From edc10f752c44b9cc461bd65505715bd72bf8f343 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Fri, 22 May 2009 21:44:02 +0000 Subject: [PATCH] Fix ffms2 providers to work with latest FFMS2 API changes. Originally committed to SVN as r2974. --- aegisub/src/audio_provider_ffmpegsource.cpp | 6 +++++- aegisub/src/ffmpegsource_common.cpp | 2 +- aegisub/src/video_provider_ffmpegsource.cpp | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/aegisub/src/audio_provider_ffmpegsource.cpp b/aegisub/src/audio_provider_ffmpegsource.cpp index 91b074f38..db3884b5a 100644 --- a/aegisub/src/audio_provider_ffmpegsource.cpp +++ b/aegisub/src/audio_provider_ffmpegsource.cpp @@ -46,7 +46,10 @@ /////////// // Constructor FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(Aegisub::String filename) { - FFMS_Init(); + if (FFMS_Init()) { + FFMS_DeInit(); + throw _T("FFmpegSource audio provider: failed to initialize FFMS2"); + } MsgSize = sizeof(FFMSErrMsg); MsgString = _T("FFmpegSource audio provider: "); @@ -181,6 +184,7 @@ FFmpegSourceAudioProvider::~FFmpegSourceAudioProvider() { void FFmpegSourceAudioProvider::Close() { FFMS_DestroyAudioSource(AudioSource); AudioSource = NULL; + FFMS_DeInit(); } diff --git a/aegisub/src/ffmpegsource_common.cpp b/aegisub/src/ffmpegsource_common.cpp index 4853026db..ba5cd0e36 100644 --- a/aegisub/src/ffmpegsource_common.cpp +++ b/aegisub/src/ffmpegsource_common.cpp @@ -84,7 +84,7 @@ FFIndex *FFmpegSourceProvider::DoIndexing(FFIndex *Index, wxString FileNameWX, w Progress.ProgressDialog->SetProgress(0,1); // index all audio tracks - Index = FFMS_MakeIndex(FileNameWX.mb_str(wxConvLocal), Trackmask, FFMSTrackMaskNone, NULL, IgnoreDecodeErrors, FFmpegSourceProvider::UpdateIndexingProgress, &Progress, FFMSErrMsg, MsgSize); + Index = FFMS_MakeIndex(FileNameWX.mb_str(wxConvLocal), Trackmask, FFMSTrackMaskNone, NULL, NULL, IgnoreDecodeErrors, FFmpegSourceProvider::UpdateIndexingProgress, &Progress, FFMSErrMsg, MsgSize); if (!Index) { Progress.ProgressDialog->Destroy(); wxString temp(FFMSErrMsg, wxConvUTF8); diff --git a/aegisub/src/video_provider_ffmpegsource.cpp b/aegisub/src/video_provider_ffmpegsource.cpp index 905e0028b..d4e50639f 100644 --- a/aegisub/src/video_provider_ffmpegsource.cpp +++ b/aegisub/src/video_provider_ffmpegsource.cpp @@ -51,7 +51,10 @@ // Constructor FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, double fps) { // initialize ffmpegsource - FFMS_Init(); + if (FFMS_Init()) { + FFMS_DeInit(); + throw _T("FFmpegSource video provider: failed to initialize FFMS2"); + } // clean up variables VideoSource = NULL; @@ -202,6 +205,7 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps) void FFmpegSourceVideoProvider::Close() { FFMS_DestroyVideoSource(VideoSource); VideoSource = NULL; + FFMS_DeInit(); DstFormat = FFMS_GetPixFmt("none"); LastDstFormat = FFMS_GetPixFmt("none");