add-ons/media/ffmpeg: Remove global initializer system.
All of the functions it calls are deprecated and no longer needed, as FFmpeg loads all codecs automatically now, and uses pthreads internally for locking as needed.
This commit is contained in:
parent
19ec897266
commit
17c276df21
@ -16,8 +16,6 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <Locker.h>
|
||||
|
||||
extern "C" {
|
||||
#include "avcodec.h"
|
||||
#include "avformat.h"
|
||||
@ -42,64 +40,6 @@ extern "C" {
|
||||
#define ERROR(a...) fprintf(stderr, a)
|
||||
|
||||
|
||||
static int
|
||||
manage_locks(void** _lock, enum AVLockOp operation)
|
||||
{
|
||||
TRACE("manage_locks(%p, %d)\n", *_lock, operation);
|
||||
|
||||
BLocker** lock = reinterpret_cast<BLocker**>(_lock);
|
||||
|
||||
switch (operation) {
|
||||
case AV_LOCK_CREATE:
|
||||
TRACE(" AV_LOCK_CREATE\n");
|
||||
*lock = new(std::nothrow) BLocker("FFmpeg lock");
|
||||
if (*lock == NULL)
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case AV_LOCK_OBTAIN:
|
||||
TRACE(" AV_LOCK_OBTAIN\n");
|
||||
if (!(*lock)->Lock())
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case AV_LOCK_RELEASE:
|
||||
TRACE(" AV_LOCK_RELEASE\n");
|
||||
(*lock)->Unlock();
|
||||
break;
|
||||
|
||||
case AV_LOCK_DESTROY:
|
||||
TRACE(" AV_LOCK_DESTROY\n");
|
||||
delete *lock;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
FFmpegPlugin::GlobalInitilizer::GlobalInitilizer()
|
||||
{
|
||||
if (av_lockmgr_register(manage_locks) != 0)
|
||||
ERROR("Failed to register lock management!\n");
|
||||
|
||||
av_register_all();
|
||||
// This will also call av_codec_init() by registering codecs.
|
||||
avfilter_register_all();
|
||||
}
|
||||
|
||||
|
||||
FFmpegPlugin::GlobalInitilizer::~GlobalInitilizer()
|
||||
{
|
||||
av_lockmgr_register(NULL);
|
||||
}
|
||||
|
||||
|
||||
FFmpegPlugin::GlobalInitilizer FFmpegPlugin::sInitilizer;
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -42,15 +42,6 @@ public:
|
||||
media_format_family* formatFamily,
|
||||
media_format* inputFormat,
|
||||
media_format* outputFormat);
|
||||
|
||||
private:
|
||||
class GlobalInitilizer {
|
||||
public:
|
||||
GlobalInitilizer();
|
||||
~GlobalInitilizer();
|
||||
};
|
||||
|
||||
static GlobalInitilizer sInitilizer;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user