From 739845fdb768402d6ad94f153b674aa7c044d703 Mon Sep 17 00:00:00 2001 From: Ajit Khare Date: Mon, 7 Jan 2013 23:23:39 -0800 Subject: 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 --- include/media/MediaPlayerInterface.h | 1 + media/libmediaplayerservice/Android.mk | 1 + media/libmediaplayerservice/MediaPlayerFactory.cpp | 25 ++++++++++++++++++++++ 3 files changed, 27 insertions(+) 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 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; } -- cgit v1.1