+/**
+ * gst_meta_api_type_has_tag:
+ * @api: an API
+ * @tag: the tag to check
+ *
+ * Check if @api was registered with @tag.
+ *
+ * Returns: %TRUE if @api was registered with @tag.
+ */
+gboolean
+gst_meta_api_type_has_tag (GType api, GQuark tag)
+{
+ g_return_val_if_fail (api != 0, FALSE);
+ g_return_val_if_fail (tag != 0, FALSE);
+
+ return g_type_get_qdata (api, tag) != NULL;
+}
+
+/**
+ * gst_meta_api_type_get_tags:
+ * @api: an API
+ *
+ * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): an array of tags as strings.
+ *
+ * Since: 1.2
+ */
+const gchar *const *
+gst_meta_api_type_get_tags (GType api)
+{
+ const gchar **tags;
+ g_return_val_if_fail (api != 0, FALSE);
+
+ tags = g_type_get_qdata (api, g_quark_from_string ("tags"));
+
+ if (!tags[0])
+ return NULL;
+
+ return (const gchar * const *) tags;
+}
+
+/**
+ * gst_meta_register:
+ * @api: the type of the #GstMeta API
+ * @impl: the name of the #GstMeta implementation
+ * @size: the size of the #GstMeta structure
+ * @init_func: (scope async): a #GstMetaInitFunction
+ * @free_func: (scope async): a #GstMetaFreeFunction
+ * @transform_func: (scope async): a #GstMetaTransformFunction
+ *
+ * Register a new #GstMeta implementation.
+ *
+ * The same @info can be retrieved later with gst_meta_get_info() by using
+ * @impl as the key.
+ *
+ * Returns: (transfer none) (nullable): a #GstMetaInfo that can be used to
+ * access metadata.
+ */
+
+const GstMetaInfo *
+gst_meta_register (GType api, const gchar * impl, gsize size,
+ GstMetaInitFunction init_func, GstMetaFreeFunction free_func,
+ GstMetaTransformFunction transform_func)
+{
+ GstMetaInfo *info;
+ GType type;
+
+ g_return_val_if_fail (api != 0, NULL);
+ g_return_val_if_fail (impl != NULL, NULL);
+ g_return_val_if_fail (size != 0, NULL);
+
+ if (init_func == NULL)
+ g_critical ("Registering meta implementation '%s' without init function",
+ impl);
+
+ /* first try to register the implementation name. It's possible
+ * that this fails because it was already registered. Don't warn,
+ * glib did this for us already. */
+ type = g_pointer_type_register_static (impl);
+ if (type == 0)
+ return NULL;
+
+ info = g_slice_new (GstMetaInfo);
+ info->api = api;
+ info->type = type;
+ info->size = size;
+ info->init_func = init_func;
+ info->free_func = free_func;
+ info->transform_func = transform_func;
+
+ GST_CAT_DEBUG (GST_CAT_META,
+ "register \"%s\" implementing \"%s\" of size %" G_GSIZE_FORMAT, impl,
+ g_type_name (api), size);
+
+ g_rw_lock_writer_lock (&lock);
+ g_hash_table_insert (metainfo, (gpointer) impl, (gpointer) info);
+ g_rw_lock_writer_unlock (&lock);
+
+ return info;
+}
+
+/**
+ * gst_meta_get_info:
+ * @impl: the name
+ *
+ * Lookup a previously registered meta info structure by its implementation name
+ * @impl.
+ *
+ * Returns: (transfer none) (nullable): a #GstMetaInfo with @impl, or
+ * %NULL when no such metainfo exists.
+ */
+const GstMetaInfo *
+gst_meta_get_info (const gchar * impl)
+{
+ GstMetaInfo *info;
+
+ g_return_val_if_fail (impl != NULL, NULL);
+
+ g_rw_lock_reader_lock (&lock);
+ info = g_hash_table_lookup (metainfo, impl);
+ g_rw_lock_reader_unlock (&lock);
+
+ return info;
+}
+
+/**
+ * gst_meta_get_seqnum:
+ * @meta: a #GstMeta
+ *
+ * Gets seqnum for this meta.
+ *
+ * Since: 1.16
+ */
+guint64
+gst_meta_get_seqnum (const GstMeta * meta)
+{
+ GstMetaItem *meta_item;
+ guint8 *p;
+
+ g_return_val_if_fail (meta != NULL, 0);
+
+ p = (guint8 *) meta;
+ p -= G_STRUCT_OFFSET (GstMetaItem, meta);
+ meta_item = (GstMetaItem *) p;
+ return meta_item->seq_num;
+}
+
+/**
+ * gst_meta_compare_seqnum:
+ * @meta1: a #GstMeta
+ * @meta2: a #GstMeta
+ *
+ * Meta sequence number compare function. Can be used as #GCompareFunc
+ * or a #GCompareDataFunc.
+ *
+ * Returns: a negative number if @meta1 comes before @meta2, 0 if both metas
+ * have an equal sequence number, or a positive integer if @meta1 comes
+ * after @meta2.
+ *
+ * Since: 1.16
+ */
+gint
+gst_meta_compare_seqnum (const GstMeta * meta1, const GstMeta * meta2)
+{
+ guint64 seqnum1 = gst_meta_get_seqnum (meta1);
+ guint64 seqnum2 = gst_meta_get_seqnum (meta2);
+
+ if (seqnum1 == seqnum2)
+ return 0;