summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-06-09 23:57:00 +0100
committerCarl Hetherington <cth@carlh.net>2018-06-09 23:57:00 +0100
commitf3db6f37c85352ad7631078907439ce8ff151b3d (patch)
treeb3bcb0606ed8ad53ef0f8eec8c159c72ba561df0
parent4513308f3c08579d53a0eee91b470dca3a28cbc2 (diff)
Fix bad parsing of ASS lines embedded into FFmpeg files and containing commas.
-rw-r--r--ChangeLog5
-rw-r--r--src/lib/ffmpeg_decoder.cc16
2 files changed, 16 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 85b0f21a9..7f4c185f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
2018-06-09 Carl Hetherington <cth@carlh.net>
+ * Fix bad parsing of ASS lines embedded into FFmpeg files
+ and containing commas.
+
* Add option to open a DCP in the player (#1312).
-a2018-06-08 Carl Hetherington <cth@carlh.net>
+2018-06-08 Carl Hetherington <cth@carlh.net>
* Add support for rotation and flipping of video sources,
and auto-detect when this is necessary (#966).
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 6a8f4d413..0746458e5 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -679,16 +679,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
);