Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2013-03-12 19:54:42 +0400
committerNicolas George <nicolas.george@normalesup.org>2013-03-25 02:19:07 +0400
commit4f112a8e34022c821be885ed293abc0b120c875b (patch)
treec8f636ef2e96887d9c043e3b362e1b7cff10b2bb /libavformat
parent125acd215250ead008938266efcacd56743f3a2a (diff)
lavf/mux: add the flush_packets option.
Note: a lot of muxers already do the flushing explicitly.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avformat.h7
-rw-r--r--libavformat/mux.c2
-rw-r--r--libavformat/options_table.h1
3 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4b8731cb86..549a0fa45f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1213,6 +1213,13 @@ typedef struct AVFormatContext {
*/
int seek2any;
+ /**
+ * Flush the I/O context after each packet.
+ * - encoding: Set by user via AVOptions (NO direct access)
+ * - decoding: unused
+ */
+ int flush_packets;
+
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 3578a52034..29ab3f5dc2 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -494,6 +494,8 @@ static inline int split_write_packet(AVFormatContext *s, AVPacket *pkt)
did_split = av_packet_split_side_data(pkt);
ret = s->oformat->write_packet(s, pkt);
+ if (s->flush_packets && s->pb && s->pb->error >= 0)
+ avio_flush(s->pb);
if (did_split)
av_packet_merge_side_data(pkt);
return ret;
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 6750050c1f..9f8613764c 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -75,6 +75,7 @@ static const AVOption options[]={
{"avoid_negative_ts", "shift timestamps to make them positive. 1 enables, 0 disables, default of -1 enables when required by target format.", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, E},
{"skip_initial_bytes", "skip initial bytes", OFFSET(skip_initial_bytes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D},
{"correct_ts_overflow", "correct single timestamp overflows", OFFSET(correct_ts_overflow), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D},
+{"flush_packets", "enable flushing of the I/O context after each packet", OFFSET(flush_packets), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E},
{NULL},
};