[FFmpeg-cvslog] Add flag to force demuxers to sort more strictly by dts.

Michael Niedermayer git at videolan.org
Sun Apr 24 21:51:28 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 24 21:29:35 2011 +0200| [8a68697dc66234d0a5fc50b4d67a94921c9893d1] | committer: Michael Niedermayer

Add flag to force demuxers to sort more strictly by dts.
This enables non interleaved AVI mode for example.
Players that are picky on strict interleaving can set this.
Patches to only switch to non intereaved AVI mode when the index is not strictly
correctly interleaved are welcome.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/avformat.h |    1 +
 libavformat/avidec.c   |    2 +-
 libavformat/options.c  |    1 +
 3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 767356a..2f41f72 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -726,6 +726,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_NOFILLIN     0x0010 ///< Do not infer any values from other values, just return what is stored in the container
 #define AVFMT_FLAG_NOPARSE      0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled
 #define AVFMT_FLAG_RTP_HINT     0x0040 ///< Add RTP hinting to the output file
+#define AVFMT_FLAG_SORT_DTS    0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down)
 
     int loop_input;
 
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 9d657e0..77d0686 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -726,7 +726,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
     if(!avi->index_loaded && pb->seekable)
         avi_load_index(s);
     avi->index_loaded = 1;
-    avi->non_interleaved |= guess_ni_flag(s);
+    avi->non_interleaved |= guess_ni_flag(s) | (s->flags & AVFMT_FLAG_SORT_DTS);
     for(i=0; i<s->nb_streams; i++){
         AVStream *st = s->streams[i];
         if(st->nb_index_entries)
diff --git a/libavformat/options.c b/libavformat/options.c
index 214c62f..0a87f2b 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -50,6 +50,7 @@ static const AVOption options[]={
 {"noparse", "disable AVParsers, this needs nofillin too", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_NOPARSE, INT_MIN, INT_MAX, D, "fflags"},
 {"igndts", "ignore dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_IGNDTS, INT_MIN, INT_MAX, D, "fflags"},
 {"rtphint", "add rtp hinting", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_RTP_HINT, INT_MIN, INT_MAX, E, "fflags"},
+{"sortdts", "try to interleave outputted packets by dts", 0, FF_OPT_TYPE_CONST, AVFMT_FLAG_SORT_DTS, INT_MIN, INT_MAX, D, "fflags"},
 {"analyzeduration", "how many microseconds are analyzed to estimate duration", OFFSET(max_analyze_duration), FF_OPT_TYPE_INT, 5*AV_TIME_BASE, 0, INT_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), FF_OPT_TYPE_BINARY, 0, 0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), FF_OPT_TYPE_INT, 1<<20, 0, INT_MAX, D},



More information about the ffmpeg-cvslog mailing list