summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2017-11-16 15:02:23 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2017-12-08 13:25:08 +0000
commit10304528c20fb9a385c617a38b6be35d1b18598a (patch)
tree1bfd06e4f4e2a31bfbfb9920503286423b3c8291
parentc0931a0709748f2483aeea17555d6953b6f28417 (diff)
downloadqtmultimedia-10304528c20fb9a385c617a38b6be35d1b18598a.tar.gz
DirectShow: Use pixel aspect ratio
Originally pixel aspect ratio was clearing (set to 1,1) within renegotiating the media type. Which caused samples with not standard pixel aspect ratio (1,1) to be rendered with black squares on the top and the bottom. (Original size was kept but PAR cleared) Added a fix to keep PAR while adjusting the media type to optimal one and set original PAR to QVideoSurfaceFormat. Task-number: QTBUG-64438 Change-Id: I6d1a5c441b89bbd5cea86667cc570bb7eb19068b Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
-rw-r--r--src/plugins/common/evr/evrcustompresenter.cpp7
-rw-r--r--src/plugins/common/evr/evrd3dpresentengine.cpp4
2 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp
index 958204079..b07dbe719 100644
--- a/src/plugins/common/evr/evrcustompresenter.cpp
+++ b/src/plugins/common/evr/evrcustompresenter.cpp
@@ -1350,13 +1350,6 @@ HRESULT EVRCustomPresenter::createOptimalVideoType(IMFMediaType *proposedType, I
// Modify the new type.
- // Set the pixel aspect ratio (PAR) to 1:1 (see assumption #1, above)
- // The ratio is packed in a single UINT64. A helper function is normally available for
- // that (MFSetAttributeRatio) but it's not correctly defined in MinGW 4.9.1.
- hr = mtOptimal->SetUINT64(MF_MT_PIXEL_ASPECT_RATIO, (((UINT64) 1) << 32) | ((UINT64) 1));
- if (FAILED(hr))
- goto done;
-
hr = proposedType->GetUINT64(MF_MT_FRAME_SIZE, &size);
width = int(HI32(size));
height = int(LO32(size));
diff --git a/src/plugins/common/evr/evrd3dpresentengine.cpp b/src/plugins/common/evr/evrd3dpresentengine.cpp
index fd9ccdef1..32d0acf91 100644
--- a/src/plugins/common/evr/evrd3dpresentengine.cpp
+++ b/src/plugins/common/evr/evrd3dpresentengine.cpp
@@ -518,6 +518,10 @@ done:
: qt_evr_pixelFormatFromD3DFormat(d3dFormat),
m_useTextureRendering ? QAbstractVideoBuffer::GLTextureHandle
: QAbstractVideoBuffer::NoHandle);
+ UINT32 horizontal = 1, vertical = 1;
+ hr = MFGetAttributeRatio(format, MF_MT_PIXEL_ASPECT_RATIO, &horizontal, &vertical);
+ if (SUCCEEDED(hr))
+ m_surfaceFormat.setPixelAspectRatio(horizontal, vertical);
} else {
releaseResources();
}