From e10e4795d251a20ceddd4ebb1d5995e37bf6fb2e Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 19 Apr 2021 16:03:06 +0300 Subject: [PATCH] evr/presenter: Set MF_MT_MINIMUM_DISPLAY_APERTURE when configuring mixer output. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/evr/presenter.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 868a265e3ee..42c4c81d9d3 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -309,12 +309,25 @@ static HRESULT video_presenter_set_media_type(struct video_presenter *presenter, return hr; } +static HRESULT video_presenter_configure_output_type(struct video_presenter *presenter, const MFVideoArea *aperture, + IMFMediaType *media_type) +{ + HRESULT hr; + + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)aperture->Area.cx << 32 | aperture->Area.cy); + if (SUCCEEDED(hr)) + hr = IMFMediaType_SetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)aperture, sizeof(*aperture)); + if (SUCCEEDED(hr)) + hr = IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (UINT8 *)aperture, sizeof(*aperture)); + + return hr; +} + static HRESULT video_presenter_invalidate_media_type(struct video_presenter *presenter) { IMFMediaType *media_type, *candidate_type; + MFVideoArea aperture = {{ 0 }}; unsigned int idx = 0; - UINT64 frame_size; - MFVideoArea aperture; RECT rect; HRESULT hr; @@ -332,11 +345,6 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre aperture.Area.cx = rect.right - rect.left; aperture.Area.cy = rect.bottom - rect.top; - aperture.OffsetX.value = 0; - aperture.OffsetX.fract = 0; - aperture.OffsetY.value = 0; - aperture.OffsetY.fract = 0; - frame_size = (UINT64)aperture.Area.cx << 32 | aperture.Area.cy; while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(presenter->mixer, 0, idx++, &candidate_type))) { @@ -346,10 +354,10 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre WARN("Failed to clone a media type, hr %#x.\n", hr); IMFMediaType_Release(candidate_type); - IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, frame_size); - IMFMediaType_SetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture, sizeof(aperture)); + hr = video_presenter_configure_output_type(presenter, &aperture, media_type); - hr = IMFTransform_SetOutputType(presenter->mixer, 0, media_type, MFT_SET_TYPE_TEST_ONLY); + if (SUCCEEDED(hr)) + hr = IMFTransform_SetOutputType(presenter->mixer, 0, media_type, MFT_SET_TYPE_TEST_ONLY); if (SUCCEEDED(hr)) hr = video_presenter_set_media_type(presenter, media_type);