diff --git a/gst/debugutils/efence.c b/gst/debugutils/efence.c index 9a79ec41e6..9d5a59992a 100644 --- a/gst/debugutils/efence.c +++ b/gst/debugutils/efence.c @@ -109,7 +109,8 @@ gst_meta_fenced_get_info (void) 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 GstBuffer *gst_fenced_buffer_copy (const GstBuffer * buffer); @@ -400,7 +401,7 @@ gst_fenced_buffer_dispose (GstBuffer * buffer) { GstMetaFenced *meta; - meta = GST_META_FENCED_GET (buffer, FALSE); + meta = GST_META_FENCED_GET (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 = (GstMiniObjectCopyFunction) gst_fenced_buffer_copy; - meta = GST_META_FENCED_GET (buffer, TRUE); + meta = GST_META_FENCED_ADD (buffer); #if 0 munmap (region, page_size); diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index c8dc9e3d53..d4969bc83d 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -64,7 +64,7 @@ gst_v4l2_buffer_dispose (GstBuffer * buffer) gint index; GstMetaV4l2 *meta; - meta = GST_META_V4L2_GET (buffer, FALSE); + meta = GST_META_V4L2_GET (buffer); g_assert (meta != NULL); pool = meta->pool; @@ -123,7 +123,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps) GST_MINI_OBJECT_CAST (ret)->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, ret, pool); @@ -451,7 +451,7 @@ gst_v4l2_buffer_pool_get (GstV4l2BufferPool * pool, gboolean blocking) } if (buf) { - GstMetaV4l2 *meta = GST_META_V4L2_GET (buf, FALSE); + GstMetaV4l2 *meta = GST_META_V4L2_GET (buf); GST_V4L2_BUFFER_POOL_LOCK (pool); GST_BUFFER_SIZE (buf) = meta->vbuffer.length; @@ -479,7 +479,7 @@ gst_v4l2_buffer_pool_qbuf (GstV4l2BufferPool * pool, GstBuffer * buf) { GstMetaV4l2 *meta; - meta = GST_META_V4L2_GET (buf, FALSE); + meta = GST_META_V4L2_GET (buf); GST_LOG_OBJECT (pool->v4l2elem, "enqueue pool buffer %d", meta->vbuffer.index); diff --git a/sys/v4l2/gstv4l2bufferpool.h b/sys/v4l2/gstv4l2bufferpool.h index 7fa846fa8d..a7e6a74a28 100644 --- a/sys/v4l2/gstv4l2bufferpool.h +++ b/sys/v4l2/gstv4l2bufferpool.h @@ -79,7 +79,8 @@ struct _GstMetaV4l2 { }; 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); GstV4l2BufferPool *gst_v4l2_buffer_pool_new (GstElement *v4l2elem, gint fd, gint num_buffers, GstCaps * caps, gboolean requeuebuf, enum v4l2_buf_type type); diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 3ee50755b4..a8985038d3 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -81,7 +81,7 @@ queue_failed: (_("Could not enqueue buffers in device '%s'."), v4l2src->v4l2object->videodev), ("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))); return FALSE; } diff --git a/sys/ximage/gstximagesrc.c b/sys/ximage/gstximagesrc.c index cd848fec20..2c2106aa8c 100644 --- a/sys/ximage/gstximagesrc.c +++ b/sys/ximage/gstximagesrc.c @@ -82,7 +82,7 @@ static void gst_ximage_src_clear_bufpool (GstXImageSrc * ximagesrc); static void 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 ((meta->width != ximagesrc->width) || (meta->height != ximagesrc->height)) { @@ -367,7 +367,7 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc) while (ximagesrc->buffer_pool != NULL) { ximage = ximagesrc->buffer_pool->data; - meta = GST_META_XIMAGE_GET (ximage, FALSE); + meta = GST_META_XIMAGE_GET (ximage); if ((meta->width != ximagesrc->width) || (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); - meta = GST_META_XIMAGE_GET (ximage, FALSE); + meta = GST_META_XIMAGE_GET (ximage); #ifdef HAVE_XDAMAGE if (ximagesrc->have_xdamage && ximagesrc->use_damage && diff --git a/sys/ximage/ximageutil.c b/sys/ximage/ximageutil.c index ce1d2f8111..c425162544 100644 --- a/sys/ximage/ximageutil.c +++ b/sys/ximage/ximageutil.c @@ -320,7 +320,7 @@ gst_ximagesrc_buffer_dispose (GstBuffer * ximage) g_return_if_fail (ximage != NULL); - meta = GST_META_XIMAGE_GET (ximage, FALSE); + meta = GST_META_XIMAGE_GET (ximage); parent = meta->parent; if (parent == NULL) { @@ -340,7 +340,7 @@ gst_ximage_buffer_free (GstBuffer * ximage) { GstMetaXImage *meta; - meta = GST_META_XIMAGE_GET (ximage, FALSE); + meta = GST_META_XIMAGE_GET (ximage); /* make sure it is not recycled */ meta->width = -1; @@ -361,7 +361,7 @@ gst_ximageutil_ximage_new (GstXContext * xcontext, GST_MINI_OBJECT_CAST (ximage)->dispose = (GstMiniObjectDisposeFunction) gst_ximagesrc_buffer_dispose; - meta = GST_META_XIMAGE_GET (ximage, TRUE); + meta = GST_META_XIMAGE_ADD (ximage); meta->width = width; meta->height = height; @@ -437,7 +437,7 @@ gst_ximageutil_ximage_destroy (GstXContext * xcontext, GstBuffer * ximage) { 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 */ if (!xcontext) diff --git a/sys/ximage/ximageutil.h b/sys/ximage/ximageutil.h index 0e1615c80b..aa674de8fa 100644 --- a/sys/ximage/ximageutil.h +++ b/sys/ximage/ximageutil.h @@ -132,7 +132,6 @@ void ximageutil_calculate_pixel_aspect_ratio (GstXContext * xcontext); /* BufferReturnFunc is called when a buffer is finalised */ typedef void (*BufferReturnFunc) (GstElement *parent, GstBuffer *buf); -#define GST_XIMAGE_GET_DATA(buf) ((GstXImageData *) (GST_BUFFER_CAST(buf)->owner_priv)) /** * GstMetaXImage: * @parent: a reference to the element we belong to @@ -162,7 +161,8 @@ struct _GstMetaXImage { }; 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, GstElement *parent, int width, int height, BufferReturnFunc return_func);