[FFmpeg-devel] [PATCH 1/3] ffmpeg: fix a crash with complex filters when pix_fmt is not specified

Matthieu Bouron matthieu.bouron at gmail.com
Thu May 3 14:36:02 CEST 2012


---
 ffmpeg.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f395a44..64ee5fd 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -707,10 +707,12 @@ static enum PixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum Pixe
 
 static const enum PixelFormat *choose_pixel_fmts(OutputStream *ost)
 {
+    enum PixelFormat *enc_pix_fmts = ost->enc ? ost->enc->pix_fmts : NULL;
+
     if (ost->st->codec->pix_fmt != PIX_FMT_NONE) {
         ost->pix_fmts[0] = choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt);
         return ost->pix_fmts;
-    } else if (ost->enc->pix_fmts) {
+    } else if (enc_pix_fmts) {
         if (ost->st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) {
             if (ost->st->codec->codec_id == CODEC_ID_MJPEG) {
                 return (const enum PixelFormat[]) { PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE };
-- 
1.7.10



More information about the ffmpeg-devel mailing list