Fixed crash related to the new keyframe system

Originally committed to SVN as r589.
This commit is contained in:
Rodrigo Braz Monteiro 2006-12-23 02:42:34 +00:00
parent d89e522fd4
commit 7cbab8cdfe
1 changed files with 57 additions and 34 deletions

View File

@ -985,13 +985,14 @@ void FrameMain::LoadVFR(wxString filename) {
VFR_Output.Load(filename);
SubsBox->Refresh(false);
}
// Fail
catch (const wchar_t *error) {
wxString err(error);
wxMessageBox(err, _T("Error opening timecodes file"), wxOK | wxICON_ERROR, this);
}
catch (...) {
wxMessageBox(_T("Unknown error"), _T("Error opening video file"), wxOK | wxICON_ERROR, this);
wxMessageBox(_T("Unknown error"), _T("Error opening timecodes file"), wxOK | wxICON_ERROR, this);
}
}
@ -1010,6 +1011,17 @@ void FrameMain::LoadVFR(wxString filename) {
//////////////////
// Load Keyframes
void FrameMain::LoadKeyframes(wxString filename) {
// Unload
if (filename.IsEmpty()) {
wxArrayInt keyFrames;
keyFrames.Empty();
videoBox->videoDisplay->SetOverKeyFrames(keyFrames);
videoBox->videoDisplay->SetKeyFramesName(filename);
Refresh();
}
// Load
try {
// Open file
wxArrayInt keyFrames;
keyFrames.Empty();
@ -1017,12 +1029,13 @@ void FrameMain::LoadKeyframes(wxString filename) {
// Read header
wxString cur = file.ReadLineFromFile();
if (cur != _T("# keyframe format v1")) return;
if (cur != _T("# keyframe format v1")) _T("Invalid keyframes file.");
cur = file.ReadLineFromFile();
if (cur.Left(4) != _T("fps ")) return;
if (cur.Left(4) != _T("fps ")) throw _T("Invalid keyframes file.");
cur = cur.Mid(4);
double fps;
cur.ToDouble(&fps);
if (fps == 0.0) throw _T("Invalid FPS.");
// Read lines
while (file.HasMoreLines()) {
@ -1052,6 +1065,16 @@ void FrameMain::LoadKeyframes(wxString filename) {
Refresh();
}
// Fail
catch (const wchar_t *error) {
wxString err(error);
wxMessageBox(err, _T("Error opening keyframes file"), wxOK | wxICON_ERROR, this);
}
catch (...) {
wxMessageBox(_T("Unknown error"), _T("Error opening keyframes file"), wxOK | wxICON_ERROR, this);
}
}
//////////////////
// Save Keyframes