aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2011-05-26 20:19:04 +0200
committerJustin Ruggles <justin.ruggles@gmail.com>2012-05-20 19:50:32 -0400
commite9cef89702e2bde918102e784c6b75a7979e85d1 (patch)
tree7eb62b52511661d3e0d8f272ca975d4c5d3b8c4a
parent5d603f1b655ee717c6639fc2fcb2c13e4a925b6f (diff)
downloadffmpeg-e9cef89702e2bde918102e784c6b75a7979e85d1.tar.gz
avformat: Add a flag to mark muxers that allow (non strict) monotone timestamps.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
-rw-r--r--doc/APIchanges4
-rw-r--r--libavformat/avformat.h6
-rw-r--r--libavformat/flvenc.c3
-rw-r--r--libavformat/framecrcenc.c2
-rw-r--r--libavformat/matroskaenc.c8
-rw-r--r--libavformat/md5enc.c2
-rw-r--r--libavformat/smjpegenc.c2
-rw-r--r--libavformat/swfenc.c2
-rw-r--r--libavformat/utils.c4
-rw-r--r--libavformat/version.h2
-rw-r--r--libavformat/wav.c1
11 files changed, 26 insertions, 10 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index dac87ee606..18105c55ba 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil: 2011-04-18
API changes, most recent first:
+2012-05-xx - xxxxxxx - lavf 54.3.0
+ Add AVFMT_TS_NONSTRICT format flag to indicate that a muxer supports
+ non-increasing monotone timestamps.
+
2012-05-15 - lavfi 2.17.0
Add support for audio filters
ac71230/a2cd9be - add video/audio buffer sink in a new installed
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 33e9098ff3..040e35eb92 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -351,6 +351,9 @@ typedef struct AVProbeData {
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */
#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */
#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */
+#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly
+ increasing timestamps, but they must
+ still be monotonic */
/**
* @addtogroup lavf_encoding
@@ -373,7 +376,8 @@ typedef struct AVOutputFormat {
/**
* can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE,
* AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS,
- * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH
+ * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH,
+ * AVFMT_TS_NONSTRICT
*/
int flags;
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 19169adbc5..3a51aaabb0 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -488,5 +488,6 @@ AVOutputFormat ff_flv_muxer = {
.codec_tag = (const AVCodecTag* const []){
flv_video_codec_ids, flv_audio_codec_ids, 0
},
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
};
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c
index d1148f9190..36dfd297c6 100644
--- a/libavformat/framecrcenc.c
+++ b/libavformat/framecrcenc.c
@@ -43,5 +43,5 @@ AVOutputFormat ff_framecrc_muxer = {
.video_codec = CODEC_ID_RAWVIDEO,
.write_header = ff_framehash_write_header,
.write_packet = framecrc_write_packet,
- .flags = AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
};
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9334b52d6d..61a91d7117 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1305,7 +1305,8 @@ AVOutputFormat ff_matroska_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag* const []){
ff_codec_bmp_tags, ff_codec_wav_tags, 0
},
@@ -1326,7 +1327,8 @@ AVOutputFormat ff_webm_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
+ AVFMT_TS_NONSTRICT,
};
#endif
@@ -1346,7 +1348,7 @@ AVOutputFormat ff_matroska_audio_muxer = {
.write_header = mkv_write_header,
.write_packet = mkv_write_packet,
.write_trailer = mkv_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
};
#endif
diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c
index 3fd54506b3..4e8db3cbe0 100644
--- a/libavformat/md5enc.c
+++ b/libavformat/md5enc.c
@@ -106,6 +106,6 @@ AVOutputFormat ff_framemd5_muxer = {
.video_codec = CODEC_ID_RAWVIDEO,
.write_header = ff_framehash_write_header,
.write_packet = framemd5_write_packet,
- .flags = AVFMT_VARIABLE_FPS,
+ .flags = AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
};
#endif
diff --git a/libavformat/smjpegenc.c b/libavformat/smjpegenc.c
index 45ba20b643..e27b895845 100644
--- a/libavformat/smjpegenc.c
+++ b/libavformat/smjpegenc.c
@@ -144,6 +144,6 @@ AVOutputFormat ff_smjpeg_muxer = {
.write_header = smjpeg_write_header,
.write_packet = smjpeg_write_packet,
.write_trailer = smjpeg_write_trailer,
- .flags = AVFMT_GLOBALHEADER,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag *const []){ ff_codec_smjpeg_video_tags, ff_codec_smjpeg_audio_tags, 0 },
};
diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c
index 82ec7ff9bc..fb0fdc5426 100644
--- a/libavformat/swfenc.c
+++ b/libavformat/swfenc.c
@@ -513,6 +513,7 @@ AVOutputFormat ff_swf_muxer = {
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
};
#endif
#if CONFIG_AVM2_MUXER
@@ -526,5 +527,6 @@ AVOutputFormat ff_avm2_muxer = {
.write_header = swf_write_header,
.write_packet = swf_write_packet,
.write_trailer = swf_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
};
#endif
diff --git a/libavformat/utils.c b/libavformat/utils.c
index e8430b23fa..438752174e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2962,7 +2962,9 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt){
pkt->dts= st->pts_buffer[0];
}
- if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
+ if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&
+ ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) &&
+ st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) {
av_log(s, AV_LOG_ERROR,
"Application provided invalid, non monotonically increasing dts to muxer in stream %d: %"PRId64" >= %"PRId64"\n",
st->index, st->cur_dts, pkt->dts);
diff --git a/libavformat/version.h b/libavformat/version.h
index 91ddfd27e8..7bd0b8e5f5 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 54
-#define LIBAVFORMAT_VERSION_MINOR 2
+#define LIBAVFORMAT_VERSION_MINOR 3
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 85849c1e75..c01121f9db 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -216,6 +216,7 @@ AVOutputFormat ff_wav_muxer = {
.write_header = wav_write_header,
.write_packet = wav_write_packet,
.write_trailer = wav_write_trailer,
+ .flags = AVFMT_TS_NONSTRICT,
.codec_tag = (const AVCodecTag* const []){ ff_codec_wav_tags, 0 },
.priv_class = &wav_muxer_class,
};