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: 'Space' will pause, 'Backspace' will go back one frame
Author:  Hans Verkuil <hverk...@xs4all.nl>
Date:    Fri Feb 7 09:56:54 2025 +0100

When not in single step mode, and reading from a file, 'Space' will
pause playback until the next 'Space'.

When in single step mode, 'Backspace' will go back one frame.

Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>

 utils/qvidcap/capture.cpp  | 22 ++++++++++++++++++++++
 utils/qvidcap/capture.h    |  1 +
 utils/qvidcap/qvidcap.1.in |  6 +++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=77f5df419204d17e025a188676eafef185c603cb
diff --git a/utils/qvidcap/capture.cpp b/utils/qvidcap/capture.cpp
index 1d51555d5ef3..6b41933eb785 100644
--- a/utils/qvidcap/capture.cpp
+++ b/utils/qvidcap/capture.cpp
@@ -219,6 +219,7 @@ CaptureWin::CaptureWin(QScrollArea *sa, QWidget *parent) :
        m_frame(0),
        m_verbose(false),
        m_no_loop(false),
+       m_pause(false),
        m_fromFrame(0),
        m_ctx(0),
        m_origPixelFormat(0),
@@ -591,6 +592,18 @@ void CaptureWin::keyPressEvent(QKeyEvent *event)
                        m_cnt = 1;
                else if (m_singleStep && m_frame > m_singleStepStart)
                        m_singleStepNext = true;
+               else if (!m_singleStep && m_mode == AppModeFile)
+                       m_pause = !m_pause;
+               return;
+       case Qt::Key_Backspace:
+               if (m_mode == AppModeFile &&
+                   m_singleStep && m_frame > m_singleStepStart) {
+                       if (m_file.pos() >= m_imageSize * 2) {
+                               m_file.seek(m_file.pos() - m_imageSize * 2);
+                               m_frame -= 2;
+                               m_singleStepNext = true;
+                       }
+               }
                return;
        case Qt::Key_Escape:
                if (!m_scrollArea->isFullScreen())
@@ -1124,6 +1137,9 @@ void CaptureWin::v4l2ReadEvent()
 {
        cv4l_buffer buf(m_fd->g_type());
 
+       if (m_pause)
+               return;
+
        if (m_singleStep && m_frame > m_singleStepStart && !m_singleStepNext)
                return;
 
@@ -1225,6 +1241,9 @@ void CaptureWin::sockReadEvent()
 {
        int n;
 
+       if (m_pause)
+               return;
+
        if (m_singleStep && m_frame > m_singleStepStart && !m_singleStepNext)
                return;
        m_singleStepNext = false;
@@ -1475,6 +1494,9 @@ void CaptureWin::tpgUpdateFrame()
 {
        bool is_alt = m_v4l_fmt.g_field() == V4L2_FIELD_ALTERNATE;
 
+       if (m_mode != AppModeTest && m_pause)
+               return;
+
        if (m_mode != AppModeTest && m_singleStep && m_frame > 
m_singleStepStart &&
            !m_singleStepNext)
                return;
diff --git a/utils/qvidcap/capture.h b/utils/qvidcap/capture.h
index 19320d06b2da..6e23a3ca9491 100644
--- a/utils/qvidcap/capture.h
+++ b/utils/qvidcap/capture.h
@@ -183,6 +183,7 @@ private:
        unsigned m_imageSize;
        bool m_verbose;
        bool m_no_loop;
+       bool m_pause;
        unsigned m_fromFrame;
        bool m_reportTimings;
        bool m_is_sdtv;
diff --git a/utils/qvidcap/qvidcap.1.in b/utils/qvidcap/qvidcap.1.in
index 20047b972519..e3e09b9caf80 100644
--- a/utils/qvidcap/qvidcap.1.in
+++ b/utils/qvidcap/qvidcap.1.in
@@ -216,7 +216,11 @@ Exit fullscreen.
 .TP
 \fISpace\fR
 When in test mode (\fB\-\-test\fR) pressing Space will skip to the next test.
-When single-stepping, continue to the next frame.
+When single-stepping, continue to the next frame. When reading from a file,
+pause playback until the next press of Space.
+.TP
+\fIBackspace\fR
+When single-stepping, go back to the previous frame.
 .TP
 \fIUp\fR
 Reduce the resolution by two pixels in height. Only available when "Override 
resolution" is enabled.

Reply via email to