Fix bad parsing of ASS lines embedded into FFmpeg files and containing commas;
authorCarl Hetherington <cth@carlh.net>
Sat, 9 Jun 2018 22:57:00 +0000 (23:57 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 8 Oct 2018 20:41:11 +0000 (21:41 +0100)
backport of f3db6f37c85352ad7631078907439ce8ff151b3d.

ChangeLog
src/lib/ffmpeg_decoder.cc

index 14a9693102813788fc7c04bf117ce6043f660641..65fc1e9c49255c759bb249760265239bbceaee9c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
index ea41acf23fc9be3e969ac2c9fc9d86859bd9ad8a..7b305ee15a5fdffc7e0ba2a65ce809e7d0d7850c 100644 (file)
@@ -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
                );