summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2object.h1
-rw-r--r--sys/v4l2/gstv4l2src.c10
-rw-r--r--sys/v4l2/v4l2_calls.c2
-rw-r--r--sys/v4l2/v4l2src_calls.c20
4 files changed, 25 insertions, 8 deletions
diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h
index c5bc3cb7..88d4eeeb 100644
--- a/sys/v4l2/gstv4l2object.h
+++ b/sys/v4l2/gstv4l2object.h
@@ -72,6 +72,7 @@ struct _GstV4l2Object {
/* the video-device's file descriptor */
gint video_fd;
GstPoll * poll;
+ gboolean can_poll_device;
/* the video buffer (mmap()'ed) */
guint8 **buffer;
diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c
index 9ebe101f..329ced5a 100644
--- a/sys/v4l2/gstv4l2src.c
+++ b/sys/v4l2/gstv4l2src.c
@@ -1248,8 +1248,14 @@ gst_v4l2src_get_read (GstV4l2Src * v4l2src, GstBuffer ** buf)
if (G_UNLIKELY (ret < 0)) {
if (errno == EBUSY)
goto stopped;
- if (errno != EAGAIN && errno != EINTR)
- goto select_error;
+ if (errno == ENXIO) {
+ GST_DEBUG_OBJECT (v4l2src,
+ "v4l2 device doesn't support polling. Disabling");
+ v4l2src->v4l2object->can_poll_device = FALSE;
+ } else {
+ if (errno != EAGAIN && errno != EINTR)
+ goto select_error;
+ }
}
amount =
v4l2_read (v4l2src->v4l2object->video_fd, GST_BUFFER_DATA (*buf),
diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
index f8a7d295..4fb1fad8 100644
--- a/sys/v4l2/v4l2_calls.c
+++ b/sys/v4l2/v4l2_calls.c
@@ -442,6 +442,8 @@ gst_v4l2_open (GstV4l2Object * v4l2object)
if (libv4l2_fd != -1)
v4l2object->video_fd = libv4l2_fd;
+ v4l2object->can_poll_device = TRUE;
+
/* get capabilities, error will be posted */
if (!gst_v4l2_get_capabilities (v4l2object))
goto error;
diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c
index 30556af4..3dd6e0e6 100644
--- a/sys/v4l2/v4l2src_calls.c
+++ b/sys/v4l2/v4l2src_calls.c
@@ -999,12 +999,20 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src, GstBuffer ** buf)
buffer.memory = V4L2_MEMORY_MMAP;
for (;;) {
- ret = gst_poll_wait (v4l2src->v4l2object->poll, GST_CLOCK_TIME_NONE);
- if (G_UNLIKELY (ret < 0)) {
- if (errno == EBUSY)
- goto stopped;
- if (errno != EAGAIN && errno != EINTR)
- goto select_error;
+ if (v4l2src->v4l2object->can_poll_device) {
+ ret = gst_poll_wait (v4l2src->v4l2object->poll, GST_CLOCK_TIME_NONE);
+ if (G_UNLIKELY (ret < 0)) {
+ if (errno == EBUSY)
+ goto stopped;
+ if (errno == ENXIO) {
+ GST_DEBUG_OBJECT (v4l2src,
+ "v4l2 device doesn't support polling. Disabling");
+ v4l2src->v4l2object->can_poll_device = FALSE;
+ } else {
+ if (errno != EAGAIN && errno != EINTR)
+ goto select_error;
+ }
+ }
}
if (v4l2_ioctl (v4l2src->v4l2object->video_fd, VIDIOC_DQBUF, &buffer) >= 0)