diff --git a/ChangeLog b/ChangeLog index 5371d090a2..873f5300a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2008-11-04 Sebastian Dröge + + Patch by: Bastien Nocera , + Hans de Goede + + * configure.ac: + * sys/v4l2/Makefile.am: + * sys/v4l2/gstv4l2src.c: (gst_v4l2src_get_read): + * sys/v4l2/v4l2_calls.c: (gst_v4l2_get_capabilities), + (gst_v4l2_fill_lists), (gst_v4l2_open), (gst_v4l2_close), + (gst_v4l2_get_norm), (gst_v4l2_set_norm), (gst_v4l2_get_frequency), + (gst_v4l2_set_frequency), (gst_v4l2_signal_strength), + (gst_v4l2_get_attribute), (gst_v4l2_set_attribute), + (gst_v4l2_get_input), (gst_v4l2_set_input): + * sys/v4l2/v4l2_calls.h: + * sys/v4l2/v4l2src_calls.c: (gst_v4l2_buffer_finalize), + (gst_v4l2_buffer_new), (gst_v4l2_buffer_pool_finalize), + (gst_v4l2_buffer_pool_new), (gst_v4l2_buffer_pool_activate), + (gst_v4l2src_fill_format_list), + (gst_v4l2src_probe_caps_for_format_and_size), + (gst_v4l2src_probe_caps_for_format), (gst_v4l2src_grab_frame), + (gst_v4l2src_set_capture), (gst_v4l2src_capture_init), + (gst_v4l2src_capture_start), (gst_v4l2src_capture_stop), + (gst_v4l2src_get_nearest_size): + Optionally use libv4l to access v4l2 devices. Fixes bug #545033. + 2008-11-04 Stefan Kost * ext/aalib/Makefile.am: diff --git a/configure.ac b/configure.ac index 04d82d98d7..23be57a602 100644 --- a/configure.ac +++ b/configure.ac @@ -550,6 +550,16 @@ return 0; fi ]) +if test x$HAVE_GST_V4L2 = xyes; then + PKG_CHECK_MODULES(LIBV4L2, libv4l2, + [ have_libv4l2=yes + AC_DEFINE(HAVE_LIBV4L2, 1, + [Whether libv4l2 is available for video buffer conversion]) + ], [ + have_libv4l2=no + ]) +fi + dnl Check for X11 translit(dnm, m, l) AM_CONDITIONAL(USE_X, true) AG_GST_CHECK_FEATURE(X, [X libraries and plugins], diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am index f6b50ed189..ed9c3ec309 100644 --- a/sys/v4l2/Makefile.am +++ b/sys/v4l2/Makefile.am @@ -22,8 +22,9 @@ libgstvideo4linux2_la_SOURCES = gstv4l2.c \ libgstvideo4linux2_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \ $(GST_CFLAGS) \ - $(X_CFLAGS) - + $(X_CFLAGS) \ + $(LIBV4L2_CFLAGS) + libgstvideo4linux2_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideo4linux2_la_LIBTOOLFLAGS = --tag=disable-static @@ -31,7 +32,8 @@ libgstvideo4linux2_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \ $(GST_BASE_LIBS) \ -lgstinterfaces-$(GST_MAJORMINOR) \ $(GST_LIBS) \ - $(xv_libs) + $(xv_libs) \ + $(LIBV4L2_LIBS) noinst_HEADERS = gstv4l2object.h v4l2_calls.h \ gstv4l2src.h v4l2src_calls.h \ diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 7aed289bba..f4e3ecb18b 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -1194,7 +1194,7 @@ gst_v4l2src_get_read (GstV4l2Src * v4l2src, GstBuffer ** buf) do { amount = - read (v4l2src->v4l2object->video_fd, GST_BUFFER_DATA (*buf), + v4l2_read (v4l2src->v4l2object->video_fd, GST_BUFFER_DATA (*buf), buffersize); if (amount == buffersize) { break; diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index f318fc5b01..3564d33514 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -75,7 +75,7 @@ gst_v4l2_get_capabilities (GstV4l2Object * v4l2object) if (!GST_V4L2_IS_OPEN (v4l2object)) return FALSE; - if (ioctl (v4l2object->video_fd, VIDIOC_QUERYCAP, &v4l2object->vcap) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCAP, &v4l2object->vcap) < 0) goto cap_failed; GST_LOG_OBJECT (e, "driver: '%s'", v4l2object->vcap.driver); @@ -124,7 +124,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) GstTunerChannel *channel; input.index = n; - if (ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { if (errno == EINVAL) break; /* end of enumeration */ else { @@ -157,7 +157,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; vtun.index = input.tuner; - if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { GST_ELEMENT_ERROR (e, RESOURCE, SETTINGS, (_("Failed to get setting of tuner %d on device '%s'."), input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM); @@ -197,7 +197,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) standard.frameperiod.denominator = 0; standard.index = n; - if (ioctl (v4l2object->video_fd, VIDIOC_ENUMSTD, &standard) < 0) { + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_ENUMSTD, &standard) < 0) { if (errno == EINVAL || errno == ENOTTY) break; /* end of enumeration */ else { @@ -242,7 +242,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) } control.id = n; - if (ioctl (v4l2object->video_fd, VIDIOC_QUERYCTRL, &control) < 0) { + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYCTRL, &control) < 0) { if (errno == EINVAL) { if (n < V4L2_CID_PRIVATE_BASE) /* continue so that we also check private controls */ @@ -324,7 +324,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) menu.id = n; for (i = 0;; i++) { menu.index = i; - if (ioctl (v4l2object->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { if (errno == EINVAL) break; /* end of enumeration */ else { @@ -399,6 +399,7 @@ gboolean gst_v4l2_open (GstV4l2Object * v4l2object) { struct stat st; + int libv4l2_fd; GST_DEBUG_OBJECT (v4l2object->element, "Trying to open device %s", v4l2object->videodev); @@ -424,6 +425,17 @@ gst_v4l2_open (GstV4l2Object * v4l2object) if (!GST_V4L2_IS_OPEN (v4l2object)) goto not_open; + libv4l2_fd = v4l2_fd_open (v4l2object->video_fd, + V4L2_ENABLE_ENUM_FMT_EMULATION); + /* Note the v4l2_xxx functions are designed so that if they get passed an + unknown fd, the will behave exactly as their regular xxx counterparts, so + if v4l2_fd_open fails, we continue as normal (missing the libv4l2 custom + cam format to normal formats conversion). Chances are big we will still + fail then though, as normally v4l2_fd_open only fails if the device is not + a v4l2 device. */ + if (libv4l2_fd != -1) + v4l2object->video_fd = libv4l2_fd; + /* get capabilities, error will be posted */ if (!gst_v4l2_get_capabilities (v4l2object)) goto error; @@ -477,7 +489,7 @@ error: { if (GST_V4L2_IS_OPEN (v4l2object)) { /* close device */ - close (v4l2object->video_fd); + v4l2_close (v4l2object->video_fd); v4l2object->video_fd = -1; } /* empty lists */ @@ -503,7 +515,7 @@ gst_v4l2_close (GstV4l2Object * v4l2object) GST_V4L2_CHECK_NOT_ACTIVE (v4l2object); /* close device */ - close (v4l2object->video_fd); + v4l2_close (v4l2object->video_fd); v4l2object->video_fd = -1; /* empty lists */ @@ -526,7 +538,7 @@ gst_v4l2_get_norm (GstV4l2Object * v4l2object, v4l2_std_id * norm) if (!GST_V4L2_IS_OPEN (v4l2object)) return FALSE; - if (ioctl (v4l2object->video_fd, VIDIOC_G_STD, norm) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_STD, norm) < 0) goto std_failed; return TRUE; @@ -554,7 +566,7 @@ gst_v4l2_set_norm (GstV4l2Object * v4l2object, v4l2_std_id norm) if (!GST_V4L2_IS_OPEN (v4l2object)) return FALSE; - if (ioctl (v4l2object->video_fd, VIDIOC_S_STD, &norm) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_STD, &norm) < 0) goto std_failed; return TRUE; @@ -590,7 +602,7 @@ gst_v4l2_get_frequency (GstV4l2Object * v4l2object, channel = gst_tuner_get_channel (GST_TUNER (v4l2object->element)); freq.tuner = tunernum; - if (ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) goto freq_failed; *frequency = freq.frequency * channel->freq_multiplicator; @@ -631,10 +643,10 @@ gst_v4l2_set_frequency (GstV4l2Object * v4l2object, freq.tuner = tunernum; /* fill in type - ignore error */ - ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq); + v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FREQUENCY, &freq); freq.frequency = frequency / channel->freq_multiplicator; - if (ioctl (v4l2object->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) goto freq_failed; return TRUE; @@ -666,7 +678,7 @@ gst_v4l2_signal_strength (GstV4l2Object * v4l2object, return FALSE; tuner.index = tunernum; - if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &tuner) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &tuner) < 0) goto tuner_failed; *signal_strength = tuner.signal; @@ -702,7 +714,7 @@ gst_v4l2_get_attribute (GstV4l2Object * v4l2object, control.id = attribute_num; - if (ioctl (v4l2object->video_fd, VIDIOC_G_CTRL, &control) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_CTRL, &control) < 0) goto ctrl_failed; *value = control.value; @@ -739,7 +751,7 @@ gst_v4l2_set_attribute (GstV4l2Object * v4l2object, control.id = attribute_num; control.value = value; - if (ioctl (v4l2object->video_fd, VIDIOC_S_CTRL, &control) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_CTRL, &control) < 0) goto ctrl_failed; return TRUE; @@ -764,7 +776,7 @@ gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input) if (!GST_V4L2_IS_OPEN (v4l2object)) return FALSE; - if (ioctl (v4l2object->video_fd, VIDIOC_G_INPUT, &n) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_INPUT, &n) < 0) goto input_failed; *input = n; @@ -790,7 +802,7 @@ gst_v4l2_set_input (GstV4l2Object * v4l2object, gint input) if (!GST_V4L2_IS_OPEN (v4l2object)) return FALSE; - if (ioctl (v4l2object->video_fd, VIDIOC_S_INPUT, &input) < 0) + if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_S_INPUT, &input) < 0) goto input_failed; return TRUE; diff --git a/sys/v4l2/v4l2_calls.h b/sys/v4l2/v4l2_calls.h index 5000cf2141..8bf7bcea4d 100644 --- a/sys/v4l2/v4l2_calls.h +++ b/sys/v4l2/v4l2_calls.h @@ -27,6 +27,17 @@ #include "gstv4l2object.h" #include "gst/gst-i18n-plugin.h" +#ifdef HAVE_LIBV4L2 +#include +#else +#define v4l2_fd_open(fd, flags) (fd) +#define v4l2_close close +#define v4l2_dup dup +#define v4l2_ioctl ioctl +#define v4l2_read read +#define v4l2_mmap mmap +#define v4l2_munmap munmap +#endif /* simple check whether the device is open */ #define GST_V4L2_IS_OPEN(v4l2object) \ diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 3643e5bbd0..6ff5945c0b 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -88,7 +88,7 @@ gst_v4l2_buffer_finalize (GstV4l2Buffer * buffer) pool->num_live_buffers--; if (pool->running) { - if (ioctl (pool->video_fd, VIDIOC_QBUF, &buffer->vbuffer) < 0) { + if (v4l2_ioctl (pool->video_fd, VIDIOC_QBUF, &buffer->vbuffer) < 0) { GST_WARNING ("could not requeue buffer %p %d", buffer, index); } else { /* FIXME: check that the caps didn't change */ @@ -106,7 +106,7 @@ gst_v4l2_buffer_finalize (GstV4l2Buffer * buffer) if (!resuscitated) { GST_LOG ("buffer %p not recovered, unmapping", buffer); gst_mini_object_unref (GST_MINI_OBJECT (pool)); - munmap ((void *) GST_BUFFER_DATA (buffer), buffer->vbuffer.length); + v4l2_munmap ((void *) GST_BUFFER_DATA (buffer), buffer->vbuffer.length); GST_MINI_OBJECT_CLASS (v4l2buffer_parent_class)->finalize (GST_MINI_OBJECT (buffer)); @@ -165,7 +165,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps) ret->vbuffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ret->vbuffer.memory = V4L2_MEMORY_MMAP; - if (ioctl (pool->video_fd, VIDIOC_QUERYBUF, &ret->vbuffer) < 0) + if (v4l2_ioctl (pool->video_fd, VIDIOC_QUERYBUF, &ret->vbuffer) < 0) goto querybuf_failed; GST_LOG (" index: %u", ret->vbuffer.index); @@ -179,7 +179,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps) GST_LOG (" length: %u", ret->vbuffer.length); GST_LOG (" input: %u", ret->vbuffer.input); - data = (guint8 *) mmap (0, ret->vbuffer.length, + data = (guint8 *) v4l2_mmap (0, ret->vbuffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, pool->video_fd, ret->vbuffer.m.offset); @@ -229,7 +229,7 @@ gst_v4l2_buffer_pool_finalize (GstV4l2BufferPool * pool) pool->lock = NULL; if (pool->video_fd >= 0) - close (pool->video_fd); + v4l2_close (pool->video_fd); if (pool->buffers) { g_free (pool->buffers); @@ -292,7 +292,7 @@ gst_v4l2_buffer_pool_new (GstV4l2Src * v4l2src, gint fd, gint num_buffers, pool = (GstV4l2BufferPool *) gst_mini_object_new (GST_TYPE_V4L2_BUFFER_POOL); - pool->video_fd = dup (fd); + pool->video_fd = v4l2_dup (fd); if (pool->video_fd < 0) goto dup_failed; @@ -344,7 +344,7 @@ gst_v4l2_buffer_pool_activate (GstV4l2BufferPool * pool, GstV4l2Src * v4l2src) GST_LOG ("enqueue pool buffer %d", n); - if (ioctl (pool->video_fd, VIDIOC_QBUF, buf) < 0) + if (v4l2_ioctl (pool->video_fd, VIDIOC_QBUF, buf) < 0) goto queue_failed; } pool->running = TRUE; @@ -527,7 +527,7 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src) format->index = n; format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) { + if (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_ENUM_FMT, format) < 0) { if (errno == EINVAL) { g_free (format); break; /* end of enumeration */ @@ -603,7 +603,7 @@ gst_v4l2src_probe_caps_for_format_and_size (GstV4l2Src * v4l2src, /* keep in mind that v4l2 gives us frame intervals (durations); we invert the * fraction to get framerate */ - if (ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) < 0) + if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) < 0) goto enum_frameintervals_failed; if (ival.type == V4L2_FRMIVAL_TYPE_DISCRETE) { @@ -629,7 +629,7 @@ gst_v4l2src_probe_caps_for_format_and_size (GstV4l2Src * v4l2src, gst_value_list_append_value (&rates, &rate); ival.index++; - } while (ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) >= 0); + } while (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMEINTERVALS, &ival) >= 0); } else if (ival.type == V4L2_FRMIVAL_TYPE_STEPWISE) { GValue min = { 0, }; GValue step = { 0, }; @@ -790,7 +790,7 @@ gst_v4l2src_probe_caps_for_format (GstV4l2Src * v4l2src, guint32 pixelformat, GST_DEBUG_OBJECT (v4l2src, "Enumerating frame sizes"); - if (ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &size) < 0) + if (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &size) < 0) goto enum_framesizes_failed; if (size.type == V4L2_FRMSIZE_TYPE_DISCRETE) { @@ -810,7 +810,7 @@ gst_v4l2src_probe_caps_for_format (GstV4l2Src * v4l2src, guint32 pixelformat, results = g_list_prepend (results, tmp); size.index++; - } while (ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &size) >= 0); + } while (v4l2_ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &size) >= 0); GST_DEBUG_OBJECT (v4l2src, "done iterating discrete frame sizes"); } else if (size.type == V4L2_FRMSIZE_TYPE_STEPWISE) { GST_DEBUG_OBJECT (v4l2src, "we have stepwise frame sizes:"); @@ -980,7 +980,7 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src, GstBuffer ** buf) buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buffer.memory = V4L2_MEMORY_MMAP; - while (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_DQBUF, &buffer) < 0) { + while (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_DQBUF, &buffer) < 0) { GST_WARNING_OBJECT (v4l2src, "problem grabbing frame %d (ix=%d), trials=%d, pool-ct=%d, buf.flags=%d", @@ -1198,7 +1198,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, memset (&format, 0x00, sizeof (struct v4l2_format)); format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (ioctl (fd, VIDIOC_G_FMT, &format) < 0) + if (v4l2_ioctl (fd, VIDIOC_G_FMT, &format) < 0) goto get_fmt_failed; format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -1210,7 +1210,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, * combined, there are other modes for requesting fields individually) */ format.fmt.pix.field = V4L2_FIELD_INTERLACED; - if (ioctl (fd, VIDIOC_S_FMT, &format) < 0) { + if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) { if (errno != EINVAL) goto set_fmt_failed; @@ -1219,7 +1219,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, format.fmt.pix.height = height; format.fmt.pix.pixelformat = pixelformat; format.fmt.pix.field = V4L2_FIELD_NONE; - if (ioctl (fd, VIDIOC_S_FMT, &format) < 0) + if (v4l2_ioctl (fd, VIDIOC_S_FMT, &format) < 0) goto set_fmt_failed; } @@ -1234,7 +1234,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, memset (&stream, 0x00, sizeof (struct v4l2_streamparm)); stream.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (ioctl (fd, VIDIOC_G_PARM, &stream) < 0) { + if (v4l2_ioctl (fd, VIDIOC_G_PARM, &stream) < 0) { GST_ELEMENT_WARNING (v4l2src, RESOURCE, SETTINGS, (_("Could not get parameters on device '%s'"), v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); @@ -1264,7 +1264,7 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, guint32 pixelformat, stream.parm.capture.timeperframe.denominator = fps_n; /* some cheap USB cam's won't accept any change */ - if (ioctl (fd, VIDIOC_S_PARM, &stream) < 0) { + if (v4l2_ioctl (fd, VIDIOC_S_PARM, &stream) < 0) { GST_ELEMENT_WARNING (v4l2src, RESOURCE, SETTINGS, (_("Video input device did not accept new frame rate setting.")), GST_ERROR_SYSTEM); @@ -1346,7 +1346,7 @@ gst_v4l2src_capture_init (GstV4l2Src * v4l2src, GstCaps * caps) breq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; breq.memory = V4L2_MEMORY_MMAP; - if (ioctl (fd, VIDIOC_REQBUFS, &breq) < 0) + if (v4l2_ioctl (fd, VIDIOC_REQBUFS, &breq) < 0) goto reqbufs_failed; GST_LOG_OBJECT (v4l2src, " count: %u", breq.count); @@ -1441,7 +1441,7 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) if (!gst_v4l2_buffer_pool_activate (v4l2src->pool, v4l2src)) goto pool_activate_failed; - if (ioctl (fd, VIDIOC_STREAMON, &type) < 0) + if (v4l2_ioctl (fd, VIDIOC_STREAMON, &type) < 0) goto streamon_failed; } @@ -1486,7 +1486,7 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) if (v4l2src->use_mmap) { /* we actually need to sync on all queued buffers but not * on the non-queued ones */ - if (ioctl (v4l2src->v4l2object->video_fd, VIDIOC_STREAMOFF, &type) < 0) + if (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_STREAMOFF, &type) < 0) goto streamoff_failed; } @@ -1562,14 +1562,14 @@ gst_v4l2src_get_nearest_size (GstV4l2Src * v4l2src, guint32 pixelformat, fmt.fmt.pix.pixelformat = pixelformat; fmt.fmt.pix.field = V4L2_FIELD_INTERLACED; - r = ioctl (fd, VIDIOC_TRY_FMT, &fmt); + r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt); if (r < 0 && errno == EINVAL) { /* try again with progressive video */ fmt.fmt.pix.width = *width; fmt.fmt.pix.height = *height; fmt.fmt.pix.pixelformat = pixelformat; fmt.fmt.pix.field = V4L2_FIELD_NONE; - r = ioctl (fd, VIDIOC_TRY_FMT, &fmt); + r = v4l2_ioctl (fd, VIDIOC_TRY_FMT, &fmt); } if (r < 0) { @@ -1589,14 +1589,14 @@ gst_v4l2src_get_nearest_size (GstV4l2Src * v4l2src, guint32 pixelformat, fmt.fmt.pix.width = *width; fmt.fmt.pix.height = *height; - r = ioctl (fd, VIDIOC_S_FMT, &fmt); + r = v4l2_ioctl (fd, VIDIOC_S_FMT, &fmt); if (r < 0 && errno == EINVAL) { /* try again with progressive video */ fmt.fmt.pix.width = *width; fmt.fmt.pix.height = *height; fmt.fmt.pix.pixelformat = pixelformat; fmt.fmt.pix.field = V4L2_FIELD_NONE; - r = ioctl (fd, VIDIOC_S_FMT, &fmt); + r = v4l2_ioctl (fd, VIDIOC_S_FMT, &fmt); } if (r < 0)