v4l2-utils: Fix incorrect use of fd in streaming_set_cap2out
PATCH 1/1 v4l2-utils: Fix incorrect use of fd in streaming_set_cap2out
Running the "Stream video from a capture video device (/dev/video1) to an output video device (/dev/video2)" example from the manpage with vivid as the output device failed with a error message.
vedant@pc ~$ v4l2-ctl --list-devices
vivid (platform:vivid-000):
/dev/video2
/dev/video3
/dev/radio0
/dev/radio1
/dev/vbi0
/dev/vbi1
/dev/swradio0
/dev/media1HD WebCam: HD WebCam (usb-0000:00:14.0-7):
/dev/video0
/dev/video1
/dev/media0vedant@pc ~$ v4l2-ctl -d0 --stream-mmap --out-device /dev/video3 --stream-out-dmabuf
VIDIOC_G_FMT returned -1 (Invalid argument)
<VIDIOC_QBUF: failed: Invalid argument
handle out -1
handle out2in -1
While using the --out-device mode g_fmt must be operated on out_fd as well. determine_field was called on fps_timestamp object for output, but was not passed out_fd.
This patch fixes the VIDIOC_G_FMT returned -1 (Invalid argument) error.
--- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
utils/v4l2-ctl/v4l2-ctl-streaming.cpp +2 -2
@@ -2666,7 +2666,7 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd) unsigned cnt = 0; cv4l_fmt fmt[2]; - fd.g_fmt(fmt[OUT], out.g_type()); + out_fd.g_fmt(fmt[OUT], out.g_type()); fd.g_fmt(fmt[CAP], in.g_type()); if (!(capabilities & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE |
@@ -2757,7 +2757,7 @@ 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(fd.g_fd(), out.g_type()); + fps_ts[OUT].determine_field(out_fd.g_fd(), out.g_type()); if (fd.streamon() || out_fd.streamon()) goto done;
Signature · 1 line
2.25.1
Hi Vedant,
Thank you for the patch.
Quoted 26 lines · Vedant Paranjape
Running the "Stream video from a capture video device (
/dev/video1) to an output video device (/dev/video2)" example from the manpage with vivid as the output device failed with a error message.vedant@pc ~$ v4l2-ctl --list-devices
vivid (platform:vivid-000):/dev/video2 /dev/video3 /dev/radio0 /dev/radio1 /dev/vbi0 /dev/vbi1 /dev/swradio0 /dev/media1HD WebCam: HD WebCam (usb-0000:00:14.0-7):
/dev/video0 /dev/video1 /dev/media0vedant@pc ~$ v4l2-ctl -d0 --stream-mmap --out-device
/dev/video3--stream-out-dmabuf
VIDIOC_G_FMTreturned -1 (Invalid argument)
<VIDIOC_QBUF: failed: Invalid argument
handle out -1
handle out2in -1
Quoted 7 lines
While using the --out-device mode
g_fmtmust be operated onout_fdas well.determine_fieldwas called onfps_timestampobject for output, but was not passedout_fd.This patch fixes the
VIDIOC_G_FMTreturned -1 (Invalid argument) error.Signed-off-by Vedant Paranjape <[email protected]>
Quoted 26 lines
--- utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)utils/v4l2-ctl/v4l2-ctl-streaming.cpp +2
-2@@ -2666,7 +2666,7 @@ static void streaming_set_cap2out(cv4l_fd &fd, cv4l_fd &out_fd) unsigned cnt = 0; cv4l_fmt fmt[2]; - fd.g_fmt(fmt[OUT], out.g_type()); + out_fd.g_fmt(fmt[OUT], out.g_type()); fd.g_fmt(fmt[CAP], in.g_type()); if (!(capabilities & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE |@@ -2757,7 +2757,7 @@ 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(fd.g_fd(), out.g_type()); + fps_ts[OUT].determine_field(out_fd.g_fd(), out.g_type()); if (fd.streamon() || out_fd.streamon()) goto done;
Signature · 3 lines
Regards, Laurent Pinchart