Loading include/media/stagefright/HardwareAPI.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define HARDWARE_API_H_ #define HARDWARE_API_H_ #include <media/stagefright/OMXPluginBase.h> #include <media/stagefright/VideoRenderer.h> #include <media/stagefright/VideoRenderer.h> #include <ui/ISurface.h> #include <ui/ISurface.h> #include <utils/RefBase.h> #include <utils/RefBase.h> Loading @@ -31,5 +32,7 @@ extern android::VideoRenderer *createRenderer( size_t displayWidth, size_t displayHeight, size_t displayWidth, size_t displayHeight, size_t decodedWidth, size_t decodedHeight); size_t decodedWidth, size_t decodedHeight); extern android::OMXPluginBase *createOMXPlugin(); #endif // HARDWARE_API_H_ #endif // HARDWARE_API_H_ include/media/stagefright/OMXPluginBase.h 0 → 100644 +51 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OMX_PLUGIN_BASE_H_ #define OMX_PLUGIN_BASE_H_ #include <sys/types.h> #include <OMX_Component.h> namespace android { struct OMXComponentBase; struct OMXPluginBase { OMXPluginBase() {} virtual ~OMXPluginBase() {} virtual OMX_ERRORTYPE makeComponentInstance( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) = 0; virtual OMX_ERRORTYPE enumerateComponents( OMX_STRING name, size_t size, OMX_U32 index) = 0; private: OMXPluginBase(const OMXPluginBase &); OMXPluginBase &operator=(const OMXPluginBase &); }; } // namespace android #endif // OMX_PLUGIN_BASE_H_ media/libstagefright/include/OMX.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ namespace android { namespace android { struct OMXMaster; class OMXNodeInstance; class OMXNodeInstance; class OMX : public BnOMX, class OMX : public BnOMX, Loading Loading @@ -108,9 +109,14 @@ public: void invalidateNodeID(node_id node); void invalidateNodeID(node_id node); protected: virtual ~OMX(); private: private: Mutex mLock; Mutex mLock; OMXMaster *mMaster; struct CallbackDispatcher; struct CallbackDispatcher; sp<CallbackDispatcher> mDispatcher; sp<CallbackDispatcher> mDispatcher; Loading media/libstagefright/omx/Android.mk +24 −5 Original line number Original line Diff line number Diff line Loading @@ -11,16 +11,33 @@ LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) LOCAL_SRC_FILES:= \ LOCAL_SRC_FILES:= \ ColorConverter.cpp \ ColorConverter.cpp \ OMX.cpp \ OMX.cpp \ OMXComponentBase.cpp \ OMXNodeInstance.cpp \ OMXNodeInstance.cpp \ OMXMaster.cpp \ OMXSoftwareCodecsPlugin.cpp \ SoftwareRenderer.cpp SoftwareRenderer.cpp ifneq ($(BUILD_WITHOUT_PV),true) LOCAL_SRC_FILES += \ OMXPVCodecsPlugin.cpp else LOCAL_CFLAGS += -DNO_OPENCORE endif LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \ libbinder \ libbinder \ libmedia \ libmedia \ libutils \ libutils \ libui \ libui \ libcutils \ libcutils ifneq ($(BUILD_WITHOUT_PV),true) LOCAL_SHARED_LIBRARIES += \ libopencore_common libopencore_common endif LOCAL_STATIC_LIBRARIES := \ libstagefright_mp3 ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) LOCAL_LDLIBS += -lpthread -ldl LOCAL_LDLIBS += -lpthread -ldl Loading @@ -35,3 +52,5 @@ LOCAL_PRELINK_MODULE:= false LOCAL_MODULE:= libstagefright_omx LOCAL_MODULE:= libstagefright_omx include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH)) media/libstagefright/omx/OMX.cpp +17 −13 Original line number Original line Diff line number Diff line Loading @@ -18,11 +18,11 @@ #define LOG_TAG "OMX" #define LOG_TAG "OMX" #include <utils/Log.h> #include <utils/Log.h> #include <dlfcn.h> #include "../include/OMX.h" #include "../include/OMX.h" #include "OMXRenderer.h" #include "OMXRenderer.h" #include "pv_omxcore.h" #include "../include/OMXNodeInstance.h" #include "../include/OMXNodeInstance.h" #include "../include/SoftwareRenderer.h" #include "../include/SoftwareRenderer.h" Loading @@ -30,6 +30,8 @@ #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/VideoRenderer.h> #include <media/stagefright/VideoRenderer.h> #include "OMXMaster.h" #include <OMX_Component.h> #include <OMX_Component.h> namespace android { namespace android { Loading Loading @@ -178,10 +180,16 @@ private: }; }; OMX::OMX() OMX::OMX() : mDispatcher(new CallbackDispatcher(this)), : mMaster(new OMXMaster), mDispatcher(new CallbackDispatcher(this)), mNodeCounter(0) { mNodeCounter(0) { } } OMX::~OMX() { delete mMaster; mMaster = NULL; } void OMX::binderDied(const wp<IBinder> &the_late_who) { void OMX::binderDied(const wp<IBinder> &the_late_who) { OMXNodeInstance *instance; OMXNodeInstance *instance; Loading @@ -201,14 +209,12 @@ void OMX::binderDied(const wp<IBinder> &the_late_who) { } } status_t OMX::listNodes(List<String8> *list) { status_t OMX::listNodes(List<String8> *list) { OMX_MasterInit(); // XXX Put this somewhere else. list->clear(); list->clear(); OMX_U32 index = 0; OMX_U32 index = 0; char componentName[256]; char componentName[256]; while (OMX_MasterComponentNameEnum(componentName, sizeof(componentName), index) while (mMaster->enumerateComponents( == OMX_ErrorNone) { componentName, sizeof(componentName), index) == OMX_ErrorNone) { list->push_back(String8(componentName)); list->push_back(String8(componentName)); ++index; ++index; Loading @@ -223,14 +229,12 @@ status_t OMX::allocateNode( *node = 0; *node = 0; OMX_MasterInit(); // XXX Put this somewhere else. OMXNodeInstance *instance = new OMXNodeInstance(this, observer); OMXNodeInstance *instance = new OMXNodeInstance(this, observer); OMX_HANDLETYPE handle; OMX_COMPONENTTYPE *handle; OMX_ERRORTYPE err = OMX_MasterGetHandle( OMX_ERRORTYPE err = mMaster->makeComponentInstance( &handle, const_cast<char *>(name), instance, name, &OMXNodeInstance::kCallbacks, &OMXNodeInstance::kCallbacks); instance, &handle); if (err != OMX_ErrorNone) { if (err != OMX_ErrorNone) { LOGV("FAILED to allocate omx component '%s'", name); LOGV("FAILED to allocate omx component '%s'", name); Loading Loading
include/media/stagefright/HardwareAPI.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ #define HARDWARE_API_H_ #define HARDWARE_API_H_ #include <media/stagefright/OMXPluginBase.h> #include <media/stagefright/VideoRenderer.h> #include <media/stagefright/VideoRenderer.h> #include <ui/ISurface.h> #include <ui/ISurface.h> #include <utils/RefBase.h> #include <utils/RefBase.h> Loading @@ -31,5 +32,7 @@ extern android::VideoRenderer *createRenderer( size_t displayWidth, size_t displayHeight, size_t displayWidth, size_t displayHeight, size_t decodedWidth, size_t decodedHeight); size_t decodedWidth, size_t decodedHeight); extern android::OMXPluginBase *createOMXPlugin(); #endif // HARDWARE_API_H_ #endif // HARDWARE_API_H_
include/media/stagefright/OMXPluginBase.h 0 → 100644 +51 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OMX_PLUGIN_BASE_H_ #define OMX_PLUGIN_BASE_H_ #include <sys/types.h> #include <OMX_Component.h> namespace android { struct OMXComponentBase; struct OMXPluginBase { OMXPluginBase() {} virtual ~OMXPluginBase() {} virtual OMX_ERRORTYPE makeComponentInstance( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) = 0; virtual OMX_ERRORTYPE enumerateComponents( OMX_STRING name, size_t size, OMX_U32 index) = 0; private: OMXPluginBase(const OMXPluginBase &); OMXPluginBase &operator=(const OMXPluginBase &); }; } // namespace android #endif // OMX_PLUGIN_BASE_H_
media/libstagefright/include/OMX.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -23,6 +23,7 @@ namespace android { namespace android { struct OMXMaster; class OMXNodeInstance; class OMXNodeInstance; class OMX : public BnOMX, class OMX : public BnOMX, Loading Loading @@ -108,9 +109,14 @@ public: void invalidateNodeID(node_id node); void invalidateNodeID(node_id node); protected: virtual ~OMX(); private: private: Mutex mLock; Mutex mLock; OMXMaster *mMaster; struct CallbackDispatcher; struct CallbackDispatcher; sp<CallbackDispatcher> mDispatcher; sp<CallbackDispatcher> mDispatcher; Loading
media/libstagefright/omx/Android.mk +24 −5 Original line number Original line Diff line number Diff line Loading @@ -11,16 +11,33 @@ LOCAL_C_INCLUDES += $(JNI_H_INCLUDE) LOCAL_SRC_FILES:= \ LOCAL_SRC_FILES:= \ ColorConverter.cpp \ ColorConverter.cpp \ OMX.cpp \ OMX.cpp \ OMXComponentBase.cpp \ OMXNodeInstance.cpp \ OMXNodeInstance.cpp \ OMXMaster.cpp \ OMXSoftwareCodecsPlugin.cpp \ SoftwareRenderer.cpp SoftwareRenderer.cpp ifneq ($(BUILD_WITHOUT_PV),true) LOCAL_SRC_FILES += \ OMXPVCodecsPlugin.cpp else LOCAL_CFLAGS += -DNO_OPENCORE endif LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \ libbinder \ libbinder \ libmedia \ libmedia \ libutils \ libutils \ libui \ libui \ libcutils \ libcutils ifneq ($(BUILD_WITHOUT_PV),true) LOCAL_SHARED_LIBRARIES += \ libopencore_common libopencore_common endif LOCAL_STATIC_LIBRARIES := \ libstagefright_mp3 ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true) LOCAL_LDLIBS += -lpthread -ldl LOCAL_LDLIBS += -lpthread -ldl Loading @@ -35,3 +52,5 @@ LOCAL_PRELINK_MODULE:= false LOCAL_MODULE:= libstagefright_omx LOCAL_MODULE:= libstagefright_omx include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY) include $(call all-makefiles-under,$(LOCAL_PATH))
media/libstagefright/omx/OMX.cpp +17 −13 Original line number Original line Diff line number Diff line Loading @@ -18,11 +18,11 @@ #define LOG_TAG "OMX" #define LOG_TAG "OMX" #include <utils/Log.h> #include <utils/Log.h> #include <dlfcn.h> #include "../include/OMX.h" #include "../include/OMX.h" #include "OMXRenderer.h" #include "OMXRenderer.h" #include "pv_omxcore.h" #include "../include/OMXNodeInstance.h" #include "../include/OMXNodeInstance.h" #include "../include/SoftwareRenderer.h" #include "../include/SoftwareRenderer.h" Loading @@ -30,6 +30,8 @@ #include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDebug.h> #include <media/stagefright/VideoRenderer.h> #include <media/stagefright/VideoRenderer.h> #include "OMXMaster.h" #include <OMX_Component.h> #include <OMX_Component.h> namespace android { namespace android { Loading Loading @@ -178,10 +180,16 @@ private: }; }; OMX::OMX() OMX::OMX() : mDispatcher(new CallbackDispatcher(this)), : mMaster(new OMXMaster), mDispatcher(new CallbackDispatcher(this)), mNodeCounter(0) { mNodeCounter(0) { } } OMX::~OMX() { delete mMaster; mMaster = NULL; } void OMX::binderDied(const wp<IBinder> &the_late_who) { void OMX::binderDied(const wp<IBinder> &the_late_who) { OMXNodeInstance *instance; OMXNodeInstance *instance; Loading @@ -201,14 +209,12 @@ void OMX::binderDied(const wp<IBinder> &the_late_who) { } } status_t OMX::listNodes(List<String8> *list) { status_t OMX::listNodes(List<String8> *list) { OMX_MasterInit(); // XXX Put this somewhere else. list->clear(); list->clear(); OMX_U32 index = 0; OMX_U32 index = 0; char componentName[256]; char componentName[256]; while (OMX_MasterComponentNameEnum(componentName, sizeof(componentName), index) while (mMaster->enumerateComponents( == OMX_ErrorNone) { componentName, sizeof(componentName), index) == OMX_ErrorNone) { list->push_back(String8(componentName)); list->push_back(String8(componentName)); ++index; ++index; Loading @@ -223,14 +229,12 @@ status_t OMX::allocateNode( *node = 0; *node = 0; OMX_MasterInit(); // XXX Put this somewhere else. OMXNodeInstance *instance = new OMXNodeInstance(this, observer); OMXNodeInstance *instance = new OMXNodeInstance(this, observer); OMX_HANDLETYPE handle; OMX_COMPONENTTYPE *handle; OMX_ERRORTYPE err = OMX_MasterGetHandle( OMX_ERRORTYPE err = mMaster->makeComponentInstance( &handle, const_cast<char *>(name), instance, name, &OMXNodeInstance::kCallbacks, &OMXNodeInstance::kCallbacks); instance, &handle); if (err != OMX_ErrorNone) { if (err != OMX_ErrorNone) { LOGV("FAILED to allocate omx component '%s'", name); LOGV("FAILED to allocate omx component '%s'", name); Loading