[FFmpeg-cvslog] r26219 - trunk/ffmpeg.c

michael subversion
Wed Jan 5 05:52:32 CET 2011


Author: michael
Date: Wed Jan  5 05:52:32 2011
New Revision: 26219

Log:
Fix/cleanup m/ljpeg encoding pix fmt selection code in ffmpeg.c.
Better ideas are welcome ...

Modified:
   trunk/ffmpeg.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Wed Jan  5 05:52:21 2011	(r26218)
+++ trunk/ffmpeg.c	Wed Jan  5 05:52:32 2011	(r26219)
@@ -628,15 +628,18 @@ static void choose_pixel_fmt(AVStream *s
 {
     if(codec && codec->pix_fmts){
         const enum PixelFormat *p= codec->pix_fmts;
+        if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){
+            if(st->codec->codec_id==CODEC_ID_MJPEG){
+                p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};
+            }else if(st->codec->codec_id==CODEC_ID_LJPEG){
+                p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};
+            }
+        }
         for(; *p!=-1; p++){
             if(*p == st->codec->pix_fmt)
                 break;
         }
-        if(*p == -1
-           && !(   st->codec->codec_id==CODEC_ID_MJPEG
-                && st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL
-                && (   st->codec->pix_fmt == PIX_FMT_YUV420P
-                    || st->codec->pix_fmt == PIX_FMT_YUV422P)))
+        if(*p == -1)
             st->codec->pix_fmt = codec->pix_fmts[0];
     }
 }



More information about the ffmpeg-cvslog mailing list