[FFmpeg-devel] [PATCH] make av_get_packet return AVERROR_EOF if appropriate

Reimar Döffinger Reimar.Doeffinger
Thu Oct 1 18:44:04 CEST 2009


On Thu, Oct 01, 2009 at 06:25:13PM +0200, Reimar D?ffinger wrote:
> Hello,
> I think av_get_packet should return an error (AVERROR_EOF) when it read nothing
> at all due to reaching EOF.
> I think this will also simplify my attempts to clean up the raw read
> functions to be more consistent/whatever.

This is the actual change:
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 20105)
+++ libavformat/utils.c (working copy)
@@ -269,6 +269,8 @@
     pkt->pos= url_ftell(s);
 
     ret= get_buffer(s, pkt->data, size);
+    if (!ret && url_feof(s))
+        ret = AVERROR_EOF;
     if(ret<=0)
         av_free_packet(pkt);
     else
 
This seems to also change seek tests, I still have to find out if the
changes are as intended.
Another question is if maybe get_buffer should be changed to behave like
this...



More information about the ffmpeg-devel mailing list