From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/wg_source.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/dlls/winegstreamer/wg_source.c b/dlls/winegstreamer/wg_source.c index c43cd4a34e2..a977701d3c1 100644 --- a/dlls/winegstreamer/wg_source.c +++ b/dlls/winegstreamer/wg_source.c @@ -41,6 +41,7 @@
struct wg_source { + gchar *url; GstPad *src_pad; GstElement *container; GstSegment segment; @@ -107,6 +108,34 @@ static GstPad *create_pad_with_caps(GstPadDirection direction, GstCaps *caps) return pad; }
+static gboolean src_query_uri(struct wg_source *source, GstQuery *query) +{ + gchar *uri; + + GST_LOG("source %p, query %" GST_PTR_FORMAT, source, query); + + gst_query_parse_uri(query, &uri); + gst_query_set_uri(query, source->url); + + return true; +} + +static gboolean src_query_cb(GstPad *pad, GstObject *parent, GstQuery *query) +{ + struct wg_source *source = gst_pad_get_element_private(pad); + + switch (GST_QUERY_TYPE(query)) + { + case GST_QUERY_URI: + if (!source->url) + return false; + return src_query_uri(source, query); + default: + GST_TRACE("source %p, ignoring %" GST_PTR_FORMAT, source, query); + return gst_pad_query_default(pad, parent, query); + } +} + NTSTATUS wg_source_create(void *args) { struct wg_source_create_params *params = args; @@ -121,6 +150,7 @@ NTSTATUS wg_source_create(void *args) gst_caps_unref(src_caps); return STATUS_UNSUCCESSFUL; } + source->url = params->url ? strdup(params->url) : NULL; gst_segment_init(&source->segment, GST_FORMAT_BYTES);
if (!(source->container = gst_bin_new("wg_source"))) @@ -128,6 +158,7 @@ NTSTATUS wg_source_create(void *args) if (!(source->src_pad = create_pad_with_caps(GST_PAD_SRC, src_caps))) goto error; gst_pad_set_element_private(source->src_pad, source); + gst_pad_set_query_function(source->src_pad, src_query_cb);
if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODABLE, src_caps, GST_CAPS_ANY)) || !append_element(source->container, element, &first, &last)) @@ -161,6 +192,7 @@ error: } if (source->src_pad) gst_object_unref(source->src_pad); + free(source->url); free(source);
gst_caps_unref(src_caps); @@ -178,6 +210,7 @@ NTSTATUS wg_source_destroy(void *args) gst_element_set_state(source->container, GST_STATE_NULL); gst_object_unref(source->container); gst_object_unref(source->src_pad); + free(source->url); free(source);
return STATUS_SUCCESS;