query: add new redirection uri the URI query

This commit is contained in:
Andoni Morales Alastruey 2013-04-19 12:14:54 +02:00
parent 210aaabb60
commit a70b5fc16a
4 changed files with 47 additions and 2 deletions

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

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

View file

@ -1418,6 +1418,48 @@ gst_query_parse_uri (GstQuery * query, gchar ** uri)
GST_QUARK (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

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