Re: [PATCH v3 2/4] media-ctl: print the configured frame interval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2017-02-13 at 12:40 +0100, Philipp Zabel wrote:
> After the pad format, also print the frame interval, if already configured.
> 
> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> Acked-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>
> ---
>  utils/media-ctl/media-ctl.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
> index 572bcf7..383fbfa 100644
> --- a/utils/media-ctl/media-ctl.c
> +++ b/utils/media-ctl/media-ctl.c
> @@ -79,6 +79,7 @@ static void v4l2_subdev_print_format(struct media_entity *entity,
>  	unsigned int pad, enum v4l2_subdev_format_whence which)
>  {
>  	struct v4l2_mbus_framefmt format;
> +	struct v4l2_fract interval = { 0, 0 };
>  	struct v4l2_rect rect;
>  	int ret;
>  
> @@ -86,10 +87,17 @@ static void v4l2_subdev_print_format(struct media_entity *entity,
>  	if (ret != 0)
>  		return;
>  
> +	ret = v4l2_subdev_get_frame_interval(entity, &interval, pad);
> +	if (ret != 0 && ret != -ENOTTY)

I noticed the documentation says in 8.60.5. Return Value [1]:

  EINVAL
    The struct v4l2_subdev_frame_interval pad references a non-existing
    pad, or the pad doesn’t support frame intervals.

even though VIDIOC_SUBDEV_G_FRAME_INTERVAL returns ENOTTY (by way of
ENOIOCTLCMD) if .g_frame_interval in the video ops is not implemented.
Is this an error in the spec, an error in the code, or just me
misunderstanding?

Should this line be changed to
	if (ret != 0 && ret != -ENOTTY && ret != -EINVAL)
?

[1] https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/vidioc-subdev-g-frame-interval.html#return-value

> +		return;
> +
>  	printf("\t\t[fmt:%s/%ux%u",
>  	       v4l2_subdev_pixelcode_to_string(format.code),
>  	       format.width, format.height);
>  
> +	if (interval.numerator || interval.denominator)
> +		printf("@%u/%u", interval.numerator, interval.denominator);
> +
>  	if (format.field)
>  		printf(" field:%s", v4l2_subdev_field_to_string(format.field));
>  

regards
Philipp




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux