Add original Samsung hardware projects

Change-Id: I79380bc91acf57ca5f3e56fb64af76f4c45f6566
Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
This commit is contained in:
Sam Protsenko
2023-09-08 19:45:36 -05:00
committed by Tim Zimmermann
commit d70d919c01
217 changed files with 127074 additions and 0 deletions

16
Android.mk Normal file
View File

@@ -0,0 +1,16 @@
ifneq ($(filter exynos, $(TARGET_SOC_NAME)),)
openmax_dirs := \
videocodec \
openmax
include $(call all-named-subdir-makefiles,$(openmax_dirs))
else
PREFIX := $(shell echo $(TARGET_BOARD_PLATFORM) | head -c 6)
ifneq ($(filter exynos, $(PREFIX)),)
openmax_dirs := \
videocodec \
openmax
include $(call all-named-subdir-makefiles,$(openmax_dirs))
endif
endif

190
NOTICE Normal file
View 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

81
openmax/Android.mk Normal file
View File

@@ -0,0 +1,81 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
BOARD_USE_ANDROID := true
BOARD_USE_SKYPE_HD := true
# Set to false to use Android's OMX header files
BOARD_USE_KHRONOS_OMX_HEADER := false
ifeq ($(BOARD_USE_ANDROID), false)
BOARD_USE_KHRONOS_OMX_HEADER := true
endif
EXYNOS_OMX_SUPPORT_TUNNELING := false
EXYNOS_OMX_SUPPORT_EGL_IMAGE := false
EXYNOS_OMX_TOP := $(LOCAL_PATH)
EXYNOS_OMX_INC := $(EXYNOS_OMX_TOP)/include
EXYNOS_OMX_COMPONENT := $(EXYNOS_OMX_TOP)/component
EXYNOS_VIDEO_CODEC := \
$(EXYNOS_OMX_TOP)/../videocodec
ifeq ($(BOARD_USE_ALP_AUDIO), true)
ifeq ($(BOARD_USE_SEIREN_AUDIO), true)
EXYNOS_AUDIO_CODEC += \
hardware/samsung_slsi/exynos/libseiren
else
EXYNOS_AUDIO_CODEC += \
hardware/samsung_slsi/exynos/libsrp
endif
endif
include $(EXYNOS_OMX_TOP)/osal/Android.mk
include $(EXYNOS_OMX_TOP)/core/Android.mk
include $(EXYNOS_OMX_COMPONENT)/common/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/h264/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/hevc/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/mpeg4/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/vp8/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/mpeg2/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/dec/vc1/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/enc/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/enc/h264/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/enc/mpeg4/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/enc/vp8/Android.mk
ifeq ($(BOARD_USE_HEVCENC_SUPPORT), true)
include $(EXYNOS_OMX_COMPONENT)/video/enc/hevc/Android.mk
endif
ifeq ($(BOARD_USE_VP9DEC_SUPPORT), true)
include $(EXYNOS_OMX_COMPONENT)/video/dec/vp9/Android.mk
endif
ifeq ($(BOARD_USE_VP9ENC_SUPPORT), true)
include $(EXYNOS_OMX_COMPONENT)/video/enc/vp9/Android.mk
endif
ifeq ($(BOARD_USE_WFDENC_SUPPORT), true)
include $(EXYNOS_OMX_COMPONENT)/video/enc/h264wfd/Android.mk
include $(EXYNOS_OMX_COMPONENT)/video/enc/hevcwfd/Android.mk
endif
ifeq ($(BOARD_USE_ALP_AUDIO), true)
include $(EXYNOS_OMX_COMPONENT)/audio/common/Android.mk
ifeq ($(BOARD_USE_SEIREN_AUDIO), true)
include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/Android.mk
include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/mp3/Android.mk
include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/aac/Android.mk
include $(EXYNOS_OMX_COMPONENT)/audio/seiren_dec/flac/Android.mk
else
include $(EXYNOS_OMX_COMPONENT)/audio/dec/Android.mk
include $(EXYNOS_OMX_COMPONENT)/audio/dec/mp3/Android.mk
endif
endif
ifeq ($(BOARD_USE_WMA_CODEC), true)
include $(EXYNOS_OMX_COMPONENT)/audio/dec/wma/Android.mk
endif

190
openmax/NOTICE Normal file
View 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

View File

