summaryrefslogtreecommitdiff
path: root/v4l2-apps/libv4l
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-09-03 13:28:26 +0200
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-09-03 13:28:26 +0200
commit8ea6a6c6c6f581cbf41e8813f6edb45acd1181f6 (patch)
treedcbd81100eb7b91e04499a594a26c43da19ab418 /v4l2-apps/libv4l
parent7e03d3ad29c248556b9818b159316f551b4b7c8c (diff)
downloadmediapointer-dvb-s2-8ea6a6c6c6f581cbf41e8813f6edb45acd1181f6.tar.gz
mediapointer-dvb-s2-8ea6a6c6c6f581cbf41e8813f6edb45acd1181f6.tar.bz2
libv4l: enable libv4l2 usage with devices which just support read()
From: Hans de Goede <hdegoede@redhat.com> libv4l: enable libv4l2 usage with devices which just support read(), this allows applications to work with mpeg capture devices like the cx18, which only do read() and only support mpeg and some exotic raw format (which libv4l can convert). Thanks to Simon Farnsworth <simon.farnsworth@onelan.com> for testing this. Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/libv4l')
-rw-r--r--v4l2-apps/libv4l/libv4l2/libv4l2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/v4l2-apps/libv4l/libv4l2/libv4l2.c b/v4l2-apps/libv4l/libv4l2/libv4l2.c
index c035ae533..3366538a7 100644
--- a/v4l2-apps/libv4l/libv4l2/libv4l2.c
+++ b/v4l2-apps/libv4l/libv4l2/libv4l2.c
@@ -312,7 +312,6 @@ static int v4l2_read_and_convert(int index, unsigned char *dest, int dest_size)
int result, buf_size, tries = max_tries;
buf_size = devices[index].dest_fmt.fmt.pix.sizeimage;
- buf_size = (buf_size + 8191) & ~8191;
if (devices[index].readbuf_size < buf_size) {
unsigned char *new_buf;
@@ -526,10 +525,9 @@ int v4l2_fd_open(int fd, int v4l2_flags)
return -1;
}
- /* we only add functionality for video capture devices, and we do not
- handle devices which don't do mmap */
+ /* we only add functionality for video capture devices */
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) ||
- !(cap.capabilities & V4L2_CAP_STREAMING))
+ !(cap.capabilities & (V4L2_CAP_STREAMING|V4L2_CAP_READWRITE)))
return fd;
/* Get current cam format */
@@ -564,6 +562,8 @@ int v4l2_fd_open(int fd, int v4l2_flags)
devices[index].flags = v4l2_flags;
if (cap.capabilities & V4L2_CAP_READWRITE)
devices[index].flags |= V4L2_SUPPORTS_READ;
+ if (!(cap.capabilities & V4L2_CAP_STREAMING))
+ devices[index].flags |= V4L2_USE_READ_FOR_READ;
if (!strcmp((char *)cap.driver, "uvcvideo"))
devices[index].flags |= V4L2_IS_UVC;
devices[index].open_count = 1;
@@ -571,7 +571,7 @@ int v4l2_fd_open(int fd, int v4l2_flags)
devices[index].dest_fmt = fmt;
/* When a user does a try_fmt with the current dest_fmt and the dest_fmt
- is a supported one we will align the resulution (see try_fmt for why).
+ is a supported one we will align the resolution (see try_fmt for why).
Do the same here now, so that a try_fmt on the result of a get_fmt done
immediately after open leaves the fmt unchanged. */
if (v4lconvert_supported_dst_format(