mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
v4l2: add video metadata to raw video buffers
This commit is contained in:
parent
be83e4f704
commit
e77d183a1e
1 changed files with 11 additions and 5 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "gst/video/video.h"
|
#include "gst/video/video.h"
|
||||||
|
#include "gst/video/gstmetavideo.h"
|
||||||
|
|
||||||
#include <gstv4l2bufferpool.h>
|
#include <gstv4l2bufferpool.h>
|
||||||
#include "gstv4l2src.h"
|
#include "gstv4l2src.h"
|
||||||
|
@ -131,8 +132,10 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index)
|
||||||
GstBuffer *ret;
|
GstBuffer *ret;
|
||||||
GstMetaV4l2 *meta;
|
GstMetaV4l2 *meta;
|
||||||
GstV4l2Object *obj;
|
GstV4l2Object *obj;
|
||||||
|
GstVideoInfo *info;
|
||||||
|
|
||||||
obj = pool->obj;
|
obj = pool->obj;
|
||||||
|
info = &obj->info;
|
||||||
|
|
||||||
ret = gst_buffer_new ();
|
ret = gst_buffer_new ();
|
||||||
GST_MINI_OBJECT_CAST (ret)->dispose =
|
GST_MINI_OBJECT_CAST (ret)->dispose =
|
||||||
|
@ -173,11 +176,14 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index)
|
||||||
gst_memory_new_wrapped (0,
|
gst_memory_new_wrapped (0,
|
||||||
meta->mem, NULL, meta->vbuffer.length, 0, meta->vbuffer.length));
|
meta->mem, NULL, meta->vbuffer.length, 0, meta->vbuffer.length));
|
||||||
|
|
||||||
/* add metadata to buffers */
|
/* add metadata to raw video buffers */
|
||||||
|
if (info->finfo) {
|
||||||
|
GST_DEBUG ("adding video meta");
|
||||||
|
gst_buffer_add_meta_video_full (ret, info->flags,
|
||||||
|
GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
|
||||||
|
GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info),
|
||||||
|
info->offset, info->stride);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
Loading…
Reference in a new issue