Merge remote-tracking branch 'origin/master' into 0.11
[platform/upstream/gstreamer.git] / gst / gstmeta.c
index d874eef..62131ad 100644 (file)
@@ -36,28 +36,33 @@ static GHashTable *metainfo = NULL;
 static GStaticRWLock lock = G_STATIC_RW_LOCK_INIT;
 
 void
-_gst_meta_init (void)
+_priv_gst_meta_initialize (void)
 {
   metainfo = g_hash_table_new (g_str_hash, g_str_equal);
 }
 
 /**
- * gst_meta_register_info:
- * @info: a #GstMetaInfo
+ * gst_meta_register:
+ * @api: the name of the #GstMeta API
+ * @impl: the name of the #GstMeta implementation
+ * @size: the size of the #GstMeta structure
+ * @init_func: a #GstMetaInitFunction
+ * @free_func: a #GstMetaFreeFunction
+ * @copy_func: a #GstMetaCopyFunction
+ * @transform_func: a #GstMetaTransformFunction
  *
- * Register a #GstMetaInfo. The same @info can be retrieved later with
- * gst_meta_get_info() by using @impl as the key.
+ * Register a new #GstMeta implementation.
  *
- * Returns: a #GstMetaInfo that can be used to access metadata.
+ * The same @info can be retrieved later with gst_meta_get_info() by using
+ * @impl as the key.
+ *
+ * Returns: (transfer none): a #GstMetaInfo that can be used to access metadata.
  */
 
 const GstMetaInfo *
 gst_meta_register (const gchar * api, const gchar * impl, gsize size,
     GstMetaInitFunction init_func, GstMetaFreeFunction free_func,
-    GstMetaCopyFunction copy_func,
-    GstMetaTransformFunction transform_func,
-    GstMetaSerializeFunction serialize_func,
-    GstMetaDeserializeFunction deserialize_func)
+    GstMetaCopyFunction copy_func, GstMetaTransformFunction transform_func)
 {
   GstMetaInfo *info;
 
@@ -67,14 +72,12 @@ gst_meta_register (const gchar * api, const gchar * impl, gsize size,
 
   info = g_slice_new (GstMetaInfo);
   info->api = g_quark_from_string (api);
-  info->impl = g_quark_from_string (impl);
+  info->type = g_pointer_type_register_static (impl);
   info->size = size;
   info->init_func = init_func;
   info->free_func = free_func;
   info->copy_func = copy_func;
   info->transform_func = transform_func;
-  info->serialize_func = serialize_func;
-  info->deserialize_func = deserialize_func;
 
   GST_DEBUG ("register \"%s\" implementing \"%s\" of size %" G_GSIZE_FORMAT,
       api, impl, size);
@@ -90,11 +93,11 @@ gst_meta_register (const gchar * api, const gchar * impl, gsize size,
  * gst_meta_get_info:
  * @impl: the name
  *
- * Lookup a previously registered meta info structure by its implementor name
+ * Lookup a previously registered meta info structure by its implementation name
  * @impl.
  *
- * Returns: a #GstMetaInfo with @impl or #NULL when no such metainfo
- * exists.
+ * Returns: (transfer none): a #GstMetaInfo with @impl, or #NULL when no such
+ * metainfo exists.
  */
 const GstMetaInfo *
 gst_meta_get_info (const gchar * impl)
@@ -109,50 +112,3 @@ gst_meta_get_info (const gchar * impl)
 
   return info;
 }
-
-/* Timing metadata */
-static void
-meta_timing_copy (GstBuffer * copybuf, GstMetaTiming * meta,
-    GstBuffer * buffer, gsize offset, gsize size)
-{
-  GstMetaTiming *timing;
-
-  GST_DEBUG ("trans called from buffer %p to %p, meta %p, %u-%u", buffer,
-      copybuf, meta, offset, size);
-
-  timing = gst_buffer_add_meta_timing (copybuf);
-  if (offset == 0) {
-    /* same offset, copy timestamps */
-    timing->pts = meta->pts;
-    timing->dts = meta->dts;
-    if (size == gst_buffer_get_size (buffer)) {
-      /* same size, copy duration */
-      timing->duration = meta->duration;
-    } else {
-      /* else clear */
-      timing->duration = GST_CLOCK_TIME_NONE;
-    }
-  } else {
-    timing->pts = -1;
-    timing->dts = -1;
-    timing->duration = -1;
-  }
-  timing->clock_rate = meta->clock_rate;
-}
-
-const GstMetaInfo *
-gst_meta_timing_get_info (void)
-{
-  static const GstMetaInfo *meta_info = NULL;
-
-  if (meta_info == NULL) {
-    meta_info = gst_meta_register ("GstMetaTiming", "GstMetaTiming",
-        sizeof (GstMetaTiming),
-        (GstMetaInitFunction) NULL,
-        (GstMetaFreeFunction) NULL,
-        (GstMetaCopyFunction) meta_timing_copy,
-        (GstMetaTransformFunction) NULL,
-        (GstMetaSerializeFunction) NULL, (GstMetaDeserializeFunction) NULL);
-  }
-  return meta_info;
-}