[FFmpeg-devel] [PATCH] Stricter TMV probe

Ronald S. Bultje rsbultje
Mon Sep 14 22:38:22 CEST 2009


Hi,

On Mon, Sep 14, 2009 at 4:33 PM, Reimar D?ffinger
<Reimar.Doeffinger at gmx.de> wrote:
> Maybe, though probe functions can be made arbitrarily complex up to
> actually encoding, the question is up to where it makes sense.
> A generic function is a good idea that might make it reasonable to use
> it, but someone will still have to come up with something that can be
> conveniently used in all cases (the maximum might not always be
> AVPROBE_SCORE_MAX, it also will certainly depend on other checks,
> it might even be convenient to just run additional tests _after_
> handling the sample rate).

Agree. I wasn't looking for a probe_score_depending_on_sample_rate(),
maybe (still complex, but take it as a poorly implemented good idea:)

#define score(min, max, ratio) \
    min + (max - min) * ratio
adapt_min_max_for_samplerate(int rate, int *min, int *max)
{
    switch (rate) {
    case ...:
        min += (max - min) * 0.5;
        break;
    default:
        max -= (max - min) * 0.5;
        break;
    }
}

int my_probe()
{
int min = 0, max = 100;
float score = 0.5;

srate = get_be32(..);
adapt_min_max_for_samplerate(srate, &min, &max);
// other factors, change score = 0.0-1.0
return score(min, max, score);
}



More information about the ffmpeg-devel mailing list