[FFmpeg-devel] [PATCH v10 2/2] avformat: add demuxer for Pro Pinball Series' Soundbanks

Zane van Iperen zane at zanevaniperen.com
Mon Apr 27 02:49:00 EEST 2020


On Sun, 26 Apr 2020 00:07:52 +0200
"Michael Niedermayer" <michael at niedermayer.cc> wrote:

> 
> also iam not sure it makes sense or if it goes to far but the probe
> code could check all tracks which are within the buffer
> all these low 10 scores are a bit ugly, some more solid "yes iam sure
> this is / is not" instead of such really low scores.
> 
> low scores which get returned based on few weak checks have the
> problem of more often producing errors in detection. Random non
> multimedia files being detected as something they are not or if 2
> demuxers have such a low score detection then its more likely the
> wrong one will be choosen
> 
> 

How's this?

I've removed the "track_count > 113" check and made it
all-or-nothing.

static int pp_bnk_probe(const AVProbeData *p)
{
    uint32_t sample_rate = AV_RL32(p->buf +  4);
    uint32_t track_count = AV_RL32(p->buf + 12);
    uint32_t flags       = AV_RL32(p->buf + 16);

    if (track_count == 0 || track_count > INT_MAX)
        return 0;

    if ((sample_rate !=  5512) && (sample_rate != 11025) &&
        (sample_rate != 22050) && (sample_rate != 44100))
        return 0;

    /* Check the first track header. */
    if (AV_RL32(p->buf + 28) != sample_rate)
        return 0;

    if ((flags & ~PP_BNK_FLAG_MASK) != 0)
        return 0;

    return AVPROBE_SCORE_MAX / 4 + 1;
}


Zane



More information about the ffmpeg-devel mailing list