diff options
author | Ajit Khare <ajitk@codeaurora.org> | 2013-01-07 23:23:39 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-02-19 11:04:28 -0800 |
commit | 739845fdb768402d6ad94f153b674aa7c044d703 (patch) | |
tree | ea050aae344ff69d689853fdb334a76460920741 | |
parent | 520ba656d8f8d4a2fd54a2c4fd98bab2a914cdd1 (diff) | |
download | frameworks_av-739845fdb768402d6ad94f153b674aa7c044d703.zip frameworks_av-739845fdb768402d6ad94f153b674aa7c044d703.tar.gz frameworks_av-739845fdb768402d6ad94f153b674aa7c044d703.tar.bz2 |
libmediaplayerservice: Add new player for DASH
- Add new player factory to support dash playback.
- DASH urls end with .mpd. When media player receives
an url with .mpd, it will use new factory to instantiate the player
to be used for supporting DASH playback.
Change-Id: I69e5a08fb2baf89d97b1e0711dbe52a8b1c39c29
-rw-r--r-- | include/media/MediaPlayerInterface.h | 1 | ||||
-rw-r--r-- | media/libmediaplayerservice/Android.mk | 1 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerFactory.cpp | 25 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index a7570d6..00d53af 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -50,6 +50,7 @@ enum player_type { // The shared library with the test player is passed passed as an // argument to the 'test:' url in the setDataSource call. TEST_PLAYER = 5, + DASH_PLAYER = 6, }; diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index a583d48..1cc21d6 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -35,6 +35,7 @@ LOCAL_SHARED_LIBRARIES := \ libstagefright_omx \ libstagefright_wfd \ libutils \ + libdl \ libvorbisidec \ LOCAL_STATIC_LIBRARIES := \ 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; } |