@@ -0,0 +1,36 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_ABasecomponent.c \
Exynos_OMX_ABaseport.c
LOCAL_MODULE := libExynosOMX_ABasecomponent
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_STATIC_LIBRARIES := libExynosOMX_OSAL
LOCAL_SHARED_LIBRARIES := libcutils libutils
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(EXYNOS_OMX_SUPPORT_EGL_IMAGE), true)
LOCAL_CFLAGS += -DEGL_IMAGE_SUPPORT
endif
include $(BUILD_STATIC_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,158 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_ABasecomponent.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* Yunji Kim (yunji.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_ABASECOMP
#define EXYNOS_OMX_ABASECOMP
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_ABaseport.h"
typedef struct _EXYNOS_OMX_MESSAGE
{
OMX_U32 messageType;
OMX_U32 messageParam;
OMX_PTR pCmdData;
} EXYNOS_OMX_MESSAGE;
/* for Check TimeStamp after Seek */
typedef struct _EXYNOS_OMX_TIMESTAMP
{
OMX_BOOL needSetStartTimeStamp;
OMX_BOOL needCheckStartTimeStamp;
OMX_TICKS startTimeStamp;
OMX_U32 nStartFlags;
} EXYNOS_OMX_TIMESTAMP;
typedef struct _EXYNOS_OMX_BASECOMPONENT
{
OMX_STRING componentName;
OMX_VERSIONTYPE componentVersion;
OMX_VERSIONTYPE specVersion;
OMX_STATETYPE currentState;
EXYNOS_OMX_TRANS_STATETYPE transientState;
OMX_BOOL abendState;
OMX_HANDLETYPE abendStateEvent;
EXYNOS_CODEC_TYPE codecType;
EXYNOS_OMX_PRIORITYMGMTTYPE compPriority;
OMX_MARKTYPE propagateMarkType;
OMX_HANDLETYPE compMutex;
OMX_HANDLETYPE hComponentHandle;
/* Message Handler */
OMX_BOOL bExitMessageHandlerThread;
OMX_HANDLETYPE hMessageHandler;
OMX_HANDLETYPE msgSemaphoreHandle;
EXYNOS_QUEUE messageQ;
/* Port */
OMX_PORT_PARAM_TYPE portParam;
EXYNOS_OMX_BASEPORT *pExynosPort;
OMX_HANDLETYPE pauseEvent;
/* Callback function */
OMX_CALLBACKTYPE *pCallbacks;
OMX_PTR callbackData;
/* Save Timestamp */
OMX_TICKS timeStamp[MAX_TIMESTAMP];
EXYNOS_OMX_TIMESTAMP checkTimeStamp;
/* Save Flags */
OMX_U32 nFlags[MAX_FLAGS];
OMX_BOOL getAllDelayBuffer;
OMX_BOOL reInputData;
OMX_BOOL bUseFlagEOF;
OMX_BOOL bSaveFlagEOS; /* bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming. */
OMX_BOOL bBehaviorEOS; /* bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming. */
OMX_ERRORTYPE (*exynos_codec_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE (*exynos_codec_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef TUNNELING_SUPPORT
OMX_ERRORTYPE (*exynos_AllocateTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_FreeTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
#endif
OMX_ERRORTYPE (*exynos_BufferProcessCreate)(OMX_HANDLETYPE pOMXComponent);
OMX_ERRORTYPE (*exynos_BufferProcessTerminate)(OMX_HANDLETYPE pOMXComponent);
OMX_ERRORTYPE (*exynos_BufferFlush)(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
} EXYNOS_OMX_BASECOMPONENT;
OMX_ERRORTYPE Exynos_OMX_GetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR ComponentParameterStructure);
OMX_ERRORTYPE Exynos_OMX_SetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR ComponentParameterStructure);
OMX_PTR Exynos_OMX_MakeDynamicConfigCMD(
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_GetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_INOUT OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_GetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType);
void Exynos_OMX_Component_abnormalTermination(OMX_IN OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_BaseComponent_Constructor(OMX_IN OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_BaseComponent_Destructor(OMX_IN OMX_HANDLETYPE hComponent);
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,992 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_ABaseport.c
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* HyeYeon Chung (hyeon.chung@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Exynos_OMX_Macros.h"
#include "Exynos_OSAL_Event.h"
#include "Exynos_OSAL_Semaphore.h"
#include "Exynos_OSAL_Mutex.h"
#include "Exynos_OSAL_Memory.h"
#include "Exynos_OMX_ABaseport.h"
#include "Exynos_OMX_ABasecomponent.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_ABASE_PORT"
//#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
#ifdef PERFORMANCE_DEBUG
#include "Exynos_OSAL_ETC.h"
#endif
#include "Exynos_OSAL_Platform.h"
OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
OMX_U32 i = 0;
OMX_BOOL bBufferFind = OMX_FALSE;
Exynos_OSAL_MutexLock(pExynosPort->hPortMutex);
for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) {
if (bufferHeader == pExynosPort->extendBufferHeader[i].OMXBufferHeader) {
if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_TRUE) {
pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_FALSE;
bBufferFind = OMX_TRUE;
break;
} else {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] Trying to return the input buffer without ownership!!", pExynosComponent, __FUNCTION__);
}
}
}
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
if ((bBufferFind == OMX_TRUE) &&
(bufferHeader != NULL) &&
(bufferHeader->pBuffer != NULL)) {
pExynosComponent->pCallbacks->EmptyBufferDone(pOMXComponent, pExynosComponent->callbackData, bufferHeader);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader: %p", pExynosComponent, __FUNCTION__, bufferHeader);
}
return ret;
}
OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE* bufferHeader)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
OMX_U32 i = 0;
OMX_BOOL bBufferFind = OMX_FALSE;
Exynos_OSAL_MutexLock(pExynosPort->hPortMutex);
for (i = 0; i < MAX_BUFFER_NUM; i++) {
if (bufferHeader == pExynosPort->extendBufferHeader[i].OMXBufferHeader) {
if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_TRUE) {
bBufferFind = OMX_TRUE;
pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_FALSE;
break;
} else {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] Trying to return the output buffer without ownership!!", pExynosComponent, __FUNCTION__);
}
}
}
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
if ((bBufferFind == OMX_TRUE) &&
(bufferHeader != NULL) &&
(bufferHeader->pBuffer != NULL)) {
pExynosComponent->pCallbacks->FillBufferDone(pOMXComponent, pExynosComponent->callbackData, bufferHeader);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader: %p", pExynosComponent, __FUNCTION__, bufferHeader);
}
return ret;
}
OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess(
OMX_COMPONENTTYPE *pOMXComponent,
OMX_S32 nPortIndex,
OMX_BOOL bEvent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 nIndex = 0;
OMX_U32 i = 0, cnt = 0;
FunctionIn();
if (pOMXComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone)
goto EXIT;
cnt = (nPortIndex == ALL_PORT_INDEX) ? ALL_PORT_NUM : 1;
for (i = 0; i < cnt; i++) {
if (nPortIndex == ALL_PORT_INDEX)
nIndex = i;
else
nIndex = nPortIndex;
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] Flush %s Port", pExynosComponent, __FUNCTION__,
(nIndex == INPUT_PORT_INDEX)? "input":"output");
ret = pExynosComponent->exynos_BufferFlush(pOMXComponent, nIndex, bEvent);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is flushed", pExynosComponent, __FUNCTION__,
(nIndex == INPUT_PORT_INDEX)? "input":"output");
if (ret == OMX_ErrorNone) {
pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateIdle;
if (bEvent == OMX_TRUE) {
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Flush/%s port)",
pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
pExynosComponent->callbackData,
OMX_EventCmdComplete,
OMX_CommandFlush, nIndex, NULL);
}
}
}
EXIT:
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret);
if ((pOMXComponent != NULL) &&
(pExynosComponent != NULL)) {
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError,
ret, 0, NULL);
}
}
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_EnablePort(
OMX_COMPONENTTYPE *pOMXComponent,
OMX_S32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
OMX_U32 i = 0;
FunctionIn();
if (pOMXComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
if ((pExynosComponent->currentState != OMX_StateLoaded) &&
(pExynosComponent->currentState != OMX_StateWaitForResources)) {
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for loadedResource",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output");
Exynos_OSAL_SemaphoreWait(pExynosPort->loadedResource);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] loadedResource about %s port is posted",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output");
if (!CHECK_PORT_POPULATED(pExynosPort)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] buffer allocation on %s port is not completed (%d/%d)",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output",
pExynosPort->assignedBufferNum, pExynosPort->portDefinition.nBufferCountActual);
}
if (pExynosPort->exceptionFlag == INVALID_STATE) {
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%p][%s] %s port is in the INVALID_STATE", pExynosComponent, __FUNCTION__,
(nPortIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosPort->exceptionFlag = NEED_PORT_DISABLE;
goto EXIT;
}
if (pExynosComponent->abendState == OMX_TRUE) {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] component is abendstate. semaphore on port(%d) is posted", pExynosComponent, __FUNCTION__, nPortIndex);
pExynosPort->exceptionFlag = NEED_PORT_DISABLE;
ret = OMX_ErrorUndefined;
goto EXIT;
}
}
pExynosPort->exceptionFlag = GENERAL_STATE;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_PortEnableProcess(
OMX_COMPONENTTYPE *pOMXComponent,
OMX_S32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 nIndex = 0;
OMX_U32 i = 0, cnt = 0;
FunctionIn();
if (pOMXComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone)
goto EXIT;
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
cnt = (nPortIndex == ALL_PORT_INDEX) ? ALL_PORT_NUM : 1;
for (i = 0; i < cnt; i++) {
if (nPortIndex == ALL_PORT_INDEX)
nIndex = i;
else
nIndex = nPortIndex;
Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Enable %s Port", pExynosComponent, __FUNCTION__,
(nPortIndex == INPUT_PORT_INDEX)? "input":"output");
ret = Exynos_OMX_EnablePort(pOMXComponent, nIndex);
if (ret == OMX_ErrorNone) {
if (CHECK_PORT_ENABLED((&pExynosComponent->pExynosPort[nIndex])))
pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateIdle;
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Enable/%s port)",
pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventCmdComplete,
OMX_CommandPortEnable, nIndex, NULL);
}
}
EXIT:
if ((ret != OMX_ErrorNone) &&
(pOMXComponent != NULL) &&
(pExynosComponent != NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret);
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError,
ret, 0, NULL);
}
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_DisablePort(
OMX_COMPONENTTYPE *pOMXComponent,
OMX_S32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_MESSAGE *message = NULL;
FunctionIn();
if (pOMXComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pExynosPort = &pExynosComponent->pExynosPort[nPortIndex];
if (!CHECK_PORT_ENABLED(pExynosPort)) {
ret = OMX_ErrorNone;
goto EXIT;
}
if (pExynosComponent->currentState != OMX_StateLoaded) {
if (CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)) {
while (Exynos_OSAL_GetElemNum(&pExynosPort->bufferQ) > 0) {
message = (EXYNOS_OMX_MESSAGE*)Exynos_OSAL_Dequeue(&pExynosPort->bufferQ);
Exynos_OSAL_Free(message);
}
}
if (pExynosPort->exceptionFlag == NEED_PORT_DISABLE)
pExynosPort->exceptionFlag = GENERAL_STATE;
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s port is waiting for unloadedResource",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output");
Exynos_OSAL_SemaphoreWait(pExynosPort->unloadedResource);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] unloadedResource about %s port is posted",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output");
if (pExynosPort->assignedBufferNum > 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] buffer free on %s port is not completed (%d/%d)",
pExynosComponent, __FUNCTION__, (nPortIndex == INPUT_PORT_INDEX)? "input":"output",
pExynosPort->assignedBufferNum, pExynosPort->portDefinition.nBufferCountActual);
}
if (pExynosComponent->abendState == OMX_TRUE) {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] component is abendstate. semaphore on port(%d) is posted", pExynosComponent, __FUNCTION__, nPortIndex);
pExynosPort->exceptionFlag = NEED_PORT_DISABLE;
ret = OMX_ErrorUndefined;
goto EXIT;
}
}
pExynosPort->portDefinition.bEnabled = OMX_FALSE;
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_PortDisableProcess(
OMX_COMPONENTTYPE *pOMXComponent,
OMX_S32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 nIndex = 0;
OMX_U32 i = 0, cnt = 0;
FunctionIn();
if (pOMXComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
cnt = (nPortIndex == ALL_PORT_INDEX ) ? ALL_PORT_NUM : 1;
if ((pExynosComponent->currentState == OMX_StateExecuting) ||
(pExynosComponent->currentState == OMX_StatePause)) {
/* port flush*/
for(i = 0; i < cnt; i++) {
if (nPortIndex == ALL_PORT_INDEX)
nIndex = i;
else
nIndex = nPortIndex;
Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Before disabling %s port, do flush",
pExynosComponent, __FUNCTION__,
(nIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateFlushingForDisable;
ret = pExynosComponent->exynos_BufferFlush(pOMXComponent, nIndex, OMX_FALSE);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] %s Port is flushed", pExynosComponent, __FUNCTION__,
(nIndex == INPUT_PORT_INDEX)? "input":"output");
if (ret != OMX_ErrorNone)
goto EXIT;
}
}
for(i = 0; i < cnt; i++) {
if (nPortIndex == ALL_PORT_INDEX)
nIndex = i;
else
nIndex = nPortIndex;
Exynos_OSAL_Log(EXYNOS_LOG_INFO, "[%p][%s] Disable %s Port",
pExynosComponent, __FUNCTION__,
(nIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateDisabling;
ret = Exynos_OMX_DisablePort(pOMXComponent, nIndex);
if (ret == OMX_ErrorNone) {
if (!CHECK_PORT_ENABLED((&pExynosComponent->pExynosPort[nIndex])))
pExynosComponent->pExynosPort[nIndex].portState = EXYNOS_OMX_PortStateLoaded;
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] send event(EventCmdComplete/Disable/%s port)",
pExynosComponent, __FUNCTION__, (nIndex == INPUT_PORT_INDEX)? "input":"output");
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventCmdComplete,
OMX_CommandPortDisable, nIndex, NULL);
}
}
EXIT:
if ((ret != OMX_ErrorNone) &&
(pOMXComponent != NULL) &&
(pExynosComponent != NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] (0x%x)", pExynosComponent, __FUNCTION__, ret);
pExynosComponent->pCallbacks->EventHandler(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError,
ret, 0, NULL);
}
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_EmptyThisBuffer(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_MESSAGE *message = NULL;
OMX_U32 i = 0;
OMX_BOOL bFindBuffer = OMX_FALSE;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone)
goto EXIT;
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
if (pBuffer == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pBuffer->nInputPortIndex != INPUT_PORT_INDEX) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
ret = Exynos_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if ((pExynosComponent->currentState != OMX_StateIdle) &&
(pExynosComponent->currentState != OMX_StateExecuting) &&
(pExynosComponent->currentState != OMX_StatePause)) {
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
if ((!CHECK_PORT_ENABLED(pExynosPort)) ||
(CHECK_PORT_BEING_FLUSHED(pExynosPort) &&
(!CHECK_PORT_TUNNELED(pExynosPort) || !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort))) ||
((pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle) &&
(CHECK_PORT_TUNNELED(pExynosPort) && !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)))) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] enabled(%d), state(%x), tunneld(%d), supplier(%d)", pExynosComponent, __FUNCTION__,
CHECK_PORT_ENABLED(pExynosPort), pExynosPort->portState,
CHECK_PORT_TUNNELED(pExynosPort), CHECK_PORT_BUFFER_SUPPLIER(pExynosPort));
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
Exynos_OSAL_MutexLock(pExynosPort->hPortMutex);
for (i = 0; i < pExynosPort->portDefinition.nBufferCountActual; i++) {
if (pBuffer == pExynosPort->extendBufferHeader[i].OMXBufferHeader) {
if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_FALSE) {
pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_TRUE;
bFindBuffer = OMX_TRUE;
break;
} else {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] input buffer(%p) was already entered!", pExynosComponent, __FUNCTION__, pBuffer);
}
}
}
if (bFindBuffer == OMX_FALSE) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] EmptyThisBuffer is failed : %p", pExynosComponent, __FUNCTION__, pBuffer);
ret = OMX_ErrorBadParameter;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
message = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_MESSAGE));
if (message == NULL) {
ret = OMX_ErrorInsufficientResources;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
message->messageType = EXYNOS_OMX_CommandEmptyBuffer;
message->messageParam = (OMX_U32) i;
message->pCmdData = (OMX_PTR)pBuffer;
ret = Exynos_OSAL_Queue(&pExynosPort->bufferQ, (void *)message);
if (ret != 0) {
ret = OMX_ErrorUndefined;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
ret = Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader:%p, nAllocLen:%d, nFilledLen:%d, nOffset:%d, nFlags:%x",
pExynosComponent, __FUNCTION__,
pBuffer, pBuffer->nAllocLen, pBuffer->nFilledLen, pBuffer->nOffset, pBuffer->nFlags);
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_FillThisBuffer(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_MESSAGE *message = NULL;
OMX_U32 i = 0;
OMX_BOOL bFindBuffer = OMX_FALSE;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone)
goto EXIT;
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
if (pBuffer == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pBuffer->nOutputPortIndex != OUTPUT_PORT_INDEX) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
ret = Exynos_OMX_Check_SizeVersion(pBuffer, sizeof(OMX_BUFFERHEADERTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if ((pExynosComponent->currentState != OMX_StateIdle) &&
(pExynosComponent->currentState != OMX_StateExecuting) &&
(pExynosComponent->currentState != OMX_StatePause)) {
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
if ((!CHECK_PORT_ENABLED(pExynosPort)) ||
((CHECK_PORT_BEING_FLUSHED(pExynosPort)) &&
(!CHECK_PORT_TUNNELED(pExynosPort) || !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort))) ||
((pExynosComponent->transientState == EXYNOS_OMX_TransStateExecutingToIdle) &&
(CHECK_PORT_TUNNELED(pExynosPort) && !CHECK_PORT_BUFFER_SUPPLIER(pExynosPort)))) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] enabled(%d), state(%x), tunneld(%d), supplier(%d)", pExynosComponent, __FUNCTION__,
CHECK_PORT_ENABLED(pExynosPort), pExynosPort->portState,
CHECK_PORT_TUNNELED(pExynosPort), CHECK_PORT_BUFFER_SUPPLIER(pExynosPort));
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
Exynos_OSAL_MutexLock(pExynosPort->hPortMutex);
for (i = 0; i < MAX_BUFFER_NUM; i++) {
if (pBuffer == pExynosPort->extendBufferHeader[i].OMXBufferHeader) {
if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_FALSE) {
pExynosPort->extendBufferHeader[i].bBufferInOMX = OMX_TRUE;
bFindBuffer = OMX_TRUE;
break;
} else {
Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "[%p][%s] output buffer(%p) was already entered!", pExynosComponent, __FUNCTION__, pBuffer);
}
}
}
if (bFindBuffer == OMX_FALSE) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] FillThisBuffer is failed : %p", pExynosComponent, __FUNCTION__, pBuffer);
ret = OMX_ErrorBadParameter;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
message = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_MESSAGE));
if (message == NULL) {
ret = OMX_ErrorInsufficientResources;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
message->messageType = EXYNOS_OMX_CommandFillBuffer;
message->messageParam = (OMX_U32) i;
message->pCmdData = (OMX_PTR)pBuffer;
ret = Exynos_OSAL_Queue(&pExynosPort->bufferQ, (void *)message);
if (ret != 0) {
ret = OMX_ErrorUndefined;
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
goto EXIT;
}
ret = Exynos_OSAL_SemaphorePost(pExynosPort->bufferSemID);
Exynos_OSAL_Log(EXYNOS_LOG_ESSENTIAL, "[%p][%s] bufferHeader:%p", pExynosComponent, __FUNCTION__, pBuffer);
Exynos_OSAL_MutexUnlock(pExynosPort->hPortMutex);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_BASEPORT *pExynosInputPort = NULL;
EXYNOS_OMX_BASEPORT *pExynosOutputPort = NULL;
int i = 0, j = 0;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] OMX_ErrorBadParameter (0x%x) Line:%d", __FUNCTION__, ret, __LINE__);
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%s] OMX_ErrorBadParameter (0x%x) Line:%d", __FUNCTION__, ret, __LINE__);
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
INIT_SET_SIZE_VERSION(&pExynosComponent->portParam, OMX_PORT_PARAM_TYPE);
pExynosComponent->portParam.nPorts = ALL_PORT_NUM;
pExynosComponent->portParam.nStartPortNumber = INPUT_PORT_INDEX;
pExynosPort = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BASEPORT) * ALL_PORT_NUM);
if (pExynosPort == NULL) {
ret = OMX_ErrorInsufficientResources;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
Exynos_OSAL_Memset(pExynosPort, 0, sizeof(EXYNOS_OMX_BASEPORT) * ALL_PORT_NUM);
pExynosComponent->pExynosPort = pExynosPort;
/* Input Port */
pExynosInputPort = &pExynosPort[INPUT_PORT_INDEX];
Exynos_OSAL_QueueCreate(&pExynosInputPort->bufferQ, MAX_QUEUE_ELEMENTS);
pExynosInputPort->extendBufferHeader = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM);
if (pExynosInputPort->extendBufferHeader == NULL) {
ret = OMX_ErrorInsufficientResources;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
Exynos_OSAL_Memset(pExynosInputPort->extendBufferHeader, 0, sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM);
pExynosInputPort->bufferStateAllocate = Exynos_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM);
if (pExynosInputPort->bufferStateAllocate == NULL) {
ret = OMX_ErrorInsufficientResources;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
Exynos_OSAL_Memset(pExynosInputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM);
pExynosInputPort->bufferSemID = NULL;
pExynosInputPort->assignedBufferNum = 0;
pExynosInputPort->portState = EXYNOS_OMX_PortStateLoaded;
pExynosInputPort->tunneledComponent = NULL;
pExynosInputPort->tunneledPort = 0;
pExynosInputPort->tunnelBufferNum = 0;
pExynosInputPort->bufferSupplier = OMX_BufferSupplyUnspecified;
pExynosInputPort->tunnelFlags = 0;
pExynosInputPort->supportFormat = NULL;
ret = Exynos_OSAL_SemaphoreCreate(&pExynosInputPort->loadedResource);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
ret = Exynos_OSAL_SemaphoreCreate(&pExynosInputPort->unloadedResource);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
INIT_SET_SIZE_VERSION(&pExynosInputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE);
pExynosInputPort->portDefinition.nPortIndex = INPUT_PORT_INDEX;
pExynosInputPort->portDefinition.eDir = OMX_DirInput;
pExynosInputPort->portDefinition.nBufferCountActual = 0;
pExynosInputPort->portDefinition.nBufferCountMin = 0;
pExynosInputPort->portDefinition.nBufferSize = 0;
pExynosInputPort->portDefinition.bEnabled = OMX_FALSE;
pExynosInputPort->portDefinition.bPopulated = OMX_FALSE;
pExynosInputPort->portDefinition.eDomain = OMX_PortDomainMax;
pExynosInputPort->portDefinition.bBuffersContiguous = OMX_FALSE;
pExynosInputPort->portDefinition.nBufferAlignment = 0;
pExynosInputPort->markType.hMarkTargetComponent = NULL;
pExynosInputPort->markType.pMarkData = NULL;
pExynosInputPort->exceptionFlag = GENERAL_STATE;
/* Output Port */
pExynosOutputPort = &pExynosPort[OUTPUT_PORT_INDEX];
Exynos_OSAL_QueueCreate(&pExynosOutputPort->bufferQ, MAX_QUEUE_ELEMENTS); /* For in case of "Output Buffer Share", MAX ELEMENTS(DPB + EDPB) */
pExynosOutputPort->extendBufferHeader = Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM);
if (pExynosOutputPort->extendBufferHeader == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
Exynos_OSAL_Memset(pExynosOutputPort->extendBufferHeader, 0, sizeof(EXYNOS_OMX_BUFFERHEADERTYPE) * MAX_BUFFER_NUM);
pExynosOutputPort->bufferStateAllocate = Exynos_OSAL_Malloc(sizeof(OMX_U32) * MAX_BUFFER_NUM);
if (pExynosOutputPort->bufferStateAllocate == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to Malloc (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
Exynos_OSAL_Memset(pExynosOutputPort->bufferStateAllocate, 0, sizeof(OMX_U32) * MAX_BUFFER_NUM);
pExynosOutputPort->bufferSemID = NULL;
pExynosOutputPort->assignedBufferNum = 0;
pExynosOutputPort->portState = EXYNOS_OMX_PortStateLoaded;
pExynosOutputPort->tunneledComponent = NULL;
pExynosOutputPort->tunneledPort = 0;
pExynosOutputPort->tunnelBufferNum = 0;
pExynosOutputPort->bufferSupplier = OMX_BufferSupplyUnspecified;
pExynosOutputPort->tunnelFlags = 0;
pExynosOutputPort->supportFormat = NULL;
ret = Exynos_OSAL_SemaphoreCreate(&pExynosOutputPort->loadedResource);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
ret = Exynos_OSAL_SemaphoreCreate(&pExynosOutputPort->unloadedResource);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] Failed to SemaphoreCreate (0x%x) Line:%d", pExynosComponent, __FUNCTION__, ret, __LINE__);
goto EXIT;
}
INIT_SET_SIZE_VERSION(&pExynosOutputPort->portDefinition, OMX_PARAM_PORTDEFINITIONTYPE);
pExynosOutputPort->portDefinition.nPortIndex = OUTPUT_PORT_INDEX;
pExynosOutputPort->portDefinition.eDir = OMX_DirOutput;
pExynosOutputPort->portDefinition.nBufferCountActual = 0;
pExynosOutputPort->portDefinition.nBufferCountMin = 0;
pExynosOutputPort->portDefinition.nBufferSize = 0;
pExynosOutputPort->portDefinition.bEnabled = OMX_FALSE;
pExynosOutputPort->portDefinition.bPopulated = OMX_FALSE;
pExynosOutputPort->portDefinition.eDomain = OMX_PortDomainMax;
pExynosOutputPort->portDefinition.bBuffersContiguous = OMX_FALSE;
pExynosOutputPort->portDefinition.nBufferAlignment = 0;
pExynosOutputPort->markType.hMarkTargetComponent = NULL;
pExynosOutputPort->markType.pMarkData = NULL;
pExynosOutputPort->exceptionFlag = GENERAL_STATE;
pExynosComponent->checkTimeStamp.needSetStartTimeStamp = OMX_FALSE;
pExynosComponent->checkTimeStamp.needCheckStartTimeStamp = OMX_FALSE;
pExynosComponent->checkTimeStamp.startTimeStamp = 0;
pExynosComponent->checkTimeStamp.nStartFlags = 0x0;
pOMXComponent->EmptyThisBuffer = &Exynos_OMX_EmptyThisBuffer;
pOMXComponent->FillThisBuffer = &Exynos_OMX_FillThisBuffer;
ret = OMX_ErrorNone;
EXIT:
if ((ret != OMX_ErrorNone) &&
(pExynosComponent != NULL) &&
(pExynosComponent->pExynosPort != NULL)) {
for (i = 0; i < ALL_PORT_NUM; i++) {
pExynosPort = &pExynosComponent->pExynosPort[i];
Exynos_OSAL_SemaphoreTerminate(pExynosPort->loadedResource);
pExynosPort->loadedResource = NULL;
Exynos_OSAL_SemaphoreTerminate(pExynosPort->unloadedResource);
pExynosPort->unloadedResource = NULL;
Exynos_OSAL_Free(pExynosPort->bufferStateAllocate);
pExynosPort->bufferStateAllocate = NULL;
Exynos_OSAL_Free(pExynosPort->extendBufferHeader);
pExynosPort->extendBufferHeader = NULL;
Exynos_OSAL_QueueTerminate(&pExynosPort->bufferQ);
}
Exynos_OSAL_Free(pExynosComponent->pExynosPort);
pExynosComponent->pExynosPort = NULL;
}
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
int i = 0, j = 0;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
for (i = 0; i < ALL_PORT_NUM; i++) {
pExynosPort = &pExynosComponent->pExynosPort[i];
Exynos_OSAL_SemaphoreTerminate(pExynosPort->loadedResource);
pExynosPort->loadedResource = NULL;
Exynos_OSAL_SemaphoreTerminate(pExynosPort->unloadedResource);
pExynosPort->unloadedResource = NULL;
Exynos_OSAL_Free(pExynosPort->bufferStateAllocate);
pExynosPort->bufferStateAllocate = NULL;
Exynos_OSAL_Free(pExynosPort->extendBufferHeader);
pExynosPort->extendBufferHeader = NULL;
Exynos_OSAL_QueueTerminate(&pExynosPort->bufferQ);
}
Exynos_OSAL_Free(pExynosComponent->pExynosPort);
pExynosComponent->pExynosPort = NULL;
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
if (pData == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
/* caution: nPlanes in buffer structure might be used all times */
Exynos_OSAL_Memset(&(pData->buffer.fd), 0, sizeof(pData->buffer.fd));
Exynos_OSAL_Memset(&(pData->buffer.addr), 0, sizeof(pData->buffer.addr));
pData->dataLen = 0;
pData->usedDataLen = 0;
pData->remainDataLen = 0;
pData->nFlags = 0;
pData->timeStamp = 0;
pData->pPrivate = NULL;
pData->bufferHeader = NULL;
EXIT:
return ret;
}

View File

@@ -0,0 +1,157 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_ABaseport.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* HyeYeon Chung (hyeon.chung@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_ABASE_PORT
#define EXYNOS_OMX_ABASE_PORT
#include "OMX_Component.h"
#include "Exynos_OMX_Def.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_Def.h"
#ifdef PERFORMANCE_DEBUG
#include <sys/time.h>
#endif
#define BUFFER_STATE_ALLOCATED (1 << 0)
#define BUFFER_STATE_ASSIGNED (1 << 1)
#define HEADER_STATE_ALLOCATED (1 << 2)
#define BUFFER_STATE_FREE 0
#define MAX_BUFFER_NUM 40
#define INPUT_PORT_INDEX 0
#define OUTPUT_PORT_INDEX 1
#define ALL_PORT_INDEX -1
#define ALL_PORT_NUM 2
typedef struct _EXYNOS_OMX_BUFFERHEADERTYPE
{
OMX_BUFFERHEADERTYPE *OMXBufferHeader;
OMX_BOOL bBufferInOMX;
} EXYNOS_OMX_BUFFERHEADERTYPE;
typedef struct _EXYNOS_OMX_DATABUFFER
{
OMX_HANDLETYPE bufferMutex;
OMX_BUFFERHEADERTYPE* bufferHeader;
OMX_BOOL dataValid;
OMX_U32 allocSize;
OMX_U32 dataLen;
OMX_U32 usedDataLen;
OMX_U32 remainDataLen;
OMX_U32 nFlags;
OMX_TICKS timeStamp;
OMX_PTR pPrivate;
} EXYNOS_OMX_DATABUFFER;
typedef struct _EXYNOS_OMX_MULTIPLANE_BUFFER
{
OMX_U32 nPlanes;
unsigned long fd[MAX_BUFFER_PLANE];
OMX_PTR addr[MAX_BUFFER_PLANE];
OMX_COLOR_FORMATTYPE eColorFormat;
} EXYNOS_OMX_MULTIPLANE_BUFFER;
typedef struct _EXYNOS_OMX_DATA
{
EXYNOS_OMX_MULTIPLANE_BUFFER buffer;
OMX_U32 allocSize;
OMX_U32 dataLen;
OMX_U32 usedDataLen;
OMX_U32 remainDataLen;
OMX_U32 nFlags;
OMX_TICKS timeStamp;
OMX_PTR pPrivate;
/* For Share Buffer */
OMX_BUFFERHEADERTYPE *bufferHeader;
} EXYNOS_OMX_DATA;
typedef enum _EXYNOS_OMX_EXCEPTION_STATE
{
GENERAL_STATE = 0x00,
NEED_PORT_FLUSH,
NEED_PORT_DISABLE,
INVALID_STATE,
} EXYNOS_OMX_EXCEPTION_STATE;
typedef struct _EXYNOS_OMX_BASEPORT
{
EXYNOS_OMX_BUFFERHEADERTYPE *extendBufferHeader;
OMX_U32 *bufferStateAllocate;
OMX_PARAM_PORTDEFINITIONTYPE portDefinition;
OMX_HANDLETYPE bufferSemID;
EXYNOS_QUEUE bufferQ;
OMX_S32 assignedBufferNum;
EXYNOS_OMX_PORT_STATETYPE portState;
OMX_HANDLETYPE loadedResource;
OMX_HANDLETYPE unloadedResource;
OMX_MARKTYPE markType;
/* Tunnel Info */
OMX_HANDLETYPE tunneledComponent;
OMX_U32 tunneledPort;
OMX_U32 tunnelBufferNum;
OMX_BUFFERSUPPLIERTYPE bufferSupplier;
OMX_U32 tunnelFlags;
OMX_COLOR_FORMATTYPE *supportFormat;
OMX_HANDLETYPE pauseEvent;
EXYNOS_OMX_DATABUFFER dataBuffer;
/* Data */
EXYNOS_OMX_DATA processData;
OMX_HANDLETYPE hPortMutex;
EXYNOS_OMX_EXCEPTION_STATE exceptionFlag;
} EXYNOS_OMX_BASEPORT;
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData);
OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader);
OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader);
#ifdef __cplusplus
};
#endif
#endif

View 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

View 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)

File diff suppressed because it is too large Load Diff

View 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 */

View 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

View 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)

View 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;
}

View 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 */

View 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

View 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;
}

View 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 */

View 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)

View 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;
}

View 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 */

View 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

View 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;
}

View 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 */

View File

@@ -0,0 +1,29 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
Exynos_OMX_Adec.c
LOCAL_MODULE := libExynosOMX_Adec
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_STATIC_LIBRARIES := libseirenhw
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \
$(EXYNOS_AUDIO_CODEC)/include
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
LOCAL_C_INCLUDES += $(ANDROID_MEDIA_INC)/openmax
endif
include $(BUILD_STATIC_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,143 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Adec.h
* @brief
* @author Yunji Kim (yunji.kim@samsung.com)
*
* @version 1.1.0
* @history
* 2012.02.28 : Create
*/
#ifndef EXYNOS_OMX_AUDIO_DECODE
#define EXYNOS_OMX_AUDIO_DECODE
#include "OMX_Component.h"
#include "Exynos_OMX_Def.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_ABaseport.h"
#include "Exynos_OMX_ABasecomponent.h"
#include "seiren_hw.h"
#define MAX_AUDIO_INPUTBUFFER_NUM 2
#define MAX_AUDIO_OUTPUTBUFFER_NUM 2
#define DEFAULT_AUDIO_INPUT_BUFFER_SIZE (16 * 1024)
#define DEFAULT_AUDIO_OUTPUT_BUFFER_SIZE (32 * 1024)
#define DEFAULT_AUDIO_SAMPLING_FREQ 44100
#define DEFAULT_AUDIO_CHANNELS_NUM 2
#define DEFAULT_AUDIO_BIT_PER_SAMPLE 16
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#define AUDIO_DATA_PLANE 0
typedef struct _SRP_DEC_INPUT_BUFFER
{
void *PhyAddr; // physical address
void *VirAddr; // virtual address
int bufferSize; // input buffer alloc size
int dataSize; // Data length
} SRP_DEC_INPUT_BUFFER;
typedef struct _EXYNOS_OMX_AUDIODEC_COMPONENT
{
OMX_HANDLETYPE hCodecHandle;
OMX_BOOL bFirstFrame;
OMX_PTR pInputBuffer;
SRP_DEC_INPUT_BUFFER SRPDecInputBuffer[MAX_AUDIO_INPUTBUFFER_NUM];
OMX_U32 indexInputBuffer;
/* Buffer Process */
OMX_BOOL bExitBufferProcessThread;
OMX_HANDLETYPE hBufferProcessThread;
OMX_ERRORTYPE (*exynos_codec_bufferProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData);
OMX_ERRORTYPE (*exynos_codec_flushSeiren) (OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type);
int (*exynos_checkInputFrame)(OMX_U8 *pInputStream, OMX_U32 buffSize, OMX_U32 flag, OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame);
} EXYNOS_OMX_AUDIODEC_COMPONENT;
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_UseBuffer(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_PTR pAppPrivate,
OMX_IN OMX_U32 nSizeBytes,
OMX_IN OMX_U8 *pBuffer);
OMX_ERRORTYPE Exynos_OMX_AllocateBuffer(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_PTR pAppPrivate,
OMX_IN OMX_U32 nSizeBytes);
OMX_ERRORTYPE Exynos_OMX_FreeBuffer(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_U32 nPortIndex,
OMX_IN OMX_BUFFERHEADERTYPE *pBufferHdr);
OMX_ERRORTYPE Exynos_OMX_AllocateTunnelBuffer(
EXYNOS_OMX_BASEPORT *pOMXBasePort,
OMX_U32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_FreeTunnelBuffer(
EXYNOS_OMX_BASEPORT *pOMXBasePort,
OMX_U32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_ComponentTunnelRequest(
OMX_IN OMX_HANDLETYPE hComp,
OMX_IN OMX_U32 nPort,
OMX_IN OMX_HANDLETYPE hTunneledComp,
OMX_IN OMX_U32 nTunneledPort,
OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup);
OMX_ERRORTYPE Exynos_OMX_BufferProcess(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR ComponentParameterStructure);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR ComponentParameterStructure);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeSetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeGetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_AudioDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent);
OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent);
#ifdef __cplusplus
}
#endif
#endif /* EXYNOS_OMX_AUDIO_DECODE */

