[FFmpeg-devel] [PATCH 6/6] Implement v4l2 input size autodetection.

Luca Abeni lucabe72
Sun Apr 25 11:30:34 CEST 2010


On Sat, 2010-04-24 at 20:53 +0200, Stefano Sabatini wrote:
> Move checks on size after the device is opened, and perform a
> VIDIOC_G_FMT ioctl() on the device if WxH is set to 0x0.
> ---
>  libavdevice/v4l2.c |   30 +++++++++++++++++++-----------

> +    if (!ap->width && !ap->height) {

This should be "||"

> +        struct v4l2_format fmt;
> +
> +        av_log(s1, AV_LOG_INFO, "Size value unspecified, querying the device\n");

This message is confusing (it does not specify what the device is being
queried for: a supported video size? The latest used video size?).
What the code really does is to use the current device's settings (if a
generic frame size supported by the device is enough, this whole part of
code can be removed, because device_init() can take care of getting a
supported frame size).

BTW, since you are changing this code, I am wondering if
avcodec_check_dimensions() should be moved after device_try_init().


More information about the ffmpeg-devel mailing list