GNOME Bugzilla – Bug 562949
[API] Add an URI query type for querying the source/sink URI
Last modified: 2008-12-20 17:38:22 UTC
Hi, the attached patch adds an URI query type and some functions to handle them. This query will be implemented by sinks/sources to query the current URI and will be used for example by demuxers for formats that can reference other files to get the current URI and create a new src pipeline with the URI of the referenced other file. The second patch adds this to filesrc/filesink/fdsrc/fdsink
Created attachment 123777 [details] [review] gstquery-uri.patch
Created attachment 123778 [details] [review] gstquery-uri-implementation.patch
Created attachment 123779 [details] [review] gstquery-uri.patch Add const qualifier to the URI parameter of gst_query_set_uri()
Created attachment 123782 [details] [review] gstquery-uri-implementation-base.patch Implementation for gio and gnomevfs.
- what would the semantics of the query be when done as element query on the top-level pipeline? (Pass on to most source-like element? Don't support at all?) - maybe add an gst_uri_is_valid guard to _set_uri?
(In reply to comment #5) > - what would the semantics of the query be when done > as element query on the top-level pipeline? (Pass on > to most source-like element? Don't support at all?) How do we handle position or duration query in that case? Pass on to the most sink-like element? Well, passing it to the most source-like element sounds good IMHO > - maybe add an gst_uri_is_valid guard to _set_uri? Good point, I'll add that before committing.
(In reply to comment #6) > (In reply to comment #5) > > - what would the semantics of the query be when done > > as element query on the top-level pipeline? (Pass on > > to most source-like element? Don't support at all?) > > How do we handle position or duration query in that case? Pass on to the most > sink-like element? > > Well, passing it to the most source-like element sounds good IMHO Thinking about it a bit more it's probably better to not handle this case. This query is mostly useful from elements inside a pipeline where the query is then sent upstream or downstream, depending on the pad where it was received until some element is reached that can answer the query or return FALSE. The semantic should probably be to send this query upstream or downstream, depending on receiving pad until it reaches an element that can answer the query. Sending directly to an element should give the URI if the element has one and return FALSE otherwise (and not forward anywhere). What do you think?
This query should travel upstream. when executed from the app it should be sent to the sinks.
(In reply to comment #8) > This query should travel upstream. when executed from the app it should be sent > to the sinks. But this would mean, that we restrict the query to the URI of the source(s) and that it can't be used to query the sink location
It also assumes that there's only one result, so maybe we should just make gst_element_query() return FALSE by default for now (and elements like playbin can then override that if they want to). I don't think this is a blocker in any case, was just wondering how it would work in that case.
I think that when the app does a query on the pipeline it would be most interested in the uri of the source. I'm just talking about the default behaviour of the URI query, the query can still go downstream because a query is never restricted to one direction only.
Ok, shall I commit the patches then (+ the valid URI check)?
Well, I'll commit them later ;)
2008-12-20 Sebastian Dröge <sebastian.droege@collabora.co.uk> * docs/gst/gstreamer-sections.txt: * gst/gstquark.c: * gst/gstquark.h: * gst/gstquery.c: (gst_query_new_uri), (gst_query_set_uri), (gst_query_parse_uri): * gst/gstquery.h: API: Add URI query type. This is useful to query the URI of a sink/source element and can be used by demuxers that need to get data from other files. This query should go upstream by default. Fixes bug #562949. * plugins/elements/gstfdsink.c: (gst_fd_sink_query): * plugins/elements/gstfdsrc.c: (gst_fd_src_class_init), (gst_fd_src_query): * plugins/elements/gstfilesink.c: (gst_file_sink_query): * plugins/elements/gstfilesrc.c: (gst_file_src_class_init), (gst_file_src_query): Implement URI query. 2008-12-20 Sebastian Dröge <sebastian.droege@collabora.co.uk> * ext/gio/gstgiobasesink.c: (gst_gio_base_sink_query): * ext/gio/gstgiobasesrc.c: (gst_gio_base_src_class_init), (gst_gio_base_src_query): * ext/gnomevfs/gstgnomevfssink.c: (gst_gnome_vfs_sink_query): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_class_init), (gst_gnome_vfs_src_query): Implement URI query. Fixes bug #562949.