[FFmpeg-devel] [PATCH]Factorise code in mpeg12.c

Michael Niedermayer michaelni
Tue Jan 6 16:00:42 CET 2009


On Mon, Jan 05, 2009 at 10:01:57PM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch tries to factorise code in mpeg12.c.
>
> Please comment, Carl Eugen

> Index: libavcodec/mpeg12.c
> ===================================================================
> --- libavcodec/mpeg12.c	(revision 16437)
> +++ libavcodec/mpeg12.c	(working copy)
> @@ -1212,6 +1212,22 @@
>      }
>  }
>  
> +static void mpeg_set_pixelformat(AVCodecContext *avctx){
> +    Mpeg1Context *s1 = avctx->priv_data;
> +    MpegEncContext *s = &s1->mpeg_enc_ctx;
> +
> +    if(avctx->xvmc_acceleration)
> +        avctx->pix_fmt = avctx->get_format(avctx,pixfmt_xvmc_mpg2_420);
> +    else{
> +        if(s->chroma_format <  2)
> +            avctx->pix_fmt = PIX_FMT_YUV420P;
> +        else if(s->chroma_format == 2)
> +            avctx->pix_fmt = PIX_FMT_YUV422P;
> +        else if(s->chroma_format >  2)
> +            avctx->pix_fmt = PIX_FMT_YUV444P;
> +    }
> +}

i would prefer if this did
return PIX_FMT_YUV420P
instead of setting avctx->pix_fmt directly

except that ok

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

> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090106/aeca7351/attachment.pgp>



More information about the ffmpeg-devel mailing list