[FFmpeg-devel] [PATCH] lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns ENODATA

Michael Niedermayer michaelni at gmx.at
Mon Aug 18 04:29:09 CEST 2014


On Mon, Aug 18, 2014 at 10:18:35AM +0800, Andre Wolokita wrote:
> As of September 14 2012, v4l_enumstd() will return ENODATA
> when a device's std field is set to 0. That is, the device
> does not have a standard format. In order to properly
> handle this case, v4l2_set_parameters should catch the
> ENODATA code and break instead of failing.
> 
> Below is the v4l2-core commit describing this change.
> 
> >>commit a5338190efc7cfa8c99a6856342a77d21c9a05cf
> >>Author: Hans Verkuil <hans.verkuil at cisco.com>
> >>Date:   Fri Sep 14 06:45:43 2012 -0300
> >>
> >>    [media] v4l2-core: tvnorms may be 0 for a given input, handle
> that case
> >>
> >>    Currently the core code looks at tvnorms to see whether ENUMSTD
> >>    or G_PARM should be enabled. This is not a good check for drivers
> >>    that support the STD API on one input and the DV Timings API
> on another.
> >>    In that case tvnorms may be 0.
> >>    Instead check whether s_std is present (for ENUMSTD) or
> whether g_std or
> >>    current_norm is present for g_parm.
> >>    Also, in the enumstd core function return ENODATA if tvnorms is 0,
> >>    because in that case the current input does not support the STD API
> >>    and ENUMSTD should return ENODATA for that.
> >>
> >>    Signed-off-by: Hans Verkuil <hans.verkuil at cisco.com>
> >>    Reviewed-by: Sakari Ailus <sakari.ailus at iki.fi>
> >>    Signed-off-by: Mauro Carvalho Chehab <mchehab at redhat.com>
> 
> Signed-off-by: Andre Wolokita <andre.wolokita at analog.com
> ---
>  libavdevice/v4l2.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index 64df0c7..fc87d6c 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -688,7 +688,7 @@ static int v4l2_set_parameters(AVFormatContext *s1)
>              standard.index = i;
>              if (v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
>                  ret = AVERROR(errno);
> -                if (ret == AVERROR(EINVAL)) {
> +                if (ret == AVERROR(EINVAL) || ret == AVERROR(ENODATA) {

the () dont match, this will not compile

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140818/bf6edcad/attachment.asc>


More information about the ffmpeg-devel mailing list