From 502c12f8274ba97e96c8b2501550201199fdb49c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 29 Feb 2012 17:25:10 +0100 Subject: [PATCH] update for metadata API changes --- ext/theora/gsttheoradec.c | 2 +- gst-libs/gst/audio/gstaudiometa.c | 22 +++++++++++++++----- gst-libs/gst/audio/gstaudiometa.h | 4 +++- gst-libs/gst/video/gstvideofilter.c | 2 +- gst-libs/gst/video/gstvideometa.c | 40 +++++++++++++++++++++++++++++-------- gst-libs/gst/video/gstvideometa.h | 10 ++++++---- sys/ximage/ximagepool.c | 24 ++++++++++++++++------ sys/ximage/ximagepool.h | 5 +++-- sys/ximage/ximagesink.c | 4 ++-- sys/xvimage/xvimagepool.c | 24 ++++++++++++++++------ sys/xvimage/xvimagepool.h | 4 +++- sys/xvimage/xvimagesink.c | 4 ++-- 12 files changed, 106 insertions(+), 39 deletions(-) diff --git a/ext/theora/gsttheoradec.c b/ext/theora/gsttheoradec.c index 91e8a3b..d3f7dbd 100644 --- a/ext/theora/gsttheoradec.c +++ b/ext/theora/gsttheoradec.c @@ -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); diff --git a/gst-libs/gst/audio/gstaudiometa.c b/gst-libs/gst/audio/gstaudiometa.c index 51a6f8b..4c303b5 100644 --- a/gst-libs/gst/audio/gstaudiometa.c +++ b/gst-libs/gst/audio/gstaudiometa.c @@ -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; } diff --git a/gst-libs/gst/audio/gstaudiometa.h b/gst-libs/gst/audio/gstaudiometa.h index a87710f..822972b 100644 --- a/gst-libs/gst/audio/gstaudiometa.h +++ b/gst-libs/gst/audio/gstaudiometa.h @@ -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)) diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index c42ddcf..97bda07 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -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; diff --git a/gst-libs/gst/video/gstvideometa.c b/gst-libs/gst/video/gstvideometa.c index 67f0d2b..e1f35ef 100644 --- a/gst-libs/gst/video/gstvideometa.c +++ b/gst-libs/gst/video/gstvideometa.c @@ -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; } diff --git a/gst-libs/gst/video/gstvideometa.h b/gst-libs/gst/video/gstvideometa.h index 62f7694..dae8d34 100644 --- a/gst-libs/gst/video/gstvideometa.h +++ b/gst-libs/gst/video/gstvideometa.h @@ -26,11 +26,11 @@ 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 diff --git a/sys/ximage/ximagepool.c b/sys/ximage/ximagepool.c index 53cf145..02c47a5 100644 --- a/sys/ximage/ximagepool.c +++ b/sys/ximage/ximagepool.c @@ -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; } diff --git a/sys/ximage/ximagepool.h b/sys/ximage/ximagepool.h index 4027b6f..22b359f 100644 --- a/sys/ximage/ximagepool.h +++ b/sys/ximage/ximagepool.h @@ -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: diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index bf2cc01..af2f64b 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -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); diff --git a/sys/xvimage/xvimagepool.c b/sys/xvimage/xvimagepool.c index d5f4d2f..32d1612 100644 --- a/sys/xvimage/xvimagepool.c +++ b/sys/xvimage/xvimagepool.c @@ -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; } diff --git a/sys/xvimage/xvimagepool.h b/sys/xvimage/xvimagepool.h index 0f2a95d..335ae81 100644 --- a/sys/xvimage/xvimagepool.h +++ b/sys/xvimage/xvimagepool.h @@ -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: diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index a273b8e..205fa0d 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -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); -- 2.7.4