Re: [PATCH] v4l2-ctl: add is_compressed_format() helper

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

 



On Thu April 11 2013 18:54:07 Tzu-Jung Lee wrote:
> It is used to:
> 
>   bypass precalculate_bars() for OUTPUT device
>   that takes encoded bitstreams.
> 
>   handle the last chunk of input file that has
>   non-buffer-aligned size.
> 
> Signed-off-by: Tzu-Jung Lee <tjlee@xxxxxxxxxxxxx>
> ---
>  utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 101 +++++++++++++++++++++++++++-------
>  1 file changed, 82 insertions(+), 19 deletions(-)
> 
> diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> index 9e361af..2bcf950 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
> @@ -115,6 +115,29 @@ static const flag_def tc_flags_def[] = {
>  	{ 0, NULL }
>  };
>  
> +static bool is_compressed_format(__u32 pixfmt)
> +{
> +	switch (pixfmt) {
> +	case V4L2_PIX_FMT_MJPEG:
> +	case V4L2_PIX_FMT_JPEG:
> +	case V4L2_PIX_FMT_DV:
> +	case V4L2_PIX_FMT_MPEG:
> +	case V4L2_PIX_FMT_H264:
> +	case V4L2_PIX_FMT_H264_NO_SC:
> +	case V4L2_PIX_FMT_H263:
> +	case V4L2_PIX_FMT_MPEG1:
> +	case V4L2_PIX_FMT_MPEG2:
> +	case V4L2_PIX_FMT_MPEG4:
> +	case V4L2_PIX_FMT_XVID:
> +	case V4L2_PIX_FMT_VC1_ANNEX_G:

You should use VIDIOC_ENUM_FMT: that sets a 'COMPRESSED' flag for compressed
formats. You can never keep a list like the above up to date, so using ENUM_FMT
is a much more generic solution.

I will review the rest of the code tomorrow, but this jumped out to me, and
you probably didn't know this flag existed :-)

Regards,

	Hans
--
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