[PATCH 2/5] winegstreamer: Remove width/height from caps when format uses 0.
Rémi Bernon
wine at gitlab.winehq.org
Mon May 2 16:24:39 CDT 2022
From: Rémi Bernon <rbernon at codeweavers.com>
To support formats with no forced width/height in the H264 transform.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/mf/tests/mf.c | 2 +-
dlls/winegstreamer/h264_decoder.c | 6 ++++++
dlls/winegstreamer/wg_format.c | 4 ++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 75c873d5dc0..4d7ca4d825c 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -6979,7 +6979,7 @@ static void test_h264_decoder(void)
"got status %#lx\n", status);
hr = IMFSample_GetTotalLength(output.pSample, &length);
ok(hr == S_OK, "GetTotalLength returned %#lx\n", hr);
- todo_wine_if(length == 1920 * 1080 * 3 / 2)
+ todo_wine
ok(length == 0, "got length %lu\n", length);
ret = IMFSample_Release(output.pSample);
ok(ret == 0, "Release returned %lu\n", ret);
diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c
index b98f137eb82..52d0fbaef27 100644
--- a/dlls/winegstreamer/h264_decoder.c
+++ b/dlls/winegstreamer/h264_decoder.c
@@ -74,6 +74,12 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
if (output_format.major_type == WG_MAJOR_TYPE_UNKNOWN)
return MF_E_INVALIDMEDIATYPE;
+ /* Don't force any specific size, H264 streams already have the metadata for it
+ * and will generate a MF_E_TRANSFORM_STREAM_CHANGE result later.
+ */
+ output_format.u.video.width = 0;
+ output_format.u.video.height = 0;
+
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
return E_FAIL;
diff --git a/dlls/winegstreamer/wg_format.c b/dlls/winegstreamer/wg_format.c
index ff9238a6a69..7f3b2b0a7dd 100644
--- a/dlls/winegstreamer/wg_format.c
+++ b/dlls/winegstreamer/wg_format.c
@@ -390,6 +390,10 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format)
{
gst_structure_remove_fields(gst_caps_get_structure(caps, i),
"framerate", "pixel-aspect-ratio", "colorimetry", "chroma-site", NULL);
+ if (!format->u.video.width)
+ gst_structure_remove_fields(gst_caps_get_structure(caps, i), "width", NULL);
+ if (!format->u.video.height)
+ gst_structure_remove_fields(gst_caps_get_structure(caps, i), "height", NULL);
}
}
return caps;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/22
More information about the wine-devel
mailing list