update for metadata API changes
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 29 Feb 2012 16:25:10 +0000 (17:25 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 29 Feb 2012 16:25:10 +0000 (17:25 +0100)
12 files changed:
ext/theora/gsttheoradec.c
gst-libs/gst/audio/gstaudiometa.c
gst-libs/gst/audio/gstaudiometa.h
gst-libs/gst/video/gstvideofilter.c
gst-libs/gst/video/gstvideometa.c
gst-libs/gst/video/gstvideometa.h
sys/ximage/ximagepool.c
sys/ximage/ximagepool.h
sys/ximage/ximagesink.c
sys/xvimage/xvimagepool.c
sys/xvimage/xvimagepool.h
sys/xvimage/xvimagesink.c

index 91e8a3b..d3f7dbd 100644 (file)
@@ -818,7 +818,7 @@ theora_negotiate_pool (GstTheoraDec * dec, GstCaps * caps, GstVideoInfo * info)
 
   /* check if downstream supports cropping */
   dec->has_cropping =
-      gst_query_has_allocation_meta (query, GST_VIDEO_CROP_META_API);
+      gst_query_has_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
 
   GST_DEBUG_OBJECT (dec, "downstream cropping %d", dec->has_cropping);
 
index 51a6f8b..4c303b5 100644 (file)
@@ -151,18 +151,30 @@ gst_buffer_add_audio_downmix_meta (GstBuffer * buffer,
   return meta;
 }
 
+GType
+gst_audio_downmix_meta_api_get_type (void)
+{
+  static volatile GType type;
+  static const gchar *tags[] = { NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstAudioDownmixMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
 const GstMetaInfo *
 gst_audio_downmix_meta_get_info (void)
 {
   static const GstMetaInfo *audio_downmix_meta_info = NULL;
-  static const gchar *tags[] = { NULL };
 
   if (audio_downmix_meta_info == NULL) {
     audio_downmix_meta_info =
-        gst_meta_register (GST_AUDIO_DOWNMIX_META_API, "GstAudioDownmixMeta",
-        sizeof (GstAudioDownmixMeta),
-        gst_audio_downmix_meta_init,
-        gst_audio_downmix_meta_free, gst_audio_downmix_meta_transform, tags);
+        gst_meta_register (GST_AUDIO_DOWNMIX_META_API_TYPE,
+        "GstAudioDownmixMeta", sizeof (GstAudioDownmixMeta),
+        gst_audio_downmix_meta_init, gst_audio_downmix_meta_free,
+        gst_audio_downmix_meta_transform);
   }
   return audio_downmix_meta_info;
 }
index a87710f..822972b 100644 (file)
@@ -26,8 +26,9 @@
 
 G_BEGIN_DECLS
 
-#define GST_AUDIO_DOWNMIX_META_API   "GstAudioDownmixMeta"
+#define GST_AUDIO_DOWNMIX_META_API_TYPE (gst_audio_downmix_meta_api_get_type())
 #define GST_AUDIO_DOWNMIX_META_INFO  (gst_audio_downmix_meta_get_info())
+
 typedef struct _GstAudioDownmixMeta GstAudioDownmixMeta;
 
 /**
@@ -57,6 +58,7 @@ struct _GstAudioDownmixMeta {
   gfloat       **matrix;
 };
 
+GType gst_audio_downmix_meta_api_get_type (void);
 const GstMetaInfo * gst_audio_downmix_meta_get_info (void);
 
 #define gst_buffer_get_audio_downmix_meta(b) ((GstAudioDownmixMeta*)gst_buffer_get_meta((b),GST_AUDIO_DOWNMIX_META_INFO))
index c42ddcf..97bda07 100644 (file)
@@ -92,7 +92,7 @@ gst_video_filter_propose_allocation (GstBaseTransform * trans,
   gst_query_set_allocation_params (query, size, 0, 0, 0, 15, pool);
   gst_object_unref (pool);
 
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API);
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
 
   return TRUE;
 
index 67f0d2b..e1f35ef 100644 (file)
@@ -48,18 +48,30 @@ gst_video_meta_transform (GstBuffer * dest, GstMeta * meta,
   return TRUE;
 }
 
+GType
+gst_video_meta_api_get_type (void)
+{
+  static volatile GType type = 0;
+  static const gchar *tags[] = { "memory", "colorspace", "size", NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstVideoMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
 /* video metadata */
 const GstMetaInfo *
 gst_video_meta_get_info (void)
 {
   static const GstMetaInfo *video_meta_info = NULL;
-  static const gchar *tags[] = { "memory", "colorspace", "size", NULL };
 
   if (video_meta_info == NULL) {
-    video_meta_info = gst_meta_register (GST_VIDEO_META_API, "GstVideoMeta",
-        sizeof (GstVideoMeta),
-        (GstMetaInitFunction) NULL,
-        (GstMetaFreeFunction) NULL, gst_video_meta_transform, tags);
+    video_meta_info =
+        gst_meta_register (GST_VIDEO_META_API_TYPE, "GstVideoMeta",
+        sizeof (GstVideoMeta), (GstMetaInitFunction) NULL,
+        (GstMetaFreeFunction) NULL, gst_video_meta_transform);
   }
   return video_meta_info;
 }
@@ -306,17 +318,29 @@ gst_video_crop_meta_transform (GstBuffer * dest, GstMeta * meta,
   return TRUE;
 }
 
+GType
+gst_video_crop_meta_api_get_type (void)
+{
+  static volatile GType type = 0;
+  static const gchar *tags[] = { "size", "orientation", NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstVideoCropMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
 const GstMetaInfo *
 gst_video_crop_meta_get_info (void)
 {
   static const GstMetaInfo *video_crop_meta_info = NULL;
-  static const gchar *tags[] = { "size", "orientation", NULL };
 
   if (video_crop_meta_info == NULL) {
     video_crop_meta_info =
-        gst_meta_register (GST_VIDEO_CROP_META_API, "GstVideoCropMeta",
+        gst_meta_register (GST_VIDEO_CROP_META_API_TYPE, "GstVideoCropMeta",
         sizeof (GstVideoCropMeta), (GstMetaInitFunction) NULL,
-        (GstMetaFreeFunction) NULL, gst_video_crop_meta_transform, tags);
+        (GstMetaFreeFunction) NULL, gst_video_crop_meta_transform);
   }
   return video_crop_meta_info;
 }
index 62f7694..dae8d34 100644 (file)
 
 G_BEGIN_DECLS
 
-#define GST_VIDEO_META_API   "GstVideoMeta"
+#define GST_VIDEO_META_API_TYPE (gst_video_meta_api_get_type())
 #define GST_VIDEO_META_INFO  (gst_video_meta_get_info())
 typedef struct _GstVideoMeta GstVideoMeta;
 
-#define GST_VIDEO_CROP_META_API   "GstVideoCropMeta"
+#define GST_VIDEO_CROP_META_API_TYPE  (gst_video_crop_meta_api_get_type())
 #define GST_VIDEO_CROP_META_INFO  (gst_video_crop_meta_get_info())
 typedef struct _GstVideoCropMeta GstVideoCropMeta;
 
@@ -73,9 +73,10 @@ struct _GstVideoMeta {
   gboolean (*unmap)  (GstVideoMeta *meta, guint plane, GstMapInfo *info);
 };
 
+GType gst_video_meta_api_get_type (void);
 const GstMetaInfo * gst_video_meta_get_info (void);
 
-#define gst_buffer_get_video_meta(b) ((GstVideoMeta*)gst_buffer_get_meta((b),GST_VIDEO_META_INFO))
+#define gst_buffer_get_video_meta(b) ((GstVideoMeta*)gst_buffer_get_meta((b),GST_VIDEO_META_API_TYPE))
 GstVideoMeta * gst_buffer_get_video_meta_id    (GstBuffer *buffer, gint id);
 
 GstVideoMeta * gst_buffer_add_video_meta       (GstBuffer *buffer, GstVideoFlags flags,
@@ -108,9 +109,10 @@ struct _GstVideoCropMeta {
   guint         height;
 };
 
+GType gst_video_crop_meta_api_get_type (void);
 const GstMetaInfo * gst_video_crop_meta_get_info (void);
 
-#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_INFO))
+#define gst_buffer_get_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_get_meta((b),GST_VIDEO_CROP_META_API_TYPE))
 #define gst_buffer_add_video_crop_meta(b) ((GstVideoCropMeta*)gst_buffer_add_meta((b),GST_VIDEO_CROP_META_INFO, NULL))
 
 G_END_DECLS
index 53cf145..02c47a5 100644 (file)
@@ -49,19 +49,31 @@ struct _GstXImageBufferPoolPrivate
 static void gst_ximage_meta_free (GstXImageMeta * meta, GstBuffer * buffer);
 
 /* ximage metadata */
+GType
+gst_ximage_meta_api_get_type (void)
+{
+  static volatile GType type;
+  static const gchar *tags[] =
+      { "memory", "size", "colorspace", "orientation", NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstXImageMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
 const GstMetaInfo *
 gst_ximage_meta_get_info (void)
 {
   static const GstMetaInfo *ximage_meta_info = NULL;
-  static const gchar *tags[] =
-      { "memory", "size", "colorspace", "orientation", NULL };
 
   if (ximage_meta_info == NULL) {
-    ximage_meta_info = gst_meta_register ("GstXImageMeta", "GstXImageMeta",
-        sizeof (GstXImageMeta),
-        (GstMetaInitFunction) NULL,
+    ximage_meta_info =
+        gst_meta_register (GST_XIMAGE_META_API_TYPE, "GstXImageMeta",
+        sizeof (GstXImageMeta), (GstMetaInitFunction) NULL,
         (GstMetaFreeFunction) gst_ximage_meta_free,
-        (GstMetaTransformFunction) NULL, tags);
+        (GstMetaTransformFunction) NULL);
   }
   return ximage_meta_info;
 }
index 4027b6f..22b359f 100644 (file)
@@ -46,11 +46,12 @@ typedef struct _GstXImageBufferPoolClass GstXImageBufferPoolClass;
 typedef struct _GstXImageBufferPoolPrivate GstXImageBufferPoolPrivate;
 
 #include "ximagesink.h"
-
+GType gst_ximage_meta_api_get_type (void);
+#define GST_XIMAGE_META_API_TYPE  (gst_ximage_meta_api_get_type())
 const GstMetaInfo * gst_ximage_meta_get_info (void);
 #define GST_XIMAGE_META_INFO  (gst_ximage_meta_get_info())
 
-#define gst_buffer_get_ximage_meta(b) ((GstXImageMeta*)gst_buffer_get_meta((b),GST_XIMAGE_META_INFO))
+#define gst_buffer_get_ximage_meta(b) ((GstXImageMeta*)gst_buffer_get_meta((b),GST_XIMAGE_META_API_TYPE))
 
 /**
  * GstXImageMeta:
index bf2cc01..af2f64b 100644 (file)
@@ -1471,8 +1471,8 @@ gst_ximagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
   gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
 
   /* we also support various metadata */
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API);
-  gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API);
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
+  gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
 
   gst_object_unref (pool);
 
index d5f4d2f..32d1612 100644 (file)
@@ -52,19 +52,31 @@ struct _GstXvImageBufferPoolPrivate
 static void gst_xvimage_meta_free (GstXvImageMeta * meta, GstBuffer * buffer);
 
 /* xvimage metadata */
+GType
+gst_xvimage_meta_api_get_type (void)
+{
+  static volatile GType type;
+  static const gchar *tags[] =
+      { "memory", "size", "colorspace", "orientation", NULL };
+
+  if (g_once_init_enter (&type)) {
+    GType _type = gst_meta_api_type_register ("GstXvImageMetaAPI", tags);
+    g_once_init_leave (&type, _type);
+  }
+  return type;
+}
+
 const GstMetaInfo *
 gst_xvimage_meta_get_info (void)
 {
   static const GstMetaInfo *xvimage_meta_info = NULL;
-  static const gchar *tags[] =
-      { "memory", "size", "colorspace", "orientation", NULL };
 
   if (xvimage_meta_info == NULL) {
-    xvimage_meta_info = gst_meta_register ("GstXvImageMeta", "GstXvImageMeta",
-        sizeof (GstXvImageMeta),
-        (GstMetaInitFunction) NULL,
+    xvimage_meta_info =
+        gst_meta_register (GST_XVIMAGE_META_API_TYPE, "GstXvImageMeta",
+        sizeof (GstXvImageMeta), (GstMetaInitFunction) NULL,
         (GstMetaFreeFunction) gst_xvimage_meta_free,
-        (GstMetaTransformFunction) NULL, tags);
+        (GstMetaTransformFunction) NULL);
   }
   return xvimage_meta_info;
 }
index 0f2a95d..335ae81 100644 (file)
@@ -47,10 +47,12 @@ typedef struct _GstXvImageBufferPoolPrivate GstXvImageBufferPoolPrivate;
 
 #include "xvimagesink.h"
 
+GType gst_xvimage_meta_api_get_type (void);
+#define GST_XVIMAGE_META_API_TYPE  (gst_xvimage_meta_api_get_type())
 const GstMetaInfo * gst_xvimage_meta_get_info (void);
 #define GST_XVIMAGE_META_INFO  (gst_xvimage_meta_get_info())
 
-#define gst_buffer_get_xvimage_meta(b) ((GstXvImageMeta*)gst_buffer_get_meta((b),GST_XVIMAGE_META_INFO))
+#define gst_buffer_get_xvimage_meta(b) ((GstXvImageMeta*)gst_buffer_get_meta((b),GST_XVIMAGE_META_API_TYPE))
 
 /**
  * GstXvImageMeta:
index a273b8e..205fa0d 100644 (file)
@@ -1980,8 +1980,8 @@ gst_xvimagesink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
   gst_query_set_allocation_params (query, size, 2, 0, 0, 0, pool);
 
   /* we also support various metadata */
-  gst_query_add_allocation_meta (query, GST_VIDEO_META_API);
-  gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API);
+  gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
+  gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE);
 
   gst_object_unref (pool);