[FFmpeg-devel] [PATCH] V4L2 compliance: Make sure VIDIOC_S_INPUT is called before querying/setting any input properties

Rupert Eibauer Rupert.Eibauer at ces.ch
Thu Jan 12 15:42:40 CET 2012


Luca Abeni <lucabe72 at email.it> wrote on 01/12/2012 03:34:25 PM:
> On 01/11/2012 10:28 PM, Michael Niedermayer wrote:
> > On Wed, Jan 11, 2012 at 09:46:57PM +0100, Rupert Eibauer wrote:
> >> Michael Niedermayer<michaelni at gmx.at>  wrote on 01/11/2012 09:23:45 
PM:
> >>>
> >>> On Wed, Jan 11, 2012 at 08:01:25PM +0100, Rupert Eibauer wrote:
> >>>> Hello,
> >>>>
> >>>> This solves a problem with a V4L device which supports different
> >> inputs.
> >>>> The problem is that the different inputs have different 
resolutions,
> >> and
> >>>> the device cannot do image scaling.
> >>>> This is what happened:
> >>>> - ffmpeg calls VIDIOC_S_FMT with the resolution we specified on the
> >>>> command line.
> >>>> - The driver responds with a resolution which is correct for the
> >> default
> >>>> input.
> >>>> - ffmpeg calls VIDIOC_S_INPUT, and the driver switches to the
> >> resolution
> >>>> supported by that input.
> >>>> - Now we have a problem: ffmpegs idea about the image resolution is
> >> wrong.
> >>>>
> >>>>
> >>>> The patch below fixes that problem. Please apply it.
> >>>
> >>> The patch looks like its linebreaks where messed up
> >>
> >> Sorry, automatic line wrapping. I hope it works better this time (or 
the
> >> attachment).
> >
> > the attachment is ok wraping wise, luca, please review if you have 
time
> At a first glance, it looks ok... But I am pretty sure that the code 
worked
> fine last time I used it (1 year ago, I think).
> So, I need to check what happened, and why this change is needed now (or
> maybe I am simply misremembering something... :).

The problem will not be visible on single-input devices. In fact, you will 
only see
it when you have a device with multiple inputs and the inputs differ in 
the set
of allowed parameters for VIDIOC_S_FMT.
Please also refer to 
http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/43286
and
http://article.gmane.org/gmane.linux.drivers.video-input-infrastructure/43288

Best regards,
Rupert

> I'll have a look at the git history, and send a reply tomorrow.
> 
> 
>          Luca



More information about the ffmpeg-devel mailing list