From 31461202c1ee2979f88f9642192ab53a2bc7e8cf Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Fri, 26 Mar 2010 13:19:51 +1000 Subject: Don't specify a BottomToTop scan line direction for YUV frames. A positive image height is supposed to indicate BottomToTop scan line direction, but this would seem to be true for RGB formats. Reviewed-by: Dmytro Poplavskiy --- .../directshow/mediaplayer/directshowmediatype.cpp | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp index cf6d45b..f8f519d 100644 --- a/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp +++ b/src/plugins/mediaservices/directshow/mediaplayer/directshowmediatype.cpp @@ -130,9 +130,17 @@ QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &typ if (header->AvgTimePerFrame > 0) format.setFrameRate(10000 /header->AvgTimePerFrame); - format.setScanLineDirection(header->bmiHeader.biHeight < 0 - ? QVideoSurfaceFormat::TopToBottom - : QVideoSurfaceFormat::BottomToTop); + switch (qt_typeLookup[i].pixelFormat) { + case QVideoFrame::Format_RGB32: + case QVideoFrame::Format_BGR24: + case QVideoFrame::Format_RGB565: + case QVideoFrame::Format_RGB555: + if (header->bmiHeader.biHeight >= 0) + format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); + break; + default: + break; + } return format; } else if (IsEqualGUID(type.formattype, FORMAT_VideoInfo2)) { @@ -145,9 +153,17 @@ QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &typ if (header->AvgTimePerFrame > 0) format.setFrameRate(10000 / header->AvgTimePerFrame); - format.setScanLineDirection(header->bmiHeader.biHeight < 0 - ? QVideoSurfaceFormat::TopToBottom - : QVideoSurfaceFormat::BottomToTop); + switch (qt_typeLookup[i].pixelFormat) { + case QVideoFrame::Format_RGB32: + case QVideoFrame::Format_BGR24: + case QVideoFrame::Format_RGB565: + case QVideoFrame::Format_RGB555: + if (header->bmiHeader.biHeight >= 0) + format.setScanLineDirection(QVideoSurfaceFormat::BottomToTop); + break; + default: + break; + } return format; } -- cgit v0.12