diff options
| author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-04 14:51:50 -0300 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-04 14:51:50 -0300 |
| commit | 88778479f1fa5916aa079b9c17929716ebc182a6 (patch) | |
| tree | 8960ed0705c81262a8b534cf182c6b56d07bb6b4 /v4l2-apps/lib/libv4l/libv4l1/libv4l1.c | |
| parent | 5fa51c4127709c7bcbcbbc6e14b4780908e36990 (diff) | |
| parent | edd1d19fe9c951f51b87b6a614f3e5abc2a6c12e (diff) | |
| download | mediapointer-dvb-s2-88778479f1fa5916aa079b9c17929716ebc182a6.tar.gz mediapointer-dvb-s2-88778479f1fa5916aa079b9c17929716ebc182a6.tar.bz2 | |
merge: http://linuxtv.org/hg/~tmerle/cinergyT2
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Priority: normal
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l1/libv4l1.c')
| -rw-r--r-- | v4l2-apps/lib/libv4l/libv4l1/libv4l1.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c index 39f2d29e0..797c8768a 100644 --- a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c +++ b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c @@ -259,6 +259,15 @@ int v4l1_open (const char *file, int oflag, ...) struct v4l2_format fmt2; struct v4l2_input input2; struct v4l2_standard standard2; + 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) @@ -276,11 +285,7 @@ int v4l1_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, no need to emulate v4l1 on |
