forked from mia/Aegisub
Fixed crash related to the new keyframe system
Originally committed to SVN as r589.
This commit is contained in:
parent
d89e522fd4
commit
7cbab8cdfe
|
@ -985,13 +985,14 @@ void FrameMain::LoadVFR(wxString filename) {
|
||||||
VFR_Output.Load(filename);
|
VFR_Output.Load(filename);
|
||||||
SubsBox->Refresh(false);
|
SubsBox->Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail
|
// Fail
|
||||||
catch (const wchar_t *error) {
|
catch (const wchar_t *error) {
|
||||||
wxString err(error);
|
wxString err(error);
|
||||||
wxMessageBox(err, _T("Error opening timecodes file"), wxOK | wxICON_ERROR, this);
|
wxMessageBox(err, _T("Error opening timecodes file"), wxOK | wxICON_ERROR, this);
|
||||||
}
|
}
|
||||||
catch (...) {
|
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
|
// Load Keyframes
|
||||||
void FrameMain::LoadKeyframes(wxString filename) {
|
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
|
// Open file
|
||||||
wxArrayInt keyFrames;
|
wxArrayInt keyFrames;
|
||||||
keyFrames.Empty();
|
keyFrames.Empty();
|
||||||
|
@ -1017,12 +1029,13 @@ void FrameMain::LoadKeyframes(wxString filename) {
|
||||||
|
|
||||||
// Read header
|
// Read header
|
||||||
wxString cur = file.ReadLineFromFile();
|
wxString cur = file.ReadLineFromFile();
|
||||||
if (cur != _T("# keyframe format v1")) return;
|
if (cur != _T("# keyframe format v1")) _T("Invalid keyframes file.");
|
||||||
cur = file.ReadLineFromFile();
|
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);
|
cur = cur.Mid(4);
|
||||||
double fps;
|
double fps;
|
||||||
cur.ToDouble(&fps);
|
cur.ToDouble(&fps);
|
||||||
|
if (fps == 0.0) throw _T("Invalid FPS.");
|
||||||
|
|
||||||
// Read lines
|
// Read lines
|
||||||
while (file.HasMoreLines()) {
|
while (file.HasMoreLines()) {
|
||||||
|
@ -1052,6 +1065,16 @@ void FrameMain::LoadKeyframes(wxString filename) {
|
||||||
Refresh();
|
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
|
// Save Keyframes
|
||||||
|
|
Loading…
Reference in a new issue