summaryrefslogtreecommitdiff
path: root/repo/media/v4l-utils
diff options
context:
space:
mode:
Diffstat (limited to 'repo/media/v4l-utils')
-rw-r--r--repo/media/v4l-utils/fix_parse_next_subopt.patch36
-rw-r--r--repo/media/v4l-utils/types.patch26
-rw-r--r--repo/media/v4l-utils/v4l-utils.xibuild29
3 files changed, 91 insertions, 0 deletions
diff --git a/repo/media/v4l-utils/fix_parse_next_subopt.patch b/repo/media/v4l-utils/fix_parse_next_subopt.patch
new file mode 100644
index 0000000..d4df9d4
--- /dev/null
+++ b/repo/media/v4l-utils/fix_parse_next_subopt.patch
@@ -0,0 +1,36 @@
+parse_next_subopt() relies on undefined behavior and only works with glibc's
+implementation of getsubopt(). This fixes the issue.
+--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp 2021-11-08 11:23:39.079748359 +0100
++++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp 2021-11-08 11:39:49.328576794 +0100
+@@ -956,15 +956,23 @@ static bool parse_subset(char *optarg)
+
+ static bool parse_next_subopt(char **subs, char **value)
+ {
+- static char *const subopts[] = {
+- nullptr
+- };
+- int opt = getsubopt(subs, subopts, value);
++ char *start = *subs;
++ if (!start || (start[0] == '\0')) {
++ fprintf(stderr, "Missing suboption value\n");
++ return true;
++ }
++ *value = start;
+
+- if (opt < 0 || *value)
+- return false;
+- fprintf(stderr, "Missing suboption value\n");
+- return true;
++ char *sep = std::strchr(start, ',');
++ if (sep != nullptr) {
++ *sep = '\0';
++ *subs = sep + 1;
++ }
++ else {
++ *subs = std::strchr(start, '\0');
++ }
++
++ return false;
+ }
+
+ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
diff --git a/repo/media/v4l-utils/types.patch b/repo/media/v4l-utils/types.patch
new file mode 100644
index 0000000..340bb81
--- /dev/null
+++ b/repo/media/v4l-utils/types.patch
@@ -0,0 +1,26 @@
+--- a/utils/keytable/keymap.h
++++ b/utils/keytable/keymap.h
+@@ -2,6 +2,10 @@
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+
++#include <stdint.h>
++typedef uint32_t u_int32_t;
++typedef int error_t;
++
+ struct keymap {
+ struct keymap *next;
+ char *name;
+--- a/utils/ir-ctl/keymap.h
++++ b/utils/ir-ctl/keymap.h
+@@ -2,6 +2,10 @@
+ #ifndef __KEYMAP_H
+ #define __KEYMAP_H
+
++#include <stdint.h>
++typedef uint32_t u_int32_t;
++typedef int error_t;
++
+ struct keymap {
+ struct keymap *next;
+ char *name;
diff --git a/repo/media/v4l-utils/v4l-utils.xibuild b/repo/media/v4l-utils/v4l-utils.xibuild
new file mode 100644
index 0000000..bd40b23
--- /dev/null
+++ b/repo/media/v4l-utils/v4l-utils.xibuild
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+NAME="v4l-utils"
+DESC="Userspace tools and conversion library for Video 4 Linux"
+
+MAKEDEPS="make "
+DEPS="alsa-lib libjpeg-turbo argp-standalone eudev "
+
+PKG_VER=1.22.1
+SOURCE="https://linuxtv.org/downloads/v4l-utils/v4l-utils-$PKG_VER.tar.bz2"
+ADDITIONAL="fix_parse_next_subopt.patch types.patch "
+
+prepare () {
+ apply_patches
+}
+
+build () {
+ ./configure \
+ --prefix=/usr
+ --bindir=/usr/bin \
+ --sysconfdir=/etc \
+ --disable-static \
+ --enable-libdvbv5
+ make
+}
+
+package () {
+ make DESTDIR=$PKG_DEST install
+}