FFMS2: more initialization fun

Originally committed to SVN as r2981.
This commit is contained in:
Fredrik Mellbin 2009-05-24 23:04:11 +00:00
parent cf03d252ca
commit c8768d8043
3 changed files with 15 additions and 9 deletions

View File

@ -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() {

View File

@ -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);

View File

@ -251,7 +251,7 @@ Note that --enable-w32threads or --enable-pthreads is required for multithreaded
<li>The audio track delay is now exposed in the API in the same way as video tracks</li>
<li>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</li>
<li>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</li>
<li>Updated FFmpeg to rev X (now with faad2 again by popular demand, updated to GCC 4.4.0 for compiling all libraries)</li>
<li>Updated FFmpeg to rev 18930 (now with faad2 again by popular demand, updated to GCC 4.4.0 for compiling all libraries)</li>
</ul></li>
<li>2.00 beta 8<ul>