mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
meta: fix for new API
This commit is contained in:
parent
ce7498e7c3
commit
c7c8f3e13d
5 changed files with 26 additions and 25 deletions
|
@ -624,7 +624,8 @@ typedef struct _GstMetaV4lSrc
|
|||
gint num;
|
||||
} GstMetaV4lSrc;
|
||||
|
||||
#define GST_META_V4LSRC_GET(buf,create) ((GstMetaV4lSrc *)gst_buffer_get_meta(buf,gst_meta_v4lsrc_get_info(),create));
|
||||
#define GST_META_V4LSRC_GET(buf) ((GstMetaV4lSrc *)gst_buffer_get_meta(buf,gst_meta_v4lsrc_get_info()))
|
||||
#define GST_META_V4LSRC_ADD(buf) ((GstMetaV4lSrc *)gst_buffer_add_meta(buf,gst_meta_v4lsrc_get_info(), NULL))
|
||||
|
||||
static void
|
||||
meta_v4lsrc_free (GstMetaV4lSrc * meta, GstBuffer * buffer)
|
||||
|
@ -682,7 +683,7 @@ gst_v4lsrc_buffer_new (GstV4lSrc * v4lsrc, gint num)
|
|||
buf = gst_buffer_new ();
|
||||
|
||||
/* attach private metadata with the frame num and v4lsrc element */
|
||||
meta = GST_META_V4LSRC_GET (buf, TRUE);
|
||||
meta = GST_META_V4LSRC_ADD (buf);
|
||||
meta->num = num;
|
||||
meta->v4lsrc = gst_object_ref (v4lsrc);
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ gst_ximage_buffer_dispose (GstBuffer * ximage)
|
|||
gboolean recycled = FALSE;
|
||||
gboolean running;
|
||||
|
||||
meta = GST_META_XIMAGE_FIND (ximage);
|
||||
meta = GST_META_XIMAGE_GET (ximage);
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
ximagesink = meta->ximagesink;
|
||||
|
@ -238,7 +238,7 @@ no_sink:
|
|||
static void
|
||||
gst_ximage_buffer_free (GstBuffer * ximage)
|
||||
{
|
||||
GstMetaXImage *meta = GST_META_XIMAGE_FIND (ximage);
|
||||
GstMetaXImage *meta = GST_META_XIMAGE_GET (ximage);
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
/* make sure it is not recycled */
|
||||
|
@ -546,7 +546,7 @@ gst_ximagesink_ximage_destroy (GstXImageSink * ximagesink, GstBuffer * ximage)
|
|||
g_return_if_fail (ximage != NULL);
|
||||
g_return_if_fail (GST_IS_XIMAGESINK (ximagesink));
|
||||
|
||||
meta = GST_META_XIMAGE_FIND (ximage);
|
||||
meta = GST_META_XIMAGE_GET (ximage);
|
||||
g_return_if_fail (meta != NULL);
|
||||
|
||||
/* Hold the object lock to ensure the XContext doesn't disappear */
|
||||
|
@ -686,7 +686,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstBuffer * ximage)
|
|||
}
|
||||
}
|
||||
|
||||
meta = GST_META_XIMAGE_FIND (ximage);
|
||||
meta = GST_META_XIMAGE_GET (ximage);
|
||||
src.w = meta->width;
|
||||
src.h = meta->height;
|
||||
dst.w = ximagesink->xwindow->width;
|
||||
|
@ -1515,7 +1515,7 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||
/* If our ximage has changed we destroy it, next chain iteration will create
|
||||
a new one */
|
||||
if ((ximagesink->ximage)) {
|
||||
GstMetaXImage *meta = GST_META_XIMAGE_FIND (ximagesink->ximage);
|
||||
GstMetaXImage *meta = GST_META_XIMAGE_GET (ximagesink->ximage);
|
||||
|
||||
if (((GST_VIDEO_SINK_WIDTH (ximagesink) != meta->width) ||
|
||||
(GST_VIDEO_SINK_HEIGHT (ximagesink) != meta->height))) {
|
||||
|
@ -1645,7 +1645,7 @@ gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
if (!ximagesink->xcontext)
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
meta = GST_META_XIMAGE_FIND (buf);
|
||||
meta = GST_META_XIMAGE_GET (buf);
|
||||
|
||||
if (meta) {
|
||||
/* If this buffer has been allocated using our buffer management we simply
|
||||
|
@ -1666,7 +1666,7 @@ gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
goto no_ximage;
|
||||
|
||||
if (GST_BUFFER_SIZE (ximagesink->ximage) < GST_BUFFER_SIZE (buf)) {
|
||||
meta = GST_META_XIMAGE_FIND (ximagesink->ximage);
|
||||
meta = GST_META_XIMAGE_GET (ximagesink->ximage);
|
||||
|
||||
GST_ELEMENT_ERROR (ximagesink, RESOURCE, WRITE,
|
||||
("Failed to create output image buffer of %dx%d pixels",
|
||||
|
@ -1883,7 +1883,7 @@ alloc:
|
|||
ximage = ximagesink->buffer_pool->data;
|
||||
|
||||
if (ximage) {
|
||||
meta = GST_META_XIMAGE_FIND (ximage);
|
||||
meta = GST_META_XIMAGE_GET (ximage);
|
||||
|
||||
/* Removing from the pool */
|
||||
ximagesink->buffer_pool = g_slist_delete_link (ximagesink->buffer_pool,
|
||||
|
|
|
@ -159,12 +159,11 @@ struct _GstMetaXImage
|
|||
const GstMetaInfo * gst_meta_ximage_get_info (void);
|
||||
#define GST_META_INFO_XIMAGE (gst_meta_ximage_get_info())
|
||||
|
||||
#define GST_META_GET(b,t,i,c) ((t *)gst_buffer_get_meta((b),(i),(c)))
|
||||
#define GST_META_XIMAGE_GET(b,c) GST_META_GET(b,GstMetaXImage,GST_META_INFO_XIMAGE,c)
|
||||
|
||||
#define GST_META_XIMAGE_ADD(buf) GST_META_XIMAGE_GET(buf,TRUE)
|
||||
#define GST_META_XIMAGE_FIND(buf) GST_META_XIMAGE_GET(buf,FALSE)
|
||||
#define GST_META_GET(b,t,i) ((t *)gst_buffer_get_meta((b),(i)))
|
||||
#define GST_META_ADD(b,t,i,p) ((t *)gst_buffer_add_meta((b),(i),(p)))
|
||||
|
||||
#define GST_META_XIMAGE_GET(b) GST_META_GET(b,GstMetaXImage,GST_META_INFO_XIMAGE)
|
||||
#define GST_META_XIMAGE_ADD(b) GST_META_ADD(b,GstMetaXImage,GST_META_INFO_XIMAGE,NULL)
|
||||
|
||||
/**
|
||||
* GstXImageSink:
|
||||
|
|
|
@ -222,7 +222,7 @@ gst_xvimage_buffer_dispose (GstBuffer * xvimage)
|
|||
GstXvImageSink *xvimagesink;
|
||||
gboolean running;
|
||||
|
||||
data = GST_META_XVIMAGE_GET (xvimage, FALSE);
|
||||
data = GST_META_XVIMAGE_GET (xvimage);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
xvimagesink = data->xvimagesink;
|
||||
|
@ -268,7 +268,7 @@ no_sink:
|
|||
static void
|
||||
gst_xvimage_buffer_free (GstBuffer * xvimage)
|
||||
{
|
||||
GstMetaXvImage *data = GST_META_XVIMAGE_GET (xvimage, FALSE);
|
||||
GstMetaXvImage *data = GST_META_XVIMAGE_GET (xvimage);
|
||||
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
|
@ -417,7 +417,7 @@ gst_xvimagesink_xvimage_new (GstXvImageSink * xvimagesink, GstCaps * caps)
|
|||
GST_MINI_OBJECT_CAST (buffer)->dispose =
|
||||
(GstMiniObjectDisposeFunction) gst_xvimage_buffer_dispose;
|
||||
|
||||
data = GST_META_XVIMAGE_GET (buffer, TRUE);
|
||||
data = GST_META_XVIMAGE_ADD (buffer);
|
||||
#ifdef HAVE_XSHM
|
||||
data->SHMInfo.shmaddr = ((void *) -1);
|
||||
data->SHMInfo.shmid = -1;
|
||||
|
@ -632,7 +632,7 @@ gst_xvimagesink_xvimage_destroy (GstXvImageSink * xvimagesink,
|
|||
g_return_if_fail (xvimage != NULL);
|
||||
g_return_if_fail (GST_IS_XVIMAGESINK (xvimagesink));
|
||||
|
||||
data = GST_META_XVIMAGE_GET (xvimage, FALSE);
|
||||
data = GST_META_XVIMAGE_GET (xvimage);
|
||||
g_return_if_fail (data != NULL);
|
||||
|
||||
GST_OBJECT_LOCK (xvimagesink);
|
||||
|
@ -806,7 +806,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink, GstBuffer * xvimage)
|
|||
xvimagesink->redraw_border = FALSE;
|
||||
}
|
||||
|
||||
data = GST_META_XVIMAGE_GET (xvimage, FALSE);
|
||||
data = GST_META_XVIMAGE_GET (xvimage);
|
||||
g_assert (data != NULL);
|
||||
|
||||
/* We scale to the window's geometry */
|
||||
|
@ -2186,7 +2186,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||
/* We renew our xvimage only if size or format changed;
|
||||
* the xvimage is the same size as the video pixel size */
|
||||
if ((xvimagesink->xvimage)) {
|
||||
GstMetaXvImage *data = GST_META_XVIMAGE_GET (xvimagesink->xvimage, FALSE);
|
||||
GstMetaXvImage *data = GST_META_XVIMAGE_GET (xvimagesink->xvimage);
|
||||
|
||||
if (((im_format != data->im_format) ||
|
||||
(video_width != data->width) || (video_height != data->height))) {
|
||||
|
@ -2337,7 +2337,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
|
||||
xvimagesink = GST_XVIMAGESINK (vsink);
|
||||
|
||||
meta = GST_META_XVIMAGE_GET (buf, FALSE);
|
||||
meta = GST_META_XVIMAGE_GET (buf);
|
||||
|
||||
if (meta) {
|
||||
/* If this buffer has been allocated using our buffer management we simply
|
||||
|
@ -2361,7 +2361,7 @@ gst_xvimagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
|
|||
goto no_image;
|
||||
|
||||
if (GST_BUFFER_SIZE (xvimagesink->xvimage) < GST_BUFFER_SIZE (buf)) {
|
||||
meta = GST_META_XVIMAGE_GET (xvimagesink->xvimage, FALSE);
|
||||
meta = GST_META_XVIMAGE_GET (xvimagesink->xvimage);
|
||||
|
||||
GST_ELEMENT_ERROR (xvimagesink, RESOURCE, WRITE,
|
||||
("Failed to create output image buffer of %dx%d pixels",
|
||||
|
@ -2620,7 +2620,7 @@ reuse_last_caps:
|
|||
xvimage = xvimagesink->image_pool->data;
|
||||
|
||||
if (xvimage) {
|
||||
meta = GST_META_XVIMAGE_GET (xvimage, FALSE);
|
||||
meta = GST_META_XVIMAGE_GET (xvimage);
|
||||
|
||||
/* Removing from the pool */
|
||||
xvimagesink->image_pool = g_slist_delete_link (xvimagesink->image_pool,
|
||||
|
|
|
@ -190,7 +190,8 @@ struct _GstMetaXvImage {
|
|||
|
||||
const GstMetaInfo * gst_meta_xvimage_get_info (void);
|
||||
|
||||
#define GST_META_XVIMAGE_GET(buf,create) ((GstMetaXvImage *)gst_buffer_get_meta(buf,gst_meta_xvimage_get_info(),create))
|
||||
#define GST_META_XVIMAGE_GET(buf) ((GstMetaXvImage *)gst_buffer_get_meta(buf,gst_meta_xvimage_get_info()))
|
||||
#define GST_META_XVIMAGE_ADD(buf) ((GstMetaXvImage *)gst_buffer_add_meta(buf,gst_meta_xvimage_get_info(), NULL))
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue