mirror of
https://github.com/Evolution-X-Devices/hardware_samsung_slsi-linaro_openmax
synced 2026-01-27 06:25:12 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 <sys/time.h>
|
||||
#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
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
/
|
||||
#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;
|
||||
}
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user