[FFmpeg-devel] [PATCH 1/2] Honor the 'C420' colorspace in Y4M demuxer

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Nov 21 09:12:30 CET 2011


On 21 Nov 2011, at 06:48, mike at multimedia.cx wrote:
> From: Mike Melanson <mike at multimedia.cx>
> 
> GStreamer's y4menc component muxes YUV 4:2:0 data as 'C420'.
> ---
> libavformat/yuv4mpeg.c |    5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
> index e1db1a3..36a27c9 100644
> --- a/libavformat/yuv4mpeg.c
> +++ b/libavformat/yuv4mpeg.c
> @@ -225,7 +225,10 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap)
>             tokstart=tokend;
>             break;
>         case 'C': // Color space
> -            if (strncmp("420jpeg",tokstart,7)==0) {
> +            if (strncmp("420",tokstart,3)==0) {
> +                pix_fmt = PIX_FMT_YUV420P;
> +                chroma_sample_location = AVCHROMA_LOC_CENTER;
> +            } else if (strncmp("420jpeg",tokstart,7)==0) {
>                 pix_fmt = PIX_FMT_YUV420P;
>                 chroma_sample_location = AVCHROMA_LOC_CENTER;

Why are you adding a whole new case if it uses the same values?
Also, doesn't this make both following two cases dead code?

>             } else if (strncmp("420mpeg2",tokstart,8)==0) {


More information about the ffmpeg-devel mailing list