[FFmpeg-devel] [PATCH] Add SUP/PGS subtitle demuxer

wm4 nfxjfg at googlemail.com
Sun Aug 31 14:57:54 CEST 2014


On Sun, 31 Aug 2014 14:25:21 +0200
Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:

> On Sun, Aug 31, 2014 at 01:04:29PM +0200, wm4 wrote:
> > +static int sup_probe(AVProbeData *p)
> > +{
> > +    if (p->buf_size < 2 || memcmp(p->buf, "PG", 2))
> > +        return 0;
> > +    return AVPROBE_SCORE_EXTENSION;
> 
> I understand if you consider it not worth the effort,
> but ideally this would scan ahead several packets,
> and if it all matches up return a higher score.
> The MP3 probe function is possibly a good reference (though
> this one should be bit simpler).

Other formats are also relatively lazy and just check the magic atthe
start of the file and call it a day (e.g. flac, some img2dec probers).
Of course it's possible that 2 bytes (and ASCII) is a bit too prone to
false positives, so maybe it should be improved.

Since PGS packets can be only at most ~64KB big, I guess it would be
feasible to check whether there is a second PGS packet after the first
one. Would that be sufficient?

In theory, it would be nice if the general probe code could jzst try to
read a few packets...


More information about the ffmpeg-devel mailing list