[FFmpeg-devel] [PATCH] lavf/avio: flush when calling avio_close()

Stefano Sabatini stefasab at gmail.com
Thu Aug 16 01:34:48 CEST 2012


This seems the expected behavior.

FIXME: bump micro
---
 libavformat/avio.h    |    3 +++
 libavformat/aviobuf.c |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/avio.h b/libavformat/avio.h
index ccf2f42..08e9dd3 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -391,6 +391,9 @@ int avio_open2(AVIOContext **s, const char *url, int flags,
  * Close the resource accessed by the AVIOContext s and free it.
  * This function can only be used if s was opened by avio_open().
  *
+ * The internal buffer is automatically flushed before closing the
+ * resource.
+ *
  * @return 0 on success, an AVERROR < 0 on error.
  */
 int avio_close(AVIOContext *s);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index f6a914a..13b3c86 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -793,6 +793,7 @@ int avio_close(AVIOContext *s)
     if (!s)
         return 0;
 
+    avio_flush(s);
     h = s->opaque;
     av_free(s->buffer);
     if (!s->write_flag)
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list