Re: [RFC PATCH] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMT

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

 



Hi Hans,

Am Freitag, den 20.03.2015, 13:17 +0100 schrieb Hans Verkuil:
> The descriptions used in drivers for the formats returned with ENUM_FMT
> are all over the place.
> 
> So instead allow the core to fill in the description and flags. This
> allows drivers to drop the description and flags.
> 
> If the format is not found in the list, and if the description field is
> filled in, then just return but call WARN_ONCE to let developers know
> that this list needs to be extended.
> 
> Based on an earlier patch from Philipp Zabel:
> http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/81411
> 
> But this patch moves the code into the core and away from drivers.

I like it. There's one small error in the NV42 description below,
otherwise
Acked-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>

> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> Cc: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
>
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c | 222 +++++++++++++++++++++++++++++++++--
>  1 file changed, 215 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 09ad8dd..694d1e0 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1101,6 +1101,205 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,
>  	return ops->vidioc_enum_output(file, fh, p);
>  }
>  
> +static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> +{
> +	const unsigned sz = sizeof(fmt->description);
> +	const char *descr = NULL;
> +
> +	switch (fmt->pixelformat) {
> +	/* Max description length mask:	descr = "0123456789012345678901234567890" */
> +	case V4L2_PIX_FMT_RGB332:	descr = "8-bit RGB 3-3-2"; break;
[...]
> +	case V4L2_PIX_FMT_NV12:		descr = "Y/CbCr 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV21:		descr = "Y/CrCb 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV16:		descr = "Y/CbCr 4:2:2"; break;
> +	case V4L2_PIX_FMT_NV61:		descr = "Y/CrCb 4:2:0"; break;
> +	case V4L2_PIX_FMT_NV24:		descr = "Y/CbCr 4:4:4"; break;
> +	case V4L2_PIX_FMT_NV42:		descr = "Y/CrCb 4:2:0"; break;

That should be 4:4:4 for NV42.

regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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