[FFmpeg-devel] [PATCH] Stricter TMV probe

Vitor Sessak vitor1001
Mon Sep 14 22:50:38 CEST 2009


Ronald S. Bultje wrote:
> 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);
> }

hmm, this suppose a pretty sophisticated probing. Maybe just using simply

int ff_is_typical_samplerate(int samplerate)
{
     switch(samplerate) {
     case ...:
     case ...:
     case ...:
         return 1;
     default:
         return 0;
     }
}

and each probe decides on how to use it better...

-Vitor



More information about the ffmpeg-devel mailing list