From 9c789aa434d43b1983d5e6b58bbad744981a6a64 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 Feb 2012 17:26:01 +0100 Subject: [PATCH] update for metadata API changes --- sys/v4l2/gstv4l2bufferpool.c | 18 +++++++++++++++--- sys/v4l2/gstv4l2bufferpool.h | 3 ++- sys/v4l2/gstv4l2sink.c | 4 ++-- sys/v4l2/gstv4l2src.c | 2 +- sys/ximage/ximageutil.c | 18 +++++++++++++++--- sys/ximage/ximageutil.h | 3 ++- 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 6c77cec422..7a68926657 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -57,17 +57,29 @@ GST_DEBUG_CATEGORY_EXTERN (v4l2_debug); /* * GstV4l2Buffer: */ +GType +gst_v4l2_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 ("GstV4l2MetaAPI", tags); + g_once_init_leave (&type, _type); + } + return type; +} + const GstMetaInfo * gst_v4l2_meta_get_info (void) { static const GstMetaInfo *meta_info = NULL; - static const gchar *tags[] = { "memory" }; if (meta_info == NULL) { meta_info = - gst_meta_register ("GstV4l2Meta", "GstV4l2Meta", + gst_meta_register (gst_v4l2_meta_api_get_type (), "GstV4l2Meta", sizeof (GstV4l2Meta), (GstMetaInitFunction) NULL, - (GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL, tags); + (GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL); } return meta_info; } diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h index 12d3ccc7df..5503628174 100644 --- a/sys/v4l2/gstv4l2bufferpool.h +++ b/sys/v4l2/gstv4l2bufferpool.h @@ -79,8 +79,9 @@ struct _GstV4l2Meta { struct v4l2_buffer vbuffer; }; +GType gst_v4l2_meta_api_get_type (void); const GstMetaInfo * gst_v4l2_meta_get_info (void); -#define GST_V4L2_META_GET(buf) ((GstV4l2Meta *)gst_buffer_get_meta(buf,gst_v4l2_meta_get_info())) +#define GST_V4L2_META_GET(buf) ((GstV4l2Meta *)gst_buffer_get_meta(buf,gst_v4l2_meta_api_get_type())) #define GST_V4L2_META_ADD(buf) ((GstV4l2Meta *)gst_buffer_add_meta(buf,gst_v4l2_meta_get_info(),NULL)) GType gst_v4l2_buffer_pool_get_type (void); diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 5e1e2d0d28..bcb0bb4a5f 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -653,8 +653,8 @@ gst_v4l2sink_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); if (pool) gst_object_unref (pool); diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 4e29931ba3..5722bdea84 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -571,7 +571,7 @@ gst_v4l2src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query) alignment); /* if downstream supports video metadata, add this to the pool config */ - if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API)) + if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); diff --git a/sys/ximage/ximageutil.c b/sys/ximage/ximageutil.c index 84cc01a5ae..907aa3aefd 100644 --- a/sys/ximage/ximageutil.c +++ b/sys/ximage/ximageutil.c @@ -23,17 +23,29 @@ #include "ximageutil.h" +GType +gst_meta_ximage_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 ("GstMetaXImageSrcAPI", tags); + g_once_init_leave (&type, _type); + } + return type; +} + const GstMetaInfo * gst_meta_ximage_get_info (void) { static const GstMetaInfo *meta_ximage_info = NULL; - static const gchar *tags[] = { "memory", NULL }; if (meta_ximage_info == NULL) { meta_ximage_info = - gst_meta_register ("GstMetaXImageSrc", "GstMetaXImageSrc", + gst_meta_register (gst_meta_ximage_api_get_type (), "GstMetaXImageSrc", sizeof (GstMetaXImage), (GstMetaInitFunction) NULL, - (GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL, tags); + (GstMetaFreeFunction) NULL, (GstMetaTransformFunction) NULL); } return meta_ximage_info; } diff --git a/sys/ximage/ximageutil.h b/sys/ximage/ximageutil.h index aa674de8fa..aa03e7a857 100644 --- a/sys/ximage/ximageutil.h +++ b/sys/ximage/ximageutil.h @@ -160,8 +160,9 @@ struct _GstMetaXImage { BufferReturnFunc return_func; }; +GType gst_meta_ximage_api_get_type (void); const GstMetaInfo * gst_meta_ximage_get_info (void); -#define GST_META_XIMAGE_GET(buf) ((GstMetaXImage *)gst_buffer_get_meta(buf,gst_meta_ximage_get_info())) +#define GST_META_XIMAGE_GET(buf) ((GstMetaXImage *)gst_buffer_get_meta(buf,gst_meta_ximage_api_get_type())) #define GST_META_XIMAGE_ADD(buf) ((GstMetaXImage *)gst_buffer_add_meta(buf,gst_meta_ximage_get_info(),NULL)) GstBuffer *gst_ximageutil_ximage_new (GstXContext *xcontext,