This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: qvidcap: add --no-loop option Author: Hans Verkuil <hverk...@xs4all.nl> Date: Thu Jan 30 08:57:32 2025 +0100 By default, when reading from a file, qvidcap will loop when the end of the file is reached. This option prevents that, and instead it will sleep indefinitely. Signed-off-by: Hans Verkuil <hverk...@xs4all.nl> utils/qvidcap/capture.cpp | 13 ++++++++++++- utils/qvidcap/capture.h | 2 ++ utils/qvidcap/qvidcap.cpp | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c059b43aef982b03a7a3195b60f58b064c80f8be diff --git a/utils/qvidcap/capture.cpp b/utils/qvidcap/capture.cpp index e3c081c9a409..85973418c95a 100644 --- a/utils/qvidcap/capture.cpp +++ b/utils/qvidcap/capture.cpp @@ -217,6 +217,8 @@ CaptureWin::CaptureWin(QScrollArea *sa, QWidget *parent) : m_sock(0), m_v4l_queue(0), m_frame(0), + m_verbose(false), + m_no_loop(false), m_ctx(0), m_origPixelFormat(0), m_fps(0), @@ -1472,8 +1474,17 @@ void CaptureWin::tpgUpdateFrame() return; m_singleStepNext = false; - if (m_mode == AppModeFile && m_file.pos() + m_imageSize > m_file.size()) + if (m_mode == AppModeFile && m_file.pos() + m_imageSize > m_file.size()) { + if (m_no_loop) { + printf("done\n"); + while (true) + sleep(1000); + exit(0); + } + if (m_verbose) + printf("loop\n"); m_file.seek(0); + } if (m_mode != AppModeFile && is_alt) { if (m_tpg.field == V4L2_FIELD_TOP) diff --git a/utils/qvidcap/capture.h b/utils/qvidcap/capture.h index 8ebe76a9d0d3..cf3380463fdd 100644 --- a/utils/qvidcap/capture.h +++ b/utils/qvidcap/capture.h @@ -90,6 +90,7 @@ public: void setCount(unsigned cnt) { m_cnt = cnt; } void setReportTimings(bool report) { m_reportTimings = report; } void setVerbose(bool verbose) { m_verbose = verbose; } + void setNoLoop(bool no_loop) { m_no_loop = no_loop; } void setOverridePixelFormat(__u32 fmt) { m_overridePixelFormat = fmt; } void setOverrideField(__u32 field) { m_overrideField = field; } void setOverrideColorspace(__u32 colsp) { m_overrideColorspace = colsp; } @@ -180,6 +181,7 @@ private: TestState m_testState; unsigned m_imageSize; bool m_verbose; + bool m_no_loop; bool m_reportTimings; bool m_is_sdtv; v4l2_std_id m_std; diff --git a/utils/qvidcap/qvidcap.cpp b/utils/qvidcap/qvidcap.cpp index f9d7a4187862..f81b376e9335 100644 --- a/utils/qvidcap/qvidcap.cpp +++ b/utils/qvidcap/qvidcap.cpp @@ -64,6 +64,7 @@ static void usage() " -t, --timings report frame render timings\n" " -v, --verbose be more verbose\n" " -R, --raw open device in raw mode\n" + " --no-loop stop at the end of the file, don't loop back to the beginning\n" "\n" " --opengl force openGL to display the video\n" " --opengles force openGL ES to display the video\n" @@ -445,6 +446,7 @@ int main(int argc, char **argv) bool info_option = false; bool report_timings = false; bool verbose = false; + bool no_loop = false; __u32 overridePixelFormat = 0; __u32 overrideWidth = 0; __u32 overrideHeight = 0; @@ -648,6 +650,8 @@ int main(int argc, char **argv) force_opengl = true; } else if (isOption(args[i], "--verbose", "-v")) { verbose = true; + } else if (isOption(args[i], "--no-loop")) { + no_loop = true; } else if (isOption(args[i], "--raw", "-R")) { fd.s_direct(true); } else if (isOptArg(args[i], "--count", "-c")) { @@ -744,6 +748,7 @@ int main(int argc, char **argv) QSurfaceFormat::setDefaultFormat(format); CaptureWin win(sa); win.setVerbose(verbose); + win.setNoLoop(no_loop); if (mode == AppModeFile) { win.setModeFile(filename); if (single_step_start)