[FFmpeg-devel] [PATCH 1/2] lavf: add info_probe_size option.

Nicolas George nicolas.george at normalesup.org
Mon Apr 23 14:02:40 CEST 2012


This option separates the "probe format" and "probe packets
for various info" semantic of the probesize option.
Input formats are now allowed to raise it if necessary under
special circumstances (example: large rawvideo frames).

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavformat/avformat.h      |    6 ++++++
 libavformat/options_table.h |    1 +
 libavformat/utils.c         |    8 +++++---
 libavformat/version.h       |    2 +-
 4 files changed, 13 insertions(+), 4 deletions(-)


I originally added a more lengthy documentation in avoptions_format.texi but
it was overwritten. I did not find where to put it.


diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index d2727d4..f6850bc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1016,6 +1016,12 @@ typedef struct AVFormatContext {
     AVIOInterruptCB interrupt_callback;
 
     /**
+     * decoding: size of data to probe for stream information;
+     * encoding: unused.
+     */
+    unsigned int info_probe_size;
+
+    /**
      * Flags to enable debugging.
      */
     int debug;
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 8d57c27..0cf2680 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -64,6 +64,7 @@ static const AVOption options[]={
 {"careful",    "consider things that violate the spec and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CAREFUL }, INT_MIN, INT_MAX, D, "err_detect"},
 {"compliant",  "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, D, "err_detect"},
 {"aggressive", "consider things that a sane encoder shouldnt do as an error", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, D, "err_detect"},
+{"info_probe_size", "maximum size to probe for stream info", OFFSET(info_probe_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, D},
 {NULL},
 };
 
diff --git a/libavformat/utils.c b/libavformat/utils.c
index de0cb54..b33e086 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2471,6 +2471,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         ic->streams[i]->info->last_dts = AV_NOPTS_VALUE;
     }
 
+    if (!ic->info_probe_size)
+        ic->info_probe_size = ic->probesize;
     count = 0;
     read_size = 0;
     for(;;) {
@@ -2519,15 +2521,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             }
         }
         /* we did not get all the codec info, but we read too much data */
-        if (read_size >= ic->probesize) {
+        if (read_size >= ic->info_probe_size) {
             ret = count;
-            av_log(ic, AV_LOG_DEBUG, "Probe buffer size limit %d reached\n", ic->probesize);
+            av_log(ic, AV_LOG_DEBUG, "Stream info probe buffer size limit %d reached\n", ic->info_probe_size);
             for (i = 0; i < ic->nb_streams; i++)
                 if (!ic->streams[i]->r_frame_rate.num &&
                     ic->streams[i]->info->duration_count <= 1)
                     av_log(ic, AV_LOG_WARNING,
                            "Stream #%d: not enough frames to estimate rate; "
-                           "consider increasing probesize\n", i);
+                           "consider increasing info_probe_size\n", i);
             break;
         }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 7c4d8e7..a3143c3 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  3
+#define LIBAVFORMAT_VERSION_MINOR  4
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list