query: add new redirection uri the URI query
authorAndoni Morales Alastruey <ylatuya@gmail.com>
Fri, 19 Apr 2013 10:14:54 +0000 (12:14 +0200)
committerAndoni Morales Alastruey <ylatuya@gmail.com>
Mon, 12 Aug 2013 14:34:54 +0000 (16:34 +0200)
gst/gstquark.c
gst/gstquark.h
gst/gstquery.c
gst/gstquery.h

index b3b6214..2f818d2 100644 (file)
@@ -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];
index cfa7e3f..e8667e7 100644 (file)
@@ -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];
index bba93d6..15144c9 100644 (file)
@@ -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
index 97234d1..7b8d582 100644 (file)
@@ -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;