From: Sebastian Dröge Date: Mon, 28 Apr 2014 07:43:32 +0000 (+0200) Subject: query: Add boolean to URI query to specify if a redirect is permanent or not X-Git-Tag: 1.3.1~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b331155e1b6defde948e844375b8d6d2d79e58f;p=platform%2Fupstream%2Fgstreamer.git query: Add boolean to URI query to specify if a redirect is permanent or not --- diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index ad1f4478b9..52262aaf37 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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 diff --git a/gst/gstquark.c b/gst/gstquark.c index 629fad2d09..cf5c766a59 100644 --- a/gst/gstquark.c +++ b/gst/gstquark.c @@ -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]; diff --git a/gst/gstquark.h b/gst/gstquark.h index 531e645bbe..98bfdd02f2 100644 --- a/gst/gstquark.h +++ b/gst/gstquark.h @@ -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]; diff --git a/gst/gstquery.c b/gst/gstquery.c index 8b6a502f51..adce934cf7 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -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 diff --git a/gst/gstquery.h b/gst/gstquery.h index 8943b8647b..58e53f4119 100644 --- a/gst/gstquery.h +++ b/gst/gstquery.h @@ -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; diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 1e00b01ab4..96f84fbe9a 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -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