Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
#include "libavformat/avformat.h"
#include "libavcodec/put_bits.h"
#include "libavutil/lfg.h"
#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];
#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];
+#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;
static void probe(AVProbeData *pd, int type, int p, int size)
{
int i = 0;
if (fmt->flags & AVFMT_NOFILE)
continue;
if (fmt->read_probe) {
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,
if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
score_array[i] = score;
fprintf(stderr,
+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;
int main(int argc, char **argv)
{
unsigned int p, i, type, size, retry;
+ if(AV_READ_TIME())
+ print_times();