meta: fix for new API

This commit is contained in:
Wim Taymans 2011-02-27 19:43:13 +01:00
parent f229f4d192
commit 9c08bde90b
7 changed files with 20 additions and 18 deletions

View file

@ -109,7 +109,8 @@ gst_meta_fenced_get_info (void)
return meta_fenced_info; return meta_fenced_info;
} }
#define GST_META_FENCED_GET(buf,create) ((GstMetaFenced *)gst_buffer_get_meta(buf,gst_meta_fenced_get_info(),create)); #define GST_META_FENCED_GET(buf) ((GstMetaFenced *)gst_buffer_get_meta(buf,gst_meta_fenced_get_info()))
#define GST_META_FENCED_ADD(buf) ((GstMetaFenced *)gst_buffer_add_meta(buf,gst_meta_fenced_get_info(),NULL))
static void gst_fenced_buffer_dispose (GstBuffer * buf); static void gst_fenced_buffer_dispose (GstBuffer * buf);
static GstBuffer *gst_fenced_buffer_copy (const GstBuffer * buffer); static GstBuffer *gst_fenced_buffer_copy (const GstBuffer * buffer);
@ -400,7 +401,7 @@ gst_fenced_buffer_dispose (GstBuffer * buffer)
{ {
GstMetaFenced *meta; GstMetaFenced *meta;
meta = GST_META_FENCED_GET (buffer, FALSE); meta = GST_META_FENCED_GET (buffer);
GST_DEBUG ("free buffer=%p", buffer); GST_DEBUG ("free buffer=%p", buffer);
@ -487,7 +488,7 @@ gst_fenced_buffer_alloc (GstBuffer * buffer, unsigned int length,
GST_MINI_OBJECT_CAST (buffer)->copy = GST_MINI_OBJECT_CAST (buffer)->copy =
(GstMiniObjectCopyFunction) gst_fenced_buffer_copy; (GstMiniObjectCopyFunction) gst_fenced_buffer_copy;
meta = GST_META_FENCED_GET (buffer, TRUE); meta = GST_META_FENCED_ADD (buffer);
#if 0 #if 0
munmap (region, page_size); munmap (region, page_size);

View file

@ -64,7 +64,7 @@ gst_v4l2_buffer_dispose (GstBuffer * buffer)
gint index; gint index;
GstMetaV4l2 *meta; GstMetaV4l2 *meta;
meta = GST_META_V4L2_GET (buffer, FALSE); meta = GST_META_V4L2_GET (buffer);
g_assert (meta != NULL); g_assert (meta != NULL);
pool = meta->pool; pool = meta->pool;
@ -123,7 +123,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps)
GST_MINI_OBJECT_CAST (ret)->dispose = GST_MINI_OBJECT_CAST (ret)->dispose =
(GstMiniObjectDisposeFunction) gst_v4l2_buffer_dispose; (GstMiniObjectDisposeFunction) gst_v4l2_buffer_dispose;
meta = GST_META_V4L2_GET (ret, TRUE); meta = GST_META_V4L2_ADD (ret);
GST_LOG_OBJECT (pool->v4l2elem, "creating buffer %u, %p in pool %p", index, GST_LOG_OBJECT (pool->v4l2elem, "creating buffer %u, %p in pool %p", index,
ret, pool); ret, pool);
@ -451,7 +451,7 @@ gst_v4l2_buffer_pool_get (GstV4l2BufferPool * pool, gboolean blocking)
} }
if (buf) { if (buf) {
GstMetaV4l2 *meta = GST_META_V4L2_GET (buf, FALSE); GstMetaV4l2 *meta = GST_META_V4L2_GET (buf);
GST_V4L2_BUFFER_POOL_LOCK (pool); GST_V4L2_BUFFER_POOL_LOCK (pool);
GST_BUFFER_SIZE (buf) = meta->vbuffer.length; GST_BUFFER_SIZE (buf) = meta->vbuffer.length;
@ -479,7 +479,7 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf)
{ {
GstMetaV4l2 *meta; GstMetaV4l2 *meta;
meta = GST_META_V4L2_GET (buf, FALSE); meta = GST_META_V4L2_GET (buf);
GST_LOG_OBJECT (pool->v4l2elem, "enqueue pool buffer %d", GST_LOG_OBJECT (pool->v4l2elem, "enqueue pool buffer %d",
meta->vbuffer.index); meta->vbuffer.index);

View file

@ -79,7 +79,8 @@ struct _GstMetaV4l2 {
}; };
const GstMetaInfo * gst_meta_v4l2_get_info (void); const GstMetaInfo * gst_meta_v4l2_get_info (void);
#define GST_META_V4L2_GET(buf,create) ((GstMetaV4l2 *)gst_buffer_get_meta(buf,gst_meta_v4l2_get_info(),create)) #define GST_META_V4L2_GET(buf) ((GstMetaV4l2 *)gst_buffer_get_meta(buf,gst_meta_v4l2_get_info()))
#define GST_META_V4L2_ADD(buf) ((GstMetaV4l2 *)gst_buffer_add_meta(buf,gst_meta_v4l2_get_info(),NULL))
void gst_v4l2_buffer_pool_destroy (GstV4l2BufferPool * pool); void gst_v4l2_buffer_pool_destroy (GstV4l2BufferPool * pool);
GstV4l2BufferPool *gst_v4l2_buffer_pool_new (GstElement *v4l2elem, gint fd, gint num_buffers, GstCaps * caps, gboolean requeuebuf, enum v4l2_buf_type type); GstV4l2BufferPool *gst_v4l2_buffer_pool_new (GstElement *v4l2elem, gint fd, gint num_buffers, GstCaps * caps, gboolean requeuebuf, enum v4l2_buf_type type);

View file

@ -81,7 +81,7 @@ queue_failed:
(_("Could not enqueue buffers in device '%s'."), (_("Could not enqueue buffers in device '%s'."),
v4l2src->v4l2object->videodev), v4l2src->v4l2object->videodev),
("enqueing buffer %d/%d failed: %s", ("enqueing buffer %d/%d failed: %s",
GST_META_V4L2_GET (buf, FALSE)->vbuffer.index, v4l2src->num_buffers, GST_META_V4L2_GET (buf)->vbuffer.index, v4l2src->num_buffers,
g_strerror (errno))); g_strerror (errno)));
return FALSE; return FALSE;
} }

