From a70b5fc16a0473a58e6a20cc498d8116e3e6eec9 Mon Sep 17 00:00:00 2001 From: Andoni Morales Alastruey Date: Fri, 19 Apr 2013 12:14:54 +0200 Subject: [PATCH] query: add new redirection uri the URI query --- gst/gstquark.c | 2 +- gst/gstquark.h | 3 ++- gst/gstquery.c | 42 ++++++++++++++++++++++++++++++++++++++++++ gst/gstquery.h | 2 ++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/gst/gstquark.c b/gst/gstquark.c index b3b6214..2f818d2 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 cfa7e3f..e8667e7 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 bba93d6..15144c9 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 97234d1..7b8d582 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; -- 2.7.4