aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-08-16 01:25:05 +0200
committerAnton Khirnov <anton@khirnov.net>2012-09-15 18:24:49 +0200
commit5d1203f0635a0b14bea6cc609026936bd7ae9e3a (patch)
tree42c3ac0cd8c69a2d4189bc76829d1373fd62e14a
parent0443879089f29e53e79d473076b99d7618ee673f (diff)
downloadffmpeg-5d1203f0635a0b14bea6cc609026936bd7ae9e3a.tar.gz
avio: flush the internal buffer in avio_close()
This is consistent with stdio, and thus what people would naturally expect.
-rw-r--r--libavformat/avio.h3
-rw-r--r--libavformat/aviobuf.c1
-rw-r--r--libavformat/img2enc.c2
-rw-r--r--libavformat/version.h2
4 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 10c0a12ccb..55c96bc432 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -349,6 +349,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 fb01613298..7dc66e25a6 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -761,6 +761,7 @@ int avio_close(AVIOContext *s)
if (!s)
return 0;
+ avio_flush(s);
h = s->opaque;
av_freep(&s->buffer);
av_free(s);
diff --git a/libavformat/img2enc.c b/libavformat/img2enc.c
index 6273af94f8..bf183560e0 100644
--- a/libavformat/img2enc.c
+++ b/libavformat/img2enc.c
@@ -86,8 +86,6 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write(pb[0], pkt->data , ysize);
avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
avio_write(pb[2], pkt->data + ysize +(pkt->size - ysize)/2, (pkt->size - ysize)/2);
- avio_flush(pb[1]);
- avio_flush(pb[2]);
avio_close(pb[1]);
avio_close(pb[2]);
}else{
diff --git a/libavformat/version.h b/libavformat/version.h
index fa4d49a33a..a86f35a6b4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 16
-#define LIBAVFORMAT_VERSION_MICRO 0
+#define LIBAVFORMAT_VERSION_MICRO 1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \