diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-25 08:37:12 -0400 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2008-09-25 08:37:12 -0400 |
commit | 7e39de54b4ed06bb2ababbe72b16f195d796d8f0 (patch) | |
tree | 5a74da414f5b1aaa78712988a989a00a94736648 /v4l2-apps/lib/libv4l/libv4l2/v4l2convert.c | |
parent | 968c43076f37c9f65df65fe50a1c643a82b1192b (diff) | |
parent | 9385e4874ef72f62d77800fe2eb47429d0854125 (diff) | |
download | mediapointer-dvb-s2-7e39de54b4ed06bb2ababbe72b16f195d796d8f0.tar.gz mediapointer-dvb-s2-7e39de54b4ed06bb2ababbe72b16f195d796d8f0.tar.bz2 |
merge: ~pb/v4l-dvb
From: Michael Krufky <mkrufky@linuxtv.org>
Priority: normal
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
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 */ |