[FFmpeg-devel] [PATCH] yuv4mpeg: complain and exit if a non-rawvideo stream is selected

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon May 30 17:14:46 CEST 2011


The yuv4mpeg muxer will crash otherwise.
---
 libavformat/yuv4mpeg.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 445ec37..90b222d 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -154,6 +154,12 @@ static int yuv4_write_header(AVFormatContext *s)
     if (s->nb_streams != 1)
         return AVERROR(EIO);
 
+    if (s->streams[0]->codec->codec_id != CODEC_ID_RAWVIDEO) {
+        av_log(s, AV_LOG_ERROR,
+               "A non-rawvideo stream was selected, but yuv4mpeg only handles rawvideo streams\n");
+        return AVERROR(EINVAL);
+    }
+
     if (s->streams[0]->codec->pix_fmt == PIX_FMT_YUV411P) {
         av_log(s, AV_LOG_ERROR, "Warning: generating rarely used 4:1:1 YUV stream, some mjpegtools might not work.\n");
     }
-- 
1.7.2.3



More information about the ffmpeg-devel mailing list