lavf/avio: flush internal buffer when calling avio_close()

This seems the expected behavior.
This commit is contained in:
Stefano Sabatini 2012-08-16 01:25:05 +02:00
parent 63f57f8530
commit 725213545d
3 changed files with 5 additions and 1 deletions

View File

@ -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. * Close the resource accessed by the AVIOContext s and free it.
* This function can only be used if s was opened by avio_open(). * 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. * @return 0 on success, an AVERROR < 0 on error.
*/ */
int avio_close(AVIOContext *s); int avio_close(AVIOContext *s);

View File

@ -793,6 +793,7 @@ int avio_close(AVIOContext *s)
if (!s) if (!s)
return 0; return 0;
avio_flush(s);
h = s->opaque; h = s->opaque;
av_free(s->buffer); av_free(s->buffer);
if (!s->write_flag) if (!s->write_flag)

View File

@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54 #define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 25 #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, \ #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \ LIBAVFORMAT_VERSION_MINOR, \