All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Vedant Paranjape <vedantparanjape160201@gmail.com>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: Re: [PATCH v1] v4l2-utils: Fix incorrect use of fd in streaming_set_cap2out
Date: Tue, 4 Jan 2022 22:08:01 +0200	[thread overview]
Message-ID: <YdSpIbsX3S9ArD9R@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220104130708.166638-1-vedantparanjape160201@gmail.com>

Hi Vedant,

Thank you for the patch.

On Tue, Jan 04, 2022 at 06:37:08PM +0530, Vedant Paranjape wrote:
> 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/media1
> 
> HD WebCam: HD WebCam (usb-0000:00:14.0-7):
>         /dev/video0
>         /dev/video1
>         /dev/media0
> 
> vedant@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.
> 
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> index 752ea140..7f6482d6 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> @@ -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;

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2022-01-04 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 13:07 [PATCH v1] v4l2-utils: Fix incorrect use of fd in streaming_set_cap2out Vedant Paranjape
2022-01-04 20:08 ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YdSpIbsX3S9ArD9R@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=vedantparanjape160201@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.