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: v4l2-ctl: if --stream-sleep count=0, then honor sleep mode
Author:  Hans Verkuil <[email protected]>
Date:    Wed May 20 12:14:53 2026 +0200

If you want to sleep before the first frame arrives, then
you set count to 0 as --stream-sleep argument.

But you also want to decide if you sleep before or after
the initial STREAMON. Use the --stream-sleep mode option for that.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=08790f6ef4d10b492569a33c58524d6ec5e4ba42
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp 
b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index ec85e41e9e12..517fc7f209f5 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -303,7 +303,8 @@ void streaming_usage()
               "                     skip the first <count> buffers. The 
default is 0.\n"
               "  --stream-sleep count=<c>,sleep=<ms>,mode=<mode>\n"
               "                     Sleep for <ms> milliseconds (default=1000) 
after <c> buffers.\n"
-              "                     If <c> is 0, then only sleep right after 
streaming starts.\n"
+              "                     If <c> is 0, then only sleep right before 
(mode >= 2) or\n"
+              "                     after (mode < 2) streaming starts.\n"
               "                     If <ms> is 0, then sleep forever (modes 0 
and 1) or not at all\n"
               "                     (for modes 2 and 3), if <ms> is positive, 
then sleep for <ms>\n"
               "                     milliseconds, if <ms> is negative, then 
sleep for a random\n"
@@ -1936,13 +1937,16 @@ restart:
 
        fps_ts.determine_field(fd.g_fd(), q.g_type());
 
+       if (stream_sleep_count == 0 && (stream_sleep_mode & 2))
+               do_sleep();
+
        if (fd.streamon())
                goto done;
 
        fd.s_trace(0);
        exp_fd.s_trace(0);
 
-       if (stream_sleep_count == 0)
+       if (stream_sleep_count == 0 && !(stream_sleep_mode & 2))
                do_sleep();
 
        if (use_poll)
@@ -2220,13 +2224,16 @@ restart:
 
        fps_ts.determine_field(fd.g_fd(), type);
 
+       if (stream_sleep_count == 0 && (stream_sleep_mode & 2))
+               do_sleep();
+
        if (fd.streamon())
                goto done;
 
        fd.s_trace(0);
        exp_fd.s_trace(0);
 
-       if (stream_sleep_count == 0)
+       if (stream_sleep_count == 0 && !(stream_sleep_mode & 2))
                do_sleep();
 
        if (use_poll)
@@ -2394,6 +2401,9 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, 
cv4l_queue &out,
                return;
        }
 
+       if (stream_sleep_count == 0 && (stream_sleep_mode & 2))
+               do_sleep();
+
        if (fd.streamon(out.g_type()))
                return;
 
@@ -2408,7 +2418,7 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, 
cv4l_queue &out,
        fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
        fps_ts[OUT].determine_field(fd.g_fd(), out.g_type());
 
-       if (stream_sleep_count == 0)
+       if (stream_sleep_count == 0 && !(stream_sleep_mode & 2))
                do_sleep();
 
        fcntl(fd.g_fd(), F_SETFL, fd_flags | O_NONBLOCK);
@@ -2875,13 +2885,16 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd 
&out_fd)
        fps_ts[CAP].determine_field(fd.g_fd(), in.g_type());
        fps_ts[OUT].determine_field(out_fd.g_fd(), out.g_type());
 
+       if (stream_sleep_count == 0 && (stream_sleep_mode & 2))
+               do_sleep();
+
        if (fd.streamon() || out_fd.streamon())
                goto done;
 
        fd.s_trace(0);
        out_fd.s_trace(0);
 
-       if (stream_sleep_count == 0)
+       if (stream_sleep_count == 0 && !(stream_sleep_mode & 2))
                do_sleep();
 
        if (use_poll)
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to