query: Add boolean to URI query to specify if a redirect is permanent or not
authorSebastian Dröge <sebastian@centricular.com>
Mon, 28 Apr 2014 07:43:32 +0000 (09:43 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 28 Apr 2014 08:03:15 +0000 (10:03 +0200)
docs/gst/gstreamer-sections.txt
gst/gstquark.c
gst/gstquark.h
gst/gstquery.c
gst/gstquery.h
win32/common/libgstreamer.def

index ad1f447..52262aa 100644 (file)
@@ -2372,6 +2372,8 @@ gst_query_parse_uri
 gst_query_set_uri
 gst_query_parse_uri_redirection
 gst_query_set_uri_redirection
+gst_query_parse_uri_redirection_permanent
+gst_query_set_uri_redirection_permanent
 
 gst_query_new_allocation
 gst_query_parse_allocation
index 629fad2..cf5c766 100644 (file)
@@ -69,7 +69,8 @@ static const gchar *_quark_strings[] = {
   "GstEventStreamStart", "stream-id", "GstQueryContext",
   "GstMessageNeedContext", "GstMessageHaveContext", "context", "context-type",
   "GstMessageStreamStart", "group-id", "uri-redirection",
-  "GstMessageDeviceAdded", "GstMessageDeviceRemoved", "device"
+  "GstMessageDeviceAdded", "GstMessageDeviceRemoved", "device",
+  "uri-redirection-permanent"
 };
 
 GQuark _priv_gst_quark_table[GST_QUARK_MAX];
index 531e645..98bfdd0 100644 (file)
@@ -199,7 +199,8 @@ typedef enum _GstQuarkId
   GST_QUARK_MESSAGE_DEVICE_ADDED = 170,
   GST_QUARK_MESSAGE_DEVICE_REMOVED = 171,
   GST_QUARK_DEVICE = 172,
-  GST_QUARK_MAX = 173
+  GST_QUARK_URI_REDIRECTION_PERMANENT = 173,
+  GST_QUARK_MAX = 174
 } GstQuarkId;
 
 extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];
index 8b6a502..adce934 100644 (file)
@@ -1462,6 +1462,58 @@ gst_query_parse_uri_redirection (GstQuery * query, gchar ** uri)
 }
 
 /**
+ * gst_query_set_uri_redirection_permanent:
+ * @query: a #GstQuery with query type GST_QUERY_URI
+ * @permanent: whether the redirect is permanent or not
+ *
+ * Answer a URI query by setting the requested URI redirection
+ * to permanent or not.
+ *
+ * Since: 1.4
+ */
+void
+gst_query_set_uri_redirection_permanent (GstQuery * query, gboolean permanent)
+{
+  GstStructure *structure;
+
+  g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
+  g_return_if_fail (gst_query_is_writable (query));
+
+  structure = GST_QUERY_STRUCTURE (query);
+  gst_structure_id_set (structure, GST_QUARK (URI_REDIRECTION_PERMANENT),
+      G_TYPE_BOOLEAN, permanent, NULL);
+}
+
+/**
+ * gst_query_parse_uri_redirection_permanent:
+ * @query: a #GstQuery
+ * @permanent: (out) (allow-none): if the URI redirection is permanent
+ *     (may be NULL)
+ *
+ * Parse an URI query, and set @permanent to %TRUE if there is a redirection
+ * and it should be considered permanent. If a redirection is permanent,
+ * applications should update their internal storage of the URI, otherwise
+ * they should make all future requests to the original URI.
+ *
+ * Since: 1.4
+ */
+void
+gst_query_parse_uri_redirection_permanent (GstQuery * query,
+    gboolean * permanent)
+{
+  GstStructure *structure;
+
+  g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
+
+  structure = GST_QUERY_STRUCTURE (query);
+  if (permanent) {
+    if (!gst_structure_id_get (structure, GST_QUARK (URI_REDIRECTION_PERMANENT),
+            G_TYPE_BOOLEAN, permanent, NULL))
+      *permanent = FALSE;
+  }
+}
+
+/**
  * gst_query_new_allocation:
  * @caps: the negotiated caps
  * @need_pool: return a pool
index 8943b86..58e53f4 100644 (file)
@@ -399,6 +399,8 @@ void            gst_query_parse_uri                  (GstQuery *query, gchar **u
 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);
+void            gst_query_parse_uri_redirection_permanent (GstQuery *query, gboolean * permanent);
+void            gst_query_set_uri_redirection_permanent (GstQuery *query, gboolean permanent);
 
 /* allocation query */
 GstQuery *      gst_query_new_allocation             (GstCaps *caps, gboolean need_pool) G_GNUC_MALLOC;
index 1e00b01..96f84fb 100644 (file)
@@ -1023,6 +1023,7 @@ EXPORTS
        gst_query_parse_segment
        gst_query_parse_uri
        gst_query_parse_uri_redirection
+       gst_query_parse_uri_redirection_permanent
        gst_query_remove_nth_allocation_meta
        gst_query_remove_nth_allocation_param
        gst_query_remove_nth_allocation_pool
@@ -1045,6 +1046,7 @@ EXPORTS
        gst_query_set_segment
        gst_query_set_uri
        gst_query_set_uri_redirection
+       gst_query_set_uri_redirection_permanent
        gst_query_type_flags_get_type
        gst_query_type_get_flags
        gst_query_type_get_name