backport v4l2-ctl-streaming: fix type of a time_t value

This commit is contained in:
liyuan 2023-12-22 03:33:29 +08:00
parent b2a1e9e99e
commit 965e3ab23f
2 changed files with 71 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From 6867620ef625bdbce43eb3d44404ce8fb37960d6 Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date: Wed, 10 Jan 2018 09:10:47 -0200
Subject: [PATCH] v4l2-ctl-streaming: fix type of a time_t value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As warned by gcc, when compiling on arm 32 bits:
v4l2-ctl-streaming.cpp: In function int do_handle_cap(int, buffers&, FILE*, int*, unsigned int&, timespec&):
v4l2-ctl-streaming.cpp:1059:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (res.tv_sec > last_sec) {
^
v4l2-ctl-streaming.cpp: In function int do_handle_out(int, buffers&, FILE*, v4l2_buffer*, unsigned int&, timespec&):
v4l2-ctl-streaming.cpp:1193:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (res.tv_sec > last_sec) {
qv4l2.cpp: In member function void ApplicationWindow::calculateFps():
qv4l2.cpp:692:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (res.tv_sec > last_sec) {
^
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
utils/qv4l2/qv4l2.cpp | 2 +-
utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 00e78cd3..929b795b 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -674,7 +674,7 @@ error:
void ApplicationWindow::calculateFps()
{
- static unsigned last_sec;
+ static time_t last_sec;
if (m_frame == 0) {
clock_gettime(CLOCK_MONOTONIC, &m_startTimestamp);
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 352e58cf..89ff2ad3 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -941,7 +941,7 @@ static int do_handle_cap(int fd, buffers &b, FILE *fout, int *index,
struct v4l2_plane planes[VIDEO_MAX_PLANES];
struct v4l2_buffer buf;
bool ignore_count_skip = false;
- static unsigned last_sec;
+ static time_t last_sec;
memset(&buf, 0, sizeof(buf));
memset(planes, 0, sizeof(planes));
@@ -1090,7 +1090,7 @@ static int do_handle_cap(int fd, buffers &b, FILE *fout, int *index,
static int do_handle_out(int fd, buffers &b, FILE *fin, struct v4l2_buffer *cap,
unsigned &count, struct timespec &ts_last)
{
- static unsigned last_sec;
+ static time_t last_sec;
struct v4l2_plane planes[VIDEO_MAX_PLANES];
struct v4l2_buffer buf;
int ret;
--
2.33.0

View File

@ -1,11 +1,12 @@
Name: v4l-utils
Version: 1.14.2
Release: 5
Release: 6
Summary: Linux utilities and libraries to handle media devices
License: GPLv2+ and GPLv2
URL: http://www.linuxtv.org/downloads/v4l-utils/
Source0: http://linuxtv.org/downloads/v4l-utils/v4l-utils-%{version}.tar.bz2
Patch0000: v4l-utils-sysmacros.patch
Patch0001: 0001-v4l2-ctl-streaming-fix-type-of-a-time_t-value.patch
BuildRequires: alsa-lib-devel desktop-file-utils doxygen gettext
BuildRequires: kernel-headers libjpeg-devel qt5-qtbase-devel systemd-devel
Requires: udev
@ -155,6 +156,9 @@ mv lib/libdvbv5/README lib/libdvbv5/README.libdvbv5
%{_mandir}/man3/*.3*
%changelog
* Thu Dec 28 2023 liyuanyuan <liyuanyuan@xfusion.com> - 1.14.2-6
- v4l2-ctl-streaming: fix type of a time_t value
* Wed Nov 13 2019 caomeng <caomeng5@huawei.com> - 1.14.2-5
- let libv4l1.so.0 in libv4l