[FFmpeg-devel] [PATCH]Allow caf demuxer to signal eof

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Nov 20 12:37:45 CET 2012


Hi!

Attached patch is needed here to properly finish decoding caf files, without 
it, ffmpeg shows an error message and ffplay cannot autoexit.

Or should AVERROR_EOF by returned whenever left <= 0 ?

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index f166804..6125113 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -348,7 +348,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     /* don't read past end of data chunk */
     if (caf->data_size > 0) {
         left = (caf->data_start + caf->data_size) - avio_tell(pb);
-        if (left <= 0)
+        if(left==0)
+            return AVERROR_EOF;
+        if (left < 0)
             return AVERROR(EIO);
     }
 


More information about the ffmpeg-devel mailing list