diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-09-17 12:01:35 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-09-17 12:01:35 +0200 |
commit | 96e6447d6233ac55f6dd4c50c9afefe99fefe773 (patch) | |
tree | 2e48a53cf7d93332ad999b046a72b1f91ee8a064 | |
parent | 22f79a2d605f3c3b36bb05e9609ff3a3dc27d1f9 (diff) | |
parent | 596e5d4783ca951258a7c580951fd161f1785ec1 (diff) | |
download | ffmpeg-96e6447d6233ac55f6dd4c50c9afefe99fefe773.tar.gz |
Merge commit '596e5d4783ca951258a7c580951fd161f1785ec1'
* commit '596e5d4783ca951258a7c580951fd161f1785ec1':
lavf: Add a flag to enable/disable per-packet flushing
Conflicts:
libavformat/avformat.h
libavformat/mux.c
libavformat/version.h
This adds a 2nd API to set per packet flushing
If the user application indicates through either a non default then this non default takes
precedence over the other still default value
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/avformat.h | 1 | ||||
-rw-r--r-- | libavformat/mux.c | 5 | ||||
-rw-r--r-- | libavformat/options_table.h | 3 | ||||
-rw-r--r-- | libavformat/version.h | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 9dea62eb5f..b18eb3f545 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1043,6 +1043,7 @@ typedef struct AVFormatContext { #define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible #define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. #define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload #define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) #define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) diff --git a/libavformat/mux.c b/libavformat/mux.c index aa5d5edebc..eff7caab25 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -535,10 +535,13 @@ static int 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) + + if (s->flush_packets && s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS) 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 a87868e162..527943932a 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -37,7 +37,8 @@ static const AVOption avformat_options[] = { {"direct", "reduce buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVIO_FLAG_DIRECT }, INT_MIN, INT_MAX, D|E, "avioflags"}, {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT, {.i64 = 5000000 }, 32, INT_MAX, D}, {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, -{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "fflags"}, +{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"}, +{"flush_packets", "reduce the latency by flushing out packets immediately", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D, "fflags"}, {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"}, {"nofillin", "do not fill in missing values that can be exactly calculated", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"}, diff --git a/libavformat/version.h b/libavformat/version.h index 667afa40c6..e7d9417b9c 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,8 +30,8 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 55 -#define LIBAVFORMAT_VERSION_MINOR 16 -#define LIBAVFORMAT_VERSION_MICRO 103 +#define LIBAVFORMAT_VERSION_MINOR 17 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |