diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-06-09 23:57:00 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-10-08 21:41:11 +0100 |
| commit | 34ddf0c18e6dd815d103552bf4013c41bd3a559c (patch) | |
| tree | 7ca884235520a98a65d8b68cfcb919d7340772c4 | |
| parent | c81b618554e46560d06aa5e531c048744e095024 (diff) | |
Fix bad parsing of ASS lines embedded into FFmpeg files and containing commas;
backport of f3db6f37c85352ad7631078907439ce8ff151b3d.
| -rw-r--r-- | ChangeLog | 9 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 16 |
2 files changed, 21 insertions, 4 deletions
@@ -1,9 +1,18 @@ +2018-10-08 Carl Hetherington <cth@carlh.net> + + * Fix bad parsing of ASS lines embedded into FFmpeg files + and containing commas. + 2018-09-25 Carl Hetherington <cth@carlh.net> * Version 2.12.12 released. 2018-09-16 Carl Hetherington <cth@carlh.net> + * Add option to open a DCP in the player (#1312). + +2018-06-08 Carl Hetherington <cth@carlh.net> + * Version 2.12.11 released. 2018-09-04 Carl Hetherington <cth@carlh.net> diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index ea41acf23..7b305ee15 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -678,16 +678,24 @@ FFmpegDecoder::decode_ass_subtitle (string ass, ContentTime from) produces a single format of Dialogue: lines... */ - vector<string> bits; - split (bits, ass, is_any_of (",")); - if (bits.size() < 10) { + int commas = 0; + string text; + for (size_t i = 0; i < ass.length(); ++i) { + if (commas < 9 && ass[i] == ',') { + ++commas; + } else if (commas == 9) { + text += ass[i]; + } + } + + if (text.empty ()) { return; } sub::RawSubtitle base; list<sub::RawSubtitle> raw = sub::SSAReader::parse_line ( base, - bits[9], + text, _ffmpeg_content->video->size().width, _ffmpeg_content->video->size().height ); |
