mirror of
https://github.com/Evolution-X-Devices/hardware_samsung_slsi-linaro_openmax
synced 2026-01-27 15:45:39 +00:00
Add original Samsung hardware projects
Change-Id: I79380bc91acf57ca5f3e56fb64af76f4c45f6566 Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
This commit is contained in:
31
openmax/component/audio/dec/Android.mk
Normal file
31
openmax/component/audio/dec/Android.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
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)
|
||||
1538
openmax/component/audio/dec/Exynos_OMX_Adec.c
Normal file
1538
openmax/component/audio/dec/Exynos_OMX_Adec.c
Normal file
File diff suppressed because it is too large
Load Diff
144
openmax/component/audio/dec/Exynos_OMX_Adec.h
Normal file
144
openmax/component/audio/dec/Exynos_OMX_Adec.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
*
|
||||
* 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 */
|
||||
190
openmax/component/audio/dec/NOTICE
Normal file
190
openmax/component/audio/dec/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
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
|
||||
|
||||
41
openmax/component/audio/dec/mp3/Android.mk
Normal file
41
openmax/component/audio/dec/mp3/Android.mk
Normal file
@@ -0,0 +1,41 @@
|
||||
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)
|
||||
938
openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c
Normal file
938
openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.c
Normal file
@@ -0,0 +1,938 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
63
openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h
Normal file
63
openmax/component/audio/dec/mp3/Exynos_OMX_Mp3dec.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
*
|
||||
* 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 */
|
||||
190
openmax/component/audio/dec/mp3/NOTICE
Normal file
190
openmax/component/audio/dec/mp3/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
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
|
||||
|
||||
58
openmax/component/audio/dec/mp3/library_register.c
Normal file
58
openmax/component/audio/dec/mp3/library_register.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
54
openmax/component/audio/dec/mp3/library_register.h
Normal file
54
openmax/component/audio/dec/mp3/library_register.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
*
|
||||
* 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 */
|
||||
|
||||
34
openmax/component/audio/dec/wma/Android.mk
Normal file
34
openmax/component/audio/dec/wma/Android.mk
Normal file
@@ -0,0 +1,34 @@
|
||||
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)
|
||||
750
openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c
Normal file
750
openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.c
Normal file
@@ -0,0 +1,750 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
68
openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h
Normal file
68
openmax/component/audio/dec/wma/Exynos_OMX_Wmadec.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
*
|
||||
* 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 */
|
||||
190
openmax/component/audio/dec/wma/NOTICE
Normal file
190
openmax/component/audio/dec/wma/NOTICE
Normal file
@@ -0,0 +1,190 @@
|
||||
|
||||
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
|
||||
|
||||
57
openmax/component/audio/dec/wma/library_register.c
Normal file
57
openmax/component/audio/dec/wma/library_register.c
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
53
openmax/component/audio/dec/wma/library_register.h
Normal file
53
openmax/component/audio/dec/wma/library_register.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
*
|
||||
* 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 */
|
||||
Reference in New Issue
Block a user