|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | - | - |
| contrib/ | | 04-Jul-2025 | - | 38,331 | 29,223 |
| doc/ | | 04-Jul-2025 | - | 2,578 | 2,004 |
| include/ | | 04-Jul-2025 | - | 21,734 | 10,621 |
| lib/ | | 04-Jul-2025 | - | 54,329 | 34,905 |
| libdvbv5-po/ | | 04-Jul-2025 | - | 4,281 | 3,354 |
| utils/ | | 04-Jul-2025 | - | 157,548 | 132,263 |
| v4l-utils-po/ | | 04-Jul-2025 | - | 13,214 | 10,535 |
| .gitattributes | D | 04-Jul-2025 | 54 | 3 | 2 |
| .gitignore | D | 04-Jul-2025 | 24 | 5 | 4 |
| Android.bp | D | 04-Jul-2025 | 5.7 KiB | 207 | 190 |
| COPYING | D | 04-Jul-2025 | 17.6 KiB | 342 | 281 |
| COPYING.libdvbv5 | D | 04-Jul-2025 | 25.8 KiB | 509 | 431 |
| COPYING.libv4l | D | 04-Jul-2025 | 25.8 KiB | 511 | 430 |
| ChangeLog | D | 04-Jul-2025 | 219.8 KiB | 4,827 | 4,439 |
| INSTALL.md | D | 04-Jul-2025 | 3.1 KiB | 143 | 106 |
| LICENSE | D | 04-Jul-2025 | 90.6 KiB | 1,783 | 1,456 |
| METADATA | D | 04-Jul-2025 | 395 | 17 | 15 |
| MODULE_LICENSE_BSD | D | 04-Jul-2025 | 0 | | |
| MODULE_LICENSE_GPL2 | D | 04-Jul-2025 | 0 | | |
| MODULE_LICENSE_LGPL2.1 | D | 04-Jul-2025 | 0 | | |
| OWNERS | D | 04-Jul-2025 | 51 | 2 | 1 |
| README.lib-multi-threading | D | 04-Jul-2025 | 520 | 13 | 9 |
| README.libv4l | D | 04-Jul-2025 | 8 KiB | 185 | 137 |
| README.md | D | 04-Jul-2025 | 7.9 KiB | 286 | 176 |
| TODO | D | 04-Jul-2025 | 1.7 KiB | 51 | 32 |
| TODO.libdvbv5 | D | 04-Jul-2025 | 139 | 3 | 3 |
| android-config.h | D | 04-Jul-2025 | 3.2 KiB | 121 | 34 |
| meson.build | D | 04-Jul-2025 | 13.7 KiB | 460 | 392 |
| meson_options.txt | D | 04-Jul-2025 | 2.6 KiB | 57 | 53 |
| sync-with-kernel.sh | D | 04-Jul-2025 | 7.3 KiB | 157 | 126 |
| v4l-utils.spec.in | D | 04-Jul-2025 | 13.3 KiB | 400 | 295 |
README.lib-multi-threading
1libv4lconvert is not safe for using one convert instance as returned by
2v4lconvert_create from multiple threads, if you want to use one v4lconvert
3instance from multiple threads you must provide your own locking and make
4sure no simultaneous calls are made.
5
6libv4l1 and libv4l2 are safe for multithread use *under* *the* *following*
7*conditions* :
8
9* when using v4lx_fd_open, do not make any v4lx_ calls to the passed fd until
10 v4lx_fd_open has completed
11
12* all v4lx_ calls must be completed before calling v4lx_close
13
README.libv4l
1Introduction
2------------
3
4libv4l is a collection of libraries which adds a thin abstraction layer on
5top of video4linux2 devices. The purpose of this (thin) layer is to make it
6easy for application writers to support a wide variety of devices without
7having to write separate code for different devices in the same class.
8
9All libv4l components are licensed under the GNU Lesser General Public
10License version 2 or (at your option) any later version.
11
12libv4l consists of 3 different libraries:
13
14
15libv4lconvert
16-------------
17
18libv4lconvert started as a library to convert from any (known) pixelformat to
19V4l2_PIX_FMT_BGR24, RGB24, YUV420 or YVU420.
20
21The list of know source formats is large and continually growing, so instead
22of keeping an (almost always outdated) list here in the README, I refer you
23to the source, see the list of defines at the top of
24libv4lconvert/libv4lconvert.c for the full list.
25For more details on the v4lconvert_ functions see libv4lconvert.h.
26
27Later on libv4lconvert was expanded to also be able to do various video
28processing functions to improve webcam video quality on a software basis. So
29the name no longer 100% covers the functionality. The video processing is
30split in to 2 parts, libv4lconvert/control and libv4lconvert/processing.
31
32The control part is used to offer video controls which can be used to control
33the video processing functions made available by libv4lconvert/processing.
34These controls are stored application wide (until reboot) by using a
35persistent shared memory object.
36
37libv4lconvert/processing offers the actual video processing functionality.
38
39
40libv4l1
41-------
42
43This offers functions like v4l1_open, v4l1_ioctl, etc. which can by used to
44quickly make v4l1 applications work with v4l2 devices. These functions work
45exactly like the normal open/close/etc, except that libv4l1 does full emulation
46of the v4l1 api on top of v4l2 drivers, in case of v4l1 drivers it will just
47pass calls through. For more details on the v4l1_ functions see libv4l1.h .
48
49
50libv4l2
51-------
52
53This offers functions like v4l2_open, v4l2_ioctl, etc. which can by used to
54quickly make v4l2 applications work with v4l2 devices with weird formats.
55libv4l2 mostly passes calls directly through to the v4l2 driver. When the
56app does a TRY_FMT / S_FMT with a not supported format libv4l2 will get in
57the middle and emulate the format (if an app wants to know which formats the
58hardware can _really_ do it should use ENUM_FMT, not randomly try a bunch of
59S_FMT's). For more details on the v4l2_ functions see libv4l2.h .
60
61
62libdvbv5
63--------
64
65This library provides the DVBv5 API to userspace programs. It can be used to
66open DVB adapters, tune transponders and read PES and other data streams.
67There are as well several parsers for DVB, ATSC, ISBT formats.
68
69The API is currently EXPERIMENTAL and likely to change.
70Run configure with --enable-libdvbv5 in order to build a shared lib and
71install the header files.
72
73
74wrappers
75--------
76
77The functionality provided by libv4l1 for v4l1 apps and libv4l2 for v4l2 apps
78can also be used by existing apps without modifying them. For this purpose
792 wrapper libraries are provided which can be preloaded before starting the
80application using the LD_PRELOAD environment variable. These wrappers will
81then intercept calls to open/close/ioctl/etc. and if these calls directed
82towards a video device the wrapper will redirect the call to the libv4lX
83counterparts.
84
85The preloadable libv4l1 wrapper which adds v4l2 device compatibility to v4l1
86applications is called v4l1compat.so. The preloadable libv4l2 wrapper which
87adds support for various pixelformats to v4l2 applications is called
88v4l2convert.so.
89
90Example usage (after install in default location):
91$ export LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so
92$ camorama
93
94
95Prerequisites
96-------------
97
98libv4l requires shmem file system support in the kernel (CONFIG_SHMEM).
99
100
101FAQ
102---
103
104Q: Why libv4l, whats wrong with directly accessing v4l2 devices ?
105Q: Do we really need yet another library ?
106A: Current webcam using applications like ekiga contain code to handle many
107different specific pixelformats webcam's use, but that code only supports a
108small subset of all native webcam (compressed) pixelformats. Other current
109v4l2 applications do not support anything but rgb pixelformats (xawtv for
110example) and this will not work with most webcams at all.
111
112With gspca being ported to v4l2 and thus decoding to normal formats being
113removed from the device driver as this really belongs in userspace, ekiga
114would need to be extended with many more often chip dependent formats, like
115the bayer compression used by the spca561 and the (different) compression used
116by the pac207 and the (again different) compression used by the sn9c102. Adding
117support for all these formats should not be done at the application level, as
118then it needs to be written for each application separately. Licensing issues
119with the decompressors will then also become a problem as just cut and pasting
120from one application to another is bound to hit license incompatibilities.
121
122So clearly this belongs in a library, and in a library with a license which
123allows this code to be used from as many different applications as possible.
124Hence libv4l was born.
125
126
127Q: Under which license may I use and distribute libv4l?
128A: The libv4l libraries are licensed under the GNU Library General Publishing
129License version 2 or (at your option) any later version. See the included
130COPYING.LIBV4L file. The decompression helpers are licensed under the GNU
131Library Publishing License version 2 (as they are derived from kernel code)
132
133
134Q: Okay so I get the use of having a libv4lconvert, but why libv4l1 ?
135A: Many v4l2 drivers do not offer full v4l1 compatibility. They often do not
136implemented the CGMBUF ioctl and v4l1 style mmap call. Adding support to all
137these drivers for this is a lot of work and more importantly unnecessary
138adds code to kernel space.
139
140Also even if the CGMBUF ioctl and v4l1 style mmap are supported, then most
141cams still deliver pixelformats which v4l1 applications do not understand.
142
143This libv4l1 was born as an easy way to get v4l1 applications to work with
144v4l2 devices without requiring full v4l1 emulation (including format
145conversion) in the kernel, and without requiring major changes to the
146applications.
147
148
149Q: Why should I use libv4l2 in my app instead of direct device access
150 combined with libv4lconvert?
151A: libv4l2 is mainly meant for quickly and easily adding support for more
152pixelformats to existing v4l2 applications. So if you feel better directly
153accessing the device in combination with libv4lconvert that's fine too.
154
155Notice that libv4l2 also does emulation of the read() call on devices which
156do not support it in the driver. In the background this uses mmap buffers
157(even on devices which do support the read call). This mmap gives libv4lconvert
158zero-copy access to the captured frame, and then it can write the converted
159data directly to the buffer the application provided to v4l2_read(). Thus
160another reason to use libv4l2 is to get the no memcpy advantage of the mmap
161capture method combined with the simplicity of making a simple read() call.
162
163
164Q: Where to send bugreports / questions?
165A: Please send libv4l questions / bugreports to the:
166 Linux Media Mailing List <linux-media@vger.kernel.org>
167 Subscription is not necessary to send mail to this list. If you're not
168 subscribed please put yourself in the CC of your original mail so you
169 will receive replies.
170
171Q: How do I port my application to libv4l1?
172A: Just replace the open call for your device by v4l1_open and all
173 following calls concerning this device file descriptor by their
174 counterpart v4l1_xxx (for a list see libv4l1.h).
175
176Q: How do I port my application to libv4l2?
177A: Just replace the open call for your device by v4l2_open and all
178 following calls concerning this device file descriptor by their
179 counterpart v4l2_xxx (for a list see libv4l2.h).
180
181Q: I still need an example how to convert my application!
182A: Check out the patches for the VLC media player:
183 https://trac.videolan.org/vlc/attachment/ticket/1804/vlc-0.8.6-libv4l1.patch
184 https://trac.videolan.org/vlc/attachment/ticket/1804/vlc-0.9.3-libv4l2.patch
185
README.md
1# v4l-utils
2
3Linux utilities and libraries to handle media devices (TV devices, capture
4devices, radio devices, remote controllers).
5
6You can always find the latest development v4l-utils in the git repo:
7[http://git.linuxtv.org/v4l-utils.git](http://git.linuxtv.org/v4l-utils.git).
8
9Those utilities follow the latest Linux Kernel media API, as documented at:
10[http://linuxtv.org/downloads/v4l-dvb-apis/](http://linuxtv.org/downloads/v4l-dvb-apis/).
11
12Any questions/remarks/patches can be sent to the linux-media mailinglist. See
13[https://linuxtv.org/lists.php](https://linuxtv.org/lists.php) for more
14information about the mailinglist.
15
16There is also a wiki page for the v4l-utils:
17[https://linuxtv.org/wiki/index.php/V4l-utils](https://linuxtv.org/wiki/index.php/V4l-utils).
18
19## Building
20
21v4l-utils uses the meson build system.
22
23A number of packages is required to fully build v4l-utils. The first step is to
24install those packages. The package names are different on each distro.
25
26On Debian and derivated distributions, you need to install the following
27packages with `apt-get` or `aptitude`:
28
29```
30debhelper doxygen gcc git graphviz libasound2-dev libjpeg-dev
31libqt5opengl5-dev libudev-dev libx11-dev meson pkg-config
32qtbase5-dev udev libsdl2-dev libbpf-dev llvm clang
33```
34
35On Fedora, the package list for a minimal install with `dnf` or `yum` is:
36
37```
38gcc gcc-c++ gettext-devel git meson perl which
39```
40
41(git is only requiried if you're cloning from the main git repository at
42linuxtv.org).
43
44And, to be able to compile it with all usual functionality with qt5, you'll need
45also:
46
47```
48alsa-lib-devel doxygen libjpeg-turbo-devel qt5-qtbase-devel libudev-devel
49mesa-libGLU-devel
50```
51
52The v4l2-tracer also needs the json-c library. On Debian: `libjson-c-dev' ; on
53Fedora: `json-c-devel`.
54
55After downloading and installing the needed packages on your distribution, you
56should run:
57
58```
59meson build/
60ninja -C build/
61```
62
63And, to install on your system:
64
65```
66sudo ninja -C build/ install
67```
68
69### Optional features
70
71Please notice that there's an extra feature to add an extra table to decode
72Japanese DVB tables via iconv. This is meant to be used when the iconv itself
73doesn't come with the *ARIB-STD-B24* and *EN300-468-TAB00* tables.
74
75gconv is an auto feature, so it will be auto-enabled in case the dependencies
76are satisfied. However, the gconv feature can be forced to enabled by running
77the following command during configuration step:
78
79```
80meson configure -Dgconv=enabled build/
81```
82
83## Versioning
84
85The v4l-utils doesn't quite follow the release versioning defined at
86[semver.org](https://semver.org/).
87
88Instead, since version 1.0, it uses `MAJOR.MINOR.PATCH`. Where:
89
90* `MINOR` - an odd number means a development version. When the development is
91closed, we release an even numbered version and start a newer odd version;
92
93* `MAJOR` - It is incremented when `MINOR` number starts to be too big. The last
94change occurred from 0.9.x to 1.0.
95
96* All numbers start with 0.
97
98All versions have their own tags, except for the current development version
99(with uses the master branch at the git tree).
100
101The `PATCH` meaning actually depends if the version is stable or development.
102
103* For even `MAJOR.MINOR` versions (1.0, 1.2, 1.4, 1.6, ...): `PATCH` is
104incremented when just bug fixes are added;
105
106* For odd `MAJOR.MINOR` versions (1.1, 1.3, 1.5, 1.7, ...): `PATCH` is
107incremented for release candidate versions.
108
109### API/ABI stability:
110
111There should not have any API/ABI changes when `PATCH` is incremented.
112
113When `MAJOR` and/or `MINOR` are incremented, the API/ABI for the libraries might
114change, although we do all the efforts for not doing it, except when inevitable.
115
116The `TODO` files should specify the events that will generate API/ABI breaks.
117
118## Media libraries
119
120There are currently three media libraries defined at `lib/` directory, meant to
121be used internally and by other applications.
122
123### libv4l
124
125This library is meant to be used by applications that need to talk with V4L2
126devices (webcams, analog TV, stream grabbers).
127
128It can be found on the following directories:
129
130```
131lib/libv4l1/
132lib/libv4l2/
133lib/libv4l-mplane/
134lib/libv4lconvert/
135```
136
137See `README.libv4l` for more information on libv4l.
138
139The libv4l is released under the GNU Lesser General Public License.
140
141### libdvbv5
142
143This library is meant to be used by digital TV applications that need to talk
144with media hardware.
145
146Full documentation is provided via Doxygen. Building documentation is enabled
147by the auto feature: `doxygen-doc`. If enabled, it will be built within the
148project.
149
150It is possible to generate documentation in html, man pages and pdf formats.
151
152The documentation is also available via web, at:
153[http://linuxtv.org/docs/libdvbv5/](http://linuxtv.org/docs/libdvbv5/).
154
155It can be found on the following directory `lib/libdvbv5/`.
156
157The libdvbv5 is released under GPL version 2.
158
159### libv4l2rds
160
161This library provides support for RDS radio applications.
162
163It can be found on the following directory `lib/libv4l2rds/`.
164
165The libv4l is released under the GNU Lesser General Public License.
166
167## Utilities
168
169The utilities are stored under `utils/` directory.
170
171The (for now for v4l-utils private use only) libv4l2util library is released
172under the GNU Lesser General Public License, all other code is released under
173the GNU General Public License.
174
175v4l-utils includes the following utilities:
176
177### decode\_tm6000
178
179Decodes tm6000 proprietary format streams.
180
181Installed under `<prefix>/bin`.
182
183### ir-keytable
184
185Dump, Load or Modify ir receiver input tables. The ir tables for remotes which
186are known by the kernel (and loaded by default depending on dvb card type) can
187be found under `utils/keytable/keycodes`.
188
189v4l-keytable does not get installed during the install step.
190
191### ir-ctl
192
193A swiss-knife tool to handle raw IR and to set lirc options.
194
195### qv4l2
196
197QT v4l2 control panel application.
198
199Installed under `<prefix>/bin`.
200
201### rds-saa6588
202
203Poll i2c RDS receiver [Philips saa6588].
204
205rds-saa6588 does not get installed during the install step.
206
207### v4l2-compliance
208
209Tool to test v4l2 API compliance of drivers.
210
211Installed under `<prefix>/bin`.
212
213### v4l2-ctl
214
215Tool to control v4l2 controls from the cmdline.
216
217Installed under `<prefix>/bin`.
218
219### v4l2-dbg
220
221Tool to directly get and set registers of v4l2 devices, this requires a
222*kernel >= 2.6.29* with the `ADV_DEBUG` option enabled. This tool can only be
223used by root and is meant for development purposes only!
224
225Installed under `<prefix>/sbin`.
226
227### v4l2-sysfs-path
228
229*FIXME* add description.
230
231Installed under `<prefix>/bin`.
232
233### v4l2-tracer
234
235Tool to trace, record and replay userspace applications that implement the v4l2
236memory-to-memory stateless video decoder interface.
237
238Installed by `make install` under `<prefix>/bin`.
239
240### xc3028-firmware
241
242Xceive XC2028/3028 tuner module firmware manipulation tool.
243
244xc3028-firmware does not get installed during the install step.
245
246## Syncing with Kernel
247
248There are a number of files on this package that depends on the Linux Kernel.
249
250In order to make easier to keep it in sync, there's a target on this package to
251do the synchronism.
252
253For the sync to work, you need to run it on with 64 bits userspace and be sure
254that glibc has the development package for 32 bits.
255
256For Fedora, this is provided via this package: *glibc-devel.i686*
257
258There are some steps required:
259
2601. At the Kernel git tree:
261
262 We need to sanitize the headers to be installed. To do that, you should run:
263
264 ```
265 make headers_install INSTALL_HDR_PATH=usr/
266 ```
267
268 This will create the dir `usr/` inside the Kernel tree.
269
2701. Be sure that you have installed both glibc development packages for 32 and 64
271bits, as otherwise the next step will fail.
272
2731. At v4l-utils tree:
274
275 ```
276 ./sync-with-kernel.sh location/of/the/kernel/tree
277 ```
278
279 Alternatively, steps 1 to 3 can be replaced with:
280
281 ```
282 KERNEL_DIR=location/of/the/kernel/tree && (cd $KERNEL_DIR && make headers_install INSTALL_HDR_PATH=usr/) && ./sync-with-kernel.sh $KERNEL_DIR
283 ```
284
2851. Remove the `usr/` from the Kernel tree.
286