Commit 226f8b7c authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Implement MF_LOW_LATENCY attribute and latency query.

parent 036166fa
...@@ -88,6 +88,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) ...@@ -88,6 +88,7 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
}; };
struct wg_format input_format; struct wg_format input_format;
struct wg_format output_format; struct wg_format output_format;
UINT32 low_latency;
if (decoder->wg_transform) if (decoder->wg_transform)
wg_transform_destroy(decoder->wg_transform); wg_transform_destroy(decoder->wg_transform);
...@@ -109,6 +110,9 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder) ...@@ -109,6 +110,9 @@ static HRESULT try_create_wg_transform(struct h264_decoder *decoder)
output_format.u.video.fps_d = 0; output_format.u.video.fps_d = 0;
output_format.u.video.fps_n = 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))) if (!(decoder->wg_transform = wg_transform_create(&input_format, &output_format, &attrs)))
return E_FAIL; return E_FAIL;
......
...@@ -309,6 +309,7 @@ struct wg_transform_attrs ...@@ -309,6 +309,7 @@ struct wg_transform_attrs
{ {
UINT32 output_plane_align; UINT32 output_plane_align;
UINT32 input_queue_length; UINT32 input_queue_length;
BOOL low_latency;
}; };
struct wg_transform_create_params struct wg_transform_create_params
......
...@@ -101,6 +101,26 @@ static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, Gst ...@@ -101,6 +101,26 @@ static GstFlowReturn transform_sink_chain_cb(GstPad *pad, GstObject *parent, Gst
return GST_FLOW_OK; 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) static gboolean transform_sink_query_cb(GstPad *pad, GstObject *parent, GstQuery *query)
{ {
struct wg_transform *transform = gst_pad_get_element_private(pad); struct wg_transform *transform = gst_pad_get_element_private(pad);
...@@ -312,6 +332,9 @@ NTSTATUS wg_transform_create(void *args) ...@@ -312,6 +332,9 @@ NTSTATUS wg_transform_create(void *args)
if (!transform->my_src) if (!transform->my_src)
goto out; 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))) if (!(transform->output_caps = wg_format_to_caps(&output_format)))
goto out; goto out;
if (!(template = gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, transform->output_caps))) if (!(template = gst_pad_template_new("sink", GST_PAD_SINK, GST_PAD_ALWAYS, transform->output_caps)))
......
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