View file

@ -82,7 +82,7 @@ static void gst_ximage_src_clear_bufpool (GstXImageSrc * ximagesrc);
static void static void
gst_ximage_src_return_buf (GstXImageSrc * ximagesrc, GstBuffer * ximage) gst_ximage_src_return_buf (GstXImageSrc * ximagesrc, GstBuffer * ximage)
{ {
GstMetaXImage *meta = GST_META_XIMAGE_GET (ximage, FALSE); GstMetaXImage *meta = GST_META_XIMAGE_GET (ximage);
/* If our geometry changed we can't reuse that image. */ /* If our geometry changed we can't reuse that image. */
if ((meta->width != ximagesrc->width) || (meta->height != ximagesrc->height)) { if ((meta->width != ximagesrc->width) || (meta->height != ximagesrc->height)) {
@ -367,7 +367,7 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
while (ximagesrc->buffer_pool != NULL) { while (ximagesrc->buffer_pool != NULL) {
ximage = ximagesrc->buffer_pool->data; ximage = ximagesrc->buffer_pool->data;
meta = GST_META_XIMAGE_GET (ximage, FALSE); meta = GST_META_XIMAGE_GET (ximage);
if ((meta->width != ximagesrc->width) || if ((meta->width != ximagesrc->width) ||
(meta->height != ximagesrc->height)) { (meta->height != ximagesrc->height)) {
@ -423,7 +423,7 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
g_return_val_if_fail (GST_IS_XIMAGE_SRC (ximagesrc), NULL); g_return_val_if_fail (GST_IS_XIMAGE_SRC (ximagesrc), NULL);
meta = GST_META_XIMAGE_GET (ximage, FALSE); meta = GST_META_XIMAGE_GET (ximage);
#ifdef HAVE_XDAMAGE #ifdef HAVE_XDAMAGE
if (ximagesrc->have_xdamage && ximagesrc->use_damage && if (ximagesrc->have_xdamage && ximagesrc->use_damage &&

View file

@ -320,7 +320,7 @@ gst_ximagesrc_buffer_dispose (GstBuffer * ximage)
g_return_if_fail (ximage != NULL); g_return_if_fail (ximage != NULL);
meta = GST_META_XIMAGE_GET (ximage, FALSE); meta = GST_META_XIMAGE_GET (ximage);
parent = meta->parent; parent = meta->parent;
if (parent == NULL) { if (parent == NULL) {
@ -340,7 +340,7 @@ gst_ximage_buffer_free (GstBuffer * ximage)
{ {
GstMetaXImage *meta; GstMetaXImage *meta;
meta = GST_META_XIMAGE_GET (ximage, FALSE); meta = GST_META_XIMAGE_GET (ximage);
/* make sure it is not recycled */ /* make sure it is not recycled */
meta->width = -1; meta->width = -1;
@ -361,7 +361,7 @@ gst_ximageutil_ximage_new (GstXContext * xcontext,
GST_MINI_OBJECT_CAST (ximage)->dispose = GST_MINI_OBJECT_CAST (ximage)->dispose =
(GstMiniObjectDisposeFunction) gst_ximagesrc_buffer_dispose; (GstMiniObjectDisposeFunction) gst_ximagesrc_buffer_dispose;
meta = GST_META_XIMAGE_GET (ximage, TRUE); meta = GST_META_XIMAGE_ADD (ximage);
meta->width = width; meta->width = width;
meta->height = height; meta->height = height;
@ -437,7 +437,7 @@ gst_ximageutil_ximage_destroy (GstXContext * xcontext, GstBuffer * ximage)
{ {
GstMetaXImage *meta; GstMetaXImage *meta;
meta = GST_META_XIMAGE_GET (ximage, FALSE); meta = GST_META_XIMAGE_GET (ximage);
/* We might have some buffers destroyed after changing state to NULL */ /* We might have some buffers destroyed after changing state to NULL */
if (!xcontext) if (!xcontext)

View file

@ -132,7 +132,6 @@ void ximageutil_calculate_pixel_aspect_ratio (GstXContext * xcontext);
/* BufferReturnFunc is called when a buffer is finalised */ /* BufferReturnFunc is called when a buffer is finalised */
typedef void (*BufferReturnFunc) (GstElement *parent, GstBuffer *buf); typedef void (*BufferReturnFunc) (GstElement *parent, GstBuffer *buf);
#define GST_XIMAGE_GET_DATA(buf) ((GstXImageData *) (GST_BUFFER_CAST(buf)->owner_priv))
/** /**
* GstMetaXImage: * GstMetaXImage:
* @parent: a reference to the element we belong to * @parent: a reference to the element we belong to
@ -162,7 +161,8 @@ struct _GstMetaXImage {
}; };
const GstMetaInfo * gst_meta_ximage_get_info (void); const GstMetaInfo * gst_meta_ximage_get_info (void);
#define GST_META_XIMAGE_GET(buf,create) ((GstMetaXImage *)gst_buffer_get_meta(buf,gst_meta_ximage_get_info(),create)); #define GST_META_XIMAGE_GET(buf) ((GstMetaXImage *)gst_buffer_get_meta(buf,gst_meta_ximage_get_info()))
#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, GstBuffer *gst_ximageutil_ximage_new (GstXContext *xcontext,
GstElement *parent, int width, int height, BufferReturnFunc return_func); GstElement *parent, int width, int height, BufferReturnFunc return_func);