From f19cfbda96d098362cc2a2565197cef347878549 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 4 Aug 2009 09:14:20 +0200 Subject: v4l2: Add v4l2sink element This also does the following changes: (1) pull the bufferpool code out into gstv4l2bufferpool.c, and make a bit more generic so it can be used both for v4l2src and v4l2sink (2) move some of the device probing/configuration/caps stuff into gstv4l2object.c so it does not have to be duplicated between v4l2src and v4l2sink Fixes bug #590280. --- sys/v4l2/v4l2_calls.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sys/v4l2/v4l2_calls.c') diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index 4fb1fad8..5f6261ea 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -46,6 +46,9 @@ #include "gstv4l2colorbalance.h" #include "gstv4l2src.h" +#include "gstv4l2sink.h" + +#include "gst/gst-i18n-plugin.h" /* Those are ioctl calls */ #ifndef V4L2_CID_HCENTER @@ -449,10 +452,14 @@ gst_v4l2_open (GstV4l2Object * v4l2object) goto error; /* do we need to be a capture device? */ - if (GST_IS_V4L2SRC (v4l2object) && + if (GST_IS_V4L2SRC (v4l2object->element) && !(v4l2object->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) goto not_capture; + if (GST_IS_V4L2SINK (v4l2object->element) && + !(v4l2object->vcap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) + goto not_output; + /* create enumerations, posts errors. */ if (!gst_v4l2_fill_lists (v4l2object)) goto error; @@ -497,6 +504,14 @@ not_capture: ("Capabilities: 0x%x", v4l2object->vcap.capabilities)); goto error; } +not_output: + { + GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND, + (_("Device '%s' is not a output device."), + v4l2object->videodev), + ("Capabilities: 0x%x", v4l2object->vcap.capabilities)); + goto error; + } error: { if (GST_V4L2_IS_OPEN (v4l2object)) { -- cgit