ffplay: Check for pix_fmt changes Fixes Ticket238 by not crashing but also not playin...
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 20 Nov 2011 18:56:49 +0000 (19:56 +0100)
committerMarton Balint <cus@passwd.hu>
Mon, 21 Nov 2011 19:20:48 +0000 (20:20 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay.c

index 46cf6a1..673f31d 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -1562,7 +1562,10 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
     edge = codec->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width();
     w += edge << 1;
     h += edge << 1;
-
+    if (codec->pix_fmt != ctx->outputs[0]->format) {
+        av_log(codec, AV_LOG_ERROR, "Pixel format mismatches %d %d\n", codec->pix_fmt, ctx->outputs[0]->format);
+        return -1;
+    }
     if(!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h)))
         return -1;