summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-09-19 09:49:40 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-09-19 09:49:40 +0200
commitf09b12245380083a45d1d9667aaffcbe943335ee (patch)
tree7aa3be0b38cd9c05b7fc212f2f5307c77a4b5d70
parent0ecdc31efb0ec34853eca9ab4ac9ed66985d3697 (diff)
context: Add convenience function gst_context_has_context_type()
-rw-r--r--docs/gst/gstreamer-sections.txt1
-rw-r--r--gst/gstcontext.c21
-rw-r--r--gst/gstcontext.h1
-rw-r--r--win32/common/libgstreamer.def1
4 files changed, 24 insertions, 0 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 36d7d561e..620cb1295 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -679,6 +679,7 @@ gst_context_ref
gst_context_unref
gst_context_copy
gst_context_get_context_type
+gst_context_has_context_type
gst_context_is_persistent
gst_context_get_structure
gst_context_writable_structure
diff --git a/gst/gstcontext.c b/gst/gstcontext.c
index 359526b17..d8c7e5cb5 100644
--- a/gst/gstcontext.c
+++ b/gst/gstcontext.c
@@ -191,6 +191,27 @@ gst_context_get_context_type (const GstContext * context)
}
/**
+ * gst_context_has_context_type:
+ * @context: The #GstContext.
+ * @context_type: Context type to check.
+ *
+ * Checks if @context has @context_type.
+ *
+ * Returns: %TRUE if @context has @context_type.
+ *
+ * Since: 1.2
+ */
+gboolean
+gst_context_has_context_type (const GstContext * context,
+ const gchar * context_type)
+{
+ g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (context_type != NULL, NULL);
+
+ return strcmp (context->context_type, context_type) == 0;
+}
+
+/**
* gst_context_get_structure:
* @context: The #GstContext.
*
diff --git a/gst/gstcontext.h b/gst/gstcontext.h
index 7ee3324b2..9dd091475 100644
--- a/gst/gstcontext.h
+++ b/gst/gstcontext.h
@@ -148,6 +148,7 @@ GstContext * gst_context_new (const gchar * contex
gboolean persistent) G_GNUC_MALLOC;
const gchar * gst_context_get_context_type (const GstContext * context);
+gboolean gst_context_has_context_type (const GstContext * context, const gchar * context_type);
const GstStructure * gst_context_get_structure (const GstContext * context);
GstStructure * gst_context_writable_structure (GstContext * context);
diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def
index 2ec2a69c3..6f8da1a40 100644
--- a/win32/common/libgstreamer.def
+++ b/win32/common/libgstreamer.def
@@ -305,6 +305,7 @@ EXPORTS
gst_context_get_context_type
gst_context_get_structure
gst_context_get_type
+ gst_context_has_context_type
gst_context_is_persistent
gst_context_new
gst_context_writable_structure