commit 84219e2b5d013709ee5259621715966c46eec746 Author: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> Date: Sat Mar 30 14:16:25 2019 +0100 v4l2-ctl: get fmt after source change When a source change event arrives during decoding get the new format at that point instead of after restarting streaming. If there is another source change queued up, then when you call streamon for CAPTURE again it might send the new source change event and update the format for that one, so reading the format after streamon might give the wrong format. Signed-off-by: Hans Verkuil <hverkuil-cisco@xxxxxxxxx> diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index bb656584..3695a027 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -2363,12 +2363,11 @@ static void stateful_m2m(cv4l_fd &fd, cv4l_queue &in, cv4l_queue &out, if (in_source_change_event) { in_source_change_event = false; last_buffer = false; + fd.g_fmt(fmt_in, in.g_type()); if (capture_setup(fd, in, exp_fd_p)) return; fps_ts[CAP].reset(); fps_ts[OUT].reset(); - fd.g_fmt(fmt_out, out.g_type()); - fd.g_fmt(fmt_in, in.g_type()); Removing those lines cause inconsistency when the user send the wanted capture pixel format when decoding with the `v4l2-ctl` command. In this case the value of `-v pixelformat=...` is updated in the kernel with the capture_setup function but it is not updated in the fmt_in variable and so the command will try to save the decoded video in a different format from what is configured in the kernel. cap_streaming = true; } else { break; Dafna