Fixed reading and writing of microdvd subtitles

Originally committed to SVN as r1254.
This commit is contained in:
Rodrigo Braz Monteiro 2007-06-18 19:25:11 +00:00
parent 9b880fd963
commit 808a1fe06c
1 changed files with 8 additions and 3 deletions

View File

@ -130,13 +130,16 @@ void MicroDVDSubtitleFormat::ReadFile(wxString filename,wxString forceEncoding)
isFirst = false; isFirst = false;
// If it wasn't an fps line, ask the user for it // If it wasn't an fps line, ask the user for it
if (fps == 0.0) { if (fps <= 0.0) {
fps = AskForFPS(); fps = AskForFPS();
if (fps == 0.0) return; if (fps == 0.0) return;
else if (fps > 0.0) cfr.SetCFR(fps); else if (fps > 0.0) cfr.SetCFR(fps);
else rate = &VFR_Output; else rate = &VFR_Output;
} }
else continue; else {
cfr.SetCFR(fps);
continue;
}
} }
// Start and end times // Start and end times
@ -176,7 +179,9 @@ void MicroDVDSubtitleFormat::WriteFile(wxString filename,wxString encoding) {
TextFileWriter file(filename,encoding); TextFileWriter file(filename,encoding);
// Write FPS line // Write FPS line
file.WriteLineToFile(wxString::Format(_T("{1}{1}%.6f"),fps)); if (rate->GetFrameRateType() != VFR) {
file.WriteLineToFile(wxString::Format(_T("{1}{1}%.6f"),rate->GetAverage()));
}
// Write lines // Write lines
using std::list; using std::list;