forked from mia/Aegisub
Shuffle some stuff around in MicroDVDSubtitleFormat::ReadFile
This commit is contained in:
parent
b743bb39b0
commit
d6fd2f016b
|
@ -96,34 +96,35 @@ void MicroDVDSubtitleFormat::ReadFile(AssFile *target, agi::fs::path const& file
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
boost::smatch match;
|
boost::smatch match;
|
||||||
std::string line = file.ReadLineFromFile();
|
std::string line = file.ReadLineFromFile();
|
||||||
if (regex_match(line, match, line_regex)) {
|
if (!regex_match(line, match, line_regex)) continue;
|
||||||
int f1 = boost::lexical_cast<int>(match[0]);
|
|
||||||
int f2 = boost::lexical_cast<int>(match[1]);
|
|
||||||
std::string text = match[2].str();
|
|
||||||
|
|
||||||
// If it's the first, check if it contains fps information
|
std::string text = match[2].str();
|
||||||
if (isFirst) {
|
|
||||||
isFirst = false;
|
|
||||||
|
|
||||||
double cfr;
|
// If it's the first, check if it contains fps information
|
||||||
if (agi::util::try_parse(text, &cfr)) {
|
if (isFirst) {
|
||||||
fps = cfr;
|
isFirst = false;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it wasn't an fps line, ask the user for it
|
double cfr;
|
||||||
fps = AskForFPS(true, false);
|
if (agi::util::try_parse(text, &cfr)) {
|
||||||
if (!fps.IsLoaded()) return;
|
fps = cfr;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::replace_all(text, "|", "\\N");
|
// If it wasn't an fps line, ask the user for it
|
||||||
|
fps = AskForFPS(true, false);
|
||||||
AssDialogue *diag = new AssDialogue;
|
if (!fps.IsLoaded()) return;
|
||||||
diag->Start = fps.TimeAtFrame(f1, agi::vfr::START);
|
|
||||||
diag->End = fps.TimeAtFrame(f2, agi::vfr::END);
|
|
||||||
diag->Text = text;
|
|
||||||
target->Line.push_back(*diag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int f1 = boost::lexical_cast<int>(match[0]);
|
||||||
|
int f2 = boost::lexical_cast<int>(match[1]);
|
||||||
|
|
||||||
|
boost::replace_all(text, "|", "\\N");
|
||||||
|
|
||||||
|
AssDialogue *diag = new AssDialogue;
|
||||||
|
diag->Start = fps.TimeAtFrame(f1, agi::vfr::START);
|
||||||
|
diag->End = fps.TimeAtFrame(f2, agi::vfr::END);
|
||||||
|
diag->Text = text;
|
||||||
|
target->Line.push_back(*diag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue