Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 739845fd authored by Ajit Khare's avatar Ajit Khare Committed by Steve Kondik
Browse files

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
parent 520ba656
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,
};


+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ LOCAL_SHARED_LIBRARIES := \
    libstagefright_omx          \
    libstagefright_wfd          \
    libutils                    \
    libdl                       \
    libvorbisidec               \

LOCAL_STATIC_LIBRARIES :=       \
+25 −0
Original line number Diff line number Diff line
@@ -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;
}