update for metadata API changes

This commit is contained in:
Wim Taymans 2012-02-29 17:25:10 +01:00
parent 337cfb764a
commit 502c12f827
12 changed files with 106 additions and 39 deletions

View 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);

View 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;
}

View 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))

View 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;

View 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;
}

View file

@ -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

View 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;
}

View 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:

View 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);

View 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;
}

View 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:

View 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);