query: Add boolean to URI query to specify if a redirect is permanent or not

This commit is contained in:
Sebastian Dröge 2014-04-28 09:43:32 +02:00
parent e3e1b0eac7
commit 3b331155e1
6 changed files with 62 additions and 2 deletions

View 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

View 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];

View 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];

View 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

View 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;

View 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