[FFmpeg-devel] [PATCH] avformat/bintext: Implement bin_probe()

Michael Niedermayer michael at niedermayer.cc
Tue Feb 6 02:11:52 EET 2018


On Mon, Feb 05, 2018 at 02:02:56PM +0100, Carl Eugen Hoyos wrote:
> 2018-02-01 2:19 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
> > On Wed, Jan 31, 2018 at 05:43:24PM +0100, Carl Eugen Hoyos wrote:
> >> 2018-01-31 15:22 GMT+01:00 Michael Niedermayer <michael at niedermayer.cc>:
> >> > Fixes misdetection of sbQ9.bin
> >> >
> >> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> >> > ---
> >> >  libavformat/bintext.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
> >> >  1 file changed, 48 insertions(+), 1 deletion(-)
> >> >
> >> > diff --git a/libavformat/bintext.c b/libavformat/bintext.c
> >> > index 12e3bfde4d..722a40c3e5 100644
> >> > --- a/libavformat/bintext.c
> >> > +++ b/libavformat/bintext.c
> >> > @@ -126,6 +126,53 @@ static void predict_width(AVCodecParameters *par, uint64_t fsize, int got_width)
> >> >          par->width = fsize > 4000 ? (160<<3) : (80<<3);
> >> >  }
> >> >
> >> > +static int bin_probe(AVProbeData *p)
> >> > +{
> >> > +    const uint8_t *d = p->buf;
> >> > +    int magic = 0, sauce = 0;
> >> > +    int invisible = 0;
> >> > +    int i;
> >> > +
> >> > +    if (p->buf_size > 256)
> >> > +        magic = !memcmp(d + p->buf_size - 256, next_magic, sizeof(next_magic));
> >> > +    if (p->buf_size > 128)
> >> > +        sauce = !memcmp(d + p->buf_size - 128, "SAUCE00", 7);
> >> > +
> >> > +    if (magic)
> >> > +        return AVPROBE_SCORE_MAX / 2;
> >>
> >> This seems too low to me or am I wrong?
> >>
> >> > +
> >> > +    if (av_match_ext(p->filename, "bin")) {
> >> > +        AVCodecParameters par;
> >> > +        int got_width = 0;
> >> > +        par.width = par.height = 0;
> >>
> >> > +        if (sauce)
> >> > +            return AVPROBE_SCORE_MAX / 2;
> >>
> >> Same here.
> >
> > was thinking the same but that was what the filename based detection
> > used before.
> > I kind of just left it where it was, the main goal of the patch was
> > just to fix the misdetection not to raise the score.
> > But we can surely raise these.
> > WHat would you think is a good value ?
> 
> I suggest to make it EXTENSION + 1 to have a still low score
> but better reflect the high probability.

ok, will push with that

thx

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

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180206/1dcd91a9/attachment.sig>


More information about the ffmpeg-devel mailing list