View 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

View File

@@ -0,0 +1,41 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Aacdec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.AAC.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \
libseirenhw
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libExynosOMX_Resourcemanager
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \
$(EXYNOS_AUDIO_CODEC)/include
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
endif
endif
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,970 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Aacdec.c
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Exynos_OMX_Macros.h"
#include "Exynos_OMX_ABasecomponent.h"
#include "Exynos_OMX_ABaseport.h"
#include "Exynos_OMX_Adec.h"
#include "Exynos_OSAL_ETC.h"
#include "Exynos_OSAL_Semaphore.h"
#include "Exynos_OSAL_Thread.h"
#include "library_register.h"
#include "Exynos_OMX_Aacdec.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_AAC_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
//#define Seiren_DUMP_TO_FILE
#ifdef Seiren_DUMP_TO_FILE
#include "stdio.h"
FILE *inFile;
FILE *outFile;
#endif
OMX_ERRORTYPE Exynos_Seiren_AacDec_GetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nParamIndex) {
case OMX_IndexParamAudioAac:
{
OMX_AUDIO_PARAM_AACPROFILETYPE *pDstAacParam = (OMX_AUDIO_PARAM_AACPROFILETYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_AACPROFILETYPE *pSrcAacParam = NULL;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstAacParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcAacParam = &pAacDec->aacParam;
Exynos_OSAL_Memcpy(pDstAacParam, pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE));
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcPcmParam = &pAacDec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_S32 codecType;
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE);
}
break;
default:
ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_SetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
case OMX_IndexParamAudioAac:
{
OMX_AUDIO_PARAM_AACPROFILETYPE *pDstAacParam = NULL;
OMX_AUDIO_PARAM_AACPROFILETYPE *pSrcAacParam = (OMX_AUDIO_PARAM_AACPROFILETYPE *)pComponentParameterStructure;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcAacParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstAacParam = &pAacDec->aacParam;
Exynos_OSAL_Memcpy(pDstAacParam, pSrcAacParam, sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE));
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSize : %d \e[0m", pDstAacParam->nSize);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nPortIndex : %d \e[0m", pDstAacParam->nPortIndex);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nChannels : %d \e[0m", pDstAacParam->nChannels);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSampleRate : %d \e[0m", pDstAacParam->nSampleRate);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nBitRate : %d \e[0m", pDstAacParam->nBitRate);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAudioBandWidth : %d \e[0m", pDstAacParam->nAudioBandWidth);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nFrameLength : %d \e[0m", pDstAacParam->nFrameLength);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAACtools : %d \e[0m", pDstAacParam->nAACtools);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nAACERtools : %d \e[0m", pDstAacParam->nAACERtools);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eAACProfile : %d \e[0m", pDstAacParam->eAACProfile);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eAACStreamFormat : %d \e[0m", pDstAacParam->eAACStreamFormat);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m eChannelMode : %d \e[0m", pDstAacParam->eChannelMode);
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstPcmParam = &pAacDec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) {
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE)) {
pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingAAC;
} else {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
}
break;
default:
ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_GetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_GetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if ((cParameterName == NULL) || (pIndexType == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_ComponentRoleEnum(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_U8 *cRole,
OMX_IN OMX_U32 nIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 codecType;
FunctionIn();
if ((hComponent == NULL) || (cRole == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
ret = OMX_ErrorNoMore;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle;
FunctionIn();
INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP);
Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Aac extractor should parse into frame unit. */
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
pAacDec->hSeirenAacHandle.bConfiguredSeiren = OMX_FALSE;
pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef Seiren_DUMP_TO_FILE
inFile = fopen("/data/InFile.aac", "w+");
outFile = fopen("/data/OutFile.pcm", "w+");
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
fclose(inFile);
fclose(outFile);
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Aac_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle;
int returnCodec = 0;
unsigned long long isSeirenStopped = 0;
OMX_BOOL isSeirenIbufOverflow = OMX_FALSE;
u32 fd = pAacDec->hSeirenAacHandle.hSeirenHandle;
audio_mem_info_t input_mem_pool = pAacDec->hSeirenAacHandle.input_mem_pool;
audio_mem_info_t output_mem_pool = pAacDec->hSeirenAacHandle.output_mem_pool;
unsigned long long sample_rate, channels;
int consumed_size = 0;
sample_rate = channels = 0;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
if (pExynosComponent->reInputData == OMX_FALSE) {
fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile);
}
#endif
/* Save timestamp and flags of input data */
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS);
/* Decoding aac frames by Seiren */
if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) {
input_mem_pool.data_size = pInputData->dataLen;
char* pt = input_mem_pool.virt_addr;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp);
if (pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
if (pAacDec->hSeirenAacHandle.bConfiguredSeiren == OMX_TRUE)
goto EXIT;
ADec_ConfigSignal(fd);
unsigned char sample_rate_index = ((*(pt+1)) >> 7 & 0x01) |
((*pt) << 1 & 0x0e);
unsigned char num_of_channel = ((*(pt+1)) >> 3 & 0x07);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "index %x ", sample_rate_index);
ADec_SetParams(fd, PCM_PARAM_SAMPLE_RATE, (unsigned long long)aac_sample_rates[sample_rate_index]);
ADec_SetParams(fd, PCM_PARAM_NUM_OF_CH, (unsigned long long)num_of_channel);
/* AAC setup-data(or DSI) could be various length. But it only needs 2byte */
input_mem_pool.data_size = 2;
ADec_SendStream(fd, &input_mem_pool, &consumed_size);
goto EXIT;
}
returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec);
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!");
if (returnCodec >= 0) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
ADec_SendEOS(fd);
pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_TRUE;
}
} else if (returnCodec < 0) {
ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
goto EXIT;
}
}
if (pAacDec->hSeirenAacHandle.bConfiguredSeiren == OMX_FALSE) {
if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE;
ret = OMX_ErrorNone;
goto EXIT;
}
returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate);
returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels);
if (returnCodec < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec);
ret = OMX_ErrorHardware;
goto EXIT;
}
if (!sample_rate || !channels) {
if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
}
ret = OMX_ErrorNone;
goto EXIT;//
}
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)",
channels, sample_rate);
if (pAacDec->pcmParam.nChannels != channels ||
pAacDec->pcmParam.nSamplingRate != sample_rate) {
/* Change channel count and sampling rate information */
pAacDec->pcmParam.nChannels = channels;
pAacDec->pcmParam.nSamplingRate = sample_rate;
/* Send Port Settings changed call back */
(*(pExynosComponent->pCallbacks->EventHandler))
(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventPortSettingsChanged, /* The command was completed */
OMX_DirOutput, /* This is the port index */
0,
NULL);
}
pAacDec->hSeirenAacHandle.bConfiguredSeiren = OMX_TRUE;
if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
ret = OMX_ErrorNone;
}
goto EXIT;
}
/* Get decoded data from Seiren */
ADec_RecvPCM(fd, &output_mem_pool);
if (output_mem_pool.data_size > 0) {
pOutputData->dataLen = output_mem_pool.data_size;
Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE],
output_mem_pool.virt_addr, output_mem_pool.data_size);
} else {
pOutputData->dataLen = 0;
}
#ifdef Seiren_DUMP_TO_FILE
if (pOutputData->dataLen > 0)
fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile);
#endif
/* Delay EOS signal until all the PCM is returned from the Seiren driver. */
if (pAacDec->hSeirenAacHandle.bSeirenSendEOS == OMX_TRUE) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped);
if (returnCodec != 0)
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE");
if (isSeirenStopped == 1) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */
ret = OMX_ErrorNone;
} else {
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
}
} else { /* Flush after EOS */
pAacDec->hSeirenAacHandle.bSeirenSendEOS = OMX_FALSE;
}
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
FunctionIn();
if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
(!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
ret = Exynos_Seiren_Aac_Decode_Block(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) {
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
} else {
pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError, ret, 0, NULL);
}
} else {
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
pInputData->dataLen -= pInputData->usedDataLen;
pInputData->usedDataLen = 0;
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_AacDec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_AAC_HANDLE *pAacDec = (EXYNOS_AAC_HANDLE *)pAudioDec->hCodecHandle;
int fd = pAacDec->hSeirenAacHandle.hSeirenHandle;
return ADec_Flush(fd, type);
}
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
OMX_S32 fd;
int i = 0;
FunctionIn();
if ((hComponent == NULL) || (componentName == NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_AAC_DEC, componentName) != 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pExynosComponent->codecType = HW_AUDIO_DEC_CODEC;
pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
if (pExynosComponent->componentName == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_1;
}
Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_AAC_DEC);
pAacDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_AAC_HANDLE));
if (pAacDec == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_AAC_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_2;
}
Exynos_OSAL_Memset(pAacDec, 0, sizeof(EXYNOS_AAC_HANDLE));
pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pAacDec;
/* Create and Init Seiren */
pAacDec->hSeirenAacHandle.bSeirenLoaded = OMX_FALSE;
fd = ADec_Create(0, ADEC_AAC, NULL);
if (fd < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_3;
}
pAacDec->hSeirenAacHandle.hSeirenHandle = fd; /* Seiren's fd */
pAacDec->hSeirenAacHandle.bSeirenLoaded = OMX_TRUE;
/* Get input buffer info from Seiren */
Exynos_OSAL_Memset(&pAacDec->hSeirenAacHandle.input_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetIMemPoolInfo(fd, &pAacDec->hSeirenAacHandle.input_mem_pool);
input_mem_pool = pAacDec->hSeirenAacHandle.input_mem_pool;
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "eiren_Adec_GetIMemPoolInfo : %d", input_mem_pool.mem_size);
if (input_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_5;
}
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.allocSize = input_mem_pool.mem_size;
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr;
/* Get output buffer info from Seiren */
Exynos_OSAL_Memset(&pAacDec->hSeirenAacHandle.output_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetOMemPoolInfo(fd, &pAacDec->hSeirenAacHandle.output_mem_pool);
output_mem_pool = pAacDec->hSeirenAacHandle.output_mem_pool;
if (output_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_6;
}
/* Set componentVersion */
pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->componentVersion.s.nStep = STEP_NUMBER;
/* Set specVersion */
pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->specVersion.s.nStep = STEP_NUMBER;
/* Input port */
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/aac");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingAAC;
/* Output port */
pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
/* Default values for Aac audio param */
INIT_SET_SIZE_VERSION(&pAacDec->aacParam, OMX_AUDIO_PARAM_AACPROFILETYPE);
pAacDec->aacParam.nPortIndex = INPUT_PORT_INDEX;
pAacDec->aacParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pAacDec->aacParam.nBitRate = 0;
pAacDec->aacParam.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ;
pAacDec->aacParam.nAudioBandWidth = 0;
pAacDec->aacParam.eChannelMode = OMX_AUDIO_ChannelModeStereo;
pAacDec->aacParam.eAACProfile = OMX_AUDIO_AACObjectNull;
pAacDec->aacParam.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP2ADTS;
/* Default values for PCM audio param */
INIT_SET_SIZE_VERSION(&pAacDec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE);
pAacDec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX;
pAacDec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pAacDec->pcmParam.eNumData = OMX_NumericalDataSigned;
pAacDec->pcmParam.eEndian = OMX_EndianLittle;
pAacDec->pcmParam.bInterleaved = OMX_TRUE;
pAacDec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE;
pAacDec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ;
pAacDec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear;
pAacDec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
pAacDec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
pOMXComponent->GetParameter = &Exynos_Seiren_AacDec_GetParameter;
pOMXComponent->SetParameter = &Exynos_Seiren_AacDec_SetParameter;
pOMXComponent->GetConfig = &Exynos_Seiren_AacDec_GetConfig;
pOMXComponent->SetConfig = &Exynos_Seiren_AacDec_SetConfig;
pOMXComponent->GetExtensionIndex = &Exynos_Seiren_AacDec_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_AacDec_ComponentRoleEnum;
pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit;
/* ToDo: Change the function name associated with a specific codec */
pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_AacDec_Init;
pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_AacDec_Terminate;
pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_AacDec_bufferProcess;
pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_AacDec_flushSeiren;
pAudioDec->exynos_checkInputFrame = NULL;
pExynosComponent->currentState = OMX_StateLoaded;
ret = OMX_ErrorNone;
goto EXIT; /* This function is performed successfully. */
EXIT_ERROR_6:
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL;
pExynosPort->processData.allocSize = 0;
EXIT_ERROR_5:
EXIT_ERROR_4:
ADec_Destroy(pAacDec->hSeirenAacHandle.hSeirenHandle);
EXIT_ERROR_3:
Exynos_OSAL_Free(pAacDec);
pAudioDec->hCodecHandle = NULL;
EXIT_ERROR_2:
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
EXIT_ERROR_1:
Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_AAC_HANDLE *pAacDec = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (((pExynosComponent->currentState != OMX_StateInvalid) &&
(pExynosComponent->currentState != OMX_StateLoaded)) ||
((pExynosComponent->currentState == OMX_StateLoaded) &&
(pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle))) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] in curState(0x%x), OMX_FreeHandle() is called. change to OMX_StateInvalid",
pExynosComponent, __FUNCTION__, pExynosComponent->currentState);
Exynos_OMX_Component_abnormalTermination(hComponent);
}
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
pAacDec = (EXYNOS_AAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
if (pAacDec != NULL) {
if (pAacDec->hSeirenAacHandle.bSeirenLoaded == OMX_TRUE) {
ADec_Destroy(pAacDec->hSeirenAacHandle.hSeirenHandle);
}
Exynos_OSAL_Free(pAacDec);
((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL;
}
ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
if (ret != OMX_ErrorNone) {
goto EXIT;
}
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}

View File

@@ -0,0 +1,72 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Aacdec.h
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#ifndef EXYNOS_OMX_AAC_DEC_COMPONENT
#define EXYNOS_OMX_AAC_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "seiren_hw.h"
static const uint32_t aac_sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000
};
typedef struct _EXYNOS_Seiren_AAC_HANDLE
{
OMX_U32 hSeirenHandle;
OMX_BOOL bConfiguredSeiren;
OMX_BOOL bSeirenLoaded;
OMX_BOOL bSeirenSendEOS;
OMX_S32 returnCodec;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
} EXYNOS_Seiren_AAC_HANDLE;
typedef struct _EXYNOS_AAC_HANDLE
{
/* OMX Codec specific */
OMX_AUDIO_PARAM_AACPROFILETYPE aacParam;
OMX_AUDIO_PARAM_PCMMODETYPE pcmParam;
/* SEC Seiren Codec specific */
EXYNOS_Seiren_AAC_HANDLE hSeirenAacHandle;
} EXYNOS_AAC_HANDLE;
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_AAC_DEC_COMPONENT */

View 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

View 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_AAC_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent)
{
FunctionIn();
if (ppExynosComponent == NULL)
goto EXIT;
/* component 1 - audio decoder AAC */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_AAC_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View 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_AAC_DEC_REG
#define EXYNOS_OMX_AAC_DEC_REG
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OMX_Component_Register.h"
#define OSCL_EXPORT_REF __attribute__((visibility("default")))
#define MAX_COMPONENT_NUM 1
#define MAX_COMPONENT_ROLE_NUM 1
/* AAC */
#define EXYNOS_OMX_COMPONENT_AAC_DEC "OMX.Exynos.AAC.Decoder"
#define EXYNOS_OMX_COMPONENT_AAC_DEC_ROLE "audio_decoder.aac"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_AAC_DEC_REG */

View File

@@ -0,0 +1,41 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Flacdec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.FLAC.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Adec libExynosOMX_OSAL libExynosOMX_ABasecomponent \
libseirenhw
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libExynosOMX_Resourcemanager
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \
$(EXYNOS_AUDIO_CODEC)/include
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
endif
endif
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,946 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Flacdec.c
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Exynos_OMX_Macros.h"
#include "Exynos_OMX_ABasecomponent.h"
#include "Exynos_OMX_ABaseport.h"
#include "Exynos_OMX_Adec.h"
#include "Exynos_OSAL_ETC.h"
#include "Exynos_OSAL_Semaphore.h"
#include "Exynos_OSAL_Thread.h"
#include "library_register.h"
#include "Exynos_OMX_Flacdec.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_FLAC_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
//#define Seiren_DUMP_TO_FILE
#ifdef Seiren_DUMP_TO_FILE
#include "stdio.h"
FILE *inFile;
FILE *outFile;
#endif
OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nParamIndex) {
case OMX_IndexParamAudioFlac:
{
OMX_AUDIO_PARAM_FLACTYPE *pDstFlacParam = (OMX_AUDIO_PARAM_FLACTYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_FLACTYPE *pSrcFlacParam = NULL;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstFlacParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcFlacParam = &pFlacDec->flacParam;
Exynos_OSAL_Memcpy(pDstFlacParam, pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE));
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcPcmParam = &pFlacDec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_S32 codecType;
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE);
}
break;
default:
ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_SetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
case OMX_IndexParamAudioFlac:
{
OMX_AUDIO_PARAM_FLACTYPE *pDstFlacParam = NULL;
OMX_AUDIO_PARAM_FLACTYPE *pSrcFlacParam = (OMX_AUDIO_PARAM_FLACTYPE *)pComponentParameterStructure;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcFlacParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstFlacParam = &pFlacDec->flacParam;
Exynos_OSAL_Memcpy(pDstFlacParam, pSrcFlacParam, sizeof(OMX_AUDIO_PARAM_FLACTYPE));
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSize : %d \e[0m", pDstFlacParam->nSize);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nPortIndex : %d \e[0m", pDstFlacParam->nPortIndex);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nChannels : %d \e[0m", pDstFlacParam->nChannels);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nSampleRate : %d \e[0m", pDstFlacParam->nSampleRate);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33;46m nCompressionLevel : %d \e[0m", pDstFlacParam->nCompressionLevel);
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstPcmParam = &pFlacDec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) {
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
if (!Exynos_OSAL_Strcmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE)) {
pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingFLAC;
} else {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
}
break;
default:
ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_GetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if ((cParameterName == NULL) || (pIndexType == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_ComponentRoleEnum(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_U8 *cRole,
OMX_IN OMX_U32 nIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 codecType;
FunctionIn();
if ((hComponent == NULL) || (cRole == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
ret = OMX_ErrorNoMore;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle;
FunctionIn();
INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP);
Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Flac extractor should parse into frame unit. */
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
pFlacDec->hSeirenFlacHandle.bConfiguredSeiren = OMX_FALSE;
pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef Seiren_DUMP_TO_FILE
inFile = fopen("/data/InFile.flac", "w+");
outFile = fopen("/data/OutFile.pcm", "w+");
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
fclose(inFile);
fclose(outFile);
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Flac_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle;
int returnCodec = 0;
unsigned long long isSeirenStopped = 0;
OMX_BOOL isSeirenIbufOverflow = OMX_FALSE;
unsigned char* pt;
u32 fd = pFlacDec->hSeirenFlacHandle.hSeirenHandle;
audio_mem_info_t input_mem_pool = pFlacDec->hSeirenFlacHandle.input_mem_pool;
audio_mem_info_t output_mem_pool = pFlacDec->hSeirenFlacHandle.output_mem_pool;
unsigned long long sample_rate, channels;
int consumed_size = 0;
sample_rate = channels = 0;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
if (pExynosComponent->reInputData == OMX_FALSE) {
fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile);
}
#endif
/* Save timestamp and flags of input data */
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS);
/* Decoding flac frames by Seiren */
if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) {
input_mem_pool.data_size = pInputData->dataLen;
pt = (unsigned char*)input_mem_pool.virt_addr;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp);
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
ADec_SendEOS(fd);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!");
}
if (pInputData->nFlags & OMX_BUFFERFLAG_CODECCONFIG)
ADec_ConfigSignal(fd);
returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec);
if (returnCodec >= 0) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_TRUE;
}
} else if (returnCodec < 0) {
ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
goto EXIT;
}
}
if (pFlacDec->hSeirenFlacHandle.bConfiguredSeiren == OMX_FALSE) {
if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE;
ret = OMX_ErrorNone;
goto EXIT;
}
returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate);
returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels);
if (returnCodec < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec);
ret = OMX_ErrorHardware;
goto EXIT;
}
if (!sample_rate || !channels) {
if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
}
ret = OMX_ErrorNone;
goto EXIT;
}
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)",
channels, sample_rate);
if (pFlacDec->pcmParam.nChannels != channels ||
pFlacDec->pcmParam.nSamplingRate != sample_rate) {
/* Change channel count and sampling rate information */
pFlacDec->pcmParam.nChannels = channels;
pFlacDec->pcmParam.nSamplingRate = sample_rate;
/* Send Port Settings changed call back */
(*(pExynosComponent->pCallbacks->EventHandler))
(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventPortSettingsChanged, /* The command was completed */
OMX_DirOutput, /* This is the port index */
0,
NULL);
}
pFlacDec->hSeirenFlacHandle.bConfiguredSeiren = OMX_TRUE;
if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
ret = OMX_ErrorNone;
}
goto EXIT;
}
/* Get decoded data from Seiren */
ADec_RecvPCM(fd, &output_mem_pool);
if (output_mem_pool.data_size > 0) {
pOutputData->dataLen = output_mem_pool.data_size;
Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE],
output_mem_pool.virt_addr, output_mem_pool.data_size);
} else {
pOutputData->dataLen = 0;
}
#ifdef Seiren_DUMP_TO_FILE
if (pOutputData->dataLen > 0)
fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile);
#endif
/* Delay EOS signal until all the PCM is returned from the Seiren driver. */
if (pFlacDec->hSeirenFlacHandle.bSeirenSendEOS == OMX_TRUE) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped);
if (returnCodec != 0)
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE");
if (isSeirenStopped == 1) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */
ret = OMX_ErrorNone;
} else {
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
}
} else { /* Flush after EOS */
pFlacDec->hSeirenFlacHandle.bSeirenSendEOS = OMX_FALSE;
}
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
FunctionIn();
if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
(!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
ret = Exynos_Seiren_Flac_Decode_Block(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) {
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
} else {
pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError, ret, 0, NULL);
}
} else {
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
pInputData->dataLen -= pInputData->usedDataLen;
pInputData->usedDataLen = 0;
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_FlacDec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_FLAC_HANDLE *pFlacDec = (EXYNOS_FLAC_HANDLE *)pAudioDec->hCodecHandle;
if (type == 1)
return 0;
int fd = pFlacDec->hSeirenFlacHandle.hSeirenHandle;
return ADec_Flush(fd, type);
}
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
OMX_S32 fd;
int i = 0;
FunctionIn();
if ((hComponent == NULL) || (componentName == NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_FLAC_DEC, componentName) != 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pExynosComponent->codecType = HW_AUDIO_DEC_CODEC;
pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
if (pExynosComponent->componentName == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_1;
}
Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_FLAC_DEC);
pFlacDec = Exynos_OSAL_Malloc(sizeof(EXYNOS_FLAC_HANDLE));
if (pFlacDec == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_FLAC_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_2;
}
Exynos_OSAL_Memset(pFlacDec, 0, sizeof(EXYNOS_FLAC_HANDLE));
pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pFlacDec;
/* Create and Init Seiren */
pFlacDec->hSeirenFlacHandle.bSeirenLoaded = OMX_FALSE;
fd = ADec_Create(0, ADEC_FLAC, NULL);
if (fd < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_3;
}
pFlacDec->hSeirenFlacHandle.hSeirenHandle = fd; /* Seiren's fd */
pFlacDec->hSeirenFlacHandle.bSeirenLoaded = OMX_TRUE;
/* Get input buffer info from Seiren */
Exynos_OSAL_Memset(&pFlacDec->hSeirenFlacHandle.input_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetIMemPoolInfo(fd, &pFlacDec->hSeirenFlacHandle.input_mem_pool);
input_mem_pool = pFlacDec->hSeirenFlacHandle.input_mem_pool;
if (input_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_5;
}
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.allocSize = input_mem_pool.mem_size;
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr;
/* Get output buffer info from Seiren */
Exynos_OSAL_Memset(&pFlacDec->hSeirenFlacHandle.output_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetOMemPoolInfo(fd, &pFlacDec->hSeirenFlacHandle.output_mem_pool);
output_mem_pool = pFlacDec->hSeirenFlacHandle.output_mem_pool;
if (output_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_6;
}
/* Set componentVersion */
pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->componentVersion.s.nStep = STEP_NUMBER;
/* Set specVersion */
pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->specVersion.s.nStep = STEP_NUMBER;
/* Input port */
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/flac");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingFLAC;
/* Output port */
pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
/* Default values for Flac audio param */
INIT_SET_SIZE_VERSION(&pFlacDec->flacParam, OMX_AUDIO_PARAM_FLACTYPE);
pFlacDec->flacParam.nPortIndex = INPUT_PORT_INDEX;
pFlacDec->flacParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pFlacDec->flacParam.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ;
/* Default values for PCM audio param */
INIT_SET_SIZE_VERSION(&pFlacDec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE);
pFlacDec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX;
pFlacDec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pFlacDec->pcmParam.eNumData = OMX_NumericalDataSigned;
pFlacDec->pcmParam.eEndian = OMX_EndianLittle;
pFlacDec->pcmParam.bInterleaved = OMX_TRUE;
pFlacDec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE;
pFlacDec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ;
pFlacDec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear;
pFlacDec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
pFlacDec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
pOMXComponent->GetParameter = &Exynos_Seiren_FlacDec_GetParameter;
pOMXComponent->SetParameter = &Exynos_Seiren_FlacDec_SetParameter;
pOMXComponent->GetConfig = &Exynos_Seiren_FlacDec_GetConfig;
pOMXComponent->SetConfig = &Exynos_Seiren_FlacDec_SetConfig;
pOMXComponent->GetExtensionIndex = &Exynos_Seiren_FlacDec_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_FlacDec_ComponentRoleEnum;
pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit;
/* ToDo: Change the function name associated with a specific codec */
pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_FlacDec_Init;
pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_FlacDec_Terminate;
pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_FlacDec_bufferProcess;
pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_FlacDec_flushSeiren;
pAudioDec->exynos_checkInputFrame = NULL;
pExynosComponent->currentState = OMX_StateLoaded;
ret = OMX_ErrorNone;
goto EXIT; /* This function is performed successfully. */
EXIT_ERROR_6:
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL;
pExynosPort->processData.allocSize = 0;
EXIT_ERROR_5:
EXIT_ERROR_4:
ADec_Destroy(pFlacDec->hSeirenFlacHandle.hSeirenHandle);
EXIT_ERROR_3:
Exynos_OSAL_Free(pFlacDec);
pAudioDec->hCodecHandle = NULL;
EXIT_ERROR_2:
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
EXIT_ERROR_1:
Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_FLAC_HANDLE *pFlacDec = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (((pExynosComponent->currentState != OMX_StateInvalid) &&
(pExynosComponent->currentState != OMX_StateLoaded)) ||
((pExynosComponent->currentState == OMX_StateLoaded) &&
(pExynosComponent->transientState == EXYNOS_OMX_TransStateLoadedToIdle))) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s] in curState(0x%x), OMX_FreeHandle() is called. change to OMX_StateInvalid",
pExynosComponent, __FUNCTION__, pExynosComponent->currentState);
Exynos_OMX_Component_abnormalTermination(hComponent);
}
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
pFlacDec = (EXYNOS_FLAC_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
if (pFlacDec != NULL) {
if (pFlacDec->hSeirenFlacHandle.bSeirenLoaded == OMX_TRUE) {
ADec_Destroy(pFlacDec->hSeirenFlacHandle.hSeirenHandle);
}
Exynos_OSAL_Free(pFlacDec);
((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL;
}
ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
if (ret != OMX_ErrorNone) {
goto EXIT;
}
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}

View File

@@ -0,0 +1,77 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Flacdec.h
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#ifndef EXYNOS_OMX_FLAC_DEC_COMPONENT
#define EXYNOS_OMX_FLAC_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "seiren_hw.h"
static const uint32_t flac_sample_rates[] =
{
0, 88200, 176400, 192000, 8000, 16000, 22050, 24000,
32000, 44100, 48000, 96000, 0, 0, 0, 0
};
static const uint32_t flac_channels[] =
{
1, 2, 3, 4, 5, 6, 7, 8,
2, 2, 2, 0, 0, 0, 0, 0
};
typedef struct _EXYNOS_Seiren_FLAC_HANDLE
{
OMX_U32 hSeirenHandle;
OMX_BOOL bConfiguredSeiren;
OMX_BOOL bSeirenLoaded;
OMX_BOOL bSeirenSendEOS;
OMX_S32 returnCodec;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
} EXYNOS_Seiren_FLAC_HANDLE;
typedef struct _EXYNOS_FLAC_HANDLE
{
/* OMX Codec specific */
OMX_AUDIO_PARAM_FLACTYPE flacParam;
OMX_AUDIO_PARAM_PCMMODETYPE pcmParam;
/* SEC Seiren Codec specific */
EXYNOS_Seiren_FLAC_HANDLE hSeirenFlacHandle;
} EXYNOS_FLAC_HANDLE;
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_FLAC_DEC_COMPONENT */

View 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

View 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_FLAC_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent)
{
FunctionIn();
if (ppExynosComponent == NULL)
goto EXIT;
/* component 1 - audio decoder FLAC */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_FLAC_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View 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_FLAC_DEC_REG
#define EXYNOS_OMX_FLAC_DEC_REG
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OMX_Component_Register.h"
#define OSCL_EXPORT_REF __attribute__((visibility("default")))
#define MAX_COMPONENT_NUM 1
#define MAX_COMPONENT_ROLE_NUM 1
/* FLAC */
#define EXYNOS_OMX_COMPONENT_FLAC_DEC "OMX.Exynos.FLAC.Decoder"
#define EXYNOS_OMX_COMPONENT_FLAC_DEC_ROLE "audio_decoder.flac"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_FLAC_DEC_REG */

View 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 \
libseirenhw
LOCAL_SHARED_LIBRARIES := libc libdl libcutils libutils libui \
libExynosOMX_Resourcemanager
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/audio/seiren_dec \
$(EXYNOS_AUDIO_CODEC)/include
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
endif
endif
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,955 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Mp3dec.c
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/
#include "Exynos_OMX_Macros.h"
#include "Exynos_OMX_ABasecomponent.h"
#include "Exynos_OMX_ABaseport.h"
#include "Exynos_OMX_Adec.h"
#include "Exynos_OSAL_ETC.h"
#include "Exynos_OSAL_Semaphore.h"
#include "Exynos_OSAL_Thread.h"
#include "library_register.h"
#include "Exynos_OMX_Mp3dec.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
//#define Seiren_DUMP_TO_FILE
#ifdef Seiren_DUMP_TO_FILE
#include "stdio.h"
FILE *inFile;
FILE *outFile;
#endif
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nParamIndex) {
case OMX_IndexParamAudioMp3:
{
OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = NULL;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstMp3Param->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcMp3Param = &pMp3Dec->mp3Param;
Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = NULL;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pDstPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pDstPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pSrcPcmParam = &pMp3Dec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_S32 codecType;
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE *)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE);
}
break;
default:
ret = Exynos_OMX_AudioDecodeGetParameter(hComponent, nParamIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_SetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentParameterStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentParameterStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
case OMX_IndexParamAudioMp3:
{
OMX_AUDIO_PARAM_MP3TYPE *pDstMp3Param = NULL;
OMX_AUDIO_PARAM_MP3TYPE *pSrcMp3Param = (OMX_AUDIO_PARAM_MP3TYPE *)pComponentParameterStructure;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcMp3Param->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstMp3Param = &pMp3Dec->mp3Param;
Exynos_OSAL_Memcpy(pDstMp3Param, pSrcMp3Param, sizeof(OMX_AUDIO_PARAM_MP3TYPE));
}
break;
case OMX_IndexParamAudioPcm:
{
OMX_AUDIO_PARAM_PCMMODETYPE *pDstPcmParam = NULL;
OMX_AUDIO_PARAM_PCMMODETYPE *pSrcPcmParam = (OMX_AUDIO_PARAM_PCMMODETYPE *)pComponentParameterStructure;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
ret = Exynos_OMX_Check_SizeVersion(pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pSrcPcmParam->nPortIndex >= ALL_PORT_NUM) {
ret = OMX_ErrorBadPortIndex;
goto EXIT;
}
pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
pDstPcmParam = &pMp3Dec->pcmParam;
Exynos_OSAL_Memcpy(pDstPcmParam, pSrcPcmParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
}
break;
case OMX_IndexParamStandardComponentRole:
{
OMX_PARAM_COMPONENTROLETYPE *pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)pComponentParameterStructure;
ret = Exynos_OMX_Check_SizeVersion(pComponentRole, sizeof(OMX_PARAM_COMPONENTROLETYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if ((pExynosComponent->currentState != OMX_StateLoaded) && (pExynosComponent->currentState != OMX_StateWaitForResources)) {
ret = OMX_ErrorIncorrectStateOperation;
goto EXIT;
}
if (!Exynos_OSAL_Strncmp((char*)pComponentRole->cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE, 16)) {
pExynosComponent->pExynosPort[INPUT_PORT_INDEX].portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3;
} else {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
}
break;
default:
ret = Exynos_OMX_AudioDecodeSetParameter(hComponent, nIndex, pComponentParameterStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeGetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_SetConfig(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR pComponentConfigStructure)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL || pComponentConfigStructure == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
switch (nIndex) {
default:
ret = Exynos_OMX_AudioDecodeSetConfig(hComponent, nIndex, pComponentConfigStructure);
break;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_GetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if ((cParameterName == NULL) || (pIndexType == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (pExynosComponent->currentState == OMX_StateInvalid) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
ret = Exynos_OMX_AudioDecodeGetExtensionIndex(hComponent, cParameterName, pIndexType);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_ComponentRoleEnum(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_OUT OMX_U8 *cRole,
OMX_IN OMX_U32 nIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
OMX_S32 codecType;
FunctionIn();
if ((hComponent == NULL) || (cRole == NULL)) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (nIndex != (MAX_COMPONENT_ROLE_NUM - 1)) {
ret = OMX_ErrorNoMore;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_Check_SizeVersion(pOMXComponent, sizeof(OMX_COMPONENTTYPE));
if (ret != OMX_ErrorNone) {
goto EXIT;
}
if (pOMXComponent->pComponentPrivate == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateInvalid ) {
ret = OMX_ErrorInvalidState;
goto EXIT;
}
Exynos_OSAL_Strcpy((char *)cRole, EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_Init(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle;
FunctionIn();
INIT_ARRAY_TO_VAL(pExynosComponent->timeStamp, DEFAULT_TIMESTAMP_VAL, MAX_TIMESTAMP);
Exynos_OSAL_Memset(pExynosComponent->nFlags, 0, sizeof(OMX_U32) * MAX_FLAGS);
pExynosComponent->bUseFlagEOF = OMX_TRUE; /* Mp3 extractor should parse into frame unit. */
pExynosComponent->bSaveFlagEOS = OMX_FALSE;
pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren = OMX_FALSE;
pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
#ifdef Seiren_DUMP_TO_FILE
inFile = fopen("/data/InFile.mp3", "w+");
outFile = fopen("/data/OutFile.pcm", "w+");
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
fclose(inFile);
fclose(outFile);
#endif
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3_Decode_Block(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle;
int returnCodec = 0;
unsigned long long isSeirenStopped = 0;
OMX_BOOL isSeirenIbufOverflow = OMX_FALSE;
u32 fd = pMp3Dec->hSeirenMp3Handle.hSeirenHandle;
audio_mem_info_t input_mem_pool = pMp3Dec->hSeirenMp3Handle.input_mem_pool;
audio_mem_info_t output_mem_pool = pMp3Dec->hSeirenMp3Handle.output_mem_pool;
unsigned long long sample_rate, channels;
int consumed_size = 0;
unsigned char* pt = NULL;
sample_rate = channels = 0;
FunctionIn();
#ifdef Seiren_DUMP_TO_FILE
if (pExynosComponent->reInputData == OMX_FALSE) {
fwrite(pInputData->buffer.addr[AUDIO_DATA_PLANE], pInputData->dataLen, 1, inFile);
}
#endif
/* Save timestamp and flags of input data */
pOutputData->timeStamp = pInputData->timeStamp;
pOutputData->nFlags = pInputData->nFlags & (~OMX_BUFFERFLAG_EOS);
/* Decoding mp3 frames by Seiren */
if (pExynosComponent->getAllDelayBuffer == OMX_FALSE) {
input_mem_pool.data_size = pInputData->dataLen;
pt = (unsigned char*)input_mem_pool.virt_addr;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "\e[1;33m %02X %02X %02X %02X %02X %02X %lld \e[0m", *pt,*(pt+1),*(pt+2),*(pt+3),*(pt+4), *(pt+5), pInputData->timeStamp);
returnCodec = ADec_SendStream(fd, &input_mem_pool, &consumed_size);
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "ProcessedSize : %d return : %d", consumed_size, returnCodec);
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "EOS!!");
if (returnCodec >= 0) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
ADec_SendEOS(fd);
pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_TRUE;
}
} else if (returnCodec < 0) {
ret = (OMX_ERRORTYPE)OMX_ErrorCodecDecode;
goto EXIT;
}
}
if (pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren == OMX_FALSE) {
if ((pInputData->dataLen <= 0) && (pInputData->nFlags & OMX_BUFFERFLAG_EOS)) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE;
ret = OMX_ErrorNone;
goto EXIT;
}
returnCodec = ADec_GetParams(fd, PCM_PARAM_SAMPLE_RATE, &sample_rate);
returnCodec = returnCodec | ADec_GetParams(fd, PCM_PARAM_NUM_OF_CH, &channels);
if (returnCodec < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetParams failed: %d", returnCodec);
ret = OMX_ErrorHardware;
goto EXIT;
}
if (!sample_rate || !channels) {
if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
}
ret = OMX_ErrorNone;
goto EXIT;
}
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "numChannels(%d), samplingRate(%d)",
channels, sample_rate);
if (pMp3Dec->pcmParam.nChannels != channels ||
pMp3Dec->pcmParam.nSamplingRate != sample_rate) {
/* Change channel count and sampling rate information */
pMp3Dec->pcmParam.nChannels = channels;
pMp3Dec->pcmParam.nSamplingRate = sample_rate;
/* Send Port Settings changed call back */
(*(pExynosComponent->pCallbacks->EventHandler))
(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventPortSettingsChanged, /* The command was completed */
OMX_DirOutput, /* This is the port index */
0,
NULL);
}
pMp3Dec->hSeirenMp3Handle.bConfiguredSeiren = OMX_TRUE;
if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) {
pOutputData->dataLen = 0;
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
} else {
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
ret = OMX_ErrorNone;
}
goto EXIT;
}
/* Get decoded data from Seiren */
ADec_RecvPCM(fd, &output_mem_pool);
pt = (unsigned char*)output_mem_pool.virt_addr;
/* Trim first samples for MP3 gapless CTS test */
if (pAudioDec->bFirstFrame) {
pAudioDec->bFirstFrame = OMX_FALSE;
/* Need to check Gapless playback or not */
const int gapless_frames = 529;
const int gapless_bytes = gapless_frames * pMp3Dec->pcmParam.nChannels * sizeof(OMX_S16);
if (output_mem_pool.data_size >= gapless_bytes) {
pt += gapless_bytes;
output_mem_pool.data_size -= gapless_bytes;
}
}
if (output_mem_pool.data_size > 0) {
pOutputData->dataLen = output_mem_pool.data_size;
Exynos_OSAL_Memcpy(pOutputData->buffer.addr[AUDIO_DATA_PLANE],
pt, output_mem_pool.data_size);
} else {
pOutputData->dataLen = 0;
}
#ifdef Seiren_DUMP_TO_FILE
if (pOutputData->dataLen > 0)
fwrite(pOutputData->buffer.addr[AUDIO_DATA_PLANE], pOutputData->dataLen, 1, outFile);
#endif
/* Delay EOS signal until all the PCM is returned from the Seiren driver. */
if (pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS == OMX_TRUE) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS) {
returnCodec = ADec_GetParams(fd, ADEC_PARAM_GET_OUTPUT_STATUS, &isSeirenStopped);
if (returnCodec != 0)
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Fail Seiren_STOP_EOS_STATE");
if (isSeirenStopped == 1) {
pOutputData->nFlags |= OMX_BUFFERFLAG_EOS;
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE; /* for repeating one song */
ret = OMX_ErrorNone;
} else {
pExynosComponent->getAllDelayBuffer = OMX_TRUE;
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
}
} else { /* Flush after EOS */
pMp3Dec->hSeirenMp3Handle.bSeirenSendEOS = OMX_FALSE;
}
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_bufferProcess(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData, EXYNOS_OMX_DATA *pOutputData)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
FunctionIn();
if ((!CHECK_PORT_ENABLED(pInputPort)) || (!CHECK_PORT_ENABLED(pOutputPort)) ||
(!CHECK_PORT_POPULATED(pInputPort)) || (!CHECK_PORT_POPULATED(pOutputPort))) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
if (OMX_FALSE == Exynos_Check_BufferProcess_State(pExynosComponent)) {
if (pInputData->nFlags & OMX_BUFFERFLAG_EOS)
ret = (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet;
else
ret = OMX_ErrorNone;
goto EXIT;
}
ret = Exynos_Seiren_Mp3_Decode_Block(pOMXComponent, pInputData, pOutputData);
if (ret != OMX_ErrorNone) {
if (ret == (OMX_ERRORTYPE)OMX_ErrorInputDataDecodeYet) {
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
} else {
pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError, ret, 0, NULL);
}
} else {
pInputData->usedDataLen += pInputData->dataLen;
pInputData->remainDataLen = pInputData->dataLen - pInputData->usedDataLen;
pInputData->dataLen -= pInputData->usedDataLen;
pInputData->usedDataLen = 0;
pOutputData->usedDataLen = 0;
pOutputData->remainDataLen = pOutputData->dataLen;
}
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_Seiren_Mp3Dec_flushSeiren(OMX_COMPONENTTYPE *pOMXComponent, SEIREN_PORTTYPE type)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
EXYNOS_MP3_HANDLE *pMp3Dec = (EXYNOS_MP3_HANDLE *)pAudioDec->hCodecHandle;
int fd = pMp3Dec->hSeirenMp3Handle.hSeirenHandle;
return ADec_Flush(fd, type);
}
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_AUDIODEC_COMPONENT *pAudioDec = NULL;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
OMX_S32 fd;
OMX_S32 codec_type = CODEC_TYPE_MAX;
int i = 0;
FunctionIn();
if ((hComponent == NULL) || (componentName == NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: parameters are null, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP3_DEC, componentName) == 0) {
codec_type = CODEC_TYPE_MP3;
} else if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP1_DEC, componentName) == 0) {
codec_type = CODEC_TYPE_MP1;
} else if (Exynos_OSAL_Strcmp(EXYNOS_OMX_COMPONENT_MP2_DEC, componentName) == 0) {
codec_type = CODEC_TYPE_MP2;
} else {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName(%s) error, ret: %X", __FUNCTION__, componentName, ret);
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
ret = Exynos_OMX_AudioDecodeComponentInit(pOMXComponent);
if (ret != OMX_ErrorNone) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: Exynos_OMX_AudioDecodeComponentInit error, ret: %X", __FUNCTION__, ret);
goto EXIT;
}
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pExynosComponent->codecType = HW_AUDIO_DEC_CODEC;
pExynosComponent->componentName = (OMX_STRING)Exynos_OSAL_Malloc(MAX_OMX_COMPONENT_NAME_SIZE);
if (pExynosComponent->componentName == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: componentName alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_1;
}
Exynos_OSAL_Memset(pExynosComponent->componentName, 0, MAX_OMX_COMPONENT_NAME_SIZE);
Exynos_OSAL_Strcpy(pExynosComponent->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC);
pMp3Dec = Exynos_OSAL_Malloc(sizeof(EXYNOS_MP3_HANDLE));
if (pMp3Dec == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "%s: EXYNOS_MP3_HANDLE alloc error, ret: %X", __FUNCTION__, ret);
ret = OMX_ErrorInsufficientResources;
goto EXIT_ERROR_2;
}
Exynos_OSAL_Memset(pMp3Dec, 0, sizeof(EXYNOS_MP3_HANDLE));
pAudioDec = (EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle;
pAudioDec->hCodecHandle = (OMX_HANDLETYPE)pMp3Dec;
pAudioDec->bFirstFrame = OMX_TRUE;
/* Create and Init Seiren */
pMp3Dec->hSeirenMp3Handle.bSeirenLoaded = OMX_FALSE;
fd = ADec_Create(0, ADEC_MP3, NULL);
if (fd < 0) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_Create failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_3;
}
pMp3Dec->hSeirenMp3Handle.hSeirenHandle = fd; /* Seiren's fd */
pMp3Dec->hSeirenMp3Handle.bSeirenLoaded = OMX_TRUE;
/* Get input buffer info from Seiren */
Exynos_OSAL_Memset(&pMp3Dec->hSeirenMp3Handle.input_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetIMemPoolInfo(fd, &pMp3Dec->hSeirenMp3Handle.input_mem_pool);
input_mem_pool = pMp3Dec->hSeirenMp3Handle.input_mem_pool;
if (input_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_Adec_GetIMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_5;
}
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.allocSize = input_mem_pool.mem_size;
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = input_mem_pool.virt_addr;
/* Get output buffer info from Seiren */
Exynos_OSAL_Memset(&pMp3Dec->hSeirenMp3Handle.output_mem_pool, 0, sizeof(audio_mem_info_t));
ADec_GetOMemPoolInfo(fd, &pMp3Dec->hSeirenMp3Handle.output_mem_pool);
output_mem_pool = pMp3Dec->hSeirenMp3Handle.output_mem_pool;
if (output_mem_pool.virt_addr == NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Seiren_ADec_GetOMemPoolInfo failed: %d", fd);
ret = OMX_ErrorHardware;
goto EXIT_ERROR_6;
}
/* Set componentVersion */
pExynosComponent->componentVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->componentVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->componentVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->componentVersion.s.nStep = STEP_NUMBER;
/* Set specVersion */
pExynosComponent->specVersion.s.nVersionMajor = VERSIONMAJOR_NUMBER;
pExynosComponent->specVersion.s.nVersionMinor = VERSIONMINOR_NUMBER;
pExynosComponent->specVersion.s.nRevision = REVISION_NUMBER;
pExynosComponent->specVersion.s.nStep = STEP_NUMBER;
/* Input port */
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = input_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = input_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
if (codec_type == CODEC_TYPE_MP3)
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg");
else if (codec_type == CODEC_TYPE_MP1)
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg-L1");
else
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/mpeg-L2");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingMP3;
/* Output port */
pExynosPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX];
pExynosPort->portDefinition.nBufferCountActual = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferCountMin = output_mem_pool.block_count;
pExynosPort->portDefinition.nBufferSize = output_mem_pool.mem_size;
pExynosPort->portDefinition.bEnabled = OMX_TRUE;
Exynos_OSAL_Memset(pExynosPort->portDefinition.format.audio.cMIMEType, 0, MAX_OMX_MIMETYPE_SIZE);
Exynos_OSAL_Strcpy(pExynosPort->portDefinition.format.audio.cMIMEType, "audio/raw");
pExynosPort->portDefinition.format.audio.pNativeRender = 0;
pExynosPort->portDefinition.format.audio.bFlagErrorConcealment = OMX_FALSE;
pExynosPort->portDefinition.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
/* Default values for Mp3 audio param */
INIT_SET_SIZE_VERSION(&pMp3Dec->mp3Param, OMX_AUDIO_PARAM_MP3TYPE);
pMp3Dec->mp3Param.nPortIndex = INPUT_PORT_INDEX;
pMp3Dec->mp3Param.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pMp3Dec->mp3Param.nBitRate = 0;
pMp3Dec->mp3Param.nSampleRate = DEFAULT_AUDIO_SAMPLING_FREQ;
pMp3Dec->mp3Param.nAudioBandWidth = 0;
pMp3Dec->mp3Param.eChannelMode = OMX_AUDIO_ChannelModeStereo;
pMp3Dec->mp3Param.eFormat = OMX_AUDIO_MP3StreamFormatMP1Layer3;
/* Default values for PCM audio param */
INIT_SET_SIZE_VERSION(&pMp3Dec->pcmParam, OMX_AUDIO_PARAM_PCMMODETYPE);
pMp3Dec->pcmParam.nPortIndex = OUTPUT_PORT_INDEX;
pMp3Dec->pcmParam.nChannels = DEFAULT_AUDIO_CHANNELS_NUM;
pMp3Dec->pcmParam.eNumData = OMX_NumericalDataSigned;
pMp3Dec->pcmParam.eEndian = OMX_EndianLittle;
pMp3Dec->pcmParam.bInterleaved = OMX_TRUE;
pMp3Dec->pcmParam.nBitPerSample = DEFAULT_AUDIO_BIT_PER_SAMPLE;
pMp3Dec->pcmParam.nSamplingRate = DEFAULT_AUDIO_SAMPLING_FREQ;
pMp3Dec->pcmParam.ePCMMode = OMX_AUDIO_PCMModeLinear;
pMp3Dec->pcmParam.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
pMp3Dec->pcmParam.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
pOMXComponent->GetParameter = &Exynos_Seiren_Mp3Dec_GetParameter;
pOMXComponent->SetParameter = &Exynos_Seiren_Mp3Dec_SetParameter;
pOMXComponent->GetConfig = &Exynos_Seiren_Mp3Dec_GetConfig;
pOMXComponent->SetConfig = &Exynos_Seiren_Mp3Dec_SetConfig;
pOMXComponent->GetExtensionIndex = &Exynos_Seiren_Mp3Dec_GetExtensionIndex;
pOMXComponent->ComponentRoleEnum = &Exynos_Seiren_Mp3Dec_ComponentRoleEnum;
pOMXComponent->ComponentDeInit = &Exynos_OMX_ComponentDeinit;
/* ToDo: Change the function name associated with a specific codec */
pExynosComponent->exynos_codec_componentInit = &Exynos_Seiren_Mp3Dec_Init;
pExynosComponent->exynos_codec_componentTerminate = &Exynos_Seiren_Mp3Dec_Terminate;
pAudioDec->exynos_codec_bufferProcess = &Exynos_Seiren_Mp3Dec_bufferProcess;
pAudioDec->exynos_codec_flushSeiren = &Exynos_Seiren_Mp3Dec_flushSeiren;
pAudioDec->exynos_checkInputFrame = NULL;
pExynosComponent->currentState = OMX_StateLoaded;
ret = OMX_ErrorNone;
goto EXIT; /* This function is performed successfully. */
EXIT_ERROR_6:
pExynosPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX];
pExynosPort->processData.buffer.addr[AUDIO_DATA_PLANE] = NULL;
pExynosPort->processData.allocSize = 0;
EXIT_ERROR_5:
EXIT_ERROR_4:
ADec_Destroy(pMp3Dec->hSeirenMp3Handle.hSeirenHandle);
EXIT_ERROR_3:
Exynos_OSAL_Free(pMp3Dec);
pAudioDec->hCodecHandle = NULL;
EXIT_ERROR_2:
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
EXIT_ERROR_1:
Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_COMPONENTTYPE *pOMXComponent = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_MP3_HANDLE *pMp3Dec = NULL;
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
FunctionIn();
if (hComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
pOMXComponent = (OMX_COMPONENTTYPE *)hComponent;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
Exynos_OSAL_Free(pExynosComponent->componentName);
pExynosComponent->componentName = NULL;
pMp3Dec = (EXYNOS_MP3_HANDLE *)((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle;
if (pMp3Dec != NULL) {
if (pMp3Dec->hSeirenMp3Handle.bSeirenLoaded == OMX_TRUE) {
ADec_Destroy(pMp3Dec->hSeirenMp3Handle.hSeirenHandle);
}
Exynos_OSAL_Free(pMp3Dec);
((EXYNOS_OMX_AUDIODEC_COMPONENT *)pExynosComponent->hComponentHandle)->hCodecHandle = NULL;
}
ret = Exynos_OMX_AudioDecodeComponentDeinit(pOMXComponent);
if (ret != OMX_ErrorNone) {
goto EXIT;
}
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}

View File

@@ -0,0 +1,74 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file Exynos_OMX_Mp3dec.h
* @brief
* @author Sungyeon Kim (sy85.kim@samsung.com)
* @version 1.0.0
* @history
* 2012.12.22 : Create
*/
#ifndef EXYNOS_OMX_MP3_DEC_COMPONENT
#define EXYNOS_OMX_MP3_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "seiren_hw.h"
typedef enum _CODEC_TYPE
{
CODEC_TYPE_MP1,
CODEC_TYPE_MP2,
CODEC_TYPE_MP3,
CODEC_TYPE_MAX
} CODEC_TYPE;
typedef struct _EXYNOS_Seiren_MP3_HANDLE
{
OMX_U32 hSeirenHandle;
OMX_BOOL bConfiguredSeiren;
OMX_BOOL bSeirenLoaded;
OMX_BOOL bSeirenSendEOS;
OMX_S32 returnCodec;
audio_mem_info_t input_mem_pool;
audio_mem_info_t output_mem_pool;
} EXYNOS_Seiren_MP3_HANDLE;
typedef struct _EXYNOS_MP3_HANDLE
{
/* OMX Codec specific */
OMX_AUDIO_PARAM_MP3TYPE mp3Param;
OMX_AUDIO_PARAM_PCMMODETYPE pcmParam;
/* SEC Seiren Codec specific */
EXYNOS_Seiren_MP3_HANDLE hSeirenMp3Handle;
} EXYNOS_MP3_HANDLE;
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent, OMX_STRING componentName);
OMX_ERRORTYPE Exynos_OMX_ComponentDeinit(OMX_HANDLETYPE hComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_MP3_DEC_COMPONENT */

View 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

View File

@@ -0,0 +1,67 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file library_register.c
* @brief
* @author Yunji Kim (yunji.kim@samsung.com)
* @version 1.1.0
* @history
* 2012.02.28 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
#include "Exynos_OSAL_Memory.h"
#include "Exynos_OSAL_ETC.h"
#include "library_register.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_MP3_DEC"
#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent)
{
FunctionIn();
if (ppExynosComponent == NULL)
goto EXIT;
/* component 1 - audio decoder MP3 */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_MP3_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 2 - audio decoder MP3 Layer 1 */
Exynos_OSAL_Strcpy(ppExynosComponent[1]->componentName, EXYNOS_OMX_COMPONENT_MP1_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[1]->roles[0], EXYNOS_OMX_COMPONENT_MP1_DEC_ROLE);
ppExynosComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 3 - audio decoder MP3 Layer 2 */
Exynos_OSAL_Strcpy(ppExynosComponent[2]->componentName, EXYNOS_OMX_COMPONENT_MP2_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[2]->roles[0], EXYNOS_OMX_COMPONENT_MP2_DEC_ROLE);
ppExynosComponent[2]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,60 @@
/*
*
* Copyright 2012 Samsung Electronics S.LSI Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @file library_register.h
* @brief
* @author Yunji Kim (yunji.kim@samsung.com)
* @version 1.1.0
* @history
* 2012.02.28 : Create
*/
#ifndef EXYNOS_OMX_MP3_DEC_REG
#define EXYNOS_OMX_MP3_DEC_REG
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OMX_Component_Register.h"
#define OSCL_EXPORT_REF __attribute__((visibility("default")))
#define MAX_COMPONENT_NUM 3
#define MAX_COMPONENT_ROLE_NUM 1
/* MP3 */
#define EXYNOS_OMX_COMPONENT_MP3_DEC "OMX.Exynos.MP3.Decoder"
#define EXYNOS_OMX_COMPONENT_MP3_DEC_ROLE "audio_decoder.mp3"
#define EXYNOS_OMX_COMPONENT_MP1_DEC "OMX.Exynos.MP1.Decoder"
#define EXYNOS_OMX_COMPONENT_MP1_DEC_ROLE "audio_decoder.mp1"
#define EXYNOS_OMX_COMPONENT_MP2_DEC "OMX.Exynos.MP2.Decoder"
#define EXYNOS_OMX_COMPONENT_MP2_DEC_ROLE "audio_decoder.mp2"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif /* EXYNOS_OMX_MP3_DEC_REG */

View File

@@ -0,0 +1,97 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Basecomponent.c \
Exynos_OMX_Baseport.c
LOCAL_MODULE := libExynosOMX_Basecomponent
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_STATIC_LIBRARIES := libExynosOMX_OSAL
LOCAL_SHARED_LIBRARIES := libcutils libutils
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_VIDEO_CODEC)/include
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(EXYNOS_OMX_SUPPORT_EGL_IMAGE), true)
LOCAL_CFLAGS += -DEGL_IMAGE_SUPPORT
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label -Wno-unused-function
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Resourcemanager.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libExynosOMX_Resourcemanager
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_STATIC_LIBRARIES := libExynosOMX_OSAL
LOCAL_SHARED_LIBRARIES := libcutils libutils liblog
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(EXYNOS_OMX_SUPPORT_TUNNELING), true)
LOCAL_CFLAGS += -DTUNNELING_SUPPORT
endif
ifneq ($(BOARD_NOT_SUPPORT_DCPP), true)
LOCAL_CFLAGS += -DUSE_SECURE_WITH_NONSECURE
endif
ifeq ($(BOARD_USE_SINGLE_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
ifdef BOARD_USE_MAX_COMPONENT_NUM
LOCAL_CFLAGS += -DMAX_COMPONENT_NUM=$(BOARD_USE_MAX_COMPONENT_NUM)
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label -Wno-unused-function
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,166 @@
/*
*
* 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_Basecomponent.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.5.0
* @history
* 2012.02.20 : Create
* 2017.08.03 : Change event handling
*/
#ifndef EXYNOS_OMX_BASECOMP
#define EXYNOS_OMX_BASECOMP
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_Baseport.h"
typedef struct _EXYNOS_OMX_MESSAGE
{
OMX_U32 type;
OMX_U32 param;
OMX_PTR pCmdData;
} EXYNOS_OMX_MESSAGE;
/* for Check TimeStamp after Seek */
typedef struct _EXYNOS_OMX_TIMESTAMP
{
OMX_BOOL needSetStartTimeStamp;
OMX_BOOL needCheckStartTimeStamp;
OMX_TICKS startTimeStamp;
OMX_U32 nStartFlags;
} EXYNOS_OMX_TIMESTAMP;
typedef struct _EXYNOS_OMX_BASECOMPONENT
{
OMX_STRING componentName;
OMX_VERSIONTYPE componentVersion;
OMX_VERSIONTYPE specVersion;
OMX_STATETYPE currentState;
EXYNOS_OMX_TRANS_STATETYPE transientState;
OMX_BOOL abendState;
EXYNOS_CODEC_TYPE codecType;
EXYNOS_OMX_PRIORITYMGMTTYPE compPriority;
OMX_MARKTYPE propagateMarkType;
OMX_HANDLETYPE compMutex;
OMX_HANDLETYPE compEventMutex;
OMX_HANDLETYPE hComponentHandle;
/* Message Handler */
OMX_BOOL bExitMessageHandlerThread;
OMX_HANDLETYPE hMessageHandler;
OMX_HANDLETYPE hSemaMsgWait;
OMX_HANDLETYPE hSemaMsgProgress;
EXYNOS_QUEUE messageQ;
EXYNOS_QUEUE dynamicConfigQ;
/* Port */
OMX_PORT_PARAM_TYPE portParam;
EXYNOS_OMX_BASEPORT *pExynosPort;
/* Callback function */
OMX_CALLBACKTYPE *pCallbacks;
OMX_PTR callbackData;
/* Save Timestamp */
OMX_BOOL bTimestampSlotUsed[MAX_TIMESTAMP];
OMX_TICKS timeStamp[MAX_TIMESTAMP];
EXYNOS_OMX_TIMESTAMP checkTimeStamp;
/* Save Flags */
OMX_U32 nFlags[MAX_FLAGS];
OMX_BOOL getAllDelayBuffer;
OMX_BOOL reInputData;
OMX_BOOL bUseImgCrop;
/* HDR10+ */
EXYNOS_QUEUE HDR10plusConfigQ;
EXYNOS_OMX_VIDEO_HDR10PLUS_INFO HDR10plusList[MAX_BUFFER_REF];
OMX_BOOL bUseFlagEOF;
OMX_BOOL bSaveFlagEOS; /* bSaveFlagEOS is OMX_TRUE, if EOS flag is incoming. */
OMX_BOOL bBehaviorEOS; /* bBehaviorEOS is OMX_TRUE, if EOS flag with Data are incoming. */
OMX_PTR vendorExts[MAX_VENDOR_EXT_NUM];
OMX_ERRORTYPE (*exynos_codec_componentInit)(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE (*exynos_codec_componentTerminate)(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef TUNNELING_SUPPORT
OMX_ERRORTYPE (*exynos_AllocateTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_FreeTunnelBuffer)(EXYNOS_OMX_BASEPORT *pOMXBasePort, OMX_U32 nPortIndex);
#endif
OMX_ERRORTYPE (*exynos_BufferProcessCreate)(OMX_HANDLETYPE pOMXComponent);
OMX_ERRORTYPE (*exynos_BufferProcessTerminate)(OMX_HANDLETYPE pOMXComponent);
OMX_ERRORTYPE (*exynos_BufferFlush)(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
} EXYNOS_OMX_BASECOMPONENT;
OMX_ERRORTYPE Exynos_OMX_GetParameter(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nParamIndex,
OMX_PTR pParams);
OMX_ERRORTYPE Exynos_OMX_SetParameter(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nParamIndex,
OMX_PTR pParams);
OMX_ERRORTYPE Exynos_OMX_GetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nConfigIndex,
OMX_PTR pConfigs);
OMX_ERRORTYPE Exynos_OMX_SetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nConfigIndex,
OMX_PTR pConfigs);
OMX_ERRORTYPE Exynos_OMX_GetExtensionIndex(
OMX_HANDLETYPE hComponent,
OMX_STRING cParameterName,
OMX_INDEXTYPE *pIndexType);
OMX_PTR Exynos_OMX_MakeDynamicConfig(OMX_INDEXTYPE nConfigIndex, OMX_PTR pConfigs);
OMX_ERRORTYPE Exynos_OMX_SendEventCommand(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, EVENT_COMMAD_TYPE Cmd, OMX_PTR pCmdData);
void Exynos_OMX_Component_AbnormalTermination(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_BaseComponent_Constructor(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_BaseComponent_Destructor(OMX_HANDLETYPE hComponent);
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_Check_SizeVersion(OMX_PTR header, OMX_U32 size);
#ifdef __cplusplus
};
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,242 @@
/*
*
* 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_Baseport.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.5.0
* @history
* 2012.02.20 : Create
* 2017.08.03 : Change event handling
*/
#ifndef EXYNOS_OMX_BASE_PORT
#define EXYNOS_OMX_BASE_PORT
#include "OMX_Component.h"
#include "Exynos_OMX_Def.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_Def.h"
#ifdef PERFORMANCE_DEBUG
#include <sys/time.h>
#endif
#define BUFFER_STATE_ALLOCATED (1 << 0)
#define BUFFER_STATE_ASSIGNED (1 << 1)
#define HEADER_STATE_ALLOCATED (1 << 2)
#define BUFFER_STATE_FREE 0
#define DEFAULT_FRAME_WIDTH 176
#define DEFAULT_FRAME_HEIGHT 144
#define MAX_BUFFER_NUM 40
#define INPUT_PORT_INDEX 0
#define OUTPUT_PORT_INDEX 1
#define ALL_PORT_INDEX -1
#define ALL_PORT_NUM 2
#define INPUT_WAY_INDEX 0
#define OUTPUT_WAY_INDEX 1
#define ALL_WAY_NUM 2
typedef struct _EXYNOS_OMX_BUFFERHEADERTYPE
{
OMX_BUFFERHEADERTYPE *OMXBufferHeader;
OMX_BOOL bBufferInOMX;
OMX_HANDLETYPE ANBHandle;
void *pYUVBuf[MAX_BUFFER_PLANE];
unsigned long buf_fd[MAX_BUFFER_PLANE];
} EXYNOS_OMX_BUFFERHEADERTYPE;
typedef struct _EXYNOS_OMX_DATABUFFER
{
OMX_HANDLETYPE bufferMutex;
OMX_BUFFERHEADERTYPE* bufferHeader;
OMX_BOOL dataValid;
OMX_U32 allocSize;
OMX_U32 dataLen;
OMX_U32 usedDataLen;
OMX_U32 remainDataLen;
OMX_U32 nFlags;
OMX_TICKS timeStamp;
OMX_PTR pPrivate;
} EXYNOS_OMX_DATABUFFER;
typedef void* CODEC_EXTRA_BUFFERINFO;
typedef struct _EXYNOS_OMX_MULTIPLANE_BUFFER
{
OMX_U32 nPlanes;
unsigned long fd[MAX_BUFFER_PLANE];
OMX_PTR addr[MAX_BUFFER_PLANE];
OMX_COLOR_FORMATTYPE eColorFormat;
} EXYNOS_OMX_MULTIPLANE_BUFFER;
typedef struct _EXYNOS_OMX_DATA
{
EXYNOS_OMX_MULTIPLANE_BUFFER buffer;
OMX_U32 allocSize;
OMX_U32 dataLen;
OMX_U32 usedDataLen;
OMX_U32 remainDataLen;
OMX_U32 nFlags;
OMX_TICKS timeStamp;
OMX_PTR pPrivate;
CODEC_EXTRA_BUFFERINFO extInfo;
/* For Share Buffer */
OMX_BUFFERHEADERTYPE *bufferHeader;
} EXYNOS_OMX_DATA;
typedef struct _EXYNOS_OMX_WAY1_PORT_DATABUFFER
{
EXYNOS_OMX_DATABUFFER dataBuffer;
} EXYNOS_OMX_PORT_1WAY_DATABUFFER;
typedef struct _EXYNOS_OMX_WAY2_PORT_DATABUFFER
{
EXYNOS_OMX_DATABUFFER inputDataBuffer;
EXYNOS_OMX_DATABUFFER outputDataBuffer;
} EXYNOS_OMX_PORT_2WAY_DATABUFFER;
typedef enum _EXYNOS_OMX_PORT_WAY_TYPE
{
WAY1_PORT = 0x00,
WAY2_PORT,
} EXYNOS_OMX_PORT_WAY_TYPE;
typedef enum _EXYNOS_OMX_EXCEPTION_STATE
{
GENERAL_STATE = 0x00,
NEED_PORT_FLUSH,
NEED_PORT_DISABLE,
INVALID_STATE,
} EXYNOS_OMX_EXCEPTION_STATE;
typedef enum _EXYNOS_OMX_PLANE
{
ONE_PLANE = 0x01,
TWO_PLANE = 0x02,
THREE_PLANE = 0x03,
/*
ANB_START_PLANE = 0x10,
ANB_ONE_PLANE = 0x11,
ANB_TWO_PLANE = 0x12,
ANB_THREE_PLANE = 0x13,
*/
} EXYNOS_OMX_PLANE;
typedef struct _EXYNOS_OMX_BASEPORT
{
EXYNOS_OMX_BUFFERHEADERTYPE *extendBufferHeader;
OMX_U32 *bufferStateAllocate;
OMX_PARAM_PORTDEFINITIONTYPE portDefinition;
OMX_HANDLETYPE bufferSemID;
EXYNOS_QUEUE bufferQ;
EXYNOS_QUEUE HdrDynamicInfoQ;
OMX_S32 assignedBufferNum;
EXYNOS_OMX_PORT_STATETYPE portState;
OMX_HANDLETYPE semWaitPortEnable[ALL_WAY_NUM];
OMX_MARKTYPE markType;
OMX_BOOL bUseImgCrop[IMG_CROP_PORT_MAX];
OMX_CONFIG_RECTTYPE cropRectangle[IMG_CROP_PORT_MAX];
/* Tunnel Info */
OMX_HANDLETYPE tunneledComponent;
OMX_U32 tunneledPort;
OMX_U32 tunnelBufferNum;
OMX_BUFFERSUPPLIERTYPE bufferSupplier;
OMX_U32 tunnelFlags;
OMX_COLOR_FORMATTYPE *supportFormat;
EXYNOS_METADATA_TYPE eMetaDataType;
OMX_BOOL bNeedContigMem; /* contiguous memory : WFD(HDCP) */
PLANE_TYPE ePlaneType;
EXYNOS_OMX_BUFFERPROCESS_TYPE bufferProcessType;
EXYNOS_OMX_PORT_WAY_TYPE portWayType;
OMX_HANDLETYPE codecSemID;
EXYNOS_QUEUE codecBufferQ;
OMX_HANDLETYPE pauseEvent;
/* Buffer */
union {
EXYNOS_OMX_PORT_1WAY_DATABUFFER port1WayDataBuffer;
EXYNOS_OMX_PORT_2WAY_DATABUFFER port2WayDataBuffer;
} way;
/* Data */
EXYNOS_OMX_DATA processData;
EXYNOS_OMX_VIDEO_HDRSTATICINFO HDRStaticInfo;
EXYNOS_OMX_VIDEO_COLORASPECTS ColorAspects;
OMX_HANDLETYPE hPortMutex;
EXYNOS_OMX_EXCEPTION_STATE exceptionFlag;
OMX_TICKS latestTimeStamp;
/* Protecting S/W Encoder uses SBWC by ConsumerUsage */
OMX_BOOL bForceUseNonCompFormat;
#ifdef PERFORMANCE_DEBUG
/* For performance debug */
OMX_HANDLETYPE hBufferCount;
#endif
} EXYNOS_OMX_BASEPORT;
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader);
OMX_ERRORTYPE Exynos_OMX_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, OMX_BUFFERHEADERTYPE *bufferHeader);
OMX_ERRORTYPE Exynos_OMX_BufferFlushProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
OMX_ERRORTYPE Exynos_OMX_DisablePort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_PortDisableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_EnablePort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_PortEnableProcess(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
OMX_ERRORTYPE Exynos_OMX_FillThisBufferAgain(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE *pBuffer);
OMX_ERRORTYPE Exynos_OMX_Port_Constructor(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_Port_Destructor(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_ResetDataBuffer(EXYNOS_OMX_DATABUFFER *pDataBuffer);
OMX_ERRORTYPE Exynos_ResetCodecData(EXYNOS_OMX_DATA *pData);
int Exynos_GetPlaneFromPort(EXYNOS_OMX_BASEPORT *pPort);
OMX_ERRORTYPE Exynos_SetPlaneToPort(EXYNOS_OMX_BASEPORT *pPort, int nPlaneNum);
OMX_ERRORTYPE Exynos_ResetImgCropInfo(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,584 @@
/*
*
* 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_Resourcemanager.c
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Exynos_OMX_Def.h"
#include "Exynos_OMX_Resourcemanager.h"
#include "Exynos_OMX_Basecomponent.h"
#include "Exynos_OSAL_Memory.h"
#include "Exynos_OSAL_Mutex.h"
#undef EXYNOS_LOG_TAG
#define EXYNOS_LOG_TAG "EXYNOS_RM"
//#define EXYNOS_LOG_OFF
#include "Exynos_OSAL_Log.h"
#define MAX_RESOURCE_VIDEO_DEC RESOURCE_VIDEO_DEC
#define MAX_RESOURCE_VIDEO_ENC RESOURCE_VIDEO_ENC
#define MAX_RESOURCE_AUDIO_DEC RESOURCE_AUDIO_DEC
#define MAX_RESOURCE_VIDEO_SECURE 2
/* Add new resource block */
typedef enum _EXYNOS_OMX_RESOURCE
{
VIDEO_DEC,
VIDEO_ENC,
AUDIO_DEC,
VIDEO_SECURE,
/* Add new resource block */
RESOURCE_MAX
} EXYNOS_OMX_RESOURCE;
typedef struct _EXYNOS_OMX_RM_COMPONENT_LIST
{
OMX_COMPONENTTYPE *pOMXStandComp;
OMX_U32 groupPriority;
struct _EXYNOS_OMX_RM_COMPONENT_LIST *pNext;
} EXYNOS_OMX_RM_COMPONENT_LIST;
/* Max allowable scheduler component instance */
static EXYNOS_OMX_RM_COMPONENT_LIST *gpRMList[RESOURCE_MAX];
static EXYNOS_OMX_RM_COMPONENT_LIST *gpRMWaitList[RESOURCE_MAX];
static OMX_HANDLETYPE ghVideoRMComponentListMutex = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *getRMList(
EXYNOS_OMX_BASECOMPONENT *pExynosComponent,
EXYNOS_OMX_RM_COMPONENT_LIST *pRMList[],
int *pMaxResource)
{
EXYNOS_OMX_RM_COMPONENT_LIST *ret = NULL;
if (pExynosComponent == NULL)
goto EXIT;
switch (pExynosComponent->codecType) {
case HW_VIDEO_DEC_CODEC:
ret = pRMList[VIDEO_DEC];
if (pMaxResource != NULL)
*pMaxResource = MAX_RESOURCE_VIDEO_DEC;
break;
case HW_VIDEO_ENC_CODEC:
ret = pRMList[VIDEO_ENC];
if (pMaxResource != NULL)
*pMaxResource = MAX_RESOURCE_VIDEO_ENC;
break;
case HW_VIDEO_DEC_SECURE_CODEC:
case HW_VIDEO_ENC_SECURE_CODEC:
ret = pRMList[VIDEO_SECURE];
if (pMaxResource != NULL) {
*pMaxResource = MAX_RESOURCE_VIDEO_SECURE;
#ifdef USE_SINGLE_DRM
*pMaxResource = 1;
#endif
}
break;
case HW_AUDIO_DEC_CODEC:
ret = pRMList[AUDIO_DEC];
if (pMaxResource != NULL)
*pMaxResource = MAX_RESOURCE_AUDIO_DEC;
break;
/* Add new resource block */
default:
ret = NULL;
if (pMaxResource != NULL)
*pMaxResource = 0;
break;
}
EXIT:
return ret;
}
OMX_ERRORTYPE setRMList(
EXYNOS_OMX_BASECOMPONENT *pExynosComponent,
EXYNOS_OMX_RM_COMPONENT_LIST *pRMList[],
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentList)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
if (pExynosComponent == NULL) {
ret = OMX_ErrorBadParameter;
goto EXIT;
}
switch (pExynosComponent->codecType) {
case HW_VIDEO_DEC_CODEC:
pRMList[VIDEO_DEC] = pRMComponentList;
break;
case HW_VIDEO_ENC_CODEC:
pRMList[VIDEO_ENC] = pRMComponentList;
break;
case HW_VIDEO_DEC_SECURE_CODEC:
case HW_VIDEO_ENC_SECURE_CODEC:
pRMList[VIDEO_SECURE] = pRMComponentList;
break;
case HW_AUDIO_DEC_CODEC:
pRMList[AUDIO_DEC] = pRMComponentList;
break;
/* Add new resource block */
default:
ret = OMX_ErrorUndefined;
break;
}
EXIT:
return ret;
}
OMX_ERRORTYPE addElementList(
EXYNOS_OMX_RM_COMPONENT_LIST **ppList,
OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_RM_COMPONENT_LIST *pTempComp = NULL;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (*ppList != NULL) {
pTempComp = *ppList;
while (pTempComp->pNext != NULL) {
pTempComp = pTempComp->pNext;
}
pTempComp->pNext = (EXYNOS_OMX_RM_COMPONENT_LIST *)Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_RM_COMPONENT_LIST));
if (pTempComp->pNext == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
((EXYNOS_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->pNext = NULL;
((EXYNOS_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->pOMXStandComp = pOMXComponent;
((EXYNOS_OMX_RM_COMPONENT_LIST *)(pTempComp->pNext))->groupPriority = pExynosComponent->compPriority.nGroupPriority;
goto EXIT;
} else {
*ppList = (EXYNOS_OMX_RM_COMPONENT_LIST *)Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_RM_COMPONENT_LIST));
if (*ppList == NULL) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
pTempComp = *ppList;
pTempComp->pNext = NULL;
pTempComp->pOMXStandComp = pOMXComponent;
pTempComp->groupPriority = pExynosComponent->compPriority.nGroupPriority;
}
EXIT:
return ret;
}
OMX_ERRORTYPE removeElementList(
EXYNOS_OMX_RM_COMPONENT_LIST **ppList,
OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_RM_COMPONENT_LIST *pCurrComp = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pPrevComp = NULL;
OMX_BOOL bDetectComp = OMX_FALSE;
if (*ppList == NULL) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
pCurrComp = *ppList;
while (pCurrComp != NULL) {
if (pCurrComp->pOMXStandComp == pOMXComponent) {
if (*ppList == pCurrComp) {
*ppList = pCurrComp->pNext;
Exynos_OSAL_Free(pCurrComp);
pCurrComp = NULL;
} else {
if (pPrevComp != NULL)
pPrevComp->pNext = pCurrComp->pNext;
Exynos_OSAL_Free(pCurrComp);
pCurrComp = NULL;
}
bDetectComp = OMX_TRUE;
break;
} else {
pPrevComp = pCurrComp;
pCurrComp = pCurrComp->pNext;
}
}
if (bDetectComp == OMX_FALSE)
ret = OMX_ErrorComponentNotFound;
else
ret = OMX_ErrorNone;
EXIT:
return ret;
}
int searchLowPriority(
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentList,
OMX_U32 inComp_priority,
EXYNOS_OMX_RM_COMPONENT_LIST **outLowComp)
{
int ret = 0;
EXYNOS_OMX_RM_COMPONENT_LIST *pTempComp = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pCandidateComp = NULL;
if (pRMComponentList == NULL) {
ret = -1;
goto EXIT;
}
pTempComp = pRMComponentList;
*outLowComp = 0;
while (pTempComp != NULL) {
if (pTempComp->groupPriority > inComp_priority) {
if (pCandidateComp != NULL) {
if (pCandidateComp->groupPriority < pTempComp->groupPriority)
pCandidateComp = pTempComp;
} else {
pCandidateComp = pTempComp;
}
}
pTempComp = pTempComp->pNext;
}
*outLowComp = pCandidateComp;
if (pCandidateComp == NULL)
ret = 0;
else
ret = 1;
EXIT:
return ret;
}
OMX_ERRORTYPE removeComponent(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
if (pExynosComponent->currentState == OMX_StateIdle) {
(*(pExynosComponent->pCallbacks->EventHandler))(pOMXComponent,
pExynosComponent->callbackData,
OMX_EventError,
OMX_ErrorResourcesLost,
0,
NULL);
ret = OMX_SendCommand(pOMXComponent, OMX_CommandStateSet, OMX_StateLoaded, NULL);
if (ret != OMX_ErrorNone) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
} else if ((pExynosComponent->currentState == OMX_StateExecuting) ||
(pExynosComponent->currentState == OMX_StatePause)) {
/* Todo */
}
ret = OMX_ErrorNone;
EXIT:
return ret;
}
OMX_ERRORTYPE Exynos_OMX_ResourceManager_Init()
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
FunctionIn();
ret = Exynos_OSAL_MutexCreate(&ghVideoRMComponentListMutex);
if (ret == OMX_ErrorNone) {
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
Exynos_OSAL_Memset(gpRMList, 0, (sizeof(EXYNOS_OMX_RM_COMPONENT_LIST*) * RESOURCE_MAX));
Exynos_OSAL_Memset(gpRMWaitList, 0, (sizeof(EXYNOS_OMX_RM_COMPONENT_LIST*) * RESOURCE_MAX));
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
}
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_ResourceManager_Deinit()
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_RM_COMPONENT_LIST *pCurrComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pNextComponent = NULL;
int i = 0;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
for (i = 0; i < RESOURCE_MAX; i++) {
if (gpRMList[i]) {
pCurrComponent = gpRMList[i];
while (pCurrComponent != NULL) {
pNextComponent = pCurrComponent->pNext;
Exynos_OSAL_Free(pCurrComponent);
pCurrComponent = pNextComponent;
}
gpRMList[i] = NULL;
}
if (gpRMWaitList[i]) {
pCurrComponent = gpRMWaitList[i];
while (pCurrComponent != NULL) {
pNextComponent = pCurrComponent->pNext;
Exynos_OSAL_Free(pCurrComponent);
pCurrComponent = pNextComponent;
}
gpRMWaitList[i] = NULL;
}
}
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
Exynos_OSAL_MutexTerminate(ghVideoRMComponentListMutex);
ghVideoRMComponentListMutex = NULL;
ret = OMX_ErrorNone;
EXIT:
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_Get_Resource(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentList = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pComponentTemp = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pComponentCandidate = NULL;
int numElem = 0;
int lowCompDetect = 0;
int maxResource = 0;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pRMComponentList = getRMList(pExynosComponent, gpRMList, &maxResource);
#ifndef USE_SECURE_WITH_NONSECURE
if ((pExynosComponent->codecType == HW_VIDEO_DEC_CODEC) ||
(pExynosComponent->codecType == HW_VIDEO_ENC_CODEC)) {
if (gpRMList[VIDEO_SECURE] != NULL) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s][%s] can't use secure with non-secure",
pExynosComponent, __FUNCTION__, pExynosComponent->componentName);
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
} else if ((pExynosComponent->codecType == HW_VIDEO_DEC_SECURE_CODEC) ||
(pExynosComponent->codecType == HW_VIDEO_ENC_SECURE_CODEC)) {
if ((gpRMList[VIDEO_DEC] != NULL) ||
(gpRMList[VIDEO_ENC] != NULL)) {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "[%p][%s][%s] can't use secure with non-secure",
pExynosComponent, __FUNCTION__, pExynosComponent->componentName);
ret = OMX_ErrorInsufficientResources;
goto EXIT;
}
}
#endif
pComponentTemp = pRMComponentList;
if (pComponentTemp != NULL) {
while (pComponentTemp) {
numElem++;
pComponentTemp = pComponentTemp->pNext;
}
} else {
numElem = 0;
}
if (numElem >= maxResource) {
lowCompDetect = searchLowPriority(pRMComponentList,
pExynosComponent->compPriority.nGroupPriority,
&pComponentCandidate);
if (lowCompDetect <= 0) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
} else {
ret = removeComponent(pComponentCandidate->pOMXStandComp);
if (ret != OMX_ErrorNone) {
ret = OMX_ErrorInsufficientResources;
goto EXIT;
} else {
ret = removeElementList(&pRMComponentList, pComponentCandidate->pOMXStandComp);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = addElementList(&pRMComponentList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
}
}
} else {
ret = addElementList(&pRMComponentList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
}
ret = setRMList(pExynosComponent, gpRMList, pRMComponentList);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = OMX_ErrorNone;
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "[%p][%s][%s] has got a resource", pExynosComponent, __FUNCTION__, pExynosComponent->componentName);
EXIT:
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_Release_Resource(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentList = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentWaitList = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pComponentTemp = NULL;
OMX_COMPONENTTYPE *pOMXWaitComponent = NULL;
int numElem = 0;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pRMComponentList = getRMList(pExynosComponent, gpRMList, NULL);
if (pRMComponentList == NULL) {
ret = OMX_ErrorUndefined;
goto EXIT;
}
ret = removeElementList(&pRMComponentList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMList, pRMComponentList);
if (ret != OMX_ErrorNone)
goto EXIT;
pRMComponentWaitList = getRMList(pExynosComponent, gpRMWaitList, NULL);
pComponentTemp = pRMComponentWaitList;
while (pComponentTemp) {
numElem++;
pComponentTemp = pComponentTemp->pNext;
}
if (numElem > 0) {
pOMXWaitComponent = pRMComponentWaitList->pOMXStandComp;
ret = removeElementList(&pRMComponentWaitList, pOMXWaitComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMWaitList, pRMComponentWaitList);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = OMX_SendCommand(pOMXWaitComponent, OMX_CommandStateSet, OMX_StateIdle, NULL);
if (ret != OMX_ErrorNone)
goto EXIT;
}
EXIT:
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_In_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentWaitList = NULL;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pRMComponentWaitList = getRMList(pExynosComponent, gpRMWaitList, NULL);
ret = addElementList(&pRMComponentWaitList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMWaitList, pRMComponentWaitList);
EXIT:
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
FunctionOut();
return ret;
}
OMX_ERRORTYPE Exynos_OMX_Out_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
EXYNOS_OMX_BASECOMPONENT *pExynosComponent = NULL;
EXYNOS_OMX_RM_COMPONENT_LIST *pRMComponentWaitList = NULL;
FunctionIn();
Exynos_OSAL_MutexLock(ghVideoRMComponentListMutex);
pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate;
pRMComponentWaitList = getRMList(pExynosComponent, gpRMWaitList, NULL);
ret = removeElementList(&pRMComponentWaitList, pOMXComponent);
if (ret != OMX_ErrorNone)
goto EXIT;
ret = setRMList(pExynosComponent, gpRMWaitList, pRMComponentWaitList);
EXIT:
Exynos_OSAL_MutexUnlock(ghVideoRMComponentListMutex);
FunctionOut();
return ret;
}

View File

@@ -0,0 +1,50 @@
/*
*
* 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_Resourcemanager.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_RESOURCEMANAGER
#define EXYNOS_OMX_RESOURCEMANAGER
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#ifdef __cplusplus
extern "C" {
#endif
OMX_ERRORTYPE Exynos_OMX_ResourceManager_Init();
OMX_ERRORTYPE Exynos_OMX_ResourceManager_Deinit();
OMX_ERRORTYPE Exynos_OMX_Get_Resource(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE Exynos_OMX_Release_Resource(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE Exynos_OMX_In_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE Exynos_OMX_Out_WaitForResource(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,61 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
Exynos_OMX_VdecControl.c \
Exynos_OMX_Vdec.c
LOCAL_MODULE := libExynosOMX_Vdec
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/include \
LOCAL_STATIC_LIBRARIES := libExynosVideoApi libVendorVideoApi libExynosOMX_OSAL
LOCAL_SHARED_LIBRARIES := liblog
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(EXYNOS_OMX_SUPPORT_TUNNELING), true)
LOCAL_CFLAGS += -DTUNNELING_SUPPORT
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_STATIC_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,226 @@
/*
*
* 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_Vdec.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* HyeYeon Chung (hyeon.chung@samsung.com)
* Yunji Kim (yunji.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_VIDEO_DECODE
#define EXYNOS_OMX_VIDEO_DECODE
#include "OMX_Component.h"
#include "Exynos_OMX_Def.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_Baseport.h"
#include "Exynos_OMX_Basecomponent.h"
#include "VendorVideoAPI.h"
#include "ExynosVideoApi.h"
#define MAX_VIDEO_INPUTBUFFER_NUM 5
#define MIN_VIDEO_INPUTBUFFER_NUM 2
#define MAX_VIDEO_OUTPUTBUFFER_NUM 4
#define MAX_FRAME_WIDTH 1920
#define MAX_FRAME_HEIGHT 1080
#define DEFAULT_VIDEO_INPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT) * 2
#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2
#define MFC_INPUT_BUFFER_NUM_MAX 3
/* min size of input buffer for DRC */
#define DEFAULT_VIDEO_MIN_INPUT_BUFFER_SIZE (1024 * 1024 * 3 / 2) /* 1.5MB */
/* input buffer size for custom component */
#define CUSTOM_DEFAULT_VIDEO_INPUT_BUFFER_SIZE (1024 * 1024 * 7) /* 7MB */
#define CUSTOM_OVER_4K_VIDEO_INPUT_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
#define CUSTOM_LIMITED_DRM_INPUT_BUFFER_SIZE (1024 * 1024 * 5 / 2) /* 2.5MB : For projects which has small vstream heap */
#define MFC_OUTPUT_BUFFER_NUM_MAX 16 * 2
#define DEFAULT_MFC_OUTPUT_YBUFFER_SIZE MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT
#define DEFAULT_MFC_OUTPUT_CBUFFER_SIZE MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 2
#define INPUT_PORT_SUPPORTFORMAT_NUM_MAX 1
#define OUTPUT_PORT_SUPPORTFORMAT_DEFAULT_NUM 3 /* I420P, NV12, RGBA */
#define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX (OUTPUT_PORT_SUPPORTFORMAT_DEFAULT_NUM + 4) /* NV12T, YV12, NV21, UNUSED */
#define EXTRA_DPB_NUM 5
#define MFC_DEFAULT_INPUT_BUFFER_PLANE 1
#define MFC_DEFAULT_OUTPUT_BUFFER_PLANE 2
#define MAX_INPUTBUFFER_NUM_DYNAMIC 0 /* Dynamic number of metadata buffer */
#define MAX_OUTPUTBUFFER_NUM_DYNAMIC 0 /* Dynamic number of metadata buffer */
#define MAX_SECURE_INPUT_BUFFER_SIZE ((3 * 1024 * 1024) / 2) /* 1.5MB */
#define DEC_BLOCKS_PER_SECOND 979200 /* remove it and have to read a capability at media_codecs.xml */
typedef struct
{
void *pAddrY;
void *pAddrC;
} CODEC_DEC_ADDR_INFO;
typedef struct _BYPASS_BUFFER_INFO
{
OMX_U32 nFlags;
OMX_TICKS timeStamp;
} BYPASS_BUFFER_INFO;
typedef struct _CODEC_DEC_BUFFER
{
void *pVirAddr[MAX_BUFFER_PLANE]; /* virtual address */
unsigned int bufferSize[MAX_BUFFER_PLANE]; /* buffer alloc size */
unsigned long fd[MAX_BUFFER_PLANE]; /* buffer FD */
int dataSize; /* total data length */
} CODEC_DEC_BUFFER;
typedef struct _DECODE_CODEC_EXTRA_BUFFERINFO
{
OMX_U32 imageWidth; /* original info of contents */
OMX_U32 imageHeight; /* original info of contents */
OMX_U32 imageStride; /* the size applibed H/W alignment. it is including padding data */
OMX_CONFIG_RECTTYPE cropRect; /* original info of contents */
OMX_COLOR_FORMATTYPE colorFormat;
PrivateDataShareBuffer PDSB;
ExynosHdrDynamicInfo HDRDynamic;
} DECODE_CODEC_EXTRA_BUFFERINFO;
typedef struct _EXYNOS_OMX_CURRENT_FRAME_TIMESTAMP
{
OMX_S32 nIndex;
OMX_TICKS timeStamp;
OMX_U32 nFlags;
} EXYNOS_OMX_CURRENT_FRAME_TIMESTAMP;
typedef enum _EXYNOS_OMX_DATA_TYPE {
DATA_TYPE_8BIT = 0x00,
DATA_TYPE_10BIT = 0x01,
DATA_TYPE_8BIT_WITH_2BIT = 0x11,
DATA_TYPE_8BIT_SBWC = 0x100,
DATA_TYPE_10BIT_SBWC = 0x101,
} EXYNOS_OMX_DATA_TYPE;
typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT
{
OMX_HANDLETYPE hCodecHandle;
OMX_BOOL bDiscardCSDError; /* if it is true, discard a error event in CorruptedHeader case */
OMX_BOOL bForceHeaderParsing;
OMX_BOOL bThumbnailMode;
OMX_BOOL bDTSMode; /* true:Decoding Time Stamp, false:Presentation Time Stamp */
OMX_BOOL bReorderMode; /* true:use Time Stamp reordering, don't care about a mode like as PTS or DTS */
EXYNOS_OMX_DATA_TYPE eDataType;
OMX_BOOL bQosChanged;
OMX_U32 nQosRatio;
OMX_U32 nOperatingRate;
OMX_U32 nPriority;
OMX_BOOL bSearchBlackBarChanged; /* true: Notify BlackBar searching option(en/disable) was changed */
OMX_BOOL bSearchBlackBar; /* true: BlackBar searching enable, false: disable */
OMX_CONFIG_RECTTYPE blackBarCropRect;
OMX_U32 nMinInBufSize; /* required min size of input buffer for DRC */
CODEC_DEC_BUFFER *pMFCDecInputBuffer[MFC_INPUT_BUFFER_NUM_MAX];
CODEC_DEC_BUFFER *pMFCDecOutputBuffer[MFC_OUTPUT_BUFFER_NUM_MAX];
/* Buffer Process */
OMX_BOOL bExitBufferProcessThread;
OMX_HANDLETYPE hSrcInputThread;
OMX_HANDLETYPE hSrcOutputThread;
OMX_HANDLETYPE hDstInputThread;
OMX_HANDLETYPE hDstOutputThread;
/* Shared Memory Handle */
OMX_HANDLETYPE hSharedMemory;
/* For Reconfiguration DPB */
OMX_BOOL bReconfigDPB;
/* For DPB Reference Handling (by OMX or MFC Driver) */
OMX_BOOL bDrvDPBManaging;
/* For SBWC Decoding */
OMX_COLOR_FORMATTYPE nCompColorFormat;
/* Protecting S/W Encoder uses SBWC by ConsumerUsage */
OMX_BOOL bForceUseNonCompFormat;
/* For Ref Cnt handling about graphic buffer */
OMX_HANDLETYPE hRefHandle;
/* CSC handle */
OMX_PTR csc_handle;
OMX_U32 csc_set_format;
/* For Image conversion when it is available */
OMX_HANDLETYPE hImgConv;
OMX_U32 nImageConvMode;
/* Performance handle */
OMX_HANDLETYPE pPerfHandle;
OMX_ERRORTYPE (*exynos_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData);
OMX_ERRORTYPE (*exynos_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pInputData);
OMX_ERRORTYPE (*exynos_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData);
OMX_ERRORTYPE (*exynos_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pOutputData);
OMX_ERRORTYPE (*exynos_codec_start)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_codec_stop)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_codec_bufferProcessRun)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_codec_enqueueAllBuffer)(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]);
OMX_ERRORTYPE (*exynos_codec_reconfigAllBuffers) (OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_BOOL (*exynos_codec_checkFormatSupport)(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_COLOR_FORMATTYPE eColorFormat);
OMX_ERRORTYPE (*exynos_codec_checkResolutionChange)(OMX_COMPONENTTYPE *pOMXComponent);
OMX_ERRORTYPE (*exynos_codec_updateExtraInfo)(OMX_COMPONENTTYPE *pOMXComponent, ExynosVideoMeta *pMeta);
} EXYNOS_OMX_VIDEODEC_COMPONENT;
#ifdef __cplusplus
extern "C" {
#endif
void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent);
void Exynos_Output_SetSupportFormat(EXYNOS_OMX_BASECOMPONENT *pExynosComponent);
void Exynos_SetReorderTimestamp(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 *nIndex, OMX_TICKS timeStamp, OMX_U32 nFlags);
void Exynos_GetReorderTimestamp(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, EXYNOS_OMX_CURRENT_FRAME_TIMESTAMP *sCurrentTimestamp, OMX_S32 nFrameIndex, OMX_S32 eFrameType);
OMX_BOOL Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE Exynos_CodecBufferToData(CODEC_DEC_BUFFER *codecBuffer, EXYNOS_OMX_DATA *pData, OMX_U32 nPortIndex);
OMX_BOOL Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *srcInputData);
OMX_ERRORTYPE Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent);
OMX_ERRORTYPE Exynos_Allocate_CodecBuffers(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex, int nBufferCnt, unsigned int nAllocSize[MAX_BUFFER_PLANE]);
void Exynos_Free_CodecBuffers(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex);
OMX_ERRORTYPE Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
/*
*
* 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_VdecControl.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.5.0
* @history
* 2012.02.20 : Create
* 2017.08.03 : Change event handling
*/
#ifndef EXYNOS_OMX_VIDEO_DECODECONTROL
#define EXYNOS_OMX_VIDEO_DECODECONTROL
#include "OMX_Component.h"
#include "Exynos_OMX_Def.h"
#include "Exynos_OSAL_Queue.h"
#include "Exynos_OMX_Baseport.h"
#include "Exynos_OMX_Basecomponent.h"
#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);
#ifdef TUNNELING_SUPPORT
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);
#endif
OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nParamIndex,
OMX_INOUT OMX_PTR ComponentParameterStructure);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetParameter(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_INDEXTYPE nIndex,
OMX_IN OMX_PTR ComponentParameterStructure);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeSetConfig(
OMX_HANDLETYPE hComponent,
OMX_INDEXTYPE nIndex,
OMX_PTR pComponentConfigStructure);
OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetExtensionIndex(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_STRING cParameterName,
OMX_OUT OMX_INDEXTYPE *pIndexType);
OMX_ERRORTYPE Exynos_InputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer);
OMX_ERRORTYPE Exynos_OutputBufferReturn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATABUFFER *pDataBuffer);
OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 nPortIndex, OMX_BOOL bEvent);
OMX_BUFFERHEADERTYPE *Exynos_OutputBufferGetQueue_Direct(EXYNOS_OMX_BASECOMPONENT *pExynosComponent);
OMX_ERRORTYPE Exynos_InputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent);
OMX_ERRORTYPE Exynos_OutputBufferGetQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent);
OMX_ERRORTYPE Exynos_CodecBufferEnQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 PortIndex, OMX_PTR data);
OMX_ERRORTYPE Exynos_CodecBufferDeQueue(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 PortIndex, OMX_PTR *data);
OMX_ERRORTYPE Exynos_CodecBufferReset(EXYNOS_OMX_BASECOMPONENT *pExynosComponent, OMX_U32 PortIndex);
OMX_ERRORTYPE Exynos_Shared_BufferToData(EXYNOS_OMX_BASEPORT *pExynosPort, EXYNOS_OMX_DATABUFFER *pUseBuffer, EXYNOS_OMX_DATA *pData);
OMX_ERRORTYPE Exynos_Shared_DataToBuffer(EXYNOS_OMX_BASEPORT *pExynosPort, EXYNOS_OMX_DATABUFFER *pUseBuffer, EXYNOS_OMX_DATA *pData);
#ifdef __cplusplus
}
#endif
#endif

