mirror of https://github.com/odrling/Aegisub
Update FFMS2 providers to initialize COM when running under Windows, as per the new FFMS2 init procedure.
Originally committed to SVN as r2986.
This commit is contained in:
parent
50069248e9
commit
c8b125943c
|
@ -41,15 +41,20 @@
|
|||
// Headers
|
||||
#include "include/aegisub/aegisub.h"
|
||||
#include "audio_provider_ffmpegsource.h"
|
||||
#ifdef WIN32
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
|
||||
|
||||
///////////
|
||||
// Constructor
|
||||
FFmpegSourceAudioProvider::FFmpegSourceAudioProvider(Aegisub::String filename) {
|
||||
if (FFMS_Init()) {
|
||||
FFMS_DeInit();
|
||||
throw _T("FFmpegSource audio provider: failed to initialize FFMS2");
|
||||
#ifdef WIN32
|
||||
if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
||||
throw _T("FFmpegSource audio provider: COM initialization failure");
|
||||
}
|
||||
#endif
|
||||
FFMS_Init();
|
||||
|
||||
MsgSize = sizeof(FFMSErrMsg);
|
||||
MsgString = _T("FFmpegSource audio provider: ");
|
||||
|
@ -176,6 +181,9 @@ void FFmpegSourceAudioProvider::LoadAudio(Aegisub::String filename) {
|
|||
// Destructor
|
||||
FFmpegSourceAudioProvider::~FFmpegSourceAudioProvider() {
|
||||
Close();
|
||||
#ifdef WIN32
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,7 +192,6 @@ FFmpegSourceAudioProvider::~FFmpegSourceAudioProvider() {
|
|||
void FFmpegSourceAudioProvider::Close() {
|
||||
FFMS_DestroyAudioSource(AudioSource);
|
||||
AudioSource = NULL;
|
||||
FFMS_DeInit();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,16 +45,21 @@
|
|||
#include "video_context.h"
|
||||
#include "options.h"
|
||||
#include "aegisub_endian.h"
|
||||
#ifdef WIN32
|
||||
#include <objbase.h>
|
||||
#endif
|
||||
|
||||
|
||||
///////////////
|
||||
// Constructor
|
||||
FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, double fps) {
|
||||
// initialize ffmpegsource
|
||||
if (FFMS_Init()) {
|
||||
FFMS_DeInit();
|
||||
throw _T("FFmpegSource video provider: failed to initialize FFMS2");
|
||||
#ifdef WIN32
|
||||
if (!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
||||
throw _T("FFmpegSource video provider: COM initialization failure");
|
||||
}
|
||||
#endif
|
||||
// initialize ffmpegsource
|
||||
FFMS_Init();
|
||||
|
||||
// clean up variables
|
||||
VideoSource = NULL;
|
||||
|
@ -78,6 +83,9 @@ FFmpegSourceVideoProvider::FFmpegSourceVideoProvider(Aegisub::String filename, d
|
|||
// Destructor
|
||||
FFmpegSourceVideoProvider::~FFmpegSourceVideoProvider() {
|
||||
Close();
|
||||
#ifdef WIN32
|
||||
CoUninitialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
@ -205,7 +213,6 @@ 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");
|
||||
|
|
Loading…
Reference in New Issue