From 9eeef48b5a534edca5cdcd8207d8091c75cc96a5 Mon Sep 17 00:00:00 2001 From: jpark37 Date: Mon, 13 Jan 2020 21:50:54 -0800 Subject: [PATCH] win-dshow: Fix upside-down RGB DIBs Fix regression to RGB DIB orientation according to MSDN. --- plugins/win-dshow/win-dshow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/win-dshow/win-dshow.cpp b/plugins/win-dshow/win-dshow.cpp index 57cd45dd1..5b4b51daf 100644 --- a/plugins/win-dshow/win-dshow.cpp +++ b/plugins/win-dshow/win-dshow.cpp @@ -539,8 +539,13 @@ void DShowInput::OnVideoData(const VideoConfig &config, unsigned char *data, frame.format = ConvertVideoFormat(config.format); frame.flip = flip; - if (config.cy_flip) - frame.flip = !frame.flip; + /* YUV DIBS are always top-down */ + if (config.format == VideoFormat::XRGB || + config.format == VideoFormat::ARGB) { + /* RGB DIBs are bottom-up by default */ + if (!config.cy_flip) + frame.flip = !frame.flip; + } if (videoConfig.format == VideoFormat::XRGB || videoConfig.format == VideoFormat::ARGB) {