summaryrefslogtreecommitdiff
path: root/tools/probetest.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-12-21 20:20:29 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-23 03:39:52 +0100
commit13306dde2240d4a3fd5c143adb96ae6376a4bfb6 (patch)
tree3f58dacc9cd813ec83d0344c68aad8e5ca1656d0 /tools/probetest.c
parent1ffcf6ac9045c647ce27581a836f325118e40b03 (diff)
downloadffmpeg-13306dde2240d4a3fd5c143adb96ae6376a4bfb6.tar.gz
tools/probetest: support testing a single specified input format
This reduces the time the test takes significantly when only one formats needs to be tested Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools/probetest.c')
-rw-r--r--tools/probetest.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/tools/probetest.c b/tools/probetest.c
index 78327deda3..74045eb498 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -29,6 +29,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 +43,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);
@@ -75,6 +78,17 @@ static void print_times(void)
}
}
+static int read_int(char *arg) {
+ int ret;
+
+ if (!arg || !*arg)
+ return -1;
+ ret = strtol(arg, &arg, 0);
+ if (*arg)
+ return -1;
+ return ret;
+}
+
int main(int argc, char **argv)
{
unsigned int p, i, type, size, retry;
@@ -83,11 +97,22 @@ 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 (!strcmp(argv[i], "-f") && i+1<argc && !single_format) {
+ single_format = argv[++i];
+ } else if (read_int(argv[i])>0 && j == 1) {
+ retry_count = read_int(argv[i]);
+ j++;
+ } else if (read_int(argv[i])>0 && j == 2) {
+ max_size = read_int(argv[i]);
+ j++;
+ } else {
+ fprintf(stderr, "probetest [-f <input format>] [<retry_count> [<max_size>]]\n");
+ return 1;
+ }
+ }
if (max_size > 1000000000U/8) {
fprintf(stderr, "max_size out of bounds\n");