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

mike at multimedia.cx mike at multimedia.cx
Mon Nov 21 06:48:44 CET 2011


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;
             } else if (strncmp("420mpeg2",tokstart,8)==0) {
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list