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 ad1f4478b98118e58b8b26e02893f8c3a2352b0f..52262aaf37c19d1ae0df0c7037b19c2391d46c4e 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 629fad2d09015dd275a0e0c4bd51e18222af17d5..cf5c766a5969a7eef9f8434cc5d3dd3f9d6eb8be 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 531e645bbe4c804f2c235904d45223f40a05dd3d..98bfdd02f2de19baaf8c468575bd815309a6f94b 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 8b6a502f51ff2f81c9e44f81180e04cefee61c3f..adce934cf7f30373b11d94c7209e742ac6de8dd0 100644 (file)
@@ -1461,6 +1461,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
index 8943b8647bc6194fd167f7f9393d9713ecd99c39..58e53f41190a4820715140380ab57c4cce62ea4a 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 1e00b01ab40011020acf9c7abd93352541734383..96f84fbe9a6b806de4966fd1cfdbae08ff0bf6e7 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