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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Aug 31 17:03:38 CEST 2014

On Sun, Aug 31, 2014 at 04:15:51PM +0200, wm4 wrote:
> Well yes, it would be possible to loop over the entire probe buffer,
> until it ends on a packet boundary, or there's a partial cut-off
> packet. How exactly would you suggest the probe score?
> Personally, I'd probably do the following: if the header of the first
> packet is available (i.e. "PG" magic), then return SCORE_EXTENSION-1.
> If the probe buffer is large enough to include the header of the next
> packet, and the next packet has no magic (i.e. probably invalid),
> return 0. Otherwise, return SCORE_EXTENSION+1.

I would extend this by:
If more than 10 found, return max score (to allow detecting without
extension, and also to allow playing files where only a later part is
corrupted, plus it avoids scanning too much).
Since 10 would be less than 640 kB probe buffer (usually much less)
there's probably no need for special-handling of anything in-between,
beyond what you suggested.

More information about the ffmpeg-devel mailing list