GNOME Bugzilla – Bug 774830
uri: Add new uri API to get URI fragment as table
Last modified: 2016-12-06 20:30:16 UTC
As an usecase of URI fragment, it can indicate temporal or spatial dimension of a media stream. To easily parse key-value pair, newly added gst_uri_get_fragment_table () API will provide the table of key-value pair likewise URI query.
Created attachment 340490 [details] [review] uri: Add new uri API to get URI fragment as table
MPEGDASH requires URI fragment based MPD Anchor feature. For example, any mpds start play from 10 Sec if URI fragment is set "t=10" Not only for MPEGDASH, Media Fragments URI 1.0 (https://www.w3.org/TR/media-frags/) is saying that URI fragment can set some playback features using URI. For the future generic usage of it in Gstreamer, I think this API is needed.
Review of attachment 340490 [details] [review]: ::: gst/gsturi.c @@ +2822,3 @@ + */ +GHashTable * +gst_uri_get_fragment_table (const GstUri * uri) As this is not defined in the URI spec itself, this should specifically mention what it's doing and based on. Maybe something like get_media_fragment_table()? Should also mention the link to the spec in the docs. @@ +2828,3 @@ + if (!uri->fragment) + return NULL; + return _gst_uri_string_to_table (uri->fragment, "&", "=", TRUE, TRUE); Is that really enough? I didn't read the spec but that seems a bit simple :)
(In reply to Sebastian Dröge (slomo) from comment #3) > Review of attachment 340490 [details] [review] [review]: Thanks for your attention of my report :) > Maybe something like get_media_fragment_table()? Should also mention the > link to the spec in the docs. get_media_fragment_table() is more correct expression. Note that, how query "key-value" should be parsed is not defined by URI spec, though. > @@ +2828,3 @@ > + if (!uri->fragment) > + return NULL; > + return _gst_uri_string_to_table (uri->fragment, "&", "=", TRUE, TRUE); > > Is that really enough? I didn't read the spec but that seems a bit simple :) If only "Media Fragments URI 1.0" is concerned, it's enough. Actually, GstUri's "URI query" is doing exactly same as this.
Created attachment 340569 [details] [review] uri: Add new uri API to get media fragments URI as table - Change API name to gst_uri_get_media_fragment_table() - Add some comment about what is doing and how.
Isn't returning a hash table going to be awkward for bindings?
(In reply to Tim-Philipp Müller from comment #6) > Isn't returning a hash table going to be awkward for bindings? Can I get some more information about "be awkward for bindings", please? If your intention was concerning for a kind of case that "what happen if non-Media Fragment URI but just URI Fragment was parsed and converted to hash table?", my answer is that unexpected "key-value" pair will be returned. For example, "http://foo/var/file#&&=afragment" will be converted to key = "" (null string) and value = "afragment". This API cannot guarantee the "validity" of returned "key-value" pair (such as null key value case), but just do split of URI fragment string based on "&" and "=". For unknown extended standard that might be somewhere, It is doubtful whether it should be validated. As an expanded usecase what I know for [&, = driven "key-pair" rule] is MPEGDASH. It's defining "period" and "as" as a keys but which are undefined keys by Media Fragments URI 1.0.
I was talking about gobject-introspection and python bindings and such.
(In reply to Tim-Philipp Müller from comment #8) > I was talking about gobject-introspection and python bindings and such. Sorry for late replay. Since I has no experiance about gobject-introspection or pygobject, it's difficault to answer your question... But, they seems to support GHashTable when I googling about them.
Hash tables should be fine, and it's what is used in the API for similar things already.
Review of attachment 340569 [details] [review]: Looks good to me under those considerations. Tim?
Oh, ok, I missed the fact that bindings can handle this already and that there are annotations for it, sorry! commit 0494c173e0b72005146195ca001771a0cd8eb5ba Author: Seungha Yang <sh.yang@lge.com> Date: Tue Nov 22 16:52:46 2016 +0900 uri: Add new uri API to get media fragments URI as table As an usecase of URI fragment, it can indicate temporal or spatial dimension of a media stream. To easily parse key-value pair, newly added gst_uri_get_media_fragment_table () API will provide the table of key-value pair likewise URI query. See also https://www.w3.org/TR/media-frags/ https://bugzilla.gnome.org/show_bug.cgi?id=774830