diff options
author | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-09-15 13:48:21 +0200 |
---|---|---|
committer | hans@localhost.localdomain <hans@localhost.localdomain> | 2008-09-15 13:48:21 +0200 |
commit | 37365f711151fceee2bbc87ef7836c5f08b7c1f1 (patch) | |
tree | 75939c8fa46e5f8c4e242873521c0852366ce427 /v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c | |
parent | d00cfd7d61d0a9cf2b38a816bfd5478f3342a0e4 (diff) | |
download | mediapointer-dvb-s2-37365f711151fceee2bbc87ef7836c5f08b7c1f1.tar.gz mediapointer-dvb-s2-37365f711151fceee2bbc87ef7836c5f08b7c1f1.tar.bz2 |
libv4l: 0.5.0 release
From: Hans de Goede <hdegoede@redhat.com>
* Add support for enumerating framesizes and frameintervals of emulated
formats when the driver supports it for the real format
* Make sure the video device always gets opened RW even if the application
asks for RO
* Add Genius E-Messenger 112 (093a:2476) to list of cams which have their
sensor upside down
Priority: normal
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c')
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c b/v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c index e8756f338..307a03ce5 100644 --- a/v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c +++ b/v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c @@ -53,6 +53,15 @@ LIBV4L_PUBLIC int open (const char *file, int oflag, ...) { int fd; struct v4l2_capability cap; + int v4l_device = 0; + + /* check if we're opening a video4linux2 device */ + if (!strncmp(file, "/dev/video", 10) || !strncmp(file, "/dev/v4l/", 9)) { + /* Some apps open the device read only, but we need rw rights as the + buffers *MUST* be mapped rw */ + oflag = (oflag & ~O_ACCMODE) | O_RDWR; + v4l_device = 1; + } /* original open code */ if (oflag & O_CREAT) @@ -70,11 +79,7 @@ LIBV4L_PUBLIC int open (const char *file, int oflag, ...) fd = syscall(SYS_open, file, oflag); /* end of original open code */ - if (fd == -1) - return fd; - - /* check if we're opening a video4linux2 device */ - if (strncmp(file, "/dev/video", 10) && strncmp(file, "/dev/v4l/", 9)) + if (fd == -1 || !v4l_device) return fd; /* check that this is an v4l2 device, libv4l2 only supports v4l2 devices */ |