• Clément Bœsch's avatar
    lavf/srtdec: rewrite parsing logic · 77eeaa2c
    Clément Bœsch authored
    Fixes Ticket #5032
    
    The samples in Ticket #5032 is using \r\r\n as line breaks.  Since we
    already are handling \r, or \n, or \r\n as line breaks, \r\n\n will be
    considered as a double line breaks. This is an issue because
    ff_subtitles_read_text_chunk() will as a result stop extracting a chunk
    after just one line.
    
    So instead of parsing the SRT by "chunks" (which means splitting every
    double LB), this new parser is detecting timing lines, and split the
    events on this basis. While this sounds safe and simple, it needs to
    take into account the event number preceding the timing line while
    handling situations such as:
    
     - event number starting at 0 or actually any number instead of 1
     - event numbers not being ordered at all
     - event number being followed by text garbage (this really happened,
       see Ticket #4898)
     - event payload containing one or multiple number (a protagonist saying
       a count-down, a date or whatever) which could be confused with a
       chapter number
     - event number being empty (see Ticket #2167)
     - all kind of weird line breaks can appear randomly like wild pokémons
     - untrustable line breaks (Ticket #5032)
    
    The sample madness.srt tries to sum up most of this into one sample,
    ticket5032-rrn.srt is the file containing \r\r\n line breaks. and
    empty-events-2167.srt contains empty events.
    77eeaa2c
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
cmdutils_opencl.c Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
ffmpeg.c Loading commit data...
ffmpeg.h Loading commit data...
ffmpeg_dxva2.c Loading commit data...
ffmpeg_filter.c Loading commit data...
ffmpeg_opt.c Loading commit data...
ffmpeg_qsv.c Loading commit data...
ffmpeg_vdpau.c Loading commit data...
ffmpeg_videotoolbox.c Loading commit data...
ffplay.c Loading commit data...
ffprobe.c Loading commit data...
ffserver.c Loading commit data...
ffserver_config.c Loading commit data...
ffserver_config.h Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...