From 47f59cfe40b0ebb3afd6c39f97dcd1eac2e966f7 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Fri, 7 Aug 2009 09:30:32 -0700 Subject: Build the stagefright library by default. --- cmds/stagefright/Android.mk | 4 -- media/libmediaplayerservice/Android.mk | 50 +++++++++------------- media/libmediaplayerservice/MediaPlayerService.cpp | 50 ++++++---------------- media/libstagefright/Android.mk | 3 -- media/libstagefright/omx/Android.mk | 4 -- 5 files changed, 33 insertions(+), 78 deletions(-) diff --git a/cmds/stagefright/Android.mk b/cmds/stagefright/Android.mk index fd681a2..e6d0503 100644 --- a/cmds/stagefright/Android.mk +++ b/cmds/stagefright/Android.mk @@ -1,5 +1,3 @@ -ifeq ($(BUILD_WITH_STAGEFRIGHT),true) - LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) @@ -62,5 +60,3 @@ include $(BUILD_EXECUTABLE) # LOCAL_MODULE:= play # # include $(BUILD_EXECUTABLE) - -endif diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index f74ef3a..84f858c 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -7,49 +7,41 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - MediaRecorderClient.cpp \ - MediaPlayerService.cpp \ + MediaRecorderClient.cpp \ + MediaPlayerService.cpp \ MetadataRetrieverClient.cpp \ - TestPlayerStub.cpp \ - VorbisPlayer.cpp \ + StagefrightPlayer.cpp \ + TestPlayerStub.cpp \ + VorbisPlayer.cpp \ MidiFile.cpp ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) LOCAL_LDLIBS += -ldl -lpthread endif -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libutils \ - libbinder \ - libvorbisidec \ - libsonivox \ - libopencore_player \ - libopencore_author \ - libmedia \ - libandroid_runtime +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libbinder \ + libvorbisidec \ + libsonivox \ + libopencore_player \ + libopencore_author \ + libmedia \ + libandroid_runtime \ + libstagefright \ + libstagefright_omx ifneq ($(TARGET_SIMULATOR),true) LOCAL_SHARED_LIBRARIES += libdl endif -LOCAL_C_INCLUDES := external/tremor/Tremor \ - $(call include-path-for, graphics corecg) \ - $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include +LOCAL_C_INCLUDES := external/tremor/Tremor \ + $(call include-path-for, graphics corecg) \ + $(TOP)/external/opencore/extern_libs_v2/khronos/openmax/include \ + $(TOP)/frameworks/base/media/libstagefright/omx LOCAL_MODULE:= libmediaplayerservice -ifeq ($(BUILD_WITH_STAGEFRIGHT),true) - LOCAL_SRC_FILES += StagefrightPlayer.cpp - - LOCAL_SHARED_LIBRARIES += \ - libstagefright \ - libstagefright_omx - - LOCAL_C_INCLUDES += $(TOP)/frameworks/base/media/libstagefright/omx - - LOCAL_CFLAGS += -DBUILD_WITH_STAGEFRIGHT -DUSE_STAGEFRIGHT -endif - include $(BUILD_SHARED_LIBRARY) diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 95d61cd..eeb4e49 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -58,20 +58,9 @@ #include "VorbisPlayer.h" #include #include "TestPlayerStub.h" - -//#undef USE_STAGEFRIGHT - -#if USE_STAGEFRIGHT #include "StagefrightPlayer.h" -#endif -#ifdef BUILD_WITH_STAGEFRIGHT #include -#else -#include -#endif - - /* desktop Linux needs a little help with gettid() */ #if defined(HAVE_GETTID) && !defined(HAVE_ANDROID_OS) @@ -199,10 +188,6 @@ typedef struct { const player_type playertype; } extmap; extmap FILE_EXTS [] = { -#if USE_STAGEFRIGHT - {".mp4", STAGEFRIGHT_PLAYER}, - {".3gp", STAGEFRIGHT_PLAYER}, -#endif {".mid", SONIVOX_PLAYER}, {".midi", SONIVOX_PLAYER}, {".smf", SONIVOX_PLAYER}, @@ -289,11 +274,7 @@ sp MediaPlayerService::create(pid_t pid, const sp MediaPlayerService::createOMX() { -#ifdef BUILD_WITH_STAGEFRIGHT return new OMX; -#else - return NULL; -#endif } status_t MediaPlayerService::AudioCache::dump(int fd, const Vector& args) const @@ -620,6 +601,16 @@ void MediaPlayerService::Client::disconnect() IPCThreadState::self()->flushCommands(); } +static player_type getDefaultPlayerType() { + char value[PROPERTY_VALUE_MAX]; + if (property_get("media.stagefright.enable-player", value, NULL) + && (!strcmp(value, "1") || !strcasecmp(value, "true"))) { + return STAGEFRIGHT_PLAYER; + } + + return PV_PLAYER; +} + static player_type getPlayerType(int fd, int64_t offset, int64_t length) { char buf[20]; @@ -650,12 +641,7 @@ static player_type getPlayerType(int fd, int64_t offset, int64_t length) EAS_Shutdown(easdata); } -#if USE_STAGEFRIGHT - return STAGEFRIGHT_PLAYER; -#endif - - // Fall through to PV - return PV_PLAYER; + return getDefaultPlayerType(); } static player_type getPlayerType(const char* url) @@ -676,12 +662,7 @@ static player_type getPlayerType(const char* url) } } -#if USE_STAGEFRIGHT - return STAGEFRIGHT_PLAYER; -#endif - - // Fall through to PV - return PV_PLAYER; + return getDefaultPlayerType(); } static sp createPlayer(player_type playerType, void* cookie, @@ -703,17 +684,10 @@ static sp createPlayer(player_type playerType, void* cookie, LOGV(" create VorbisPlayer"); p = new VorbisPlayer(); break; -#if USE_STAGEFRIGHT case STAGEFRIGHT_PLAYER: LOGV(" create StagefrightPlayer"); p = new StagefrightPlayer; break; -#else - case STAGEFRIGHT_PLAYER: - LOG_ALWAYS_FATAL( - "Should not be here, stagefright player not enabled."); - break; -#endif case TEST_PLAYER: LOGV("Create Test Player stub"); p = new TestPlayerStub(); diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk index 0a44762..00ba1ac 100644 --- a/media/libstagefright/Android.mk +++ b/media/libstagefright/Android.mk @@ -1,5 +1,3 @@ -ifeq ($(BUILD_WITH_STAGEFRIGHT),true) - LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) @@ -54,4 +52,3 @@ LOCAL_MODULE:= libstagefright include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) -endif diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk index 2e564e9..ecd3b2e 100644 --- a/media/libstagefright/omx/Android.mk +++ b/media/libstagefright/omx/Android.mk @@ -1,5 +1,3 @@ -ifeq ($(BUILD_WITH_STAGEFRIGHT),true) - LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) @@ -27,5 +25,3 @@ LOCAL_PRELINK_MODULE:= false LOCAL_MODULE:= libstagefright_omx include $(BUILD_SHARED_LIBRARY) - -endif -- cgit v1.1