From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mf/tests/transform.c | 12 ++---------- dlls/winegstreamer/h264_decoder.c | 4 ++++ dlls/winegstreamer/unixlib.h | 1 + dlls/winegstreamer/wg_transform.c | 23 +++++++++++++++++++++++ 4 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index a8e1cc83c62..168c7afb43c 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4026,7 +4026,6 @@ static void test_h264_decoder_concat_streams(void) const struct buffer_desc output_buffer_desc[] = { {.length = 0x3600}, - {.length = 0x3600, .todo_length = TRUE}, {.length = 0x4980}, }; const struct attribute_desc output_sample_attributes[] = @@ -4039,18 +4038,12 @@ static void test_h264_decoder_concat_streams(void) { .attributes = output_sample_attributes + 0, .sample_time = 0, .sample_duration = 333667, - .buffer_count = 1, .buffers = output_buffer_desc + 0, .repeat_count = 57, - }, - { - .attributes = output_sample_attributes + 0, - .sample_time = 19352666, .sample_duration = 333667, - .buffer_count = 1, .buffers = output_buffer_desc + 1, .repeat_count = 1, - .todo_length = TRUE, + .buffer_count = 1, .buffers = output_buffer_desc + 0, .repeat_count = 59, }, { .attributes = output_sample_attributes + 0, .sample_time = 60 * 333667, .sample_duration = 333667, - .buffer_count = 1, .buffers = output_buffer_desc + 2, .repeat_count = 59, + .buffer_count = 1, .buffers = output_buffer_desc + 1, .repeat_count = 59, }, };
@@ -4150,7 +4143,6 @@ static void test_h264_decoder_concat_streams(void)
hr = IMFCollection_GetElementCount(output_samples, &count); ok(hr == S_OK, "GetElementCount returned %#lx\n", hr); - todo_wine ok(count >= 0x77, "GetElementCount returned %#lx\n", count);
ret = check_mf_sample_collection(output_samples, output_sample_desc, NULL); diff --git a/dlls/winegstreamer/h264_decoder.c b/dlls/winegstreamer/h264_decoder.c index bcb9f341aaa..ab4d883d0df 100644 --- a/dlls/winegstreamer/h264_decoder.c +++ b/dlls/winegstreamer/h264_decoder.c @@ -87,6 +87,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) }; struct wg_format input_format; struct wg_format output_format; + UINT32 low_latency;
if (decoder->wg_transform) wg_transform_destroy(decoder->wg_transform); @@ -108,6 +109,9 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) output_format.u.video.fps_d = 0; output_format.u.video.fps_n = 0;
+ if (SUCCEEDED(IMFAttributes_GetUINT32(decoder->attributes, &MF_LOW_LATENCY, &low_latency))) + attrs.low_latency = !!low_latency; + if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs))) return E_FAIL;
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h index 938319faea7..a9892bf9d4f 100644 --- a/dlls/winegstreamer/unixlib.h +++ b/dlls/winegstreamer/unixlib.h @@ -309,6 +309,7 @@ struct wg_transform_attrs { UINT32 output_plane_align; UINT32 input_queue_length; + BOOL low_latency; };
struct wg_transform_create_params diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c index 4ea68dd5a75..76dbc31ff74 100644 --- a/dlls/winegstreamer/wg_transform.c +++ b/dlls/winegstreamer/wg_transform.c @@ -106,6 +106,26 @@ static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, Gst return GST_FLOW_OK; }
+static gboolean transform_src_query_latency(struct wg_transform *transform, GstQuery *query) +{ + GST_LOG("transform %p, query %p", transform, query); + gst_query_set_latency(query, transform->attrs.low_latency, 0, 0); + return true; +} + +static gboolean transform_src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +{ + struct wg_transform *transform = gst_pad_get_element_private(pad); + + switch (query->type) + { + case GST_QUERY_LATENCY: + return transform_src_query_latency(transform, query); + default: + return gst_pad_query_default(pad, parent, query); + } +} + static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) { struct wg_transform *transform = gst_pad_get_element_private(pad); @@ -321,6 +341,9 @@ NTSTATUS wg_transform_create(void *args) if (!transform->my_src) goto out;
+ gst_pad_set_element_private(transform->my_src, transform); + gst_pad_set_query_function(transform->my_src, transform_src_query_cb); + if (!(transform->output_caps = wg_format_to_caps(&output_format))) goto out; if (!(template = gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, transform->output_caps)))