mirror of https://github.com/odrling/Aegisub
ffmpegsource video provider now cleans up after itself properly even if loading the video file failed
Originally committed to SVN as r2373.
This commit is contained in:
parent
cc85096bbd
commit
9b4f389fb2
|
@ -58,7 +58,12 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, d
|
||||||
MessageSize = sizeof(FFMSErrorMessage);
|
MessageSize = sizeof(FFMSErrorMessage);
|
||||||
|
|
||||||
// and here we go
|
// and here we go
|
||||||
|
try {
|
||||||
LoadVideo(filename, fps);
|
LoadVideo(filename, fps);
|
||||||
|
} catch (...) {
|
||||||
|
Close();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -92,12 +97,14 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
||||||
Progress.ProgressDialog->Show();
|
Progress.ProgressDialog->Show();
|
||||||
Progress.ProgressDialog->SetProgress(0,1);
|
Progress.ProgressDialog->SetProgress(0,1);
|
||||||
|
|
||||||
Index = FFMS_MakeIndex(FileNameWX.char_str(), 0, "", FFmpegSourceVideoProvider::UpdateIndexingProgress, &Progress, FFMSErrorMessage, MessageSize);
|
Index = FFMS_MakeIndex(FileNameWX.char_str(), 1, NULL, FFmpegSourceVideoProvider::UpdateIndexingProgress, &Progress, FFMSErrorMessage, MessageSize);
|
||||||
if (Index == NULL) {
|
if (Index == NULL) {
|
||||||
|
Progress.ProgressDialog->Destroy();
|
||||||
ErrorMsg.Printf(_T("FFmpegSource video provider: %s"), FFMSErrorMessage);
|
ErrorMsg.Printf(_T("FFmpegSource video provider: %s"), FFMSErrorMessage);
|
||||||
throw ErrorMsg;
|
throw ErrorMsg;
|
||||||
}
|
}
|
||||||
Progress.ProgressDialog->Destroy();
|
Progress.ProgressDialog->Destroy();
|
||||||
|
|
||||||
// write it to disk
|
// write it to disk
|
||||||
if (FFMS_WriteIndex(CacheName.char_str(), Index, FFMSErrorMessage, MessageSize)) {
|
if (FFMS_WriteIndex(CacheName.char_str(), Index, FFMSErrorMessage, MessageSize)) {
|
||||||
ErrorMsg.Printf(_T("FFmpegSource video provider: %s"), FFMSErrorMessage);
|
ErrorMsg.Printf(_T("FFmpegSource video provider: %s"), FFMSErrorMessage);
|
||||||
|
|
Loading…
Reference in New Issue