From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/gst_private.h | 23 +++++++++++++++++++++++ dlls/winegstreamer/video_processor.c | 22 ++++++++++++++++++++++ 2 files changed, 45 insertions(+)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 142de9bce9f..0f7d945ba37 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -43,6 +43,29 @@ bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
#define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
+static inline BOOL is_mf_video_area_empty(const MFVideoArea *area) +{ + return !area->OffsetX.value && !area->OffsetY.value && !area->Area.cx && !area->Area.cy; +} + +static inline void get_mf_video_content_rect(const MFVideoInfo *info, RECT *rect) +{ + if (!is_mf_video_area_empty(&info->MinimumDisplayAperture)) + { + rect->left = info->MinimumDisplayAperture.OffsetX.value; + rect->top = info->MinimumDisplayAperture.OffsetY.value; + rect->right = rect->left + info->MinimumDisplayAperture.Area.cx; + rect->bottom = rect->top + info->MinimumDisplayAperture.Area.cy; + } + else + { + rect->left = 0; + rect->top = 0; + rect->right = info->dwWidth; + rect->bottom = info->dwHeight; + } +} + struct wg_sample_queue;
HRESULT wg_sample_queue_create(struct wg_sample_queue **out); diff --git a/dlls/winegstreamer/video_processor.c b/dlls/winegstreamer/video_processor.c index 5555cef8303..3cb2c1a5bc6 100644 --- a/dlls/winegstreamer/video_processor.c +++ b/dlls/winegstreamer/video_processor.c @@ -91,6 +91,26 @@ struct video_processor IMFVideoSampleAllocatorEx *allocator; };
+static void update_video_aperture(MFVideoInfo *input_info, MFVideoInfo *output_info) +{ + RECT input_rect, output_rect; + + get_mf_video_content_rect(input_info, &input_rect); + get_mf_video_content_rect(output_info, &output_rect); + + if (!EqualRect(&input_rect, &output_rect)) + { + FIXME("Mismatched content size %s vs %s\n", wine_dbgstr_rect(&input_rect), + wine_dbgstr_rect(&output_rect)); + } + + input_info->MinimumDisplayAperture.OffsetX.value = input_rect.left; + input_info->MinimumDisplayAperture.OffsetY.value = input_rect.top; + input_info->MinimumDisplayAperture.Area.cx = input_rect.right - input_rect.left; + input_info->MinimumDisplayAperture.Area.cy = input_rect.bottom - input_rect.top; + output_info->MinimumDisplayAperture = input_info->MinimumDisplayAperture; +} + static HRESULT normalize_media_types(BOOL bottom_up, IMFMediaType **input_type, IMFMediaType **output_type) { MFVIDEOFORMAT *input_format, *output_format; @@ -114,6 +134,8 @@ static HRESULT normalize_media_types(BOOL bottom_up, IMFMediaType **input_type, if (bottom_up && normalize_output) output_format->videoInfo.VideoFlags |= MFVideoFlag_BottomUpLinearRep;
+ update_video_aperture(&input_format->videoInfo, &output_format->videoInfo); + if (FAILED(hr = MFCreateVideoMediaType(input_format, (IMFVideoMediaType **)input_type))) goto done; if (FAILED(hr = MFCreateVideoMediaType(output_format, (IMFVideoMediaType **)output_type)))