View 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

View File

@@ -0,0 +1,97 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_H264dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.AVC.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_S3D_SUPPORT
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/include \
ifeq ($(BOARD_USE_SKYPE_HD), true)
LOCAL_CFLAGS += -DUSE_SKYPE_HD
LOCAL_CFLAGS += -DBUILD_DEC
LOCAL_STATIC_LIBRARIES += libExynosOMX_SkypeHD_Dec
endif
ifeq ($(BOARD_USE_KHRONOS_OMX_HEADER), true)
LOCAL_CFLAGS += -DUSE_KHRONOS_OMX_HEADER
LOCAL_C_INCLUDES += $(EXYNOS_OMX_INC)/khronos
else
ifeq ($(BOARD_USE_ANDROID), true)
LOCAL_HEADER_LIBRARIES := media_plugin_headers
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,105 @@
/*
*
* 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_H264dec.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_H264_DEC_COMPONENT
#define EXYNOS_OMX_H264_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
#include "library_register.h"
typedef struct _EXYNOS_MFC_H264DEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
/* for custom component(MSRND) */
#define MAX_H264_DISPLAYDELAY_VALIDNUM 8
OMX_U32 nDisplayDelay;
/* skype */
OMX_BOOL bLowLatency;
/* extra info which will be shared with renderer */
int interlacedType;
ExynosVideoHdrInfo sHdrInfo;
OMX_U32 nActualFormat;
#ifdef USE_S3D_SUPPORT
EXYNOS_OMX_FPARGMT_TYPE S3DFPArgmtType;
#endif
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 5
OMX_VIDEO_AVCPROFILETYPE profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_VIDEO_AVCLEVELTYPE maxLevel;
} EXYNOS_MFC_H264DEC_HANDLE;
typedef struct _EXYNOS_H264DEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_AVCTYPE AVCComponent[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_H264DEC_HANDLE hMFCH264Handle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_H264DEC_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);
OMX_ERRORTYPE H264CodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,59 @@
/*
*
* 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 SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : 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"
#include "Exynos_OSAL_Log.h"
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **exynosComponents)
{
FunctionIn();
if (exynosComponents == NULL)
goto EXIT;
/* component 1 - video decoder H.264 */
Exynos_OSAL_Strcpy(exynosComponents[0]->componentName, EXYNOS_OMX_COMPONENT_H264_DEC);
Exynos_OSAL_Strcpy(exynosComponents[0]->roles[0], EXYNOS_OMX_COMPONENT_H264_DEC_ROLE);
exynosComponents[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 2 - video decoder H.264 for DRM */
Exynos_OSAL_Strcpy(exynosComponents[1]->componentName, EXYNOS_OMX_COMPONENT_H264_DRM_DEC);
Exynos_OSAL_Strcpy(exynosComponents[1]->roles[0], EXYNOS_OMX_COMPONENT_H264_DEC_ROLE);
exynosComponents[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,62 @@
/*
*
* 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 SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_H264_REG
#define EXYNOS_OMX_H264_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 2
#define MAX_COMPONENT_ROLE_NUM 1
/* H.264 */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_H264_DEC "OMX.Exynos.AVC.Decoder"
#define EXYNOS_OMX_COMPONENT_H264_DRM_DEC "OMX.Exynos.AVC.Decoder.secure"
#else
#define EXYNOS_OMX_COMPONENT_H264_DEC "OMX.Exynos.avc.dec"
#define EXYNOS_OMX_COMPONENT_H264_DRM_DEC "OMX.Exynos.avc.dec.secure"
#endif
#define EXYNOS_OMX_COMPONENT_H264_DEC_ROLE "video_decoder.avc"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **exynosComponents);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,96 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_HEVCdec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.HEVC.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_CFLAGS += -DUSE_HEVC_SUPPORT
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_S3D_SUPPORT
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifeq ($(BOARD_USE_FULL_ST2094_40), true)
LOCAL_CFLAGS += -DUSE_FULL_ST2094_40
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
/*
*
* Copyright 2013 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_HEVCdec.h
* @brief
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.0.0
* @history
* 2013.07.26 : Create
*/
#ifndef EXYNOS_OMX_HEVC_DEC_COMPONENT
#define EXYNOS_OMX_HEVC_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
typedef struct _EXYNOS_MFC_HEVCDEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
/* for custom component(MSRND) */
#define MAX_HEVC_DISPLAYDELAY_VALIDNUM 8
OMX_U32 nDisplayDelay;
/* extra info which will be shared with renderer */
ExynosVideoHdrInfo sHdrInfo;
OMX_U32 nActualFormat;
#ifdef USE_S3D_SUPPORT
EXYNOS_OMX_FPARGMT_TYPE S3DFPArgmtType;
#endif
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 4
OMX_VIDEO_HEVCPROFILETYPE profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_VIDEO_HEVCLEVELTYPE maxLevel;
} EXYNOS_MFC_HEVCDEC_HANDLE;
typedef struct _EXYNOS_HEVCDEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_HEVCTYPE HevcComponent[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_HEVCDEC_HANDLE hMFCHevcHandle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_HEVCDEC_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);
OMX_ERRORTYPE HevcCodecDstSetup(OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,65 @@
/*
*
* Copyright 2013 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 SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.0.0
* @history
* 2013.07.26 : 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_HEVC_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 - video decoder HEVC */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_HEVC_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_HEVC_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 2 - video decoder HEVC for DRM */
Exynos_OSAL_Strcpy(ppExynosComponent[1]->componentName, EXYNOS_OMX_COMPONENT_HEVC_DRM_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[1]->roles[0], EXYNOS_OMX_COMPONENT_HEVC_DEC_ROLE);
ppExynosComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,62 @@
/*
*
* Copyright 2013 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 SeungBeom Kim (sbcrux.kim@samsung.com)
* Taehwan Kim (t_h.kim@samsung.com)
* @version 2.0.0
* @history
* 2013.07.26 : Create
*/
#ifndef EXYNOS_OMX_HEVC_DEC_REG
#define EXYNOS_OMX_HEVC_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 2
#define MAX_COMPONENT_ROLE_NUM 1
/* HEVC */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_HEVC_DEC "OMX.Exynos.HEVC.Decoder"
#define EXYNOS_OMX_COMPONENT_HEVC_DRM_DEC "OMX.Exynos.HEVC.Decoder.secure"
#else
#define EXYNOS_OMX_COMPONENT_HEVC_DEC "OMX.Exynos.hevc.dec"
#define EXYNOS_OMX_COMPONENT_HEVC_DRM_DEC "OMX.Exynos.hevc.dec.secure"
#endif
#define EXYNOS_OMX_COMPONENT_HEVC_DEC_ROLE "video_decoder.hevc"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,87 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Mpeg2dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.MPEG2.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
/*
*
* 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_Mpeg2dec.h
* @brief
* @author Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : Create
*/
#ifndef EXYNOS_OMX_MPEG2_DEC_COMPONENT
#define EXYNOS_OMX_MPEG2_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
typedef struct _EXYNOS_MFC_MPEG2DEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
/* extra info which will be shared with renderer */
int interlacedType;
ExynosVideoHdrInfo sHdrInfo;
OMX_U32 nActualFormat;
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 2
OMX_VIDEO_MPEG2PROFILETYPE profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_VIDEO_MPEG2LEVELTYPE maxLevel;
} EXYNOS_MFC_MPEG2DEC_HANDLE;
typedef struct _EXYNOS_MPEG2DEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_MPEG2TYPE Mpeg2Component[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_MPEG2DEC_HANDLE hMFCMpeg2Handle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_MPEG2DEC_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);
OMX_ERRORTYPE Mpeg2CodecDstSetup(
OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,59 @@
/*
*
* 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 Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : 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_MPEG2_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 - video decoder MPEG2 */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_MPEG2_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_MPEG2_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,59 @@
/*
*
* 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 Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : Create
*/
#ifndef EXYNOS_OMX_MPEG2_DEC_REG
#define EXYNOS_OMX_MPEG2_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
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_MPEG2_DEC "OMX.Exynos.MPEG2.Decoder"
#else
#define EXYNOS_OMX_COMPONENT_MPEG2_DEC "OMX.Exynos.mpeg2.dec"
#endif
#define EXYNOS_OMX_COMPONENT_MPEG2_DEC_ROLE "video_decoder.mpeg2"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(
ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,87 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Mpeg4dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.MPEG4.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,123 @@
/*
*
* 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_Mpeg4dec.h
* @brief
* @author Yunji Kim (yunji.kim@samsung.com)
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_MPEG4_DEC_COMPONENT
#define EXYNOS_OMX_MPEG4_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
typedef enum _CODEC_TYPE
{
CODEC_TYPE_H263,
CODEC_TYPE_MPEG4
} CODEC_TYPE;
/*
* This structure is the same as BitmapInfoHhr struct in pv_avifile_typedefs.h file
*/
typedef struct _BitmapInfoHhr
{
OMX_U32 BiSize;
OMX_U32 BiWidth;
OMX_U32 BiHeight;
OMX_U16 BiPlanes;
OMX_U16 BiBitCount;
OMX_U32 BiCompression;
OMX_U32 BiSizeImage;
OMX_U32 BiXPelsPerMeter;
OMX_U32 BiYPelsPerMeter;
OMX_U32 BiClrUsed;
OMX_U32 BiClrImportant;
} BitmapInfoHhr;
typedef struct _EXYNOS_MFC_MPEG4DEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
CODEC_TYPE codecType;
/* extra info which will be shared with renderer */
int interlacedType;
OMX_U32 nActualFormat;
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 4
OMX_S32 profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_S32 maxLevel;
} EXYNOS_MFC_MPEG4DEC_HANDLE;
typedef struct _EXYNOS_MPEG4DEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_H263TYPE h263Component[ALL_PORT_NUM];
OMX_VIDEO_PARAM_MPEG4TYPE mpeg4Component[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_MPEG4DEC_HANDLE hMFCMpeg4Handle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_MPEG4DEC_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);
OMX_ERRORTYPE Mpeg4CodecDstSetup(
OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,69 @@
/*
*
* 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 2.0.0
* @history
* 2012.02.20 : 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_MPEG4_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 - video decoder MPEG4 */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_MPEG4_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_MPEG4_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 2 - video decoder MPEG4 for DRM*/
Exynos_OSAL_Strcpy(ppExynosComponent[1]->componentName, EXYNOS_OMX_COMPONENT_MPEG4_DRM_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[1]->roles[0], EXYNOS_OMX_COMPONENT_MPEG4_DEC_ROLE);
ppExynosComponent[1]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
/* component 3 - video decoder H.263 */
Exynos_OSAL_Strcpy(ppExynosComponent[2]->componentName, EXYNOS_OMX_COMPONENT_H263_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[2]->roles[0], EXYNOS_OMX_COMPONENT_H263_DEC_ROLE);
ppExynosComponent[2]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,72 @@
/*
*
* 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 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_MPEG4_DEC_REG
#define EXYNOS_OMX_MPEG4_DEC_REG
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "Exynos_OMX_Component_Register.h"
#define OSCL_EXPORT_REF __attribute__((visibility("default")))
#define MAX_COMPONENT_NUM 3
#define MAX_COMPONENT_ROLE_NUM 1
/* MPEG4 */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_MPEG4_DEC "OMX.Exynos.MPEG4.Decoder"
#define EXYNOS_OMX_COMPONENT_MPEG4_DRM_DEC "OMX.Exynos.MPEG4.Decoder.secure"
#else
#define EXYNOS_OMX_COMPONENT_MPEG4_DEC "OMX.Exynos.mpeg4.dec"
#define EXYNOS_OMX_COMPONENT_MPEG4_DRM_DEC "OMX.Exynos.mpeg4.dec.secure"
#endif
#define EXYNOS_OMX_COMPONENT_MPEG4_DEC_ROLE "video_decoder.mpeg4"
/* H.263 */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_H263_DEC "OMX.Exynos.H263.Decoder"
#else
#define EXYNOS_OMX_COMPONENT_H263_DEC "OMX.Exynos.h263.dec"
#endif
#define EXYNOS_OMX_COMPONENT_H263_DEC_ROLE "video_decoder.h263"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(
ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,87 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Wmvdec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.WMV.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
/*
*
* 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_Wmvdec.h
* @brief
* @author HyeYeon Chung (hyeon.chung@samsung.com)
* @author Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : Create
*/
#ifndef EXYNOS_OMX_WMV_DEC_COMPONENT
#define EXYNOS_OMX_WMV_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
#define BITMAPINFOHEADER_SIZE 40
#define BITMAPINFOHEADER_ASFBINDING_SIZE 41
#define COMPRESSION_POS 16
typedef enum WMV_FORMAT {
WMV_FORMAT_VC1,
WMV_FORMAT_WMV3,
WMV_FORMAT_UNKNOWN
} WMV_FORMAT;
typedef struct _EXYNOS_MFC_WMVDEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
WMV_FORMAT wmvFormat;
/* extra info which will be shared with renderer */
int interlacedType;
OMX_U32 nActualFormat;
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 3
OMX_VIDEO_VC1PROFILETYPE profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_VIDEO_VC1LEVELTYPE maxLevel[MAX_PROFILE_NUM];
} EXYNOS_MFC_WMVDEC_HANDLE;
typedef struct _EXYNOS_WMVDEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_WMVTYPE WmvComponent[ALL_PORT_NUM];
OMX_VIDEO_PARAM_VC1TYPE Vc1Component[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_WMVDEC_HANDLE hMFCWmvHandle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_WMVDEC_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);
OMX_ERRORTYPE WmvCodecDstSetup(
OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,59 @@
/*
*
* 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 HyeYeon Chung (hyeon.chung@samsung.com)
* @author Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : 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_WMV_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 - video decoder WMV */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_WMV_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_WMV_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,59 @@
/*
*
* 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 HyeYeon Chung (hyeon.chung@samsung.com)
* @author Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.07.10 : Create
*/
#ifndef EXYNOS_OMX_WMV_DEC_REG
#define EXYNOS_OMX_WMV_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
/* WMV */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_WMV_DEC "OMX.Exynos.WMV.Decoder"
#else
#define EXYNOS_OMX_COMPONENT_WMV_DEC "OMX.Exynos.vc1.dec"
#endif
#define EXYNOS_OMX_COMPONENT_WMV_DEC_ROLE "video_decoder.vc1"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(
ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,88 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Vp8dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.VP8.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_CFLAGS += -DUSE_VP8_SUPPORT
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager\
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,96 @@
/*
*
* 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_Vp8dec.h
* @brief
* @author Satish Kumar Reddy (palli.satish@samsung.com)
* @author SeungBeom Kim (sbcrux.kim@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_VP8_DEC_COMPONENT
#define EXYNOS_OMX_VP8_DEC_COMPONENT
#include "Exynos_OMX_Def.h"
#include "OMX_Component.h"
#include "OMX_Video.h"
#include "ExynosVideoApi.h"
typedef struct _EXYNOS_MFC_VP8DEC_HANDLE
{
OMX_HANDLETYPE hMFCHandle;
OMX_U32 indexTimestamp;
OMX_U32 outputIndexTimestamp;
OMX_BOOL bConfiguredMFCSrc;
OMX_BOOL bConfiguredMFCDst;
OMX_S32 maxDPBNum;
/* extra info which will be shared with renderer */
OMX_U32 nActualFormat;
ExynosVideoColorFormatType MFCOutputColorType;
ExynosVideoDecOps *pDecOps;
ExynosVideoDecBufferOps *pInbufOps;
ExynosVideoDecBufferOps *pOutbufOps;
ExynosVideoGeometry codecOutbufConf;
ExynosVideoInstInfo videoInstInfo;
#define MAX_PROFILE_NUM 1
OMX_VIDEO_VP8PROFILETYPE profiles[MAX_PROFILE_NUM];
OMX_S32 nProfileCnt;
OMX_VIDEO_VP8LEVELTYPE maxLevel;
} EXYNOS_MFC_VP8DEC_HANDLE;
typedef struct _EXYNOS_VP8DEC_HANDLE
{
/* OMX Codec specific */
OMX_VIDEO_PARAM_VP8TYPE VP8Component[ALL_PORT_NUM];
OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE errorCorrectionType[ALL_PORT_NUM];
/* EXYNOS MFC Codec specific */
EXYNOS_MFC_VP8DEC_HANDLE hMFCVp8Handle;
OMX_BOOL bSourceStart;
OMX_BOOL bDestinationStart;
OMX_HANDLETYPE hSourceStartEvent;
OMX_HANDLETYPE hDestinationInStartEvent;
OMX_HANDLETYPE hDestinationOutStartEvent;
EXYNOS_QUEUE bypassBufferInfoQ;
} EXYNOS_VP8DEC_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);
OMX_ERRORTYPE VP8CodecDstSetup(
OMX_COMPONENTTYPE *pOMXComponent);
#ifdef __cplusplus
};
#endif
#endif

