From d4126ff9860eaa6cc954df327d195dd120e0bae7 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Wed, 5 Sep 2012 16:39:31 +0200 Subject: [PATCH] v4l2: also poll for output devices Note that the V4L2 API defines that for output devices POLLOUT indicates that a buffer is ready to be dequeued. https://bugzilla.gnome.org/show_bug.cgi?id=698992 --- sys/v4l2/gstv4l2bufferpool.c | 9 ++------- sys/v4l2/v4l2_calls.c | 5 ++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index f885156..53e3700 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -632,13 +632,8 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer) GstV4l2Object *obj = pool->obj; GstClockTime timestamp; - if (obj->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { - /* select works for input devices when data is available. According to the - * specs we can also poll to find out when a frame has been displayed but - * that just seems to lock up here */ - if ((res = gst_v4l2_object_poll (obj)) != GST_FLOW_OK) - goto poll_error; - } + if ((res = gst_v4l2_object_poll (obj)) != GST_FLOW_OK) + goto poll_error; memset (&vbuffer, 0x00, sizeof (vbuffer)); vbuffer.type = obj->type; diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index e9201a2..21262ba 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -481,7 +481,10 @@ gst_v4l2_open (GstV4l2Object * v4l2object) pollfd.fd = v4l2object->video_fd; gst_poll_add_fd (v4l2object->poll, &pollfd); - gst_poll_fd_ctl_read (v4l2object->poll, &pollfd, TRUE); + if (v4l2object->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + gst_poll_fd_ctl_read (v4l2object->poll, &pollfd, TRUE); + else + gst_poll_fd_ctl_write (v4l2object->poll, &pollfd, TRUE); return TRUE; -- 2.7.4