On Sun, Apr 26, 2020 at 11:49:00PM +0000, Zane van Iperen wrote:
> On Sun, 26 Apr 2020 00:07:52 +0200
> "Michael Niedermayer" <mich...@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;
> }

ok until someone sees a way to improve this

thx


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to