[FFmpeg-devel] [PATCH]Decode png frames without iend chunk

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Mar 10 13:51:37 CET 2014


Attached patch allows decoding of png frames without iend chunk, this is what 
all web browers (except Konqueror) do.
Since the chunk is required by the specification, printing an error is 
expected imo.
Fixes ticket #3357

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 516dd41..12e8b11 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -546,6 +546,8 @@ static int decode_frame(AVCodecContext *avctx,
     for (;;) {
         if (bytestream2_get_bytes_left(&s->gb) <= 0) {
             av_log(avctx, AV_LOG_ERROR, "No bytes left\n");
+            if (s->state & PNG_ALLIMAGE)
+                goto exit_loop;
             goto fail;

More information about the ffmpeg-devel mailing list