|
|
86f512 |
From 8cdc7e8c7e08da82b8b3b7516f957f13e541af59 Mon Sep 17 00:00:00 2001
|
|
|
86f512 |
From: Eugene Syromyatnikov <evgsyr@gmail.com>
|
|
|
86f512 |
Date: Wed, 29 Jan 2020 18:48:31 +0100
|
|
|
86f512 |
Subject: [PATCH 85/86] v4l2: decode frame intervals/sizes unconditionally
|
|
|
86f512 |
|
|
|
86f512 |
---
|
|
|
86f512 |
v4l2.c | 62 ++++++++++++++++++++++++++++++++--------
|
|
|
86f512 |
xlat/v4l2_frameinterval_types.in | 6 ++--
|
|
|
86f512 |
xlat/v4l2_framesize_types.in | 6 ++--
|
|
|
86f512 |
3 files changed, 56 insertions(+), 18 deletions(-)
|
|
|
86f512 |
|
|
|
86f512 |
Index: strace-5.1/v4l2.c
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/v4l2.c 2020-01-29 21:08:39.766035121 +0100
|
|
|
86f512 |
+++ strace-5.1/v4l2.c 2020-01-29 21:08:41.137022537 +0100
|
|
|
86f512 |
@@ -206,6 +206,52 @@
|
|
|
86f512 |
|
|
|
86f512 |
|
|
|
86f512 |
typedef struct {
|
|
|
86f512 |
+ uint32_t width;
|
|
|
86f512 |
+ uint32_t height;
|
|
|
86f512 |
+} struct_v4l2_frmsize_discrete;
|
|
|
86f512 |
+
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ uint32_t min_width;
|
|
|
86f512 |
+ uint32_t max_width;
|
|
|
86f512 |
+ uint32_t step_width;
|
|
|
86f512 |
+ uint32_t min_height;
|
|
|
86f512 |
+ uint32_t max_height;
|
|
|
86f512 |
+ uint32_t step_height;
|
|
|
86f512 |
+} struct_v4l2_frmsize_stepwise;
|
|
|
86f512 |
+
|
|
|
86f512 |
+/** Added by Linux commit v2.6.19-rc1~183 */
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ uint32_t index;
|
|
|
86f512 |
+ uint32_t pixel_format;
|
|
|
86f512 |
+ uint32_t type; /**< enum v4l2_frmsizetypes */
|
|
|
86f512 |
+ union {
|
|
|
86f512 |
+ struct_v4l2_frmsize_discrete discrete;
|
|
|
86f512 |
+ struct_v4l2_frmsize_stepwise stepwise;
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ uint32_t reserved[2];
|
|
|
86f512 |
+} struct_v4l2_frmsizeenum;
|
|
|
86f512 |
+
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ struct v4l2_fract min;
|
|
|
86f512 |
+ struct v4l2_fract max;
|
|
|
86f512 |
+ struct v4l2_fract step;
|
|
|
86f512 |
+} struct_v4l2_frmival_stepwise;
|
|
|
86f512 |
+
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
+ uint32_t index;
|
|
|
86f512 |
+ uint32_t pixel_format;
|
|
|
86f512 |
+ uint32_t width;
|
|
|
86f512 |
+ uint32_t height;
|
|
|
86f512 |
+ uint32_t type; /**< enum v4l2_frmivaltypes */
|
|
|
86f512 |
+ union {
|
|
|
86f512 |
+ struct v4l2_fract discrete;
|
|
|
86f512 |
+ struct_v4l2_frmival_stepwise stepwise;
|
|
|
86f512 |
+ };
|
|
|
86f512 |
+ uint32_t reserved[2];
|
|
|
86f512 |
+} struct_v4l2_frmivalenum;
|
|
|
86f512 |
+
|
|
|
86f512 |
+
|
|
|
86f512 |
+typedef struct {
|
|
|
86f512 |
uint32_t index;
|
|
|
86f512 |
uint32_t count;
|
|
|
86f512 |
uint32_t memory;
|
|
|
86f512 |
@@ -1076,13 +1122,12 @@
|
|
|
86f512 |
return 0;
|
|
|
86f512 |
}
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_ENUM_FRAMESIZES
|
|
|
86f512 |
-# include "xlat/v4l2_framesize_types.h"
|
|
|
86f512 |
+#include "xlat/v4l2_framesize_types.h"
|
|
|
86f512 |
|
|
|
86f512 |
static int
|
|
|
86f512 |
print_v4l2_frmsizeenum(struct tcb *const tcp, const kernel_ulong_t arg)
|
|
|
86f512 |
{
|
|
|
86f512 |
- struct v4l2_frmsizeenum s;
|
|
|
86f512 |
+ struct_v4l2_frmsizeenum s;
|
|
|
86f512 |
|
|
|
86f512 |
if (entering(tcp)) {
|
|
|
86f512 |
tprints(", ");
|
|
|
86f512 |
@@ -1114,15 +1159,13 @@
|
|
|
86f512 |
tprints("}");
|
|
|
86f512 |
return RVAL_IOCTL_DECODED;
|
|
|
86f512 |
}
|
|
|
86f512 |
-#endif /* VIDIOC_ENUM_FRAMESIZES */
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_ENUM_FRAMEINTERVALS
|
|
|
86f512 |
-# include "xlat/v4l2_frameinterval_types.h"
|
|
|
86f512 |
+#include "xlat/v4l2_frameinterval_types.h"
|
|
|
86f512 |
|
|
|
86f512 |
static int
|
|
|
86f512 |
print_v4l2_frmivalenum(struct tcb *const tcp, const kernel_ulong_t arg)
|
|
|
86f512 |
{
|
|
|
86f512 |
- struct v4l2_frmivalenum f;
|
|
|
86f512 |
+ struct_v4l2_frmivalenum f;
|
|
|
86f512 |
|
|
|
86f512 |
if (entering(tcp)) {
|
|
|
86f512 |
tprints(", ");
|
|
|
86f512 |
@@ -1158,7 +1201,6 @@
|
|
|
86f512 |
|
|
|
86f512 |
return RVAL_IOCTL_DECODED;
|
|
|
86f512 |
}
|
|
|
86f512 |
-#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
|
|
|
86f512 |
|
|
|
86f512 |
static int
|
|
|
86f512 |
print_v4l2_create_buffers(struct tcb *const tcp, const kernel_ulong_t arg)
|
|
|
86f512 |
@@ -1281,15 +1323,11 @@
|
|
|
86f512 |
return print_v4l2_ext_controls(tcp, arg,
|
|
|
86f512 |
code == VIDIOC_G_EXT_CTRLS);
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_ENUM_FRAMESIZES
|
|
|
86f512 |
case VIDIOC_ENUM_FRAMESIZES: /* RW */
|
|
|
86f512 |
return print_v4l2_frmsizeenum(tcp, arg);
|
|
|
86f512 |
-#endif /* VIDIOC_ENUM_FRAMESIZES */
|
|
|
86f512 |
|
|
|
86f512 |
-#ifdef VIDIOC_ENUM_FRAMEINTERVALS
|
|
|
86f512 |
case VIDIOC_ENUM_FRAMEINTERVALS: /* RW */
|
|
|
86f512 |
return print_v4l2_frmivalenum(tcp, arg);
|
|
|
86f512 |
-#endif /* VIDIOC_ENUM_FRAMEINTERVALS */
|
|
|
86f512 |
|
|
|
86f512 |
case VIDIOC_CREATE_BUFS: /* RW */
|
|
|
86f512 |
return print_v4l2_create_buffers(tcp, arg);
|
|
|
86f512 |
Index: strace-5.1/xlat/v4l2_frameinterval_types.in
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/xlat/v4l2_frameinterval_types.in 2020-01-29 21:08:21.012207266 +0100
|
|
|
86f512 |
+++ strace-5.1/xlat/v4l2_frameinterval_types.in 2020-01-29 21:08:41.137022537 +0100
|
|
|
86f512 |
@@ -1,3 +1,3 @@
|
|
|
86f512 |
-V4L2_FRMIVAL_TYPE_DISCRETE
|
|
|
86f512 |
-V4L2_FRMIVAL_TYPE_CONTINUOUS
|
|
|
86f512 |
-V4L2_FRMIVAL_TYPE_STEPWISE
|
|
|
86f512 |
+V4L2_FRMIVAL_TYPE_DISCRETE 1
|
|
|
86f512 |
+V4L2_FRMIVAL_TYPE_CONTINUOUS 2
|
|
|
86f512 |
+V4L2_FRMIVAL_TYPE_STEPWISE 3
|
|
|
86f512 |
Index: strace-5.1/xlat/v4l2_framesize_types.in
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/xlat/v4l2_framesize_types.in 2020-01-29 21:08:21.012207266 +0100
|
|
|
86f512 |
+++ strace-5.1/xlat/v4l2_framesize_types.in 2020-01-29 21:08:41.137022537 +0100
|
|
|
86f512 |
@@ -1,3 +1,3 @@
|
|
|
86f512 |
-V4L2_FRMSIZE_TYPE_DISCRETE
|
|
|
86f512 |
-V4L2_FRMSIZE_TYPE_CONTINUOUS
|
|
|
86f512 |
-V4L2_FRMSIZE_TYPE_STEPWISE
|
|
|
86f512 |
+V4L2_FRMSIZE_TYPE_DISCRETE 1
|
|
|
86f512 |
+V4L2_FRMSIZE_TYPE_CONTINUOUS 2
|
|
|
86f512 |
+V4L2_FRMSIZE_TYPE_STEPWISE 3
|
|
|
86f512 |
Index: strace-5.1/xlat/v4l2_frameinterval_types.h
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/xlat/v4l2_frameinterval_types.h 2019-05-22 15:08:30.000000000 +0200
|
|
|
86f512 |
+++ strace-5.1/xlat/v4l2_frameinterval_types.h 2020-01-29 21:12:03.513076783 +0100
|
|
|
86f512 |
@@ -3,6 +3,27 @@
|
|
|
86f512 |
#include "gcc_compat.h"
|
|
|
86f512 |
#include "static_assert.h"
|
|
|
86f512 |
|
|
|
86f512 |
+#if defined(V4L2_FRMIVAL_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMIVAL_TYPE_DISCRETE) == (1), "V4L2_FRMIVAL_TYPE_DISCRETE != 1");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMIVAL_TYPE_DISCRETE 1
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
+#if defined(V4L2_FRMIVAL_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMIVAL_TYPE_CONTINUOUS) == (2), "V4L2_FRMIVAL_TYPE_CONTINUOUS != 2");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMIVAL_TYPE_CONTINUOUS 2
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
+#if defined(V4L2_FRMIVAL_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMIVAL_TYPE_STEPWISE) == (3), "V4L2_FRMIVAL_TYPE_STEPWISE != 3");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMIVAL_TYPE_STEPWISE 3
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
|
|
|
86f512 |
#ifndef XLAT_MACROS_ONLY
|
|
|
86f512 |
|
|
|
86f512 |
@@ -16,15 +37,9 @@
|
|
|
86f512 |
static
|
|
|
86f512 |
# endif
|
|
|
86f512 |
const struct xlat v4l2_frameinterval_types[] = {
|
|
|
86f512 |
-#if defined(V4L2_FRMIVAL_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_DISCRETE)
|
|
|
86f512 |
- XLAT(V4L2_FRMIVAL_TYPE_DISCRETE),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
-#if defined(V4L2_FRMIVAL_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMIVAL_TYPE_CONTINUOUS)
|
|
|
86f512 |
- XLAT(V4L2_FRMIVAL_TYPE_CONTINUOUS),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
-#if defined(V4L2_FRMIVAL_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMIVAL_TYPE_STEPWISE)
|
|
|
86f512 |
- XLAT(V4L2_FRMIVAL_TYPE_STEPWISE),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
+ XLAT(V4L2_FRMIVAL_TYPE_DISCRETE),
|
|
|
86f512 |
+ XLAT(V4L2_FRMIVAL_TYPE_CONTINUOUS),
|
|
|
86f512 |
+ XLAT(V4L2_FRMIVAL_TYPE_STEPWISE),
|
|
|
86f512 |
XLAT_END
|
|
|
86f512 |
};
|
|
|
86f512 |
|
|
|
86f512 |
Index: strace-5.1/xlat/v4l2_framesize_types.h
|
|
|
86f512 |
===================================================================
|
|
|
86f512 |
--- strace-5.1.orig/xlat/v4l2_framesize_types.h 2019-05-22 15:08:31.000000000 +0200
|
|
|
86f512 |
+++ strace-5.1/xlat/v4l2_framesize_types.h 2020-01-29 21:12:03.681075121 +0100
|
|
|
86f512 |
@@ -3,6 +3,27 @@
|
|
|
86f512 |
#include "gcc_compat.h"
|
|
|
86f512 |
#include "static_assert.h"
|
|
|
86f512 |
|
|
|
86f512 |
+#if defined(V4L2_FRMSIZE_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMSIZE_TYPE_DISCRETE) == (1), "V4L2_FRMSIZE_TYPE_DISCRETE != 1");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMSIZE_TYPE_DISCRETE 1
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
+#if defined(V4L2_FRMSIZE_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMSIZE_TYPE_CONTINUOUS) == (2), "V4L2_FRMSIZE_TYPE_CONTINUOUS != 2");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMSIZE_TYPE_CONTINUOUS 2
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
+#if defined(V4L2_FRMSIZE_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE)
|
|
|
86f512 |
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+static_assert((V4L2_FRMSIZE_TYPE_STEPWISE) == (3), "V4L2_FRMSIZE_TYPE_STEPWISE != 3");
|
|
|
86f512 |
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
|
|
|
86f512 |
+#else
|
|
|
86f512 |
+# define V4L2_FRMSIZE_TYPE_STEPWISE 3
|
|
|
86f512 |
+#endif
|
|
|
86f512 |
|
|
|
86f512 |
#ifndef XLAT_MACROS_ONLY
|
|
|
86f512 |
|
|
|
86f512 |
@@ -16,15 +37,9 @@
|
|
|
86f512 |
static
|
|
|
86f512 |
# endif
|
|
|
86f512 |
const struct xlat v4l2_framesize_types[] = {
|
|
|
86f512 |
-#if defined(V4L2_FRMSIZE_TYPE_DISCRETE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_DISCRETE)
|
|
|
86f512 |
- XLAT(V4L2_FRMSIZE_TYPE_DISCRETE),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
-#if defined(V4L2_FRMSIZE_TYPE_CONTINUOUS) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS) && HAVE_DECL_V4L2_FRMSIZE_TYPE_CONTINUOUS)
|
|
|
86f512 |
- XLAT(V4L2_FRMSIZE_TYPE_CONTINUOUS),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
-#if defined(V4L2_FRMSIZE_TYPE_STEPWISE) || (defined(HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE) && HAVE_DECL_V4L2_FRMSIZE_TYPE_STEPWISE)
|
|
|
86f512 |
- XLAT(V4L2_FRMSIZE_TYPE_STEPWISE),
|
|
|
86f512 |
-#endif
|
|
|
86f512 |
+ XLAT(V4L2_FRMSIZE_TYPE_DISCRETE),
|
|
|
86f512 |
+ XLAT(V4L2_FRMSIZE_TYPE_CONTINUOUS),
|
|
|
86f512 |
+ XLAT(V4L2_FRMSIZE_TYPE_STEPWISE),
|
|
|
86f512 |
XLAT_END
|
|
|
86f512 |
};
|
|
|
86f512 |
|