img2enc: ensure that the codec is rawvideo for split planes mode.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Nov 2012 00:13:12 +0000 (01:13 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Nov 2012 00:31:41 +0000 (01:31 +0100)
Found-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/img2enc.c

index dea4572..c485569 100644 (file)
@@ -41,6 +41,7 @@ typedef struct {
 static int write_header(AVFormatContext *s)
 {
     VideoMuxData *img = s->priv_data;
+    AVStream *st = s->streams[0];
     const char *str;
 
     av_strlcpy(img->path, s->filename, sizeof(img->path));
@@ -52,7 +53,10 @@ static int write_header(AVFormatContext *s)
         img->is_pipe = 1;
 
     str = strrchr(img->path, '.');
-    img->split_planes = str && !av_strcasecmp(str + 1, "y");
+    img->split_planes =     str
+                         && !av_strcasecmp(str + 1, "y")
+                         && s->nb_streams == 1
+                         && st->codec->codec_id == AV_CODEC_ID_RAWVIDEO;
     return 0;
 }