From 7c02cd8cf8e1b97df8f8bfddfeba68d7c7b4f820 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 2 Nov 2021 00:12:58 -0500 Subject: [PATCH] winegstreamer: Set rcSource and rcTarget for WMF video formats. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/gst_private.h | 2 +- dlls/winegstreamer/quartz_parser.c | 29 +++++++++++++++++------------ dlls/winegstreamer/wm_reader.c | 4 ++-- dlls/wmvcore/tests/wmvcore.c | 4 ++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 109ce6ab28f..f11543d7fb2 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -101,7 +101,7 @@ HRESULT decodebin_parser_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN HRESULT mpeg_splitter_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; HRESULT wave_parser_create(IUnknown *outer, IUnknown **out) DECLSPEC_HIDDEN; -bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format); +bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm); bool amt_to_wg_format(const AM_MEDIA_TYPE *mt, struct wg_format *format); BOOL init_gstreamer(void) DECLSPEC_HIDDEN; diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 4e7e22a64ea..77a186bbb26 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -275,7 +275,7 @@ static unsigned int get_image_size(const struct wg_format *format) return 0; } -static bool amt_from_wg_format_video(AM_MEDIA_TYPE *mt, const struct wg_format *format) +static bool amt_from_wg_format_video(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm) { static const struct { @@ -322,6 +322,11 @@ static bool amt_from_wg_format_video(AM_MEDIA_TYPE *mt, const struct wg_format * memset(video_format, 0, sizeof(*video_format)); + if (wm) + { + SetRect(&video_format->rcSource, 0, 0, format->u.video.width, format->u.video.height); + video_format->rcTarget = video_format->rcSource; + } if ((frame_time = MulDiv(10000000, format->u.video.fps_d, format->u.video.fps_n)) != -1) video_format->AvgTimePerFrame = frame_time; video_format->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); @@ -343,7 +348,7 @@ static bool amt_from_wg_format_video(AM_MEDIA_TYPE *mt, const struct wg_format * return true; } -bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format) +bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format, bool wm) { memset(mt, 0, sizeof(*mt)); @@ -356,7 +361,7 @@ bool amt_from_wg_format(AM_MEDIA_TYPE *mt, const struct wg_format *format) return amt_from_wg_format_audio(mt, format); case WG_MAJOR_TYPE_VIDEO: - return amt_from_wg_format_video(mt, format); + return amt_from_wg_format_video(mt, format, wm); } assert(0); @@ -1076,7 +1081,7 @@ static HRESULT decodebin_parser_source_get_media_type(struct parser_source *pin, memset(mt, 0, sizeof(AM_MEDIA_TYPE)); - if (amt_from_wg_format(mt, &format)) + if (amt_from_wg_format(mt, &format, false)) { if (!index--) return S_OK; @@ -1086,14 +1091,14 @@ static HRESULT decodebin_parser_source_get_media_type(struct parser_source *pin, if (format.major_type == WG_MAJOR_TYPE_VIDEO && index < ARRAY_SIZE(video_formats)) { format.u.video.format = video_formats[index]; - if (!amt_from_wg_format(mt, &format)) + if (!amt_from_wg_format(mt, &format, false)) return E_OUTOFMEMORY; return S_OK; } else if (format.major_type == WG_MAJOR_TYPE_AUDIO && !index) { format.u.audio.format = WG_AUDIO_FORMAT_S16LE; - if (!amt_from_wg_format(mt, &format)) + if (!amt_from_wg_format(mt, &format, false)) return E_OUTOFMEMORY; return S_OK; } @@ -1613,7 +1618,7 @@ static HRESULT wave_parser_source_query_accept(struct parser_source *pin, const HRESULT hr; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(&pad_mt, &format)) + if (!amt_from_wg_format(&pad_mt, &format, false)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1628,7 +1633,7 @@ static HRESULT wave_parser_source_get_media_type(struct parser_source *pin, if (index > 0) return VFW_S_NO_MORE_ITEMS; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(mt, &format)) + if (!amt_from_wg_format(mt, &format, false)) return E_OUTOFMEMORY; return S_OK; } @@ -1699,7 +1704,7 @@ static HRESULT avi_splitter_source_query_accept(struct parser_source *pin, const HRESULT hr; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(&pad_mt, &format)) + if (!amt_from_wg_format(&pad_mt, &format, false)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1714,7 +1719,7 @@ static HRESULT avi_splitter_source_get_media_type(struct parser_source *pin, if (index > 0) return VFW_S_NO_MORE_ITEMS; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(mt, &format)) + if (!amt_from_wg_format(mt, &format, false)) return E_OUTOFMEMORY; return S_OK; } @@ -1783,7 +1788,7 @@ static HRESULT mpeg_splitter_source_query_accept(struct parser_source *pin, cons HRESULT hr; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(&pad_mt, &format)) + if (!amt_from_wg_format(&pad_mt, &format, false)) return E_OUTOFMEMORY; hr = compare_media_types(mt, &pad_mt) ? S_OK : S_FALSE; FreeMediaType(&pad_mt); @@ -1798,7 +1803,7 @@ static HRESULT mpeg_splitter_source_get_media_type(struct parser_source *pin, if (index > 0) return VFW_S_NO_MORE_ITEMS; wg_parser_stream_get_preferred_format(pin->wg_stream, &format); - if (!amt_from_wg_format(mt, &format)) + if (!amt_from_wg_format(mt, &format, false)) return E_OUTOFMEMORY; return S_OK; } diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 82f74318062..1d46db3fb0d 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -157,7 +157,7 @@ static IWMOutputMediaProps *output_props_create(const struct wg_format *format) object->IWMOutputMediaProps_iface.lpVtbl = &output_props_vtbl; object->refcount = 1; - if (!amt_from_wg_format(&object->mt, format)) + if (!amt_from_wg_format(&object->mt, format, true)) { free(object); return NULL; @@ -338,7 +338,7 @@ static HRESULT WINAPI stream_config_GetStreamType(IWMStreamConfig *iface, GUID * EnterCriticalSection(&reader->cs); - if (!amt_from_wg_format(&mt, &config->stream->format)) + if (!amt_from_wg_format(&mt, &config->stream->format, true)) { LeaveCriticalSection(&reader->cs); return E_OUTOFMEMORY; diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 6e196234208..469666161a4 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -629,8 +629,8 @@ static void check_video_type(const WM_MEDIA_TYPE *mt) todo_wine ok(!mt->bTemporalCompression, "Got temporal compression %d.\n", mt->bTemporalCompression); ok(!mt->pUnk, "Got pUnk %p.\n", mt->pUnk); - todo_wine ok(EqualRect(&video_info->rcSource, &rect), "Got source rect %s.\n", wine_dbgstr_rect(&rect)); - todo_wine ok(EqualRect(&video_info->rcTarget, &rect), "Got target rect %s.\n", wine_dbgstr_rect(&rect)); + ok(EqualRect(&video_info->rcSource, &rect), "Got source rect %s.\n", wine_dbgstr_rect(&rect)); + ok(EqualRect(&video_info->rcTarget, &rect), "Got target rect %s.\n", wine_dbgstr_rect(&rect)); ok(!video_info->dwBitRate, "Got bit rate %u.\n", video_info->dwBitRate); ok(!video_info->dwBitErrorRate, "Got bit error rate %u.\n", video_info->dwBitErrorRate); ok(video_info->bmiHeader.biSize == sizeof(video_info->bmiHeader),