[FFmpeg-devel] [PATCH] lavf/srtdec: rewrite parsing logic

Clément Bœsch u at pkh.me
Thu Dec 24 13:20:16 CET 2015

On Thu, Dec 24, 2015 at 01:11:49PM +0100, Clément Bœsch wrote:
> Fixes Ticket #5032

OK I was a bit lazy in writing a longer description, so here are some more

The samples in Ticket #5032 is basically composed of \r\r\n line breaks.
So we already are handling \r, or \n, or \r\n as line breaks. Which means
\r\n\n will be considered as a double line breaks. This is an issue
because ff_subtitles_read_text_chunk() will stop extracting a chunk after
just one line, and basically shit happens.

So instead of parsing the SRT by "chunks" (which means splitting every
\n\n), this new parser is detecting timing lines, and split on this basis.
It needs to take into account the event number preceding it, but it means
it has to handle situations such as:

 - the event number can be 0 and not start at 1
 - the event number is not ordered at all
 - the event number can be followed by text
 - the event payload can contain one or multiple number
 - all kind of weird line breaks can appear randomly like wild pokémons

The sample madness.srt tries to sum up all of this in one sample, and
ticket5032-rrn.srt is the file containing \r\r\n line breaks.

I believe the demuxer to be way more solid that way


Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151224/851ebc3f/attachment.sig>

More information about the ffmpeg-devel mailing list