update for metadata API changes

This commit is contained in:
Wim Taymans 2012-02-29 17:26:01 +01:00
parent dda3219e4c
commit 9c789aa434
6 changed files with 37 additions and 11 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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