diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-16 15:16:16 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-16 15:16:16 +0200 |
commit | 356ef049d30479b6bcaee9a7cd78e9ca436ec365 (patch) | |
tree | b9244a878e5a8ea1b0f7a958612afe9f439635b0 | |
parent | 0dc232e1140be953e920388c54dd4cfa0d7637e0 (diff) |
query: Add gst_query_has_context_type()
-rw-r--r-- | docs/gst/gstreamer-sections.txt | 1 | ||||
-rw-r--r-- | gst/gstquery.c | 38 | ||||
-rw-r--r-- | gst/gstquery.h | 1 | ||||
-rw-r--r-- | win32/common/libgstreamer.def | 1 |
4 files changed, 37 insertions, 4 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 49c31cf86..2626cf328 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -2376,6 +2376,7 @@ gst_query_parse_context gst_query_add_context_type gst_query_get_n_context_types gst_query_parse_nth_context_type +gst_query_has_context_type <SUBSECTION Standard> GstQueryClass GST_QUERY diff --git a/gst/gstquery.c b/gst/gstquery.c index d5f296284..564e244e1 100644 --- a/gst/gstquery.c +++ b/gst/gstquery.c @@ -2503,7 +2503,7 @@ free_array_string (gpointer ptr) /** * gst_query_add_context_type: - * @query: a GST_QUERY_NEED_CONTEXT type query + * @query: a GST_QUERY_CONTEXT type query * @context_type: a context type * * Add a new context type to @query. @@ -2528,7 +2528,7 @@ gst_query_add_context_type (GstQuery * query, const gchar * context_type) /** * gst_query_get_n_context_types: - * @query: a GST_QUERY_NEED_CONTEXT type query + * @query: a GST_QUERY_CONTEXT type query * * Retrieve the number of values currently stored in the * context-types array of the query's structure. @@ -2552,10 +2552,10 @@ gst_query_get_n_context_types (GstQuery * query) /** * gst_query_parse_nth_context_type: - * @query: a GST_QUERY_NEED_CONTEXT type query + * @query: a GST_QUERY_CONTEXT type query * @context_type: (out) (allow-none): the context type, or NULL * - * Parse a context type from an existing GST_QUERY_NEED_CONTEXT query + * Parse a context type from an existing GST_QUERY_CONTEXT query * from @index. * * Returns: a #gboolean indicating if the parsing succeeded. @@ -2580,3 +2580,33 @@ gst_query_parse_nth_context_type (GstQuery * query, guint index, return TRUE; } + +/** + * gst_query_has_context_type: + * @query: a GST_QUERY_CONTEXT type query + * @context_type: the context type + * + * Check if @query is asking for @context_type. + * + * Returns: %TRUE if @context_type is requested. + */ +gboolean +gst_query_has_context_type (GstQuery * query, const gchar * context_type) +{ + guint i, n; + + g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONTEXT, FALSE); + g_return_val_if_fail (context_type != NULL, FALSE); + + n = gst_query_get_n_context_types (query); + for (i = 0; i < n; i++) { + const gchar *tmp; + + if (gst_query_parse_nth_context_type (query, i, &tmp) && + strcmp (tmp, context_type) == 0) + return TRUE; + } + + + return FALSE; +} diff --git a/gst/gstquery.h b/gst/gstquery.h index 57a9c0622..e956a2aa6 100644 --- a/gst/gstquery.h +++ b/gst/gstquery.h @@ -487,6 +487,7 @@ GstQuery * gst_query_new_context (void) G_GNUC_MALLOC; void gst_query_add_context_type (GstQuery * query, const gchar * context_type); guint gst_query_get_n_context_types (GstQuery * query); gboolean gst_query_parse_nth_context_type (GstQuery * query, guint i, const gchar ** context_type); +gboolean gst_query_has_context_type (GstQuery * query, const gchar * context_type); void gst_query_set_context (GstQuery *query, GstContext *context); void gst_query_parse_context (GstQuery *query, GstContext **context); diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index 4f89ad16c..f6e9ec447 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -922,6 +922,7 @@ EXPORTS gst_query_get_n_scheduling_modes gst_query_get_structure gst_query_get_type + gst_query_has_context_type gst_query_has_scheduling_mode gst_query_has_scheduling_mode_with_flags gst_query_new_accept_caps |