[FFmpeg-devel] patch -- grab v4l infastructure

Michael Niedermayer michaelni
Fri Jun 1 21:31:57 CEST 2007


Hi

On Fri, Jun 01, 2007 at 07:41:29AM -0400, mmh wrote:
Content-Description: message body text
> 
> Just converts nested if construct to table look up format, to
> simplify the code and make it easier to add additional formats.
> 

[...]
> @@ -158,27 +171,15 @@
>      /* try to choose a suitable video format */
>      pict.palette = desired_palette;
>      pict.depth= desired_depth;
> -    if (desired_palette == -1 || (ret = ioctl(video_fd, VIDIOCSPICT, &pict)) < 0) {
> -        pict.palette=VIDEO_PALETTE_YUV420P;
> -        pict.depth=12;
> -        ret = ioctl(video_fd, VIDIOCSPICT, &pict);
> -        if (ret < 0) {
> -            pict.palette=VIDEO_PALETTE_YUV422;
> -            pict.depth=16;
> -            ret = ioctl(video_fd, VIDIOCSPICT, &pict);
> -            if (ret < 0) {
> -                pict.palette=VIDEO_PALETTE_RGB24;
> -                pict.depth=24;
> -                ret = ioctl(video_fd, VIDIOCSPICT, &pict);
> -                if (ret < 0) {
> -                    pict.palette=VIDEO_PALETTE_GREY;
> -                    pict.depth=8;
> -                    ret = ioctl(video_fd, VIDIOCSPICT, &pict);
> -                    if (ret < 0)
> -                        goto fail1;
> -                }
> -            }
> +    if (desired_palette == -1) {
> +        for (j = 0; j < vformat_num; j++) {
> +            pict.palette = video_formats[j].palette;
> +            pict.depth = video_formats[j].depth;
> +            if (-1 != ioctl(video_fd, VIDIOCSPICT, &pict))
> +                break;
>          }
> +        if (j >= vformat_num)
> +            goto fail1;
>      }

this looks wrong if desired_palette != -1


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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070601/f705a20e/attachment.pgp>



More information about the ffmpeg-devel mailing list