summaryrefslogtreecommitdiff
path: root/v4l2-apps/lib/libv4l/libv4l1
diff options
context:
space:
mode:
authorThierry MERLE <thierry.merle@free.fr>2008-07-06 14:07:34 +0200
committerThierry MERLE <thierry.merle@free.fr>2008-07-06 14:07:34 +0200
commitab715d2e8eb29998b60fa3bbc1ad95441cfb69b3 (patch)
tree78731a6290210dba267ee4f6f3655659334835d4 /v4l2-apps/lib/libv4l/libv4l1
parentc1a4267284bcd81240221187f5a16454f36ba02e (diff)
downloadmediapointer-dvb-s2-ab715d2e8eb29998b60fa3bbc1ad95441cfb69b3.tar.gz
mediapointer-dvb-s2-ab715d2e8eb29998b60fa3bbc1ad95441cfb69b3.tar.bz2
v4l2-library: libv4l-sync-with-0.3.3-release
From: Hans de Goede <j.w.r.degoede@hhs.nl> * Add open64 and mmap64 wrappers to the LD_PRELOAD wrapper libs, so that they also work for applications compiled with FILE_OFFSET_BITS=64, this fixes using them with v4l-info * While looking at xawtv in general, found a few bugs in xawtv itself, added a patch to fix those to the appl-patches dir * Talking about the appl-patches dir, restore that as it accidentally got dropped from 0.3.2 * Be more verbose in various places when it comes to logging (esp errors) * Change v4lconvert_enum_fmt code a bit, so that it is easier to add more supported destination formats to libv4lconvert * Don't return -EINVAL from try_fmt when we cannot convert because the cam doesn't have any formats we know. Instead just return as format whatever the cam returns from try_fmt, this new behavior is compliant with the v4l2 api as documented Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l1')
-rw-r--r--v4l2-apps/lib/libv4l/libv4l1/libv4l1.c8
-rw-r--r--v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c29
2 files changed, 32 insertions, 5 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c
index 7f5e79e3d..4a54047df 100644
--- a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c
+++ b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c
@@ -40,9 +40,6 @@
in turn will call v4l1_open, so therefor v4l1_open (for example) may not
use the regular open()!
*/
-
-#define _LARGEFILE64_SOURCE 1
-
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
@@ -642,7 +639,8 @@ int v4l1_ioctl (int fd, unsigned long int request, ...)
}
if (devices[index].v4l1_frame_pointer == MAP_FAILED) {
- devices[index].v4l1_frame_pointer = mmap64(NULL, mbuf->size,
+ devices[index].v4l1_frame_pointer = (void *)syscall(SYS_mmap, NULL,
+ (size_t)mbuf->size,
PROT_READ|PROT_WRITE,
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
if (devices[index].v4l1_frame_pointer == MAP_FAILED) {
@@ -749,7 +747,7 @@ ssize_t v4l1_read(int fd, void* buffer, size_t n)
void *v4l1_mmap(void *start, size_t length, int prot, int flags, int fd,
- __off_t offset)
+ __off64_t offset)
{
int index;
void *result;
diff --git a/v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c b/v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c
index 4a4e5c253..db3a0027b 100644
--- a/v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c
+++ b/v4l2-apps/lib/libv4l/libv4l1/v4l1compat.c
@@ -19,6 +19,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _LARGEFILE64_SOURCE 1
+
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
@@ -50,6 +52,27 @@ int open (const char *file, int oflag, ...)
return fd;
}
+int open64 (const char *file, int oflag, ...)
+{
+ int fd;
+
+ if (oflag & O_CREAT)
+ {
+ va_list ap;
+ mode_t mode;
+
+ va_start (ap, oflag);
+ mode = va_arg (ap, mode_t);
+
+ fd = v4l1_open(file, oflag | O_LARGEFILE, mode);
+
+ va_end(ap);
+ } else
+ fd = v4l1_open(file, oflag | O_LARGEFILE);
+
+ return fd;
+}
+
int close(int fd) {
return v4l1_close(fd);
}
@@ -82,6 +105,12 @@ void mmap(void *start, size_t length, int prot, int flags, int fd,
return v4l1_mmap(start, length, prot, flags, fd, offset);
}
+void mmap64(void *start, size_t length, int prot, int flags, int fd,
+ __off64_t offset)
+{
+ return v4l1_mmap(start, length, prot, flags, fd, offset);
+}
+
int munmap(void *start, size_t length)
{
return v4l1_munmap(start, length);