summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-12-01 15:33:55 -0200
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-12-01 15:33:55 -0200
commit655f032b6b86ac96cefcefe344e181d83d197c87 (patch)
tree379866364afce7b20f3cb6eb9cb0f472c09854ad /v4l2-apps/lib
parentb3ceea6006597e232746dc87188c71ba307cd681 (diff)
downloadmediapointer-dvb-s2-655f032b6b86ac96cefcefe344e181d83d197c87.tar.gz
mediapointer-dvb-s2-655f032b6b86ac96cefcefe344e181d83d197c87.tar.bz2
Fix free buffer handling
From: Mauro Carvalho Chehab <mchehab@infradead.org> There is a non-compliance on video-buf implementation about calling REQBUFS with count=0. According with API, this should free all buffers, but video-buf returns, instead, -EINVAL. Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l2-apps/lib')
-rw-r--r--v4l2-apps/lib/v4l2_driver.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/v4l2-apps/lib/v4l2_driver.c b/v4l2-apps/lib/v4l2_driver.c
index 3c156f459..a73d6a3f5 100644
--- a/v4l2-apps/lib/v4l2_driver.c
+++ b/v4l2-apps/lib/v4l2_driver.c
@@ -525,10 +525,21 @@ int v4l2_free_bufs(struct v4l2_driver *drv)
drv->reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
drv->reqbuf.memory = V4L2_MEMORY_MMAP;
+ /* stop capture */
+ if (xioctl(drv->fd,VIDIOC_STREAMOFF,&drv->reqbuf.type)<0)
+ return errno;
+
+ sleep (1); // FIXME: Should check if all buffers are stopped
+
+/* V4L2 API says REQBUFS with count=0 should be used to release buffer.
+ However, video-buf.c doesn't implement it.
+ */
+#if 0
if (xioctl(drv->fd,VIDIOC_REQBUFS,&drv->reqbuf)<0) {
perror("reqbufs while freeing buffers");
return errno;
}
+#endif
if (drv->reqbuf.count != 0) {
fprintf(stderr,"REQBUFS returned %d buffers while asking for freeing it!\n",
@@ -693,12 +704,6 @@ prt_buf_info("***QBUF",drv->v4l2_bufs[i]);
int v4l2_stop_streaming(struct v4l2_driver *drv)
{
- /* stop capture */
- if (xioctl(drv->fd,VIDIOC_STREAMOFF,&drv->reqbuf.type)<0)
- return errno;
-
- sleep (1); // FIXME: Should check if all buffers are stopped
-
v4l2_free_bufs(drv);
return 0;