diff --git a/aegisub/FFmpegSource2/ffms.cpp b/aegisub/FFmpegSource2/ffms.cpp index fec21338a..35174426b 100644 --- a/aegisub/FFmpegSource2/ffms.cpp +++ b/aegisub/FFmpegSource2/ffms.cpp @@ -32,26 +32,32 @@ extern "C" { #endif static int InitCount = 0; +static bool FFmpegInited = false; FFMS_API(int) FFMS_Init() { - if (!InitCount++) { + if (!FFmpegInited) { av_register_all(); av_log_set_level(AV_LOG_QUIET); + } + + if (!InitCount) { #ifdef HAALISOURCE - if (::CoInitializeEx(NULL, COINIT_MULTITHREADED) != S_OK) - return 1; + ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); #endif } - return 0; + + InitCount++; + return InitCount; } - -FFMS_API(void) FFMS_DeInit() { - if (!--InitCount) { +FFMS_API(int) FFMS_DeInit() { + InitCount--; + if (!InitCount) { #ifdef HAALISOURCE ::CoUninitialize(); #endif } + return InitCount; } FFMS_API(int) FFMS_GetLogLevel() { diff --git a/aegisub/FFmpegSource2/ffms.h b/aegisub/FFmpegSource2/ffms.h index 2481ea48a..59accdafa 100644 --- a/aegisub/FFmpegSource2/ffms.h +++ b/aegisub/FFmpegSource2/ffms.h @@ -123,7 +123,7 @@ typedef int (FFMS_CC *TAudioNameCallback)(const char *SourceFile, int Track, con // Most functions return 0 on success // Functions without error message output can be assumed to never fail FFMS_API(int) FFMS_Init(); -FFMS_API(void) FFMS_DeInit(); +FFMS_API(int) FFMS_DeInit(); FFMS_API(int) FFMS_GetLogLevel(); FFMS_API(void) FFMS_SetLogLevel(int Level); FFMS_API(FFVideo *) FFMS_CreateVideoSource(const char *SourceFile, int Track, FFIndex *Index, const char *PP, int Threads, int SeekMode, char *ErrorMsg, unsigned MsgSize); diff --git a/aegisub/FFmpegSource2/ffms2.html b/aegisub/FFmpegSource2/ffms2.html index d48ade70d..34ccc8f42 100644 --- a/aegisub/FFmpegSource2/ffms2.html +++ b/aegisub/FFmpegSource2/ffms2.html @@ -251,7 +251,7 @@ Note that --enable-w32threads or --enable-pthreads is required for multithreaded
  • The audio track delay is now exposed in the API in the same way as video tracks
  • A big type and argument name cleanup in the API, many things have been renamed to be clearer and ffms.h should be completely C friendly now
  • Removed FFNoLog and replaced it with FFSetLogLevel and FFGetLogLevel, the default logging is now also set to quiet, the magical numbers to supply it can be found in avutil/log.h
  • -
  • Updated FFmpeg to rev X (now with faad2 again by popular demand, updated to GCC 4.4.0 for compiling all libraries)
  • +
  • Updated FFmpeg to rev 18930 (now with faad2 again by popular demand, updated to GCC 4.4.0 for compiling all libraries)
  • 2.00 beta 8