[FFmpeg-cvslog] avformat: Add a flag to mark muxers that allow (non strict) monotone timestamps.
James Zern
git at videolan.org
Tue May 22 00:04:47 CEST 2012
ffmpeg | branch: master | James Zern <jzern at google.com> | Thu May 26 20:19:04 2011 +0200| [e9cef89702e2bde918102e784c6b75a7979e85d1] | committer: Justin Ruggles
avformat: Add a flag to mark muxers that allow (non strict) monotone timestamps.
Signed-off-by: Justin Ruggles <justin.ruggles at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e9cef89702e2bde918102e784c6b75a7979e85d1
---
doc/APIchanges | 4 ++++
libavformat/avformat.h | 6 +++++-
libavformat/flvenc.c | 3 ++-
libavformat/framecrcenc.c | 2 +-
libavformat/matroskaenc.c | 8 +++++---
libavformat/md5enc.c | 2 +-
libavformat/smjpegenc.c | 2 +-
libavformat/swfenc.c | 2 ++
libavformat/utils.c | 4 +++-
libavformat/version.h | 2 +-
libavformat/wav.c | 1 +
11 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index dac87ee..18105c5 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 33e9098..040e35e 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 19169ad..3a51aaa 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 d1148f9..36dfd29 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 9334b52..61a91d7 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 3fd5450..4e8db3c 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 45ba20b..e27b895 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 82ec7ff..fb0fdc5 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 e8430b2..4387521 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 91ddfd2..7bd0b8e 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 85849c1..c01121f 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,
};
More information about the ffmpeg-cvslog
mailing list