diff options
-rw-r--r-- | libopencorehw/Android.mk | 3 | ||||
-rw-r--r-- | libstagefrighthw/Android.mk | 4 | ||||
-rw-r--r-- | libstagefrighthw/TIOMXPlugin.cpp | 83 | ||||
-rw-r--r-- | libstagefrighthw/TIOMXPlugin.h | 62 | ||||
-rw-r--r-- | omx/core_plugin/omx_core_plugin/Android.mk | 3 | ||||
-rw-r--r-- | omx/system/src/openmax_il/omx_core/src/Android.mk | 8 | ||||
-rwxr-xr-x | omx/system/src/openmax_il/omx_core/src/OMX_Core.c | 7 | ||||
-rw-r--r-- | omx/ti_omx_config_parser/Android.mk | 4 | ||||
-rw-r--r-- | omx/video/src/openmax_il/video_decode/src/OMX_VideoDec_Utils.c | 10 |
9 files changed, 174 insertions, 10 deletions
diff --git a/libopencorehw/Android.mk b/libopencorehw/Android.mk index 28cb526..73d4c38 100644 --- a/libopencorehw/Android.mk +++ b/libopencorehw/Android.mk @@ -1,3 +1,5 @@ +ifneq ($(BUILD_WITHOUT_PV),true) + LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) @@ -32,3 +34,4 @@ LOCAL_LDLIBS += include $(BUILD_SHARED_LIBRARY) +endif diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk index 37757c4..235decc 100644 --- a/libstagefrighthw/Android.mk +++ b/libstagefrighthw/Android.mk @@ -3,7 +3,8 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ stagefright_overlay_output.cpp \ - TIHardwareRenderer.cpp + TIHardwareRenderer.cpp \ + TIOMXPlugin.cpp LOCAL_CFLAGS := $(PV_CFLAGS_MINUS_VISIBILITY) @@ -16,6 +17,7 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ libui \ + libdl LOCAL_MODULE := libstagefrighthw diff --git a/libstagefrighthw/TIOMXPlugin.cpp b/libstagefrighthw/TIOMXPlugin.cpp new file mode 100644 index 0000000..bc0f4d7 --- /dev/null +++ b/libstagefrighthw/TIOMXPlugin.cpp @@ -0,0 +1,83 @@ +/* + * 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. + */ + +#include "TIOMXPlugin.h" + +#include <dlfcn.h> + +#include <media/stagefright/HardwareAPI.h> + +namespace android { + +OMXPluginBase *createOMXPlugin() { + return new TIOMXPlugin; +} + +TIOMXPlugin::TIOMXPlugin() + : mLibHandle(dlopen("libOMX_Core.so", RTLD_NOW)), + mInit(NULL), + mDeinit(NULL), + mComponentNameEnum(NULL), + mGetHandle(NULL) { + if (mLibHandle != NULL) { + mInit = (InitFunc)dlsym(mLibHandle, "TIOMX_Init"); + mDeinit = (DeinitFunc)dlsym(mLibHandle, "TIOMX_DeInit"); + + mComponentNameEnum = + (ComponentNameEnumFunc)dlsym(mLibHandle, "TIOMX_ComponentNameEnum"); + + mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "TIOMX_GetHandle"); + + (*mInit)(); + } +} + +TIOMXPlugin::~TIOMXPlugin() { + if (mLibHandle != NULL) { + (*mDeinit)(); + + dlclose(mLibHandle); + mLibHandle = NULL; + } +} + +OMX_ERRORTYPE TIOMXPlugin::makeComponentInstance( + const char *name, + const OMX_CALLBACKTYPE *callbacks, + OMX_PTR appData, + OMX_COMPONENTTYPE **component) { + if (mLibHandle == NULL) { + return OMX_ErrorUndefined; + } + + return (*mGetHandle)( + reinterpret_cast<OMX_HANDLETYPE *>(component), + const_cast<char *>(name), + appData, const_cast<OMX_CALLBACKTYPE *>(callbacks)); +} + +OMX_ERRORTYPE TIOMXPlugin::enumerateComponents( + OMX_STRING name, + size_t size, + OMX_U32 index) { + if (mLibHandle == NULL) { + return OMX_ErrorUndefined; + } + + return (*mComponentNameEnum)(name, size, index); +} + +} // namespace android diff --git a/libstagefrighthw/TIOMXPlugin.h b/libstagefrighthw/TIOMXPlugin.h new file mode 100644 index 0000000..2bd4a80 --- /dev/null +++ b/libstagefrighthw/TIOMXPlugin.h @@ -0,0 +1,62 @@ +/* + * 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 TI_OMX_PLUGIN_H_ + +#define TI_OMX_PLUGIN_H_ + +#include <media/stagefright/OMXPluginBase.h> + +namespace android { + +struct TIOMXPlugin : public OMXPluginBase { + TIOMXPlugin(); + virtual ~TIOMXPlugin(); + + virtual OMX_ERRORTYPE makeComponentInstance( + const char *name, + const OMX_CALLBACKTYPE *callbacks, + OMX_PTR appData, + OMX_COMPONENTTYPE **component); + + virtual OMX_ERRORTYPE enumerateComponents( + OMX_STRING name, + size_t size, + OMX_U32 index); + +private: + void *mLibHandle; + + typedef OMX_ERRORTYPE (*InitFunc)(); + typedef OMX_ERRORTYPE (*DeinitFunc)(); + typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)( + OMX_STRING, OMX_U32, OMX_U32); + + typedef OMX_ERRORTYPE (*GetHandleFunc)( + OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *); + + InitFunc mInit; + DeinitFunc mDeinit; + ComponentNameEnumFunc mComponentNameEnum; + GetHandleFunc mGetHandle; + + TIOMXPlugin(const TIOMXPlugin &); + TIOMXPlugin &operator=(const TIOMXPlugin &); +}; + +} // namespace android + +#endif // TI_OMX_PLUGIN_H_ diff --git a/omx/core_plugin/omx_core_plugin/Android.mk b/omx/core_plugin/omx_core_plugin/Android.mk index ffdff71..222f0cb 100644 --- a/omx/core_plugin/omx_core_plugin/Android.mk +++ b/omx/core_plugin/omx_core_plugin/Android.mk @@ -1,3 +1,5 @@ +ifneq ($(BUILD_WITHOUT_PV),true) + LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_PRELINK_MODULE := false @@ -41,3 +43,4 @@ LOCAL_SHARED_LIBRARIES := libOMX_Core include $(BUILD_SHARED_LIBRARY) +endif diff --git a/omx/system/src/openmax_il/omx_core/src/Android.mk b/omx/system/src/openmax_il/omx_core/src/Android.mk index 9c162b4..f0c6acf 100644 --- a/omx/system/src/openmax_il/omx_core/src/Android.mk +++ b/omx/system/src/openmax_il/omx_core/src/Android.mk @@ -13,11 +13,17 @@ LOCAL_C_INCLUDES += \ LOCAL_SHARED_LIBRARIES := \ libdl \ - libVendor_ti_omx_config_parser \ liblog LOCAL_CFLAGS := $(TI_OMX_CFLAGS) +ifneq ($(BUILD_WITHOUT_PV),true) +LOCAL_SHARED_LIBRARIES += \ + libVendor_ti_omx_config_parser +else +LOCAL_CFLAGS += -DNO_OPENCORE +endif + LOCAL_MODULE:= libOMX_Core include $(BUILD_SHARED_LIBRARY) diff --git a/omx/system/src/openmax_il/omx_core/src/OMX_Core.c b/omx/system/src/openmax_il/omx_core/src/OMX_Core.c index f6176e9..19dca20 100755 --- a/omx/system/src/openmax_il/omx_core/src/OMX_Core.c +++ b/omx/system/src/openmax_il/omx_core/src/OMX_Core.c @@ -20,8 +20,10 @@ #include "OMX_Core.h" #include "OMX_ComponentRegistry.h" +#ifndef NO_OPENCORE /** determine capabilities of a component before acually using it */ #include "ti_omx_config_parser.h" +#endif /** size for the array of allocated components. Sets the maximum * number of components that can be allocated at once */ @@ -167,7 +169,6 @@ OMX_ERRORTYPE TIOMX_GetHandle( OMX_HANDLETYPE* pHandle, OMX_STRING cComponentNam OMX_ERRORTYPE (*pComponentInit)(OMX_HANDLETYPE*); OMX_ERRORTYPE err = OMX_ErrorNone; OMX_COMPONENTTYPE *componentType; - const char* pErr = dlerror(); if(pthread_mutex_lock(&mutex) != 0) { @@ -246,7 +247,7 @@ OMX_ERRORTYPE TIOMX_GetHandle( OMX_HANDLETYPE* pHandle, OMX_STRING cComponentNam /* Get a function pointer to the "OMX_ComponentInit" function. If * there is an error, we can't go on, so set the error code and exit */ pComponentInit = dlsym(pModules[i], "OMX_ComponentInit"); - if( (pErr != NULL) || (pComponentInit == NULL) ) { + if( pComponentInit == NULL ) { LOGE("%d:: dlsym failed for module %p\n", __LINE__, pModules[i]); err = OMX_ErrorInvalidComponent; goto CLEAN_UP; @@ -757,6 +758,8 @@ OMX_BOOL TIOMXConfigParserRedirect( { OMX_BOOL Status = OMX_FALSE; +#ifndef NO_OPENCORE Status = TIOMXConfigParser(aInputParameters, aOutputParameters); +#endif return Status; } diff --git a/omx/ti_omx_config_parser/Android.mk b/omx/ti_omx_config_parser/Android.mk index 5c8ace8..c6a0021 100644 --- a/omx/ti_omx_config_parser/Android.mk +++ b/omx/ti_omx_config_parser/Android.mk @@ -1,3 +1,5 @@ +ifneq ($(BUILD_WITHOUT_PV),true) + LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) $(call add-prebuilt-files, ETC) @@ -54,3 +56,5 @@ LOCAL_C_INCLUDES := \ LOCAL_SHARED_LIBRARIES += libopencore_common include $(BUILD_SHARED_LIBRARY) + +endif diff --git a/omx/video/src/openmax_il/video_decode/src/OMX_VideoDec_Utils.c b/omx/video/src/openmax_il/video_decode/src/OMX_VideoDec_Utils.c index 5e339e0..1dfd91e 100644 --- a/omx/video/src/openmax_il/video_decode/src/OMX_VideoDec_Utils.c +++ b/omx/video/src/openmax_il/video_decode/src/OMX_VideoDec_Utils.c @@ -2326,7 +2326,6 @@ OMX_ERRORTYPE VIDDEC_HandleCommand (OMX_HANDLETYPE phandle, OMX_U32 nParam1) #else void* pMyLCML; VIDDEC_fpo fpGetHandle; - char* error; #endif OMX_PRINT1(pComponentPrivate->dbg, "+++ENTERING\n"); @@ -2424,9 +2423,9 @@ OMX_ERRORTYPE VIDDEC_HandleCommand (OMX_HANDLETYPE phandle, OMX_U32 nParam1) goto EXIT; } fpGetHandle = dlsym(pMyLCML, "GetHandle"); - if ((error = dlerror()) != NULL) { + if (!fpGetHandle) { OMX_PRDSP4(pComponentPrivate->dbg, "OMX_ErrorBadParameter\n"); - fputs(error, stderr); + fputs(dlerror(), stderr); dlclose(pMyLCML); pMyLCML = NULL; eError = OMX_ErrorBadParameter; @@ -8352,7 +8351,6 @@ OMX_ERRORTYPE VIDDEC_LoadCodec(VIDDEC_COMPONENT_PRIVATE* pComponentPrivate) LPFNDLLFUNC1 fpGetHandle1; #else VIDDEC_fpo fpGetHandle; - char* error; #endif #ifndef UNDER_CE @@ -8364,9 +8362,9 @@ OMX_ERRORTYPE VIDDEC_LoadCodec(VIDDEC_COMPONENT_PRIVATE* pComponentPrivate) goto EXIT; } fpGetHandle = dlsym(pComponentPrivate->pModLCML, "GetHandle"); - if ((error = dlerror()) != NULL) { + if (!fpGetHandle) { OMX_PRDSP4(pComponentPrivate->dbg, "OMX_ErrorBadParameter\n"); - fputs(error, stderr); + fputs(dlerror(), stderr); dlclose(pComponentPrivate->pModLCML); pComponentPrivate->pModLCML = NULL; eError = OMX_ErrorBadParameter; |