X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fstl_text_reader.cc;h=f08a438fb8dba8974bea75d33cbf7def16487588;hb=4a2b319516ba5deda908e9778ce8880e421d709e;hp=0b4141c2f6ad7e50f84dfd4af00d1df474798555;hpb=aebf2cb7812c8f593b85182611b587e6014aefc6;p=libsub.git diff --git a/src/stl_text_reader.cc b/src/stl_text_reader.cc index 0b4141c..f08a438 100644 --- a/src/stl_text_reader.cc +++ b/src/stl_text_reader.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Carl Hetherington + Copyright (C) 2014-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +22,8 @@ #include #include #include +#include -using std::list; using std::ostream; using std::istream; using std::string; @@ -38,8 +38,12 @@ using namespace sub; STLTextReader::STLTextReader (istream& in) { + /* This reader extracts no information about where the subtitle + should be on screen, so its reference is TOP_OF_SUBTITLE. + */ _subtitle.vertical_position.line = 0; - + _subtitle.vertical_position.reference = TOP_OF_SUBTITLE; + while (in.good ()) { string line; getline (in, line); @@ -74,7 +78,7 @@ STLTextReader::STLTextReader (istream& in) if (divider[0] != string::npos) { divider[1] = line.find_first_of (",", divider[0] + 1); } - + if (divider[0] == string::npos || divider[1] == string::npos || divider[0] <= 1 || divider[1] >= line.length() - 1) { warn (String::compose ("Unrecognised line %1", line)); continue; @@ -85,97 +89,84 @@ STLTextReader::STLTextReader (istream& in) string to_string = line.substr (divider[0] + 1, divider[1] - divider[0] - 1); trim (to_string); - optional from = time (from_string); - optional to = time (to_string); + optional