diff options
Diffstat (limited to 'ffmpeg/tools/probetest.c')
| -rw-r--r-- | ffmpeg/tools/probetest.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/ffmpeg/tools/probetest.c b/ffmpeg/tools/probetest.c index b13c6f9..b685e3d 100644 --- a/ffmpeg/tools/probetest.c +++ b/ffmpeg/tools/probetest.c @@ -23,10 +23,17 @@ #include "libavformat/avformat.h" #include "libavcodec/put_bits.h" #include "libavutil/lfg.h" +#include "libavutil/timer.h" -static int score_array[1000]; //this must be larger than the number of formats +#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; @@ -36,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, @@ -49,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; @@ -84,6 +110,11 @@ int main(int argc, char **argv) pd.buf = av_realloc(pd.buf, size + AVPROBE_PADDING_SIZE); pd.filename = ""; + if (!pd.buf) { + fprintf(stderr, "out of memory\n"); + return 1; + } + memset(pd.buf, 0, size + AVPROBE_PADDING_SIZE); fprintf(stderr, "testing size=%d\n", size); @@ -141,5 +172,7 @@ int main(int argc, char **argv) } } } + if(AV_READ_TIME()) + print_times(); return failures; } |
