Fix javac command never caching input .md5s
[chromium-blink-merge.git] / third_party / v4l-utils / lib / include / libv4l2.h
blob8f3f55a158c4416e47c4771547ed4367984851ad
1 /*
2 # (C) 2008 Hans de Goede <hdegoede@redhat.com>
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU Lesser General Public License as published by
6 # the Free Software Foundation; either version 2.1 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
19 #ifndef __LIBV4L2_H
20 #define __LIBV4L2_H
22 #include <stdio.h>
23 #include <unistd.h>
24 #include <stdint.h>
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
30 #if HAVE_VISIBILITY
31 #define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
32 #else
33 #define LIBV4L_PUBLIC
34 #endif
36 /* Point this to a FILE opened for writing when you want to log error and
37 status messages to a file, when NULL errors will get send to stderr */
38 LIBV4L_PUBLIC extern FILE *v4l2_log_file;
40 /* Just like your regular open/close/etc, except that format conversion is
41 done if necessary when capturing. That is if you (try to) set a capture
42 format which is not supported by the cam, but is supported by libv4lconvert,
43 then the try_fmt / set_fmt will succeed as if the cam supports the format
44 and on dqbuf / read the data will be converted for you and returned in
45 the request format. enum_fmt will also report support for the formats to
46 which conversion is possible.
48 Another difference is that you can make v4l2_read() calls even on devices
49 which do not support the regular read() method.
51 Note the device name passed to v4l2_open must be of a video4linux2 device,
52 if it is anything else (including a video4linux1 device), v4l2_open will
53 fail.
55 Note that the argument to v4l2_ioctl after the request must be a valid
56 memory address of structure of the appropriate type for the request (for
57 v4l2 requests which expect a structure address). Passing in NULL or an
58 invalid memory address will not lead to failure with errno being EFAULT,
59 as it would with a real ioctl, but will cause libv4l2 to break, and you
60 get to keep both pieces.
63 LIBV4L_PUBLIC int v4l2_open(const char *file, int oflag, ...);
64 LIBV4L_PUBLIC int v4l2_close(int fd);
65 LIBV4L_PUBLIC int v4l2_dup(int fd);
66 LIBV4L_PUBLIC int v4l2_ioctl(int fd, unsigned long int request, ...);
67 LIBV4L_PUBLIC ssize_t v4l2_read(int fd, void *buffer, size_t n);
68 LIBV4L_PUBLIC ssize_t v4l2_write(int fd, const void *buffer, size_t n);
69 LIBV4L_PUBLIC void *v4l2_mmap(void *start, size_t length, int prot, int flags,
70 int fd, int64_t offset);
71 LIBV4L_PUBLIC int v4l2_munmap(void *_start, size_t length);
74 /* Misc utility functions */
76 /* This function takes a value of 0 - 65535, and then scales that range to
77 the actual range of the given v4l control id, and then if the cid exists
78 and is not locked sets the cid to the scaled value.
80 Normally returns 0, even if the cid did not exist or was locked, returns
81 non 0 when an other error occured. */
82 LIBV4L_PUBLIC int v4l2_set_control(int fd, int cid, int value);
84 /* This function returns a value of 0 - 65535, scaled to from the actual range
85 of the given v4l control id. When the cid does not exist, or could not be
86 accessed -1 is returned. */
87 LIBV4L_PUBLIC int v4l2_get_control(int fd, int cid);
90 /* "low level" access functions, these functions allow somewhat lower level
91 access to libv4l2 (currently there only is v4l2_fd_open here) */
93 /* Flags for v4l2_fd_open's v4l2_flags argument */
95 /* Disable all format conversion done by libv4l2, this includes the software
96 whitebalance, gamma correction, flipping, etc. libv4lconvert does. Use this
97 if you want raw frame data, but still want the additional error checks and
98 the read() emulation libv4l2 offers. */
99 #define V4L2_DISABLE_CONVERSION 0x01
100 /* This flag is *OBSOLETE*, since version 0.5.98 libv4l *always* reports
101 emulated formats to ENUM_FMT, except when conversion is disabled. */
102 #define V4L2_ENABLE_ENUM_FMT_EMULATION 0x02
104 /* v4l2_fd_open: open an already opened fd for further use through
105 v4l2lib and possibly modify libv4l2's default behavior through the
106 v4l2_flags argument.
108 Returns fd on success, -1 if the fd is not suitable for use through libv4l2
109 (note the fd is left open in this case). */
110 LIBV4L_PUBLIC int v4l2_fd_open(int fd, int v4l2_flags);
112 #ifdef __cplusplus
114 #endif /* __cplusplus */
116 #endif