]> git.sesse.net Git - ffmpeg/commit
movtextdec: fix handling of UTF-8 subtitles
authorwm4 <nfxjfg@googlemail.com>
Sat, 24 Mar 2018 14:41:54 +0000 (15:41 +0100)
committerwm4 <nfxjfg@googlemail.com>
Sun, 25 Mar 2018 17:27:02 +0000 (19:27 +0200)
commitb0644c3e1a96397ee5e2448c542fa4c3bc319537
treeb08e9604d82001257ba73bdc4626953c6690b58b
parentb7d0d912ef9b60eae962e4622d72860af31a8b00
movtextdec: fix handling of UTF-8 subtitles

Subtitles which contained styled UTF-8 subtitles (i.e. not just 7 bit
ASCII characters) were not handled correctly. The spec mandates that
styling start/end ranges are in "characters". It's not quite clear what
a "character" is supposed to be, but maybe they mean unicode codepoints.

FFmpeg's decoder treated the style ranges as byte idexes, which could
lead to UTF-8 sequences being broken, and the common code dropping the
whole subtitle line.

Change this and count the codepoint instead. This also means that even
if this is somehow wrong, the decoder won't break UTF-8 sequences
anymore. The sample which led me to investigate this now appears to work
correctly.
libavcodec/movtextdec.c