diff options
Diffstat (limited to 'media/libmediaplayerservice/MediaPlayerFactory.cpp')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerFactory.cpp | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerFactory.cpp b/media/libmediaplayerservice/MediaPlayerFactory.cpp index 90aed39..3e0fc0d 100644 --- a/media/libmediaplayerservice/MediaPlayerFactory.cpp +++ b/media/libmediaplayerservice/MediaPlayerFactory.cpp @@ -60,14 +60,20 @@ status_t MediaPlayerFactory::registerFactory_l(IFactory* factory, return OK; } -player_type MediaPlayerFactory::getDefaultPlayerType() { +static player_type getDefaultPlayerType() { char value[PROPERTY_VALUE_MAX]; - if (property_get("media.stagefright.use-nuplayer", value, NULL) + if (property_get("media.stagefright.use-awesome", value, NULL) && (!strcmp("1", value) || !strcasecmp("true", value))) { - return NU_PLAYER; + return STAGEFRIGHT_PLAYER; } - return STAGEFRIGHT_PLAYER; + // TODO: remove this EXPERIMENTAL developer settings property + if (property_get("persist.sys.media.use-awesome", value, NULL) + && !strcasecmp("true", value)) { + return STAGEFRIGHT_PLAYER; + } + + return NU_PLAYER; } status_t MediaPlayerFactory::registerFactory(IFactory* factory, @@ -170,21 +176,24 @@ sp<MediaPlayerBase> MediaPlayerFactory::createPlayer( class StagefrightPlayerFactory : public MediaPlayerFactory::IFactory { public: - virtual float scoreFactory(const sp<IMediaPlayer>& client, + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, int fd, int64_t offset, - int64_t length, - float curScore) { - char buf[20]; - lseek(fd, offset, SEEK_SET); - read(fd, buf, sizeof(buf)); - lseek(fd, offset, SEEK_SET); - - long ident = *((long*)buf); - - // Ogg vorbis? - if (ident == 0x5367674f) // 'OggS' - return 1.0; + int64_t /*length*/, + float /*curScore*/) { + if (getDefaultPlayerType() + == STAGEFRIGHT_PLAYER) { + char buf[20]; + lseek(fd, offset, SEEK_SET); + read(fd, buf, sizeof(buf)); + lseek(fd, offset, SEEK_SET); + + uint32_t ident = *((uint32_t*)buf); + + // Ogg vorbis? + if (ident == 0x5367674f) // 'OggS' + return 1.0; + } return 0.0; } @@ -197,7 +206,7 @@ class StagefrightPlayerFactory : class NuPlayerFactory : public MediaPlayerFactory::IFactory { public: - virtual float scoreFactory(const sp<IMediaPlayer>& client, + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, const char* url, float curScore) { static const float kOurScore = 0.8; @@ -229,9 +238,9 @@ class NuPlayerFactory : public MediaPlayerFactory::IFactory { return 0.0; } - virtual float scoreFactory(const sp<IMediaPlayer>& client, - const sp<IStreamSource> &source, - float curScore) { + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, + const sp<IStreamSource>& /*source*/, + float /*curScore*/) { return 1.0; } @@ -243,7 +252,7 @@ class NuPlayerFactory : public MediaPlayerFactory::IFactory { class SonivoxPlayerFactory : public MediaPlayerFactory::IFactory { public: - virtual float scoreFactory(const sp<IMediaPlayer>& client, + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, const char* url, float curScore) { static const float kOurScore = 0.4; @@ -274,7 +283,7 @@ class SonivoxPlayerFactory : public MediaPlayerFactory::IFactory { return 0.0; } - virtual float scoreFactory(const sp<IMediaPlayer>& client, + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, int fd, int64_t offset, int64_t length, @@ -312,9 +321,9 @@ class SonivoxPlayerFactory : public MediaPlayerFactory::IFactory { class TestPlayerFactory : public MediaPlayerFactory::IFactory { public: - virtual float scoreFactory(const sp<IMediaPlayer>& client, + virtual float scoreFactory(const sp<IMediaPlayer>& /*client*/, const char* url, - float curScore) { + float /*curScore*/) { if (TestPlayerStub::canBeUsed(url)) { return 1.0; } |