diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-04-19 12:14:54 +0200 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2013-08-12 16:34:54 +0200 |
commit | a70b5fc16a0473a58e6a20cc498d8116e3e6eec9 (patch) | |
tree | 79a37521aee8ade9e2960ebef03a0abc63f53545 /gst | |
parent | 210aaabb608b0e9582daae3d80954db56986a61e (diff) |
query: add new redirection uri the URI query
Diffstat (limited to 'gst')
-rw-r--r-- | gst/gstquark.c | 2 | ||||
-rw-r--r-- | gst/gstquark.h | 3 | ||||
-rw-r--r-- | gst/gstquery.c | 42 | ||||
-rw-r--r-- | gst/gstquery.h | 2 |
4 files changed, 47 insertions, 2 deletions
diff --git a/gst/gstquark.c b/gst/gstquark.c index b3b621441..2f818d25a 100644 --- a/gst/gstquark.c +++ b/gst/gstquark.c @@ -68,7 +68,7 @@ static const gchar *_quark_strings[] = { "GstEventSegmentDone", "GstEventStreamStart", "stream-id", "GstEventContext", "GstQueryContext", "GstMessageNeedContext", "GstMessageHaveContext", "context", "context-types", - "GstMessageStreamStart", "group-id" + "GstMessageStreamStart", "group-id", "uri-redirection" }; GQuark _priv_gst_quark_table[GST_QUARK_MAX]; diff --git a/gst/gstquark.h b/gst/gstquark.h index cfa7e3f36..e8667e715 100644 --- a/gst/gstquark.h +++ b/gst/gstquark.h @@ -196,7 +196,8 @@ typedef enum _GstQuarkId GST_QUARK_CONTEXT_TYPES = 167, GST_QUARK_MESSAGE_STREAM_START = 168, GST_QUARK_GROUP_ID = 169, - GST_QUARK_MAX = 170 + GST_QUARK_URI_REDIRECTION = 170, + GST_QUARK_MAX = 171 } GstQuarkId; extern GQuark _priv_gst_quark_table[GST_QUARK_MAX]; diff --git a/gst/gstquery.c b/gst/gstquery.c index bba93d63b..15144c982 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -1419,6 +1419,48 @@ gst_query_parse_uri (GstQuery * query, gchar ** uri) } /** + * gst_query_set_uri_redirection: + * @query: a #GstQuery with query type GST_QUERY_URI + * @uri: the URI to set + * + * Answer a URI query by setting the requested URI redirection. + */ +void +gst_query_set_uri_redirection (GstQuery * query, const gchar * uri) +{ + GstStructure *structure; + + g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI); + g_return_if_fail (gst_query_is_writable (query)); + g_return_if_fail (gst_uri_is_valid (uri)); + + structure = GST_QUERY_STRUCTURE (query); + gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION), + G_TYPE_STRING, uri, NULL); +} + +/** + * gst_query_parse_uri_redirection: + * @query: a #GstQuery + * @uri: (out) (transfer full) (allow-none): the storage for the redirect URI + * (may be NULL) + * + * Parse an URI query, writing the URI into @uri as a newly + * allocated string, if the respective parameters are non-NULL. + * Free the string with g_free() after usage. + */ +void +gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri) +{ + GstStructure *structure; + + g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI); + + structure = GST_QUERY_STRUCTURE (query); + gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION), uri, NULL); +} + +/** * gst_query_new_allocation: * @caps: the negotiated caps * @need_pool: return a pool diff --git a/gst/gstquery.h b/gst/gstquery.h index 97234d160..7b8d58224 100644 --- a/gst/gstquery.h +++ b/gst/gstquery.h @@ -397,6 +397,8 @@ gboolean gst_query_parse_nth_buffering_range (GstQuery *query, GstQuery * gst_query_new_uri (void) G_GNUC_MALLOC; void gst_query_parse_uri (GstQuery *query, gchar **uri); void gst_query_set_uri (GstQuery *query, const gchar *uri); +void gst_query_parse_uri_redirection (GstQuery *query, gchar **uri); +void gst_query_set_uri_redirection (GstQuery *query, const gchar *uri); /* allocation query */ GstQuery * gst_query_new_allocation (GstCaps *caps, gboolean need_pool) G_GNUC_MALLOC; |