View 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

View File

@@ -0,0 +1,59 @@
/*
*
* 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 Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : 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_VP8_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 - video decoder VP8 */
Exynos_OSAL_Strcpy(ppExynosComponent[0]->componentName, EXYNOS_OMX_COMPONENT_VP8_DEC);
Exynos_OSAL_Strcpy(ppExynosComponent[0]->roles[0], EXYNOS_OMX_COMPONENT_VP8_DEC_ROLE);
ppExynosComponent[0]->totalRoleNum = MAX_COMPONENT_ROLE_NUM;
EXIT:
FunctionOut();
return MAX_COMPONENT_NUM;
}

View File

@@ -0,0 +1,60 @@
/*
*
* 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 Satish Kumar Reddy (palli.satish@samsung.com)
* @version 2.0.0
* @history
* 2012.02.20 : Create
*/
#ifndef EXYNOS_OMX_VP8_DEC_REG
#define EXYNOS_OMX_VP8_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
/* VP8 */
#ifndef USE_CUSTOM_COMPONENT_SUPPORT
#define EXYNOS_OMX_COMPONENT_VP8_DEC "OMX.Exynos.VP8.Decoder"
#else
#define EXYNOS_OMX_COMPONENT_VP8_DEC "OMX.Exynos.vp8.dec"
#endif
#define EXYNOS_OMX_COMPONENT_VP8_DEC_ROLE "video_decoder.vp8"
#ifdef __cplusplus
extern "C" {
#endif
OSCL_EXPORT_REF int Exynos_OMX_COMPONENT_Library_Register(
ExynosRegisterComponentType **ppExynosComponent);
#ifdef __cplusplus
};
#endif
#endif

