summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Gaignard <benjamin.gaignard@linaro.org>2014-11-21 16:36:15 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-11-21 11:29:04 -0500
commite6c2ad5571e5dedb212287efe238eb450032cd4f (patch)
tree2c6f24c3ee473fe802471ff43c2232d3f8dd4e57
parentec6b8b84af719d828ddd91c724e715c0b4a556bc (diff)
v4l2object: allow to automatic selection of dmabuf
If the v4l2 queue support dmabuf select this buffer pool mode and update the query with allocator. This patch only concern exporting dmabuf and not importing dmabuf fd from downstream element. https://bugzilla.gnome.org/show_bug.cgi?id=699382
-rw-r--r--sys/v4l2/gstv4l2bufferpool.c2
-rw-r--r--sys/v4l2/gstv4l2object.c8
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index 2019072e7..2ea9eb58c 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -517,6 +517,8 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
max_buffers);
+ gst_buffer_pool_config_set_allocator (config, pool->allocator, &params);
+
/* keep a GstVideoInfo with defaults for the when we need to copy */
gst_video_info_from_caps (&pool->caps_info, caps);
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index d70b53d6f..974624335 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -2362,8 +2362,12 @@ gst_v4l2_object_setup_pool (GstV4l2Object * v4l2object, GstCaps * caps)
goto method_not_supported;
if (v4l2object->vcap.capabilities & V4L2_CAP_STREAMING) {
- if (v4l2object->req_mode == GST_V4L2_IO_AUTO)
- mode = GST_V4L2_IO_MMAP;
+ if (v4l2object->req_mode == GST_V4L2_IO_AUTO) {
+ if (GST_V4L2_OBJECT_CAN_REQUEST (v4l2object, DMABUF))
+ mode = GST_V4L2_IO_DMABUF;
+ else
+ mode = GST_V4L2_IO_MMAP;
+ }
} else if (v4l2object->req_mode == GST_V4L2_IO_MMAP)
goto method_not_supported;