From 6825d70ae8310faa064c8d39cb20c77d5d02c8b9 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 19 Jun 2016 21:57:58 +0100 Subject: Fix some small errors in SSA/ASS parsing. --- src/ssa_reader.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ssa_reader.cc b/src/ssa_reader.cc index c1614a8..74d497a 100644 --- a/src/ssa_reader.cc +++ b/src/ssa_reader.cc @@ -316,9 +316,9 @@ SSAReader::read (function ()> get_line) size_t const colon = line->find (":"); SUB_ASSERT (colon != string::npos); - SUB_ASSERT (line->length() > colon + 1); string const type = line->substr (0, colon); - string const body = line->substr (colon + 2); + string body = line->substr (colon + 1); + trim (body); switch (part) { case INFO: @@ -367,6 +367,10 @@ SSAReader::read (function ()> get_line) } else if (event_format[i] == "End") { sub.to = parse_time (event[i]); } else if (event_format[i] == "Style") { + /* libass trims leading '*'s from style names, commenting that + "they seem to mean literally nothing". Go figure... + */ + trim_left_if (event[i], boost::is_any_of ("*")); SUB_ASSERT (styles.find(event[i]) != styles.end()); Style style = styles[event[i]]; sub.font = style.font_name; -- cgit v1.2.3