[FFmpeg-cvslog] muxers: Add a flag to mark muxers that allow (non strict) monotone timestamps.

James Zern git at videolan.org
Thu May 26 22:01:44 CEST 2011


ffmpeg | branch: master | James Zern <jzern at google.com> | Thu May 26 20:19:04 2011 +0200| [094aa84b03632370dde171935171321bbfa9548b] | committer: Michael Niedermayer

muxers: Add a flag to mark muxers that allow (non strict) monotone timestamps.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=094aa84b03632370dde171935171321bbfa9548b
---

 libavformat/avformat.h    |    3 +++
 libavformat/matroskaenc.c |    2 +-
 libavformat/utils.c       |    2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1607a30..00fe8a6 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -262,6 +262,9 @@ typedef struct AVFormatParameters {
 #define AVFMT_NOSTREAMS     0x1000 /**< Format does not require any streams */
 #define AVFMT_NOBINSEARCH   0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */
 #define AVFMT_NOGENSEARCH   0x4000 /**< Format does not allow to fallback to generic search */
+#define AVFMT_TS_NONSTRICT  0x8000 /**< Format does not require strictly
+                                          increasing timestamps, but they must
+                                          still be monotonic */
 
 typedef struct AVOutputFormat {
     const char *name;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index c3e203c..ae29765 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1220,7 +1220,7 @@ AVOutputFormat ff_webm_muxer = {
     mkv_write_header,
     mkv_write_packet,
     mkv_write_trailer,
-    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
+    .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT,
 };
 #endif
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3c9a89d..3432b22 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2993,7 +2993,7 @@ 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);



More information about the ffmpeg-cvslog mailing list