[FFmpeg-devel] [PATCH] tools/probetest: support testing a single specified input format

Michael Niedermayer michaelni at gmx.at
Sun Dec 21 21:09:54 CET 2014


This reduces the time the test takes significantly when only one
formats needs to be tested

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 tools/probetest.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tools/probetest.c b/tools/probetest.c
index 78327de..cbd9f89 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -22,6 +22,7 @@
 
 #include "libavformat/avformat.h"
 #include "libavcodec/put_bits.h"
+#include "libavutil/avstring.h"
 #include "libavutil/lfg.h"
 #include "libavutil/timer.h"
 
@@ -29,6 +30,7 @@
 static int score_array[MAX_FORMATS];
 static int64_t time_array[MAX_FORMATS];
 static int failures = 0;
+static const char *single_format;
 
 #ifndef AV_READ_TIME
 #define AV_READ_TIME(x) 0
@@ -42,7 +44,9 @@ static void probe(AVProbeData *pd, int type, int p, int size)
     while ((fmt = av_iformat_next(fmt))) {
         if (fmt->flags & AVFMT_NOFILE)
             continue;
-        if (fmt->read_probe) {
+        if (fmt->read_probe &&
+            (!single_format || !strcmp(single_format, fmt->name))
+        ) {
             int score;
             int64_t start = AV_READ_TIME();
             score = fmt->read_probe(pd);
@@ -83,11 +87,18 @@ int main(int argc, char **argv)
     PutBitContext pb;
     int retry_count= 4097;
     int max_size = 65537;
-
-    if(argc >= 2)
-        retry_count = atoi(argv[1]);
-    if(argc >= 3)
-        max_size = atoi(argv[2]);
+    int j;
+
+    for (j = i = 1; i<argc; i++) {
+        if (av_isdigit(argv[i][0])) {
+            if (j++ == 1) {
+                retry_count = atoi(argv[i]);
+            } else
+                max_size = atoi(argv[i]);
+        } else {
+            single_format = argv[i];
+        }
+    }
 
     if (max_size > 1000000000U/8) {
         fprintf(stderr, "max_size out of bounds\n");
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list