From 725213545d63172099618cbaa08428e11729906d Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 16 Aug 2012 01:25:05 +0200 Subject: [PATCH] lavf/avio: flush internal buffer when calling avio_close() This seems the expected behavior. --- libavformat/avio.h | 3 +++ libavformat/aviobuf.c | 1 + libavformat/version.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.h b/libavformat/avio.h index ccf2f42548..08e9dd3659 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 f6a914ace4..13b3c863e3 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) diff --git a/libavformat/version.h b/libavformat/version.h index 39c4bf585b..4275ecdb2b 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 54 #define LIBAVFORMAT_VERSION_MINOR 25 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \