diff --git a/sys/applemedia/coremediabuffer.c b/sys/applemedia/coremediabuffer.c index b5e199f8a8..63ef6116b5 100644 --- a/sys/applemedia/coremediabuffer.c +++ b/sys/applemedia/coremediabuffer.c @@ -31,13 +31,26 @@ gst_core_media_meta_free (GstCoreMediaMeta * meta, GstBuffer * buf) g_object_unref (meta->ctx); } +GType +gst_core_media_meta_api_get_type (void) +{ + static volatile GType type; + static const gchar *tags[] = { "memory", NULL }; + + if (g_once_init_enter (&type)) { + GType _type = gst_meta_api_type_register ("GstCoreMediaMetaAPI", tags); + g_once_init_leave (&type, _type); + } + return type; +} + static const GstMetaInfo * gst_core_media_meta_get_info (void) { static const GstMetaInfo *core_media_meta_info = NULL; if (core_media_meta_info == NULL) { - core_media_meta_info = gst_meta_register ("GstCoreMediaeMeta", + core_media_meta_info = gst_meta_register (GST_CORE_MEDIA_META_API_TYPE, "GstCoreMediaMeta", sizeof (GstCoreMediaMeta), (GstMetaInitFunction) NULL, (GstMetaFreeFunction) gst_core_media_meta_free, @@ -122,7 +135,7 @@ CVPixelBufferRef gst_core_media_buffer_get_pixel_buffer (GstBuffer * buf) { GstCoreMediaMeta *meta = (GstCoreMediaMeta *) gst_buffer_get_meta (buf, - gst_core_media_meta_get_info ()); + GST_CORE_MEDIA_META_API_TYPE); g_return_val_if_fail (meta != NULL, NULL); return meta->ctx->cv->CVPixelBufferRetain (meta->pixel_buf); diff --git a/sys/applemedia/coremediabuffer.h b/sys/applemedia/coremediabuffer.h index 1b7b8dd00b..e04f206a27 100644 --- a/sys/applemedia/coremediabuffer.h +++ b/sys/applemedia/coremediabuffer.h @@ -25,6 +25,9 @@ #include "coremediactx.h" G_BEGIN_DECLS +#define GST_CORE_MEDIA_META_API_TYPE (gst_core_media_meta_api_get_type()) +#define gst_buffer_get_core_media_meta(b) \ + ((GstCoreVideoMeta*)gst_buffer_get_meta((b),GST_CORE_MEDIA_META_API_TYPE)) typedef struct _GstCoreMediaMeta { @@ -42,6 +45,7 @@ GstBuffer * gst_core_media_buffer_new (GstCoreMediaCtx * ctx, CMSampleBufferRef sample_buf); CVPixelBufferRef gst_core_media_buffer_get_pixel_buffer (GstBuffer * buf); +GType gst_core_media_meta_api_get_type (void); G_END_DECLS