[FFmpeg-cvslog] lavf: add AVFormatContext.max_ts_probe

Anton Khirnov git at videolan.org
Mon Aug 25 13:26:57 CEST 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Aug 19 17:49:58 2014 +0000| [b263f8ffe7599d9cd27ec477a12700da8eb2790d] | committer: Anton Khirnov

lavf: add AVFormatContext.max_ts_probe

It allows to configure how long will avformat_find_stream_info() wait
to get the first timestamp.

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

 doc/APIchanges              |    3 +++
 libavformat/avformat.h      |    6 ++++++
 libavformat/options_table.h |    1 +
 libavformat/utils.c         |    1 +
 libavformat/version.h       |    2 +-
 5 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 14ec297..0ea02ff 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2014-08-09
 
 API changes, most recent first:
 
+2014-08-xx - xxxxxxx - lavf 56.03.0 - avformat.h
+  Add AVFormatContext.max_ts_probe.
+
 2014-08-13 - 8ddc326 - lavu 54.03.0 - mem.h
   Add av_strndup().
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 5b29145..923b282 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1192,6 +1192,12 @@ typedef struct AVFormatContext {
     int event_flags;
 #define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata.
 
+    /**
+     * Maximum number of packets to read while waiting for the first timestamp.
+     * Decoding only.
+     */
+    int max_ts_probe;
+
     /*****************************************************************
      * All fields below this line are not part of the public API. They
      * may not be used outside of libavformat and can be changed and
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index ac052c8..0f7207c 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -65,6 +65,7 @@ static const AVOption avformat_options[] = {
 {"strict", "strictly conform to all the things in the spec no matter what the consequences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, D|E, "strict"},
 {"normal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, D|E, "strict"},
 {"experimental", "allow non-standardized experimental variants", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, D|E, "strict"},
+{"max_ts_probe", "maximum number of packets to read while waiting for the first timestamp", OFFSET(max_ts_probe), AV_OPT_TYPE_INT, { .i64 = 50 }, 0, INT_MAX, D },
 {NULL},
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4cc246d..faad9c9 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2108,6 +2108,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 !st->codec->extradata)
                 break;
             if (st->first_dts == AV_NOPTS_VALUE &&
+                st->codec_info_nb_frames < ic->max_ts_probe &&
                 (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
                  st->codec->codec_type == AVMEDIA_TYPE_AUDIO))
                 break;
diff --git a/libavformat/version.h b/libavformat/version.h
index 7b1acd6..d4dee72 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -30,7 +30,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVFORMAT_VERSION_MAJOR 56
-#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, \



More information about the ffmpeg-cvslog mailing list