View File

@@ -0,0 +1,88 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
Exynos_OMX_Vp9dec.c \
library_register.c
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE := libOMX.Exynos.VP9.Decoder
LOCAL_MODULE_RELATIVE_PATH := omx
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CFLAGS :=
LOCAL_CFLAGS += -DUSE_VP9_SUPPORT
ifeq ($(BOARD_USE_DMA_BUF), true)
LOCAL_CFLAGS += -DUSE_DMA_BUF
endif
ifeq ($(BOARD_USE_CSC_HW), true)
LOCAL_CFLAGS += -DUSE_CSC_HW
endif
ifeq ($(BOARD_USE_CUSTOM_COMPONENT_SUPPORT), true)
LOCAL_CFLAGS += -DUSE_CUSTOM_COMPONENT_SUPPORT
endif
ifeq ($(BOARD_USE_SINGLE_PLANE_IN_DRM), true)
LOCAL_CFLAGS += -DUSE_SINGLE_PLANE_IN_DRM
endif
ifdef BOARD_EXYNOS_S10B_FORMAT_ALIGN
LOCAL_CFLAGS += -DS10B_FORMAT_8B_ALIGNMENT=$(BOARD_EXYNOS_S10B_FORMAT_ALIGN)
endif
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES := libExynosOMX_Vdec libVendorVideoApi libExynosOMX_OSAL libExynosOMX_Basecomponent \
libExynosVideoApi
LOCAL_SHARED_LIBRARIES := \
libc \
libcutils \
libutils \
libdl \
liblog \
libhardware \
libhidlbase \
libui \
libexynosgraphicbuffer \
libstagefright_foundation \
libexynosv4l2 \
libion_exynos \
libcsc \
libExynosOMX_Resourcemanager \
libepicoperator
LOCAL_C_INCLUDES := \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
$(EXYNOS_OMX_TOP)/core \
$(EXYNOS_OMX_COMPONENT)/common \
$(EXYNOS_OMX_COMPONENT)/video/dec \
$(EXYNOS_VIDEO_CODEC)/include \
$(TOP)/hardware/samsung_slsi/exynos/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
LOCAL_CFLAGS += -DUSE_ANDROID
endif
endif
ifeq ($(BOARD_USE_SMALL_SECURE_MEMORY), true)
LOCAL_CFLAGS += -DUSE_SMALL_SECURE_MEMORY
endif
ifeq ($(BOARD_USE_COMPRESSED_COLOR), true)
LOCAL_CFLAGS += -DUSE_COMPRESSED_COLOR
endif
LOCAL_CFLAGS += -Wno-unused-variable -Wno-unused-label
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More