diff options
306 files changed, 15001 insertions, 7618 deletions
@@ -1,63 +1,4 @@ *~ -*.1 -*.o -*.lo -*.la -*.d -*.so -*.so.0 -*.so.1 -*.pc -*.a -*.tar.* -*.spec -.libs -.deps -.dirstamp -config.h -config.h.in -config.log -config.status -Makefile -Makefile.in -configure -m4 -aclocal.m4 -autom4te.cache -build-aux -libtool -stamp-h1 -ABOUT-NLS -lib/include/dvb-frontend.h -lib/include/libdvbv5/libdvb-version.h -doxygen-doc/ patches/ -gettextize -libdvbv5-po/*.gmo -libdvbv5-po/POTFILES -libdvbv5-po/stamp-po -libdvbv5-po/*.mo -libdvbv5-po/remove-potcdate.sed -libdvbv5-po/Makefile.in.in -libdvbv5-po/Makevars.template -libdvbv5-po/Rules-quot -libdvbv5-po/boldquot.sed -libdvbv5-po/en@boldquot.header -libdvbv5-po/en@quot.header -libdvbv5-po/insert-header.sin -libdvbv5-po/quot.sed -libdvbv5-po/remove-potcdate.sin -v4l-utils-po/*.gmo -v4l-utils-po/POTFILES -v4l-utils-po/stamp-po -v4l-utils-po/*.mo -v4l-utils-po/remove-potcdate.sed -v4l-utils-po/Makefile.in.in -v4l-utils-po/Makevars.template -v4l-utils-po/Rules-quot -v4l-utils-po/boldquot.sed -v4l-utils-po/en@boldquot.header -v4l-utils-po/en@quot.header -v4l-utils-po/insert-header.sin -v4l-utils-po/quot.sed -v4l-utils-po/remove-potcdate.sin +build/ +*.pc @@ -1,3 +1,202 @@ +v4l-utils-1.24.0 +---------------- + +Ariel D'Alessandro (1): + Move README to markdown syntax + +Benjamin Mugnier (1): + libv4lconvert: Fix v4lconvert_grey_to_rgb24 not taking stride into account + +Daniel Scally (2): + mc_nextgen_test: Display ancillary links + v4l2-compliance: Account for ancillary links + +David Fries (1): + qv4l2: Add capture toggle and close hotkeys to CaptureWin + +Deborah Brouwer (9): + v4l2-info: add flag V4L2_PIX_FMT_FLAG_SET_CSC + v4l2-info: move flags2s to v4l2-info.h + utils: add v4l2-tracer utility + v4l2-tracer: check for strerrorname_np() + v4l2-tracer: add signal handling + v4l2-tracer: refactor autogeneration script + v4l2-tracer: add exact matching for 'type' and 'field' + v4l2-tracer: add INPUT and OUTPUT ioctls + v4l2-tracer: remove trailing comma from JSON trace + +Dikshita Agarwal (2): + Add check for READ ONLY flag + Add check for READ ONLY flag + +Gregor Jasny (8): + buildsystem: Start v4l-utils 1.23.0 development cycle + configure.ac: Add copy of gnulib visibility.m4 + bootstrap.sh: Replace which with POSIX compliant command -v + m4: Update ax_pthread to latest + v4l2-tracer: do not distribute generated files + xc3028-firmware: distribute proper header + v4l2-tracer: distribute man page template + v4l2-tracer: add headers to distribute them + +Hans Verkuil (70): + cec-compliance: wake up remote device if needed + decode_tm6000: fix compiler warning + libdvbv5/dvb-dev-remote.c: fix send_fmt prototype + v4l2-compliance: improve failure message + v4l2-compliance: add missing return + v4l2-ctl: pass bus_info to mi_get_media_fd() + test-media: increase sleep after modprobe vivid to 3 + v4l2-compliance: show value with 'delta_ms > 10' fail msg + v4l2-compliance: relax time32-64 test + v4l-utils: update to latest media_stage kernel + v4l2-ctl/compliance: add stateless VP9 support + libv4lconvert: HM12 -> NV12_16L16 + v4l-utils: use v4l_getsubopt instead of getsubopt + sliced-vbi-detect/test.c: drop unused headers + v4l2-compliance: detect no-mmu systems + v4l2-compliance: increase sleeps that are too short + v4l2-compliance: improve select() check in captureBufs() + v4l2-compliance: improve two vivid_ro_ctrl warnings + cec-ctl: show timestamp for events + cec-ctl: periodically insert monotonic/wallclock time + v4l2-ctl: support edid-decode output as --set-edid input + Revert "Add check for READ ONLY flag" + v4l2-compliance: only check function if an MC is present + cec-ctl: fix timestamp log for HPD/5V changes + cec-ctl: only generate eob for CEC pin events + cec-ctl: improve --analyze-pin performance + cec-ctl: show timestamps in microsecond precision + cec-ctl: store the wallclock/monotonic clocks every minute + qv4l2: fix search/replace mistake in vbi-tab.cpp/h license text + v4l2-ctl: allow waiting/polling for multiple events + sync-with-kernel.sh: tuner-xc2028-types.h -> xc2028-types.h + v4l-utils: sync to latest kernel + v4l2-compliance: fix G/S_PARM tests for stateful encoders + v4l-utils: sync-with-kernel + cec-compliance: make <GET CEC VERSION> mandatory + cec-compliance: replace warn by announce if unresponsive + cec-compliance: don't test if PA is invalid + v4l-utils: sync with latest kernel headers + v4l2-compliance: detect V4L2_PIX_FMT_HEVC_SLICE + v4l2-ctl: support HEVC controls + v4l2-compliance/ctl: add dynamic array support + media-info: support ancillary links + v4l2-compliance: show ancillary links + v4l2-dbg: drop cap2s(), use v4l2_info_capability() instead + rds-ctl: drop cap2s(), use v4l2_info_capability() instead + v4l2-ctl/rds-ctl: move tuner info helpers to v4l2-info.cpp + v4l-utils: sync with upstream kernel + v4l2-ctl: add support for V4L2_EVENT_CTRL_CH_DIMENSIONS + v4l2-ctl: show all dimensions for V4L2_EVENT_CTRL_CH_DIMENSIONS + v4l2-compliance: check vivid pixel array control behavior + v4l2-compliance: test of vivid's pixel array in requests + xc3028-firmware: fix use-after-free + libdvbv5: fix string overread + test-media: check results of cmp in the vicodec tests + v4l-utils: sync with upstream media tree + v4l-utils: sync with upstream git repo + v4l2-ctl: print_control should check for array controls + v4l2-ctl: -C foo -C bar only shows foo + v4l2-compliance: support INTEGER and INTEGER64 control arrays + test-media: wait longer after rmmod/modprobe if DEBUG_KOBJECT_RELEASE=y + cec-follower: add --ignore-standby/view-on options + v4l2-compliance: support g++ 7.5.0 + v4l-utils: sync with upstream git repo + v4l2-tpg.patch: add missing get_random_u8() + v4l-utils: sync with latest upstream git repo + v4l2-tracer: add support for most basic controls + cec-ctl: --store-pin shouldn't enable pin monitoring + v4l-utils: sync with latest upstream git repo + v4l2-info: add support for new V4L2_SUBDEV_CAP_STREAMS capability + v4l2-compliance: add tests for area, string and integer64 controls + +Hans de Goede (4): + libv4lconvert: Fix v4lconvert_yuv420_to_rgb/bgr24() not taking stride into account + libv4lconvert: Fix v4lconvert_rgb565_to_rgb/bgr24() not taking stride into account + libv4lconvert: Fix v4lconvert_nv12_*() not taking stride into account + libv4lconvert: Fix v4lconvert_nv16_to_yuyv() not taking stride into account + +Jorge Maidana (1): + qv4l2: enable the play action on non-streaming radio rx + +Khem Raj (1): + media-info: Include missing <cstdint> for uintptr_t + +Laurent Pinchart (7): + v4l2-ctl: Operate on output device if specified + libv4l2subdev: Fix compilation error by including missing header + v4l2 utils: Support V4L2_PIX_FMT_YUV[AX]32 + libdvbv5: Fix invalid header file name in Doxygen INPUT + libdvbv5: Fix Doygen deprecation warnings + keytable: Add -fno-stack-protector compilation option + libv4lconvert: Don't ignore return value of ftruncate() + +Martin VallevandMartin Vallevand (1): + libdvbv5: cleanup ASTC service location parsing + +Mauro Carvalho Chehab (24): + v4l2grab: print the fourcc when libv4l won't handle it + v4l2grab: accept other formats than RGB24 + v4l2grab: optimize conversion routines + v4l2grab: use BT.709 by default on YUV conversion + v4l2grab: pass fmt to the conversion function + v4l2grab: add support for handling colorspace + v4l2grab: rework conversion routines to add more YUV formats + v4l2grab: add the basic logic to support planar formats + v4l2grab: add support for YUV 420 planar and semi-planar formats + v4l2grab: add RGB 32 format and variants + v4l2grab: don't try to convert formats on raw mode + v4l2grab: add a way to explicitly enable raw mode + v4l2grab: use an array for format properties + v4l2grab: properly implement quantization + v4l2grab: avoid the risc of having sizeimage == 0 + v4l2grab: estimate the frame rate + v4l2grab: fix buffer conversion size + v4l2grab: fix raw output on mmap + v4l2grab: validate it the returned image is big enough + v4l2grab: fix image size calculation for some formats + v4l2grab: expand video format switch case + v4l2grab: allow adding planars with full size + v4l2grab: add support for NV16 and NV61 + v4l2grab: add support for 422P format + +Niklas Söderlund (1): + configure.ac: Add option to disable compilation of v4l2-tracer + +Peter Kjellerstedt (1): + configure.ac, Makefile.am: Support building without NLS + +Ricardo Ribalda (1): + v4l2-compliance: Let uvcvideo return -EACCES + +Sakari Ailus (1): + utils: Allow choosing v4l2-tracer-gen.pl output + +Sean Young (4): + ir-ctl: allow for different gaps to be specified + v4l-utils: sync with latest media staging tree + ir-ctl: report ir overflow + keytable: provide configuration for empty keymap + +Simon Arlott (2): + libdvbv5: Read all "other" PIDs for channels + dvbv5-zap: Record all the channel video/audio/other PIDs + +Sudip Mukherjee (1): + keytable: Convert deprecated libbpf API + +Umang Jain (1): + v4l2-ctl: Fix typo in --list-patterns help text + +Vedant Paranjape (1): + v4l2-utils: Fix incorrect use of fd in streaming_set_cap2out + +Xavier Roumegue (2): + v4l2-utils: Change get_(cap_compose|out_crop)_rect() return type to void + v4l2-utils: read/write full frame from/to file for m2m non codec driver + + v4l-utils-1.22.0 ---------------- diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 099c968c..00000000 --- a/INSTALL +++ /dev/null @@ -1,105 +0,0 @@ -Requirements: -------------- -* make and a C and C++ compiler -* optionally libjpeg v6 or later -* optionally Qt5 for building qv4l2 - -Building: ---------- - -If you checked out the source repository you need to install the autotools -environment and gettext first. - -The autotools/gettext should be updated to the version that are shipped -on your distro. This can be done by running: - $ ./bootstrap.sh - -Then you need to configure any any desired options with: - $ ./configure - -You can get a summary of possible configurations via the --help option. -If used without arguments, it will set the install prefix to /usr/local/. - -After configuration you need to start the build process with: - $ make - -Installing: ------------ - -To install it at the prefix configured by ./configure, do, as root: - # make install - -Note that v4l-utils' "make install" supports DESTDIR for installing into -a build root for example: - # make install DESTDIR=/mnt/sysimage - -Cross Compiling: ----------------- - -Cross compiling has been tested with the Code Sourcery and Linaro ARM Linux -toolchain. - -To cross compile with the Code Sourcery toolchain run the following commands: - -export PATH=/opt/arm-2009q3/bin:$PATH -export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib -./configure --host=arm-none-linux-gnueabi --without-jpeg -make - -To cross compile with the Linaro toolchain run the following commands: - -export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin:$PATH -export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib -./configure --host=arm-linux-gnueabihf --without-jpeg -make - -Building static binaries: -------------------------- - -There are two options in building static binaries: either fully static or -dynamically linking to system shared libraries while statically linking -libraries that are a part of v4l-utils. - -In either case, building static binaries requires telling pkg-config the -static libraries will be needed, and telling configure to disable building -of shared libraries. This way system libraries will still be linked -dynamically: - - $ PKG_CONFIG="pkg-config --static" ./configure --disable-shared - -Fully static binares can be built by further setting LDFLAGS for the -configure: - - $ PKG_CONFIG="pkg-config --static" LDFLAGS="--static -static" \ - ./configure --disable-shared - -Note that this requires static variants of all the libraries needed for -linking which may not be available in all systems. - -Android Cross Compiling and Installing: ----------------- - -v4l-utils will only build using the complete AOSP source tree, because of the -stlport dependency. - -List of v4l-utils that supply an Android.mk makefile: -* utils/v4l2-compliance -* utils/v4l2-ctl -* utils/v4l2-dbg - -To cross compile an utility you must first configure the shell with Android's -envsetup.sh to add the mm alias, before running lunch to select your target -device. - -cd /path/to/aosp -source build/envsetup.sh -lunch -cd /path/to/v4l-utils -cd <utility> -mm - -Output binary will be located in the Android out directory, below the -target/product/<name>/system/bin/<v4l-utils executable name> path. - -The binary executable can be pushed to the target Android device using -adb push <v4l-utils executable> /system/bin diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 00000000..ed7b10a7 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,142 @@ +# Installation + +## Requirements + +* meson and a C and C++ compiler +* optionally libjpeg v6 or later +* optionally Qt5 for building qv4l2 + +## Basic installation + +v4l-utils can be built and installed using meson as follows: + +``` +meson setup build/ +ninja -C build/ +sudo ninja -C build/ install +``` + +## Configuration + +You can get a summary of possible configurations running: + +``` +meson configure build/ +``` + +To change the options values use the `-D` option: + +``` +meson configure -Doption=newvalue build/ +``` + +After configuration you need to start the build process with: + +``` +ninja -C build/ +``` + +More info about meson options: +[https://mesonbuild.com/Build-options.html](https://mesonbuild.com/Build-options.html) + +## Installing + +If you need to install to a different directory than the install prefix, use +the `DESTDIR` environment variable: + +``` +DESTDIR=/path/to/staging/area ninja -C build/ install +``` + +## Static builds + +Meson provides a built-in option to set the default library type: + +``` +Core options Default Value Possible Values Description +------------ ------------- --------------- ----------- +default_library shared [shared, static, both] Default library type +``` + +As previously described, it can be set as follows during the configuration step: + +``` +meson configure -Ddefault_library=static build/ +``` + +Note that this will just build static libraries, but linking to dependencies and +system libraries dynamically. + +*Fully static* builds are not supported yet and would require custom +configuration and setting proper flags. By the time of this writing, there's an +ongoing issue in meson to add this feature, see +https://github.com/mesonbuild/meson/issues/7621 + +## Cross Compiling + +Meson supports cross-compilation by specifying a number of binary paths and +settings in a file and passing this file to `meson` or `meson configure` with +the `--cross-file` parameter. + +Below are a few example of cross files, but keep in mind that you will likely +have to alter them for your system. + +32-bit build on x86 linux: + +``` +[binaries] +c = '/usr/bin/gcc' +cpp = '/usr/bin/g++' +ar = '/usr/bin/gcc-ar' +strip = '/usr/bin/strip' +pkgconfig = '/usr/bin/pkg-config-32' +llvm-config = '/usr/bin/llvm-config32' + +[properties] +c_args = ['-m32'] +c_link_args = ['-m32'] +cpp_args = ['-m32'] +cpp_link_args = ['-m32'] + +[host_machine] +system = 'linux' +cpu_family = 'x86' +cpu = 'i686' +endian = 'little' +``` + +64-bit build on ARM linux: + +``` +[binaries] +c = '/usr/bin/aarch64-linux-gnu-gcc' +cpp = '/usr/bin/aarch64-linux-gnu-g++' +ar = '/usr/bin/aarch64-linux-gnu-gcc-ar' +strip = '/usr/bin/aarch64-linux-gnu-strip' +pkgconfig = '/usr/bin/aarch64-linux-gnu-pkg-config' +exe_wrapper = '/usr/bin/qemu-aarch64-static' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'aarch64' +endian = 'little' +``` + +64-bit build on x86 windows: + +``` +[binaries] +c = '/usr/bin/x86_64-w64-mingw32-gcc' +cpp = '/usr/bin/x86_64-w64-mingw32-g++' +ar = '/usr/bin/x86_64-w64-mingw32-ar' +strip = '/usr/bin/x86_64-w64-mingw32-strip' +pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' +exe_wrapper = 'wine' + +[host_machine] +system = 'windows' +cpu_family = 'x86_64' +cpu = 'i686' +endian = 'little' +``` diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 7fb443ab..00000000 --- a/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -AUTOMAKE_OPTIONS = foreign -ACLOCAL_AMFLAGS = -I m4 -AM_MAKEFLAGS = $(word 1, $(subst 1, -w, $(filter 1, $(V))) --no-print-directory) - -SUBDIRS = v4l-utils-po libdvbv5-po lib - -if WITH_V4LUTILS -SUBDIRS += utils contrib -endif - -EXTRA_DIST = android-config.h sync-with-kernel.sh bootstrap.sh \ - doxygen_libdvbv5.cfg include COPYING.libv4l \ - COPYING.libdvbv5 README.libv4l README.lib-multi-threading \ - TODO.libdvbv5 doc/libdvbv5-index.doc - -include $(top_srcdir)/aminclude.am diff --git a/README b/README deleted file mode 100644 index a7759171..00000000 --- a/README +++ /dev/null @@ -1,274 +0,0 @@ -v4l-utils ---------- - -Linux utilities and libraries to handle media devices (TV devices, -capture devices, radio devices, remote controllers). - -You can always find the latest development v4l-utils in the git repo: - http://git.linuxtv.org/v4l-utils.git - -Those utilities follow the latest Linux Kernel media API, as documented -at: - http://linuxtv.org/downloads/v4l-dvb-apis/ - -Any questions/remarks/patches can be sent to the linux-media mailinglist. -See https://linuxtv.org/lists.php for more information about the mailinglist. - -There is also a wiki page for the v4l-utils: - - https://linuxtv.org/wiki/index.php/V4l-utils - - --------- -Building --------- - -A number of packages is required to fully build v4l-utils. The first -step is to install those packages. The package names are different on -each distro. - -On Debian and derivated distributions, you need to install the following -packages with apt-get or aptitude: - debhelper dh-autoreconf autotools-dev autoconf-archive doxygen graphviz - libasound2-dev libtool libjpeg-dev qtbase5-dev qt5-default - libqt5opengl5-dev libudev-dev libx11-dev pkg-config udev make gcc git - - -On Fedora, the package list for a minimal install with dnf or yum is: - git automake autoconf libtool make gcc gcc-c++ which perl gettext-devel - -(git is only requiried if you're cloning from the main git repository at - linuxtv.org). - -And, to be able to compile it with all usual functionality with qt5, -you'll need also: - alsa-lib-devel doxygen libjpeg-turbo-devel qt5-qtbase-devel - libudev-devel mesa-libGLU-devel - - -After downloading and installing the needed packages, you should run: - - ./bootstrap.sh - ./configure - make - -If ./configure exit with some errors try: - - autoreconf -i --force - ./configure - -And, to install on your system: - sudo make install - -Optional features -^^^^^^^^^^^^^^^^^ - -Please notice that there's an extra feature to add an extra table to -decode Japanese DVB tables via iconv. This is meant to be used when -the iconv itself doesn't come with the ARIB-STD-B24 and EN300-468-TAB00 -tables. - -That requires not only the gconv package, but it also needs to be manually -enabled with: - --enable-gconv - ----------- -versioning ----------- - -The v4l-utils doesn't quite follow the release versioning defined -at semver.org. - -Instead, since version 1.0, it uses: - - MAJOR.MINOR.PATCH - -Where: - - MINOR - an odd number means a development version. When - the development is closed, we release an even - numbered version and start a newer odd version; - - MAJOR - It is incremented when MINOR number starts to be - too big. The last change occurred from 0.9.x to 1.0. - - All numbers start with 0. - -All versions have their own tags, except for the current -deveopment version (with uses the master branch at the git tree). - -The PATCH meaning actually depends if the version is stable -or developent. - -For even MAJOR.MINOR versions (1.0, 1.2, 1.4, 1.6, ...) - - PATCH is incremented when just bug fixes are added; - -For odd MAJOR.MINOR versions (1.1, 1.3, 1.5, 1.7, ...) - PATCH is incremented for release candidate versions. - -API/ABI stability: ------------------ - -There should not have any API/ABI changes when PATCH is incremented. - -When MAJOR and/or MINOR are incremented, the API/ABI for the -libraries might change, although we do all the efforts for not -doing it, except when inevitable. - -The TODO files should specify the events that will generate -API/ABI breaks. - ---------------- -media libraries ---------------- - -There are currently three media libraries defined at /lib directory, -meant to be used internally and by other applications. - -libv4l ------- - -This library is meant to be used by applications that need to -talk with V4L2 devices (webcams, analog TV, stream grabbers). - -It can be found on the following directories: - lib/libv4l1 - lib/libv4l2 - lib/libv4l-mplane - lib/libv4lconvert - -See README.libv4l for more information on libv4l. - -The libv4l is released under the GNU Lesser General Public License. - -libdvbv5 --------- - -This library is meant to be used by digital TV applications that -need to talk with media hardware. - -Full documentation is provided via Doxygen. It can be built, -after configuring the package, with: - $ make doxygen-run - -It is possible to generate documentation in html, man pages and pdf -formats. - -The documentation is also available via web, at: - http://linuxtv.org/docs/libdvbv5/ - -It can be found on the following directory: - lib/libdvbv5 - -The libdvbv5 is released under GPL version 2. - - -libv4l2rds ----------- - -This library provides support for RDS radio applications. - -It can be found on the following directory: - lib/libv4l2rds - -The libv4l is released under the GNU Lesser General Public License. - ---------- -Utilities ---------- - -The utilities are stored under /util directory. - -The (for now for v4l-utils private use only) libv4l2util library is -released under the GNU Lesser General Public License, all other code is -released under the GNU General Public License. - -v4l-utils includes the following utilities: - -decode_tm6000: -Decodes tm6000 proprietary format streams. -Installed by make install under <prefix>/bin. - -ir-keytable: -Dump, Load or Modify ir receiver input tables. -The ir tables for remotes which are known by the kernel -(and loaded by default depending on dvb card type) can be found -under utils/keytable/keycodes. -v4l-keytable does not get installed by make install. - -ir-ctl: -A swiss-knife tool to handle raw IR and to set lirc options - -qv4l2: -QT v4l2 control panel application. -Installed by make install under <prefix>/bin. - -rds-saa6588: -Poll i2c RDS receiver [Philips saa6588]. -rds-saa6588 does not get installed by make install. - -v4l2-compliance: -Tool to test v4l2 API compliance of drivers. -Installed by make install under <prefix>/bin. - -v4l2-ctl: -Tool to control v4l2 controls from the cmdline. -Installed by make install under <prefix>/bin. - -v4l2-dbg: -Tool to directly get and set registers of v4l2 devices, -this requires a kernel >= 2.6.29 with the ADV_DEBUG option -enabled. This tool can only be used by root and is meant -for development purposes only! -Installed by make install under <prefix>/sbin. - -v4l2-sysfs-path: -FIXME add description. -Installed by make install under <prefix>/bin. - -xc3028-firmware: -Xceive XC2028/3028 tuner module firmware manipulation tool. -xc3028-firmware does not get installed by make install. - -------------------- -Syncing with Kernel -------------------- - -There are a number of files on this package that depends on the Linux Kernel. - -In order to make easier to keep it in sync, there's a target on this -package to do the synchronism. - -For the sync to work, you need to run it on with 64 bits userspace and -be sure that glibc has the development package for 32 bits. - -For Fedora, this is provided via this package: glibc-devel.i686 - -There are some steps required: - -step 1) at the Kernel git tree: - -We need to sanitize the headers to be installed. To do that, you should -run - - $ make headers_install INSTALL_HDR_PATH=usr/ - -This will create the dir "usr/" inside the Kernel tree. - -step 2) - -Be sure that you have installed both glibc development packages for -32 and 64 bits, as otherwise the next step will fail. - -step 3) at v4l-utils tree: - - $ ./sync-with-kernel.sh location/of/the/kernel/tree - -Alternatively, steps 1 to 3 can be replaced with: - -KERNEL_DIR=location/of/the/kernel/tree && (cd $KERNEL_DIR && make headers_install INSTALL_HDR_PATH=usr/) && ./sync-with-kernel.sh $KERNEL_DIR - -step 4) - -Remove the usr/ from the Kernel tree. diff --git a/README.md b/README.md new file mode 100644 index 00000000..16a55762 --- /dev/null +++ b/README.md @@ -0,0 +1,285 @@ +# v4l-utils + +Linux utilities and libraries to handle media devices (TV devices, capture +devices, radio devices, remote controllers). + +You can always find the latest development v4l-utils in the git repo: +[http://git.linuxtv.org/v4l-utils.git](http://git.linuxtv.org/v4l-utils.git). + +Those utilities follow the latest Linux Kernel media API, as documented at: +[http://linuxtv.org/downloads/v4l-dvb-apis/](http://linuxtv.org/downloads/v4l-dvb-apis/). + +Any questions/remarks/patches can be sent to the linux-media mailinglist. See +[https://linuxtv.org/lists.php](https://linuxtv.org/lists.php) for more +information about the mailinglist. + +There is also a wiki page for the v4l-utils: +[https://linuxtv.org/wiki/index.php/V4l-utils](https://linuxtv.org/wiki/index.php/V4l-utils). + +## Building + +v4l-utils uses the meson build system. + +A number of packages is required to fully build v4l-utils. The first step is to +install those packages. The package names are different on each distro. + +On Debian and derivated distributions, you need to install the following +packages with `apt-get` or `aptitude`: + +``` +debhelper doxygen gcc git graphviz libasound2-dev libjpeg-dev +libqt5opengl5-dev libudev-dev libx11-dev meson pkg-config qt5-default +qtbase5-dev udev +``` + +On Fedora, the package list for a minimal install with `dnf` or `yum` is: + +``` +gcc gcc-c++ gettext-devel git meson perl which +``` + +(git is only requiried if you're cloning from the main git repository at +linuxtv.org). + +And, to be able to compile it with all usual functionality with qt5, you'll need +also: + +``` +alsa-lib-devel doxygen libjpeg-turbo-devel qt5-qtbase-devel libudev-devel +mesa-libGLU-devel +``` + +The v4l2-tracer also needs the json-c library. On Debian: `libjson-c-dev' ; on +Fedora: `json-c-devel`. + +After downloading and installing the needed packages on your distribution, you +should run: + +``` +meson build/ +ninja -C build/ +``` + +And, to install on your system: + +``` +sudo ninja -C build/ install +``` + +### Optional features + +Please notice that there's an extra feature to add an extra table to decode +Japanese DVB tables via iconv. This is meant to be used when the iconv itself +doesn't come with the *ARIB-STD-B24* and *EN300-468-TAB00* tables. + +gconv is an auto feature, so it will be auto-enabled in case the dependencies +are satisfied. However, the gconv feature can be forced to enabled by running +the following command during configuration step: + +``` +meson configure -Dgconv=enabled build/ +``` + +## Versioning + +The v4l-utils doesn't quite follow the release versioning defined at +[semver.org](https://semver.org/). + +Instead, since version 1.0, it uses `MAJOR.MINOR.PATCH`. Where: + +* `MINOR` - an odd number means a development version. When the development is +closed, we release an even numbered version and start a newer odd version; + +* `MAJOR` - It is incremented when `MINOR` number starts to be too big. The last +change occurred from 0.9.x to 1.0. + +* All numbers start with 0. + +All versions have their own tags, except for the current development version +(with uses the master branch at the git tree). + +The `PATCH` meaning actually depends if the version is stable or development. + +* For even `MAJOR.MINOR` versions (1.0, 1.2, 1.4, 1.6, ...): `PATCH` is +incremented when just bug fixes are added; + +* For odd `MAJOR.MINOR` versions (1.1, 1.3, 1.5, 1.7, ...): `PATCH` is +incremented for release candidate versions. + +### API/ABI stability: + +There should not have any API/ABI changes when `PATCH` is incremented. + +When `MAJOR` and/or `MINOR` are incremented, the API/ABI for the libraries might +change, although we do all the efforts for not doing it, except when inevitable. + +The `TODO` files should specify the events that will generate API/ABI breaks. + +## Media libraries + +There are currently three media libraries defined at `lib/` directory, meant to +be used internally and by other applications. + +### libv4l + +This library is meant to be used by applications that need to talk with V4L2 +devices (webcams, analog TV, stream grabbers). + +It can be found on the following directories: + +``` +lib/libv4l1/ +lib/libv4l2/ +lib/libv4l-mplane/ +lib/libv4lconvert/ +``` + +See `README.libv4l` for more information on libv4l. + +The libv4l is released under the GNU Lesser General Public License. + +### libdvbv5 + +This library is meant to be used by digital TV applications that need to talk +with media hardware. + +Full documentation is provided via Doxygen. Building documentation is enabled +by the auto feature: `doxygen-doc`. If enabled, it will be built within the +project. + +It is possible to generate documentation in html, man pages and pdf formats. + +The documentation is also available via web, at: +[http://linuxtv.org/docs/libdvbv5/](http://linuxtv.org/docs/libdvbv5/). + +It can be found on the following directory `lib/libdvbv5/`. + +The libdvbv5 is released under GPL version 2. + +### libv4l2rds + +This library provides support for RDS radio applications. + +It can be found on the following directory `lib/libv4l2rds/`. + +The libv4l is released under the GNU Lesser General Public License. + +## Utilities + +The utilities are stored under `utils/` directory. + +The (for now for v4l-utils private use only) libv4l2util library is released +under the GNU Lesser General Public License, all other code is released under +the GNU General Public License. + +v4l-utils includes the following utilities: + +### decode\_tm6000 + +Decodes tm6000 proprietary format streams. + +Installed under `<prefix>/bin`. + +### ir-keytable + +Dump, Load or Modify ir receiver input tables. The ir tables for remotes which +are known by the kernel (and loaded by default depending on dvb card type) can +be found under `utils/keytable/keycodes`. + +v4l-keytable does not get installed during the install step. + +### ir-ctl + +A swiss-knife tool to handle raw IR and to set lirc options. + +### qv4l2 + +QT v4l2 control panel application. + +Installed under `<prefix>/bin`. + +### rds-saa6588 + +Poll i2c RDS receiver [Philips saa6588]. + +rds-saa6588 does not get installed during the install step. + +### v4l2-compliance + +Tool to test v4l2 API compliance of drivers. + +Installed under `<prefix>/bin`. + +### v4l2-ctl + +Tool to control v4l2 controls from the cmdline. + +Installed under `<prefix>/bin`. + +### v4l2-dbg + +Tool to directly get and set registers of v4l2 devices, this requires a +*kernel >= 2.6.29* with the `ADV_DEBUG` option enabled. This tool can only be +used by root and is meant for development purposes only! + +Installed under `<prefix>/sbin`. + +### v4l2-sysfs-path + +*FIXME* add description. + +Installed under `<prefix>/bin`. + +### v4l2-tracer + +Tool to trace, record and replay userspace applications that implement the v4l2 +memory-to-memory stateless video decoder interface. + +Installed by `make install` under `<prefix>/bin`. + +### xc3028-firmware + +Xceive XC2028/3028 tuner module firmware manipulation tool. + +xc3028-firmware does not get installed during the install step. + +## Syncing with Kernel + +There are a number of files on this package that depends on the Linux Kernel. + +In order to make easier to keep it in sync, there's a target on this package to +do the synchronism. + +For the sync to work, you need to run it on with 64 bits userspace and be sure +that glibc has the development package for 32 bits. + +For Fedora, this is provided via this package: *glibc-devel.i686* + +There are some steps required: + +1. At the Kernel git tree: + + We need to sanitize the headers to be installed. To do that, you should run: + + ``` + make headers_install INSTALL_HDR_PATH=usr/ + ``` + + This will create the dir `usr/` inside the Kernel tree. + +1. Be sure that you have installed both glibc development packages for 32 and 64 +bits, as otherwise the next step will fail. + +1. At v4l-utils tree: + + ``` + ./sync-with-kernel.sh location/of/the/kernel/tree + ``` + + Alternatively, steps 1 to 3 can be replaced with: + + ``` + KERNEL_DIR=location/of/the/kernel/tree && (cd $KERNEL_DIR && make headers_install INSTALL_HDR_PATH=usr/) && ./sync-with-kernel.sh $KERNEL_DIR + ``` + +1. Remove the `usr/` from the Kernel tree. diff --git a/aminclude.am b/aminclude.am deleted file mode 100644 index 07ed72c3..00000000 --- a/aminclude.am +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright (C) 2004 Oren Ben-Kiki -# This file is distributed under the same terms as the Automake macro files. - -# Generate automatic documentation using Doxygen. Goals and variables values -# are controlled by the various DX_COND_??? conditionals set by autoconf. -# -# The provided goals are: -# doxygen-doc: Generate all doxygen documentation. -# doxygen-run: Run doxygen, which will generate some of the documentation -# (HTML, CHM, CHI, MAN, RTF, XML) but will not do the post -# processing required for the rest of it (PS, PDF, and some MAN). -# doxygen-man: Rename some doxygen generated man pages. -# doxygen-ps: Generate doxygen PostScript documentation. -# doxygen-pdf: Generate doxygen PDF documentation. -# -# Note that by default these are not integrated into the automake goals. If -# doxygen is used to generate man pages, you can achieve this integration by -# setting man3_MANS to the list of man pages generated and then adding the -# dependency: -# -# $(man3_MANS): doxygen-doc -# -# This will cause make to run doxygen and generate all the documentation. -# -# The following variable is intended for use in Makefile.am: -# -# DX_CLEANFILES = everything to clean. -# -# This is usually added to MOSTLYCLEANFILES. - -## --------------------------------- ## -## Format-independent Doxygen rules. ## -## --------------------------------- ## - -if DX_COND_doc - -## ------------------------------- ## -## Rules specific for HTML output. ## -## ------------------------------- ## - -if DX_COND_html - -DX_CLEAN_HTML = @DX_DOCDIR@/html - -endif DX_COND_html - -## ------------------------------ ## -## Rules specific for CHM output. ## -## ------------------------------ ## - -if DX_COND_chm - -DX_CLEAN_CHM = @DX_DOCDIR@/chm - -if DX_COND_chi - -DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi - -endif DX_COND_chi - -endif DX_COND_chm - -## ------------------------------ ## -## Rules specific for MAN output. ## -## ------------------------------ ## - -if DX_COND_man - -DX_CLEAN_MAN = @DX_DOCDIR@/man - -endif DX_COND_man - -## ------------------------------ ## -## Rules specific for RTF output. ## -## ------------------------------ ## - -if DX_COND_rtf - -DX_CLEAN_RTF = @DX_DOCDIR@/rtf - -endif DX_COND_rtf - -## ------------------------------ ## -## Rules specific for XML output. ## -## ------------------------------ ## - -if DX_COND_xml - -DX_CLEAN_XML = @DX_DOCDIR@/xml - -endif DX_COND_xml - -## ----------------------------- ## -## Rules specific for PS output. ## -## ----------------------------- ## - -if DX_COND_ps - -DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps - -DX_PS_GOAL = doxygen-ps - -doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps - -@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag - cd @DX_DOCDIR@/latex; \ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \ - $(DX_LATEX) refman.tex; \ - $(MAKEINDEX_PATH) refman.idx; \ - $(DX_LATEX) refman.tex; \ - countdown=5; \ - while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \ - refman.log > /dev/null 2>&1 \ - && test $$countdown -gt 0; do \ - $(DX_LATEX) refman.tex; \ - countdown=`expr $$countdown - 1`; \ - done; \ - $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi - -endif DX_COND_ps - -## ------------------------------ ## -## Rules specific for PDF output. ## -## ------------------------------ ## - -if DX_COND_pdf - -DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf - -DX_PDF_GOAL = doxygen-pdf - -doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf - -@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag - cd @DX_DOCDIR@/latex; \ - rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \ - $(DX_PDFLATEX) refman.tex; \ - $(DX_MAKEINDEX) refman.idx; \ - $(DX_PDFLATEX) refman.tex; \ - countdown=5; \ - while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \ - refman.log > /dev/null 2>&1 \ - && test $$countdown -gt 0; do \ - $(DX_PDFLATEX) refman.tex; \ - countdown=`expr $$countdown - 1`; \ - done; \ - mv refman.pdf ../@PACKAGE@.pdf - -endif DX_COND_pdf - -## ------------------------------------------------- ## -## Rules specific for LaTeX (shared for PS and PDF). ## -## ------------------------------------------------- ## - -if DX_COND_latex - -DX_CLEAN_LATEX = @DX_DOCDIR@/latex - -endif DX_COND_latex - -.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL) - -.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL) - -doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag - -doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL) - -@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS) - rm -rf @DX_DOCDIR@ - $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG) - -DX_CLEANFILES = \ - @DX_DOCDIR@/@PACKAGE@.tag \ - -r \ - $(DX_CLEAN_HTML) \ - $(DX_CLEAN_CHM) \ - $(DX_CLEAN_CHI) \ - $(DX_CLEAN_MAN) \ - $(DX_CLEAN_RTF) \ - $(DX_CLEAN_XML) \ - $(DX_CLEAN_PS) \ - $(DX_CLEAN_PDF) \ - $(DX_CLEAN_LATEX) - -endif DX_COND_doc diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 0ad344c3..00000000 --- a/bootstrap.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -mkdir build-aux/ 2>/dev/null -touch build-aux/config.rpath libdvbv5-po/Makefile.in.in v4l-utils-po/Makefile.in.in -autoreconf -vfi - -GETTEXTIZE=$(command -v gettextize) -if [ "GETTEXTIZE" != "" ]; then - VER=$(gettextize --version|perl -ne 'print $1 if (m/(\d\.\d.*)/)') - - cp build-aux/config.rpath build-aux/config.rpath.bak - - sed "s,read dummy < /dev/tty,," < $GETTEXTIZE > ./gettextize - chmod 755 ./gettextize - - echo "Generating locale v4l-utils-po build files for gettext version $VER" - ./gettextize --force --copy --no-changelog --po-dir=v4l-utils-po >/dev/null - - echo "Generating locale libdvbv5-po build files for gettext version $VER" - ./gettextize --force --copy --no-changelog --po-dir=libdvbv5-po >/dev/null - - for i in v4l-utils-po/Makefile.in.in libdvbv5-po/Makefile.in.in; do - sed 's,rm -f Makefile,rm -f,' $i >a && mv a $i - done - sed 's,PACKAGE = @PACKAGE@,PACKAGE = @LIBDVBV5_DOMAIN@,' <libdvbv5-po/Makefile.in.in >a && mv a libdvbv5-po/Makefile.in.in - - mv build-aux/config.rpath.bak build-aux/config.rpath -fi diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 05298981..00000000 --- a/configure.ac +++ /dev/null @@ -1,668 +0,0 @@ -# -*- Autoconf -*- - -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.59) -AC_INIT([v4l-utils],[1.23.0]) - -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) -AC_CONFIG_SRCDIR([lib/libv4l2/libv4l2.c]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile - lib/Makefile - lib/libv4lconvert/Makefile - lib/libv4l2/Makefile - lib/libv4l1/Makefile - lib/libdvbv5/Makefile - lib/libv4l2rds/Makefile - lib/libv4l-mplane/Makefile - - utils/Makefile - utils/libv4l2util/Makefile - utils/libmedia_dev/Makefile - utils/dvb/Makefile - utils/keytable/Makefile - utils/keytable/bpf_protocols/Makefile - utils/ir-ctl/Makefile - utils/cx18-ctl/Makefile - utils/ivtv-ctl/Makefile - utils/media-ctl/Makefile - utils/v4l2-compliance/Makefile - utils/v4l2-ctl/Makefile - utils/v4l2-dbg/Makefile - utils/v4l2-sysfs-path/Makefile - utils/qv4l2/Makefile - utils/libcecutil/Makefile - utils/cec-ctl/Makefile - utils/cec-ctl/cec-ctl.1 - utils/cec-compliance/Makefile - utils/cec-compliance/cec-compliance.1 - utils/cec-follower/Makefile - utils/cec-follower/cec-follower.1 - utils/qvidcap/Makefile - utils/rds-ctl/Makefile - - contrib/Makefile - contrib/freebsd/Makefile - contrib/test/Makefile - contrib/gconv/Makefile - contrib/cobalt-ctl/Makefile - contrib/decode_tm6000/Makefile - contrib/xc3028-firmware/Makefile - contrib/rds-saa6588/Makefile - - v4l-utils-po/Makefile.in - libdvbv5-po/Makefile.in - - v4l-utils.spec - lib/libv4lconvert/libv4lconvert.pc - lib/libv4l1/libv4l1.pc - lib/libv4l2/libv4l2.pc - lib/libdvbv5/libdvbv5.pc - lib/libv4l2rds/libv4l2rds.pc - utils/media-ctl/libmediactl.pc - utils/media-ctl/libv4l2subdev.pc - - lib/include/libdvbv5/libdvb-version.h - - utils/qv4l2/qv4l2.1 - utils/qvidcap/qvidcap.1 - utils/v4l2-compliance/v4l2-compliance.1 - utils/v4l2-ctl/v4l2-ctl.1 - utils/keytable/ir-keytable.1 - utils/keytable/rc_keymap.5 - utils/ir-ctl/ir-ctl.1 - utils/dvb/dvb-fe-tool.1 - utils/dvb/dvbv5-scan.1 - utils/dvb/dvb-format-convert.1 - utils/dvb/dvbv5-zap.1 -]) - -AC_GNU_SOURCE - -AM_INIT_AUTOMAKE([1.9 subdir-objects no-dist-gzip dist-bzip2 -Wno-portability]) # 1.10 is needed for target_LIBTOOLFLAGS - -AM_MAINTAINER_MODE -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# Checks for programs. -AC_PROG_CXX -AC_PROG_CC_C99 -AC_PROG_INSTALL -AC_PROG_LIBTOOL -AC_PROG_MKDIR_P -AC_PROG_LN_S -PKG_PROG_PKG_CONFIG -DX_DOT_FEATURE(ON) -DX_INIT_DOXYGEN($PACKAGE_NAME, doxygen_libdvbv5.cfg) -ALL_LINGUAS="" -m4_ifdef(AM_GNU_GETTEXT_REQUIRE_VERSION,[AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.8])],[AM_GNU_GETTEXT_VERSION([0.19.8])]) -AM_GNU_GETTEXT([external]) - -LIBDVBV5_DOMAIN="libdvbv5" -AC_DEFINE([LIBDVBV5_DOMAIN], "libdvbv5", [libdvbv5 domain]) -AC_SUBST(LIBDVBV5_DOMAIN) - -# Define localedir -AC_DEFUN([V4L_EXPAND_PREFIX], [ - $1=$2 - dnl expanding twice, since from autoconf 2.60 on, $datadir refers to - dnl $datarootdir which in turn refers to $prefix - $1=`( test "x$prefix" = xNONE && prefix="$ac_default_prefix" - eval tmp_v4l_prefix=\""[$]$1"\" - eval echo $tmp_v4l_prefix - )` -]) - -V4L_EXPAND_PREFIX(v4l_localedir, "$datadir/locale") -localedir="\$(datadir)/locale" - -AC_ARG_WITH(localedir, - [ --with-localedir=PATH Where the locale files are installed ]) -if test "x$with_localedir" != "x"; then - v4l_localedir="$with_localedir" - localedir="$with_localedir" -fi - -AC_DEFINE_UNQUOTED(LOCALEDIR, "$v4l_localedir", [locale directory]) -AC_SUBST(localedir) - -# sync-with-kernel.sh and keytable install could make use of them -#AC_PROG_GREP -#AC_PROG_SED -gl_PROMOTED_TYPE_MODE_T -gl_VISIBILITY - -AC_CHECK_HEADERS([sys/klog.h]) -AC_CHECK_FUNCS([klogctl]) - -AC_CACHE_CHECK([for ioctl with POSIX signature], - [gl_cv_func_ioctl_posix_signature], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include <sys/ioctl.h>]], - [[int ioctl (int, int, ...);]]) - ], - [gl_cv_func_ioctl_posix_signature=yes], - [gl_cv_func_ioctl_posix_signature=no]) - ]) -if test "x$gl_cv_func_ioctl_posix_signature" = xyes; then - AC_DEFINE([HAVE_POSIX_IOCTL], [1], [Have ioctl with POSIX signature]) -fi - -AC_CHECK_FUNCS([__secure_getenv secure_getenv]) -AC_HEADER_MAJOR - -# Check host os -case "$host_os" in - *linux*) - linux_os="yes" - ;; - *freebsd*) - freebsd_os="yes" - ;; -esac - -AM_CONDITIONAL([LINUX_OS], [test x$linux_os = xyes]) - -# Checks for dependencies - -PKG_CHECK_MODULES(X11, [x11], [x11_pkgconfig=yes], [x11_pkgconfig=no]) -AC_SUBST([X11_CFLAGS]) -AC_SUBST([X11_LIBS]) -AM_CONDITIONAL([HAVE_X11], [test x$x11_pkgconfig = xyes]) - -PKG_CHECK_MODULES([LIBELF], [libelf], [libelf_pkgconfig=yes], [libelf_pkgconfig=no]) -AC_SUBST([LIBELF_CFLAGS]) -AC_SUBST([LIBELF_LIBS]) -if test "x$libelf_pkgconfig" = "xyes"; then - AC_CHECK_PROG([CLANG], clang, clang) -else - AC_MSG_WARN(libelf library not available) -fi - -AS_IF([test "x$x11_pkgconfig" = xyes], - [PKG_CHECK_MODULES(GL, [gl], [gl_pkgconfig=yes], [gl_pkgconfig=no])], [gl_pkgconfig=no]) -AC_SUBST([GL_CFLAGS]) -AC_SUBST([GL_LIBS]) -AM_CONDITIONAL([HAVE_GL], [test x$gl_pkgconfig = xyes]) - -AS_IF([test "x$gl_pkgconfig" = xyes], - [PKG_CHECK_MODULES(GLU, [glu], [glu_pkgconfig=yes], [glu_pkgconfig=no])], [glu_pkgconfig=no]) - -AC_SUBST([GLU_CFLAGS]) -AC_SUBST([GLU_LIBS]) -AM_CONDITIONAL([HAVE_GLU], [test x$glu_pkgconfig = xyes]) - -AC_ARG_WITH([jpeg], - AS_HELP_STRING([--without-jpeg], [Do not use jpeg library]), - [], - [with_jpeg=yes]) - -AS_IF([test "x$with_jpeg" != xno], - [AC_CHECK_HEADER([jpeglib.h], - [AC_CHECK_LIB([jpeg], - [jpeg_read_header], - [have_jpeg=yes - JPEG_LIBS="-ljpeg" - AC_DEFINE([HAVE_JPEG],[1],[whether we use libjpeg])], - [have_jpeg=no - AC_MSG_WARN(cannot find libjpeg (v6 or later required))])], - [have_jpeg=no - AC_MSG_WARN(cannot find libjpeg)])]) - -AM_CONDITIONAL([HAVE_JPEG], [test x$have_jpeg = xyes]) - -QT_VERSION="none" - -PKG_CHECK_MODULES(QT5, [Qt5Core >= 5.0 Qt5Gui >= 5.0 Qt5Widgets >= 5.0], [qt_pkgconfig=true], [qt_pkgconfig=false]) -PKG_CHECK_MODULES(QT5, [Qt5Core >= 5.4 Qt5Gui >= 5.4 Qt5Widgets >= 5.4], [qt54_pkgconfig=true], [qt54_pkgconfig=false]) -if test "x$qt_pkgconfig" = "xtrue"; then - QT_CFLAGS="$QT5_CFLAGS -fPIC" - QT_LIBS="$QT5_LIBS" - AC_SUBST(QT_CFLAGS) - AC_SUBST(QT_LIBS) - AC_CHECK_PROGS(MOC, [moc-qt5 moc]) - AC_CHECK_PROGS(UIC, [uic-qt5 uic]) - AC_CHECK_PROGS(RCC, [rcc-qt5 rcc]) - AC_SUBST(MOC) - AC_SUBST(UIC) - AC_SUBST(RCC) - if test "x$qt54_pkgconfig" = "xtrue"; then - PKG_CHECK_MODULES(QT5GL, [Qt5OpenGL >= 5.4 gl], [qt_pkgconfig_gl=true], [qt_pkgconfig_gl=false]) - else - PKG_CHECK_MODULES(QT5GL, [Qt5OpenGL >= 5.0 gl], [qt_pkgconfig_gl=true], [qt_pkgconfig_gl=false]) - fi - if test "x$qt_pkgconfig_gl" = "xtrue"; then - SAVED_CXXFLAGS="${CXXFLAGS}" - CXXFLAGS="${CXXFLAGS} ${QT_CFLAGS} ${QT5GL_CFLAGS}" - AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([for Qt5 Desktop OpenGL]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE( -[[ -#define GL_GLEXT_PROTOTYPES -#define QT_NO_OPENGL_ES_2 - -#include <QGLWidget> -#include <QGLShader> -#include <QGLShaderProgram> -#include <QGLFunctions> - -#ifndef GL_UNSIGNED_INT_8_8_8_8 -#error Missing OpenGL Extensions -#endif -]])], - [qt_desktop_opengl=yes], - [qt_desktop_opengl=no]) - AC_MSG_RESULT([$qt_desktop_opengl]) - CXXFLAGS="${SAVED_CXXFLAGS}" - AC_LANG_POP - fi - - if test "x$qt_desktop_opengl" = "xyes"; then - QTGL_CFLAGS="$QT5GL_CFLAGS -fPIC" - QTGL_LIBS="$QT5GL_LIBS" - AC_SUBST(QTGL_CFLAGS) - AC_SUBST(QTGL_LIBS) - AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support]) - if test "x$qt54_pkgconfig" = "xtrue"; then - QT_VERSION="v5.4 with QtGL" - else - QT_VERSION="v5 with QtGL" - fi - else - if test "x$qt54_pkgconfig" = "xtrue"; then - QT_VERSION="v5.4" - else - QT_VERSION="v5" - fi - AC_MSG_WARN(Qt5 Desktop OpenGL is not available) - fi -else - AC_MSG_WARN(Qt5 or higher is not available) -fi - - -PKG_CHECK_MODULES(ALSA, [alsa], [alsa_pkgconfig=true], [alsa_pkgconfig=false]) -if test "x$alsa_pkgconfig" = "xtrue"; then - AC_DEFINE([HAVE_ALSA], [1], [alsa library is present]) -else - AC_MSG_WARN(ALSA library not available) -fi - -AC_ARG_WITH([libudev], - AS_HELP_STRING([--without-libudev], [Do not use udev library]), - [], - [with_libudev=yes]) - -have_libudev=no - -AS_IF([test "x$with_libudev" != xno -o "x$enable_libdvbv5" != xno], - [PKG_CHECK_MODULES(libudev, libudev, have_libudev=yes, have_libudev=no) - AS_IF([test "x$have_libudev" = xyes], - [AC_DEFINE([HAVE_LIBUDEV], [], [Use libudev]) - LIBUDEV_CFLAGS="$libudev_CFLAGS" - LIBUDEV_LIBS="$libudev_LIBS" - AC_SUBST(LIBUDEV_CFLAGS) - AC_SUBST(LIBUDEV_LIBS)], - AC_MSG_WARN(udev library not available) - )]) - -AC_SUBST([JPEG_LIBS]) - -# Check for pthread - -AS_IF([test x$enable_shared != xno], - [AX_PTHREAD([have_pthread=yes - AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])], - [have_pthread=no])], - [have_pthread=no]) - -# The dlopen() function is in the C library for *BSD and in -# libdl on GLIBC-based systems - -dl_saved_libs=$LIBS - AC_SEARCH_LIBS([dlopen], - [dl], - [test "$ac_cv_search_dlopen" = "none required" || DLOPEN_LIBS=$ac_cv_search_dlopen], - [AC_MSG_WARN([unable to find the dlopen() function])]) - AC_SUBST([DLOPEN_LIBS]) -LIBS=$dl_saved_libs - -AC_CHECK_HEADER([argp.h],,AC_MSG_ERROR(Cannot continue: argp.h not found)) -argp_saved_libs=$LIBS - AC_SEARCH_LIBS([argp_parse], - [argp], - [test "$ac_cv_search_argp_parse" = "none required" || ARGP_LIBS=$ac_cv_search_argp_parse], - [AC_MSG_ERROR([unable to find the argp_parse() function])]) - AC_SUBST([ARGP_LIBS]) -LIBS=$argp_saved_libs - -AC_CHECK_FUNCS([fork], AC_DEFINE([HAVE_LIBV4LCONVERT_HELPERS],[1],[whether to use libv4lconvert helpers])) -AM_CONDITIONAL([HAVE_LIBV4LCONVERT_HELPERS], [test x$ac_cv_func_fork = xyes]) - -AC_CHECK_HEADER([linux/i2c-dev.h], [linux_i2c_dev=yes], [linux_i2c_dev=no]) -AM_CONDITIONAL([HAVE_LINUX_I2C_DEV], [test x$linux_i2c_dev = xyes]) - -AM_ICONV - -# does this compiler support -m32 ? -AC_MSG_CHECKING([if gcc accepts -m32]) -safe_CFLAGS=$CFLAGS -CFLAGS="-m32" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ - return 0; -]])], [ - AC_MSG_RESULT([yes]) - have_m32=yes -], [ - AC_MSG_RESULT([no]) - have_m32=no -]) -CFLAGS=$safe_CFLAGS -AM_CONDITIONAL([HAVE_M32], [test x$have_m32 = xyes]) - -# directories - -AC_ARG_WITH(libv4l1subdir, - AS_HELP_STRING([--with-libv4l1subdir=DIR], [set libv4l1 library subdir (default=libv4l)]), - [], - [with_libv4l1subdir="libv4l"]) - -AC_ARG_WITH(libv4l2subdir, - AS_HELP_STRING([--with-libv4l2subdir=DIR], [set libv4l2 library subdir (default=libv4l)]), - [], - [with_libv4l2subdir="libv4l"]) - -AC_ARG_WITH(libv4lconvertsubdir, - AS_HELP_STRING([--with-libv4lconvertsubdir=DIR], [set libv4lconvert library subdir (default=libv4l)]), - [], - [with_libv4lconvertsubdir="libv4l"]) - -AC_ARG_WITH(udevdir, - AS_HELP_STRING([--with-udevdir=DIR], [set udev directory]), - [], - [with_udevdir=`$PKG_CONFIG --variable=udevdir udev || echo /lib/udev`]) - -AC_ARG_WITH(systemdsystemunitdir, - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [set systemd system unit directory]), - [], - [with_systemdsystemunitdir=auto]) -AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], - [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) - AS_IF([test "x$def_systemdsystemunitdir" = "x"], - [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], - [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) - with_systemdsystemunitdir=no], - [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) -AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) - -# Generic check: works with most distributions -def_gconv_dir=`for i in /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib; do if @<:@ -d \$i/gconv @:>@; then echo \$i/gconv; break; fi; done` - -# Debian/Ubuntu-specific check: should be aligned with the debian package -AS_IF([test "x${def_gconv_dir}" = "x" ], - def_gconv_dir=`for i in mips64el-linux-gnuabi64 mips64el-linux-gnuabin32 mips64-linux-gnuabi64 mips64-linux-gnuabin32 mipsisa64r6el-linux-gnuabi64 mipsisa64r6el-linux-gnuabin32 mipsisa64r6-linux-gnuabi64 mipsisa64r6-linux-gnuabin32 powerpc64-linux-gnu sparc64-linux-gnu x86_64-linux-gnu x86_64-linux-gnux32 alphaev67-linux-gnu arm-linux-gnueabi arm-linux-gnueabihf i686-kfreebsd-gnu i686-linux-gnu mipsel-linux-gnu mipsisa32r6el-linux-gnu mipsisa32r6-linux-gnu mips-linux-gnu powerpc-linux-gnu s390-linux-gnu sparcv9-linux-gnu; do if @<:@ -d /usr/lib/\$i/gconv @:>@; then echo /usr/lib/\$i/gconv; break; fi; done`) - -AC_ARG_WITH(gconvdir, - AS_HELP_STRING([--with-gconvdir=DIR], - [set system's gconv directory (default is to autodetect)]), - [], - [with_gconvdir=$def_gconv_dir]) - -AC_SUBST([libv4l1subdir], [$with_libv4l1subdir]) -AC_SUBST([libv4l2subdir], [$with_libv4l2subdir]) -AC_SUBST([libv4l1privdir], [$libdir/$with_libv4l1subdir]) -AC_SUBST([libv4l2privdir], [$libdir/$with_libv4l2subdir]) -AC_SUBST([libv4l2plugindir], [$libdir/$with_libv4l2subdir/plugins]) -AC_SUBST([libv4lconvertprivdir], [$libdir/$with_libv4lconvertsubdir]) -AC_SUBST([keytablesystemdir], [$with_udevdir/rc_keymaps]) -AC_SUBST([keytableuserdir], [$sysconfdir/rc_keymaps]) -AC_SUBST([udevrulesdir], [$with_udevdir/rules.d]) -AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir/systemd-udevd.service.d/]) -AC_SUBST([pkgconfigdir], [$libdir/pkgconfig]) -AC_SUBST([gconvsysdir], [$with_gconvdir]) - -AC_DEFINE_UNQUOTED([V4L_UTILS_VERSION], ["$PACKAGE_VERSION"], [v4l-utils version string]) -AC_DEFINE_DIR([LIBV4L1_PRIV_DIR], [libv4l1privdir], [libv4l1 private lib directory]) -AC_DEFINE_DIR([LIBV4L2_PRIV_DIR], [libv4l2privdir], [libv4l2 private lib directory]) -AC_DEFINE_DIR([LIBV4L2_PLUGIN_DIR], [libv4l2plugindir], [libv4l2 plugin directory]) -AC_DEFINE_DIR([LIBV4LCONVERT_PRIV_DIR], [libv4lconvertprivdir], [libv4lconvert private lib directory]) -AC_DEFINE_DIR([IR_KEYTABLE_SYSTEM_DIR], [keytablesystemdir], [ir-keytable preinstalled tables directory]) -AC_DEFINE_DIR([IR_KEYTABLE_USER_DIR], [keytableuserdir], [ir-keytable user defined tables directory]) - -MAJOR=`echo "$PACKAGE_VERSION" | perl -ne 'print $1 if (m/^(\d+)\.(\d+)\.(\d+)/)'` -MINOR=`echo "$PACKAGE_VERSION" | perl -ne 'print $2 if (m/^(\d+)\.(\d+)\.(\d+)/)'` -PATCH=`echo "$PACKAGE_VERSION" | perl -ne 'print $3 if (m/^(\d+)\.(\d+)\.(\d+)/)'` - -AC_SUBST(MAJOR) -AC_SUBST(MINOR) -AC_SUBST(PATCH) -AC_SUBST(V4L_UTILS_VERSION) - -# options - -AC_ARG_ENABLE(libdvbv5, - AS_HELP_STRING([--disable-libdvbv5], [disable libdvbv5 compilation]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-libdvbv5) ;; - esac] -) - -AC_ARG_ENABLE(dyn-libv4l, - AS_HELP_STRING([--disable-dyn-libv4l], [disable dynamic libv4l support]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-dyn-libv4l) ;; - esac] -) - -AC_ARG_ENABLE(v4l-utils, - AS_HELP_STRING([--disable-v4l-utils], [disable v4l-utils compilation]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l-utils) ;; - esac] -) - -AC_ARG_ENABLE(v4l2-compliance-libv4l, - AS_HELP_STRING([--disable-v4l2-compliance-libv4l], [disable use of libv4l in v4l2-compliance]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2-compliance-libv4l) ;; - esac] -) - -AC_ARG_ENABLE(v4l2-compliance-32, - AS_HELP_STRING([--enable-v4l2-compliance-32], [enable v4l2-compliance-32 compilation (for debugging purposes only)]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-v4l2-compliance-32) ;; - esac] -) - -AC_ARG_ENABLE(v4l2-ctl-libv4l, - AS_HELP_STRING([--disable-v4l2-ctl-libv4l], [disable use of libv4l in v4l2-ctl]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2-ctl-libv4l) ;; - esac] -) - -AC_ARG_ENABLE(v4l2-ctl-stream-to, - AS_HELP_STRING([--disable-v4l2-ctl-stream-to], [disable use of --stream-to in v4l2-ctl]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2-ctl-stream-to) ;; - esac] -) - -AC_ARG_ENABLE(v4l2-ctl-32, - AS_HELP_STRING([--enable-v4l2-ctl-32], [enable v4l2-ctl-32 compilation (for debugging purposes only)]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-v4l2-ctl-32) ;; - esac] -) - -AC_ARG_ENABLE(qv4l2, - AS_HELP_STRING([--disable-qv4l2], [disable qv4l2 compilation]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-qv4l2) ;; - esac] -) - -AC_ARG_ENABLE(qvidcap, - AS_HELP_STRING([--disable-qvidcap], [disable qvidcap compilation]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-qvidcap) ;; - esac] -) - -AC_ARG_ENABLE(gconv, - AS_HELP_STRING([--enable-gconv], [enable compilation of gconv modules]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-gconv) ;; - esac] -) - -AC_ARG_ENABLE(bpf, - AS_HELP_STRING([--disable-bpf], [disable IR BPF decoders]), - [case "${enableval}" in - yes | no ) ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-bpf) ;; - esac] -) - -PKG_CHECK_MODULES([SDL2], [sdl2 SDL2_image], [sdl_pc=yes], [sdl_pc=no]) -AM_CONDITIONAL([HAVE_SDL], [test x$sdl_pc = xyes]) - -# Check if backtrace functions are defined -AC_SEARCH_LIBS([backtrace], [execinfo], [ - AC_DEFINE(HAVE_BACKTRACE, [1], [glibc has functions to provide stack backtrace]) -]) - -AM_CONDITIONAL([WITH_LIBDVBV5], [test x$enable_libdvbv5 != xno -a x$have_libudev = xyes]) -AM_CONDITIONAL([WITH_DVBV5_REMOTE], [test x$enable_libdvbv5 != xno -a x$have_libudev = xyes -a x$have_pthread = xyes]) - -AM_CONDITIONAL([WITH_DYN_LIBV4L], [test x$enable_dyn_libv4l != xno]) -AM_CONDITIONAL([WITH_V4LUTILS], [test x$enable_v4l_utils != xno -a x$linux_os = xyes]) -AM_CONDITIONAL([WITH_QV4L2], [test x${qt_pkgconfig} = xtrue -a x$enable_qv4l2 != xno]) -AM_CONDITIONAL([WITH_QVIDCAP], [test x${qt_desktop_opengl} = xyes -a x$enable_qvidcap != xno]) -AM_CONDITIONAL([WITH_V4L_PLUGINS], [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno]) -AM_CONDITIONAL([WITH_V4L_WRAPPERS], [test x$enable_dyn_libv4l != xno -a x$enable_shared != xno]) -AM_CONDITIONAL([WITH_QTGL], [test x${qt_desktop_opengl} = xyes]) -AM_CONDITIONAL([WITH_GCONV], [test x$enable_gconv = xyes -a x$enable_shared = xyes -a x$with_gconvdir != x -a -f $with_gconvdir/gconv-modules]) -AM_CONDITIONAL([WITH_V4L2_CTL_LIBV4L], [test x${enable_v4l2_ctl_libv4l} != xno]) -AM_CONDITIONAL([WITH_V4L2_CTL_STREAM_TO], [test x${enable_v4l2_ctl_stream_to} != xno]) -AM_CONDITIONAL([WITH_V4L2_CTL_32], [test x${enable_v4l2_ctl_32} = xyes]) -AM_CONDITIONAL([WITH_V4L2_COMPLIANCE], [test x$ac_cv_func_fork = xyes]) -AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno]) -AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes]) -PKG_CHECK_MODULES([LIBBPF], [libbpf], [bpf_pc=yes], [bpf_pc=no]) -AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang -a x$bpf_pc = xyes]) - -# append -static to libtool compile and link command to enforce static libs -AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) -AS_IF([test x$enable_libv4l = xno], [AC_SUBST([ENFORCE_LIBV4L_STATIC], ["-static"])]) - -# Since systemd v239, udevd is not allowed to execute BPF systems calls; -# add an override to allow bpf(2) in that case. On earlier versions, the -# override will restrict udevd to bpf syscall only and will stop the system -# from booting. This is also true on current debian versions. -AM_CONDITIONAL([HAVE_UDEVDSYSCALLFILTER], [grep -s SystemCallFilter $with_systemdsystemunitdir/systemd-udevd.service]) - -# misc - -if test "x$linux_os" = "xyes"; then - CPPFLAGS="-I\$(top_srcdir)/include $CPPFLAGS" -elif test "x$freebsd_os" = "xyes"; then - CPPFLAGS="-I\$(top_srcdir)/contrib/freebsd/include $CPPFLAGS" -fi - -CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS" - -# Obtain git SHA of HEAD -AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"]) - -# Obtain git commit count of HEAD -AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -e \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"]) - -# Obtain git commit date of HEAD -AC_SUBST(GIT_COMMIT_DATE, ["-DGIT_COMMIT_DATE=\$(shell if test -e \$(top_srcdir)/.git ; then TZ=UTC git -C \$(top_srcdir) show --quiet --date='format-local:\"%F %T\"' --format='%cd'; fi)"]) - -AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"]) -AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes" - AC_DEFINE([HAVE_DVBV5_REMOTE], [1], [Usage of DVBv5 remote enabled])], - [USE_DVBV5_REMOTE="no"]) -AM_COND_IF([WITH_DYN_LIBV4L], [USE_DYN_LIBV4L="yes"], [USE_DYN_LIBV4L="no"]) -AM_COND_IF([WITH_V4LUTILS], [USE_V4LUTILS="yes"], [USE_V4LUTILS="no"]) -AM_COND_IF([WITH_QV4L2], [USE_QV4L2="yes"], [USE_QV4L2="no"]) -AM_COND_IF([WITH_QVIDCAP], [USE_QVIDCAP="yes"], [USE_QVIDCAP="no"]) -AM_COND_IF([WITH_V4L_PLUGINS], [USE_V4L_PLUGINS="yes" - AC_DEFINE([HAVE_V4L_PLUGINS], [1], [V4L plugin support enabled])], - [USE_V4L_PLUGINS="no"]) -AM_COND_IF([WITH_V4L_WRAPPERS], [USE_V4L_WRAPPERS="yes"], [USE_V4L_WRAPPERS="no"]) -AM_COND_IF([WITH_GCONV], [USE_GCONV="yes"], [USE_GCONV="no"]) -AM_COND_IF([WITH_V4L2_CTL_LIBV4L], [USE_V4L2_CTL_LIBV4L="yes"], [USE_V4L2_CTL_LIBV4L="no"]) -AM_COND_IF([WITH_V4L2_CTL_32], [USE_V4L2_CTL_32="yes"], [USE_V4L2_CTL_32="no"]) -AM_COND_IF([WITH_V4L2_COMPLIANCE], [USE_V4L2_COMPLIANCE="yes"], [USE_V4L2_COMPLIANCE="no"]) -AM_COND_IF([WITH_V4L2_COMPLIANCE_LIBV4L], [USE_V4L2_COMPLIANCE_LIBV4L="yes"], [USE_V4L2_COMPLIANCE_LIBV4L="no"]) -AM_COND_IF([WITH_V4L2_COMPLIANCE_32], [USE_V4L2_COMPLIANCE_32="yes"], [USE_V4L2_COMPLIANCE_32="no"]) -AM_COND_IF([WITH_BPF], [USE_BPF="yes" - AC_DEFINE([HAVE_BPF], [1], [BPF IR decoder support enabled])], - [USE_BPF="no"]) -AS_IF([test "x$alsa_pkgconfig" = "xtrue"], [USE_ALSA="yes"], [USE_ALSA="no"]) - -AC_OUTPUT - -if test x$enable_gconv = xyes -a x$USE_GCONV = xno; then - echo - echo "Failed to enable gconv. Disabling it" -fi - -dnl --------------------------------------------------------------------- -dnl compile time options summary - -cat <<EOF - -compile time options summary -============================ - - Host OS : $host_os - X11 : $x11_pkgconfig - GL : $gl_pkgconfig - glu : $glu_pkgconfig - libelf : $libelf_pkgconfig - libjpeg : $have_jpeg - libudev : $have_libudev - pthread : $have_pthread - QT version : $QT_VERSION - ALSA support : $USE_ALSA - SDL support : $sdl_pc - - build dynamic libs : $enable_shared - build static libs : $enable_static - - gconv : $USE_GCONV - - dynamic libv4l : $USE_DYN_LIBV4L - v4l_plugins : $USE_V4L_PLUGINS - v4l_wrappers : $USE_V4L_WRAPPERS - libdvbv5 : $USE_LIBDVBV5 - dvbv5-daemon : $USE_DVBV5_REMOTE - v4lutils : $USE_V4LUTILS - qv4l2 : $USE_QV4L2 - qvidcap : $USE_QVIDCAP - v4l2-ctl uses libv4l : $USE_V4L2_CTL_LIBV4L - v4l2-ctl-32 : $USE_V4L2_CTL_32 - v4l2-compliance : $USE_V4L2_COMPLIANCE - v4l2-compliance uses libv4l: $USE_V4L2_COMPLIANCE_LIBV4L - v4l2-compliance-32 : $USE_V4L2_COMPLIANCE_32 - BPF IR Decoders: : $USE_BPF -EOF diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index b418b518..00000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -if LINUX_OS -SUBDIRS = test xc3028-firmware - -if HAVE_LINUX_I2C_DEV -SUBDIRS += \ - rds-saa6588 -endif - -else -SUBDIRS = freebsd -endif - -if WITH_GCONV -SUBDIRS += gconv -endif - -SUBDIRS += decode_tm6000 - - -EXTRA_DIST = \ - cobalt-ctl \ - parsers \ - pci_traffic \ - v4l_rec.pl \ - lircd2toml.py diff --git a/contrib/cobalt-ctl/.gitignore b/contrib/cobalt-ctl/.gitignore deleted file mode 100644 index 8493b210..00000000 --- a/contrib/cobalt-ctl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cobalt-ctl diff --git a/contrib/cobalt-ctl/Makefile.am b/contrib/cobalt-ctl/Makefile.am deleted file mode 100644 index 2cc69000..00000000 --- a/contrib/cobalt-ctl/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -bin_PROGRAMS = cobalt-ctl - -cobalt_ctl_SOURCES = cobalt-ctl.c s-record.c diff --git a/contrib/cobalt-ctl/meson.build b/contrib/cobalt-ctl/meson.build new file mode 100644 index 00000000..f76fcba3 --- /dev/null +++ b/contrib/cobalt-ctl/meson.build @@ -0,0 +1,8 @@ +cobalt_ctl_sources = files( + 'cobalt-ctl.c', + 's-record.c', +) + +cobalt_ctl = executable('cobalt-ctl', + cobalt_ctl_sources, + include_directories : v4l2_utils_incdir) diff --git a/contrib/decode_tm6000/.gitignore b/contrib/decode_tm6000/.gitignore deleted file mode 100644 index 7c881113..00000000 --- a/contrib/decode_tm6000/.gitignore +++ /dev/null @@ -1 +0,0 @@ -decode_tm6000 diff --git a/contrib/decode_tm6000/Makefile.am b/contrib/decode_tm6000/Makefile.am deleted file mode 100644 index 863933cc..00000000 --- a/contrib/decode_tm6000/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_PROGRAMS = decode_tm6000 -decode_tm6000_SOURCES = decode_tm6000.c -decode_tm6000_LDADD = ../../utils/libv4l2util/libv4l2util.la -decode_tm6000_LDFLAGS = $(ARGP_LIBS) diff --git a/contrib/decode_tm6000/meson.build b/contrib/decode_tm6000/meson.build new file mode 100644 index 00000000..5147278b --- /dev/null +++ b/contrib/decode_tm6000/meson.build @@ -0,0 +1,14 @@ +decode_tm6000_sources = files( + 'decode_tm6000.c', +) + +decode_tm6000_deps = [ + dep_argp, + dep_libv4l2util, +] + +decode_tm6000 = executable('decode_tm6000', + decode_tm6000_sources, + install : true, + dependencies: decode_tm6000_deps, + include_directories : v4l2_utils_incdir) diff --git a/contrib/freebsd/Makefile.am b/contrib/freebsd/Makefile.am deleted file mode 100644 index abf0d57b..00000000 --- a/contrib/freebsd/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -EXTRA_DIST = \ - include \ - patches diff --git a/contrib/freebsd/include/linux/input-event-codes.h b/contrib/freebsd/include/linux/input-event-codes.h index a63dcd4a..c46be93d 100644 --- a/contrib/freebsd/include/linux/input-event-codes.h +++ b/contrib/freebsd/include/linux/input-event-codes.h @@ -614,6 +614,9 @@ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */ #define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */ +#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */ +#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */ +#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ @@ -862,6 +865,7 @@ #define ABS_TOOL_WIDTH 0x1c #define ABS_VOLUME 0x20 +#define ABS_PROFILE 0x21 #define ABS_MISC 0x28 diff --git a/contrib/freebsd/include/linux/input.h b/contrib/freebsd/include/linux/input.h index 2ff653ac..e1ab29b1 100644 --- a/contrib/freebsd/include/linux/input.h +++ b/contrib/freebsd/include/linux/input.h @@ -112,10 +112,13 @@ struct input_id { * Note that input core does not clamp reported values to the * [minimum, maximum] limits, such task is left to userspace. * - * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z) - * is reported in units per millimeter (units/mm), resolution - * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported - * in units per radian. + * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z, + * ABS_MT_POSITION_X, ABS_MT_POSITION_Y) is reported in units + * per millimeter (units/mm), resolution for rotational axes + * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. + * The resolution for the size axes (ABS_MT_TOUCH_MAJOR, + * ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MAJOR, ABS_MT_WIDTH_MINOR) + * is reported in units per millimeter (units/mm). * When INPUT_PROP_ACCELEROMETER is set the resolution changes. * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in * units per g (units/g) and in units per degree per second diff --git a/contrib/freebsd/include/linux/v4l2-common.h b/contrib/freebsd/include/linux/v4l2-common.h index efcc4013..6c97f218 100644 --- a/contrib/freebsd/include/linux/v4l2-common.h +++ b/contrib/freebsd/include/linux/v4l2-common.h @@ -10,45 +10,6 @@ * * Copyright (C) 2012 Nokia Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #ifndef __V4L2_COMMON__ diff --git a/contrib/freebsd/include/linux/v4l2-controls.h b/contrib/freebsd/include/linux/v4l2-controls.h index b70d3ea1..230475b7 100644 --- a/contrib/freebsd/include/linux/v4l2-controls.h +++ b/contrib/freebsd/include/linux/v4l2-controls.h @@ -4,44 +4,6 @@ * * Copyright (C) 1999-2012 the contributors * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * * The contents of this header was split off from videodev2.h. All control * definitions should be added to this header, which is included by * videodev2.h. @@ -157,8 +119,10 @@ enum v4l2_colorfx { /* USER-class private control IDs */ -/* The base for the meye driver controls. See linux/meye.h for the list - * of controls. We reserve 16 controls for this driver. */ +/* + * The base for the meye driver controls. This driver was removed, but + * we keep this define in case any software still uses it. + */ #define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000) /* The base for the bttv driver controls. @@ -229,6 +193,18 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_ISL7998X_BASE (V4L2_CID_USER_BASE + 0x1180) +/* + * The base for DW100 driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190) + +/* + * The base for Aspeed driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_ASPEED_BASE (V4L2_CID_USER_BASE + 0x11a0) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ @@ -1015,6 +991,8 @@ enum v4l2_auto_focus_range { #define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_HDR_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE+36) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) @@ -1732,7 +1710,7 @@ struct v4l2_vp8_segment { * @sharpness_level: matches sharpness_level syntax element. * @level: matches loop_filter_level syntax element. * @padding: padding field. Should be zeroed by applications. - * @flags: see V4L2_VP8_LF_FLAG_{}. + * @flags: see V4L2_VP8_LF_{}. * * This structure contains loop filter related parameters. * See the 'mb_lf_adjustments()' part of the frame header syntax, @@ -2407,6 +2385,9 @@ struct v4l2_ctrl_hevc_slice_params { * @poc_st_curr_after: provides the index of the short term after references * in DPB array * @poc_lt_curr: provides the index of the long term references in DPB array + * @num_delta_pocs_of_ref_rps_idx: same as the derived value NumDeltaPocs[RefRpsIdx], + * can be used to parse the RPS data in slice headers + * instead of skipping it with @short_term_ref_pic_set_size. * @reserved: padding field. Should be zeroed by applications. * @dpb: the decoded picture buffer, for meta-data about reference frames * @flags: see V4L2_HEVC_DECODE_PARAM_FLAG_{} @@ -2422,7 +2403,8 @@ struct v4l2_ctrl_hevc_decode_params { __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; - __u8 reserved[4]; + __u8 num_delta_pocs_of_ref_rps_idx; + __u8 reserved[3]; struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u64 flags; }; diff --git a/contrib/freebsd/include/linux/videodev2.h b/contrib/freebsd/include/linux/videodev2.h index 7365b15f..2f274840 100644 --- a/contrib/freebsd/include/linux/videodev2.h +++ b/contrib/freebsd/include/linux/videodev2.h @@ -509,7 +509,6 @@ struct v4l2_capability { #define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ -#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ #define V4L2_CAP_META_OUTPUT 0x08000000 /* Is a metadata output device */ @@ -584,6 +583,13 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_RGBX32 v4l2_fourcc('X', 'B', '2', '4') /* 32 RGBX-8-8-8-8 */ #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ +#define V4L2_PIX_FMT_RGBX1010102 v4l2_fourcc('R', 'X', '3', '0') /* 32 RGBX-10-10-10-2 */ +#define V4L2_PIX_FMT_RGBA1010102 v4l2_fourcc('R', 'A', '3', '0') /* 32 RGBA-10-10-10-2 */ +#define V4L2_PIX_FMT_ARGB2101010 v4l2_fourcc('A', 'R', '3', '0') /* 32 ARGB-2-10-10-10 */ + +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ @@ -591,6 +597,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ @@ -625,6 +632,15 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUV48_12 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ + +/* + * YCbCr packed format. For each Y2xx format, xx bits of valid data occupy the MSBs + * of the 16 bit components, and 16-xx bits of zero padding occupy the LSBs. + */ +#define V4L2_PIX_FMT_Y210 v4l2_fourcc('Y', '2', '1', '0') /* 32 YUYV 4:2:2 */ +#define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 4:2:2 */ +#define V4L2_PIX_FMT_Y216 v4l2_fourcc('Y', '2', '1', '6') /* 32 YUYV 4:2:2 */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ @@ -634,12 +650,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ @@ -662,6 +680,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */ #define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2') /* 12 Y/CbCr 4:2:0 32x32 tiles */ #define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12 Y/CbCr 4:2:0 10-bit 4x4 macroblocks */ +#define V4L2_PIX_FMT_NV12_8L128 v4l2_fourcc('A', 'T', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ +#define V4L2_PIX_FMT_NV12_10BE_8L128 v4l2_fourcc_be('A', 'X', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ /* Tiled YUV formats, non contiguous planes */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */ @@ -745,6 +765,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ #define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ +#define V4L2_PIX_FMT_SPK v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */ +#define V4L2_PIX_FMT_RV30 v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */ +#define V4L2_PIX_FMT_RV40 v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ @@ -783,6 +806,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */ #define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */ #define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */ +#define V4L2_PIX_FMT_AJPG v4l2_fourcc('A', 'J', 'P', 'G') /* Aspeed JPEG */ /* 10bit raw packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ @@ -1586,7 +1610,8 @@ struct v4l2_bt_timings { ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \ - (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) + ((bt)->interlaced ? \ + ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0)) #define V4L2_DV_BT_FRAME_HEIGHT(bt) \ ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) @@ -1677,7 +1702,7 @@ struct v4l2_input { uint8_t name[32]; /* Label */ uint32_t type; /* Type of input */ uint32_t audioset; /* Associated audios (bitfield) */ - uint32_t tuner; /* enum v4l2_tuner_type */ + uint32_t tuner; /* Tuner index */ v4l2_std_id std; uint32_t status; uint32_t capabilities; @@ -1764,6 +1789,8 @@ struct v4l2_ext_control { uint8_t *p_u8; uint16_t *p_u16; uint32_t *p_u32; + int32_t *p_s32; + int64_t *p_s64; struct v4l2_area *p_area; struct v4l2_ctrl_h264_sps *p_h264_sps; struct v4l2_ctrl_h264_pps *p_h264_pps; @@ -2415,6 +2442,7 @@ struct v4l2_event_vsync { #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) #define V4L2_EVENT_CTRL_CH_RANGE (1 << 2) +#define V4L2_EVENT_CTRL_CH_DIMENSIONS (1 << 3) struct v4l2_event_ctrl { uint32_t changes; @@ -2657,5 +2685,10 @@ struct v4l2_create_buffers { /* Deprecated definitions kept for backwards compatibility */ #define V4L2_PIX_FMT_HM12 V4L2_PIX_FMT_NV12_16L16 #define V4L2_PIX_FMT_SUNXI_TILED_NV12 V4L2_PIX_FMT_NV12_32L32 +/* + * This capability was never implemented, anyone using this cap should drop it + * from their code. + */ +#define V4L2_CAP_ASYNCIO 0x02000000 #endif /* __LINUX_VIDEODEV2_H */ diff --git a/contrib/gconv/Makefile.am b/contrib/gconv/Makefile.am deleted file mode 100644 index 68b5bd5f..00000000 --- a/contrib/gconv/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -gconvdir = $(libdir)/gconv -gconv_LTLIBRARIES = ARIB-STD-B24.la EN300-468-TAB00.la -gconv_DATA = gconv-modules - -gconv_ldflags = -module -shared -avoid-version -no-install --version-script=gconv.map - -gconv_base_sources = iconv/skeleton.c iconv/loop.c - -arib-std-b24.c, en300-468-tab00.c: $(gconv_base_sources) - -ARIB_STD_B24_la_SOURCES = arib-std-b24.c jis0201.h jis0208.h jisx0213.h -ARIB_STD_B24_la_LDFLAGS = $(gconv_ldflags) -L@gconvsysdir@ -R@gconvsysdir@ -lJIS -lJISX0213 - -EN300_468_TAB00_la_SOURCES = en300-468-tab00.c -EN300_468_TAB00_la_LDFLAGS = $(gconv_ldflags) - -EXTRA_DIST = $(gconv_base_sources) $(gconv_DATA) gconv.map diff --git a/contrib/gconv/meson.build b/contrib/gconv/meson.build new file mode 100644 index 00000000..e95278fd --- /dev/null +++ b/contrib/gconv/meson.build @@ -0,0 +1,44 @@ +gconv_install_dir = get_option('libdir') / 'gconv' + +arib_std_b24_sources = files( + 'arib-std-b24.c', + 'jis0201.h', + 'jis0208.h', + 'jisx0213.h', +) + +arib_std_b24_deps = [ + dep_jis, + dep_jisx0213, +] + +arib_std_b24 = shared_module('ARIB-STD-B24', + arib_std_b24_sources, + name_prefix : '', + dependencies : arib_std_b24_deps, + install : true, + install_dir : gconv_install_dir, + include_directories : v4l2_utils_incdir) + +dep_arib_std_b24 = declare_dependency(link_with : arib_std_b24) + +en300_468_tab00_sources = files( + 'en300-468-tab00.c', +) + +en300_468_tab00_deps = [ + dep_jis, + dep_jisx0213, +] + +en300_468_tab00 = shared_module('EN300-468-TAB00', + en300_468_tab00_sources, + name_prefix : '', + dependencies : en300_468_tab00_deps, + install : true, + install_dir : gconv_install_dir, + include_directories : v4l2_utils_incdir) + +dep_en300_468_tab00 = declare_dependency(link_with : en300_468_tab00) + +install_data('gconv-modules', install_dir : gconv_install_dir) diff --git a/contrib/meson.build b/contrib/meson.build new file mode 100644 index 00000000..e3aa05ac --- /dev/null +++ b/contrib/meson.build @@ -0,0 +1,13 @@ +if host_machine.system() == 'linux' + subdir('test') + subdir('xc3028-firmware') + if have_i2c_dev + subdir('rds-saa6588') + endif +endif + +subdir('decode_tm6000') + +if have_gconv + subdir('gconv', if_found : [dep_jis, dep_jisx0213]) +endif diff --git a/contrib/rds-saa6588/.gitignore b/contrib/rds-saa6588/.gitignore deleted file mode 100644 index 101db6e9..00000000 --- a/contrib/rds-saa6588/.gitignore +++ /dev/null @@ -1 +0,0 @@ -rds-saa6588 diff --git a/contrib/rds-saa6588/Makefile.am b/contrib/rds-saa6588/Makefile.am deleted file mode 100644 index a551d9fb..00000000 --- a/contrib/rds-saa6588/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -noinst_PROGRAMS = rds-saa6588 - -rds_saa6588_SOURCES = rds-saa6588.c diff --git a/contrib/rds-saa6588/meson.build b/contrib/rds-saa6588/meson.build new file mode 100644 index 00000000..037d2e20 --- /dev/null +++ b/contrib/rds-saa6588/meson.build @@ -0,0 +1,7 @@ +rds_saa6588_sources = files( + 'rds-saa6588.c', +) + +rds_saa6588 = executable('rds-saa6588', + rds_saa6588_sources, + include_directories : v4l2_utils_incdir) diff --git a/contrib/test/.gitignore b/contrib/test/.gitignore deleted file mode 100644 index 5bd81d01..00000000 --- a/contrib/test/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -capture-example -driver-test -ioctl-test -pixfmt-test -sliced-vbi-detect -sliced-vbi-test -stress-buffer -v4l2gl -v4l2grab -mc_nextgen_test -sdlcam diff --git a/contrib/test/Makefile.am b/contrib/test/Makefile.am deleted file mode 100644 index 5771ee4d..00000000 --- a/contrib/test/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -noinst_PROGRAMS = \ - ioctl-test \ - sliced-vbi-test \ - sliced-vbi-detect \ - v4l2grab \ - driver-test \ - mc_nextgen_test \ - stress-buffer \ - capture-example - -if HAVE_X11 -noinst_PROGRAMS += pixfmt-test -endif - -if HAVE_GLU -noinst_PROGRAMS += v4l2gl -endif - -if HAVE_SDL -if HAVE_JPEG -noinst_PROGRAMS += sdlcam -endif -endif - -driver_test_SOURCES = driver-test.c -driver_test_LDADD = ../../utils/libv4l2util/libv4l2util.la - -pixfmt_test_SOURCES = pixfmt-test.c -pixfmt_test_CFLAGS = $(X11_CFLAGS) -pixfmt_test_LDFLAGS = $(X11_LIBS) - -v4l2grab_SOURCES = v4l2grab.c -v4l2grab_LDFLAGS = $(ARGP_LIBS) -v4l2grab_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la -lpthread - -v4l2gl_SOURCES = v4l2gl.c -v4l2gl_LDFLAGS = $(X11_LIBS) $(GL_LIBS) $(GLU_LIBS) $(ARGP_LIBS) -v4l2gl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la - -sdlcam_LDFLAGS = $(JPEG_LIBS) $(SDL2_LIBS) -lm -ldl -lrt -sdlcam_CFLAGS = -I../.. $(SDL2_CFLAGS) -sdlcam_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4lconvert/libv4lconvert.la - -mc_nextgen_test_CFLAGS = $(LIBUDEV_CFLAGS) -mc_nextgen_test_LDFLAGS = $(ARGP_LIBS) $(LIBUDEV_LIBS) - - -ioctl_test_SOURCES = ioctl-test.c ioctl-test.h ioctl_32.h ioctl_64.h - -sliced_vbi_test_SOURCES = sliced-vbi-test.c - -sliced_vbi_detect_SOURCES = sliced-vbi-detect.c - -stress_buffer_SOURCES = stress-buffer.c - -capture_example_SOURCES = capture-example.c - -ioctl-test.c: ioctl-test.h - -EXTRA_DIST = \ - gen_ioctl_list.pl \ - test-media \ - test-media-unload.pl \ - vim2m_test_with_gstreamer.sh \ - vim2m_test_with_qvidcap.sh diff --git a/contrib/test/ioctl-test.h b/contrib/test/ioctl-test.h index 03b53078..c2a54f12 100644 --- a/contrib/test/ioctl-test.h +++ b/contrib/test/ioctl-test.h @@ -69,12 +69,14 @@ union v4l_parms { struct v4l2_standard p_v4l2_standard; struct v4l2_streamparm p_v4l2_streamparm; struct v4l2_subdev_capability p_v4l2_subdev_capability; + struct v4l2_subdev_client_capability p_v4l2_subdev_client_capability; struct v4l2_subdev_crop p_v4l2_subdev_crop; struct v4l2_subdev_format p_v4l2_subdev_format; struct v4l2_subdev_frame_interval p_v4l2_subdev_frame_interval; struct v4l2_subdev_frame_interval_enum p_v4l2_subdev_frame_interval_enum; struct v4l2_subdev_frame_size_enum p_v4l2_subdev_frame_size_enum; struct v4l2_subdev_mbus_code_enum p_v4l2_subdev_mbus_code_enum; + struct v4l2_subdev_routing p_v4l2_subdev_routing; struct v4l2_subdev_selection p_v4l2_subdev_selection; struct v4l2_tuner p_v4l2_tuner; }; @@ -185,21 +187,25 @@ static const struct { ioc(subdev, VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL), /* struct v4l2_subdev_frame_interval_enum */ ioc(subdev, VIDIOC_SUBDEV_ENUM_FRAME_SIZE), /* struct v4l2_subdev_frame_size_enum */ ioc(subdev, VIDIOC_SUBDEV_ENUM_MBUS_CODE), /* struct v4l2_subdev_mbus_code_enum */ + ioc(subdev, VIDIOC_SUBDEV_G_CLIENT_CAP), /* struct v4l2_subdev_client_capability */ ioc(subdev, VIDIOC_SUBDEV_G_CROP), /* struct v4l2_subdev_crop */ ioc(subdev, VIDIOC_SUBDEV_G_DV_TIMINGS), /* struct v4l2_dv_timings */ ioc(subdev, VIDIOC_SUBDEV_G_EDID), /* struct v4l2_edid */ ioc(subdev, VIDIOC_SUBDEV_G_FMT), /* struct v4l2_subdev_format */ ioc(subdev, VIDIOC_SUBDEV_G_FRAME_INTERVAL), /* struct v4l2_subdev_frame_interval */ + ioc(subdev, VIDIOC_SUBDEV_G_ROUTING), /* struct v4l2_subdev_routing */ ioc(subdev, VIDIOC_SUBDEV_G_SELECTION), /* struct v4l2_subdev_selection */ ioc(subdev, VIDIOC_SUBDEV_G_STD), /* v4l2_std_id */ ioc(subdev, VIDIOC_SUBDEV_QUERYCAP), /* struct v4l2_subdev_capability */ ioc(subdev, VIDIOC_SUBDEV_QUERYSTD), /* v4l2_std_id */ ioc(subdev, VIDIOC_SUBDEV_QUERY_DV_TIMINGS), /* struct v4l2_dv_timings */ + ioc(subdev, VIDIOC_SUBDEV_S_CLIENT_CAP), /* struct v4l2_subdev_client_capability */ ioc(subdev, VIDIOC_SUBDEV_S_CROP), /* struct v4l2_subdev_crop */ ioc(subdev, VIDIOC_SUBDEV_S_DV_TIMINGS), /* struct v4l2_dv_timings */ ioc(subdev, VIDIOC_SUBDEV_S_EDID), /* struct v4l2_edid */ ioc(subdev, VIDIOC_SUBDEV_S_FMT), /* struct v4l2_subdev_format */ ioc(subdev, VIDIOC_SUBDEV_S_FRAME_INTERVAL), /* struct v4l2_subdev_frame_interval */ + ioc(subdev, VIDIOC_SUBDEV_S_ROUTING), /* struct v4l2_subdev_routing */ ioc(subdev, VIDIOC_SUBDEV_S_SELECTION), /* struct v4l2_subdev_selection */ ioc(subdev, VIDIOC_SUBDEV_S_STD), /* v4l2_std_id */ ioc(video, VIDIOC_SUBSCRIBE_EVENT), /* struct v4l2_event_subscription */ diff --git a/contrib/test/ioctl_32.h b/contrib/test/ioctl_32.h index fb30b8a0..1fab2dc4 100644 --- a/contrib/test/ioctl_32.h +++ b/contrib/test/ioctl_32.h @@ -96,21 +96,25 @@ #define CMD32_VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL 0xc040564b #define CMD32_VIDIOC_SUBDEV_ENUM_FRAME_SIZE 0xc040564a #define CMD32_VIDIOC_SUBDEV_ENUM_MBUS_CODE 0xc0305602 +#define CMD32_VIDIOC_SUBDEV_G_CLIENT_CAP 0x80085665 #define CMD32_VIDIOC_SUBDEV_G_CROP 0xc038563b #define CMD32_VIDIOC_SUBDEV_G_DV_TIMINGS 0xc0845658 #define CMD32_VIDIOC_SUBDEV_G_EDID 0xc0245628 #define CMD32_VIDIOC_SUBDEV_G_FMT 0xc0585604 #define CMD32_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615 +#define CMD32_VIDIOC_SUBDEV_G_ROUTING 0xc0285626 #define CMD32_VIDIOC_SUBDEV_G_SELECTION 0xc040563d #define CMD32_VIDIOC_SUBDEV_G_STD 0x80085617 #define CMD32_VIDIOC_SUBDEV_QUERYCAP 0x80405600 #define CMD32_VIDIOC_SUBDEV_QUERYSTD 0x8008563f #define CMD32_VIDIOC_SUBDEV_QUERY_DV_TIMINGS 0x80845663 +#define CMD32_VIDIOC_SUBDEV_S_CLIENT_CAP 0xc0085666 #define CMD32_VIDIOC_SUBDEV_S_CROP 0xc038563c #define CMD32_VIDIOC_SUBDEV_S_DV_TIMINGS 0xc0845657 #define CMD32_VIDIOC_SUBDEV_S_EDID 0xc0245629 #define CMD32_VIDIOC_SUBDEV_S_FMT 0xc0585605 #define CMD32_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616 +#define CMD32_VIDIOC_SUBDEV_S_ROUTING 0xc0285627 #define CMD32_VIDIOC_SUBDEV_S_SELECTION 0xc040563e #define CMD32_VIDIOC_SUBDEV_S_STD 0x40085618 #define CMD32_VIDIOC_SUBSCRIBE_EVENT 0x4020565a diff --git a/contrib/test/ioctl_64.h b/contrib/test/ioctl_64.h index accc297c..9f580cf1 100644 --- a/contrib/test/ioctl_64.h +++ b/contrib/test/ioctl_64.h @@ -96,21 +96,25 @@ #define CMD64_VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL 0xc040564b #define CMD64_VIDIOC_SUBDEV_ENUM_FRAME_SIZE 0xc040564a #define CMD64_VIDIOC_SUBDEV_ENUM_MBUS_CODE 0xc0305602 +#define CMD64_VIDIOC_SUBDEV_G_CLIENT_CAP 0x80085665 #define CMD64_VIDIOC_SUBDEV_G_CROP 0xc038563b #define CMD64_VIDIOC_SUBDEV_G_DV_TIMINGS 0xc0845658 #define CMD64_VIDIOC_SUBDEV_G_EDID 0xc0285628 #define CMD64_VIDIOC_SUBDEV_G_FMT 0xc0585604 #define CMD64_VIDIOC_SUBDEV_G_FRAME_INTERVAL 0xc0305615 +#define CMD64_VIDIOC_SUBDEV_G_ROUTING 0xc0285626 #define CMD64_VIDIOC_SUBDEV_G_SELECTION 0xc040563d #define CMD64_VIDIOC_SUBDEV_G_STD 0x80085617 #define CMD64_VIDIOC_SUBDEV_QUERYCAP 0x80405600 #define CMD64_VIDIOC_SUBDEV_QUERYSTD 0x8008563f #define CMD64_VIDIOC_SUBDEV_QUERY_DV_TIMINGS 0x80845663 +#define CMD64_VIDIOC_SUBDEV_S_CLIENT_CAP 0xc0085666 #define CMD64_VIDIOC_SUBDEV_S_CROP 0xc038563c #define CMD64_VIDIOC_SUBDEV_S_DV_TIMINGS 0xc0845657 #define CMD64_VIDIOC_SUBDEV_S_EDID 0xc0285629 #define CMD64_VIDIOC_SUBDEV_S_FMT 0xc0585605 #define CMD64_VIDIOC_SUBDEV_S_FRAME_INTERVAL 0xc0305616 +#define CMD64_VIDIOC_SUBDEV_S_ROUTING 0xc0285627 #define CMD64_VIDIOC_SUBDEV_S_SELECTION 0xc040563e #define CMD64_VIDIOC_SUBDEV_S_STD 0x40085618 #define CMD64_VIDIOC_SUBSCRIBE_EVENT 0x4020565a diff --git a/contrib/test/mc_nextgen_test.c b/contrib/test/mc_nextgen_test.c index 6086ceb4..11254a0a 100644 --- a/contrib/test/mc_nextgen_test.c +++ b/contrib/test/mc_nextgen_test.c @@ -19,8 +19,6 @@ * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * */ -#include <config.h> - #include <linux/media.h> #include <argp.h> diff --git a/contrib/test/meson.build b/contrib/test/meson.build new file mode 100644 index 00000000..29b51df6 --- /dev/null +++ b/contrib/test/meson.build @@ -0,0 +1,143 @@ +ioctl_test_sources = files( + 'ioctl-test.c', + 'ioctl-test.h', + 'ioctl_32.h', + 'ioctl_64.h', +) + +ioctl_test = executable('ioctl-test', + ioctl_test_sources, + include_directories : v4l2_utils_incdir) + +sliced_vbi_test_sources = files( + 'sliced-vbi-test.c', +) + +sliced_vbi_test = executable('sliced-vbi-test', + sliced_vbi_test_sources, + include_directories : v4l2_utils_incdir) + +sliced_vbi_detect_sources = files( + 'sliced-vbi-detect.c', +) + +sliced_vbi_detect = executable('sliced-vbi-detect', + sliced_vbi_detect_sources, + include_directories : v4l2_utils_incdir) + +v4l2grab_sources = files( + 'v4l2grab.c', + +) + +v4l2grab_deps = [ + dep_argp, + dep_libv4l2, + dep_libv4lconvert, + dep_threads, +] + +v4l2grab = executable('v4l2grab', + v4l2grab_sources, + dependencies : v4l2grab_deps, + include_directories : v4l2_utils_incdir) + +driver_test_sources = files( + 'driver-test.c', + +) + +driver_test_deps = [ + dep_libv4l2util, +] + +driver_test = executable('driver-test', + driver_test_sources, + dependencies : driver_test_deps, + include_directories : v4l2_utils_incdir) + +mc_nextgen_test_sources = files( + 'mc_nextgen_test.c', +) + +mc_nextgen_test_deps = [ + dep_argp, + dep_libudev, +] + +mc_nextgen_test = executable('mc-nextgen-test', + mc_nextgen_test_sources, + dependencies : mc_nextgen_test_deps, + include_directories : v4l2_utils_incdir) + +stress_buffer_sources = files( + 'stress-buffer.c', +) + +stress_buffer = executable('stress-buffer', + stress_buffer_sources, + include_directories : v4l2_utils_incdir) + +capture_example_sources = files( + 'capture-example.c', +) + +capture_example = executable('capture-example', + capture_example_sources, + include_directories : v4l2_utils_incdir) + +if dep_x11.found() + pixfmt_test_sources = files( + 'pixfmt-test.c', + ) + + pixfmt_test_deps = [ + dep_x11, + ] + + pixfmt_test = executable('pixfmt-test', + pixfmt_test_sources, + dependencies : pixfmt_test_deps, + include_directories : v4l2_utils_incdir) +endif + +if dep_gl.found() and dep_glu.found() and dep_x11.found() + v4l2gl_sources = files( + 'v4l2gl.c', + ) + + v4l2gl_deps = [ + dep_gl, + dep_glu, + dep_libv4l2, + dep_libv4lconvert, + dep_x11, + ] + + v4l2gl = executable('v4l2gl', + v4l2gl_sources, + dependencies : v4l2gl_deps, + include_directories : v4l2_utils_incdir) +endif + +if dep_jpeg.found() and dep_sdl.found() and dep_sdl_image.found() + sdlcam_sources = files( + 'sdlcam.c', + ) + + sdlcam_deps = [ + dep_jpeg, + dep_libdl, + dep_libm, + dep_librt, + dep_libv4l2, + dep_libv4lconvert, + dep_sdl, + dep_sdl_image, + ] + + sdlcam = executable('sdlcam', + sdlcam_sources, + dependencies : sdlcam_deps, + include_directories : v4l2_utils_incdir) +endif diff --git a/contrib/test/pixfmt-test.c b/contrib/test/pixfmt-test.c index 43a11c4e..1cae69aa 100644 --- a/contrib/test/pixfmt-test.c +++ b/contrib/test/pixfmt-test.c @@ -20,8 +20,6 @@ #define _GNU_SOURCE 1 -#include <config.h> - #include <stdio.h> #include <stdlib.h> #include <stdbool.h> diff --git a/contrib/test/test-media b/contrib/test/test-media index b928c39f..1c21b5d4 100755 --- a/contrib/test/test-media +++ b/contrib/test/test-media @@ -18,6 +18,7 @@ unload=0 unbind_time=1 reunbind_time=9 rmmod_time=1 +modprobe_time=3 kobj_rel=0 v4l2_ctl=v4l2-ctl v4l2_compliance=v4l2-compliance @@ -55,7 +56,8 @@ if [ -z "$1" ]; then echo "vimc: test the vimc driver" echo "vicodec: test the vicodec driver" echo "vidtv: test the vidtv driver" - echo "cec: adds the vivid CEC compliance tests, 'cec-pwr' adds the CEC standby/wakeup tests." + echo "cec: adds the vivid CEC compliance tests, except for the CEC standby/wakeup tests." + echo "cec-pwr: adds the vivid CEC compliance tests, including the CEC standby/wakeup tests." echo "all: equals 'vivid vim2m vimc vicodec vidtv cec cec-pwr'" echo "mc: equals 'vivid vim2m vimc vicodec vidtv'" exit 0 @@ -68,9 +70,7 @@ fi dmesg -n notice -date -uname -a -v4l2-compliance --version +echo echo test-media $* echo echo @@ -111,8 +111,6 @@ while [ ! -z "$1" ]; do echo v4l2-compliance-32 is not installed. exit 0 fi - $v4l2_compliance --version - echo ;; all) vidtv=1 @@ -147,14 +145,23 @@ while [ ! -z "$1" ]; do ;; cec) cec=1 + cecpwr=--skip-test-standby-resume ;; cec-pwr) + cec=1 cecpwr= ;; esac shift done +date +uname -a +echo +$v4l2_ctl --version +$v4l2_compliance --version +echo + if [ $vidtv -eq 1 ]; then if [ ! -f /proc/config.gz ]; then if cat /proc/config.gz | gunzip | grep -q CONFIG_MEDIA_CONTROLLER_DVB=y ; then @@ -173,7 +180,8 @@ if [ $kobj_rel -eq 1 ]; then echo Detected CONFIG_DEBUG_KOBJECT_RELEASE=y unbind_time=10 reunbind_time=14 - rmmod_time=5 + rmmod_time=10 + modprobe_time=10 fi if [ $unload -eq 1 ]; then @@ -187,7 +195,7 @@ fi rmmod vivid 2&>/dev/null modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1 -sleep 3 +sleep $modprobe_time tmp=`mktemp` @@ -233,6 +241,10 @@ fi if [ $cec -eq 1 ]; then dmesg -n notice + cec-ctl --version + cec-compliance --version + cec-follower --version + echo if ! cec-ctl -D vivid -a vivid-000-vid-cap0 >/dev/null ; then echo "FAIL: the vivid module had no cec support" | tee -a $tmp echo "Grand Total for vivid cec: Succeeded: 0, Failed: 1, Warnings: 0" | tee -a $tmp @@ -315,7 +327,7 @@ if [ $vivid -eq 1 -a $setup -eq 0 ]; then fi modprobe vivid n_devs=3 multiplanar=1,2,2 cache_hints=1,0,0 #allocators=0,1,1 - sleep 3 + sleep $modprobe_time $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-cap -i3 -v width=3840,height=2160,pixelformat=NV24 $v4l2_ctl -z platform:vivid-002 -d vivid-002-vid-out -o1 -x width=3840,height=2160,pixelformat=NM16 @@ -336,7 +348,7 @@ fi if [ $vim2m -eq 1 ]; then rmmod vim2m 2&>/dev/null modprobe vim2m - sleep 1 + sleep $modprobe_time dmesg -n notice if ! $v4l2_ctl -z platform:vim2m ; then @@ -412,7 +424,7 @@ fi if [ $vimc -eq 1 ]; then rmmod vimc 2&>/dev/null modprobe vimc - sleep 1 + sleep $modprobe_time dmesg -n notice if ! $v4l2_ctl -z platform:vimc -d "Sensor A" ; then @@ -516,7 +528,7 @@ if [ $vicodec -eq 1 ]; then rmmod vicodec 2&>/dev/null modprobe vicodec - sleep 2 + sleep $modprobe_time dmesg -n notice if ! $v4l2_ctl -z platform:vicodec ; then @@ -580,6 +592,9 @@ if [ $vicodec -eq 1 -a $setup -eq 0 ]; then decful_opts='-z platform:vicodec -d stateful-decoder-source --stream-mmap --stream-out-mmap' decless_opts='-z platform:vicodec -d stateless-decoder-source --stream-mmap --stream-out-mmap' + vicodec_tests=0 + vicodec_ok=0 + vicodec_fail=0 echo echo stateful decode | tee /dev/kmsg echo @@ -588,7 +603,14 @@ if [ $vicodec -eq 1 -a $setup -eq 0 ]; then echo stateless decode | tee /dev/kmsg echo $v4l2_ctl $decless_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.1280.24 --stream-to=$tmpdir/raw.yu12.1280.24.stateless - cmp $tmpdir/raw.yu12.1280.24 $tmpdir/raw.yu12.1280.24.stateless + vicodec_tests=$((vicodec_tests+1)) + if cmp $tmpdir/raw.yu12.1280.24 $tmpdir/raw.yu12.1280.24.stateless ; then + echo "OK: stateless decode" | tee -a $tmp + vicodec_ok=$((vicodec_ok+1)) + else + echo "FAIL: stateless decode: unexpected output" | tee -a $tmp + vicodec_fail=$((vicodec_fail+1)) + fi echo echo stateful decode with dynamic resolution changes for every frame | tee /dev/kmsg @@ -596,7 +618,14 @@ if [ $vicodec -eq 1 -a $setup -eq 0 ]; then $v4l2_ctl $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.2.12 --stream-to=$tmpdir/raw.yu12.mix.2.12 # v4l2-ctl does not yet reallocate buffers if they are too small for the new format $v4l2_ctl $decless_opts -v width=1920,height=1088 --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.2.12 --stream-to=$tmpdir/raw.yu12.mix.2.12.stateless - cmp $tmpdir/raw.yu12.mix.2.12 $tmpdir/raw.yu12.mix.2.12.stateless + vicodec_tests=$((vicodec_tests+1)) + if cmp $tmpdir/raw.yu12.mix.2.12 $tmpdir/raw.yu12.mix.2.12.stateless ; then + echo "OK: stateful decode with dynamic resolution changes for every frame" | tee -a $tmp + vicodec_ok=$((vicodec_ok+1)) + else + echo "FAIL: stateful decode with dynamic resolution changes for every frame: unexpected output" | tee -a $tmp + vicodec_fail=$((vicodec_fail+1)) + fi echo echo stateful decode with dynamic resolution changes for every other frame | tee /dev/kmsg @@ -604,7 +633,15 @@ if [ $vicodec -eq 1 -a $setup -eq 0 ]; then $v4l2_ctl $decful_opts --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.4.6 --stream-to=$tmpdir/raw.yu12.mix.4.6 # v4l2-ctl does not yet reallocate buffers if they are too small for the new format $v4l2_ctl $decless_opts -v width=1920,height=1088 --stream-from-hdr=$tmpdir/comp.hdr.yu12.mix.4.6 --stream-to=$tmpdir/raw.yu12.mix.4.6.stateless - cmp $tmpdir/raw.yu12.mix.4.6 $tmpdir/raw.yu12.mix.4.6.stateless + vicodec_tests=$((vicodec_tests+1)) + if cmp $tmpdir/raw.yu12.mix.4.6 $tmpdir/raw.yu12.mix.4.6.stateless ; then + echo "OK: stateful decode with dynamic resolution changes for every other frame" | tee -a $tmp + vicodec_ok=$((vicodec_ok+1)) + else + echo "FAIL: stateful decode with dynamic resolution changes for every other frame: unexpected output" | tee -a $tmp + vicodec_fail=$((vicodec_fail+1)) + fi + echo Total for vicodec cmp tests: $vicodec_tests, Succeeded: $vicodec_ok, Failed: $vicodec_fail, Warnings: 0 | tee -a $tmp rm -rf $tmpdir echo @@ -665,7 +702,7 @@ fi if [ $vidtv -eq 1 ]; then rmmod dvb_vidtv_bridge dvb_vidtv_tuner dvb_vidtv_demod 2&>/dev/null modprobe vidtv - sleep 2 + sleep $modprobe_time dmesg -n notice if ! media-ctl -d platform:vidtv ; then diff --git a/contrib/test/v4l2gl.c b/contrib/test/v4l2gl.c index 4df3910e..dc665fcc 100644 --- a/contrib/test/v4l2gl.c +++ b/contrib/test/v4l2gl.c @@ -12,7 +12,6 @@ */ #include <argp.h> -#include <config.h> #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/contrib/test/v4l2grab.c b/contrib/test/v4l2grab.c index a19f7196..0983f918 100644 --- a/contrib/test/v4l2grab.c +++ b/contrib/test/v4l2grab.c @@ -12,7 +12,6 @@ */ #include <argp.h> -#include <config.h> #include <errno.h> #include <fcntl.h> #include <linux/videodev2.h> @@ -68,8 +67,8 @@ static void xioctl(int fh, unsigned long int request, void *arg) struct video_formats { unsigned int pixformat; unsigned int depth; - unsigned int y_decimation; - unsigned int x_decimation; + int y_decimation; + int x_decimation; unsigned int is_rgb:1; }; @@ -82,24 +81,27 @@ struct colorspace_parms { }; static const struct video_formats supported_formats[] = { - { V4L2_PIX_FMT_BGR32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_ABGR32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_XBGR32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_RGB32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_ARGB32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_XRGB32, 32, 0, 0, 1}, - { V4L2_PIX_FMT_BGR24, 24, 0, 0, 1}, - { V4L2_PIX_FMT_RGB24, 24, 0, 0, 1}, - { V4L2_PIX_FMT_RGB565, 16, 0, 0, 1}, - { V4L2_PIX_FMT_RGB565X, 16, 0, 0, 1}, - { V4L2_PIX_FMT_YUYV, 16, 0, 0, 0}, - { V4L2_PIX_FMT_UYVY, 16, 0, 0, 0}, - { V4L2_PIX_FMT_YVYU, 16, 0, 0, 0}, - { V4L2_PIX_FMT_VYUY, 16, 0, 0, 0}, - { V4L2_PIX_FMT_NV12, 8, 1, 0, 0}, - { V4L2_PIX_FMT_NV21, 8, 1, 0, 0}, + { V4L2_PIX_FMT_BGR32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_ABGR32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_XBGR32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_RGB32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_ARGB32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_XRGB32, 32, -1, -1, 1}, + { V4L2_PIX_FMT_BGR24, 24, -1, -1, 1}, + { V4L2_PIX_FMT_RGB24, 24, -1, -1, 1}, + { V4L2_PIX_FMT_RGB565, 16, -1, -1, 1}, + { V4L2_PIX_FMT_RGB565X, 16, -1, -1, 1}, + { V4L2_PIX_FMT_YUYV, 16, -1, -1, 0}, + { V4L2_PIX_FMT_UYVY, 16, -1, -1, 0}, + { V4L2_PIX_FMT_YVYU, 16, -1, -1, 0}, + { V4L2_PIX_FMT_VYUY, 16, -1, -1, 0}, + { V4L2_PIX_FMT_NV12, 8, 1, -1, 0}, + { V4L2_PIX_FMT_NV21, 8, 1, -1, 0}, + { V4L2_PIX_FMT_NV16, 8, 0, -1, 0}, + { V4L2_PIX_FMT_NV61, 8, 0, -1, 0}, { V4L2_PIX_FMT_YUV420, 8, 1, 1, 0}, { V4L2_PIX_FMT_YVU420, 8, 1, 1, 0}, + { V4L2_PIX_FMT_YUV422P, 8, 0, 1, 0}, }; static const struct video_formats *video_fmt_props(unsigned int pixformat) @@ -206,8 +208,6 @@ static char *prt_caps(uint32_t caps, char *s) strcat (s,"RADIO "); if (V4L2_CAP_READWRITE & caps) strcat (s,"READWRITE "); - if (V4L2_CAP_ASYNCIO & caps) - strcat (s,"ASYNCIO "); if (V4L2_CAP_STREAMING & caps) strcat (s,"STREAMING "); if (V4L2_CAP_EXT_PIX_FORMAT & caps) @@ -226,12 +226,6 @@ static char *prt_caps(uint32_t caps, char *s) strcat (s,"SDR_OUTPUT "); if(V4L2_CAP_META_CAPTURE & caps) strcat (s,"META_CAPTURE "); - if(V4L2_CAP_READWRITE & caps) - strcat (s,"READWRITE "); - if(V4L2_CAP_ASYNCIO & caps) - strcat (s,"ASYNCIO "); - if(V4L2_CAP_STREAMING & caps) - strcat (s,"STREAMING "); if(V4L2_CAP_META_OUTPUT & caps) strcat (s,"META_OUTPUT "); if(V4L2_CAP_TOUCH & caps) @@ -378,28 +372,35 @@ static void copy_two_pixels(struct v4l2_format *fmt, break; case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV16: + u = plane1[0]; + v = plane1[1]; + + for (i = 0; i < 2; i++) + convert_yuv(c, plane0[i], u, v, dst); + + break; case V4L2_PIX_FMT_NV21: - if (fourcc == V4L2_PIX_FMT_NV12) { - u = plane1[0]; - v = plane1[1]; - } else { - u = plane1[1]; - v = plane1[0]; - } + case V4L2_PIX_FMT_NV61: + v = plane1[0]; + u = plane1[1]; for (i = 0; i < 2; i++) convert_yuv(c, plane0[i], u, v, dst); break; case V4L2_PIX_FMT_YUV420: + case V4L2_PIX_FMT_YUV422P: + u = plane1[0]; + v = plane2[0]; + + for (i = 0; i < 2; i++) + convert_yuv(c, plane0[i], u, v, dst); + + break; case V4L2_PIX_FMT_YVU420: - if (fourcc == V4L2_PIX_FMT_YUV420) { - u = plane1[0]; - v = plane2[0]; - } else { - u = plane2[0]; - v = plane1[0]; - } + v = plane1[0]; + u = plane2[0]; for (i = 0; i < 2; i++) convert_yuv(c, plane0[i], u, v, dst); @@ -441,6 +442,7 @@ static void copy_two_pixels(struct v4l2_format *fmt, } static unsigned int convert_to_rgb24(struct v4l2_format *fmt, + unsigned int imagesize, unsigned char *plane0, unsigned char *p_out) { @@ -454,6 +456,7 @@ static unsigned int convert_to_rgb24(struct v4l2_format *fmt, unsigned char *plane1 = NULL; unsigned char *plane2 = NULL; struct colorspace_parms c; + unsigned int needed_size; unsigned int x, y, depth; uint32_t num_planes = 1; unsigned char *p_start; @@ -468,21 +471,42 @@ static unsigned int convert_to_rgb24(struct v4l2_format *fmt, return 0; depth = video_fmt->depth; - h_dec = video_fmt->y_decimation; - w_dec = video_fmt->x_decimation; - if (h_dec) + plane0_size = width * height * depth; + needed_size = plane0_size; + + if (video_fmt->y_decimation >= 0) { num_planes++; + h_dec = video_fmt->y_decimation; + needed_size += plane0_size >> h_dec; + } - if (w_dec) + if (video_fmt->x_decimation >= 0) { num_planes++; + w_dec = video_fmt->x_decimation; + needed_size += plane0_size >> w_dec; + } + + plane0_size = plane0_size >> 3; + needed_size = needed_size >> 3; + + if (imagesize < needed_size) { + fprintf(stderr, "Warning: Image too small! "); + fprintf(stderr, "Image size: %u bytes, need %u, being:\n", imagesize, needed_size); + fprintf(stderr, "\tPlane0 size: %u bytes\n", plane0_size); + if (video_fmt->y_decimation >= 0) + fprintf(stderr, "\tH Plane size: %u bytes\n", plane0_size >> h_dec); + if (video_fmt->x_decimation >= 0) + fprintf(stderr, "\tW Plane size: %u bytes\n", plane0_size >> w_dec); + + // FIXME: should we bail-out here? + // exit(EXIT_FAILURE); + } p_start = p_out; - if (num_planes > 1) { - plane0_size = (width * height * depth) >> 3; + if (num_planes > 1) plane1_start = plane0_start + plane0_size; - } if (num_planes > 2) plane2_start = plane1_start + (plane0_size >> (w_dec + h_dec)); @@ -565,7 +589,8 @@ static int read_capture_loop(int fd, struct buffer *buffers, if (!ppm_output || !out_buf) { out_buf = buffers[0].start; } else { - size = convert_to_rgb24(fmt, buffers[0].start, out_buf); + size = convert_to_rgb24(fmt, size, + buffers[0].start, out_buf); } fwrite(out_buf, size, 1, fout); @@ -644,7 +669,8 @@ static int userptr_capture_loop(int fd, struct buffer *buffers, out_buf = buffers[buf.index].start; size = buf.bytesused; } else { - size = convert_to_rgb24(fmt, buffers[buf.index].start, + size = convert_to_rgb24(fmt, buf.bytesused, + buffers[buf.index].start, out_buf); } @@ -849,7 +875,8 @@ static int mmap_capture_threads(int fd, struct buffer *buffers, out_buf = buffers[buf.index].start; size = buf.bytesused; } else { - size = convert_to_rgb24(fmt, buffers[buf.index].start, + size = convert_to_rgb24(fmt, buf.bytesused, + buffers[buf.index].start, out_buf); } @@ -919,11 +946,12 @@ static int mmap_capture_loop(int fd, struct buffer *buffers, fprintf(fout, "P6\n%d %d 255\n", fmt->fmt.pix.width, fmt->fmt.pix.height); - if (!out_buf) { + if (!ppm_output || !out_buf) { out_buf = buffers[buf.index].start; size = buf.bytesused; } else { - size = convert_to_rgb24(fmt, buffers[buf.index].start, + size = convert_to_rgb24(fmt, buf.bytesused, + buffers[buf.index].start, out_buf); } fwrite(out_buf, size, 1, fout); @@ -1186,7 +1214,7 @@ int main(int argc, char **argv) ppm_output = 0; } else { if (is_format_supported(fmt.fmt.pix.pixelformat)) { - out_buf = malloc(3 * x_res * y_res); + out_buf = malloc(3 * fmt.fmt.pix.width * fmt.fmt.pix.height); if (!out_buf) { perror("Cannot allocate memory"); exit(EXIT_FAILURE); diff --git a/contrib/xc3028-firmware/.gitignore b/contrib/xc3028-firmware/.gitignore deleted file mode 100644 index e9c07c4f..00000000 --- a/contrib/xc3028-firmware/.gitignore +++ /dev/null @@ -1 +0,0 @@ -firmware-tool diff --git a/contrib/xc3028-firmware/Makefile.am b/contrib/xc3028-firmware/Makefile.am deleted file mode 100644 index 8b23d1e1..00000000 --- a/contrib/xc3028-firmware/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -noinst_PROGRAMS = firmware-tool - -firmware_tool_SOURCES = firmware-tool.c standards.c extract_head.h standards.h tuner-xc2028-types.h - -EXTRA_DIST = README diff --git a/contrib/xc3028-firmware/firmware-tool.c b/contrib/xc3028-firmware/firmware-tool.c index 3ae59f87..5dd205e0 100644 --- a/contrib/xc3028-firmware/firmware-tool.c +++ b/contrib/xc3028-firmware/firmware-tool.c @@ -677,8 +677,6 @@ static int seek_chunks(struct chunk_hunk *fhunk, } } - free(temp_data); - /* Method 2: seek for base firmware */ if (!base_start) base_start = seek; @@ -728,6 +726,8 @@ static int seek_chunks(struct chunk_hunk *fhunk, base_start = p; + free(temp_data); + return 2; } } @@ -785,6 +785,8 @@ not_found: #endif memset(fhunk, 0, sizeof(struct chunk_hunk)); printf("Couldn't find firmware\n"); + + free(temp_data); return 0; /* Method 4: Seek for first firmware chunks */ diff --git a/contrib/xc3028-firmware/meson.build b/contrib/xc3028-firmware/meson.build new file mode 100644 index 00000000..802c6858 --- /dev/null +++ b/contrib/xc3028-firmware/meson.build @@ -0,0 +1,11 @@ +xc3028_firmware_sources = files( + 'extract_head.h', + 'firmware-tool.c', + 'standards.c', + 'standards.h', + 'xc2028-types.h', +) + +xc3028_firmware = executable('xc3028-firmware', + xc3028_firmware_sources, + include_directories : v4l2_utils_incdir) diff --git a/doxygen_libdvbv5.cfg b/doc/Doxyfile.in index b25301a0..b7a76cb1 100644 --- a/doxygen_libdvbv5.cfg +++ b/doc/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = libdvbv5 # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = $(VERSION) +PROJECT_NUMBER = @VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = $(DOCDIR) +OUTPUT_DIRECTORY = @DOCDIR@ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -144,7 +144,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = $(SRCDIR) +STRIP_FROM_PATH = @SRCDIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -222,12 +222,6 @@ TAB_SIZE = 8 ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -743,52 +737,52 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = $(SRCDIR)/doc/libdvbv5-index.doc \ - $(SRCDIR)/lib/include/libdvbv5/dvb-demux.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-dev.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-fe.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-file.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-log.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-sat.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-scan.h \ - $(SRCDIR)/lib/include/libdvbv5/dvb-v5-std.h \ - $(SRCDIR)/lib/include/libdvbv5/descriptors.h \ - $(SRCDIR)/lib/include/libdvbv5/header.h \ - $(SRCDIR)/lib/include/libdvbv5/atsc_header.h \ - $(SRCDIR)/lib/include/libdvbv5/atsc_eit.h \ - $(SRCDIR)/lib/include/libdvbv5/cat.h \ - $(SRCDIR)/lib/include/libdvbv5/eit.h \ - $(SRCDIR)/lib/include/libdvbv5/mgt.h \ - $(SRCDIR)/lib/include/libdvbv5/nit.h \ - $(SRCDIR)/lib/include/libdvbv5/pat.h \ - $(SRCDIR)/lib/include/libdvbv5/pmt.h \ - $(SRCDIR)/lib/include/libdvbv5/sdt.h \ - $(SRCDIR)/lib/include/libdvbv5/vct.h \ - $(SRCDIR)/lib/include/libdvbv5/crc32.h \ - $(SRCDIR)/lib/include/libdvbv5/countries.h \ - $(SRCDIR)/lib/include/libdvbv5/mpeg_es.h \ - $(SRCDIR)/lib/include/libdvbv5/mpeg_pes.h \ - $(SRCDIR)/lib/include/libdvbv5/mpeg_ts.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_atsc_service_location.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_ca.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_ca_identifier.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_cable_delivery.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_event_extended.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_event_short.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_extension.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_descriptor_id.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_frequency_list.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_hierarchy.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_isdbt_delivery.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_language.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_logical_channel.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_network_name.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_partial_reception.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_sat.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_service.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_t2_delivery.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_terrestrial_delivery.h \ - $(SRCDIR)/lib/include/libdvbv5/desc_ts_info.h \ +INPUT = @SRCDIR@/doc/libdvbv5-index.doc \ + @SRCDIR@/lib/include/libdvbv5/dvb-demux.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-dev.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-fe.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-file.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-log.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-sat.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-scan.h \ + @SRCDIR@/lib/include/libdvbv5/dvb-v5-std.h \ + @SRCDIR@/lib/include/libdvbv5/descriptors.h \ + @SRCDIR@/lib/include/libdvbv5/header.h \ + @SRCDIR@/lib/include/libdvbv5/atsc_header.h \ + @SRCDIR@/lib/include/libdvbv5/atsc_eit.h \ + @SRCDIR@/lib/include/libdvbv5/cat.h \ + @SRCDIR@/lib/include/libdvbv5/eit.h \ + @SRCDIR@/lib/include/libdvbv5/mgt.h \ + @SRCDIR@/lib/include/libdvbv5/nit.h \ + @SRCDIR@/lib/include/libdvbv5/pat.h \ + @SRCDIR@/lib/include/libdvbv5/pmt.h \ + @SRCDIR@/lib/include/libdvbv5/sdt.h \ + @SRCDIR@/lib/include/libdvbv5/vct.h \ + @SRCDIR@/lib/include/libdvbv5/crc32.h \ + @SRCDIR@/lib/include/libdvbv5/countries.h \ + @SRCDIR@/lib/include/libdvbv5/mpeg_es.h \ + @SRCDIR@/lib/include/libdvbv5/mpeg_pes.h \ + @SRCDIR@/lib/include/libdvbv5/mpeg_ts.h \ + @SRCDIR@/lib/include/libdvbv5/desc_atsc_service_location.h \ + @SRCDIR@/lib/include/libdvbv5/desc_ca.h \ + @SRCDIR@/lib/include/libdvbv5/desc_ca_identifier.h \ + @SRCDIR@/lib/include/libdvbv5/desc_cable_delivery.h \ + @SRCDIR@/lib/include/libdvbv5/desc_event_extended.h \ + @SRCDIR@/lib/include/libdvbv5/desc_event_short.h \ + @SRCDIR@/lib/include/libdvbv5/desc_extension.h \ + @SRCDIR@/lib/include/libdvbv5/desc_frequency_list.h \ + @SRCDIR@/lib/include/libdvbv5/desc_hierarchy.h \ + @SRCDIR@/lib/include/libdvbv5/desc_isdbt_delivery.h \ + @SRCDIR@/lib/include/libdvbv5/desc_language.h \ + @SRCDIR@/lib/include/libdvbv5/desc_logical_channel.h \ + @SRCDIR@/lib/include/libdvbv5/desc_network_name.h \ + @SRCDIR@/lib/include/libdvbv5/desc_partial_reception.h \ + @SRCDIR@/lib/include/libdvbv5/desc_registration_id.h \ + @SRCDIR@/lib/include/libdvbv5/desc_sat.h \ + @SRCDIR@/lib/include/libdvbv5/desc_service.h \ + @SRCDIR@/lib/include/libdvbv5/desc_t2_delivery.h \ + @SRCDIR@/lib/include/libdvbv5/desc_terrestrial_delivery.h \ + @SRCDIR@/lib/include/libdvbv5/desc_ts_info.h \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -856,7 +850,7 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = $(SRCDIR)/utils/dvb/ +EXAMPLE_PATH = @SRCDIR@/utils/dvb/ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -1023,13 +1017,6 @@ VERBATIM_HEADERS = YES ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -1045,7 +1032,7 @@ IGNORE_PREFIX = # If the GENERATE_HTML tag is set to YES doxygen will generate HTML output # The default value is: YES. -GENERATE_HTML = $(GENERATE_HTML) +GENERATE_HTML = @GENERATE_HTML@ # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1244,14 +1231,14 @@ DOCSET_PUBLISHER_NAME = Publisher # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_HTMLHELP = $(GENERATE_HTMLHELP) +GENERATE_HTMLHELP = NO # The CHM_FILE tag can be used to specify the file name of the resulting .chm # file. You can add a path in front of the file if the result should not be # written to the html output directory. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -CHM_FILE = ../$(PROJECT).chm +CHM_FILE = # The HHC_LOCATION tag can be used to specify the location (absolute path # including file name) of the HTML help compiler ( hhc.exe). If non-empty @@ -1259,14 +1246,14 @@ CHM_FILE = ../$(PROJECT).chm # The file has to be specified with full path. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -HHC_LOCATION = $(HHC_PATH) +HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated ( # YES) or that it should be included in the master .chm file ( NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. -GENERATE_CHI = $(GENERATE_CHI) +GENERATE_CHI = NO # The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) # and project file content. @@ -1585,7 +1572,7 @@ EXTRA_SEARCH_MAPPINGS = # If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. # The default value is: YES. -GENERATE_LATEX = $(GENERATE_LATEX) +GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1628,7 +1615,7 @@ COMPACT_LATEX = YES # The default value is: a4. # This tag requires that the tag GENERATE_LATEX is set to YES. -PAPER_TYPE = $(PAPER_SIZE) +PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names # that should be included in the LaTeX output. To get the times font for @@ -1687,7 +1674,7 @@ PDF_HYPERLINKS = YES # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. -USE_PDFLATEX = $(GENERATE_PDF) +USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode # command to the generated LaTeX files. This will instruct LaTeX to keep running @@ -1705,16 +1692,6 @@ LATEX_BATCHMODE = YES LATEX_HIDE_INDICES = NO -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See # http://en.wikipedia.org/wiki/BibTeX and \cite for more info. @@ -1732,7 +1709,7 @@ LATEX_BIB_STYLE = plain # readers/editors. # The default value is: NO. -GENERATE_RTF = $(GENERATE_RTF) +GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1787,7 +1764,7 @@ RTF_EXTENSIONS_FILE = # classes and files. # The default value is: NO. -GENERATE_MAN = $(GENERATE_MAN) +GENERATE_MAN = @GENERATE_MAN@ # The MAN_OUTPUT tag is used to specify where the man pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1824,7 +1801,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = $(GENERATE_XML) +GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -1834,18 +1811,6 @@ GENERATE_XML = $(GENERATE_XML) XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify a XML DTD, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_DTD = - # If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program # listings (including syntax highlighting and cross-referencing information) to # the XML output. Note that enabling this will significantly increase the size @@ -2028,7 +1993,7 @@ TAGFILES = # tag file that is based on the input files it reads. See section "Linking to # external documentation" for more information about the usage of tag files. -GENERATE_TAGFILE = $(DOCDIR)/$(PROJECT).tag +GENERATE_TAGFILE = @DOCDIR@/@PROJECT@.tag # If the ALLEXTERNALS tag is set to YES all external class will be listed in the # class index. If set to NO only the inherited external classes will be listed. @@ -2050,34 +2015,10 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/false - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2098,7 +2039,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: NO. -HAVE_DOT = $(HAVE_DOT) +HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2270,7 +2211,7 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = $(DOT_PATH) +DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 00000000..8f4437e7 --- /dev/null +++ b/doc/meson.build @@ -0,0 +1,35 @@ +doxygen_doc_option = get_option('doxygen-doc') +if doxygen_doc_option.disabled() or not prog_doxygen.found() + subdir_done() +endif + +cdata = configuration_data() +cdata.set('DOCDIR', 'doc') +cdata.set('GENERATE_HTML', get_option('doxygen-html')) +cdata.set('GENERATE_MAN', get_option('doxygen-man')) +cdata.set('PROJECT', meson.project_name()) +cdata.set('SRCDIR', source_root) +cdata.set('VERSION', as_version) + +doxyfile = configure_file(input : 'Doxyfile.in', + output : 'Doxyfile', + configuration : cdata) + +doxygen_install_dirs = [] + +doxygen_output = [] +if get_option('doxygen-html') + doxygen_output += 'html' + doxygen_install_dirs += get_option('datadir') / 'doc' / '@0@'.format(meson.project_name()) +endif +if get_option('doxygen-man') + doxygen_output += 'man' + doxygen_install_dirs += get_option('mandir') / '..' +endif + +custom_target('doxygen', + input : doxyfile, + output : doxygen_output, + command : [prog_doxygen, doxyfile], + install : true, + install_dir : doxygen_install_dirs) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 2892794f..58e30f17 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -87,10 +87,35 @@ struct bpf_cgroup_storage_key { __u32 attach_type; /* program attach type (enum bpf_attach_type) */ }; +enum bpf_cgroup_iter_order { + BPF_CGROUP_ITER_ORDER_UNSPEC = 0, + BPF_CGROUP_ITER_SELF_ONLY, /* process only a single object. */ + BPF_CGROUP_ITER_DESCENDANTS_PRE, /* walk descendants in pre-order. */ + BPF_CGROUP_ITER_DESCENDANTS_POST, /* walk descendants in post-order. */ + BPF_CGROUP_ITER_ANCESTORS_UP, /* walk ancestors upward. */ +}; + union bpf_iter_link_info { struct { __u32 map_fd; } map; + struct { + enum bpf_cgroup_iter_order order; + + /* At most one of cgroup_fd and cgroup_id can be non-zero. If + * both are zero, the walk starts from the default cgroup v2 + * root. For walking v1 hierarchy, one should always explicitly + * specify cgroup_fd. + */ + __u32 cgroup_fd; + __u64 cgroup_id; + } cgroup; + /* Parameters of task iterators. */ + struct { + __u32 tid; + __u32 pid; + __u32 pid_fd; + } task; }; /* BPF syscall commands, see bpf(2) man-page for more details. */ @@ -897,7 +922,14 @@ enum bpf_map_type { BPF_MAP_TYPE_CPUMAP, BPF_MAP_TYPE_XSKMAP, BPF_MAP_TYPE_SOCKHASH, - BPF_MAP_TYPE_CGROUP_STORAGE, + BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED, + /* BPF_MAP_TYPE_CGROUP_STORAGE is available to bpf programs attaching + * to a cgroup. The newer BPF_MAP_TYPE_CGRP_STORAGE is available to + * both cgroup-attached and other progs and supports all functionality + * provided by BPF_MAP_TYPE_CGROUP_STORAGE. So mark + * BPF_MAP_TYPE_CGROUP_STORAGE deprecated. + */ + BPF_MAP_TYPE_CGROUP_STORAGE = BPF_MAP_TYPE_CGROUP_STORAGE_DEPRECATED, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE, BPF_MAP_TYPE_QUEUE, @@ -909,6 +941,8 @@ enum bpf_map_type { BPF_MAP_TYPE_INODE_STORAGE, BPF_MAP_TYPE_TASK_STORAGE, BPF_MAP_TYPE_BLOOM_FILTER, + BPF_MAP_TYPE_USER_RINGBUF, + BPF_MAP_TYPE_CGRP_STORAGE, }; /* Note that tracing related programs such as @@ -952,6 +986,7 @@ enum bpf_prog_type { BPF_PROG_TYPE_LSM, BPF_PROG_TYPE_SK_LOOKUP, BPF_PROG_TYPE_SYSCALL, /* a program that can execute syscalls */ + BPF_PROG_TYPE_NETFILTER, }; enum bpf_attach_type { @@ -998,6 +1033,8 @@ enum bpf_attach_type { BPF_SK_REUSEPORT_SELECT_OR_MIGRATE, BPF_PERF_EVENT, BPF_TRACE_KPROBE_MULTI, + BPF_LSM_CGROUP, + BPF_STRUCT_OPS, __MAX_BPF_ATTACH_TYPE }; @@ -1014,6 +1051,7 @@ enum bpf_link_type { BPF_LINK_TYPE_PERF_EVENT = 7, BPF_LINK_TYPE_KPROBE_MULTI = 8, BPF_LINK_TYPE_STRUCT_OPS = 9, + BPF_LINK_TYPE_NETFILTER = 10, MAX_BPF_LINK_TYPE, }; @@ -1073,7 +1111,7 @@ enum bpf_link_type { */ #define BPF_F_STRICT_ALIGNMENT (1U << 0) -/* If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the +/* If BPF_F_ANY_ALIGNMENT is used in BPF_PROG_LOAD command, the * verifier will allow any alignment whatsoever. On platforms * with strict alignment requirements for loads ands stores (such * as sparc and mips) the verifier validates that all loads and @@ -1121,6 +1159,11 @@ enum bpf_link_type { */ #define BPF_F_XDP_HAS_FRAGS (1U << 5) +/* If BPF_F_XDP_DEV_BOUND_ONLY is used in BPF_PROG_LOAD command, the loaded + * program becomes device-bound but can access XDP metadata. + */ +#define BPF_F_XDP_DEV_BOUND_ONLY (1U << 6) + /* link_create.kprobe_multi.flags used in LINK_CREATE command for * BPF_TRACE_KPROBE_MULTI attach type to create return probe. */ @@ -1226,13 +1269,16 @@ enum { /* Create a map that is suitable to be an inner map with dynamic max entries */ BPF_F_INNER_MAP = (1U << 12), + +/* Create a map that will be registered/unregesitered by the backed bpf_link */ + BPF_F_LINK = (1U << 13), }; /* Flags for BPF_PROG_QUERY. */ /* Query effective (directly attached + inherited from ancestor cgroups) * programs that will be executed for events within a cgroup. - * attach_flags with this flag are returned only for directly attached programs. + * attach_flags with this flag are always returned 0. */ #define BPF_F_QUERY_EFFECTIVE (1U << 0) @@ -1363,6 +1409,11 @@ union bpf_attr { __aligned_u64 fd_array; /* array of FDs */ __aligned_u64 core_relos; __u32 core_relo_rec_size; /* sizeof(struct bpf_core_relo) */ + /* output: actual total log contents size (including termintaing zero). + * It could be both larger than original log_size (if log was + * truncated), or smaller (if log buffer wasn't filled completely). + */ + __u32 log_true_size; }; struct { /* anonymous struct used by BPF_OBJ_* commands */ @@ -1431,6 +1482,10 @@ union bpf_attr { __u32 attach_flags; __aligned_u64 prog_ids; __u32 prog_cnt; + /* output: per-program attach_flags. + * not allowed to be set during effective query. + */ + __aligned_u64 prog_attach_flags; } query; struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */ @@ -1444,6 +1499,11 @@ union bpf_attr { __u32 btf_size; __u32 btf_log_size; __u32 btf_log_level; + /* output: actual total log contents size (including termintaing zero). + * It could be both larger than original log_size (if log was + * truncated), or smaller (if log buffer wasn't filled completely). + */ + __u32 btf_log_true_size; }; struct { @@ -1463,7 +1523,10 @@ union bpf_attr { } task_fd_query; struct { /* struct used by BPF_LINK_CREATE command */ - __u32 prog_fd; /* eBPF program to attach */ + union { + __u32 prog_fd; /* eBPF program to attach */ + __u32 map_fd; /* struct_ops to attach */ + }; union { __u32 target_fd; /* object to attach to */ __u32 target_ifindex; /* target ifindex */ @@ -1499,17 +1562,34 @@ union bpf_attr { */ __u64 cookie; } tracing; + struct { + __u32 pf; + __u32 hooknum; + __s32 priority; + __u32 flags; + } netfilter; }; } link_create; struct { /* struct used by BPF_LINK_UPDATE command */ __u32 link_fd; /* link fd */ - /* new program fd to update link with */ - __u32 new_prog_fd; + union { + /* new program fd to update link with */ + __u32 new_prog_fd; + /* new struct_ops map fd to update link with */ + __u32 new_map_fd; + }; __u32 flags; /* extra flags */ - /* expected link's program fd; is specified only if - * BPF_F_REPLACE flag is set in flags */ - __u32 old_prog_fd; + union { + /* expected link's program fd; is specified only if + * BPF_F_REPLACE flag is set in flags. + */ + __u32 old_prog_fd; + /* expected link's map fd; is specified only + * if BPF_F_REPLACE flag is set. + */ + __u32 old_map_fd; + }; } link_update; struct { @@ -1603,17 +1683,17 @@ union bpf_attr { * Description * This helper is a "printk()-like" facility for debugging. It * prints a message defined by format *fmt* (of size *fmt_size*) - * to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if + * to file *\/sys/kernel/tracing/trace* from TraceFS, if * available. It can take up to three additional **u64** * arguments (as an eBPF helpers, the total number of arguments is * limited to five). * * Each time the helper is called, it appends a line to the trace. - * Lines are discarded while *\/sys/kernel/debug/tracing/trace* is - * open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this. + * Lines are discarded while *\/sys/kernel/tracing/trace* is + * open, use *\/sys/kernel/tracing/trace_pipe* to avoid this. * The format of the trace is customizable, and the exact output * one will get depends on the options set in - * *\/sys/kernel/debug/tracing/trace_options* (see also the + * *\/sys/kernel/tracing/trace_options* (see also the * *README* file under the same directory). However, it usually * defaults to something like: * @@ -1962,6 +2042,9 @@ union bpf_attr { * sending the packet. This flag was added for GRE * encapsulation, but might be used with other protocols * as well in the future. + * **BPF_F_NO_TUNNEL_KEY** + * Add a flag to tunnel metadata indicating that no tunnel + * key should be set in the resulting tunnel header. * * Here is a typical usage on the transmit path: * @@ -2359,7 +2442,8 @@ union bpf_attr { * Pull in non-linear data in case the *skb* is non-linear and not * all of *len* are part of the linear section. Make *len* bytes * from *skb* readable and writable. If a zero value is passed for - * *len*, then the whole length of the *skb* is pulled. + * *len*, then all bytes in the linear part of *skb* will be made + * readable and writable. * * This helper is only needed for reading and writing with direct * packet access. @@ -2544,14 +2628,19 @@ union bpf_attr { * * **SOL_SOCKET**, which supports the following *optname*\ s: * **SO_RCVBUF**, **SO_SNDBUF**, **SO_MAX_PACING_RATE**, * **SO_PRIORITY**, **SO_RCVLOWAT**, **SO_MARK**, - * **SO_BINDTODEVICE**, **SO_KEEPALIVE**. + * **SO_BINDTODEVICE**, **SO_KEEPALIVE**, **SO_REUSEADDR**, + * **SO_REUSEPORT**, **SO_BINDTOIFINDEX**, **SO_TXREHASH**. * * **IPPROTO_TCP**, which supports the following *optname*\ s: * **TCP_CONGESTION**, **TCP_BPF_IW**, * **TCP_BPF_SNDCWND_CLAMP**, **TCP_SAVE_SYN**, * **TCP_KEEPIDLE**, **TCP_KEEPINTVL**, **TCP_KEEPCNT**, - * **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**. + * **TCP_SYNCNT**, **TCP_USER_TIMEOUT**, **TCP_NOTSENT_LOWAT**, + * **TCP_NODELAY**, **TCP_MAXSEG**, **TCP_WINDOW_CLAMP**, + * **TCP_THIN_LINEAR_TIMEOUTS**, **TCP_BPF_DELACK_MAX**, + * **TCP_BPF_RTO_MIN**. * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. - * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. + * * **IPPROTO_IPV6**, which supports the following *optname*\ s: + * **IPV6_TCLASS**, **IPV6_AUTOFLOWLABEL**. * Return * 0 on success, or a negative error in case of failure. * @@ -2570,10 +2659,12 @@ union bpf_attr { * There are two supported modes at this time: * * * **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer - * (room space is added or removed below the layer 2 header). + * (room space is added or removed between the layer 2 and + * layer 3 headers). * * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer - * (room space is added or removed below the layer 3 header). + * (room space is added or removed between the layer 3 and + * layer 4 headers). * * The following flags are supported at this time: * @@ -2597,6 +2688,11 @@ union bpf_attr { * Use with BPF_F_ADJ_ROOM_ENCAP_L2 flag to further specify the * L2 type as Ethernet. * + * * **BPF_F_ADJ_ROOM_DECAP_L3_IPV4**, + * **BPF_F_ADJ_ROOM_DECAP_L3_IPV6**: + * Indicate the new IP header version after decapsulating the outer + * IP header. Used when the inner and outer IP versions are different. + * * A call to this helper is susceptible to change the underlying * packet buffer. Therefore, at load time, all checks on pointers * previously done by the verifier are invalidated and must be @@ -2605,7 +2701,7 @@ union bpf_attr { * Return * 0 on success, or a negative error in case of failure. * - * long bpf_redirect_map(struct bpf_map *map, u32 key, u64 flags) + * long bpf_redirect_map(struct bpf_map *map, u64 key, u64 flags) * Description * Redirect the packet to the endpoint referenced by *map* at * index *key*. Depending on its type, this *map* can contain @@ -2741,7 +2837,7 @@ union bpf_attr { * * long bpf_perf_prog_read_value(struct bpf_perf_event_data *ctx, struct bpf_perf_event_value *buf, u32 buf_size) * Description - * For en eBPF program attached to a perf event, retrieve the + * For an eBPF program attached to a perf event, retrieve the * value of the event counter associated to *ctx* and store it in * the structure pointed by *buf* and of size *buf_size*. Enabled * and running times are also stored in the structure (see @@ -2766,12 +2862,10 @@ union bpf_attr { * and **BPF_CGROUP_INET6_CONNECT**. * * This helper actually implements a subset of **getsockopt()**. - * It supports the following *level*\ s: - * - * * **IPPROTO_TCP**, which supports *optname* - * **TCP_CONGESTION**. - * * **IPPROTO_IP**, which supports *optname* **IP_TOS**. - * * **IPPROTO_IPV6**, which supports *optname* **IPV6_TCLASS**. + * It supports the same set of *optname*\ s that is supported by + * the **bpf_setsockopt**\ () helper. The exceptions are + * **TCP_BPF_*** is **bpf_setsockopt**\ () only and + * **TCP_SAVED_SYN** is **bpf_getsockopt**\ () only. * Return * 0 on success, or a negative error in case of failure. * @@ -3005,8 +3099,18 @@ union bpf_attr { * **BPF_F_USER_STACK** * Collect a user space stack instead of a kernel stack. * **BPF_F_USER_BUILD_ID** - * Collect buildid+offset instead of ips for user stack, - * only valid if **BPF_F_USER_STACK** is also specified. + * Collect (build_id, file_offset) instead of ips for user + * stack, only valid if **BPF_F_USER_STACK** is also + * specified. + * + * *file_offset* is an offset relative to the beginning + * of the executable or shared object file backing the vma + * which the *ip* falls in. It is *not* an offset relative + * to that object's base address. Accordingly, it must be + * adjusted by adding (sh_addr - sh_offset), where + * sh_{addr,offset} correspond to the executable section + * containing *file_offset* in the object, for comparisons + * to symbols' st_value to be valid. * * **bpf_get_stack**\ () can collect up to * **PERF_MAX_STACK_DEPTH** both kernel and user frames, subject @@ -3066,6 +3170,11 @@ union bpf_attr { * **BPF_FIB_LOOKUP_OUTPUT** * Perform lookup from an egress perspective (default is * ingress). + * **BPF_FIB_LOOKUP_SKIP_NEIGH** + * Skip the neighbour table lookup. *params*->dmac + * and *params*->smac will not be set as output. A common + * use case is to call **bpf_redirect_neigh**\ () after + * doing **bpf_fib_lookup**\ (). * * *ctx* is either **struct xdp_md** for XDP programs or * **struct sk_buff** tc cls_act programs. @@ -3597,10 +3706,11 @@ union bpf_attr { * * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or - * **sizeof**\ (**struct ip6hdr**). + * **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* - * contains **sizeof**\ (**struct tcphdr**). + * contains the length of the TCP header (at least + * **sizeof**\ (**struct tcphdr**)). * Return * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative * error otherwise. @@ -3783,10 +3893,11 @@ union bpf_attr { * * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or - * **sizeof**\ (**struct ip6hdr**). + * **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* - * contains the length of the TCP header. + * contains the length of the TCP header with options (at least + * **sizeof**\ (**struct tcphdr**)). * Return * On success, lower 32 bits hold the generated SYN cookie in * followed by 16 bits which hold the MSS value for that cookie, @@ -4420,7 +4531,7 @@ union bpf_attr { * * **-EEXIST** if the option already exists. * - * **-EFAULT** on failrue to parse the existing header options. + * **-EFAULT** on failure to parse the existing header options. * * **-EPERM** if the helper cannot be used under the current * *skops*\ **->op**. @@ -4629,7 +4740,7 @@ union bpf_attr { * a *map* with *task* as the **key**. From this * perspective, the usage is not much different from * **bpf_map_lookup_elem**\ (*map*, **&**\ *task*) except this - * helper enforces the key must be an task_struct and the map must also + * helper enforces the key must be a task_struct and the map must also * be a **BPF_MAP_TYPE_TASK_STORAGE**. * * Underneath, the value is stored locally at *task* instead of @@ -4687,7 +4798,7 @@ union bpf_attr { * * long bpf_ima_inode_hash(struct inode *inode, void *dst, u32 size) * Description - * Returns the stored IMA hash of the *inode* (if it's avaialable). + * Returns the stored IMA hash of the *inode* (if it's available). * If the hash is larger than *size*, then only *size* * bytes will be copied to *dst* * Return @@ -4711,12 +4822,12 @@ union bpf_attr { * * The argument *len_diff* can be used for querying with a planned * size change. This allows to check MTU prior to changing packet - * ctx. Providing an *len_diff* adjustment that is larger than the + * ctx. Providing a *len_diff* adjustment that is larger than the * actual packet size (resulting in negative packet size) will in - * principle not exceed the MTU, why it is not considered a - * failure. Other BPF-helpers are needed for performing the - * planned size change, why the responsability for catch a negative - * packet size belong in those helpers. + * principle not exceed the MTU, which is why it is not considered + * a failure. Other BPF helpers are needed for performing the + * planned size change; therefore the responsibility for catching + * a negative packet size belongs in those helpers. * * Specifying *ifindex* zero means the MTU check is performed * against the current net device. This is practical if this isn't @@ -4894,6 +5005,12 @@ union bpf_attr { * different maps if key/value layout matches across maps. * Every bpf_timer_set_callback() can have different callback_fn. * + * *flags* can be one of: + * + * **BPF_F_TIMER_ABS** + * Start the timer in absolute expire value instead of the + * default relative one. + * * Return * 0 on success. * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier @@ -4914,6 +5031,7 @@ union bpf_attr { * Get address of the traced function (for tracing and kprobe programs). * Return * Address of the traced function. + * 0 for kprobes placed within the function (not at the entry). * * u64 bpf_get_attach_cookie(void *ctx) * Description @@ -5043,12 +5161,12 @@ union bpf_attr { * * long bpf_get_func_arg(void *ctx, u32 n, u64 *value) * Description - * Get **n**-th argument (zero based) of the traced function (for tracing programs) + * Get **n**-th argument register (zero based) of the traced function (for tracing programs) * returned in **value**. * * Return * 0 on success. - * **-EINVAL** if n >= arguments count of traced function. + * **-EINVAL** if n >= argument register count of traced function. * * long bpf_get_func_ret(void *ctx, u64 *value) * Description @@ -5061,24 +5179,37 @@ union bpf_attr { * * long bpf_get_func_arg_cnt(void *ctx) * Description - * Get number of arguments of the traced function (for tracing programs). + * Get number of registers of the traced function (for tracing programs) where + * function arguments are stored in these registers. * * Return - * The number of arguments of the traced function. + * The number of argument registers of the traced function. * * int bpf_get_retval(void) * Description - * Get the syscall's return value that will be returned to userspace. + * Get the BPF program's return value that will be returned to the upper layers. * - * This helper is currently supported by cgroup programs only. + * This helper is currently supported by cgroup programs and only by the hooks + * where BPF program's return value is returned to the userspace via errno. * Return - * The syscall's return value. + * The BPF program's return value. * * int bpf_set_retval(int retval) * Description - * Set the syscall's return value that will be returned to userspace. + * Set the BPF program's return value that will be returned to the upper layers. + * + * This helper is currently supported by cgroup programs and only by the hooks + * where BPF program's return value is returned to the userspace via errno. + * + * Note that there is the following corner case where the program exports an error + * via bpf_set_retval but signals success via 'return 1': + * + * bpf_set_retval(-EPERM); + * return 1; + * + * In this case, the BPF program's return value will use helper's -EPERM. This + * still holds true for cgroup/bind{4,6} which supports extra 'return 3' success case. * - * This helper is currently supported by cgroup programs only. * Return * 0 on success, or a negative error in case of failure. * @@ -5222,247 +5353,439 @@ union bpf_attr { * Return * Nothing. Always succeeds. * - * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset) + * long bpf_dynptr_read(void *dst, u32 len, const struct bpf_dynptr *src, u32 offset, u64 flags) * Description * Read *len* bytes from *src* into *dst*, starting from *offset* * into *src*. + * *flags* is currently unused. * Return * 0 on success, -E2BIG if *offset* + *len* exceeds the length - * of *src*'s data, -EINVAL if *src* is an invalid dynptr. + * of *src*'s data, -EINVAL if *src* is an invalid dynptr or if + * *flags* is not 0. * - * long bpf_dynptr_write(struct bpf_dynptr *dst, u32 offset, void *src, u32 len) + * long bpf_dynptr_write(const struct bpf_dynptr *dst, u32 offset, void *src, u32 len, u64 flags) * Description * Write *len* bytes from *src* into *dst*, starting from *offset* * into *dst*. + * + * *flags* must be 0 except for skb-type dynptrs. + * + * For skb-type dynptrs: + * * All data slices of the dynptr are automatically + * invalidated after **bpf_dynptr_write**\ (). This is + * because writing may pull the skb and change the + * underlying packet buffer. + * + * * For *flags*, please see the flags accepted by + * **bpf_skb_store_bytes**\ (). * Return * 0 on success, -E2BIG if *offset* + *len* exceeds the length * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst* - * is a read-only dynptr. + * is a read-only dynptr or if *flags* is not correct. For skb-type dynptrs, + * other errors correspond to errors returned by **bpf_skb_store_bytes**\ (). * - * void *bpf_dynptr_data(struct bpf_dynptr *ptr, u32 offset, u32 len) + * void *bpf_dynptr_data(const struct bpf_dynptr *ptr, u32 offset, u32 len) * Description * Get a pointer to the underlying dynptr data. * * *len* must be a statically known value. The returned data slice * is invalidated whenever the dynptr is invalidated. + * + * skb and xdp type dynptrs may not use bpf_dynptr_data. They should + * instead use bpf_dynptr_slice and bpf_dynptr_slice_rdwr. * Return * Pointer to the underlying dynptr data, NULL if the dynptr is * read-only, if the dynptr is invalid, or if the offset and length * is out of bounds. + * + * s64 bpf_tcp_raw_gen_syncookie_ipv4(struct iphdr *iph, struct tcphdr *th, u32 th_len) + * Description + * Try to issue a SYN cookie for the packet with corresponding + * IPv4/TCP headers, *iph* and *th*, without depending on a + * listening socket. + * + * *iph* points to the IPv4 header. + * + * *th* points to the start of the TCP header, while *th_len* + * contains the length of the TCP header (at least + * **sizeof**\ (**struct tcphdr**)). + * Return + * On success, lower 32 bits hold the generated SYN cookie in + * followed by 16 bits which hold the MSS value for that cookie, + * and the top 16 bits are unused. + * + * On failure, the returned value is one of the following: + * + * **-EINVAL** if *th_len* is invalid. + * + * s64 bpf_tcp_raw_gen_syncookie_ipv6(struct ipv6hdr *iph, struct tcphdr *th, u32 th_len) + * Description + * Try to issue a SYN cookie for the packet with corresponding + * IPv6/TCP headers, *iph* and *th*, without depending on a + * listening socket. + * + * *iph* points to the IPv6 header. + * + * *th* points to the start of the TCP header, while *th_len* + * contains the length of the TCP header (at least + * **sizeof**\ (**struct tcphdr**)). + * Return + * On success, lower 32 bits hold the generated SYN cookie in + * followed by 16 bits which hold the MSS value for that cookie, + * and the top 16 bits are unused. + * + * On failure, the returned value is one of the following: + * + * **-EINVAL** if *th_len* is invalid. + * + * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin. + * + * long bpf_tcp_raw_check_syncookie_ipv4(struct iphdr *iph, struct tcphdr *th) + * Description + * Check whether *iph* and *th* contain a valid SYN cookie ACK + * without depending on a listening socket. + * + * *iph* points to the IPv4 header. + * + * *th* points to the TCP header. + * Return + * 0 if *iph* and *th* are a valid SYN cookie ACK. + * + * On failure, the returned value is one of the following: + * + * **-EACCES** if the SYN cookie is not valid. + * + * long bpf_tcp_raw_check_syncookie_ipv6(struct ipv6hdr *iph, struct tcphdr *th) + * Description + * Check whether *iph* and *th* contain a valid SYN cookie ACK + * without depending on a listening socket. + * + * *iph* points to the IPv6 header. + * + * *th* points to the TCP header. + * Return + * 0 if *iph* and *th* are a valid SYN cookie ACK. + * + * On failure, the returned value is one of the following: + * + * **-EACCES** if the SYN cookie is not valid. + * + * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin. + * + * u64 bpf_ktime_get_tai_ns(void) + * Description + * A nonsettable system-wide clock derived from wall-clock time but + * ignoring leap seconds. This clock does not experience + * discontinuities and backwards jumps caused by NTP inserting leap + * seconds as CLOCK_REALTIME does. + * + * See: **clock_gettime**\ (**CLOCK_TAI**) + * Return + * Current *ktime*. + * + * long bpf_user_ringbuf_drain(struct bpf_map *map, void *callback_fn, void *ctx, u64 flags) + * Description + * Drain samples from the specified user ring buffer, and invoke + * the provided callback for each such sample: + * + * long (\*callback_fn)(const struct bpf_dynptr \*dynptr, void \*ctx); + * + * If **callback_fn** returns 0, the helper will continue to try + * and drain the next sample, up to a maximum of + * BPF_MAX_USER_RINGBUF_SAMPLES samples. If the return value is 1, + * the helper will skip the rest of the samples and return. Other + * return values are not used now, and will be rejected by the + * verifier. + * Return + * The number of drained samples if no error was encountered while + * draining samples, or 0 if no samples were present in the ring + * buffer. If a user-space producer was epoll-waiting on this map, + * and at least one sample was drained, they will receive an event + * notification notifying them of available space in the ring + * buffer. If the BPF_RB_NO_WAKEUP flag is passed to this + * function, no wakeup notification will be sent. If the + * BPF_RB_FORCE_WAKEUP flag is passed, a wakeup notification will + * be sent even if no sample was drained. + * + * On failure, the returned value is one of the following: + * + * **-EBUSY** if the ring buffer is contended, and another calling + * context was concurrently draining the ring buffer. + * + * **-EINVAL** if user-space is not properly tracking the ring + * buffer due to the producer position not being aligned to 8 + * bytes, a sample not being aligned to 8 bytes, or the producer + * position not matching the advertised length of a sample. + * + * **-E2BIG** if user-space has tried to publish a sample which is + * larger than the size of the ring buffer, or which cannot fit + * within a struct bpf_dynptr. + * + * void *bpf_cgrp_storage_get(struct bpf_map *map, struct cgroup *cgroup, void *value, u64 flags) + * Description + * Get a bpf_local_storage from the *cgroup*. + * + * Logically, it could be thought of as getting the value from + * a *map* with *cgroup* as the **key**. From this + * perspective, the usage is not much different from + * **bpf_map_lookup_elem**\ (*map*, **&**\ *cgroup*) except this + * helper enforces the key must be a cgroup struct and the map must also + * be a **BPF_MAP_TYPE_CGRP_STORAGE**. + * + * In reality, the local-storage value is embedded directly inside of the + * *cgroup* object itself, rather than being located in the + * **BPF_MAP_TYPE_CGRP_STORAGE** map. When the local-storage value is + * queried for some *map* on a *cgroup* object, the kernel will perform an + * O(n) iteration over all of the live local-storage values for that + * *cgroup* object until the local-storage value for the *map* is found. + * + * An optional *flags* (**BPF_LOCAL_STORAGE_GET_F_CREATE**) can be + * used such that a new bpf_local_storage will be + * created if one does not exist. *value* can be used + * together with **BPF_LOCAL_STORAGE_GET_F_CREATE** to specify + * the initial value of a bpf_local_storage. If *value* is + * **NULL**, the new bpf_local_storage will be zero initialized. + * Return + * A bpf_local_storage pointer is returned on success. + * + * **NULL** if not found or there was an error in adding + * a new bpf_local_storage. + * + * long bpf_cgrp_storage_delete(struct bpf_map *map, struct cgroup *cgroup) + * Description + * Delete a bpf_local_storage from a *cgroup*. + * Return + * 0 on success. + * + * **-ENOENT** if the bpf_local_storage cannot be found. */ -#define __BPF_FUNC_MAPPER(FN) \ - FN(unspec), \ - FN(map_lookup_elem), \ - FN(map_update_elem), \ - FN(map_delete_elem), \ - FN(probe_read), \ - FN(ktime_get_ns), \ - FN(trace_printk), \ - FN(get_prandom_u32), \ - FN(get_smp_processor_id), \ - FN(skb_store_bytes), \ - FN(l3_csum_replace), \ - FN(l4_csum_replace), \ - FN(tail_call), \ - FN(clone_redirect), \ - FN(get_current_pid_tgid), \ - FN(get_current_uid_gid), \ - FN(get_current_comm), \ - FN(get_cgroup_classid), \ - FN(skb_vlan_push), \ - FN(skb_vlan_pop), \ - FN(skb_get_tunnel_key), \ - FN(skb_set_tunnel_key), \ - FN(perf_event_read), \ - FN(redirect), \ - FN(get_route_realm), \ - FN(perf_event_output), \ - FN(skb_load_bytes), \ - FN(get_stackid), \ - FN(csum_diff), \ - FN(skb_get_tunnel_opt), \ - FN(skb_set_tunnel_opt), \ - FN(skb_change_proto), \ - FN(skb_change_type), \ - FN(skb_under_cgroup), \ - FN(get_hash_recalc), \ - FN(get_current_task), \ - FN(probe_write_user), \ - FN(current_task_under_cgroup), \ - FN(skb_change_tail), \ - FN(skb_pull_data), \ - FN(csum_update), \ - FN(set_hash_invalid), \ - FN(get_numa_node_id), \ - FN(skb_change_head), \ - FN(xdp_adjust_head), \ - FN(probe_read_str), \ - FN(get_socket_cookie), \ - FN(get_socket_uid), \ - FN(set_hash), \ - FN(setsockopt), \ - FN(skb_adjust_room), \ - FN(redirect_map), \ - FN(sk_redirect_map), \ - FN(sock_map_update), \ - FN(xdp_adjust_meta), \ - FN(perf_event_read_value), \ - FN(perf_prog_read_value), \ - FN(getsockopt), \ - FN(override_return), \ - FN(sock_ops_cb_flags_set), \ - FN(msg_redirect_map), \ - FN(msg_apply_bytes), \ - FN(msg_cork_bytes), \ - FN(msg_pull_data), \ - FN(bind), \ - FN(xdp_adjust_tail), \ - FN(skb_get_xfrm_state), \ - FN(get_stack), \ - FN(skb_load_bytes_relative), \ - FN(fib_lookup), \ - FN(sock_hash_update), \ - FN(msg_redirect_hash), \ - FN(sk_redirect_hash), \ - FN(lwt_push_encap), \ - FN(lwt_seg6_store_bytes), \ - FN(lwt_seg6_adjust_srh), \ - FN(lwt_seg6_action), \ - FN(rc_repeat), \ - FN(rc_keydown), \ - FN(skb_cgroup_id), \ - FN(get_current_cgroup_id), \ - FN(get_local_storage), \ - FN(sk_select_reuseport), \ - FN(skb_ancestor_cgroup_id), \ - FN(sk_lookup_tcp), \ - FN(sk_lookup_udp), \ - FN(sk_release), \ - FN(map_push_elem), \ - FN(map_pop_elem), \ - FN(map_peek_elem), \ - FN(msg_push_data), \ - FN(msg_pop_data), \ - FN(rc_pointer_rel), \ - FN(spin_lock), \ - FN(spin_unlock), \ - FN(sk_fullsock), \ - FN(tcp_sock), \ - FN(skb_ecn_set_ce), \ - FN(get_listener_sock), \ - FN(skc_lookup_tcp), \ - FN(tcp_check_syncookie), \ - FN(sysctl_get_name), \ - FN(sysctl_get_current_value), \ - FN(sysctl_get_new_value), \ - FN(sysctl_set_new_value), \ - FN(strtol), \ - FN(strtoul), \ - FN(sk_storage_get), \ - FN(sk_storage_delete), \ - FN(send_signal), \ - FN(tcp_gen_syncookie), \ - FN(skb_output), \ - FN(probe_read_user), \ - FN(probe_read_kernel), \ - FN(probe_read_user_str), \ - FN(probe_read_kernel_str), \ - FN(tcp_send_ack), \ - FN(send_signal_thread), \ - FN(jiffies64), \ - FN(read_branch_records), \ - FN(get_ns_current_pid_tgid), \ - FN(xdp_output), \ - FN(get_netns_cookie), \ - FN(get_current_ancestor_cgroup_id), \ - FN(sk_assign), \ - FN(ktime_get_boot_ns), \ - FN(seq_printf), \ - FN(seq_write), \ - FN(sk_cgroup_id), \ - FN(sk_ancestor_cgroup_id), \ - FN(ringbuf_output), \ - FN(ringbuf_reserve), \ - FN(ringbuf_submit), \ - FN(ringbuf_discard), \ - FN(ringbuf_query), \ - FN(csum_level), \ - FN(skc_to_tcp6_sock), \ - FN(skc_to_tcp_sock), \ - FN(skc_to_tcp_timewait_sock), \ - FN(skc_to_tcp_request_sock), \ - FN(skc_to_udp6_sock), \ - FN(get_task_stack), \ - FN(load_hdr_opt), \ - FN(store_hdr_opt), \ - FN(reserve_hdr_opt), \ - FN(inode_storage_get), \ - FN(inode_storage_delete), \ - FN(d_path), \ - FN(copy_from_user), \ - FN(snprintf_btf), \ - FN(seq_printf_btf), \ - FN(skb_cgroup_classid), \ - FN(redirect_neigh), \ - FN(per_cpu_ptr), \ - FN(this_cpu_ptr), \ - FN(redirect_peer), \ - FN(task_storage_get), \ - FN(task_storage_delete), \ - FN(get_current_task_btf), \ - FN(bprm_opts_set), \ - FN(ktime_get_coarse_ns), \ - FN(ima_inode_hash), \ - FN(sock_from_file), \ - FN(check_mtu), \ - FN(for_each_map_elem), \ - FN(snprintf), \ - FN(sys_bpf), \ - FN(btf_find_by_name_kind), \ - FN(sys_close), \ - FN(timer_init), \ - FN(timer_set_callback), \ - FN(timer_start), \ - FN(timer_cancel), \ - FN(get_func_ip), \ - FN(get_attach_cookie), \ - FN(task_pt_regs), \ - FN(get_branch_snapshot), \ - FN(trace_vprintk), \ - FN(skc_to_unix_sock), \ - FN(kallsyms_lookup_name), \ - FN(find_vma), \ - FN(loop), \ - FN(strncmp), \ - FN(get_func_arg), \ - FN(get_func_ret), \ - FN(get_func_arg_cnt), \ - FN(get_retval), \ - FN(set_retval), \ - FN(xdp_get_buff_len), \ - FN(xdp_load_bytes), \ - FN(xdp_store_bytes), \ - FN(copy_from_user_task), \ - FN(skb_set_tstamp), \ - FN(ima_file_hash), \ - FN(kptr_xchg), \ - FN(map_lookup_percpu_elem), \ - FN(skc_to_mptcp_sock), \ - FN(dynptr_from_mem), \ - FN(ringbuf_reserve_dynptr), \ - FN(ringbuf_submit_dynptr), \ - FN(ringbuf_discard_dynptr), \ - FN(dynptr_read), \ - FN(dynptr_write), \ - FN(dynptr_data), \ +#define ___BPF_FUNC_MAPPER(FN, ctx...) \ + FN(unspec, 0, ##ctx) \ + FN(map_lookup_elem, 1, ##ctx) \ + FN(map_update_elem, 2, ##ctx) \ + FN(map_delete_elem, 3, ##ctx) \ + FN(probe_read, 4, ##ctx) \ + FN(ktime_get_ns, 5, ##ctx) \ + FN(trace_printk, 6, ##ctx) \ + FN(get_prandom_u32, 7, ##ctx) \ + FN(get_smp_processor_id, 8, ##ctx) \ + FN(skb_store_bytes, 9, ##ctx) \ + FN(l3_csum_replace, 10, ##ctx) \ + FN(l4_csum_replace, 11, ##ctx) \ + FN(tail_call, 12, ##ctx) \ + FN(clone_redirect, 13, ##ctx) \ + FN(get_current_pid_tgid, 14, ##ctx) \ + FN(get_current_uid_gid, 15, ##ctx) \ + FN(get_current_comm, 16, ##ctx) \ + FN(get_cgroup_classid, 17, ##ctx) \ + FN(skb_vlan_push, 18, ##ctx) \ + FN(skb_vlan_pop, 19, ##ctx) \ + FN(skb_get_tunnel_key, 20, ##ctx) \ + FN(skb_set_tunnel_key, 21, ##ctx) \ + FN(perf_event_read, 22, ##ctx) \ + FN(redirect, 23, ##ctx) \ + FN(get_route_realm, 24, ##ctx) \ + FN(perf_event_output, 25, ##ctx) \ + FN(skb_load_bytes, 26, ##ctx) \ + FN(get_stackid, 27, ##ctx) \ + FN(csum_diff, 28, ##ctx) \ + FN(skb_get_tunnel_opt, 29, ##ctx) \ + FN(skb_set_tunnel_opt, 30, ##ctx) \ + FN(skb_change_proto, 31, ##ctx) \ + FN(skb_change_type, 32, ##ctx) \ + FN(skb_under_cgroup, 33, ##ctx) \ + FN(get_hash_recalc, 34, ##ctx) \ + FN(get_current_task, 35, ##ctx) \ + FN(probe_write_user, 36, ##ctx) \ + FN(current_task_under_cgroup, 37, ##ctx) \ + FN(skb_change_tail, 38, ##ctx) \ + FN(skb_pull_data, 39, ##ctx) \ + FN(csum_update, 40, ##ctx) \ + FN(set_hash_invalid, 41, ##ctx) \ + FN(get_numa_node_id, 42, ##ctx) \ + FN(skb_change_head, 43, ##ctx) \ + FN(xdp_adjust_head, 44, ##ctx) \ + FN(probe_read_str, 45, ##ctx) \ + FN(get_socket_cookie, 46, ##ctx) \ + FN(get_socket_uid, 47, ##ctx) \ + FN(set_hash, 48, ##ctx) \ + FN(setsockopt, 49, ##ctx) \ + FN(skb_adjust_room, 50, ##ctx) \ + FN(redirect_map, 51, ##ctx) \ + FN(sk_redirect_map, 52, ##ctx) \ + FN(sock_map_update, 53, ##ctx) \ + FN(xdp_adjust_meta, 54, ##ctx) \ + FN(perf_event_read_value, 55, ##ctx) \ + FN(perf_prog_read_value, 56, ##ctx) \ + FN(getsockopt, 57, ##ctx) \ + FN(override_return, 58, ##ctx) \ + FN(sock_ops_cb_flags_set, 59, ##ctx) \ + FN(msg_redirect_map, 60, ##ctx) \ + FN(msg_apply_bytes, 61, ##ctx) \ + FN(msg_cork_bytes, 62, ##ctx) \ + FN(msg_pull_data, 63, ##ctx) \ + FN(bind, 64, ##ctx) \ + FN(xdp_adjust_tail, 65, ##ctx) \ + FN(skb_get_xfrm_state, 66, ##ctx) \ + FN(get_stack, 67, ##ctx) \ + FN(skb_load_bytes_relative, 68, ##ctx) \ + FN(fib_lookup, 69, ##ctx) \ + FN(sock_hash_update, 70, ##ctx) \ + FN(msg_redirect_hash, 71, ##ctx) \ + FN(sk_redirect_hash, 72, ##ctx) \ + FN(lwt_push_encap, 73, ##ctx) \ + FN(lwt_seg6_store_bytes, 74, ##ctx) \ + FN(lwt_seg6_adjust_srh, 75, ##ctx) \ + FN(lwt_seg6_action, 76, ##ctx) \ + FN(rc_repeat, 77, ##ctx) \ + FN(rc_keydown, 78, ##ctx) \ + FN(skb_cgroup_id, 79, ##ctx) \ + FN(get_current_cgroup_id, 80, ##ctx) \ + FN(get_local_storage, 81, ##ctx) \ + FN(sk_select_reuseport, 82, ##ctx) \ + FN(skb_ancestor_cgroup_id, 83, ##ctx) \ + FN(sk_lookup_tcp, 84, ##ctx) \ + FN(sk_lookup_udp, 85, ##ctx) \ + FN(sk_release, 86, ##ctx) \ + FN(map_push_elem, 87, ##ctx) \ + FN(map_pop_elem, 88, ##ctx) \ + FN(map_peek_elem, 89, ##ctx) \ + FN(msg_push_data, 90, ##ctx) \ + FN(msg_pop_data, 91, ##ctx) \ + FN(rc_pointer_rel, 92, ##ctx) \ + FN(spin_lock, 93, ##ctx) \ + FN(spin_unlock, 94, ##ctx) \ + FN(sk_fullsock, 95, ##ctx) \ + FN(tcp_sock, 96, ##ctx) \ + FN(skb_ecn_set_ce, 97, ##ctx) \ + FN(get_listener_sock, 98, ##ctx) \ + FN(skc_lookup_tcp, 99, ##ctx) \ + FN(tcp_check_syncookie, 100, ##ctx) \ + FN(sysctl_get_name, 101, ##ctx) \ + FN(sysctl_get_current_value, 102, ##ctx) \ + FN(sysctl_get_new_value, 103, ##ctx) \ + FN(sysctl_set_new_value, 104, ##ctx) \ + FN(strtol, 105, ##ctx) \ + FN(strtoul, 106, ##ctx) \ + FN(sk_storage_get, 107, ##ctx) \ + FN(sk_storage_delete, 108, ##ctx) \ + FN(send_signal, 109, ##ctx) \ + FN(tcp_gen_syncookie, 110, ##ctx) \ + FN(skb_output, 111, ##ctx) \ + FN(probe_read_user, 112, ##ctx) \ + FN(probe_read_kernel, 113, ##ctx) \ + FN(probe_read_user_str, 114, ##ctx) \ + FN(probe_read_kernel_str, 115, ##ctx) \ + FN(tcp_send_ack, 116, ##ctx) \ + FN(send_signal_thread, 117, ##ctx) \ + FN(jiffies64, 118, ##ctx) \ + FN(read_branch_records, 119, ##ctx) \ + FN(get_ns_current_pid_tgid, 120, ##ctx) \ + FN(xdp_output, 121, ##ctx) \ + FN(get_netns_cookie, 122, ##ctx) \ + FN(get_current_ancestor_cgroup_id, 123, ##ctx) \ + FN(sk_assign, 124, ##ctx) \ + FN(ktime_get_boot_ns, 125, ##ctx) \ + FN(seq_printf, 126, ##ctx) \ + FN(seq_write, 127, ##ctx) \ + FN(sk_cgroup_id, 128, ##ctx) \ + FN(sk_ancestor_cgroup_id, 129, ##ctx) \ + FN(ringbuf_output, 130, ##ctx) \ + FN(ringbuf_reserve, 131, ##ctx) \ + FN(ringbuf_submit, 132, ##ctx) \ + FN(ringbuf_discard, 133, ##ctx) \ + FN(ringbuf_query, 134, ##ctx) \ + FN(csum_level, 135, ##ctx) \ + FN(skc_to_tcp6_sock, 136, ##ctx) \ + FN(skc_to_tcp_sock, 137, ##ctx) \ + FN(skc_to_tcp_timewait_sock, 138, ##ctx) \ + FN(skc_to_tcp_request_sock, 139, ##ctx) \ + FN(skc_to_udp6_sock, 140, ##ctx) \ + FN(get_task_stack, 141, ##ctx) \ + FN(load_hdr_opt, 142, ##ctx) \ + FN(store_hdr_opt, 143, ##ctx) \ + FN(reserve_hdr_opt, 144, ##ctx) \ + FN(inode_storage_get, 145, ##ctx) \ + FN(inode_storage_delete, 146, ##ctx) \ + FN(d_path, 147, ##ctx) \ + FN(copy_from_user, 148, ##ctx) \ + FN(snprintf_btf, 149, ##ctx) \ + FN(seq_printf_btf, 150, ##ctx) \ + FN(skb_cgroup_classid, 151, ##ctx) \ + FN(redirect_neigh, 152, ##ctx) \ + FN(per_cpu_ptr, 153, ##ctx) \ + FN(this_cpu_ptr, 154, ##ctx) \ + FN(redirect_peer, 155, ##ctx) \ + FN(task_storage_get, 156, ##ctx) \ + FN(task_storage_delete, 157, ##ctx) \ + FN(get_current_task_btf, 158, ##ctx) \ + FN(bprm_opts_set, 159, ##ctx) \ + FN(ktime_get_coarse_ns, 160, ##ctx) \ + FN(ima_inode_hash, 161, ##ctx) \ + FN(sock_from_file, 162, ##ctx) \ + FN(check_mtu, 163, ##ctx) \ + FN(for_each_map_elem, 164, ##ctx) \ + FN(snprintf, 165, ##ctx) \ + FN(sys_bpf, 166, ##ctx) \ + FN(btf_find_by_name_kind, 167, ##ctx) \ + FN(sys_close, 168, ##ctx) \ + FN(timer_init, 169, ##ctx) \ + FN(timer_set_callback, 170, ##ctx) \ + FN(timer_start, 171, ##ctx) \ + FN(timer_cancel, 172, ##ctx) \ + FN(get_func_ip, 173, ##ctx) \ + FN(get_attach_cookie, 174, ##ctx) \ + FN(task_pt_regs, 175, ##ctx) \ + FN(get_branch_snapshot, 176, ##ctx) \ + FN(trace_vprintk, 177, ##ctx) \ + FN(skc_to_unix_sock, 178, ##ctx) \ + FN(kallsyms_lookup_name, 179, ##ctx) \ + FN(find_vma, 180, ##ctx) \ + FN(loop, 181, ##ctx) \ + FN(strncmp, 182, ##ctx) \ + FN(get_func_arg, 183, ##ctx) \ + FN(get_func_ret, 184, ##ctx) \ + FN(get_func_arg_cnt, 185, ##ctx) \ + FN(get_retval, 186, ##ctx) \ + FN(set_retval, 187, ##ctx) \ + FN(xdp_get_buff_len, 188, ##ctx) \ + FN(xdp_load_bytes, 189, ##ctx) \ + FN(xdp_store_bytes, 190, ##ctx) \ + FN(copy_from_user_task, 191, ##ctx) \ + FN(skb_set_tstamp, 192, ##ctx) \ + FN(ima_file_hash, 193, ##ctx) \ + FN(kptr_xchg, 194, ##ctx) \ + FN(map_lookup_percpu_elem, 195, ##ctx) \ + FN(skc_to_mptcp_sock, 196, ##ctx) \ + FN(dynptr_from_mem, 197, ##ctx) \ + FN(ringbuf_reserve_dynptr, 198, ##ctx) \ + FN(ringbuf_submit_dynptr, 199, ##ctx) \ + FN(ringbuf_discard_dynptr, 200, ##ctx) \ + FN(dynptr_read, 201, ##ctx) \ + FN(dynptr_write, 202, ##ctx) \ + FN(dynptr_data, 203, ##ctx) \ + FN(tcp_raw_gen_syncookie_ipv4, 204, ##ctx) \ + FN(tcp_raw_gen_syncookie_ipv6, 205, ##ctx) \ + FN(tcp_raw_check_syncookie_ipv4, 206, ##ctx) \ + FN(tcp_raw_check_syncookie_ipv6, 207, ##ctx) \ + FN(ktime_get_tai_ns, 208, ##ctx) \ + FN(user_ringbuf_drain, 209, ##ctx) \ + FN(cgrp_storage_get, 210, ##ctx) \ + FN(cgrp_storage_delete, 211, ##ctx) \ /* */ +/* backwards-compatibility macros for users of __BPF_FUNC_MAPPER that don't + * know or care about integer value that is now passed as second argument + */ +#define __BPF_FUNC_MAPPER_APPLY(name, value, FN) FN(name), +#define __BPF_FUNC_MAPPER(FN) ___BPF_FUNC_MAPPER(__BPF_FUNC_MAPPER_APPLY, FN) + /* integer value in 'imm' field of BPF_CALL instruction selects which helper * function eBPF program intends to call */ -#define __BPF_ENUM_FN(x) BPF_FUNC_ ## x +#define __BPF_ENUM_FN(x, y) BPF_FUNC_ ## x = y, enum bpf_func_id { - __BPF_FUNC_MAPPER(__BPF_ENUM_FN) + ___BPF_FUNC_MAPPER(__BPF_ENUM_FN) __BPF_FUNC_MAX_ID, }; #undef __BPF_ENUM_FN @@ -5515,6 +5838,12 @@ enum { BPF_F_ZERO_CSUM_TX = (1ULL << 1), BPF_F_DONT_FRAGMENT = (1ULL << 2), BPF_F_SEQ_NUMBER = (1ULL << 3), + BPF_F_NO_TUNNEL_KEY = (1ULL << 4), +}; + +/* BPF_FUNC_skb_get_tunnel_key flags. */ +enum { + BPF_F_TUNINFO_FLAGS = (1ULL << 4), }; /* BPF_FUNC_perf_event_output, BPF_FUNC_perf_event_read and @@ -5549,6 +5878,8 @@ enum { BPF_F_ADJ_ROOM_ENCAP_L4_UDP = (1ULL << 4), BPF_F_ADJ_ROOM_NO_CSUM_RESET = (1ULL << 5), BPF_F_ADJ_ROOM_ENCAP_L2_ETH = (1ULL << 6), + BPF_F_ADJ_ROOM_DECAP_L3_IPV4 = (1ULL << 7), + BPF_F_ADJ_ROOM_DECAP_L3_IPV6 = (1ULL << 8), }; enum { @@ -5706,7 +6037,10 @@ struct bpf_tunnel_key { }; __u8 tunnel_tos; __u8 tunnel_ttl; - __u16 tunnel_ext; /* Padding, future use. */ + union { + __u16 tunnel_ext; /* compat */ + __be16 tunnel_flags; + }; __u32 tunnel_label; union { __u32 local_ipv4; @@ -5750,6 +6084,11 @@ enum bpf_ret_code { * represented by BPF_REDIRECT above). */ BPF_LWT_REROUTE = 128, + /* BPF_FLOW_DISSECTOR_CONTINUE: used by BPF_PROG_TYPE_FLOW_DISSECTOR + * to indicate that no custom dissection was performed, and + * fallback to standard dissector is requested. + */ + BPF_FLOW_DISSECTOR_CONTINUE = 129, }; struct bpf_sock { @@ -5995,6 +6334,8 @@ struct bpf_prog_info { __u64 run_cnt; __u64 recursion_misses; __u32 verified_insns; + __u32 attach_btf_obj_id; + __u32 attach_btf_id; } __attribute__((aligned(8))); struct bpf_map_info { @@ -6046,11 +6387,26 @@ struct bpf_link_info { struct { __aligned_u64 target_name; /* in/out: target_name buffer ptr */ __u32 target_name_len; /* in/out: target_name buffer len */ + + /* If the iter specific field is 32 bits, it can be put + * in the first or second union. Otherwise it should be + * put in the second union. + */ union { struct { __u32 map_id; } map; }; + union { + struct { + __u64 cgroup_id; + __u32 order; + } cgroup; + struct { + __u32 tid; + __u32 pid; + } task; + }; } iter; struct { __u32 netns_ino; @@ -6059,6 +6415,15 @@ struct bpf_link_info { struct { __u32 ifindex; } xdp; + struct { + __u32 map_id; + } struct_ops; + struct { + __u32 pf; + __u32 hooknum; + __s32 priority; + __u32 flags; + } netfilter; }; } __attribute__((aligned(8))); @@ -6169,6 +6534,7 @@ struct bpf_sock_ops { * the outgoing header has not * been written yet. */ + __u64 skb_hwtstamp; }; /* Definitions for bpf_sock_ops_cb_flags */ @@ -6454,6 +6820,7 @@ struct bpf_raw_tracepoint_args { enum { BPF_FIB_LOOKUP_DIRECT = (1U << 0), BPF_FIB_LOOKUP_OUTPUT = (1U << 1), + BPF_FIB_LOOKUP_SKIP_NEIGH = (1U << 2), }; enum { @@ -6611,6 +6978,31 @@ struct bpf_dynptr { __u64 :64; } __attribute__((aligned(8))); +struct bpf_list_head { + __u64 :64; + __u64 :64; +} __attribute__((aligned(8))); + +struct bpf_list_node { + __u64 :64; + __u64 :64; +} __attribute__((aligned(8))); + +struct bpf_rb_root { + __u64 :64; + __u64 :64; +} __attribute__((aligned(8))); + +struct bpf_rb_node { + __u64 :64; + __u64 :64; + __u64 :64; +} __attribute__((aligned(8))); + +struct bpf_refcount { + __u32 :32; +} __attribute__((aligned(4))); + struct bpf_sysctl { __u32 write; /* Sysctl is being read (= 0) or written (= 1). * Allows 1,2,4-byte read, but no write. @@ -6702,6 +7094,7 @@ enum bpf_core_relo_kind { BPF_CORE_TYPE_SIZE = 9, /* type size in bytes */ BPF_CORE_ENUMVAL_EXISTS = 10, /* enum value existence in target kernel */ BPF_CORE_ENUMVAL_VALUE = 11, /* enum value integer value */ + BPF_CORE_TYPE_MATCHES = 12, /* type match in target kernel */ }; /* @@ -6759,4 +7152,21 @@ struct bpf_core_relo { enum bpf_core_relo_kind kind; }; +/* + * Flags to control bpf_timer_start() behaviour. + * - BPF_F_TIMER_ABS: Timeout passed is absolute time, by default it is + * relative to current time. + */ +enum { + BPF_F_TIMER_ABS = (1ULL << 0), +}; + +/* BPF numbers iterator state */ +struct bpf_iter_num { + /* opaque iterator state; having __u64 here allows to preserve correct + * alignment requirements in vmlinux.h, generated from BTF + */ + __u64 __opaque[1]; +} __attribute__((aligned(8))); + #endif /* __LINUX_BPF_H__ */ diff --git a/include/linux/cec-funcs.h b/include/linux/cec-funcs.h index 0385d0e7..b0fe9b2e 100644 --- a/include/linux/cec-funcs.h +++ b/include/linux/cec-funcs.h @@ -1568,6 +1568,20 @@ static __inline__ void cec_ops_request_short_audio_descriptor(const struct cec_m } } +static __inline__ void cec_msg_set_audio_volume_level(struct cec_msg *msg, + __u8 audio_volume_level) +{ + msg->len = 3; + msg->msg[1] = CEC_MSG_SET_AUDIO_VOLUME_LEVEL; + msg->msg[2] = audio_volume_level; +} + +static __inline__ void cec_ops_set_audio_volume_level(const struct cec_msg *msg, + __u8 *audio_volume_level) +{ + *audio_volume_level = msg->msg[2]; +} + /* Audio Rate Control Feature */ static __inline__ void cec_msg_set_audio_rate(struct cec_msg *msg, diff --git a/include/linux/cec.h b/include/linux/cec.h index 971a2ec5..9ebbec29 100644 --- a/include/linux/cec.h +++ b/include/linux/cec.h @@ -768,6 +768,7 @@ struct cec_event { #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE 0x08 #define CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX 0x04 #define CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX 0x02 +#define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_VOLUME_LEVEL 0x01 #define CEC_MSG_GIVE_FEATURES 0xa5 /* HDMI 2.0 */ @@ -1059,6 +1060,7 @@ struct cec_event { #define CEC_OP_AUD_FMT_ID_CEA861 0 #define CEC_OP_AUD_FMT_ID_CEA861_CXT 1 +#define CEC_MSG_SET_AUDIO_VOLUME_LEVEL 0x73 /* Audio Rate Control Feature */ #define CEC_MSG_SET_AUDIO_RATE 0x9a diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h index f8a0aeae..4606b335 100644 --- a/include/linux/dvb/dmx.h +++ b/include/linux/dvb/dmx.h @@ -5,21 +5,6 @@ * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> * & Ralph Metzler <ralph@convergence.de> * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * */ #ifndef _DVBDMX_H_ diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index 5f00fc1f..392171a7 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h @@ -7,21 +7,6 @@ * Holger Waechtler <holger@convergence.de> * Andre Draszik <ad@convergence.de> * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * */ #ifndef _DVBFRONTEND_H_ @@ -282,7 +267,6 @@ enum fe_spectral_inversion { /** * enum fe_code_rate - Type of Forward Error Correction (FEC) * - * * @FEC_NONE: No Forward Error Correction Code * @FEC_1_2: Forward Error Correction Code 1/2 * @FEC_2_3: Forward Error Correction Code 2/3 @@ -296,6 +280,26 @@ enum fe_spectral_inversion { * @FEC_3_5: Forward Error Correction Code 3/5 * @FEC_9_10: Forward Error Correction Code 9/10 * @FEC_2_5: Forward Error Correction Code 2/5 + * @FEC_1_3: Forward Error Correction Code 1/3 + * @FEC_1_4: Forward Error Correction Code 1/4 + * @FEC_5_9: Forward Error Correction Code 5/9 + * @FEC_7_9: Forward Error Correction Code 7/9 + * @FEC_8_15: Forward Error Correction Code 8/15 + * @FEC_11_15: Forward Error Correction Code 11/15 + * @FEC_13_18: Forward Error Correction Code 13/18 + * @FEC_9_20: Forward Error Correction Code 9/20 + * @FEC_11_20: Forward Error Correction Code 11/20 + * @FEC_23_36: Forward Error Correction Code 23/36 + * @FEC_25_36: Forward Error Correction Code 25/36 + * @FEC_13_45: Forward Error Correction Code 13/45 + * @FEC_26_45: Forward Error Correction Code 26/45 + * @FEC_28_45: Forward Error Correction Code 28/45 + * @FEC_32_45: Forward Error Correction Code 32/45 + * @FEC_77_90: Forward Error Correction Code 77/90 + * @FEC_11_45: Forward Error Correction Code 11/45 + * @FEC_4_15: Forward Error Correction Code 4/15 + * @FEC_14_45: Forward Error Correction Code 14/45 + * @FEC_7_15: Forward Error Correction Code 7/15 * * Please note that not all FEC types are supported by a given standard. */ @@ -313,6 +317,26 @@ enum fe_code_rate { FEC_3_5, FEC_9_10, FEC_2_5, + FEC_1_3, + FEC_1_4, + FEC_5_9, + FEC_7_9, + FEC_8_15, + FEC_11_15, + FEC_13_18, + FEC_9_20, + FEC_11_20, + FEC_23_36, + FEC_25_36, + FEC_13_45, + FEC_26_45, + FEC_28_45, + FEC_32_45, + FEC_77_90, + FEC_11_45, + FEC_4_15, + FEC_14_45, + FEC_7_15, }; /** @@ -331,6 +355,13 @@ enum fe_code_rate { * @APSK_32: 32-APSK modulation * @DQPSK: DQPSK modulation * @QAM_4_NR: 4-QAM-NR modulation + * @QAM_1024: 1024-QAM modulation + * @QAM_4096: 4096-QAM modulation + * @APSK_8_L: 8APSK-L modulation + * @APSK_16_L: 16APSK-L modulation + * @APSK_32_L: 32APSK-L modulation + * @APSK_64: 64APSK modulation + * @APSK_64_L: 64APSK-L modulation * * Please note that not all modulations are supported by a given standard. * @@ -350,6 +381,13 @@ enum fe_modulation { APSK_32, DQPSK, QAM_4_NR, + QAM_1024, + QAM_4096, + APSK_8_L, + APSK_16_L, + APSK_32_L, + APSK_64, + APSK_64_L, }; /** @@ -404,6 +442,7 @@ enum fe_transmit_mode { * @GUARD_INTERVAL_PN420: PN length 420 (1/4) * @GUARD_INTERVAL_PN595: PN length 595 (1/6) * @GUARD_INTERVAL_PN945: PN length 945 (1/9) + * @GUARD_INTERVAL_1_64: Guard interval 1/64 * * Please note that not all guard intervals are supported by a given standard. */ @@ -419,6 +458,7 @@ enum fe_guard_interval { GUARD_INTERVAL_PN420, GUARD_INTERVAL_PN595, GUARD_INTERVAL_PN945, + GUARD_INTERVAL_1_64, }; /** @@ -571,6 +611,9 @@ enum fe_pilot { * @ROLLOFF_20: Roloff factor: α=20% * @ROLLOFF_25: Roloff factor: α=25% * @ROLLOFF_AUTO: Auto-detect the roloff factor. + * @ROLLOFF_15: Rolloff factor: α=15% + * @ROLLOFF_10: Rolloff factor: α=10% + * @ROLLOFF_5: Rolloff factor: α=5% * * .. note: * @@ -581,6 +624,9 @@ enum fe_rolloff { ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, + ROLLOFF_15, + ROLLOFF_10, + ROLLOFF_5, }; /** @@ -594,6 +640,8 @@ enum fe_rolloff { * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) * @SYS_DVBC_ANNEX_C: * Cable TV: DVB-C following ITU-T J.83 Annex C spec + * @SYS_DVBC2: + * Cable TV: DVB-C2 * @SYS_ISDBC: * Cable TV: ISDB-C (no drivers yet) * @SYS_DVBT: @@ -611,7 +659,7 @@ enum fe_rolloff { * @SYS_DVBS: * Satellite TV: DVB-S * @SYS_DVBS2: - * Satellite TV: DVB-S2 + * Satellite TV: DVB-S2 and DVB-S2X * @SYS_TURBO: * Satellite TV: DVB-S Turbo * @SYS_ISDBS: @@ -645,6 +693,7 @@ enum fe_delivery_system { SYS_DVBT2, SYS_TURBO, SYS_DVBC_ANNEX_C, + SYS_DVBC2, }; /* backward compatibility definitions for delivery systems */ @@ -720,7 +769,7 @@ enum atscmh_rs_frame_mode { }; /** - * enum atscmh_rs_code_mode + * enum atscmh_rs_code_mode - ATSC-M/H Reed Solomon modes * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). diff --git a/include/linux/media-bus-format.h b/include/linux/media-bus-format.h index 0dfc11ee..a03c543c 100644 --- a/include/linux/media-bus-format.h +++ b/include/linux/media-bus-format.h @@ -34,7 +34,7 @@ #define MEDIA_BUS_FMT_FIXED 0x0001 -/* RGB - next is 0x101e */ +/* RGB - next is 0x1025 */ #define MEDIA_BUS_FMT_RGB444_1X12 0x1016 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002 @@ -46,8 +46,11 @@ #define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007 #define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008 #define MEDIA_BUS_FMT_RGB666_1X18 0x1009 +#define MEDIA_BUS_FMT_BGR666_1X18 0x1023 #define MEDIA_BUS_FMT_RBG888_1X24 0x100e #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015 +#define MEDIA_BUS_FMT_BGR666_1X24_CPADHI 0x1024 +#define MEDIA_BUS_FMT_RGB565_1X24_CPADHI 0x1022 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010 #define MEDIA_BUS_FMT_BGR888_1X24 0x1013 #define MEDIA_BUS_FMT_BGR888_3X8 0x101b @@ -59,13 +62,17 @@ #define MEDIA_BUS_FMT_RGB888_3X8_DELTA 0x101d #define MEDIA_BUS_FMT_RGB888_1X7X4_SPWG 0x1011 #define MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA 0x1012 +#define MEDIA_BUS_FMT_RGB666_1X30_CPADLO 0x101e +#define MEDIA_BUS_FMT_RGB888_1X30_CPADLO 0x101f #define MEDIA_BUS_FMT_ARGB8888_1X32 0x100d #define MEDIA_BUS_FMT_RGB888_1X32_PADHI 0x100f #define MEDIA_BUS_FMT_RGB101010_1X30 0x1018 +#define MEDIA_BUS_FMT_RGB666_1X36_CPADLO 0x1020 +#define MEDIA_BUS_FMT_RGB888_1X36_CPADLO 0x1021 #define MEDIA_BUS_FMT_RGB121212_1X36 0x1019 #define MEDIA_BUS_FMT_RGB161616_1X48 0x101a -/* YUV (including grey) - next is 0x202e */ +/* YUV (including grey) - next is 0x202f */ #define MEDIA_BUS_FMT_Y8_1X8 0x2001 #define MEDIA_BUS_FMT_UV8_1X8 0x2015 #define MEDIA_BUS_FMT_UYVY8_1_5X8 0x2002 @@ -88,6 +95,7 @@ #define MEDIA_BUS_FMT_YUYV12_2X12 0x201e #define MEDIA_BUS_FMT_YVYU12_2X12 0x201f #define MEDIA_BUS_FMT_Y14_1X14 0x202d +#define MEDIA_BUS_FMT_Y16_1X16 0x202e #define MEDIA_BUS_FMT_UYVY8_1X16 0x200f #define MEDIA_BUS_FMT_VYUY8_1X16 0x2010 #define MEDIA_BUS_FMT_YUYV8_1X16 0x2011 diff --git a/include/linux/media.h b/include/linux/media.h index e0da619e..b5a77bbf 100644 --- a/include/linux/media.h +++ b/include/linux/media.h @@ -140,8 +140,8 @@ struct media_device_info { #define MEDIA_ENT_F_DV_ENCODER (MEDIA_ENT_F_BASE + 0x6002) /* Entity flags */ -#define MEDIA_ENT_FL_DEFAULT (1 << 0) -#define MEDIA_ENT_FL_CONNECTOR (1 << 1) +#define MEDIA_ENT_FL_DEFAULT (1U << 0) +#define MEDIA_ENT_FL_CONNECTOR (1U << 1) /* OR with the entity id value to find the next entity */ #define MEDIA_ENT_ID_FLAG_NEXT (1U << 31) @@ -203,9 +203,9 @@ struct media_entity_desc { }; }; -#define MEDIA_PAD_FL_SINK (1 << 0) -#define MEDIA_PAD_FL_SOURCE (1 << 1) -#define MEDIA_PAD_FL_MUST_CONNECT (1 << 2) +#define MEDIA_PAD_FL_SINK (1U << 0) +#define MEDIA_PAD_FL_SOURCE (1U << 1) +#define MEDIA_PAD_FL_MUST_CONNECT (1U << 2) struct media_pad_desc { __u32 entity; /* entity ID */ @@ -214,14 +214,14 @@ struct media_pad_desc { __u32 reserved[2]; }; -#define MEDIA_LNK_FL_ENABLED (1 << 0) -#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) -#define MEDIA_LNK_FL_DYNAMIC (1 << 2) +#define MEDIA_LNK_FL_ENABLED (1U << 0) +#define MEDIA_LNK_FL_IMMUTABLE (1U << 1) +#define MEDIA_LNK_FL_DYNAMIC (1U << 2) #define MEDIA_LNK_FL_LINK_TYPE (0xf << 28) -# define MEDIA_LNK_FL_DATA_LINK (0 << 28) -# define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28) -# define MEDIA_LNK_FL_ANCILLARY_LINK (2 << 28) +# define MEDIA_LNK_FL_DATA_LINK (0U << 28) +# define MEDIA_LNK_FL_INTERFACE_LINK (1U << 28) +# define MEDIA_LNK_FL_ANCILLARY_LINK (2U << 28) struct media_link_desc { struct media_pad_desc source; @@ -276,7 +276,7 @@ struct media_links_enum { * struct media_device_info. */ #define MEDIA_V2_ENTITY_HAS_FLAGS(media_version) \ - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) + ((media_version) >= ((4U << 16) | (19U << 8) | 0U)) struct media_v2_entity { __u32 id; @@ -311,7 +311,7 @@ struct media_v2_interface { * struct media_device_info. */ #define MEDIA_V2_PAD_HAS_INDEX(media_version) \ - ((media_version) >= ((4 << 16) | (19 << 8) | 0)) + ((media_version) >= ((4U << 16) | (19U << 8) | 0U)) struct media_v2_pad { __u32 id; @@ -414,7 +414,7 @@ struct media_v2_topology { #define MEDIA_INTF_T_ALSA_TIMER (MEDIA_INTF_T_ALSA_BASE + 7) /* Obsolete symbol for media_version, no longer used in the kernel */ -#define MEDIA_API_VERSION ((0 << 16) | (1 << 8) | 0) +#define MEDIA_API_VERSION ((0U << 16) | (1U << 8) | 0U) #endif /* __LINUX_MEDIA_H */ diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h index 14de1731..c3ca11e3 100644 --- a/include/linux/v4l2-common.h +++ b/include/linux/v4l2-common.h @@ -10,45 +10,6 @@ * * Copyright (C) 2012 Nokia Corporation * Contact: Sakari Ailus <sakari.ailus@iki.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ #ifndef __V4L2_COMMON__ diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h index b70d3ea1..230475b7 100644 --- a/include/linux/v4l2-controls.h +++ b/include/linux/v4l2-controls.h @@ -4,44 +4,6 @@ * * Copyright (C) 1999-2012 the contributors * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * * The contents of this header was split off from videodev2.h. All control * definitions should be added to this header, which is included by * videodev2.h. @@ -157,8 +119,10 @@ enum v4l2_colorfx { /* USER-class private control IDs */ -/* The base for the meye driver controls. See linux/meye.h for the list - * of controls. We reserve 16 controls for this driver. */ +/* + * The base for the meye driver controls. This driver was removed, but + * we keep this define in case any software still uses it. + */ #define V4L2_CID_USER_MEYE_BASE (V4L2_CID_USER_BASE + 0x1000) /* The base for the bttv driver controls. @@ -229,6 +193,18 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_ISL7998X_BASE (V4L2_CID_USER_BASE + 0x1180) +/* + * The base for DW100 driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_DW100_BASE (V4L2_CID_USER_BASE + 0x1190) + +/* + * The base for Aspeed driver controls. + * We reserve 16 controls for this driver. + */ +#define V4L2_CID_USER_ASPEED_BASE (V4L2_CID_USER_BASE + 0x11a0) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ @@ -1015,6 +991,8 @@ enum v4l2_auto_focus_range { #define V4L2_CID_CAMERA_SENSOR_ROTATION (V4L2_CID_CAMERA_CLASS_BASE+35) +#define V4L2_CID_HDR_SENSOR_MODE (V4L2_CID_CAMERA_CLASS_BASE+36) + /* FM Modulator class control IDs */ #define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) @@ -1732,7 +1710,7 @@ struct v4l2_vp8_segment { * @sharpness_level: matches sharpness_level syntax element. * @level: matches loop_filter_level syntax element. * @padding: padding field. Should be zeroed by applications. - * @flags: see V4L2_VP8_LF_FLAG_{}. + * @flags: see V4L2_VP8_LF_{}. * * This structure contains loop filter related parameters. * See the 'mb_lf_adjustments()' part of the frame header syntax, @@ -2407,6 +2385,9 @@ struct v4l2_ctrl_hevc_slice_params { * @poc_st_curr_after: provides the index of the short term after references * in DPB array * @poc_lt_curr: provides the index of the long term references in DPB array + * @num_delta_pocs_of_ref_rps_idx: same as the derived value NumDeltaPocs[RefRpsIdx], + * can be used to parse the RPS data in slice headers + * instead of skipping it with @short_term_ref_pic_set_size. * @reserved: padding field. Should be zeroed by applications. * @dpb: the decoded picture buffer, for meta-data about reference frames * @flags: see V4L2_HEVC_DECODE_PARAM_FLAG_{} @@ -2422,7 +2403,8 @@ struct v4l2_ctrl_hevc_decode_params { __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; - __u8 reserved[4]; + __u8 num_delta_pocs_of_ref_rps_idx; + __u8 reserved[3]; struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]; __u64 flags; }; diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h index 846dadfb..2c318de1 100644 --- a/include/linux/v4l2-mediabus.h +++ b/include/linux/v4l2-mediabus.h @@ -3,10 +3,6 @@ * Media Bus API header * * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef __LINUX_V4L2_MEDIABUS_H diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h index 658106f5..4a195b68 100644 --- a/include/linux/v4l2-subdev.h +++ b/include/linux/v4l2-subdev.h @@ -6,24 +6,12 @@ * * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> * Sakari Ailus <sakari.ailus@iki.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef __LINUX_V4L2_SUBDEV_H #define __LINUX_V4L2_SUBDEV_H +#include <linux/const.h> #include <linux/ioctl.h> #include <linux/types.h> #include <linux/v4l2-common.h> @@ -44,13 +32,15 @@ enum v4l2_subdev_format_whence { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @format: media bus format (format code and frame size) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_format { __u32 which; __u32 pad; struct v4l2_mbus_framefmt format; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -58,13 +48,15 @@ struct v4l2_subdev_format { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @rect: pad crop rectangle boundaries + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_crop { __u32 which; __u32 pad; struct v4l2_rect rect; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; #define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001 @@ -80,6 +72,7 @@ struct v4l2_subdev_crop { * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_mbus_code_enum { @@ -88,7 +81,8 @@ struct v4l2_subdev_mbus_code_enum { __u32 code; __u32 which; __u32 flags; - __u32 reserved[7]; + __u32 stream; + __u32 reserved[6]; }; /** @@ -101,6 +95,7 @@ struct v4l2_subdev_mbus_code_enum { * @min_height: minimum frame height, in pixels * @max_height: maximum frame height, in pixels * @which: format type (from enum v4l2_subdev_format_whence) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_size_enum { @@ -112,19 +107,22 @@ struct v4l2_subdev_frame_size_enum { __u32 min_height; __u32 max_height; __u32 which; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** * struct v4l2_subdev_frame_interval - Pad-level frame rate * @pad: pad number, as reported by the media API * @interval: frame interval in seconds + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval { __u32 pad; struct v4l2_fract interval; - __u32 reserved[9]; + __u32 stream; + __u32 reserved[8]; }; /** @@ -136,6 +134,7 @@ struct v4l2_subdev_frame_interval { * @height: frame height in pixels * @interval: frame interval in seconds * @which: format type (from enum v4l2_subdev_format_whence) + * @stream: stream number, defined in subdev routing * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval_enum { @@ -146,7 +145,8 @@ struct v4l2_subdev_frame_interval_enum { __u32 height; struct v4l2_fract interval; __u32 which; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -158,6 +158,7 @@ struct v4l2_subdev_frame_interval_enum { * defined in v4l2-common.h; V4L2_SEL_TGT_* . * @flags: constraint flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*. * @r: coordinates of the selection window + * @stream: stream number, defined in subdev routing * @reserved: for future use, set to zero for now * * Hardware may use multiple helper windows to process a video stream. @@ -170,7 +171,8 @@ struct v4l2_subdev_selection { __u32 target; __u32 flags; struct v4l2_rect r; - __u32 reserved[8]; + __u32 stream; + __u32 reserved[7]; }; /** @@ -188,6 +190,67 @@ struct v4l2_subdev_capability { /* The v4l2 sub-device video device node is registered in read-only mode. */ #define V4L2_SUBDEV_CAP_RO_SUBDEV 0x00000001 +/* The v4l2 sub-device supports routing and multiplexed streams. */ +#define V4L2_SUBDEV_CAP_STREAMS 0x00000002 + +/* + * Is the route active? An active route will start when streaming is enabled + * on a video node. + */ +#define V4L2_SUBDEV_ROUTE_FL_ACTIVE (1U << 0) + +/** + * struct v4l2_subdev_route - A route inside a subdev + * + * @sink_pad: the sink pad index + * @sink_stream: the sink stream identifier + * @source_pad: the source pad index + * @source_stream: the source stream identifier + * @flags: route flags V4L2_SUBDEV_ROUTE_FL_* + * @reserved: drivers and applications must zero this array + */ +struct v4l2_subdev_route { + __u32 sink_pad; + __u32 sink_stream; + __u32 source_pad; + __u32 source_stream; + __u32 flags; + __u32 reserved[5]; +}; + +/** + * struct v4l2_subdev_routing - Subdev routing information + * + * @which: configuration type (from enum v4l2_subdev_format_whence) + * @num_routes: the total number of routes in the routes array + * @routes: pointer to the routes array + * @reserved: drivers and applications must zero this array + */ +struct v4l2_subdev_routing { + __u32 which; + __u32 num_routes; + __u64 routes; + __u32 reserved[6]; +}; + +/* + * The client is aware of streams. Setting this flag enables the use of 'stream' + * fields (referring to the stream number) with various ioctls. If this is not + * set (which is the default), the 'stream' fields will be forced to 0 by the + * kernel. + */ + #define V4L2_SUBDEV_CLIENT_CAP_STREAMS (1U << 0) + +/** + * struct v4l2_subdev_client_capability - Capabilities of the client accessing + * the subdev + * + * @capabilities: A bitmask of V4L2_SUBDEV_CLIENT_CAP_* flags. + */ +struct v4l2_subdev_client_capability { + __u64 capabilities; +}; + /* Backwards compatibility define --- to be removed */ #define v4l2_subdev_edid v4l2_edid @@ -203,6 +266,11 @@ struct v4l2_subdev_capability { #define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) #define VIDIOC_SUBDEV_G_SELECTION _IOWR('V', 61, struct v4l2_subdev_selection) #define VIDIOC_SUBDEV_S_SELECTION _IOWR('V', 62, struct v4l2_subdev_selection) +#define VIDIOC_SUBDEV_G_ROUTING _IOWR('V', 38, struct v4l2_subdev_routing) +#define VIDIOC_SUBDEV_S_ROUTING _IOWR('V', 39, struct v4l2_subdev_routing) +#define VIDIOC_SUBDEV_G_CLIENT_CAP _IOR('V', 101, struct v4l2_subdev_client_capability) +#define VIDIOC_SUBDEV_S_CLIENT_CAP _IOWR('V', 102, struct v4l2_subdev_client_capability) + /* The following ioctls are identical to the ioctls in videodev2.h */ #define VIDIOC_SUBDEV_G_STD _IOR('V', 23, v4l2_std_id) #define VIDIOC_SUBDEV_S_STD _IOW('V', 24, v4l2_std_id) diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 1a6a8217..c19441a1 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -475,7 +475,6 @@ struct v4l2_capability { #define V4L2_CAP_META_CAPTURE 0x00800000 /* Is a metadata capture device */ #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ -#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ #define V4L2_CAP_META_OUTPUT 0x08000000 /* Is a metadata output device */ @@ -550,6 +549,13 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_RGBX32 v4l2_fourcc('X', 'B', '2', '4') /* 32 RGBX-8-8-8-8 */ #define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */ #define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */ +#define V4L2_PIX_FMT_RGBX1010102 v4l2_fourcc('R', 'X', '3', '0') /* 32 RGBX-10-10-10-2 */ +#define V4L2_PIX_FMT_RGBA1010102 v4l2_fourcc('R', 'A', '3', '0') /* 32 RGBA-10-10-10-2 */ +#define V4L2_PIX_FMT_ARGB2101010 v4l2_fourcc('A', 'R', '3', '0') /* 32 ARGB-2-10-10-10 */ + +/* RGB formats (6 or 8 bytes per pixel) */ +#define V4L2_PIX_FMT_BGR48_12 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ +#define V4L2_PIX_FMT_ABGR64_12 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ /* Grey formats */ #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ @@ -557,6 +563,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 Greyscale */ #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 Greyscale */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 Greyscale BE */ @@ -591,6 +598,15 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ +#define V4L2_PIX_FMT_YUV48_12 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 12-bit per component */ + +/* + * YCbCr packed format. For each Y2xx format, xx bits of valid data occupy the MSBs + * of the 16 bit components, and 16-xx bits of zero padding occupy the LSBs. + */ +#define V4L2_PIX_FMT_Y210 v4l2_fourcc('Y', '2', '1', '0') /* 32 YUYV 4:2:2 */ +#define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 4:2:2 */ +#define V4L2_PIX_FMT_Y216 v4l2_fourcc('Y', '2', '1', '6') /* 32 YUYV 4:2:2 */ /* two planes -- one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ @@ -600,12 +616,14 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ #define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit per component */ +#define V4L2_PIX_FMT_P012 v4l2_fourcc('P', '0', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* two non contiguous planes - one Y, one Cr + Cb interleaved */ #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */ #define V4L2_PIX_FMT_NV16M v4l2_fourcc('N', 'M', '1', '6') /* 16 Y/CbCr 4:2:2 */ #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_P012M v4l2_fourcc('P', 'M', '1', '2') /* 24 Y/CbCr 4:2:0 12-bit per component */ /* three planes - Y Cb, Cr */ #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ @@ -628,6 +646,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */ #define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2') /* 12 Y/CbCr 4:2:0 32x32 tiles */ #define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12 Y/CbCr 4:2:0 10-bit 4x4 macroblocks */ +#define V4L2_PIX_FMT_NV12_8L128 v4l2_fourcc('A', 'T', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ +#define V4L2_PIX_FMT_NV12_10BE_8L128 v4l2_fourcc_be('A', 'X', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ /* Tiled YUV formats, non contiguous planes */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */ @@ -711,6 +731,9 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_FWHT_STATELESS v4l2_fourcc('S', 'F', 'W', 'H') /* Stateless FWHT (vicodec) */ #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ #define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ +#define V4L2_PIX_FMT_SPK v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */ +#define V4L2_PIX_FMT_RV30 v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */ +#define V4L2_PIX_FMT_RV40 v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */ /* Vendor-specific formats */ #define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ @@ -749,6 +772,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */ #define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */ #define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */ +#define V4L2_PIX_FMT_AJPG v4l2_fourcc('A', 'J', 'P', 'G') /* Aspeed JPEG */ /* 10bit raw packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ @@ -1552,7 +1576,8 @@ struct v4l2_bt_timings { ((bt)->width + V4L2_DV_BT_BLANKING_WIDTH(bt)) #define V4L2_DV_BT_BLANKING_HEIGHT(bt) \ ((bt)->vfrontporch + (bt)->vsync + (bt)->vbackporch + \ - (bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) + ((bt)->interlaced ? \ + ((bt)->il_vfrontporch + (bt)->il_vsync + (bt)->il_vbackporch) : 0)) #define V4L2_DV_BT_FRAME_HEIGHT(bt) \ ((bt)->height + V4L2_DV_BT_BLANKING_HEIGHT(bt)) @@ -1643,7 +1668,7 @@ struct v4l2_input { __u8 name[32]; /* Label */ __u32 type; /* Type of input */ __u32 audioset; /* Associated audios (bitfield) */ - __u32 tuner; /* enum v4l2_tuner_type */ + __u32 tuner; /* Tuner index */ v4l2_std_id std; __u32 status; __u32 capabilities; @@ -1730,6 +1755,8 @@ struct v4l2_ext_control { __u8 *p_u8; __u16 *p_u16; __u32 *p_u32; + __s32 *p_s32; + __s64 *p_s64; struct v4l2_area *p_area; struct v4l2_ctrl_h264_sps *p_h264_sps; struct v4l2_ctrl_h264_pps *p_h264_pps; @@ -2381,6 +2408,7 @@ struct v4l2_event_vsync { #define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) #define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) #define V4L2_EVENT_CTRL_CH_RANGE (1 << 2) +#define V4L2_EVENT_CTRL_CH_DIMENSIONS (1 << 3) struct v4l2_event_ctrl { __u32 changes; @@ -2623,5 +2651,10 @@ struct v4l2_create_buffers { /* Deprecated definitions kept for backwards compatibility */ #define V4L2_PIX_FMT_HM12 V4L2_PIX_FMT_NV12_16L16 #define V4L2_PIX_FMT_SUNXI_TILED_NV12 V4L2_PIX_FMT_NV12_32L32 +/* + * This capability was never implemented, anyone using this cap should drop it + * from their code. + */ +#define V4L2_CAP_ASYNCIO 0x02000000 #endif /* __LINUX_VIDEODEV2_H */ diff --git a/lib/Makefile.am b/lib/Makefile.am deleted file mode 100644 index a105c95a..00000000 --- a/lib/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -SUBDIRS = \ - libv4lconvert \ - libv4l2 \ - libv4l1 \ - libv4l2rds \ - libv4l-mplane - -if WITH_LIBDVBV5 -SUBDIRS += \ - libdvbv5 -endif - -EXTRA_DIST = Android.mk diff --git a/lib/include/libdvbv5/desc_extension.h b/lib/include/libdvbv5/desc_extension.h index 8f7220de..344f7cca 100644 --- a/lib/include/libdvbv5/desc_extension.h +++ b/lib/include/libdvbv5/desc_extension.h @@ -141,7 +141,6 @@ typedef int (*dvb_desc_ext_init_func) (struct dvb_v5_fe_parms *parms, * @ingroup dvb_table * * @param parms Struct dvb_v5_fe_parms pointer - * @param buf buffer with the content of the descriptor * @param ext struct dvb_extension_descriptor pointer * @param desc struct dvb_desc pointer */ diff --git a/lib/include/libdvbv5/dvb-dev.h b/lib/include/libdvbv5/dvb-dev.h index 2eeae516..6b4d7483 100644 --- a/lib/include/libdvbv5/dvb-dev.h +++ b/lib/include/libdvbv5/dvb-dev.h @@ -114,7 +114,7 @@ enum dvb_dev_change_type { * * sysname: Kernel's system name for the device (dvb?.frontend?, * for example) - * @type: type of change, as defined by enum dvb_dev_change_type + * type: type of change, as defined by enum dvb_dev_change_type * * @note: the returned string should be freed with free(). */ @@ -171,7 +171,8 @@ void dvb_dev_free(struct dvb_device *dvb); * @ingroup dvb_device * * @param dvb pointer to struct dvb_device to be filled - * @param enable_monitor if different than zero put the routine into + * @param handler if not NULL, then this is called whenever + * something changed * monitor mode * @param user_priv pointer to user private data * @@ -181,12 +182,8 @@ void dvb_dev_free(struct dvb_device *dvb); * at the struct dvb_device and return. * * In monitor mode, it will not only enumerate all devices, but it will also - * keep waiting for device changes. The device seek loop will only be - * interrupted after calling dvb_dev_stop_monitor(). - * - * Please notice that, in such mode, the function will wait forever. So, it - * is up to the application to put start a separate thread to handle it in - * monitor mode, and add the needed mutexes to make it thread safe. + * keep waiting for device changes. The handler callback is called for the + * changed device. * * @return returns 0 on success, a negative value otherwise. */ diff --git a/lib/include/libdvbv5/dvb-fe.h b/lib/include/libdvbv5/dvb-fe.h index 96657013..ed283f29 100644 --- a/lib/include/libdvbv5/dvb-fe.h +++ b/lib/include/libdvbv5/dvb-fe.h @@ -752,18 +752,18 @@ int dvb_fe_set_default_country(struct dvb_v5_fe_parms *parms, extern const unsigned fe_bandwidth_name[8]; extern const char *dvb_v5_name[72]; extern const void *dvb_v5_attr_names[]; -extern const char *delivery_system_name[20]; -extern const char *fe_code_rate_name[14]; -extern const char *fe_modulation_name[15]; +extern const char *delivery_system_name[21]; +extern const char *fe_code_rate_name[34]; +extern const char *fe_modulation_name[22]; extern const char *fe_transmission_mode_name[10]; extern const unsigned fe_bandwidth_name[8]; -extern const char *fe_guard_interval_name[12]; +extern const char *fe_guard_interval_name[13]; extern const char *fe_hierarchy_name[6]; extern const char *fe_voltage_name[4]; extern const char *fe_tone_name[3]; extern const char *fe_inversion_name[4]; extern const char *fe_pilot_name[4]; -extern const char *fe_rolloff_name[5]; +extern const char *fe_rolloff_name[8]; #endif diff --git a/lib/include/libdvbv5/dvb-frontend.h b/lib/include/libdvbv5/dvb-frontend.h index 5f00fc1f..392171a7 100644 --- a/lib/include/libdvbv5/dvb-frontend.h +++ b/lib/include/libdvbv5/dvb-frontend.h @@ -7,21 +7,6 @@ * Holger Waechtler <holger@convergence.de> * Andre Draszik <ad@convergence.de> * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * */ #ifndef _DVBFRONTEND_H_ @@ -282,7 +267,6 @@ enum fe_spectral_inversion { /** * enum fe_code_rate - Type of Forward Error Correction (FEC) * - * * @FEC_NONE: No Forward Error Correction Code * @FEC_1_2: Forward Error Correction Code 1/2 * @FEC_2_3: Forward Error Correction Code 2/3 @@ -296,6 +280,26 @@ enum fe_spectral_inversion { * @FEC_3_5: Forward Error Correction Code 3/5 * @FEC_9_10: Forward Error Correction Code 9/10 * @FEC_2_5: Forward Error Correction Code 2/5 + * @FEC_1_3: Forward Error Correction Code 1/3 + * @FEC_1_4: Forward Error Correction Code 1/4 + * @FEC_5_9: Forward Error Correction Code 5/9 + * @FEC_7_9: Forward Error Correction Code 7/9 + * @FEC_8_15: Forward Error Correction Code 8/15 + * @FEC_11_15: Forward Error Correction Code 11/15 + * @FEC_13_18: Forward Error Correction Code 13/18 + * @FEC_9_20: Forward Error Correction Code 9/20 + * @FEC_11_20: Forward Error Correction Code 11/20 + * @FEC_23_36: Forward Error Correction Code 23/36 + * @FEC_25_36: Forward Error Correction Code 25/36 + * @FEC_13_45: Forward Error Correction Code 13/45 + * @FEC_26_45: Forward Error Correction Code 26/45 + * @FEC_28_45: Forward Error Correction Code 28/45 + * @FEC_32_45: Forward Error Correction Code 32/45 + * @FEC_77_90: Forward Error Correction Code 77/90 + * @FEC_11_45: Forward Error Correction Code 11/45 + * @FEC_4_15: Forward Error Correction Code 4/15 + * @FEC_14_45: Forward Error Correction Code 14/45 + * @FEC_7_15: Forward Error Correction Code 7/15 * * Please note that not all FEC types are supported by a given standard. */ @@ -313,6 +317,26 @@ enum fe_code_rate { FEC_3_5, FEC_9_10, FEC_2_5, + FEC_1_3, + FEC_1_4, + FEC_5_9, + FEC_7_9, + FEC_8_15, + FEC_11_15, + FEC_13_18, + FEC_9_20, + FEC_11_20, + FEC_23_36, + FEC_25_36, + FEC_13_45, + FEC_26_45, + FEC_28_45, + FEC_32_45, + FEC_77_90, + FEC_11_45, + FEC_4_15, + FEC_14_45, + FEC_7_15, }; /** @@ -331,6 +355,13 @@ enum fe_code_rate { * @APSK_32: 32-APSK modulation * @DQPSK: DQPSK modulation * @QAM_4_NR: 4-QAM-NR modulation + * @QAM_1024: 1024-QAM modulation + * @QAM_4096: 4096-QAM modulation + * @APSK_8_L: 8APSK-L modulation + * @APSK_16_L: 16APSK-L modulation + * @APSK_32_L: 32APSK-L modulation + * @APSK_64: 64APSK modulation + * @APSK_64_L: 64APSK-L modulation * * Please note that not all modulations are supported by a given standard. * @@ -350,6 +381,13 @@ enum fe_modulation { APSK_32, DQPSK, QAM_4_NR, + QAM_1024, + QAM_4096, + APSK_8_L, + APSK_16_L, + APSK_32_L, + APSK_64, + APSK_64_L, }; /** @@ -404,6 +442,7 @@ enum fe_transmit_mode { * @GUARD_INTERVAL_PN420: PN length 420 (1/4) * @GUARD_INTERVAL_PN595: PN length 595 (1/6) * @GUARD_INTERVAL_PN945: PN length 945 (1/9) + * @GUARD_INTERVAL_1_64: Guard interval 1/64 * * Please note that not all guard intervals are supported by a given standard. */ @@ -419,6 +458,7 @@ enum fe_guard_interval { GUARD_INTERVAL_PN420, GUARD_INTERVAL_PN595, GUARD_INTERVAL_PN945, + GUARD_INTERVAL_1_64, }; /** @@ -571,6 +611,9 @@ enum fe_pilot { * @ROLLOFF_20: Roloff factor: α=20% * @ROLLOFF_25: Roloff factor: α=25% * @ROLLOFF_AUTO: Auto-detect the roloff factor. + * @ROLLOFF_15: Rolloff factor: α=15% + * @ROLLOFF_10: Rolloff factor: α=10% + * @ROLLOFF_5: Rolloff factor: α=5% * * .. note: * @@ -581,6 +624,9 @@ enum fe_rolloff { ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, + ROLLOFF_15, + ROLLOFF_10, + ROLLOFF_5, }; /** @@ -594,6 +640,8 @@ enum fe_rolloff { * Cable TV: DVB-C following ITU-T J.83 Annex B spec (ClearQAM) * @SYS_DVBC_ANNEX_C: * Cable TV: DVB-C following ITU-T J.83 Annex C spec + * @SYS_DVBC2: + * Cable TV: DVB-C2 * @SYS_ISDBC: * Cable TV: ISDB-C (no drivers yet) * @SYS_DVBT: @@ -611,7 +659,7 @@ enum fe_rolloff { * @SYS_DVBS: * Satellite TV: DVB-S * @SYS_DVBS2: - * Satellite TV: DVB-S2 + * Satellite TV: DVB-S2 and DVB-S2X * @SYS_TURBO: * Satellite TV: DVB-S Turbo * @SYS_ISDBS: @@ -645,6 +693,7 @@ enum fe_delivery_system { SYS_DVBT2, SYS_TURBO, SYS_DVBC_ANNEX_C, + SYS_DVBC2, }; /* backward compatibility definitions for delivery systems */ @@ -720,7 +769,7 @@ enum atscmh_rs_frame_mode { }; /** - * enum atscmh_rs_code_mode + * enum atscmh_rs_code_mode - ATSC-M/H Reed Solomon modes * @ATSCMH_RSCODE_211_187: Reed Solomon code (211,187). * @ATSCMH_RSCODE_223_187: Reed Solomon code (223,187). * @ATSCMH_RSCODE_235_187: Reed Solomon code (235,187). diff --git a/lib/include/libdvbv5/dvb-sat.h b/lib/include/libdvbv5/dvb-sat.h index 403b2c3b..74214d22 100644 --- a/lib/include/libdvbv5/dvb-sat.h +++ b/lib/include/libdvbv5/dvb-sat.h @@ -146,7 +146,8 @@ int dvb_sat_set_parms(struct dvb_v5_fe_parms *parms); * @brief return the real satellite frequency * @ingroup satellite * - * @param parms struct dvb_v5_fe_parms pointer. + * @param p struct dvb_v5_fe_parms pointer. + * @param freq the DTV frequency. * * This function is called internally by the library to get the satellite * frequency, considering the LO frequency. diff --git a/lib/include/libdvbv5/pmt.h b/lib/include/libdvbv5/pmt.h index 5876c594..1005b8dd 100644 --- a/lib/include/libdvbv5/pmt.h +++ b/lib/include/libdvbv5/pmt.h @@ -56,8 +56,6 @@ * @brief Add support for MPEG-TS Stream types * @ingroup dvb_table * - * @var stream_reserved0 - * @brief ITU-T | ISO/IEC Reserved * @var stream_video * @brief ISO/IEC 11172 Video * @var stream_video_h262 @@ -98,10 +96,6 @@ * @brief ISO/IEC 14496-1 SL-packetized stream or FlexMux stream carried in ISO/IEC14496_sections. * @var stream_download * @brief ISO/IEC 13818-6 Synchronized Download Protocol - * @var stream_reserved - * @brief ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved (from 0x15 to 0x7f) - * @var stream_private - * @brief User Private (from 0x80 to 0xff) */ enum dvb_streams { stream_video = 0x01, diff --git a/lib/libdvbv5/Makefile.am b/lib/libdvbv5/Makefile.am deleted file mode 100644 index 683ae3fb..00000000 --- a/lib/libdvbv5/Makefile.am +++ /dev/null @@ -1,126 +0,0 @@ -if WITH_LIBDVBV5 -lib_LTLIBRARIES = libdvbv5.la - -otherincludedir = $(includedir)/libdvbv5 -otherinclude_HEADERS = \ - ../include/libdvbv5/libdvb-version.h \ - ../include/libdvbv5/dvb-demux.h \ - ../include/libdvbv5/dvb-v5-std.h \ - ../include/libdvbv5/dvb-file.h \ - ../include/libdvbv5/countries.h \ - ../include/libdvbv5/crc32.h \ - ../include/libdvbv5/dvb-dev.h \ - ../include/libdvbv5/dvb-frontend.h \ - ../include/libdvbv5/dvb-fe.h \ - ../include/libdvbv5/dvb-sat.h \ - ../include/libdvbv5/dvb-scan.h \ - ../include/libdvbv5/dvb-log.h \ - ../include/libdvbv5/descriptors.h \ - ../include/libdvbv5/header.h \ - ../include/libdvbv5/pat.h \ - ../include/libdvbv5/pmt.h \ - ../include/libdvbv5/desc_language.h \ - ../include/libdvbv5/desc_network_name.h \ - ../include/libdvbv5/desc_cable_delivery.h \ - ../include/libdvbv5/desc_sat.h \ - ../include/libdvbv5/desc_terrestrial_delivery.h \ - ../include/libdvbv5/desc_t2_delivery.h \ - ../include/libdvbv5/desc_service.h \ - ../include/libdvbv5/desc_frequency_list.h \ - ../include/libdvbv5/desc_registration_id.h \ - ../include/libdvbv5/desc_event_short.h \ - ../include/libdvbv5/desc_event_extended.h \ - ../include/libdvbv5/desc_atsc_service_location.h \ - ../include/libdvbv5/desc_hierarchy.h \ - ../include/libdvbv5/desc_extension.h \ - ../include/libdvbv5/desc_isdbt_delivery.h \ - ../include/libdvbv5/desc_logical_channel.h \ - ../include/libdvbv5/desc_ts_info.h \ - ../include/libdvbv5/desc_partial_reception.h \ - ../include/libdvbv5/desc_ca.h \ - ../include/libdvbv5/desc_ca_identifier.h \ - ../include/libdvbv5/nit.h \ - ../include/libdvbv5/sdt.h \ - ../include/libdvbv5/vct.h \ - ../include/libdvbv5/atsc_header.h \ - ../include/libdvbv5/mgt.h \ - ../include/libdvbv5/eit.h \ - ../include/libdvbv5/cat.h \ - ../include/libdvbv5/atsc_eit.h \ - ../include/libdvbv5/mpeg_ts.h \ - ../include/libdvbv5/mpeg_pes.h \ - ../include/libdvbv5/mpeg_es.h - -pkgconfig_DATA = libdvbv5.pc -LIBDVBV5_VERSION = -version-info 0 -else -noinst_LTLIBRARIES = libdvbv5.la -endif - -libdvbv5_la_SOURCES = \ - compat-soname.c \ - crc32.c \ - countries.c \ - dvb-legacy-channel-format.c \ - dvb-zap-format.c \ - dvb-vdr-format.c \ - dvb-v5.c \ - dvb-v5.h \ - parse_string.c \ - parse_string.h \ - dvb-demux.c \ - dvb-dev.c \ - dvb-dev-local.c \ - dvb-dev-priv.h \ - dvb-fe.c \ - dvb-fe-priv.h \ - dvb-log.c \ - dvb-file.c \ - dvb-v5-std.c \ - dvb-sat.c \ - dvb-scan.c \ - descriptors.c \ - tables/header.c \ - tables/pat.c \ - tables/pmt.c \ - tables/nit.c \ - tables/sdt.c \ - tables/vct.c \ - tables/mgt.c \ - tables/eit.c \ - tables/cat.c \ - tables/atsc_eit.c \ - tables/mpeg_ts.c \ - tables/mpeg_pes.c \ - tables/mpeg_es.c \ - descriptors/desc_language.c \ - descriptors/desc_network_name.c \ - descriptors/desc_cable_delivery.c \ - descriptors/desc_sat.c \ - descriptors/desc_terrestrial_delivery.c \ - descriptors/desc_t2_delivery.c \ - descriptors/desc_service.c \ - descriptors/desc_registration_id.c \ - descriptors/desc_frequency_list.c \ - descriptors/desc_event_short.c \ - descriptors/desc_event_extended.c \ - descriptors/desc_atsc_service_location.c \ - descriptors/desc_hierarchy.c \ - descriptors/desc_extension.c \ - descriptors/desc_isdbt_delivery.c \ - descriptors/desc_logical_channel.c \ - descriptors/desc_ts_info.c \ - descriptors/desc_partial_reception.c \ - descriptors/desc_ca.c \ - descriptors/desc_ca_identifier.c - -if WITH_DVBV5_REMOTE -libdvbv5_la_SOURCES += \ - dvb-dev-remote.c -endif - -libdvbv5_la_CPPFLAGS = -I../.. $(ENFORCE_LIBDVBV5_STATIC) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) -libdvbv5_la_LDFLAGS = $(LIBDVBV5_VERSION) $(ENFORCE_LIBDVBV5_STATIC) $(LIBUDEV_LIBS) -lm -lrt -libdvbv5_la_LIBADD = $(LTLIBICONV) - -EXTRA_DIST = README gen_dvb_structs.pl diff --git a/lib/libdvbv5/countries.c b/lib/libdvbv5/countries.c index 609add0b..a6e5f415 100644 --- a/lib/libdvbv5/countries.c +++ b/lib/libdvbv5/countries.c @@ -15,7 +15,6 @@ * */ -#include <config.h> #include "libdvbv5/countries.h" #include <ctype.h> diff --git a/lib/libdvbv5/descriptors/desc_atsc_service_location.c b/lib/libdvbv5/descriptors/desc_atsc_service_location.c index 8b423dc5..b3e191c8 100644 --- a/lib/libdvbv5/descriptors/desc_atsc_service_location.c +++ b/lib/libdvbv5/descriptors/desc_atsc_service_location.c @@ -34,21 +34,28 @@ int atsc_desc_service_location_init(struct dvb_v5_fe_parms *parms, int i; size_t len, dlen = desc->length; - len = sizeof(*s_loc); + // raw data should have one element + len = sizeof(u_int16_t) + sizeof(u_int8_t) + sizeof(struct atsc_desc_service_location_elementary); if (dlen < len) { dvb_logwarn("ATSC service location descriptor is too small"); return -1; } - memcpy(s_loc, p, len); - p += len; - dlen -= len; + memcpy(&s_loc->bitfield , p, sizeof(u_int16_t)); + p += sizeof(u_int16_t); + dlen -= sizeof(u_int16_t); + bswap16(s_loc->bitfield); + + memcpy(&s_loc->number_elements , p, sizeof(u_int8_t)); + p += sizeof(u_int8_t); + dlen -= sizeof(u_int8_t); bswap16(s_loc->bitfield); len = s_loc->number_elements * sizeof(*s_loc->elementary); if (dlen < len) { - dvb_logwarn("ATSC service location descriptor is too small"); + dvb_logwarn("ATSC service location descriptor is too small for %d elements", + s_loc->number_elements); return -1; } if (dlen > len) { diff --git a/lib/libdvbv5/dvb-dev-local.c b/lib/libdvbv5/dvb-dev-local.c index a5e3979f..ea511471 100644 --- a/lib/libdvbv5/dvb-dev-local.c +++ b/lib/libdvbv5/dvb-dev-local.c @@ -27,8 +27,6 @@ #include <unistd.h> #include <string.h> -#include <config.h> - #ifdef HAVE_PTHREAD # include <pthread.h> #endif diff --git a/lib/libdvbv5/dvb-dev-remote.c b/lib/libdvbv5/dvb-dev-remote.c index cd783858..de4d11e4 100644 --- a/lib/libdvbv5/dvb-dev-remote.c +++ b/lib/libdvbv5/dvb-dev-remote.c @@ -20,9 +20,6 @@ #define _LARGEFILE_SOURCE 1 #define _LARGEFILE64_SOURCE 1 -#include <config.h> - - #ifdef HAVE_BACKTRACE #include <execinfo.h> #endif @@ -1497,6 +1494,7 @@ int dvb_remote_fe_set_parms(struct dvb_v5_fe_parms *par) struct queued_msg *msg = NULL; int ret, i; char buf[REMOTE_BUF_SIZE], lnb_name[80] = "", *p = buf; + char cmd[CMD_SIZE]; size_t size = sizeof(buf); if (priv->disconnected) @@ -1536,7 +1534,8 @@ int dvb_remote_fe_set_parms(struct dvb_v5_fe_parms *par) size -= ret; } - msg = send_buf(dvb, priv->fd, "fe_set_parms", buf, p - buf); + strcpy(cmd, "fe_set_parms"); + msg = send_buf(dvb, priv->fd, cmd, buf, p - buf); if (!msg) goto error; diff --git a/lib/libdvbv5/dvb-dev.c b/lib/libdvbv5/dvb-dev.c index c379f402..4bf87fca 100644 --- a/lib/libdvbv5/dvb-dev.c +++ b/lib/libdvbv5/dvb-dev.c @@ -23,8 +23,6 @@ #include <unistd.h> #include <string.h> -#include <config.h> - #include "dvb-fe-priv.h" #include "dvb-dev-priv.h" diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index beda5cd8..7848fcda 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -30,8 +30,6 @@ #include <unistd.h> #include <stdarg.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c index ca84866d..09d071da 100644 --- a/lib/libdvbv5/dvb-file.c +++ b/lib/libdvbv5/dvb-file.c @@ -50,8 +50,6 @@ #include <libdvbv5/desc_hierarchy.h> #include <libdvbv5/countries.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> @@ -674,21 +672,18 @@ static int fill_entry(struct dvb_entry *entry, char *key, char *value) if (!type) return 0; - len = 0; - p = strtok(value," \t"); if (!p) return 0; while (p) { entry->other_el_pid = realloc(entry->other_el_pid, - (len + 1) * + (entry->other_el_pid_len + 1) * sizeof (*entry->other_el_pid)); - entry->other_el_pid[len].type = type; - entry->other_el_pid[len].pid = atol(p); + entry->other_el_pid[entry->other_el_pid_len].type = type; + entry->other_el_pid[entry->other_el_pid_len].pid = atol(p); p = strtok(NULL, " \t\n"); - len++; + entry->other_el_pid_len++; } - entry->other_el_pid_len = len; } if (!is_video && !is_audio) { @@ -1202,7 +1197,7 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms, char *vchannel, int get_detected, int get_nit) { - struct dvb_entry *entry; + struct dvb_entry *entry = NULL; int i, j, r, found = 0; uint32_t freq = 0; @@ -1237,7 +1232,7 @@ static int get_program_and_store(struct dvb_v5_fe_parms_priv *parms, if (!dvb_file->first_entry) { dvb_file->first_entry = calloc(sizeof(*entry), 1); entry = dvb_file->first_entry; - } else { + } else if (entry) { entry->next = calloc(sizeof(*entry), 1); entry = entry->next; } diff --git a/lib/libdvbv5/dvb-log.c b/lib/libdvbv5/dvb-log.c index f92da5f8..5aa6906d 100644 --- a/lib/libdvbv5/dvb-log.c +++ b/lib/libdvbv5/dvb-log.c @@ -24,8 +24,6 @@ #include <unistd.h> #include <stdarg.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c index 71ded425..36a42344 100644 --- a/lib/libdvbv5/dvb-sat.c +++ b/lib/libdvbv5/dvb-sat.c @@ -25,8 +25,6 @@ #include "dvb-fe-priv.h" #include <libdvbv5/dvb-v5-std.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index 5c8aca96..fcf2eba7 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -61,8 +61,6 @@ #include <libdvbv5/desc_t2_delivery.h> #include <libdvbv5/desc_sat.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> @@ -1118,9 +1116,33 @@ static void add_update_nit_dvbs(struct dvb_table_nit *nit, dvbs_dvbc_dvbs_freq_inner[d->fec]); dvb_store_entry_prop(new, DTV_ROLLOFF, dvbs_rolloff[d->roll_off]); - if (d->roll_off != 0) - dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, - SYS_DVBS2); + + /* + * Check if the returned parameters are really DVB-S or not + * + * DVB-S supports only 0.35 roll-off, with QPSK and + * Red-Solomon FEC 1/2, 2/3, 3/4, 5/6, 7/8. If anythign else is + * reported, then it is DVB-S2. + */ + + if ((d->roll_off != 0 && d->roll_off != ROLLOFF_35) || + (d->modulation_system != 0 && d->modulation_system != QPSK)) { + dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, SYS_DVBS2); + return; + } + + switch (d->fec) { + case FEC_NONE: + case FEC_AUTO: + case FEC_1_2: + case FEC_2_3: + case FEC_3_4: + case FEC_5_6: + case FEC_7_8: + return; + default: + dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, SYS_DVBS2); + } } static void add_update_nit_isdbs(struct dvb_table_nit *nit, diff --git a/lib/libdvbv5/dvb-v5.c b/lib/libdvbv5/dvb-v5.c index 37e92125..f7960e1d 100644 --- a/lib/libdvbv5/dvb-v5.c +++ b/lib/libdvbv5/dvb-v5.c @@ -50,39 +50,66 @@ struct fe_status_name fe_status_name[8] = { { FE_TIMEDOUT, "TIMEDOUT" }, }; -const char *fe_code_rate_name[14] = { - [FEC_1_2] = "1/2", - [FEC_2_3] = "2/3", - [FEC_2_5] = "2/5", - [FEC_3_4] = "3/4", - [FEC_3_5] = "3/5", - [FEC_4_5] = "4/5", - [FEC_5_6] = "5/6", - [FEC_6_7] = "6/7", - [FEC_7_8] = "7/8", - [FEC_8_9] = "8/9", - [FEC_9_10] = "9/10", - [FEC_AUTO] = "AUTO", - [FEC_NONE] = "NONE", - [13] = NULL, +const char *fe_code_rate_name[34] = { + [FEC_1_2] = "1/2", + [FEC_1_3] = "1/3", + [FEC_1_4] = "1/4", + [FEC_2_3] = "2/3", + [FEC_2_5] = "2/5", + [FEC_3_4] = "3/4", + [FEC_3_5] = "3/5", + [FEC_4_5] = "4/5", + [FEC_4_15] = "4/15", + [FEC_5_6] = "5/6", + [FEC_5_9] = "5/9", + [FEC_6_7] = "6/7", + [FEC_7_8] = "7/8", + [FEC_7_9] = "7/9", + [FEC_7_15] = "7/15", + [FEC_8_9] = "8/9", + [FEC_8_15] = "8/15", + [FEC_9_10] = "9/10", + [FEC_9_20] = "9/20", + [FEC_11_15] = "11/15", + [FEC_11_20] = "11/20", + [FEC_11_45] = "11/45", + [FEC_13_18] = "13/18", + [FEC_13_45] = "13/45", + [FEC_14_45] = "14/45", + [FEC_23_36] = "23/36", + [FEC_25_36] = "25/36", + [FEC_26_45] = "26/45", + [FEC_28_45] = "28/45", + [FEC_32_45] = "32/45", + [FEC_77_90] = "77/90", + [FEC_AUTO] = "AUTO", + [FEC_NONE] = "NONE", + [33] = NULL, }; -const char *fe_modulation_name[15] = { - [APSK_16] = "APSK/16", - [APSK_32] = "APSK/32", - [DQPSK] = "DQPSK", - [PSK_8] = "PSK/8", - [QAM_4_NR] = "QAM/4_NR", - [QAM_16] = "QAM/16", - [QAM_32] = "QAM/32", - [QAM_64] = "QAM/64", - [QAM_128] = "QAM/128", - [QAM_256] = "QAM/256", - [QAM_AUTO] = "QAM/AUTO", - [QPSK] = "QPSK", - [VSB_8] = "VSB/8", - [VSB_16] = "VSB/16", - [14] = NULL, +const char *fe_modulation_name[22] = { + [APSK_8_L] = "APSK/8_L", + [APSK_16] = "APSK/16", + [APSK_16_L] = "APSK/16_L", + [APSK_32] = "APSK/32", + [APSK_32_L] = "APSK/32_L", + [APSK_64] = "APSK/64", + [APSK_64_L] = "APSK/64_L", + [DQPSK] = "DQPSK", + [PSK_8] = "PSK/8", + [QAM_4_NR] = "QAM/4_NR", + [QAM_16] = "QAM/16", + [QAM_32] = "QAM/32", + [QAM_64] = "QAM/64", + [QAM_128] = "QAM/128", + [QAM_256] = "QAM/256", + [QAM_1024] = "QAM/1024", + [QAM_4096] = "QAM/4096", + [QAM_AUTO] = "QAM/AUTO", + [QPSK] = "QPSK", + [VSB_8] = "VSB/8", + [VSB_16] = "VSB/16", + [21] = NULL, }; const char *fe_transmission_mode_name[10] = { @@ -109,11 +136,12 @@ const unsigned fe_bandwidth_name[8] = { [7] = 0, }; -const char *fe_guard_interval_name[12] = { +const char *fe_guard_interval_name[13] = { [GUARD_INTERVAL_1_4] = "1/4", [GUARD_INTERVAL_1_8] = "1/8", [GUARD_INTERVAL_1_16] = "1/16", [GUARD_INTERVAL_1_32] = "1/32", + [GUARD_INTERVAL_1_64] = "1/64", [GUARD_INTERVAL_1_128] = "1/128", [GUARD_INTERVAL_19_128] = "19/128", [GUARD_INTERVAL_19_256] = "19/256", @@ -121,7 +149,7 @@ const char *fe_guard_interval_name[12] = { [GUARD_INTERVAL_PN420] = "PN420", [GUARD_INTERVAL_PN595] = "PN595", [GUARD_INTERVAL_PN945] = "PN945", - [11] = NULL, + [12] = NULL, }; const char *fe_hierarchy_name[6] = { @@ -160,12 +188,15 @@ const char *fe_pilot_name[4] = { [3] = NULL, }; -const char *fe_rolloff_name[5] = { +const char *fe_rolloff_name[8] = { + [ROLLOFF_5] = "5", + [ROLLOFF_10] = "10", + [ROLLOFF_15] = "15", [ROLLOFF_20] = "20", [ROLLOFF_25] = "25", [ROLLOFF_35] = "35", [ROLLOFF_AUTO] = "AUTO", - [4] = NULL, + [7] = NULL, }; const char *dvb_v5_name[72] = { @@ -243,13 +274,14 @@ const char *dvb_v5_name[72] = { [71] = NULL, }; -const char *delivery_system_name[20] = { +const char *delivery_system_name[21] = { [SYS_ATSC] = "ATSC", [SYS_ATSCMH] = "ATSCMH", [SYS_CMMB] = "CMMB", [SYS_DAB] = "DAB", [SYS_DSS] = "DSS", [SYS_DTMB] = "DTMB", + [SYS_DVBC2] = "DVBC2", [SYS_DVBC_ANNEX_A] = "DVBC/ANNEX_A", [SYS_DVBC_ANNEX_B] = "DVBC/ANNEX_B", [SYS_DVBC_ANNEX_C] = "DVBC/ANNEX_C", @@ -263,6 +295,6 @@ const char *delivery_system_name[20] = { [SYS_ISDBT] = "ISDBT", [SYS_TURBO] = "TURBO", [SYS_UNDEFINED] = "UNDEFINED", - [19] = NULL, + [20] = NULL, }; diff --git a/lib/libdvbv5/dvb-v5.h b/lib/libdvbv5/dvb-v5.h index 3540bac1..f3072e9c 100644 --- a/lib/libdvbv5/dvb-v5.h +++ b/lib/libdvbv5/dvb-v5.h @@ -14,17 +14,17 @@ struct fe_status_name { char *name; }; extern struct fe_status_name fe_status_name[8]; -extern const char *fe_code_rate_name[14]; -extern const char *fe_modulation_name[15]; +extern const char *fe_code_rate_name[34]; +extern const char *fe_modulation_name[22]; extern const char *fe_transmission_mode_name[10]; extern const unsigned fe_bandwidth_name[8]; -extern const char *fe_guard_interval_name[12]; +extern const char *fe_guard_interval_name[13]; extern const char *fe_hierarchy_name[6]; extern const char *fe_voltage_name[4]; extern const char *fe_tone_name[3]; extern const char *fe_inversion_name[4]; extern const char *fe_pilot_name[4]; -extern const char *fe_rolloff_name[5]; +extern const char *fe_rolloff_name[8]; extern const char *dvb_v5_name[72]; -extern const char *delivery_system_name[20]; +extern const char *delivery_system_name[21]; #endif diff --git a/lib/libdvbv5/dvb-vdr-format.c b/lib/libdvbv5/dvb-vdr-format.c index d2365712..9c8728c6 100644 --- a/lib/libdvbv5/dvb-vdr-format.c +++ b/lib/libdvbv5/dvb-vdr-format.c @@ -23,8 +23,6 @@ #include <libdvbv5/dvb-file.h> #include <libdvbv5/dvb-v5-std.h> -#include <config.h> - #ifdef ENABLE_NLS # include "gettext.h" # include <libintl.h> diff --git a/lib/libdvbv5/gen_dvb_structs.pl b/lib/libdvbv5/gen_dvb_structs.pl index d15d1fc3..3dea6e72 100755 --- a/lib/libdvbv5/gen_dvb_structs.pl +++ b/lib/libdvbv5/gen_dvb_structs.pl @@ -473,8 +473,6 @@ sub output_arrays($$$$$) my $fe_file = "$dir/linux/dvb/frontend.h"; -copy $fe_file, "../include/dvb-frontend.h"; - # Generate a header file with the API conversions open OUT, ">dvb-v5.h" or die "Can't write on dvb-v5.h"; gen_fe $fe_file; diff --git a/lib/libdvbv5/libdvbv5.pc.in b/lib/libdvbv5/libdvbv5.pc.in deleted file mode 100644 index 6b5f292d..00000000 --- a/lib/libdvbv5/libdvbv5.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -Name: libdvbv5 -Description: DVBv5 utility library -Version: @PACKAGE_VERSION@ -Requires.private: libudev -Libs: -L${libdir} -ldvbv5 -Cflags: -I${includedir} diff --git a/lib/libdvbv5/meson.build b/lib/libdvbv5/meson.build new file mode 100644 index 00000000..0b92e404 --- /dev/null +++ b/lib/libdvbv5/meson.build @@ -0,0 +1,156 @@ +libdvbv5_option = get_option('libdvbv5') +if libdvbv5_option.disabled() or not dep_libudev.found() + dep_libdvbv5 = dependency('', required : false) + subdir_done() +endif + +libdvbv5_sources = files( + 'compat-soname.c', + 'countries.c', + 'crc32.c', + 'descriptors.c', + 'descriptors/desc_atsc_service_location.c', + 'descriptors/desc_ca.c', + 'descriptors/desc_ca_identifier.c', + 'descriptors/desc_cable_delivery.c', + 'descriptors/desc_event_extended.c', + 'descriptors/desc_event_short.c', + 'descriptors/desc_extension.c', + 'descriptors/desc_frequency_list.c', + 'descriptors/desc_hierarchy.c', + 'descriptors/desc_isdbt_delivery.c', + 'descriptors/desc_language.c', + 'descriptors/desc_logical_channel.c', + 'descriptors/desc_network_name.c', + 'descriptors/desc_partial_reception.c', + 'descriptors/desc_registration_id.c', + 'descriptors/desc_sat.c', + 'descriptors/desc_service.c', + 'descriptors/desc_t2_delivery.c', + 'descriptors/desc_terrestrial_delivery.c', + 'descriptors/desc_ts_info.c', + 'dvb-demux.c', + 'dvb-dev-local.c', + 'dvb-dev-priv.h', + 'dvb-dev-remote.c', + 'dvb-dev.c', + 'dvb-fe-priv.h', + 'dvb-fe.c', + 'dvb-file.c', + 'dvb-legacy-channel-format.c', + 'dvb-log.c', + 'dvb-sat.c', + 'dvb-scan.c', + 'dvb-v5-std.c', + 'dvb-v5.c', + 'dvb-v5.h', + 'dvb-vdr-format.c', + 'dvb-zap-format.c', + 'parse_string.c', + 'parse_string.h', + 'tables/atsc_eit.c', + 'tables/cat.c', + 'tables/eit.c', + 'tables/header.c', + 'tables/mgt.c', + 'tables/mpeg_es.c', + 'tables/mpeg_pes.c', + 'tables/mpeg_ts.c', + 'tables/nit.c', + 'tables/pat.c', + 'tables/pmt.c', + 'tables/sdt.c', + 'tables/vct.c', +) + +configure_file( + output : 'libdvb-version.h', + input : '../include/libdvbv5/libdvb-version.h.in', + configuration : conf, + install: true, + install_dir: 'include/libdvbv5', +) + +libdvbv5_api = files( + '../include/libdvbv5/atsc_eit.h', + '../include/libdvbv5/atsc_header.h', + '../include/libdvbv5/cat.h', + '../include/libdvbv5/countries.h', + '../include/libdvbv5/crc32.h', + '../include/libdvbv5/desc_atsc_service_location.h', + '../include/libdvbv5/desc_ca.h', + '../include/libdvbv5/desc_ca_identifier.h', + '../include/libdvbv5/desc_cable_delivery.h', + '../include/libdvbv5/desc_event_extended.h', + '../include/libdvbv5/desc_event_short.h', + '../include/libdvbv5/desc_extension.h', + '../include/libdvbv5/desc_frequency_list.h', + '../include/libdvbv5/desc_hierarchy.h', + '../include/libdvbv5/desc_isdbt_delivery.h', + '../include/libdvbv5/desc_language.h', + '../include/libdvbv5/desc_logical_channel.h', + '../include/libdvbv5/desc_network_name.h', + '../include/libdvbv5/desc_partial_reception.h', + '../include/libdvbv5/desc_registration_id.h', + '../include/libdvbv5/desc_sat.h', + '../include/libdvbv5/desc_service.h', + '../include/libdvbv5/desc_t2_delivery.h', + '../include/libdvbv5/desc_terrestrial_delivery.h', + '../include/libdvbv5/desc_ts_info.h', + '../include/libdvbv5/descriptors.h', + '../include/libdvbv5/dvb-demux.h', + '../include/libdvbv5/dvb-dev.h', + '../include/libdvbv5/dvb-fe.h', + '../include/libdvbv5/dvb-file.h', + '../include/libdvbv5/dvb-frontend.h', + '../include/libdvbv5/dvb-log.h', + '../include/libdvbv5/dvb-sat.h', + '../include/libdvbv5/dvb-scan.h', + '../include/libdvbv5/dvb-v5-std.h', + '../include/libdvbv5/eit.h', + '../include/libdvbv5/header.h', + '../include/libdvbv5/mgt.h', + '../include/libdvbv5/mpeg_es.h', + '../include/libdvbv5/mpeg_pes.h', + '../include/libdvbv5/mpeg_ts.h', + '../include/libdvbv5/nit.h', + '../include/libdvbv5/pat.h', + '../include/libdvbv5/pmt.h', + '../include/libdvbv5/sdt.h', + '../include/libdvbv5/vct.h', +) + +install_headers(libdvbv5_api, subdir: 'libdvbv5') + +libdvbv5_deps = [ + dep_iconv, + dep_libm, + dep_librt, + dep_libudev, + dep_threads, +] + +libdvbv5_c_args = [ + '-DHAVE_DVBV5_REMOTE', + '-DHAVE_PTHREAD', + '-DLIBDVBV5_DOMAIN="libdvbv5"', +] + +libdvbv5 = library('dvbv5', + libdvbv5_sources, + soversion: '0', + version: '0.0.0', + install : true, + dependencies : libdvbv5_deps, + c_args : libdvbv5_c_args, + include_directories : v4l2_utils_incdir) + +dep_libdvbv5 = declare_dependency(link_with : libdvbv5) +meson.override_dependency('libdvbv5', dep_libdvbv5) + +pkg.generate( + libdvbv5, + name : 'libdvbv5', + version : meson.project_version(), + requires_private : 'libudev', + description : 'DVBv5 utility library') diff --git a/lib/libdvbv5/parse_string.c b/lib/libdvbv5/parse_string.c index d354f497..e673343c 100644 --- a/lib/libdvbv5/parse_string.c +++ b/lib/libdvbv5/parse_string.c @@ -21,7 +21,6 @@ * c.f. EN 300 468 annex A */ -#include <config.h> #include <iconv.h> #include <stdio.h> #include <stdlib.h> diff --git a/lib/libv4l-mplane/Makefile.am b/lib/libv4l-mplane/Makefile.am deleted file mode 100644 index 5264ecf2..00000000 --- a/lib/libv4l-mplane/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -if WITH_V4L_PLUGINS -libv4l2plugin_LTLIBRARIES = libv4l-mplane.la -endif - -libv4l_mplane_la_SOURCES = libv4l-mplane.c -libv4l_mplane_la_CPPFLAGS = $(CFLAG_VISIBILITY) -libv4l_mplane_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -lpthread diff --git a/lib/libv4l-mplane/libv4l-mplane.c b/lib/libv4l-mplane/libv4l-mplane.c index 2f685a73..071e9bc7 100644 --- a/lib/libv4l-mplane/libv4l-mplane.c +++ b/lib/libv4l-mplane/libv4l-mplane.c @@ -16,7 +16,6 @@ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <config.h> #include <errno.h> #include <stdint.h> #include <stdio.h> diff --git a/lib/libv4l-mplane/meson.build b/lib/libv4l-mplane/meson.build new file mode 100644 index 00000000..0e0e558b --- /dev/null +++ b/lib/libv4l-mplane/meson.build @@ -0,0 +1,23 @@ +libv4l_mplane_sources = files( + 'libv4l-mplane.c', +) + +libv4l_mplane_deps = [ + dep_threads, +] + +libv4l_mplane_c_args = [] + +if have_visibility + libv4l_mplane_c_args += ['-fvisibility=hidden'] +endif + +libv4l_mplane = shared_module('v4l-mplane', + libv4l_mplane_sources, + install : true, + install_dir : libv4l2plugindir, + dependencies : libv4l_mplane_deps, + c_args : libv4l_mplane_c_args, + include_directories : v4l2_utils_incdir) + +dep_libv4l_mplane = declare_dependency(link_with : libv4l_mplane) diff --git a/lib/libv4l1/Makefile.am b/lib/libv4l1/Makefile.am deleted file mode 100644 index 42cb3dbb..00000000 --- a/lib/libv4l1/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -if WITH_DYN_LIBV4L -lib_LTLIBRARIES = libv4l1.la -include_HEADERS = ../include/libv4l1.h ../include/libv4l1-videodev.h -pkgconfig_DATA = libv4l1.pc -LIBV4L1_VERSION = -version-info 0 -if WITH_V4L_WRAPPERS -libv4l1priv_LTLIBRARIES = v4l1compat.la - -install-exec-hook: - $(mkdir_p) $(DESTDIR)/$(libdir) - (cd $(DESTDIR)/$(libdir) && rm -f v4l1compat.so && $(LN_S) $(libv4l1subdir)/v4l1compat.so v4l1compat.so) - -endif -else -noinst_LTLIBRARIES = libv4l1.la -endif - -libv4l1_la_SOURCES = libv4l1.c log.c libv4l1-priv.h -libv4l1_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC) -libv4l1_la_LDFLAGS = $(LIBV4L1_VERSION) -lpthread $(ENFORCE_LIBV4L_STATIC) -libv4l1_la_LIBADD = ../libv4l2/libv4l2.la - -v4l1compat_la_SOURCES = v4l1compat.c - -v4l1compat_la_LIBADD = libv4l1.la -v4l1compat_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -v4l1compat_la_LIBTOOLFLAGS = --tag=disable-static - -EXTRA_DIST = libv4l1-kernelcode-license.txt diff --git a/lib/libv4l1/libv4l1.c b/lib/libv4l1/libv4l1.c index b4efa995..ec903305 100644 --- a/lib/libv4l1/libv4l1.c +++ b/lib/libv4l1/libv4l1.c @@ -47,7 +47,6 @@ in turn will call v4l1_open, so therefor v4l1_open (for example) may not use the regular open()! */ -#include <config.h> #include <errno.h> #include <stdarg.h> #include <stdio.h> diff --git a/lib/libv4l1/libv4l1.pc.in b/lib/libv4l1/libv4l1.pc.in deleted file mode 100644 index b4d74537..00000000 --- a/lib/libv4l1/libv4l1.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -Name: libv4l1 -Description: v4l1 compatibility library -Version: @PACKAGE_VERSION@ -Requires.private: libv4l2 -Libs: -L${libdir} -lv4l1 -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/lib/libv4l1/meson.build b/lib/libv4l1/meson.build new file mode 100644 index 00000000..e1fba346 --- /dev/null +++ b/lib/libv4l1/meson.build @@ -0,0 +1,65 @@ +libv4l1_sources = files( + 'libv4l1-priv.h', + 'libv4l1.c', + 'log.c', +) + +libv4l1_api = files( + '../include/libv4l1-videodev.h', + '../include/libv4l1.h', +) + +install_headers(libv4l1_api) + +libv4l1_deps = [ + dep_libv4l2, + dep_threads, +] + +libv4l1_c_args = [] + +if have_visibility + libv4l1_c_args += ['-fvisibility=hidden'] +endif + +libv4l1 = library('v4l1', + libv4l1_sources, + install : true, + soversion: '0', + version: '0.0.0', + dependencies : libv4l1_deps, + c_args : libv4l1_c_args, + include_directories : v4l2_utils_incdir) + +dep_libv4l1 = declare_dependency(link_with : libv4l1) +meson.override_dependency('libv4l1', dep_libv4l1) + +pkg.generate( + libv4l1, + name : 'libv4l1', + version : meson.project_version(), + requires_private : 'libv4l2', + description : 'v4l1 compatibility library') + +if not get_option('v4l-wrappers') + subdir_done() +endif + +v4l1compat_sources = files( + 'v4l1compat.c', +) + +v4l1compat_deps = [ + dep_libv4l1, +] + +libv4l1privdir = get_option('prefix') / get_option('libdir') / get_option('libv4l1subdir') + +v4l1compat = shared_module('v4l1compat', + v4l1compat_sources, + name_prefix : '', + install : true, + install_dir : libv4l1privdir, + c_args : v4l2_wrapper_args, + dependencies : v4l1compat_deps, + include_directories : v4l2_utils_incdir) diff --git a/lib/libv4l1/v4l1compat.c b/lib/libv4l1/v4l1compat.c index e5c9e562..2db68423 100644 --- a/lib/libv4l1/v4l1compat.c +++ b/lib/libv4l1/v4l1compat.c @@ -19,12 +19,6 @@ # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -/* ensure we see *64 variants and they aren't transparently used */ -#undef _LARGEFILE_SOURCE -#undef _FILE_OFFSET_BITS -#define _LARGEFILE64_SOURCE 1 - -#include <config.h> #include <stdlib.h> #include <stdarg.h> #include <fcntl.h> diff --git a/lib/libv4l2/Android.mk b/lib/libv4l2/Android.mk index 7d723fbe..c57626cb 100644 --- a/lib/libv4l2/Android.mk +++ b/lib/libv4l2/Android.mk @@ -10,6 +10,7 @@ LOCAL_SRC_FILES := \ LOCAL_CFLAGS += -Wno-missing-field-initializers LOCAL_CFLAGS += -Wno-sign-compare +LOCAL_CFLAGS += -include ../../android-config.h LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../include \ diff --git a/lib/libv4l2/Makefile.am b/lib/libv4l2/Makefile.am deleted file mode 100644 index 3a1bb901..00000000 --- a/lib/libv4l2/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -if WITH_DYN_LIBV4L -lib_LTLIBRARIES = libv4l2.la -include_HEADERS = ../include/libv4l2.h ../include/libv4l-plugin.h -pkgconfig_DATA = libv4l2.pc -LIBV4L2_VERSION = -version-info 0 -if WITH_V4L_WRAPPERS -libv4l2priv_LTLIBRARIES = v4l2convert.la - -install-exec-hook: - $(mkdir_p) $(DESTDIR)/$(libdir) - (cd $(DESTDIR)/$(libdir) && rm -f v4l2convert.so && $(LN_S) $(libv4l2subdir)/v4l2convert.so v4l2convert.so) - -endif -else -noinst_LTLIBRARIES = libv4l2.la -endif - -libv4l2_la_SOURCES = libv4l2.c log.c libv4l2-priv.h -if WITH_V4L_PLUGINS -libv4l2_la_SOURCES += v4l2-plugin.c -endif - -libv4l2_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC) -libv4l2_la_LDFLAGS = $(LIBV4L2_VERSION) -lpthread $(DLOPEN_LIBS) $(ENFORCE_LIBV4L_STATIC) -libv4l2_la_LIBADD = ../libv4lconvert/libv4lconvert.la - -v4l2convert_la_SOURCES = v4l2convert.c -v4l2convert_la_LIBADD = libv4l2.la -v4l2convert_la_LDFLAGS = -avoid-version -module -shared -export-dynamic -v4l2convert_la_LIBTOOLFLAGS = --tag=disable-static - -EXTRA_DIST = Android.mk v4l2-plugin-android.c diff --git a/lib/libv4l2/libv4l2.c b/lib/libv4l2/libv4l2.c index 9ebf8c18..032a4f1c 100644 --- a/lib/libv4l2/libv4l2.c +++ b/lib/libv4l2/libv4l2.c @@ -55,11 +55,6 @@ When modifications are made, one should be careful that this behavior is preserved. */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <errno.h> #include <stdarg.h> #include <stdio.h> diff --git a/lib/libv4l2/libv4l2.pc.in b/lib/libv4l2/libv4l2.pc.in deleted file mode 100644 index 37ba4fe5..00000000 --- a/lib/libv4l2/libv4l2.pc.in +++ /dev/null @@ -1,12 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -Name: libv4l2 -Description: v4l2 device access library -Version: @PACKAGE_VERSION@ -Requires.private: libv4lconvert -Libs: -L${libdir} -lv4l2 -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/lib/libv4l2/log.c b/lib/libv4l2/log.c index 9517b86f..0e0e70b3 100644 --- a/lib/libv4l2/log.c +++ b/lib/libv4l2/log.c @@ -18,11 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/lib/libv4l2/meson.build b/lib/libv4l2/meson.build new file mode 100644 index 00000000..9d6ecd5f --- /dev/null +++ b/lib/libv4l2/meson.build @@ -0,0 +1,74 @@ +libv4l2_sources = files( + 'libv4l2-priv.h', + 'libv4l2.c', + 'log.c', +) + +libv4l2_api = files( + '../include/libv4l-plugin.h', + '../include/libv4l2.h', +) + +install_headers(libv4l2_api) + +libv4l2_deps = [ + dep_libdl, + dep_libv4lconvert, + dep_threads, +] + +libv4l2_c_args = [] + +if get_option('v4l-plugins') + libv4l2_sources += files('v4l2-plugin.c') + libv4l2_c_args += [ + '-DHAVE_V4L_PLUGINS', + '-DLIBV4L2_PLUGIN_DIR="@0@"'.format(libv4l2plugindir) + ] +endif + +if have_visibility + libv4l2_c_args += ['-fvisibility=hidden'] +endif + +libv4l2 = library('v4l2', + libv4l2_sources, + soversion: '0', + version: '0.0.0', + install : true, + dependencies : libv4l2_deps, + c_args : libv4l2_c_args, + include_directories : v4l2_utils_incdir) + +dep_libv4l2 = declare_dependency(link_with : libv4l2) +meson.override_dependency('libv4l2', dep_libv4l2) + +pkg.generate( + libv4l2, + name : 'libv4l2', + version : meson.project_version(), + requires_private : 'libv4lconvert', + description : 'v4l2 device access library') + +if not get_option('v4l-wrappers') + subdir_done() +endif + +v4l2convert_sources = files( + 'v4l2convert.c', +) + +v4l2convert_deps = [ + dep_libv4l2, +] + +libv4l2privdir = get_option('prefix') / get_option('libdir') / get_option('libv4l2subdir') + +v4l2convert = shared_module('v4l2convert', + v4l2convert_sources, + name_prefix : '', + install : true, + install_dir : libv4l2privdir, + c_args : v4l2_wrapper_args, + dependencies : v4l2convert_deps, + include_directories : v4l2_utils_incdir) diff --git a/lib/libv4l2/v4l2-plugin-android.c b/lib/libv4l2/v4l2-plugin-android.c index c4ebc658..1aee111c 100644 --- a/lib/libv4l2/v4l2-plugin-android.c +++ b/lib/libv4l2/v4l2-plugin-android.c @@ -16,11 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdarg.h> #include <dlfcn.h> #include <fcntl.h> diff --git a/lib/libv4l2/v4l2-plugin.c b/lib/libv4l2/v4l2-plugin.c index ff42eed4..e2356cb6 100644 --- a/lib/libv4l2/v4l2-plugin.c +++ b/lib/libv4l2/v4l2-plugin.c @@ -16,7 +16,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <config.h> #include <stdarg.h> #include <dlfcn.h> #include <fcntl.h> diff --git a/lib/libv4l2/v4l2convert.c b/lib/libv4l2/v4l2convert.c index 13ca4cfb..396ed3ea 100644 --- a/lib/libv4l2/v4l2convert.c +++ b/lib/libv4l2/v4l2convert.c @@ -23,16 +23,6 @@ /* prevent GCC 4.7 inlining error */ #undef _FORTIFY_SOURCE -/* ensure we see *64 variants and they aren't transparently used */ -#undef _LARGEFILE_SOURCE -#undef _FILE_OFFSET_BITS -#define _LARGEFILE64_SOURCE 1 - -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdarg.h> #include <stdlib.h> #include <fcntl.h> diff --git a/lib/libv4l2rds/Makefile.am b/lib/libv4l2rds/Makefile.am deleted file mode 100644 index 73fdd3e2..00000000 --- a/lib/libv4l2rds/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -if WITH_DYN_LIBV4L -lib_LTLIBRARIES = libv4l2rds.la -include_HEADERS = ../include/libv4l2rds.h -pkgconfig_DATA = libv4l2rds.pc -LIBV4L2RDS_VERSION = -version-info 0 -else -noinst_LTLIBRARIES = libv4l2rds.la -endif - -libv4l2rds_la_SOURCES = libv4l2rds.c -libv4l2rds_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC) -libv4l2rds_la_LDFLAGS = $(LIBV4L2RDS_VERSION) -lpthread $(ENFORCE_LIBV4L_STATIC) diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c index 2e67d060..4bc01721 100644 --- a/lib/libv4l2rds/libv4l2rds.c +++ b/lib/libv4l2rds/libv4l2rds.c @@ -10,7 +10,6 @@ #include <stdlib.h> #include <string.h> #include <time.h> -#include <config.h> #include <sys/types.h> #include <sys/mman.h> diff --git a/lib/libv4l2rds/libv4l2rds.pc.in b/lib/libv4l2rds/libv4l2rds.pc.in deleted file mode 100644 index cc1d5f69..00000000 --- a/lib/libv4l2rds/libv4l2rds.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -Name: libv4l2rds -Description: v4l2 RDS decode library -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lv4l2rds -Libs.private: -lpthread -Cflags: -I${includedir} diff --git a/lib/libv4l2rds/meson.build b/lib/libv4l2rds/meson.build new file mode 100644 index 00000000..338a97f8 --- /dev/null +++ b/lib/libv4l2rds/meson.build @@ -0,0 +1,37 @@ +libv4l2rds_sources = files( + 'libv4l2rds.c', +) + +libv4l2rds_api = files( + '../include/libv4l2rds.h', +) + +install_headers(libv4l2rds_api) + +libv4l2rds_deps = [ + dep_threads, +] + +libv4l2rds_c_args = [] + +if have_visibility + libv4l2rds_c_args += ['-fvisibility=hidden'] +endif + +libv4l2rds = library('v4l2rds', + libv4l2rds_sources, + soversion: '0', + version: '0.0.0', + install : true, + dependencies : libv4l2rds_deps, + c_args : libv4l2rds_c_args, + include_directories : v4l2_utils_incdir) + +dep_libv4l2rds = declare_dependency(link_with : libv4l2rds) +meson.override_dependency('libv4l2rds', dep_libv4l2rds) + +pkg.generate( + libv4l2rds, + name : 'libv4l2rds', + version : meson.project_version(), + description : 'v4l2 RDS decode library') diff --git a/lib/libv4lconvert/.gitignore b/lib/libv4lconvert/.gitignore deleted file mode 100644 index 5d677136..00000000 --- a/lib/libv4lconvert/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -ov511-decomp -ov518-decomp - diff --git a/lib/libv4lconvert/Android.mk b/lib/libv4lconvert/Android.mk index a4e75c95..fc0d1aba 100644 --- a/lib/libv4lconvert/Android.mk +++ b/lib/libv4lconvert/Android.mk @@ -35,6 +35,7 @@ LOCAL_SRC_FILES := \ LOCAL_CFLAGS += -Wno-missing-field-initializers LOCAL_CFLAGS += -Wno-sign-compare +LOCAL_CFLAGS += -include ../../android-config.h LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../include \ diff --git a/lib/libv4lconvert/Makefile.am b/lib/libv4lconvert/Makefile.am deleted file mode 100644 index 71152b54..00000000 --- a/lib/libv4lconvert/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -if WITH_DYN_LIBV4L -lib_LTLIBRARIES = libv4lconvert.la -if HAVE_LIBV4LCONVERT_HELPERS -libv4lconvertpriv_PROGRAMS = ov511-decomp ov518-decomp -endif -include_HEADERS = ../include/libv4lconvert.h -pkgconfig_DATA = libv4lconvert.pc -LIBV4LCONVERT_VERSION = -version-info 0 -else -noinst_LTLIBRARIES = libv4lconvert.la -endif - -libv4lconvert_la_SOURCES = \ - libv4lconvert.c tinyjpeg.c sn9c10x.c sn9c20x.c pac207.c mr97310a.c \ - flip.c crop.c jidctflt.c spca561-decompress.c \ - rgbyuv.c sn9c2028-decomp.c spca501.c sq905c.c bayer.c nv12_16l16.c \ - stv0680.c cpia1.c se401.c jpgl.c jpeg.c jl2005bcd.c \ - control/libv4lcontrol.c control/libv4lcontrol.h control/libv4lcontrol-priv.h \ - processing/libv4lprocessing.c processing/whitebalance.c processing/autogain.c \ - processing/gamma.c processing/libv4lprocessing.h processing/libv4lprocessing-priv.h \ - helper-funcs.h libv4lconvert-priv.h libv4lsyscall-priv.h \ - tinyjpeg.h tinyjpeg-internal.h -if HAVE_JPEG -libv4lconvert_la_SOURCES += jpeg_memsrcdest.c jpeg_memsrcdest.h -endif -if HAVE_LIBV4LCONVERT_HELPERS -libv4lconvert_la_SOURCES += helper.c -endif -libv4lconvert_la_CPPFLAGS = $(CFLAG_VISIBILITY) $(ENFORCE_LIBV4L_STATIC) -libv4lconvert_la_LDFLAGS = $(LIBV4LCONVERT_VERSION) -lrt -lm $(JPEG_LIBS) $(ENFORCE_LIBV4L_STATIC) - -ov511_decomp_SOURCES = ov511-decomp.c - -ov518_decomp_SOURCES = ov518-decomp.c - -EXTRA_DIST = Android.mk diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c index 7296de1d..67671937 100644 --- a/lib/libv4lconvert/control/libv4lcontrol.c +++ b/lib/libv4lconvert/control/libv4lcontrol.c @@ -725,16 +725,21 @@ struct v4lcontrol_data *v4lcontrol_create(int fd, void *dev_ops_priv, if (shm_fd >= 0) { /* Set the shared memory size */ - ftruncate(shm_fd, V4LCONTROL_SHM_SIZE); - - /* Retreive a pointer to the shm object */ - data->shm_values = mmap(NULL, V4LCONTROL_SHM_SIZE, (PROT_READ | PROT_WRITE), - MAP_SHARED, shm_fd, 0); - close(shm_fd); - - if (data->shm_values == MAP_FAILED) { - perror("libv4lcontrol: error shm mmap failed"); - data->shm_values = NULL; + int ret = ftruncate(shm_fd, V4LCONTROL_SHM_SIZE); + if (ret) { + perror("libv4lcontrol: shm ftruncate failed"); + close(shm_fd); + } else { + /* Retrieve a pointer to the shm object */ + data->shm_values = mmap(NULL, V4LCONTROL_SHM_SIZE, + PROT_READ | PROT_WRITE, + MAP_SHARED, shm_fd, 0); + close(shm_fd); + + if (data->shm_values == MAP_FAILED) { + perror("libv4lcontrol: shm mmap failed"); + data->shm_values = NULL; + } } } else perror("libv4lcontrol: error creating shm segment failed"); diff --git a/lib/libv4lconvert/jl2005bcd.c b/lib/libv4lconvert/jl2005bcd.c index ec7103d5..707c3205 100644 --- a/lib/libv4lconvert/jl2005bcd.c +++ b/lib/libv4lconvert/jl2005bcd.c @@ -23,11 +23,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdlib.h> #include <string.h> diff --git a/lib/libv4lconvert/jpeg.c b/lib/libv4lconvert/jpeg.c index 15f8dec7..ebfc8149 100644 --- a/lib/libv4lconvert/jpeg.c +++ b/lib/libv4lconvert/jpeg.c @@ -16,11 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <errno.h> #include <stdlib.h> #include "libv4lconvert-priv.h" diff --git a/lib/libv4lconvert/jpeg_memsrcdest.c b/lib/libv4lconvert/jpeg_memsrcdest.c index 0540470f..6c09efe9 100644 --- a/lib/libv4lconvert/jpeg_memsrcdest.c +++ b/lib/libv4lconvert/jpeg_memsrcdest.c @@ -16,11 +16,6 @@ /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdlib.h> #include <stdio.h> diff --git a/lib/libv4lconvert/libv4lconvert-priv.h b/lib/libv4lconvert/libv4lconvert-priv.h index 6b9128ce..ff2f4a75 100644 --- a/lib/libv4lconvert/libv4lconvert-priv.h +++ b/lib/libv4lconvert/libv4lconvert-priv.h @@ -19,11 +19,6 @@ #ifndef __LIBV4LCONVERT_PRIV_H #define __LIBV4LCONVERT_PRIV_H -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <stdio.h> #include <stdint.h> #include <sys/types.h> @@ -118,10 +113,10 @@ void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt, int bgr, int yvu, int bpp); void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dst, - int width, int height, int yvu); + int width, int height, int stride, int yvu); void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dst, - int width, int height, int yvu); + int width, int height, int stride, int yvu); void v4lconvert_yuyv_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height, int stride); @@ -133,7 +128,7 @@ void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dst, int width, int height, int stride, int yvu); void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest, - int width, int height); + int width, int height, int stride); void v4lconvert_yvyu_to_rgb24(const unsigned char *src, unsigned char *dst, int width, int height, int stride); @@ -157,7 +152,7 @@ void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dst, const struct v4l2_format *src_fmt); void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height); + int width, int height, int stride); void v4lconvert_grey_to_yuv420(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt); @@ -178,10 +173,10 @@ int v4lconvert_y10b_to_yuv420(struct v4lconvert_data *data, const unsigned char *src, unsigned char *dest, int width, int height); void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height); + int width, int height, int stride); void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest, - int width, int height); + int width, int height, int stride); void v4lconvert_rgb565_to_yuv420(const unsigned char *src, unsigned char *dest, const struct v4l2_format *src_fmt, int yvu); @@ -287,10 +282,10 @@ void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest, int width, int height, int bgr, int Xin, unsigned char hsv_enc); void v4lconvert_nv12_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height, int bgr); + int width, int height, int stride, int bgr); void v4lconvert_nv12_to_yuv420(const unsigned char *src, unsigned char *dest, - int width, int height, int yvu); + int width, int height, int stride, int yvu); void v4lconvert_rotate90(unsigned char *src, unsigned char *dest, struct v4l2_format *fmt); diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c index e794ec00..80f39dc4 100644 --- a/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c @@ -16,11 +16,6 @@ # Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif #include <errno.h> #include <string.h> #include <stdlib.h> @@ -905,11 +900,11 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: v4lconvert_yuv420_to_rgb24(data->convert_pixfmt_buf, dest, width, - height, yvu); + height, bytesperline, yvu); break; case V4L2_PIX_FMT_BGR24: v4lconvert_yuv420_to_bgr24(data->convert_pixfmt_buf, dest, width, - height, yvu); + height, bytesperline, yvu); break; } break; @@ -937,16 +932,16 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, case V4L2_PIX_FMT_NV12: switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: - v4lconvert_nv12_to_rgb24(src, dest, width, height, 0); + v4lconvert_nv12_to_rgb24(src, dest, width, height, bytesperline, 0); break; case V4L2_PIX_FMT_BGR24: - v4lconvert_nv12_to_rgb24(src, dest, width, height, 1); + v4lconvert_nv12_to_rgb24(src, dest, width, height, bytesperline, 1); break; case V4L2_PIX_FMT_YUV420: - v4lconvert_nv12_to_yuv420(src, dest, width, height, 0); + v4lconvert_nv12_to_yuv420(src, dest, width, height, bytesperline, 0); break; case V4L2_PIX_FMT_YVU420: - v4lconvert_nv12_to_yuv420(src, dest, width, height, 1); + v4lconvert_nv12_to_yuv420(src, dest, width, height, bytesperline, 1); break; } break; @@ -1245,7 +1240,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_BGR24: - v4lconvert_grey_to_rgb24(src, dest, width, height); + v4lconvert_grey_to_rgb24(src, dest, width, height, bytesperline); break; case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YVU420: @@ -1282,10 +1277,10 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, } switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: - v4lconvert_rgb565_to_rgb24(src, dest, width, height); + v4lconvert_rgb565_to_rgb24(src, dest, width, height, bytesperline); break; case V4L2_PIX_FMT_BGR24: - v4lconvert_rgb565_to_bgr24(src, dest, width, height); + v4lconvert_rgb565_to_bgr24(src, dest, width, height, bytesperline); break; case V4L2_PIX_FMT_YUV420: v4lconvert_rgb565_to_yuv420(src, dest, fmt, 0); @@ -1398,11 +1393,11 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: v4lconvert_yuv420_to_rgb24(src, dest, width, - height, 0); + height, bytesperline, 0); break; case V4L2_PIX_FMT_BGR24: v4lconvert_yuv420_to_bgr24(src, dest, width, - height, 0); + height, bytesperline, 0); break; case V4L2_PIX_FMT_YUV420: memcpy(dest, src, width * height * 3 / 2); @@ -1422,11 +1417,11 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, switch (dest_pix_fmt) { case V4L2_PIX_FMT_RGB24: v4lconvert_yuv420_to_rgb24(src, dest, width, - height, 1); + height, bytesperline, 1); break; case V4L2_PIX_FMT_BGR24: v4lconvert_yuv420_to_bgr24(src, dest, width, - height, 1); + height, bytesperline, 1); break; case V4L2_PIX_FMT_YUV420: v4lconvert_swap_uv(src, dest, fmt); @@ -1445,10 +1440,10 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, if (!tmpbuf) return v4lconvert_oom_error(data); - v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height); + v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height, bytesperline); src_pix_fmt = V4L2_PIX_FMT_YUYV; src = tmpbuf; - bytesperline = bytesperline * 2; + bytesperline = width * 2; /* fall through */ } case V4L2_PIX_FMT_YUYV: @@ -1482,10 +1477,10 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data, return v4lconvert_oom_error(data); /* Note NV61 is NV16 with U and V swapped so this becomes yvyu. */ - v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height); + v4lconvert_nv16_to_yuyv(src, tmpbuf, width, height, bytesperline); src_pix_fmt = V4L2_PIX_FMT_YVYU; src = tmpbuf; - bytesperline = bytesperline * 2; + bytesperline = width * 2; /* fall through */ } case V4L2_PIX_FMT_YVYU: diff --git a/lib/libv4lconvert/libv4lconvert.pc.in b/lib/libv4lconvert/libv4lconvert.pc.in deleted file mode 100644 index 2b65d8b8..00000000 --- a/lib/libv4lconvert/libv4lconvert.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -includedir=@includedir@ -libdir=@libdir@ - -Name: libv4lconvert -Description: v4l format conversion library -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lv4lconvert -Libs.private: -lrt -lm @JPEG_LIBS@ -Cflags: -I${includedir} diff --git a/lib/libv4lconvert/meson.build b/lib/libv4lconvert/meson.build new file mode 100644 index 00000000..38740755 --- /dev/null +++ b/lib/libv4lconvert/meson.build @@ -0,0 +1,117 @@ +libv4lconvert_sources = files( + 'bayer.c', + 'control/libv4lcontrol-priv.h', + 'control/libv4lcontrol.c', + 'control/libv4lcontrol.h', + 'cpia1.c', + 'crop.c', + 'flip.c', + 'helper-funcs.h', + 'jidctflt.c', + 'jl2005bcd.c', + 'jpeg.c', + 'jpgl.c', + 'libv4lconvert-priv.h', + 'libv4lconvert.c', + 'libv4lsyscall-priv.h', + 'mr97310a.c', + 'nv12_16l16.c', + 'pac207.c', + 'processing/autogain.c', + 'processing/gamma.c', + 'processing/libv4lprocessing-priv.h', + 'processing/libv4lprocessing.c', + 'processing/libv4lprocessing.h', + 'processing/whitebalance.c', + 'rgbyuv.c', + 'se401.c', + 'sn9c10x.c', + 'sn9c2028-decomp.c', + 'sn9c20x.c', + 'spca501.c', + 'spca561-decompress.c', + 'sq905c.c', + 'stv0680.c', + 'tinyjpeg-internal.h', + 'tinyjpeg.c', + 'tinyjpeg.h', +) + +libv4lconvert_api = files( + '../include/libv4lconvert.h', +) + +install_headers(libv4lconvert_api) + +libv4lconvert_deps = [ + dep_libm, + dep_librt, +] + +libv4lconvert_priv_libs = [ + '-lm', + '-lrt', +] + +libv4lconvertprivdir = get_option('prefix') / get_option('libdir') / get_option('libv4lconvertsubdir') + +libv4lconvert_c_args = ['-DLIBV4LCONVERT_PRIV_DIR="@0@"'.format(libv4lconvertprivdir)] + +if dep_jpeg.found() + libv4lconvert_deps += dep_jpeg + libv4lconvert_priv_libs += dep_jpeg_priv_libs + libv4lconvert_sources += files( + 'jpeg_memsrcdest.c', + 'jpeg_memsrcdest.h' + ) + libv4lconvert_c_args += [ + '-DHAVE_JPEG', + ] +endif + +if have_fork + libv4lconvert_sources += files( + 'helper.c', + ) + ov511_decomp_sources = files( + 'ov511-decomp.c', + ) + ov511_decomp = executable('ov511-decomp', + ov511_decomp_sources, + install : true, + install_dir : libv4lconvertprivdir, + include_directories : v4l2_utils_incdir) + ov518_decomp_sources = files( + 'ov518-decomp.c', + ) + ov518_decomp = executable('ov518-decomp', + ov518_decomp_sources, + install : true, + install_dir : libv4lconvertprivdir, + include_directories : v4l2_utils_incdir) +endif + +if have_visibility + libv4lconvert_c_args += [ + '-fvisibility=hidden', + '-DHAVE_LIBV4LCONVERT_HELPERS', + ] +endif + +libv4lconvert = library('v4lconvert', + libv4lconvert_sources, + soversion: '0', + version: '0.0.0', + install : true, + dependencies : libv4lconvert_deps, + c_args : libv4lconvert_c_args, + include_directories : v4l2_utils_incdir) + +dep_libv4lconvert = declare_dependency(link_with : libv4lconvert) +meson.override_dependency('libv4lconvert', dep_libv4lconvert) + +pkg.generate( + libv4lconvert, + name : 'libv4lconvert', + version : meson.project_version(), + description : 'v4l format conversion library') diff --git a/lib/libv4lconvert/rgbyuv.c b/lib/libv4lconvert/rgbyuv.c index b54b4577..e2dceb3a 100644 --- a/lib/libv4lconvert/rgbyuv.c +++ b/lib/libv4lconvert/rgbyuv.c @@ -93,7 +93,7 @@ void v4lconvert_rgb24_to_yuv420(const unsigned char *src, unsigned char *dest, #define CLIP(color) (unsigned char)(((color) > 0xFF) ? 0xff : (((color) < 0) ? 0 : (color))) void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest, - int width, int height, int yvu) + int width, int height, int stride, int yvu) { int i, j; @@ -101,11 +101,11 @@ void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest, const unsigned char *usrc, *vsrc; if (yvu) { - vsrc = src + width * height; - usrc = vsrc + (width * height) / 4; + vsrc = src + stride * height; + usrc = vsrc + (stride * height) / 4; } else { - usrc = src + width * height; - vsrc = usrc + (width * height) / 4; + usrc = src + stride * height; + vsrc = usrc + (stride * height) / 4; } for (i = 0; i < height; i++) { @@ -138,16 +138,20 @@ void v4lconvert_yuv420_to_bgr24(const unsigned char *src, unsigned char *dest, usrc++; vsrc++; } + ysrc += stride - width; /* Rewind u and v for next line */ if (!(i & 1)) { usrc -= width / 2; vsrc -= width / 2; + } else { + usrc += (stride - width) / 2; + vsrc += (stride - width) / 2; } } } void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height, int yvu) + int width, int height, int stride, int yvu) { int i, j; @@ -155,11 +159,11 @@ void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest, const unsigned char *usrc, *vsrc; if (yvu) { - vsrc = src + width * height; - usrc = vsrc + (width * height) / 4; + vsrc = src + stride * height; + usrc = vsrc + (stride * height) / 4; } else { - usrc = src + width * height; - vsrc = usrc + (width * height) / 4; + usrc = src + stride * height; + vsrc = usrc + (stride * height) / 4; } for (i = 0; i < height; i++) { @@ -192,10 +196,14 @@ void v4lconvert_yuv420_to_rgb24(const unsigned char *src, unsigned char *dest, usrc++; vsrc++; } + ysrc += stride - width; /* Rewind u and v for next line */ - if (!(i&1)) { + if (!(i & 1)) { usrc -= width / 2; vsrc -= width / 2; + } else { + usrc += (stride - width) / 2; + vsrc += (stride - width) / 2; } } } @@ -296,17 +304,21 @@ void v4lconvert_yuyv_to_yuv420(const unsigned char *src, unsigned char *dest, } void v4lconvert_nv16_to_yuyv(const unsigned char *src, unsigned char *dest, - int width, int height) + int width, int height, int stride) { const unsigned char *y, *cbcr; - int count = 0; + int i, j; y = src; - cbcr = src + width*height; + cbcr = src + stride * height; - while (count++ < width*height) { - *dest++ = *y++; - *dest++ = *cbcr++; + for (i = 0; i < height; i++) { + for (j = 0; j < width; j++) { + *dest++ = *y++; + *dest++ = *cbcr++; + } + y += stride - width; + cbcr += stride - width; } } @@ -503,7 +515,7 @@ void v4lconvert_swap_uv(const unsigned char *src, unsigned char *dest, } void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height) + int width, int height, int stride) { int j; while (--height >= 0) { @@ -517,11 +529,12 @@ void v4lconvert_rgb565_to_rgb24(const unsigned char *src, unsigned char *dest, src += 2; } + src += stride - 2 * width; } } void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest, - int width, int height) + int width, int height, int stride) { int j; while (--height >= 0) { @@ -535,6 +548,7 @@ void v4lconvert_rgb565_to_bgr24(const unsigned char *src, unsigned char *dest, src += 2; } + src += stride - 2 * width; } } @@ -640,7 +654,7 @@ void v4lconvert_y16_to_yuv420(const unsigned char *src, unsigned char *dest, } void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height) + int width, int height, int stride) { int j; while (--height >= 0) { @@ -650,6 +664,7 @@ void v4lconvert_grey_to_rgb24(const unsigned char *src, unsigned char *dest, *dest++ = *src; src++; } + src += stride - width; } } @@ -847,11 +862,11 @@ void v4lconvert_hsv_to_rgb24(const unsigned char *src, unsigned char *dest, } void v4lconvert_nv12_to_rgb24(const unsigned char *src, unsigned char *dest, - int width, int height, int bgr) + int width, int height, int stride, int bgr) { int i, j; const unsigned char *ysrc = src; - const unsigned char *uvsrc = src + width * height; + const unsigned char *uvsrc = src + stride * height; for (i = 0; i < height; i++) { for (j = 0; j < width; j ++) { @@ -869,18 +884,21 @@ void v4lconvert_nv12_to_rgb24(const unsigned char *src, unsigned char *dest, uvsrc += 2; } + ysrc += stride - width; /* Rewind u and v for next line */ if (!(i&1)) uvsrc -= width; + else + uvsrc += stride - width; } } void v4lconvert_nv12_to_yuv420(const unsigned char *src, unsigned char *dest, - int width, int height, int yvu) + int width, int height, int stride, int yvu) { int i, j; const unsigned char *ysrc = src; - const unsigned char *uvsrc = src + width * height; + const unsigned char *uvsrc = src + stride * height; unsigned char *ydst = dest; unsigned char *udst, *vdst; @@ -892,7 +910,7 @@ void v4lconvert_nv12_to_yuv420(const unsigned char *src, unsigned char *dest, vdst = udst + ((width / 2) * (height / 2)); } - for (i = 0; i < height; i++) + for (i = 0; i < height; i++) { for (j = 0; j < width; j++) { *ydst++ = *ysrc++; if (((i % 2) == 0) && ((j % 2) == 0)) { @@ -900,4 +918,9 @@ void v4lconvert_nv12_to_yuv420(const unsigned char *src, unsigned char *dest, *vdst++ = *uvsrc++; } } + + ysrc += stride - width; + if ((i % 2) == 0) + uvsrc += stride - width; + } } diff --git a/lib/meson.build b/lib/meson.build new file mode 100644 index 00000000..47cee16d --- /dev/null +++ b/lib/meson.build @@ -0,0 +1,11 @@ +libv4l2plugindir = get_option('prefix') / get_option('libdir') / get_option('libv4l2subdir') / 'plugins' + +subdir('libdvbv5') +subdir('libv4lconvert') +subdir('libv4l2') +subdir('libv4l1') +subdir('libv4l2rds') + +if get_option('v4l-plugins') + subdir('libv4l-mplane') +endif diff --git a/libdvbv5-po/Makevars b/libdvbv5-po/Makevars deleted file mode 100644 index eba76a13..00000000 --- a/libdvbv5-po/Makevars +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile variables for PO directory in any package using GNU gettext. - -# Usually the message domain is the same as the package name. -DOMAIN = $(PACKAGE) - -# These two variables depend on the location of this directory. -subdir = libdvbv5-po -top_builddir = .. - -# These options get passed to xgettext. -XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ --keyword=P_:1,2 - -# This is the copyright holder that gets inserted into the header of the -# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding -# package. (Note that the msgstr strings, extracted from the package's -# sources, belong to the copyright holder of the package.) Translators are -# expected to transfer the copyright for their translations to this person -# or entity, or to disclaim their copyright. The empty string stands for -# the public domain; in this case the translators are expected to disclaim -# their copyright. -COPYRIGHT_HOLDER = Mauro Carvalho Chehab - -# This tells whether or not to prepend "GNU " prefix to the package -# name that gets inserted into the header of the $(DOMAIN).pot file. -# Possible values are "yes", "no", or empty. If it is empty, try to -# detect it automatically by scanning the files in $(top_srcdir) for -# "GNU packagename" string. -PACKAGE_GNU = - -# This is the email address or URL to which the translators shall report -# bugs in the untranslated strings: -# - Strings which are not entire sentences, see the maintainer guidelines -# in the GNU gettext documentation, section 'Preparing Strings'. -# - Strings which use unclear terms or require additional context to be -# understood. -# - Strings which make invalid assumptions about notation of date, time or -# money. -# - Pluralisation problems. -# - Incorrect English spelling. -# - Incorrect formatting. -# It can be your email address, or a mailing list address where translators -# can write to without being subscribed, or the URL of a web page through -# which the translators can contact you. -MSGID_BUGS_ADDRESS = linux-media@vger.Kernel.org - -# This is the list of locale categories, beyond LC_MESSAGES, for which the -# message catalogs shall be used. It is usually empty. -EXTRA_LOCALE_CATEGORIES = - -# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt' -# context. Possible values are "yes" and "no". Set this to yes if the -# package uses functions taking also a message context, like pgettext(), or -# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument. -USE_MSGCTXT = no - -# These options get passed to msgmerge. -# Useful options are in particular: -# --previous to keep previous msgids of translated messages, -# --quiet to reduce the verbosity. -MSGMERGE_OPTIONS = - -# This tells whether or not to regenerate a PO file when $(DOMAIN).pot -# has changed. Possible values are "yes" and "no". Set this to no if -# the POT file is checked in the repository and the version control -# program ignores timestamps. -PO_DEPENDS_ON_POT = yes - -# This tells whether or not to forcibly update $(DOMAIN).pot and -# regenerate PO files on "make dist". Possible values are "yes" and -# "no". Set this to no if the POT file and PO files are maintained -# externally. -DIST_DEPENDS_ON_UPDATE_PO = yes diff --git a/libdvbv5-po/ca.po b/libdvbv5-po/ca.po index 1005811d..8786e121 100644 --- a/libdvbv5-po/ca.po +++ b/libdvbv5-po/ca.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: v4l-utils 1.8.1\n" "Report-Msgid-Bugs-To: linux-media@vger.Kernel.org\n" -"POT-Creation-Date: 2021-10-15 18:41+0200\n" +"POT-Creation-Date: 2023-02-23 09:16+0100\n" "PO-Revision-Date: 2016-03-10 04:31+0000\n" "Last-Translator: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>\n" "Language-Team: Catalan\n" @@ -298,8 +298,8 @@ msgstr "No es pot afegir la propietat %s\n" msgid "Can't add property %d\n" msgstr "No es pot afegir la propietat %s\n" -#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:761 -#: lib/libdvbv5/dvb-file.c:1348 +#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:758 +#: lib/libdvbv5/dvb-file.c:1345 msgid "Allocating memory for dvb_file" msgstr "" @@ -328,7 +328,7 @@ msgstr "" msgid "parameter %s invalid: %s" msgstr "el paràmetre %s no és vàlid: %s" -#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:846 +#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:843 #, c-format msgid "ERROR %s while parsing line %d of %s\n" msgstr "ERROR %s en analitzar la línia %d de %s\n" @@ -363,144 +363,144 @@ msgstr "" msgid "ERROR: %s while parsing entry %d of %s\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:797 +#: lib/libdvbv5/dvb-file.c:794 #, c-format msgid "Missing channel group" msgstr "" -#: lib/libdvbv5/dvb-file.c:810 +#: lib/libdvbv5/dvb-file.c:807 #, c-format msgid "key/value without a channel group" msgstr "" -#: lib/libdvbv5/dvb-file.c:815 +#: lib/libdvbv5/dvb-file.c:812 #, c-format msgid "missing key" msgstr "falta la clau" -#: lib/libdvbv5/dvb-file.c:824 +#: lib/libdvbv5/dvb-file.c:821 #, c-format msgid "missing value" msgstr "falta el valor" -#: lib/libdvbv5/dvb-file.c:832 +#: lib/libdvbv5/dvb-file.c:829 #, c-format msgid "value %s is invalid for %s" msgstr "el valor %s no és vàlid per %s" -#: lib/libdvbv5/dvb-file.c:1227 +#: lib/libdvbv5/dvb-file.c:1224 #, c-format msgid "Channel %s (service ID %d) not found on PMT. Skipping it." msgstr "" -#: lib/libdvbv5/dvb-file.c:1245 +#: lib/libdvbv5/dvb-file.c:1242 msgid "Not enough memory" msgstr "No hi ha memòria suficient" -#: lib/libdvbv5/dvb-file.c:1276 +#: lib/libdvbv5/dvb-file.c:1273 msgid "Couldn't get frontend props" msgstr "" -#: lib/libdvbv5/dvb-file.c:1305 +#: lib/libdvbv5/dvb-file.c:1302 #, c-format msgid "Storing Service ID %d: '%s'" msgstr "" -#: lib/libdvbv5/dvb-file.c:1320 +#: lib/libdvbv5/dvb-file.c:1317 msgid "reserved" msgstr "reservat" -#: lib/libdvbv5/dvb-file.c:1321 +#: lib/libdvbv5/dvb-file.c:1318 msgid "digital television" msgstr "televisió digital" -#: lib/libdvbv5/dvb-file.c:1322 +#: lib/libdvbv5/dvb-file.c:1319 msgid "digital radio" msgstr "ràdio digital" -#: lib/libdvbv5/dvb-file.c:1323 +#: lib/libdvbv5/dvb-file.c:1320 msgid "Teletext" msgstr "Teletext" -#: lib/libdvbv5/dvb-file.c:1324 +#: lib/libdvbv5/dvb-file.c:1321 msgid "NVOD reference" msgstr "Referència NVOD" -#: lib/libdvbv5/dvb-file.c:1325 +#: lib/libdvbv5/dvb-file.c:1322 msgid "NVOD time-shifted" msgstr "" -#: lib/libdvbv5/dvb-file.c:1326 +#: lib/libdvbv5/dvb-file.c:1323 msgid "mosaic" msgstr "mosaic" -#: lib/libdvbv5/dvb-file.c:1327 +#: lib/libdvbv5/dvb-file.c:1324 msgid "PAL coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1328 +#: lib/libdvbv5/dvb-file.c:1325 msgid "SECAM coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1329 +#: lib/libdvbv5/dvb-file.c:1326 msgid "D/D2-MAC" msgstr "D/D2-MAC" -#: lib/libdvbv5/dvb-file.c:1330 +#: lib/libdvbv5/dvb-file.c:1327 msgid "FM Radio" msgstr "Ràdio FM" -#: lib/libdvbv5/dvb-file.c:1331 +#: lib/libdvbv5/dvb-file.c:1328 msgid "NTSC coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1332 +#: lib/libdvbv5/dvb-file.c:1329 msgid "data broadcast" msgstr "redifusió de les dades" -#: lib/libdvbv5/dvb-file.c:1333 +#: lib/libdvbv5/dvb-file.c:1330 msgid "user defined" msgstr "definit de l'usuari" -#: lib/libdvbv5/dvb-file.c:1372 +#: lib/libdvbv5/dvb-file.c:1369 #, c-format msgid "Virtual channel %s, name = %s" msgstr "Canal virtual %s, nom = %s" -#: lib/libdvbv5/dvb-file.c:1401 +#: lib/libdvbv5/dvb-file.c:1398 #, c-format msgid "Service %s, provider %s: %s" msgstr "Servei %s, proveïdor %s: %s" -#: lib/libdvbv5/dvb-file.c:1414 +#: lib/libdvbv5/dvb-file.c:1411 #, c-format msgid "Storing as channel %s" msgstr "S'està emmagatzemat com a canal %s" -#: lib/libdvbv5/dvb-file.c:1457 +#: lib/libdvbv5/dvb-file.c:1454 msgid "WARNING: no SDT table - storing channel(s) without their names" msgstr "" -#: lib/libdvbv5/dvb-file.c:1459 +#: lib/libdvbv5/dvb-file.c:1456 msgid "WARNING: Some Service IDs are not at the SDT table" msgstr "" -#: lib/libdvbv5/dvb-file.c:1488 +#: lib/libdvbv5/dvb-file.c:1485 #, c-format msgid "File format %s is unknown\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1533 +#: lib/libdvbv5/dvb-file.c:1530 #, c-format msgid "ERROR: Delivery system %s is not known. Valid values are:\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1577 +#: lib/libdvbv5/dvb-file.c:1574 #, c-format msgid "Currently, VDR format is supported only for output\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1580 +#: lib/libdvbv5/dvb-file.c:1577 #, c-format msgid "Format is not supported\n" msgstr "El format no està admès\n" diff --git a/libdvbv5-po/de.po b/libdvbv5-po/de.po index a531bce3..31c1a3e6 100644 --- a/libdvbv5-po/de.po +++ b/libdvbv5-po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: v4l-utils 1.12.3\n" "Report-Msgid-Bugs-To: linux-media@vger.Kernel.org\n" -"POT-Creation-Date: 2021-10-15 18:41+0200\n" +"POT-Creation-Date: 2023-02-23 09:16+0100\n" "PO-Revision-Date: 2017-05-06 22:58+0200\n" "Last-Translator: Chris Leick <c.leick@vollbio.de>\n" "Language-Team: German <debian-l10n-german@lists.debian.org>\n" @@ -303,8 +303,8 @@ msgstr "Eigenschaft %s kann nicht hinzugefügt werden.\n" msgid "Can't add property %d\n" msgstr "Eigenschaft %s kann nicht hinzugefügt werden.\n" -#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:761 -#: lib/libdvbv5/dvb-file.c:1348 +#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:758 +#: lib/libdvbv5/dvb-file.c:1345 msgid "Allocating memory for dvb_file" msgstr "Speicher für dvb_file wird reserviert" @@ -333,7 +333,7 @@ msgstr "Parameter %i (%s) fehlt." msgid "parameter %s invalid: %s" msgstr "Parameter %s ungültig: %s" -#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:846 +#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:843 #, c-format msgid "ERROR %s while parsing line %d of %s\n" msgstr "FEHLER %s beim Auswerten der Zeile %d von %s\n" @@ -369,146 +369,146 @@ msgstr "" msgid "ERROR: %s while parsing entry %d of %s\n" msgstr "FEHLER: %s beim Auswerten von Eintrag %d von %s\n" -#: lib/libdvbv5/dvb-file.c:797 +#: lib/libdvbv5/dvb-file.c:794 #, c-format msgid "Missing channel group" msgstr "fehlende Kanalgruppe" -#: lib/libdvbv5/dvb-file.c:810 +#: lib/libdvbv5/dvb-file.c:807 #, c-format msgid "key/value without a channel group" msgstr "Schlüssel/Wert ohne eine Kanalgruppe" -#: lib/libdvbv5/dvb-file.c:815 +#: lib/libdvbv5/dvb-file.c:812 #, c-format msgid "missing key" msgstr "fehlender Schlüssel" -#: lib/libdvbv5/dvb-file.c:824 +#: lib/libdvbv5/dvb-file.c:821 #, c-format msgid "missing value" msgstr "fehlender Wert" -#: lib/libdvbv5/dvb-file.c:832 +#: lib/libdvbv5/dvb-file.c:829 #, c-format msgid "value %s is invalid for %s" msgstr "Wert %s ist für %s ungültig." # PMT = program map table -#: lib/libdvbv5/dvb-file.c:1227 +#: lib/libdvbv5/dvb-file.c:1224 #, c-format msgid "Channel %s (service ID %d) not found on PMT. Skipping it." msgstr "Kanal %s (Dienstkennung %d) nicht in PMT gefunden; wird übersprungen" -#: lib/libdvbv5/dvb-file.c:1245 +#: lib/libdvbv5/dvb-file.c:1242 msgid "Not enough memory" msgstr "Speicherplatz reicht nicht aus" -#: lib/libdvbv5/dvb-file.c:1276 +#: lib/libdvbv5/dvb-file.c:1273 msgid "Couldn't get frontend props" msgstr "Oberflächeneigenschaften konnten nicht geholt werden." -#: lib/libdvbv5/dvb-file.c:1305 +#: lib/libdvbv5/dvb-file.c:1302 #, c-format msgid "Storing Service ID %d: '%s'" msgstr "Dienstkennung %d wird gespeichert: »%s«" -#: lib/libdvbv5/dvb-file.c:1320 +#: lib/libdvbv5/dvb-file.c:1317 msgid "reserved" msgstr "reserviert" -#: lib/libdvbv5/dvb-file.c:1321 +#: lib/libdvbv5/dvb-file.c:1318 msgid "digital television" msgstr "Digitalfernsehen" -#: lib/libdvbv5/dvb-file.c:1322 +#: lib/libdvbv5/dvb-file.c:1319 msgid "digital radio" msgstr "Digitalradio" -#: lib/libdvbv5/dvb-file.c:1323 +#: lib/libdvbv5/dvb-file.c:1320 msgid "Teletext" msgstr "Teletext" # NVoD = Near video on demand -#: lib/libdvbv5/dvb-file.c:1324 +#: lib/libdvbv5/dvb-file.c:1321 msgid "NVOD reference" msgstr "NVoD-Referenz" -#: lib/libdvbv5/dvb-file.c:1325 +#: lib/libdvbv5/dvb-file.c:1322 msgid "NVOD time-shifted" msgstr "NVoD zeitversetzt" -#: lib/libdvbv5/dvb-file.c:1326 +#: lib/libdvbv5/dvb-file.c:1323 msgid "mosaic" msgstr "Mosaik" -#: lib/libdvbv5/dvb-file.c:1327 +#: lib/libdvbv5/dvb-file.c:1324 msgid "PAL coded signal" msgstr "PAL-kodiertes Signal" -#: lib/libdvbv5/dvb-file.c:1328 +#: lib/libdvbv5/dvb-file.c:1325 msgid "SECAM coded signal" msgstr "SECAM-kodiertes Signal" -#: lib/libdvbv5/dvb-file.c:1329 +#: lib/libdvbv5/dvb-file.c:1326 msgid "D/D2-MAC" msgstr "D/D2-MAC" -#: lib/libdvbv5/dvb-file.c:1330 +#: lib/libdvbv5/dvb-file.c:1327 msgid "FM Radio" msgstr "UKW-Radio" -#: lib/libdvbv5/dvb-file.c:1331 +#: lib/libdvbv5/dvb-file.c:1328 msgid "NTSC coded signal" msgstr "NTSC-kodiertes Signal" -#: lib/libdvbv5/dvb-file.c:1332 +#: lib/libdvbv5/dvb-file.c:1329 msgid "data broadcast" msgstr "Datenausstrahlung" -#: lib/libdvbv5/dvb-file.c:1333 +#: lib/libdvbv5/dvb-file.c:1330 msgid "user defined" msgstr "benutzerdefiniert" -#: lib/libdvbv5/dvb-file.c:1372 +#: lib/libdvbv5/dvb-file.c:1369 #, c-format msgid "Virtual channel %s, name = %s" msgstr "virtueller Kanal %s, Name = %s" -#: lib/libdvbv5/dvb-file.c:1401 +#: lib/libdvbv5/dvb-file.c:1398 #, c-format msgid "Service %s, provider %s: %s" msgstr "Dienst %s, Anbieter %s: %s" -#: lib/libdvbv5/dvb-file.c:1414 +#: lib/libdvbv5/dvb-file.c:1411 #, c-format msgid "Storing as channel %s" msgstr "wird als Kanal %s gespeichert" -#: lib/libdvbv5/dvb-file.c:1457 +#: lib/libdvbv5/dvb-file.c:1454 msgid "WARNING: no SDT table - storing channel(s) without their names" msgstr "WARNUNG: keine SDT-Tabelle - Kanalspeicherung ohne Namen" -#: lib/libdvbv5/dvb-file.c:1459 +#: lib/libdvbv5/dvb-file.c:1456 msgid "WARNING: Some Service IDs are not at the SDT table" msgstr "WARNUNG: Einige Dienstkennungen stehen nicht in der SDT-Tabelle." -#: lib/libdvbv5/dvb-file.c:1488 +#: lib/libdvbv5/dvb-file.c:1485 #, c-format msgid "File format %s is unknown\n" msgstr "Dateiformat %s ist unbekannt\n" -#: lib/libdvbv5/dvb-file.c:1533 +#: lib/libdvbv5/dvb-file.c:1530 #, c-format msgid "ERROR: Delivery system %s is not known. Valid values are:\n" msgstr "FEHLER: Übertragungssystem %s ist unbekannt. Gültige Werte sind:\n" -#: lib/libdvbv5/dvb-file.c:1577 +#: lib/libdvbv5/dvb-file.c:1574 #, c-format msgid "Currently, VDR format is supported only for output\n" msgstr "VDR-Format wird derzeit nur für die Ausgabe unterstützt.\n" -#: lib/libdvbv5/dvb-file.c:1580 +#: lib/libdvbv5/dvb-file.c:1577 #, c-format msgid "Format is not supported\n" msgstr "Format wird nicht unterstützt.\n" diff --git a/libdvbv5-po/libdvbv5.pot b/libdvbv5-po/libdvbv5.pot index f49e8108..0f0733d9 100644 --- a/libdvbv5-po/libdvbv5.pot +++ b/libdvbv5-po/libdvbv5.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: v4l-utils 1.21.0\n" +"Project-Id-Version: v4l-utils 1.24.0\n" "Report-Msgid-Bugs-To: linux-media@vger.Kernel.org\n" -"POT-Creation-Date: 2021-10-15 18:41+0200\n" +"POT-Creation-Date: 2023-02-23 09:16+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -300,8 +300,8 @@ msgstr "" msgid "Can't add property %d\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:761 -#: lib/libdvbv5/dvb-file.c:1348 +#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:758 +#: lib/libdvbv5/dvb-file.c:1345 msgid "Allocating memory for dvb_file" msgstr "" @@ -330,7 +330,7 @@ msgstr "" msgid "parameter %s invalid: %s" msgstr "" -#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:846 +#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:843 #, c-format msgid "ERROR %s while parsing line %d of %s\n" msgstr "" @@ -365,144 +365,144 @@ msgstr "" msgid "ERROR: %s while parsing entry %d of %s\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:797 +#: lib/libdvbv5/dvb-file.c:794 #, c-format msgid "Missing channel group" msgstr "" -#: lib/libdvbv5/dvb-file.c:810 +#: lib/libdvbv5/dvb-file.c:807 #, c-format msgid "key/value without a channel group" msgstr "" -#: lib/libdvbv5/dvb-file.c:815 +#: lib/libdvbv5/dvb-file.c:812 #, c-format msgid "missing key" msgstr "" -#: lib/libdvbv5/dvb-file.c:824 +#: lib/libdvbv5/dvb-file.c:821 #, c-format msgid "missing value" msgstr "" -#: lib/libdvbv5/dvb-file.c:832 +#: lib/libdvbv5/dvb-file.c:829 #, c-format msgid "value %s is invalid for %s" msgstr "" -#: lib/libdvbv5/dvb-file.c:1227 +#: lib/libdvbv5/dvb-file.c:1224 #, c-format msgid "Channel %s (service ID %d) not found on PMT. Skipping it." msgstr "" -#: lib/libdvbv5/dvb-file.c:1245 +#: lib/libdvbv5/dvb-file.c:1242 msgid "Not enough memory" msgstr "" -#: lib/libdvbv5/dvb-file.c:1276 +#: lib/libdvbv5/dvb-file.c:1273 msgid "Couldn't get frontend props" msgstr "" -#: lib/libdvbv5/dvb-file.c:1305 +#: lib/libdvbv5/dvb-file.c:1302 #, c-format msgid "Storing Service ID %d: '%s'" msgstr "" -#: lib/libdvbv5/dvb-file.c:1320 +#: lib/libdvbv5/dvb-file.c:1317 msgid "reserved" msgstr "" -#: lib/libdvbv5/dvb-file.c:1321 +#: lib/libdvbv5/dvb-file.c:1318 msgid "digital television" msgstr "" -#: lib/libdvbv5/dvb-file.c:1322 +#: lib/libdvbv5/dvb-file.c:1319 msgid "digital radio" msgstr "" -#: lib/libdvbv5/dvb-file.c:1323 +#: lib/libdvbv5/dvb-file.c:1320 msgid "Teletext" msgstr "" -#: lib/libdvbv5/dvb-file.c:1324 +#: lib/libdvbv5/dvb-file.c:1321 msgid "NVOD reference" msgstr "" -#: lib/libdvbv5/dvb-file.c:1325 +#: lib/libdvbv5/dvb-file.c:1322 msgid "NVOD time-shifted" msgstr "" -#: lib/libdvbv5/dvb-file.c:1326 +#: lib/libdvbv5/dvb-file.c:1323 msgid "mosaic" msgstr "" -#: lib/libdvbv5/dvb-file.c:1327 +#: lib/libdvbv5/dvb-file.c:1324 msgid "PAL coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1328 +#: lib/libdvbv5/dvb-file.c:1325 msgid "SECAM coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1329 +#: lib/libdvbv5/dvb-file.c:1326 msgid "D/D2-MAC" msgstr "" -#: lib/libdvbv5/dvb-file.c:1330 +#: lib/libdvbv5/dvb-file.c:1327 msgid "FM Radio" msgstr "" -#: lib/libdvbv5/dvb-file.c:1331 +#: lib/libdvbv5/dvb-file.c:1328 msgid "NTSC coded signal" msgstr "" -#: lib/libdvbv5/dvb-file.c:1332 +#: lib/libdvbv5/dvb-file.c:1329 msgid "data broadcast" msgstr "" -#: lib/libdvbv5/dvb-file.c:1333 +#: lib/libdvbv5/dvb-file.c:1330 msgid "user defined" msgstr "" -#: lib/libdvbv5/dvb-file.c:1372 +#: lib/libdvbv5/dvb-file.c:1369 #, c-format msgid "Virtual channel %s, name = %s" msgstr "" -#: lib/libdvbv5/dvb-file.c:1401 +#: lib/libdvbv5/dvb-file.c:1398 #, c-format msgid "Service %s, provider %s: %s" msgstr "" -#: lib/libdvbv5/dvb-file.c:1414 +#: lib/libdvbv5/dvb-file.c:1411 #, c-format msgid "Storing as channel %s" msgstr "" -#: lib/libdvbv5/dvb-file.c:1457 +#: lib/libdvbv5/dvb-file.c:1454 msgid "WARNING: no SDT table - storing channel(s) without their names" msgstr "" -#: lib/libdvbv5/dvb-file.c:1459 +#: lib/libdvbv5/dvb-file.c:1456 msgid "WARNING: Some Service IDs are not at the SDT table" msgstr "" -#: lib/libdvbv5/dvb-file.c:1488 +#: lib/libdvbv5/dvb-file.c:1485 #, c-format msgid "File format %s is unknown\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1533 +#: lib/libdvbv5/dvb-file.c:1530 #, c-format msgid "ERROR: Delivery system %s is not known. Valid values are:\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1577 +#: lib/libdvbv5/dvb-file.c:1574 #, c-format msgid "Currently, VDR format is supported only for output\n" msgstr "" -#: lib/libdvbv5/dvb-file.c:1580 +#: lib/libdvbv5/dvb-file.c:1577 #, c-format msgid "Format is not supported\n" msgstr "" diff --git a/libdvbv5-po/meson.build b/libdvbv5-po/meson.build new file mode 100644 index 00000000..e382651e --- /dev/null +++ b/libdvbv5-po/meson.build @@ -0,0 +1,3 @@ +i18n.gettext('libdvbv5', + args : i18n_gettext_arguments, +) diff --git a/libdvbv5-po/pt_BR.po b/libdvbv5-po/pt_BR.po index a8813013..a029d05e 100644 --- a/libdvbv5-po/pt_BR.po +++ b/libdvbv5-po/pt_BR.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: libdvbv5 1.7.0\n" "Report-Msgid-Bugs-To: linux-media@vger.Kernel.org\n" -"POT-Creation-Date: 2021-10-15 18:41+0200\n" +"POT-Creation-Date: 2023-02-23 09:16+0100\n" "PO-Revision-Date: 2017-05-06 23:13-0300\n" "Last-Translator: Mauro Carvalho Chehab <mchehab@kernel.org>\n" "Language-Team: Brazilian Portuguese\n" @@ -309,8 +309,8 @@ msgstr "Não é possível adicionar propriedade %s\n" msgid "Can't add property %d\n" msgstr "Não é possível adicionar propriedade %s\n" -#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:761 -#: lib/libdvbv5/dvb-file.c:1348 +#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:758 +#: lib/libdvbv5/dvb-file.c:1345 msgid "Allocating memory for dvb_file" msgstr "Alocação de memória para dvb_file" @@ -339,7 +339,7 @@ msgstr "parâmetro%i (%s) faltando" msgid "parameter %s invalid: %s" msgstr "parâmetro %s inválido: %s" -#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:846 +#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:843 #, c-format msgid "ERROR %s while parsing line %d of %s\n" msgstr "ERROR %s ao analisar linha %d de %s\n" @@ -374,145 +374,145 @@ msgstr "propriedade %s não é suportada durante a análise de entrada %d de %s\ msgid "ERROR: %s while parsing entry %d of %s\n" msgstr "ERRO: %s ao analisar a entrada %d de %s\n" -#: lib/libdvbv5/dvb-file.c:797 +#: lib/libdvbv5/dvb-file.c:794 #, c-format msgid "Missing channel group" msgstr "Faltando grupo de canais" -#: lib/libdvbv5/dvb-file.c:810 +#: lib/libdvbv5/dvb-file.c:807 #, c-format msgid "key/value without a channel group" msgstr "chave/valor sem grupo de canais" -#: lib/libdvbv5/dvb-file.c:815 +#: lib/libdvbv5/dvb-file.c:812 #, c-format msgid "missing key" msgstr "falta chave" -#: lib/libdvbv5/dvb-file.c:824 +#: lib/libdvbv5/dvb-file.c:821 #, c-format msgid "missing value" msgstr "falta valor" -#: lib/libdvbv5/dvb-file.c:832 +#: lib/libdvbv5/dvb-file.c:829 #, c-format msgid "value %s is invalid for %s" msgstr "valor %s é inválido para %s" -#: lib/libdvbv5/dvb-file.c:1227 +#: lib/libdvbv5/dvb-file.c:1224 #, c-format msgid "Channel %s (service ID %d) not found on PMT. Skipping it." msgstr "Canal %s (serviço de ID %d) não foi encontrado na PMT. Ignorando." -#: lib/libdvbv5/dvb-file.c:1245 +#: lib/libdvbv5/dvb-file.c:1242 msgid "Not enough memory" msgstr "Memória insuficiente" -#: lib/libdvbv5/dvb-file.c:1276 +#: lib/libdvbv5/dvb-file.c:1273 msgid "Couldn't get frontend props" msgstr "Não foi possível obter propriedades do frontend" -#: lib/libdvbv5/dvb-file.c:1305 +#: lib/libdvbv5/dvb-file.c:1302 #, c-format msgid "Storing Service ID %d: '%s'" msgstr "Armazenando Serviço ID %d: '%s'" -#: lib/libdvbv5/dvb-file.c:1320 +#: lib/libdvbv5/dvb-file.c:1317 msgid "reserved" msgstr "reservado" -#: lib/libdvbv5/dvb-file.c:1321 +#: lib/libdvbv5/dvb-file.c:1318 msgid "digital television" msgstr "televisão digital" -#: lib/libdvbv5/dvb-file.c:1322 +#: lib/libdvbv5/dvb-file.c:1319 msgid "digital radio" msgstr "rádio digital" -#: lib/libdvbv5/dvb-file.c:1323 +#: lib/libdvbv5/dvb-file.c:1320 msgid "Teletext" msgstr "Teletexto" -#: lib/libdvbv5/dvb-file.c:1324 +#: lib/libdvbv5/dvb-file.c:1321 msgid "NVOD reference" msgstr "NVOD referência" -#: lib/libdvbv5/dvb-file.c:1325 +#: lib/libdvbv5/dvb-file.c:1322 msgid "NVOD time-shifted" msgstr "NVOD com time-shift" -#: lib/libdvbv5/dvb-file.c:1326 +#: lib/libdvbv5/dvb-file.c:1323 msgid "mosaic" msgstr "mosaico" -#: lib/libdvbv5/dvb-file.c:1327 +#: lib/libdvbv5/dvb-file.c:1324 msgid "PAL coded signal" msgstr "Sinal codificado PAL" -#: lib/libdvbv5/dvb-file.c:1328 +#: lib/libdvbv5/dvb-file.c:1325 msgid "SECAM coded signal" msgstr "Sinal codificado SECAM" -#: lib/libdvbv5/dvb-file.c:1329 +#: lib/libdvbv5/dvb-file.c:1326 msgid "D/D2-MAC" msgstr "D/D2-MAC" -#: lib/libdvbv5/dvb-file.c:1330 +#: lib/libdvbv5/dvb-file.c:1327 msgid "FM Radio" msgstr "Rádio FM" -#: lib/libdvbv5/dvb-file.c:1331 +#: lib/libdvbv5/dvb-file.c:1328 msgid "NTSC coded signal" msgstr "Sinal codificado NTSC" -#: lib/libdvbv5/dvb-file.c:1332 +#: lib/libdvbv5/dvb-file.c:1329 msgid "data broadcast" msgstr "transmissão de dados" -#: lib/libdvbv5/dvb-file.c:1333 +#: lib/libdvbv5/dvb-file.c:1330 msgid "user defined" msgstr "definido pelo usuário" -#: lib/libdvbv5/dvb-file.c:1372 +#: lib/libdvbv5/dvb-file.c:1369 #, c-format msgid "Virtual channel %s, name = %s" msgstr "Canal virtual %s, nome = %s" -#: lib/libdvbv5/dvb-file.c:1401 +#: lib/libdvbv5/dvb-file.c:1398 #, c-format msgid "Service %s, provider %s: %s" msgstr "Serviço %s, prestador %s: %s" -#: lib/libdvbv5/dvb-file.c:1414 +#: lib/libdvbv5/dvb-file.c:1411 #, c-format msgid "Storing as channel %s" msgstr "Armazenar como canal %s" -#: lib/libdvbv5/dvb-file.c:1457 +#: lib/libdvbv5/dvb-file.c:1454 msgid "WARNING: no SDT table - storing channel(s) without their names" msgstr "AVISO: nenhuma tabela SDT - armazenando canal(s), sem os seus nomes" -#: lib/libdvbv5/dvb-file.c:1459 +#: lib/libdvbv5/dvb-file.c:1456 msgid "WARNING: Some Service IDs are not at the SDT table" msgstr "AVISO: Alguns identificadores de serviço não estão na tabela SDT" -#: lib/libdvbv5/dvb-file.c:1488 +#: lib/libdvbv5/dvb-file.c:1485 #, c-format msgid "File format %s is unknown\n" msgstr "Formato de arquivo %s é desconhecido\n" -#: lib/libdvbv5/dvb-file.c:1533 +#: lib/libdvbv5/dvb-file.c:1530 #, c-format msgid "ERROR: Delivery system %s is not known. Valid values are:\n" msgstr "" "ERRO: sistema de TV digital %s não é conhecido. Os valores válidos são:\n" -#: lib/libdvbv5/dvb-file.c:1577 +#: lib/libdvbv5/dvb-file.c:1574 #, c-format msgid "Currently, VDR format is supported only for output\n" msgstr "Atualmente, o formato VDR é suportado apenas para a saída\n" -#: lib/libdvbv5/dvb-file.c:1580 +#: lib/libdvbv5/dvb-file.c:1577 #, c-format msgid "Format is not supported\n" msgstr "Formato não é suportado\n" diff --git a/libdvbv5-po/uk.po b/libdvbv5-po/uk.po index 66ab097c..8e447672 100644 --- a/libdvbv5-po/uk.po +++ b/libdvbv5-po/uk.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: v4l-utils 1.8.1\n" "Report-Msgid-Bugs-To: linux-media@vger.Kernel.org\n" -"POT-Creation-Date: 2021-10-15 18:41+0200\n" +"POT-Creation-Date: 2023-02-23 09:16+0100\n" "PO-Revision-Date: 2015-12-30 10:00+0000\n" "Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n" "Language-Team: Ukrainian <kde-i18n-uk@kde.org>\n" @@ -13,8 +13,8 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Zanata 4.6.2\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" #: lib/libdvbv5/dvb-fe.c:151 #, c-format @@ -308,8 +308,8 @@ msgstr "Не вдалося додати властивість %s\n" msgid "Can't add property %d\n" msgstr "Не вдалося додати властивість %s\n" -#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:761 -#: lib/libdvbv5/dvb-file.c:1348 +#: lib/libdvbv5/dvb-file.c:245 lib/libdvbv5/dvb-file.c:758 +#: lib/libdvbv5/dvb-file.c:1345 msgid "Allocating memory for dvb_file" msgstr "Отримуємо пам’ять під dvb_file" @@ -338,7 +338,7 @@ msgstr "пропущено параметр %i (%s)" msgid "parameter %s invalid: %s" msgstr "некоректний параметр %s: %s" -#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:846 +#: lib/libdvbv5/dvb-file.c:387 lib/libdvbv5/dvb-file.c:843 #, c-format msgid "ERROR %s while parsing line %d of %s\n" msgstr "ПОМИЛКА %s під час обробки рядка %d з %s\n" @@ -377,148 +377,148 @@ msgstr "не передбачена властивість %s під час об msgid "ERROR: %s while parsing entry %d of %s\n" msgstr "ПОМИЛКА %s під час обробки запису %d з %s\n" -#: lib/libdvbv5/dvb-file.c:797 +#: lib/libdvbv5/dvb-file.c:794 #, c-format msgid "Missing channel group" msgstr "Пропущено групу каналів" -#: lib/libdvbv5/dvb-file.c:810 +#: lib/libdvbv5/dvb-file.c:807 #, c-format msgid "key/value without a channel group" msgstr "ключ/значення без групи каналів" -#: lib/libdvbv5/dvb-file.c:815 +#: lib/libdvbv5/dvb-file.c:812 #, c-format msgid "missing key" msgstr "не вказано ключ" -#: lib/libdvbv5/dvb-file.c:824 +#: lib/libdvbv5/dvb-file.c:821 #, c-format msgid "missing value" msgstr "не вистачає значення" -#: lib/libdvbv5/dvb-file.c:832 +#: lib/libdvbv5/dvb-file.c:829 #, c-format msgid "value %s is invalid for %s" msgstr "значення %s є некоректним для %s" -#: lib/libdvbv5/dvb-file.c:1227 +#: lib/libdvbv5/dvb-file.c:1224 #, c-format msgid "Channel %s (service ID %d) not found on PMT. Skipping it." msgstr "" "Канал %s (ідентифікатор служби %d) у PMT не знайдено. Пропускаємо його." -#: lib/libdvbv5/dvb-file.c:1245 +#: lib/libdvbv5/dvb-file.c:1242 msgid "Not enough memory" msgstr "Не вистачає пам'яті" -#: lib/libdvbv5/dvb-file.c:1276 +#: lib/libdvbv5/dvb-file.c:1273 msgid "Couldn't get frontend props" msgstr "Не вдалося отримати властивості інтерфейсу виведення" -#: lib/libdvbv5/dvb-file.c:1305 +#: lib/libdvbv5/dvb-file.c:1302 #, c-format msgid "Storing Service ID %d: '%s'" msgstr "Зберігаємо ідентифікатор служби %d: «%s»" -#: lib/libdvbv5/dvb-file.c:1320 +#: lib/libdvbv5/dvb-file.c:1317 msgid "reserved" msgstr "зарезервовано" -#: lib/libdvbv5/dvb-file.c:1321 +#: lib/libdvbv5/dvb-file.c:1318 msgid "digital television" msgstr "цифрове телебачення" -#: lib/libdvbv5/dvb-file.c:1322 +#: lib/libdvbv5/dvb-file.c:1319 msgid "digital radio" msgstr "цифрове радіо" -#: lib/libdvbv5/dvb-file.c:1323 +#: lib/libdvbv5/dvb-file.c:1320 msgid "Teletext" msgstr "Телетекст" -#: lib/libdvbv5/dvb-file.c:1324 +#: lib/libdvbv5/dvb-file.c:1321 msgid "NVOD reference" msgstr "Еталонне NVOD" -#: lib/libdvbv5/dvb-file.c:1325 +#: lib/libdvbv5/dvb-file.c:1322 msgid "NVOD time-shifted" msgstr "NVOD із часовим зсувом" -#: lib/libdvbv5/dvb-file.c:1326 +#: lib/libdvbv5/dvb-file.c:1323 msgid "mosaic" msgstr "мозаїка" -#: lib/libdvbv5/dvb-file.c:1327 +#: lib/libdvbv5/dvb-file.c:1324 msgid "PAL coded signal" msgstr "Сигнал, закодований у PAL" -#: lib/libdvbv5/dvb-file.c:1328 +#: lib/libdvbv5/dvb-file.c:1325 msgid "SECAM coded signal" msgstr "Сигнал, закодований у SECAM" -#: lib/libdvbv5/dvb-file.c:1329 +#: lib/libdvbv5/dvb-file.c:1326 msgid "D/D2-MAC" msgstr "D/D2-MAC" -#: lib/libdvbv5/dvb-file.c:1330 +#: lib/libdvbv5/dvb-file.c:1327 msgid "FM Radio" msgstr "FM-радіо" -#: lib/libdvbv5/dvb-file.c:1331 +#: lib/libdvbv5/dvb-file.c:1328 msgid "NTSC coded signal" msgstr "Сигнал, закодований у NTSC" -#: lib/libdvbv5/dvb-file.c:1332 +#: lib/libdvbv5/dvb-file.c:1329 msgid "data broadcast" msgstr "трансляція даних" -#: lib/libdvbv5/dvb-file.c:1333 +#: lib/libdvbv5/dvb-file.c:1330 msgid "user defined" msgstr "визначений користувачем" -#: lib/libdvbv5/dvb-file.c:1372 +#: lib/libdvbv5/dvb-file.c:1369 #, c-format msgid "Virtual channel %s, name = %s" msgstr "Віртуальний канал %s, назва = %s" -#: lib/libdvbv5/dvb-file.c:1401 +#: lib/libdvbv5/dvb-file.c:1398 #, c-format msgid "Service %s, provider %s: %s" msgstr "Служба %s, постачальник даних %s: %s" -#: lib/libdvbv5/dvb-file.c:1414 +#: lib/libdvbv5/dvb-file.c:1411 #, c-format msgid "Storing as channel %s" msgstr "Зберігаємо як канал %s" -#: lib/libdvbv5/dvb-file.c:1457 +#: lib/libdvbv5/dvb-file.c:1454 msgid "WARNING: no SDT table - storing channel(s) without their names" msgstr "ПОПЕРЕДЖЕННЯ: немає таблиці SDT — зберігаємо записи каналів без назв" -#: lib/libdvbv5/dvb-file.c:1459 +#: lib/libdvbv5/dvb-file.c:1456 msgid "WARNING: Some Service IDs are not at the SDT table" msgstr "" -#: lib/libdvbv5/dvb-file.c:1488 +#: lib/libdvbv5/dvb-file.c:1485 #, c-format msgid "File format %s is unknown\n" msgstr "Невідомий формат файла %s\n" -#: lib/libdvbv5/dvb-file.c:1533 +#: lib/libdvbv5/dvb-file.c:1530 #, c-format msgid "ERROR: Delivery system %s is not known. Valid values are:\n" msgstr "" "ПОМИЛКА: невідома система надання даних %s. Коректними значеннями є такі:\n" -#: lib/libdvbv5/dvb-file.c:1577 +#: lib/libdvbv5/dvb-file.c:1574 #, c-format msgid "Currently, VDR format is supported only for output\n" msgstr "" "У поточній версії підтримку формату VDR передбачено лише для виведення " "даних\n" -#: lib/libdvbv5/dvb-file.c:1580 +#: lib/libdvbv5/dvb-file.c:1577 #, c-format msgid "Format is not supported\n" msgstr "Підтримки цього формату не передбачено\n" diff --git a/m4/ac_define_dir.m4 b/m4/ac_define_dir.m4 deleted file mode 100644 index e15cea2c..00000000 --- a/m4/ac_define_dir.m4 +++ /dev/null @@ -1,34 +0,0 @@ -dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) -dnl -dnl This macro sets VARNAME to the expansion of the DIR variable, -dnl taking care of fixing up ${prefix} and such. -dnl -dnl VARNAME is then offered as both an output variable and a C -dnl preprocessor symbol. -dnl -dnl Example: -dnl -dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) -dnl -dnl @category Misc -dnl @author Stepan Kasal <kasal@ucw.cz> -dnl @author Andreas Schwab <schwab@suse.de> -dnl @author Guido U. Draheim <guidod@gmx.de> -dnl @author Alexandre Oliva -dnl @version 2006-10-13 -dnl @license AllPermissive - -AC_DEFUN([AC_DEFINE_DIR], [ - prefix_NONE= - exec_prefix_NONE= - test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix - test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix -dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn -dnl refers to ${prefix}. Thus we have to use `eval' twice. - eval ac_define_dir="\"[$]$2\"" - eval ac_define_dir="\"$ac_define_dir\"" - AC_SUBST($1, "$ac_define_dir") - AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) - test "$prefix_NONE" && prefix=NONE - test "$exec_prefix_NONE" && exec_prefix=NONE -]) diff --git a/m4/ax_prog_doxygen.m4 b/m4/ax_prog_doxygen.m4 deleted file mode 100644 index 44b22b00..00000000 --- a/m4/ax_prog_doxygen.m4 +++ /dev/null @@ -1,532 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_prog_doxygen.html -# =========================================================================== -# -# SYNOPSIS -# -# DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR]) -# DX_DOXYGEN_FEATURE(ON|OFF) -# DX_DOT_FEATURE(ON|OFF) -# DX_HTML_FEATURE(ON|OFF) -# DX_CHM_FEATURE(ON|OFF) -# DX_CHI_FEATURE(ON|OFF) -# DX_MAN_FEATURE(ON|OFF) -# DX_RTF_FEATURE(ON|OFF) -# DX_XML_FEATURE(ON|OFF) -# DX_PDF_FEATURE(ON|OFF) -# DX_PS_FEATURE(ON|OFF) -# -# DESCRIPTION -# -# The DX_*_FEATURE macros control the default setting for the given -# Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for -# generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML -# help (for MS users), 'CHI' for generating a seperate .chi file by the -# .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate -# output formats. The environment variable DOXYGEN_PAPER_SIZE may be -# specified to override the default 'a4wide' paper size. -# -# By default, HTML, PDF and PS documentation is generated as this seems to -# be the most popular and portable combination. MAN pages created by -# Doxygen are usually problematic, though by picking an appropriate subset -# and doing some massaging they might be better than nothing. CHM and RTF -# are specific for MS (note that you can't generate both HTML and CHM at -# the same time). The XML is rather useless unless you apply specialized -# post-processing to it. -# -# The macros mainly control the default state of the feature. The use can -# override the default by specifying --enable or --disable. The macros -# ensure that contradictory flags are not given (e.g., -# --enable-doxygen-html and --enable-doxygen-chm, -# --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each -# feature will be automatically disabled (with a warning) if the required -# programs are missing. -# -# Once all the feature defaults have been specified, call DX_INIT_DOXYGEN -# with the following parameters: a one-word name for the project for use -# as a filename base etc., an optional configuration file name (the -# default is 'Doxyfile', the same as Doxygen's default), and an optional -# output directory name (the default is 'doxygen-doc'). -# -# Automake Support -# -# The following is a template aminclude.am file for use with Automake. -# Make targets and variables values are controlled by the various -# DX_COND_* conditionals set by autoconf. -# -# The provided targets are: -# -# doxygen-doc: Generate all doxygen documentation. -# -# doxygen-run: Run doxygen, which will generate some of the -# documentation (HTML, CHM, CHI, MAN, RTF, XML) -# but will not do the post processing required -# for the rest of it (PS, PDF, and some MAN). -# -# doxygen-man: Rename some doxygen generated man pages. -# -# doxygen-ps: Generate doxygen PostScript documentation. -# -# doxygen-pdf: Generate doxygen PDF documentation. -# -# Note that by default these are not integrated into the automake targets. -# If doxygen is used to generate man pages, you can achieve this -# integration by setting man3_MANS to the list of man pages generated and -# then adding the dependency: -# -# $(man3_MANS): doxygen-doc -# -# This will cause make to run doxygen and generate all the documentation. -# -# The following variable is intended for use in Makefile.am: -# -# DX_CLEANFILES = everything to clean. -# -# Then add this variable to MOSTLYCLEANFILES. -# -# ----- begin aminclude.am ------------------------------------- -# -# ## --------------------------------- ## -# ## Format-independent Doxygen rules. ## -# ## --------------------------------- ## -# -# if DX_COND_doc -# -# ## ------------------------------- ## -# ## Rules specific for HTML output. ## -# ## ------------------------------- ## -# -# if DX_COND_html -# -# DX_CLEAN_HTML = @DX_DOCDIR@/html -# -# endif DX_COND_html -# -# ## ------------------------------ ## -# ## Rules specific for CHM output. ## -# ## ------------------------------ ## -# -# if DX_COND_chm -# -# DX_CLEAN_CHM = @DX_DOCDIR@/chm -# -# if DX_COND_chi -# -# DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi -# -# endif DX_COND_chi -# -# endif DX_COND_chm -# -# ## ------------------------------ ## -# ## Rules specific for MAN output. ## -# ## ------------------------------ ## -# -# if DX_COND_man -# -# DX_CLEAN_MAN = @DX_DOCDIR@/man -# -# endif DX_COND_man -# -# ## ------------------------------ ## -# ## Rules specific for RTF output. ## -# ## ------------------------------ ## -# -# if DX_COND_rtf -# -# DX_CLEAN_RTF = @DX_DOCDIR@/rtf -# -# endif DX_COND_rtf -# -# ## ------------------------------ ## -# ## Rules specific for XML output. ## -# ## ------------------------------ ## -# -# if DX_COND_xml -# -# DX_CLEAN_XML = @DX_DOCDIR@/xml -# -# endif DX_COND_xml -# -# ## ----------------------------- ## -# ## Rules specific for PS output. ## -# ## ----------------------------- ## -# -# if DX_COND_ps -# -# DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps -# -# DX_PS_GOAL = doxygen-ps -# -# doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps -# -# @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag -# cd @DX_DOCDIR@/latex; \ -# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \ -# $(DX_LATEX) refman.tex; \ -# $(MAKEINDEX_PATH) refman.idx; \ -# $(DX_LATEX) refman.tex; \ -# countdown=5; \ -# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \ -# refman.log > /dev/null 2>&1 \ -# && test $$countdown -gt 0; do \ -# $(DX_LATEX) refman.tex; \ -# countdown=`expr $$countdown - 1`; \ -# done; \ -# $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi -# -# endif DX_COND_ps -# -# ## ------------------------------ ## -# ## Rules specific for PDF output. ## -# ## ------------------------------ ## -# -# if DX_COND_pdf -# -# DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf -# -# DX_PDF_GOAL = doxygen-pdf -# -# doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf -# -# @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag -# cd @DX_DOCDIR@/latex; \ -# rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \ -# $(DX_PDFLATEX) refman.tex; \ -# $(DX_MAKEINDEX) refman.idx; \ -# $(DX_PDFLATEX) refman.tex; \ -# countdown=5; \ -# while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \ -# refman.log > /dev/null 2>&1 \ -# && test $$countdown -gt 0; do \ -# $(DX_PDFLATEX) refman.tex; \ -# countdown=`expr $$countdown - 1`; \ -# done; \ -# mv refman.pdf ../@PACKAGE@.pdf -# -# endif DX_COND_pdf -# -# ## ------------------------------------------------- ## -# ## Rules specific for LaTeX (shared for PS and PDF). ## -# ## ------------------------------------------------- ## -# -# if DX_COND_latex -# -# DX_CLEAN_LATEX = @DX_DOCDIR@/latex -# -# endif DX_COND_latex -# -# .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL) -# -# .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL) -# -# doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag -# -# doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL) -# -# @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS) -# rm -rf @DX_DOCDIR@ -# $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG) -# -# DX_CLEANFILES = \ -# @DX_DOCDIR@/@PACKAGE@.tag \ -# -r \ -# $(DX_CLEAN_HTML) \ -# $(DX_CLEAN_CHM) \ -# $(DX_CLEAN_CHI) \ -# $(DX_CLEAN_MAN) \ -# $(DX_CLEAN_RTF) \ -# $(DX_CLEAN_XML) \ -# $(DX_CLEAN_PS) \ -# $(DX_CLEAN_PDF) \ -# $(DX_CLEAN_LATEX) -# -# endif DX_COND_doc -# -# ----- end aminclude.am --------------------------------------- -# -# LICENSE -# -# Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 12 - -## ----------## -## Defaults. ## -## ----------## - -DX_ENV="" -AC_DEFUN([DX_FEATURE_doc], ON) -AC_DEFUN([DX_FEATURE_dot], OFF) -AC_DEFUN([DX_FEATURE_man], OFF) -AC_DEFUN([DX_FEATURE_html], ON) -AC_DEFUN([DX_FEATURE_chm], OFF) -AC_DEFUN([DX_FEATURE_chi], OFF) -AC_DEFUN([DX_FEATURE_rtf], OFF) -AC_DEFUN([DX_FEATURE_xml], OFF) -AC_DEFUN([DX_FEATURE_pdf], ON) -AC_DEFUN([DX_FEATURE_ps], ON) - -## --------------- ## -## Private macros. ## -## --------------- ## - -# DX_ENV_APPEND(VARIABLE, VALUE) -# ------------------------------ -# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen. -AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])]) - -# DX_DIRNAME_EXPR -# --------------- -# Expand into a shell expression prints the directory part of a path. -AC_DEFUN([DX_DIRNAME_EXPR], - [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']]) - -# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF) -# ------------------------------------- -# Expands according to the M4 (static) status of the feature. -AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])]) - -# DX_REQUIRE_PROG(VARIABLE, PROGRAM) -# ---------------------------------- -# Require the specified program to be found for the DX_CURRENT_FEATURE to work. -AC_DEFUN([DX_REQUIRE_PROG], [ -AC_PATH_TOOL([$1], [$2]) -if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then - AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION]) - AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -fi -]) - -# DX_TEST_FEATURE(FEATURE) -# ------------------------ -# Expand to a shell expression testing whether the feature is active. -AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1]) - -# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE) -# ------------------------------------------------- -# Verify that a required features has the right state before trying to turn on -# the DX_CURRENT_FEATURE. -AC_DEFUN([DX_CHECK_DEPEND], [ -test "$DX_FLAG_$1" = "$2" \ -|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1, - requires, contradicts) doxygen-DX_CURRENT_FEATURE]) -]) - -# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE) -# ---------------------------------------------------------- -# Turn off the DX_CURRENT_FEATURE if the required feature is off. -AC_DEFUN([DX_CLEAR_DEPEND], [ -test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0) -]) - -# DX_FEATURE_ARG(FEATURE, DESCRIPTION, -# CHECK_DEPEND, CLEAR_DEPEND, -# REQUIRE, DO-IF-ON, DO-IF-OFF) -# -------------------------------------------- -# Parse the command-line option controlling a feature. CHECK_DEPEND is called -# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND), -# otherwise CLEAR_DEPEND is called to turn off the default state if a required -# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional -# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and -# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature. -AC_DEFUN([DX_ARG_ABLE], [ - AC_DEFUN([DX_CURRENT_FEATURE], [$1]) - AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2]) - AC_ARG_ENABLE(doxygen-$1, - [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1], - [--enable-doxygen-$1]), - DX_IF_FEATURE([$1], [don't $2], [$2]))], - [ -case "$enableval" in -#( -y|Y|yes|Yes|YES) - AC_SUBST([DX_FLAG_$1], 1) - $3 -;; #( -n|N|no|No|NO) - AC_SUBST([DX_FLAG_$1], 0) -;; #( -*) - AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1]) -;; -esac -], [ -AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)]) -$4 -]) -if DX_TEST_FEATURE([$1]); then - $5 - : -fi -AM_CONDITIONAL(DX_COND_$1, DX_TEST_FEATURE([$1])) -if DX_TEST_FEATURE([$1]); then - $6 - : -else - $7 - : -fi -]) - -## -------------- ## -## Public macros. ## -## -------------- ## - -# DX_XXX_FEATURE(DEFAULT_STATE) -# ----------------------------- -AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc], [$1])]) -AC_DEFUN([DX_DOT_FEATURE], [AC_DEFUN([DX_FEATURE_dot], [$1])]) -AC_DEFUN([DX_MAN_FEATURE], [AC_DEFUN([DX_FEATURE_man], [$1])]) -AC_DEFUN([DX_HTML_FEATURE], [AC_DEFUN([DX_FEATURE_html], [$1])]) -AC_DEFUN([DX_CHM_FEATURE], [AC_DEFUN([DX_FEATURE_chm], [$1])]) -AC_DEFUN([DX_CHI_FEATURE], [AC_DEFUN([DX_FEATURE_chi], [$1])]) -AC_DEFUN([DX_RTF_FEATURE], [AC_DEFUN([DX_FEATURE_rtf], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_XML_FEATURE], [AC_DEFUN([DX_FEATURE_xml], [$1])]) -AC_DEFUN([DX_PDF_FEATURE], [AC_DEFUN([DX_FEATURE_pdf], [$1])]) -AC_DEFUN([DX_PS_FEATURE], [AC_DEFUN([DX_FEATURE_ps], [$1])]) - -# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR]) -# --------------------------------------------------------- -# PROJECT also serves as the base name for the documentation files. -# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc". -AC_DEFUN([DX_INIT_DOXYGEN], [ - -# Files: -AC_SUBST([DX_PROJECT], [$1]) -AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])]) -AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])]) - -# Environment variables used inside doxygen.cfg: -DX_ENV_APPEND(SRCDIR, $srcdir) -DX_ENV_APPEND(PROJECT, $DX_PROJECT) -DX_ENV_APPEND(DOCDIR, $DX_DOCDIR) -DX_ENV_APPEND(VERSION, $PACKAGE_VERSION) - -# Doxygen itself: -DX_ARG_ABLE(doc, [generate any doxygen documentation], - [], - [], - [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen) - DX_REQUIRE_PROG([DX_PERL], perl)], - [DX_ENV_APPEND(PERL_PATH, $DX_PERL)]) - -# Dot for graphics: -DX_ARG_ABLE(dot, [generate graphics for doxygen documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_DOT], dot)], - [DX_ENV_APPEND(HAVE_DOT, YES) - DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])], - [DX_ENV_APPEND(HAVE_DOT, NO)]) - -# Man pages generation: -DX_ARG_ABLE(man, [generate doxygen manual pages], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_MAN, YES)], - [DX_ENV_APPEND(GENERATE_MAN, NO)]) - -# RTF file generation: -DX_ARG_ABLE(rtf, [generate doxygen RTF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_RTF, YES)], - [DX_ENV_APPEND(GENERATE_RTF, NO)]) - -# XML file generation: -DX_ARG_ABLE(xml, [generate doxygen XML documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [], - [DX_ENV_APPEND(GENERATE_XML, YES)], - [DX_ENV_APPEND(GENERATE_XML, NO)]) - -# (Compressed) HTML help generation: -DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_HHC], hhc)], - [DX_ENV_APPEND(HHC_PATH, $DX_HHC) - DX_ENV_APPEND(GENERATE_HTML, YES) - DX_ENV_APPEND(GENERATE_HTMLHELP, YES)], - [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)]) - -# Seperate CHI file generation. -DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file], - [DX_CHECK_DEPEND(chm, 1)], - [DX_CLEAR_DEPEND(chm, 1)], - [], - [DX_ENV_APPEND(GENERATE_CHI, YES)], - [DX_ENV_APPEND(GENERATE_CHI, NO)]) - -# Plain HTML pages generation: -DX_ARG_ABLE(html, [generate doxygen plain HTML documentation], - [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)], - [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)], - [], - [DX_ENV_APPEND(GENERATE_HTML, YES)], - [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)]) - -# PostScript file generation: -DX_ARG_ABLE(ps, [generate doxygen PostScript documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_LATEX], latex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_DVIPS], dvips) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# PDF file generation: -DX_ARG_ABLE(pdf, [generate doxygen PDF documentation], - [DX_CHECK_DEPEND(doc, 1)], - [DX_CLEAR_DEPEND(doc, 1)], - [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex) - DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex) - DX_REQUIRE_PROG([DX_EGREP], egrep)]) - -# LaTeX generation for PS and/or PDF: -AM_CONDITIONAL(DX_COND_latex, DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf)) -if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then - DX_ENV_APPEND(GENERATE_LATEX, YES) -else - DX_ENV_APPEND(GENERATE_LATEX, NO) -fi - -# Paper size for PS and/or PDF: -AC_ARG_VAR(DOXYGEN_PAPER_SIZE, - [a4wide (default), a4, letter, legal or executive]) -case "$DOXYGEN_PAPER_SIZE" in -#( -"") - AC_SUBST(DOXYGEN_PAPER_SIZE, "") -;; #( -a4wide|a4|letter|legal|executive) - DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE) -;; #( -*) - AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE']) -;; -esac - -#For debugging: -#echo DX_FLAG_doc=$DX_FLAG_doc -#echo DX_FLAG_dot=$DX_FLAG_dot -#echo DX_FLAG_man=$DX_FLAG_man -#echo DX_FLAG_html=$DX_FLAG_html -#echo DX_FLAG_chm=$DX_FLAG_chm -#echo DX_FLAG_chi=$DX_FLAG_chi -#echo DX_FLAG_rtf=$DX_FLAG_rtf -#echo DX_FLAG_xml=$DX_FLAG_xml -#echo DX_FLAG_pdf=$DX_FLAG_pdf -#echo DX_FLAG_ps=$DX_FLAG_ps -#echo DX_ENV=$DX_ENV -]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 deleted file mode 100644 index 9f35d139..00000000 --- a/m4/ax_pthread.m4 +++ /dev/null @@ -1,522 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is -# needed for multi-threaded programs (defaults to the value of CC -# respectively CXX otherwise). (This is necessary on e.g. AIX to use the -# special cc_r/CC_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also to link with them as well. For example, you might link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threaded programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# CXX="$PTHREAD_CXX" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> -# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> -# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <https://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 31 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_SED]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on Tru64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items with a "," contain both -# C compiler flags (before ",") and linker flags (after ","). Other items -# starting with a "-" are C compiler flags, and remaining items are -# library names, except for "none" which indicates that we try without -# any flags at all, and "pthread-config" which is a program returning -# the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 -# (Note: HP C rejects this with "bad form for `-t' option") -# -pthreads: Solaris/gcc (Note: HP C also rejects) -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads and -# -D_REENTRANT too), HP C (must be checked before -lpthread, which -# is present but should not be used directly; and before -mthreads, -# because the compiler interprets this as "-mt" + "-hreads") -# -mthreads: Mingw32/gcc, Lynx/gcc -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case $host_os in - - freebsd*) - - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; - - hpux*) - - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." - - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; - - openedition*) - - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) - - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; - - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). - - ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags" - ;; -esac - -# Are we compiling with Clang? - -AC_CACHE_CHECK([whether $CC is Clang], - [ax_cv_PTHREAD_CLANG], - [ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) - fi - ]) -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" - - -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - -# Note that for GCC and Clang -pthread generally implies -lpthread, -# except when -nostdlib is passed. -# This is problematic using libtool to build C++ shared libraries with pthread: -# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460 -# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333 -# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555 -# To solve this, first try -pthread together with -lpthread for GCC - -AS_IF([test "x$GCC" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"]) - -# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first - -AS_IF([test "x$ax_pthread_clang" = "xyes"], - [ax_pthread_flags="-pthread,-lpthread -pthread"]) - - -# The presence of a feature test macro requesting re-entrant function -# definitions is, on some systems, a strong hint that pthreads support is -# correctly enabled - -case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; - - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; - - *) - ax_pthread_check_macro="--" - ;; -esac -AS_IF([test "x$ax_pthread_check_macro" = "x--"], - [ax_pthread_check_cond=0], - [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) - - -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - *,*) - PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"` - PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"` - AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void *some_global = NULL; - static void routine(void *a) - { - /* To avoid any unused-parameter or - unused-but-set-parameter warning. */ - some_global = a; - } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - - -# Clang needs special handling, because older versions handle the -pthread -# option in a rather... idiosyncratic way - -if test "x$ax_pthread_clang" = "xyes"; then - - # Clang takes -pthread; it has never supported any other flag - - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) - - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) - - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. - - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac - -fi # $ax_pthread_clang = yes - - - -# Various other checks: -if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) - - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], - [[int i = PTHREAD_PRIO_INHERIT; - return i;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [ - AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"]) - AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])]) - ], - [ - AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC]) - AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])]) - ] - ) - ]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" -test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) -AC_SUBST([PTHREAD_CXX]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/m4/mode_t.m4 b/m4/mode_t.m4 deleted file mode 100644 index 40f612a6..00000000 --- a/m4/mode_t.m4 +++ /dev/null @@ -1,26 +0,0 @@ -# mode_t.m4 serial 2 -dnl Copyright (C) 2009-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and -# include <sys/types.h>. - -# Define PROMOTED_MODE_T to the type that is the result of "default argument -# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. -AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], -[ - AC_REQUIRE([AC_TYPE_MODE_T]) - AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ - dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', - dnl and to itself otherwise. This assumption is not guaranteed by the ISO C - dnl standard, but we don't know of any real-world counterexamples. - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]], - [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], - [gl_cv_promoted_mode_t='int'], - [gl_cv_promoted_mode_t='mode_t']) - ]) - AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], - [Define to the type that is the result of default argument promotions of type mode_t.]) -]) diff --git a/m4/visibility.m4 b/m4/visibility.m4 deleted file mode 100644 index d161bd7f..00000000 --- a/m4/visibility.m4 +++ /dev/null @@ -1,82 +0,0 @@ -# visibility.m4 serial 8 -dnl Copyright (C) 2005, 2008, 2010-2021 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl Tests whether the compiler supports the command-line option -dnl -fvisibility=hidden and the function and variable attributes -dnl __attribute__((__visibility__("hidden"))) and -dnl __attribute__((__visibility__("default"))). -dnl Does *not* test for __visibility__("protected") - which has tricky -dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on -dnl Mac OS X. -dnl Does *not* test for __visibility__("internal") - which has processor -dnl dependent semantics. -dnl Does *not* test for #pragma GCC visibility push(hidden) - which is -dnl "really only recommended for legacy code". -dnl Set the variable CFLAG_VISIBILITY. -dnl Defines and sets the variable HAVE_VISIBILITY. - -AC_DEFUN([gl_VISIBILITY], -[ - AC_REQUIRE([AC_PROG_CC]) - CFLAG_VISIBILITY= - HAVE_VISIBILITY=0 - if test -n "$GCC"; then - dnl First, check whether -Werror can be added to the command line, or - dnl whether it leads to an error because of some other option that the - dnl user has put into $CC $CFLAGS $CPPFLAGS. - AC_CACHE_CHECK([whether the -Werror option is usable], - [gl_cv_cc_vis_werror], - [gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [gl_cv_cc_vis_werror=yes], - [gl_cv_cc_vis_werror=no]) - CFLAGS="$gl_save_CFLAGS" - ]) - dnl Now check whether visibility declarations are supported. - AC_CACHE_CHECK([for simple visibility declarations], - [gl_cv_cc_visibility], - [gl_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fvisibility=hidden" - dnl We use the option -Werror and a function dummyfunc, because on some - dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning - dnl "visibility attribute not supported in this configuration; ignored" - dnl at the first function definition in every compilation unit, and we - dnl don't want to use the option in this case. - if test $gl_cv_cc_vis_werror = yes; then - CFLAGS="$CFLAGS -Werror" - fi - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; - extern __attribute__((__visibility__("default"))) int exportedvar; - extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); - extern __attribute__((__visibility__("default"))) int exportedfunc (void); - void dummyfunc (void); - int hiddenvar; - int exportedvar; - int hiddenfunc (void) { return 51; } - int exportedfunc (void) { return 1225736919; } - void dummyfunc (void) {} - ]], - [[]])], - [gl_cv_cc_visibility=yes], - [gl_cv_cc_visibility=no]) - CFLAGS="$gl_save_CFLAGS" - ]) - if test $gl_cv_cc_visibility = yes; then - CFLAG_VISIBILITY="-fvisibility=hidden" - HAVE_VISIBILITY=1 - fi - fi - AC_SUBST([CFLAG_VISIBILITY]) - AC_SUBST([HAVE_VISIBILITY]) - AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], - [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) -]) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..0867359d --- /dev/null +++ b/meson.build @@ -0,0 +1,421 @@ +project('v4l-utils', 'c', 'cpp', + version: '1.25.0', + meson_version : '>= 0.54', + default_options : [ + 'buildtype=debugoptimized', + 'warning_level=1', + 'c_std=gnu99', + 'cpp_std=gnu++11', + ], + license : 'LGPL 2.1+') + +# meson >= 0.56 can use instead meson.project_source_root() +source_root = meson.current_source_dir() + +cc = meson.get_compiler('c') +cpp = meson.get_compiler('cpp') +have_m32 = cc.has_link_argument('-m32') +have_visibility = cc.has_argument('-fvisibility=hidden') and \ + cc.has_function_attribute('visibility:default') + +sys_root = meson.get_external_property('sys_root', '/') + +fs = import('fs') +i18n = import('i18n') +pkg = import('pkgconfig') +qt5 = import('qt5') + +as_version = meson.project_version() +ver_arr = as_version.split('.') +as_major_version = ver_arr[0] +as_minor_version = ver_arr[1] +as_patch_version = ver_arr[2] + +conf = configuration_data() +conf.set_quoted('PACKAGE', meson.project_name()) +conf.set_quoted('PACKAGE_VERSION', as_version) +conf.set_quoted('V4L_UTILS_VERSION', as_version) +conf.set('MAJOR', as_major_version) +conf.set('MINOR', as_minor_version) +conf.set('PATCH', as_patch_version) + +common_arguments = [ + '-Wpointer-arith', + '-D_GNU_SOURCE', + '-DPROMOTED_MODE_T=int', + '-DENABLE_NLS', + '-include', meson.current_build_dir() / 'config.h', +] + +v4l2_wrapper_args = [ + # As the library needs to provide both 32-bit and 64-bit versions + # of file operations, disable transparent large file support (fixes + # 'Error: symbol `open64/mmap64' is already defined' compile failure + # otherwise) + '-U_FILE_OFFSET_BITS', + '-D_FILE_OFFSET_BITS=32', + '-D_LARGEFILE64_SOURCE', +] + +v4l2_utils_incdir_arr = [ + 'lib' / 'include', +] + +if host_machine.system() == 'linux' + v4l2_utils_incdir_arr += 'include' +elif host_machine.system() == 'freebsd' + v4l2_utils_incdir_arr += 'contrib/freebsd/include' +endif + +v4l2_utils_incdir = include_directories(v4l2_utils_incdir_arr) + +prog_bash = find_program('bash') +prog_clang = find_program('clang', required : get_option('bpf')) +prog_doxygen = find_program('doxygen', required : get_option('doxygen-doc')) +prog_grep = find_program('grep') +prog_perl = find_program('perl') + +dep_alsa = dependency('alsa', required : false) +if dep_alsa.found() + conf.set('HAVE_ALSA', 1) +endif + +dep_gl = dependency('gl', required : get_option('qvidcap').enabled()) +dep_glu = dependency('glu', required : false) + +dep_jsonc = dependency('json-c', required : get_option('v4l2-tracer'), version : '>=0.15') + +dep_libdl = cc.find_library('dl') +dep_libelf = cc.find_library('elf', required : get_option('bpf')) +dep_libm = cc.find_library('m') +dep_librt = cc.find_library('rt') +dep_qt5 = dependency('qt5', modules: ['Core', 'Gui', 'Widgets'], + required : get_option('qvidcap').enabled() or get_option('qv4l2').enabled()) + +dep_qt5_opengl = dependency('qt5', modules: ['OpenGL'], + required : get_option('qvidcap').enabled()) + +dep_libbpf = dependency('libbpf', required : get_option('bpf'), version : '>=0.7') + +dep_sdl = dependency('SDL2', required: false) +if not dep_sdl.found() + dep_sdl = cc.find_library('SDL2', has_headers: 'SDL2/SDL.h', required: false) +endif + +dep_sdl_image = dependency('SDL2_image', required: false) +if not dep_sdl_image.found() + dep_sdl_image = cc.find_library('SDL2_image', has_headers: 'SDL2/SDL_image.h', required: false) +endif + +dep_threads = dependency('threads') +dep_x11 = dependency('x11', required : false) +dep_xmlrpc = dependency('xmlrpc', required : false) + +have_fork = cc.has_function('fork') +have_i2c_dev = cc.has_header('linux/i2c-dev.h') + +if have_visibility + conf.set('HAVE_VISIBILITY', 1) +endif + +if cc.has_function('klogctl') + conf.set('HAVE_KLOGCTL', 1) +endif + +if cc.has_function('secure_getenv') + conf.set('HAVE_SECURE_GETENV', 1) +endif + +if cc.has_function('__secure_getenv') + conf.set('HAVE___SECURE_GETENV', 1) +endif + +if cc.has_header('sys/klog.h') + conf.set('HAVE_SYS_KLOG_H', 1) +endif + +if cc.has_header_symbol('execinfo.h', 'backtrace') + conf.set('HAVE_BACKTRACE', 1) +endif + +if cc.has_function('argp_parse') + dep_argp = dependency('', required : false) +else + dep_argp = cc.find_library('argp') +endif + +if cc.has_function('strerrorname_np') + conf.set('HAVE_STRERRORNAME_NP', 1) +endif + +conf.set_quoted('LOCALEDIR', get_option('prefix') / get_option('datadir') / 'locale') + +# Meson 0.60 handles the iconv dependency natively. For older versions, fall +# back to manual checks for the iconv_open function in libc, or finding an +# external library otherwise. +if meson.version().version_compare('>= 0.60') + dep_iconv = dependency('iconv', required : false) + found_iconv = dep_iconv.found() +else + if cc.has_function('iconv_open') + dep_iconv = [] + found_iconv = true + else + dep_iconv = [cc.find_library('iconv', required : false)] + found_iconv = dep_iconv.found() + endif +endif + +if found_iconv + conf.set('HAVE_ICONV', 1) + iconv_const_test = '''#include <iconv.h> +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +''' + if cc.compiles(iconv_const_test, dependencies : dep_iconv) + conf.set('ICONV_CONST', '') + else + conf.set('ICONV_CONST', 'const') + endif +endif + +have_gconv = cc.has_header('gconv.h', required : get_option('gconv')) + +# Detect system gconv directory +gconvsysdir = get_option('gconvsysdir') + +# Generic check: works with most distributions +gconv_dirs_generic = [ + 'lib64', + 'usr/lib64', + 'lib', + 'usr/lib', + 'usr/local/lib64', + 'usr/local/lib', +] + +if gconvsysdir == '' + foreach dir : gconv_dirs_generic + dir = sys_root / dir / 'gconv' + if fs.is_dir(dir) + gconvsysdir = dir + break + endif + endforeach +endif + +# Debian/Ubuntu-specific check: should be aligned with the debian package +gconv_dirs_debian = [ + 'aarch64-linux-gnu', + 'alphaev67-linux-gnu', + 'arm-linux-gnueabi', + 'arm-linux-gnueabihf', + 'i686-kfreebsd-gnu', + 'i686-linux-gnu', + 'mips-linux-gnu', + 'mips64-linux-gnuabi64', + 'mips64-linux-gnuabin32', + 'mips64el-linux-gnuabi64', + 'mips64el-linux-gnuabin32', + 'mipsel-linux-gnu', + 'mipsisa32r6-linux-gnu', + 'mipsisa32r6el-linux-gnu', + 'mipsisa64r6-linux-gnuabi64', + 'mipsisa64r6-linux-gnuabin32', + 'mipsisa64r6el-linux-gnuabi64', + 'mipsisa64r6el-linux-gnuabin32', + 'powerpc-linux-gnu', + 'powerpc64-linux-gnu', + 's390-linux-gnu', + 'sparc64-linux-gnu', + 'sparcv9-linux-gnu', + 'x86_64-linux-gnu', + 'x86_64-linux-gnux32', +] + +if gconvsysdir == '' + foreach dir : gconv_dirs_debian + dir = sys_root / 'usr' / 'lib' / dir / 'gconv' + if fs.is_dir(dir) + gconvsysdir = dir + break + endif + endforeach +endif + +if gconvsysdir == '' + dep_jis = cc.find_library('JIS', required : get_option('gconv')) + dep_jisx0213 = cc.find_library('JISX0213', required : get_option('gconv')) +else + dep_jis = cc.find_library('JIS', required : get_option('gconv'), dirs : gconvsysdir) + dep_jisx0213 = cc.find_library('JISX0213', required : get_option('gconv'), dirs : gconvsysdir) +endif + +dep_jpeg = dependency('libjpeg', required : get_option('jpeg')) +if dep_jpeg.found() + dep_jpeg_priv_libs = '-ljpeg' +endif + +systemd_systemdir = get_option('systemdsystemunitdir') +if systemd_systemdir == '' + dep_systemd = dependency('systemd', required : false) + if dep_systemd.found() + systemd_systemdir = dep_systemd.get_variable(pkgconfig : 'systemdsystemunitdir') + endif +endif +if systemd_systemdir == '' + systemd_systemdir = '/lib/systemd/system' +endif +# Since systemd v239, udevd is not allowed to execute BPF systems calls; +# add an override to allow bpf(2) in that case. On earlier versions, the +# override will restrict udevd to bpf syscall only and will stop the system +# from booting. This is also true on current debian versions. +have_udevdsyscallfilter = run_command(prog_grep, '-s', 'SystemCallFilter', + systemd_systemdir / 'systemd-udevd.service', + check : false).returncode() == 0 + +dep_libudev = dependency('libudev', required : get_option('libdvbv5')) +if dep_libudev.found() + conf.set('HAVE_LIBUDEV', 1) +endif + +udevdir = get_option('udevdir') +if udevdir == '' + dep_udev = dependency('udev', required : false) + if dep_udev.found() + udevdir = dep_udev.get_variable(pkgconfig : 'udevdir') + endif +endif +if udevdir == '' + udevdir = '/lib/udev' +endif + +qt5_opengl_test = ''' +#define GL_GLEXT_PROTOTYPES +#define QT_NO_OPENGL_ES_2 + +#include <QGLWidget> +#include <QGLShader> +#include <QGLShaderProgram> +#include <QGLFunctions> + +#ifndef GL_UNSIGNED_INT_8_8_8_8 +#error Missing OpenGL Extensions +#endif +''' +have_qt5_opengl = cpp.compiles(qt5_opengl_test, + dependencies : [dep_gl, dep_qt5, dep_qt5_opengl], + args : '-fPIC') +if have_qt5_opengl + conf.set('HAVE_QTGL', 1) +endif + +ioctl_posix_test = ''' +#include <sys/ioctl.h> +int ioctl (int, int, ...); +''' +if cc.compiles(ioctl_posix_test) + conf.set('HAVE_POSIX_IOCTL', 1) +endif + +c_arguments = [] +cpp_arguments = [] + +c_arguments += common_arguments +cpp_arguments += common_arguments + +add_project_arguments(c_arguments, language : 'c') +add_project_arguments(cpp_arguments, language : 'cpp') +add_project_link_arguments(cpp_arguments, language : 'cpp') + +git_sha = '' +git_commit_cnt = '' +git_commit_date = '' + +if fs.is_dir('.git') + prog_git = find_program('git') + git_sha = run_command(prog_git, '-C', source_root, 'rev-parse', '--short=12', 'HEAD', + check : true).stdout().strip() + git_commit_cnt = '-' + run_command(prog_git, '-C', source_root, 'rev-list', '--count', 'HEAD', + check : true).stdout().strip() + git_commit_date = run_command(prog_git, '-C', source_root, 'show', '--quiet', + '--date=format-local:%F %T', '--format=%cd', + env : ['TZ=UTC'], check : true).stdout().strip() +endif + +conf.set('GIT_SHA', git_sha) +conf.set('GIT_COMMIT_CNT', git_commit_cnt) +conf.set('GIT_COMMIT_DATE', git_commit_date) + +man_pages = [] + +i18n_gettext_arguments = ['--directory=' + source_root, + '--keyword=_', '--keyword=N_', '--keyword=P_:1,2'] +subdir('libdvbv5-po') +subdir('v4l-utils-po') + +subdir('lib') + +if get_option('v4l-utils') + subdir('utils') + subdir('contrib') +endif + +subdir('doc') + +configure_file(output : 'config.h', configuration : conf) + +foreach m : man_pages + configure_file(input : join_paths(m[0], '@0@.@1@.in'.format(m[1], m[2])), + output : '@0@.@1@'.format(m[1], m[2]), + install_dir : join_paths(get_option('mandir'), 'man@0@'.format(m[2])), + configuration : conf) +endforeach + +configure_file(input : 'v4l-utils.spec.in', output : 'v4l-utils.spec', + configuration : conf) + +summary({ + 'ALSA' : dep_alsa.found(), + 'GL' : dep_gl.found(), + 'GLU' : dep_glu.found(), + 'JSON-C' : dep_jsonc.found(), + 'Qt5' : [ + dep_qt5.found(), + have_qt5_opengl ? 'with QtGL' : 'without QtGL', + ], + 'SDL' : dep_sdl.found(), + 'X11' : dep_x11.found(), + 'gconv' : have_gconv, + 'iconv' : found_iconv, + 'libjpeg' : dep_jpeg.found(), + 'libudev' : dep_libudev.found(), + 'threads' : dep_threads.found(), + }, bool_yn : true, section : 'Dependencies') + +summary({ + 'udevdir' : udevdir, + }, section : 'Directories') + +summary({ + 'libdvbv5' : is_variable('libdvbv5'), + 'v4l-plugins' : get_option('v4l-plugins'), + 'v4l-wrappers' : get_option('v4l-wrappers'), + }, bool_yn : true, section : 'Libraries') + +summary({ + 'BPF IR decoders' : ir_bpf_enabled, + 'qv4l2' : is_variable('qv4l2'), + 'qvidcap' : is_variable('qvidcap'), + 'v4l-utils' : get_option('v4l-utils'), + 'v4l2-compliance' : [ + is_variable('v4l2_compliance'), + get_option('v4l2-compliance-libv4l') ? 'with libv4l' : 'without libv4l', + ], + 'v4l2-compliance-32' : is_variable('v4l2_compliance_32'), + 'v4l2-ctl' : [ + is_variable('v4l2_ctl'), + get_option('v4l2-ctl-libv4l') ? 'with libv4l' : 'without libv4l', + ], + 'v4l2-ctl-32' : is_variable('v4l2_ctl_32'), + 'v4l2-tracer' : is_variable('v4l2_tracer'), + }, bool_yn : true, section : 'Applications') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..2fa046c0 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,54 @@ +# Features +option('bpf', type : 'feature', value : 'auto', + description : 'Enable IR BPF decoders') +option('gconv', type : 'feature', value : 'auto', + description : 'Enable compilation of gconv modules') +option('jpeg', type : 'feature', value : 'auto') +option('libdvbv5', type : 'feature', value : 'auto', + description : 'Enable libdvbv5 compilation') +option('qv4l2', type : 'feature', value : 'auto', + description : 'Enable qv4l2 compilation') +option('qvidcap', type : 'feature', value : 'auto', + description : 'Enable qvidcap compilation') +option('v4l2-tracer', type : 'feature', value : 'auto', + description : 'Enable v4l2-tracer compilation') + +# Options +option('v4l-plugins', type : 'boolean', + description : 'V4L plugin support') +option('v4l-utils', type : 'boolean', + description : 'Enable v4l-utils compilation') +option('v4l-wrappers', type : 'boolean', + description : 'V4L wrappers support') +option('v4l2-compliance-32', type : 'boolean', value : false, + description : 'Enable v4l2-compliance-32 compilation (for debugging purposes only)') +option('v4l2-compliance-libv4l', type : 'boolean', + description : 'Enable use of libv4l in v4l2-compliance') +option('v4l2-ctl-32', type : 'boolean', value : false, + description : 'Enable v4l2-ctl-32 compilation (for debugging purposes only)') +option('v4l2-ctl-libv4l', type : 'boolean', + description : 'Enable use of libv4l in v4l2-ctl') +option('v4l2-ctl-stream-to', type : 'boolean', + description : 'Enable use of --stream-to in v4l2-ctl') + +# Directories +option('gconvsysdir', type : 'string', + description : 'Set system gconv directory (default is to autodetect)') +option('libv4l1subdir', type : 'string', value : 'libv4l', + description : 'Set libv4l1 library subdir') +option('libv4l2subdir', type : 'string', value : 'libv4l', + description : 'Set libv4l2 library subdir') +option('libv4lconvertsubdir', type : 'string', value : 'libv4l', + description : 'Set libv4lconvert library subdir') +option('systemdsystemunitdir', type : 'string', + description : 'Set systemd system unit directory') +option('udevdir', type : 'string', + description : 'Set udev directory') + +# Doxygen options +option('doxygen-doc', type : 'feature', value : 'auto', + description : 'Generate doxygen project documentation') +option('doxygen-html', type : 'boolean', + description : 'Generate doxygen plain HTML documentation') +option('doxygen-man', type : 'boolean', value : false, + description : 'Generate doxygen manual pages') diff --git a/sync-with-kernel.sh b/sync-with-kernel.sh index 0e70f7b6..ed2a9e21 100755 --- a/sync-with-kernel.sh +++ b/sync-with-kernel.sh @@ -59,11 +59,13 @@ function keytable { cd ${SRCDIR} echo generating ${SRCDIR}/parse.h ./gen_input_events.pl < ${KERNEL_DIR}/usr/include/linux/input-event-codes.h > ${SRCDIR}/parse.h - mkdir -p ${SRCDIR}/rc_keymaps rm -f ${SRCDIR}/rc_keymaps/* echo storing existing keymaps at ${SRCDIR}/rc_keymaps/ ./gen_keytables.pl ${KERNEL_DIR}; cp ${SRCDIR}/rc_keymaps_userspace/* ${SRCDIR}/rc_keymaps/ + echo "ir_keytable_rc_keymaps = files(" >${SRCDIR}/rc_keymaps/meson.build + ls ${SRCDIR}/rc_keymaps | grep toml | perl -ne "chomp; printf(\" '\$_',\n\");" >>${SRCDIR}/rc_keymaps/meson.build + echo ")" >>${SRCDIR}/rc_keymaps/meson.build } function libdvbv5 { diff --git a/utils/Makefile.am b/utils/Makefile.am deleted file mode 100644 index 0e68a612..00000000 --- a/utils/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -SUBDIRS = \ - libv4l2util \ - libmedia_dev \ - ivtv-ctl \ - ir-ctl \ - cx18-ctl \ - keytable \ - media-ctl \ - v4l2-ctl \ - v4l2-dbg \ - v4l2-sysfs-path \ - libcecutil \ - cec-ctl \ - cec-compliance \ - cec-follower \ - rds-ctl - -if WITH_LIBDVBV5 -SUBDIRS += \ - dvb -endif - -if WITH_V4L2_COMPLIANCE -SUBDIRS += \ - v4l2-compliance -endif - -if WITH_QV4L2 -SUBDIRS += qv4l2 -endif - -if WITH_QVIDCAP -SUBDIRS += qvidcap -endif - -EXTRA_DIST = common diff --git a/utils/cec-compliance/.gitignore b/utils/cec-compliance/.gitignore deleted file mode 100644 index 2093e3b4..00000000 --- a/utils/cec-compliance/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cec-compliance -cec-compliance.1 diff --git a/utils/cec-compliance/Makefile.am b/utils/cec-compliance/Makefile.am deleted file mode 100644 index 81a68370..00000000 --- a/utils/cec-compliance/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = cec-compliance -man_MANS = cec-compliance.1 - -cec_compliance_SOURCES = cec-compliance.cpp cec-compliance.h cec-test.cpp cec-test-adapter.cpp cec-test-audio.cpp cec-test-power.cpp cec-test-fuzzing.cpp cec-test-tuner-record-timer.cpp -cec_compliance_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE) -cec_compliance_LDADD = -lrt ../libcecutil/libcecutil.la - -EXTRA_DIST = cec-compliance.1 diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h index 34ed9a81..5a693f7a 100644 --- a/utils/cec-compliance/cec-compliance.h +++ b/utils/cec-compliance/cec-compliance.h @@ -11,12 +11,6 @@ #include <linux/cec-funcs.h> #include "cec-htng-funcs.h" -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif - #include <cec-info.h> #include <vector> @@ -181,6 +175,10 @@ struct remote_subtest { using vec_remote_subtests = std::vector<remote_subtest>; +#ifndef __FILE_NAME__ +#define __FILE_NAME__ __FILE__ +#endif + #define OK 0 #define FAIL 1 #define OK_PRESUMED 2 @@ -226,7 +224,7 @@ using vec_remote_subtests = std::vector<remote_subtest>; if (show_warnings) \ printf("\t\%s: %s(%d): " fmt, \ show_colors ? COLOR_BOLD("warn") : "warn", \ - __FILE__, __LINE__, ##args); \ + __FILE_NAME__, __LINE__, ##args); \ if (exit_on_warn) \ std::exit(EXIT_FAILURE); \ 0; \ @@ -257,7 +255,7 @@ using vec_remote_subtests = std::vector<remote_subtest>; #define fail(fmt, args...) \ ({ \ printf("\t\t%s: %s(%d): " fmt, show_colors ? \ - COLOR_RED("fail") : "fail", __FILE__, __LINE__, ##args); \ + COLOR_RED("fail") : "fail", __FILE_NAME__, __LINE__, ##args); \ if (exit_on_fail) \ std::exit(EXIT_FAILURE); \ FAIL; \ diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp index ed1e1fbc..6ab9b1e3 100644 --- a/utils/cec-compliance/cec-test-power.cpp +++ b/utils/cec-compliance/cec-test-power.cpp @@ -26,7 +26,8 @@ static bool get_power_status(struct node *node, unsigned me, unsigned la, __u8 & power_status = CEC_OP_POWER_STATUS_STANDBY; return true; } - if (res || !(msg.tx_status & CEC_TX_STATUS_OK) || timed_out_or_abort(&msg)) + if (res || !(msg.tx_status & CEC_TX_STATUS_OK) || !(msg.rx_status & CEC_RX_STATUS_OK) || + cec_msg_status_is_abort(&msg)) return false; cec_ops_report_power_status(&msg, &power_status); return true; diff --git a/utils/cec-compliance/meson.build b/utils/cec-compliance/meson.build new file mode 100644 index 00000000..9cc0017b --- /dev/null +++ b/utils/cec-compliance/meson.build @@ -0,0 +1,23 @@ +cec_compliance_sources = files( + 'cec-compliance.cpp', + 'cec-compliance.h', + 'cec-test-adapter.cpp', + 'cec-test-audio.cpp', + 'cec-test-fuzzing.cpp', + 'cec-test-power.cpp', + 'cec-test-tuner-record-timer.cpp', + 'cec-test.cpp', +) + +cec_compliance_deps = [ + dep_libcecutil, + dep_librt, +] + +cec_compliance = executable('cec-compliance', + cec_compliance_sources, + install : true, + dependencies : cec_compliance_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'cec-compliance', 1 ]] diff --git a/utils/cec-ctl/.gitignore b/utils/cec-ctl/.gitignore deleted file mode 100644 index f37a33eb..00000000 --- a/utils/cec-ctl/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cec-ctl -cec-ctl.1 diff --git a/utils/cec-ctl/Makefile.am b/utils/cec-ctl/Makefile.am deleted file mode 100644 index 27e69494..00000000 --- a/utils/cec-ctl/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = cec-ctl -man_MANS = cec-ctl.1 - -cec_ctl_SOURCES = cec-ctl.cpp cec-pin.cpp cec-ctl.h -cec_ctl_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE) -cec_ctl_LDADD = -lrt -lpthread ../libcecutil/libcecutil.la - -EXTRA_DIST = cec-ctl.1 diff --git a/utils/cec-ctl/cec-ctl.1.in b/utils/cec-ctl/cec-ctl.1.in index d76182fc..f2be87ad 100644 --- a/utils/cec-ctl/cec-ctl.1.in +++ b/utils/cec-ctl/cec-ctl.1.in @@ -12,11 +12,19 @@ The easiest way to quickly test a CEC adapter of an HDMI output is: cec-ctl -d/dev/cecX --playback -S +This is what you would use if the HDMI output of your device supports +CEC: your device will play back video, so it is a CEC Playback device. + And for an HDMI input: cec-ctl -d/dev/cecX --tv -S +This is what you would use if your device has an HDMI input, i.e. it +acts like a TV. + Both commands configure the CEC adapter and show the CEC topology. +The '--playback' and '--tv' options configure \fIyour\fR device, they are +not about what device you will be talking to. To put a display to standby use: @@ -263,14 +271,16 @@ via the \fB\-\-analyze\-pin\fR option. Use \- to write to stdout instead of to a Read and analyze the CEC pin events from the given file. Use \- to read from stdin instead of from a file. .TP -\fB\-\-test\-power\-cycle\fR [\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR] -This option tests the power cycle behavior of the display. It polls up to +\fB\-\-test\-standby\-wakeup\-cycle\fR [\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR] +This option tests the standby-wakeup cycle behavior of the display. It polls up to \fI<n>\fR times (default 15), waiting for a state change. If that fails then it waits \fI<secs>\fR seconds (default 10) before retrying this. +If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby. .TP -\fB\-\-stress\-test\-power\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR] -This option performs a stress test for a display: it power cycles the display \fI<count>\fR -times using the CEC Standby and Image View On commands. If \fI<count>\fR is 0, then never stop. +\fB\-\-stress\-test\-standby\-wakeup\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR] +This option performs a stress test for a display: it cycles the display \fI<count>\fR +times in and out of standby using the CEC Standby and Image View On commands. +If \fI<count>\fR is 0, then never stop. It polls up to \fI<n>\fR times (default 30), waiting for a state change. If \fI<maxsecs>\fR is non-zero (0 is the default), then sleep for a random number of seconds between \fI<minsecs>\fR (0 is the default) and \fI<maxsecs>\fR before each <Standby> or @@ -283,6 +293,21 @@ non-zero \fI<reps>\fR value is needed in order to pass this test, then that indi a problem. If \fI<secs1>\fR is specified, then sleep for <secs1> seconds before transmitting <Image View On>. If \fI<secs2>\fR is specified, then sleep for <secs2> seconds before transmitting <Standby>. +If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby. +.TP +\fB\-\-stress\-test\-random\-standby\-wakeup\-cycle\fR \fIcnt\fR=\fI<count>\fR[,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0/1>\fR] +This option performs a stress test for a display: it cycles the display \fI<count>\fR +times in and out of standby using the CEC Standby and Image View On commands. +After each command wait between \fI<minsecs>\fR (default is 0) and \fI<maxsecs>\fR (default is 10) +seconds. +This test does not check if the display reached the new state, +this test is meant to check if the display can handle state change commands +while still transitioning to a new state. After every 10 cycles it attempts to properly +wake up the display and check if that works. If not, this test fails. +If \fI<count>\fR is 0, then never stop. +If \fI<seed>\fR is specified, then set the randomizer seed to that value instead of +using the current time as seed. +If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in standby. .TP \fB\-\-help\-all\fR Prints the help message for all options. diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 5e47fdfc..adeff1f9 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -25,12 +25,6 @@ #include "cec-log.h" #include "cec-parse.h" -#ifdef __ANDROID__ -#include <android-config.h> -#else -#include <config.h> -#endif - #include "cec-ctl.h" #include "compiler.h" @@ -41,6 +35,8 @@ static bool ignore_la[16]; static const char *edid_path; static bool is_paused; +#define CEC_CTL_VERSION 2 + #define POLL_FAKE_OPCODE 256 static unsigned short ignore_opcode[257]; @@ -125,8 +121,9 @@ enum Option { OptFeatSetAudioRate, OptFeatSinkHasARCTx, OptFeatSourceHasARCRx, - OptStressTestPowerCycle, - OptTestPowerCycle, + OptTestStandbyWakeupCycle, + OptStressTestStandbyWakeupCycle, + OptStressTestRandomStandbyWakeupCycle, OptVendorCommand = 508, OptVendorCommandWithID, OptVendorRemoteButtonDown, @@ -226,8 +223,14 @@ static struct option long_options[] = { { "vendor-command", required_argument, nullptr, OptVendorCommand }, \ { "custom-command", required_argument, nullptr, OptCustomCommand }, \ - { "test-power-cycle", optional_argument, nullptr, OptTestPowerCycle }, \ - { "stress-test-power-cycle", required_argument, nullptr, OptStressTestPowerCycle }, \ + // Keep old option names for backwards compatibility + { "test-power-cycle", optional_argument, nullptr, OptTestStandbyWakeupCycle }, \ + { "stress-test-power-cycle", required_argument, nullptr, OptStressTestStandbyWakeupCycle }, \ + { "test-random-power-states", required_argument, nullptr, OptStressTestRandomStandbyWakeupCycle }, \ + + { "test-standby-wakeup-cycle", optional_argument, nullptr, OptTestStandbyWakeupCycle }, \ + { "stress-test-standby-wakeup-cycle", required_argument, nullptr, OptStressTestStandbyWakeupCycle }, \ + { "stress-test-random-standby-wakeup-cycle", required_argument, nullptr, OptStressTestRandomStandbyWakeupCycle }, \ { nullptr, 0, nullptr, 0 } }; @@ -323,14 +326,15 @@ static void usage() " Use - for stdout.\n" " --analyze-pin <from> Analyze the low-level CEC pin changes from the file <from>.\n" " Use - for stdin.\n" - " --test-power-cycle [polls=<n>][,sleep=<secs>]\n" - " Test power cycle behavior of the display. It polls up to\n" + " --test-standby-wakeup-cycle [polls=<n>][,sleep=<secs>][,hpd-may-be-low=<0/1>]\n" + " Test standby-wakeup cycle behavior of the display. It polls up to\n" " <n> times (default 15), waiting for a state change. If\n" " that fails it waits <secs> seconds (default 10) before\n" " retrying this.\n" - " --stress-test-power-cycle cnt=<count>[,polls=<n>][,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,repeats=<reps>]\n" - " [,sleep-before-on=<secs1>][,sleep-before-off=<secs2>]\n" - " Power cycle display <count> times. If 0, then never stop.\n" + " If <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby.\n" + " --stress-test-standby-wakeup-cycle cnt=<count>[,polls=<n>][,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,repeats=<reps>]\n" + " [,sleep-before-on=<secs1>][,sleep-before-off=<secs2>][,hpd-may-be-low=<0/1>]\n" + " Standby-Wakeup cycle display <count> times. If 0, then never stop.\n" " It polls up to <n> times (default 30), waiting for a state change.\n" " If <maxsecs> is non-zero (0 is the default), then sleep for\n" " a random number of seconds between <minsecs> (0 is the default) and <maxsecs>\n" @@ -343,6 +347,18 @@ static void usage() " before transmitting <Image View On>.\n" " If <secs2> is specified, then sleep for <secs2> seconds\n" " before transmitting <Standby>.\n" + " If <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby.\n" + " --stress-test-random-standby-wakeup-cycle cnt=<count>[,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,hpd-may-be-low=<0/1>]\n" + " Randomly transmit <Standby> or <Image View On> up to <count> times.\n" + " If <count> is 0, then never stop. After each transmit wait between\n" + " <min-sleep> (default 0) and <max-sleep> (default 10) seconds.\n" + " If <seed> is specified, then set the randomizer seed to\n" + " that value instead of using the current time as seed.\n" + " If <hpd-may-be-low> is 1, then the HPD is allowed to be low when in standby.\n" + " This test does not check if the display reached the new state,\n" + " it checks if the display can handle this situation without\n" + " locking up. After every 10 cycles it attempts to properly\n" + " wake up the display and check if that works. If not, this test fails.\n" "\n" CEC_PARSE_USAGE "\n" @@ -481,26 +497,24 @@ static const char *event2s(__u32 event) } } -static void log_event(struct cec_event &ev, bool show) +static void log_event(struct cec_event &ev, bool show, bool pin_logging = false) { bool is_high = ev.event == CEC_EVENT_PIN_CEC_HIGH; bool is_initial = ev.flags & CEC_EVENT_FL_INITIAL_STATE; - bool is_pin_event = false; __u16 pa; if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH && ev.event != CEC_EVENT_PIN_HPD_LOW && ev.event != CEC_EVENT_PIN_HPD_HIGH && ev.event != CEC_EVENT_PIN_5V_LOW && ev.event != CEC_EVENT_PIN_5V_HIGH) printf("\n"); - else - is_pin_event = true; + if ((ev.flags & CEC_EVENT_FL_DROPPED_EVENTS) && show) printf("(warn: %s events were lost)\n", event2s(ev.event)); if (show) { if (is_initial) { printf("Initial "); } else if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH) { - if (is_pin_event) + if (pin_logging) printf("%s: ", ts2s(ev.ts / 1000000000.0).c_str()); else printf("%s: ", ts2s(ev.ts).c_str()); @@ -510,7 +524,10 @@ static void log_event(struct cec_event &ev, bool show) switch (ev.event) { case CEC_EVENT_STATE_CHANGE: pa = ev.state_change.phys_addr; - if (show) + if (show && pin_logging) + printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x\n", + cec_phys_addr_exp(pa), ev.state_change.log_addr_mask); + else if (show) printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x, Conn Info: %s\n", cec_phys_addr_exp(pa), ev.state_change.log_addr_mask, @@ -785,12 +802,12 @@ static void generate_eob_event(__u64 ts, FILE *fstore) }; if (fstore) { - fprintf(fstore, "%llu.%09llu %d\n", + fprintf(fstore, "%llu.%09llu 0x%x\n", ev_eob.ts / 1000000000, ev_eob.ts % 1000000000, ev_eob.event - CEC_EVENT_PIN_CEC_LOW); fflush(fstore); } - log_event(ev_eob, fstore != stdout); + log_event(ev_eob, fstore != stdout, true); } static void show_msg(const cec_msg &msg) @@ -813,8 +830,11 @@ static void show_msg(const cec_msg &msg) log_raw_msg(&msg); std::string status; if ((msg.tx_status & ~CEC_TX_STATUS_OK) || - (msg.rx_status & ~CEC_RX_STATUS_OK)) + (msg.rx_status & ~CEC_RX_STATUS_OK)) { status = std::string(" ") + cec_status2s(msg); + if (verbose) + printf("\tTimestamp: %s\n", ts2s(current_ts()).c_str()); + } if (verbose && transmitted) printf("\tSequence: %u Tx Timestamp: %s%s\n", msg.sequence, ts2s(msg.tx_ts).c_str(), @@ -868,7 +888,8 @@ static void wait_for_msgs(const struct node &node, __u32 monitor_time) } } -#define MONITOR_FL_DROPPED_EVENTS (1 << 16) +#define MONITOR_STATE_CHANGE 0x10 +#define MONITOR_FL_DROPPED_EVENTS (1 << 16) static void monitor(const struct node &node, __u32 monitor_time, const char *store_pin) { @@ -881,7 +902,7 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto if (options[OptMonitorAll]) monitor = CEC_MODE_MONITOR_ALL; - else if (options[OptMonitorPin] || options[OptStorePin]) + else if (options[OptMonitorPin]) monitor = CEC_MODE_MONITOR_PIN; if (!(node.caps & CEC_CAP_MONITOR_ALL) && monitor == CEC_MODE_MONITOR_ALL) { @@ -920,7 +941,7 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto std::exit(EXIT_FAILURE); } fprintf(fstore, "# cec-ctl --store-pin\n"); - fprintf(fstore, "# version 1\n"); + fprintf(fstore, "# version %d\n", CEC_CTL_VERSION); fprintf(fstore, "# start_monotonic %lu.%09lu\n", start_monotonic.tv_sec, start_monotonic.tv_nsec); fprintf(fstore, "# start_timeofday %lu.%06lu\n", @@ -996,17 +1017,27 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto if (ev.event == CEC_EVENT_PIN_CEC_LOW || ev.event == CEC_EVENT_PIN_CEC_HIGH) generate_eob_event(ev.ts, fstore); - if (pin_event && fstore) { + if (fstore && ev.event == CEC_EVENT_STATE_CHANGE) { + unsigned int v = MONITOR_STATE_CHANGE; + + if (ev.flags & CEC_EVENT_FL_DROPPED_EVENTS) + v |= MONITOR_FL_DROPPED_EVENTS; + + fprintf(fstore, "%llu.%09llu 0x%x 0x%04x 0x%04x\n", + ev.ts / 1000000000, ev.ts % 1000000000, v, + ev.state_change.phys_addr, ev.state_change.log_addr_mask); + fflush(fstore); + } else if (fstore && pin_event) { unsigned int v = ev.event - CEC_EVENT_PIN_CEC_LOW; if (ev.flags & CEC_EVENT_FL_DROPPED_EVENTS) v |= MONITOR_FL_DROPPED_EVENTS; - fprintf(fstore, "%llu.%09llu %d\n", + fprintf(fstore, "%llu.%09llu 0x%x\n", ev.ts / 1000000000, ev.ts % 1000000000, v); fflush(fstore); } if (!pin_event || options[OptMonitorPin]) - log_event(ev, fstore != stdout); + log_event(ev, fstore != stdout, true); } if (!res && eob_ts) { struct timespec ts; @@ -1021,6 +1052,31 @@ static void monitor(const struct node &node, __u32 monitor_time, const char *sto fclose(fstore); } +static unsigned read_val(char **p) +{ + unsigned v = 0; + + while (**p == ' ') + (*p)++; + + if ((*p)[0] == '0' && (*p)[1] == 'x') { + (*p) += 2; + while (isxdigit(**p)) { + if (isdigit(**p)) + v = v * 16 + **p - '0'; + else + v = v * 16 + tolower(**p) - 'a' + 10; + (*p)++; + } + } else { + while (isdigit(**p)) { + v = v * 10 + **p - '0'; + (*p)++; + } + } + return v; +} + static void analyze(const char *analyze_pin) { FILE *fanalyze; @@ -1046,9 +1102,13 @@ static void analyze(const char *analyze_pin) goto err; line++; if (!fgets(s, sizeof(s), fanalyze) || - sscanf(s, "# version %u\n", &version) != 1 || - version != 1) + sscanf(s, "# version %u\n", &version) != 1) goto err; + if (version > CEC_CTL_VERSION) { + fprintf(stderr, "Pin store file has version %d, but we only support up to version %d\n", + version, CEC_CTL_VERSION); + std::exit(EXIT_FAILURE); + } line++; if (!fgets(s, sizeof(s), fanalyze) || sscanf(s, "# start_monotonic %lu.%09lu\n", &tv_sec, &tv_nsec) != 2 || @@ -1104,29 +1164,45 @@ static void analyze(const char *analyze_pin) p++; while (isdigit(*p)) tv_nsec = tv_nsec * 10 + *p++ - '0'; - if (*p == ' ') - p++; - while (isdigit(*p)) - event = event * 10 + *p++ - '0'; - if (*p != '\n' || (event & ~MONITOR_FL_DROPPED_EVENTS) > 5) { + event = read_val(&p); + + bool dropped_events = event & MONITOR_FL_DROPPED_EVENTS; + event &= ~MONITOR_FL_DROPPED_EVENTS; + + __u16 pa = 0; + __u16 la_mask = 0; + + if (event == MONITOR_STATE_CHANGE) { + pa = read_val(&p); + la_mask = read_val(&p); + } + if (*p != '\n') { fprintf(stderr, "malformed data at line %d\n", line); break; } + if (event != MONITOR_STATE_CHANGE && event > 5) { + fprintf(stderr, "unknown event at line %d\n", line); + break; + } ev.ts = tv_sec * 1000000000ULL + tv_nsec; ev.flags = 0; - if (event & MONITOR_FL_DROPPED_EVENTS) { - event &= ~MONITOR_FL_DROPPED_EVENTS; + if (dropped_events) ev.flags = CEC_EVENT_FL_DROPPED_EVENTS; + if (event == MONITOR_STATE_CHANGE) { + ev.event = CEC_EVENT_STATE_CHANGE; + ev.state_change.phys_addr = pa; + ev.state_change.log_addr_mask = la_mask; + } else { + ev.event = event + CEC_EVENT_PIN_CEC_LOW; } - ev.event = event + CEC_EVENT_PIN_CEC_LOW; - log_event(ev, true); + log_event(ev, true, true); line++; } if (eob_ts) { ev.event = CEC_EVENT_PIN_CEC_HIGH; ev.ts = eob_ts; - log_event(ev, true); + log_event(ev, true, true); } if (fanalyze != stdin) @@ -1225,7 +1301,7 @@ static int transmit_msg_retry(const struct node &node, struct cec_msg &msg) return ret; } -static int init_power_cycle_test(const struct node &node, unsigned repeats, unsigned max_tries) +static int init_standby_wakeup_cycle_test(const struct node &node, unsigned repeats, unsigned max_tries) { struct cec_msg msg; unsigned from; @@ -1254,7 +1330,7 @@ static int init_power_cycle_test(const struct node &node, unsigned repeats, unsi } else { switch (laddrs.log_addr_type[0]) { case CEC_LOG_ADDR_TYPE_TV: - fprintf(stderr, "A TV can't run the power cycle test.\n"); + fprintf(stderr, "A TV can't run the standby-wakeup cycle test.\n"); std::exit(EXIT_FAILURE); case CEC_LOG_ADDR_TYPE_RECORD: from = CEC_LOG_ADDR_RECORD_1; @@ -1302,15 +1378,12 @@ static int init_power_cycle_test(const struct node &node, unsigned repeats, unsi printf("Transmit Standby to TV: "); fflush(stdout); cec_msg_init(&msg, from, CEC_LOG_ADDR_TV); - static bool sent; cec_msg_standby(&msg); tries = 0; unsigned hpd_is_low_cnt = 0; for (;;) { - if (!sent) { sent=true; ret = transmit_msg_retry(node, msg); - } else ret = 0; // The first standby transmit must always succeed, // later standbys may fail with ENONET if (ret && (ret != ENONET || !tries)) { @@ -1367,8 +1440,8 @@ static int init_power_cycle_test(const struct node &node, unsigned repeats, unsi return from; } -static void test_power_cycle(const struct node &node, unsigned int max_tries, - unsigned int retry_sleep) +static void test_standby_wakeup_cycle(const struct node &node, unsigned int max_tries, + unsigned int retry_sleep, bool hpd_may_be_low) { struct cec_log_addrs laddrs = { }; struct cec_msg msg; @@ -1381,7 +1454,7 @@ static void test_power_cycle(const struct node &node, unsigned int max_tries, __u8 wakeup_la; int ret; - from = init_power_cycle_test(node, 2, max_tries); + from = init_standby_wakeup_cycle_test(node, 2, max_tries); doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs); if (laddrs.log_addr[0] != CEC_LOG_ADDR_INVALID) @@ -1389,10 +1462,11 @@ static void test_power_cycle(const struct node &node, unsigned int max_tries, else wakeup_la = CEC_LOG_ADDR_UNREGISTERED; - bool hpd_is_low = wakeup_la == CEC_LOG_ADDR_UNREGISTERED; + bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || hpd_may_be_low; printf("The Hotplug Detect pin %s when in Standby\n\n", - hpd_is_low ? "is pulled low" : "remains high"); + hpd_may_be_low ? "may be pulled low" : + (hpd_is_low ? "is pulled low" : "remains high")); for (unsigned iter = 0; iter <= 2 * 12; iter++) { unsigned i = iter / 2; @@ -1579,10 +1653,11 @@ static void test_power_cycle(const struct node &node, unsigned int max_tries, printf("Test had %u failure%s\n", failures, failures == 1 ? "" : "s"); } -static void stress_test_power_cycle(const struct node &node, unsigned cnt, - double min_sleep, double max_sleep, unsigned max_tries, - bool has_seed, unsigned seed, unsigned repeats, - double sleep_before_on, double sleep_before_off) +static void stress_test_standby_wakeup_cycle(const struct node &node, unsigned cnt, + double min_sleep, double max_sleep, unsigned max_tries, + bool has_seed, unsigned seed, unsigned repeats, + double sleep_before_on, double sleep_before_off, + bool hpd_may_be_low) { struct cec_log_addrs laddrs = { }; struct cec_msg msg; @@ -1604,7 +1679,7 @@ static void stress_test_power_cycle(const struct node &node, unsigned cnt, if (mod_usleep) printf("Randomizer seed: %u\n\n", seed); - unsigned from = init_power_cycle_test(node, repeats, max_tries); + unsigned from = init_standby_wakeup_cycle_test(node, repeats, max_tries); doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs); if (laddrs.log_addr[0] != CEC_LOG_ADDR_INVALID) @@ -1612,10 +1687,11 @@ static void stress_test_power_cycle(const struct node &node, unsigned cnt, else wakeup_la = CEC_LOG_ADDR_UNREGISTERED; - bool hpd_is_low = wakeup_la == CEC_LOG_ADDR_UNREGISTERED; + bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || hpd_may_be_low; printf("The Hotplug Detect pin %s when in Standby\n\n", - hpd_is_low ? "is pulled low" : "remains high"); + hpd_may_be_low ? "may be pulled low" : + (hpd_is_low ? "is pulled low" : "remains high")); srandom(seed); @@ -1814,6 +1890,195 @@ static void stress_test_power_cycle(const struct node &node, unsigned cnt, } } +static void stress_test_random_standby_wakeup_cycle(const struct node &node, unsigned cnt, + double min_sleep, double max_sleep, + bool has_seed, unsigned seed, + bool hpd_may_be_low) +{ + struct cec_log_addrs laddrs = { }; + struct cec_msg msg; + unsigned iter = 0; + unsigned min_usleep = 1000000.0 * (max_sleep ? min_sleep : 0); + unsigned mod_usleep = 0; + unsigned from, wakeup_la; + __u16 pa; + int ret; + + if (max_sleep) + mod_usleep = 1000000.0 * (max_sleep - min_sleep) + 1; + + if (!has_seed) + seed = time(nullptr); + + if (mod_usleep) + printf("Randomizer seed: %u\n\n", seed); + + doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &pa); + if (pa == CEC_PHYS_ADDR_INVALID || !pa) { + cec_msg_init(&msg, 0xf, CEC_LOG_ADDR_TV); + cec_msg_image_view_on(&msg); + if (transmit_msg_retry(node, msg)) { + printf("FAIL: Image View On failed\n"); + std::exit(EXIT_FAILURE); + } + sleep(15); + doioctl(&node, CEC_ADAP_G_PHYS_ADDR, &pa); + if (pa == CEC_PHYS_ADDR_INVALID || !pa) { + printf("FAIL: invalid physical address\n"); + std::exit(EXIT_FAILURE); + } + printf("Physical Address: %x.%x.%x.%x\n", + cec_phys_addr_exp(pa)); + } + + doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs); + if (laddrs.log_addr[0] == CEC_LOG_ADDR_INVALID) { + printf("FAIL: invalid logical address\n"); + std::exit(EXIT_FAILURE); + } + from = laddrs.log_addr[0]; + + init_standby_wakeup_cycle_test(node, 2, 30); + + doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs); + if (laddrs.log_addr[0] != CEC_LOG_ADDR_INVALID) + wakeup_la = laddrs.log_addr[0]; + else + wakeup_la = CEC_LOG_ADDR_UNREGISTERED; + + bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || hpd_may_be_low; + + printf("The Hotplug Detect pin %s when in Standby\n\n", + hpd_may_be_low ? "may be pulled low" : + (hpd_is_low ? "is pulled low" : "remains high")); + + srandom(seed); + + for (;;) { + unsigned usecs1 = mod_usleep ? random() % mod_usleep : 0; + unsigned usecs2 = mod_usleep ? random() % mod_usleep : 0; + + usecs1 += min_usleep; + usecs2 += min_usleep; + + iter++; + + bool verify_result = iter % 10 == 0; + + if (verify_result) + usecs1 = 30 * 1000000; + + if (usecs1) + printf("%s: Sleep %.2fs before Image View On\n", ts2s(current_ts()).c_str(), + usecs1 / 1000000.0); + fflush(stdout); + usleep(usecs1); + printf("%s: ", ts2s(current_ts()).c_str()); + printf("Transmit Image View On from LA %s (iteration %u): ", cec_la2s(wakeup_la), iter); + + cec_msg_init(&msg, wakeup_la, CEC_LOG_ADDR_TV); + cec_msg_image_view_on(&msg); + for (int i = 0; i < 50; i++) { + ret = transmit_msg_retry(node, msg); + if (!ret) + break; + usleep(200000); + } + if (ret) + printf("%s\n", strerror(ret)); + else + printf("OK\n"); + + if (verify_result) { + printf("%s: Sleep %.2fs before verifying power state\n", ts2s(current_ts()).c_str(), + usecs1 / 1000000.0); + fflush(stdout); + usleep(usecs1); + cec_msg_init(&msg, from, CEC_LOG_ADDR_TV); + cec_msg_give_device_power_status(&msg, true); + printf("%s: ", ts2s(current_ts()).c_str()); + printf("Transmit Give Device Power Status from LA %s: ", cec_la2s(from)); + ret = transmit_msg_retry(node, msg); + if (!ret) { + __u8 pwr; + + cec_ops_report_power_status(&msg, &pwr); + printf("%s\n", power_status2s(pwr)); + if (pwr == CEC_OP_POWER_STATUS_ON) + goto done; + } else { + printf("%s\n", strerror(ret)); + } + printf("%s: ", ts2s(current_ts()).c_str()); + printf("Retry transmit Image View On from LA %s: ", cec_la2s(wakeup_la)); + + cec_msg_init(&msg, wakeup_la, CEC_LOG_ADDR_TV); + cec_msg_image_view_on(&msg); + ret = transmit_msg_retry(node, msg); + if (ret) { + printf("%s\n", strerror(ret)); + printf("FAIL: never woke up\n"); + std::exit(EXIT_FAILURE); + } + printf("OK\n"); + printf("%s: Sleep %.2fs before verifying power state\n", ts2s(current_ts()).c_str(), + usecs1 / 1000000.0); + fflush(stdout); + usleep(usecs1); + cec_msg_init(&msg, from, CEC_LOG_ADDR_TV); + cec_msg_give_device_power_status(&msg, true); + printf("%s: ", ts2s(current_ts()).c_str()); + printf("Retry transmit Give Device Power Status from LA %s: ", cec_la2s(from)); + ret = transmit_msg_retry(node, msg); + if (ret) { + printf("%s\n", strerror(ret)); + } else { + __u8 pwr; + + cec_ops_report_power_status(&msg, &pwr); + printf("%s\n", power_status2s(pwr)); + if (pwr == CEC_OP_POWER_STATUS_ON) + goto done; + } + printf("FAIL: never woke up\n"); + std::exit(EXIT_FAILURE); + } +done: + + if (cnt && iter == cnt) + break; + + if (usecs2) + printf("%s: Sleep %.2fs before Standby\n", ts2s(current_ts()).c_str(), + usecs2 / 1000000.0); + fflush(stdout); + usleep(usecs2); + printf("%s: ", ts2s(current_ts()).c_str()); + printf("Transmit Standby from LA %s (iteration %u): ", cec_la2s(from), iter); + + /* + * Some displays only accept Standby from the Active Source. + * So make us the Active Source before sending Standby. + */ + cec_msg_init(&msg, from, CEC_LOG_ADDR_TV); + cec_msg_active_source(&msg, pa); + transmit_msg_retry(node, msg); + cec_msg_init(&msg, from, CEC_LOG_ADDR_TV); + cec_msg_standby(&msg); + for (int i = 0; i < 50; i++) { + ret = transmit_msg_retry(node, msg); + if (!ret) + break; + usleep(200000); + } + if (ret) + printf("%s\n", strerror(ret)); + else + printf("OK\n"); + } +} + + static int calc_node_val(const char *s) { s = std::strrchr(s, '/') + 1; @@ -2029,17 +2294,25 @@ int main(int argc, char **argv) __u32 timeout = 1000; __u32 monitor_time = 0; __u32 vendor_id = 0x000c03; /* HDMI LLC vendor ID */ - unsigned int stress_test_pwr_cycle_cnt = 0; - double stress_test_pwr_cycle_min_sleep = 0; - double stress_test_pwr_cycle_max_sleep = 0; - unsigned int stress_test_pwr_cycle_polls = 30; - bool stress_test_pwr_cycle_has_seed = false; - unsigned int stress_test_pwr_cycle_seed = 0; - unsigned int stress_test_pwr_cycle_repeats = 0; - double stress_test_pwr_cycle_sleep_before_on = 0; - double stress_test_pwr_cycle_sleep_before_off = 0; - unsigned int test_pwr_cycle_polls = 15; - unsigned int test_pwr_cycle_sleep = 10; + unsigned int stress_test_standby_wakeup_cycle_cnt = 0; + double stress_test_standby_wakeup_cycle_min_sleep = 0; + double stress_test_standby_wakeup_cycle_max_sleep = 0; + unsigned int stress_test_standby_wakeup_cycle_polls = 30; + bool stress_test_standby_wakeup_cycle_has_seed = false; + unsigned int stress_test_standby_wakeup_cycle_seed = 0; + unsigned int stress_test_standby_wakeup_cycle_repeats = 0; + double stress_test_standby_wakeup_cycle_sleep_before_on = 0; + double stress_test_standby_wakeup_cycle_sleep_before_off = 0; + bool stress_test_standby_wakeup_cycle_hpd_may_be_low = false; + unsigned int test_standby_wakeup_cycle_polls = 15; + unsigned int test_standby_wakeup_cycle_sleep = 10; + bool test_standby_wakeup_cycle_hpd_may_be_low = false; + unsigned int stress_test_random_standby_wakeup_cnt = 0; + double stress_test_random_standby_wakeup_min_sleep = 0; + double stress_test_random_standby_wakeup_max_sleep = 10; + bool stress_test_random_standby_wakeup_has_seed = false; + unsigned int stress_test_random_standby_wakeup_seed = 0; + bool stress_test_random_standby_wakeup_hpd_may_be_low = false; bool warn_if_unconfigured = false; __u16 phys_addr; __u8 from = 0, to = 0, first_to = 0xff; @@ -2415,10 +2688,11 @@ int main(int argc, char **argv) list_devices(); break; - case OptTestPowerCycle: { + case OptTestStandbyWakeupCycle: { static constexpr const char *arg_names[] = { "polls", "sleep", + "hpd-may-be-low", nullptr }; char *value, *subs = optarg; @@ -2430,10 +2704,13 @@ int main(int argc, char **argv) while (*subs != '\0') { switch (cec_parse_subopt(&subs, arg_names, &value)) { case 0: - test_pwr_cycle_polls = strtoul(value, nullptr, 0); + test_standby_wakeup_cycle_polls = strtoul(value, nullptr, 0); break; case 1: - test_pwr_cycle_sleep = strtoul(value, nullptr, 0); + test_standby_wakeup_cycle_sleep = strtoul(value, nullptr, 0); + break; + case 2: + test_standby_wakeup_cycle_hpd_may_be_low = true; break; default: std::exit(EXIT_FAILURE); @@ -2442,7 +2719,7 @@ int main(int argc, char **argv) break; } - case OptStressTestPowerCycle: { + case OptStressTestStandbyWakeupCycle: { static constexpr const char *arg_names[] = { "cnt", "min-sleep", @@ -2452,6 +2729,7 @@ int main(int argc, char **argv) "sleep-before-on", "sleep-before-off", "polls", + "hpd-may-be-low", nullptr }; char *value, *subs = optarg; @@ -2459,35 +2737,79 @@ int main(int argc, char **argv) while (*subs != '\0') { switch (cec_parse_subopt(&subs, arg_names, &value)) { case 0: - stress_test_pwr_cycle_cnt = strtoul(value, nullptr, 0); + stress_test_standby_wakeup_cycle_cnt = strtoul(value, nullptr, 0); break; case 1: - stress_test_pwr_cycle_min_sleep = strtod(value, nullptr); + stress_test_standby_wakeup_cycle_min_sleep = strtod(value, nullptr); break; case 2: - stress_test_pwr_cycle_max_sleep = strtod(value, nullptr); + stress_test_standby_wakeup_cycle_max_sleep = strtod(value, nullptr); break; case 3: - stress_test_pwr_cycle_has_seed = true; - stress_test_pwr_cycle_seed = strtoul(value, nullptr, 0); + stress_test_standby_wakeup_cycle_has_seed = true; + stress_test_standby_wakeup_cycle_seed = strtoul(value, nullptr, 0); break; case 4: - stress_test_pwr_cycle_repeats = strtoul(value, nullptr, 0); + stress_test_standby_wakeup_cycle_repeats = strtoul(value, nullptr, 0); break; case 5: - stress_test_pwr_cycle_sleep_before_on = strtod(value, nullptr); + stress_test_standby_wakeup_cycle_sleep_before_on = strtod(value, nullptr); break; case 6: - stress_test_pwr_cycle_sleep_before_off = strtod(value, nullptr); + stress_test_standby_wakeup_cycle_sleep_before_off = strtod(value, nullptr); break; case 7: - stress_test_pwr_cycle_polls = strtoul(value, nullptr, 0); + stress_test_standby_wakeup_cycle_polls = strtoul(value, nullptr, 0); + break; + case 8: + stress_test_standby_wakeup_cycle_hpd_may_be_low = true; + break; + default: + std::exit(EXIT_FAILURE); + } + } + if (stress_test_standby_wakeup_cycle_min_sleep > stress_test_standby_wakeup_cycle_max_sleep) { + fprintf(stderr, "min-sleep > max-sleep\n"); + std::exit(EXIT_FAILURE); + } + warn_if_unconfigured = true; + break; + } + + case OptStressTestRandomStandbyWakeupCycle: { + static constexpr const char *arg_names[] = { + "cnt", + "min-sleep", + "max-sleep", + "seed", + "hpd-may-be-low", + nullptr + }; + char *value, *subs = optarg; + + while (*subs != '\0') { + switch (cec_parse_subopt(&subs, arg_names, &value)) { + case 0: + stress_test_random_standby_wakeup_cnt = strtoul(value, nullptr, 0); + break; + case 1: + stress_test_random_standby_wakeup_min_sleep = strtod(value, nullptr); + break; + case 2: + stress_test_random_standby_wakeup_max_sleep = strtod(value, nullptr); + break; + case 3: + stress_test_random_standby_wakeup_has_seed = true; + stress_test_random_standby_wakeup_seed = strtoul(value, nullptr, 0); + break; + case 4: + stress_test_random_standby_wakeup_hpd_may_be_low = true; break; default: std::exit(EXIT_FAILURE); } } - if (stress_test_pwr_cycle_min_sleep > stress_test_pwr_cycle_max_sleep) { + if (stress_test_random_standby_wakeup_min_sleep > stress_test_random_standby_wakeup_max_sleep) { fprintf(stderr, "min-sleep > max-sleep\n"); std::exit(EXIT_FAILURE); } @@ -2762,7 +3084,9 @@ int main(int argc, char **argv) phys_addrs[la] = (phys_addr << 8) | la; } - if (options[OptTestPowerCycle] || options[OptStressTestPowerCycle]) { + if (options[OptTestStandbyWakeupCycle] || + options[OptStressTestStandbyWakeupCycle] || + options[OptStressTestRandomStandbyWakeupCycle]) { print_version(); printf("\n"); } @@ -2787,7 +3111,7 @@ int main(int argc, char **argv) if (node.num_log_addrs == 0) { if (options[OptMonitor] || options[OptMonitorAll] || - options[OptMonitorPin] || options[OptStorePin]) + options[OptMonitorPin]) goto skip_la; if (warn_if_unconfigured) fprintf(stderr, "\nAdapter is unconfigured, please configure it first.\n"); @@ -2862,22 +3186,35 @@ int main(int argc, char **argv) if (options[OptNonBlocking]) fcntl(node.fd, F_SETFL, fcntl(node.fd, F_GETFL) & ~O_NONBLOCK); - if (options[OptTestPowerCycle]) - test_power_cycle(node, test_pwr_cycle_polls, test_pwr_cycle_sleep); - if (options[OptStressTestPowerCycle]) - stress_test_power_cycle(node, stress_test_pwr_cycle_cnt, - stress_test_pwr_cycle_min_sleep, - stress_test_pwr_cycle_max_sleep, - stress_test_pwr_cycle_polls, - stress_test_pwr_cycle_has_seed, - stress_test_pwr_cycle_seed, - stress_test_pwr_cycle_repeats, - stress_test_pwr_cycle_sleep_before_on, - stress_test_pwr_cycle_sleep_before_off); + if (options[OptTestStandbyWakeupCycle]) + test_standby_wakeup_cycle(node, + test_standby_wakeup_cycle_polls, + test_standby_wakeup_cycle_sleep, + test_standby_wakeup_cycle_hpd_may_be_low); + if (options[OptStressTestStandbyWakeupCycle]) + stress_test_standby_wakeup_cycle(node, + stress_test_standby_wakeup_cycle_cnt, + stress_test_standby_wakeup_cycle_min_sleep, + stress_test_standby_wakeup_cycle_max_sleep, + stress_test_standby_wakeup_cycle_polls, + stress_test_standby_wakeup_cycle_has_seed, + stress_test_standby_wakeup_cycle_seed, + stress_test_standby_wakeup_cycle_repeats, + stress_test_standby_wakeup_cycle_sleep_before_on, + stress_test_standby_wakeup_cycle_sleep_before_off, + stress_test_standby_wakeup_cycle_hpd_may_be_low); + if (options[OptStressTestRandomStandbyWakeupCycle]) + stress_test_random_standby_wakeup_cycle(node, + stress_test_random_standby_wakeup_cnt, + stress_test_random_standby_wakeup_min_sleep, + stress_test_random_standby_wakeup_max_sleep, + stress_test_random_standby_wakeup_has_seed, + stress_test_random_standby_wakeup_seed, + stress_test_random_standby_wakeup_hpd_may_be_low); skip_la: if (options[OptMonitor] || options[OptMonitorAll] || - options[OptMonitorPin] || options[OptStorePin]) { + options[OptMonitorPin]) { monitor(node, monitor_time, store_pin); } else if (options[OptWaitForMsgs]) { wait_for_msgs(node, monitor_time); diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp index cf4b6d34..f3500555 100644 --- a/utils/cec-ctl/cec-pin.cpp +++ b/utils/cec-ctl/cec-pin.cpp @@ -8,12 +8,6 @@ #include <linux/cec.h> #include "cec-htng.h" -#ifdef __ANDROID__ -#include <android-config.h> -#else -#include <config.h> -#endif - #include "cec-ctl.h" #include "cec-log.h" diff --git a/utils/cec-ctl/meson.build b/utils/cec-ctl/meson.build new file mode 100644 index 00000000..059ca206 --- /dev/null +++ b/utils/cec-ctl/meson.build @@ -0,0 +1,18 @@ +cec_ctl_sources = files( + 'cec-ctl.cpp', + 'cec-ctl.h', + 'cec-pin.cpp', +) + +cec_ctl_deps = [ + dep_libcecutil, + dep_librt, +] + +cec_ctl = executable('cec-ctl', + cec_ctl_sources, + install : true, + dependencies : cec_ctl_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'cec-ctl', 1 ]] diff --git a/utils/cec-follower/.gitignore b/utils/cec-follower/.gitignore deleted file mode 100644 index 29546d1f..00000000 --- a/utils/cec-follower/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -cec-follower -cec-follower.1 diff --git a/utils/cec-follower/Makefile.am b/utils/cec-follower/Makefile.am deleted file mode 100644 index 903d3715..00000000 --- a/utils/cec-follower/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -bin_PROGRAMS = cec-follower -man_MANS = cec-follower.1 - -cec_follower_SOURCES = cec-follower.cpp cec-follower.h cec-processing.cpp cec-tuner.cpp -cec_follower_CPPFLAGS = -I$(top_srcdir)/utils/libcecutil $(GIT_SHA) $(GIT_COMMIT_CNT) $(GIT_COMMIT_DATE) -cec_follower_LDADD = -lrt ../libcecutil/libcecutil.la - -EXTRA_DIST = cec-follower.1 diff --git a/utils/cec-follower/cec-follower.1.in b/utils/cec-follower/cec-follower.1.in index 281651ea..64a0968f 100644 --- a/utils/cec-follower/cec-follower.1.in +++ b/utils/cec-follower/cec-follower.1.in @@ -76,6 +76,9 @@ Prints the help message. \fB\-n\fR, \fB\-\-no\-warnings\fR Turn off warning messages. .TP +\fB\-e\fR, \fB\-\-exclusive\fR +If specified, then the follower uses exclusive mode (CEC_MODE_EXCL_FOLLOWER). +.TP \fB\-m\fR, \fB\-\-show\-msgs\fR Show received messages. .TP @@ -96,6 +99,12 @@ is emulating a TV. Ignore messages from logical address \fI<la>\fR and opcode \fI<opcode>\fR. 'all' can be used for \fI<la>\fR or \fI<opcode>\fR to match all logical addresses or opcodes. +.TP +\fB\-\-ignore\-standby\fR \fI<n>\fR +Ignore every <n>th received Standby message. +.TP +\fB\-\-ignore\-view\-on\fR \fI<n>\fR +Ignore every <n>th received Image/Text View On message. .SH EXIT STATUS On success, it returns 0. Otherwise, it will return the error code. diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp index 0adf6ce8..a7481aea 100644 --- a/utils/cec-follower/cec-follower.cpp +++ b/utils/cec-follower/cec-follower.cpp @@ -25,6 +25,7 @@ enum Option { OptSetAdapter = 'a', OptSetDevice = 'd', OptSetDriver = 'D', + OptExclusive = 'e', OptHelp = 'h', OptIgnore = 'i', OptNoWarnings = 'n', @@ -36,6 +37,8 @@ enum Option { OptServiceByDigID = 128, OptStandby, OptTogglePowerStatus, + OptIgnoreStandby, + OptIgnoreViewOn, OptVersion, OptLast = 256 }; @@ -53,6 +56,7 @@ static struct option long_options[] = { { "device", required_argument, nullptr, OptSetDevice }, { "adapter", required_argument, nullptr, OptSetAdapter }, { "driver", required_argument, nullptr, OptSetDriver }, + { "exclusive", no_argument, 0, OptExclusive }, { "help", no_argument, nullptr, OptHelp }, { "no-warnings", no_argument, nullptr, OptNoWarnings }, { "trace", no_argument, nullptr, OptTrace }, @@ -63,6 +67,8 @@ static struct option long_options[] = { { "service-by-dig-id", no_argument, nullptr, OptServiceByDigID }, { "standby", no_argument, nullptr, OptStandby }, { "toggle-power-status", required_argument, nullptr, OptTogglePowerStatus }, + { "ignore-standby", required_argument, nullptr, OptIgnoreStandby }, + { "ignore-view-on", required_argument, nullptr, OptIgnoreViewOn }, { "ignore", required_argument, nullptr, OptIgnore }, { "version", no_argument, nullptr, OptVersion }, @@ -84,12 +90,17 @@ static void usage() " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" + " -e, --exclusive If specified, then the follower uses exclusive mode (CEC_MODE_EXCL_FOLLOWER)\n" " -m, --show-msgs Show received messages\n" " -s, --show-state Show state changes from the emulated device\n" " --service-by-dig-id Report digital services by digital ID instead of by channel\n" " --standby Start in Standby state\n" " --toggle-power-status <secs>\n" " Toggle the power status every <secs> seconds\n" + " --ignore-standby <n>\n" + " Ignore every <n>th received Standby message\n" + " --ignore-view-on <n>\n" + " Ignore every <n>th received Image/Text View On message\n" " -i, --ignore <la>,<opcode>\n" " Ignore messages from logical address <la> and opcode\n" " <opcode>. 'all' can be used for <la> or <opcode> to match\n" @@ -459,6 +470,12 @@ int main(int argc, char **argv) case OptTogglePowerStatus: toggle_power_status = strtoul(optarg, nullptr, 0); break; + case OptIgnoreStandby: + node.ignore_standby = strtoul(optarg, nullptr, 0); + break; + case OptIgnoreViewOn: + node.ignore_view_on = strtoul(optarg, nullptr, 0); + break; case OptIgnore: { bool all_la = !strncmp(optarg, "all", 3); bool all_opcodes = true; @@ -605,5 +622,5 @@ int main(int argc, char **argv) std::exit(EXIT_FAILURE); } - testProcessing(&node, options[OptWallClock]); + testProcessing(&node, options[OptExclusive], options[OptWallClock]); } diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h index 945e65ff..8328d9a7 100644 --- a/utils/cec-follower/cec-follower.h +++ b/utils/cec-follower/cec-follower.h @@ -11,12 +11,6 @@ #include <linux/cec-funcs.h> #include "cec-htng-funcs.h" -#ifdef ANDROID -#include <android-config.h> -#else -#include <config.h> -#endif - #include <cec-info.h> #include <cec-log.h> #include <set> @@ -86,6 +80,10 @@ struct node { bool ignore_la[16]; unsigned short ignore_opcode[256]; + unsigned standby_cnt; + unsigned ignore_standby; + unsigned view_on_cnt; + unsigned ignore_view_on; }; struct Timer { @@ -198,6 +196,10 @@ struct short_audio_desc { #define SAD_EXT_TYPE_AC_4 12 #define SAD_EXT_TYPE_LPCM_3D_AUDIO 13 +#ifndef __FILE_NAME__ +#define __FILE_NAME__ __FILE__ +#endif + #define info(fmt, args...) \ do { \ if (show_info) \ @@ -214,7 +216,7 @@ struct short_audio_desc { do { \ warnings++; \ if (show_warnings) \ - printf("\t\twarn: %s(%d): " fmt, __FILE__, __LINE__, ##args); \ + printf("\t\twarn: %s(%d): " fmt, __FILE_NAME__, __LINE__, ##args); \ } while (0) #define warn_once(fmt, args...) \ @@ -226,7 +228,7 @@ struct short_audio_desc { warnings++; \ if (show_warnings) \ printf("\t\twarn: %s(%d): " fmt, \ - __FILE__, __LINE__, ##args); \ + __FILE_NAME__, __LINE__, ##args); \ } \ } while (0) @@ -276,7 +278,7 @@ void process_timer_msgs(struct node *node, struct cec_msg &msg, unsigned me, __u // CEC processing void reply_feature_abort(struct node *node, struct cec_msg *msg, __u8 reason = CEC_OP_ABORT_UNRECOGNIZED_OP); -void testProcessing(struct node *node, bool wallclock); +void testProcessing(struct node *node, bool exclusive, bool wallclock); bool enter_standby(struct node *node); #endif diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp index 661cbf42..14ee211b 100644 --- a/utils/cec-follower/cec-processing.cpp +++ b/utils/cec-follower/cec-processing.cpp @@ -332,7 +332,8 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me, __u8 /* Standby */ case CEC_MSG_STANDBY: - enter_standby(node); + if (!node->ignore_standby || (++node->standby_cnt % node->ignore_standby)) + enter_standby(node); return; @@ -366,7 +367,8 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me, __u8 case CEC_MSG_TEXT_VIEW_ON: if (!cec_has_tv(1 << me)) break; - exit_standby(node); + if (!node->ignore_view_on || (++node->view_on_cnt % node->ignore_view_on)) + exit_standby(node); return; case CEC_MSG_SET_STREAM_PATH: { __u16 phys_addr; @@ -1076,13 +1078,14 @@ static void update_programmed_timers(struct node *node) } } -void testProcessing(struct node *node, bool wallclock) +void testProcessing(struct node *node, bool exclusive, bool wallclock) { struct cec_log_addrs laddrs; fd_set rd_fds; fd_set ex_fds; int fd = node->fd; - __u32 mode = CEC_MODE_INITIATOR | CEC_MODE_FOLLOWER; + __u32 mode = CEC_MODE_INITIATOR | + (exclusive ? CEC_MODE_EXCL_FOLLOWER : CEC_MODE_FOLLOWER); unsigned me; unsigned last_poll_la = 15; __u8 last_pwr_state = current_power_state(node); diff --git a/utils/cec-follower/meson.build b/utils/cec-follower/meson.build new file mode 100644 index 00000000..2d58fac4 --- /dev/null +++ b/utils/cec-follower/meson.build @@ -0,0 +1,19 @@ +cec_follower_sources = files( + 'cec-follower.cpp', + 'cec-follower.h', + 'cec-processing.cpp', + 'cec-tuner.cpp', +) + +cec_follower_deps = [ + dep_libcecutil, + dep_librt, +] + +cec_follower = executable('cec-follower', + cec_follower_sources, + install : true, + dependencies : cec_follower_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'cec-follower', 1 ]] diff --git a/utils/common/cv4l-helpers.h b/utils/common/cv4l-helpers.h index 3cee372b..91a04146 100644 --- a/utils/common/cv4l-helpers.h +++ b/utils/common/cv4l-helpers.h @@ -82,6 +82,7 @@ public: bool has_rw() const { return v4l_has_rw(this); } bool has_streaming() const { return v4l_has_streaming(this); } bool has_ext_pix_format() const { return v4l_has_ext_pix_format(this); } + bool has_streams() const { return have_streams; } int querycap(v4l2_capability &cap, bool force = false) { diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp index 53e132f5..95e4c74f 100644 --- a/utils/common/media-info.cpp +++ b/utils/common/media-info.cpp @@ -3,6 +3,7 @@ * Copyright 2018 Cisco Systems, Inc. and/or its affiliates. All rights reserved. */ +#include <cstdint> #include <cstring> #include <fstream> #include <iostream> @@ -333,6 +334,7 @@ static constexpr flag_def entity_functions_def[] = { { MEDIA_ENT_F_PROC_VIDEO_STATISTICS, "Video Statistics" }, { MEDIA_ENT_F_PROC_VIDEO_DECODER, "Video Decoder" }, { MEDIA_ENT_F_PROC_VIDEO_ENCODER, "Video Encoder" }, + { MEDIA_ENT_F_PROC_VIDEO_ISP, "Image Signal Processor" }, { MEDIA_ENT_F_VID_MUX, "Video Muxer" }, { MEDIA_ENT_F_VID_IF_BRIDGE, "Video Interface Bridge" }, { 0, nullptr } @@ -365,15 +367,17 @@ std::string mi_entfunction2s(__u32 function, bool *is_invalid) if (function == entity_functions_def[i].flag) { bool fail = !memcmp(entity_functions_def[i].str, "FAIL: ", 6); - if (is_invalid) { + if (is_invalid && fail) { *is_invalid = fail; return entity_functions_def[i].str; } return fail ? entity_functions_def[i].str + 6 : entity_functions_def[i].str; } } - if (is_invalid) - return "WARNING: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?"; + if (is_invalid) { + *is_invalid = true; + return "FAIL: Unknown Function (" + num2s(function) + "), is v4l2-compliance out-of-date?"; + } return "Unknown Function (" + num2s(function) + ")"; } @@ -570,7 +574,7 @@ static __u32 read_topology(int media_fd, __u32 major, __u32 minor, } printf("\t Link 0x%08x: %s remote pad 0x%x of entity '%s' (%s): %s\n", link.id, is_sink ? "from" : "to", remote_pad, - remote_ent->name, mi_entfunction2s(remote_ent->function).c_str(), + remote_ent->name, mi_entfunction2s(remote_ent->function, is_invalid).c_str(), mi_linkflags2s(link.flags).c_str()); if (function && !*function) *function = remote_ent->function; diff --git a/utils/common/v4l-helpers.h b/utils/common/v4l-helpers.h index c09cd987..f8e96d58 100644 --- a/utils/common/v4l-helpers.h +++ b/utils/common/v4l-helpers.h @@ -9,6 +9,7 @@ #ifndef _V4L_HELPERS_H_ #define _V4L_HELPERS_H_ +#include <linux/v4l2-subdev.h> #include <linux/videodev2.h> #include <string.h> #include <stdlib.h> @@ -39,6 +40,7 @@ struct v4l_fd { bool have_selection; bool is_subdev; bool is_media; + bool have_streams; int (*open)(struct v4l_fd *f, const char *file, int oflag, ...); int (*close)(struct v4l_fd *f); @@ -507,6 +509,12 @@ static inline int v4l_open(struct v4l_fd *f, const char *devname, bool non_block static inline int v4l_subdev_s_fd(struct v4l_fd *f, int fd, const char *devname) { + struct v4l2_subdev_client_capability clientcap = {}; + struct v4l2_subdev_capability subdevcap = {}; + bool subdev_streams; + bool client_streams; + int ret; + if (f->fd >= 0) f->close(f); @@ -528,6 +536,16 @@ static inline int v4l_subdev_s_fd(struct v4l_fd *f, int fd, const char *devname) f->have_next_ctrl = false; f->have_selection = false; + ret = ioctl(f->fd, VIDIOC_SUBDEV_QUERYCAP, &subdevcap); + subdev_streams = !ret && (subdevcap.capabilities & V4L2_SUBDEV_CAP_STREAMS); + + clientcap.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS; + + ret = ioctl(f->fd, VIDIOC_SUBDEV_S_CLIENT_CAP, &clientcap); + client_streams = !ret && (clientcap.capabilities & V4L2_SUBDEV_CLIENT_CAP_STREAMS); + + f->have_streams = subdev_streams && client_streams; + return f->fd; } diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp index 00a5fada..4f8c2aa7 100644 --- a/utils/common/v4l2-info.cpp +++ b/utils/common/v4l2-info.cpp @@ -16,12 +16,7 @@ static std::string num2s(unsigned num, bool is_hex = true) return buf; } -struct flag_def { - unsigned flag; - const char *str; -}; - -static std::string flags2s(unsigned val, const flag_def *def) +std::string flags2s(unsigned val, const flag_def *def) { std::string s; @@ -92,10 +87,10 @@ static std::string cap2s(unsigned cap) s += "\t\tAudio\n"; if (cap & V4L2_CAP_RADIO) s += "\t\tRadio\n"; + if (cap & V4L2_CAP_IO_MC) + s += "\t\tI/O MC\n"; if (cap & V4L2_CAP_READWRITE) s += "\t\tRead/Write\n"; - if (cap & V4L2_CAP_ASYNCIO) - s += "\t\tAsync I/O\n"; if (cap & V4L2_CAP_STREAMING) s += "\t\tStreaming\n"; if (cap & V4L2_CAP_EXT_PIX_FORMAT) @@ -111,6 +106,8 @@ static std::string subdevcap2s(unsigned cap) if (cap & V4L2_SUBDEV_CAP_RO_SUBDEV) s += "\t\tRead-Only Sub-Device\n"; + if (cap & V4L2_SUBDEV_CAP_STREAMS) + s += "\t\tStreams Support\n"; return s; } @@ -347,6 +344,7 @@ std::string quantization2s(int val) static constexpr flag_def pixflags_def[] = { { V4L2_PIX_FMT_FLAG_PREMUL_ALPHA, "premultiplied-alpha" }, + { V4L2_PIX_FMT_FLAG_SET_CSC, "set-csc" }, { 0, nullptr } }; @@ -768,3 +766,109 @@ std::string vbiflags2s(__u32 flags) { return flags2s(flags, vbi_def); } + +std::string ttype2s(int type) +{ + switch (type) { + case V4L2_TUNER_RADIO: return "radio"; + case V4L2_TUNER_ANALOG_TV: return "Analog TV"; + case V4L2_TUNER_DIGITAL_TV: return "Digital TV"; + case V4L2_TUNER_SDR: return "SDR"; + case V4L2_TUNER_RF: return "RF"; + default: return "unknown"; + } +} + +std::string audmode2s(int audmode) +{ + switch (audmode) { + case V4L2_TUNER_MODE_STEREO: return "stereo"; + case V4L2_TUNER_MODE_LANG1: return "lang1"; + case V4L2_TUNER_MODE_LANG2: return "lang2"; + case V4L2_TUNER_MODE_LANG1_LANG2: return "bilingual"; + case V4L2_TUNER_MODE_MONO: return "mono"; + default: return "unknown"; + } +} + +std::string rxsubchans2s(int rxsubchans) +{ + std::string s; + + if (rxsubchans & V4L2_TUNER_SUB_MONO) + s += "mono "; + if (rxsubchans & V4L2_TUNER_SUB_STEREO) + s += "stereo "; + if (rxsubchans & V4L2_TUNER_SUB_LANG1) + s += "lang1 "; + if (rxsubchans & V4L2_TUNER_SUB_LANG2) + s += "lang2 "; + if (rxsubchans & V4L2_TUNER_SUB_RDS) + s += "rds "; + return s; +} + +std::string txsubchans2s(int txsubchans) +{ + std::string s; + + if (txsubchans & V4L2_TUNER_SUB_MONO) + s += "mono "; + if (txsubchans & V4L2_TUNER_SUB_STEREO) + s += "stereo "; + if (txsubchans & V4L2_TUNER_SUB_LANG1) + s += "bilingual "; + if (txsubchans & V4L2_TUNER_SUB_SAP) + s += "sap "; + if (txsubchans & V4L2_TUNER_SUB_RDS) + s += "rds "; + return s; +} + +std::string tcap2s(unsigned cap) +{ + std::string s; + + if (cap & V4L2_TUNER_CAP_LOW) + s += "62.5 Hz "; + else if (cap & V4L2_TUNER_CAP_1HZ) + s += "1 Hz "; + else + s += "62.5 kHz "; + if (cap & V4L2_TUNER_CAP_NORM) + s += "multi-standard "; + if (cap & V4L2_TUNER_CAP_HWSEEK_BOUNDED) + s += "hwseek-bounded "; + if (cap & V4L2_TUNER_CAP_HWSEEK_WRAP) + s += "hwseek-wrap "; + if (cap & V4L2_TUNER_CAP_STEREO) + s += "stereo "; + if (cap & V4L2_TUNER_CAP_LANG1) + s += "lang1 "; + if (cap & V4L2_TUNER_CAP_LANG2) + s += "lang2 "; + if (cap & V4L2_TUNER_CAP_RDS) + s += "rds "; + if (cap & V4L2_TUNER_CAP_RDS_BLOCK_IO) + s += "rds-block-I/O "; + if (cap & V4L2_TUNER_CAP_RDS_CONTROLS) + s += "rds-controls "; + if (cap & V4L2_TUNER_CAP_FREQ_BANDS) + s += "freq-bands "; + if (cap & V4L2_TUNER_CAP_HWSEEK_PROG_LIM) + s += "hwseek-prog-lim "; + return s; +} + +std::string modulation2s(unsigned modulation) +{ + switch (modulation) { + case V4L2_BAND_MODULATION_VSB: + return "VSB"; + case V4L2_BAND_MODULATION_FM: + return "FM"; + case V4L2_BAND_MODULATION_AM: + return "AM"; + } + return "Unknown"; +} diff --git a/utils/common/v4l2-info.h b/utils/common/v4l2-info.h index 6ddd2ee5..6de5654c 100644 --- a/utils/common/v4l2-info.h +++ b/utils/common/v4l2-info.h @@ -11,6 +11,20 @@ #include <linux/videodev2.h> #include <linux/v4l2-subdev.h> +/* + * The max value comes from a check in the kernel source code + * drivers/media/v4l2-core/v4l2-ioctl.c check_array_args() + */ +#define NUM_ROUTES_MAX 256 + +struct flag_def { + unsigned flag; + const char *str; +}; + +/* Return a comma-separated string of flags or hex value if unknown */ +std::string flags2s(unsigned val, const flag_def *def); + /* Print capability information */ void v4l2_info_capability(const v4l2_capability &cap); void v4l2_info_subdev_capability(const v4l2_subdev_capability &subdevcap); @@ -118,4 +132,22 @@ std::string bufferflags2s(__u32 flags); /* Return vbi flags description */ std::string vbiflags2s(__u32 flags); +/* Return tuner type description */ +std::string ttype2s(int type); + +/* Return audio mode description */ +std::string audmode2s(int audmode); + +/* Return RX subchannels description */ +std::string rxsubchans2s(int rxsubchans); + +/* Return TX subchannels description */ +std::string txsubchans2s(int txsubchans); + +/* Return tuner capabilities description */ +std::string tcap2s(unsigned cap); + +/* Return band modulation description */ +std::string modulation2s(unsigned modulation); + #endif diff --git a/utils/common/v4l2-pix-formats.h b/utils/common/v4l2-pix-formats.h index f2066dec..511a8d41 100644 --- a/utils/common/v4l2-pix-formats.h +++ b/utils/common/v4l2-pix-formats.h @@ -35,11 +35,17 @@ case V4L2_PIX_FMT_BGRX32: return "32-bit XBGR 8-8-8-8"; case V4L2_PIX_FMT_RGBA32: return "32-bit RGBA 8-8-8-8"; case V4L2_PIX_FMT_RGBX32: return "32-bit RGBX 8-8-8-8"; + case V4L2_PIX_FMT_RGBX1010102: return "32-bit RGBX 10-10-10-2"; + case V4L2_PIX_FMT_RGBA1010102: return "32-bit RGBA 10-10-10-2"; + case V4L2_PIX_FMT_ARGB2101010: return "32-bit ARGB 2-10-10-10"; + case V4L2_PIX_FMT_BGR48_12: return "12-bit Depth BGR"; + case V4L2_PIX_FMT_ABGR64_12: return "12-bit Depth BGRA"; case V4L2_PIX_FMT_GREY: return "8-bit Greyscale"; case V4L2_PIX_FMT_Y4: return "4-bit Greyscale"; case V4L2_PIX_FMT_Y6: return "6-bit Greyscale"; case V4L2_PIX_FMT_Y10: return "10-bit Greyscale"; case V4L2_PIX_FMT_Y12: return "12-bit Greyscale"; + case V4L2_PIX_FMT_Y012: return "12-bit Greyscale (bits 15-4)"; case V4L2_PIX_FMT_Y14: return "14-bit Greyscale"; case V4L2_PIX_FMT_Y16: return "16-bit Greyscale"; case V4L2_PIX_FMT_Y16_BE: return "16-bit Greyscale BE"; @@ -78,23 +84,26 @@ case V4L2_PIX_FMT_YUV420: return "Planar YUV 4:2:0"; case V4L2_PIX_FMT_HI240: return "8-bit Dithered RGB (BTTV)"; case V4L2_PIX_FMT_M420: return "YUV 4:2:0 (M420)"; - case V4L2_PIX_FMT_NV12: return "Y/CbCr 4:2:0"; - case V4L2_PIX_FMT_NV21: return "Y/CrCb 4:2:0"; - case V4L2_PIX_FMT_NV16: return "Y/CbCr 4:2:2"; - case V4L2_PIX_FMT_NV61: return "Y/CrCb 4:2:2"; - case V4L2_PIX_FMT_NV24: return "Y/CbCr 4:4:4"; - case V4L2_PIX_FMT_NV42: return "Y/CrCb 4:4:4"; - case V4L2_PIX_FMT_P010: return "10-bit Y/CbCr 4:2:0"; - case V4L2_PIX_FMT_NV12_4L4: return "Y/CbCr 4:2:0 (4x4 Linear)"; - case V4L2_PIX_FMT_NV12_16L16: return "Y/CbCr 4:2:0 (16x16 Linear)"; - case V4L2_PIX_FMT_NV12_32L32: return "Y/CbCr 4:2:0 (32x32 Linear)"; - case V4L2_PIX_FMT_P010_4L4: return "10-bit Y/CbCr 4:2:0 (4x4 Linear)"; - case V4L2_PIX_FMT_NV12M: return "Y/CbCr 4:2:0 (N-C)"; - case V4L2_PIX_FMT_NV21M: return "Y/CrCb 4:2:0 (N-C)"; - case V4L2_PIX_FMT_NV16M: return "Y/CbCr 4:2:2 (N-C)"; - case V4L2_PIX_FMT_NV61M: return "Y/CrCb 4:2:2 (N-C)"; - case V4L2_PIX_FMT_NV12MT: return "Y/CbCr 4:2:0 (64x32 MB, N-C)"; - case V4L2_PIX_FMT_NV12MT_16X16: return "Y/CbCr 4:2:0 (16x16 MB, N-C)"; + case V4L2_PIX_FMT_YUV48_12: return "12-bit YUV 4:4:4 Packed"; + case V4L2_PIX_FMT_NV12: return "Y/UV 4:2:0"; + case V4L2_PIX_FMT_NV21: return "Y/VU 4:2:0"; + case V4L2_PIX_FMT_NV16: return "Y/UV 4:2:2"; + case V4L2_PIX_FMT_NV61: return "Y/VU 4:2:2"; + case V4L2_PIX_FMT_NV24: return "Y/UV 4:4:4"; + case V4L2_PIX_FMT_NV42: return "Y/VU 4:4:4"; + case V4L2_PIX_FMT_P010: return "10-bit Y/UV 4:2:0"; + case V4L2_PIX_FMT_P012: return "12-bit Y/UV 4:2:0"; + case V4L2_PIX_FMT_NV12_4L4: return "Y/UV 4:2:0 (4x4 Linear)"; + case V4L2_PIX_FMT_NV12_16L16: return "Y/UV 4:2:0 (16x16 Linear)"; + case V4L2_PIX_FMT_NV12_32L32: return "Y/UV 4:2:0 (32x32 Linear)"; + case V4L2_PIX_FMT_P010_4L4: return "10-bit Y/UV 4:2:0 (4x4 Linear)"; + case V4L2_PIX_FMT_NV12M: return "Y/UV 4:2:0 (N-C)"; + case V4L2_PIX_FMT_NV21M: return "Y/VU 4:2:0 (N-C)"; + case V4L2_PIX_FMT_NV16M: return "Y/UV 4:2:2 (N-C)"; + case V4L2_PIX_FMT_NV61M: return "Y/VU 4:2:2 (N-C)"; + case V4L2_PIX_FMT_NV12MT: return "Y/UV 4:2:0 (64x32 MB, N-C)"; + case V4L2_PIX_FMT_NV12MT_16X16: return "Y/UV 4:2:0 (16x16 MB, N-C)"; + case V4L2_PIX_FMT_P012M: return "12-bit Y/UV 4:2:0 (N-C)"; case V4L2_PIX_FMT_YUV420M: return "Planar YUV 4:2:0 (N-C)"; case V4L2_PIX_FMT_YVU420M: return "Planar YVU 4:2:0 (N-C)"; case V4L2_PIX_FMT_YUV422M: return "Planar YUV 4:2:2 (N-C)"; @@ -175,8 +184,13 @@ case V4L2_META_FMT_VIVID: return "Vivid Metadata"; case V4L2_META_FMT_RK_ISP1_PARAMS: return "Rockchip ISP1 3A Parameters"; case V4L2_META_FMT_RK_ISP1_STAT_3A: return "Rockchip ISP1 3A Statistics"; + case V4L2_PIX_FMT_NV12_8L128: return "NV12 (8x128 Linear)"; case V4L2_PIX_FMT_NV12M_8L128: return "NV12M (8x128 Linear)"; + case V4L2_PIX_FMT_NV12_10BE_8L128: return "10-bit NV12 (8x128 Linear, BE)"; case V4L2_PIX_FMT_NV12M_10BE_8L128: return "10-bit NV12M (8x128 Linear, BE)"; + case V4L2_PIX_FMT_Y210: return "10-bit YUYV Packed"; + case V4L2_PIX_FMT_Y212: return "12-bit YUYV Packed"; + case V4L2_PIX_FMT_Y216: return "16-bit YUYV Packed"; case V4L2_PIX_FMT_MJPEG: return "Motion-JPEG"; case V4L2_PIX_FMT_JPEG: return "JFIF JPEG"; case V4L2_PIX_FMT_DV: return "1394"; @@ -200,6 +214,9 @@ case V4L2_PIX_FMT_HEVC: return "HEVC"; case V4L2_PIX_FMT_FWHT: return "FWHT"; case V4L2_PIX_FMT_FWHT_STATELESS: return "FWHT Stateless"; + case V4L2_PIX_FMT_SPK: return "Sorenson Spark"; + case V4L2_PIX_FMT_RV30: return "RealVideo 8"; + case V4L2_PIX_FMT_RV40: return "RealVideo 9 & 10"; case V4L2_PIX_FMT_CPIA1: return "GSPCA CPiA YUV"; case V4L2_PIX_FMT_WNVA: return "WNVA"; case V4L2_PIX_FMT_SN9C10X: return "GSPCA SN9C10X"; @@ -221,3 +238,4 @@ case V4L2_PIX_FMT_MT21C: return "Mediatek Compressed Format"; case V4L2_PIX_FMT_QC08C: return "QCOM Compressed 8-bit Format"; case V4L2_PIX_FMT_QC10C: return "QCOM Compressed 10-bit Format"; + case V4L2_PIX_FMT_AJPG: return "Aspeed JPEG"; diff --git a/utils/common/v4l2-tpg-core.c b/utils/common/v4l2-tpg-core.c index 3cfd0f1d..b4075bcb 100644 --- a/utils/common/v4l2-tpg-core.c +++ b/utils/common/v4l2-tpg-core.c @@ -861,9 +861,9 @@ static void precalculate_color(struct tpg_data *tpg, int k) g = tpg_colors[col].g; b = tpg_colors[col].b; } else if (tpg->pattern == TPG_PAT_NOISE) { - r = g = b = prandom_u32_max(256); + r = g = b = get_random_u8(); } else if (k == TPG_COLOR_RANDOM) { - r = g = b = tpg->qual_offset + prandom_u32_max(196); + r = g = b = tpg->qual_offset + get_random_u32_below(196); } else if (k >= TPG_COLOR_RAMP) { r = g = b = k - TPG_COLOR_RAMP; } @@ -2271,7 +2271,7 @@ static void tpg_fill_params_extras(const struct tpg_data *tpg, params->wss_width = tpg->crop.width; params->wss_width = tpg_hscale_div(tpg, p, params->wss_width); params->wss_random_offset = - params->twopixsize * prandom_u32_max(tpg->src_width / 2); + params->twopixsize * get_random_u32_below(tpg->src_width / 2); if (tpg->crop.left < tpg->border.left) { left_pillar_width = tpg->border.left - tpg->crop.left; @@ -2480,9 +2480,9 @@ static void tpg_fill_plane_pattern(const struct tpg_data *tpg, linestart_newer = tpg->black_line[p]; } else if (tpg->pattern == TPG_PAT_NOISE || tpg->qual == TPG_QUAL_NOISE) { linestart_older = tpg->random_line[p] + - twopixsize * prandom_u32_max(tpg->src_width / 2); + twopixsize * get_random_u32_below(tpg->src_width / 2); linestart_newer = tpg->random_line[p] + - twopixsize * prandom_u32_max(tpg->src_width / 2); + twopixsize * get_random_u32_below(tpg->src_width / 2); } else { unsigned frame_line_old = (frame_line + mv_vert_old) % tpg->src_height; diff --git a/utils/common/v4l2-tpg.h b/utils/common/v4l2-tpg.h index 5760854e..f141e408 100644 --- a/utils/common/v4l2-tpg.h +++ b/utils/common/v4l2-tpg.h @@ -56,11 +56,17 @@ static inline void *vzalloc(unsigned long size) #define clamp_t(type, val, min, max) clamp((type)val, (type)min, (type)max) -static inline u32 prandom_u32_max(u32 ep_ro) +static inline u32 get_random_u32_below(u32 ep_ro) { return rand() % ep_ro; } +static inline u32 get_random_u8(void) +{ + return get_random_u32_below(256); +} + + struct tpg_rbg_color8 { unsigned char r, g, b; }; diff --git a/utils/common/v4l2-tpg.patch b/utils/common/v4l2-tpg.patch index 2381ebd9..89a5bf36 100644 --- a/utils/common/v4l2-tpg.patch +++ b/utils/common/v4l2-tpg.patch @@ -167,7 +167,7 @@ diff --git a/utils/common/v4l2-tpg.h b/utils/common/v4l2-tpg.h index 0b0ddb87..91da74ec 100644 --- a/utils/common/v4l2-tpg.h +++ b/utils/common/v4l2-tpg.h -@@ -8,13 +8,59 @@ +@@ -8,13 +8,65 @@ #ifndef _V4L2_TPG_H_ #define _V4L2_TPG_H_ @@ -224,11 +224,17 @@ index 0b0ddb87..91da74ec 100644 + +#define clamp_t(type, val, min, max) clamp((type)val, (type)min, (type)max) + -+static inline u32 prandom_u32_max(u32 ep_ro) ++static inline u32 get_random_u32_below(u32 ep_ro) +{ + return rand() % ep_ro; +} + ++static inline u32 get_random_u8(void) ++{ ++ return get_random_u32_below(256); ++} ++ ++ struct tpg_rbg_color8 { unsigned char r, g, b; }; diff --git a/utils/cx18-ctl/.gitignore b/utils/cx18-ctl/.gitignore deleted file mode 100644 index 15fd535b..00000000 --- a/utils/cx18-ctl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cx18-ctl diff --git a/utils/cx18-ctl/Makefile.am b/utils/cx18-ctl/Makefile.am deleted file mode 100644 index 94fce36d..00000000 --- a/utils/cx18-ctl/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -bin_PROGRAMS = cx18-ctl - -cx18_ctl_SOURCES = cx18-ctl.c diff --git a/utils/cx18-ctl/cx18-ctl.c b/utils/cx18-ctl/cx18-ctl.c index 16a2c82f..8586f72d 100644 --- a/utils/cx18-ctl/cx18-ctl.c +++ b/utils/cx18-ctl/cx18-ctl.c @@ -19,7 +19,6 @@ Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <config.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> diff --git a/utils/cx18-ctl/meson.build b/utils/cx18-ctl/meson.build new file mode 100644 index 00000000..161b91c9 --- /dev/null +++ b/utils/cx18-ctl/meson.build @@ -0,0 +1,8 @@ +cx18_ctl_sources = files( + 'cx18-ctl.c', +) + +cx18_ctl = executable('cx18-ctl', + cx18_ctl_sources, + install : true, + include_directories : v4l2_utils_incdir) diff --git a/utils/dvb/.gitignore b/utils/dvb/.gitignore deleted file mode 100644 index 6123e5ab..00000000 --- a/utils/dvb/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -dvb-fe-tool -dvb-fe-tool.1 -dvb-format-convert -dvb-format-convert.1 -dvbv5-scan -dvbv5-scan.1 -dvbv5-zap -dvbv5-zap.1 -dvbv5-daemon diff --git a/utils/dvb/Makefile.am b/utils/dvb/Makefile.am deleted file mode 100644 index 1895018a..00000000 --- a/utils/dvb/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -bin_PROGRAMS = dvb-fe-tool dvbv5-zap dvbv5-scan dvb-format-convert - -if WITH_DVBV5_REMOTE -bin_PROGRAMS += \ - dvbv5-daemon -endif - -man_MANS = dvb-fe-tool.1 dvbv5-zap.1 dvbv5-scan.1 dvb-format-convert.1 - -dvb_fe_tool_SOURCES = dvb-fe-tool.c -dvb_fe_tool_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvb_fe_tool_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) -dvb_fe_tool_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) - -dvbv5_zap_SOURCES = dvbv5-zap.c -dvbv5_zap_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvbv5_zap_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) -dvbv5_zap_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) - -dvbv5_scan_SOURCES = dvbv5-scan.c -dvbv5_scan_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvbv5_scan_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) -dvbv5_scan_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) - -dvb_format_convert_SOURCES = dvb-format-convert.c -dvb_format_convert_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvb_format_convert_LDFLAGS = $(ARGP_LIBS) -lm $(LIBUDEV_CFLAGS) $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) -dvb_format_convert_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) - -dvbv5_daemon_SOURCES = dvbv5-daemon.c -dvbv5_daemon_LDADD = ../../lib/libdvbv5/libdvbv5.la @LIBINTL@ $(LIBUDEV_LIBS) $(XMLRPC_LDADD) $(PTHREAD_LDADD) -dvbv5_daemon_LDFLAGS = $(ARGP_LIBS) -lm $(XMLRPC_LDFLAGS) $(PTHREAD_LDFLAGS) -dvbv5_daemon_CFLAGS = $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS) $(PTHREAD_CFLAGS) - -EXTRA_DIST = README diff --git a/utils/dvb/dvb-fe-tool.c b/utils/dvb/dvb-fe-tool.c index 92b90905..994fa4e8 100644 --- a/utils/dvb/dvb-fe-tool.c +++ b/utils/dvb/dvb-fe-tool.c @@ -20,7 +20,6 @@ #include "libdvbv5/dvb-file.h" #include "libdvbv5/dvb-dev.h" -#include <config.h> #include <argp.h> #include <signal.h> #include <stdlib.h> diff --git a/utils/dvb/dvb-format-convert.c b/utils/dvb/dvb-format-convert.c index d9019e50..e4bd95df 100644 --- a/utils/dvb/dvb-format-convert.c +++ b/utils/dvb/dvb-format-convert.c @@ -29,8 +29,6 @@ #include <sys/time.h> #include <argp.h> -#include <config.h> - #ifdef ENABLE_NLS # define _(string) gettext(string) # include "gettext.h" diff --git a/utils/dvb/dvbv5-daemon.c b/utils/dvb/dvbv5-daemon.c index d9b70181..669b3321 100644 --- a/utils/dvb/dvbv5-daemon.c +++ b/utils/dvb/dvbv5-daemon.c @@ -24,14 +24,11 @@ #define _LARGEFILE_SOURCE 1 #define _LARGEFILE64_SOURCE 1 -#include <config.h> - #ifdef HAVE_BACKTRACE #include <execinfo.h> #endif #include <argp.h> -#include <config.h> #include <endian.h> #include <netinet/in.h> #include <poll.h> diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c index 0a522433..9f47ead7 100644 --- a/utils/dvb/dvbv5-scan.c +++ b/utils/dvb/dvbv5-scan.c @@ -30,8 +30,6 @@ #include <sys/time.h> #include <argp.h> -#include <config.h> - #ifdef ENABLE_NLS # define _(string) gettext(string) # include "gettext.h" diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c index 8e752297..5f84e101 100644 --- a/utils/dvb/dvbv5-zap.c +++ b/utils/dvb/dvbv5-zap.c @@ -49,8 +49,6 @@ #include <sys/time.h> #include <time.h> -#include <config.h> - #ifdef ENABLE_NLS # define _(string) gettext(string) # include "gettext.h" @@ -92,7 +90,7 @@ struct arguments { int lna, lnb, sat_number; unsigned diseqc_wait, silent, verbose, frontend_only, freq_bpf; unsigned timeout, dvr, rec_psi, exit_after_tuning; - unsigned n_apid, n_vpid, all_pids; + unsigned n_apid, n_vpid, extra_pids, all_pids; enum dvb_file_formats input_format, output_format; unsigned traffic_monitor, low_traffic, non_human, port; char *search, *server; @@ -106,6 +104,7 @@ static const struct argp_option options[] = { {"adapter", 'a', N_("adapter#"), 0, N_("use given adapter (default 0)"), 0}, {"audio_pid", 'A', N_("audio_pid#"), 0, N_("audio pid program to use (default 0)"), 0}, {"channels", 'c', N_("file"), 0, N_("read channels list from 'file'"), 0}, + {"extra-pids", 'E', NULL, 0, N_("output all channel pids"), 0 }, {"demux", 'd', N_("demux#"), 0, N_("use given demux (default 0)"), 0}, {"frontend", 'f', N_("frontend#"), 0, N_("use given frontend (default 0)"), 0}, {"input-format", 'I', N_("format"), 0, N_("Input format: ZAP, CHANNEL, DVBV5 (default: DVBV5)"), 0}, @@ -165,16 +164,24 @@ static int timeout_flag = 0; } while (0) +/* + * Find channel configuration. + * On success, the caller must dvb_file_free(*out_file). + */ static int parse(struct arguments *args, struct dvb_v5_fe_parms *parms, - char *channel, - int *vpid, int *apid, int *sid) + const char *channel, + struct dvb_file **out_file, + const struct dvb_entry **out_entry) { struct dvb_file *dvb_file; struct dvb_entry *entry; int i; uint32_t sys; + *out_file = NULL; + *out_entry = NULL; + /* This is used only when reading old formats */ switch (parms->current_sys) { case SYS_DVBT: @@ -265,18 +272,6 @@ static int parse(struct arguments *args, if (parms->sat_number < 0 && entry->sat_number >= 0) parms->sat_number = entry->sat_number; - if (entry->video_pid) { - if (args->n_vpid < entry->video_pid_len) - *vpid = entry->video_pid[args->n_vpid]; - else - *vpid = entry->video_pid[0]; - } - if (entry->audio_pid) { - if (args->n_apid < entry->audio_pid_len) - *apid = entry->audio_pid[args->n_apid]; - else - *apid = entry->audio_pid[0]; - } if (entry->other_el_pid) { int i, type = -1; for (i = 0; i < entry->other_el_pid_len; i++) { @@ -290,7 +285,6 @@ static int parse(struct arguments *args, } fprintf(stderr, "\n"); } - *sid = entry->service_id; /* First of all, set the delivery system */ dvb_retrieve_entry_prop(entry, DTV_DELIVERY_SYSTEM, &sys); @@ -335,7 +329,8 @@ static int parse(struct arguments *args, } } - dvb_file_free(dvb_file); + *out_file = dvb_file; + *out_entry = entry; return 0; } @@ -691,8 +686,11 @@ static error_t parse_opt(int k, char *optarg, struct argp_state *state) case 'V': args->n_vpid = strtoul(optarg, NULL, 0); break; + case 'E': + args->extra_pids = 1; + break; case 'P': - args->all_pids++; + args->all_pids = 1; break; case 'm': args->traffic_monitor = 1; @@ -1032,12 +1030,12 @@ int main(int argc, char **argv) char *homedir = getenv("HOME"); char *channel = NULL; int lnb = -1, idx = -1; - int vpid = -1, apid = -1, sid = -1; int pmtpid = 0; + struct dvb_file *dvb_file = NULL; + const struct dvb_entry *dvb_entry = NULL; struct dvb_open_descriptor *pat_fd = NULL, *pmt_fd = NULL; struct dvb_open_descriptor *sdt_fd = NULL; struct dvb_open_descriptor *sid_fd = NULL, *dvr_fd = NULL; - struct dvb_open_descriptor *audio_fd = NULL, *video_fd = NULL; int file_fd = -1; int err = -1; int r, ret; @@ -1167,7 +1165,7 @@ int main(int argc, char **argv) if (r < 0) fprintf(stderr, _("Failed to set the country code:%s\n"), args.cc); - if (parse(&args, parms, channel, &vpid, &apid, &sid)) + if (parse(&args, parms, channel, &dvb_file, &dvb_entry)) goto err; if (setup_frontend(&args, parms) < 0) @@ -1197,23 +1195,16 @@ int main(int argc, char **argv) } if (args.rec_psi) { - if (sid < 0) { - fprintf(stderr, _("Service id 0x%04x was not specified at the file\n"), - sid); - goto err; - } - sid_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); if (!sid_fd) { ERROR("opening sid demux failed"); return -1; } - pmtpid = dvb_dev_dmx_get_pmt_pid(sid_fd, sid); + pmtpid = dvb_dev_dmx_get_pmt_pid(sid_fd, dvb_entry->service_id); dvb_dev_close(sid_fd); if (pmtpid <= 0) { fprintf(stderr, _("couldn't find pmt-pid for sid %04x\n"), - sid); - + dvb_entry->service_id); goto err; } @@ -1251,58 +1242,112 @@ int main(int argc, char **argv) goto err; } - if (args.all_pids++) { - vpid = 0x2000; - apid = 0; - } - if (vpid >= 0) { - if (args.silent < 2) { - if (vpid == 0x2000) - fprintf(stderr, _("pass all PID's to TS\n")); - else - fprintf(stderr, _("video pid %d\n"), vpid); - } - video_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); + if (args.all_pids) { + struct dvb_open_descriptor *video_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); if (!video_fd) { ERROR("failed opening '%s'", args.demux_dev); goto err; } - if (args.silent < 2) - fprintf(stderr, _(" dvb_set_pesfilter %d\n"), vpid); - fprintf(stderr, _("dvb_dev_set_bufsize: buffer set to %d\n"), DVB_BUF_SIZE); dvb_dev_set_bufsize(video_fd, DVB_BUF_SIZE); - if (vpid == 0x2000) { - if (dvb_dev_dmx_set_pesfilter(video_fd, vpid, DMX_PES_OTHER, - DMX_OUT_TS_TAP, 0) < 0) - goto err; - } else { - if (dvb_dev_dmx_set_pesfilter(video_fd, vpid, DMX_PES_VIDEO, - args.dvr ? DMX_OUT_TS_TAP : DMX_OUT_DECODER, - args.dvr ? 64 * 1024 : 0) < 0) - goto err; + if (args.silent < 2) { + fprintf(stderr, _("pass all PIDs to TS\n")); + fprintf(stderr, _(" dvb_set_pesfilter %d\n"), 0x2000); } - } - if (apid > 0) { - if (args.silent < 2) - fprintf(stderr, _("audio pid %d\n"), apid); - audio_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); - if (!audio_fd) { - ERROR("failed opening '%s'", args.demux_dev); + if (dvb_dev_dmx_set_pesfilter(video_fd, 0x2000, DMX_PES_OTHER, + DMX_OUT_TS_TAP, 0) < 0) { goto err; } - if (args.silent < 2) - fprintf(stderr, _(" dvb_set_pesfilter %d\n"), apid); - if (dvb_dev_dmx_set_pesfilter(audio_fd, apid, DMX_PES_AUDIO, - args.dvr ? DMX_OUT_TS_TAP : DMX_OUT_DECODER, - args.dvr ? 64 * 1024 : 0) < 0) - goto err; + } else { + if (dvb_entry->video_pid_len) { + struct dvb_open_descriptor *video_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); + if (!video_fd) { + ERROR("failed opening '%s'", args.demux_dev); + goto err; + } + + fprintf(stderr, _("dvb_dev_set_bufsize: buffer set to %d\n"), DVB_BUF_SIZE); + dvb_dev_set_bufsize(video_fd, DVB_BUF_SIZE); + + if (args.n_vpid >= dvb_entry->video_pid_len) { + args.n_vpid = 0; + } + + for (int i = 0; i < dvb_entry->video_pid_len; i++) { + if (!args.extra_pids && i != args.n_vpid) { + continue; + } + + if (args.silent < 2) { + fprintf(stderr, _("video%2$s pid %1$d\n"), + dvb_entry->video_pid[i], i == args.n_vpid ? "" : "+"); + } + + if (dvb_dev_dmx_set_pesfilter(video_fd, dvb_entry->video_pid[i], + i == args.n_vpid ? DMX_PES_VIDEO : DMX_PES_OTHER, + args.dvr ? DMX_OUT_TS_TAP : DMX_OUT_DECODER, + args.dvr ? 1024 * 1024 : 0) < 0) { + goto err; + } + } + } + + if (dvb_entry->audio_pid_len) { + if (args.n_apid >= dvb_entry->audio_pid_len) { + args.n_apid = 0; + } + + for (int i = 0; i < dvb_entry->audio_pid_len; i++) { + if (!args.extra_pids && i != args.n_apid) { + continue; + } + + struct dvb_open_descriptor *audio_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); + if (!audio_fd) { + ERROR("failed opening '%s'", args.demux_dev); + goto err; + } + + if (args.silent < 2) { + fprintf(stderr, _("audio%2$s pid %1$d\n"), + dvb_entry->audio_pid[i], i == args.n_apid ? "" : "+"); + } + + if (dvb_dev_dmx_set_pesfilter(audio_fd, dvb_entry->audio_pid[i], + i == args.n_apid ? DMX_PES_AUDIO : DMX_PES_OTHER, + args.dvr ? DMX_OUT_TS_TAP : DMX_OUT_DECODER, + args.dvr ? 64 * 1024 : 0) < 0) { + goto err; + } + } + } + + if (args.extra_pids && dvb_entry->other_el_pid_len) { + for (int i = dvb_entry->other_el_pid_len - 1; i >= 0; i--) { + struct dvb_open_descriptor * other_fd = dvb_dev_open(dvb, args.demux_dev, O_RDWR); + if (!other_fd) { + ERROR("failed opening '%s'", args.demux_dev); + goto err; + } + + if (args.silent < 2) { + fprintf(stderr, _("other pid %d (%d)\n"), + dvb_entry->other_el_pid[i].pid, dvb_entry->other_el_pid[i].type); + } + + if (dvb_dev_dmx_set_pesfilter(other_fd, dvb_entry->other_el_pid[i].pid, DMX_PES_OTHER, + args.dvr ? DMX_OUT_TS_TAP : DMX_OUT_DECODER, + args.dvr ? 64 * 1024 : 0) < 0) { + goto err; + } + } + } } - if (((vpid >= 0 && vpid != 0x2000) || apid) && !args.rec_psi) { + if ((dvb_entry->video_pid_len || dvb_entry->audio_pid_len) && !args.all_pids && !args.rec_psi) { printf(_("PMT record is disabled.\n" "Please notice that some streams can only be decoded with PMT data.\n" "Use '-p' option to also record PMT.\n")); @@ -1404,6 +1449,10 @@ int main(int argc, char **argv) err: dvb_dev_free(dvb); + if (dvb_file) { + dvb_file_free(dvb_file); + } + /* * Just to make Valgrind happier. It should be noticed * That, if an error happens or if the program exits via diff --git a/utils/dvb/meson.build b/utils/dvb/meson.build new file mode 100644 index 00000000..871f5a39 --- /dev/null +++ b/utils/dvb/meson.build @@ -0,0 +1,70 @@ +dvb_common_deps = [ + dep_argp, + dep_libdvbv5, + dep_libudev, + dep_threads, + dep_xmlrpc, +] + +dvb_fe_tool_sources = files( + 'dvb-fe-tool.c', +) + +dvb_fe_tool = executable('dvb-fe-tool', + dvb_fe_tool_sources, + install : true, + dependencies : dvb_common_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'dvb-fe-tool', 1 ]] + +dvbv5_zap_sources = files( + 'dvbv5-zap.c', +) + +dvbv5_zap = executable('dvbv5-zap', + dvbv5_zap_sources, + install : true, + dependencies : dvb_common_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'dvbv5-zap', 1 ]] + +dvbv5_scan_sources = files( + 'dvbv5-scan.c', +) + +dvbv5_scan = executable('dvbv5-scan', + dvbv5_scan_sources, + install : true, + dependencies : dvb_common_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'dvbv5-scan', 1 ]] + +dvb_format_convert_sources = files( + 'dvb-format-convert.c', +) + +dvb_format_convert = executable('dvb-format-convert', + dvb_format_convert_sources, + install : true, + dependencies : dvb_common_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'dvb-format-convert', 1 ]] + +dvbv5_daemon_sources = files( + 'dvbv5-daemon.c', +) + +dvbv5_daemon_c_args = [ + '-DHAVE_DVBV5_REMOTE', +] + +dvbv5_daemon = executable('dvbv5-daemon', + dvbv5_daemon_sources, + install : true, + dependencies : dvb_common_deps, + c_args : dvbv5_daemon_c_args, + include_directories : v4l2_utils_incdir) diff --git a/utils/gen_media_bus_format_codes.sh b/utils/gen_media_bus_format_codes.sh new file mode 100755 index 00000000..4bdcc3b7 --- /dev/null +++ b/utils/gen_media_bus_format_codes.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +src="$1" + +sed -e \ +'/#define MEDIA_BUS_FMT/ ! d; s/.*#define //; /FIXED/ d; s/\t.*//; s/.*/ &,/;' \ +${src} diff --git a/utils/gen_media_bus_format_names.sh b/utils/gen_media_bus_format_names.sh new file mode 100755 index 00000000..3fdc830d --- /dev/null +++ b/utils/gen_media_bus_format_names.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +src="$1" + +sed -e \ +'/#define MEDIA_BUS_FMT/ ! d; s/.*FMT_//; /FIXED/ d; s/\t.*//; s/.*/{ \"&\", MEDIA_BUS_FMT_& },/;' \ +${src} diff --git a/utils/ir-ctl/.gitignore b/utils/ir-ctl/.gitignore deleted file mode 100644 index 3220d69f..00000000 --- a/utils/ir-ctl/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ir-ctl -ir-ctl.1 diff --git a/utils/ir-ctl/Makefile.am b/utils/ir-ctl/Makefile.am deleted file mode 100644 index ad90b84e..00000000 --- a/utils/ir-ctl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -bin_PROGRAMS = ir-ctl -man_MANS = ir-ctl.1 - -ir_ctl_SOURCES = ir-ctl.c ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h bpf_encoder.c bpf_encoder.h -ir_ctl_LDADD = @LIBINTL@ -ir_ctl_LDFLAGS = $(ARGP_LIBS) diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 240a3752..3c389bd9 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -26,8 +26,6 @@ #include <argp.h> #include <sysexits.h> -#include <config.h> - #include <linux/lirc.h> #include "ir-encode.h" diff --git a/utils/ir-ctl/meson.build b/utils/ir-ctl/meson.build new file mode 100644 index 00000000..24d73a15 --- /dev/null +++ b/utils/ir-ctl/meson.build @@ -0,0 +1,23 @@ +ir_ctl_sources = files( + 'bpf_encoder.c', + 'bpf_encoder.h', + 'ir-ctl.c', + 'ir-encode.c', + 'ir-encode.h', + 'keymap.c', + 'keymap.h', + 'toml.c', + 'toml.h', +) + +ir_ctl_deps = [ + dep_argp, +] + +ir_ctl = executable('ir-ctl', + ir_ctl_sources, + install : true, + dependencies : ir_ctl_deps, + include_directories : v4l2_utils_incdir) + +man_pages += [[ meson.current_source_dir(), 'ir-ctl', 1 ]] diff --git a/utils/ivtv-ctl/.gitignore b/utils/ivtv-ctl/.gitignore deleted file mode 100644 index 17a8eb65..00000000 --- a/utils/ivtv-ctl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ivtv-ctl diff --git a/utils/ivtv-ctl/Makefile.am b/utils/ivtv-ctl/Makefile.am deleted file mode 100644 index c1196673..00000000 --- a/utils/ivtv-ctl/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_PROGRAMS = ivtv-ctl - -ivtv_ctl_SOURCES = ivtv-ctl.c -ivtv_ctl_LDFLAGS = -lm diff --git a/utils/ivtv-ctl/meson.build b/utils/ivtv-ctl/meson.build new file mode 100644 index 00000000..410a8439 --- /dev/null +++ b/utils/ivtv-ctl/meson.build @@ -0,0 +1,13 @@ +ivtv_ctl_sources = files( + 'ivtv-ctl.c', +) + +ivtv_ctl_deps = [ + dep_libm, +] + +ivtv_ctl = executable('ivtv-ctl', + ivtv_ctl_sources, + install : true, + dependencies : ivtv_ctl_deps, + include_directories : v4l2_utils_incdir) diff --git a/utils/keytable/.gitignore b/utils/keytable/.gitignore deleted file mode 100644 index 460e4a13..00000000 --- a/utils/keytable/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -ir-keytable -ir-keytable.1 -rc_keymap.5 diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am deleted file mode 100644 index eee61f0e..00000000 --- a/utils/keytable/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -bin_PROGRAMS = ir-keytable -man_MANS = ir-keytable.1 rc_keymap.5 -sysconf_DATA = rc_maps.cfg -keytablesystem_DATA = $(srcdir)/rc_keymaps/* -udevrules_DATA = 70-infrared.rules -if WITH_BPF -if HAVE_SYSTEMD -if HAVE_UDEVDSYSCALLFILTER -systemdsystemunit_DATA = 50-rc_keymap.conf -endif -endif -endif - -ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h - -if WITH_BPF -ir_keytable_SOURCES += bpf_load.c bpf_load.h -endif - -ir_keytable_LDADD = @LIBINTL@ -ir_keytable_LDFLAGS = $(ARGP_LIBS) - -if WITH_BPF -ir_keytable_LDFLAGS += $(LIBELF_LIBS) $(LIBBPF_LIBS) -ir_keytable_CFLAGS = $(LIBBPF_CFLAGS) -SUBDIRS = bpf_protocols -endif - -EXTRA_DIST = 70-infrared.rules 50-rc_keymap.conf rc_keymaps rc_keymaps_userspace gen_input_events.pl gen_keytables.pl ir-keytable.1 rc_maps.cfg rc_keymap.5 - -check: - @$(foreach keymap,$(wildcard $(keytablesystem_DATA)),./ir-keytable --test-keymap=$(keymap);) - -# custom target -install-data-local: - $(install_sh) -d "$(DESTDIR)$(keytableuserdir)" diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index 7c633dac..06098fc3 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -63,19 +63,17 @@ struct bpf_file { static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, struct bpf_insn *prog, int size) { - struct bpf_load_program_attr load_attr; - int fd, err; + LIBBPF_OPTS(bpf_prog_load_opts, opts); + int fd, err, insn_cnt; - memset(&load_attr, 0, sizeof(struct bpf_load_program_attr)); + insn_cnt = size / sizeof(struct bpf_insn); - load_attr.prog_type = BPF_PROG_TYPE_LIRC_MODE2; - load_attr.expected_attach_type = BPF_LIRC_MODE2; - load_attr.name = bpf_file->name; - load_attr.insns = prog; - load_attr.insns_cnt = size / sizeof(struct bpf_insn); - load_attr.license = bpf_file->license; + opts.expected_attach_type = BPF_LIRC_MODE2; + opts.log_buf = bpf_log_buf; + opts.log_size = LOG_BUF_SIZE; - fd = bpf_load_program_xattr(&load_attr, bpf_log_buf, LOG_BUF_SIZE); + fd = bpf_prog_load(BPF_PROG_TYPE_LIRC_MODE2, bpf_file->name, + bpf_file->license, prog, insn_cnt, &opts); if (fd < 0) { printf("bpf_load_program() err=%m\n%s", bpf_log_buf); return -1; @@ -95,6 +93,9 @@ static int build_raw_map(struct bpf_map_data *map, struct raw_entry *raw, int nu int no_patterns, value_size, fd, key, i; struct raw_entry *e; struct raw_pattern *p; + LIBBPF_OPTS(bpf_map_create_opts, opts, + .map_flags = map->def.map_flags, + ); no_patterns = 0; @@ -110,14 +111,13 @@ static int build_raw_map(struct bpf_map_data *map, struct raw_entry *raw, int nu value_size = sizeof(struct raw_pattern) + max_length * sizeof(short); - fd = bpf_create_map_node(map->def.type, - map->name, - map->def.key_size, - value_size, - no_patterns, - map->def.map_flags, - numa_node); - + opts.numa_node = numa_node; + fd = bpf_map_create(map->def.type, + map->name, + map->def.key_size, + value_size, + no_patterns, + &opts); if (fd < 0) { printf(_("failed to create a map: %d %s\n"), errno, strerror(errno)); @@ -174,27 +174,34 @@ static int load_maps(struct bpf_file *bpf_file, struct raw_entry *raw) if (maps[i].def.type == BPF_MAP_TYPE_ARRAY_OF_MAPS || maps[i].def.type == BPF_MAP_TYPE_HASH_OF_MAPS) { - int inner_map_fd = bpf_file->map_fd[maps[i].def.inner_map_idx]; + LIBBPF_OPTS(bpf_map_create_opts, opts, + .inner_map_fd = bpf_file->map_fd[maps[i].def.inner_map_idx], + .map_flags = maps[i].def.map_flags, + .numa_node = numa_node, + ); - bpf_file->map_fd[i] = bpf_create_map_in_map_node( + bpf_file->map_fd[i] = bpf_map_create( maps[i].def.type, maps[i].name, maps[i].def.key_size, - inner_map_fd, + 4, maps[i].def.max_entries, - maps[i].def.map_flags, - numa_node); + &opts); } else if (!strcmp(maps[i].name, "raw_map")) { bpf_file->map_fd[i] = build_raw_map(&maps[i], raw, numa_node); } else { - bpf_file->map_fd[i] = bpf_create_map_node( + LIBBPF_OPTS(bpf_map_create_opts, opts, + .map_flags = maps[i].def.map_flags, + .numa_node = numa_node, + ); + + bpf_file->map_fd[i] = bpf_map_create( maps[i].def.type, maps[i].name, maps[i].def.key_size, maps[i].def.value_size, maps[i].def.max_entries, - maps[i].def.map_flags, - numa_node); + &opts); } if (bpf_file->map_fd[i] < 0) { diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am deleted file mode 100644 index 13be2794..00000000 --- a/utils/keytable/bpf_protocols/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# Get Clang's default includes on this system, as opposed to those seen by -# '-target bpf'. This fixes "missing" files on some architectures/distros, -# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc. -# -# Use '-idirafter': Don't interfere with include mechanics except where the -# build would have failed anyways. -CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \ - | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') - -%.o: %.c bpf_helpers.h - $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $< - -PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o - -all: $(PROTOCOLS) - -CLEANFILES = $(PROTOCOLS) -EXTRA_DIST = $(PROTOCOLS:%.o=%.c) bitmap.h bpf_helpers.h - -# custom target -install-data-local: - $(install_sh) -d "$(DESTDIR)$(keytableuserdir)/protocols" - $(install_sh) -d "$(DESTDIR)$(keytablesystemdir)/protocols" - $(install_sh) -m 0644 $(PROTOCOLS) "$(DESTDIR)$(keytablesystemdir)/protocols" diff --git a/utils/keytable/bpf_protocols/clang_sys_includes.sh b/utils/keytable/bpf_protocols/clang_sys_includes.sh new file mode 100755 index 00000000..9dc4af12 --- /dev/null +++ b/utils/keytable/bpf_protocols/clang_sys_includes.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Get Clang's default includes on this system, as opposed to those seen by +# '-target bpf'. This fixes "missing" files on some architectures/distros, +# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc. +# +# Use '-idirafter': Don't interfere with include mechanics except where the +# build would have failed anyways. +$CLANG -v -E - </dev/null 2>&1 \ + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }' diff --git a/utils/keytable/bpf_protocols/meson.build b/utils/keytable/bpf_protocols/meson.build new file mode 100644 index 00000000..1e4f0064 --- /dev/null +++ b/utils/keytable/bpf_protocols/meson.build @@ -0,0 +1,31 @@ +bpf_protocols_files = [ + 'grundig', + 'imon_rsc', + 'manchester', + 'pulse_distance', + 'pulse_length', + 'raw', + 'rc_mm', + 'samsung36', + 'xbox-dvd', +] + +clang_sys_includes = run_command('clang_sys_includes.sh', + check : true, + env : ['CLANG=' + prog_clang.full_path()]) + +foreach file : bpf_protocols_files + output = file + '.o' + input = file + '.c' + custom_target(output, + output : output, + input : input, + command : [ + prog_clang, + clang_sys_includes.stdout().split(), + '-D__linux__', '-fno-stack-protector', '-target', 'bpf', + '-O2', '-c', '@INPUT@', '-o', '@OUTPUT@', + ], + install : true, + install_dir : ir_keytable_system_dir / 'rc_keymaps' / 'protocols') +endforeach diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 248493a9..3d5a3c51 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -12,7 +12,6 @@ GNU General Public License for more details. */ -#include <config.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> @@ -382,14 +381,16 @@ static int add_keymap(struct keymap *map, const char *fname) protocol = parse_sysfs_protocol(map->protocol, false); if (protocol == SYSFS_INVALID) { - struct bpf_protocol *b; - - b = malloc(sizeof(*b)); - b->name = strdup(map->protocol); - b->param = map->param; - /* steal param */ - map->param = NULL; - add_bpf_protocol(b); + if (strcmp(map->protocol, "none")) { + struct bpf_protocol *b; + + b = malloc(sizeof(*b)); + b->name = strdup(map->protocol); + b->param = map->param; + /* steal param */ + map->param = NULL; + add_bpf_protocol(b); + } } else { ch_proto |= protocol; } @@ -1751,7 +1752,7 @@ static bool attach_bpf(const char *lirc_name, const char *bpf_prog, struct proto struct rlimit rl; int fd, ret; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return false; @@ -1842,7 +1843,7 @@ static void clear_bpf(const char *lirc_name) unsigned int features, i; int ret, prog_fd, fd; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return; @@ -2105,11 +2106,6 @@ int main(int argc, char *argv[]) } add_keymap(map, fname); free_keymap(map); - if (!keytable) { - fprintf(stderr, _("Empty keymap %s\n"), fname); - free(fname); - return -1; - } free(fname); clear = 1; matches++; diff --git a/utils/keytable/meson.build b/utils/keytable/meson.build new file mode 100644 index 00000000..0ca08a18 --- /dev/null +++ b/utils/keytable/meson.build @@ -0,0 +1,85 @@ +ir_keytable_sources = files( + 'ir-encode.c', + 'ir-encode.h', + 'keymap.c', + 'keymap.h', + 'keytable.c', + 'parse.h', + 'toml.c', + 'toml.h', +) + +ir_keytable_deps = [ + dep_argp, +] + +ir_keytable_system_dir = udevdir +ir_keytable_user_dir = get_option('sysconfdir') / 'rc_keymaps' + +ir_keytable_c_args = [ + '-DIR_KEYTABLE_SYSTEM_DIR="@0@"'.format(ir_keytable_system_dir), + '-DIR_KEYTABLE_USER_DIR="@0@"'.format(ir_keytable_user_dir), +] + +ir_bpf_enabled = prog_clang.found() and dep_libbpf.found() and dep_libelf.found() + +if ir_bpf_enabled + ir_keytable_sources += files( + 'bpf_load.c', + 'bpf_load.h', + ) + ir_keytable_deps += [ + dep_libbpf, + dep_libelf, + ] + ir_keytable_c_args += [ + '-DHAVE_BPF', + ] + subdir('bpf_protocols') +endif + +ir_keytable_incdir = [ + utils_common_incdir, + v4l2_utils_incdir, +] + +ir_keytable = executable('ir-keytable', + sources : ir_keytable_sources, + install : true, + dependencies : ir_keytable_deps, + c_args : ir_keytable_c_args, + include_directories : ir_keytable_incdir) + +man_pages += [[ meson.current_source_dir(), 'ir-keytable', 1 ]] +man_pages += [[ meson.current_source_dir(), 'rc_keymap', 5 ]] + +ir_keytable_sysconf_files = files( + 'rc_maps.cfg', +) +install_data(ir_keytable_sysconf_files, + install_dir : get_option('sysconfdir')) + +subdir('rc_keymaps') +install_data(ir_keytable_rc_keymaps, + install_dir : ir_keytable_system_dir / 'rc_keymaps') + +ir_keytable_udev_rules = files( + '70-infrared.rules', +) +install_data(ir_keytable_udev_rules, + install_dir : ir_keytable_system_dir / 'rules.d') + +if have_udevdsyscallfilter + ir_keytable_systemd_files = files( + '50-rc_keymap.conf', + ) + install_data(ir_keytable_systemd_files, + install_dir : systemd_systemdir / 'systemd-udevd.service.d') +endif + +# Install non-existing directory to create empty directory structure +# See: https://github.com/mesonbuild/meson/issues/2904 +# This should be replaced with install_emptydir() when bumping the minimum meson +# version to 0.60.0. +install_subdir('protocols', + install_dir : ir_keytable_user_dir) diff --git a/utils/keytable/parse.h b/utils/keytable/parse.h index c70664f0..08b0c7a3 100644 --- a/utils/keytable/parse.h +++ b/utils/keytable/parse.h @@ -529,6 +529,9 @@ struct parse_event key_events[] = { {"KEY_KBD_LAYOUT_NEXT", 0x248}, {"KEY_EMOJI_PICKER", 0x249}, {"KEY_DICTATE", 0x24a}, + {"KEY_CAMERA_ACCESS_ENABLE", 0x24b}, + {"KEY_CAMERA_ACCESS_DISABLE", 0x24c}, + {"KEY_CAMERA_ACCESS_TOGGLE", 0x24d}, {"KEY_BRIGHTNESS_MIN", 0x250}, {"KEY_BRIGHTNESS_MAX", 0x251}, {"KEY_KBDINPUTASSIST_PREV", 0x260}, @@ -700,6 +703,7 @@ struct parse_event abs_events[] = { {"ABS_TILT_Y", 0x1b}, {"ABS_TOOL_WIDTH", 0x1c}, {"ABS_VOLUME", 0x20}, + {"ABS_PROFILE", 0x21}, {"ABS_MISC", 0x28}, {"ABS_RESERVED", 0x2e}, {"ABS_MT_SLOT", 0x2f}, diff --git a/utils/keytable/rc_keymaps/beelink_mxiii.toml b/utils/keytable/rc_keymaps/beelink_mxiii.toml new file mode 100644 index 00000000..24205b16 --- /dev/null +++ b/utils/keytable/rc_keymaps/beelink_mxiii.toml @@ -0,0 +1,18 @@ +# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-beelink-mxiii.c +[[protocols]] +name = "beelink_mxiii" +protocol = "nec" +variant = "nec" +[protocols.scancodes] +0xb2dc = "KEY_POWER" +0xb288 = "KEY_MUTE" +0xb282 = "KEY_HOME" +0xb2ca = "KEY_UP" +0xb299 = "KEY_LEFT" +0xb2ce = "KEY_OK" +0xb2c1 = "KEY_RIGHT" +0xb2d2 = "KEY_DOWN" +0xb2c5 = "KEY_MENU" +0xb29a = "KEY_BACK" +0xb281 = "KEY_VOLUMEDOWN" +0xb280 = "KEY_VOLUMEUP" diff --git a/utils/keytable/rc_keymaps/dreambox.toml b/utils/keytable/rc_keymaps/dreambox.toml new file mode 100644 index 00000000..1bee2112 --- /dev/null +++ b/utils/keytable/rc_keymaps/dreambox.toml @@ -0,0 +1,86 @@ +# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-dreambox.c +[[protocols]] +name = "dreambox" +protocol = "nec" +variant = "nec" +[protocols.scancodes] +0x3200 = "KEY_POWER" +0x3290 = "KEY_HELP" +0x3201 = "KEY_1" +0x3202 = "KEY_2" +0x3203 = "KEY_3" +0x3204 = "KEY_4" +0x3205 = "KEY_5" +0x3206 = "KEY_6" +0x3207 = "KEY_7" +0x3208 = "KEY_8" +0x3209 = "KEY_9" +0x320a = "KEY_PREVIOUS" +0x320b = "KEY_0" +0x320c = "KEY_NEXT" +0x321f = "KEY_RED" +0x3220 = "KEY_GREEN" +0x3221 = "KEY_YELLOW" +0x3222 = "KEY_BLUE" +0x3210 = "KEY_INFO" +0x3212 = "KEY_MENU" +0x320e = "KEY_AUDIO" +0x3218 = "KEY_PVR" +0x3213 = "KEY_LEFT" +0x3211 = "KEY_UP" +0x3215 = "KEY_RIGHT" +0x3217 = "KEY_DOWN" +0x3214 = "KEY_OK" +0x3219 = "KEY_VOLUMEUP" +0x321c = "KEY_VOLUMEDOWN" +0x321d = "KEY_ESC" +0x321a = "KEY_MUTE" +0x321b = "KEY_PAGEUP" +0x321e = "KEY_PAGEDOWN" +0x3223 = "KEY_PREVIOUSSONG" +0x3224 = "KEY_PLAYPAUSE" +0x3225 = "KEY_STOP" +0x3226 = "KEY_NEXTSONG" +0x3227 = "KEY_TV" +0x3228 = "KEY_RADIO" +0x3229 = "KEY_TEXT" +0x322a = "KEY_RECORD" +0x3407 = "KEY_MUTE" +0x3401 = "KEY_POWER" +0x3432 = "KEY_PREVIOUSSONG" +0x3433 = "KEY_PLAYPAUSE" +0x3435 = "KEY_NEXTSONG" +0x3436 = "KEY_RECORD" +0x3434 = "KEY_STOP" +0x3425 = "KEY_TEXT" +0x341f = "KEY_RED" +0x3420 = "KEY_GREEN" +0x3421 = "KEY_YELLOW" +0x3422 = "KEY_BLUE" +0x341b = "KEY_INFO" +0x341c = "KEY_MENU" +0x3430 = "KEY_AUDIO" +0x3431 = "KEY_PVR" +0x3414 = "KEY_LEFT" +0x3411 = "KEY_UP" +0x3416 = "KEY_RIGHT" +0x3419 = "KEY_DOWN" +0x3415 = "KEY_OK" +0x3413 = "KEY_VOLUMEUP" +0x3418 = "KEY_VOLUMEDOWN" +0x3412 = "KEY_ESC" +0x3426 = "KEY_HELP" +0x3417 = "KEY_PAGEUP" +0x341a = "KEY_PAGEDOWN" +0x3404 = "KEY_1" +0x3405 = "KEY_2" +0x3406 = "KEY_3" +0x3408 = "KEY_4" +0x3409 = "KEY_5" +0x340a = "KEY_6" +0x340c = "KEY_7" +0x340d = "KEY_8" +0x340e = "KEY_9" +0x340b = "KEY_PREVIOUS" +0x3410 = "KEY_0" +0x340f = "KEY_NEXT" diff --git a/utils/keytable/rc_keymaps/empty.toml b/utils/keytable/rc_keymaps/empty.toml new file mode 100644 index 00000000..0c0b5e69 --- /dev/null +++ b/utils/keytable/rc_keymaps/empty.toml @@ -0,0 +1,2 @@ +[[protocols]] +protocol = "none" diff --git a/utils/keytable/rc_keymaps/meson.build b/utils/keytable/rc_keymaps/meson.build new file mode 100644 index 00000000..2b8ebd8f --- /dev/null +++ b/utils/keytable/rc_keymaps/meson.build @@ -0,0 +1,156 @@ +ir_keytable_rc_keymaps = files( + 'adstech_dvb_t_pci.toml', + 'af9005.toml', + 'alink_dtu_m.toml', + 'allwinner_ba10_tv_box.toml', + 'allwinner_i12_a20_tv_box.toml', + 'anysee.toml', + 'apac_viewcomp.toml', + 'astrometa_t2hybrid.toml', + 'asus_pc39.toml', + 'asus_ps3_100.toml', + 'ati_tv_wonder_hd_600.toml', + 'ati_x10.toml', + 'avermedia_a16d.toml', + 'avermedia_cardbus.toml', + 'avermedia_dvbt.toml', + 'avermedia_m135a.toml', + 'avermedia_m733a_rm_k6.toml', + 'avermedia_rm_ks.toml', + 'avermedia.toml', + 'avertv_303.toml', + 'az6027.toml', + 'azurewave_ad_tu700.toml', + 'beelink_gs1.toml', + 'beelink_mxiii.toml', + 'behold_columbus.toml', + 'behold.toml', + 'budget_ci_old.toml', + 'cec.toml', + 'cinergy_1400.toml', + 'cinergyt2.toml', + 'cinergy.toml', + 'ct_90405.toml', + 'd680_dmb.toml', + 'delock_61959.toml', + 'dib0700_nec.toml', + 'dib0700_rc5.toml', + 'dibusb.toml', + 'digitalnow_tinytwin.toml', + 'digittrade.toml', + 'digitv.toml', + 'dish_network.toml', + 'dm1105_nec.toml', + 'dntv_live_dvbt_pro.toml', + 'dntv_live_dvb_t.toml', + 'dreambox.toml', + 'dtt200u.toml', + 'dvbsky.toml', + 'dvico_mce.toml', + 'dvico_portable.toml', + 'empty.toml', + 'em_terratec.toml', + 'encore_enltv2.toml', + 'encore_enltv_fm53.toml', + 'encore_enltv.toml', + 'evga_indtube.toml', + 'eztv.toml', + 'flydvb.toml', + 'flyvideo.toml', + 'fusionhdtv_mce.toml', + 'gadmei_rm008z.toml', + 'geekbox.toml', + 'genius_tvgo_a11mce.toml', + 'gotview7135.toml', + 'hauppauge.toml', + 'haupp.toml', + 'hisi_poplar.toml', + 'hisi_tv_demo.toml', + 'imon_mce.toml', + 'imon_pad.toml', + 'imon_rsc.toml', + 'iodata_bctv7e.toml', + 'it913x_v1.toml', + 'it913x_v2.toml', + 'kaiomy.toml', + 'khadas.toml', + 'khamsin.toml', + 'kii_pro.toml', + 'kworld_315u.toml', + 'kworld_pc150u.toml', + 'kworld_plus_tv_analog.toml', + 'leadtek_y04g0051.toml', + 'lme2510.toml', + 'manli.toml', + 'mce_keyboard.toml', + 'mecool_kiii_pro.toml', + 'mecool_kii_pro.toml', + 'medion_x10_digitainer.toml', + 'medion_x10_or2x.toml', + 'medion_x10.toml', + 'megasky.toml', + 'minix_neo.toml', + 'msi_digivox_iii.toml', + 'msi_digivox_ii.toml', + 'msi_tvanywhere_plus.toml', + 'msi_tvanywhere.toml', + 'nebula.toml', + 'nec_terratec_cinergy_xs.toml', + 'norwood.toml', + 'npgtech.toml', + 'odroid.toml', + 'opera1.toml', + 'pctv_sedna.toml', + 'pine64.toml', + 'pinnacle310e.toml', + 'pinnacle_color.toml', + 'pinnacle_grey.toml', + 'pinnacle_pctv_hd.toml', + 'pixelview_002t.toml', + 'pixelview_mk12.toml', + 'pixelview_new.toml', + 'pixelview.toml', + 'powercolor_real_angel.toml', + 'proteus_2309.toml', + 'purpletv.toml', + 'pv951.toml', + 'rc6_mce.toml', + 'real_audio_220_32_keys.toml', + 'reddo.toml', + 'samsung_ak59_00125a.toml', + 'snapstream_firefly.toml', + 'streamzap.toml', + 'su3000.toml', + 'tanix_tx3mini.toml', + 'tanix_tx5max.toml', + 'tbs_nec.toml', + 'technisat_ts35.toml', + 'technisat_usb2.toml', + 'terratec_cinergy_c_pci.toml', + 'terratec_cinergy_s2_hd.toml', + 'terratec_cinergy_xs.toml', + 'terratec_slim_2.toml', + 'terratec_slim.toml', + 'tevii_nec.toml', + 'tivo.toml', + 'total_media_in_hand_02.toml', + 'total_media_in_hand.toml', + 'trekstor.toml', + 'tt_1500.toml', + 'tvwalkertwin.toml', + 'twinhan_dtv_cab_ci.toml', + 'twinhan_vp1027_dvbs.toml', + 'vega_s9x.toml', + 'videomate_k100.toml', + 'videomate_s350.toml', + 'videomate_tv_pvr.toml', + 'vp702x.toml', + 'wetek_hub.toml', + 'wetek_play2.toml', + 'winfast.toml', + 'winfast_usbii_deluxe.toml', + 'wobo_i5.toml', + 'x96max.toml', + 'xbox_dvd.toml', + 'zx_irdec.toml', +) diff --git a/utils/keytable/rc_keymaps_userspace/empty.toml b/utils/keytable/rc_keymaps_userspace/empty.toml new file mode 100644 index 00000000..0c0b5e69 --- /dev/null +++ b/utils/keytable/rc_keymaps_userspace/empty.toml @@ -0,0 +1,2 @@ +[[protocols]] +protocol = "none" diff --git a/utils/keytable/rc_maps.cfg b/utils/keytable/rc_maps.cfg index e12e15c6..263ff0c6 100644 --- a/utils/keytable/rc_maps.cfg +++ b/utils/keytable/rc_maps.cfg @@ -49,6 +49,7 @@ * rc-avertv-303 avertv_303.toml * rc-azurewave-ad-tu700 azurewave_ad_tu700.toml * rc-beelink-gs1 beelink_gs1.toml +* rc-beelink-mxiii beelink_mxiii.toml * rc-behold-columbus behold_columbus.toml * rc-behold behold.toml * rc-budget-ci-old budget_ci_old.toml @@ -65,6 +66,7 @@ * rc-dm1105-nec dm1105_nec.toml * rc-dntv-live-dvb-t dntv_live_dvb_t.toml * rc-dntv-live-dvbt-pro dntv_live_dvbt_pro.toml +* rc-dreambox dreambox.toml * rc-dtt200u dtt200u.toml * rc-dvbsky dvbsky.toml * rc-dvico-mce dvico_mce.toml diff --git a/utils/libcecutil/.gitignore b/utils/libcecutil/.gitignore deleted file mode 100644 index 49a48b9a..00000000 --- a/utils/libcecutil/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -cec-log-gen.h -cec-parse-gen.h -cec-parse-src-gen.h -cec-msgs-gen.h diff --git a/utils/libcecutil/Makefile.am b/utils/libcecutil/Makefile.am deleted file mode 100644 index d2c7ddcc..00000000 --- a/utils/libcecutil/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -noinst_LTLIBRARIES = libcecutil.la - -libcecutil_la_SOURCES = cec-info.cpp cec-log.cpp cec-parse.cpp cec-info.h cec-log.h cec-parse.h \ - cec-htng.h cec-htng-funcs.h -libcecutil_la_CPPFLAGS = -static -I$(top_srcdir)/utils/common -libcecutil_la_LDFLAGS = -static - -CEC_GEN_PREREQS = $(top_srcdir)/include/linux/cec.h $(top_srcdir)/utils/libcecutil/cec-htng.h \ - $(top_srcdir)/include/linux/cec-funcs.h $(top_srcdir)/utils/libcecutil/cec-htng-funcs.h -CEC_GEN_HDRS = cec-log-gen.h cec-parse-gen.h cec-parse-src-gen.h cec-msgs-gen.h - -cec-info.cpp cec-log.cpp cec-parse.cpp: $(CEC_GEN_HDRS) - -$(CEC_GEN_HDRS): gen.intermediate ; - -.INTERMEDIATE: gen.intermediate - -gen.intermediate: cec-gen.pl $(CEC_GEN_PREREQS) - $(AM_V_GEN) $(top_srcdir)/utils/libcecutil/cec-gen.pl $(CEC_GEN_PREREQS) - -clean-local: - -rm -vf $(CEC_GEN_HDRS) - -EXTRA_DIST = cec-gen.pl diff --git a/utils/libcecutil/cec-info.cpp b/utils/libcecutil/cec-info.cpp index 87aa00a2..dce7effd 100644 --- a/utils/libcecutil/cec-info.cpp +++ b/utils/libcecutil/cec-info.cpp @@ -20,7 +20,7 @@ const char *cec_opcode2s(unsigned opcode) { - for (auto i : msgtable) + for (const auto &i : msgtable) if (i.opcode == opcode) return i.name; return nullptr; @@ -28,7 +28,7 @@ const char *cec_opcode2s(unsigned opcode) const char *cec_cdc_opcode2s(unsigned cdc_opcode) { - for (auto i : cdcmsgtable) + for (const auto &i : cdcmsgtable) if (i.opcode == cdc_opcode) return i.name; return nullptr; @@ -36,7 +36,7 @@ const char *cec_cdc_opcode2s(unsigned cdc_opcode) const char *cec_htng_opcode2s(unsigned htng_opcode) { - for (auto i : htngmsgtable) + for (const auto &i : htngmsgtable) if (i.opcode == htng_opcode) return i.name; return nullptr; diff --git a/utils/libcecutil/meson.build b/utils/libcecutil/meson.build new file mode 100644 index 00000000..ea57c536 --- /dev/null +++ b/utils/libcecutil/meson.build @@ -0,0 +1,44 @@ +libcecutil_sources = files( + 'cec-htng-funcs.h', + 'cec-htng.h', + 'cec-info.cpp', + 'cec-info.h', + 'cec-log.cpp', + 'cec-log.h', + 'cec-parse.cpp', + 'cec-parse.h', +) + +libcecutil_deps = [ + dep_libdl, + dep_threads, +] + +libcecutil_incdir = [ + utils_common_incdir, + v4l2_utils_incdir, +] + +cec_gen_sources = files( + '../../include/linux/cec.h', + 'cec-htng.h', + '../../include/linux/cec-funcs.h', + 'cec-htng-funcs.h', +) + +configure_file( + input : 'cec-gen.pl', + output : 'cec-gen-dummy.stamp', + command : [prog_perl, '@INPUT@', cec_gen_sources, 'utils/libcecutil'], +) + +libcecutil = static_library('cecutil', + libcecutil_sources, + install : false, + dependencies : libcecutil_deps, + include_directories : libcecutil_incdir) + +dep_libcecutil = declare_dependency( + link_with : libcecutil, + include_directories : '.', +) diff --git a/utils/libmedia_dev/Makefile.am b/utils/libmedia_dev/Makefile.am deleted file mode 100644 index 3796efbd..00000000 --- a/utils/libmedia_dev/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_LTLIBRARIES = libmedia_dev.la - -libmedia_dev_la_SOURCES = get_media_devices.c get_media_devices.h -libmedia_dev_la_CPPFLAGS = -static -libmedia_dev_la_LDFLAGS = -static - -EXTRA_DIST = README diff --git a/utils/libmedia_dev/meson.build b/utils/libmedia_dev/meson.build new file mode 100644 index 00000000..f97238e6 --- /dev/null +++ b/utils/libmedia_dev/meson.build @@ -0,0 +1,14 @@ +libmedia_dev_sources = files( + 'get_media_devices.c', + 'get_media_devices.h', +) + +libmedia_dev = static_library('media_dev', + libmedia_dev_sources, + install : false, + include_directories : v4l2_utils_incdir) + +dep_libmedia_dev = declare_dependency( + link_with : libmedia_dev, + include_directories : '.', +) diff --git a/utils/libv4l2util/Makefile.am b/utils/libv4l2util/Makefile.am deleted file mode 100644 index eb11017a..00000000 --- a/utils/libv4l2util/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -noinst_LTLIBRARIES = libv4l2util.la - -libv4l2util_la_SOURCES = frequencies.c v4l2_driver.c v4l2_driver.h libv4l2util.h -libv4l2util_la_CPPFLAGS = -static -libv4l2util_la_LDFLAGS = -static - -EXTRA_DIST = TODO diff --git a/utils/libv4l2util/meson.build b/utils/libv4l2util/meson.build new file mode 100644 index 00000000..9d1c6e12 --- /dev/null +++ b/utils/libv4l2util/meson.build @@ -0,0 +1,16 @@ +libv4l2util_sources = files( + 'frequencies.c', + 'libv4l2util.h', + 'v4l2_driver.c', + 'v4l2_driver.h', +) + +libv4l2util = static_library('v4l2util', + libv4l2util_sources, + install : false, + include_directories : v4l2_utils_incdir) + +dep_libv4l2util = declare_dependency( + link_with : libv4l2util, + include_directories : '.', +) diff --git a/utils/libv4l2util/v4l2_driver.c b/utils/libv4l2util/v4l2_driver.c index 98345e8d..6b6366fa 100644 --- a/utils/libv4l2util/v4l2_driver.c +++ b/utils/libv4l2util/v4l2_driver.c @@ -142,8 +142,6 @@ static char *prt_caps(uint32_t caps) strcat (s,"RADIO "); if (V4L2_CAP_READWRITE & caps) strcat (s,"READWRITE "); - if (V4L2_CAP_ASYNCIO & caps) - strcat (s,"ASYNCIO "); if (V4L2_CAP_STREAMING & caps) strcat (s,"STREAMING "); if (V4L2_CAP_EXT_PIX_FORMAT & caps) @@ -162,12 +160,6 @@ static char *prt_caps(uint32_t caps) strcat (s,"SDR_OUTPUT "); if(V4L2_CAP_META_CAPTURE & caps) strcat (s,"META_CAPTURE "); - if(V4L2_CAP_READWRITE & caps) - strcat (s,"READWRITE "); - if(V4L2_CAP_ASYNCIO & caps) - strcat (s,"ASYNCIO "); - if(V4L2_CAP_STREAMING & caps) - strcat (s,"STREAMING "); if(V4L2_CAP_META_OUTPUT & caps) strcat (s,"META_OUTPUT "); if(V4L2_CAP_TOUCH & caps) diff --git a/utils/media-ctl/.gitignore b/utils/media-ctl/.gitignore deleted file mode 100644 index 5354fec1..00000000 --- a/utils/media-ctl/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -media-ctl -media-bus-format-names.h -media-bus-format-codes.h diff --git a/utils/media-ctl/Makefile.am b/utils/media-ctl/Makefile.am deleted file mode 100644 index c48c8d62..00000000 --- a/utils/media-ctl/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -noinst_LTLIBRARIES = libmediactl.la libv4l2subdev.la - -libmediactl_la_SOURCES = libmediactl.c mediactl-priv.h -libmediactl_la_CFLAGS = -static $(LIBUDEV_CFLAGS) -libmediactl_la_LDFLAGS = -static $(LIBUDEV_LIBS) - -media-bus-format-names.h: ../../include/linux/media-bus-format.h - $(AM_V_GEN) sed -e '/#define MEDIA_BUS_FMT/ ! d; s/.*FMT_//; /FIXED/ d; s/\t.*//; s/.*/{ \"&\", MEDIA_BUS_FMT_& },/;' \ - < $< > $@ - -media-bus-format-codes.h: ../../include/linux/media-bus-format.h - $(AM_V_GEN) sed -e '/#define MEDIA_BUS_FMT/ ! d; s/.*#define //; /FIXED/ d; s/\t.*//; s/.*/ &,/;' \ - < $< > $@ - -BUILT_SOURCES = media-bus-format-names.h media-bus-format-codes.h -CLEANFILES = $(BUILT_SOURCES) - -nodist_libv4l2subdev_la_SOURCES = $(BUILT_SOURCES) -libv4l2subdev_la_SOURCES = libv4l2subdev.c -libv4l2subdev_la_LIBADD = libmediactl.la -libv4l2subdev_la_CFLAGS = -static -libv4l2subdev_la_LDFLAGS = -static - -mediactl_includedir=$(includedir)/mediactl -noinst_HEADERS = mediactl.h v4l2subdev.h - -bin_PROGRAMS = media-ctl -media_ctl_SOURCES = media-ctl.c options.c options.h tools.h -media_ctl_LDADD = libmediactl.la libv4l2subdev.la -media_ctl_CFLAGS = $(GIT_COMMIT_CNT) diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c index 1fd6525b..64ac8cf1 100644 --- a/utils/media-ctl/libmediactl.c +++ b/utils/media-ctl/libmediactl.c @@ -19,8 +19,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" - #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/types.h> @@ -876,6 +874,49 @@ struct media_pad *media_parse_pad(struct media_device *media, return &entity->pads[pad]; } +struct media_pad *media_parse_pad_stream(struct media_device *media, + const char *p, unsigned int *stream, + char **endp) +{ + struct media_pad *pad; + const char *orig_p = p; + char *ep; + + pad = media_parse_pad(media, p, &ep); + if (pad == NULL) + return NULL; + + p = ep; + + if (*p == '/') { + unsigned int s; + + p++; + + s = strtoul(p, &ep, 10); + + if (ep == p) { + media_dbg(media, "Unable to parse stream: '%s'\n", orig_p); + if (endp) + *endp = (char*)p; + return NULL; + } + + *stream = s; + + p++; + } else { + *stream = 0; + } + + for (; isspace(*p); ++p); + + if (endp) + *endp = (char*)p; + + return pad; +} + struct media_link *media_parse_link(struct media_device *media, const char *p, char **endp) { diff --git a/utils/media-ctl/libmediactl.pc.in b/utils/media-ctl/libmediactl.pc.in deleted file mode 100644 index dab2ff0a..00000000 --- a/utils/media-ctl/libmediactl.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libmediactl -Description: Media controller library. -Version: @PACKAGE_VERSION@ -Cflags: -I${includedir} -Libs: -L${libdir} -lmediactl diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c index 63bb3d75..c614f4a2 100644 --- a/utils/media-ctl/libv4l2subdev.c +++ b/utils/media-ctl/libv4l2subdev.c @@ -40,8 +40,20 @@ #include "tools.h" #include "v4l2subdev.h" +/* + * The max value comes from a check in the kernel source code + * drivers/media/v4l2-core/v4l2-ioctl.c check_array_args() + */ +#define NUM_ROUTES_MAX 256 + int v4l2_subdev_open(struct media_entity *entity) { + struct v4l2_subdev_client_capability clientcap = {}; + struct v4l2_subdev_capability subdevcap = {}; + bool subdev_streams; + bool client_streams; + int ret; + if (entity->fd != -1) return 0; @@ -54,6 +66,16 @@ int v4l2_subdev_open(struct media_entity *entity) return ret; } + ret = ioctl(entity->fd, VIDIOC_SUBDEV_QUERYCAP, &subdevcap); + subdev_streams = !ret && (subdevcap.capabilities & V4L2_SUBDEV_CAP_STREAMS); + + clientcap.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS; + + ret = ioctl(entity->fd, VIDIOC_SUBDEV_S_CLIENT_CAP, &clientcap); + client_streams = !ret && (clientcap.capabilities & V4L2_SUBDEV_CLIENT_CAP_STREAMS); + + entity->supports_streams = subdev_streams && client_streams; + return 0; } @@ -64,7 +86,7 @@ void v4l2_subdev_close(struct media_entity *entity) } int v4l2_subdev_get_format(struct media_entity *entity, - struct v4l2_mbus_framefmt *format, unsigned int pad, + struct v4l2_mbus_framefmt *format, unsigned int pad, unsigned int stream, enum v4l2_subdev_format_whence which) { struct v4l2_subdev_format fmt; @@ -74,8 +96,14 @@ int v4l2_subdev_get_format(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&fmt, 0, sizeof(fmt)); fmt.pad = pad; + fmt.stream = stream; fmt.which = which; ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_FMT, &fmt); @@ -88,6 +116,7 @@ int v4l2_subdev_get_format(struct media_entity *entity, int v4l2_subdev_set_format(struct media_entity *entity, struct v4l2_mbus_framefmt *format, unsigned int pad, + unsigned int stream, enum v4l2_subdev_format_whence which) { struct v4l2_subdev_format fmt; @@ -97,8 +126,14 @@ int v4l2_subdev_set_format(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&fmt, 0, sizeof(fmt)); fmt.pad = pad; + fmt.stream = stream; fmt.which = which; fmt.format = *format; @@ -111,8 +146,8 @@ int v4l2_subdev_set_format(struct media_entity *entity, } int v4l2_subdev_get_selection(struct media_entity *entity, - struct v4l2_rect *rect, unsigned int pad, unsigned int target, - enum v4l2_subdev_format_whence which) + struct v4l2_rect *rect, unsigned int pad, unsigned int stream, + unsigned int target, enum v4l2_subdev_format_whence which) { union { struct v4l2_subdev_selection sel; @@ -124,8 +159,14 @@ int v4l2_subdev_get_selection(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&u.sel, 0, sizeof(u.sel)); u.sel.pad = pad; + u.sel.stream = stream; u.sel.target = target; u.sel.which = which; @@ -150,8 +191,8 @@ int v4l2_subdev_get_selection(struct media_entity *entity, } int v4l2_subdev_set_selection(struct media_entity *entity, - struct v4l2_rect *rect, unsigned int pad, unsigned int target, - enum v4l2_subdev_format_whence which) + struct v4l2_rect *rect, unsigned int pad, unsigned int stream, + unsigned int target, enum v4l2_subdev_format_whence which) { union { struct v4l2_subdev_selection sel; @@ -163,8 +204,14 @@ int v4l2_subdev_set_selection(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&u.sel, 0, sizeof(u.sel)); u.sel.pad = pad; + u.sel.stream = stream; u.sel.target = target; u.sel.which = which; u.sel.r = *rect; @@ -179,6 +226,7 @@ int v4l2_subdev_set_selection(struct media_entity *entity, memset(&u.crop, 0, sizeof(u.crop)); u.crop.pad = pad; + u.crop.stream = stream; u.crop.which = which; u.crop.rect = *rect; @@ -190,6 +238,79 @@ int v4l2_subdev_set_selection(struct media_entity *entity, return 0; } +int v4l2_subdev_get_routing(struct media_entity *entity, + struct v4l2_subdev_route **routes, + unsigned int *num_routes) +{ + struct v4l2_subdev_routing routing = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; + struct v4l2_subdev_route *r; + int ret; + + ret = v4l2_subdev_open(entity); + if (ret < 0) + return ret; + + if (!entity->supports_streams) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + + ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing); + if (ret == -1 && errno != ENOSPC) + return -errno; + + if (!routing.num_routes) { + *routes = NULL; + *num_routes = 0; + return 0; + } + + r = calloc(routing.num_routes, sizeof(*r)); + if (!r) + return -ENOMEM; + + routing.routes = (uintptr_t)r; + ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_ROUTING, &routing); + if (ret) { + free(r); + return ret; + } + + *num_routes = routing.num_routes; + *routes = r; + + return 0; +} + +int v4l2_subdev_set_routing(struct media_entity *entity, + struct v4l2_subdev_route *routes, + unsigned int num_routes) +{ + struct v4l2_subdev_routing routing = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .routes = (uintptr_t)routes, + .num_routes = num_routes, + }; + int ret; + + ret = v4l2_subdev_open(entity); + if (ret < 0) + return ret; + + if (!entity->supports_streams) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + + ret = ioctl(entity->fd, VIDIOC_SUBDEV_S_ROUTING, &routing); + if (ret == -1) + return -errno; + + return 0; +} + int v4l2_subdev_get_dv_timings_caps(struct media_entity *entity, struct v4l2_dv_timings_cap *caps) { @@ -264,7 +385,7 @@ int v4l2_subdev_set_dv_timings(struct media_entity *entity, int v4l2_subdev_get_frame_interval(struct media_entity *entity, struct v4l2_fract *interval, - unsigned int pad) + unsigned int pad, unsigned int stream) { struct v4l2_subdev_frame_interval ival; int ret; @@ -273,8 +394,14 @@ int v4l2_subdev_get_frame_interval(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&ival, 0, sizeof(ival)); ival.pad = pad; + ival.stream = stream; ret = ioctl(entity->fd, VIDIOC_SUBDEV_G_FRAME_INTERVAL, &ival); if (ret < 0) @@ -286,7 +413,7 @@ int v4l2_subdev_get_frame_interval(struct media_entity *entity, int v4l2_subdev_set_frame_interval(struct media_entity *entity, struct v4l2_fract *interval, - unsigned int pad) + unsigned int pad, unsigned int stream) { struct v4l2_subdev_frame_interval ival; int ret; @@ -295,8 +422,14 @@ int v4l2_subdev_set_frame_interval(struct media_entity *entity, if (ret < 0) return ret; + if (!entity->supports_streams && stream) { + media_dbg(entity->media, "Streams API not supported\n"); + return -ENOTSUP; + } + memset(&ival, 0, sizeof(ival)); ival.pad = pad; + ival.stream = stream; ival.interval = *interval; ret = ioctl(entity->fd, VIDIOC_SUBDEV_S_FRAME_INTERVAL, &ival); @@ -307,6 +440,155 @@ int v4l2_subdev_set_frame_interval(struct media_entity *entity, return 0; } +static int v4l2_subdev_parse_setup_route(struct media_device *media, + struct v4l2_subdev_route *r, + const char *p, char **endp) +{ + char *end; + + /* sink pad/stream */ + + r->sink_pad = strtoul(p, &end, 10); + if (*end != '/') { + media_dbg(media, "Expected '/'\n"); + return -EINVAL; + } + + p = end + 1; + + r->sink_stream = strtoul(p, &end, 10); + + for (; isspace(*end); ++end); + + if (end[0] != '-' || end[1] != '>') { + media_dbg(media, "Expected '->'\n"); + return -EINVAL; + } + p = end + 2; + + /* source pad/stream */ + + r->source_pad = strtoul(p, &end, 10); + if (*end != '/') { + media_dbg(media, "Expected '/'\n"); + return -EINVAL; + } + + p = end + 1; + + r->source_stream = strtoul(p, &end, 10); + + /* flags */ + + for (; isspace(*end); ++end); + + if (*end != '[') { + media_dbg(media, "Expected '['\n"); + return -EINVAL; + } + + for (end++; isspace(*end); ++end); + + p = end; + + r->flags = strtoul(p, &end, 0); + if (r->flags & ~(V4L2_SUBDEV_ROUTE_FL_ACTIVE)) { + media_dbg(media, "Bad route flags %#x\n", r->flags); + return -EINVAL; + } + + for (; isspace(*end); ++end); + + if (*end != ']') { + media_dbg(media, "Expected ']'\n"); + return -EINVAL; + } + end++; + + for (; isspace(*end); ++end); + + *endp = end; + + return 0; +} + +int v4l2_subdev_parse_setup_routes(struct media_device *media, const char *p) +{ + struct media_entity *entity; + struct v4l2_subdev_route *routes; + unsigned int num_routes; + unsigned int i; + char *end; + int ret; + + entity = media_parse_entity(media, p, &end); + if (!entity) + return -EINVAL; + + p = end; + + if (*p != '[') { + media_dbg(media, "Expected '['\n"); + return -EINVAL; + } + + p++; + + routes = calloc(NUM_ROUTES_MAX, sizeof(routes[0])); + if (!routes) + return -ENOMEM; + + num_routes = 0; + + while (*p != 0) { + struct v4l2_subdev_route *r = &routes[num_routes]; + + ret = v4l2_subdev_parse_setup_route(media, r, p, &end); + if (ret) + goto out; + + p = end; + + num_routes++; + + if (*p == ',') { + p++; + continue; + } + + break; + } + + if (*p != ']') { + media_dbg(media, "Expected ']'\n"); + ret = -EINVAL; + goto out; + } + + for (i = 0; i < num_routes; ++i) { + struct v4l2_subdev_route *r = &routes[i]; + + media_dbg(entity->media, + "Setting up route %s : %u/%u -> %u/%u [0x%08x]\n", + entity->info.name, + r->sink_pad, r->sink_stream, + r->source_pad, r->source_stream, + r->flags); + } + + ret = v4l2_subdev_set_routing(entity, routes, num_routes); + if (ret) { + media_dbg(entity->media, "VIDIOC_SUBDEV_S_ROUTING failed: %d\n", + ret); + goto out; + } + +out: + free(routes); + + return ret; +} + static int v4l2_subdev_parse_format(struct media_device *media, struct v4l2_mbus_framefmt *format, const char *p, char **endp) @@ -442,7 +724,8 @@ static bool strhazit(const char *str, const char **p) } static struct media_pad *v4l2_subdev_parse_pad_format( - struct media_device *media, struct v4l2_mbus_framefmt *format, + struct media_device *media, unsigned int *stream, + struct v4l2_mbus_framefmt *format, struct v4l2_rect *crop, struct v4l2_rect *compose, struct v4l2_fract *interval, const char *p, char **endp) { @@ -453,7 +736,7 @@ static struct media_pad *v4l2_subdev_parse_pad_format( for (; isspace(*p); ++p); - pad = media_parse_pad(media, p, &end); + pad = media_parse_pad_stream(media, p, stream, &end); if (pad == NULL) { *endp = end; return NULL; @@ -675,6 +958,7 @@ static struct media_pad *v4l2_subdev_parse_pad_format( } static int set_format(struct media_pad *pad, + unsigned int stream, struct v4l2_mbus_framefmt *format) { int ret; @@ -683,12 +967,12 @@ static int set_format(struct media_pad *pad, return 0; media_dbg(pad->entity->media, - "Setting up format %s %ux%u on pad %s/%u\n", + "Setting up format %s %ux%u on pad %s/%u/%u\n", v4l2_subdev_pixelcode_to_string(format->code), format->width, format->height, - pad->entity->info.name, pad->index); + pad->entity->info.name, pad->index, stream); - ret = v4l2_subdev_set_format(pad->entity, format, pad->index, + ret = v4l2_subdev_set_format(pad->entity, format, pad->index, stream, V4L2_SUBDEV_FORMAT_ACTIVE); if (ret < 0) { media_dbg(pad->entity->media, @@ -705,8 +989,8 @@ static int set_format(struct media_pad *pad, return 0; } -static int set_selection(struct media_pad *pad, unsigned int target, - struct v4l2_rect *rect) +static int set_selection(struct media_pad *pad, unsigned int stream, + unsigned int target, struct v4l2_rect *rect) { int ret; @@ -714,11 +998,11 @@ static int set_selection(struct media_pad *pad, unsigned int target, return 0; media_dbg(pad->entity->media, - "Setting up selection target %u rectangle (%u,%u)/%ux%u on pad %s/%u\n", + "Setting up selection target %u rectangle (%u,%u)/%ux%u on pad %s/%u/%u\n", target, rect->left, rect->top, rect->width, rect->height, - pad->entity->info.name, pad->index); + pad->entity->info.name, pad->index, stream); - ret = v4l2_subdev_set_selection(pad->entity, rect, pad->index, + ret = v4l2_subdev_set_selection(pad->entity, rect, pad->index, stream, target, V4L2_SUBDEV_FORMAT_ACTIVE); if (ret < 0) { media_dbg(pad->entity->media, @@ -734,7 +1018,7 @@ static int set_selection(struct media_pad *pad, unsigned int target, return 0; } -static int set_frame_interval(struct media_pad *pad, +static int set_frame_interval(struct media_pad *pad, unsigned int stream, struct v4l2_fract *interval) { int ret; @@ -743,11 +1027,12 @@ static int set_frame_interval(struct media_pad *pad, return 0; media_dbg(pad->entity->media, - "Setting up frame interval %u/%u on pad %s/%u\n", + "Setting up frame interval %u/%u on pad %s/%u/%u\n", interval->numerator, interval->denominator, - pad->entity->info.name, pad->index); + pad->entity->info.name, pad->index, stream); - ret = v4l2_subdev_set_frame_interval(pad->entity, interval, pad->index); + ret = v4l2_subdev_set_frame_interval(pad->entity, interval, pad->index, + stream); if (ret < 0) { media_dbg(pad->entity->media, "Unable to set frame interval: %s (%d)", @@ -770,11 +1055,13 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media, struct v4l2_rect crop = { -1, -1, -1, -1 }; struct v4l2_rect compose = crop; struct v4l2_fract interval = { 0, 0 }; + unsigned int stream; unsigned int i; char *end; int ret; - pad = v4l2_subdev_parse_pad_format(media, &format, &crop, &compose, + pad = v4l2_subdev_parse_pad_format(media, &stream, + &format, &crop, &compose, &interval, p, &end); if (pad == NULL) { media_print_streampos(media, p, end); @@ -783,30 +1070,29 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media, } if (pad->flags & MEDIA_PAD_FL_SINK) { - ret = set_format(pad, &format); + ret = set_format(pad, stream, &format); if (ret < 0) return ret; } - ret = set_selection(pad, V4L2_SEL_TGT_CROP, &crop); + ret = set_selection(pad, stream, V4L2_SEL_TGT_CROP, &crop); if (ret < 0) return ret; - ret = set_selection(pad, V4L2_SEL_TGT_COMPOSE, &compose); + ret = set_selection(pad, stream, V4L2_SEL_TGT_COMPOSE, &compose); if (ret < 0) return ret; if (pad->flags & MEDIA_PAD_FL_SOURCE) { - ret = set_format(pad, &format); + ret = set_format(pad, stream, &format); if (ret < 0) return ret; } - ret = set_frame_interval(pad, &interval); + ret = set_frame_interval(pad, stream, &interval); if (ret < 0) return ret; - /* If the pad is an output pad, automatically set the same format and * frame interval on the remote subdev input pads, if any. */ @@ -821,9 +1107,9 @@ static int v4l2_subdev_parse_setup_format(struct media_device *media, if (link->source == pad && link->sink->entity->info.type == MEDIA_ENT_T_V4L2_SUBDEV) { remote_format = format; - set_format(link->sink, &remote_format); + set_format(link->sink, stream, &remote_format); - ret = set_frame_interval(link->sink, &interval); + ret = set_frame_interval(link->sink, stream, &interval); if (ret < 0 && ret != -EINVAL && ret != -ENOTTY) return ret; } diff --git a/utils/media-ctl/libv4l2subdev.pc.in b/utils/media-ctl/libv4l2subdev.pc.in deleted file mode 100644 index a601b781..00000000 --- a/utils/media-ctl/libv4l2subdev.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libv4l2subdev -Description: V4L2 subdevice library. -Requires: libmediactl -Version: @PACKAGE_VERSION@ -Cflags: -I${includedir} -Libs: -L${libdir} -lv4l2subdev diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c index 84ee7a83..961d10c8 100644 --- a/utils/media-ctl/media-ctl.c +++ b/utils/media-ctl/media-ctl.c @@ -28,6 +28,7 @@ #include <errno.h> #include <fcntl.h> #include <stdbool.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -75,23 +76,43 @@ static void print_flags(const struct flag_name *flag_names, unsigned int num_ent } } +static void v4l2_subdev_print_routes(struct media_entity *entity, + struct v4l2_subdev_route *routes, + unsigned int num_routes) +{ + unsigned int i; + + if (num_routes) + printf("\troutes:\n"); + + for (i = 0; i < num_routes; i++) { + const struct v4l2_subdev_route *route = &routes[i]; + + printf("\t\t%u/%u -> %u/%u [%s]\n", + route->sink_pad, route->sink_stream, + route->source_pad, route->source_stream, + route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE ? "ACTIVE" : "INACTIVE"); + } +} + static void v4l2_subdev_print_format(struct media_entity *entity, - unsigned int pad, enum v4l2_subdev_format_whence which) + unsigned int pad, unsigned int stream, + enum v4l2_subdev_format_whence which) { struct v4l2_mbus_framefmt format; struct v4l2_fract interval = { 0, 0 }; struct v4l2_rect rect; int ret; - ret = v4l2_subdev_get_format(entity, &format, pad, which); + ret = v4l2_subdev_get_format(entity, &format, pad, stream, which); if (ret != 0) return; - ret = v4l2_subdev_get_frame_interval(entity, &interval, pad); + ret = v4l2_subdev_get_frame_interval(entity, &interval, pad, stream); if (ret != 0 && ret != -ENOTTY && ret != -EINVAL) return; - printf("\t\t[fmt:%s/%ux%u", + printf("\t\t[stream:%u fmt:%s/%ux%u", stream, v4l2_subdev_pixelcode_to_string(format.code), format.width, format.height); @@ -118,28 +139,28 @@ static void v4l2_subdev_print_format(struct media_entity *entity, v4l2_subdev_quantization_to_string(format.quantization)); } - ret = v4l2_subdev_get_selection(entity, &rect, pad, + ret = v4l2_subdev_get_selection(entity, &rect, pad, stream, V4L2_SEL_TGT_CROP_BOUNDS, which); if (ret == 0) printf("\n\t\t crop.bounds:(%u,%u)/%ux%u", rect.left, rect.top, rect.width, rect.height); - ret = v4l2_subdev_get_selection(entity, &rect, pad, + ret = v4l2_subdev_get_selection(entity, &rect, pad, stream, V4L2_SEL_TGT_CROP, which); if (ret == 0) printf("\n\t\t crop:(%u,%u)/%ux%u", rect.left, rect.top, rect.width, rect.height); - ret = v4l2_subdev_get_selection(entity, &rect, pad, + ret = v4l2_subdev_get_selection(entity, &rect, pad, stream, V4L2_SEL_TGT_COMPOSE_BOUNDS, which); if (ret == 0) printf("\n\t\t compose.bounds:(%u,%u)/%ux%u", rect.left, rect.top, rect.width, rect.height); - ret = v4l2_subdev_get_selection(entity, &rect, pad, + ret = v4l2_subdev_get_selection(entity, &rect, pad, stream, V4L2_SEL_TGT_COMPOSE, which); if (ret == 0) @@ -455,12 +476,49 @@ static void media_print_topology_dot(struct media_device *media) } static void media_print_pad_text(struct media_entity *entity, - const struct media_pad *pad) + const struct media_pad *pad, + struct v4l2_subdev_route *routes, + unsigned int num_routes) { + uint64_t printed_streams_mask = 0; + unsigned int i; + if (media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) return; - v4l2_subdev_print_format(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE); + if (!routes) { + v4l2_subdev_print_format(entity, pad->index, 0, + V4L2_SUBDEV_FORMAT_ACTIVE); + } else { + for (i = 0; i < num_routes; ++i) { + const struct v4l2_subdev_route *route = &routes[i]; + unsigned int stream; + + if (!(route->flags & V4L2_SUBDEV_ROUTE_FL_ACTIVE)) + continue; + + if (pad->flags & MEDIA_PAD_FL_SINK) { + if (route->sink_pad != pad->index) + continue; + + stream = route->sink_stream; + } else { + if (route->source_pad != pad->index) + continue; + + stream = route->source_stream; + } + + if (printed_streams_mask & (1ULL << stream)) + continue; + + v4l2_subdev_print_format(entity, pad->index, stream, + V4L2_SUBDEV_FORMAT_ACTIVE); + + printed_streams_mask |= (1ULL << stream); + } + } + v4l2_subdev_print_pad_dv(entity, pad->index, V4L2_SUBDEV_FORMAT_ACTIVE); if (pad->flags & MEDIA_PAD_FL_SOURCE) @@ -478,13 +536,24 @@ static void media_print_topology_text_entity(struct media_device *media, const struct media_entity_desc *info = media_entity_get_info(entity); const char *devname = media_entity_get_devname(entity); unsigned int num_links = media_entity_get_links_count(entity); + struct v4l2_subdev_route *routes = NULL; + unsigned int num_routes = 0; unsigned int j, k; unsigned int padding; + if (media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV) + v4l2_subdev_get_routing(entity, &routes, &num_routes); + padding = printf("- entity %u: ", info->id); - printf("%s (%u pad%s, %u link%s)\n", info->name, + printf("%s (%u pad%s, %u link%s", info->name, info->pads, info->pads > 1 ? "s" : "", num_links, num_links > 1 ? "s" : ""); + + if (media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV) + printf(", %u route%s", num_routes, num_routes != 1 ? "s" : ""); + + printf(")\n"); + printf("%*ctype %s subtype %s flags %x\n", padding, ' ', media_entity_type_to_string(info->type), media_entity_subtype_to_string(info->type), @@ -492,12 +561,15 @@ static void media_print_topology_text_entity(struct media_device *media, if (devname) printf("%*cdevice node name %s\n", padding, ' ', devname); + if (media_entity_type(entity) == MEDIA_ENT_T_V4L2_SUBDEV) + v4l2_subdev_print_routes(entity, routes, num_routes); + for (j = 0; j < info->pads; j++) { const struct media_pad *pad = media_entity_get_pad(entity, j); printf("\tpad%u: %s\n", j, media_pad_type_to_string(pad->flags)); - media_print_pad_text(entity, pad); + media_print_pad_text(entity, pad, routes, num_routes); for (k = 0; k < num_links; k++) { const struct media_link *link = media_entity_get_link(entity, k); @@ -521,6 +593,8 @@ static void media_print_topology_text_entity(struct media_device *media, } } printf("\n"); + + free(routes); } static void media_print_topology_text(struct media_device *media) @@ -594,14 +668,16 @@ int main(int argc, char **argv) if (media_opts.fmt_pad) { struct media_pad *pad; + unsigned int stream; + char *p; - pad = media_parse_pad(media, media_opts.fmt_pad, NULL); + pad = media_parse_pad_stream(media, media_opts.fmt_pad, &stream, &p); if (pad == NULL) { printf("Pad '%s' not found\n", media_opts.fmt_pad); goto out; } - v4l2_subdev_print_format(pad->ent |