[FFmpeg-devel] [PATCH] v4l2: Old or cheap cams will _not_ accept parms query or modification. ioctl(VIDIOC_G_PARM) or ioctl(VIDIOC_S_PARM)

Lucas F. Ottaviano lucks.ph at gmail.com
Thu Feb 23 01:51:35 CET 2012


Hello! I think you should not ignore this, if you want ffmpeg to be as
universally accessible as possible...
It's a shame that because of this simplicity some users will not be able to
use ffmpeg or ffplay.

+ Some old or cheap cams will _not_ accept to set or get paramaters,
   so returning an error when this is not possible is not good.

2012/2/13 Lucas F. Ottaviano <lucks.ph at gmail.com>

> From: "Lucas F. Ottaviano" <lucks.ph at gmail.com>
>
> Signed-off-by: Lucas F. Ottaviano <lucks.ph at gmail.com>
> ---
>  libavdevice/v4l2.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
> index 642df1d..e39565e 100644
> --- a/libavdevice/v4l2.c
> +++ b/libavdevice/v4l2.c
> @@ -627,10 +627,9 @@ static int v4l2_set_parameters(AVFormatContext *s1)
>         tpf->denominator = framerate_q.num;
>
>         if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) != 0) {
> -            av_log(s1, AV_LOG_ERROR,
> +            av_log(s1, AV_LOG_WARNING,
>                    "ioctl set time per frame(%d/%d) failed\n",
>                    framerate_q.den, framerate_q.num);
> -            return AVERROR(EIO);
>         }
>
>         if (framerate_q.num != tpf->denominator ||
> @@ -643,9 +642,8 @@ static int v4l2_set_parameters(AVFormatContext *s1)
>         }
>     } else {
>         if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) != 0) {
> -            av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n",
> +            av_log(s1, AV_LOG_WARNING, "ioctl(VIDIOC_G_PARM): %s\n",
>                    strerror(errno));
> -            return AVERROR(errno);
>         }
>     }
>     s1->streams[0]->codec->time_base.den = tpf->denominator;
> --
> 1.7.8.4
>
>


-- 
Lucas F. Ottaviano.


More information about the ffmpeg-devel mailing list