diff options
Diffstat (limited to 'media/libmediaplayerservice/MediaPlayerFactory.cpp')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerFactory.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerFactory.cpp b/media/libmediaplayerservice/MediaPlayerFactory.cpp index 3f69c11..57f6743 100644 --- a/media/libmediaplayerservice/MediaPlayerFactory.cpp +++ b/media/libmediaplayerservice/MediaPlayerFactory.cpp @@ -30,6 +30,7 @@ #include "TestPlayerStub.h" #include "StagefrightPlayer.h" #include "nuplayer/NuPlayerDriver.h" +#include <dlfcn.h> namespace android { @@ -334,6 +335,30 @@ void MediaPlayerFactory::registerBuiltinFactories() { registerFactory_l(new SonivoxPlayerFactory(), SONIVOX_PLAYER); registerFactory_l(new TestPlayerFactory(), TEST_PLAYER); + const char* FACTORY_LIB = "libdashplayer.so"; + const char* FACTORY_CREATE_FN = "CreateDASHFactory"; + + MediaPlayerFactory::IFactory* pFactory = NULL; + void* pFactoryLib = NULL; + typedef MediaPlayerFactory::IFactory* (*CreateDASHDriverFn)(); + + pFactoryLib = ::dlopen(FACTORY_LIB, RTLD_LAZY); + if (pFactoryLib == NULL) { + ALOGE("Failed to open FACTORY_LIB Error : %s ",::dlerror()); + } else { + CreateDASHDriverFn pCreateFnPtr; + pCreateFnPtr = (CreateDASHDriverFn) dlsym(pFactoryLib, FACTORY_CREATE_FN); + if (pCreateFnPtr == NULL) { + ALOGE("Could not locate pCreateFnPtr"); + } else { + pFactory = pCreateFnPtr(); + if(pFactory == NULL) { + ALOGE("Failed to invoke CreateDASHDriverFn..."); + } else { + registerFactory_l(pFactory,DASH_PLAYER); + } + } + } sInitComplete = true; } |