Commit 7adcdb6f authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Only filter video caps attributes when format uses 0.

In wg_transform we only want to remove width/height/framerate if the transform supports format change, and we want to keep the caps fixed otherwise so we can use gst_caps_is_always_compatible to monitor caps changes. 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=52183Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com>
parent 2ae08f03
......@@ -7200,7 +7200,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);
......
......@@ -75,6 +75,14 @@ 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;
output_format.u.video.fps_d = 0;
output_format.u.video.fps_n = 0;
if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format)))
return E_FAIL;
......
......@@ -394,11 +394,14 @@ static GstCaps *wg_format_to_caps_video(const struct wg_format *format)
gst_video_info_set_format(&info, video_format, format->u.video.width, abs(format->u.video.height));
if ((caps = gst_video_info_to_caps(&info)))
{
/* Clear some fields that shouldn't prevent us from connecting. */
for (i = 0; i < gst_caps_get_size(caps); ++i)
{
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);
if (!format->u.video.fps_d && !format->u.video.fps_n)
gst_structure_remove_fields(gst_caps_get_structure(caps, i), "framerate", NULL);
}
}
return caps;
......
......@@ -598,6 +598,7 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query)
{
GstCaps *caps, *filter, *temp;
gchar *str;
gsize i;
gst_query_parse_caps(query, &filter);
......@@ -608,6 +609,11 @@ static gboolean sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query)
if (!caps)
return FALSE;
/* Clear some fields that shouldn't prevent us from connecting. */
for (i = 0; i < gst_caps_get_size(caps); ++i)
gst_structure_remove_fields(gst_caps_get_structure(caps, i),
"framerate", "pixel-aspect-ratio", "colorimetry", "chroma-site", NULL);
str = gst_caps_to_string(caps);
GST_LOG("Stream caps are \"%s\".", str);
g_free(str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment