From 1f46467cd4eae4c11e8f91554679f10ac8b2da53 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Sep 2009 10:08:44 -0300 Subject: Improve decode_tm6000 for better usage of mmap method From: Mauro Carvalho Chehab Now, mmap method is the default, when reading from tm6000 V4L2 device. Also, now, it is possible to specify the channel frequency via command line, and the number of video buffers to be used. Priority: normal Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/libv4l2util/v4l2_driver.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'v4l2-apps/libv4l2util/v4l2_driver.c') diff --git a/v4l2-apps/libv4l2util/v4l2_driver.c b/v4l2-apps/libv4l2util/v4l2_driver.c index 94f826968..919119b6a 100644 --- a/v4l2-apps/libv4l2util/v4l2_driver.c +++ b/v4l2-apps/libv4l2util/v4l2_driver.c @@ -646,6 +646,9 @@ int v4l2_mmap_bufs(struct v4l2_driver *drv, unsigned int num_buffers) return 0; } +/* Returns <0, if error, 0 if nothing to read and , if something + read + */ int v4l2_rcvbuf(struct v4l2_driver *drv, v4l2_recebe_buffer *rec_buf) { int ret; @@ -668,7 +671,7 @@ int v4l2_rcvbuf(struct v4l2_driver *drv, v4l2_recebe_buffer *rec_buf) default: perror ("dqbuf"); - return errno; + return -errno; } } prt_buf_info("DQBUF",&buf); @@ -677,19 +680,18 @@ int v4l2_rcvbuf(struct v4l2_driver *drv, v4l2_recebe_buffer *rec_buf) ret = rec_buf (&buf,&drv->bufs[buf.index]); - if (ret) { + if (ret<0) { v4l2_free_bufs(drv); return ret; } if (-1 == xioctl (drv->fd, VIDIOC_QBUF, &buf)) { perror ("qbuf"); - return errno; + return -errno; } - return 0; + return ret; } - int v4l2_start_streaming(struct v4l2_driver *drv) { uint32_t i; -- cgit v1.2.3