|
@@ -23,11 +23,17 @@
|
|
|
#include "libavformat/avformat.h"
|
|
|
#include "libavcodec/put_bits.h"
|
|
|
#include "libavutil/lfg.h"
|
|
|
+#include "libavutil/timer.h"
|
|
|
|
|
|
#define MAX_FORMATS 1000 //this must be larger than the number of formats
|
|
|
static int score_array[MAX_FORMATS];
|
|
|
+static int64_t time_array[MAX_FORMATS];
|
|
|
static int failures = 0;
|
|
|
|
|
|
+#ifndef AV_READ_TIME
|
|
|
+#define AV_READ_TIME(x) 0
|
|
|
+#endif
|
|
|
+
|
|
|
static void probe(AVProbeData *pd, int type, int p, int size)
|
|
|
{
|
|
|
int i = 0;
|
|
@@ -37,7 +43,10 @@ static void probe(AVProbeData *pd, int type, int p, int size)
|
|
|
if (fmt->flags & AVFMT_NOFILE)
|
|
|
continue;
|
|
|
if (fmt->read_probe) {
|
|
|
- int score = fmt->read_probe(pd);
|
|
|
+ int score;
|
|
|
+ int64_t start = AV_READ_TIME();
|
|
|
+ score = fmt->read_probe(pd);
|
|
|
+ time_array[i] += AV_READ_TIME() - start;
|
|
|
if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
|
|
|
score_array[i] = score;
|
|
|
fprintf(stderr,
|
|
@@ -50,6 +59,22 @@ static void probe(AVProbeData *pd, int type, int p, int size)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void print_times(void)
|
|
|
+{
|
|
|
+ int i = 0;
|
|
|
+ AVInputFormat *fmt = NULL;
|
|
|
+
|
|
|
+ while ((fmt = av_iformat_next(fmt))) {
|
|
|
+ if (fmt->flags & AVFMT_NOFILE)
|
|
|
+ continue;
|
|
|
+ if (time_array[i] > 1000000) {
|
|
|
+ fprintf(stderr, "%12"PRIu64" cycles, %12s\n",
|
|
|
+ time_array[i], fmt->name);
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
int main(int argc, char **argv)
|
|
|
{
|
|
|
unsigned int p, i, type, size, retry;
|
|
@@ -142,5 +167,7 @@ int main(int argc, char **argv)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(AV_READ_TIME())
|
|
|
+ print_times();
|
|
|
return failures;
|
|
|
}
|