meta: add method to check for a tag
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 28 Feb 2012 11:52:00 +0000 (12:52 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 28 Feb 2012 11:52:00 +0000 (12:52 +0100)
gst/gstmeta.c
gst/gstmeta.h
win32/common/libgstreamer.def

index ed68a23..db69933 100644 (file)
@@ -126,3 +126,27 @@ gst_meta_get_info (const gchar * impl)
 
   return info;
 }
+
+/*
+ * gst_meta_info_has_tag:
+ * @info: a #GstMetaInfo
+ * @tag: a #GQuark
+ *
+ * Check if @info contains @tag.
+ *
+ * Returns: %TRUE when @info contains @tag.
+ */
+gboolean
+gst_meta_info_has_tag (const GstMetaInfo * info, GQuark tag)
+{
+  gint i;
+
+  g_return_val_if_fail (info != NULL, FALSE);
+  g_return_val_if_fail (tag != 0, FALSE);
+
+  for (i = 0; info->tags[i]; i++)
+    if (info->tags[i] == tag)
+      return TRUE;
+
+  return FALSE;
+}
index 2c70a36..e4ce17f 100644 (file)
@@ -190,6 +190,8 @@ const GstMetaInfo *  gst_meta_register        (const gchar *api, const gchar *im
                                                const gchar **tags);
 const GstMetaInfo *  gst_meta_get_info        (const gchar * impl);
 
+gboolean             gst_meta_info_has_tag    (const GstMetaInfo *info, GQuark tag);
+
 G_END_DECLS
 
 #endif /* __GST_META_H__ */
index 42e0af3..ce0c515 100644 (file)
@@ -586,6 +586,7 @@ EXPORTS
        gst_message_type_to_quark
        gst_meta_flags_get_type
        gst_meta_get_info
+       gst_meta_info_has_tag
        gst_meta_register
        gst_mini_object_copy
        gst_mini_object_flags_get_type