From e8775bc8c5f730bd24b16908f4a7425354f5cfe1 Mon Sep 17 00:00:00 2001 From: Stricted Date: Fri, 17 Jan 2025 05:43:10 +0100 Subject: [PATCH] openmax: remove unused audio codecs nothing is using them and with the follow up blueprint conversion these are not compilable without substantial amount of work Change-Id: If94f42a0901fabd90c37b88dd1afda96d18dc519 --- openmax/Android.mk | 26 - openmax/component/audio/common/Android.mk | 36 - .../audio/common/Exynos_OMX_ABasecomponent.c | 1727 ----------------- .../audio/common/Exynos_OMX_ABasecomponent.h | 158 -- .../audio/common/Exynos_OMX_ABaseport.c | 992 ---------- .../audio/common/Exynos_OMX_ABaseport.h | 157 -- openmax/component/audio/common/NOTICE | 190 -- openmax/component/audio/dec/Android.mk | 31 - openmax/component/audio/dec/Exynos_OMX_Adec.c | 1538 --------------- openmax/component/audio/dec/Exynos_OMX_Adec.h | 144 -- openmax/component/audio/dec/NOTICE | 190 -- openmax/component/audio/dec/mp3/Android.mk | 41 - .../audio/dec/mp3/Exynos_OMX_Mp3dec.c | 938 --------- .../audio/dec/mp3/Exynos_OMX_Mp3dec.h | 63 - openmax/component/audio/dec/mp3/NOTICE | 190 -- .../audio/dec/mp3/library_register.c | 58 - .../audio/dec/mp3/library_register.h | 54 - openmax/component/audio/dec/wma/Android.mk | 34 - .../audio/dec/wma/Exynos_OMX_Wmadec.c | 750 ------- .../audio/dec/wma/Exynos_OMX_Wmadec.h | 68 - openmax/component/audio/dec/wma/NOTICE | 190 -- .../audio/dec/wma/library_register.c | 57 - .../audio/dec/wma/library_register.h | 53 - openmax/component/audio/seiren_dec/Android.mk | 29 - .../audio/seiren_dec/Exynos_OMX_Adec.c | 1537 --------------- .../audio/seiren_dec/Exynos_OMX_Adec.h | 143 -- openmax/component/audio/seiren_dec/NOTICE | 190 -- .../component/audio/seiren_dec/aac/Android.mk | 41 - .../audio/seiren_dec/aac/Exynos_OMX_Aacdec.c | 970 --------- .../audio/seiren_dec/aac/Exynos_OMX_Aacdec.h | 72 - openmax/component/audio/seiren_dec/aac/NOTICE | 190 -- .../audio/seiren_dec/aac/library_register.c | 58 - .../audio/seiren_dec/aac/library_register.h | 54 - .../audio/seiren_dec/flac/Android.mk | 41 - .../seiren_dec/flac/Exynos_OMX_Flacdec.c | 946 --------- .../seiren_dec/flac/Exynos_OMX_Flacdec.h | 77 - .../component/audio/seiren_dec/flac/NOTICE | 190 -- .../audio/seiren_dec/flac/library_register.c | 58 - .../audio/seiren_dec/flac/library_register.h | 54 - .../component/audio/seiren_dec/mp3/Android.mk | 41 - .../audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.c | 955 --------- .../audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.h | 74 - openmax/component/audio/seiren_dec/mp3/NOTICE | 190 -- .../audio/seiren_dec/mp3/library_register.c | 67 - .../audio/seiren_dec/mp3/library_register.h | 60 - 45 files changed, 13722 deletions(-) delete mode 100644 openmax/component/audio/common/Android.mk delete mode 100644 openmax/component/audio/common/Exynos_OMX_ABasecomponent.c delete mode 100644 openmax/component/audio/common/Exynos_OMX_ABasecomponent.h delete mode 100644 openmax/component/audio/common/Exynos_OMX_ABaseport.c delete mode 100644 openmax/component/audio/common/Exynos_OMX_ABaseport.h delete mode 100644 openmax/component/audio/common/NOTICE delete mode 100644 openmax/component/audio/dec/Android.mk delete mode 100644 openmax/component/audio/dec/Exynos_OMX_Adec.c delete mode 100644 openmax/component/audio/dec/Exynos_OMX_Adec.h delete mode 100644 openmax/component/audio/dec/NOTICE delete mode 100644 openmax/component/audio/dec/mp3/Android.mk delete mode 100644 openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c delete mode 100644 openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h delete mode 100644 openmax/component/audio/dec/mp3/NOTICE delete mode 100644 openmax/component/audio/dec/mp3/library_register.c delete mode 100644 openmax/component/audio/dec/mp3/library_register.h delete mode 100644 openmax/component/audio/dec/wma/Android.mk delete mode 100644 openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c delete mode 100644 openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h delete mode 100644 openmax/component/audio/dec/wma/NOTICE delete mode 100644 openmax/component/audio/dec/wma/library_register.c delete mode 100644 openmax/component/audio/dec/wma/library_register.h delete mode 100644 openmax/component/audio/seiren_dec/Android.mk delete mode 100644 openmax/component/audio/seiren_dec/Exynos_OMX_Adec.c delete mode 100644 openmax/component/audio/seiren_dec/Exynos_OMX_Adec.h delete mode 100644 openmax/component/audio/seiren_dec/NOTICE delete mode 100644 openmax/component/audio/seiren_dec/aac/Android.mk delete mode 100644 openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.c delete mode 100644 openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.h delete mode 100644 openmax/component/audio/seiren_dec/aac/NOTICE delete mode 100644 openmax/component/audio/seiren_dec/aac/library_register.c delete mode 100644 openmax/component/audio/seiren_dec/aac/library_register.h delete mode 100644 openmax/component/audio/seiren_dec/flac/Android.mk delete mode 100644 openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.c delete mode 100644 openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.h delete mode 100644 openmax/component/audio/seiren_dec/flac/NOTICE delete mode 100644 openmax/component/audio/seiren_dec/flac/library_register.c delete mode 100644 openmax/component/audio/seiren_dec/flac/library_register.h delete mode 100644 openmax/component/audio/seiren_dec/mp3/Android.mk delete mode 100644 openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.c delete mode 100644 openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.h delete mode 100644 openmax/component/audio/seiren_dec/mp3/NOTICE delete mode 100644 openmax/component/audio/seiren_dec/mp3/library_register.c delete mode 100644 openmax/component/audio/seiren_dec/mp3/library_register.h diff --git a/openmax/Android.mk b/openmax/Android.mk index a90f254..7d3a465 100644 --- a/openmax/Android.mk +++ b/openmax/Android.mk @@ -22,15 +22,6 @@ EXYNOS_OMX_COMPONENT := $(EXYNOS_OMX_TOP)/component EXYNOS_VIDEO_CODEC := \ $(EXYNOS_OMX_TOP)/../videocodec -ifeq ($(BOARD_USE_ALP_AUDIO), true) - ifeq ($(BOARD_USE_SEIREN_AUDIO), true) - EXYNOS_AUDIO_CODEC += \ - hardware/samsung_slsi-linaro/exynos/libseiren - else - EXYNOS_AUDIO_CODEC += \ - hardware/samsung_slsi-linaro/exynos/libsrp - endif -endif include $(EXYNOS_OMX_TOP)/osal/Android.mk include $(EXYNOS_OMX_TOP)/core/Android.mk @@ -62,20 +53,3 @@ ifeq ($(BOARD_USE_WFDENC_SUPPORT), true) include $(EXYNOS_OMX_COMPONENT)/video/enc/h264wfd/Android.mk include $(EXYNOS_OMX_COMPONENT)/video/enc/hevcwfd/Android.mk endif - -ifeq ($(BOARD_USE_ALP_AUDIO), true) - include $(EXYNOS_OMX_COMPONENT)/audio/common/Android.mk - ifeq ($(BOARD_USE_SEIREN_AUDIO), true) - include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/Android.mk - include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/mp3/Android.mk - include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/aac/Android.mk - include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/flac/Android.mk - else - include $(EXYNOS_OMX_COMPONENT)/audio/dec/Android.mk - include $(EXYNOS_OMX_COMPONENT)/audio/dec/mp3/Android.mk - endif -endif - -ifeq ($(BOARD_USE_WMA_CODEC), true) -include $(EXYNOS_OMX_COMPONENT)/audio/dec/wma/Android.mk -endif diff --git a/openmax/component/audio/common/Android.mk b/openmax/component/audio/common/Android.mk deleted file mode 100644 index 60dadb4..0000000 --- a/openmax/component/audio/common/Android.mk +++ /dev/null @@ -1,36 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_ABasecomponent.c \ - Exynos_OMX_ABaseport.c - -LOCAL_MODULE := libExynosOMX_ABasecomponent -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_STATIC_LIBRARIES := libExynosOMX_OSAL -LOCAL_SHARED_LIBRARIES := libcutils libutils - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -LOCAL_CFLAGS += -DUSE_ANDROID -endif -endif - -ifeq ($(EXYNOS_OMX_SUPPORT_EGL_IMAGE), true) -LOCAL_CFLAGS += -DEGL_IMAGE_SUPPORT -endif - -include $(BUILD_STATIC_LIBRARY) diff --git a/openmax/component/audio/common/Exynos_OMX_ABasecomponent.c b/openmax/component/audio/common/Exynos_OMX_ABasecomponent.c deleted file mode 100644 index d3d64a8..0000000 --- a/openmax/component/audio/common/Exynos_OMX_ABasecomponent.c +++ /dev/null @@ -1,1727 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_ABasecomponent.c - * @brief - * @author SeungBeom Kim (sbcrux.kim@samsung.com) - * Yunji Kim (yunji.kim@samsung.com) - * @version 2.0.0 - * @history - * 2012.02.20 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Event.h" -#include "Exynos_OSAL_Thread.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Mutex.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_Resourcemanager.h" -#include "Exynos_OMX_Macros.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_ABASE_COMP" -//#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -static OMX_ERRORTYPE Exynos_SetPortFlush(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam); -static OMX_ERRORTYPE Exynos_SetPortEnable(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam); -static OMX_ERRORTYPE Exynos_SetPortDisable(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam); - -/* Change CHECK_SIZE_VERSION Macro */ -OMX_ERRORTYPE Exynos_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_VERSIONTYPE *version = NULL; - - if (header == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - version = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32)); - if (*((OMX_U32*)header) != size) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - Exynos_OSAL_Log(EXYNOS_LOG_FUNC_TRACE, "[%s] nVersionMajor:%d, nVersionMinor:%d", __FUNCTION__, version->s.nVersionMajor, version->s.nVersionMinor); - - if ((version->s.nVersionMajor != VERSIONMAJOR_NUMBER) || - (version->s.nVersionMinor > VERSIONMINOR_NUMBER)) { - ret = OMX_ErrorVersionMismatch; - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetComponentVersion( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_STRING pComponentName, - OMX_OUT OMX_VERSIONTYPE *pComponentVersion, - OMX_OUT OMX_VERSIONTYPE *pSpecVersion, - OMX_OUT OMX_UUIDTYPE *pComponentUUID) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - unsigned long compUUID[3]; - - FunctionIn(); - - /* check parameters */ - if (hComponent == NULL || - pComponentName == NULL || pComponentVersion == NULL || - pSpecVersion == NULL || pComponentUUID == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy(pComponentName, pExynosComponent->componentName); - Exynos_OSAL_Memcpy(pComponentVersion, &(pExynosComponent->componentVersion), sizeof(OMX_VERSIONTYPE)); - Exynos_OSAL_Memcpy(pSpecVersion, &(pExynosComponent->specVersion), sizeof(OMX_VERSIONTYPE)); - - /* Fill UUID with handle address, PID and UID. - * This should guarantee uiniqness */ - compUUID[0] = (unsigned long)pOMXComponent; - compUUID[1] = (unsigned long)getpid(); - compUUID[2] = (unsigned long)getuid(); - Exynos_OSAL_Memcpy(*pComponentUUID, compUUID, 3 * sizeof(*compUUID)); - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetState ( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_STATETYPE *pState) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pState == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - *pState = pExynosComponent->currentState; - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentStateSet(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 messageParam) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_MESSAGE *message; - OMX_STATETYPE destState = messageParam; - OMX_STATETYPE currentState = pExynosComponent->currentState; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - unsigned int i = 0, j = 0; - int k = 0; - - FunctionIn(); - - /* check parameters */ - if (currentState == destState) { - ret = OMX_ErrorSameState; - goto EXIT; - } - if (currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] current:(%s) dest:(%s)", pExynosComponent, __FUNCTION__, stateString(currentState), stateString(destState)); - switch (destState) { - case OMX_StateInvalid: - switch (currentState) { - case OMX_StateWaitForResources: - Exynos_OMX_Out_WaitForResource(pOMXComponent); - case OMX_StateIdle: - case OMX_StateExecuting: - case OMX_StatePause: - case OMX_StateLoaded: - pExynosComponent->currentState = OMX_StateInvalid; - ret = pExynosComponent->exynos_BufferProcessTerminate(pOMXComponent); - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex); - pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex = NULL; - - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].hPortMutex); - pExynosComponent->pExynosPort[i].hPortMutex = NULL; - } - - Exynos_OSAL_SignalTerminate(pExynosComponent->pauseEvent); - pExynosComponent->pauseEvent = NULL; - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_SemaphoreTerminate(pExynosComponent->pExynosPort[i].bufferSemID); - pExynosComponent->pExynosPort[i].bufferSemID = NULL; - } - - if (currentState != OMX_StateLoaded) - pExynosComponent->exynos_codec_componentTerminate(pOMXComponent); - - Exynos_OSAL_SignalSet(pExynosComponent->abendStateEvent); - - ret = OMX_ErrorInvalidState; - break; - default: - ret = OMX_ErrorInvalidState; - break; - } - break; - case OMX_StateLoaded: - switch (currentState) { - case OMX_StateIdle: - for(i = 0; i < pExynosComponent->portParam.nPorts; i++) - pExynosComponent->pExynosPort[i].portState = EXYNOS_OMX_PortStateDisabling; - - ret = pExynosComponent->exynos_BufferProcessTerminate(pOMXComponent); - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex); - pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex = NULL; - - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].hPortMutex); - pExynosComponent->pExynosPort[i].hPortMutex = NULL; - } - - Exynos_OSAL_SignalTerminate(pExynosComponent->pauseEvent); - pExynosComponent->pauseEvent = NULL; - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_SemaphoreTerminate(pExynosComponent->pExynosPort[i].bufferSemID); - pExynosComponent->pExynosPort[i].bufferSemID = NULL; - } - - pExynosComponent->exynos_codec_componentTerminate(pOMXComponent); - - for (i = 0; i < (pExynosComponent->portParam.nPorts); i++) { - pExynosPort = (pExynosComponent->pExynosPort + i); -#ifdef TUNNELING_SUPPORT - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message != NULL) - Exynos_OSAL_Free(message); - } - ret = pExynosComponent->exynos_FreeTunnelBuffer(pExynosPort, i); - if (OMX_ErrorNone != ret) { - goto EXIT; - } - } else -#endif - { - if (CHECK_PORT_ENABLED(pExynosPort)) { - if (pExynosPort->assignedBufferNum > 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for unloadedResource", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphoreWait(pExynosPort->unloadedResource); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] unloadedResource about %s port is posted", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - } - - while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message != NULL) - Exynos_OSAL_Free(message); - } - - Exynos_OSAL_Set_SemaphoreCount(pExynosPort->unloadedResource, 0); - } - } - - if (pExynosComponent->abendState != OMX_TRUE) - pExynosPort->portState = EXYNOS_OMX_PortStateLoaded; - } - - /* this signal will be handled by invalid state handling - if (pExynosComponent->abendState == OMX_TRUE) { - Exynos_OSAL_SignalSet(pExynosComponent->abendStateEvent); - goto EXIT; - } - */ - - pExynosComponent->transientState = EXYNOS_OMX_TransStateMax; - pExynosComponent->currentState = OMX_StateLoaded; - break; - case OMX_StateWaitForResources: - ret = Exynos_OMX_Out_WaitForResource(pOMXComponent); - pExynosComponent->currentState = OMX_StateLoaded; - break; - case OMX_StateExecuting: - case OMX_StatePause: - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - break; - case OMX_StateIdle: - switch (currentState) { - case OMX_StateLoaded: - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &(pExynosComponent->pExynosPort[i]); - - pExynosPort->portState = EXYNOS_OMX_PortStateEnabling; - -#ifdef TUNNELING_SUPPORT - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - if (CHECK_PORT_ENABLED(pExynosPort)) { - ret = pExynosComponent->exynos_AllocateTunnelBuffer(pExynosPort, i); - if (ret!=OMX_ErrorNone) - goto EXIT; - } - } else -#endif - { - if (CHECK_PORT_ENABLED(pExynosPort)) { - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for loadedResource", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphoreWait(pExynosComponent->pExynosPort[i].loadedResource); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] loadedResource about %s port is posted", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - - Exynos_OSAL_Set_SemaphoreCount(pExynosPort->loadedResource, 0); - } - } - - if (pExynosComponent->abendState != OMX_TRUE) - pExynosPort->portState = EXYNOS_OMX_PortStateIdle; - } - - if (pExynosComponent->abendState == OMX_TRUE) { - Exynos_OSAL_SignalSet(pExynosComponent->abendStateEvent); - goto EXIT; - } - - Exynos_OSAL_Get_Log_Property(); // For debuging, Function called when GetHandle function is success - ret = pExynosComponent->exynos_codec_componentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { -#ifdef TUNNELING_SUPPORT - /* - * if (CHECK_PORT_TUNNELED == OMX_TRUE) thenTunnel Buffer Free - */ -#endif - Exynos_OSAL_SignalSet(pExynosComponent->abendStateEvent); - goto EXIT; - } - - Exynos_OSAL_SignalCreate(&pExynosComponent->pauseEvent); - - for (i = 0; i < ALL_PORT_NUM; i++) { - ret = Exynos_OSAL_SemaphoreCreate(&pExynosComponent->pExynosPort[i].bufferSemID); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x)", pExynosComponent, __FUNCTION__, ret); - goto EXIT; - } - } - for (i = 0; i < ALL_PORT_NUM; i++) { - ret = Exynos_OSAL_MutexCreate(&pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to MutexCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - - ret = Exynos_OSAL_MutexCreate(&pExynosComponent->pExynosPort[i].hPortMutex); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to MutexCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - } - - ret = pExynosComponent->exynos_BufferProcessCreate(pOMXComponent); - if (ret != OMX_ErrorNone) { -#ifdef TUNNELING_SUPPORT - /* - * if (CHECK_PORT_TUNNELED == OMX_TRUE) thenTunnel Buffer Free - */ -#endif - Exynos_OSAL_SignalTerminate(pExynosComponent->pauseEvent); - pExynosComponent->pauseEvent = NULL; - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex); - pExynosComponent->pExynosPort[i].dataBuffer.bufferMutex = NULL; - - Exynos_OSAL_MutexTerminate(pExynosComponent->pExynosPort[i].hPortMutex); - pExynosComponent->pExynosPort[i].hPortMutex = NULL; - } - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_SemaphoreTerminate(pExynosComponent->pExynosPort[i].bufferSemID); - pExynosComponent->pExynosPort[i].bufferSemID = NULL; - } - - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - - pExynosComponent->transientState = EXYNOS_OMX_TransStateMax; - pExynosComponent->currentState = OMX_StateIdle; - break; - case OMX_StateExecuting: - Exynos_SetPortFlush(pExynosComponent, ALL_PORT_INDEX); - Exynos_OMX_BufferFlushProcess(pOMXComponent, ALL_PORT_INDEX, OMX_FALSE); - pExynosComponent->transientState = EXYNOS_OMX_TransStateMax; - pExynosComponent->currentState = OMX_StateIdle; - break; - case OMX_StatePause: - Exynos_SetPortFlush(pExynosComponent, ALL_PORT_INDEX); - Exynos_OMX_BufferFlushProcess(pOMXComponent, ALL_PORT_INDEX, OMX_FALSE); - pExynosComponent->currentState = OMX_StateIdle; - break; - case OMX_StateWaitForResources: - pExynosComponent->currentState = OMX_StateIdle; - break; - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - break; - case OMX_StateExecuting: - switch (currentState) { - case OMX_StateLoaded: - ret = OMX_ErrorIncorrectStateTransition; - break; - case OMX_StateIdle: - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort) && CHECK_PORT_ENABLED(pExynosPort)) { - for (j = 0; j < pExynosPort->tunnelBufferNum; j++) { - Exynos_OSAL_SemaphorePost(pExynosComponent->pExynosPort[i].bufferSemID); - } - } - } - - pExynosComponent->transientState = EXYNOS_OMX_TransStateMax; - pExynosComponent->currentState = OMX_StateExecuting; - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - break; - case OMX_StatePause: - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort) && CHECK_PORT_ENABLED(pExynosPort)) { - OMX_S32 semaValue = 0, cnt = 0; - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[i].bufferSemID, &semaValue); - if (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > semaValue) { - cnt = Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) - semaValue; - for (k = 0; k < cnt; k++) { - Exynos_OSAL_SemaphorePost(pExynosComponent->pExynosPort[i].bufferSemID); - } - } - } - } - - pExynosComponent->currentState = OMX_StateExecuting; - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - break; - case OMX_StateWaitForResources: - ret = OMX_ErrorIncorrectStateTransition; - break; - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - break; - case OMX_StatePause: - switch (currentState) { - case OMX_StateLoaded: - ret = OMX_ErrorIncorrectStateTransition; - break; - case OMX_StateIdle: - pExynosComponent->currentState = OMX_StatePause; - break; - case OMX_StateExecuting: - pExynosComponent->currentState = OMX_StatePause; - break; - case OMX_StateWaitForResources: - ret = OMX_ErrorIncorrectStateTransition; - break; - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - break; - case OMX_StateWaitForResources: - switch (currentState) { - case OMX_StateLoaded: - ret = Exynos_OMX_In_WaitForResource(pOMXComponent); - pExynosComponent->currentState = OMX_StateWaitForResources; - break; - case OMX_StateIdle: - case OMX_StateExecuting: - case OMX_StatePause: - ret = OMX_ErrorIncorrectStateTransition; - break; - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - break; - default: - ret = OMX_ErrorIncorrectStateTransition; - break; - } - -EXIT: - if (ret == OMX_ErrorNone) { - if (pExynosComponent->pCallbacks != NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] OMX_EventCmdComplete", pExynosComponent, __FUNCTION__); - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventCmdComplete, OMX_CommandStateSet, - destState, NULL); - } - } else { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret); - if (pExynosComponent->pCallbacks != NULL) { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } - FunctionOut(); - - return ret; -} - -static OMX_ERRORTYPE Exynos_OMX_MessageHandlerThread(OMX_PTR threadData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - OMX_U32 messageType = 0, portIndex = 0; - - FunctionIn(); - - if (threadData == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)threadData; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - while (pExynosComponent->bExitMessageHandlerThread == OMX_FALSE) { - Exynos_OSAL_SemaphoreWait(pExynosComponent->msgSemaphoreHandle); - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosComponent->messageQ); - if (message != NULL) { - messageType = message->messageType; - switch (messageType) { - case OMX_CommandStateSet: - ret = Exynos_OMX_ComponentStateSet(pOMXComponent, message->messageParam); - break; - case OMX_CommandFlush: - Exynos_SetPortFlush(pExynosComponent, message->messageParam); - ret = Exynos_OMX_BufferFlushProcess(pOMXComponent, message->messageParam, OMX_TRUE); - break; - case OMX_CommandPortDisable: - Exynos_SetPortDisable(pExynosComponent, message->messageParam); - ret = Exynos_OMX_PortDisableProcess(pOMXComponent, message->messageParam); - break; - case OMX_CommandPortEnable: - Exynos_SetPortEnable(pExynosComponent, message->messageParam); - ret = Exynos_OMX_PortEnableProcess(pOMXComponent, message->messageParam); - break; - case OMX_CommandMarkBuffer: - portIndex = message->messageParam; - pExynosComponent->pExynosPort[portIndex].markType.hMarkTargetComponent = ((OMX_MARKTYPE *)message->pCmdData)->hMarkTargetComponent; - pExynosComponent->pExynosPort[portIndex].markType.pMarkData = ((OMX_MARKTYPE *)message->pCmdData)->pMarkData; - break; - case (OMX_COMMANDTYPE)EXYNOS_OMX_CommandComponentDeInit: - pExynosComponent->bExitMessageHandlerThread = OMX_TRUE; - break; - default: - break; - } - Exynos_OSAL_Free(message); - message = NULL; - } - } - - Exynos_OSAL_ThreadExit(NULL); - -EXIT: - FunctionOut(); - - return ret; -} - -static OMX_ERRORTYPE Exynos_SetPortFlush(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_S32 nPortIndex = nParam; - - OMX_U16 i = 0, cnt = 0, index = 0; - - - if ((pExynosComponent->currentState == OMX_StateExecuting) || - (pExynosComponent->currentState == OMX_StatePause)) { - if ((nPortIndex != ALL_PORT_INDEX) && - ((OMX_S32)nPortIndex >= (OMX_S32)pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (nPortIndex == ALL_PORT_INDEX) { - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - if (!CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateFlushing; - } - } else { - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (!CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateFlushing; - } - } else { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - return ret; -} - -static OMX_ERRORTYPE Exynos_SetPortEnable(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_S32 nPortIndex = nParam; - - OMX_U16 i = 0; - - FunctionIn(); - - if ((nPortIndex != ALL_PORT_INDEX) && - ((OMX_S32)nPortIndex >= (OMX_S32)pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (nPortIndex == ALL_PORT_INDEX) { - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - if (CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateEnabling; - } - } else { - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateEnabling; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; - -} - -static OMX_ERRORTYPE Exynos_SetPortDisable(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_S32 nPortIndex = nParam; - - OMX_U16 i = 0; - - FunctionIn(); - - if ((nPortIndex != ALL_PORT_INDEX) && - ((OMX_S32)nPortIndex >= (OMX_S32)pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (nPortIndex == ALL_PORT_INDEX) { - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - if (!CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateDisabling; - } - } else { - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (!CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort->portState = EXYNOS_OMX_PortStateDisabling; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -static OMX_ERRORTYPE Exynos_SetMarkBuffer(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - if (nParam >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if ((pExynosComponent->currentState == OMX_StateExecuting) || - (pExynosComponent->currentState == OMX_StatePause)) { - ret = OMX_ErrorNone; - } else { - ret = OMX_ErrorIncorrectStateOperation; - } - -EXIT: - return ret; -} - -static OMX_ERRORTYPE Exynos_StateSet(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nParam) -{ - OMX_U32 destState = nParam; - OMX_U32 i = 0; - - if ((destState == OMX_StateIdle) && (pExynosComponent->currentState == OMX_StateLoaded)) { - pExynosComponent->transientState = EXYNOS_OMX_TransStateLoadedToIdle; - - for(i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosComponent->pExynosPort[i].portState = EXYNOS_OMX_PortStateEnabling; - } - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] OMX_StateLoaded to OMX_StateIdle", pExynosComponent, __FUNCTION__); - } else if ((destState == OMX_StateLoaded) && (pExynosComponent->currentState == OMX_StateIdle)) { - pExynosComponent->transientState = EXYNOS_OMX_TransStateIdleToLoaded; - - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosComponent->pExynosPort[i].portState = EXYNOS_OMX_PortStateDisabling; - } - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] OMX_StateIdle to OMX_StateLoaded", pExynosComponent, __FUNCTION__); - } else if ((destState == OMX_StateIdle) && (pExynosComponent->currentState == OMX_StateExecuting)) { - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - pExynosComponent->transientState = EXYNOS_OMX_TransStateExecutingToIdle; - - pExynosPort = &(pExynosComponent->pExynosPort[INPUT_PORT_INDEX]); - if ((pExynosPort->portDefinition.bEnabled == OMX_FALSE) && - (pExynosPort->portState == EXYNOS_OMX_PortStateEnabling)) { - pExynosPort->exceptionFlag = INVALID_STATE; - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - } - - pExynosPort = &(pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]); - if ((pExynosPort->portDefinition.bEnabled == OMX_FALSE) && - (pExynosPort->portState == EXYNOS_OMX_PortStateEnabling)) { - pExynosPort->exceptionFlag = INVALID_STATE; - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - } - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] OMX_StateExecuting to OMX_StateIdle", pExynosComponent, __FUNCTION__); - } else if ((destState == OMX_StateIdle) && (pExynosComponent->currentState == OMX_StatePause)) { - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] OMX_StatePause to OMX_StateIdle", pExynosComponent, __FUNCTION__); - } else if ((destState == OMX_StateExecuting) && (pExynosComponent->currentState == OMX_StateIdle)) { - pExynosComponent->transientState = EXYNOS_OMX_TransStateIdleToExecuting; - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] OMX_StateIdle to OMX_StateExecuting", pExynosComponent, __FUNCTION__); - } else if (destState == OMX_StateInvalid) { - for (i = 0; i < pExynosComponent->portParam.nPorts; i++) { - pExynosComponent->pExynosPort[i].portState = EXYNOS_OMX_PortStateInvalid; - } - } - - return OMX_ErrorNone; -} - -static OMX_ERRORTYPE Exynos_OMX_CommandQueue( - EXYNOS_OMX_BASECOMPONENT *pExynosComponent, - OMX_COMMANDTYPE Cmd, - OMX_U32 nParam, - OMX_PTR pCmdData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_MESSAGE *command = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_MESSAGE)); - - if (command == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - command->messageType = (OMX_U32)Cmd; - command->messageParam = nParam; - command->pCmdData = pCmdData; - - ret = Exynos_OSAL_Queue(&pExynosComponent->messageQ, (void *)command); - if (ret != 0) { - ret = OMX_ErrorUndefined; - goto EXIT; - } - ret = Exynos_OSAL_SemaphorePost(pExynosComponent->msgSemaphoreHandle); - -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_SendCommand( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_COMMANDTYPE Cmd, - OMX_IN OMX_U32 nParam, - OMX_IN OMX_PTR pCmdData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (Cmd) { - case OMX_CommandStateSet : - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Command: OMX_CommandStateSet", pExynosComponent, __FUNCTION__); - Exynos_StateSet(pExynosComponent, nParam); - break; - case OMX_CommandFlush : - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Command: OMX_CommandFlush", pExynosComponent, __FUNCTION__); - ret = Exynos_SetPortFlush(pExynosComponent, nParam); - if (ret != OMX_ErrorNone) - goto EXIT; - break; - case OMX_CommandPortDisable : - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Command: OMX_CommandPortDisable", pExynosComponent, __FUNCTION__); - ret = Exynos_SetPortDisable(pExynosComponent, nParam); - if (ret != OMX_ErrorNone) - goto EXIT; - break; - case OMX_CommandPortEnable : - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Command: OMX_CommandPortEnable", pExynosComponent, __FUNCTION__); - ret = Exynos_SetPortEnable(pExynosComponent, nParam); - if (ret != OMX_ErrorNone) - goto EXIT; - break; - case OMX_CommandMarkBuffer : - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Command: OMX_CommandMarkBuffer", pExynosComponent, __FUNCTION__); - ret = Exynos_SetMarkBuffer(pExynosComponent, nParam); - if (ret != OMX_ErrorNone) - goto EXIT; - break; - default: - break; - } - - ret = Exynos_OMX_CommandQueue(pExynosComponent, Cmd, nParam, pCmdData); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioInit: - case OMX_IndexParamVideoInit: - case OMX_IndexParamImageInit: - case OMX_IndexParamOtherInit: - { - OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure; - ret = Exynos_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - portParam->nPorts = 0; - portParam->nStartPortNumber = 0; - } - break; - case OMX_IndexParamPortDefinition: - { - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portDefinition->nPortIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - /* except nSize, nVersion and nPortIndex */ - int nOffset = sizeof(OMX_U32) + sizeof(OMX_VERSIONTYPE) + sizeof(OMX_U32); - - if (portIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - Exynos_OSAL_Memcpy(((char *)portDefinition) + nOffset, - ((char *)&pExynosPort->portDefinition) + nOffset, - portDefinition->nSize - nOffset); - } - break; - case OMX_IndexParamPriorityMgmt: - { - OMX_PRIORITYMGMTTYPE *compPriority = (OMX_PRIORITYMGMTTYPE *)ComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(compPriority, sizeof(OMX_PRIORITYMGMTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - compPriority->nGroupID = pExynosComponent->compPriority.nGroupID; - compPriority->nGroupPriority = pExynosComponent->compPriority.nGroupPriority; - } - break; - - case OMX_IndexParamCompBufferSupplier: - { - OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = bufferSupplier->nPortIndex; - EXYNOS_OMX_BASEPORT *pExynosPort; - - if ((pExynosComponent->currentState == OMX_StateLoaded) || - (pExynosComponent->currentState == OMX_StateWaitForResources)) { - if (portIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(bufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - - - if (pExynosPort->portDefinition.eDir == OMX_DirInput) { - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyInput; - } else if (CHECK_PORT_TUNNELED(pExynosPort)) { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput; - } else { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified; - } - } else { - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput; - } else if (CHECK_PORT_TUNNELED(pExynosPort)) { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyInput; - } else { - bufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified; - } - } - } - else - { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - } - break; - default: - { - ret = OMX_ErrorUnsupportedIndex; - goto EXIT; - } - break; - } - - ret = OMX_ErrorNone; - -EXIT: - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioInit: - case OMX_IndexParamVideoInit: - case OMX_IndexParamImageInit: - case OMX_IndexParamOtherInit: - { - OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure; - ret = Exynos_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateLoaded) && - (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - /* ret = OMX_ErrorUndefined; */ - /* Exynos_OSAL_Memcpy(&pExynosComponent->portParam, portParam, sizeof(OMX_PORT_PARAM_TYPE)); */ - } - break; - case OMX_IndexParamPortDefinition: - { - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portDefinition->nPortIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - /* except nSize, nVersion and nPortIndex */ - int nOffset = sizeof(OMX_U32) + sizeof(OMX_VERSIONTYPE) + sizeof(OMX_U32); - - if (portIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(portDefinition, sizeof(OMX_PARAM_PORTDEFINITIONTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - if (pExynosPort->portDefinition.bEnabled == OMX_TRUE) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - } - if (portDefinition->nBufferCountActual < pExynosPort->portDefinition.nBufferCountMin) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - Exynos_OSAL_Memcpy(((char *)&pExynosPort->portDefinition) + nOffset, - ((char *)portDefinition) + nOffset, - portDefinition->nSize - nOffset); - } - break; - case OMX_IndexParamPriorityMgmt: - { - OMX_PRIORITYMGMTTYPE *compPriority = (OMX_PRIORITYMGMTTYPE *)ComponentParameterStructure; - - if ((pExynosComponent->currentState != OMX_StateLoaded) && - (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - ret = Exynos_OMX_Check_SizeVersion(compPriority, sizeof(OMX_PRIORITYMGMTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosComponent->compPriority.nGroupID = compPriority->nGroupID; - pExynosComponent->compPriority.nGroupPriority = compPriority->nGroupPriority; - } - break; - case OMX_IndexParamCompBufferSupplier: - { - OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = bufferSupplier->nPortIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - - if (portIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(bufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - if (pExynosPort->portDefinition.bEnabled == OMX_TRUE) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - } - - if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) { - ret = OMX_ErrorNone; - goto EXIT; - } - if (CHECK_PORT_TUNNELED(pExynosPort) == 0) { - ret = OMX_ErrorNone; /*OMX_ErrorNone ?????*/ - goto EXIT; - } - - if (pExynosPort->portDefinition.eDir == OMX_DirInput) { - if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) { - /* - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorNone; - } - */ - pExynosPort->tunnelFlags |= EXYNOS_TUNNEL_IS_SUPPLIER; - bufferSupplier->nPortIndex = pExynosPort->tunneledPort; - ret = OMX_SetParameter(pExynosPort->tunneledComponent, OMX_IndexParamCompBufferSupplier, bufferSupplier); - goto EXIT; - } else if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) { - ret = OMX_ErrorNone; - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - pExynosPort->tunnelFlags &= ~EXYNOS_TUNNEL_IS_SUPPLIER; - bufferSupplier->nPortIndex = pExynosPort->tunneledPort; - ret = OMX_SetParameter(pExynosPort->tunneledComponent, OMX_IndexParamCompBufferSupplier, bufferSupplier); - } - goto EXIT; - } - } else if (pExynosPort->portDefinition.eDir == OMX_DirOutput) { - if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) { - ret = OMX_ErrorNone; - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - pExynosPort->tunnelFlags &= ~EXYNOS_TUNNEL_IS_SUPPLIER; - ret = OMX_ErrorNone; - } - goto EXIT; - } else if (bufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) { - /* - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorNone; - } - */ - pExynosPort->tunnelFlags |= EXYNOS_TUNNEL_IS_SUPPLIER; - ret = OMX_ErrorNone; - goto EXIT; - } - } - } - break; - default: - { - ret = OMX_ErrorUnsupportedIndex; - goto EXIT; - } - break; - } - - ret = OMX_ErrorNone; - -EXIT: - - FunctionOut(); - - return ret; -} - -OMX_PTR Exynos_OMX_MakeDynamicConfigCMD( - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure) -{ - OMX_PTR ret = NULL; - OMX_S32 nConfigStructureSize = 0; - - switch ((int)nIndex) { - case OMX_IndexConfigVideoIntraPeriod: - { - nConfigStructureSize = sizeof(OMX_U32); - ret = Exynos_OSAL_Malloc(sizeof(OMX_U32) + nConfigStructureSize); - } - break; - case OMX_IndexConfigVideoRoiInfo: - { - EXYNOS_OMX_VIDEO_CONFIG_ROIINFO *pRoiInfo = (EXYNOS_OMX_VIDEO_CONFIG_ROIINFO *)pComponentConfigStructure; - OMX_S32 nRoiMBInfoSize = 0; - nConfigStructureSize = *(OMX_U32 *)pComponentConfigStructure; - if (pRoiInfo->bUseRoiInfo == OMX_TRUE) - nRoiMBInfoSize = pRoiInfo->nRoiMBInfoSize; - ret = Exynos_OSAL_Malloc(sizeof(OMX_U32) + nConfigStructureSize + nRoiMBInfoSize); - if (ret != NULL) - Exynos_OSAL_Memcpy((OMX_PTR)((OMX_U8 *)ret + sizeof(OMX_U32) + nConfigStructureSize), pRoiInfo->pRoiMBInfo, nRoiMBInfoSize); - } - break; - default: - nConfigStructureSize = *(OMX_U32 *)pComponentConfigStructure; - ret = Exynos_OSAL_Malloc(sizeof(OMX_U32) + nConfigStructureSize); - break; - } - - if (ret != NULL) { - *((OMX_S32 *)ret) = (OMX_S32)nIndex; - Exynos_OSAL_Memcpy((OMX_PTR)((OMX_U8 *)ret + sizeof(OMX_U32)), pComponentConfigStructure, nConfigStructureSize); - } - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_INOUT OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = OMX_ErrorUnsupportedIndex; - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = OMX_ErrorUnsupportedIndex; - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = OMX_ErrorBadParameter; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_SetCallbacks ( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_CALLBACKTYPE* pCallbacks, - OMX_IN OMX_PTR pAppData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pCallbacks == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - if (pExynosComponent->currentState != OMX_StateLoaded) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosComponent->pCallbacks = pCallbacks; - pExynosComponent->callbackData = pAppData; - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -#ifdef EGL_IMAGE_SUPPORT -OMX_ERRORTYPE Exynos_OMX_UseEGLImage( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN void *eglImage) -{ - return OMX_ErrorNotImplemented; -} -#endif - -void Exynos_OMX_Component_abnormalTermination( - OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - int i = 0; - - FunctionIn(); - - if (hComponent == NULL) - goto EXIT; - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - - if (pOMXComponent->pComponentPrivate == NULL) - goto EXIT; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - /* clear a msg command piled on queue */ - while(Exynos_OSAL_GetElemNum(&pExynosComponent->messageQ) > 0) - Exynos_OSAL_Free(Exynos_OSAL_Dequeue(&pExynosComponent->messageQ)); - - pExynosComponent->abendState = OMX_TRUE; - - /* post semaphore for msg handler thread, if it is waiting */ - for (i = 0; i < ALL_PORT_NUM; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - - if ((pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle) || - (pExynosPort->portState == EXYNOS_OMX_PortStateInvalid) || - (pExynosPort->portState == EXYNOS_OMX_PortStateEnabling)) { // enabling exception - pExynosComponent->abendState = OMX_TRUE; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%p][%s] post loadedResource about %s port", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - } - - if ((pExynosComponent->transientState == EXYNOS_OMX_TransStateIdleToLoaded) || - (pExynosPort->portState == EXYNOS_OMX_PortStateInvalid) || - (pExynosPort->portState == EXYNOS_OMX_PortStateFlushingForDisable) || - (pExynosPort->portState == EXYNOS_OMX_PortStateDisabling)) { // disabling exception - pExynosComponent->abendState = OMX_TRUE; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%p][%s] post unloadedResource about %s port", - pExynosComponent, __FUNCTION__, - (i == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphorePost(pExynosPort->unloadedResource); - } - } - - /* change to invalid state except for Loaded state */ - if (pExynosComponent->transientState != EXYNOS_OMX_TransStateLoadedToIdle) - Exynos_OMX_SendCommand(hComponent, OMX_CommandStateSet, OMX_StateInvalid, NULL); - - /* wait for state change or LoaedToIdle handling */ - Exynos_OSAL_SignalWait(pExynosComponent->abendStateEvent, 1000); - Exynos_OSAL_SignalReset(pExynosComponent->abendStateEvent); - -EXIT: - FunctionOut(); - - return; -} - -OMX_ERRORTYPE Exynos_OMX_BaseComponent_Constructor( - OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%s] lib version is %s", __FUNCTION__, IS_64BIT_OS? "64bit":"32bit"); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] OMX_ErrorBadParameter (0x%x)", __FUNCTION__, ret); - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BASECOMPONENT)); - if (pExynosComponent == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] Failed to Malloc (0x%x)", __FUNCTION__, ret); - goto EXIT; - } - Exynos_OSAL_Memset(pExynosComponent, 0, sizeof(EXYNOS_OMX_BASECOMPONENT)); - pOMXComponent->pComponentPrivate = (OMX_PTR)pExynosComponent; - - ret = Exynos_OSAL_SemaphoreCreate(&pExynosComponent->msgSemaphoreHandle); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x)", pExynosComponent, __FUNCTION__, ret); - goto EXIT; - } - ret = Exynos_OSAL_MutexCreate(&pExynosComponent->compMutex); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to MutexCreate (0x%x)", pExynosComponent, __FUNCTION__, ret); - goto EXIT; - } - ret = Exynos_OSAL_SignalCreate(&pExynosComponent->abendStateEvent); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SignalCreate (0x%x)", pExynosComponent, __FUNCTION__, ret); - goto EXIT; - } - - pExynosComponent->bExitMessageHandlerThread = OMX_FALSE; - Exynos_OSAL_QueueCreate(&pExynosComponent->messageQ, MAX_QUEUE_ELEMENTS); - ret = Exynos_OSAL_ThreadCreate(&pExynosComponent->hMessageHandler, Exynos_OMX_MessageHandlerThread, pOMXComponent); - if (ret != OMX_ErrorNone) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to ThreadCreate (0x%x)", pExynosComponent, __FUNCTION__, ret); - goto EXIT; - } - - pOMXComponent->GetComponentVersion = &Exynos_OMX_GetComponentVersion; - pOMXComponent->SendCommand = &Exynos_OMX_SendCommand; - pOMXComponent->GetState = &Exynos_OMX_GetState; - pOMXComponent->SetCallbacks = &Exynos_OMX_SetCallbacks; - -#ifdef EGL_IMAGE_SUPPORT - pOMXComponent->UseEGLImage = &Exynos_OMX_UseEGLImage; -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BaseComponent_Destructor( - OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 semaValue = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - Exynos_OMX_CommandQueue(pExynosComponent, (OMX_COMMANDTYPE)EXYNOS_OMX_CommandComponentDeInit, 0, NULL); - Exynos_OSAL_SleepMillisec(0); - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->msgSemaphoreHandle, &semaValue); - if (semaValue == 0) - Exynos_OSAL_SemaphorePost(pExynosComponent->msgSemaphoreHandle); - Exynos_OSAL_SemaphorePost(pExynosComponent->msgSemaphoreHandle); - - Exynos_OSAL_ThreadTerminate(pExynosComponent->hMessageHandler); - pExynosComponent->hMessageHandler = NULL; - - Exynos_OSAL_SignalTerminate(pExynosComponent->abendStateEvent); - pExynosComponent->abendStateEvent = NULL; - Exynos_OSAL_MutexTerminate(pExynosComponent->compMutex); - pExynosComponent->compMutex = NULL; - Exynos_OSAL_SemaphoreTerminate(pExynosComponent->msgSemaphoreHandle); - pExynosComponent->msgSemaphoreHandle = NULL; - Exynos_OSAL_QueueTerminate(&pExynosComponent->messageQ); - - Exynos_OSAL_Free(pExynosComponent); - pExynosComponent = NULL; - - ret = OMX_ErrorNone; -EXIT: - FunctionOut(); - - return ret; -} - - diff --git a/openmax/component/audio/common/Exynos_OMX_ABasecomponent.h b/openmax/component/audio/common/Exynos_OMX_ABasecomponent.h deleted file mode 100644 index b714095..0000000 --- a/openmax/component/audio/common/Exynos_OMX_ABasecomponent.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_ABasecomponent.h - * @brief - * @author SeungBeom Kim (sbcrux.kim@samsung.com) - * Yunji Kim (yunji.kim@samsung.com) - * @version 2.0.0 - * @history - * 2012.02.20 : Create - */ - -#ifndef EXYNOS_OMX_ABASECOMP -#define EXYNOS_OMX_ABASECOMP - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OSAL_Queue.h" -#include "Exynos_OMX_ABaseport.h" - - -typedef struct _EXYNOS_OMX_MESSAGE -{ - OMX_U32 messageType; - OMX_U32 messageParam; - OMX_PTR pCmdData; -} EXYNOS_OMX_MESSAGE; - -/* for Check TimeStamp after Seek */ -typedef struct _EXYNOS_OMX_TIMESTAMP -{ - OMX_BOOL needSetStartTimeStamp; - OMX_BOOL needCheckStartTimeStamp; - OMX_TICKS startTimeStamp; - OMX_U32 nStartFlags; -} EXYNOS_OMX_TIMESTAMP; - -typedef struct _EXYNOS_OMX_BASECOMPONENT -{ - OMX_STRING componentName; - OMX_VERSIONTYPE componentVersion; - OMX_VERSIONTYPE specVersion; - - OMX_STATETYPE currentState; - EXYNOS_OMX_TRANS_STATETYPE transientState; - OMX_BOOL abendState; - OMX_HANDLETYPE abendStateEvent; - - EXYNOS_CODEC_TYPE codecType; - EXYNOS_OMX_PRIORITYMGMTTYPE compPriority; - OMX_MARKTYPE propagateMarkType; - OMX_HANDLETYPE compMutex; - - OMX_HANDLETYPE hComponentHandle; - - /* Message Handler */ - OMX_BOOL bExitMessageHandlerThread; - OMX_HANDLETYPE hMessageHandler; - OMX_HANDLETYPE msgSemaphoreHandle; - EXYNOS_QUEUE messageQ; - - /* Port */ - OMX_PORT_PARAM_TYPE portParam; - EXYNOS_OMX_BASEPORT *pExynosPort; - - OMX_HANDLETYPE pauseEvent; - - /* Callback function */ - OMX_CALLBACKTYPE *pCallbacks; - OMX_PTR callbackData; - - /* Save Timestamp */ - OMX_TICKS timeStamp[MAX_TIMESTAMP]; - EXYNOS_OMX_TIMESTAMP checkTimeStamp; - - /* Save Flags */ - OMX_U32 nFlags[MAX_FLAGS]; - - OMX_BOOL getAllDelayBuffer; - OMX_BOOL reInputData; - - OMX_BOOL bUseFlagEOF; - OMX_BOOL bSaveFlagEOS; /* bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming. */ - OMX_BOOL bBehaviorEOS; /* bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming. */ - - OMX_ERRORTYPE (*exynos_codec_componentInit)(OMX_COMPONENTTYPE *pOMXComponent); - OMX_ERRORTYPE (*exynos_codec_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent); - -#ifdef TUNNELING_SUPPORT - OMX_ERRORTYPE (*exynos_AllocateTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex); - OMX_ERRORTYPE (*exynos_FreeTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex); -#endif - - OMX_ERRORTYPE (*exynos_BufferProcessCreate)(OMX_HANDLETYPE pOMXComponent); - OMX_ERRORTYPE (*exynos_BufferProcessTerminate)(OMX_HANDLETYPE pOMXComponent); - OMX_ERRORTYPE (*exynos_BufferFlush)(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent); -} EXYNOS_OMX_BASECOMPONENT; - -OMX_ERRORTYPE Exynos_OMX_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure); - -OMX_ERRORTYPE Exynos_OMX_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure); - -OMX_PTR Exynos_OMX_MakeDynamicConfigCMD( - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure); - -OMX_ERRORTYPE Exynos_OMX_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_INOUT OMX_PTR pComponentConfigStructure); - -OMX_ERRORTYPE Exynos_OMX_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure); - -OMX_ERRORTYPE Exynos_OMX_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType); - -void Exynos_OMX_Component_abnormalTermination(OMX_IN OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_BaseComponent_Constructor(OMX_IN OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_BaseComponent_Destructor(OMX_IN OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -extern "C" { -#endif - - OMX_ERRORTYPE Exynos_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size); - - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/openmax/component/audio/common/Exynos_OMX_ABaseport.c b/openmax/component/audio/common/Exynos_OMX_ABaseport.c deleted file mode 100644 index 7c4ed9a..0000000 --- a/openmax/component/audio/common/Exynos_OMX_ABaseport.c +++ /dev/null @@ -1,992 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_ABaseport.c - * @brief - * @author SeungBeom Kim (sbcrux.kim@samsung.com) - * HyeYeon Chung (hyeon.chung@samsung.com) - * @version 2.0.0 - * @history - * 2012.02.20 : Create - */ - -#include -#include -#include - -#include "Exynos_OMX_Macros.h" -#include "Exynos_OSAL_Event.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Mutex.h" -#include "Exynos_OSAL_Memory.h" - -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_ABasecomponent.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_ABASE_PORT" -//#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -#ifdef PERFORMANCE_DEBUG -#include "Exynos_OSAL_ETC.h" -#endif - -#include "Exynos_OSAL_Platform.h" - - -OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - OMX_U32 i = 0; - OMX_BOOL bBufferFind = OMX_FALSE; - - Exynos_OSAL_MutexLock(pExynosPort->hPortMutex); - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (bufferHeader == pExynosPort->extendBufferHeader[i].OMXBufferHeader) { - if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_TRUE) { - pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_FALSE; - bBufferFind = OMX_TRUE; - break; - } else { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] Trying to return the input buffer without ownership!!", pExynosComponent, __FUNCTION__); - } - } - } - - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - - if ((bBufferFind == OMX_TRUE) && - (bufferHeader != NULL) && - (bufferHeader->pBuffer != NULL)) { - pExynosComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pExynosComponent->callbackData, bufferHeader); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader: %p", pExynosComponent, __FUNCTION__, bufferHeader); - } - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - OMX_U32 i = 0; - OMX_BOOL bBufferFind = OMX_FALSE; - Exynos_OSAL_MutexLock(pExynosPort->hPortMutex); - for (i = 0; i < MAX_BUFFER_NUM; i++) { - if (bufferHeader == pExynosPort->extendBufferHeader[i].OMXBufferHeader) { - if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_TRUE) { - bBufferFind = OMX_TRUE; - pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_FALSE; - break; - } else { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] Trying to return the output buffer without ownership!!", pExynosComponent, __FUNCTION__); - } - } - } - - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - - if ((bBufferFind == OMX_TRUE) && - (bufferHeader != NULL) && - (bufferHeader->pBuffer != NULL)) { - pExynosComponent->pCallbacks->FillBufferDone(pOMXComponent, pExynosComponent->callbackData, bufferHeader); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader: %p", pExynosComponent, __FUNCTION__, bufferHeader); - } - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess( - OMX_COMPONENTTYPE *pOMXComponent, - OMX_S32 nPortIndex, - OMX_BOOL bEvent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 nIndex = 0; - - OMX_U32 i = 0, cnt = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - cnt = (nPortIndex == ALL_PORT_INDEX) ? ALL_PORT_NUM : 1; - for (i = 0; i < cnt; i++) { - if (nPortIndex == ALL_PORT_INDEX) - nIndex = i; - else - nIndex = nPortIndex; - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Flush %s Port", pExynosComponent, __FUNCTION__, - (nIndex == INPUT_PORT_INDEX)? "input":"output"); - ret = pExynosComponent->exynos_BufferFlush(pOMXComponent, nIndex, bEvent); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is flushed", pExynosComponent, __FUNCTION__, - (nIndex == INPUT_PORT_INDEX)? "input":"output"); - if (ret == OMX_ErrorNone) { - pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateIdle; - - if (bEvent == OMX_TRUE) { - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Flush/%s port)", - pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventCmdComplete, - OMX_CommandFlush, nIndex, NULL); - } - } - } - -EXIT: - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret); - if ((pOMXComponent != NULL) && - (pExynosComponent != NULL)) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, - ret, 0, NULL); - } - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_EnablePort( - OMX_COMPONENTTYPE *pOMXComponent, - OMX_S32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - OMX_U32 i = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - - if ((pExynosComponent->currentState != OMX_StateLoaded) && - (pExynosComponent->currentState != OMX_StateWaitForResources)) { - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for loadedResource", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphoreWait(pExynosPort->loadedResource); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] loadedResource about %s port is posted", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - - if (!CHECK_PORT_POPULATED(pExynosPort)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] buffer allocation on %s port is not completed (%d/%d)", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output", - pExynosPort->assignedBufferNum, pExynosPort->portDefinition.nBufferCountActual); - } - - if (pExynosPort->exceptionFlag == INVALID_STATE) { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%p][%s] %s port is in the INVALID_STATE", pExynosComponent, __FUNCTION__, - (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosPort->exceptionFlag = NEED_PORT_DISABLE; - goto EXIT; - } - - if (pExynosComponent->abendState == OMX_TRUE) { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] component is abendstate. semaphore on port(%d) is posted", pExynosComponent, __FUNCTION__, nPortIndex); - pExynosPort->exceptionFlag = NEED_PORT_DISABLE; - ret = OMX_ErrorUndefined; - goto EXIT; - } - } - - pExynosPort->exceptionFlag = GENERAL_STATE; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_PortEnableProcess( - OMX_COMPONENTTYPE *pOMXComponent, - OMX_S32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 nIndex = 0; - - OMX_U32 i = 0, cnt = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - cnt = (nPortIndex == ALL_PORT_INDEX) ? ALL_PORT_NUM : 1; - for (i = 0; i < cnt; i++) { - if (nPortIndex == ALL_PORT_INDEX) - nIndex = i; - else - nIndex = nPortIndex; - - Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Enable %s Port", pExynosComponent, __FUNCTION__, - (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - ret = Exynos_OMX_EnablePort(pOMXComponent, nIndex); - if (ret == OMX_ErrorNone) { - if (CHECK_PORT_ENABLED((&pExynosComponent->pExynosPort[nIndex]))) - pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateIdle; - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Enable/%s port)", - pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventCmdComplete, - OMX_CommandPortEnable, nIndex, NULL); - } - } - -EXIT: - if ((ret != OMX_ErrorNone) && - (pOMXComponent != NULL) && - (pExynosComponent != NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret); - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, - ret, 0, NULL); - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_DisablePort( - OMX_COMPONENTTYPE *pOMXComponent, - OMX_S32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - - if (!CHECK_PORT_ENABLED(pExynosPort)) { - ret = OMX_ErrorNone; - goto EXIT; - } - - if (pExynosComponent->currentState != OMX_StateLoaded) { - if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) { - message = (EXYNOS_OMX_MESSAGE*)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - Exynos_OSAL_Free(message); - } - } - - if (pExynosPort->exceptionFlag == NEED_PORT_DISABLE) - pExynosPort->exceptionFlag = GENERAL_STATE; - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for unloadedResource", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - Exynos_OSAL_SemaphoreWait(pExynosPort->unloadedResource); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] unloadedResource about %s port is posted", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output"); - - if (pExynosPort->assignedBufferNum > 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] buffer free on %s port is not completed (%d/%d)", - pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output", - pExynosPort->assignedBufferNum, pExynosPort->portDefinition.nBufferCountActual); - } - - if (pExynosComponent->abendState == OMX_TRUE) { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] component is abendstate. semaphore on port(%d) is posted", pExynosComponent, __FUNCTION__, nPortIndex); - pExynosPort->exceptionFlag = NEED_PORT_DISABLE; - ret = OMX_ErrorUndefined; - goto EXIT; - } - } - - pExynosPort->portDefinition.bEnabled = OMX_FALSE; - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_PortDisableProcess( - OMX_COMPONENTTYPE *pOMXComponent, - OMX_S32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 nIndex = 0; - - OMX_U32 i = 0, cnt = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - cnt = (nPortIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1; - - if ((pExynosComponent->currentState == OMX_StateExecuting) || - (pExynosComponent->currentState == OMX_StatePause)) { - /* port flush*/ - for(i = 0; i < cnt; i++) { - if (nPortIndex == ALL_PORT_INDEX) - nIndex = i; - else - nIndex = nPortIndex; - - Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Before disabling %s port, do flush", - pExynosComponent, __FUNCTION__, - (nIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateFlushingForDisable; - ret = pExynosComponent->exynos_BufferFlush(pOMXComponent, nIndex, OMX_FALSE); - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s Port is flushed", pExynosComponent, __FUNCTION__, - (nIndex == INPUT_PORT_INDEX)? "input":"output"); - if (ret != OMX_ErrorNone) - goto EXIT; - } - } - - for(i = 0; i < cnt; i++) { - if (nPortIndex == ALL_PORT_INDEX) - nIndex = i; - else - nIndex = nPortIndex; - - Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Disable %s Port", - pExynosComponent, __FUNCTION__, - (nIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateDisabling; - ret = Exynos_OMX_DisablePort(pOMXComponent, nIndex); - if (ret == OMX_ErrorNone) { - if (!CHECK_PORT_ENABLED((&pExynosComponent->pExynosPort[nIndex]))) - pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateLoaded; - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Disable/%s port)", - pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output"); - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventCmdComplete, - OMX_CommandPortDisable, nIndex, NULL); - } - } - -EXIT: - if ((ret != OMX_ErrorNone) && - (pOMXComponent != NULL) && - (pExynosComponent != NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret); - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, - ret, 0, NULL); - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_EmptyThisBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - OMX_U32 i = 0; - OMX_BOOL bFindBuffer = OMX_FALSE; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (pBuffer == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pBuffer->nInputPortIndex != INPUT_PORT_INDEX) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - ret = Exynos_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateIdle) && - (pExynosComponent->currentState != OMX_StateExecuting) && - (pExynosComponent->currentState != OMX_StatePause)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - if ((!CHECK_PORT_ENABLED(pExynosPort)) || - (CHECK_PORT_BEING_FLUSHED(pExynosPort) && - (!CHECK_PORT_TUNNELED(pExynosPort) || !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort))) || - ((pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle) && - (CHECK_PORT_TUNNELED(pExynosPort) && !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)))) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] enabled(%d), state(%x), tunneld(%d), supplier(%d)", pExynosComponent, __FUNCTION__, - CHECK_PORT_ENABLED(pExynosPort), pExynosPort->portState, - CHECK_PORT_TUNNELED(pExynosPort), CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)); - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - Exynos_OSAL_MutexLock(pExynosPort->hPortMutex); - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (pBuffer == pExynosPort->extendBufferHeader[i].OMXBufferHeader) { - if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_FALSE) { - pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_TRUE; - bFindBuffer = OMX_TRUE; - break; - } else { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] input buffer(%p) was already entered!", pExynosComponent, __FUNCTION__, pBuffer); - } - } - } - - if (bFindBuffer == OMX_FALSE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] EmptyThisBuffer is failed : %p", pExynosComponent, __FUNCTION__, pBuffer); - ret = OMX_ErrorBadParameter; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - - message = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_MESSAGE)); - if (message == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - message->messageType = EXYNOS_OMX_CommandEmptyBuffer; - message->messageParam = (OMX_U32) i; - message->pCmdData = (OMX_PTR)pBuffer; - - ret = Exynos_OSAL_Queue(&pExynosPort->bufferQ, (void *)message); - if (ret != 0) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - ret = Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID); - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader:%p, nAllocLen:%d, nFilledLen:%d, nOffset:%d, nFlags:%x", - pExynosComponent, __FUNCTION__, - pBuffer, pBuffer->nAllocLen, pBuffer->nFilledLen, pBuffer->nOffset, pBuffer->nFlags); - - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FillThisBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_BUFFERHEADERTYPE *pBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - OMX_U32 i = 0; - OMX_BOOL bFindBuffer = OMX_FALSE; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (pBuffer == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - if (pBuffer->nOutputPortIndex != OUTPUT_PORT_INDEX) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - ret = Exynos_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateIdle) && - (pExynosComponent->currentState != OMX_StateExecuting) && - (pExynosComponent->currentState != OMX_StatePause)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - if ((!CHECK_PORT_ENABLED(pExynosPort)) || - ((CHECK_PORT_BEING_FLUSHED(pExynosPort)) && - (!CHECK_PORT_TUNNELED(pExynosPort) || !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort))) || - ((pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle) && - (CHECK_PORT_TUNNELED(pExynosPort) && !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)))) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] enabled(%d), state(%x), tunneld(%d), supplier(%d)", pExynosComponent, __FUNCTION__, - CHECK_PORT_ENABLED(pExynosPort), pExynosPort->portState, - CHECK_PORT_TUNNELED(pExynosPort), CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)); - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - Exynos_OSAL_MutexLock(pExynosPort->hPortMutex); - for (i = 0; i < MAX_BUFFER_NUM; i++) { - if (pBuffer == pExynosPort->extendBufferHeader[i].OMXBufferHeader) { - if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_FALSE) { - pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_TRUE; - bFindBuffer = OMX_TRUE; - break; - } else { - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] output buffer(%p) was already entered!", pExynosComponent, __FUNCTION__, pBuffer); - } - } - } - - if (bFindBuffer == OMX_FALSE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] FillThisBuffer is failed : %p", pExynosComponent, __FUNCTION__, pBuffer); - ret = OMX_ErrorBadParameter; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - - message = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_MESSAGE)); - if (message == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - message->messageType = EXYNOS_OMX_CommandFillBuffer; - message->messageParam = (OMX_U32) i; - message->pCmdData = (OMX_PTR)pBuffer; - - ret = Exynos_OSAL_Queue(&pExynosPort->bufferQ, (void *)message); - if (ret != 0) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - goto EXIT; - } - - ret = Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID); - - Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader:%p", pExynosComponent, __FUNCTION__, pBuffer); - - Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_BASEPORT *pExynosInputPort = NULL; - EXYNOS_OMX_BASEPORT *pExynosOutputPort = NULL; - int i = 0, j = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] OMX_ErrorBadParameter (0x%x) Line:%d", __FUNCTION__, ret, __LINE__); - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] OMX_ErrorBadParameter (0x%x) Line:%d", __FUNCTION__, ret, __LINE__); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - INIT_SET_SIZE_VERSION(&pExynosComponent->portParam, OMX_PORT_PARAM_TYPE); - pExynosComponent->portParam.nPorts = ALL_PORT_NUM; - pExynosComponent->portParam.nStartPortNumber = INPUT_PORT_INDEX; - - pExynosPort = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BASEPORT) * ALL_PORT_NUM); - if (pExynosPort == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - Exynos_OSAL_Memset(pExynosPort, 0, sizeof(EXYNOS_OMX_BASEPORT) * ALL_PORT_NUM); - pExynosComponent->pExynosPort = pExynosPort; - - /* Input Port */ - pExynosInputPort = &pExynosPort[INPUT_PORT_INDEX]; - - Exynos_OSAL_QueueCreate(&pExynosInputPort->bufferQ, MAX_QUEUE_ELEMENTS); - - pExynosInputPort->extendBufferHeader = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM); - if (pExynosInputPort->extendBufferHeader == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - Exynos_OSAL_Memset(pExynosInputPort->extendBufferHeader, 0, sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM); - - pExynosInputPort->bufferStateAllocate = Exynos_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM); - if (pExynosInputPort->bufferStateAllocate == NULL) { - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - Exynos_OSAL_Memset(pExynosInputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM); - - pExynosInputPort->bufferSemID = NULL; - pExynosInputPort->assignedBufferNum = 0; - pExynosInputPort->portState = EXYNOS_OMX_PortStateLoaded; - pExynosInputPort->tunneledComponent = NULL; - pExynosInputPort->tunneledPort = 0; - pExynosInputPort->tunnelBufferNum = 0; - pExynosInputPort->bufferSupplier = OMX_BufferSupplyUnspecified; - pExynosInputPort->tunnelFlags = 0; - pExynosInputPort->supportFormat = NULL; - - ret = Exynos_OSAL_SemaphoreCreate(&pExynosInputPort->loadedResource); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - - ret = Exynos_OSAL_SemaphoreCreate(&pExynosInputPort->unloadedResource); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - - INIT_SET_SIZE_VERSION(&pExynosInputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE); - pExynosInputPort->portDefinition.nPortIndex = INPUT_PORT_INDEX; - pExynosInputPort->portDefinition.eDir = OMX_DirInput; - pExynosInputPort->portDefinition.nBufferCountActual = 0; - pExynosInputPort->portDefinition.nBufferCountMin = 0; - pExynosInputPort->portDefinition.nBufferSize = 0; - pExynosInputPort->portDefinition.bEnabled = OMX_FALSE; - pExynosInputPort->portDefinition.bPopulated = OMX_FALSE; - pExynosInputPort->portDefinition.eDomain = OMX_PortDomainMax; - pExynosInputPort->portDefinition.bBuffersContiguous = OMX_FALSE; - pExynosInputPort->portDefinition.nBufferAlignment = 0; - pExynosInputPort->markType.hMarkTargetComponent = NULL; - pExynosInputPort->markType.pMarkData = NULL; - pExynosInputPort->exceptionFlag = GENERAL_STATE; - - /* Output Port */ - pExynosOutputPort = &pExynosPort[OUTPUT_PORT_INDEX]; - - Exynos_OSAL_QueueCreate(&pExynosOutputPort->bufferQ, MAX_QUEUE_ELEMENTS); /* For in case of "Output Buffer Share", MAX ELEMENTS(DPB + EDPB) */ - - pExynosOutputPort->extendBufferHeader = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM); - if (pExynosOutputPort->extendBufferHeader == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(pExynosOutputPort->extendBufferHeader, 0, sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM); - - pExynosOutputPort->bufferStateAllocate = Exynos_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM); - if (pExynosOutputPort->bufferStateAllocate == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(pExynosOutputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM); - - pExynosOutputPort->bufferSemID = NULL; - pExynosOutputPort->assignedBufferNum = 0; - pExynosOutputPort->portState = EXYNOS_OMX_PortStateLoaded; - pExynosOutputPort->tunneledComponent = NULL; - pExynosOutputPort->tunneledPort = 0; - pExynosOutputPort->tunnelBufferNum = 0; - pExynosOutputPort->bufferSupplier = OMX_BufferSupplyUnspecified; - pExynosOutputPort->tunnelFlags = 0; - pExynosOutputPort->supportFormat = NULL; - - ret = Exynos_OSAL_SemaphoreCreate(&pExynosOutputPort->loadedResource); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - - ret = Exynos_OSAL_SemaphoreCreate(&pExynosOutputPort->unloadedResource); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__); - goto EXIT; - } - - INIT_SET_SIZE_VERSION(&pExynosOutputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE); - pExynosOutputPort->portDefinition.nPortIndex = OUTPUT_PORT_INDEX; - pExynosOutputPort->portDefinition.eDir = OMX_DirOutput; - pExynosOutputPort->portDefinition.nBufferCountActual = 0; - pExynosOutputPort->portDefinition.nBufferCountMin = 0; - pExynosOutputPort->portDefinition.nBufferSize = 0; - pExynosOutputPort->portDefinition.bEnabled = OMX_FALSE; - pExynosOutputPort->portDefinition.bPopulated = OMX_FALSE; - pExynosOutputPort->portDefinition.eDomain = OMX_PortDomainMax; - pExynosOutputPort->portDefinition.bBuffersContiguous = OMX_FALSE; - pExynosOutputPort->portDefinition.nBufferAlignment = 0; - pExynosOutputPort->markType.hMarkTargetComponent = NULL; - pExynosOutputPort->markType.pMarkData = NULL; - pExynosOutputPort->exceptionFlag = GENERAL_STATE; - - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE; - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; - pExynosComponent->checkTimeStamp.startTimeStamp = 0; - pExynosComponent->checkTimeStamp.nStartFlags = 0x0; - - pOMXComponent->EmptyThisBuffer = &Exynos_OMX_EmptyThisBuffer; - pOMXComponent->FillThisBuffer = &Exynos_OMX_FillThisBuffer; - - ret = OMX_ErrorNone; - -EXIT: - if ((ret != OMX_ErrorNone) && - (pExynosComponent != NULL) && - (pExynosComponent->pExynosPort != NULL)) { - for (i = 0; i < ALL_PORT_NUM; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - - Exynos_OSAL_SemaphoreTerminate(pExynosPort->loadedResource); - pExynosPort->loadedResource = NULL; - Exynos_OSAL_SemaphoreTerminate(pExynosPort->unloadedResource); - pExynosPort->unloadedResource = NULL; - Exynos_OSAL_Free(pExynosPort->bufferStateAllocate); - pExynosPort->bufferStateAllocate = NULL; - Exynos_OSAL_Free(pExynosPort->extendBufferHeader); - pExynosPort->extendBufferHeader = NULL; - - Exynos_OSAL_QueueTerminate(&pExynosPort->bufferQ); - } - - Exynos_OSAL_Free(pExynosComponent->pExynosPort); - pExynosComponent->pExynosPort = NULL; - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - int i = 0, j = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - for (i = 0; i < ALL_PORT_NUM; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - - Exynos_OSAL_SemaphoreTerminate(pExynosPort->loadedResource); - pExynosPort->loadedResource = NULL; - Exynos_OSAL_SemaphoreTerminate(pExynosPort->unloadedResource); - pExynosPort->unloadedResource = NULL; - Exynos_OSAL_Free(pExynosPort->bufferStateAllocate); - pExynosPort->bufferStateAllocate = NULL; - Exynos_OSAL_Free(pExynosPort->extendBufferHeader); - pExynosPort->extendBufferHeader = NULL; - - Exynos_OSAL_QueueTerminate(&pExynosPort->bufferQ); - } - - Exynos_OSAL_Free(pExynosComponent->pExynosPort); - pExynosComponent->pExynosPort = NULL; - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - if (pData == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - /* caution: nPlanes in buffer structure might be used all times */ - Exynos_OSAL_Memset(&(pData->buffer.fd), 0, sizeof(pData->buffer.fd)); - Exynos_OSAL_Memset(&(pData->buffer.addr), 0, sizeof(pData->buffer.addr)); - - pData->dataLen = 0; - pData->usedDataLen = 0; - pData->remainDataLen = 0; - pData->nFlags = 0; - pData->timeStamp = 0; - pData->pPrivate = NULL; - pData->bufferHeader = NULL; - -EXIT: - return ret; -} diff --git a/openmax/component/audio/common/Exynos_OMX_ABaseport.h b/openmax/component/audio/common/Exynos_OMX_ABaseport.h deleted file mode 100644 index 1db51c3..0000000 --- a/openmax/component/audio/common/Exynos_OMX_ABaseport.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_ABaseport.h - * @brief - * @author SeungBeom Kim (sbcrux.kim@samsung.com) - * HyeYeon Chung (hyeon.chung@samsung.com) - * @version 2.0.0 - * @history - * 2012.02.20 : Create - */ - -#ifndef EXYNOS_OMX_ABASE_PORT -#define EXYNOS_OMX_ABASE_PORT - -#include "OMX_Component.h" -#include "Exynos_OMX_Def.h" -#include "Exynos_OSAL_Queue.h" -#include "Exynos_OMX_Def.h" - -#ifdef PERFORMANCE_DEBUG -#include -#endif - -#define BUFFER_STATE_ALLOCATED (1 << 0) -#define BUFFER_STATE_ASSIGNED (1 << 1) -#define HEADER_STATE_ALLOCATED (1 << 2) -#define BUFFER_STATE_FREE 0 - -#define MAX_BUFFER_NUM 40 - -#define INPUT_PORT_INDEX 0 -#define OUTPUT_PORT_INDEX 1 -#define ALL_PORT_INDEX -1 -#define ALL_PORT_NUM 2 - - -typedef struct _EXYNOS_OMX_BUFFERHEADERTYPE -{ - OMX_BUFFERHEADERTYPE *OMXBufferHeader; - OMX_BOOL bBufferInOMX; -} EXYNOS_OMX_BUFFERHEADERTYPE; - -typedef struct _EXYNOS_OMX_DATABUFFER -{ - OMX_HANDLETYPE bufferMutex; - OMX_BUFFERHEADERTYPE* bufferHeader; - OMX_BOOL dataValid; - OMX_U32 allocSize; - OMX_U32 dataLen; - OMX_U32 usedDataLen; - OMX_U32 remainDataLen; - OMX_U32 nFlags; - OMX_TICKS timeStamp; - OMX_PTR pPrivate; -} EXYNOS_OMX_DATABUFFER; - -typedef struct _EXYNOS_OMX_MULTIPLANE_BUFFER -{ - OMX_U32 nPlanes; - unsigned long fd[MAX_BUFFER_PLANE]; - OMX_PTR addr[MAX_BUFFER_PLANE]; - OMX_COLOR_FORMATTYPE eColorFormat; -} EXYNOS_OMX_MULTIPLANE_BUFFER; - -typedef struct _EXYNOS_OMX_DATA -{ - EXYNOS_OMX_MULTIPLANE_BUFFER buffer; - OMX_U32 allocSize; - OMX_U32 dataLen; - OMX_U32 usedDataLen; - OMX_U32 remainDataLen; - OMX_U32 nFlags; - OMX_TICKS timeStamp; - OMX_PTR pPrivate; - - /* For Share Buffer */ - OMX_BUFFERHEADERTYPE *bufferHeader; -} EXYNOS_OMX_DATA; - -typedef enum _EXYNOS_OMX_EXCEPTION_STATE -{ - GENERAL_STATE = 0x00, - NEED_PORT_FLUSH, - NEED_PORT_DISABLE, - INVALID_STATE, -} EXYNOS_OMX_EXCEPTION_STATE; - -typedef struct _EXYNOS_OMX_BASEPORT -{ - EXYNOS_OMX_BUFFERHEADERTYPE *extendBufferHeader; - OMX_U32 *bufferStateAllocate; - OMX_PARAM_PORTDEFINITIONTYPE portDefinition; - OMX_HANDLETYPE bufferSemID; - EXYNOS_QUEUE bufferQ; - OMX_S32 assignedBufferNum; - EXYNOS_OMX_PORT_STATETYPE portState; - OMX_HANDLETYPE loadedResource; - OMX_HANDLETYPE unloadedResource; - - OMX_MARKTYPE markType; - - /* Tunnel Info */ - OMX_HANDLETYPE tunneledComponent; - OMX_U32 tunneledPort; - OMX_U32 tunnelBufferNum; - OMX_BUFFERSUPPLIERTYPE bufferSupplier; - OMX_U32 tunnelFlags; - - OMX_COLOR_FORMATTYPE *supportFormat; - - OMX_HANDLETYPE pauseEvent; - - EXYNOS_OMX_DATABUFFER dataBuffer; - - /* Data */ - EXYNOS_OMX_DATA processData; - - OMX_HANDLETYPE hPortMutex; - EXYNOS_OMX_EXCEPTION_STATE exceptionFlag; -} EXYNOS_OMX_BASEPORT; - - -#ifdef __cplusplus -extern "C" { -#endif - -OMX_ERRORTYPE Exynos_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent); -OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData); -OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader); -OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader); - -#ifdef __cplusplus -}; -#endif - - -#endif diff --git a/openmax/component/audio/common/NOTICE b/openmax/component/audio/common/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/common/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/dec/Android.mk b/openmax/component/audio/dec/Android.mk deleted file mode 100644 index 600fa9f..0000000 --- a/openmax/component/audio/dec/Android.mk +++ /dev/null @@ -1,31 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - Exynos_OMX_Adec.c - -LOCAL_MODULE := libExynosOMX_Adec -LOCAL_ARM_MODE := arm -LOCAL_MODULE_TAGS := optional -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_STATIC_LIBRARIES := libsrpapi - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/dec \ - $(EXYNOS_AUDIO_CODEC)/alp/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -endif -endif - -include $(BUILD_STATIC_LIBRARY) diff --git a/openmax/component/audio/dec/Exynos_OMX_Adec.c b/openmax/component/audio/dec/Exynos_OMX_Adec.c deleted file mode 100644 index 9d294c6..0000000 --- a/openmax/component/audio/dec/Exynos_OMX_Adec.c +++ /dev/null @@ -1,1538 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Adec.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include "Exynos_OMX_Macros.h" -#include "Exynos_OSAL_Event.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OMX_Basecomponent.h" -#include "Exynos_OSAL_Thread.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Mutex.h" -#include "Exynos_OSAL_ETC.h" -#include "srp_api.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_AUDIO_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -OMX_ERRORTYPE Exynos_OMX_UseBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes, - OMX_IN OMX_U8 *pBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (nPortIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)Exynos_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE)); - if (temp_bufferHeader == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE)); - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (pExynosPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) { - pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader; - pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED); - INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE); - temp_bufferHeader->pBuffer = pBuffer; - temp_bufferHeader->nAllocLen = nSizeBytes; - temp_bufferHeader->pAppPrivate = pAppPrivate; - if (nPortIndex == INPUT_PORT_INDEX) - temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX; - else - temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX; - - pExynosPort->assignedBufferNum++; - if (pExynosPort->assignedBufferNum == (OMX_S32)pExynosPort->portDefinition.nBufferCountActual) { - pExynosPort->portDefinition.bPopulated = OMX_TRUE; - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - } - *ppBufferHdr = temp_bufferHeader; - ret = OMX_ErrorNone; - goto EXIT; - } - } - - Exynos_OSAL_Free(temp_bufferHeader); - ret = OMX_ErrorInsufficientResources; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AllocateBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (nPortIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - temp_buffer = Exynos_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes); - if (temp_buffer == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - - temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)Exynos_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE)); - if (temp_bufferHeader == NULL) { - Exynos_OSAL_Free(temp_buffer); - temp_buffer = NULL; - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE)); - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (pExynosPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) { - pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader; - pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ALLOCATED | HEADER_STATE_ALLOCATED); - INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE); - temp_bufferHeader->pBuffer = temp_buffer; - temp_bufferHeader->nAllocLen = nSizeBytes; - temp_bufferHeader->pAppPrivate = pAppPrivate; - if (nPortIndex == INPUT_PORT_INDEX) - temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX; - else - temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX; - pExynosPort->assignedBufferNum++; - if (pExynosPort->assignedBufferNum == (OMX_S32)pExynosPort->portDefinition.nBufferCountActual) { - pExynosPort->portDefinition.bPopulated = OMX_TRUE; - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - } - *ppBuffer = temp_bufferHeader; - ret = OMX_ErrorNone; - goto EXIT; - } - } - - Exynos_OSAL_Free(temp_bufferHeader); - Exynos_OSAL_Free(temp_buffer); - ret = OMX_ErrorInsufficientResources; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FreeBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if ((pExynosPort->portState != EXYNOS_OMX_PortStateDisabling) && - (pExynosPort->portState != EXYNOS_OMX_PortStateFlushingForDisable) && - (pExynosPort->portState != EXYNOS_OMX_PortStateInvalid)) { - (*(pExynosComponent->pCallbacks->EventHandler)) (pOMXComponent, - pExynosComponent->callbackData, - (OMX_U32)OMX_EventError, - (OMX_U32)OMX_ErrorPortUnpopulated, - nPortIndex, NULL); - } - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (((pExynosPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pExynosPort->extendBufferHeader[i].OMXBufferHeader != NULL)) { - if (pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer == pBufferHdr->pBuffer) { - if (pExynosPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) { - Exynos_OSAL_Free(pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer); - pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer = NULL; - pBufferHdr->pBuffer = NULL; - } else if (pExynosPort->bufferStateAllocate[i] & BUFFER_STATE_ASSIGNED) { - ; /* None*/ - } - pExynosPort->assignedBufferNum--; - if (pExynosPort->bufferStateAllocate[i] & HEADER_STATE_ALLOCATED) { - Exynos_OSAL_Free(pExynosPort->extendBufferHeader[i].OMXBufferHeader); - pExynosPort->extendBufferHeader[i].OMXBufferHeader = NULL; - pBufferHdr = NULL; - } - pExynosPort->bufferStateAllocate[i] = BUFFER_STATE_FREE; - ret = OMX_ErrorNone; - goto EXIT; - } - } - } - -EXIT: - if (ret == OMX_ErrorNone) { - if (pExynosPort->assignedBufferNum == 0) { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pExynosPort->unloadedResource signal set"); - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->unloadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - pExynosPort->portDefinition.bPopulated = OMX_FALSE; - } - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 bufferSize = 0; - OMX_PARAM_PORTDEFINITIONTYPE portDefinition; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT* pExynosPort = NULL; - OMX_BUFFERHEADERTYPE* temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 bufferSize = 0; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest( - OMX_IN OMX_HANDLETYPE hComp, - OMX_IN OMX_U32 nPort, - OMX_IN OMX_HANDLETYPE hTunneledComp, - OMX_IN OMX_U32 nTunneledPort, - OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - if ((pExynosComponent->currentState == OMX_StateExecuting) && - (pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portState == EXYNOS_OMX_PortStateIdle) && - (pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX].portState == EXYNOS_OMX_PortStateIdle) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateExecutingToIdle) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateIdleToExecuting)) { - return OMX_TRUE; - } else { - return OMX_FALSE; - } -} - -OMX_ERRORTYPE Exynos_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOMXInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOMXOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *dataBuffer = &exynosOMXInputPort->dataBuffer; - OMX_BUFFERHEADERTYPE *bufferHeader = dataBuffer->bufferHeader; - - FunctionIn(); - - if (bufferHeader != NULL) { - if (exynosOMXInputPort->markType.hMarkTargetComponent != NULL ) { - bufferHeader->hMarkTargetComponent = exynosOMXInputPort->markType.hMarkTargetComponent; - bufferHeader->pMarkData = exynosOMXInputPort->markType.pMarkData; - exynosOMXInputPort->markType.hMarkTargetComponent = NULL; - exynosOMXInputPort->markType.pMarkData = NULL; - } - - if (bufferHeader->hMarkTargetComponent != NULL) { - if (bufferHeader->hMarkTargetComponent == pOMXComponent) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventMark, - 0, 0, bufferHeader->pMarkData); - } else { - pExynosComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; - pExynosComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; - } - } - - bufferHeader->nFilledLen = 0; - Exynos_OMX_InputBufferReturn(pOMXComponent, bufferHeader); - } - - if ((pExynosComponent->currentState == OMX_StatePause) && - ((!CHECK_PORT_BEING_FLUSHED(exynosOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOMXOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - dataBuffer->dataValid = OMX_FALSE; - dataBuffer->dataLen = 0; - dataBuffer->remainDataLen = 0; - dataBuffer->usedDataLen = 0; - dataBuffer->bufferHeader = NULL; - dataBuffer->nFlags = 0; - dataBuffer->timeStamp = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_InputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *dataBuffer = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - pExynosPort= &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - dataBuffer = &pExynosPort->dataBuffer; - - if (pExynosComponent->currentState != OMX_StateExecuting) { - ret = OMX_ErrorUndefined; - goto EXIT; - } else { - Exynos_OSAL_SemaphoreWait(pExynosPort->bufferSemID); - Exynos_OSAL_MutexLock(dataBuffer->bufferMutex); - if (dataBuffer->dataValid != OMX_TRUE) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message == NULL) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - goto EXIT; - } - - dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData); - dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen; - dataBuffer->dataLen = dataBuffer->bufferHeader->nFilledLen; - dataBuffer->remainDataLen = dataBuffer->dataLen; - dataBuffer->usedDataLen = 0; - dataBuffer->dataValid = OMX_TRUE; - dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; - dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp; - - Exynos_OSAL_Free(message); - - if (dataBuffer->allocSize <= dataBuffer->dataLen) - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "Input Buffer Full, Check input buffer size! allocSize:%d, dataLen:%d", dataBuffer->allocSize, dataBuffer->dataLen); - } else { - Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID); - } - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - ret = OMX_ErrorNone; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOMXInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOMXOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *dataBuffer = &exynosOMXOutputPort->dataBuffer; - OMX_BUFFERHEADERTYPE *bufferHeader = dataBuffer->bufferHeader; - - FunctionIn(); - - if (bufferHeader != NULL) { - bufferHeader->nFilledLen = dataBuffer->remainDataLen; - bufferHeader->nOffset = 0; - bufferHeader->nFlags = dataBuffer->nFlags; - bufferHeader->nTimeStamp = dataBuffer->timeStamp; - - if (pExynosComponent->propagateMarkType.hMarkTargetComponent != NULL) { - bufferHeader->hMarkTargetComponent = pExynosComponent->propagateMarkType.hMarkTargetComponent; - bufferHeader->pMarkData = pExynosComponent->propagateMarkType.pMarkData; - pExynosComponent->propagateMarkType.hMarkTargetComponent = NULL; - pExynosComponent->propagateMarkType.pMarkData = NULL; - } - - if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventBufferFlag, - OUTPUT_PORT_INDEX, - bufferHeader->nFlags, NULL); - } - - Exynos_OMX_OutputBufferReturn(pOMXComponent, bufferHeader); - } - - if ((pExynosComponent->currentState == OMX_StatePause) && - ((!CHECK_PORT_BEING_FLUSHED(exynosOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOMXOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - /* reset dataBuffer */ - dataBuffer->dataValid = OMX_FALSE; - dataBuffer->dataLen = 0; - dataBuffer->remainDataLen = 0; - dataBuffer->usedDataLen = 0; - dataBuffer->bufferHeader = NULL; - dataBuffer->nFlags = 0; - dataBuffer->timeStamp = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OutputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *dataBuffer = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - pExynosPort= &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - dataBuffer = &pExynosPort->dataBuffer; - - if (pExynosComponent->currentState != OMX_StateExecuting) { - ret = OMX_ErrorUndefined; - goto EXIT; - } else { - Exynos_OSAL_SemaphoreWait(pExynosPort->bufferSemID); - Exynos_OSAL_MutexLock(dataBuffer->bufferMutex); - if (dataBuffer->dataValid != OMX_TRUE) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message == NULL) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - goto EXIT; - } - - dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData); - dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen; - dataBuffer->dataLen = 0; //dataBuffer->bufferHeader->nFilledLen; - dataBuffer->remainDataLen = dataBuffer->dataLen; - dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset; - dataBuffer->dataValid = OMX_TRUE; - /* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */ - /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */ - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = dataBuffer->bufferHeader->pBuffer; - pExynosPort->processData.allocSize = dataBuffer->bufferHeader->nAllocLen; - - Exynos_OSAL_Free(message); - } else { - Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID); - } - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - ret = OMX_ErrorNone; - } -EXIT: - FunctionOut(); - - return ret; - -} - -OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_BOOL ret = OMX_FALSE; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_OMX_BASEPORT *exynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *inputUseBuffer = &exynosInputPort->dataBuffer; - EXYNOS_OMX_DATA *inputData = &exynosInputPort->processData; - OMX_U32 copySize = 0; - OMX_BYTE checkInputStream = NULL; - OMX_U32 checkInputStreamLen = 0; - OMX_U32 checkedSize = 0; - OMX_BOOL flagEOF = OMX_FALSE; - OMX_BOOL previousFrameEOF = OMX_FALSE; - - FunctionIn(); - - if (inputUseBuffer->dataValid == OMX_TRUE) { - checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen; - checkInputStreamLen = inputUseBuffer->remainDataLen; - - if (inputData->dataLen == 0) { - previousFrameEOF = OMX_TRUE; - } else { - previousFrameEOF = OMX_FALSE; - } - - /* Audio extractor should parse into frame units. */ - flagEOF = OMX_TRUE; - checkedSize = checkInputStreamLen; - copySize = checkedSize; - - if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) - pExynosComponent->bSaveFlagEOS = OMX_TRUE; - - if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) { - if (copySize > 0) - Exynos_OSAL_Memcpy((char*)inputData->buffer.addr[AUDIO_DATA_PLANE] + inputData->dataLen, checkInputStream, copySize); - - inputUseBuffer->dataLen -= copySize; - inputUseBuffer->remainDataLen -= copySize; - inputUseBuffer->usedDataLen += copySize; - - inputData->dataLen += copySize; - inputData->remainDataLen += copySize; - - if (previousFrameEOF == OMX_TRUE) { - inputData->timeStamp = inputUseBuffer->timeStamp; - inputData->nFlags = inputUseBuffer->nFlags; - } - - if (pExynosComponent->bUseFlagEOF == OMX_TRUE) { - if (pExynosComponent->bSaveFlagEOS == OMX_TRUE) { - inputData->nFlags |= OMX_BUFFERFLAG_EOS; - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - } else { - inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS)); - } - } else { - if ((checkedSize == checkInputStreamLen) && (pExynosComponent->bSaveFlagEOS == OMX_TRUE)) { - if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && - ((inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || - (inputData->dataLen == 0))) { - inputData->nFlags |= OMX_BUFFERFLAG_EOS; - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - } else if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && - (!(inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) && - (inputData->dataLen != 0)) { - inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS)); - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_TRUE; - } - } else { - inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS)); - } - } - } else { - /*????????????????????????????????? Error ?????????????????????????????????*/ - Exynos_InputBufferReturn(pOMXComponent); - Exynos_ResetCodecData(inputData); - flagEOF = OMX_FALSE; - } - - if ((inputUseBuffer->remainDataLen == 0) || - (CHECK_PORT_BEING_FLUSHED(exynosInputPort))) - Exynos_InputBufferReturn(pOMXComponent); - else - inputUseBuffer->dataValid = OMX_TRUE; - } - - if (flagEOF == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) { - /* Flush SRP buffers */ - SRP_Flush(); - pAudioDec->outFrames = 0; - pAudioDec->baseTime = 0; - pAudioDec->bFirstFrame = OMX_TRUE; - - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE; - pExynosComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp; - pExynosComponent->checkTimeStamp.nStartFlags = inputData->nFlags; - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "first frame timestamp after seeking %lld us (%.2f secs)", - inputData->timeStamp, inputData->timeStamp / 1E6); - } - - ret = OMX_TRUE; - } else { - ret = OMX_FALSE; - } - - FunctionOut(); - - return ret; -} - -OMX_BOOL Exynos_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_BOOL ret = OMX_FALSE; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *outputUseBuffer = &exynosOutputPort->dataBuffer; - EXYNOS_OMX_DATA *outputData = &exynosOutputPort->processData; - OMX_U32 copySize = 0; - - FunctionIn(); - - if (outputUseBuffer->dataValid == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp) { - pExynosComponent->checkTimeStamp.startTimeStamp = RESET_TIMESTAMP_VAL; - pExynosComponent->checkTimeStamp.nStartFlags = 0x0; - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE; - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; - } else { - ret = OMX_TRUE; - goto EXIT; - } - } else if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) { - ret = OMX_TRUE; - goto EXIT; - } - - if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) { - copySize = outputData->remainDataLen; - - outputUseBuffer->dataLen += copySize; - outputUseBuffer->remainDataLen += copySize; - outputUseBuffer->nFlags = outputData->nFlags; - outputUseBuffer->timeStamp = outputData->timeStamp; - - ret = OMX_TRUE; - - if ((outputUseBuffer->remainDataLen > 0) || - (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) || - (CHECK_PORT_BEING_FLUSHED(exynosOutputPort))) { - Exynos_OutputBufferReturn(pOMXComponent); - - /* reset outputData */ - Exynos_ResetCodecData(outputData); - } - } else { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "output buffer is smaller than decoded data size Out Length"); - - ret = OMX_FALSE; - - /* reset outputData */ - Exynos_ResetCodecData(outputData); - } - } else { - ret = OMX_FALSE; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_OMX_BASEPORT *exynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *inputUseBuffer = &exynosInputPort->dataBuffer; - EXYNOS_OMX_DATABUFFER *outputUseBuffer = &exynosOutputPort->dataBuffer; - EXYNOS_OMX_DATA *inputData = &exynosInputPort->processData; - EXYNOS_OMX_DATA *outputData = &exynosOutputPort->processData; - OMX_U32 copySize = 0; - - pExynosComponent->reInputData = OMX_FALSE; - - FunctionIn(); - - while (!pAudioDec->bExitBufferProcessThread) { - Exynos_OSAL_SleepMillisec(0); - - if (((pExynosComponent->currentState == OMX_StatePause) || - (pExynosComponent->currentState == OMX_StateIdle) || - (pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle) || - (pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle)) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateIdleToLoaded)&& - ((!CHECK_PORT_BEING_FLUSHED(exynosInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - while ((Exynos_Check_BufferProcess_State(pExynosComponent)) && (!pAudioDec->bExitBufferProcessThread)) { - Exynos_OSAL_SleepMillisec(0); - - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - if ((outputUseBuffer->dataValid != OMX_TRUE) && - (!CHECK_PORT_BEING_FLUSHED(exynosOutputPort))) { - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - ret = Exynos_OutputBufferGetQueue(pExynosComponent); - if ((ret == OMX_ErrorUndefined) || - (exynosInputPort->portState != EXYNOS_OMX_PortStateIdle) || - (exynosOutputPort->portState != EXYNOS_OMX_PortStateIdle)) { - break; - } - } else { - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - } - - if (pExynosComponent->reInputData == OMX_FALSE) { - Exynos_OSAL_MutexLock(inputUseBuffer->bufferMutex); - if ((Exynos_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) && - (!CHECK_PORT_BEING_FLUSHED(exynosInputPort))) { - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - ret = Exynos_InputBufferGetQueue(pExynosComponent); - break; - } - - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - } - - Exynos_OSAL_MutexLock(inputUseBuffer->bufferMutex); - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - ret = pAudioDec->exynos_codec_bufferProcess(pOMXComponent, inputData, outputData); - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) - pExynosComponent->reInputData = OMX_TRUE; - else - pExynosComponent->reInputData = OMX_FALSE; - - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - Exynos_Postprocess_OutputData(pOMXComponent); - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - } - } - -EXIT: - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetFlushBuffer(EXYNOS_OMX_BASEPORT *pExynosPort, EXYNOS_OMX_DATABUFFER **pDataBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - FunctionIn(); - - *pDataBuffer = &pExynosPort->dataBuffer; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *flushPortBuffer = NULL; - OMX_BUFFERHEADERTYPE *bufferHeader = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - OMX_U32 flushNum = 0; - OMX_S32 semValue = 0; - - FunctionIn(); - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) { - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[portIndex].bufferSemID, &semValue); - if (semValue == 0) - Exynos_OSAL_SemaphorePost(pExynosComponent->pExynosPort[portIndex].bufferSemID); - Exynos_OSAL_SemaphoreWait(pExynosComponent->pExynosPort[portIndex].bufferSemID); - - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message != NULL) { - bufferHeader = (OMX_BUFFERHEADERTYPE *)message->pCmdData; - bufferHeader->nFilledLen = 0; - - if (portIndex == OUTPUT_PORT_INDEX) { - Exynos_OMX_OutputBufferReturn(pOMXComponent, bufferHeader); - } else { - Exynos_OMX_InputBufferReturn(pOMXComponent, bufferHeader); - } - - Exynos_OSAL_Free(message); - message = NULL; - } - } - - Exynos_OMX_GetFlushBuffer(pExynosPort, &flushPortBuffer); - if (flushPortBuffer != NULL) { - if (flushPortBuffer->dataValid == OMX_TRUE) { - if (portIndex == INPUT_PORT_INDEX) - Exynos_InputBufferReturn(pOMXComponent); - else if (portIndex == OUTPUT_PORT_INDEX) - Exynos_OutputBufferReturn(pOMXComponent); - - Exynos_ResetCodecData(&(pExynosPort->processData)); - } - } - - while(1) { - OMX_S32 cnt = 0; - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[portIndex].bufferSemID, &cnt); - if (cnt <= 0) - break; - Exynos_OSAL_SemaphoreWait(pExynosComponent->pExynosPort[portIndex].bufferSemID); - } - Exynos_OSAL_SetElemNum(&pExynosPort->bufferQ, 0); - - pExynosPort->processData.dataLen = 0; - pExynosPort->processData.nFlags = 0; - pExynosPort->processData.remainDataLen = 0; - pExynosPort->processData.timeStamp = 0; - pExynosPort->processData.usedDataLen = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *flushPortBuffer = NULL; - OMX_U32 i = 0, cnt = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - Exynos_OMX_GetFlushBuffer(pExynosPort, &flushPortBuffer); - - Exynos_OSAL_MutexLock(flushPortBuffer->bufferMutex); - ret = Exynos_OMX_FlushPort(pOMXComponent, nPortIndex); - Exynos_OSAL_MutexUnlock(flushPortBuffer->bufferMutex); - - if (nPortIndex == INPUT_PORT_INDEX) { - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE; - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pExynosComponent->reInputData = OMX_FALSE; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioInit: - { - OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure; - ret = Exynos_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - portParam->nPorts = pExynosComponent->portParam.nPorts; - portParam->nStartPortNumber = pExynosComponent->portParam.nStartPortNumber; - ret = OMX_ErrorNone; - } - break; - case OMX_IndexParamAudioPortFormat: - { - OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portFormat->nPortIndex; - OMX_U32 index = portFormat->nIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL; - OMX_U32 supportFormatNum = 0; /* supportFormatNum = N-1 */ - - ret = Exynos_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((portIndex >= pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - - if (portIndex == INPUT_PORT_INDEX) { - supportFormatNum = INPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1; - if (index > supportFormatNum) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - portDefinition = &pExynosPort->portDefinition; - - portFormat->eEncoding = portDefinition->format.audio.eEncoding; - } else if (portIndex == OUTPUT_PORT_INDEX) { - supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1; - if (index > supportFormatNum) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - portDefinition = &pExynosPort->portDefinition; - - portFormat->eEncoding = portDefinition->format.audio.eEncoding; - } - ret = OMX_ErrorNone; - } - break; - default: - { - ret = Exynos_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); - } - break; - } - -EXIT: - FunctionOut(); - - return ret; -} -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioPortFormat: - { - OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portFormat->nPortIndex; - OMX_U32 index = portFormat->nIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL; - OMX_U32 supportFormatNum = 0; /* supportFormatNum = N-1 */ - - ret = Exynos_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((portIndex >= pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - portDefinition = &pExynosPort->portDefinition; - - portDefinition->format.audio.eEncoding = portFormat->eEncoding; - ret = OMX_ErrorNone; - } - break; - default: - { - ret = Exynos_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure); - } - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexConfigAudioMute: - { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexConfigAudioMute"); - ret = OMX_ErrorUnsupportedIndex; - } - break; - case OMX_IndexConfigAudioVolume: - { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexConfigAudioVolume"); - ret = OMX_ErrorUnsupportedIndex; - } - break; - default: - ret = Exynos_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -static OMX_ERRORTYPE Exynos_OMX_BufferProcessThread(OMX_PTR threadData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pSECComponent = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - if (threadData == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)threadData; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - pSECComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - Exynos_OMX_BufferProcess(pOMXComponent); - - Exynos_OSAL_ThreadExit(NULL); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess_Create(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - - FunctionIn(); - - pAudioDec->bExitBufferProcessThread = OMX_FALSE; - - ret = Exynos_OSAL_ThreadCreate(&pAudioDec->hBufferProcessThread, - Exynos_OMX_BufferProcessThread, - pOMXComponent); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - OMX_S32 countValue = 0; - unsigned int i = 0; - - FunctionIn(); - - pAudioDec->bExitBufferProcessThread = OMX_TRUE; - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[i].bufferSemID, &countValue); - if (countValue == 0) - Exynos_OSAL_SemaphorePost(pExynosComponent->pExynosPort[i].bufferSemID); - } - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - Exynos_OSAL_ThreadTerminate(pAudioDec->hBufferProcessThread); - pAudioDec->hBufferProcessThread = NULL; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - ret = Exynos_OMX_BaseComponent_Constructor(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - ret = Exynos_OMX_Port_Constructor(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OMX_BaseComponent_Destructor(pOMXComponent); - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pAudioDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_AUDIODEC_COMPONENT)); - if (pAudioDec == NULL) { - Exynos_OMX_BaseComponent_Destructor(pOMXComponent); - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__); - goto EXIT; - } - - Exynos_OSAL_Memset(pAudioDec, 0, sizeof(EXYNOS_OMX_AUDIODEC_COMPONENT)); - pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pAudioDec; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pAudioDec->bFirstFrame = OMX_TRUE; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = MAX_AUDIO_INPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferCountMin = MAX_AUDIO_INPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferSize = DEFAULT_AUDIO_INPUT_BUFFER_SIZE; - pExynosPort->portDefinition.eDomain = OMX_PortDomainAudio; - - pExynosPort->portDefinition.format.audio.cMIMEType = Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = MAX_AUDIO_OUTPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferCountMin = MAX_AUDIO_OUTPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferSize = DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE; - pExynosPort->portDefinition.eDomain = OMX_PortDomainAudio; - - pExynosPort->portDefinition.format.audio.cMIMEType = Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused; - - - pOMXComponent->UseBuffer = &Exynos_OMX_UseBuffer; - pOMXComponent->AllocateBuffer = &Exynos_OMX_AllocateBuffer; - pOMXComponent->FreeBuffer = &Exynos_OMX_FreeBuffer; - pOMXComponent->ComponentTunnelRequest = &Exynos_OMX_ComponentTunnelRequest; - -#ifdef TUNNELING_SUPPORT - pExynosComponent->exynos_AllocateTunnelBuffer = &Exynos_OMX_AllocateTunnelBuffer; - pExynosComponent->exynos_FreeTunnelBuffer = &Exynos_OMX_FreeTunnelBuffer; -#endif - pExynosComponent->exynos_BufferProcessCreate = &Exynos_OMX_BufferProcess_Create; - pExynosComponent->exynos_BufferProcessTerminate = &Exynos_OMX_BufferProcess_Terminate; - pExynosComponent->exynos_BufferFlush = &Exynos_OMX_BufferFlush; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - int i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - Exynos_OSAL_Free(pAudioDec); - pExynosComponent->hComponentHandle = pAudioDec = NULL; - - for(i = 0; i < ALL_PORT_NUM; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - Exynos_OSAL_Free(pExynosPort->portDefinition.format.audio.cMIMEType); - pExynosPort->portDefinition.format.audio.cMIMEType = NULL; - } - - ret = Exynos_OMX_Port_Destructor(pOMXComponent); - - ret = Exynos_OMX_BaseComponent_Destructor(hComponent); - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/dec/Exynos_OMX_Adec.h b/openmax/component/audio/dec/Exynos_OMX_Adec.h deleted file mode 100644 index 4413bee..0000000 --- a/openmax/component/audio/dec/Exynos_OMX_Adec.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Adec.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_AUDIO_DECODE -#define EXYNOS_OMX_AUDIO_DECODE - -#include "OMX_Component.h" -#include "Exynos_OMX_Def.h" -#include "Exynos_OSAL_Queue.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_ABasecomponent.h" - -#define MAX_AUDIO_INPUTBUFFER_NUM 2 -#define MAX_AUDIO_OUTPUTBUFFER_NUM 2 - -#define DEFAULT_AUDIO_INPUT_BUFFER_SIZE (16 * 1024) -#define DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE (32 * 1024) - -#define DEFAULT_AUDIO_SAMPLING_FREQ 44100 -#define DEFAULT_AUDIO_CHANNELS_NUM 2 -#define DEFAULT_AUDIO_BIT_PER_SAMPLE 16 - -#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 -#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 - -#define AUDIO_DATA_PLANE 0 - - -typedef struct _SRP_DEC_INPUT_BUFFER -{ - void *PhyAddr; // physical address - void *VirAddr; // virtual address - int bufferSize; // input buffer alloc size - int dataSize; // Data length -} SRP_DEC_INPUT_BUFFER; - -typedef struct _EXYNOS_OMX_AUDIODEC_COMPONENT -{ - OMX_HANDLETYPE hCodecHandle; - - OMX_BOOL bFirstFrame; - OMX_PTR pInputBuffer; - SRP_DEC_INPUT_BUFFER SRPDecInputBuffer[MAX_AUDIO_INPUTBUFFER_NUM]; - OMX_U32 indexInputBuffer; - OMX_TICKS outFrames; - OMX_TICKS baseTime; - - /* Buffer Process */ - OMX_BOOL bExitBufferProcessThread; - OMX_HANDLETYPE hBufferProcessThread; - - OMX_ERRORTYPE (*exynos_codec_bufferProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData); - - int (*exynos_checkInputFrame)(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); -} EXYNOS_OMX_AUDIODEC_COMPONENT; - - -#ifdef __cplusplus -extern "C" { -#endif - -OMX_ERRORTYPE Exynos_OMX_UseBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes, - OMX_IN OMX_U8 *pBuffer); -OMX_ERRORTYPE Exynos_OMX_AllocateBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes); -OMX_ERRORTYPE Exynos_OMX_FreeBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr); -OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer( - EXYNOS_OMX_BASEPORT *pOMXBasePort, - OMX_U32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer( - EXYNOS_OMX_BASEPORT *pOMXBasePort, - OMX_U32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest( - OMX_IN OMX_HANDLETYPE hComp, - OMX_IN OMX_U32 nPort, - OMX_IN OMX_HANDLETYPE hTunneledComp, - OMX_IN OMX_U32 nTunneledPort, - OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup); -OMX_ERRORTYPE Exynos_OMX_BufferProcess(OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); -OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent); - -#ifdef __cplusplus -} -#endif - -#endif /* EXYNOS_OMX_AUDIO_DECODE */ diff --git a/openmax/component/audio/dec/NOTICE b/openmax/component/audio/dec/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/dec/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/dec/mp3/Android.mk b/openmax/component/audio/dec/mp3/Android.mk deleted file mode 100644 index 4c28be6..0000000 --- a/openmax/component/audio/dec/mp3/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_Mp3dec.c \ - library_register.c - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libOMX.Exynos.MP3.Decoder -LOCAL_MODULE_RELATIVE_PATH := omx -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \ - libsrpapi -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \ - libExynosOMX_Resourcemanager - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/dec \ - $(EXYNOS_AUDIO_CODEC)/alp/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -endif -endif - -include $(BUILD_SHARED_LIBRARY) diff --git a/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c b/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c deleted file mode 100644 index 6fb940f..0000000 --- a/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c +++ /dev/null @@ -1,938 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Mp3dec.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include - -#include "Exynos_OMX_Macros.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Thread.h" -#include "library_register.h" -#include "Exynos_OMX_Mp3dec.h" -#include "srp_api.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -//#define SRP_DUMP_TO_FILE -#ifdef SRP_DUMP_TO_FILE -#include "stdio.h" - -FILE *inFile; -FILE *outFile; -#endif - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioMp3: - { - OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstMp3Param->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcMp3Param = &pMp3Dec->mp3Param; - - Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcPcmParam = &pMp3Dec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_S32 codecType; - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - } - break; - default: - ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioMp3: - { - OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = NULL; - OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcMp3Param->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstMp3Param = &pMp3Dec->mp3Param; - - Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstPcmParam = &pMp3Dec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE)) { - pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3; - } else { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - } - break; - default: - ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_ComponentRoleEnum( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 codecType; - - FunctionIn(); - - if ((hComponent == NULL) || (cRole == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_Init(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Mp3 extractor should parse into frame unit. */ - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pMp3Dec->hSRPMp3Handle.bConfiguredSRP = OMX_FALSE; - pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - -#ifdef SRP_DUMP_TO_FILE - inFile = fopen("/data/InFile.mp3", "w+"); - outFile = fopen("/data/OutFile.pcm", "w+"); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - FunctionIn(); - -#ifdef SRP_DUMP_TO_FILE - fclose(inFile); - fclose(outFile); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle; - struct srp_dec_info codecDecInfo; - OMX_S32 returnCodec = 0; - unsigned long isSRPStopped = 0; - OMX_PTR dataBuffer = NULL; - unsigned int dataLen = 0; - OMX_BOOL isSRPIbufOverflow = OMX_FALSE; - - FunctionIn(); - -#ifdef SRP_DUMP_TO_FILE - if (pExynosComponent->reInputData == OMX_FALSE) { - fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile); - } -#endif - - /* Save timestamp and flags of input data */ - if (pAudioDec->bFirstFrame) { - pOutputData->timeStamp = pInputData->timeStamp; - pAudioDec->baseTime = pInputData->timeStamp; - pAudioDec->bFirstFrame = OMX_FALSE; - } - pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS); - - /* Decoding mp3 frames by SRP */ - if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) { - returnCodec = SRP_Decode(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen); - - if (returnCodec >= 0) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - SRP_Send_EOS(); - pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_TRUE; - } - } else if (returnCodec == SRP_ERROR_IBUF_OVERFLOW) { - isSRPIbufOverflow = OMX_TRUE; - ret = OMX_ErrorInputDataDecodeYet; - } - } - - if (pMp3Dec->hSRPMp3Handle.bConfiguredSRP == OMX_FALSE) { - if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE; - ret = OMX_ErrorNone; - goto EXIT; - } - - returnCodec = SRP_Get_Dec_Info(&codecDecInfo); - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "SRP_Get_Dec_Info failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT; - } - - if (!codecDecInfo.sample_rate || !codecDecInfo.channels) { - if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = OMX_ErrorInputDataDecodeYet; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - if (isSRPIbufOverflow) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - } - goto EXIT; - } - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)", - codecDecInfo.channels, codecDecInfo.sample_rate); - - if (pMp3Dec->pcmParam.nChannels != codecDecInfo.channels || - pMp3Dec->pcmParam.nSamplingRate != codecDecInfo.sample_rate) { - /* Change channel count and sampling rate information */ - pMp3Dec->pcmParam.nChannels = codecDecInfo.channels; - pMp3Dec->pcmParam.nSamplingRate = codecDecInfo.sample_rate; - - /* Send Port Settings changed call back */ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - - pMp3Dec->hSRPMp3Handle.bConfiguredSRP = OMX_TRUE; - - if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = OMX_ErrorInputDataDecodeYet; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - if (isSRPIbufOverflow) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - } - goto EXIT; - } - - /* Get decoded data from SRP */ - returnCodec = SRP_Get_PCM(&dataBuffer, &dataLen); - if (pMp3Dec->hSRPMp3Handle.bConfiguredSRP == OMX_TRUE) { - pOutputData->timeStamp = pAudioDec->baseTime + pAudioDec->outFrames * 1000 * 1000 / (OMX_TICKS)pMp3Dec->pcmParam.nSamplingRate; - int frames = dataLen / pMp3Dec->pcmParam.nChannels / 2; - pAudioDec->outFrames += frames; - } - if (dataLen > 0) { - pOutputData->dataLen = dataLen; - Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE], dataBuffer, dataLen); - } else { - pOutputData->dataLen = 0; - } - -#ifdef SRP_DUMP_TO_FILE - if (pOutputData->dataLen > 0) - fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile); -#endif - - /* Delay EOS signal until all the PCM is returned from the SRP driver. */ - if (pMp3Dec->hSRPMp3Handle.bSRPSendEOS == OMX_TRUE) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - returnCodec = SRP_GetParams(SRP_STOP_EOS_STATE, &isSRPStopped); - if (returnCodec != 0) - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail SRP_STOP_EOS_STATE"); - if (isSRPStopped == 1) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE; /* for repeating one song */ - ret = OMX_ErrorNone; - } else { - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = OMX_ErrorInputDataDecodeYet; - } - } else { /* Flush after EOS */ - pMp3Dec->hSRPMp3Handle.bSRPSendEOS = OMX_FALSE; - } - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_SRP_Mp3Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - - FunctionIn(); - - if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) || - (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - - ret = Exynos_SRP_Mp3_Decode_Block(pOMXComponent, pInputData, pOutputData); - - if (ret != OMX_ErrorNone) { - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) { - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } else { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } else { - pInputData->usedDataLen += pInputData->dataLen; - pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen; - pInputData->dataLen -= pInputData->usedDataLen; - pInputData->usedDataLen = 0; - - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - OMX_PTR pInputBuffer = NULL; - OMX_PTR pOutputBuffer = NULL; - unsigned int inputBufferSize = 0; - unsigned int inputBufferNum = 0; - unsigned int outputBufferSize = 0; - unsigned int outputBufferNum = 0; - OMX_S32 returnCodec; - int i = 0; - - FunctionIn(); - - if ((hComponent == NULL) || (componentName == NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP3_DEC, componentName) != 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosComponent->codecType = HW_AUDIO_DEC_CODEC; - - pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE); - if (pExynosComponent->componentName == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_1; - } - Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE); - Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC); - - pMp3Dec = Exynos_OSAL_Malloc(sizeof(EXYNOS_MP3_HANDLE)); - if (pMp3Dec == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_MP3_HANDLE alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_2; - } - Exynos_OSAL_Memset(pMp3Dec, 0, sizeof(EXYNOS_MP3_HANDLE)); - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pMp3Dec; - - /* Create and Init SRP */ - pMp3Dec->hSRPMp3Handle.bSRPLoaded = OMX_FALSE; - returnCodec = SRP_Create(SRP_INIT_BLOCK_MODE); - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "SRP_Create failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_3; - } - pMp3Dec->hSRPMp3Handle.hSRPHandle = returnCodec; /* SRP's fd */ - - returnCodec = SRP_Init(); - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "SRP_Init failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_4; - } - pMp3Dec->hSRPMp3Handle.bSRPLoaded = OMX_TRUE; - - /* Get input buffer info from SRP */ - returnCodec = SRP_Get_Ibuf_Info(&pInputBuffer, &inputBufferSize, &inputBufferNum); - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "SRP_Get_Ibuf_Info failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_5; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.allocSize = inputBufferSize; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = Exynos_OSAL_Malloc(inputBufferSize); - if (pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Input data buffer alloc failed"); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_5; - } - - /* Get output buffer info from SRP */ - returnCodec = SRP_Get_Obuf_Info(&pOutputBuffer, &outputBufferSize, &outputBufferNum); - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "SRP_Get_Obuf_Info failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_6; - } - - /* Set componentVersion */ - pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->componentVersion.s.nStep = STEP_NUMBER; - - /* Set specVersion */ - pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->specVersion.s.nStep = STEP_NUMBER; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = inputBufferNum; - pExynosPort->portDefinition.nBufferCountMin = inputBufferNum; - pExynosPort->portDefinition.nBufferSize = inputBufferSize; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = outputBufferNum; - pExynosPort->portDefinition.nBufferCountMin = outputBufferNum; - pExynosPort->portDefinition.nBufferSize = outputBufferSize; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM; - - /* Default values for Mp3 audio param */ - INIT_SET_SIZE_VERSION(&pMp3Dec->mp3Param, OMX_AUDIO_PARAM_MP3TYPE); - pMp3Dec->mp3Param.nPortIndex = INPUT_PORT_INDEX; - pMp3Dec->mp3Param.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pMp3Dec->mp3Param.nBitRate = 0; - pMp3Dec->mp3Param.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pMp3Dec->mp3Param.nAudioBandWidth = 0; - pMp3Dec->mp3Param.eChannelMode = OMX_AUDIO_ChannelModeStereo; - pMp3Dec->mp3Param.eFormat = OMX_AUDIO_MP3StreamFormatMP1Layer3; - - /* Default values for PCM audio param */ - INIT_SET_SIZE_VERSION(&pMp3Dec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE); - pMp3Dec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX; - pMp3Dec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pMp3Dec->pcmParam.eNumData = OMX_NumericalDataSigned; - pMp3Dec->pcmParam.eEndian = OMX_EndianLittle; - pMp3Dec->pcmParam.bInterleaved = OMX_TRUE; - pMp3Dec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE; - pMp3Dec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pMp3Dec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear; - pMp3Dec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - pMp3Dec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - - pOMXComponent->GetParameter = &Exynos_SRP_Mp3Dec_GetParameter; - pOMXComponent->SetParameter = &Exynos_SRP_Mp3Dec_SetParameter; - pOMXComponent->GetConfig = &Exynos_SRP_Mp3Dec_GetConfig; - pOMXComponent->SetConfig = &Exynos_SRP_Mp3Dec_SetConfig; - pOMXComponent->GetExtensionIndex = &Exynos_SRP_Mp3Dec_GetExtensionIndex; - pOMXComponent->ComponentRoleEnum = &Exynos_SRP_Mp3Dec_ComponentRoleEnum; - pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit; - - /* ToDo: Change the function name associated with a specific codec */ - pExynosComponent->exynos_codec_componentInit = &Exynos_SRP_Mp3Dec_Init; - pExynosComponent->exynos_codec_componentTerminate = &Exynos_SRP_Mp3Dec_Terminate; - pAudioDec->exynos_codec_bufferProcess = &Exynos_SRP_Mp3Dec_bufferProcess; - pAudioDec->exynos_checkInputFrame = NULL; - - pExynosComponent->currentState = OMX_StateLoaded; - - ret = OMX_ErrorNone; - goto EXIT; /* This function is performed successfully. */ - -EXIT_ERROR_6: - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - Exynos_OSAL_Free(pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE]); - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; -EXIT_ERROR_5: - SRP_Deinit(); -EXIT_ERROR_4: - SRP_Terminate(); -EXIT_ERROR_3: - Exynos_OSAL_Free(pMp3Dec); - pAudioDec->hCodecHandle = NULL; -EXIT_ERROR_2: - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; -EXIT_ERROR_1: - Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - if (pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE]) { - Exynos_OSAL_Free(pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE]); - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - if (pMp3Dec != NULL) { - if (pMp3Dec->hSRPMp3Handle.bSRPLoaded == OMX_TRUE) { - SRP_Deinit(); - SRP_Terminate(); - } - Exynos_OSAL_Free(pMp3Dec); - ((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL; - } - - ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h b/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h deleted file mode 100644 index 6e871b5..0000000 --- a/openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Mp3dec.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_MP3_DEC_COMPONENT -#define EXYNOS_OMX_MP3_DEC_COMPONENT - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" - -typedef struct _EXYNOS_SRP_MP3_HANDLE -{ - OMX_U32 hSRPHandle; - OMX_BOOL bConfiguredSRP; - OMX_BOOL bSRPLoaded; - OMX_BOOL bSRPSendEOS; - OMX_S32 returnCodec; -} EXYNOS_SRP_MP3_HANDLE; - -typedef struct _EXYNOS_MP3_HANDLE -{ - /* OMX Codec specific */ - OMX_AUDIO_PARAM_MP3TYPE mp3Param; - OMX_AUDIO_PARAM_PCMMODETYPE pcmParam; - - /* SEC SRP Codec specific */ - EXYNOS_SRP_MP3_HANDLE hSRPMp3Handle; -} EXYNOS_MP3_HANDLE; - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName); - OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_MP3_DEC_COMPONENT */ diff --git a/openmax/component/audio/dec/mp3/NOTICE b/openmax/component/audio/dec/mp3/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/dec/mp3/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/dec/mp3/library_register.c b/openmax/component/audio/dec/mp3/library_register.c deleted file mode 100644 index f0775cc..0000000 --- a/openmax/component/audio/dec/mp3/library_register.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Memory.h" -#include "Exynos_OSAL_ETC.h" -#include "library_register.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent) -{ - FunctionIn(); - - if (ppExynosComponent == NULL) - goto EXIT; - - /* component 1 - audio decoder MP3 */ - Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - -EXIT: - FunctionOut(); - return MAX_COMPONENT_NUM; -} - diff --git a/openmax/component/audio/dec/mp3/library_register.h b/openmax/component/audio/dec/mp3/library_register.h deleted file mode 100644 index 7b9c34a..0000000 --- a/openmax/component/audio/dec/mp3/library_register.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_MP3_DEC_REG -#define EXYNOS_OMX_MP3_DEC_REG - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OMX_Component_Register.h" - - -#define OSCL_EXPORT_REF __attribute__((visibility("default"))) -#define MAX_COMPONENT_NUM 1 -#define MAX_COMPONENT_ROLE_NUM 1 - -/* MP3 */ -#define EXYNOS_OMX_COMPONENT_MP3_DEC "OMX.Exynos.MP3.Decoder" -#define EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE "audio_decoder.mp3" - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_MP3_DEC_REG */ - diff --git a/openmax/component/audio/dec/wma/Android.mk b/openmax/component/audio/dec/wma/Android.mk deleted file mode 100644 index 0b51c45..0000000 --- a/openmax/component/audio/dec/wma/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_Wmadec.c \ - library_register.c - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libOMX.Exynos.WMA.Decoder -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/omx -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \ - libsrpapi -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \ - libExynosOMX_Resourcemanager libffmpegapi\ - -LOCAL_C_INCLUDES := $(EXYNOS_OMX_INC)/khronos \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/dec \ - $(EXYNOS_AUDIO_CODEC)/alp/include \ - $(EXYNOS_AUDIO_CODEC)/ffmpeg/include - -include $(BUILD_SHARED_LIBRARY) diff --git a/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c b/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c deleted file mode 100644 index 601a0c2..0000000 --- a/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c +++ /dev/null @@ -1,750 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Wmadec.c - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.09.07 : Create - */ - -#include -#include -#include - -#include "Exynos_OMX_Macros.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Thread.h" -#include "library_register.h" -#include "Exynos_OMX_Wmadec.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_WMA_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioWma: - { - OMX_AUDIO_PARAM_WMATYPE *pDstWmaParam = (OMX_AUDIO_PARAM_WMATYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_WMATYPE *pSrcWmaParam = NULL; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstWmaParam, sizeof(OMX_AUDIO_PARAM_WMATYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pDstWmaParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pWmaDec = (EXYNOS_WMA_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcWmaParam = &pWmaDec->wmaParam; - - Exynos_OSAL_Memcpy(pDstWmaParam, pSrcWmaParam, sizeof(OMX_AUDIO_PARAM_WMATYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pWmaDec = (EXYNOS_WMA_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcPcmParam = &pWmaDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_S32 codecType; - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_WMA_DEC_ROLE); - } - break; - default: - ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioWma: - { - OMX_AUDIO_PARAM_WMATYPE *pDstWmaParam = NULL; - OMX_AUDIO_PARAM_WMATYPE *pSrcWmaParam = (OMX_AUDIO_PARAM_WMATYPE *)pComponentParameterStructure; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcWmaParam, sizeof(OMX_AUDIO_PARAM_WMATYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pSrcWmaParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pWmaDec = (EXYNOS_WMA_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstWmaParam = &pWmaDec->wmaParam; - - Exynos_OSAL_Memcpy(pDstWmaParam, pSrcWmaParam, sizeof(OMX_AUDIO_PARAM_WMATYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pWmaDec = (EXYNOS_WMA_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstPcmParam = &pWmaDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_WMA_DEC_ROLE)) { - pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingWMA; - } else { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - } - break; - default: - ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - /* TODO : Support for various OMX_INDEXTYPE */ - default: - ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - /* TODO : Support for various OMX_INDEXTYPE */ - default: - ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_ComponentRoleEnum( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 codecType; - - FunctionIn(); - - if ((hComponent == NULL) || (cRole == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) - goto EXIT; - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_WMA_DEC_ROLE); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_Init(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_WMA_HANDLE *pWmaDec = (EXYNOS_WMA_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Wma extractor should parse into frame unit. */ - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - - FFmpeg_Init(&pWmaDec->ffmpeg); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_WMA_HANDLE *pWmaDec = (EXYNOS_WMA_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - FFmpeg_DeInit(&pWmaDec->ffmpeg); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_codecConfigure(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData) -{ - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_WMA_HANDLE *pWmaDec = (EXYNOS_WMA_HANDLE *)pAudioDec->hCodecHandle; - - const int codec_info_size = 18; - - FFmpeg *ffmpeg = &pWmaDec->ffmpeg; - CodecInfoHhr codecInfo; - char extra_data[10]; - - Exynos_OSAL_Memcpy(&codecInfo, pInputData->buffer.addr[AUDIO_DATA_PLANE], codec_info_size); - Exynos_OSAL_Memcpy(extra_data, ((char*)pInputData->buffer.addr[AUDIO_DATA_PLANE]) + codec_info_size, - codecInfo.codecSpecificDataSize); - - return FFmpeg_CodecOpen(ffmpeg, codecInfo.codecID, codecInfo.averageNumberOfbytesPerSecond * 8, - extra_data, codecInfo.codecSpecificDataSize, codecInfo.sampleRates, - codecInfo.numberOfChannels, codecInfo.blockAlignment); -} - -OMX_ERRORTYPE Exynos_FFMPEG_WmaDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_WMA_HANDLE *pWmaDec = (EXYNOS_WMA_HANDLE *)pAudioDec->hCodecHandle; - EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - - FunctionIn(); - - if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) || - (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { - ret = Exynos_FFMPEG_WmaDec_codecConfigure(pOMXComponent, pInputData); - } else { - /* Save timestamp and flags of input data */ - pOutputData->timeStamp = pInputData->timeStamp; - pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS); - - /* WARNING IT DOESNT GUARANTEE WORKING WELL TO MULTIPLE FRAMES */ - pInputData->dataLen = pInputData->allocSize; - pOutputData->dataLen = pOutputData->allocSize; - ret = FFmpeg_Decode(&pWmaDec->ffmpeg, - pInputData->buffer.addr[AUDIO_DATA_PLANE], (int*)&pInputData->dataLen, - pOutputData->buffer.addr[AUDIO_DATA_PLANE], (int*)&pOutputData->dataLen); - } - - if (ret != OMX_ErrorNone) { - if (ret == OMX_ErrorInputDataDecodeYet) { - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } else { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } else { - pInputData->usedDataLen += pInputData->dataLen; - pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen; - pInputData->dataLen -= pInputData->usedDataLen; - pInputData->usedDataLen = 0; - - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - OMX_PTR pInputBuffer = NULL; - OMX_PTR pOutputBuffer = NULL; - unsigned int inputBufferSize = AUDIO_INBUF_SIZE; - unsigned int inputBufferNum = 1; - unsigned int outputBufferSize = AVCODEC_MAX_AUDIO_FRAME_SIZE; - unsigned int outputBufferNum = 1; - OMX_S32 returnCodec; - int i = 0; - - FunctionIn(); - - if ((hComponent == NULL) || (componentName == NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_WMA_DEC, componentName) != 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosComponent->codecType = HW_AUDIO_DEC_CODEC; - - pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE); - if (pExynosComponent->componentName == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_1; - } - Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE); - Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_WMA_DEC); - - pWmaDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_WMA_HANDLE)); - if (pWmaDec == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_WMA_HANDLE alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_2; - } - Exynos_OSAL_Memset(pWmaDec, 0, sizeof(EXYNOS_WMA_HANDLE)); - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pWmaDec; - - /* Get input buffer info */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = Exynos_OSAL_Malloc(inputBufferSize); - if (pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Input data buffer alloc failed"); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_3; - } - pExynosPort->processData.allocSize = inputBufferSize; - - /* Set componentVersion */ - pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->componentVersion.s.nStep = STEP_NUMBER; - - /* Set specVersion */ - pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->specVersion.s.nStep = STEP_NUMBER; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = inputBufferNum; - pExynosPort->portDefinition.nBufferCountMin = inputBufferNum; - pExynosPort->portDefinition.nBufferSize = inputBufferSize; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/x-ms-wma"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingWMA; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = outputBufferNum; - pExynosPort->portDefinition.nBufferCountMin = outputBufferNum; - pExynosPort->portDefinition.nBufferSize = outputBufferSize; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM; - - /* Default values for Wma audio param */ - INIT_SET_SIZE_VERSION(&pWmaDec->wmaParam, OMX_AUDIO_PARAM_WMATYPE); - pWmaDec->wmaParam.nPortIndex = INPUT_PORT_INDEX; - pWmaDec->wmaParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pWmaDec->wmaParam.nBitRate = 0; - pWmaDec->wmaParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pWmaDec->wmaParam.eFormat = OMX_AUDIO_WMAFormat9; - - /* Default values for PCM audio param */ - INIT_SET_SIZE_VERSION(&pWmaDec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE); - pWmaDec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX; - pWmaDec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pWmaDec->pcmParam.eNumData = OMX_NumericalDataSigned; - pWmaDec->pcmParam.eEndian = OMX_EndianLittle; - pWmaDec->pcmParam.bInterleaved = OMX_TRUE; - pWmaDec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE; - pWmaDec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pWmaDec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear; - pWmaDec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - pWmaDec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - - pOMXComponent->GetParameter = &Exynos_FFMPEG_WmaDec_GetParameter; - pOMXComponent->SetParameter = &Exynos_FFMPEG_WmaDec_SetParameter; - pOMXComponent->GetConfig = &Exynos_FFMPEG_WmaDec_GetConfig; - pOMXComponent->SetConfig = &Exynos_FFMPEG_WmaDec_SetConfig; - pOMXComponent->GetExtensionIndex = &Exynos_FFMPEG_WmaDec_GetExtensionIndex; - pOMXComponent->ComponentRoleEnum = &Exynos_FFMPEG_WmaDec_ComponentRoleEnum; - pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit; - - /* ToDo: Change the function name associated with a specific codec */ - pExynosComponent->exynos_codec_componentInit = &Exynos_FFMPEG_WmaDec_Init; - pExynosComponent->exynos_codec_componentTerminate = &Exynos_FFMPEG_WmaDec_Terminate; - pAudioDec->exynos_codec_bufferProcess = &Exynos_FFMPEG_WmaDec_bufferProcess; - pAudioDec->exynos_checkInputFrame = NULL; - - pExynosComponent->currentState = OMX_StateLoaded; - - ret = OMX_ErrorNone; - goto EXIT; /* This function is performed successfully. */ - -EXIT_ERROR_3: - Exynos_OSAL_Free(pWmaDec); - pAudioDec->hCodecHandle = NULL; -EXIT_ERROR_2: - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; -EXIT_ERROR_1: - Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_WMA_HANDLE *pWmaDec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - if (pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE]) { - Exynos_OSAL_Free(pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE]); - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; - } - - pWmaDec = (EXYNOS_WMA_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - if (pWmaDec != NULL) { - Exynos_OSAL_Free(pWmaDec); - ((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL; - } - - ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); - if (ret != OMX_ErrorNone) - goto EXIT; - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h b/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h deleted file mode 100644 index 9cef0c4..0000000 --- a/openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Wmadec.h - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.09.07 : Create - */ - -#ifndef EXYNOS_OMX_WMA_DEC_COMPONENT -#define EXYNOS_OMX_WMA_DEC_COMPONENT - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "ffmpeg_api.h" - -/* - * This structure is the same as BitmapInfoHhr struct in pv_avifile_typedefs.h file - */ -typedef struct _CodecInfoHhr -{ - OMX_U16 codecID; - OMX_U16 numberOfChannels; - OMX_U32 sampleRates; - OMX_U32 averageNumberOfbytesPerSecond; - OMX_U16 blockAlignment; - OMX_U16 bitsPerSample; - OMX_U16 codecSpecificDataSize; -} CodecInfoHhr; - -typedef struct _EXYNOS_WMA_HANDLE -{ - /* OMX Codec specific */ - OMX_AUDIO_PARAM_WMATYPE wmaParam; - OMX_AUDIO_PARAM_PCMMODETYPE pcmParam; - - FFmpeg ffmpeg; -} EXYNOS_WMA_HANDLE; - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName); - OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_WMA_DEC_COMPONENT */ diff --git a/openmax/component/audio/dec/wma/NOTICE b/openmax/component/audio/dec/wma/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/dec/wma/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/dec/wma/library_register.c b/openmax/component/audio/dec/wma/library_register.c deleted file mode 100644 index a2122c0..0000000 --- a/openmax/component/audio/dec/wma/library_register.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.c - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.09.07 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Memory.h" -#include "Exynos_OSAL_ETC.h" -#include "library_register.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_WMA_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent) -{ - FunctionIn(); - - if (ppExynosComponent == NULL) - goto EXIT; - - /* component 1 - audio decoder WMA */ - Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_WMA_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_WMA_DEC_ROLE); - ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - -EXIT: - FunctionOut(); - return MAX_COMPONENT_NUM; -} diff --git a/openmax/component/audio/dec/wma/library_register.h b/openmax/component/audio/dec/wma/library_register.h deleted file mode 100644 index 0e7aaad..0000000 --- a/openmax/component/audio/dec/wma/library_register.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.h - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.09.07 : Create - */ - -#ifndef EXYNOS_OMX_WMA_DEC_REG -#define EXYNOS_OMX_WMA_DEC_REG - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OMX_Component_Register.h" - - -#define OSCL_EXPORT_REF __attribute__((visibility("default"))) -#define MAX_COMPONENT_NUM 1 -#define MAX_COMPONENT_ROLE_NUM 1 - -/* WMA */ -#define EXYNOS_OMX_COMPONENT_WMA_DEC "OMX.Exynos.WMA.Decoder" -#define EXYNOS_OMX_COMPONENT_WMA_DEC_ROLE "audio_decoder.wma" - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_WMA_DEC_REG */ diff --git a/openmax/component/audio/seiren_dec/Android.mk b/openmax/component/audio/seiren_dec/Android.mk deleted file mode 100644 index 89c4ba1..0000000 --- a/openmax/component/audio/seiren_dec/Android.mk +++ /dev/null @@ -1,29 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - Exynos_OMX_Adec.c - -LOCAL_MODULE := libExynosOMX_Adec -LOCAL_ARM_MODE := arm -LOCAL_MODULE_TAGS := optional -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_STATIC_LIBRARIES := libseirenhw - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \ - $(EXYNOS_AUDIO_CODEC)/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -LOCAL_C_INCLUDES += $(ANDROID_MEDIA_INC)/openmax -endif - -include $(BUILD_STATIC_LIBRARY) diff --git a/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.c b/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.c deleted file mode 100644 index 4ca8bfa..0000000 --- a/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.c +++ /dev/null @@ -1,1537 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Adec.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include "Exynos_OMX_Macros.h" -#include "Exynos_OSAL_Event.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OMX_Basecomponent.h" -#include "Exynos_OSAL_Thread.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Mutex.h" -#include "Exynos_OSAL_ETC.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_AUDIO_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -OMX_ERRORTYPE Exynos_OMX_UseBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes, - OMX_IN OMX_U8 *pBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (nPortIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)Exynos_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE)); - if (temp_bufferHeader == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE)); - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (pExynosPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) { - pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader; - pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ASSIGNED | HEADER_STATE_ALLOCATED); - INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE); - temp_bufferHeader->pBuffer = pBuffer; - temp_bufferHeader->nAllocLen = nSizeBytes; - temp_bufferHeader->pAppPrivate = pAppPrivate; - if (nPortIndex == INPUT_PORT_INDEX) - temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX; - else - temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX; - - pExynosPort->assignedBufferNum++; - if (pExynosPort->assignedBufferNum == (OMX_S32)pExynosPort->portDefinition.nBufferCountActual) { - pExynosPort->portDefinition.bPopulated = OMX_TRUE; - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - } - *ppBufferHdr = temp_bufferHeader; - ret = OMX_ErrorNone; - goto EXIT; - } - } - - Exynos_OSAL_Free(temp_bufferHeader); - ret = OMX_ErrorInsufficientResources; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AllocateBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - if (nPortIndex >= pExynosComponent->portParam.nPorts) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - temp_buffer = Exynos_OSAL_Malloc(sizeof(OMX_U8) * nSizeBytes); - if (temp_buffer == NULL) { - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - - temp_bufferHeader = (OMX_BUFFERHEADERTYPE *)Exynos_OSAL_Malloc(sizeof(OMX_BUFFERHEADERTYPE)); - if (temp_bufferHeader == NULL) { - Exynos_OSAL_Free(temp_buffer); - temp_buffer = NULL; - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - Exynos_OSAL_Memset(temp_bufferHeader, 0, sizeof(OMX_BUFFERHEADERTYPE)); - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (pExynosPort->bufferStateAllocate[i] == BUFFER_STATE_FREE) { - pExynosPort->extendBufferHeader[i].OMXBufferHeader = temp_bufferHeader; - pExynosPort->bufferStateAllocate[i] = (BUFFER_STATE_ALLOCATED | HEADER_STATE_ALLOCATED); - INIT_SET_SIZE_VERSION(temp_bufferHeader, OMX_BUFFERHEADERTYPE); - temp_bufferHeader->pBuffer = temp_buffer; - temp_bufferHeader->nAllocLen = nSizeBytes; - temp_bufferHeader->pAppPrivate = pAppPrivate; - if (nPortIndex == INPUT_PORT_INDEX) - temp_bufferHeader->nInputPortIndex = INPUT_PORT_INDEX; - else - temp_bufferHeader->nOutputPortIndex = OUTPUT_PORT_INDEX; - pExynosPort->assignedBufferNum++; - if (pExynosPort->assignedBufferNum == (OMX_S32)pExynosPort->portDefinition.nBufferCountActual) { - pExynosPort->portDefinition.bPopulated = OMX_TRUE; - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->loadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - } - *ppBuffer = temp_bufferHeader; - ret = OMX_ErrorNone; - goto EXIT; - } - } - - Exynos_OSAL_Free(temp_bufferHeader); - Exynos_OSAL_Free(temp_buffer); - ret = OMX_ErrorInsufficientResources; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FreeBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - - if (CHECK_PORT_TUNNELED(pExynosPort) && CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - if ((pExynosPort->portState != EXYNOS_OMX_PortStateDisabling) && - (pExynosPort->portState != EXYNOS_OMX_PortStateFlushingForDisable) && - (pExynosPort->portState != EXYNOS_OMX_PortStateInvalid)) { - (*(pExynosComponent->pCallbacks->EventHandler)) (pOMXComponent, - pExynosComponent->callbackData, - (OMX_U32)OMX_EventError, - (OMX_U32)OMX_ErrorPortUnpopulated, - nPortIndex, NULL); - } - - for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) { - if (((pExynosPort->bufferStateAllocate[i] | BUFFER_STATE_FREE) != 0) && (pExynosPort->extendBufferHeader[i].OMXBufferHeader != NULL)) { - if (pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer == pBufferHdr->pBuffer) { - if (pExynosPort->bufferStateAllocate[i] & BUFFER_STATE_ALLOCATED) { - Exynos_OSAL_Free(pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer); - pExynosPort->extendBufferHeader[i].OMXBufferHeader->pBuffer = NULL; - pBufferHdr->pBuffer = NULL; - } else if (pExynosPort->bufferStateAllocate[i] & BUFFER_STATE_ASSIGNED) { - ; /* None*/ - } - pExynosPort->assignedBufferNum--; - if (pExynosPort->bufferStateAllocate[i] & HEADER_STATE_ALLOCATED) { - Exynos_OSAL_Free(pExynosPort->extendBufferHeader[i].OMXBufferHeader); - pExynosPort->extendBufferHeader[i].OMXBufferHeader = NULL; - pBufferHdr = NULL; - } - pExynosPort->bufferStateAllocate[i] = BUFFER_STATE_FREE; - ret = OMX_ErrorNone; - goto EXIT; - } - } - } - -EXIT: - if (ret == OMX_ErrorNone) { - if (pExynosPort->assignedBufferNum == 0) { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pExynosPort->unloadedResource signal set"); - /* Exynos_OSAL_MutexLock(pExynosComponent->compMutex); */ - Exynos_OSAL_SemaphorePost(pExynosPort->unloadedResource); - /* Exynos_OSAL_MutexUnlock(pExynosComponent->compMutex); */ - pExynosPort->portDefinition.bPopulated = OMX_FALSE; - } - } - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_BUFFERHEADERTYPE *temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 bufferSize = 0; - OMX_PARAM_PORTDEFINITIONTYPE portDefinition; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT* pExynosPort = NULL; - OMX_BUFFERHEADERTYPE* temp_bufferHeader = NULL; - OMX_U8 *temp_buffer = NULL; - OMX_U32 bufferSize = 0; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest( - OMX_IN OMX_HANDLETYPE hComp, - OMX_IN OMX_U32 nPort, - OMX_IN OMX_HANDLETYPE hTunneledComp, - OMX_IN OMX_U32 nTunneledPort, - OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - ret = OMX_ErrorTunnelingUnsupported; -EXIT: - return ret; -} - -OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - if ((pExynosComponent->currentState == OMX_StateExecuting) && - (pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portState == EXYNOS_OMX_PortStateIdle) && - (pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX].portState == EXYNOS_OMX_PortStateIdle) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateExecutingToIdle) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateIdleToExecuting)) { - return OMX_TRUE; - } else { - return OMX_FALSE; - } -} - -OMX_ERRORTYPE Exynos_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOMXInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOMXOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *dataBuffer = &exynosOMXInputPort->dataBuffer; - OMX_BUFFERHEADERTYPE *bufferHeader = dataBuffer->bufferHeader; - - FunctionIn(); - - if (bufferHeader != NULL) { - if (exynosOMXInputPort->markType.hMarkTargetComponent != NULL ) { - bufferHeader->hMarkTargetComponent = exynosOMXInputPort->markType.hMarkTargetComponent; - bufferHeader->pMarkData = exynosOMXInputPort->markType.pMarkData; - exynosOMXInputPort->markType.hMarkTargetComponent = NULL; - exynosOMXInputPort->markType.pMarkData = NULL; - } - - if (bufferHeader->hMarkTargetComponent != NULL) { - if (bufferHeader->hMarkTargetComponent == pOMXComponent) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventMark, - 0, 0, bufferHeader->pMarkData); - } else { - pExynosComponent->propagateMarkType.hMarkTargetComponent = bufferHeader->hMarkTargetComponent; - pExynosComponent->propagateMarkType.pMarkData = bufferHeader->pMarkData; - } - } - - bufferHeader->nFilledLen = 0; - Exynos_OMX_InputBufferReturn(pOMXComponent, bufferHeader); - } - - if ((pExynosComponent->currentState == OMX_StatePause) && - ((!CHECK_PORT_BEING_FLUSHED(exynosOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOMXOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - dataBuffer->dataValid = OMX_FALSE; - dataBuffer->dataLen = 0; - dataBuffer->remainDataLen = 0; - dataBuffer->usedDataLen = 0; - dataBuffer->bufferHeader = NULL; - dataBuffer->nFlags = 0; - dataBuffer->timeStamp = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_InputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *dataBuffer = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - pExynosPort= &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - dataBuffer = &pExynosPort->dataBuffer; - - if (pExynosComponent->currentState != OMX_StateExecuting) { - ret = OMX_ErrorUndefined; - goto EXIT; - } else { - Exynos_OSAL_SemaphoreWait(pExynosPort->bufferSemID); - Exynos_OSAL_MutexLock(dataBuffer->bufferMutex); - if (dataBuffer->dataValid != OMX_TRUE) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message == NULL) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - goto EXIT; - } - - dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData); - dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen; - dataBuffer->dataLen = dataBuffer->bufferHeader->nFilledLen; - dataBuffer->remainDataLen = dataBuffer->dataLen; - dataBuffer->usedDataLen = 0; - dataBuffer->dataValid = OMX_TRUE; - dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; - dataBuffer->timeStamp = dataBuffer->bufferHeader->nTimeStamp; - - Exynos_OSAL_Free(message); - - if (dataBuffer->allocSize <= dataBuffer->dataLen) - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "Input Buffer Full, Check input buffer size! allocSize:%d, dataLen:%d", dataBuffer->allocSize, dataBuffer->dataLen); - } - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - ret = OMX_ErrorNone; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOMXInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOMXOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *dataBuffer = &exynosOMXOutputPort->dataBuffer; - OMX_BUFFERHEADERTYPE *bufferHeader = dataBuffer->bufferHeader; - - FunctionIn(); - - if (bufferHeader != NULL) { - bufferHeader->nFilledLen = dataBuffer->remainDataLen; - bufferHeader->nOffset = 0; - bufferHeader->nFlags = dataBuffer->nFlags; - bufferHeader->nTimeStamp = dataBuffer->timeStamp; - - if (pExynosComponent->propagateMarkType.hMarkTargetComponent != NULL) { - bufferHeader->hMarkTargetComponent = pExynosComponent->propagateMarkType.hMarkTargetComponent; - bufferHeader->pMarkData = pExynosComponent->propagateMarkType.pMarkData; - pExynosComponent->propagateMarkType.hMarkTargetComponent = NULL; - pExynosComponent->propagateMarkType.pMarkData = NULL; - } - - if (bufferHeader->nFlags & OMX_BUFFERFLAG_EOS) { - pExynosComponent->pCallbacks->EventHandler(pOMXComponent, - pExynosComponent->callbackData, - OMX_EventBufferFlag, - OUTPUT_PORT_INDEX, - bufferHeader->nFlags, NULL); - } - - Exynos_OMX_OutputBufferReturn(pOMXComponent, bufferHeader); - } - - if ((pExynosComponent->currentState == OMX_StatePause) && - ((!CHECK_PORT_BEING_FLUSHED(exynosOMXInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOMXOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - /* reset dataBuffer */ - dataBuffer->dataValid = OMX_FALSE; - dataBuffer->dataLen = 0; - dataBuffer->remainDataLen = 0; - dataBuffer->usedDataLen = 0; - dataBuffer->bufferHeader = NULL; - dataBuffer->nFlags = 0; - dataBuffer->timeStamp = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OutputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *dataBuffer = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - pExynosPort= &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - dataBuffer = &pExynosPort->dataBuffer; - - if (pExynosComponent->currentState != OMX_StateExecuting) { - ret = OMX_ErrorUndefined; - goto EXIT; - } else { - Exynos_OSAL_SemaphoreWait(pExynosPort->bufferSemID); - Exynos_OSAL_MutexLock(dataBuffer->bufferMutex); - if (dataBuffer->dataValid != OMX_TRUE) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message == NULL) { - ret = OMX_ErrorUndefined; - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - goto EXIT; - } - - dataBuffer->bufferHeader = (OMX_BUFFERHEADERTYPE *)(message->pCmdData); - dataBuffer->allocSize = dataBuffer->bufferHeader->nAllocLen; - dataBuffer->dataLen = 0; //dataBuffer->bufferHeader->nFilledLen; - dataBuffer->remainDataLen = dataBuffer->dataLen; - dataBuffer->usedDataLen = 0; //dataBuffer->bufferHeader->nOffset; - dataBuffer->dataValid = OMX_TRUE; - /* dataBuffer->nFlags = dataBuffer->bufferHeader->nFlags; */ - /* dataBuffer->nTimeStamp = dataBuffer->bufferHeader->nTimeStamp; */ - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = dataBuffer->bufferHeader->pBuffer; - pExynosPort->processData.allocSize = dataBuffer->bufferHeader->nAllocLen; - - Exynos_OSAL_Free(message); - } - Exynos_OSAL_MutexUnlock(dataBuffer->bufferMutex); - ret = OMX_ErrorNone; - } -EXIT: - FunctionOut(); - - return ret; - -} - -OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_BOOL ret = OMX_FALSE; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_OMX_BASEPORT *exynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *inputUseBuffer = &exynosInputPort->dataBuffer; - EXYNOS_OMX_DATA *inputData = &exynosInputPort->processData; - OMX_U32 copySize = 0; - OMX_BYTE checkInputStream = NULL; - OMX_U32 checkInputStreamLen = 0; - OMX_U32 checkedSize = 0; - OMX_BOOL flagEOF = OMX_FALSE; - OMX_BOOL previousFrameEOF = OMX_FALSE; - - FunctionIn(); - - if (inputUseBuffer->dataValid == OMX_TRUE) { - checkInputStream = inputUseBuffer->bufferHeader->pBuffer + inputUseBuffer->usedDataLen; - checkInputStreamLen = inputUseBuffer->remainDataLen; - - if (inputData->dataLen == 0) { - previousFrameEOF = OMX_TRUE; - } else { - previousFrameEOF = OMX_FALSE; - } - - /* Audio extractor should parse into frame units. */ - flagEOF = OMX_TRUE; - checkedSize = checkInputStreamLen; - copySize = checkedSize; - - if (inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) - pExynosComponent->bSaveFlagEOS = OMX_TRUE; - - if (((inputData->allocSize) - (inputData->dataLen)) >= copySize) { - if (copySize > 0) - Exynos_OSAL_Memcpy((char*)inputData->buffer.addr[AUDIO_DATA_PLANE] + inputData->dataLen, checkInputStream, copySize); - - inputUseBuffer->dataLen -= copySize; - inputUseBuffer->remainDataLen -= copySize; - inputUseBuffer->usedDataLen += copySize; - - inputData->dataLen += copySize; - inputData->remainDataLen += copySize; - - if (previousFrameEOF == OMX_TRUE) { - inputData->timeStamp = inputUseBuffer->timeStamp; - inputData->nFlags = inputUseBuffer->nFlags; - } - - if (pExynosComponent->bUseFlagEOF == OMX_TRUE) { - if (pExynosComponent->bSaveFlagEOS == OMX_TRUE) { - inputData->nFlags |= OMX_BUFFERFLAG_EOS; - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - } else { - inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS)); - } - } else { - if ((checkedSize == checkInputStreamLen) && (pExynosComponent->bSaveFlagEOS == OMX_TRUE)) { - if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && - ((inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || - (inputData->dataLen == 0))) { - inputData->nFlags |= OMX_BUFFERFLAG_EOS; - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - } else if ((inputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) && - (!(inputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) && - (inputData->dataLen != 0)) { - inputData->nFlags = (inputData->nFlags & (~OMX_BUFFERFLAG_EOS)); - flagEOF = OMX_TRUE; - pExynosComponent->bSaveFlagEOS = OMX_TRUE; - } - } else { - inputData->nFlags = (inputUseBuffer->nFlags & (~OMX_BUFFERFLAG_EOS)); - } - } - } else { - /*????????????????????????????????? Error ?????????????????????????????????*/ - Exynos_InputBufferReturn(pOMXComponent); - Exynos_ResetCodecData(inputData); - flagEOF = OMX_FALSE; - } - - if ((inputUseBuffer->remainDataLen == 0) || - (CHECK_PORT_BEING_FLUSHED(exynosInputPort))) - Exynos_InputBufferReturn(pOMXComponent); - else - inputUseBuffer->dataValid = OMX_TRUE; - } - - if (flagEOF == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) { - /* Flush seiren buffers */ - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOFFFFFFFF!!!!!!!!OMX_FLUSH_SEIREN"); - - pAudioDec->exynos_codec_flushSeiren(pOMXComponent, PORT_OUT); - //ADec_Flush(NULL, PORT_OUT); - - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_TRUE; - pExynosComponent->checkTimeStamp.startTimeStamp = inputData->timeStamp; - pExynosComponent->checkTimeStamp.nStartFlags = inputData->nFlags; - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "first frame timestamp after seeking %lld us (%.2f secs)", - inputData->timeStamp, inputData->timeStamp / 1E6); - } - - ret = OMX_TRUE; - } else { - ret = OMX_FALSE; - } - - FunctionOut(); - - return ret; -} - -OMX_BOOL Exynos_Postprocess_OutputData(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_BOOL ret = OMX_FALSE; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *exynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *outputUseBuffer = &exynosOutputPort->dataBuffer; - EXYNOS_OMX_DATA *outputData = &exynosOutputPort->processData; - OMX_U32 copySize = 0; - - FunctionIn(); - - if (outputUseBuffer->dataValid == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.needCheckStartTimeStamp == OMX_TRUE) { - if (pExynosComponent->checkTimeStamp.startTimeStamp == outputData->timeStamp) { - pExynosComponent->checkTimeStamp.startTimeStamp = RESET_TIMESTAMP_VAL; - pExynosComponent->checkTimeStamp.nStartFlags = 0x0; - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE; - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; - } else { - ret = OMX_TRUE; - goto EXIT; - } - } else if (pExynosComponent->checkTimeStamp.needSetStartTimeStamp == OMX_TRUE) { - ret = OMX_TRUE; - goto EXIT; - } - - if (outputData->remainDataLen <= (outputUseBuffer->allocSize - outputUseBuffer->dataLen)) { - copySize = outputData->remainDataLen; - - outputUseBuffer->dataLen += copySize; - outputUseBuffer->remainDataLen += copySize; - outputUseBuffer->nFlags = outputData->nFlags; - outputUseBuffer->timeStamp = outputData->timeStamp; - - ret = OMX_TRUE; - - if ((outputUseBuffer->remainDataLen > 0) || - (outputUseBuffer->nFlags & OMX_BUFFERFLAG_EOS) || - (CHECK_PORT_BEING_FLUSHED(exynosOutputPort))) { - Exynos_OutputBufferReturn(pOMXComponent); - - /* reset outputData */ - Exynos_ResetCodecData(outputData); - } - } else { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "output buffer is smaller than decoded data size Out Length"); - - ret = OMX_FALSE; - - /* reset outputData */ - Exynos_ResetCodecData(outputData); - } - } else { - ret = OMX_FALSE; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_OMX_BASEPORT *exynosInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *exynosOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - EXYNOS_OMX_DATABUFFER *inputUseBuffer = &exynosInputPort->dataBuffer; - EXYNOS_OMX_DATABUFFER *outputUseBuffer = &exynosOutputPort->dataBuffer; - EXYNOS_OMX_DATA *inputData = &exynosInputPort->processData; - EXYNOS_OMX_DATA *outputData = &exynosOutputPort->processData; - OMX_U32 copySize = 0; - - pExynosComponent->reInputData = OMX_FALSE; - - FunctionIn(); - - while (!pAudioDec->bExitBufferProcessThread) { - if (((pExynosComponent->currentState == OMX_StatePause) || - (pExynosComponent->currentState == OMX_StateIdle) || - (pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle) || - (pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle)) && - (pExynosComponent->transientState != EXYNOS_OMX_TransStateIdleToLoaded)&& - ((!CHECK_PORT_BEING_FLUSHED(exynosInputPort) && !CHECK_PORT_BEING_FLUSHED(exynosOutputPort)))) { - Exynos_OSAL_SignalWait(pExynosComponent->pauseEvent, DEF_MAX_WAIT_TIME); - Exynos_OSAL_SignalReset(pExynosComponent->pauseEvent); - } - - while ((Exynos_Check_BufferProcess_State(pExynosComponent)) && (!pAudioDec->bExitBufferProcessThread)) { - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - if ((outputUseBuffer->dataValid != OMX_TRUE) && - (!CHECK_PORT_BEING_FLUSHED(exynosOutputPort))) { - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - ret = Exynos_OutputBufferGetQueue(pExynosComponent); - if ((ret == OMX_ErrorUndefined) || - (exynosInputPort->portState != EXYNOS_OMX_PortStateIdle) || - (exynosOutputPort->portState != EXYNOS_OMX_PortStateIdle)) { - break; - } - } else { - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - } - - if (pExynosComponent->reInputData == OMX_FALSE) { - Exynos_OSAL_MutexLock(inputUseBuffer->bufferMutex); - if ((Exynos_Preprocessor_InputData(pOMXComponent) == OMX_FALSE) && - (!CHECK_PORT_BEING_FLUSHED(exynosInputPort))) { - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - ret = Exynos_InputBufferGetQueue(pExynosComponent); - break; - } - - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - } - - Exynos_OSAL_MutexLock(inputUseBuffer->bufferMutex); - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - if ((outputUseBuffer->dataValid == OMX_TRUE) && ((inputData->dataLen > 0) || (inputData->nFlags & OMX_BUFFERFLAG_EOS))) - ret = pAudioDec->exynos_codec_bufferProcess(pOMXComponent, inputData, outputData); - else { - ret = OMX_ErrorNone; - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - break; - } - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - Exynos_OSAL_MutexUnlock(inputUseBuffer->bufferMutex); - - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) - pExynosComponent->reInputData = OMX_TRUE; - else - pExynosComponent->reInputData = OMX_FALSE; - - Exynos_OSAL_MutexLock(outputUseBuffer->bufferMutex); - Exynos_Postprocess_OutputData(pOMXComponent); - Exynos_OSAL_MutexUnlock(outputUseBuffer->bufferMutex); - } - } - -EXIT: - - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_GetFlushBuffer(EXYNOS_OMX_BASEPORT *pExynosPort, EXYNOS_OMX_DATABUFFER **pDataBuffer) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - - FunctionIn(); - - *pDataBuffer = &pExynosPort->dataBuffer; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 portIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *flushPortBuffer = NULL; - OMX_BUFFERHEADERTYPE *bufferHeader = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - OMX_U32 flushNum = 0; - OMX_S32 semValue = 0; - - FunctionIn(); - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) { - message = (EXYNOS_OMX_MESSAGE *)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ); - if (message != NULL) { - bufferHeader = (OMX_BUFFERHEADERTYPE *)message->pCmdData; - bufferHeader->nFilledLen = 0; - - if (portIndex == OUTPUT_PORT_INDEX) { - Exynos_OMX_OutputBufferReturn(pOMXComponent, bufferHeader); - } else { - Exynos_OMX_InputBufferReturn(pOMXComponent, bufferHeader); - } - - Exynos_OSAL_Free(message); - message = NULL; - } - } - - Exynos_OMX_GetFlushBuffer(pExynosPort, &flushPortBuffer); - if (flushPortBuffer != NULL) { - if (flushPortBuffer->dataValid == OMX_TRUE) { - if (portIndex == INPUT_PORT_INDEX) - Exynos_InputBufferReturn(pOMXComponent); - else if (portIndex == OUTPUT_PORT_INDEX) - Exynos_OutputBufferReturn(pOMXComponent); - - /* reset outputData */ - Exynos_ResetCodecData(&(pExynosPort->processData)); - } - } - - while(1) { - OMX_S32 cnt = 0; - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[portIndex].bufferSemID, &cnt); - if (cnt <= 0) - break; - if (Exynos_OSAL_SemaphoreTryWait(pExynosComponent->pExynosPort[portIndex].bufferSemID) == OMX_ErrorUndefined) - Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "Cannot be happened"); - } - Exynos_OSAL_SetElemNum(&pExynosPort->bufferQ, 0); - - pExynosPort->processData.dataLen = 0; - pExynosPort->processData.nFlags = 0; - pExynosPort->processData.remainDataLen = 0; - pExynosPort->processData.timeStamp = 0; - pExynosPort->processData.usedDataLen = 0; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_DATABUFFER *flushPortBuffer = NULL; - OMX_U32 i = 0, cnt = 0; - - FunctionIn(); - - if (pOMXComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - - pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; - Exynos_OMX_GetFlushBuffer(pExynosPort, &flushPortBuffer); - - Exynos_OSAL_MutexLock(flushPortBuffer->bufferMutex); - ret = Exynos_OMX_FlushPort(pOMXComponent, nPortIndex); - Exynos_OSAL_MutexUnlock(flushPortBuffer->bufferMutex); - - if (bEvent == OMX_TRUE && ret == OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "bEVENT!!!!!!OMX_FLUSH_SEIREN"); - pAudioDec->exynos_codec_flushSeiren(pOMXComponent, nPortIndex); - } - - if (nPortIndex == INPUT_PORT_INDEX) { - pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_TRUE; - pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE; - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pExynosComponent->reInputData = OMX_FALSE; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioInit: - { - OMX_PORT_PARAM_TYPE *portParam = (OMX_PORT_PARAM_TYPE *)ComponentParameterStructure; - ret = Exynos_OMX_Check_SizeVersion(portParam, sizeof(OMX_PORT_PARAM_TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - portParam->nPorts = pExynosComponent->portParam.nPorts; - portParam->nStartPortNumber = pExynosComponent->portParam.nStartPortNumber; - ret = OMX_ErrorNone; - } - break; - case OMX_IndexParamAudioPortFormat: - { - OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portFormat->nPortIndex; - OMX_U32 index = portFormat->nIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL; - OMX_U32 supportFormatNum = 0; /* supportFormatNum = N-1 */ - - ret = Exynos_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((portIndex >= pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - - if (portIndex == INPUT_PORT_INDEX) { - supportFormatNum = INPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1; - if (index > supportFormatNum) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - portDefinition = &pExynosPort->portDefinition; - - portFormat->eEncoding = portDefinition->format.audio.eEncoding; - } else if (portIndex == OUTPUT_PORT_INDEX) { - supportFormatNum = OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX - 1; - if (index > supportFormatNum) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - portDefinition = &pExynosPort->portDefinition; - - portFormat->eEncoding = portDefinition->format.audio.eEncoding; - } - ret = OMX_ErrorNone; - } - break; - default: - { - ret = Exynos_OMX_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); - } - break; - } - -EXIT: - FunctionOut(); - - return ret; -} -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - if (ComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioPortFormat: - { - OMX_AUDIO_PARAM_PORTFORMATTYPE *portFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE *)ComponentParameterStructure; - OMX_U32 portIndex = portFormat->nPortIndex; - OMX_U32 index = portFormat->nIndex; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - OMX_PARAM_PORTDEFINITIONTYPE *portDefinition = NULL; - OMX_U32 supportFormatNum = 0; /* supportFormatNum = N-1 */ - - ret = Exynos_OMX_Check_SizeVersion(portFormat, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((portIndex >= pExynosComponent->portParam.nPorts)) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pExynosPort = &pExynosComponent->pExynosPort[portIndex]; - portDefinition = &pExynosPort->portDefinition; - - portDefinition->format.audio.eEncoding = portFormat->eEncoding; - ret = OMX_ErrorNone; - } - break; - default: - { - ret = Exynos_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure); - } - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexConfigAudioMute: - { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexConfigAudioMute"); - ret = OMX_ErrorUnsupportedIndex; - } - break; - case OMX_IndexConfigAudioVolume: - { - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "OMX_IndexConfigAudioVolume"); - ret = OMX_ErrorUnsupportedIndex; - } - break; - default: - ret = Exynos_OMX_SetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_GetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -static OMX_ERRORTYPE Exynos_OMX_BufferProcessThread(OMX_PTR threadData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pSECComponent = NULL; - EXYNOS_OMX_MESSAGE *message = NULL; - - FunctionIn(); - - if (threadData == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)threadData; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - pSECComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - Exynos_OMX_BufferProcess(pOMXComponent); - - Exynos_OSAL_ThreadExit(NULL); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess_Create(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - - FunctionIn(); - - pAudioDec->bExitBufferProcessThread = OMX_FALSE; - - ret = Exynos_OSAL_ThreadCreate(&pAudioDec->hBufferProcessThread, - Exynos_OMX_BufferProcessThread, - pOMXComponent); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - OMX_S32 countValue = 0; - unsigned int i = 0; - - FunctionIn(); - - pAudioDec->bExitBufferProcessThread = OMX_TRUE; - - for (i = 0; i < ALL_PORT_NUM; i++) { - Exynos_OSAL_Get_SemaphoreCount(pExynosComponent->pExynosPort[i].bufferSemID, &countValue); - if (countValue == 0) - Exynos_OSAL_SemaphorePost(pExynosComponent->pExynosPort[i].bufferSemID); - } - - Exynos_OSAL_SignalSet(pExynosComponent->pauseEvent); - Exynos_OSAL_ThreadTerminate(pAudioDec->hBufferProcessThread); - pAudioDec->hBufferProcessThread = NULL; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - ret = Exynos_OMX_BaseComponent_Constructor(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - ret = Exynos_OMX_Port_Constructor(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OMX_BaseComponent_Destructor(pOMXComponent); - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_Error, Line:%d", __LINE__); - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pAudioDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_AUDIODEC_COMPONENT)); - if (pAudioDec == NULL) { - Exynos_OMX_BaseComponent_Destructor(pOMXComponent); - ret = OMX_ErrorInsufficientResources; - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__); - goto EXIT; - } - - Exynos_OSAL_Memset(pAudioDec, 0, sizeof(EXYNOS_OMX_AUDIODEC_COMPONENT)); - pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pAudioDec; - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = MAX_AUDIO_INPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferCountMin = MAX_AUDIO_INPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferSize = DEFAULT_AUDIO_INPUT_BUFFER_SIZE; - pExynosPort->portDefinition.eDomain = OMX_PortDomainAudio; - - pExynosPort->portDefinition.format.audio.cMIMEType = Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = MAX_AUDIO_OUTPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferCountMin = MAX_AUDIO_OUTPUTBUFFER_NUM; - pExynosPort->portDefinition.nBufferSize = DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE; - pExynosPort->portDefinition.eDomain = OMX_PortDomainAudio; - - pExynosPort->portDefinition.format.audio.cMIMEType = Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingUnused; - - - pOMXComponent->UseBuffer = &Exynos_OMX_UseBuffer; - pOMXComponent->AllocateBuffer = &Exynos_OMX_AllocateBuffer; - pOMXComponent->FreeBuffer = &Exynos_OMX_FreeBuffer; - pOMXComponent->ComponentTunnelRequest = &Exynos_OMX_ComponentTunnelRequest; - -#ifdef TUNNELING_SUPPORT - pExynosComponent->exynos_AllocateTunnelBuffer = &Exynos_OMX_AllocateTunnelBuffer; - pExynosComponent->exynos_FreeTunnelBuffer = &Exynos_OMX_FreeTunnelBuffer; -#endif - pExynosComponent->exynos_BufferProcessCreate = &Exynos_OMX_BufferProcess_Create; - pExynosComponent->exynos_BufferProcessTerminate = &Exynos_OMX_BufferProcess_Terminate; - pExynosComponent->exynos_BufferFlush = &Exynos_OMX_BufferFlush; - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - int i = 0; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - Exynos_OSAL_Free(pAudioDec); - pExynosComponent->hComponentHandle = pAudioDec = NULL; - - for(i = 0; i < ALL_PORT_NUM; i++) { - pExynosPort = &pExynosComponent->pExynosPort[i]; - Exynos_OSAL_Free(pExynosPort->portDefinition.format.audio.cMIMEType); - pExynosPort->portDefinition.format.audio.cMIMEType = NULL; - } - - ret = Exynos_OMX_Port_Destructor(pOMXComponent); - - ret = Exynos_OMX_BaseComponent_Destructor(hComponent); - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.h b/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.h deleted file mode 100644 index d0d0bf5..0000000 --- a/openmax/component/audio/seiren_dec/Exynos_OMX_Adec.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Adec.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_AUDIO_DECODE -#define EXYNOS_OMX_AUDIO_DECODE - -#include "OMX_Component.h" -#include "Exynos_OMX_Def.h" -#include "Exynos_OSAL_Queue.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "seiren_hw.h" - -#define MAX_AUDIO_INPUTBUFFER_NUM 2 -#define MAX_AUDIO_OUTPUTBUFFER_NUM 2 - -#define DEFAULT_AUDIO_INPUT_BUFFER_SIZE (16 * 1024) -#define DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE (32 * 1024) - -#define DEFAULT_AUDIO_SAMPLING_FREQ 44100 -#define DEFAULT_AUDIO_CHANNELS_NUM 2 -#define DEFAULT_AUDIO_BIT_PER_SAMPLE 16 - -#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 -#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1 - -#define AUDIO_DATA_PLANE 0 - -typedef struct _SRP_DEC_INPUT_BUFFER -{ - void *PhyAddr; // physical address - void *VirAddr; // virtual address - int bufferSize; // input buffer alloc size - int dataSize; // Data length -} SRP_DEC_INPUT_BUFFER; - -typedef struct _EXYNOS_OMX_AUDIODEC_COMPONENT -{ - OMX_HANDLETYPE hCodecHandle; - - OMX_BOOL bFirstFrame; - OMX_PTR pInputBuffer; - SRP_DEC_INPUT_BUFFER SRPDecInputBuffer[MAX_AUDIO_INPUTBUFFER_NUM]; - OMX_U32 indexInputBuffer; - - /* Buffer Process */ - OMX_BOOL bExitBufferProcessThread; - OMX_HANDLETYPE hBufferProcessThread; - - OMX_ERRORTYPE (*exynos_codec_bufferProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData); - OMX_ERRORTYPE (*exynos_codec_flushSeiren) (OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type); - - int (*exynos_checkInputFrame)(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); -} EXYNOS_OMX_AUDIODEC_COMPONENT; - - -#ifdef __cplusplus -extern "C" { -#endif - -OMX_ERRORTYPE Exynos_OMX_UseBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes, - OMX_IN OMX_U8 *pBuffer); -OMX_ERRORTYPE Exynos_OMX_AllocateBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_PTR pAppPrivate, - OMX_IN OMX_U32 nSizeBytes); -OMX_ERRORTYPE Exynos_OMX_FreeBuffer( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_U32 nPortIndex, - OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr); -OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer( - EXYNOS_OMX_BASEPORT *pOMXBasePort, - OMX_U32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer( - EXYNOS_OMX_BASEPORT *pOMXBasePort, - OMX_U32 nPortIndex); -OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest( - OMX_IN OMX_HANDLETYPE hComp, - OMX_IN OMX_U32 nPort, - OMX_IN OMX_HANDLETYPE hTunneledComp, - OMX_IN OMX_U32 nTunneledPort, - OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup); -OMX_ERRORTYPE Exynos_OMX_BufferProcess(OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR ComponentParameterStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR ComponentParameterStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetConfig( - OMX_HANDLETYPE hComponent, - OMX_INDEXTYPE nIndex, - OMX_PTR pComponentConfigStructure); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent); -OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent); -OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent); - -#ifdef __cplusplus -} -#endif - -#endif /* EXYNOS_OMX_AUDIO_DECODE */ diff --git a/openmax/component/audio/seiren_dec/NOTICE b/openmax/component/audio/seiren_dec/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/seiren_dec/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/seiren_dec/aac/Android.mk b/openmax/component/audio/seiren_dec/aac/Android.mk deleted file mode 100644 index 0fde9ae..0000000 --- a/openmax/component/audio/seiren_dec/aac/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_Aacdec.c \ - library_register.c - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libOMX.Exynos.AAC.Decoder -LOCAL_MODULE_RELATIVE_PATH := omx -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \ - libseirenhw -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \ - libExynosOMX_Resourcemanager - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \ - $(EXYNOS_AUDIO_CODEC)/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -endif -endif - -include $(BUILD_SHARED_LIBRARY) diff --git a/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.c b/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.c deleted file mode 100644 index 7cc80a6..0000000 --- a/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.c +++ /dev/null @@ -1,970 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Aacdec.c - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#include -#include -#include - -#include "Exynos_OMX_Macros.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Thread.h" -#include "library_register.h" -#include "Exynos_OMX_Aacdec.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_AAC_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -//#define Seiren_DUMP_TO_FILE -#ifdef Seiren_DUMP_TO_FILE -#include "stdio.h" - -FILE *inFile; -FILE *outFile; -#endif - -OMX_ERRORTYPE Exynos_Seiren_AacDec_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioAac: - { - OMX_AUDIO_PARAM_AACPROFILETYPE *pDstAacParam = (OMX_AUDIO_PARAM_AACPROFILETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_AACPROFILETYPE *pSrcAacParam = NULL; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstAacParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcAacParam = &pAacDec->aacParam; - - Exynos_OSAL_Memcpy(pDstAacParam, pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcPcmParam = &pAacDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_S32 codecType; - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE); - } - break; - default: - ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioAac: - { - OMX_AUDIO_PARAM_AACPROFILETYPE *pDstAacParam = NULL; - OMX_AUDIO_PARAM_AACPROFILETYPE *pSrcAacParam = (OMX_AUDIO_PARAM_AACPROFILETYPE *)pComponentParameterStructure; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcAacParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstAacParam = &pAacDec->aacParam; - - Exynos_OSAL_Memcpy(pDstAacParam, pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE)); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSize : %d \e[0m", pDstAacParam->nSize); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nPortIndex : %d \e[0m", pDstAacParam->nPortIndex); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nChannels : %d \e[0m", pDstAacParam->nChannels); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSampleRate : %d \e[0m", pDstAacParam->nSampleRate); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nBitRate : %d \e[0m", pDstAacParam->nBitRate); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAudioBandWidth : %d \e[0m", pDstAacParam->nAudioBandWidth); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nFrameLength : %d \e[0m", pDstAacParam->nFrameLength); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAACtools : %d \e[0m", pDstAacParam->nAACtools); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAACERtools : %d \e[0m", pDstAacParam->nAACERtools); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eAACProfile : %d \e[0m", pDstAacParam->eAACProfile); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eAACStreamFormat : %d \e[0m", pDstAacParam->eAACStreamFormat); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eChannelMode : %d \e[0m", pDstAacParam->eChannelMode); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstPcmParam = &pAacDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE)) { - pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingAAC; - } else { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - } - break; - default: - ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_ComponentRoleEnum( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 codecType; - - FunctionIn(); - - if ((hComponent == NULL) || (cRole == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_Init(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Aac extractor should parse into frame unit. */ - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pAacDec->hSeirenAacHandle.bConfiguredSeiren = OMX_FALSE; - pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - -#ifdef Seiren_DUMP_TO_FILE - inFile = fopen("/data/InFile.aac", "w+"); - outFile = fopen("/data/OutFile.pcm", "w+"); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - fclose(inFile); - fclose(outFile); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Aac_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle; - int returnCodec = 0; - unsigned long long isSeirenStopped = 0; - OMX_BOOL isSeirenIbufOverflow = OMX_FALSE; - - u32 fd = pAacDec->hSeirenAacHandle.hSeirenHandle; - audio_mem_info_t input_mem_pool = pAacDec->hSeirenAacHandle.input_mem_pool; - audio_mem_info_t output_mem_pool = pAacDec->hSeirenAacHandle.output_mem_pool; - unsigned long long sample_rate, channels; - int consumed_size = 0; - sample_rate = channels = 0; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - if (pExynosComponent->reInputData == OMX_FALSE) { - fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile); - } -#endif - - /* Save timestamp and flags of input data */ - pOutputData->timeStamp = pInputData->timeStamp; - pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS); - - /* Decoding aac frames by Seiren */ - if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) { - input_mem_pool.data_size = pInputData->dataLen; - char* pt = input_mem_pool.virt_addr; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp); - - if (pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { - if (pAacDec->hSeirenAacHandle.bConfiguredSeiren == OMX_TRUE) - goto EXIT; - - ADec_ConfigSignal(fd); - unsigned char sample_rate_index = ((*(pt+1)) >> 7 & 0x01) | - ((*pt) << 1 & 0x0e); - unsigned char num_of_channel = ((*(pt+1)) >> 3 & 0x07); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "index %x ", sample_rate_index); - ADec_SetParams(fd, PCM_PARAM_SAMPLE_RATE, (unsigned long long)aac_sample_rates[sample_rate_index]); - ADec_SetParams(fd, PCM_PARAM_NUM_OF_CH, (unsigned long long)num_of_channel); - - /* AAC setup-data(or DSI) could be various length. But it only needs 2byte */ - input_mem_pool.data_size = 2; - ADec_SendStream(fd, &input_mem_pool, &consumed_size); - goto EXIT; - } - returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size); - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec); - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!"); - if (returnCodec >= 0) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - ADec_SendEOS(fd); - pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_TRUE; - } - } else if (returnCodec < 0) { - ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode; - goto EXIT; - } - } - - if (pAacDec->hSeirenAacHandle.bConfiguredSeiren == OMX_FALSE) { - if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE; - ret = OMX_ErrorNone; - goto EXIT; - } - - returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate); - returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels); - - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT; - } - - if (!sample_rate || !channels) { - if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - } - ret = OMX_ErrorNone; - goto EXIT;// - } - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)", - channels, sample_rate); - - if (pAacDec->pcmParam.nChannels != channels || - pAacDec->pcmParam.nSamplingRate != sample_rate) { - /* Change channel count and sampling rate information */ - pAacDec->pcmParam.nChannels = channels; - pAacDec->pcmParam.nSamplingRate = sample_rate; - - /* Send Port Settings changed call back */ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - - pAacDec->hSeirenAacHandle.bConfiguredSeiren = OMX_TRUE; - - if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - ret = OMX_ErrorNone; - } - goto EXIT; - } - - /* Get decoded data from Seiren */ - ADec_RecvPCM(fd, &output_mem_pool); - if (output_mem_pool.data_size > 0) { - pOutputData->dataLen = output_mem_pool.data_size; - Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE], - output_mem_pool.virt_addr, output_mem_pool.data_size); - } else { - pOutputData->dataLen = 0; - } - -#ifdef Seiren_DUMP_TO_FILE - if (pOutputData->dataLen > 0) - fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile); -#endif - - /* Delay EOS signal until all the PCM is returned from the Seiren driver. */ - if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped); - if (returnCodec != 0) - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE"); - if (isSeirenStopped == 1) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */ - ret = OMX_ErrorNone; - } else { - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } - } else { /* Flush after EOS */ - pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE; - } - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - - FunctionIn(); - - if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) || - (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - - ret = Exynos_Seiren_Aac_Decode_Block(pOMXComponent, pInputData, pOutputData); - - if (ret != OMX_ErrorNone) { - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) { - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } else { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } else { - pInputData->usedDataLen += pInputData->dataLen; - pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen; - pInputData->dataLen -= pInputData->usedDataLen; - pInputData->usedDataLen = 0; - - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_AacDec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle; - - int fd = pAacDec->hSeirenAacHandle.hSeirenHandle; - return ADec_Flush(fd, type); -} - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; - OMX_S32 fd; - - int i = 0; - - FunctionIn(); - - if ((hComponent == NULL) || (componentName == NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_AAC_DEC, componentName) != 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosComponent->codecType = HW_AUDIO_DEC_CODEC; - - pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE); - if (pExynosComponent->componentName == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_1; - } - Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE); - Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_AAC_DEC); - - pAacDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_AAC_HANDLE)); - if (pAacDec == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_AAC_HANDLE alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_2; - } - Exynos_OSAL_Memset(pAacDec, 0, sizeof(EXYNOS_AAC_HANDLE)); - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pAacDec; - - /* Create and Init Seiren */ - pAacDec->hSeirenAacHandle.bSeirenLoaded = OMX_FALSE; - fd = ADec_Create(0, ADEC_AAC, NULL); - - if (fd < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_3; - } - pAacDec->hSeirenAacHandle.hSeirenHandle = fd; /* Seiren's fd */ - pAacDec->hSeirenAacHandle.bSeirenLoaded = OMX_TRUE; - - /* Get input buffer info from Seiren */ - Exynos_OSAL_Memset(&pAacDec->hSeirenAacHandle.input_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetIMemPoolInfo(fd, &pAacDec->hSeirenAacHandle.input_mem_pool); - input_mem_pool = pAacDec->hSeirenAacHandle.input_mem_pool; - - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "eiren_Adec_GetIMemPoolInfo : %d", input_mem_pool.mem_size); - - if (input_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_5; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.allocSize = input_mem_pool.mem_size; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr; - - /* Get output buffer info from Seiren */ - Exynos_OSAL_Memset(&pAacDec->hSeirenAacHandle.output_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetOMemPoolInfo(fd, &pAacDec->hSeirenAacHandle.output_mem_pool); - output_mem_pool = pAacDec->hSeirenAacHandle.output_mem_pool; - if (output_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_6; - } - - /* Set componentVersion */ - pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->componentVersion.s.nStep = STEP_NUMBER; - - /* Set specVersion */ - pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->specVersion.s.nStep = STEP_NUMBER; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/aac"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingAAC; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM; - - /* Default values for Aac audio param */ - INIT_SET_SIZE_VERSION(&pAacDec->aacParam, OMX_AUDIO_PARAM_AACPROFILETYPE); - pAacDec->aacParam.nPortIndex = INPUT_PORT_INDEX; - pAacDec->aacParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pAacDec->aacParam.nBitRate = 0; - pAacDec->aacParam.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pAacDec->aacParam.nAudioBandWidth = 0; - pAacDec->aacParam.eChannelMode = OMX_AUDIO_ChannelModeStereo; - pAacDec->aacParam.eAACProfile = OMX_AUDIO_AACObjectNull; - pAacDec->aacParam.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP2ADTS; - - /* Default values for PCM audio param */ - INIT_SET_SIZE_VERSION(&pAacDec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE); - pAacDec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX; - pAacDec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pAacDec->pcmParam.eNumData = OMX_NumericalDataSigned; - pAacDec->pcmParam.eEndian = OMX_EndianLittle; - pAacDec->pcmParam.bInterleaved = OMX_TRUE; - pAacDec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE; - pAacDec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pAacDec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear; - pAacDec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - pAacDec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - - pOMXComponent->GetParameter = &Exynos_Seiren_AacDec_GetParameter; - pOMXComponent->SetParameter = &Exynos_Seiren_AacDec_SetParameter; - pOMXComponent->GetConfig = &Exynos_Seiren_AacDec_GetConfig; - pOMXComponent->SetConfig = &Exynos_Seiren_AacDec_SetConfig; - pOMXComponent->GetExtensionIndex = &Exynos_Seiren_AacDec_GetExtensionIndex; - pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_AacDec_ComponentRoleEnum; - pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit; - - /* ToDo: Change the function name associated with a specific codec */ - pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_AacDec_Init; - pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_AacDec_Terminate; - pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_AacDec_bufferProcess; - pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_AacDec_flushSeiren; - pAudioDec->exynos_checkInputFrame = NULL; - - pExynosComponent->currentState = OMX_StateLoaded; - - ret = OMX_ErrorNone; - goto EXIT; /* This function is performed successfully. */ - -EXIT_ERROR_6: - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; -EXIT_ERROR_5: -EXIT_ERROR_4: - ADec_Destroy(pAacDec->hSeirenAacHandle.hSeirenHandle); -EXIT_ERROR_3: - Exynos_OSAL_Free(pAacDec); - pAudioDec->hCodecHandle = NULL; -EXIT_ERROR_2: - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; -EXIT_ERROR_1: - Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_AAC_HANDLE *pAacDec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (((pExynosComponent->currentState != OMX_StateInvalid) && - (pExynosComponent->currentState != OMX_StateLoaded)) || - ((pExynosComponent->currentState == OMX_StateLoaded) && - (pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle))) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] in curState(0x%x), OMX_FreeHandle() is called. change to OMX_StateInvalid", - pExynosComponent, __FUNCTION__, pExynosComponent->currentState); - Exynos_OMX_Component_abnormalTermination(hComponent); - } - - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; - - pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - if (pAacDec != NULL) { - if (pAacDec->hSeirenAacHandle.bSeirenLoaded == OMX_TRUE) { - ADec_Destroy(pAacDec->hSeirenAacHandle.hSeirenHandle); - } - Exynos_OSAL_Free(pAacDec); - ((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL; - } - - ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.h b/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.h deleted file mode 100644 index 5e32a2a..0000000 --- a/openmax/component/audio/seiren_dec/aac/Exynos_OMX_Aacdec.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Aacdec.h - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#ifndef EXYNOS_OMX_AAC_DEC_COMPONENT -#define EXYNOS_OMX_AAC_DEC_COMPONENT - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "seiren_hw.h" - -static const uint32_t aac_sample_rates[] = -{ - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000 -}; - -typedef struct _EXYNOS_Seiren_AAC_HANDLE -{ - OMX_U32 hSeirenHandle; - OMX_BOOL bConfiguredSeiren; - OMX_BOOL bSeirenLoaded; - OMX_BOOL bSeirenSendEOS; - OMX_S32 returnCodec; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; -} EXYNOS_Seiren_AAC_HANDLE; - -typedef struct _EXYNOS_AAC_HANDLE -{ - /* OMX Codec specific */ - OMX_AUDIO_PARAM_AACPROFILETYPE aacParam; - OMX_AUDIO_PARAM_PCMMODETYPE pcmParam; - - /* SEC Seiren Codec specific */ - EXYNOS_Seiren_AAC_HANDLE hSeirenAacHandle; -} EXYNOS_AAC_HANDLE; - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName); - OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_AAC_DEC_COMPONENT */ diff --git a/openmax/component/audio/seiren_dec/aac/NOTICE b/openmax/component/audio/seiren_dec/aac/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/seiren_dec/aac/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/seiren_dec/aac/library_register.c b/openmax/component/audio/seiren_dec/aac/library_register.c deleted file mode 100644 index cb7f3f5..0000000 --- a/openmax/component/audio/seiren_dec/aac/library_register.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Memory.h" -#include "Exynos_OSAL_ETC.h" -#include "library_register.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_AAC_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent) -{ - FunctionIn(); - - if (ppExynosComponent == NULL) - goto EXIT; - - /* component 1 - audio decoder AAC */ - Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_AAC_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE); - ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - -EXIT: - FunctionOut(); - return MAX_COMPONENT_NUM; -} - diff --git a/openmax/component/audio/seiren_dec/aac/library_register.h b/openmax/component/audio/seiren_dec/aac/library_register.h deleted file mode 100644 index 75b0cc2..0000000 --- a/openmax/component/audio/seiren_dec/aac/library_register.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_AAC_DEC_REG -#define EXYNOS_OMX_AAC_DEC_REG - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OMX_Component_Register.h" - - -#define OSCL_EXPORT_REF __attribute__((visibility("default"))) -#define MAX_COMPONENT_NUM 1 -#define MAX_COMPONENT_ROLE_NUM 1 - -/* AAC */ -#define EXYNOS_OMX_COMPONENT_AAC_DEC "OMX.Exynos.AAC.Decoder" -#define EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE "audio_decoder.aac" - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_AAC_DEC_REG */ - diff --git a/openmax/component/audio/seiren_dec/flac/Android.mk b/openmax/component/audio/seiren_dec/flac/Android.mk deleted file mode 100644 index 5083c4f..0000000 --- a/openmax/component/audio/seiren_dec/flac/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_Flacdec.c \ - library_register.c - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libOMX.Exynos.FLAC.Decoder -LOCAL_MODULE_RELATIVE_PATH := omx -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \ - libseirenhw -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \ - libExynosOMX_Resourcemanager - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \ - $(EXYNOS_AUDIO_CODEC)/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -endif -endif - -include $(BUILD_SHARED_LIBRARY) diff --git a/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.c b/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.c deleted file mode 100644 index d51a97c..0000000 --- a/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.c +++ /dev/null @@ -1,946 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Flacdec.c - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#include -#include -#include - -#include "Exynos_OMX_Macros.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Thread.h" -#include "library_register.h" -#include "Exynos_OMX_Flacdec.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_FLAC_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -//#define Seiren_DUMP_TO_FILE -#ifdef Seiren_DUMP_TO_FILE -#include "stdio.h" - -FILE *inFile; -FILE *outFile; -#endif - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioFlac: - { - OMX_AUDIO_PARAM_FLACTYPE *pDstFlacParam = (OMX_AUDIO_PARAM_FLACTYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_FLACTYPE *pSrcFlacParam = NULL; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstFlacParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcFlacParam = &pFlacDec->flacParam; - - Exynos_OSAL_Memcpy(pDstFlacParam, pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcPcmParam = &pFlacDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_S32 codecType; - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE); - } - break; - default: - ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioFlac: - { - OMX_AUDIO_PARAM_FLACTYPE *pDstFlacParam = NULL; - OMX_AUDIO_PARAM_FLACTYPE *pSrcFlacParam = (OMX_AUDIO_PARAM_FLACTYPE *)pComponentParameterStructure; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcFlacParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstFlacParam = &pFlacDec->flacParam; - - Exynos_OSAL_Memcpy(pDstFlacParam, pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE)); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSize : %d \e[0m", pDstFlacParam->nSize); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nPortIndex : %d \e[0m", pDstFlacParam->nPortIndex); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nChannels : %d \e[0m", pDstFlacParam->nChannels); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSampleRate : %d \e[0m", pDstFlacParam->nSampleRate); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nCompressionLevel : %d \e[0m", pDstFlacParam->nCompressionLevel); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstPcmParam = &pFlacDec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE)) { - pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingFLAC; - } else { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - } - break; - default: - ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_ComponentRoleEnum( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 codecType; - - FunctionIn(); - - if ((hComponent == NULL) || (cRole == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_Init(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Flac extractor should parse into frame unit. */ - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pFlacDec->hSeirenFlacHandle.bConfiguredSeiren = OMX_FALSE; - pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - -#ifdef Seiren_DUMP_TO_FILE - inFile = fopen("/data/InFile.flac", "w+"); - outFile = fopen("/data/OutFile.pcm", "w+"); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - fclose(inFile); - fclose(outFile); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Flac_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle; - int returnCodec = 0; - unsigned long long isSeirenStopped = 0; - OMX_BOOL isSeirenIbufOverflow = OMX_FALSE; - unsigned char* pt; - - u32 fd = pFlacDec->hSeirenFlacHandle.hSeirenHandle; - audio_mem_info_t input_mem_pool = pFlacDec->hSeirenFlacHandle.input_mem_pool; - audio_mem_info_t output_mem_pool = pFlacDec->hSeirenFlacHandle.output_mem_pool; - unsigned long long sample_rate, channels; - int consumed_size = 0; - sample_rate = channels = 0; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - if (pExynosComponent->reInputData == OMX_FALSE) { - fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile); - } -#endif - - /* Save timestamp and flags of input data */ - pOutputData->timeStamp = pInputData->timeStamp; - pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS); - - /* Decoding flac frames by Seiren */ - if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) { - input_mem_pool.data_size = pInputData->dataLen; - pt = (unsigned char*)input_mem_pool.virt_addr; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp); - - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - ADec_SendEOS(fd); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!"); - } - if (pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) - ADec_ConfigSignal(fd); - - returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size); - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec); - if (returnCodec >= 0) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_TRUE; - } - } else if (returnCodec < 0) { - ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode; - goto EXIT; - } - } - - if (pFlacDec->hSeirenFlacHandle.bConfiguredSeiren == OMX_FALSE) { - if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE; - ret = OMX_ErrorNone; - goto EXIT; - } - - returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate); - returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels); - - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT; - } - - if (!sample_rate || !channels) { - if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - } - ret = OMX_ErrorNone; - goto EXIT; - } - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)", - channels, sample_rate); - - if (pFlacDec->pcmParam.nChannels != channels || - pFlacDec->pcmParam.nSamplingRate != sample_rate) { - /* Change channel count and sampling rate information */ - pFlacDec->pcmParam.nChannels = channels; - pFlacDec->pcmParam.nSamplingRate = sample_rate; - - /* Send Port Settings changed call back */ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - - pFlacDec->hSeirenFlacHandle.bConfiguredSeiren = OMX_TRUE; - - if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - ret = OMX_ErrorNone; - } - goto EXIT; - } - - /* Get decoded data from Seiren */ - ADec_RecvPCM(fd, &output_mem_pool); - if (output_mem_pool.data_size > 0) { - pOutputData->dataLen = output_mem_pool.data_size; - Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE], - output_mem_pool.virt_addr, output_mem_pool.data_size); - } else { - pOutputData->dataLen = 0; - } - -#ifdef Seiren_DUMP_TO_FILE - if (pOutputData->dataLen > 0) - fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile); -#endif - - /* Delay EOS signal until all the PCM is returned from the Seiren driver. */ - if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped); - if (returnCodec != 0) - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE"); - if (isSeirenStopped == 1) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */ - ret = OMX_ErrorNone; - } else { - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } - } else { /* Flush after EOS */ - pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE; - } - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - - FunctionIn(); - - if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) || - (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - - ret = Exynos_Seiren_Flac_Decode_Block(pOMXComponent, pInputData, pOutputData); - - if (ret != OMX_ErrorNone) { - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) { - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } else { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } else { - pInputData->usedDataLen += pInputData->dataLen; - pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen; - pInputData->dataLen -= pInputData->usedDataLen; - pInputData->usedDataLen = 0; - - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_FlacDec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle; - - if (type == 1) - return 0; - int fd = pFlacDec->hSeirenFlacHandle.hSeirenHandle; - return ADec_Flush(fd, type); -} - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; - OMX_S32 fd; - - int i = 0; - - FunctionIn(); - - if ((hComponent == NULL) || (componentName == NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_FLAC_DEC, componentName) != 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosComponent->codecType = HW_AUDIO_DEC_CODEC; - - pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE); - if (pExynosComponent->componentName == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_1; - } - Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE); - Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_FLAC_DEC); - - pFlacDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_FLAC_HANDLE)); - if (pFlacDec == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_FLAC_HANDLE alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_2; - } - Exynos_OSAL_Memset(pFlacDec, 0, sizeof(EXYNOS_FLAC_HANDLE)); - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pFlacDec; - - /* Create and Init Seiren */ - pFlacDec->hSeirenFlacHandle.bSeirenLoaded = OMX_FALSE; - fd = ADec_Create(0, ADEC_FLAC, NULL); - - if (fd < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_3; - } - pFlacDec->hSeirenFlacHandle.hSeirenHandle = fd; /* Seiren's fd */ - pFlacDec->hSeirenFlacHandle.bSeirenLoaded = OMX_TRUE; - - /* Get input buffer info from Seiren */ - Exynos_OSAL_Memset(&pFlacDec->hSeirenFlacHandle.input_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetIMemPoolInfo(fd, &pFlacDec->hSeirenFlacHandle.input_mem_pool); - input_mem_pool = pFlacDec->hSeirenFlacHandle.input_mem_pool; - - if (input_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_5; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.allocSize = input_mem_pool.mem_size; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr; - - /* Get output buffer info from Seiren */ - Exynos_OSAL_Memset(&pFlacDec->hSeirenFlacHandle.output_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetOMemPoolInfo(fd, &pFlacDec->hSeirenFlacHandle.output_mem_pool); - output_mem_pool = pFlacDec->hSeirenFlacHandle.output_mem_pool; - if (output_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_6; - } - - /* Set componentVersion */ - pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->componentVersion.s.nStep = STEP_NUMBER; - - /* Set specVersion */ - pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->specVersion.s.nStep = STEP_NUMBER; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/flac"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingFLAC; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM; - - /* Default values for Flac audio param */ - INIT_SET_SIZE_VERSION(&pFlacDec->flacParam, OMX_AUDIO_PARAM_FLACTYPE); - pFlacDec->flacParam.nPortIndex = INPUT_PORT_INDEX; - pFlacDec->flacParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pFlacDec->flacParam.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ; - - /* Default values for PCM audio param */ - INIT_SET_SIZE_VERSION(&pFlacDec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE); - pFlacDec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX; - pFlacDec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pFlacDec->pcmParam.eNumData = OMX_NumericalDataSigned; - pFlacDec->pcmParam.eEndian = OMX_EndianLittle; - pFlacDec->pcmParam.bInterleaved = OMX_TRUE; - pFlacDec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE; - pFlacDec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pFlacDec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear; - pFlacDec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - pFlacDec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - - pOMXComponent->GetParameter = &Exynos_Seiren_FlacDec_GetParameter; - pOMXComponent->SetParameter = &Exynos_Seiren_FlacDec_SetParameter; - pOMXComponent->GetConfig = &Exynos_Seiren_FlacDec_GetConfig; - pOMXComponent->SetConfig = &Exynos_Seiren_FlacDec_SetConfig; - pOMXComponent->GetExtensionIndex = &Exynos_Seiren_FlacDec_GetExtensionIndex; - pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_FlacDec_ComponentRoleEnum; - pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit; - - /* ToDo: Change the function name associated with a specific codec */ - pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_FlacDec_Init; - pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_FlacDec_Terminate; - pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_FlacDec_bufferProcess; - pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_FlacDec_flushSeiren; - pAudioDec->exynos_checkInputFrame = NULL; - - pExynosComponent->currentState = OMX_StateLoaded; - - ret = OMX_ErrorNone; - goto EXIT; /* This function is performed successfully. */ - -EXIT_ERROR_6: - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; -EXIT_ERROR_5: -EXIT_ERROR_4: - ADec_Destroy(pFlacDec->hSeirenFlacHandle.hSeirenHandle); -EXIT_ERROR_3: - Exynos_OSAL_Free(pFlacDec); - pAudioDec->hCodecHandle = NULL; -EXIT_ERROR_2: - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; -EXIT_ERROR_1: - Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_FLAC_HANDLE *pFlacDec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if (((pExynosComponent->currentState != OMX_StateInvalid) && - (pExynosComponent->currentState != OMX_StateLoaded)) || - ((pExynosComponent->currentState == OMX_StateLoaded) && - (pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle))) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] in curState(0x%x), OMX_FreeHandle() is called. change to OMX_StateInvalid", - pExynosComponent, __FUNCTION__, pExynosComponent->currentState); - Exynos_OMX_Component_abnormalTermination(hComponent); - } - - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; - - pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - if (pFlacDec != NULL) { - if (pFlacDec->hSeirenFlacHandle.bSeirenLoaded == OMX_TRUE) { - ADec_Destroy(pFlacDec->hSeirenFlacHandle.hSeirenHandle); - } - Exynos_OSAL_Free(pFlacDec); - ((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL; - } - - ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.h b/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.h deleted file mode 100644 index 7f88847..0000000 --- a/openmax/component/audio/seiren_dec/flac/Exynos_OMX_Flacdec.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Flacdec.h - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#ifndef EXYNOS_OMX_FLAC_DEC_COMPONENT -#define EXYNOS_OMX_FLAC_DEC_COMPONENT - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "seiren_hw.h" - -static const uint32_t flac_sample_rates[] = -{ - 0, 88200, 176400, 192000, 8000, 16000, 22050, 24000, - 32000, 44100, 48000, 96000, 0, 0, 0, 0 -}; -static const uint32_t flac_channels[] = -{ - 1, 2, 3, 4, 5, 6, 7, 8, - 2, 2, 2, 0, 0, 0, 0, 0 -}; - -typedef struct _EXYNOS_Seiren_FLAC_HANDLE -{ - OMX_U32 hSeirenHandle; - OMX_BOOL bConfiguredSeiren; - OMX_BOOL bSeirenLoaded; - OMX_BOOL bSeirenSendEOS; - OMX_S32 returnCodec; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; -} EXYNOS_Seiren_FLAC_HANDLE; - -typedef struct _EXYNOS_FLAC_HANDLE -{ - /* OMX Codec specific */ - OMX_AUDIO_PARAM_FLACTYPE flacParam; - OMX_AUDIO_PARAM_PCMMODETYPE pcmParam; - - /* SEC Seiren Codec specific */ - EXYNOS_Seiren_FLAC_HANDLE hSeirenFlacHandle; -} EXYNOS_FLAC_HANDLE; - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName); - OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_FLAC_DEC_COMPONENT */ diff --git a/openmax/component/audio/seiren_dec/flac/NOTICE b/openmax/component/audio/seiren_dec/flac/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/seiren_dec/flac/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/seiren_dec/flac/library_register.c b/openmax/component/audio/seiren_dec/flac/library_register.c deleted file mode 100644 index e242810..0000000 --- a/openmax/component/audio/seiren_dec/flac/library_register.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Memory.h" -#include "Exynos_OSAL_ETC.h" -#include "library_register.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_FLAC_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent) -{ - FunctionIn(); - - if (ppExynosComponent == NULL) - goto EXIT; - - /* component 1 - audio decoder FLAC */ - Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_FLAC_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE); - ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - -EXIT: - FunctionOut(); - return MAX_COMPONENT_NUM; -} - diff --git a/openmax/component/audio/seiren_dec/flac/library_register.h b/openmax/component/audio/seiren_dec/flac/library_register.h deleted file mode 100644 index f9d4e5b..0000000 --- a/openmax/component/audio/seiren_dec/flac/library_register.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_FLAC_DEC_REG -#define EXYNOS_OMX_FLAC_DEC_REG - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OMX_Component_Register.h" - - -#define OSCL_EXPORT_REF __attribute__((visibility("default"))) -#define MAX_COMPONENT_NUM 1 -#define MAX_COMPONENT_ROLE_NUM 1 - -/* FLAC */ -#define EXYNOS_OMX_COMPONENT_FLAC_DEC "OMX.Exynos.FLAC.Decoder" -#define EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE "audio_decoder.flac" - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_FLAC_DEC_REG */ - diff --git a/openmax/component/audio/seiren_dec/mp3/Android.mk b/openmax/component/audio/seiren_dec/mp3/Android.mk deleted file mode 100644 index ae82ac2..0000000 --- a/openmax/component/audio/seiren_dec/mp3/Android.mk +++ /dev/null @@ -1,41 +0,0 @@ -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - Exynos_OMX_Mp3dec.c \ - library_register.c - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := libOMX.Exynos.MP3.Decoder -LOCAL_MODULE_RELATIVE_PATH := omx -LOCAL_PROPRIETARY_MODULE := true - -LOCAL_CFLAGS := - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \ - libseirenhw -LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \ - libExynosOMX_Resourcemanager - -LOCAL_C_INCLUDES := \ - $(EXYNOS_OMX_INC)/exynos \ - $(EXYNOS_OMX_TOP)/osal \ - $(EXYNOS_OMX_TOP)/core \ - $(EXYNOS_OMX_COMPONENT)/common \ - $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \ - $(EXYNOS_AUDIO_CODEC)/include - -ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true) -LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER -LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos -else -ifeq ($(BOARD_USE_ANDROID), true) -LOCAL_HEADER_LIBRARIES := media_plugin_headers -endif -endif - -include $(BUILD_SHARED_LIBRARY) diff --git a/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.c b/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.c deleted file mode 100644 index df82339..0000000 --- a/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.c +++ /dev/null @@ -1,955 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Mp3dec.c - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#include -#include -#include -/ -#include "Exynos_OMX_Macros.h" -#include "Exynos_OMX_ABasecomponent.h" -#include "Exynos_OMX_ABaseport.h" -#include "Exynos_OMX_Adec.h" -#include "Exynos_OSAL_ETC.h" -#include "Exynos_OSAL_Semaphore.h" -#include "Exynos_OSAL_Thread.h" -#include "library_register.h" -#include "Exynos_OMX_Mp3dec.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - -//#define Seiren_DUMP_TO_FILE -#ifdef Seiren_DUMP_TO_FILE -#include "stdio.h" - -FILE *inFile; -FILE *outFile; -#endif - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, - OMX_INOUT OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nParamIndex) { - case OMX_IndexParamAudioMp3: - { - OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstMp3Param->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcMp3Param = &pMp3Dec->mp3Param; - - Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pSrcPcmParam = &pMp3Dec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_S32 codecType; - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - } - break; - default: - ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_SetParameter( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentParameterStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentParameterStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - case OMX_IndexParamAudioMp3: - { - OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = NULL; - OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcMp3Param->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstMp3Param = &pMp3Dec->mp3Param; - - Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE)); - } - break; - case OMX_IndexParamAudioPcm: - { - OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL; - OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - - ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) { - ret = OMX_ErrorBadPortIndex; - goto EXIT; - } - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - pDstPcmParam = &pMp3Dec->pcmParam; - - Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); - } - break; - case OMX_IndexParamStandardComponentRole: - { - OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure; - - ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) { - ret = OMX_ErrorIncorrectStateOperation; - goto EXIT; - } - - if (!Exynos_OSAL_Strncmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE, 16)) { - pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3; - } else { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - } - break; - default: - ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure); - break; - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_SetConfig( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, - OMX_IN OMX_PTR pComponentConfigStructure) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL || pComponentConfigStructure == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - switch (nIndex) { - default: - ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure); - break; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetExtensionIndex( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_STRING cParameterName, - OMX_OUT OMX_INDEXTYPE *pIndexType) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - if ((cParameterName == NULL) || (pIndexType == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (pExynosComponent->currentState == OMX_StateInvalid) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_ComponentRoleEnum( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - OMX_S32 codecType; - - FunctionIn(); - - if ((hComponent == NULL) || (cRole == NULL)) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) { - ret = OMX_ErrorNoMore; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE)); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - if (pOMXComponent->pComponentPrivate == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - if (pExynosComponent->currentState == OMX_StateInvalid ) { - ret = OMX_ErrorInvalidState; - goto EXIT; - } - - Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_Init(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle; - - FunctionIn(); - - INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP); - Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS); - pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Mp3 extractor should parse into frame unit. */ - pExynosComponent->bSaveFlagEOS = OMX_FALSE; - pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren = OMX_FALSE; - pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - -#ifdef Seiren_DUMP_TO_FILE - inFile = fopen("/data/InFile.mp3", "w+"); - outFile = fopen("/data/OutFile.pcm", "w+"); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - fclose(inFile); - fclose(outFile); -#endif - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle; - int returnCodec = 0; - unsigned long long isSeirenStopped = 0; - OMX_BOOL isSeirenIbufOverflow = OMX_FALSE; - - u32 fd = pMp3Dec->hSeirenMp3Handle.hSeirenHandle; - audio_mem_info_t input_mem_pool = pMp3Dec->hSeirenMp3Handle.input_mem_pool; - audio_mem_info_t output_mem_pool = pMp3Dec->hSeirenMp3Handle.output_mem_pool; - unsigned long long sample_rate, channels; - int consumed_size = 0; - unsigned char* pt = NULL; - sample_rate = channels = 0; - - FunctionIn(); - -#ifdef Seiren_DUMP_TO_FILE - if (pExynosComponent->reInputData == OMX_FALSE) { - fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile); - } -#endif - - /* Save timestamp and flags of input data */ - pOutputData->timeStamp = pInputData->timeStamp; - pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS); - - /* Decoding mp3 frames by Seiren */ - if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) { - input_mem_pool.data_size = pInputData->dataLen; - pt = (unsigned char*)input_mem_pool.virt_addr; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp); - returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size); - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec); - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!"); - if (returnCodec >= 0) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - ADec_SendEOS(fd); - pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_TRUE; - } - } else if (returnCodec < 0) { - ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode; - goto EXIT; - } - } - - if (pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren == OMX_FALSE) { - if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE; - ret = OMX_ErrorNone; - goto EXIT; - } - - returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate); - returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels); - - if (returnCodec < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec); - ret = OMX_ErrorHardware; - goto EXIT; - } - - if (!sample_rate || !channels) { - if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - } - ret = OMX_ErrorNone; - goto EXIT; - } - - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)", - channels, sample_rate); - - if (pMp3Dec->pcmParam.nChannels != channels || - pMp3Dec->pcmParam.nSamplingRate != sample_rate) { - /* Change channel count and sampling rate information */ - pMp3Dec->pcmParam.nChannels = channels; - pMp3Dec->pcmParam.nSamplingRate = sample_rate; - - /* Send Port Settings changed call back */ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - - pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren = OMX_TRUE; - - if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) { - pOutputData->dataLen = 0; - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } else { - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - ret = OMX_ErrorNone; - } - goto EXIT; - } - - /* Get decoded data from Seiren */ - ADec_RecvPCM(fd, &output_mem_pool); - - pt = (unsigned char*)output_mem_pool.virt_addr; - /* Trim first samples for MP3 gapless CTS test */ - if (pAudioDec->bFirstFrame) { - pAudioDec->bFirstFrame = OMX_FALSE; - /* Need to check Gapless playback or not */ - const int gapless_frames = 529; - const int gapless_bytes = gapless_frames * pMp3Dec->pcmParam.nChannels * sizeof(OMX_S16); - if (output_mem_pool.data_size >= gapless_bytes) { - pt += gapless_bytes; - output_mem_pool.data_size -= gapless_bytes; - } - } - - if (output_mem_pool.data_size > 0) { - pOutputData->dataLen = output_mem_pool.data_size; - Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE], - pt, output_mem_pool.data_size); - } else { - pOutputData->dataLen = 0; - } - -#ifdef Seiren_DUMP_TO_FILE - if (pOutputData->dataLen > 0) - fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile); -#endif - - /* Delay EOS signal until all the PCM is returned from the Seiren driver. */ - if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) { - returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped); - if (returnCodec != 0) - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE"); - if (isSeirenStopped == 1) { - pOutputData->nFlags |= OMX_BUFFERFLAG_EOS; - pExynosComponent->getAllDelayBuffer = OMX_FALSE; - pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */ - ret = OMX_ErrorNone; - } else { - pExynosComponent->getAllDelayBuffer = OMX_TRUE; - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - } - } else { /* Flush after EOS */ - pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE; - } - } -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - - FunctionIn(); - - if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) || - (!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) { - if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) - ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet; - else - ret = OMX_ErrorNone; - - goto EXIT; - } - - ret = Exynos_Seiren_Mp3_Decode_Block(pOMXComponent, pInputData, pOutputData); - - if (ret != OMX_ErrorNone) { - if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) { - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } else { - pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent, - pExynosComponent->callbackData, - OMX_EventError, ret, 0, NULL); - } - } else { - pInputData->usedDataLen += pInputData->dataLen; - pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen; - pInputData->dataLen -= pInputData->usedDataLen; - pInputData->usedDataLen = 0; - - pOutputData->usedDataLen = 0; - pOutputData->remainDataLen = pOutputData->dataLen; - } - -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle; - - int fd = pMp3Dec->hSeirenMp3Handle.hSeirenHandle; - return ADec_Flush(fd, type); -} - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; - OMX_S32 fd; - OMX_S32 codec_type = CODEC_TYPE_MAX; - - int i = 0; - - FunctionIn(); - - if ((hComponent == NULL) || (componentName == NULL)) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP3_DEC, componentName) == 0) { - codec_type = CODEC_TYPE_MP3; - } else if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP1_DEC, componentName) == 0) { - codec_type = CODEC_TYPE_MP1; - } else if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP2_DEC, componentName) == 0) { - codec_type = CODEC_TYPE_MP2; - } else { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret); - ret = OMX_ErrorBadParameter; - goto EXIT; - } - - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent); - if (ret != OMX_ErrorNone) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret); - goto EXIT; - } - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - pExynosComponent->codecType = HW_AUDIO_DEC_CODEC; - - pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE); - if (pExynosComponent->componentName == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_1; - } - Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE); - Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC); - - pMp3Dec = Exynos_OSAL_Malloc(sizeof(EXYNOS_MP3_HANDLE)); - if (pMp3Dec == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_MP3_HANDLE alloc error, ret: %X", __FUNCTION__, ret); - ret = OMX_ErrorInsufficientResources; - goto EXIT_ERROR_2; - } - Exynos_OSAL_Memset(pMp3Dec, 0, sizeof(EXYNOS_MP3_HANDLE)); - pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle; - pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pMp3Dec; - pAudioDec->bFirstFrame = OMX_TRUE; - - /* Create and Init Seiren */ - pMp3Dec->hSeirenMp3Handle.bSeirenLoaded = OMX_FALSE; - fd = ADec_Create(0, ADEC_MP3, NULL); - - if (fd < 0) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_3; - } - pMp3Dec->hSeirenMp3Handle.hSeirenHandle = fd; /* Seiren's fd */ - pMp3Dec->hSeirenMp3Handle.bSeirenLoaded = OMX_TRUE; - - /* Get input buffer info from Seiren */ - Exynos_OSAL_Memset(&pMp3Dec->hSeirenMp3Handle.input_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetIMemPoolInfo(fd, &pMp3Dec->hSeirenMp3Handle.input_mem_pool); - input_mem_pool = pMp3Dec->hSeirenMp3Handle.input_mem_pool; - - if (input_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_5; - } - - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.allocSize = input_mem_pool.mem_size; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr; - - /* Get output buffer info from Seiren */ - Exynos_OSAL_Memset(&pMp3Dec->hSeirenMp3Handle.output_mem_pool, 0, sizeof(audio_mem_info_t)); - ADec_GetOMemPoolInfo(fd, &pMp3Dec->hSeirenMp3Handle.output_mem_pool); - output_mem_pool = pMp3Dec->hSeirenMp3Handle.output_mem_pool; - if (output_mem_pool.virt_addr == NULL) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd); - ret = OMX_ErrorHardware; - goto EXIT_ERROR_6; - } - - /* Set componentVersion */ - pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->componentVersion.s.nStep = STEP_NUMBER; - - /* Set specVersion */ - pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER; - pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER; - pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER; - pExynosComponent->specVersion.s.nStep = STEP_NUMBER; - - /* Input port */ - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - if (codec_type == CODEC_TYPE_MP3) - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg"); - else if (codec_type == CODEC_TYPE_MP1) - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg-L1"); - else - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg-L2"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3; - - /* Output port */ - pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; - pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count; - pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size; - pExynosPort->portDefinition.bEnabled = OMX_TRUE; - Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE); - Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw"); - pExynosPort->portDefinition.format.audio.pNativeRender = 0; - pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE; - pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM; - - /* Default values for Mp3 audio param */ - INIT_SET_SIZE_VERSION(&pMp3Dec->mp3Param, OMX_AUDIO_PARAM_MP3TYPE); - pMp3Dec->mp3Param.nPortIndex = INPUT_PORT_INDEX; - pMp3Dec->mp3Param.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pMp3Dec->mp3Param.nBitRate = 0; - pMp3Dec->mp3Param.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pMp3Dec->mp3Param.nAudioBandWidth = 0; - pMp3Dec->mp3Param.eChannelMode = OMX_AUDIO_ChannelModeStereo; - pMp3Dec->mp3Param.eFormat = OMX_AUDIO_MP3StreamFormatMP1Layer3; - - /* Default values for PCM audio param */ - INIT_SET_SIZE_VERSION(&pMp3Dec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE); - pMp3Dec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX; - pMp3Dec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM; - pMp3Dec->pcmParam.eNumData = OMX_NumericalDataSigned; - pMp3Dec->pcmParam.eEndian = OMX_EndianLittle; - pMp3Dec->pcmParam.bInterleaved = OMX_TRUE; - pMp3Dec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE; - pMp3Dec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ; - pMp3Dec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear; - pMp3Dec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF; - pMp3Dec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF; - - pOMXComponent->GetParameter = &Exynos_Seiren_Mp3Dec_GetParameter; - pOMXComponent->SetParameter = &Exynos_Seiren_Mp3Dec_SetParameter; - pOMXComponent->GetConfig = &Exynos_Seiren_Mp3Dec_GetConfig; - pOMXComponent->SetConfig = &Exynos_Seiren_Mp3Dec_SetConfig; - pOMXComponent->GetExtensionIndex = &Exynos_Seiren_Mp3Dec_GetExtensionIndex; - pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_Mp3Dec_ComponentRoleEnum; - pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit; - - /* ToDo: Change the function name associated with a specific codec */ - pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_Mp3Dec_Init; - pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_Mp3Dec_Terminate; - pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_Mp3Dec_bufferProcess; - pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_Mp3Dec_flushSeiren; - pAudioDec->exynos_checkInputFrame = NULL; - - pExynosComponent->currentState = OMX_StateLoaded; - - ret = OMX_ErrorNone; - goto EXIT; /* This function is performed successfully. */ - -EXIT_ERROR_6: - pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; - pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL; - pExynosPort->processData.allocSize = 0; -EXIT_ERROR_5: -EXIT_ERROR_4: - ADec_Destroy(pMp3Dec->hSeirenMp3Handle.hSeirenHandle); -EXIT_ERROR_3: - Exynos_OSAL_Free(pMp3Dec); - pAudioDec->hCodecHandle = NULL; -EXIT_ERROR_2: - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; -EXIT_ERROR_1: - Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); -EXIT: - FunctionOut(); - - return ret; -} - -OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent) -{ - OMX_ERRORTYPE ret = OMX_ErrorNone; - OMX_COMPONENTTYPE *pOMXComponent = NULL; - EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL; - EXYNOS_MP3_HANDLE *pMp3Dec = NULL; - EXYNOS_OMX_BASEPORT *pExynosPort = NULL; - - FunctionIn(); - - if (hComponent == NULL) { - ret = OMX_ErrorBadParameter; - goto EXIT; - } - pOMXComponent = (OMX_COMPONENTTYPE *)hComponent; - pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; - - Exynos_OSAL_Free(pExynosComponent->componentName); - pExynosComponent->componentName = NULL; - - pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle; - if (pMp3Dec != NULL) { - if (pMp3Dec->hSeirenMp3Handle.bSeirenLoaded == OMX_TRUE) { - ADec_Destroy(pMp3Dec->hSeirenMp3Handle.hSeirenHandle); - } - Exynos_OSAL_Free(pMp3Dec); - ((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL; - } - - ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent); - if (ret != OMX_ErrorNone) { - goto EXIT; - } - - ret = OMX_ErrorNone; - -EXIT: - FunctionOut(); - - return ret; -} diff --git a/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.h b/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.h deleted file mode 100644 index 84f7e10..0000000 --- a/openmax/component/audio/seiren_dec/mp3/Exynos_OMX_Mp3dec.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file Exynos_OMX_Mp3dec.h - * @brief - * @author Sungyeon Kim (sy85.kim@samsung.com) - * @version 1.0.0 - * @history - * 2012.12.22 : Create - */ - -#ifndef EXYNOS_OMX_MP3_DEC_COMPONENT -#define EXYNOS_OMX_MP3_DEC_COMPONENT - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "seiren_hw.h" - -typedef enum _CODEC_TYPE -{ - CODEC_TYPE_MP1, - CODEC_TYPE_MP2, - CODEC_TYPE_MP3, - CODEC_TYPE_MAX -} CODEC_TYPE; - -typedef struct _EXYNOS_Seiren_MP3_HANDLE -{ - OMX_U32 hSeirenHandle; - OMX_BOOL bConfiguredSeiren; - OMX_BOOL bSeirenLoaded; - OMX_BOOL bSeirenSendEOS; - OMX_S32 returnCodec; - audio_mem_info_t input_mem_pool; - audio_mem_info_t output_mem_pool; -} EXYNOS_Seiren_MP3_HANDLE; - -typedef struct _EXYNOS_MP3_HANDLE -{ - /* OMX Codec specific */ - OMX_AUDIO_PARAM_MP3TYPE mp3Param; - OMX_AUDIO_PARAM_PCMMODETYPE pcmParam; - - /* SEC Seiren Codec specific */ - EXYNOS_Seiren_MP3_HANDLE hSeirenMp3Handle; -} EXYNOS_MP3_HANDLE; - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName); - OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_MP3_DEC_COMPONENT */ diff --git a/openmax/component/audio/seiren_dec/mp3/NOTICE b/openmax/component/audio/seiren_dec/mp3/NOTICE deleted file mode 100644 index 316b4eb..0000000 --- a/openmax/component/audio/seiren_dec/mp3/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2014, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/openmax/component/audio/seiren_dec/mp3/library_register.c b/openmax/component/audio/seiren_dec/mp3/library_register.c deleted file mode 100644 index fe44c0b..0000000 --- a/openmax/component/audio/seiren_dec/mp3/library_register.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.c - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#include -#include -#include -#include - -#include "Exynos_OSAL_Memory.h" -#include "Exynos_OSAL_ETC.h" -#include "library_register.h" - -#undef EXYNOS_LOG_TAG -#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC" -#define EXYNOS_LOG_OFF -#include "Exynos_OSAL_Log.h" - - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent) -{ - FunctionIn(); - - if (ppExynosComponent == NULL) - goto EXIT; - - /* component 1 - audio decoder MP3 */ - Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE); - ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - - /* component 2 - audio decoder MP3 Layer 1 */ - Exynos_OSAL_Strcpy(ppExynosComponent[1]->componentName, EXYNOS_OMX_COMPONENT_MP1_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[1]->roles[0], EXYNOS_OMX_COMPONENT_MP1_DEC_ROLE); - ppExynosComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; - - /* component 3 - audio decoder MP3 Layer 2 */ - Exynos_OSAL_Strcpy(ppExynosComponent[2]->componentName, EXYNOS_OMX_COMPONENT_MP2_DEC); - Exynos_OSAL_Strcpy(ppExynosComponent[2]->roles[0], EXYNOS_OMX_COMPONENT_MP2_DEC_ROLE); - ppExynosComponent[2]->totalRoleNum = MAX_COMPONENT_ROLE_NUM; -EXIT: - FunctionOut(); - return MAX_COMPONENT_NUM; -} - diff --git a/openmax/component/audio/seiren_dec/mp3/library_register.h b/openmax/component/audio/seiren_dec/mp3/library_register.h deleted file mode 100644 index a750690..0000000 --- a/openmax/component/audio/seiren_dec/mp3/library_register.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * - * Copyright 2012 Samsung Electronics S.LSI Co. LTD - * - * 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. - */ - -/* - * @file library_register.h - * @brief - * @author Yunji Kim (yunji.kim@samsung.com) - * @version 1.1.0 - * @history - * 2012.02.28 : Create - */ - -#ifndef EXYNOS_OMX_MP3_DEC_REG -#define EXYNOS_OMX_MP3_DEC_REG - -#include "Exynos_OMX_Def.h" -#include "OMX_Component.h" -#include "Exynos_OMX_Component_Register.h" - - -#define OSCL_EXPORT_REF __attribute__((visibility("default"))) -#define MAX_COMPONENT_NUM 3 -#define MAX_COMPONENT_ROLE_NUM 1 - -/* MP3 */ -#define EXYNOS_OMX_COMPONENT_MP3_DEC "OMX.Exynos.MP3.Decoder" -#define EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE "audio_decoder.mp3" - -#define EXYNOS_OMX_COMPONENT_MP1_DEC "OMX.Exynos.MP1.Decoder" -#define EXYNOS_OMX_COMPONENT_MP1_DEC_ROLE "audio_decoder.mp1" - -#define EXYNOS_OMX_COMPONENT_MP2_DEC "OMX.Exynos.MP2.Decoder" -#define EXYNOS_OMX_COMPONENT_MP2_DEC_ROLE "audio_decoder.mp2" - -#ifdef __cplusplus -extern "C" { -#endif - -OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent); - -#ifdef __cplusplus -}; -#endif - -#endif /* EXYNOS_OMX_MP3_DEC_REG */ -