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

Michael Niedermayer michaelni at gmx.at
Wed Jan 11 22:28:19 CET 2012


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


> 
> > > It is for 0.8.9, because this is the version I am currently using. 
> 0.9.1 
> > > and git do not compile because of some asm errors.
> > 
> > please report the asm issue, so it can be fixed
> 
> Are you sure you want to care about this? If it happened with recent 
> versions of yasm,
> somebody else would have noticed. I am using SLES 11.

well, configure should exit with a human readable error at the least
just failing compilation is definitly a bug.

[...]

>  v4l2.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 076b6363cff678fb9cd6f5e888d7c7510fd1234c  ffmpeg-v4l2-compliance.diff
> --- ffmpeg-0.8.9.orig/libavdevice/v4l2.c	2011-12-25 22:18:30.000000000 +0100
> +++ ffmpeg-0.8.9/libavdevice/v4l2.c	2012-01-11 18:43:47.000000000 +0100
> @@ -621,6 +621,9 @@
>          av_log(s1, AV_LOG_VERBOSE, "Setting frame size to %dx%d\n", s->width, s->height);
>      }
>  
> +    if ((res = v4l2_set_parameters(s1, ap) < 0))
> +        goto out;
> +
>      desired_format = device_try_init(s1, pix_fmt, &s->width, &s->height, &codec_id);
>      if (desired_format == 0) {
>          av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for "
> @@ -634,9 +637,6 @@
>          goto out;
>      s->frame_format = desired_format;
>  
> -    if ((res = v4l2_set_parameters(s1, ap) < 0))
> -        goto out;
> -
>      st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
>      s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
>      if (capabilities & V4L2_CAP_STREAMING) {

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120111/f87f5187/attachment.asc>


More information about the ffmpeg-devel mailing list