]> git.sesse.net Git - ffmpeg/commitdiff
lavf: add AVFormatContext.max_ts_probe
authorAnton Khirnov <anton@khirnov.net>
Tue, 19 Aug 2014 17:49:58 +0000 (17:49 +0000)
committerAnton Khirnov <anton@khirnov.net>
Mon, 25 Aug 2014 05:17:54 +0000 (05:17 +0000)
It allows to configure how long will avformat_find_stream_info() wait
to get the first timestamp.

doc/APIchanges
libavformat/avformat.h
libavformat/options_table.h
libavformat/utils.c
libavformat/version.h

index 14ec297f16516e0f9fbfb2d6437472f34c0a939a..0ea02ff34e5a026f9fb09f41c3b336ef524083fd 100644 (file)
@@ -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().
 
index 5b29145a01baa6841fbe481aa1040b891f3addc8..923b282d411293b604b4200a3b3f6bc2c4849f6a 100644 (file)
@@ -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
index ac052c805b4ff9d0c5e49849aa6f0e9297342641..0f7207ccf14774da605fce6db866af0ad5e67939 100644 (file)
@@ -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},
 };
 
index 4cc246d9eec1016ab77d2aa6f0fe75aef23378a3..faad9c9db4e39af406892c53847bf702b0dab2f0 100644 (file)
@@ -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;
index 7b1acd614395e861f19a1ade426533a615dfac60..d4dee72222047248af22a6b0d194f35d263cad09 100644 (file)
@@ -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, \