summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShalaj Jain <shalajj@codeaurora.org>2012-06-22 19:03:55 -0700
committerShashank Mittal <mittals@codeaurora.org>2012-07-09 22:44:30 -0700
commit75d02350937dd06049770219c5acffee8948996e (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904
parent3d528deb37f16eab7d699ec8e7f60d34141a6316 (diff)
downloadmedia-75d02350937dd06049770219c5acffee8948996e.tar.gz
hardware/qcom/media: Drop obsolete code
Change-Id: I9bb09477f34dbd4329c7ce4e7b21940070e5daf7
-rw-r--r--CleanSpec.mk49
-rw-r--r--libstagefrighthw/Android.mk42
-rw-r--r--libstagefrighthw/MODULE_LICENSE_APACHE20
-rw-r--r--libstagefrighthw/NOTICE189
-rw-r--r--libstagefrighthw/QComOMXPlugin.cpp179
-rw-r--r--libstagefrighthw/QComOMXPlugin.h76
-rw-r--r--mm-core/Android.mk38
-rw-r--r--mm-core/omxcore/Android.mk96
-rw-r--r--mm-core/omxcore/inc/OMX_Audio.h1311
-rw-r--r--mm-core/omxcore/inc/OMX_Component.h579
-rw-r--r--mm-core/omxcore/inc/OMX_ContentPipe.h195
-rw-r--r--mm-core/omxcore/inc/OMX_Core.h1431
-rw-r--r--mm-core/omxcore/inc/OMX_IVCommon.h920
-rw-r--r--mm-core/omxcore/inc/OMX_Image.h328
-rw-r--r--mm-core/omxcore/inc/OMX_Index.h258
-rw-r--r--mm-core/omxcore/inc/OMX_Other.h337
-rw-r--r--mm-core/omxcore/inc/OMX_QCOMExtns.h689
-rw-r--r--mm-core/omxcore/inc/OMX_Types.h347
-rw-r--r--mm-core/omxcore/inc/OMX_Video.h1060
-rwxr-xr-xmm-core/omxcore/inc/QOMX_AudioExtensions.h181
-rwxr-xr-xmm-core/omxcore/inc/QOMX_AudioIndexExtensions.h77
-rw-r--r--mm-core/omxcore/inc/qc_omx_common.h65
-rw-r--r--mm-core/omxcore/inc/qc_omx_component.h183
-rw-r--r--mm-core/omxcore/inc/qc_omx_msg.h58
-rw-r--r--mm-core/omxcore/src/7630/qc_registry_table.c664
-rw-r--r--mm-core/omxcore/src/7630/qc_registry_table_android.c447
-rw-r--r--mm-core/omxcore/src/common/omx_core_cmp.cpp407
-rw-r--r--mm-core/omxcore/src/common/omx_core_cmp.h160
-rw-r--r--mm-core/omxcore/src/common/qc_omx_core.c847
-rw-r--r--mm-core/omxcore/src/common/qc_omx_core.h72
-rw-r--r--mm-video/Android.mk39
-rw-r--r--mm-video/vidc/vdec/Android.mk110
-rw-r--r--mm-video/vidc/vdec/inc/Map.h237
-rw-r--r--mm-video/vidc/vdec/inc/decoder_driver_test.h69
-rw-r--r--mm-video/vidc/vdec/inc/frameparser.h94
-rw-r--r--mm-video/vidc/vdec/inc/h264_utils.h209
-rw-r--r--mm-video/vidc/vdec/inc/message_queue.h78
-rw-r--r--mm-video/vidc/vdec/inc/omx_vdec.h615
-rw-r--r--mm-video/vidc/vdec/inc/qtypes.h90
-rw-r--r--mm-video/vidc/vdec/inc/queue.h39
-rw-r--r--mm-video/vidc/vdec/src/frameparser.cpp508
-rw-r--r--mm-video/vidc/vdec/src/h264_utils.cpp455
-rw-r--r--mm-video/vidc/vdec/src/message_queue.c174
-rw-r--r--mm-video/vidc/vdec/src/omx_vdec.cpp6203
-rw-r--r--mm-video/vidc/vdec/src/queue.c128
-rw-r--r--mm-video/vidc/vdec/test/decoder_driver_test.c1189
-rw-r--r--mm-video/vidc/vdec/test/omx_vdec_test.cpp2470
-rw-r--r--mm-video/vidc/venc/Android.mk106
-rw-r--r--mm-video/vidc/venc/inc/camera_test.h58
-rw-r--r--mm-video/vidc/venc/inc/fb_test.h48
-rw-r--r--mm-video/vidc/venc/inc/omx_video_base.h496
-rw-r--r--mm-video/vidc/venc/inc/omx_video_common.h75
-rw-r--r--mm-video/vidc/venc/inc/omx_video_encoder.h70
-rw-r--r--mm-video/vidc/venc/inc/queue.h80
-rw-r--r--mm-video/vidc/venc/inc/venc_util.h53
-rw-r--r--mm-video/vidc/venc/inc/video_encoder_device.h97
-rw-r--r--mm-video/vidc/venc/inc/video_encoder_test.h76
-rw-r--r--mm-video/vidc/venc/src/omx_video_base.cpp3530
-rw-r--r--mm-video/vidc/venc/src/omx_video_encoder.cpp1230
-rw-r--r--mm-video/vidc/venc/src/video_encoder_device.cpp1883
-rw-r--r--mm-video/vidc/venc/test/camera_test.cpp93
-rw-r--r--mm-video/vidc/venc/test/fb_test.c48
-rw-r--r--mm-video/vidc/venc/test/queue.c174
-rw-r--r--mm-video/vidc/venc/test/venc_test.cpp1635
-rw-r--r--mm-video/vidc/venc/test/venc_util.c51
-rw-r--r--mm-video/vidc/venc/test/video_encoder_test.c1065
66 files changed, 0 insertions, 34860 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk
deleted file mode 100644
index b84e1b65..00000000
--- a/CleanSpec.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright (C) 2007 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# If you don't need to do a full clean build but would like to touch
-# a file or delete some intermediate files, add a clean step to the end
-# of the list. These steps will only be run once, if they haven't been
-# run before.
-#
-# E.g.:
-# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
-# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
-#
-# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
-# files that are missing or have been moved.
-#
-# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
-# Use $(OUT_DIR) to refer to the "out" directory.
-#
-# If you need to re-do something that's already mentioned, just copy
-# the command and add it to the bottom of the list. E.g., if a change
-# that you made last week required touching a file and a change you
-# made today requires touching the same file, just copy the old
-# touch step and add it to the end of the list.
-#
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-
-# For example:
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
-#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
-#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
-#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
-
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
diff --git a/libstagefrighthw/Android.mk b/libstagefrighthw/Android.mk
deleted file mode 100644
index 8b448c13..00000000
--- a/libstagefrighthw/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- QComOMXPlugin.cpp \
-
-LOCAL_CFLAGS := $(PV_CFLAGS_MINUS_VISIBILITY)
-
-LOCAL_C_INCLUDES:= \
- $(TOP)/frameworks/native/include/media/hardware \
- $(TOP)/frameworks/native/include/media/openmax
-
-LOCAL_SHARED_LIBRARIES := \
- libbinder \
- libutils \
- libcutils \
- libdl \
- libui \
-
-LOCAL_MODULE := libstagefrighthw
-
-include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/libstagefrighthw/MODULE_LICENSE_APACHE2 b/libstagefrighthw/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29b..00000000
--- a/libstagefrighthw/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/libstagefrighthw/NOTICE b/libstagefrighthw/NOTICE
deleted file mode 100644
index a94ca1f6..00000000
--- a/libstagefrighthw/NOTICE
+++ /dev/null
@@ -1,189 +0,0 @@
- Copyright (c) 2009, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/libstagefrighthw/QComOMXPlugin.cpp b/libstagefrighthw/QComOMXPlugin.cpp
deleted file mode 100644
index fa9c8d70..00000000
--- a/libstagefrighthw/QComOMXPlugin.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "QComOMXPlugin.h"
-
-#include <dlfcn.h>
-
-#include <HardwareAPI.h>
-
-namespace android {
-
-static const char kPrefix[] = "7x30.";
-
-static OMX_ERRORTYPE AddPrefix(char *name) {
- if (strncmp("OMX.qcom.", name, 9)) {
- return OMX_ErrorUndefined;
- }
- String8 tmp(name, 9);
- tmp.append(kPrefix);
- tmp.append(&name[9]);
- strcpy(name, tmp.string());
- return OMX_ErrorNone;
-}
-
-static void RemovePrefix(const char *name, String8 *out) {
- out->setTo(name, 9); // "OMX.qcom."
- out->append(&name[9 + strlen(kPrefix)]);
-}
-
-OMXPluginBase *createOMXPlugin() {
- return new QComOMXPlugin;
-}
-
-QComOMXPlugin::QComOMXPlugin()
- : mLibHandle(dlopen("libOmxCore.so", RTLD_NOW)),
- mInit(NULL),
- mDeinit(NULL),
- mComponentNameEnum(NULL),
- mGetHandle(NULL),
- mFreeHandle(NULL),
- mGetRolesOfComponentHandle(NULL) {
- if (mLibHandle != NULL) {
- mInit = (InitFunc)dlsym(mLibHandle, "OMX_Init");
- mDeinit = (DeinitFunc)dlsym(mLibHandle, "OMX_DeInit");
-
- mComponentNameEnum =
- (ComponentNameEnumFunc)dlsym(mLibHandle, "OMX_ComponentNameEnum");
-
- mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "OMX_GetHandle");
- mFreeHandle = (FreeHandleFunc)dlsym(mLibHandle, "OMX_FreeHandle");
-
- mGetRolesOfComponentHandle =
- (GetRolesOfComponentFunc)dlsym(
- mLibHandle, "OMX_GetRolesOfComponent");
-
- (*mInit)();
- }
-}
-
-QComOMXPlugin::~QComOMXPlugin() {
- if (mLibHandle != NULL) {
- (*mDeinit)();
-
- dlclose(mLibHandle);
- mLibHandle = NULL;
- }
-}
-
-OMX_ERRORTYPE QComOMXPlugin::makeComponentInstance(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component) {
- if (mLibHandle == NULL) {
- return OMX_ErrorUndefined;
- }
-
- String8 tmp;
- RemovePrefix(name, &tmp);
- name = tmp.string();
-
- return (*mGetHandle)(
- reinterpret_cast<OMX_HANDLETYPE *>(component),
- const_cast<char *>(name),
- appData, const_cast<OMX_CALLBACKTYPE *>(callbacks));
-}
-
-OMX_ERRORTYPE QComOMXPlugin::destroyComponentInstance(
- OMX_COMPONENTTYPE *component) {
- if (mLibHandle == NULL) {
- return OMX_ErrorUndefined;
- }
-
- return (*mFreeHandle)(reinterpret_cast<OMX_HANDLETYPE *>(component));
-}
-
-OMX_ERRORTYPE QComOMXPlugin::enumerateComponents(
- OMX_STRING name,
- size_t size,
- OMX_U32 index) {
- if (mLibHandle == NULL) {
- return OMX_ErrorUndefined;
- }
-
- OMX_ERRORTYPE res = (*mComponentNameEnum)(name, size, index);
-
- if (res != OMX_ErrorNone) {
- return res;
- }
-
- return AddPrefix(name);
-}
-
-OMX_ERRORTYPE QComOMXPlugin::getRolesOfComponent(
- const char *name,
- Vector<String8> *roles) {
- roles->clear();
-
- if (mLibHandle == NULL) {
- return OMX_ErrorUndefined;
- }
-
- String8 tmp;
- RemovePrefix(name, &tmp);
- name = tmp.string();
-
- OMX_U32 numRoles;
- OMX_ERRORTYPE err = (*mGetRolesOfComponentHandle)(
- const_cast<OMX_STRING>(name), &numRoles, NULL);
-
- if (err != OMX_ErrorNone) {
- return err;
- }
-
- if (numRoles > 0) {
- OMX_U8 **array = new OMX_U8 *[numRoles];
- for (OMX_U32 i = 0; i < numRoles; ++i) {
- array[i] = new OMX_U8[OMX_MAX_STRINGNAME_SIZE];
- }
-
- OMX_U32 numRoles2;
- err = (*mGetRolesOfComponentHandle)(
- const_cast<OMX_STRING>(name), &numRoles2, array);
-
- if (err == OMX_ErrorNone && numRoles != numRoles2) {
- err = OMX_ErrorUndefined;
- }
-
- for (OMX_U32 i = 0; i < numRoles; ++i) {
- if (err == OMX_ErrorNone) {
- String8 s((const char *)array[i]);
- roles->push(s);
- }
-
- delete[] array[i];
- array[i] = NULL;
- }
-
- delete[] array;
- array = NULL;
- }
-
- return err;
-}
-
-} // namespace android
diff --git a/libstagefrighthw/QComOMXPlugin.h b/libstagefrighthw/QComOMXPlugin.h
deleted file mode 100644
index 432e19a9..00000000
--- a/libstagefrighthw/QComOMXPlugin.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef QCOM_OMX_PLUGIN_H_
-
-#define QCOM_OMX_PLUGIN_H_
-
-#include <OMXPluginBase.h>
-
-namespace android {
-
-struct QComOMXPlugin : public OMXPluginBase {
- QComOMXPlugin();
- virtual ~QComOMXPlugin();
-
- virtual OMX_ERRORTYPE makeComponentInstance(
- const char *name,
- const OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData,
- OMX_COMPONENTTYPE **component);
-
- virtual OMX_ERRORTYPE destroyComponentInstance(
- OMX_COMPONENTTYPE *component);
-
- virtual OMX_ERRORTYPE enumerateComponents(
- OMX_STRING name,
- size_t size,
- OMX_U32 index);
-
- virtual OMX_ERRORTYPE getRolesOfComponent(
- const char *name,
- Vector<String8> *roles);
-
-private:
- void *mLibHandle;
-
- typedef OMX_ERRORTYPE (*InitFunc)();
- typedef OMX_ERRORTYPE (*DeinitFunc)();
- typedef OMX_ERRORTYPE (*ComponentNameEnumFunc)(
- OMX_STRING, OMX_U32, OMX_U32);
-
- typedef OMX_ERRORTYPE (*GetHandleFunc)(
- OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
-
- typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
-
- typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
- OMX_STRING, OMX_U32 *, OMX_U8 **);
-
- InitFunc mInit;
- DeinitFunc mDeinit;
- ComponentNameEnumFunc mComponentNameEnum;
- GetHandleFunc mGetHandle;
- FreeHandleFunc mFreeHandle;
- GetRolesOfComponentFunc mGetRolesOfComponentHandle;
-
- QComOMXPlugin(const QComOMXPlugin &);
- QComOMXPlugin &operator=(const QComOMXPlugin &);
-};
-
-} // namespace android
-
-#endif // QCOM_OMX_PLUGIN_H_
diff --git a/mm-core/Android.mk b/mm-core/Android.mk
deleted file mode 100644
index ad9949a6..00000000
--- a/mm-core/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#--------------------------------------------------------------------------
-#Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-#Redistribution and use in source and binary forms, with or without
-#modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Code Aurora nor
-# the names of its contributors may be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#--------------------------------------------------------------------------
-
-OMX_CORE_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-ifneq ($(BUILD_TINY_ANDROID),true)
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
- include $(OMX_CORE_PATH)/omxcore/Android.mk
-endif
-
-endif #BUILD_TINY_ANDROID
diff --git a/mm-core/omxcore/Android.mk b/mm-core/omxcore/Android.mk
deleted file mode 100644
index aa9383e3..00000000
--- a/mm-core/omxcore/Android.mk
+++ /dev/null
@@ -1,96 +0,0 @@
-#--------------------------------------------------------------------------
-#Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-#Redistribution and use in source and binary forms, with or without
-#modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Code Aurora nor
-# the names of its contributors may be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#--------------------------------------------------------------------------
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-#OMXCORE_CFLAGS := -g -O3 -DVERBOSE
-#OMXCORE_CFLAGS += -O0 -fno-inline -fno-short-enums
-OMXCORE_CFLAGS += -D_ANDROID_
-OMXCORE_CFLAGS += -D_ENABLE_QC_MSG_LOG_
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
- MM_CORE_TARGET = 7630
-else
- $(error Unsupported target platform $(TARGET_BOARD_PLATFORM))
-endif
-
-#===============================================================================
-# Deploy the headers that can be exposed
-#===============================================================================
-
-LOCAL_COPY_HEADERS_TO := mm-core/omxcore
-LOCAL_COPY_HEADERS := inc/OMX_Audio.h
-LOCAL_COPY_HEADERS += inc/OMX_Component.h
-LOCAL_COPY_HEADERS += inc/OMX_ContentPipe.h
-LOCAL_COPY_HEADERS += inc/OMX_Core.h
-LOCAL_COPY_HEADERS += inc/OMX_Image.h
-LOCAL_COPY_HEADERS += inc/OMX_Index.h
-LOCAL_COPY_HEADERS += inc/OMX_IVCommon.h
-LOCAL_COPY_HEADERS += inc/OMX_Other.h
-LOCAL_COPY_HEADERS += inc/OMX_QCOMExtns.h
-LOCAL_COPY_HEADERS += inc/OMX_Types.h
-LOCAL_COPY_HEADERS += inc/OMX_Video.h
-LOCAL_COPY_HEADERS += inc/qc_omx_common.h
-LOCAL_COPY_HEADERS += inc/qc_omx_component.h
-LOCAL_COPY_HEADERS += inc/qc_omx_msg.h
-LOCAL_COPY_HEADERS += inc/QOMX_AudioExtensions.h
-LOCAL_COPY_HEADERS += inc/QOMX_AudioIndexExtensions.h
-
-#===============================================================================
-# LIBRARY for Android apps
-#===============================================================================
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
-LOCAL_MODULE := libOmxCore
-LOCAL_SHARED_LIBRARIES := liblog libdl
-LOCAL_CFLAGS := $(OMXCORE_CFLAGS)
-
-LOCAL_SRC_FILES := src/common/omx_core_cmp.cpp
-LOCAL_SRC_FILES += src/common/qc_omx_core.c
-LOCAL_SRC_FILES += src/$(MM_CORE_TARGET)/qc_registry_table_android.c
-
-include $(BUILD_SHARED_LIBRARY)
-
-#===============================================================================
-# LIBRARY for command line test apps
-#===============================================================================
-
-include $(CLEAR_VARS)
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/src/common
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/inc
-LOCAL_MODULE := libmm-omxcore
-LOCAL_SHARED_LIBRARIES := liblog libdl
-LOCAL_CFLAGS := $(OMXCORE_CFLAGS)
-
-LOCAL_SRC_FILES := src/common/omx_core_cmp.cpp
-LOCAL_SRC_FILES += src/common/qc_omx_core.c
-LOCAL_SRC_FILES += src/$(MM_CORE_TARGET)/qc_registry_table.c
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/mm-core/omxcore/inc/OMX_Audio.h b/mm-core/omxcore/inc/OMX_Audio.h
deleted file mode 100644
index 04f1a999..00000000
--- a/mm-core/omxcore/inc/OMX_Audio.h
+++ /dev/null
@@ -1,1311 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Audio.h - OpenMax IL version 1.1.2
- * The structures needed by Audio components to exchange
- * parameters and configuration data with the componenmilts.
- */
-
-#ifndef OMX_Audio_h
-#define OMX_Audio_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup midi MIDI
- * @ingroup audio
- */
-
-/** @defgroup effects Audio effects
- * @ingroup audio
- */
-
-/** @defgroup audio OpenMAX IL Audio Domain
- * Structures for OpenMAX IL Audio domain
- * @{
- */
-
-/** Enumeration used to define the possible audio codings.
- * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must
- * be done in a vendor specific way. Since this is for an audio
- * processing element this enum is relevant. However, for another
- * type of component other enums would be in this area.
- */
-typedef enum OMX_AUDIO_CODINGTYPE {
- OMX_AUDIO_CodingUnused = 0, /**< Placeholder value when coding is N/A */
- OMX_AUDIO_CodingAutoDetect, /**< auto detection of audio format */
- OMX_AUDIO_CodingPCM, /**< Any variant of PCM coding */
- OMX_AUDIO_CodingADPCM, /**< Any variant of ADPCM encoded data */
- OMX_AUDIO_CodingAMR, /**< Any variant of AMR encoded data */
- OMX_AUDIO_CodingGSMFR, /**< Any variant of GSM fullrate (i.e. GSM610) */
- OMX_AUDIO_CodingGSMEFR, /**< Any variant of GSM Enhanced Fullrate encoded data*/
- OMX_AUDIO_CodingGSMHR, /**< Any variant of GSM Halfrate encoded data */
- OMX_AUDIO_CodingPDCFR, /**< Any variant of PDC Fullrate encoded data */
- OMX_AUDIO_CodingPDCEFR, /**< Any variant of PDC Enhanced Fullrate encoded data */
- OMX_AUDIO_CodingPDCHR, /**< Any variant of PDC Halfrate encoded data */
- OMX_AUDIO_CodingTDMAFR, /**< Any variant of TDMA Fullrate encoded data (TIA/EIA-136-420) */
- OMX_AUDIO_CodingTDMAEFR, /**< Any variant of TDMA Enhanced Fullrate encoded data (TIA/EIA-136-410) */
- OMX_AUDIO_CodingQCELP8, /**< Any variant of QCELP 8kbps encoded data */
- OMX_AUDIO_CodingQCELP13, /**< Any variant of QCELP 13kbps encoded data */
- OMX_AUDIO_CodingEVRC, /**< Any variant of EVRC encoded data */
- OMX_AUDIO_CodingSMV, /**< Any variant of SMV encoded data */
- OMX_AUDIO_CodingG711, /**< Any variant of G.711 encoded data */
- OMX_AUDIO_CodingG723, /**< Any variant of G.723 dot 1 encoded data */
- OMX_AUDIO_CodingG726, /**< Any variant of G.726 encoded data */
- OMX_AUDIO_CodingG729, /**< Any variant of G.729 encoded data */
- OMX_AUDIO_CodingAAC, /**< Any variant of AAC encoded data */
- OMX_AUDIO_CodingMP3, /**< Any variant of MP3 encoded data */
- OMX_AUDIO_CodingSBC, /**< Any variant of SBC encoded data */
- OMX_AUDIO_CodingVORBIS, /**< Any variant of VORBIS encoded data */
- OMX_AUDIO_CodingWMA, /**< Any variant of WMA encoded data */
- OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */
- OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */
- OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_CodingMax = 0x7FFFFFFF
-} OMX_AUDIO_CODINGTYPE;
-
-
-/** The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output audio
- * path. If additional information is needed to define the parameters of the
- * port (such as frequency), additional structures must be sent such as the
- * OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port.
- */
-typedef struct OMX_AUDIO_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType; /**< MIME type of data for the port */
- OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference
- for an output device,
- otherwise this field is 0 */
- OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is
- supported by the OMX component */
- OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this
- port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PORTDEFINITIONTYPE;
-
-
-/** Port format parameter. This structure is used to enumerate
- * the various data input/output format supported by the port.
- */
-typedef struct OMX_AUDIO_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Indicates which port to set */
- OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
- OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */
-} OMX_AUDIO_PARAM_PORTFORMATTYPE;
-
-
-/** PCM mode type */
-typedef enum OMX_AUDIO_PCMMODETYPE {
- OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */
- OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */
- OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */
- OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_PCMModeMax = 0x7FFFFFFF
-} OMX_AUDIO_PCMMODETYPE;
-
-
-typedef enum OMX_AUDIO_CHANNELTYPE {
- OMX_AUDIO_ChannelNone = 0x0, /**< Unused or empty */
- OMX_AUDIO_ChannelLF = 0x1, /**< Left front */
- OMX_AUDIO_ChannelRF = 0x2, /**< Right front */
- OMX_AUDIO_ChannelCF = 0x3, /**< Center front */
- OMX_AUDIO_ChannelLS = 0x4, /**< Left surround */
- OMX_AUDIO_ChannelRS = 0x5, /**< Right surround */
- OMX_AUDIO_ChannelLFE = 0x6, /**< Low frequency effects */
- OMX_AUDIO_ChannelCS = 0x7, /**< Back surround */
- OMX_AUDIO_ChannelLR = 0x8, /**< Left rear. */
- OMX_AUDIO_ChannelRR = 0x9, /**< Right rear. */
- OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_ChannelMax = 0x7FFFFFFF
-} OMX_AUDIO_CHANNELTYPE;
-
-#define OMX_AUDIO_MAXCHANNELS 16 /**< maximum number distinct audio channels that a buffer may contain */
-#define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */
-
-/** PCM format description */
-typedef struct OMX_AUDIO_PARAM_PCMMODETYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */
- OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed or unsigned */
- OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */
- OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for
- non-interleaved data (e.g. block data) */
- OMX_U32 nBitPerSample; /**< Bit per sample */
- OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */
- OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */
-
-} OMX_AUDIO_PARAM_PCMMODETYPE;
-
-
-/** Audio channel mode. This is used by both AAC and MP3, although the names are more appropriate
- * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC.
- */
-typedef enum OMX_AUDIO_CHANNELMODETYPE {
- OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those
- two channels changes accordingly to each channel information */
- OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between
- 2 channels for higher compression gain */
- OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half
- the bitrate of the overall bitrate */
- OMX_AUDIO_ChannelModeMono, /**< Mono channel mode */
- OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF
-} OMX_AUDIO_CHANNELMODETYPE;
-
-
-typedef enum OMX_AUDIO_MP3STREAMFORMATTYPE {
- OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatMP2Layer3, /**< MP3 Audio MPEG 2 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatMP2_5Layer3, /**< MP3 Audio MPEG2.5 Layer 3 Stream format */
- OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MP3STREAMFORMATTYPE;
-
-/** MP3 params */
-typedef struct OMX_AUDIO_PARAM_MP3TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
- OMX_AUDIO_MP3STREAMFORMATTYPE eFormat; /**< MP3 stream format */
-} OMX_AUDIO_PARAM_MP3TYPE;
-
-
-typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE {
- OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */
- OMX_AUDIO_AACStreamFormatMP4ADTS, /**< AAC Audio Data Transport Stream 4 format */
- OMX_AUDIO_AACStreamFormatMP4LOAS, /**< AAC Low Overhead Audio Stream format */
- OMX_AUDIO_AACStreamFormatMP4LATM, /**< AAC Low overhead Audio Transport Multiplex */
- OMX_AUDIO_AACStreamFormatADIF, /**< AAC Audio Data Interchange Format */
- OMX_AUDIO_AACStreamFormatMP4FF, /**< AAC inside MPEG-4/ISO File Format */
- OMX_AUDIO_AACStreamFormatRAW, /**< AAC Raw Format */
- OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_AACSTREAMFORMATTYPE;
-
-
-/** AAC mode type. Note that the term profile is used with the MPEG-2
- * standard and the term object type and profile is used with MPEG-4 */
-typedef enum OMX_AUDIO_AACPROFILETYPE{
- OMX_AUDIO_AACObjectNull = 0, /**< Null, not used */
- OMX_AUDIO_AACObjectMain = 1, /**< AAC Main object */
- OMX_AUDIO_AACObjectLC, /**< AAC Low Complexity object (AAC profile) */
- OMX_AUDIO_AACObjectSSR, /**< AAC Scalable Sample Rate object */
- OMX_AUDIO_AACObjectLTP, /**< AAC Long Term Prediction object */
- OMX_AUDIO_AACObjectHE, /**< AAC High Efficiency (object type SBR, HE-AAC profile) */
- OMX_AUDIO_AACObjectScalable, /**< AAC Scalable object */
- OMX_AUDIO_AACObjectERLC = 17, /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */
- OMX_AUDIO_AACObjectLD = 23, /**< AAC Low Delay object (Error Resilient) */
- OMX_AUDIO_AACObjectHE_PS = 29, /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */
- OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AACObjectMax = 0x7FFFFFFF
-} OMX_AUDIO_AACPROFILETYPE;
-
-
-/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for encoder configuration and optional as decoder info output.
- * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */
-#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */
-#define OMX_AUDIO_AACToolMS 0x00000001 /**< MS: Mid/side joint coding tool allowed or active */
-#define OMX_AUDIO_AACToolIS 0x00000002 /**< IS: Intensity stereo tool allowed or active */
-#define OMX_AUDIO_AACToolTNS 0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */
-#define OMX_AUDIO_AACToolPNS 0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */
-#define OMX_AUDIO_AACToolLTP 0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */
-#define OMX_AUDIO_AACToolAll 0x7FFFFFFF /**< all AAC tools allowed or active (*/
-
-/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
- * Required for ER encoder configuration and optional as decoder info output */
-#define OMX_AUDIO_AACERNone 0x00000000 /**< no AAC ER tools allowed/used */
-#define OMX_AUDIO_AACERVCB11 0x00000001 /**< VCB11: Virtual Code Books for AAC section data */
-#define OMX_AUDIO_AACERRVLC 0x00000002 /**< RVLC: Reversible Variable Length Coding */
-#define OMX_AUDIO_AACERHCR 0x00000004 /**< HCR: Huffman Codeword Reordering */
-#define OMX_AUDIO_AACERAll 0x7FFFFFFF /**< all AAC ER tools allowed/used */
-
-
-/** AAC params */
-typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_U32 nFrameLength; /**< Frame length (in audio samples per channel) of the codec.
- Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD).
- Use 0 to let encoder decide */
- OMX_U32 nAACtools; /**< AAC tool usage */
- OMX_U32 nAACERtools; /**< MPEG-4 AAC error resilience tool usage */
- OMX_AUDIO_AACPROFILETYPE eAACProfile; /**< AAC profile enumeration */
- OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
-} OMX_AUDIO_PARAM_AACPROFILETYPE;
-
-
-/** VORBIS params */
-typedef struct OMX_AUDIO_PARAM_VORBISTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the encoded data data. Use 0 for variable
- rate or unknown bit rates. Encoding is set to the
- bitrate closest to specified value (in bps) */
- OMX_U32 nMinBitRate; /**< Sets minimum bitrate (in bps). */
- OMX_U32 nMaxBitRate; /**< Sets maximum bitrate (in bps). */
-
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should
- limit the audio signal. Use 0 to let encoder decide */
- OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high).
- In the default mode of operation, teh quality level is 3.
- Normal quality range is 0 - 10. */
- OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the
- normal VBR encoding, but allows hard or soft bitrate
- constraints to be enforced by the encoder. This mode can
- be slower, and may also be lower quality. It is
- primarily useful for streaming. */
- OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on
- non-stereo streams). Useful for lower-bitrate encoding. */
-} OMX_AUDIO_PARAM_VORBISTYPE;
-
-
-/** WMA Version */
-typedef enum OMX_AUDIO_WMAFORMATTYPE {
- OMX_AUDIO_WMAFormatUnused = 0, /**< format unused or unknown */
- OMX_AUDIO_WMAFormat7, /**< Windows Media Audio format 7 */
- OMX_AUDIO_WMAFormat8, /**< Windows Media Audio format 8 */
- OMX_AUDIO_WMAFormat9, /**< Windows Media Audio format 9 */
- OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAFORMATTYPE;
-
-
-/** WMA Profile */
-typedef enum OMX_AUDIO_WMAPROFILETYPE {
- OMX_AUDIO_WMAProfileUnused = 0, /**< profile unused or unknown */
- OMX_AUDIO_WMAProfileL1, /**< Windows Media audio version 9 profile L1 */
- OMX_AUDIO_WMAProfileL2, /**< Windows Media audio version 9 profile L2 */
- OMX_AUDIO_WMAProfileL3, /**< Windows Media audio version 9 profile L3 */
- OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF
-} OMX_AUDIO_WMAPROFILETYPE;
-
-
-/** WMA params */
-typedef struct OMX_AUDIO_PARAM_WMATYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U16 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */
- OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */
- OMX_U32 nSamplingRate; /**< Sampling rate of the source data */
- OMX_U16 nBlockAlign; /**< is the block alignment, or block size, in bytes of the audio codec */
- OMX_U16 nEncodeOptions; /**< WMA Type-specific data */
- OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */
-} OMX_AUDIO_PARAM_WMATYPE;
-
-/**
- * RealAudio format
- */
-typedef enum OMX_AUDIO_RAFORMATTYPE {
- OMX_AUDIO_RAFormatUnused = 0, /**< Format unused or unknown */
- OMX_AUDIO_RA8, /**< RealAudio 8 codec */
- OMX_AUDIO_RA9, /**< RealAudio 9 codec */
- OMX_AUDIO_RA10_AAC, /**< MPEG-4 AAC codec for bitrates of more than 128kbps */
- OMX_AUDIO_RA10_CODEC, /**< RealAudio codec for bitrates less than 128 kbps */
- OMX_AUDIO_RA10_LOSSLESS, /**< RealAudio Lossless */
- OMX_AUDIO_RA10_MULTICHANNEL, /**< RealAudio Multichannel */
- OMX_AUDIO_RA10_VOICE, /**< RealAudio Voice for bitrates below 15 kbps */
- OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_RAFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_RAFORMATTYPE;
-
-/** RA (Real Audio) params */
-typedef struct OMX_AUDIO_PARAM_RATYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */
- OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */
- OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */
- OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */
- OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */
- OMX_U32 nNumRegions; /**< is the number of regions value */
- OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */
-} OMX_AUDIO_PARAM_RATYPE;
-
-
-/** SBC Allocation Method Type */
-typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE {
- OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */
- OMX_AUDIO_SBCAllocMethodSNR, /**< SNR allocation method */
- OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF
-} OMX_AUDIO_SBCALLOCMETHODTYPE;
-
-
-/** SBC params */
-typedef struct OMX_AUDIO_PARAM_SBCTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
- OMX_U32 nBlocks; /**< Number of blocks */
- OMX_U32 nSubbands; /**< Number of subbands */
- OMX_U32 nBitPool; /**< Bitpool value */
- OMX_BOOL bEnableBitrate; /**< Use bitrate value instead of bitpool */
- OMX_AUDIO_CHANNELMODETYPE eChannelMode; /**< Channel mode enumeration */
- OMX_AUDIO_SBCALLOCMETHODTYPE eSBCAllocType; /**< SBC Allocation method type */
-} OMX_AUDIO_PARAM_SBCTYPE;
-
-
-/** ADPCM stream format parameters */
-typedef struct OMX_AUDIO_PARAM_ADPCMTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_U32 nBitsPerSample; /**< Number of bits in each sample */
- OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for
- variable or unknown sampling rate. */
-} OMX_AUDIO_PARAM_ADPCMTYPE;
-
-
-/** G723 rate */
-typedef enum OMX_AUDIO_G723RATE {
- OMX_AUDIO_G723ModeUnused = 0, /**< AMRNB Mode unused / unknown */
- OMX_AUDIO_G723ModeLow, /**< 5300 bps */
- OMX_AUDIO_G723ModeHigh, /**< 6300 bps */
- OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G723ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G723RATE;
-
-
-/** G723 - Sample rate must be 8 KHz */
-typedef struct OMX_AUDIO_PARAM_G723TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_AUDIO_G723RATE eBitRate; /**< todo: Should this be moved to a config? */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
- OMX_BOOL bPostFilter; /**< Enable Post Filter */
-} OMX_AUDIO_PARAM_G723TYPE;
-
-
-/** ITU G726 (ADPCM) rate */
-typedef enum OMX_AUDIO_G726MODE {
- OMX_AUDIO_G726ModeUnused = 0, /**< G726 Mode unused / unknown */
- OMX_AUDIO_G726Mode16, /**< 16 kbps */
- OMX_AUDIO_G726Mode24, /**< 24 kbps */
- OMX_AUDIO_G726Mode32, /**< 32 kbps, most common rate, also G721 */
- OMX_AUDIO_G726Mode40, /**< 40 kbps */
- OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G726ModeMax = 0x7FFFFFFF
-} OMX_AUDIO_G726MODE;
-
-
-/** G.726 stream format parameters - must be at 8KHz */
-typedef struct OMX_AUDIO_PARAM_G726TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_G726MODE eG726Mode;
-} OMX_AUDIO_PARAM_G726TYPE;
-
-
-/** G729 coder type */
-typedef enum OMX_AUDIO_G729TYPE {
- OMX_AUDIO_G729 = 0, /**< ITU G.729 encoded data */
- OMX_AUDIO_G729A, /**< ITU G.729 annex A encoded data */
- OMX_AUDIO_G729B, /**< ITU G.729 with annex B encoded data */
- OMX_AUDIO_G729AB, /**< ITU G.729 annexes A and B encoded data */
- OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_G729Max = 0x7FFFFFFF
-} OMX_AUDIO_G729TYPE;
-
-
-/** G729 stream format parameters - fixed 6KHz sample rate */
-typedef struct OMX_AUDIO_PARAM_G729TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_AUDIO_G729TYPE eBitType;
-} OMX_AUDIO_PARAM_G729TYPE;
-
-
-/** AMR Frame format */
-typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE {
- OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance
- (Standard) Format */
- OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface
- Format 1 */
- OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface
- Format 2*/
- OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage
- Format */
- OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time
- Transport Protocol Payload Format */
- OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */
- OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRFRAMEFORMATTYPE;
-
-
-/** AMR band mode */
-typedef enum OMX_AUDIO_AMRBANDMODETYPE {
- OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */
- OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */
- OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */
- OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */
- OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */
- OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */
- OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */
- OMX_AUDIO_AMRBandModeNB6, /**< AMRNB Mode 6 = 10200 bps */
- OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */
- OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */
- OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */
- OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */
- OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */
- OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */
- OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */
- OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */
- OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */
- OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */
- OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRBANDMODETYPE;
-
-
-/** AMR Discontinuous Transmission mode */
-typedef enum OMX_AUDIO_AMRDTXMODETYPE {
- OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */
- OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using
- Voice Activity Detector 1 (VAD1) is enabled */
- OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using
- Voice Activity Detector 2 (VAD2) is enabled */
- OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between
- Off, VAD1 or VAD2 modes */
-
- OMX_AUDIO_AMRDTXasEFR, /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */
-
- OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF
-} OMX_AUDIO_AMRDTXMODETYPE;
-
-
-/** AMR params */
-typedef struct OMX_AUDIO_PARAM_AMRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels */
- OMX_U32 nBitRate; /**< Bit rate read only field */
- OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */
- OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */
- OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */
-} OMX_AUDIO_PARAM_AMRTYPE;
-
-
-/** GSM_FR (ETSI 06.10, 3GPP 46.010) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMFRTYPE;
-
-
-/** GSM-HR (ETSI 06.20, 3GPP 46.020) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMHRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMHRTYPE;
-
-
-/** GSM-EFR (ETSI 06.60, 3GPP 46.060) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_GSMEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_GSMEFRTYPE;
-
-
-/** TDMA FR (TIA/EIA-136-420, VSELP 7.95kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAFRTYPE;
-
-
-/** TDMA EFR (TIA/EIA-136-410, ACELP 7.4kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_TDMAEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_TDMAEFRTYPE;
-
-
-/** PDC FR ( RCR-27, VSELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCFRTYPE;
-
-
-/** PDC EFR ( RCR-27, ACELP 6.7kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCEFRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCEFRTYPE;
-
-/** PDC HR ( RCR-27, PSI-CELP 3.45kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_PDCHRTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */
- OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */
-} OMX_AUDIO_PARAM_PDCHRTYPE;
-
-
-/** CDMA Rate types */
-typedef enum OMX_AUDIO_CDMARATETYPE {
- OMX_AUDIO_CDMARateBlank = 0, /**< CDMA encoded frame is blank */
- OMX_AUDIO_CDMARateFull, /**< CDMA encoded frame in full rate */
- OMX_AUDIO_CDMARateHalf, /**< CDMA encoded frame in half rate */
- OMX_AUDIO_CDMARateQuarter, /**< CDMA encoded frame in quarter rate */
- OMX_AUDIO_CDMARateEighth, /**< CDMA encoded frame in eighth rate (DTX)*/
- OMX_AUDIO_CDMARateErasure, /**< CDMA erasure frame */
- OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_CDMARateMax = 0x7FFFFFFF
-} OMX_AUDIO_CDMARATETYPE;
-
-
-/** QCELP8 (TIA/EIA-96, up to 8kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP8TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable
- rate or unknown bit rates */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP8TYPE;
-
-
-/** QCELP13 ( CDMA, EIA/TIA-733, 13.3kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_QCELP13TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
-} OMX_AUDIO_PARAM_QCELP13TYPE;
-
-
-/** EVRC ( CDMA, EIA/TIA-127, RCELP up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_EVRCTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< actual Frame rate */
- OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 */
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 */
- OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter */
- OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */
- OMX_BOOL bPostFilter; /**< Enable decoder's post Filter */
-} OMX_AUDIO_PARAM_EVRCTYPE;
-
-
-/** SMV ( up to 8.55kbps coder) stream format parameters */
-typedef struct OMX_AUDIO_PARAM_SMVTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannels; /**< Number of channels in the data stream (not
- necessarily the same as the number of channels
- to be rendered. */
- OMX_AUDIO_CDMARATETYPE eCDMARate; /**< Frame rate */
- OMX_BOOL bRATE_REDUCon; /**< RATE_REDUCtion is requested for this frame */
- OMX_U32 nMinBitRate; /**< minmal rate for the encoder = 1,2,3,4, default = 1 ??*/
- OMX_U32 nMaxBitRate; /**< maximal rate for the encoder = 1,2,3,4, default = 4 ??*/
- OMX_BOOL bHiPassFilter; /**< Enable encoder's High Pass Filter ??*/
- OMX_BOOL bNoiseSuppressor; /**< Enable encoder's noise suppressor pre-processing */
- OMX_BOOL bPostFilter; /**< Enable decoder's post Filter ??*/
-} OMX_AUDIO_PARAM_SMVTYPE;
-
-
-/** MIDI Format
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIFORMATTYPE
-{
- OMX_AUDIO_MIDIFormatUnknown = 0, /**< MIDI Format unknown or don't care */
- OMX_AUDIO_MIDIFormatSMF0, /**< Standard MIDI File Type 0 */
- OMX_AUDIO_MIDIFormatSMF1, /**< Standard MIDI File Type 1 */
- OMX_AUDIO_MIDIFormatSMF2, /**< Standard MIDI File Type 2 */
- OMX_AUDIO_MIDIFormatSPMIDI, /**< SP-MIDI */
- OMX_AUDIO_MIDIFormatXMF0, /**< eXtensible Music Format type 0 */
- OMX_AUDIO_MIDIFormatXMF1, /**< eXtensible Music Format type 1 */
- OMX_AUDIO_MIDIFormatMobileXMF, /**< Mobile XMF (eXtensible Music Format type 2) */
- OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIFORMATTYPE;
-
-
-/** MIDI params
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDITYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire
- MIDI file passed in, otherwise if 0x0, the MIDI data
- is merged and streamed (instead of passed as an
- entire MIDI file) */
- OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic
- voices. A value of zero indicates that the default
- polyphony of the device is used */
- OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound
- bank at initialization */
- OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */
-} OMX_AUDIO_PARAM_MIDITYPE;
-
-
-/** Type of the MIDI sound bank
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE {
- OMX_AUDIO_MIDISoundBankUnused = 0, /**< unused/unknown soundbank type */
- OMX_AUDIO_MIDISoundBankDLS1, /**< DLS version 1 */
- OMX_AUDIO_MIDISoundBankDLS2, /**< DLS version 2 */
- OMX_AUDIO_MIDISoundBankMobileDLSBase, /**< Mobile DLS, using the base functionality */
- OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */
- OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKTYPE;
-
-
-/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE {
- OMX_AUDIO_MIDISoundBankLayoutUnused = 0, /**< unused/unknown soundbank type */
- OMX_AUDIO_MIDISoundBankLayoutGM, /**< GS layout (based on bank MSB 0x00) */
- OMX_AUDIO_MIDISoundBankLayoutGM2, /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */
- OMX_AUDIO_MIDISoundBankLayoutUser, /**< Does not conform to any bank numbering standards */
- OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE;
-
-
-/** MIDI params to load/unload user soundbank
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nDLSIndex; /**< DLS file index to be loaded */
- OMX_U32 nDLSSize; /**< Size in bytes */
- OMX_PTR pDLSData; /**< Pointer to DLS file data */
- OMX_AUDIO_MIDISOUNDBANKTYPE eMidiSoundBank; /**< Midi sound bank type enumeration */
- OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE eMidiSoundBankLayout; /**< Midi sound bank layout enumeration */
-} OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE;
-
-
-/** Structure for Live MIDI events and MIP messages.
- * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.)
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nMidiEventSize; /**< Size of immediate MIDI events or MIP message in bytes */
- OMX_U8 nMidiEvents[1]; /**< MIDI event array to be rendered immediately, or an
- array for the MIP message buffer, where the size is
- indicated by nMidiEventSize */
-} OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE;
-
-
-/** MIDI sound bank/ program pair in a given channel
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_U32 nChannel; /**< Valid channel values range from 1 to 16 */
- OMX_U16 nIDProgram; /**< Valid program ID range is 1 to 128 */
- OMX_U16 nIDSoundBank; /**< Sound bank ID */
- OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks
- by index if multiple banks are present */
-} OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE;
-
-
-/** MIDI control
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10
- format based on JAVA MMAPI (JSR-135) requirement */
- OMX_BU32 sPlayBackRate; /**< Relative playback rate, stored as Q14.17 fixed-point
- number based on JSR-135 requirement */
- OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10
- fixed-point number based on JSR-135 requirement */
- OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic
- voices. A value of zero indicates that the default
- polyphony of the device is used */
- OMX_U32 nNumRepeat; /**< Number of times to repeat playback */
- OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback
- will stop automatically. Set to zero if not used */
- OMX_U16 nChannelMuteMask; /**< 16 bit mask for channel mute status */
- OMX_U16 nChannelSoloMask; /**< 16 bit mask for channel solo status */
- OMX_U32 nTrack0031MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 0-31 */
- OMX_U32 nTrack3263MuteMask; /**< 32 bit mask for track mute status. Note: This is for tracks 32-63 */
- OMX_U32 nTrack0031SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 0-31 */
- OMX_U32 nTrack3263SoloMask; /**< 32 bit mask for track solo status. Note: This is for tracks 32-63 */
-
-} OMX_AUDIO_CONFIG_MIDICONTROLTYPE;
-
-
-/** MIDI Playback States
- * @ingroup midi
- */
-typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE {
- OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to
- other defined states */
- OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open.
- The MIDI engine is currently processing
- MIDI events. */
- OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being
- primed. The MIDI engine is currently
- processing MIDI events. */
- OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but
- not playing. The MIDI engine is currently
- processing MIDI events. The transition to
- this state is only possible from the
- OMX_AUDIO_MIDIPlayBackStatePlaying state,
- when the 'playback head' reaches the end
- of media data or the playback stops due
- to stop time set.*/
- OMX_AUDIO_MIDIPlayBackStatePlaying, /**< A MIDI resource is open and currently
- playing. The MIDI engine is currently
- processing MIDI events.*/
- OMX_AUDIO_MIDIPlayBackStatePlayingPartially, /**< Best-effort playback due to SP-MIDI/DLS
- resource constraints */
- OMX_AUDIO_MIDIPlayBackStatePlayingSilently, /**< Due to system resource constraints and
- SP-MIDI content constraints, there is
- no audible MIDI content during playback
- currently. The situation may change if
- resources are freed later.*/
- OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF
-} OMX_AUDIO_MIDIPLAYBACKSTATETYPE;
-
-
-/** MIDI status
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field.
- NOTE: May not return a meaningful value until the entire
- file is parsed and buffered. */
- OMX_U32 nDuration; /**< The length of the currently open MIDI resource
- in milliseconds. NOTE: May not return a meaningful value
- until the entire file is parsed and buffered. */
- OMX_U32 nPosition; /**< Current Position of the MIDI resource being played
- in milliseconds */
- OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful
- value until the entire file is parsed and buffered. */
- OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently
- open MIDI resource. NOTE: May not return a meaningful value
- until the entire file is parsed and buffered. */
- OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing
- MIDI resource. NOTE: May not return a meaningful value until
- the entire file is parsed and buffered. */
- OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState; /**< MIDI playback state enumeration, read only field */
-} OMX_AUDIO_CONFIG_MIDISTATUSTYPE;
-
-
-/** MIDI Meta Event structure one per Meta Event.
- * MIDI Meta Events are like audio metadata, except that they are interspersed
- * with the MIDI content throughout the file and are not localized in the header.
- * As such, it is necessary to retrieve information about these Meta Events from
- * the engine, as it encounters these Meta Events within the MIDI content.
- * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright,
- * author, default tempo, etc.) scattered throughout the file.
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nIndex; /**< Index of Meta Event */
- OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */
- OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */
- OMX_U32 nTrack; /**< track number for the meta event */
- OMX_U32 nPosition; /**< Position of the meta-event in milliseconds */
-} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE;
-
-
-/** MIDI Meta Event Data structure - one per Meta Event.
- * @ingroup midi
- */
-typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nIndex; /**< Index of Meta Event */
- OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */
- OMX_U8 nData[1]; /**< array of one or more bytes of meta data
- as indicated by the nMetaEventSize field */
-} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE;
-
-
-/** Audio Volume adjustment for a port */
-typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's volume. Select the
- output port to adjust the master
- volume. */
- OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100)
- or logarithmic scale (mB) */
- OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR
- Volume logarithmic setting for this port. The values
- for volume are in mB (millibels = 1/100 dB) relative
- to a gain of 1 (e.g. the output is the same as the
- input level). Values are in mB from nMax
- (maximum volume) to nMin mB (typically negative).
- Since the volume is "voltage"
- and not a "power", it takes a setting of
- -600 mB to decrease the volume by 1/2. If
- a component cannot accurately set the
- volume to the requested value, it must
- set the volume to the closest value BELOW
- the requested value. When getting the
- volume setting, the current actual volume
- must be returned. */
-} OMX_AUDIO_CONFIG_VOLUMETYPE;
-
-
-/** Audio Volume adjustment for a channel */
-typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's volume. Select the
- output port to adjust the master
- volume. */
- OMX_U32 nChannel; /**< channel to select from 0 to N-1,
- using OMX_ALL to apply volume settings
- to all channels */
- OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or
- logarithmic scale (mB) */
- OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR
- Volume logarithmic setting for this port.
- The values for volume are in mB
- (millibels = 1/100 dB) relative to a gain
- of 1 (e.g. the output is the same as the
- input level). Values are in mB from nMax
- (maximum volume) to nMin mB (typically negative).
- Since the volume is "voltage"
- and not a "power", it takes a setting of
- -600 mB to decrease the volume by 1/2. If
- a component cannot accurately set the
- volume to the requested value, it must
- set the volume to the closest value BELOW
- the requested value. When getting the
- volume setting, the current actual volume
- must be returned. */
- OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel,
- FALSE otherwise */
-} OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE;
-
-
-/** Audio balance setting */
-typedef struct OMX_AUDIO_CONFIG_BALANCETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's balance. Select the
- output port to adjust the master
- balance. */
- OMX_S32 nBalance; /**< balance setting for this port
- (-100 to 100, where -100 indicates
- all left, and no right */
-} OMX_AUDIO_CONFIG_BALANCETYPE;
-
-
-/** Audio Port mute */
-typedef struct OMX_AUDIO_CONFIG_MUTETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port index indicating which port to
- set. Select the input port to set
- just that port's mute. Select the
- output port to adjust the master
- mute. */
- OMX_BOOL bMute; /**< Mute setting for this port */
-} OMX_AUDIO_CONFIG_MUTETYPE;
-
-
-/** Audio Channel mute */
-typedef struct OMX_AUDIO_CONFIG_CHANNELMUTETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nChannel; /**< channel to select from 0 to N-1,
- using OMX_ALL to apply mute settings
- to all channels */
- OMX_BOOL bMute; /**< Mute setting for this channel */
- OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel,
- FALSE otherwise */
-} OMX_AUDIO_CONFIG_CHANNELMUTETYPE;
-
-
-
-/** Enable / Disable for loudness control, which boosts bass and to a
- * smaller extent high end frequencies to compensate for hearing
- * ability at the extreme ends of the audio spectrum
- */
-typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bLoudness; /**< Enable/disable for loudness */
-} OMX_AUDIO_CONFIG_LOUDNESSTYPE;
-
-
-/** Enable / Disable for bass, which controls low frequencies
- */
-typedef struct OMX_AUDIO_CONFIG_BASSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for bass control */
- OMX_S32 nBass; /**< bass setting for the port, as a
- continuous value from -100 to 100
- (0 means no change in bass level)*/
-} OMX_AUDIO_CONFIG_BASSTYPE;
-
-
-/** Enable / Disable for treble, which controls high frequencies tones
- */
-typedef struct OMX_AUDIO_CONFIG_TREBLETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for treble control */
- OMX_S32 nTreble; /**< treble setting for the port, as a
- continuous value from -100 to 100
- (0 means no change in treble level) */
-} OMX_AUDIO_CONFIG_TREBLETYPE;
-
-
-/** An equalizer is typically used for two reasons: to compensate for an
- * sub-optimal frequency response of a system to make it sound more natural
- * or to create intentionally some unnatural coloring to the sound to create
- * an effect.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_EQUALIZERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for equalizer */
- OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is
- N-1, where N is the number of bands, lower limit is 0 */
- OMX_BU32 sCenterFreq; /**< Center frequecies in Hz. This is a
- read only element and is used to determine
- the lower, center and upper frequency of
- this band. */
- OMX_BS32 sBandLevel; /**< band level in millibels */
-} OMX_AUDIO_CONFIG_EQUALIZERTYPE;
-
-
-/** Stereo widening mode type
- * @ingroup effects
- */
-typedef enum OMX_AUDIO_STEREOWIDENINGTYPE {
- OMX_AUDIO_StereoWideningHeadphones, /**< Stereo widening for loudspeakers */
- OMX_AUDIO_StereoWideningLoudspeakers, /**< Stereo widening for closely spaced loudspeakers */
- OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF
-} OMX_AUDIO_STEREOWIDENINGTYPE;
-
-
-/** Control for stereo widening, which is a special 2-channel
- * case of the audio virtualizer effect. For example, for 5.1-channel
- * output, it translates to virtual surround sound.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for stereo widening control */
- OMX_AUDIO_STEREOWIDENINGTYPE eWideningType; /**< Stereo widening algorithm type */
- OMX_U32 nStereoWidening; /**< stereo widening setting for the port,
- as a continuous value from 0 to 100 */
-} OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE;
-
-
-/** The chorus effect (or ``choralizer'') is any signal processor which makes
- * one sound source (such as a voice) sound like many such sources singing
- * (or playing) in unison. Since performance in unison is never exact, chorus
- * effects simulate this by making independently modified copies of the input
- * signal. Modifications may include (1) delay, (2) frequency shift, and
- * (3) amplitude modulation.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_CHORUSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for chorus */
- OMX_BU32 sDelay; /**< average delay in milliseconds */
- OMX_BU32 sModulationRate; /**< rate of modulation in millihertz */
- OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of
- delay (i.e. 0 to 100) */
- OMX_BU32 nFeedback; /**< Feedback from chorus output to input in percentage */
-} OMX_AUDIO_CONFIG_CHORUSTYPE;
-
-
-/** Reverberation is part of the reflected sound that follows the early
- * reflections. In a typical room, this consists of a dense succession of
- * echoes whose energy decays exponentially. The reverberation effect structure
- * as defined here includes both (early) reflections as well as (late) reverberations.
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bEnable; /**< Enable/disable for reverberation control */
- OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect
- (i.e. both early reflections and late
- reverberation) in millibels */
- OMX_BS32 sRoomHighFreqLevel; /**< Attenuation at high frequencies
- relative to the intensity at low
- frequencies in millibels */
- OMX_BS32 sReflectionsLevel; /**< Intensity level of early reflections
- (relative to room value), in millibels */
- OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative
- to the direct path, in milliseconds */
- OMX_BS32 sReverbLevel; /**< Intensity level of late reverberation
- relative to room level, in millibels */
- OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection
- to the beginning of the late reverberation
- section, in milliseconds */
- OMX_BU32 sDecayTime; /**< Late reverberation decay time at low
- frequencies, in milliseconds */
- OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative
- to low frequency decay time in percent */
- OMX_U32 nDensity; /**< Modal density in the late reverberation decay,
- in percent (i.e. 0 - 100) */
- OMX_U32 nDiffusion; /**< Echo density in the late reverberation decay,
- in percent (i.e. 0 - 100) */
- OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is
- the frequency used as the reference for all
- the high-frequency settings above */
-
-} OMX_AUDIO_CONFIG_REVERBERATIONTYPE;
-
-
-/** Possible settings for the Echo Cancelation structure to use
- * @ingroup effects
- */
-typedef enum OMX_AUDIO_ECHOCANTYPE {
- OMX_AUDIO_EchoCanOff = 0, /**< Echo Cancellation is disabled */
- OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation -
- echo from plastics and face */
- OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for
- Hands Free operation */
- OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for
- Car Kit (longer echo) */
- OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_AUDIO_EchoCanMax = 0x7FFFFFFF
-} OMX_AUDIO_ECHOCANTYPE;
-
-
-/** Enable / Disable for echo cancelation, which removes undesired echo's
- * from the audio
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_AUDIO_ECHOCANTYPE eEchoCancelation; /**< Echo cancelation settings */
-} OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE;
-
-
-/** Enable / Disable for noise reduction, which undesired noise from
- * the audio
- * @ingroup effects
- */
-typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BOOL bNoiseReduction; /**< Enable/disable for noise reduction */
-} OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/mm-core/omxcore/inc/OMX_Component.h b/mm-core/omxcore/inc/OMX_Component.h
deleted file mode 100644
index d5956405..00000000
--- a/mm-core/omxcore/inc/OMX_Component.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Component.h - OpenMax IL version 1.1.2
- * The OMX_Component header file contains the definitions used to define
- * the public interface of a component. This header file is intended to
- * be used by both the application and the component.
- */
-
-#ifndef OMX_Component_h
-#define OMX_Component_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Audio.h>
-#include <OMX_Video.h>
-#include <OMX_Image.h>
-#include <OMX_Other.h>
-
-/** @ingroup comp */
-typedef enum OMX_PORTDOMAINTYPE {
- OMX_PortDomainAudio,
- OMX_PortDomainVideo,
- OMX_PortDomainImage,
- OMX_PortDomainOther,
- OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_PortDomainMax = 0x7ffffff
-} OMX_PORTDOMAINTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port number the structure applies to */
- OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */
- OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */
- OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */
- OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */
- OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by
- OMX_CommandPortEnable/OMX_CommandPortDisable.
- When disabled a port is unpopulated. A disabled port
- is not populated with buffers on a transition to IDLE. */
- OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by
- nBufferCountActual. A disabled port is always unpopulated.
- An enabled port is populated on a transition to OMX_StateIdle
- and unpopulated on a transition to loaded. */
- OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */
- union {
- OMX_AUDIO_PORTDEFINITIONTYPE audio;
- OMX_VIDEO_PORTDEFINITIONTYPE video;
- OMX_IMAGE_PORTDEFINITIONTYPE image;
- OMX_OTHER_PORTDEFINITIONTYPE other;
- } format;
- OMX_BOOL bBuffersContiguous;
- OMX_U32 nBufferAlignment;
-} OMX_PARAM_PORTDEFINITIONTYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_U32TYPE {
- OMX_U32 nSize; /**< Size of this structure, in Bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_U32 nU32; /**< U32 value */
-} OMX_PARAM_U32TYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONPOLICYTYPE {
- OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
- OMX_SuspensionEnabled, /**< Suspension allowed */
- OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_SuspensionPolicyMax = 0x7fffffff
-} OMX_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_SUSPENSIONPOLICYTYPE ePolicy;
-} OMX_PARAM_SUSPENSIONPOLICYTYPE;
-
-/** @ingroup rpm */
-typedef enum OMX_SUSPENSIONTYPE {
- OMX_NotSuspended, /**< component is not suspended */
- OMX_Suspended, /**< component is suspended */
- OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_SuspendMax = 0x7FFFFFFF
-} OMX_SUSPENSIONTYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_PARAM_SUSPENSIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_SUSPENSIONTYPE eType;
-} OMX_PARAM_SUSPENSIONTYPE ;
-
-typedef struct OMX_CONFIG_BOOLEANTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bEnabled;
-} OMX_CONFIG_BOOLEANTYPE;
-
-/* Parameter specifying the content uri to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTURITYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes, including
- actual URI name */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8 contentURI[1]; /**< The URI name */
-} OMX_PARAM_CONTENTURITYPE;
-
-/* Parameter specifying the pipe to use. */
-/** @ingroup cp */
-typedef struct OMX_PARAM_CONTENTPIPETYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_HANDLETYPE hPipe; /**< The pipe handle*/
-} OMX_PARAM_CONTENTPIPETYPE;
-
-/** @ingroup rpm */
-typedef struct OMX_RESOURCECONCEALMENTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment
- methods (like degrading algorithm quality to
- lower resource consumption or functional bypass)
- on a component as a resolution to resource conflicts. */
-} OMX_RESOURCECONCEALMENTTYPE;
-
-
-/** @ingroup metadata */
-typedef enum OMX_METADATACHARSETTYPE {
- OMX_MetadataCharsetUnknown = 0,
- OMX_MetadataCharsetASCII,
- OMX_MetadataCharsetBinary,
- OMX_MetadataCharsetCodePage1252,
- OMX_MetadataCharsetUTF8,
- OMX_MetadataCharsetJavaConformantUTF8,
- OMX_MetadataCharsetUTF7,
- OMX_MetadataCharsetImapUTF7,
- OMX_MetadataCharsetUTF16LE,
- OMX_MetadataCharsetUTF16BE,
- OMX_MetadataCharsetGB12345,
- OMX_MetadataCharsetHZGB2312,
- OMX_MetadataCharsetGB2312,
- OMX_MetadataCharsetGB18030,
- OMX_MetadataCharsetGBK,
- OMX_MetadataCharsetBig5,
- OMX_MetadataCharsetISO88591,
- OMX_MetadataCharsetISO88592,
- OMX_MetadataCharsetISO88593,
- OMX_MetadataCharsetISO88594,
- OMX_MetadataCharsetISO88595,
- OMX_MetadataCharsetISO88596,
- OMX_MetadataCharsetISO88597,
- OMX_MetadataCharsetISO88598,
- OMX_MetadataCharsetISO88599,
- OMX_MetadataCharsetISO885910,
- OMX_MetadataCharsetISO885913,
- OMX_MetadataCharsetISO885914,
- OMX_MetadataCharsetISO885915,
- OMX_MetadataCharsetShiftJIS,
- OMX_MetadataCharsetISO2022JP,
- OMX_MetadataCharsetISO2022JP1,
- OMX_MetadataCharsetISOEUCJP,
- OMX_MetadataCharsetSMS7Bit,
- OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
-} OMX_METADATACHARSETTYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASCOPETYPE
-{
- OMX_MetadataScopeAllLevels,
- OMX_MetadataScopeTopLevel,
- OMX_MetadataScopePortLevel,
- OMX_MetadataScopeNodeLevel,
- OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataScopeTypeMax = 0x7fffffff
-} OMX_METADATASCOPETYPE;
-
-/** @ingroup metadata */
-typedef enum OMX_METADATASEARCHMODETYPE
-{
- OMX_MetadataSearchValueSizeByIndex,
- OMX_MetadataSearchItemByIndex,
- OMX_MetadataSearchNextItemByKey,
- OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MetadataSearchTypeMax = 0x7fffffff
-} OMX_METADATASEARCHMODETYPE;
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_METADATASCOPETYPE eScopeMode;
- OMX_U32 nScopeSpecifier;
- OMX_U32 nMetadataItemCount;
-} OMX_CONFIG_METADATAITEMCOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_METADATAITEMTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_METADATASCOPETYPE eScopeMode;
- OMX_U32 nScopeSpecifier;
- OMX_U32 nMetadataItemIndex;
- OMX_METADATASEARCHMODETYPE eSearchMode;
- OMX_METADATACHARSETTYPE eKeyCharset;
- OMX_U8 nKeySizeUsed;
- OMX_U8 nKey[128];
- OMX_METADATACHARSETTYPE eValueCharset;
- OMX_STRING sLanguageCountry;
- OMX_U32 nValueMaxSize;
- OMX_U32 nValueSizeUsed;
- OMX_U8 nValue[1];
-} OMX_CONFIG_METADATAITEMTYPE;
-
-/* @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys;
- OMX_U32 nParentNodeID;
- OMX_U32 nNumNodes;
-} OMX_CONFIG_CONTAINERNODECOUNTTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys;
- OMX_U32 nParentNodeID;
- OMX_U32 nNodeIndex;
- OMX_U32 nNodeID;
- OMX_STRING cNodeName;
- OMX_BOOL bIsLeafType;
-} OMX_CONFIG_CONTAINERNODEIDTYPE;
-
-/** @ingroup metadata */
-typedef struct OMX_PARAM_METADATAFILTERTYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and
- * the three key fields below are ignored */
- OMX_METADATACHARSETTYPE eKeyCharset;
- OMX_U32 nKeySizeUsed;
- OMX_U8 nKey [128];
- OMX_U32 nLanguageCountrySizeUsed;
- OMX_U8 nLanguageCountry[128];
- OMX_BOOL bEnabled; /* if true then key is part of filter (e.g.
- * retained for query later). If false then
- * key is not part of filter */
-} OMX_PARAM_METADATAFILTERTYPE;
-
-/** The OMX_HANDLETYPE structure defines the component handle. The component
- * handle is used to access all of the component's public methods and also
- * contains pointers to the component's private data area. The component
- * handle is initialized by the OMX core (with help from the component)
- * during the process of loading the component. After the component is
- * successfully loaded, the application can safely access any of the
- * component's public functions (although some may return an error because
- * the state is inappropriate for the access).
- *
- * @ingroup comp
- */
-typedef struct OMX_COMPONENTTYPE
-{
- /** The size of this structure, in bytes. It is the responsibility
- of the allocator of this structure to fill in this value. Since
- this structure is allocated by the GetHandle function, this
- function will fill in this value. */
- OMX_U32 nSize;
-
- /** nVersion is the version of the OMX specification that the structure
- is built against. It is the responsibility of the creator of this
- structure to initialize this value and every user of this structure
- should verify that it knows how to use the exact version of
- this structure found herein. */
- OMX_VERSIONTYPE nVersion;
-
- /** pComponentPrivate is a pointer to the component private data area.
- This member is allocated and initialized by the component when the
- component is first loaded. The application should not access this
- data area. */
- OMX_PTR pComponentPrivate;
-
- /** pApplicationPrivate is a pointer that is a parameter to the
- OMX_GetHandle method, and contains an application private value
- provided by the IL client. This application private data is
- returned to the IL Client by OMX in all callbacks */
- OMX_PTR pApplicationPrivate;
-
- /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL
- specification for details on the GetComponentVersion method.
- */
- OMX_ERRORTYPE (*GetComponentVersion)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STRING pComponentName,
- OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
- OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
- OMX_OUT OMX_UUIDTYPE* pComponentUUID);
-
- /** refer to OMX_SendCommand in OMX_core.h or the OMX IL
- specification for details on the SendCommand method.
- */
- OMX_ERRORTYPE (*SendCommand)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_COMMANDTYPE Cmd,
- OMX_IN OMX_U32 nParam1,
- OMX_IN OMX_PTR pCmdData);
-
- /** refer to OMX_GetParameter in OMX_core.h or the OMX IL
- specification for details on the GetParameter method.
- */
- OMX_ERRORTYPE (*GetParameter)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nParamIndex,
- OMX_INOUT OMX_PTR pComponentParameterStructure);
-
-
- /** refer to OMX_SetParameter in OMX_core.h or the OMX IL
- specification for details on the SetParameter method.
- */
- OMX_ERRORTYPE (*SetParameter)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentParameterStructure);
-
-
- /** refer to OMX_GetConfig in OMX_core.h or the OMX IL
- specification for details on the GetConfig method.
- */
- OMX_ERRORTYPE (*GetConfig)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_INOUT OMX_PTR pComponentConfigStructure);
-
-
- /** refer to OMX_SetConfig in OMX_core.h or the OMX IL
- specification for details on the SetConfig method.
- */
- OMX_ERRORTYPE (*SetConfig)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_INDEXTYPE nIndex,
- OMX_IN OMX_PTR pComponentConfigStructure);
-
-
- /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL
- specification for details on the GetExtensionIndex method.
- */
- OMX_ERRORTYPE (*GetExtensionIndex)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_STRING cParameterName,
- OMX_OUT OMX_INDEXTYPE* pIndexType);
-
-
- /** refer to OMX_GetState in OMX_core.h or the OMX IL
- specification for details on the GetState method.
- */
- OMX_ERRORTYPE (*GetState)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_STATETYPE* pState);
-
-
- /** The ComponentTunnelRequest method will interact with another OMX
- component to determine if tunneling is possible and to setup the
- tunneling. The return codes for this method can be used to
- determine if tunneling is not possible, or if tunneling is not
- supported.
-
- Base profile components (i.e. non-interop) do not support this
- method and should return OMX_ErrorNotImplemented
-
- The interop profile component MUST support tunneling to another
- interop profile component with a compatible port parameters.
- A component may also support proprietary communication.
-
- If proprietary communication is supported the negotiation of
- proprietary communication is done outside of OMX in a vendor
- specific way. It is only required that the proper result be
- returned and the details of how the setup is done is left
- to the component implementation.
-
- When this method is invoked when nPort in an output port, the
- component will:
- 1. Populate the pTunnelSetup structure with the output port's
- requirements and constraints for the tunnel.
-
- When this method is invoked when nPort in an input port, the
- component will:
- 1. Query the necessary parameters from the output port to
- determine if the ports are compatible for tunneling
- 2. If the ports are compatible, the component should store
- the tunnel step provided by the output port
- 3. Determine which port (either input or output) is the buffer
- supplier, and call OMX_SetParameter on the output port to
- indicate this selection.
-
- The component will return from this call within 5 msec.
-
- @param [in] hComp
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle method.
- @param [in] nPort
- nPort is used to select the port on the component to be used
- for tunneling.
- @param [in] hTunneledComp
- Handle of the component to tunnel with. This is the component
- handle returned by the call to the OMX_GetHandle method. When
- this parameter is 0x0 the component should setup the port for
- communication with the application / IL Client.
- @param [in] nPortOutput
- nPortOutput is used indicate the port the component should
- tunnel with.
- @param [in] pTunnelSetup
- Pointer to the tunnel setup structure. When nPort is an output port
- the component should populate the fields of this structure. When
- When nPort is an input port the component should review the setup
- provided by the component with the output port.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup tun
- */
-
- OMX_ERRORTYPE (*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);
-
- /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL
- specification for details on the UseBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*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);
-
- /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL
- specification for details on the AllocateBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*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);
-
- /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL
- specification for details on the FreeBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FreeBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL
- specification for details on the EmptyThisBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*EmptyThisBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL
- specification for details on the FillThisBuffer method.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FillThisBuffer)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** The SetCallbacks method is used by the core to specify the callback
- structure from the application to the component. This is a blocking
- call. The component will return from this call within 5 msec.
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @param [in] pCallbacks
- pointer to an OMX_CALLBACKTYPE structure used to provide the
- callback information to the component
- @param [in] pAppData
- pointer to an application defined value. It is anticipated that
- the application will pass a pointer to a data structure or a "this
- pointer" in this area to allow the callback (in the application)
- to determine the context of the call
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- */
- OMX_ERRORTYPE (*SetCallbacks)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_CALLBACKTYPE* pCallbacks,
- OMX_IN OMX_PTR pAppData);
-
- /** ComponentDeInit method is used to deinitialize the component
- providing a means to free any resources allocated at component
- initialization. NOTE: After this call the component handle is
- not valid for further use.
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- */
- OMX_ERRORTYPE (*ComponentDeInit)(
- OMX_IN OMX_HANDLETYPE hComponent);
-
- /** @ingroup buf */
- OMX_ERRORTYPE (*UseEGLImage)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
- OMX_IN OMX_U32 nPortIndex,
- OMX_IN OMX_PTR pAppPrivate,
- OMX_IN void* eglImage);
-
- OMX_ERRORTYPE (*ComponentRoleEnum)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_U8 *cRole,
- OMX_IN OMX_U32 nIndex);
-
-} OMX_COMPONENTTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_ContentPipe.h b/mm-core/omxcore/inc/OMX_ContentPipe.h
deleted file mode 100644
index 5f6310c2..00000000
--- a/mm-core/omxcore/inc/OMX_ContentPipe.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_ContentPipe.h - OpenMax IL version 1.1.2
- * The OMX_ContentPipe header file contains the definitions used to define
- * the public interface for content piples. This header file is intended to
- * be used by the component.
- */
-
-#ifndef OMX_CONTENTPIPE_H
-#define OMX_CONTENTPIPE_H
-
-#ifndef KD_EACCES
-/* OpenKODE error codes. CPResult values may be zero (indicating success
- or one of the following values) */
-#define KD_EACCES (1)
-#define KD_EADDRINUSE (2)
-#define KD_EAGAIN (5)
-#define KD_EBADF (7)
-#define KD_EBUSY (8)
-#define KD_ECONNREFUSED (9)
-#define KD_ECONNRESET (10)
-#define KD_EDEADLK (11)
-#define KD_EDESTADDRREQ (12)
-#define KD_ERANGE (35)
-#define KD_EEXIST (13)
-#define KD_EFBIG (14)
-#define KD_EHOSTUNREACH (15)
-#define KD_EINVAL (17)
-#define KD_EIO (18)
-#define KD_EISCONN (20)
-#define KD_EISDIR (21)
-#define KD_EMFILE (22)
-#define KD_ENAMETOOLONG (23)
-#define KD_ENOENT (24)
-#define KD_ENOMEM (25)
-#define KD_ENOSPC (26)
-#define KD_ENOSYS (27)
-#define KD_ENOTCONN (28)
-#define KD_EPERM (33)
-#define KD_ETIMEDOUT (36)
-#define KD_EILSEQ (19)
-#endif
-
-/** Map types from OMX standard types only here so interface is as generic as possible. */
-typedef OMX_U32 CPresult;
-typedef char * CPstring;
-typedef void * CPhandle;
-typedef OMX_U32 CPuint;
-typedef OMX_S32 CPint;
-typedef char CPbyte;
-typedef OMX_BOOL CPbool;
-
-/** enumeration of origin types used in the CP_PIPETYPE's Seek function
- * @ingroup cp
- */
-typedef enum CP_ORIGINTYPE {
- CP_OriginBegin,
- CP_OriginCur,
- CP_OriginEnd,
- CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_OriginMax = 0X7FFFFFFF
-} CP_ORIGINTYPE;
-
-/** enumeration of contact access types used in the CP_PIPETYPE's Open function
- * @ingroup cp
- */
-typedef enum CP_ACCESSTYPE {
- CP_AccessRead,
- CP_AccessWrite,
- CP_AccessReadWrite ,
- CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_AccessMax = 0X7FFFFFFF
-} CP_ACCESSTYPE;
-
-/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function
- * @ingroup cp
- */
-typedef enum CP_CHECKBYTESRESULTTYPE
-{
- CP_CheckBytesOk, /**< There are at least the request number
- of bytes available */
- CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes
- and presently lacks sufficient bytes.
- Client will be called when they are
- sufficient bytes are available. */
- CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes
- but those available are less than those
- requested */
- CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream
- and no more bytes are available. */
- CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */
- CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_CheckBytesMax = 0X7FFFFFFF
-} CP_CHECKBYTESRESULTTYPE;
-
-/** enumeration of content pipe events sent to the client callback.
- * @ingroup cp
- */
-typedef enum CP_EVENTTYPE{
- CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/
- CP_Overflow, /** enumeration of content pipe events sent to the client callback*/
- CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/
- CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- CP_EventMax = 0X7FFFFFFF
-} CP_EVENTTYPE;
-
-/** content pipe definition
- * @ingroup cp
- */
-typedef struct CP_PIPETYPE
-{
- /** Open a content stream for reading or writing. */
- CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess );
-
- /** Close a content stream. */
- CPresult (*Close)( CPhandle hContent );
-
- /** Create a content source and open it for writing. */
- CPresult (*Create)( CPhandle *hContent, CPstring szURI );
-
- /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/
- CPresult (*CheckAvailableBytes)( CPhandle hContent, CPuint nBytesRequested, CP_CHECKBYTESRESULTTYPE *eResult );
-
- /** Seek to certain position in the content relative to the specified origin. */
- CPresult (*SetPosition)( CPhandle hContent, CPint nOffset, CP_ORIGINTYPE eOrigin);
-
- /** Retrieve the current position relative to the start of the content. */
- CPresult (*GetPosition)( CPhandle hContent, CPuint *pPosition);
-
- /** Retrieve data of the specified size from the content stream (advance content pointer by size of data).
- Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */
- CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize);
-
- /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes.
- Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also
- returns the size of the block actually read. Content pointer advances the by the returned size.
- Note: pipe provides pointer. This function is appropriate for large reads. The client must call
- ReleaseReadBuffer when done with buffer.
-
- In some cases the requested block may not reside in contiguous memory within the
- pipe implementation. For instance if the pipe leverages a circular buffer then the requested
- block may straddle the boundary of the circular buffer. By default a pipe implementation
- performs a copy in this case to provide the block to the pipe client in one contiguous buffer.
- If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory
- boundary. Here the client may retrieve the data in segments over successive calls. */
- CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy);
-
- /** Release a buffer obtained by ReadBuffer back to the pipe. */
- CPresult (*ReleaseReadBuffer)(CPhandle hContent, CPbyte *pBuffer);
-
- /** Write data of the specified size to the content (advance content pointer by size of data).
- Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */
- CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize);
-
- /** Retrieve a buffer allocated by the pipe used to write data to the content.
- Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate
- for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/
- CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize);
-
- /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the
- the contents of the buffer to content and advance content pointer by the size of the buffer */
- CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize);
-
- /** Register a per-handle client callback with the content pipe. */
- CPresult (*RegisterCallback)( CPhandle hContent, CPresult (*ClientCallback)(CP_EVENTTYPE eEvent, CPuint iParam));
-
-} CP_PIPETYPE;
-
-#endif
-
diff --git a/mm-core/omxcore/inc/OMX_Core.h b/mm-core/omxcore/inc/OMX_Core.h
deleted file mode 100644
index a076f2f4..00000000
--- a/mm-core/omxcore/inc/OMX_Core.h
+++ /dev/null
@@ -1,1431 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Core.h - OpenMax IL version 1.1.2
- * The OMX_Core header file contains the definitions used by both the
- * application and the component to access common items.
- */
-
-#ifndef OMX_Core_h
-#define OMX_Core_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header shall include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Index.h>
-
-
-/** The OMX_COMMANDTYPE enumeration is used to specify the action in the
- * OMX_SendCommand macro.
- * @ingroup core
- */
-typedef enum OMX_COMMANDTYPE
-{
- OMX_CommandStateSet, /**< Change the component state */
- OMX_CommandFlush, /**< Flush the data queue(s) of a component */
- OMX_CommandPortDisable, /**< Disable a port on a component. */
- OMX_CommandPortEnable, /**< Enable a port on a component. */
- OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */
- OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_CommandMax = 0X7FFFFFFF
-} OMX_COMMANDTYPE;
-
-
-
-/** The OMX_STATETYPE enumeration is used to indicate or change the component
- * state. This enumeration reflects the current state of the component when
- * used with the OMX_GetState macro or becomes the parameter in a state change
- * command when used with the OMX_SendCommand macro.
- *
- * The component will be in the Loaded state after the component is initially
- * loaded into memory. In the Loaded state, the component is not allowed to
- * allocate or hold resources other than to build it's internal parameter
- * and configuration tables. The application will send one or more
- * SetParameters/GetParameters and SetConfig/GetConfig commands to the
- * component and the component will record each of these parameter and
- * configuration changes for use later. When the application sends the
- * Idle command, the component will acquire the resources needed for the
- * specified configuration and will transition to the idle state if the
- * allocation is successful. If the component cannot successfully
- * transition to the idle state for any reason, the state of the component
- * shall be fully rolled back to the Loaded state (e.g. all allocated
- * resources shall be released). When the component receives the command
- * to go to the Executing state, it shall begin processing buffers by
- * sending all input buffers it holds to the application. While
- * the component is in the Idle state, the application may also send the
- * Pause command. If the component receives the pause command while in the
- * Idle state, the component shall send all input buffers it holds to the
- * application, but shall not begin processing buffers. This will allow the
- * application to prefill buffers.
- *
- * @ingroup comp
- */
-
-typedef enum OMX_STATETYPE
-{
- OMX_StateInvalid, /**< component has detected that it's internal data
- structures are corrupted to the point that
- it cannot determine it's state properly */
- OMX_StateLoaded, /**< component has been loaded but has not completed
- initialization. The OMX_SetParameter macro
- and the OMX_GetParameter macro are the only
- valid macros allowed to be sent to the
- component in this state. */
- OMX_StateIdle, /**< component initialization has been completed
- successfully and the component is ready to
- to start. */
- OMX_StateExecuting, /**< component has accepted the start command and
- is processing data (if data is available) */
- OMX_StatePause, /**< component has received pause command */
- OMX_StateWaitForResources, /**< component is waiting for resources, either after
- preemption or before it gets the resources requested.
- See specification for complete details. */
- OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_StateMax = 0X7FFFFFFF
-} OMX_STATETYPE;
-
-/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These
- * errors should cover most of the common failure cases. However,
- * vendors are free to add additional error messages of their own as
- * long as they follow these rules:
- * 1. Vendor error messages shall be in the range of 0x90000000 to
- * 0x9000FFFF.
- * 2. Vendor error messages shall be defined in a header file provided
- * with the component. No error messages are allowed that are
- * not defined.
- */
-typedef enum OMX_ERRORTYPE
-{
- OMX_ErrorNone = 0,
-
- /** There were insufficient resources to perform the requested operation */
- OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000,
-
- /** There was an error, but the cause of the error could not be determined */
- OMX_ErrorUndefined = (OMX_S32) 0x80001001,
-
- /** The component name string was not valid */
- OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002,
-
- /** No component with the specified name string was found */
- OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003,
-
- /** The component specified did not have a "OMX_ComponentInit" or
- "OMX_ComponentDeInit entry point */
- OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004,
-
- /** One or more parameters were not valid */
- OMX_ErrorBadParameter = (OMX_S32) 0x80001005,
-
- /** The requested function is not implemented */
- OMX_ErrorNotImplemented = (OMX_S32) 0x80001006,
-
- /** The buffer was emptied before the next buffer was ready */
- OMX_ErrorUnderflow = (OMX_S32) 0x80001007,
-
- /** The buffer was not available when it was needed */
- OMX_ErrorOverflow = (OMX_S32) 0x80001008,
-
- /** The hardware failed to respond as expected */
- OMX_ErrorHardware = (OMX_S32) 0x80001009,
-
- /** The component is in the state OMX_StateInvalid */
- OMX_ErrorInvalidState = (OMX_S32) 0x8000100A,
-
- /** Stream is found to be corrupt */
- OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B,
-
- /** Ports being connected are not compatible */
- OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C,
-
- /** Resources allocated to an idle component have been
- lost resulting in the component returning to the loaded state */
- OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D,
-
- /** No more indicies can be enumerated */
- OMX_ErrorNoMore = (OMX_S32) 0x8000100E,
-
- /** The component detected a version mismatch */
- OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F,
-
- /** The component is not ready to return data at this time */
- OMX_ErrorNotReady = (OMX_S32) 0x80001010,
-
- /** There was a timeout that occurred */
- OMX_ErrorTimeout = (OMX_S32) 0x80001011,
-
- /** This error occurs when trying to transition into the state you are already in */
- OMX_ErrorSameState = (OMX_S32) 0x80001012,
-
- /** Resources allocated to an executing or paused component have been
- preempted, causing the component to return to the idle state */
- OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013,
-
- /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
- during the allocation of buffers (on a transition from the LOADED to the IDLE state or
- on a port restart) when it deems that it has waited an unusually long time for the supplier
- to send it an allocated buffer via a UseBuffer call. */
- OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014,
-
- /** A non-supplier port sends this error to the IL client (via the EventHandler callback)
- during the deallocation of buffers (on a transition from the IDLE to LOADED state or
- on a port stop) when it deems that it has waited an unusually long time for the supplier
- to request the deallocation of a buffer header via a FreeBuffer call. */
- OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015,
-
- /** A supplier port sends this error to the IL client (via the EventHandler callback)
- during the stopping of a port (either on a transition from the IDLE to LOADED
- state or a port stop) when it deems that it has waited an unusually long time for
- the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */
- OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016,
-
- /** Attempting a state transtion that is not allowed */
- OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017,
-
- /* Attempting a command that is not allowed during the present state. */
- OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018,
-
- /** The values encapsulated in the parameter or config structure are not supported. */
- OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019,
-
- /** The parameter or config indicated by the given index is not supported. */
- OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A,
-
- /** The port index supplied is incorrect. */
- OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B,
-
- /** The port has lost one or more of its buffers and it thus unpopulated. */
- OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C,
-
- /** Component suspended due to temporary loss of resources */
- OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D,
-
- /** Component suspended due to an inability to acquire dynamic resources */
- OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E,
-
- /** When the macroblock error reporting is enabled the component returns new error
- for every frame that has errors */
- OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F,
-
- /** A component reports this error when it cannot parse or determine the format of an input stream. */
- OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020,
-
- /** The content open operation failed. */
- OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021,
-
- /** The content creation operation failed. */
- OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022,
-
- /** Separate table information is being used */
- OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023,
-
- /** Tunneling is unsupported by the component*/
- OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024,
-
- OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ErrorMax = 0x7FFFFFFF
-} OMX_ERRORTYPE;
-
-/** @ingroup core */
-typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent);
-
-/** @ingroup core */
-typedef struct OMX_COMPONENTREGISTERTYPE
-{
- const char * pName; /* Component name, 128 byte limit (including '\0') applies */
- OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */
-} OMX_COMPONENTREGISTERTYPE;
-
-/** @ingroup core */
-extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[];
-
-/** @ingroup rpm */
-typedef struct OMX_PRIORITYMGMTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nGroupPriority; /**< Priority of the component group */
- OMX_U32 nGroupID; /**< ID of the component group */
-} OMX_PRIORITYMGMTTYPE;
-
-/* Component name and Role names are limited to 128 characters including the terminating '\0'. */
-#define OMX_MAX_STRINGNAME_SIZE 128
-
-/** @ingroup comp */
-typedef struct OMX_PARAM_COMPONENTROLETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */
-} OMX_PARAM_COMPONENTROLETYPE;
-
-/** End of Stream Buffer Flag:
- *
- * A component sets EOS when it has no more data to emit on a particular
- * output port. Thus an output port shall set EOS on the last buffer it
- * emits. A component's determination of when an output port should
- * cease sending data is implemenation specific.
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_EOS 0x00000001
-
-/** Start Time Buffer Flag:
- *
- * The source of a stream (e.g. a demux component) sets the STARTTIME
- * flag on the buffer that contains the starting timestamp for the
- * stream. The starting timestamp corresponds to the first data that
- * should be displayed at startup or after a seek.
- * The first timestamp of the stream is not necessarily the start time.
- * For instance, in the case of a seek to a particular video frame,
- * the target frame may be an interframe. Thus the first buffer of
- * the stream will be the intra-frame preceding the target frame and
- * the starttime will occur with the target frame (with any other
- * required frames required to reconstruct the target intervening).
- *
- * The STARTTIME flag is directly associated with the buffer's
- * timestamp ' thus its association to buffer data and its
- * propagation is identical to the timestamp's.
- *
- * When a Sync Component client receives a buffer with the
- * STARTTIME flag it shall perform a SetConfig on its sync port
- * using OMX_ConfigTimeClientStartTime and passing the buffer's
- * timestamp.
- *
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_STARTTIME 0x00000002
-
-
-
-/** Decode Only Buffer Flag:
- *
- * The source of a stream (e.g. a demux component) sets the DECODEONLY
- * flag on any buffer that should shall be decoded but should not be
- * displayed. This flag is used, for instance, when a source seeks to
- * a target interframe that requires the decode of frames preceding the
- * target to facilitate the target's reconstruction. In this case the
- * source would emit the frames preceding the target downstream
- * but mark them as decode only.
- *
- * The DECODEONLY is associated with buffer data and propagated in a
- * manner identical to the buffer timestamp.
- *
- * A component that renders data should ignore all buffers with
- * the DECODEONLY flag set.
- *
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DECODEONLY 0x00000004
-
-
-/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt
- * @ingroup buf
- */
-
-#define OMX_BUFFERFLAG_DATACORRUPT 0x00000008
-
-/* End of Frame: The buffer contains exactly one end of frame and no data
- * occurs after the end of frame. This flag is an optional hint. The absence
- * of this flag does not imply the absence of an end of frame within the buffer.
- * @ingroup buf
-*/
-#define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010
-
-/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame '
- * a frame that has no dependency on any other frame information
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_SYNCFRAME 0x00000020
-
-/* Extra data present flag: there is extra data appended to the data stream
- * residing in the buffer
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_EXTRADATA 0x00000040
-
-/** Codec Config Buffer Flag:
-* OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an
-* output port when all bytes in the buffer form part or all of a set of
-* codec specific configuration data. Examples include SPS/PPS nal units
-* for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for
-* OMX_AUDIO_CodingAAC. Any component that for a given stream sets
-* OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes
-* with frame data in the same buffer, and shall send all buffers
-* containing codec configuration bytes before any buffers containing
-* frame data that those configurations bytes describe.
-* If the stream format for a particular codec has a frame specific
-* header at the start of each frame, for example OMX_AUDIO_CodingMP3 or
-* OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as
-* normal without setting OMX_BUFFERFLAG_CODECCONFIG.
- * @ingroup buf
- */
-#define OMX_BUFFERFLAG_CODECCONFIG 0x00000080
-
-
-
-/** @ingroup buf */
-typedef struct OMX_BUFFERHEADERTYPE
-{
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U8* pBuffer; /**< Pointer to actual block of memory
- that is acting as the buffer */
- OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */
- OMX_U32 nFilledLen; /**< number of bytes currently in the
- buffer */
- OMX_U32 nOffset; /**< start offset of valid data in bytes from
- the start of the buffer */
- OMX_PTR pAppPrivate; /**< pointer to any data the application
- wants to associate with this buffer */
- OMX_PTR pPlatformPrivate; /**< pointer to any data the platform
- wants to associate with this buffer */
- OMX_PTR pInputPortPrivate; /**< pointer to any data the input port
- wants to associate with this buffer */
- OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port
- wants to associate with this buffer */
- OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a
- mark event upon processing this buffer. */
- OMX_PTR pMarkData; /**< Application specific data associated with
- the mark sent on a mark event to disambiguate
- this mark from others. */
- OMX_U32 nTickCount; /**< Optional entry that the component and
- application can update with a tick count
- when they access the component. This
- value should be in microseconds. Since
- this is a value relative to an arbitrary
- starting point, this value cannot be used
- to determine absolute time. This is an
- optional entry and not all components
- will update it.*/
- OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample
- starting at the first logical sample
- boundary in the buffer. Timestamps of
- successive samples within the buffer may
- be inferred by adding the duration of the
- of the preceding buffer to the timestamp
- of the preceding buffer.*/
- OMX_U32 nFlags; /**< buffer specific flags */
- OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using
- this buffer */
- OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using
- this buffer */
-} OMX_BUFFERHEADERTYPE;
-
-/** The OMX_EXTRADATATYPE enumeration is used to define the
- * possible extra data payload types.
- * NB: this enum is binary backwards compatible with the previous
- * OMX_EXTRADATA_QUANT define. This should be replaced with
- * OMX_ExtraDataQuantization.
- */
-typedef enum OMX_EXTRADATATYPE
-{
- OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */
- OMX_ExtraDataQuantization, /**< The data payload contains quantization data */
- OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ExtraDataMax = 0x7FFFFFFF
-} OMX_EXTRADATATYPE;
-
-
-typedef struct OMX_OTHER_EXTRADATATYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_EXTRADATATYPE eType; /* Extra Data type */
- OMX_U32 nDataSize; /* Size of the supporting data to follow */
- OMX_U8 data[1]; /* Supporting data hint */
-} OMX_OTHER_EXTRADATATYPE;
-
-/** @ingroup comp */
-typedef struct OMX_PORT_PARAM_TYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPorts; /**< The number of ports for this component */
- OMX_U32 nStartPortNumber; /** first port number for this type of port */
-} OMX_PORT_PARAM_TYPE;
-
-/** @ingroup comp */
-typedef enum OMX_EVENTTYPE
-{
- OMX_EventCmdComplete, /**< component has sucessfully completed a command */
- OMX_EventError, /**< component has detected an error condition */
- OMX_EventMark, /**< component has detected a buffer mark */
- OMX_EventPortSettingsChanged, /**< component is reported a port settings change */
- OMX_EventBufferFlag, /**< component has detected an EOS */
- OMX_EventResourcesAcquired, /**< component has been granted resources and is
- automatically starting the state change from
- OMX_StateWaitForResources to OMX_StateIdle. */
- OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */
- OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */
- OMX_EventPortFormatDetected, /**< Component has detected a supported format. */
- OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EventMax = 0x7FFFFFFF
-} OMX_EVENTTYPE;
-
-typedef struct OMX_CALLBACKTYPE
-{
- /** The EventHandler method is used to notify the application when an
- event of interest occurs. Events are defined in the OMX_EVENTTYPE
- enumeration. Please see that enumeration for details of what will
- be returned for each type of event. Callbacks should not return
- an error to the component, so if an error occurs, the application
- shall handle it internally. This is a blocking call.
-
- The application should return from this call within 5 msec to avoid
- blocking the component for an excessively long period of time.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param eEvent
- Event that the component wants to notify the application about.
- @param nData1
- nData will be the OMX_ERRORTYPE for an error event and will be
- an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event.
- @param nData2
- nData2 will hold further information related to the event. Can be OMX_STATETYPE for
- a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event.
- Default value is 0 if not used. )
- @param pEventData
- Pointer to additional event-specific data (see spec for meaning).
- */
-
- OMX_ERRORTYPE (*EventHandler)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1,
- OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData);
-
- /** The EmptyBufferDone method is used to return emptied buffers from an
- input port back to the application for reuse. This is a blocking call
- so the application should not attempt to refill the buffers during this
- call, but should queue them and refill them in another thread. There
- is no error return, so the application shall handle any errors generated
- internally.
-
- The application should return from this call within 5 msec.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer indicating the buffer that was emptied.
- @ingroup buf
- */
- OMX_ERRORTYPE (*EmptyBufferDone)(
- OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-
- /** The FillBufferDone method is used to return filled buffers from an
- output port back to the application for emptying and then reuse.
- This is a blocking call so the application should not attempt to
- empty the buffers during this call, but should queue the buffers
- and empty them in another thread. There is no error return, so
- the application shall handle any errors generated internally. The
- application shall also update the buffer header to indicate the
- number of bytes placed into the buffer.
-
- The application should return from this call within 5 msec.
-
- @param hComponent
- handle of the component to access. This is the component
- handle returned by the call to the GetHandle function.
- @param pAppData
- pointer to an application defined value that was provided in the
- pAppData parameter to the OMX_GetHandle method for the component.
- This application defined value is provided so that the application
- can have a component specific context when receiving the callback.
- @param pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer indicating the buffer that was filled.
- @ingroup buf
- */
- OMX_ERRORTYPE (*FillBufferDone)(
- OMX_OUT OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_PTR pAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
-
-} OMX_CALLBACKTYPE;
-
-/** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier
- preference when tunneling between two ports.
- @ingroup tun buf
-*/
-typedef enum OMX_BUFFERSUPPLIERTYPE
-{
- OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified,
- or don't care */
- OMX_BufferSupplyInput, /**< input port supplies the buffers */
- OMX_BufferSupplyOutput, /**< output port supplies the buffers */
- OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_BufferSupplyMax = 0x7FFFFFFF
-} OMX_BUFFERSUPPLIERTYPE;
-
-
-/** buffer supplier parameter
- * @ingroup tun
- */
-typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */
-} OMX_PARAM_BUFFERSUPPLIERTYPE;
-
-
-/**< indicates that buffers received by an input port of a tunnel
- may not modify the data in the buffers
- @ingroup tun
- */
-#define OMX_PORTTUNNELFLAG_READONLY 0x00000001
-
-
-/** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output
- port to an input port as part the two ComponentTunnelRequest calls
- resulting from a OMX_SetupTunnel call from the IL Client.
- @ingroup tun
- */
-typedef struct OMX_TUNNELSETUPTYPE
-{
- OMX_U32 nTunnelFlags; /**< bit flags for tunneling */
- OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */
-} OMX_TUNNELSETUPTYPE;
-
-/* OMX Component headers is included to enable the core to use
- macros for functions into the component for OMX release 1.0.
- Developers should not access any structures or data from within
- the component header directly */
-/* TO BE REMOVED - #include <OMX_Component.h> */
-
-/** GetComponentVersion will return information about the component.
- This is a blocking call. This macro will go directly from the
- application to the component (via a core macro). The
- component will return from this call within 5 msec.
- @param [in] hComponent
- handle of component to execute the command
- @param [out] pComponentName
- pointer to an empty string of length 128 bytes. The component
- will write its name into this string. The name will be
- terminated by a single zero byte. The name of a component will
- be 127 bytes or less to leave room for the trailing zero byte.
- An example of a valid component name is "OMX.ABC.ChannelMixer\0".
- @param [out] pComponentVersion
- pointer to an OMX Version structure that the component will fill
- in. The component will fill in a value that indicates the
- component version. NOTE: the component version is NOT the same
- as the OMX Specification version (found in all structures). The
- component version is defined by the vendor of the component and
- its value is entirely up to the component vendor.
- @param [out] pSpecVersion
- pointer to an OMX Version structure that the component will fill
- in. The SpecVersion is the version of the specification that the
- component was built against. Please note that this value may or
- may not match the structure's version. For example, if the
- component was built against the 2.0 specification, but the
- application (which creates the structure is built against the
- 1.0 specification the versions would be different.
- @param [out] pComponentUUID
- pointer to the UUID of the component which will be filled in by
- the component. The UUID is a unique identifier that is set at
- RUN time for the component and is unique to each instantion of
- the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetComponentVersion( \
- hComponent, \
- pComponentName, \
- pComponentVersion, \
- pSpecVersion, \
- pComponentUUID) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion( \
- hComponent, \
- pComponentName, \
- pComponentVersion, \
- pSpecVersion, \
- pComponentUUID) /* Macro End */
-
-
-/** Send a command to the component. This call is a non-blocking call.
- The component should check the parameters and then queue the command
- to the component thread to be executed. The component thread shall
- send the EventHandler() callback at the conclusion of the command.
- This macro will go directly from the application to the component (via
- a core macro). The component will return from this call within 5 msec.
-
- When the command is "OMX_CommandStateSet" the component will queue a
- state transition to the new state idenfied in nParam.
-
- When the command is "OMX_CommandFlush", to flush a port's buffer queues,
- the command will force the component to return all buffers NOT CURRENTLY
- BEING PROCESSED to the application, in the order in which the buffers
- were received.
-
- When the command is "OMX_CommandPortDisable" or
- "OMX_CommandPortEnable", the component's port (given by the value of
- nParam) will be stopped or restarted.
-
- When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the
- pCmdData will point to a OMX_MARKTYPE structure containing the component
- handle of the component to examine the buffer chain for the mark. nParam1
- contains the index of the port on which the buffer mark is applied.
-
- Specification text for more details.
-
- @param [in] hComponent
- handle of component to execute the command
- @param [in] Cmd
- Command for the component to execute
- @param [in] nParam
- Parameter for the command to be executed. When Cmd has the value
- OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has
- the value OMX_CommandFlush, value of nParam indicates which port(s)
- to flush. -1 is used to flush all ports a single port index will
- only flush that port. When Cmd has the value "OMX_CommandPortDisable"
- or "OMX_CommandPortEnable", the component's port is given by
- the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer"
- the components pot is given by the value of nParam.
- @param [in] pCmdData
- Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value
- "OMX_CommandMarkBuffer".
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SendCommand( \
- hComponent, \
- Cmd, \
- nParam, \
- pCmdData) \
- ((OMX_COMPONENTTYPE*)hComponent)->SendCommand( \
- hComponent, \
- Cmd, \
- nParam, \
- pCmdData) /* Macro End */
-
-
-/** The OMX_GetParameter macro will get one of the current parameter
- settings from the component. This macro cannot only be invoked when
- the component is in the OMX_StateInvalid state. The nParamIndex
- parameter is used to indicate which structure is being requested from
- the component. The application shall allocate the correct structure
- and shall fill in the structure size and version information before
- invoking this macro. When the parameter applies to a port, the
- caller shall fill in the appropriate nPortIndex value indicating the
- port on which the parameter applies. If the component has not had
- any settings changed, then the component should return a set of
- valid DEFAULT parameters for the component. This is a blocking
- call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nParamIndex
- Index of the structure to be filled. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in,out] pComponentParameterStructure
- Pointer to application allocated structure to be filled by the
- component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) /* Macro End */
-
-
-/** The OMX_SetParameter macro will send an initialization parameter
- structure to a component. Each structure shall be sent one at a time,
- in a separate invocation of the macro. This macro can only be
- invoked when the component is in the OMX_StateLoaded state, or the
- port is disabled (when the parameter applies to a port). The
- nParamIndex parameter is used to indicate which structure is being
- passed to the component. The application shall allocate the
- correct structure and shall fill in the structure size and version
- information (as well as the actual data) before invoking this macro.
- The application is free to dispose of this structure after the call
- as the component is required to copy any data it shall retain. This
- is a blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nIndex
- Index of the structure to be sent. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in] pComponentParameterStructure
- pointer to application allocated structure to be used for
- initialization by the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->SetParameter( \
- hComponent, \
- nParamIndex, \
- pComponentParameterStructure) /* Macro End */
-
-
-/** The OMX_GetConfig macro will get one of the configuration structures
- from a component. This macro can be invoked anytime after the
- component has been loaded. The nParamIndex call parameter is used to
- indicate which structure is being requested from the component. The
- application shall allocate the correct structure and shall fill in the
- structure size and version information before invoking this macro.
- If the component has not had this configuration parameter sent before,
- then the component should return a set of valid DEFAULT values for the
- component. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nIndex
- Index of the structure to be filled. This value is from the
- OMX_INDEXTYPE enumeration.
- @param [in,out] pComponentConfigStructure
- pointer to application allocated structure to be filled by the
- component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
-*/
-#define OMX_GetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) /* Macro End */
-
-
-/** The OMX_SetConfig macro will send one of the configuration
- structures to a component. Each structure shall be sent one at a time,
- each in a separate invocation of the macro. This macro can be invoked
- anytime after the component has been loaded. The application shall
- allocate the correct structure and shall fill in the structure size
- and version information (as well as the actual data) before invoking
- this macro. The application is free to dispose of this structure after
- the call as the component is required to copy any data it shall retain.
- This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nConfigIndex
- Index of the structure to be sent. This value is from the
- OMX_INDEXTYPE enumeration above.
- @param [in] pComponentConfigStructure
- pointer to application allocated structure to be used for
- initialization by the component.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_SetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) \
- ((OMX_COMPONENTTYPE*)hComponent)->SetConfig( \
- hComponent, \
- nConfigIndex, \
- pComponentConfigStructure) /* Macro End */
-
-
-/** The OMX_GetExtensionIndex macro will invoke a component to translate
- a vendor specific configuration or parameter string into an OMX
- structure index. There is no requirement for the vendor to support
- this command for the indexes already found in the OMX_INDEXTYPE
- enumeration (this is done to save space in small components). The
- component shall support all vendor supplied extension indexes not found
- in the master OMX_INDEXTYPE enumeration. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @param [in] cParameterName
- OMX_STRING that shall be less than 128 characters long including
- the trailing null byte. This is the string that will get
- translated by the component into a configuration index.
- @param [out] pIndexType
- a pointer to a OMX_INDEXTYPE to receive the index value.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetExtensionIndex( \
- hComponent, \
- cParameterName, \
- pIndexType) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex( \
- hComponent, \
- cParameterName, \
- pIndexType) /* Macro End */
-
-
-/** The OMX_GetState macro will invoke the component to get the current
- state of the component and place the state value into the location
- pointed to by pState.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] pState
- pointer to the location to receive the state. The value returned
- is one of the OMX_STATETYPE members
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp
- */
-#define OMX_GetState( \
- hComponent, \
- pState) \
- ((OMX_COMPONENTTYPE*)hComponent)->GetState( \
- hComponent, \
- pState) /* Macro End */
-
-
-/** The OMX_UseBuffer macro will request that the component use
- a buffer (and allocate its own buffer header) already allocated
- by another component, or by the IL Client. This is a blocking
- call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
- pointer to the buffer header
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-
-#define OMX_UseBuffer( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes, \
- pBuffer)
-
-
-/** The OMX_AllocateBuffer macro will request that the component allocate
- a new buffer and buffer header. The component will allocate the
- buffer and the buffer header and return a pointer to the buffer
- header. This is a blocking call.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive
- the pointer to the buffer header
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with. The port can be found by using the nPortIndex
- value as an index into the Port Definition array of the component.
- @param [in] pAppPrivate
- pAppPrivate is used to initialize the pAppPrivate member of the
- buffer header structure.
- @param [in] nSizeBytes
- size of the buffer to allocate. Used when bAllocateNew is true.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_AllocateBuffer( \
- hComponent, \
- ppBuffer, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes) \
- ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer( \
- hComponent, \
- ppBuffer, \
- nPortIndex, \
- pAppPrivate, \
- nSizeBytes) /* Macro End */
-
-
-/** The OMX_FreeBuffer macro will release a buffer header from the component
- which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If
- the component allocated the buffer (see the OMX_UseBuffer macro) then
- the component shall free the buffer and buffer header. This is a
- blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_FreeBuffer( \
- hComponent, \
- nPortIndex, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer( \
- hComponent, \
- nPortIndex, \
- pBuffer) /* Macro End */
-
-
-/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an
- input port of a component. The buffer will be emptied by the component
- and returned to the application via the EmptyBufferDone call back.
- This is a non-blocking call in that the component will record the buffer
- and return immediately and then empty the buffer, later, at the proper
- time. As expected, this macro may be invoked only while the component
- is in the OMX_StateExecuting. If nPortIndex does not specify an input
- port, the component shall return an error.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_EmptyThisBuffer( \
- hComponent, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \
- hComponent, \
- pBuffer) /* Macro End */
-
-
-/** The OMX_FillThisBuffer macro will send an empty buffer to an
- output port of a component. The buffer will be filled by the component
- and returned to the application via the FillBufferDone call back.
- This is a non-blocking call in that the component will record the buffer
- and return immediately and then fill the buffer, later, at the proper
- time. As expected, this macro may be invoked only while the component
- is in the OMX_ExecutingState. If nPortIndex does not specify an output
- port, the component shall return an error.
-
- The component should return from this call within 5 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [in] pBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer
- or AllocateBuffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_FillThisBuffer( \
- hComponent, \
- pBuffer) \
- ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer( \
- hComponent, \
- pBuffer) /* Macro End */
-
-
-
-/** The OMX_UseEGLImage macro will request that the component use
- a EGLImage provided by EGL (and allocate its own buffer header)
- This is a blocking call.
-
- The component should return from this call within 20 msec.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the OMX_GetHandle function.
- @param [out] ppBuffer
- pointer to an OMX_BUFFERHEADERTYPE structure used to receive the
- pointer to the buffer header. Note that the memory location used
- for this buffer is NOT visible to the IL Client.
- @param [in] nPortIndex
- nPortIndex is used to select the port on the component the buffer will
- be used with. The port can be found by using the nPortIndex
- value as an index into the Port Definition array of the component.
- @param [in] pAppPrivate
- pAppPrivate is used to initialize the pAppPrivate member of the
- buffer header structure.
- @param [in] eglImage
- eglImage contains the handle of the EGLImage to use as a buffer on the
- specified port. The component is expected to validate properties of
- the EGLImage against the configuration of the port to ensure the component
- can use the EGLImage as a buffer.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup comp buf
- */
-#define OMX_UseEGLImage( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- eglImage) \
- ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage( \
- hComponent, \
- ppBufferHdr, \
- nPortIndex, \
- pAppPrivate, \
- eglImage)
-
-/** The OMX_Init method is used to initialize the OMX core. It shall be the
- first call made into OMX and it should only be executed one time without
- an interviening OMX_Deinit call.
-
- The core should return from this call within 20 msec.
-
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void);
-
-
-/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be
- the last call made into OMX. In the event that the core determines that
- thare are components loaded when this call is made, the core may return
- with an error rather than try to unload the components.
-
- The core should return from this call within 20 msec.
-
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void);
-
-
-/** The OMX_ComponentNameEnum method will enumerate through all the names of
- recognised valid components in the system. This function is provided
- as a means to detect all the components in the system run-time. There is
- no strict ordering to the enumeration order of component names, although
- each name will only be enumerated once. If the OMX core supports run-time
- installation of new components, it is only requried to detect newly
- installed components when the first call to enumerate component names
- is made (i.e. when nIndex is 0x0).
-
- The core should return from this call in 20 msec.
-
- @param [out] cComponentName
- pointer to a null terminated string with the component name. The
- names of the components are strings less than 127 bytes in length
- plus the trailing null for a maximum size of 128 bytes. An example
- of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are
- assigned by the vendor, but shall start with "OMX." and then have
- the Vendor designation next.
- @param [in] nNameLength
- number of characters in the cComponentName string. With all
- component name strings restricted to less than 128 characters
- (including the trailing null) it is recomended that the caller
- provide a input string for the cComponentName of 128 characters.
- @param [in] nIndex
- number containing the enumeration index for the component.
- Multiple calls to OMX_ComponentNameEnum with increasing values
- of nIndex will enumerate through the component names in the
- system until OMX_ErrorNoMore is returned. The value of nIndex
- is 0 to (N-1), where N is the number of valid installed components
- in the system.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. When the value of nIndex exceeds the number of
- components in the system minus 1, OMX_ErrorNoMore will be
- returned. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum(
- OMX_OUT OMX_STRING cComponentName,
- OMX_IN OMX_U32 nNameLength,
- OMX_IN OMX_U32 nIndex);
-
-
-/** The OMX_GetHandle method will locate the component specified by the
- component name given, load that component into memory and then invoke
- the component's methods to create an instance of the component.
-
- The core should return from this call within 20 msec.
-
- @param [out] pHandle
- pointer to an OMX_HANDLETYPE pointer to be filled in by this method.
- @param [in] cComponentName
- pointer to a null terminated string with the component name. The
- names of the components are strings less than 127 bytes in length
- plus the trailing null for a maximum size of 128 bytes. An example
- of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are
- assigned by the vendor, but shall start with "OMX." and then have
- the Vendor designation next.
- @param [in] pAppData
- pointer to an application defined value that will be returned
- during callbacks so that the application can identify the source
- of the callback.
- @param [in] pCallBacks
- pointer to a OMX_CALLBACKTYPE structure that will be passed to the
- component to initialize it with.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(
- OMX_OUT OMX_HANDLETYPE* pHandle,
- OMX_IN OMX_STRING cComponentName,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_CALLBACKTYPE* pCallBacks);
-
-
-/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle
- method. If the component reference count goes to zero, the component will
- be unloaded from memory.
-
- The core should return from this call within 20 msec when the component is
- in the OMX_StateLoaded state.
-
- @param [in] hComponent
- Handle of the component to be accessed. This is the component
- handle returned by the call to the GetHandle function.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(
- OMX_IN OMX_HANDLETYPE hComponent);
-
-
-
-/** The OMX_SetupTunnel method will handle the necessary calls to the components
- to setup the specified tunnel the two components. NOTE: This is
- an actual method (not a #define macro). This method will make calls into
- the component ComponentTunnelRequest method to do the actual tunnel
- connection.
-
- The ComponentTunnelRequest method on both components will be called.
- This method shall not be called unless the component is in the
- OMX_StateLoaded state except when the ports used for the tunnel are
- disabled. In this case, the component may be in the OMX_StateExecuting,
- OMX_StatePause, or OMX_StateIdle states.
-
- The core should return from this call within 20 msec.
-
- @param [in] hOutput
- Handle of the component to be accessed. Also this is the handle
- of the component whose port, specified in the nPortOutput parameter
- will be used the source for the tunnel. This is the component handle
- returned by the call to the OMX_GetHandle function. There is a
- requirement that hOutput be the source for the data when
- tunelling (i.e. nPortOutput is an output port). If 0x0, the component
- specified in hInput will have it's port specified in nPortInput
- setup for communication with the application / IL client.
- @param [in] nPortOutput
- nPortOutput is used to select the source port on component to be
- used in the tunnel.
- @param [in] hInput
- This is the component to setup the tunnel with. This is the handle
- of the component whose port, specified in the nPortInput parameter
- will be used the destination for the tunnel. This is the component handle
- returned by the call to the OMX_GetHandle function. There is a
- requirement that hInput be the destination for the data when
- tunelling (i.e. nPortInut is an input port). If 0x0, the component
- specified in hOutput will have it's port specified in nPortPOutput
- setup for communication with the application / IL client.
- @param [in] nPortInput
- nPortInput is used to select the destination port on component to be
- used in the tunnel.
- @return OMX_ERRORTYPE
- If the command successfully executes, the return code will be
- OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
- When OMX_ErrorNotImplemented is returned, one or both components is
- a non-interop component and does not support tunneling.
-
- On failure, the ports of both components are setup for communication
- with the application / IL Client.
- @ingroup core tun
- */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel(
- OMX_IN OMX_HANDLETYPE hOutput,
- OMX_IN OMX_U32 nPortOutput,
- OMX_IN OMX_HANDLETYPE hInput,
- OMX_IN OMX_U32 nPortInput);
-
-/** @ingroup cp */
-OMX_API OMX_ERRORTYPE OMX_GetContentPipe(
- OMX_OUT OMX_HANDLETYPE *hPipe,
- OMX_IN OMX_STRING szURI);
-
-/** The OMX_GetComponentsOfRole method will return the number of components that support the given
- role and (if the compNames field is non-NULL) the names of those components. The call will fail if
- an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
- client should:
- * first call this function with the compNames field NULL to determine the number of component names
- * second call this function with the compNames field pointing to an array of names allocated
- according to the number returned by the first call.
-
- The core should return from this call within 5 msec.
-
- @param [in] role
- This is generic standard component name consisting only of component class
- name and the type within that class (e.g. 'audio_decoder.aac').
- @param [inout] pNumComps
- This is used both as input and output.
-
- If compNames is NULL, the input is ignored and the output specifies how many components support
- the given role.
-
- If compNames is not NULL, on input it bounds the size of the input structure and
- on output, it specifies the number of components string names listed within the compNames parameter.
- @param [inout] compNames
- If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts
- a list of the names of all physical components that implement the specified standard component name.
- Each name is NULL terminated. numComps indicates the number of names.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole (
- OMX_IN OMX_STRING role,
- OMX_INOUT OMX_U32 *pNumComps,
- OMX_INOUT OMX_U8 **compNames);
-
-/** The OMX_GetRolesOfComponent method will return the number of roles supported by the given
- component and (if the roles field is non-NULL) the names of those roles. The call will fail if
- an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the
- client should:
- * first call this function with the roles field NULL to determine the number of role names
- * second call this function with the roles field pointing to an array of names allocated
- according to the number returned by the first call.
-
- The core should return from this call within 5 msec.
-
- @param [in] compName
- This is the name of the component being queried about.
- @param [inout] pNumRoles
- This is used both as input and output.
-
- If roles is NULL, the input is ignored and the output specifies how many roles the component supports.
-
- If compNames is not NULL, on input it bounds the size of the input structure and
- on output, it specifies the number of roles string names listed within the roles parameter.
- @param [out] roles
- If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings
- which accepts a list of the names of all standard components roles implemented on the
- specified component name. numComps indicates the number of names.
- @ingroup core
- */
-OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent (
- OMX_IN OMX_STRING compName,
- OMX_INOUT OMX_U32 *pNumRoles,
- OMX_OUT OMX_U8 **roles);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/mm-core/omxcore/inc/OMX_IVCommon.h b/mm-core/omxcore/inc/OMX_IVCommon.h
deleted file mode 100644
index 4c4995ce..00000000
--- a/mm-core/omxcore/inc/OMX_IVCommon.h
+++ /dev/null
@@ -1,920 +0,0 @@
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * @file OMX_IVCommon.h - OpenMax IL version 1.1.2
- * The structures needed by Video and Image components to exchange
- * parameters and configuration data with the components.
- */
-#ifndef OMX_IVCommon_h
-#define OMX_IVCommon_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/**
- * Each OMX header must include all required header files to allow the header
- * to compile without errors. The includes below are required for this header
- * file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-/** @defgroup iv OpenMAX IL Imaging and Video Domain
- * Common structures for OpenMAX IL Imaging and Video domains
- * @{
- */
-
-
-/**
- * Enumeration defining possible uncompressed image/video formats.
- *
- * ENUMS:
- * Unused : Placeholder value when format is N/A
- * Monochrome : black and white
- * 8bitRGB332 : Red 7:5, Green 4:2, Blue 1:0
- * 12bitRGB444 : Red 11:8, Green 7:4, Blue 3:0
- * 16bitARGB4444 : Alpha 15:12, Red 11:8, Green 7:4, Blue 3:0
- * 16bitARGB1555 : Alpha 15, Red 14:10, Green 9:5, Blue 4:0
- * 16bitRGB565 : Red 15:11, Green 10:5, Blue 4:0
- * 16bitBGR565 : Blue 15:11, Green 10:5, Red 4:0
- * 18bitRGB666 : Red 17:12, Green 11:6, Blue 5:0
- * 18bitARGB1665 : Alpha 17, Red 16:11, Green 10:5, Blue 4:0
- * 19bitARGB1666 : Alpha 18, Red 17:12, Green 11:6, Blue 5:0
- * 24bitRGB888 : Red 24:16, Green 15:8, Blue 7:0
- * 24bitBGR888 : Blue 24:16, Green 15:8, Red 7:0
- * 24bitARGB1887 : Alpha 23, Red 22:15, Green 14:7, Blue 6:0
- * 25bitARGB1888 : Alpha 24, Red 23:16, Green 15:8, Blue 7:0
- * 32bitBGRA8888 : Blue 31:24, Green 23:16, Red 15:8, Alpha 7:0
- * 32bitARGB8888 : Alpha 31:24, Red 23:16, Green 15:8, Blue 7:0
- * YUV411Planar : U,Y are subsampled by a factor of 4 horizontally
- * YUV411PackedPlanar : packed per payload in planar slices
- * YUV420Planar : Three arrays Y,U,V.
- * YUV420PackedPlanar : packed per payload in planar slices
- * YUV420SemiPlanar : Two arrays, one is all Y, the other is U and V
- * YUV422Planar : Three arrays Y,U,V.
- * YUV422PackedPlanar : packed per payload in planar slices
- * YUV422SemiPlanar : Two arrays, one is all Y, the other is U and V
- * YCbYCr : Organized as 16bit YUYV (i.e. YCbYCr)
- * YCrYCb : Organized as 16bit YVYU (i.e. YCrYCb)
- * CbYCrY : Organized as 16bit UYVY (i.e. CbYCrY)
- * CrYCbY : Organized as 16bit VYUY (i.e. CrYCbY)
- * YUV444Interleaved : Each pixel contains equal parts YUV
- * RawBayer8bit : SMIA camera output format
- * RawBayer10bit : SMIA camera output format
- * RawBayer8bitcompressed : SMIA camera output format
- */
-typedef enum OMX_COLOR_FORMATTYPE {
- OMX_COLOR_FormatUnused,
- OMX_COLOR_FormatMonochrome,
- OMX_COLOR_Format8bitRGB332,
- OMX_COLOR_Format12bitRGB444,
- OMX_COLOR_Format16bitARGB4444,
- OMX_COLOR_Format16bitARGB1555,
- OMX_COLOR_Format16bitRGB565,
- OMX_COLOR_Format16bitBGR565,
- OMX_COLOR_Format18bitRGB666,
- OMX_COLOR_Format18bitARGB1665,
- OMX_COLOR_Format19bitARGB1666,
- OMX_COLOR_Format24bitRGB888,
- OMX_COLOR_Format24bitBGR888,
- OMX_COLOR_Format24bitARGB1887,
- OMX_COLOR_Format25bitARGB1888,
- OMX_COLOR_Format32bitBGRA8888,
- OMX_COLOR_Format32bitARGB8888,
- OMX_COLOR_FormatYUV411Planar,
- OMX_COLOR_FormatYUV411PackedPlanar,
- OMX_COLOR_FormatYUV420Planar,
- OMX_COLOR_FormatYUV420PackedPlanar,
- OMX_COLOR_FormatYUV420SemiPlanar,
- OMX_COLOR_FormatYUV422Planar,
- OMX_COLOR_FormatYUV422PackedPlanar,
- OMX_COLOR_FormatYUV422SemiPlanar,
- OMX_COLOR_FormatYCbYCr,
- OMX_COLOR_FormatYCrYCb,
- OMX_COLOR_FormatCbYCrY,
- OMX_COLOR_FormatCrYCbY,
- OMX_COLOR_FormatYUV444Interleaved,
- OMX_COLOR_FormatRawBayer8bit,
- OMX_COLOR_FormatRawBayer10bit,
- OMX_COLOR_FormatRawBayer8bitcompressed,
- OMX_COLOR_FormatL2,
- OMX_COLOR_FormatL4,
- OMX_COLOR_FormatL8,
- OMX_COLOR_FormatL16,
- OMX_COLOR_FormatL24,
- OMX_COLOR_FormatL32,
- OMX_COLOR_FormatYUV420PackedSemiPlanar,
- OMX_COLOR_FormatYUV422PackedSemiPlanar,
- OMX_COLOR_Format18BitBGR666,
- OMX_COLOR_Format24BitARGB6666,
- OMX_COLOR_Format24BitABGR6666,
- OMX_COLOR_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_COLOR_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_COLOR_FormatMax = 0x7FFFFFFF
-} OMX_COLOR_FORMATTYPE;
-
-
-/**
- * Defines the matrix for conversion from RGB to YUV or vice versa.
- * iColorMatrix should be initialized with the fixed point values
- * used in converting between formats.
- */
-typedef struct OMX_CONFIG_COLORCONVERSIONTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
- OMX_U32 nPortIndex; /**< Port that this struct applies to */
- OMX_S32 xColorMatrix[3][3]; /**< Stored in signed Q16 format */
- OMX_S32 xColorOffset[4]; /**< Stored in signed Q16 format */
-}OMX_CONFIG_COLORCONVERSIONTYPE;
-
-
-/**
- * Structure defining percent to scale each frame dimension. For example:
- * To make the width 50% larger, use fWidth = 1.5 and to make the width
- * 1/2 the original size, use fWidth = 0.5
- */
-typedef struct OMX_CONFIG_SCALEFACTORTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version info */
- OMX_U32 nPortIndex; /**< Port that this struct applies to */
- OMX_S32 xWidth; /**< Fixed point value stored as Q16 */
- OMX_S32 xHeight; /**< Fixed point value stored as Q16 */
-}OMX_CONFIG_SCALEFACTORTYPE;
-
-
-/**
- * Enumeration of possible image filter types
- */
-typedef enum OMX_IMAGEFILTERTYPE {
- OMX_ImageFilterNone,
- OMX_ImageFilterNoise,
- OMX_ImageFilterEmboss,
- OMX_ImageFilterNegative,
- OMX_ImageFilterSketch,
- OMX_ImageFilterOilPaint,
- OMX_ImageFilterHatch,
- OMX_ImageFilterGpen,
- OMX_ImageFilterAntialias,
- OMX_ImageFilterDeRing,
- OMX_ImageFilterSolarize,
- OMX_ImageFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ImageFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ImageFilterMax = 0x7FFFFFFF
-} OMX_IMAGEFILTERTYPE;
-
-
-/**
- * Image filter configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eImageFilter : Image filter type enumeration
- */
-typedef struct OMX_CONFIG_IMAGEFILTERTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGEFILTERTYPE eImageFilter;
-} OMX_CONFIG_IMAGEFILTERTYPE;
-
-
-/**
- * Customized U and V for color enhancement
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bColorEnhancement : Enable/disable color enhancement
- * nCustomizedU : Practical values: 16-240, range: 0-255, value set for
- * U component
- * nCustomizedV : Practical values: 16-240, range: 0-255, value set for
- * V component
- */
-typedef struct OMX_CONFIG_COLORENHANCEMENTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bColorEnhancement;
- OMX_U8 nCustomizedU;
- OMX_U8 nCustomizedV;
-} OMX_CONFIG_COLORENHANCEMENTTYPE;
-
-
-/**
- * Define color key and color key mask
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nARGBColor : 32bit Alpha, Red, Green, Blue Color
- * nARGBMask : 32bit Mask for Alpha, Red, Green, Blue channels
- */
-typedef struct OMX_CONFIG_COLORKEYTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nARGBColor;
- OMX_U32 nARGBMask;
-} OMX_CONFIG_COLORKEYTYPE;
-
-
-/**
- * List of color blend types for pre/post processing
- *
- * ENUMS:
- * None : No color blending present
- * AlphaConstant : Function is (alpha_constant * src) +
- * (1 - alpha_constant) * dst)
- * AlphaPerPixel : Function is (alpha * src) + (1 - alpha) * dst)
- * Alternate : Function is alternating pixels from src and dst
- * And : Function is (src & dst)
- * Or : Function is (src | dst)
- * Invert : Function is ~src
- */
-typedef enum OMX_COLORBLENDTYPE {
- OMX_ColorBlendNone,
- OMX_ColorBlendAlphaConstant,
- OMX_ColorBlendAlphaPerPixel,
- OMX_ColorBlendAlternate,
- OMX_ColorBlendAnd,
- OMX_ColorBlendOr,
- OMX_ColorBlendInvert,
- OMX_ColorBlendKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ColorBlendVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ColorBlendMax = 0x7FFFFFFF
-} OMX_COLORBLENDTYPE;
-
-
-/**
- * Color blend configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nRGBAlphaConstant : Constant global alpha values when global alpha is used
- * eColorBlend : Color blend type enumeration
- */
-typedef struct OMX_CONFIG_COLORBLENDTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nRGBAlphaConstant;
- OMX_COLORBLENDTYPE eColorBlend;
-} OMX_CONFIG_COLORBLENDTYPE;
-
-
-/**
- * Hold frame dimension
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nWidth : Frame width in pixels
- * nHeight : Frame height in pixels
- */
-typedef struct OMX_FRAMESIZETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nWidth;
- OMX_U32 nHeight;
-} OMX_FRAMESIZETYPE;
-
-
-/**
- * Rotation configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nRotation : +/- integer rotation value
- */
-typedef struct OMX_CONFIG_ROTATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nRotation;
-} OMX_CONFIG_ROTATIONTYPE;
-
-
-/**
- * Possible mirroring directions for pre/post processing
- *
- * ENUMS:
- * None : No mirroring
- * Vertical : Vertical mirroring, flip on X axis
- * Horizontal : Horizontal mirroring, flip on Y axis
- * Both : Both vertical and horizontal mirroring
- */
-typedef enum OMX_MIRRORTYPE {
- OMX_MirrorNone = 0,
- OMX_MirrorVertical,
- OMX_MirrorHorizontal,
- OMX_MirrorBoth,
- OMX_MirrorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MirrorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_MirrorMax = 0x7FFFFFFF
-} OMX_MIRRORTYPE;
-
-
-/**
- * Mirroring configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eMirror : Mirror type enumeration
- */
-typedef struct OMX_CONFIG_MIRRORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_MIRRORTYPE eMirror;
-} OMX_CONFIG_MIRRORTYPE;
-
-
-/**
- * Position information only
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nX : X coordinate for the point
- * nY : Y coordinate for the point
- */
-typedef struct OMX_CONFIG_POINTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nX;
- OMX_S32 nY;
-} OMX_CONFIG_POINTTYPE;
-
-
-/**
- * Frame size plus position
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nLeft : X Coordinate of the top left corner of the rectangle
- * nTop : Y Coordinate of the top left corner of the rectangle
- * nWidth : Width of the rectangle
- * nHeight : Height of the rectangle
- */
-typedef struct OMX_CONFIG_RECTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nLeft;
- OMX_S32 nTop;
- OMX_U32 nWidth;
- OMX_U32 nHeight;
-} OMX_CONFIG_RECTTYPE;
-
-
-/**
- * Deblocking state; it is required to be set up before starting the codec
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bDeblocking : Enable/disable deblocking mode
- */
-typedef struct OMX_PARAM_DEBLOCKINGTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bDeblocking;
-} OMX_PARAM_DEBLOCKINGTYPE;
-
-
-/**
- * Stabilization state
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bStab : Enable/disable frame stabilization state
- */
-typedef struct OMX_CONFIG_FRAMESTABTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bStab;
-} OMX_CONFIG_FRAMESTABTYPE;
-
-
-/**
- * White Balance control type
- *
- * STRUCT MEMBERS:
- * SunLight : Referenced in JSR-234
- * Flash : Optimal for device's integrated flash
- */
-typedef enum OMX_WHITEBALCONTROLTYPE {
- OMX_WhiteBalControlOff = 0,
- OMX_WhiteBalControlAuto,
- OMX_WhiteBalControlSunLight,
- OMX_WhiteBalControlCloudy,
- OMX_WhiteBalControlShade,
- OMX_WhiteBalControlTungsten,
- OMX_WhiteBalControlFluorescent,
- OMX_WhiteBalControlIncandescent,
- OMX_WhiteBalControlFlash,
- OMX_WhiteBalControlHorizon,
- OMX_WhiteBalControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_WhiteBalControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_WhiteBalControlMax = 0x7FFFFFFF
-} OMX_WHITEBALCONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eWhiteBalControl : White balance enumeration
- */
-typedef struct OMX_CONFIG_WHITEBALCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_WHITEBALCONTROLTYPE eWhiteBalControl;
-} OMX_CONFIG_WHITEBALCONTROLTYPE;
-
-
-/**
- * Exposure control type
- */
-typedef enum OMX_EXPOSURECONTROLTYPE {
- OMX_ExposureControlOff = 0,
- OMX_ExposureControlAuto,
- OMX_ExposureControlNight,
- OMX_ExposureControlBackLight,
- OMX_ExposureControlSpotLight,
- OMX_ExposureControlSports,
- OMX_ExposureControlSnow,
- OMX_ExposureControlBeach,
- OMX_ExposureControlLargeAperture,
- OMX_ExposureControlSmallApperture,
- OMX_ExposureControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_ExposureControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_ExposureControlMax = 0x7FFFFFFF
-} OMX_EXPOSURECONTROLTYPE;
-
-
-/**
- * White Balance control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eExposureControl : Exposure control enumeration
- */
-typedef struct OMX_CONFIG_EXPOSURECONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_EXPOSURECONTROLTYPE eExposureControl;
-} OMX_CONFIG_EXPOSURECONTROLTYPE;
-
-
-/**
- * Defines sensor supported mode.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nFrameRate : Single shot mode is indicated by a 0
- * bOneShot : Enable for single shot, disable for streaming
- * sFrameSize : Framesize
- */
-typedef struct OMX_PARAM_SENSORMODETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nFrameRate;
- OMX_BOOL bOneShot;
- OMX_FRAMESIZETYPE sFrameSize;
-} OMX_PARAM_SENSORMODETYPE;
-
-
-/**
- * Defines contrast level
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nContrast : Values allowed for contrast -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_CONTRASTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nContrast;
-} OMX_CONFIG_CONTRASTTYPE;
-
-
-/**
- * Defines brightness level
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nBrightness : 0-100%
- */
-typedef struct OMX_CONFIG_BRIGHTNESSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nBrightness;
-} OMX_CONFIG_BRIGHTNESSTYPE;
-
-
-/**
- * Defines backlight level configuration for a video sink, e.g. LCD panel
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nBacklight : Values allowed for backlight 0-100%
- * nTimeout : Number of milliseconds before backlight automatically turns
- * off. A value of 0x0 disables backight timeout
- */
-typedef struct OMX_CONFIG_BACKLIGHTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nBacklight;
- OMX_U32 nTimeout;
-} OMX_CONFIG_BACKLIGHTTYPE;
-
-
-/**
- * Defines setting for Gamma
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nGamma : Values allowed for gamma -100 to 100, zero means no change
- */
-typedef struct OMX_CONFIG_GAMMATYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nGamma;
-} OMX_CONFIG_GAMMATYPE;
-
-
-/**
- * Define for setting saturation
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSaturation : Values allowed for saturation -100 to 100, zero means
- * no change
- */
-typedef struct OMX_CONFIG_SATURATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nSaturation;
-} OMX_CONFIG_SATURATIONTYPE;
-
-
-/**
- * Define for setting Lightness
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nLightness : Values allowed for lightness -100 to 100, zero means no
- * change
- */
-typedef struct OMX_CONFIG_LIGHTNESSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_S32 nLightness;
-} OMX_CONFIG_LIGHTNESSTYPE;
-
-
-/**
- * Plane blend configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Index of input port associated with the plane.
- * nDepth : Depth of the plane in relation to the screen. Higher
- * numbered depths are "behind" lower number depths.
- * This number defaults to the Port Index number.
- * nAlpha : Transparency blending component for the entire plane.
- * See blending modes for more detail.
- */
-typedef struct OMX_CONFIG_PLANEBLENDTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nDepth;
- OMX_U32 nAlpha;
-} OMX_CONFIG_PLANEBLENDTYPE;
-
-
-/**
- * Define interlace type
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bEnable : Enable control variable for this functionality
- * (see below)
- * nInterleavePortIndex : Index of input or output port associated with
- * the interleaved plane.
- * pPlanarPortIndexes[4] : Index of input or output planar ports.
- */
-typedef struct OMX_PARAM_INTERLEAVETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnable;
- OMX_U32 nInterleavePortIndex;
-} OMX_PARAM_INTERLEAVETYPE;
-
-
-/**
- * Defines the picture effect used for an input picture
- */
-typedef enum OMX_TRANSITIONEFFECTTYPE {
- OMX_EffectNone,
- OMX_EffectFadeFromBlack,
- OMX_EffectFadeToBlack,
- OMX_EffectUnspecifiedThroughConstantColor,
- OMX_EffectDissolve,
- OMX_EffectWipe,
- OMX_EffectUnspecifiedMixOfTwoScenes,
- OMX_EffectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_EffectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EffectMax = 0x7FFFFFFF
-} OMX_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Structure used to configure current transition effect
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eEffect : Effect to enable
- */
-typedef struct OMX_CONFIG_TRANSITIONEFFECTTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_TRANSITIONEFFECTTYPE eEffect;
-} OMX_CONFIG_TRANSITIONEFFECTTYPE;
-
-
-/**
- * Defines possible data unit types for encoded video data. The data unit
- * types are used both for encoded video input for playback as well as
- * encoded video output from recording.
- */
-typedef enum OMX_DATAUNITTYPE {
- OMX_DataUnitCodedPicture,
- OMX_DataUnitVideoSegment,
- OMX_DataUnitSeveralSegments,
- OMX_DataUnitArbitraryStreamSection,
- OMX_DataUnitKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DataUnitVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DataUnitMax = 0x7FFFFFFF
-} OMX_DATAUNITTYPE;
-
-
-/**
- * Defines possible encapsulation types for coded video data unit. The
- * encapsulation information is used both for encoded video input for
- * playback as well as encoded video output from recording.
- */
-typedef enum OMX_DATAUNITENCAPSULATIONTYPE {
- OMX_DataEncapsulationElementaryStream,
- OMX_DataEncapsulationGenericPayload,
- OMX_DataEncapsulationRtpPayload,
- OMX_DataEncapsulationKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DataEncapsulationVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DataEncapsulationMax = 0x7FFFFFFF
-} OMX_DATAUNITENCAPSULATIONTYPE;
-
-
-/**
- * Structure used to configure the type of being decoded/encoded
- */
-typedef struct OMX_PARAM_DATAUNITTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_DATAUNITTYPE eUnitType;
- OMX_DATAUNITENCAPSULATIONTYPE eEncapsulationType;
-} OMX_PARAM_DATAUNITTYPE;
-
-
-/**
- * Defines dither types
- */
-typedef enum OMX_DITHERTYPE {
- OMX_DitherNone,
- OMX_DitherOrdered,
- OMX_DitherErrorDiffusion,
- OMX_DitherOther,
- OMX_DitherKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_DitherVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_DitherMax = 0x7FFFFFFF
-} OMX_DITHERTYPE;
-
-
-/**
- * Structure used to configure current type of dithering
- */
-typedef struct OMX_CONFIG_DITHERTYPE {
- OMX_U32 nSize; /**< Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_DITHERTYPE eDither; /**< Type of dithering to use */
-} OMX_CONFIG_DITHERTYPE;
-
-typedef struct OMX_CONFIG_CAPTUREMODETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex; /**< Port that this structure applies to */
- OMX_BOOL bContinuous; /**< If true then ignore frame rate and emit capture
- * data as fast as possible (otherwise obey port's frame rate). */
- OMX_BOOL bFrameLimited; /**< If true then terminate capture after the port emits the
- * specified number of frames (otherwise the port does not
- * terminate the capture until instructed to do so by the client).
- * Even if set, the client may manually terminate the capture prior
- * to reaching the limit. */
- OMX_U32 nFrameLimit; /**< Limit on number of frames emitted during a capture (only
- * valid if bFrameLimited is set). */
-} OMX_CONFIG_CAPTUREMODETYPE;
-
-typedef enum OMX_METERINGTYPE {
-
- OMX_MeteringModeAverage, /**< Center-weighted average metering. */
- OMX_MeteringModeSpot, /**< Spot (partial) metering. */
- OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */
-
- OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_MeteringVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_EVModeMax = 0x7fffffff
-} OMX_METERINGTYPE;
-
-typedef struct OMX_CONFIG_EXPOSUREVALUETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_METERINGTYPE eMetering;
- OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */
- OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */
- OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */
- OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */
- OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */
- OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */
- OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */
-} OMX_CONFIG_EXPOSUREVALUETYPE;
-
-/**
- * Focus region configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bCenter : Use center region as focus region of interest
- * bLeft : Use left region as focus region of interest
- * bRight : Use right region as focus region of interest
- * bTop : Use top region as focus region of interest
- * bBottom : Use bottom region as focus region of interest
- * bTopLeft : Use top left region as focus region of interest
- * bTopRight : Use top right region as focus region of interest
- * bBottomLeft : Use bottom left region as focus region of interest
- * bBottomRight : Use bottom right region as focus region of interest
- */
-typedef struct OMX_CONFIG_FOCUSREGIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bCenter;
- OMX_BOOL bLeft;
- OMX_BOOL bRight;
- OMX_BOOL bTop;
- OMX_BOOL bBottom;
- OMX_BOOL bTopLeft;
- OMX_BOOL bTopRight;
- OMX_BOOL bBottomLeft;
- OMX_BOOL bBottomRight;
-} OMX_CONFIG_FOCUSREGIONTYPE;
-
-/**
- * Focus Status type
- */
-typedef enum OMX_FOCUSSTATUSTYPE {
- OMX_FocusStatusOff = 0,
- OMX_FocusStatusRequest,
- OMX_FocusStatusReached,
- OMX_FocusStatusUnableToReach,
- OMX_FocusStatusLost,
- OMX_FocusStatusKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_FocusStatusVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_FocusStatusMax = 0x7FFFFFFF
-} OMX_FOCUSSTATUSTYPE;
-
-/**
- * Focus status configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFocusStatus : Specifies the focus status
- * bCenterStatus : Use center region as focus region of interest
- * bLeftStatus : Use left region as focus region of interest
- * bRightStatus : Use right region as focus region of interest
- * bTopStatus : Use top region as focus region of interest
- * bBottomStatus : Use bottom region as focus region of interest
- * bTopLeftStatus : Use top left region as focus region of interest
- * bTopRightStatus : Use top right region as focus region of interest
- * bBottomLeftStatus : Use bottom left region as focus region of interest
- * bBottomRightStatus : Use bottom right region as focus region of interest
- */
-typedef struct OMX_PARAM_FOCUSSTATUSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_FOCUSSTATUSTYPE eFocusStatus;
- OMX_BOOL bCenterStatus;
- OMX_BOOL bLeftStatus;
- OMX_BOOL bRightStatus;
- OMX_BOOL bTopStatus;
- OMX_BOOL bBottomStatus;
- OMX_BOOL bTopLeftStatus;
- OMX_BOOL bTopRightStatus;
- OMX_BOOL bBottomLeftStatus;
- OMX_BOOL bBottomRightStatus;
-} OMX_PARAM_FOCUSSTATUSTYPE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_Image.h b/mm-core/omxcore/inc/OMX_Image.h
deleted file mode 100644
index a6d4666c..00000000
--- a/mm-core/omxcore/inc/OMX_Image.h
+++ /dev/null
@@ -1,328 +0,0 @@
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * @file OMX_Image.h - OpenMax IL version 1.1.2
- * The structures needed by Image components to exchange parameters and
- * configuration data with the components.
- */
-#ifndef OMX_Image_h
-#define OMX_Image_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_IVCommon.h>
-
-/** @defgroup imaging OpenMAX IL Imaging Domain
- * @ingroup iv
- * Structures for OpenMAX IL Imaging domain
- * @{
- */
-
-/**
- * Enumeration used to define the possible image compression coding.
- */
-typedef enum OMX_IMAGE_CODINGTYPE {
- OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
- OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
- OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
- OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
- OMX_IMAGE_CodingEXIF, /**< EXIF image format */
- OMX_IMAGE_CodingTIFF, /**< TIFF image format */
- OMX_IMAGE_CodingGIF, /**< Graphics image format */
- OMX_IMAGE_CodingPNG, /**< PNG image format */
- OMX_IMAGE_CodingLZW, /**< LZW image format */
- OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
- OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_CodingMax = 0x7FFFFFFF
-} OMX_IMAGE_CODINGTYPE;
-
-
-/**
- * Data structure used to define an image path. The number of image paths
- * for input and output will vary by type of the image component.
- *
- * Input (aka Source) : Zero Inputs, one Output,
- * Splitter : One Input, 2 or more Outputs,
- * Processing Element : One Input, one output,
- * Mixer : 2 or more inputs, one output,
- * Output (aka Sink) : One Input, zero outputs.
- *
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output
- * image path. If additional vendor specific data is required, it should
- * be transmitted to the component using the CustomCommand function.
- * Compliant components will prepopulate this structure with optimal
- * values during the OMX_GetParameter() command.
- *
- * STRUCT MEMBERS:
- * cMIMEType : MIME type of data for the port
- * pNativeRender : Platform specific reference for a display if a
- * sync, otherwise this field is 0
- * nFrameWidth : Width of frame to be used on port if
- * uncompressed format is used. Use 0 for
- * unknown, don't care or variable
- * nFrameHeight : Height of frame to be used on port if
- * uncompressed format is used. Use 0 for
- * unknown, don't care or variable
- * nStride : Number of bytes per span of an image (i.e.
- * indicates the number of bytes to get from
- * span N to span N+1, where negative stride
- * indicates the image is bottom up
- * nSliceHeight : Height used when encoding in slices
- * bFlagErrorConcealment : Turns on error concealment if it is supported by
- * the OMX component
- * eCompressionFormat : Compression format used in this instance of
- * the component. When OMX_IMAGE_CodingUnused is
- * specified, eColorFormat is valid
- * eColorFormat : Decompressed format used by this component
- * pNativeWindow : Platform specific reference for a window object if a
- * display sink , otherwise this field is 0x0.
- */
-typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType;
- OMX_NATIVE_DEVICETYPE pNativeRender;
- OMX_U32 nFrameWidth;
- OMX_U32 nFrameHeight;
- OMX_S32 nStride;
- OMX_U32 nSliceHeight;
- OMX_BOOL bFlagErrorConcealment;
- OMX_IMAGE_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_IMAGE_PORTDEFINITIONTYPE;
-
-
-/**
- * Port format parameter. This structure is used to enumerate the various
- * data input/output format supported by the port.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Indicates which port to set
- * nIndex : Indicates the enumeration index for the format from
- * 0x0 to N-1
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_IMAGE_CodingUnused is specified,
- * eColorFormat is valid
- * eColorFormat : Decompressed format used by this component
- */
-typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_IMAGE_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
-} OMX_IMAGE_PARAM_PORTFORMATTYPE;
-
-
-/**
- * Flash control type
- *
- * ENUMS
- * Torch : Flash forced constantly on
- */
-typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
- OMX_IMAGE_FlashControlOn = 0,
- OMX_IMAGE_FlashControlOff,
- OMX_IMAGE_FlashControlAuto,
- OMX_IMAGE_FlashControlRedEyeReduction,
- OMX_IMAGE_FlashControlFillin,
- OMX_IMAGE_FlashControlTorch,
- OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FLASHCONTROLTYPE;
-
-
-/**
- * Flash control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFlashControl : Flash control type
- */
-typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
-} OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
-
-
-/**
- * Focus control type
- */
-typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
- OMX_IMAGE_FocusControlOn = 0,
- OMX_IMAGE_FocusControlOff,
- OMX_IMAGE_FocusControlAuto,
- OMX_IMAGE_FocusControlAutoLock,
- OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
-} OMX_IMAGE_FOCUSCONTROLTYPE;
-
-
-/**
- * Focus control configuration
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFocusControl : Focus control
- * nFocusSteps : Focus can take on values from 0 mm to infinity.
- * Interest is only in number of steps over this range.
- * nFocusStepIndex : Current focus step index
- */
-typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
- OMX_U32 nFocusSteps;
- OMX_U32 nFocusStepIndex;
-} OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
-
-
-/**
- * Q Factor for JPEG compression, which controls the tradeoff between image
- * quality and size. Q Factor provides a more simple means of controlling
- * JPEG compression quality, without directly programming Quantization
- * tables for chroma and luma
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
- * produces the smallest, worst quality images, and a factor
- * of 100 produces the largest, best quality images. A
- * typical default is 75 for small good quality images
- */
-typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nQFactor;
-} OMX_IMAGE_PARAM_QFACTORTYPE;
-
-/**
- * Quantization table type
- */
-
-typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
- OMX_IMAGE_QuantizationTableLuma = 0,
- OMX_IMAGE_QuantizationTableChroma,
- OMX_IMAGE_QuantizationTableChromaCb,
- OMX_IMAGE_QuantizationTableChromaCr,
- OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
-} OMX_IMAGE_QUANTIZATIONTABLETYPE;
-
-/**
- * JPEG quantization tables are used to determine DCT compression for
- * YUV data, as an alternative to specifying Q factor, providing exact
- * control of compression
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eQuantizationTable : Quantization table type
- * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
- * in increasing columns then by rows of data (i.e.
- * row 1, ... row 8). Quantization values are in
- * the range 0-255 and stored in linear order
- * (i.e. the component will zig-zag the
- * quantization table data if required internally)
- */
-typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
- OMX_U8 nQuantizationMatrix[64];
-} OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
-
-
-/**
- * Huffman table type, the same Huffman table is applied for chroma and
- * luma component
- */
-typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
- OMX_IMAGE_HuffmanTableAC = 0,
- OMX_IMAGE_HuffmanTableDC,
- OMX_IMAGE_HuffmanTableACLuma,
- OMX_IMAGE_HuffmanTableACChroma,
- OMX_IMAGE_HuffmanTableDCLuma,
- OMX_IMAGE_HuffmanTableDCChroma,
- OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
-} OMX_IMAGE_HUFFMANTABLETYPE;
-
-/**
- * JPEG Huffman table
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eHuffmanTable : Huffman table type
- * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
- * possible length
- * nHuffmanTable[256] : 0-255, the size used for AC and DC
- * HuffmanTable are 16 and 162
- */
-typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
- OMX_U8 nNumberOfHuffmanCodeOfLength[16];
- OMX_U8 nHuffmanTable[256];
-}OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
-
-/** @} */
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_Index.h b/mm-core/omxcore/inc/OMX_Index.h
deleted file mode 100644
index 44d4ea76..00000000
--- a/mm-core/omxcore/inc/OMX_Index.h
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Index.h - OpenMax IL version 1.1.2
- * The OMX_Index header file contains the definitions for both applications
- * and components .
- */
-
-
-#ifndef OMX_Index_h
-#define OMX_Index_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-#include <OMX_Types.h>
-
-
-/** The OMX_INDEXTYPE enumeration is used to select a structure when either
- * getting or setting parameters and/or configuration data. Each entry in
- * this enumeration maps to an OMX specified structure. When the
- * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods
- * are used, the second parameter will always be an entry from this enumeration
- * and the third entry will be the structure shown in the comments for the entry.
- * For example, if the application is initializing a cropping function, the
- * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter
- * and would send a pointer to an initialized OMX_RECTTYPE structure as the
- * third parameter.
- *
- * The enumeration entries named with the OMX_Config prefix are sent using
- * the OMX_SetConfig command and the enumeration entries named with the
- * OMX_PARAM_ prefix are sent using the OMX_SetParameter command.
- */
-typedef enum OMX_INDEXTYPE {
-
- OMX_IndexComponentStartUnused = 0x01000000,
- OMX_IndexParamPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
- OMX_IndexParamAudioInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamImageInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamVideoInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamOtherInit, /**< reference: OMX_PORT_PARAM_TYPE */
- OMX_IndexParamNumAvailableStreams, /**< reference: OMX_PARAM_U32TYPE */
- OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */
- OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */
- OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */
- OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */
- OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */
- OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */
- OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */
- OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */
- OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */
- OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */
- OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */
- OMX_IndexConfigMetadataItem, /**< reference: OMX_CONFIG_METADATAITEMTYPE */
- OMX_IndexConfigCounterNodeID, /**< reference: OMX_CONFIG_CONTAINERNODEIDTYPE */
- OMX_IndexParamMetadataFilterType, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
- OMX_IndexParamMetadataKeyFilter, /**< reference: OMX_PARAM_METADATAFILTERTYPE */
- OMX_IndexConfigPriorityMgmt, /**< reference: OMX_PRIORITYMGMTTYPE */
- OMX_IndexParamStandardComponentRole, /**< reference: OMX_PARAM_COMPONENTROLETYPE */
-
- OMX_IndexPortStartUnused = 0x02000000,
- OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
- OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
- OMX_IndexReservedStartUnused = 0x03000000,
-
- /* Audio parameters and configurations */
- OMX_IndexAudioStartUnused = 0x04000000,
- OMX_IndexParamAudioPortFormat, /**< reference: OMX_AUDIO_PARAM_PORTFORMATTYPE */
- OMX_IndexParamAudioPcm, /**< reference: OMX_AUDIO_PARAM_PCMMODETYPE */
- OMX_IndexParamAudioAac, /**< reference: OMX_AUDIO_PARAM_AACPROFILETYPE */
- OMX_IndexParamAudioRa, /**< reference: OMX_AUDIO_PARAM_RATYPE */
- OMX_IndexParamAudioMp3, /**< reference: OMX_AUDIO_PARAM_MP3TYPE */
- OMX_IndexParamAudioAdpcm, /**< reference: OMX_AUDIO_PARAM_ADPCMTYPE */
- OMX_IndexParamAudioG723, /**< reference: OMX_AUDIO_PARAM_G723TYPE */
- OMX_IndexParamAudioG729, /**< reference: OMX_AUDIO_PARAM_G729TYPE */
- OMX_IndexParamAudioAmr, /**< reference: OMX_AUDIO_PARAM_AMRTYPE */
- OMX_IndexParamAudioWma, /**< reference: OMX_AUDIO_PARAM_WMATYPE */
- OMX_IndexParamAudioSbc, /**< reference: OMX_AUDIO_PARAM_SBCTYPE */
- OMX_IndexParamAudioMidi, /**< reference: OMX_AUDIO_PARAM_MIDITYPE */
- OMX_IndexParamAudioGsm_FR, /**< reference: OMX_AUDIO_PARAM_GSMFRTYPE */
- OMX_IndexParamAudioMidiLoadUserSound, /**< reference: OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE */
- OMX_IndexParamAudioG726, /**< reference: OMX_AUDIO_PARAM_G726TYPE */
- OMX_IndexParamAudioGsm_EFR, /**< reference: OMX_AUDIO_PARAM_GSMEFRTYPE */
- OMX_IndexParamAudioGsm_HR, /**< reference: OMX_AUDIO_PARAM_GSMHRTYPE */
- OMX_IndexParamAudioPdc_FR, /**< reference: OMX_AUDIO_PARAM_PDCFRTYPE */
- OMX_IndexParamAudioPdc_EFR, /**< reference: OMX_AUDIO_PARAM_PDCEFRTYPE */
- OMX_IndexParamAudioPdc_HR, /**< reference: OMX_AUDIO_PARAM_PDCHRTYPE */
- OMX_IndexParamAudioTdma_FR, /**< reference: OMX_AUDIO_PARAM_TDMAFRTYPE */
- OMX_IndexParamAudioTdma_EFR, /**< reference: OMX_AUDIO_PARAM_TDMAEFRTYPE */
- OMX_IndexParamAudioQcelp8, /**< reference: OMX_AUDIO_PARAM_QCELP8TYPE */
- OMX_IndexParamAudioQcelp13, /**< reference: OMX_AUDIO_PARAM_QCELP13TYPE */
- OMX_IndexParamAudioEvrc, /**< reference: OMX_AUDIO_PARAM_EVRCTYPE */
- OMX_IndexParamAudioSmv, /**< reference: OMX_AUDIO_PARAM_SMVTYPE */
- OMX_IndexParamAudioVorbis, /**< reference: OMX_AUDIO_PARAM_VORBISTYPE */
-
- OMX_IndexConfigAudioMidiImmediateEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE */
- OMX_IndexConfigAudioMidiControl, /**< reference: OMX_AUDIO_CONFIG_MIDICONTROLTYPE */
- OMX_IndexConfigAudioMidiSoundBankProgram, /**< reference: OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE */
- OMX_IndexConfigAudioMidiStatus, /**< reference: OMX_AUDIO_CONFIG_MIDISTATUSTYPE */
- OMX_IndexConfigAudioMidiMetaEvent, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE */
- OMX_IndexConfigAudioMidiMetaEventData, /**< reference: OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE */
- OMX_IndexConfigAudioVolume, /**< reference: OMX_AUDIO_CONFIG_VOLUMETYPE */
- OMX_IndexConfigAudioBalance, /**< reference: OMX_AUDIO_CONFIG_BALANCETYPE */
- OMX_IndexConfigAudioChannelMute, /**< reference: OMX_AUDIO_CONFIG_CHANNELMUTETYPE */
- OMX_IndexConfigAudioMute, /**< reference: OMX_AUDIO_CONFIG_MUTETYPE */
- OMX_IndexConfigAudioLoudness, /**< reference: OMX_AUDIO_CONFIG_LOUDNESSTYPE */
- OMX_IndexConfigAudioEchoCancelation, /**< reference: OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE */
- OMX_IndexConfigAudioNoiseReduction, /**< reference: OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE */
- OMX_IndexConfigAudioBass, /**< reference: OMX_AUDIO_CONFIG_BASSTYPE */
- OMX_IndexConfigAudioTreble, /**< reference: OMX_AUDIO_CONFIG_TREBLETYPE */
- OMX_IndexConfigAudioStereoWidening, /**< reference: OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE */
- OMX_IndexConfigAudioChorus, /**< reference: OMX_AUDIO_CONFIG_CHORUSTYPE */
- OMX_IndexConfigAudioEqualizer, /**< reference: OMX_AUDIO_CONFIG_EQUALIZERTYPE */
- OMX_IndexConfigAudioReverberation, /**< reference: OMX_AUDIO_CONFIG_REVERBERATIONTYPE */
- OMX_IndexConfigAudioChannelVolume, /**< reference: OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE */
-
- /* Image specific parameters and configurations */
- OMX_IndexImageStartUnused = 0x05000000,
- OMX_IndexParamImagePortFormat, /**< reference: OMX_IMAGE_PARAM_PORTFORMATTYPE */
- OMX_IndexParamFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
- OMX_IndexConfigFocusControl, /**< reference: OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE */
- OMX_IndexParamQFactor, /**< reference: OMX_IMAGE_PARAM_QFACTORTYPE */
- OMX_IndexParamQuantizationTable, /**< reference: OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE */
- OMX_IndexParamHuffmanTable, /**< reference: OMX_IMAGE_PARAM_HUFFMANTTABLETYPE */
- OMX_IndexConfigFlashControl, /**< reference: OMX_IMAGE_PARAM_FLASHCONTROLTYPE */
-
- /* Video specific parameters and configurations */
- OMX_IndexVideoStartUnused = 0x06000000,
- OMX_IndexParamVideoPortFormat, /**< reference: OMX_VIDEO_PARAM_PORTFORMATTYPE */
- OMX_IndexParamVideoQuantization, /**< reference: OMX_VIDEO_PARAM_QUANTIZATIONTYPE */
- OMX_IndexParamVideoFastUpdate, /**< reference: OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE */
- OMX_IndexParamVideoBitrate, /**< reference: OMX_VIDEO_PARAM_BITRATETYPE */
- OMX_IndexParamVideoMotionVector, /**< reference: OMX_VIDEO_PARAM_MOTIONVECTORTYPE */
- OMX_IndexParamVideoIntraRefresh, /**< reference: OMX_VIDEO_PARAM_INTRAREFRESHTYPE */
- OMX_IndexParamVideoErrorCorrection, /**< reference: OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE */
- OMX_IndexParamVideoVBSMC, /**< reference: OMX_VIDEO_PARAM_VBSMCTYPE */
- OMX_IndexParamVideoMpeg2, /**< reference: OMX_VIDEO_PARAM_MPEG2TYPE */
- OMX_IndexParamVideoMpeg4, /**< reference: OMX_VIDEO_PARAM_MPEG4TYPE */
- OMX_IndexParamVideoWmv, /**< reference: OMX_VIDEO_PARAM_WMVTYPE */
- OMX_IndexParamVideoRv, /**< reference: OMX_VIDEO_PARAM_RVTYPE */
- OMX_IndexParamVideoAvc, /**< reference: OMX_VIDEO_PARAM_AVCTYPE */
- OMX_IndexParamVideoH263, /**< reference: OMX_VIDEO_PARAM_H263TYPE */
- OMX_IndexParamVideoProfileLevelQuerySupported, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
- OMX_IndexParamVideoProfileLevelCurrent, /**< reference: OMX_VIDEO_PARAM_PROFILELEVELTYPE */
- OMX_IndexConfigVideoBitrate, /**< reference: OMX_VIDEO_CONFIG_BITRATETYPE */
- OMX_IndexConfigVideoFramerate, /**< reference: OMX_CONFIG_FRAMERATETYPE */
- OMX_IndexConfigVideoIntraVOPRefresh, /**< reference: OMX_CONFIG_INTRAREFRESHVOPTYPE */
- OMX_IndexConfigVideoIntraMBRefresh, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
- OMX_IndexConfigVideoMBErrorReporting, /**< reference: OMX_CONFIG_MBERRORREPORTINGTYPE */
- OMX_IndexParamVideoMacroblocksPerFrame, /**< reference: OMX_PARAM_MACROBLOCKSTYPE */
- OMX_IndexConfigVideoMacroBlockErrorMap, /**< reference: OMX_CONFIG_MACROBLOCKERRORMAPTYPE */
- OMX_IndexParamVideoSliceFMO, /**< reference: OMX_VIDEO_PARAM_AVCSLICEFMO */
- OMX_IndexConfigVideoAVCIntraPeriod, /**< reference: OMX_VIDEO_CONFIG_AVCINTRAPERIOD */
- OMX_IndexConfigVideoNalSize, /**< reference: OMX_VIDEO_CONFIG_NALSIZE */
-
- /* Image & Video common Configurations */
- OMX_IndexCommonStartUnused = 0x07000000,
- OMX_IndexParamCommonDeblocking, /**< reference: OMX_PARAM_DEBLOCKINGTYPE */
- OMX_IndexParamCommonSensorMode, /**< reference: OMX_PARAM_SENSORMODETYPE */
- OMX_IndexParamCommonInterleave, /**< reference: OMX_PARAM_INTERLEAVETYPE */
- OMX_IndexConfigCommonColorFormatConversion, /**< reference: OMX_CONFIG_COLORCONVERSIONTYPE */
- OMX_IndexConfigCommonScale, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
- OMX_IndexConfigCommonImageFilter, /**< reference: OMX_CONFIG_IMAGEFILTERTYPE */
- OMX_IndexConfigCommonColorEnhancement, /**< reference: OMX_CONFIG_COLORENHANCEMENTTYPE */
- OMX_IndexConfigCommonColorKey, /**< reference: OMX_CONFIG_COLORKEYTYPE */
- OMX_IndexConfigCommonColorBlend, /**< reference: OMX_CONFIG_COLORBLENDTYPE */
- OMX_IndexConfigCommonFrameStabilisation,/**< reference: OMX_CONFIG_FRAMESTABTYPE */
- OMX_IndexConfigCommonRotate, /**< reference: OMX_CONFIG_ROTATIONTYPE */
- OMX_IndexConfigCommonMirror, /**< reference: OMX_CONFIG_MIRRORTYPE */
- OMX_IndexConfigCommonOutputPosition, /**< reference: OMX_CONFIG_POINTTYPE */
- OMX_IndexConfigCommonInputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonOutputCrop, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonDigitalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE */
- OMX_IndexConfigCommonOpticalZoom, /**< reference: OMX_CONFIG_SCALEFACTORTYPE*/
- OMX_IndexConfigCommonWhiteBalance, /**< reference: OMX_CONFIG_WHITEBALCONTROLTYPE */
- OMX_IndexConfigCommonExposure, /**< reference: OMX_CONFIG_EXPOSURECONTROLTYPE */
- OMX_IndexConfigCommonContrast, /**< reference: OMX_CONFIG_CONTRASTTYPE */
- OMX_IndexConfigCommonBrightness, /**< reference: OMX_CONFIG_BRIGHTNESSTYPE */
- OMX_IndexConfigCommonBacklight, /**< reference: OMX_CONFIG_BACKLIGHTTYPE */
- OMX_IndexConfigCommonGamma, /**< reference: OMX_CONFIG_GAMMATYPE */
- OMX_IndexConfigCommonSaturation, /**< reference: OMX_CONFIG_SATURATIONTYPE */
- OMX_IndexConfigCommonLightness, /**< reference: OMX_CONFIG_LIGHTNESSTYPE */
- OMX_IndexConfigCommonExclusionRect, /**< reference: OMX_CONFIG_RECTTYPE */
- OMX_IndexConfigCommonDithering, /**< reference: OMX_CONFIG_DITHERTYPE */
- OMX_IndexConfigCommonPlaneBlend, /**< reference: OMX_CONFIG_PLANEBLENDTYPE */
- OMX_IndexConfigCommonExposureValue, /**< reference: OMX_CONFIG_EXPOSUREVALUETYPE */
- OMX_IndexConfigCommonOutputSize, /**< reference: OMX_FRAMESIZETYPE */
- OMX_IndexParamCommonExtraQuantData, /**< reference: OMX_OTHER_EXTRADATATYPE */
- OMX_IndexConfigCommonFocusRegion, /**< reference: OMX_CONFIG_FOCUSREGIONTYPE */
- OMX_IndexConfigCommonFocusStatus, /**< reference: OMX_PARAM_FOCUSSTATUSTYPE */
- OMX_IndexConfigCommonTransitionEffect, /**< reference: OMX_CONFIG_TRANSITIONEFFECTTYPE */
-
- /* Reserved Configuration range */
- OMX_IndexOtherStartUnused = 0x08000000,
- OMX_IndexParamOtherPortFormat, /**< reference: OMX_OTHER_PARAM_PORTFORMATTYPE */
- OMX_IndexConfigOtherPower, /**< reference: OMX_OTHER_CONFIG_POWERTYPE */
- OMX_IndexConfigOtherStats, /**< reference: OMX_OTHER_CONFIG_STATSTYPE */
-
-
- /* Reserved Time range */
- OMX_IndexTimeStartUnused = 0x09000000,
- OMX_IndexConfigTimeScale, /**< reference: OMX_TIME_CONFIG_SCALETYPE */
- OMX_IndexConfigTimeClockState, /**< reference: OMX_TIME_CONFIG_CLOCKSTATETYPE */
- OMX_IndexConfigTimeActiveRefClock, /**< reference: OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE */
- OMX_IndexConfigTimeCurrentMediaTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
- OMX_IndexConfigTimeCurrentWallTime, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (read only) */
- OMX_IndexConfigTimeCurrentAudioReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimeCurrentVideoReference, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimeMediaTimeRequest, /**< reference: OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE (write only) */
- OMX_IndexConfigTimeClientStartTime, /**<reference: OMX_TIME_CONFIG_TIMESTAMPTYPE (write only) */
- OMX_IndexConfigTimePosition, /**< reference: OMX_TIME_CONFIG_TIMESTAMPTYPE */
- OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */
-
-
- OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- /* Vendor specific area */
- OMX_IndexVendorStartUnused = 0x7F000000,
- /* Vendor specific structures should be in the range of 0x7F000000
- to 0x7FFFFFFE. This range is not broken out by vendor, so
- private indexes are not guaranteed unique and therefore should
- only be sent to the appropriate component. */
-
- OMX_IndexMax = 0x7FFFFFFF
-
-} OMX_INDEXTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_Other.h b/mm-core/omxcore/inc/OMX_Other.h
deleted file mode 100644
index caf7f384..00000000
--- a/mm-core/omxcore/inc/OMX_Other.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** @file OMX_Other.h - OpenMax IL version 1.1.2
- * The structures needed by Other components to exchange
- * parameters and configuration data with the components.
- */
-
-#ifndef OMX_Other_h
-#define OMX_Other_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/* Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_Core.h>
-
-
-/**
- * Enumeration of possible data types which match to multiple domains or no
- * domain at all. For types which are vendor specific, a value above
- * OMX_OTHER_VENDORTSTART should be used.
- */
-typedef enum OMX_OTHER_FORMATTYPE {
- OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time,
- time deltas, etc */
- OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power
- management, setting clocks? */
- OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames
- dropped, etc */
- OMX_OTHER_FormatBinary, /**< Arbitrary binary data */
- OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific
- formats */
-
- OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_OTHER_FormatMax = 0x7FFFFFFF
-} OMX_OTHER_FORMATTYPE;
-
-/**
- * Enumeration of seek modes.
- */
-typedef enum OMX_TIME_SEEKMODETYPE {
- OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation
- * of the requested seek position over
- * the actual seek position if it
- * results in a faster seek. */
- OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek
- * position over an approximation
- * of the requested seek position even
- * if it results in a slower seek. */
- OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_SeekModeMax = 0x7FFFFFFF
-} OMX_TIME_SEEKMODETYPE;
-
-/* Structure representing the seekmode of the component */
-typedef struct OMX_TIME_CONFIG_SEEKMODETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */
-} OMX_TIME_CONFIG_SEEKMODETYPE;
-
-/** Structure representing a time stamp used with the following configs
- * on the Clock Component (CC):
- *
- * OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall
- * time
- * OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media
- * time
- * OMX_IndexConfigTimeCurrentAudioReference and
- * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference
- * clock sending SC its reference time
- * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends
- * this structure to the Clock Component via a SetConfig on its
- * client port when it receives a buffer with
- * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp
- * specified by that buffer for nStartTimestamp.
- *
- * It’s also used with the following config on components in general:
- *
- * OMX_IndexConfigTimePosition: IL client querying component position
- * (GetConfig) or commanding a component to seek to the given location
- * (SetConfig)
- */
-typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version
- * information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_TICKS nTimestamp; /**< timestamp .*/
-} OMX_TIME_CONFIG_TIMESTAMPTYPE;
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_UPDATETYPE {
- OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */
- OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */
- OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */
- OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_UpdateMax = 0x7FFFFFFF
-} OMX_TIME_UPDATETYPE;
-
-/** Enumeration of possible reference clocks to the media time. */
-typedef enum OMX_TIME_REFCLOCKTYPE {
- OMX_TIME_RefClockNone, /**< Use no references. */
- OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */
- OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */
- OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_RefClockMax = 0x7FFFFFFF
-} OMX_TIME_REFCLOCKTYPE;
-
-/** Enumeration of clock states. */
-typedef enum OMX_TIME_CLOCKSTATE {
- OMX_TIME_ClockStateRunning, /**< Clock running. */
- OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the
- * prescribed clients emit their
- * start time. */
- OMX_TIME_ClockStateStopped, /**< Clock stopped. */
- OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_TIME_ClockStateMax = 0x7FFFFFFF
-} OMX_TIME_CLOCKSTATE;
-
-/** Structure representing a media time request to the clock component.
- *
- * A client component sends this structure to the Clock Component via a SetConfig
- * on its client port to specify a media timestamp the Clock Component
- * should emit. The Clock Component should fulfill the request by sending a
- * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested
- * timestamp.
- *
- * The client may require a media time request be fulfilled slightly
- * earlier than the media time specified. In this case the client specifies
- * an offset which is equal to the difference between wall time corresponding
- * to the requested media time and the wall time when it will be
- * fulfilled.
- *
- * A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to
- * time events according to timestamps. If a client must perform an operation O at
- * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a
- * media time request at T (perhaps specifying an offset to ensure the request fulfillment
- * is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE
- * structure back to the client component, the client may perform operation O (perhaps having
- * to wait a slight amount more time itself as specified by the return values).
- */
-
-typedef struct OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< port that this structure applies to */
- OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time
- * from others (e.g. the number of the frame to deliver).
- * Duplicated in the media time structure that fulfills
- * this request. A value of zero is reserved for time scale
- * updates. */
- OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/
- OMX_TICKS nOffset; /**< Amount of wall clock time by which this
- * request should be fulfilled early */
-} OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE;
-
-/**< Structure sent from the clock component client either when fulfilling
- * a media time request or when the time scale has changed.
- *
- * In the former case the Clock Component fills this structure and times its emission
- * to a client component (via the client port) according to the corresponding media
- * time request sent by the client. The Clock Component should time the emission to occur
- * when the requested timestamp matches the Clock Component's media time but also the
- * prescribed offset early.
- *
- * Upon scale changes the clock component clears the nClientPrivate data, sends the current
- * media time and sets the nScale to the new scale via the client port. It emits a
- * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to
- * alter processing to accomodate scaling. For instance a video component might skip inter-frames
- * in the case of extreme fastforward. Likewise an audio component might add or remove samples
- * from an audio frame to scale audio data.
- *
- * It is expected that some clock components may not be able to fulfill requests
- * at exactly the prescribed time. This is acceptable so long as the request is
- * fulfilled at least as early as described and not later. This structure provides
- * fields the client may use to wait for the remaining time.
- *
- * The client may use either the nOffset or nWallTimeAtMedia fields to determine the
- * wall time until the nMediaTimestamp actually occurs. In the latter case the
- * client can get a more accurate value for offset by getting the current wall
- * from the cloc component and subtracting it from nWallTimeAtMedia.
- */
-
-typedef struct OMX_TIME_MEDIATIMETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time
- * from others. Copied from the media time request.
- * A value of zero is reserved for time scale updates. */
- OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */
- OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was
- * requested then this is the current media time. */
- OMX_TICKS nOffset; /**< Amount of wall clock time by which this
- * request was actually fulfilled early */
-
- OMX_TICKS nWallTimeAtMediaTime; /**< Wall time corresponding to nMediaTimeStamp.
- * A client may compare this value to current
- * media time obtained from the Clock Component to determine
- * the wall time until the media timestamp is really
- * current. */
- OMX_S32 xScale; /**< Current media time scale in Q16 format. */
- OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/
- /**< State of the media time. */
-} OMX_TIME_MEDIATIMETYPE;
-
-/** Structure representing the current media time scale factor. Applicable only to clock
- * component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via
- * the clock component client ports. Upon recieving this config the clock component changes
- * the rate by which the media time increases or decreases effectively implementing trick modes.
- */
-typedef struct OMX_TIME_CONFIG_SCALETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_S32 xScale; /**< This is a value in Q16 format which is used for
- * scaling the media time */
-} OMX_TIME_CONFIG_SCALETYPE;
-
-/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE’s nWaitMask field */
-#define OMX_CLOCKPORT0 0x00000001
-#define OMX_CLOCKPORT1 0x00000002
-#define OMX_CLOCKPORT2 0x00000004
-#define OMX_CLOCKPORT3 0x00000008
-#define OMX_CLOCKPORT4 0x00000010
-#define OMX_CLOCKPORT5 0x00000020
-#define OMX_CLOCKPORT6 0x00000040
-#define OMX_CLOCKPORT7 0x00000080
-
-/** Structure representing the current mode of the media clock.
- * IL Client uses this config to change or query the mode of the
- * media clock of the clock component. Applicable only to clock
- * component.
- *
- * On a SetConfig if eState is OMX_TIME_ClockStateRunning media time
- * starts immediately at the prescribed start time. If
- * OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores
- * the given nStartTime and waits for all clients specified in the
- * nWaitMask to send starttimes (via
- * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts
- * the media clock using the earliest start time supplied. */
-typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version
- * information */
- OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */
- OMX_TICKS nStartTime; /**< Start time of the media time. */
- OMX_TICKS nOffset; /**< Time to offset the media time by
- * (e.g. preroll). Media time will be
- * reported to be nOffset ticks earlier.
- */
- OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */
-} OMX_TIME_CONFIG_CLOCKSTATETYPE;
-
-/** Structure representing the reference clock currently being used to
- * compute media time. IL client uses this config to change or query the
- * clock component's active reference clock */
-typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */
-} OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE;
-
-/** Descriptor for setting specifics of power type.
- * Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_POWERTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_BOOL bEnablePM; /**< Flag to enable Power Management */
-} OMX_OTHER_CONFIG_POWERTYPE;
-
-
-/** Descriptor for setting specifics of stats type.
- * Note: this structure is listed for backwards compatibility. */
-typedef struct OMX_OTHER_CONFIG_STATSTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- /* what goes here */
-} OMX_OTHER_CONFIG_STATSTYPE;
-
-
-/**
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output other
- * path.
- */
-typedef struct OMX_OTHER_PORTDEFINITIONTYPE {
- OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
-} OMX_OTHER_PORTDEFINITIONTYPE;
-
-/** Port format parameter. This structure is used to enumerate
- * the various data input/output format supported by the port.
- */
-typedef struct OMX_OTHER_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize; /**< size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Indicates which port to set */
- OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */
- OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */
-} OMX_OTHER_PARAM_PORTFORMATTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_QCOMExtns.h b/mm-core/omxcore/inc/OMX_QCOMExtns.h
deleted file mode 100644
index b9af5945..00000000
--- a/mm-core/omxcore/inc/OMX_QCOMExtns.h
+++ /dev/null
@@ -1,689 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef __OMX_QCOM_EXTENSIONS_H__
-#define __OMX_QCOM_EXTENSIONS_H__
-
-/*============================================================================
-*//** @file OMX_QCOMExtns.h
- This header contains constants and type definitions that specify the
- extensions added to the OpenMAX Vendor specific APIs.
-
-*//*========================================================================*/
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-#include "OMX_Core.h"
-#include "OMX_Video.h"
-
-/**
- * This extension is used to register mapping of a virtual
- * address to a physical address. This extension is a parameter
- * which can be set using the OMX_SetParameter macro. The data
- * pointer corresponding to this extension is
- * OMX_QCOM_MemMapEntry. This parameter is a 'write only'
- * parameter (Current value cannot be queried using
- * OMX_GetParameter macro).
- */
-#define OMX_QCOM_EXTN_REGISTER_MMAP "OMX.QCOM.index.param.register_mmap"
-
-/**
- * This structure describes the data pointer corresponding to
- * the OMX_QCOM_MMAP_REGISTER_EXTN extension. This parameter
- * must be set only 'after' populating a port with a buffer
- * using OMX_UseBuffer, wherein the data pointer of the buffer
- * corresponds to the virtual address as specified in this
- * structure.
- */
-struct OMX_QCOM_PARAM_MEMMAPENTRYTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
- OMX_U32 nPortIndex; /**< Port number the structure applies to */
-
- /**
- * The virtual address of memory block
- */
- OMX_U64 nVirtualAddress;
-
- /**
- * The physical address corresponding to the virtual address. The physical
- * address is contiguous for the entire valid range of the virtual
- * address.
- */
- OMX_U64 nPhysicalAddress;
-};
-
-#define QOMX_VIDEO_IntraRefreshRandom (OMX_VIDEO_IntraRefreshVendorStartUnused + 0)
-
-#define OMX_QCOM_PORTDEFN_EXTN "OMX.QCOM.index.param.portdefn"
-/* Allowed APIs on the above Index: OMX_GetParameter() and OMX_SetParameter() */
-
-typedef enum OMX_QCOMMemoryRegion
-{
- OMX_QCOM_MemRegionInvalid,
- OMX_QCOM_MemRegionEBI1,
- OMX_QCOM_MemRegionSMI,
- OMX_QCOM_MemRegionMax = 0X7FFFFFFF
-} OMX_QCOMMemoryRegion;
-
-typedef enum OMX_QCOMCacheAttr
-{
- OMX_QCOM_CacheAttrNone,
- OMX_QCOM_CacheAttrWriteBack,
- OMX_QCOM_CacheAttrWriteThrough,
- OMX_QCOM_CacheAttrMAX = 0X7FFFFFFF
-} OMX_QCOMCacheAttr;
-
-typedef struct OMX_QCOMRectangle
-{
- OMX_S32 x;
- OMX_S32 y;
- OMX_S32 dx;
- OMX_S32 dy;
-} OMX_QCOMRectangle;
-
-/** OMX_QCOMFramePackingFormat
- * Input or output buffer format
- */
-typedef enum OMX_QCOMFramePackingFormat
-{
- /* 0 - unspecified
- */
- OMX_QCOM_FramePacking_Unspecified,
-
- /* 1 - Partial frames may be present OMX IL 1.1.1 Figure 2-10:
- * Case 1??Each Buffer Filled In Whole or In Part
- */
- OMX_QCOM_FramePacking_Arbitrary,
-
- /* 2 - Multiple complete frames per buffer (integer number)
- * OMX IL 1.1.1 Figure 2-11: Case 2—Each Buffer Filled with
- * Only Complete Frames of Data
- */
- OMX_QCOM_FramePacking_CompleteFrames,
-
- /* 3 - Only one complete frame per buffer, no partial frame
- * OMX IL 1.1.1 Figure 2-12: Case 3—Each Buffer Filled with
- * Only One Frame of Compressed Data. Usually at least one
- * complete unit of data will be delivered in a buffer for
- * uncompressed data formats.
- */
- OMX_QCOM_FramePacking_OnlyOneCompleteFrame,
-
- /* 4 - Only one complete subframe per buffer, no partial subframe
- * Example: In H264, one complete NAL per buffer, where one frame
- * can contatin multiple NAL
- */
- OMX_QCOM_FramePacking_OnlyOneCompleteSubFrame,
-
- OMX_QCOM_FramePacking_MAX = 0X7FFFFFFF
-} OMX_QCOMFramePackingFormat;
-
-typedef struct OMX_QCOM_PARAM_PORTDEFINITIONTYPE {
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
-
- /** Platform specific memory region EBI1, SMI, etc.,*/
- OMX_QCOMMemoryRegion nMemRegion;
-
- OMX_QCOMCacheAttr nCacheAttr; /** Cache attributes */
-
- /** Input or output buffer format */
- OMX_U32 nFramePackingFormat;
-
-} OMX_QCOM_PARAM_PORTDEFINITIONTYPE;
-
-#define OMX_QCOM_PLATFORMPVT_EXTN "OMX.QCOM.index.param.platformprivate"
-/** Allowed APIs on the above Index: OMX_SetParameter() */
-
-typedef enum OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE
-{
- /** Enum for PMEM information */
- OMX_QCOM_PLATFORM_PRIVATE_PMEM = 0x1
-} OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE;
-
-/** IL client will set the following structure. A failure
- * code will be returned if component does not support the
- * value provided for 'type'.
- */
-struct OMX_QCOM_PLATFORMPRIVATE_EXTN
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /** OMX spec version information */
- OMX_U32 nPortIndex; /** Port number on which usebuffer extn is applied */
-
- /** Type of extensions should match an entry from
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE
- */
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type;
-};
-
-typedef struct OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO
-{
- /** pmem file descriptor */
- OMX_U32 pmem_fd;
- /** Offset from pmem device base address */
- OMX_U32 offset;
-}OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO;
-
-typedef struct OMX_QCOM_PLATFORM_PRIVATE_ENTRY
-{
- /** Entry type */
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY_TYPE type;
-
- /** Pointer to platform specific entry */
- void* entry;
-}OMX_QCOM_PLATFORM_PRIVATE_ENTRY;
-
-typedef struct OMX_QCOM_PLATFORM_PRIVATE_LIST
-{
- /** Number of entries */
- OMX_U32 nEntries;
-
- /** Pointer to array of platform specific entries *
- * Contiguous block of OMX_QCOM_PLATFORM_PRIVATE_ENTRY element
- */
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY* entryList;
-}OMX_QCOM_PLATFORM_PRIVATE_LIST;
-
-#define OMX_QCOM_FRAME_PACKING_FORMAT "OMX.QCOM.index.param.framepackfmt"
-/* Allowed API call: OMX_GetParameter() */
-/* IL client can use this index to rerieve the list of frame formats *
- * supported by the component */
-
-typedef struct OMX_QCOM_FRAME_PACKINGFORMAT_TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_QCOMFramePackingFormat eframePackingFormat;
-} OMX_QCOM_FRAME_PACKINGFORMAT_TYPE;
-
-
-/**
- * Following is the enum for color formats supported on Qualcomm
- * MSMs YVU420SemiPlanar color format is not defined in OpenMAX
- * 1.1.1 and prior versions of OpenMAX specification.
- */
-
-enum OMX_QCOM_COLOR_FORMATTYPE
-{
-
-/** YVU420SemiPlanar: YVU planar format, organized with a first
- * plane containing Y pixels, and a second plane containing
- * interleaved V and U pixels. V and U pixels are sub-sampled
- * by a factor of two both horizontally and vertically.
- */
- OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
- QOMX_COLOR_FormatYVU420PackedSemiPlanar32m4ka,
- QOMX_COLOR_FormatYUV420PackedSemiPlanar16m2ka,
- QOMX_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka
-};
-
-enum OMX_QCOM_VIDEO_CODINGTYPE
-{
-/** Codecs support by qualcomm which are not listed in OMX 1.1.x
- * spec
- * */
- OMX_QCOM_VIDEO_CodingVC1 = 0x7FA30C00 ,
- OMX_QCOM_VIDEO_CodingWMV9 = 0x7FA30C01,
- QOMX_VIDEO_CodingDivx = 0x7FA30C02, /**< Value when coding is Divx */
- QOMX_VIDEO_CodingSpark = 0x7FA30C03, /**< Value when coding is Sorenson Spark */
- QOMX_VIDEO_CodingVp = 0x7FA30C04
-};
-
-enum OMX_QCOM_EXTN_INDEXTYPE
-{
- /** Qcom proprietary extension index list */
-
- /* "OMX.QCOM.index.param.register_mmap" */
- OMX_QcomIndexRegmmap = 0x7F000000,
-
- /* "OMX.QCOM.index.param.platformprivate" */
- OMX_QcomIndexPlatformPvt = 0x7F000001,
-
- /* "OMX.QCOM.index.param.portdefn" */
- OMX_QcomIndexPortDefn = 0x7F000002,
-
- /* "OMX.QCOM.index.param.framepackingformat" */
- OMX_QcomIndexPortFramePackFmt = 0x7F000003,
-
- /*"OMX.QCOM.index.param.Interlaced */
- OMX_QcomIndexParamInterlaced = 0x7F000004,
-
- /*"OMX.QCOM.index.config.interlaceformat */
- OMX_QcomIndexConfigInterlaced = 0x7F000005,
-
- /*"OMX.QCOM.index.param.syntaxhdr" */
- QOMX_IndexParamVideoSyntaxHdr = 0x7F000006,
-
- /*"OMX.QCOM.index.config.intraperiod" */
- QOMX_IndexConfigVideoIntraperiod = 0x7F000007,
-
- /*"OMX.QCOM.index.config.randomIntrarefresh" */
- QOMX_IndexConfigVideoIntraRefresh = 0x7F000008,
-
- /*"OMX.QCOM.index.config.video.TemporalSpatialTradeOff" */
- QOMX_IndexConfigVideoTemporalSpatialTradeOff = 0x7F000009,
-
- /*"OMX.QCOM.index.param.video.EncoderMode" */
- QOMX_IndexParamVideoEncoderMode = 0x7F00000A,
-
- /*"OMX.QCOM.index.param.Divxtype */
- OMX_QcomIndexParamVideoDivx = 0x7F00000B,
-
- /*"OMX.QCOM.index.param.Sparktype */
- OMX_QcomIndexParamVideoSpark = 0x7F00000C,
-
- /*"OMX.QCOM.index.param.Vptype */
- OMX_QcomIndexParamVideoVp = 0x7F00000D,
-
- OMX_QcomIndexQueryNumberOfVideoDecInstance = 0x7F00000E
-};
-
-/**
- * Enumeration used to define the video encoder modes
- *
- * ENUMS:
- * EncoderModeDefault : Default video recording mode.
- * All encoder settings made through
- * OMX_SetParameter/OMX_SetConfig are applied. No
- * parameter is overridden.
- * EncoderModeMMS : Video recording mode for MMS (Multimedia Messaging
- * Service). This mode is similar to EncoderModeDefault
- * except that here the Rate control mode is overridden
- * internally and set as a variant of variable bitrate with
- * variable frame rate. After this mode is set if the IL
- * client tries to set OMX_VIDEO_CONTROLRATETYPE via
- * OMX_IndexParamVideoBitrate that would be rejected. For
- * this, client should set mode back to EncoderModeDefault
- * first and then change OMX_VIDEO_CONTROLRATETYPE.
- */
-typedef enum QOMX_VIDEO_ENCODERMODETYPE
-{
- QOMX_VIDEO_EncoderModeDefault = 0x00,
- QOMX_VIDEO_EncoderModeMMS = 0x01,
- QOMX_VIDEO_EncoderModeMax = 0x7FFFFFFF
-} QOMX_VIDEO_ENCODERMODETYPE;
-
-/**
- * This structure is used to set the video encoder mode.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version info
- * nPortIndex : Port that this structure applies to
- * nMode : defines the video encoder mode
- */
-typedef struct QOMX_VIDEO_PARAM_ENCODERMODETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- QOMX_VIDEO_ENCODERMODETYPE nMode;
-} QOMX_VIDEO_PARAM_ENCODERMODETYPE;
-
-/**
- * This structure describes the parameters corresponding to the
- * QOMX_VIDEO_SYNTAXHDRTYPE extension. This parameter can be queried
- * during the loaded state.
- */
-
-typedef struct QOMX_VIDEO_SYNTAXHDRTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nBytes; /** The number of bytes filled in to the buffer */
- OMX_U8 data[1]; /** Buffer to store the header information */
-} QOMX_VIDEO_SYNTAXHDRTYPE;
-
-/**
- * This structure describes the parameters corresponding to the
- * QOMX_VIDEO_TEMPORALSPATIALTYPE extension. This parameter can be set
- * dynamically during any state except the state invalid. This is primarily
- * used for setting MaxQP from the application. This is set on the out port.
- */
-
-typedef struct QOMX_VIDEO_TEMPORALSPATIALTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nTSFactor; /** Temoral spatial tradeoff factor value in 0-100 */
-} QOMX_VIDEO_TEMPORALSPATIALTYPE;
-
-/**
- * This structure describes the parameters corresponding to the
- * OMX_QCOM_VIDEO_CONFIG_INTRAPERIODTYPE extension. This parameter can be set
- * dynamically during any state except the state invalid. This is set on the out port.
- */
-
-typedef struct QOMX_VIDEO_INTRAPERIODTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nIDRPeriod; /** This specifies coding a frame as IDR after every nPFrames
- of intra frames. If this parameter is set to 0, only the
- first frame of the encode session is an IDR frame. This
- field is ignored for non-AVC codecs and is used only for
- codecs that support IDR Period */
- OMX_U32 nPFrames; /** The number of "P" frames between two "I" frames */
- OMX_U32 nBFrames; /** The number of "B" frames between two "I" frames */
-} QOMX_VIDEO_INTRAPERIODTYPE;
-
-/**
- * This structure describes the parameters corresponding to the
- * OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE extension. This parameter can be set
- * dynamically during any state except the state invalid. This is used for the buffer negotiation
- * with other clients. This is set on the out port.
- */
-typedef struct OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion; /** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nBufferOccupancy; /** The number of bytes to be set for the buffer occupancy */
-} OMX_QCOM_VIDEO_CONFIG_ULBUFFEROCCUPANCYTYPE;
-
-/**
- * This structure describes the parameters corresponding to the
- * OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE extension. This parameter can be set
- * dynamically during any state except the state invalid. This is primarily used for the dynamic/random
- * intrarefresh. This is set on the out port.
- */
-typedef struct OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nRirMBs; /** The number of MBs to be set for intrarefresh */
-} OMX_QCOM_VIDEO_CONFIG_RANDOMINTRAREFRESHTYPE;
-
-
-/**
- * This structure describes the parameters corresponding to the
- * OMX_QCOM_VIDEO_CONFIG_QPRANGE extension. This parameter can be set
- * dynamically during any state except the state invalid. This is primarily
- * used for the min/max QP to be set from the application. This
- * is set on the out port.
- */
-typedef struct OMX_QCOM_VIDEO_CONFIG_QPRANGE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_U32 nMinQP; /** The number for minimum quantization parameter */
- OMX_U32 nMaxQP; /** The number for maximum quantization parameter */
-} OMX_QCOM_VIDEO_CONFIG_QPRANGE;
-
-
-typedef struct OMX_VENDOR_EXTRADATATYPE {
- OMX_U32 nPortIndex;
- OMX_U32 nDataSize;
- OMX_U8 *pData; // cdata (codec_data/extradata)
-} OMX_VENDOR_EXTRADATATYPE;
-
-typedef enum OMX_INDEXVENDORTYPE {
- OMX_IndexVendorFileReadInputFilename = 0xFF000001,
- OMX_IndexVendorParser3gpInputFilename = 0xFF000002,
- OMX_IndexVendorVideoExtraData = 0xFF000003,
- OMX_IndexVendorAudioExtraData = 0xFF000004
-} OMX_INDEXVENDORTYPE;
-
-typedef enum OMX_QCOM_VC1RESOLUTIONTYPE
-{
- OMX_QCOM_VC1_PICTURE_RES_1x1,
- OMX_QCOM_VC1_PICTURE_RES_2x1,
- OMX_QCOM_VC1_PICTURE_RES_1x2,
- OMX_QCOM_VC1_PICTURE_RES_2x2
-} OMX_QCOM_VC1RESOLUTIONTYPE;
-
-typedef enum OMX_QCOM_INTERLACETYPE
-{
- OMX_QCOM_InterlaceFrameProgressive,
- OMX_QCOM_InterlaceInterleaveFrameTopFieldFirst,
- OMX_QCOM_InterlaceInterleaveFrameBottomFieldFirst,
- OMX_QCOM_InterlaceFrameTopFieldFirst,
- OMX_QCOM_InterlaceFrameBottomFieldFirst,
- OMX_QCOM_InterlaceFieldTop,
- OMX_QCOM_InterlaceFieldBottom
-}OMX_QCOM_INTERLACETYPE;
-
-typedef struct OMX_QCOM_PARAM_VIDEO_INTERLACETYPE
-{
- OMX_U32 nSize; /** Size of the structure in bytes */
- OMX_VERSIONTYPE nVersion;/** OMX specification version information */
- OMX_U32 nPortIndex; /** Portindex which is extended by this structure */
- OMX_BOOL bInterlace; /** Interlace content **/
-}OMX_QCOM_PARAM_VIDEO_INTERLACETYPE;
-
-typedef struct OMX_QCOM_CONFIG_INTERLACETYPE
-{
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_QCOM_INTERLACETYPE eInterlaceType;
-}OMX_QCOM_CONFIG_INTERLACETYPE;
-
-#define MAX_PAN_SCAN_WINDOWS 4
-
-typedef struct OMX_QCOM_PANSCAN
-{
- OMX_U32 numWindows;
- OMX_QCOMRectangle window[MAX_PAN_SCAN_WINDOWS];
-} OMX_QCOM_PANSCAN;
-
-typedef struct OMX_QCOM_EXTRADATA_FRAMEINFO
-{
- // common frame meta data. interlace related info removed
- OMX_VIDEO_PICTURETYPE ePicType;
- OMX_QCOM_INTERLACETYPE interlaceType;
- OMX_QCOM_PANSCAN panScan;
- OMX_U32 nConcealedMacroblocks;
-} OMX_QCOM_EXTRADATA_FRAMEINFO;
-
-typedef struct OMX_QCOM_EXTRADATA_FRAMEDIMENSION
-{
- /** Frame Dimensions added to each YUV buffer */
- OMX_U32 nDecWidth; /** Width rounded to multiple of 16 */
- OMX_U32 nDecHeight; /** Height rounded to multiple of 16 */
- OMX_U32 nActualWidth; /** Actual Frame Width */
- OMX_U32 nActualHeight; /** Actual Frame Height */
-
-}OMX_QCOM_EXTRADATA_FRAMEDIMENSION;
-
-typedef struct OMX_QCOM_H264EXTRADATA
-{
- OMX_U64 seiTimeStamp;
-} OMX_QCOM_H264EXTRADATA;
-
-typedef struct OMX_QCOM_VC1EXTRADATA
-{
- OMX_U32 nVC1RangeY;
- OMX_U32 nVC1RangeUV;
- OMX_QCOM_VC1RESOLUTIONTYPE eVC1PicResolution;
-} OMX_QCOM_VC1EXTRADATA;
-
-typedef union OMX_QCOM_EXTRADATA_CODEC_DATA
-{
- OMX_QCOM_H264EXTRADATA h264ExtraData;
- OMX_QCOM_VC1EXTRADATA vc1ExtraData;
-} OMX_QCOM_EXTRADATA_CODEC_DATA;
-
-typedef enum OMX_QCOM_EXTRADATATYPE
-{
- OMX_ExtraDataFrameInfo = 0x7F000001,
- OMX_ExtraDataH264 = 0x7F000002,
- OMX_ExtraDataVC1 = 0x7F000003,
- OMX_ExtraDataFrameDimension = 0x7F000004,
- OMX_ExtraDataVideoEncoderSliceInfo = 0x7F000005
-} OMX_QCOM_EXTRADATATYPE;
-
-
-#define OMX_EXTRADATA_HEADER_SIZE 20
-
-/**
- * DivX Versions
- */
-typedef enum QOMX_VIDEO_DIVXFORMATTYPE {
- QOMX_VIDEO_DIVXFormatUnused = 0x01, /**< Format unused or unknown */
- QOMX_VIDEO_DIVXFormat311 = 0x02, /**< DivX 3.11 */
- QOMX_VIDEO_DIVXFormat4 = 0x04, /**< DivX 4 */
- QOMX_VIDEO_DIVXFormat5 = 0x08, /**< DivX 5 */
- QOMX_VIDEO_DIVXFormat6 = 0x10, /**< DivX 6 */
- QOMX_VIDEO_DIVXFormatKhronosExtensions = 0x6F000000,
- QOMX_VIDEO_DIVXFormatVendorStartUnused = 0x7F000000,
- QOMX_VIDEO_DIVXFormatMax = 0x7FFFFFFF
-} QOMX_VIDEO_DIVXFORMATTYPE;
-
-/**
- * DivX profile types, each profile indicates support for
- * various performance bounds.
- */
-typedef enum QOMX_VIDEO_DIVXPROFILETYPE {
- QOMX_VIDEO_DivXProfileqMobile = 0x01, /**< qMobile Profile */
- QOMX_VIDEO_DivXProfileMobile = 0x02, /**< Mobile Profile */
- QOMX_VIDEO_DivXProfileMT = 0x04, /**< Mobile Theatre Profile */
- QOMX_VIDEO_DivXProfileHT = 0x08, /**< Home Theatre Profile */
- QOMX_VIDEO_DivXProfileHD = 0x10, /**< High Definition Profile */
- QOMX_VIDEO_DIVXProfileKhronosExtensions = 0x6F000000,
- QOMX_VIDEO_DIVXProfileVendorStartUnused = 0x7F000000,
- QOMX_VIDEO_DIVXProfileMax = 0x7FFFFFFF
-} QOMX_VIDEO_DIVXPROFILETYPE;
-
-/**
- * DivX Video Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of DivX stream / data
- * eProfile : Profile of DivX stream / data
- */
-typedef struct QOMX_VIDEO_PARAM_DIVXTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- QOMX_VIDEO_DIVXFORMATTYPE eFormat;
- QOMX_VIDEO_DIVXPROFILETYPE eProfile;
-} QOMX_VIDEO_PARAM_DIVXTYPE;
-
-
-
-/**
- * VP Versions
- */
-typedef enum QOMX_VIDEO_VPFORMATTYPE {
- QOMX_VIDEO_VPFormatUnused = 0x01, /**< Format unused or unknown */
- QOMX_VIDEO_VPFormat6 = 0x02, /**< VP6 Video Format */
- QOMX_VIDEO_VPFormat7 = 0x04, /**< VP7 Video Format */
- QOMX_VIDEO_VPFormat8 = 0x08, /**< VP8 Video Format */
- QOMX_VIDEO_VPFormatKhronosExtensions = 0x6F000000,
- QOMX_VIDEO_VPFormatVendorStartUnused = 0x7F000000,
- QOMX_VIDEO_VPFormatMax = 0x7FFFFFFF
-} QOMX_VIDEO_VPFORMATTYPE;
-
-/**
- * VP profile types, each profile indicates support for various
- * encoding tools.
- */
-typedef enum QOMX_VIDEO_VPPROFILETYPE {
- QOMX_VIDEO_VPProfileSimple = 0x01, /**< Simple Profile, applies to VP6 only */
- QOMX_VIDEO_VPProfileAdvanced = 0x02, /**< Advanced Profile, applies to VP6 only */
- QOMX_VIDEO_VPProfileVersion0 = 0x04, /**< Version 0, applies to VP7 and VP8 */
- QOMX_VIDEO_VPProfileVersion1 = 0x08, /**< Version 1, applies to VP7 and VP8 */
- QOMX_VIDEO_VPProfileVersion2 = 0x10, /**< Version 2, applies to VP8 only */
- QOMX_VIDEO_VPProfileVersion3 = 0x20, /**< Version 3, applies to VP8 only */
- QOMX_VIDEO_VPProfileKhronosExtensions = 0x6F000000,
- QOMX_VIDEO_VPProfileVendorStartUnused = 0x7F000000,
- QOMX_VIDEO_VPProfileMax = 0x7FFFFFFF
-} QOMX_VIDEO_VPPROFILETYPE;
-
-/**
- * VP Video Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Format of VP stream / data
- * eProfile : Profile or Version of VP stream / data
- */
-typedef struct QOMX_VIDEO_PARAM_VPTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- QOMX_VIDEO_VPFORMATTYPE eFormat;
- QOMX_VIDEO_VPPROFILETYPE eProfile;
-} QOMX_VIDEO_PARAM_VPTYPE;
-
-/**
- * Spark Versions
- */
-typedef enum QOMX_VIDEO_SPARKFORMATTYPE {
- QOMX_VIDEO_SparkFormatUnused = 0x01, /**< Format unused or unknown */
- QOMX_VIDEO_SparkFormat0 = 0x02, /**< Video Format Version 0 */
- QOMX_VIDEO_SparkFormat1 = 0x04, /**< Video Format Version 1 */
- QOMX_VIDEO_SparkFormatKhronosExtensions = 0x6F000000,
- QOMX_VIDEO_SparkFormatVendorStartUnused = 0x7F000000,
- QOMX_VIDEO_SparkFormatMax = 0x7FFFFFFF
-} QOMX_VIDEO_SPARKFORMATTYPE;
-
-/**
- * Spark Video Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of Spark stream / data
- */
-typedef struct QOMX_VIDEO_PARAM_SPARKTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- QOMX_VIDEO_SPARKFORMATTYPE eFormat;
-} QOMX_VIDEO_PARAM_SPARKTYPE;
-
-
-typedef struct QOMX_VIDEO_QUERY_DECODER_INSTANCES {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nNumOfInstances;
-} QOMX_VIDEO_QUERY_DECODER_INSTANCES;
-
-
-
-#endif /* __OMX_QCOM_EXTENSIONS_H__ */
diff --git a/mm-core/omxcore/inc/OMX_Types.h b/mm-core/omxcore/inc/OMX_Types.h
deleted file mode 100644
index 9b02a3eb..00000000
--- a/mm-core/omxcore/inc/OMX_Types.h
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/** OMX_Types.h - OpenMax IL version 1.1.2
- * The OMX_Types header file contains the primitive type definitions used by
- * the core, the application and the component. This file may need to be
- * modified to be used on systems that do not have "char" set to 8 bits,
- * "short" set to 16 bits and "long" set to 32 bits.
- */
-
-#ifndef OMX_Types_h
-#define OMX_Types_h
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/** The OMX_API and OMX_APIENTRY are platform specific definitions used
- * to declare OMX function prototypes. They are modified to meet the
- * requirements for a particular platform */
-#ifdef __SYMBIAN32__
-# ifdef __OMX_EXPORTS
-# define OMX_API __declspec(dllexport)
-# else
-# ifdef _WIN32
-# define OMX_API __declspec(dllexport)
-# else
-# define OMX_API __declspec(dllimport)
-# endif
-# endif
-#else
-# ifdef _WIN32
-# ifdef __OMX_EXPORTS
-# define OMX_API __declspec(dllexport)
-# else
-# define OMX_API __declspec(dllimport)
-# endif
-# else
-# ifdef __OMX_EXPORTS
-# define OMX_API
-# else
-# define OMX_API extern
-# endif
-# endif
-#endif
-
-#ifndef OMX_APIENTRY
-#define OMX_APIENTRY
-#endif
-
-/** OMX_IN is used to identify inputs to an OMX function. This designation
- will also be used in the case of a pointer that points to a parameter
- that is used as an output. */
-#ifndef OMX_IN
-#define OMX_IN
-#endif
-
-/** OMX_OUT is used to identify outputs from an OMX function. This
- designation will also be used in the case of a pointer that points
- to a parameter that is used as an input. */
-#ifndef OMX_OUT
-#define OMX_OUT
-#endif
-
-
-/** OMX_INOUT is used to identify parameters that may be either inputs or
- outputs from an OMX function at the same time. This designation will
- also be used in the case of a pointer that points to a parameter that
- is used both as an input and an output. */
-#ifndef OMX_INOUT
-#define OMX_INOUT
-#endif
-
-/** OMX_ALL is used to as a wildcard to select all entities of the same type
- * when specifying the index, or referring to a object by an index. (i.e.
- * use OMX_ALL to indicate all N channels). When used as a port index
- * for a config or parameter this OMX_ALL denotes that the config or
- * parameter applies to the entire component not just one port. */
-#define OMX_ALL 0xFFFFFFFF
-
-/** In the following we define groups that help building doxygen documentation */
-
-/** @defgroup core OpenMAX IL core
- * Functions and structure related to the OMX IL core
- */
-
- /** @defgroup comp OpenMAX IL component
- * Functions and structure related to the OMX IL component
- */
-
-/** @defgroup rpm Resource and Policy Management
- * Structures for resource and policy management of components
- */
-
-/** @defgroup buf Buffer Management
- * Buffer handling functions and structures
- */
-
-/** @defgroup tun Tunneling
- * @ingroup core comp
- * Structures and functions to manage tunnels among component ports
- */
-
-/** @defgroup cp Content Pipes
- * @ingroup core
- */
-
- /** @defgroup metadata Metadata handling
- *
- */
-
-/** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */
-typedef unsigned char OMX_U8;
-
-/** OMX_S8 is an 8 bit signed quantity that is byte aligned */
-typedef signed char OMX_S8;
-
-/** OMX_U16 is a 16 bit unsigned quantity that is 16 bit word aligned */
-typedef unsigned short OMX_U16;
-
-/** OMX_S16 is a 16 bit signed quantity that is 16 bit word aligned */
-typedef signed short OMX_S16;
-
-/** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */
-typedef unsigned long OMX_U32;
-
-/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
-typedef signed long OMX_S32;
-
-
-/* Users with compilers that cannot accept the "long long" designation should
- define the OMX_SKIP64BIT macro. It should be noted that this may cause
- some components to fail to compile if the component was written to require
- 64 bit integral types. However, these components would NOT compile anyway
- since the compiler does not support the way the component was written.
-*/
-#ifndef OMX_SKIP64BIT
-#ifdef __SYMBIAN32__
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#elif defined(WIN32)
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned __int64 OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed __int64 OMX_S64;
-
-#else /* WIN32 */
-
-/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */
-typedef unsigned long long OMX_U64;
-
-/** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */
-typedef signed long long OMX_S64;
-
-#endif /* WIN32 */
-#endif
-
-
-/** The OMX_BOOL type is intended to be used to represent a true or a false
- value when passing parameters to and from the OMX core and components. The
- OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary.
- */
-typedef enum OMX_BOOL {
- OMX_FALSE = 0,
- OMX_TRUE = !OMX_FALSE,
- OMX_BOOL_MAX = 0x7FFFFFFF
-} OMX_BOOL;
-
-/** The OMX_PTR type is intended to be used to pass pointers between the OMX
- applications and the OMX Core and components. This is a 32 bit pointer and
- is aligned on a 32 bit boundary.
- */
-typedef void* OMX_PTR;
-
-/** The OMX_STRING type is intended to be used to pass "C" type strings between
- the application and the core and component. The OMX_STRING type is a 32
- bit pointer to a zero terminated string. The pointer is word aligned and
- the string is byte aligned.
- */
-typedef char* OMX_STRING;
-
-/** The OMX_BYTE type is intended to be used to pass arrays of bytes such as
- buffers between the application and the component and core. The OMX_BYTE
- type is a 32 bit pointer to a zero terminated string. The pointer is word
- aligned and the string is byte aligned.
- */
-typedef unsigned char* OMX_BYTE;
-
-/** OMX_UUIDTYPE is a very long unique identifier to uniquely identify
- at runtime. This identifier should be generated by a component in a way
- that guarantees that every instance of the identifier running on the system
- is unique. */
-typedef unsigned char OMX_UUIDTYPE[128];
-
-/** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or
- an output port. This enumeration is common across all component types.
- */
-typedef enum OMX_DIRTYPE
-{
- OMX_DirInput, /**< Port is an input port */
- OMX_DirOutput, /**< Port is an output port */
- OMX_DirMax = 0x7FFFFFFF
-} OMX_DIRTYPE;
-
-/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering
- for numerical data (i.e. big endian, or little endian).
- */
-typedef enum OMX_ENDIANTYPE
-{
- OMX_EndianBig, /**< big endian */
- OMX_EndianLittle, /**< little endian */
- OMX_EndianMax = 0x7FFFFFFF
-} OMX_ENDIANTYPE;
-
-
-/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data
- is signed or unsigned
- */
-typedef enum OMX_NUMERICALDATATYPE
-{
- OMX_NumericalDataSigned, /**< signed data */
- OMX_NumericalDataUnsigned, /**< unsigned data */
- OMX_NumercialDataMax = 0x7FFFFFFF
-} OMX_NUMERICALDATATYPE;
-
-
-/** Unsigned bounded value type */
-typedef struct OMX_BU32 {
- OMX_U32 nValue; /**< actual value */
- OMX_U32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
- OMX_U32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BU32;
-
-
-/** Signed bounded value type */
-typedef struct OMX_BS32 {
- OMX_S32 nValue; /**< actual value */
- OMX_S32 nMin; /**< minimum for value (i.e. nValue >= nMin) */
- OMX_S32 nMax; /**< maximum for value (i.e. nValue <= nMax) */
-} OMX_BS32;
-
-
-/** Structure representing some time or duration in microseconds. This structure
- * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate
- * negative deltas and preroll scenarios. The quantity is represented in microseconds
- * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based
- * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g.
- * individual audio samples delivered at 192 kHz). The quantity is 64 bit to
- * accommodate a large dynamic range (signed 32 bit values would allow only for plus
- * or minus 35 minutes).
- *
- * Implementations with limited precision may convert the signed 64 bit value to
- * a signed 32 bit value internally but risk loss of precision.
- */
-#ifndef OMX_SKIP64BIT
-typedef OMX_S64 OMX_TICKS;
-#else
-typedef struct OMX_TICKS
-{
- OMX_U32 nLowPart; /** low bits of the signed 64 bit tick value */
- OMX_U32 nHighPart; /** high bits of the signed 64 bit tick value */
-} OMX_TICKS;
-#endif
-#define OMX_TICKS_PER_SECOND 1000000
-
-/** Define the public interface for the OMX Handle. The core will not use
- this value internally, but the application should only use this value.
- */
-typedef void* OMX_HANDLETYPE;
-
-typedef struct OMX_MARKTYPE
-{
- OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will
- generate a mark event upon
- processing the mark. */
- OMX_PTR pMarkData; /**< Application specific data associated with
- the mark sent on a mark event to disambiguate
- this mark from others. */
-} OMX_MARKTYPE;
-
-
-/** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the
- * platform & operating specific object used to reference the display
- * or can be used by a audio port for native audio rendering */
-typedef void* OMX_NATIVE_DEVICETYPE;
-
-/** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the
- * platform & operating specific object used to reference the window */
-typedef void* OMX_NATIVE_WINDOWTYPE;
-
-/** The OMX_VERSIONTYPE union is used to specify the version for
- a structure or component. For a component, the version is entirely
- specified by the component vendor. Components doing the same function
- from different vendors may or may not have the same version. For
- structures, the version shall be set by the entity that allocates the
- structure. For structures specified in the OMX 1.1 specification, the
- value of the version shall be set to 1.1.0.0 in all cases. Access to the
- OMX_VERSIONTYPE can be by a single 32 bit access (e.g. by nVersion) or
- by accessing one of the structure elements to, for example, check only
- the Major revision.
- */
-typedef union OMX_VERSIONTYPE
-{
- struct
- {
- OMX_U8 nVersionMajor; /**< Major version accessor element */
- OMX_U8 nVersionMinor; /**< Minor version accessor element */
- OMX_U8 nRevision; /**< Revision version accessor element */
- OMX_U8 nStep; /**< Step version accessor element */
- } s;
- OMX_U32 nVersion; /**< 32 bit value to make accessing the
- version easily done in a single word
- size copy/compare operation */
-} OMX_VERSIONTYPE;
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
diff --git a/mm-core/omxcore/inc/OMX_Video.h b/mm-core/omxcore/inc/OMX_Video.h
deleted file mode 100644
index 163e4508..00000000
--- a/mm-core/omxcore/inc/OMX_Video.h
+++ /dev/null
@@ -1,1060 +0,0 @@
-/**
- * Copyright (c) 2008 The Khronos Group Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject
- * to the following conditions:
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-/**
- * @file OMX_Video.h - OpenMax IL version 1.1.2
- * The structures is needed by Video components to exchange parameters
- * and configuration data with OMX components.
- */
-#ifndef OMX_Video_h
-#define OMX_Video_h
-
-/** @defgroup video OpenMAX IL Video Domain
- * @ingroup iv
- * Structures for OpenMAX IL Video domain
- * @{
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-/**
- * Each OMX header must include all required header files to allow the
- * header to compile without errors. The includes below are required
- * for this header file to compile successfully
- */
-
-#include <OMX_IVCommon.h>
-
-
-/**
- * Enumeration used to define the possible video compression codings.
- * NOTE: This essentially refers to file extensions. If the coding is
- * being used to specify the ENCODE type, then additional work
- * must be done to configure the exact flavor of the compression
- * to be used. For decode cases where the user application can
- * not differentiate between MPEG-4 and H.264 bit streams, it is
- * up to the codec to handle this.
- */
-typedef enum OMX_VIDEO_CODINGTYPE {
- OMX_VIDEO_CodingUnused, /**< Value when coding is N/A */
- OMX_VIDEO_CodingAutoDetect, /**< Autodetection of coding type */
- OMX_VIDEO_CodingMPEG2, /**< AKA: H.262 */
- OMX_VIDEO_CodingH263, /**< H.263 */
- OMX_VIDEO_CodingMPEG4, /**< MPEG-4 */
- OMX_VIDEO_CodingWMV, /**< all versions of Windows Media Video */
- OMX_VIDEO_CodingRV, /**< all versions of Real Video */
- OMX_VIDEO_CodingAVC, /**< H.264/AVC */
- OMX_VIDEO_CodingMJPEG, /**< Motion JPEG */
- OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_CodingMax = 0x7FFFFFFF
-} OMX_VIDEO_CODINGTYPE;
-
-
-/**
- * Data structure used to define a video path. The number of Video paths for
- * input and output will vary by type of the Video component.
- *
- * Input (aka Source) : zero Inputs, one Output,
- * Splitter : one Input, 2 or more Outputs,
- * Processing Element : one Input, one output,
- * Mixer : 2 or more inputs, one output,
- * Output (aka Sink) : one Input, zero outputs.
- *
- * The PortDefinition structure is used to define all of the parameters
- * necessary for the compliant component to setup an input or an output video
- * path. If additional vendor specific data is required, it should be
- * transmitted to the component using the CustomCommand function. Compliant
- * components will prepopulate this structure with optimal values during the
- * GetDefaultInitParams command.
- *
- * STRUCT MEMBERS:
- * cMIMEType : MIME type of data for the port
- * pNativeRender : Platform specific reference for a display if a
- * sync, otherwise this field is 0
- * nFrameWidth : Width of frame to be used on channel if
- * uncompressed format is used. Use 0 for unknown,
- * don't care or variable
- * nFrameHeight : Height of frame to be used on channel if
- * uncompressed format is used. Use 0 for unknown,
- * don't care or variable
- * nStride : Number of bytes per span of an image
- * (i.e. indicates the number of bytes to get
- * from span N to span N+1, where negative stride
- * indicates the image is bottom up
- * nSliceHeight : Height used when encoding in slices
- * nBitrate : Bit rate of frame to be used on channel if
- * compressed format is used. Use 0 for unknown,
- * don't care or variable
- * xFramerate : Frame rate to be used on channel if uncompressed
- * format is used. Use 0 for unknown, don't care or
- * variable. Units are Q16 frames per second.
- * bFlagErrorConcealment : Turns on error concealment if it is supported by
- * the OMX component
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_VIDEO_CodingUnused is
- * specified, eColorFormat is used
- * eColorFormat : Decompressed format used by this component
- * pNativeWindow : Platform specific reference for a window object if a
- * display sink , otherwise this field is 0x0.
- */
-typedef struct OMX_VIDEO_PORTDEFINITIONTYPE {
- OMX_STRING cMIMEType;
- OMX_NATIVE_DEVICETYPE pNativeRender;
- OMX_U32 nFrameWidth;
- OMX_U32 nFrameHeight;
- OMX_S32 nStride;
- OMX_U32 nSliceHeight;
- OMX_U32 nBitrate;
- OMX_U32 xFramerate;
- OMX_BOOL bFlagErrorConcealment;
- OMX_VIDEO_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_NATIVE_WINDOWTYPE pNativeWindow;
-} OMX_VIDEO_PORTDEFINITIONTYPE;
-
-/**
- * Port format parameter. This structure is used to enumerate the various
- * data input/output format supported by the port.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Indicates which port to set
- * nIndex : Indicates the enumeration index for the format from
- * 0x0 to N-1
- * eCompressionFormat : Compression format used in this instance of the
- * component. When OMX_VIDEO_CodingUnused is specified,
- * eColorFormat is used
- * eColorFormat : Decompressed format used by this component
- * xFrameRate : Indicates the video frame rate in Q16 format
- */
-typedef struct OMX_VIDEO_PARAM_PORTFORMATTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIndex;
- OMX_VIDEO_CODINGTYPE eCompressionFormat;
- OMX_COLOR_FORMATTYPE eColorFormat;
- OMX_U32 xFramerate;
-} OMX_VIDEO_PARAM_PORTFORMATTYPE;
-
-
-/**
- * This is a structure for configuring video compression quantization
- * parameter values. Codecs may support different QP values for different
- * frame types.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version info
- * nPortIndex : Port that this structure applies to
- * nQpI : QP value to use for index frames
- * nQpP : QP value to use for P frames
- * nQpB : QP values to use for bidirectional frames
- */
-typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nQpI;
- OMX_U32 nQpP;
- OMX_U32 nQpB;
-} OMX_VIDEO_PARAM_QUANTIZATIONTYPE;
-
-
-/**
- * Structure for configuration of video fast update parameters.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version info
- * nPortIndex : Port that this structure applies to
- * bEnableVFU : Enable/Disable video fast update
- * nFirstGOB : Specifies the number of the first macroblock row
- * nFirstMB : specifies the first MB relative to the specified first GOB
- * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB
- * and nFirstMB
- */
-typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnableVFU;
- OMX_U32 nFirstGOB;
- OMX_U32 nFirstMB;
- OMX_U32 nNumMBs;
-} OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE;
-
-
-/**
- * Enumeration of possible bitrate control types
- */
-typedef enum OMX_VIDEO_CONTROLRATETYPE {
- OMX_Video_ControlRateDisable,
- OMX_Video_ControlRateVariable,
- OMX_Video_ControlRateConstant,
- OMX_Video_ControlRateVariableSkipFrames,
- OMX_Video_ControlRateConstantSkipFrames,
- OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_Video_ControlRateMax = 0x7FFFFFFF
-} OMX_VIDEO_CONTROLRATETYPE;
-
-
-/**
- * Structure for configuring bitrate mode of a codec.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : Port that this struct applies to
- * eControlRate : Control rate type enum
- * nTargetBitrate : Target bitrate to encode with
- */
-typedef struct OMX_VIDEO_PARAM_BITRATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_CONTROLRATETYPE eControlRate;
- OMX_U32 nTargetBitrate;
-} OMX_VIDEO_PARAM_BITRATETYPE;
-
-
-/**
- * Enumeration of possible motion vector (MV) types
- */
-typedef enum OMX_VIDEO_MOTIONVECTORTYPE {
- OMX_Video_MotionVectorPixel,
- OMX_Video_MotionVectorHalfPel,
- OMX_Video_MotionVectorQuarterPel,
- OMX_Video_MotionVectorEighthPel,
- OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_Video_MotionVectorMax = 0x7FFFFFFF
-} OMX_VIDEO_MOTIONVECTORTYPE;
-
-
-/**
- * Structure for configuring the number of motion vectors used as well
- * as their accuracy.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : port that this structure applies to
- * eAccuracy : Enumerated MV accuracy
- * bUnrestrictedMVs : Allow unrestricted MVs
- * bFourMV : Allow use of 4 MVs
- * sXSearchRange : Search range in horizontal direction for MVs
- * sYSearchRange : Search range in vertical direction for MVs
- */
-typedef struct OMX_VIDEO_PARAM_MOTIONVECTORTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_MOTIONVECTORTYPE eAccuracy;
- OMX_BOOL bUnrestrictedMVs;
- OMX_BOOL bFourMV;
- OMX_S32 sXSearchRange;
- OMX_S32 sYSearchRange;
-} OMX_VIDEO_PARAM_MOTIONVECTORTYPE;
-
-
-/**
- * Enumeration of possible methods to use for Intra Refresh
- */
-typedef enum OMX_VIDEO_INTRAREFRESHTYPE {
- OMX_VIDEO_IntraRefreshCyclic,
- OMX_VIDEO_IntraRefreshAdaptive,
- OMX_VIDEO_IntraRefreshBoth,
- OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF
-} OMX_VIDEO_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for configuring intra refresh mode
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eRefreshMode : Cyclic, Adaptive, or Both
- * nAirMBs : Number of intra macroblocks to refresh in a frame when
- * AIR is enabled
- * nAirRef : Number of times a motion marked macroblock has to be
- * intra coded
- * nCirMBs : Number of consecutive macroblocks to be coded as "intra"
- * when CIR is enabled
- */
-typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_INTRAREFRESHTYPE eRefreshMode;
- OMX_U32 nAirMBs;
- OMX_U32 nAirRef;
- OMX_U32 nCirMBs;
-} OMX_VIDEO_PARAM_INTRAREFRESHTYPE;
-
-
-/**
- * Structure for enabling various error correction methods for video
- * compression.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * bEnableHEC : Enable/disable header extension codes (HEC)
- * bEnableResync : Enable/disable resynchronization markers
- * nResynchMarkerSpacing : Resynch markers interval (in bits) to be
- * applied in the stream
- * bEnableDataPartitioning : Enable/disable data partitioning
- * bEnableRVLC : Enable/disable reversible variable length
- * coding
- */
-typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnableHEC;
- OMX_BOOL bEnableResync;
- OMX_U32 nResynchMarkerSpacing;
- OMX_BOOL bEnableDataPartitioning;
- OMX_BOOL bEnableRVLC;
-} OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE;
-
-
-/**
- * Configuration of variable block-size motion compensation (VBSMC)
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * b16x16 : Enable inter block search 16x16
- * b16x8 : Enable inter block search 16x8
- * b8x16 : Enable inter block search 8x16
- * b8x8 : Enable inter block search 8x8
- * b8x4 : Enable inter block search 8x4
- * b4x8 : Enable inter block search 4x8
- * b4x4 : Enable inter block search 4x4
- */
-typedef struct OMX_VIDEO_PARAM_VBSMCTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL b16x16;
- OMX_BOOL b16x8;
- OMX_BOOL b8x16;
- OMX_BOOL b8x8;
- OMX_BOOL b8x4;
- OMX_BOOL b4x8;
- OMX_BOOL b4x4;
-} OMX_VIDEO_PARAM_VBSMCTYPE;
-
-
-/**
- * H.263 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- *
- * ENUMS:
- * Baseline : Baseline Profile: H.263 (V1), no optional modes
- * H320 Coding : H.320 Coding Efficiency Backward Compatibility
- * Profile: H.263+ (V2), includes annexes I, J, L.4
- * and T
- * BackwardCompatible : Backward Compatibility Profile: H.263 (V1),
- * includes annex F
- * ISWV2 : Interactive Streaming Wireless Profile: H.263+
- * (V2), includes annexes I, J, K and T
- * ISWV3 : Interactive Streaming Wireless Profile: H.263++
- * (V3), includes profile 3 and annexes V and W.6.3.8
- * HighCompression : Conversational High Compression Profile: H.263++
- * (V3), includes profiles 1 & 2 and annexes D and U
- * Internet : Conversational Internet Profile: H.263++ (V3),
- * includes profile 5 and annex K
- * Interlace : Conversational Interlace Profile: H.263++ (V3),
- * includes profile 5 and annex W.6.3.11
- * HighLatency : High Latency Profile: H.263++ (V3), includes
- * profile 6 and annexes O.1 and P.5
- */
-typedef enum OMX_VIDEO_H263PROFILETYPE {
- OMX_VIDEO_H263ProfileBaseline = 0x01,
- OMX_VIDEO_H263ProfileH320Coding = 0x02,
- OMX_VIDEO_H263ProfileBackwardCompatible = 0x04,
- OMX_VIDEO_H263ProfileISWV2 = 0x08,
- OMX_VIDEO_H263ProfileISWV3 = 0x10,
- OMX_VIDEO_H263ProfileHighCompression = 0x20,
- OMX_VIDEO_H263ProfileInternet = 0x40,
- OMX_VIDEO_H263ProfileInterlace = 0x80,
- OMX_VIDEO_H263ProfileHighLatency = 0x100,
- OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_H263PROFILETYPE;
-
-
-/**
- * H.263 level types, each level indicates support for various frame sizes,
- * bit rates, decoder frame rates.
- */
-typedef enum OMX_VIDEO_H263LEVELTYPE {
- OMX_VIDEO_H263Level10 = 0x01,
- OMX_VIDEO_H263Level20 = 0x02,
- OMX_VIDEO_H263Level30 = 0x04,
- OMX_VIDEO_H263Level40 = 0x08,
- OMX_VIDEO_H263Level45 = 0x10,
- OMX_VIDEO_H263Level50 = 0x20,
- OMX_VIDEO_H263Level60 = 0x40,
- OMX_VIDEO_H263Level70 = 0x80,
- OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_H263LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_H263LEVELTYPE;
-
-
-/**
- * Specifies the picture type. These values should be OR'd to signal all
- * pictures types which are allowed.
- *
- * ENUMS:
- * Generic Picture Types: I, P and B
- * H.263 Specific Picture Types: SI and SP
- * H.264 Specific Picture Types: EI and EP
- * MPEG-4 Specific Picture Types: S
- */
-typedef enum OMX_VIDEO_PICTURETYPE {
- OMX_VIDEO_PictureTypeI = 0x01,
- OMX_VIDEO_PictureTypeP = 0x02,
- OMX_VIDEO_PictureTypeB = 0x04,
- OMX_VIDEO_PictureTypeSI = 0x08,
- OMX_VIDEO_PictureTypeSP = 0x10,
- OMX_VIDEO_PictureTypeEI = 0x11,
- OMX_VIDEO_PictureTypeEP = 0x12,
- OMX_VIDEO_PictureTypeS = 0x14,
- OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF
-} OMX_VIDEO_PICTURETYPE;
-
-
-/**
- * H.263 Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * eProfile : H.263 profile(s) to use
- * eLevel : H.263 level(s) to use
- * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE
- * (specified in the 1998 version of H.263) to
- * indicate custom picture sizes or clock
- * frequencies
- * nAllowedPictureTypes : Specifies the picture types allowed in the
- * bitstream
- * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is
- * not constrained. It is recommended to change
- * the value of the RTYPE bit for each reference
- * picture in error-free communication
- * nPictureHeaderRepetition : Specifies the frequency of picture header
- * repetition
- * nGOBHeaderInterval : Specifies the interval of non-empty GOB
- * headers in units of GOBs
- */
-typedef struct OMX_VIDEO_PARAM_H263TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_VIDEO_H263PROFILETYPE eProfile;
- OMX_VIDEO_H263LEVELTYPE eLevel;
- OMX_BOOL bPLUSPTYPEAllowed;
- OMX_U32 nAllowedPictureTypes;
- OMX_BOOL bForceRoundingTypeToZero;
- OMX_U32 nPictureHeaderRepetition;
- OMX_U32 nGOBHeaderInterval;
-} OMX_VIDEO_PARAM_H263TYPE;
-
-
-/**
- * MPEG-2 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_MPEG2PROFILETYPE {
- OMX_VIDEO_MPEG2ProfileSimple = 0, /**< Simple Profile */
- OMX_VIDEO_MPEG2ProfileMain, /**< Main Profile */
- OMX_VIDEO_MPEG2Profile422, /**< 4:2:2 Profile */
- OMX_VIDEO_MPEG2ProfileSNR, /**< SNR Profile */
- OMX_VIDEO_MPEG2ProfileSpatial, /**< Spatial Profile */
- OMX_VIDEO_MPEG2ProfileHigh, /**< High Profile */
- OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG2PROFILETYPE;
-
-
-/**
- * MPEG-2 level types, each level indicates support for various frame
- * sizes, bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_MPEG2LEVELTYPE {
- OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */
- OMX_VIDEO_MPEG2LevelML, /**< Main Level */
- OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */
- OMX_VIDEO_MPEG2LevelHL, /**< High Level */
- OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG2LEVELTYPE;
-
-
-/**
- * MPEG-2 params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * eProfile : MPEG-2 profile(s) to use
- * eLevel : MPEG-2 levels(s) to use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG2TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_VIDEO_MPEG2PROFILETYPE eProfile;
- OMX_VIDEO_MPEG2LEVELTYPE eLevel;
-} OMX_VIDEO_PARAM_MPEG2TYPE;
-
-
-/**
- * MPEG-4 profile types, each profile indicates support for various
- * performance bounds and different annexes.
- *
- * ENUMS:
- * - Simple Profile, Levels 1-3
- * - Simple Scalable Profile, Levels 1-2
- * - Core Profile, Levels 1-2
- * - Main Profile, Levels 2-4
- * - N-bit Profile, Level 2
- * - Scalable Texture Profile, Level 1
- * - Simple Face Animation Profile, Levels 1-2
- * - Simple Face and Body Animation (FBA) Profile, Levels 1-2
- * - Basic Animated Texture Profile, Levels 1-2
- * - Hybrid Profile, Levels 1-2
- * - Advanced Real Time Simple Profiles, Levels 1-4
- * - Core Scalable Profile, Levels 1-3
- * - Advanced Coding Efficiency Profile, Levels 1-4
- * - Advanced Core Profile, Levels 1-2
- * - Advanced Scalable Texture, Levels 2-3
- */
-typedef enum OMX_VIDEO_MPEG4PROFILETYPE {
- OMX_VIDEO_MPEG4ProfileSimple = 0x01,
- OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02,
- OMX_VIDEO_MPEG4ProfileCore = 0x04,
- OMX_VIDEO_MPEG4ProfileMain = 0x08,
- OMX_VIDEO_MPEG4ProfileNbit = 0x10,
- OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20,
- OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40,
- OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80,
- OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100,
- OMX_VIDEO_MPEG4ProfileHybrid = 0x200,
- OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400,
- OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800,
- OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000,
- OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000,
- OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000,
- OMX_VIDEO_MPEG4ProfileAdvancedSimple = 0x8000,
- OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG4PROFILETYPE;
-
-
-/**
- * MPEG-4 level types, each level indicates support for various frame
- * sizes, bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_MPEG4LEVELTYPE {
- OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */
- OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */
- OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */
- OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */
- OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */
- OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */
- OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */
- OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */
- OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF
-} OMX_VIDEO_MPEG4LEVELTYPE;
-
-
-/**
- * MPEG-4 configuration. This structure handles configuration options
- * which are specific to MPEG4 algorithms
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+
- * Annex K). Put zero if not used
- * bSVH : Enable Short Video Header mode
- * bGov : Flag to enable GOV
- * nPFrames : Number of P frames between each I frame (also called
- * GOV period)
- * nBFrames : Number of B frames between each I frame
- * nIDCVLCThreshold : Value of intra DC VLC threshold
- * bACPred : Flag to use ac prediction
- * nMaxPacketSize : Maximum size of packet in bytes.
- * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4.
- * Interpreted as described in MPEG4 standard.
- * eProfile : MPEG-4 profile(s) to use.
- * eLevel : MPEG-4 level(s) to use.
- * nAllowedPictureTypes : Specifies the picture types allowed in the bitstream
- * nHeaderExtension : Specifies the number of consecutive video packet
- * headers within a VOP
- * bReversibleVLC : Specifies whether reversible variable length coding
- * is in use
- */
-typedef struct OMX_VIDEO_PARAM_MPEG4TYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nSliceHeaderSpacing;
- OMX_BOOL bSVH;
- OMX_BOOL bGov;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_U32 nIDCVLCThreshold;
- OMX_BOOL bACPred;
- OMX_U32 nMaxPacketSize;
- OMX_U32 nTimeIncRes;
- OMX_VIDEO_MPEG4PROFILETYPE eProfile;
- OMX_VIDEO_MPEG4LEVELTYPE eLevel;
- OMX_U32 nAllowedPictureTypes;
- OMX_U32 nHeaderExtension;
- OMX_BOOL bReversibleVLC;
-} OMX_VIDEO_PARAM_MPEG4TYPE;
-
-
-/**
- * WMV Versions
- */
-typedef enum OMX_VIDEO_WMVFORMATTYPE {
- OMX_VIDEO_WMVFormatUnused = 0x01, /**< Format unused or unknown */
- OMX_VIDEO_WMVFormat7 = 0x02, /**< Windows Media Video format 7 */
- OMX_VIDEO_WMVFormat8 = 0x04, /**< Windows Media Video format 8 */
- OMX_VIDEO_WMVFormat9 = 0x08, /**< Windows Media Video format 9 */
- OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_WMVFormatMax = 0x7FFFFFFF
-} OMX_VIDEO_WMVFORMATTYPE;
-
-
-/**
- * WMV Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of WMV stream / data
- */
-typedef struct OMX_VIDEO_PARAM_WMVTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_WMVFORMATTYPE eFormat;
-} OMX_VIDEO_PARAM_WMVTYPE;
-
-
-/**
- * Real Video Version
- */
-typedef enum OMX_VIDEO_RVFORMATTYPE {
- OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */
- OMX_VIDEO_RVFormat8, /**< Real Video format 8 */
- OMX_VIDEO_RVFormat9, /**< Real Video format 9 */
- OMX_VIDEO_RVFormatG2, /**< Real Video Format G2 */
- OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_RVFormatMax = 0x7FFFFFFF
-} OMX_VIDEO_RVFORMATTYPE;
-
-
-/**
- * Real Video Params
- *
- * STUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * eFormat : Version of RV stream / data
- * nBitsPerPixel : Bits per pixel coded in the frame
- * nPaddedWidth : Padded width in pixel of a video frame
- * nPaddedHeight : Padded Height in pixels of a video frame
- * nFrameRate : Rate of video in frames per second
- * nBitstreamFlags : Flags which internal information about the bitstream
- * nBitstreamVersion : Bitstream version
- * nMaxEncodeFrameSize: Max encoded frame size
- * bEnablePostFilter : Turn on/off post filter
- * bEnableTemporalInterpolation : Turn on/off temporal interpolation
- * bEnableLatencyMode : When enabled, the decoder does not display a decoded
- * frame until it has detected that no enhancement layer
- * frames or dependent B frames will be coming. This
- * detection usually occurs when a subsequent non-B
- * frame is encountered
- */
-typedef struct OMX_VIDEO_PARAM_RVTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_VIDEO_RVFORMATTYPE eFormat;
- OMX_U16 nBitsPerPixel;
- OMX_U16 nPaddedWidth;
- OMX_U16 nPaddedHeight;
- OMX_U32 nFrameRate;
- OMX_U32 nBitstreamFlags;
- OMX_U32 nBitstreamVersion;
- OMX_U32 nMaxEncodeFrameSize;
- OMX_BOOL bEnablePostFilter;
- OMX_BOOL bEnableTemporalInterpolation;
- OMX_BOOL bEnableLatencyMode;
-} OMX_VIDEO_PARAM_RVTYPE;
-
-
-/**
- * AVC profile types, each profile indicates support for various
- * performance bounds and different annexes.
- */
-typedef enum OMX_VIDEO_AVCPROFILETYPE {
- OMX_VIDEO_AVCProfileBaseline = 0x01, /**< Baseline profile */
- OMX_VIDEO_AVCProfileMain = 0x02, /**< Main profile */
- OMX_VIDEO_AVCProfileExtended = 0x04, /**< Extended profile */
- OMX_VIDEO_AVCProfileHigh = 0x08, /**< High profile */
- OMX_VIDEO_AVCProfileHigh10 = 0x10, /**< High 10 profile */
- OMX_VIDEO_AVCProfileHigh422 = 0x20, /**< High 4:2:2 profile */
- OMX_VIDEO_AVCProfileHigh444 = 0x40, /**< High 4:4:4 profile */
- OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCPROFILETYPE;
-
-
-/**
- * AVC level types, each level indicates support for various frame sizes,
- * bit rates, decoder frame rates. No need
- */
-typedef enum OMX_VIDEO_AVCLEVELTYPE {
- OMX_VIDEO_AVCLevel1 = 0x01, /**< Level 1 */
- OMX_VIDEO_AVCLevel1b = 0x02, /**< Level 1b */
- OMX_VIDEO_AVCLevel11 = 0x04, /**< Level 1.1 */
- OMX_VIDEO_AVCLevel12 = 0x08, /**< Level 1.2 */
- OMX_VIDEO_AVCLevel13 = 0x10, /**< Level 1.3 */
- OMX_VIDEO_AVCLevel2 = 0x20, /**< Level 2 */
- OMX_VIDEO_AVCLevel21 = 0x40, /**< Level 2.1 */
- OMX_VIDEO_AVCLevel22 = 0x80, /**< Level 2.2 */
- OMX_VIDEO_AVCLevel3 = 0x100, /**< Level 3 */
- OMX_VIDEO_AVCLevel31 = 0x200, /**< Level 3.1 */
- OMX_VIDEO_AVCLevel32 = 0x400, /**< Level 3.2 */
- OMX_VIDEO_AVCLevel4 = 0x800, /**< Level 4 */
- OMX_VIDEO_AVCLevel41 = 0x1000, /**< Level 4.1 */
- OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */
- OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */
- OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */
- OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCLEVELTYPE;
-
-
-/**
- * AVC loop filter modes
- *
- * OMX_VIDEO_AVCLoopFilterEnable : Enable
- * OMX_VIDEO_AVCLoopFilterDisable : Disable
- * OMX_VIDEO_AVCLoopFilterDisableSliceBoundary : Disabled on slice boundaries
- */
-typedef enum OMX_VIDEO_AVCLOOPFILTERTYPE {
- OMX_VIDEO_AVCLoopFilterEnable = 0,
- OMX_VIDEO_AVCLoopFilterDisable,
- OMX_VIDEO_AVCLoopFilterDisableSliceBoundary,
- OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCLOOPFILTERTYPE;
-
-
-/**
- * AVC params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nSliceHeaderSpacing : Number of macroblocks between slice header, put
- * zero if not used
- * nPFrames : Number of P frames between each I frame
- * nBFrames : Number of B frames between each I frame
- * bUseHadamard : Enable/disable Hadamard transform
- * nRefFrames : Max number of reference frames to use for inter
- * motion search (1-16)
- * nRefIdxTrailing : Pic param set ref frame index (index into ref
- * frame buffer of trailing frames list), B frame
- * support
- * nRefIdxForward : Pic param set ref frame index (index into ref
- * frame buffer of forward frames list), B frame
- * support
- * bEnableUEP : Enable/disable unequal error protection. This
- * is only valid of data partitioning is enabled.
- * bEnableFMO : Enable/disable flexible macroblock ordering
- * bEnableASO : Enable/disable arbitrary slice ordering
- * bEnableRS : Enable/disable sending of redundant slices
- * eProfile : AVC profile(s) to use
- * eLevel : AVC level(s) to use
- * nAllowedPictureTypes : Specifies the picture types allowed in the
- * bitstream
- * bFrameMBsOnly : specifies that every coded picture of the
- * coded video sequence is a coded frame
- * containing only frame macroblocks
- * bMBAFF : Enable/disable switching between frame and
- * field macroblocks within a picture
- * bEntropyCodingCABAC : Entropy decoding method to be applied for the
- * syntax elements for which two descriptors appear
- * in the syntax tables
- * bWeightedPPrediction : Enable/disable weighted prediction shall not
- * be applied to P and SP slices
- * nWeightedBipredicitonMode : Default weighted prediction is applied to B
- * slices
- * bconstIpred : Enable/disable intra prediction
- * bDirect8x8Inference : Specifies the method used in the derivation
- * process for luma motion vectors for B_Skip,
- * B_Direct_16x16 and B_Direct_8x8 as specified
- * in subclause 8.4.1.2 of the AVC spec
- * bDirectSpatialTemporal : Flag indicating spatial or temporal direct
- * mode used in B slice coding (related to
- * bDirect8x8Inference) . Spatial direct mode is
- * more common and should be the default.
- * nCabacInitIdx : Index used to init CABAC contexts
- * eLoopFilterMode : Enable/disable loop filter
- */
-typedef struct OMX_VIDEO_PARAM_AVCTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nSliceHeaderSpacing;
- OMX_U32 nPFrames;
- OMX_U32 nBFrames;
- OMX_BOOL bUseHadamard;
- OMX_U32 nRefFrames;
- OMX_U32 nRefIdx10ActiveMinus1;
- OMX_U32 nRefIdx11ActiveMinus1;
- OMX_BOOL bEnableUEP;
- OMX_BOOL bEnableFMO;
- OMX_BOOL bEnableASO;
- OMX_BOOL bEnableRS;
- OMX_VIDEO_AVCPROFILETYPE eProfile;
- OMX_VIDEO_AVCLEVELTYPE eLevel;
- OMX_U32 nAllowedPictureTypes;
- OMX_BOOL bFrameMBsOnly;
- OMX_BOOL bMBAFF;
- OMX_BOOL bEntropyCodingCABAC;
- OMX_BOOL bWeightedPPrediction;
- OMX_U32 nWeightedBipredicitonMode;
- OMX_BOOL bconstIpred ;
- OMX_BOOL bDirect8x8Inference;
- OMX_BOOL bDirectSpatialTemporal;
- OMX_U32 nCabacInitIdc;
- OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode;
-} OMX_VIDEO_PARAM_AVCTYPE;
-
-typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE,
- or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
- OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE,
- or OMX_VIDEO_MPEG4PROFILETYPE depending on context */
- OMX_U32 nProfileIndex; /**< Used to query for individual profile support information,
- This parameter is valid only for
- OMX_IndexParamVideoProfileLevelQuerySupported index,
- For all other indices this parameter is to be ignored. */
-} OMX_VIDEO_PARAM_PROFILELEVELTYPE;
-
-/**
- * Structure for dynamically configuring bitrate mode of a codec.
- *
- * STRUCT MEMBERS:
- * nSize : Size of the struct in bytes
- * nVersion : OMX spec version info
- * nPortIndex : Port that this struct applies to
- * nEncodeBitrate : Target average bitrate to be generated in bps
- */
-typedef struct OMX_VIDEO_CONFIG_BITRATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nEncodeBitrate;
-} OMX_VIDEO_CONFIG_BITRATETYPE;
-
-/**
- * Defines Encoder Frame Rate setting
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * xEncodeFramerate : Encoding framerate represented in Q16 format
- */
-typedef struct OMX_CONFIG_FRAMERATETYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 xEncodeFramerate; /* Q16 format */
-} OMX_CONFIG_FRAMERATETYPE;
-
-typedef struct OMX_CONFIG_INTRAREFRESHVOPTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL IntraRefreshVOP;
-} OMX_CONFIG_INTRAREFRESHVOPTYPE;
-
-typedef struct OMX_CONFIG_MACROBLOCKERRORMAPTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nErrMapSize; /* Size of the Error Map in bytes */
- OMX_U8 ErrMap[1]; /* Error map hint */
-} OMX_CONFIG_MACROBLOCKERRORMAPTYPE;
-
-typedef struct OMX_CONFIG_MBERRORREPORTINGTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_BOOL bEnabled;
-} OMX_CONFIG_MBERRORREPORTINGTYPE;
-
-typedef struct OMX_PARAM_MACROBLOCKSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nMacroblocks;
-} OMX_PARAM_MACROBLOCKSTYPE;
-
-/**
- * AVC Slice Mode modes
- *
- * OMX_VIDEO_SLICEMODE_AVCDefault : Normal frame encoding, one slice per frame
- * OMX_VIDEO_SLICEMODE_AVCMBSlice : NAL mode, number of MBs per frame
- * OMX_VIDEO_SLICEMODE_AVCByteSlice : NAL mode, number of bytes per frame
- */
-typedef enum OMX_VIDEO_AVCSLICEMODETYPE {
- OMX_VIDEO_SLICEMODE_AVCDefault = 0,
- OMX_VIDEO_SLICEMODE_AVCMBSlice,
- OMX_VIDEO_SLICEMODE_AVCByteSlice,
- OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
- OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
- OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF
-} OMX_VIDEO_AVCSLICEMODETYPE;
-
-/**
- * AVC FMO Slice Mode Params
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nNumSliceGroups : Specifies the number of slice groups
- * nSliceGroupMapType : Specifies the type of slice groups
- * eSliceMode : Specifies the type of slice
- */
-typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U8 nNumSliceGroups;
- OMX_U8 nSliceGroupMapType;
- OMX_VIDEO_AVCSLICEMODETYPE eSliceMode;
-} OMX_VIDEO_PARAM_AVCSLICEFMO;
-
-/**
- * AVC IDR Period Configs
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nIDRPeriod : Specifies periodicity of IDR frames
- * nPFrames : Specifies internal of coding Intra frames
- */
-typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nIDRPeriod;
- OMX_U32 nPFrames;
-} OMX_VIDEO_CONFIG_AVCINTRAPERIOD;
-
-/**
- * AVC NAL Size Configs
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nNaluBytes : Specifies the NAL unit size
- */
-typedef struct OMX_VIDEO_CONFIG_NALSIZE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nNaluBytes;
-} OMX_VIDEO_CONFIG_NALSIZE;
-
-/** @} */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
-/* File EOF */
-
diff --git a/mm-core/omxcore/inc/QOMX_AudioExtensions.h b/mm-core/omxcore/inc/QOMX_AudioExtensions.h
deleted file mode 100755
index 85a1764f..00000000
--- a/mm-core/omxcore/inc/QOMX_AudioExtensions.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file QOMX_AudioExtensions.h
- This module contains the extensions for Audio
-
-*//*========================================================================*/
-
-#ifndef __H_QOMX_AUDIOEXTENSIONS_H__
-#define __H_QOMX_AUDIOEXTENSIONS_H__
-
-/*========================================================================
-
- INCLUDE FILES FOR MODULE
-
-========================================================================== */
-#include <OMX_Audio.h>
-
-/*========================================================================
-
- DEFINITIONS AND DECLARATIONS
-
-========================================================================== */
-
-#if defined( __cplusplus )
-extern "C"
-{
-#endif /* end of macro __cplusplus */
-
-/* Audio extension strings */
-#define OMX_QCOM_INDEX_PARAM_AMRWBPLUS "OMX.Qualcomm.index.audio.amrwbplus"
-#define OMX_QCOM_INDEX_PARAM_WMA10PRO "OMX.Qualcomm.index.audio.wma10pro"
-#define OMX_QCOM_INDEX_PARAM_SESSIONID "OMX.Qualcomm.index.audio.sessionId"
-#define OMX_QCOM_INDEX_PARAM_VOICERECORDTYPE "OMX.Qualcomm.index.audio.VoiceRecord"
-
-typedef enum QOMX_AUDIO_AMRBANDMODETYPE {
- QOMX_AUDIO_AMRBandModeWB9 = 0x7F000001,/**< AMRWB Mode 9 = SID*/
- QOMX_AUDIO_AMRBandModeWB10 = 0x7F000002,/**< AMRWB Mode 10 = 13600 bps */
- QOMX_AUDIO_AMRBandModeWB11 = 0x7F000003,/**< AMRWB Mode 11 = 18000 bps */
- QOMX_AUDIO_AMRBandModeWB12 = 0x7F000004,/**< AMRWB Mode 12 = 24000 bps */
- QOMX_AUDIO_AMRBandModeWB13 = 0x7F000005,/**< AMRWB Mode 13 = 24000 bps */
- QOMX_AUDIO_AMRBandModeWB14 = 0x7F000006,/**< AMRWB Mode 14 = FRAME_ERASE*/
- QOMX_AUDIO_AMRBandModeWB15 = 0x7F000007,/**< AMRWB Mode 15 = NO_DATA */
-}QOMX_AUDIO_AMRBANDMODETYPE;
-
-/**
- * AMR WB PLUS type
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nChannels : Number of channels
- * nBitRate : Bit rate read only field
- * nSampleRate : Sampling frequency for the clip(16/24/32/48KHz)
- * eAMRBandMode : AMR Band Mode enumeration
- * eAMRDTXMode : AMR DTX Mode enumeration
- * eAMRFrameFormat : AMR frame format enumeration
- */
-
-typedef struct QOMX_AUDIO_PARAM_AMRWBPLUSTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U32 nChannels;
- OMX_U32 nBitRate;
- OMX_U32 nSampleRate;
- QOMX_AUDIO_AMRBANDMODETYPE eAMRBandMode;
- OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode;
- OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat;
-} QOMX_AUDIO_PARAM_AMRWBPLUSTYPE;
-
-typedef enum QOMX_AUDIO_WMAFORMATTYPE {
- QOMX_AUDIO_WMAFormat10Pro = 0x7F000001, /**< Windows Media Audio format 10*/
-} QOMX_AUDIO_WMAFORMATTYPE;
-
-/**
- * WMA 10 PRO type
- *
- * STRUCT MEMBERS:
- * nSize : Size of the structure in bytes
- * nVersion : OMX specification version information
- * nPortIndex : Port that this structure applies to
- * nChannels : Number of channels
- * nBitRate : Bit rate read only field
- * eFormat : Version of WMA stream / data
- * eProfile : Profile of WMA stream / data
- * nSamplingRate : Sampling rate of the source data
- * nBlockAlign : block alignment, or block size, in bytes of the audio codec
- * nEncodeOptions : WMA Type-specific data
- * nSuperBlockAlign : WMA Type-specific data
- * validBitsPerSample : encoded stream (24-bit or 16-bit)
- * formatTag : codec ID(0x162 or 0x166)
- * advancedEncodeOpt : bit packed words indicating the features supported for LBR bitstream
- * advancedEncodeOpt2 : bit packed words indicating the features supported for LBR bitstream
- */
-typedef struct QOMX_AUDIO_PARAM_WMA10PROTYPE {
- OMX_U32 nSize;
- OMX_VERSIONTYPE nVersion;
- OMX_U32 nPortIndex;
- OMX_U16 nChannels;
- OMX_U32 nBitRate;
- QOMX_AUDIO_WMAFORMATTYPE eFormat;
- OMX_AUDIO_WMAPROFILETYPE eProfile;
- OMX_U32 nSamplingRate;
- OMX_U16 nBlockAlign;
- OMX_U16 nEncodeOptions;
- OMX_U32 nSuperBlockAlign;
- OMX_U32 validBitsPerSample;
- OMX_U32 formatTag;
- OMX_U32 advancedEncodeOpt;
- OMX_U32 advancedEncodeOpt2;
-} QOMX_AUDIO_PARAM_WMA10PROTYPE;
-
-/**
- * Stream info data
- *
- * STRUCT MEMBERS:
- * sessionId : session Id for alsa to route data
- */
-typedef struct QOMX_AUDIO_STREAM_INFO_DATA {
- OMX_U8 sessionId;
-} QOMX_AUDIO_STREAM_INFO_DATA;
-
-
-/**
- * Record Path
- *
- * STRUCT MEMBERS:
- * recPath : Record Path for encoding
- */
-typedef enum{
-
-QOMX_AUDIO_VOICE_TX,
-QOMX_AUDIO_VOICE_RX,
-QOMX_AUDIO_VOICE_MIXED,
-
-} QOMX_AUDIO_VOICERECORDMODETYPE;
-typedef struct QOMX_AUDIO_CONFIG_VOICERECORDTYPE {
-
-OMX_U32 nSize;
-OMX_VERSIONTYPE nVersion;
-QOMX_AUDIO_VOICERECORDMODETYPE eVoiceRecordMode;
-} QOMX_AUDIO_CONFIG_VOICERECORDTYPE;
-
-
-
-
-#if defined( __cplusplus )
-}
-#endif /* end of macro __cplusplus */
-
-#endif /* end of macro __H_QOMX_AUDIOEXTENSIONS_H__ */
diff --git a/mm-core/omxcore/inc/QOMX_AudioIndexExtensions.h b/mm-core/omxcore/inc/QOMX_AudioIndexExtensions.h
deleted file mode 100755
index 09c16732..00000000
--- a/mm-core/omxcore/inc/QOMX_AudioIndexExtensions.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file QOMX_AudioIndexExtensions.h
- This module contains the index extensions for Audio
-
-*//*========================================================================*/
-
-
-#ifndef __H_QOMX_AUDIOINDEXEXTENSIONS_H__
-#define __H_QOMX_AUDIOINDEXEXTENSIONS_H__
-
-/*========================================================================
-
- INCLUDE FILES FOR MODULE
-
-========================================================================== */
-#include <OMX_Core.h>
-
-/*========================================================================
-
- DEFINITIONS AND DECLARATIONS
-
-========================================================================== */
-
-#if defined( __cplusplus )
-extern "C"
-{
-#endif /* end of macro __cplusplus */
-
-/**
- * Enumeration used to define Qualcomm's vendor extensions for
- * audio. The audio extensions occupy a range of
- * 0x7F100000-0x7F1FFFFF, inclusive.
- */
-typedef enum QOMX_AUDIO_EXTENSIONS_INDEXTYPE
-{
- QOMX_IndexParamAudioAmrWbPlus = 0x7F200000, /**< "OMX.Qualcomm.index.audio.amrwbplus" */
- QOMX_IndexParamAudioWma10Pro = 0x7F200001, /**< "OMX.Qualcomm.index.audio.wma10pro" */
- QOMX_IndexParamAudioSessionId = 0x7F200002, /**< "OMX.Qualcomm.index.audio.sessionId" */
- QOMX_IndexParamAudioVoiceRecord = 0x7F200003, /**< "OMX.Qualcomm.index.audio.VoiceRecord" */
- QOMX_IndexParamAudioUnused = 0x7F2FFFFF
-} QOMX_AUDIO_EXTENSIONS_INDEXTYPE;
-
-#if defined( __cplusplus )
-}
-#endif /* end of macro __cplusplus */
-
-#endif /* end of macro __H_QOMX_AUDIOINDEXEXTENSIONS_H__ */
diff --git a/mm-core/omxcore/inc/qc_omx_common.h b/mm-core/omxcore/inc/qc_omx_common.h
deleted file mode 100644
index a673d3cd..00000000
--- a/mm-core/omxcore/inc/qc_omx_common.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file qc_omx_common.h
- This module contains the definitions of the OpenMAX core.
-
-*//*========================================================================*/
-
-#ifndef QC_OMX_COMMON_H
-#define QC_OMX_COMMON_H
-
-
-#include <stdio.h> // Standard IO
-#include "OMX_Core.h" // OMX API
-#include "OMX_QCOMExtns.h" // OMX API
-
-#define OMX_CORE_MAX_CMP 1 // MAX Components supported
-#define OMX_CORE_MAX_CMP_ROLES 1 // MAX Roles per component
-#define OMX_SPEC_VERSION 0x00000101 // OMX Version
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void * (*create_qc_omx_component)(void);
-
-#ifdef _ANDROID_
-#define LOG_TAG "QC_CORE"
-#endif
-#include "qc_omx_msg.h"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/mm-core/omxcore/inc/qc_omx_component.h b/mm-core/omxcore/inc/qc_omx_component.h
deleted file mode 100644
index ad226d00..00000000
--- a/mm-core/omxcore/inc/qc_omx_component.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o m p o n e n t I n t e r f a c e
-
-*//** @file qc_omx_component.h
- This module contains the abstract interface for the OpenMAX components.
-
-*//*========================================================================*/
-
-#ifndef QC_OMX_COMPONENT_H
-#define QC_OMX_COMPONENT_H
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-#include "OMX_Core.h"
-#include "OMX_Component.h"
-
-class qc_omx_component
-{
-
-public:
- /* single member to hold the vtable */
- OMX_COMPONENTTYPE m_cmp;
-
-public:
-
- // this is critical, otherwise, sub class destructor will not be called
- virtual ~qc_omx_component(){}
-
- // Initialize the component after creation
- virtual OMX_ERRORTYPE component_init(OMX_IN OMX_STRING componentName)=0;
-
- /*******************************************************************/
- /* Standard OpenMAX Methods */
- /*******************************************************************/
-
- // Query the component for its information
- virtual
- OMX_ERRORTYPE get_component_version(OMX_HANDLETYPE cmp_handle,
- OMX_STRING cmp_name,
- OMX_VERSIONTYPE* cmp_version,
- OMX_VERSIONTYPE* spec_version,
- OMX_UUIDTYPE* cmp_UUID)=0;
-
- // Invoke a command on the component
- virtual
- OMX_ERRORTYPE send_command(OMX_HANDLETYPE cmp_handle,
- OMX_COMMANDTYPE cmd,
- OMX_U32 param1,
- OMX_PTR cmd_data)=0;
-
- // Get a Parameter setting from the component
- virtual
- OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE cmp_handle,
- OMX_INDEXTYPE param_index,
- OMX_PTR param_data)=0;
-
- // Send a parameter structure to the component
- virtual
- OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE cmp_handle,
- OMX_INDEXTYPE param_index,
- OMX_PTR param_data)=0;
-
- // Get a configuration structure from the component
- virtual
- OMX_ERRORTYPE get_config(OMX_HANDLETYPE cmp_handle,
- OMX_INDEXTYPE config_index,
- OMX_PTR config_data)=0;
-
- // Set a component configuration value
- virtual
- OMX_ERRORTYPE set_config(OMX_HANDLETYPE cmp_handle,
- OMX_INDEXTYPE config_index,
- OMX_PTR config_data)=0;
-
- // Translate the vendor specific extension string to
- // standardized index type
- virtual
- OMX_ERRORTYPE get_extension_index(OMX_HANDLETYPE cmp_handle,
- OMX_STRING paramName,
- OMX_INDEXTYPE* indexType)=0;
-
- // Get Current state information
- virtual
- OMX_ERRORTYPE get_state(OMX_HANDLETYPE cmp_handle,
- OMX_STATETYPE* state)=0;
-
- // Component Tunnel Request
- virtual
- OMX_ERRORTYPE component_tunnel_request(OMX_HANDLETYPE cmp_handle,
- OMX_U32 port,
- OMX_HANDLETYPE peer_component,
- OMX_U32 peer_port,
- OMX_TUNNELSETUPTYPE* tunnel_setup)=0;
-
- // Use a buffer already allocated by the IL client
- // or a buffer already supplied by a tunneled component
- virtual
- OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE cmp_handle,
- OMX_BUFFERHEADERTYPE** buffer_hdr,
- OMX_U32 port,
- OMX_PTR app_data,
- OMX_U32 bytes,
- OMX_U8* buffer)=0;
-
-
- // Request that the component allocate new buffer and associated header
- virtual
- OMX_ERRORTYPE allocate_buffer(OMX_HANDLETYPE cmp_handle,
- OMX_BUFFERHEADERTYPE** buffer_hdr,
- OMX_U32 port,
- OMX_PTR app_data,
- OMX_U32 bytes)=0;
-
- // Release the buffer and associated header from the component
- virtual
- OMX_ERRORTYPE free_buffer(OMX_HANDLETYPE cmp_handle,
- OMX_U32 port,
- OMX_BUFFERHEADERTYPE* buffer)=0;
-
- // Send a filled buffer to an input port of a component
- virtual
- OMX_ERRORTYPE empty_this_buffer(OMX_HANDLETYPE cmp_handle,
- OMX_BUFFERHEADERTYPE* buffer)=0;
-
- // Send an empty buffer to an output port of a component
- virtual
- OMX_ERRORTYPE fill_this_buffer(OMX_HANDLETYPE cmp_handle,
- OMX_BUFFERHEADERTYPE* buffer)=0;
-
- // Set callbacks
- virtual
- OMX_ERRORTYPE set_callbacks( OMX_HANDLETYPE cmp_handle,
- OMX_CALLBACKTYPE* callbacks,
- OMX_PTR app_data)=0;
-
- // Component De-Initialize
- virtual
- OMX_ERRORTYPE component_deinit( OMX_HANDLETYPE cmp_handle)=0;
-
- // Use the Image already allocated via EGL
- virtual
- OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE cmp_handle,
- OMX_BUFFERHEADERTYPE** buffer_hdr,
- OMX_U32 port,
- OMX_PTR app_data,
- void* egl_image)=0;
-
- // Component Role enum
- virtual
- OMX_ERRORTYPE component_role_enum( OMX_HANDLETYPE cmp_handle,
- OMX_U8* role,
- OMX_U32 index)=0;
-
-};
-#endif /* QC_OMX_COMPONENT_H */
diff --git a/mm-core/omxcore/inc/qc_omx_msg.h b/mm-core/omxcore/inc/qc_omx_msg.h
deleted file mode 100644
index af8b7e72..00000000
--- a/mm-core/omxcore/inc/qc_omx_msg.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*==========================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file qc_omx_msg.h
- This module contains the definitions of the OpenMAX core.
-
-*//*========================================================================*/
-
-#ifndef _QC_OMX_MSG_H_
-#define _QC_OMX_MSG_H_
-
-#ifdef _ENABLE_QC_MSG_LOG_
- #ifdef _ANDROID_
- #include <utils/Log.h>
- #define DEBUG_PRINT_ERROR ALOGE
- #define DEBUG_PRINT ALOGI
- #define DEBUG_DETAIL ALOGV
- #else
- #define DEBUG_PRINT_ERROR printf
- #define DEBUG_PRINT printf
- #define DEBUG_DETAIL printf
- #endif // _ANDROID_
-#else
- #define DEBUG_PRINT_ERROR
- #define DEBUG_PRINT
- #define DEBUG_DETAIL
-#endif // _ENABLE_QC_MSG_LOG_
-
-
-#endif // _QC_OMX_MSG_H_
diff --git a/mm-core/omxcore/src/7630/qc_registry_table.c b/mm-core/omxcore/src/7630/qc_registry_table.c
deleted file mode 100644
index f7644205..00000000
--- a/mm-core/omxcore/src/7630/qc_registry_table.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- This module contains the registry table for the QCOM's OpenMAX core.
-
-*//*========================================================================*/
-
-#include "qc_omx_core.h"
-
-omx_core_cb_type core[] =
-{
- {
- "OMX.qcom.video.decoder.avc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVdec.so",
- #else
- "libmm-vdec-omxh264.so.1",
- #endif
- {
- "video_decoder.avc"
- }
- },
- {
- "OMX.qcom.video.decoder.mpeg4",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVdec.so",
- #else
- "libmm-vdec-omxmp4.so.1",
- #endif
- {
- "video_decoder.mpeg4"
- }
- },
- {
- "OMX.qcom.video.decoder.vc1",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVdec.so",
- #else
- "libmm-vdec-omxwmv.so.1",
- #endif
- {
- "video_decoder.vc1"
- }
- },
- {
- "OMX.qcom.video.decoder.h263",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVdec.so",
- #else
- "libmm-vdec-omxmp4.so.1",
- #endif
- {
- "video_decoder.h263"
- }
- },
- {
- "OMX.qcom.video.encoder.mpeg4",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVenc.so",
- #else
- "libmm-venc-omx.so.1",
- #endif
- {
- "video_encoder.mpeg4"
- }
- },
- {
- "OMX.qcom.video.encoder.h263",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVenc.so",
- #else
- "libmm-venc-omx.so.1",
- #endif
- {
- "video_encoder.h263",
- }
- },
- {
- "OMX.qcom.video.encoder.avc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxVenc.so",
- #else
- "libmm-venc-omx.so.1",
- #endif
- {
- "video_encoder.avc"
- }
- },
- {
- "OMX.qcom.audio.decoder.mp3",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxMp3Dec.so",
- #else
- "libmm-adec-omxmp3.so.1",
- #endif
- {
- "audio_decoder.mp3"
- }
- },
- {
- "OMX.qcom.audio.decoder.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAacDec.so",
- #else
- "libmm-adec-omxaac.so.1",
- #endif
- {
- "audio_decoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.mp3",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxMp3Dec.so",
- #else
- "libmm-adec-omxmp3.so.1",
- #endif
- {
- "audio_decoder.mp3"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAacDec.so",
- #else
- "libmm-adec-omxaac.so.1",
- #endif
- {
- "audio_decoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrnb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrDec.so",
- #else
- "libmm-adec-omxamr.so.1",
- #endif
- {
- "audio_decoder.amrnb"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrnb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrDec.so",
- #else
- "libmm-adec-omxamr.so.1",
- #endif
- {
- "audio_decoder.amrnb"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAacEnc.so",
- #else
- "libmm-aenc-omxaac.so.1",
- #endif
- {
- "audio_encoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.Qcelp13",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxQcelpDec.so",
- #else
- "libmm-adec-omxQcelp13.so.1",
- #endif
- {
- "audio_decoder.Qcelp13"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.Qcelp13",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxQcelpDec.so",
- #else
- "libmm-adec-omxQcelp13.so.1",
- #endif
- {
- "audio_decoder.Qcelp13"
- }
- },
- {
- "OMX.qcom.audio.decoder.evrc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxEvrcDec.so",
- #else
- "libmm-adec-omxevrc.so.1",
- #endif
- {
- "audio_decoder.evrc"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.evrc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxEvrcDec.so",
- #else
- "libmm-adec-omxevrc.so.1",
- #endif
- {
- "audio_decoder.evrc"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.amr",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrEnc.so",
- #else
- "libmm-aenc-omxamr.so.1",
- #endif
- {
- "audio_encoder.amr"
- }
- },
- {
- "OMX.qcom.audio.decoder.wma",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxWmaDec.so",
- #else
- "libmm-adec-omxwma.so.1",
- #endif
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.wma",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxWmaDec.so",
- #else
- "libmm-adec-omxwma.so.1",
- #endif
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.wma10Pro",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxWmaDec.so",
- #else
- "libmm-adec-omxwma.so.1",
- #endif
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.wma10Pro",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxWmaDec.so",
- #else
- "libmm-adec-omxwma.so.1",
- #endif
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrwb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrwbDec.so",
- #else
- "libmm-adec-omxamrwb.so.1",
- #endif
- {
- "audio_decoder.amrwb"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrwb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrwbDec.so",
- #else
- "libmm-adec-omxamrwb.so.1",
- #endif
- {
- "audio_decoder.amrwb"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrwbp",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrwbDec.so",
- #else
- "libmm-adec-omxamrwb.so.1",
- #endif
- {
- "audio_decoder.amrwbp"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrwbp",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAmrwbDec.so",
- #else
- "libmm-adec-omxamrwb.so.1",
- #endif
- {
- "audio_decoder.amrwbp"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.qcelp13",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxQcelp13Enc.so",
- #else
- "libmm-aenc-omxqcelp13.so.1",
- #endif
- {
- "audio_encoder.qcelp13"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.evrc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxEvrcEnc.so",
- #else
- "libmm-aenc-omxevrc.so.1",
- #endif
- {
- "audio_encoder.evrc"
- }
- },
- {
- "OMX.qcom.audio.decoder.adpcm",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAdpcmDec.so",
- #else
- "libmm-adec-omxadpcm.so.1",
- #endif
- {
- "audio_decoder.adpcm"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.adpcm",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- #ifdef _ANDROID_
- "libOmxAdpcmDec.so",
- #else
- "libmm-adec-omxadpcm.so.1",
- #endif
- {
- "audio_decoder.adpcm"
- }
- }
-};
-
-const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
-
-
diff --git a/mm-core/omxcore/src/7630/qc_registry_table_android.c b/mm-core/omxcore/src/7630/qc_registry_table_android.c
deleted file mode 100644
index 764aea80..00000000
--- a/mm-core/omxcore/src/7630/qc_registry_table_android.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- This module contains the registry table for the QCOM's OpenMAX core.
-
-*//*========================================================================*/
-
-
-#include "qc_omx_core.h"
-
-omx_core_cb_type core[] =
-{
- {
- "OMX.qcom.video.decoder.avc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVdec.so",
- {
- "video_decoder.avc"
- }
- },
- {
- "OMX.qcom.video.decoder.mpeg4",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVdec.so",
- {
- "video_decoder.mpeg4"
- }
- },
- {
- "OMX.qcom.video.decoder.vc1",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVdec.so",
- {
- "video_decoder.vc1"
- }
- },
- {
- "OMX.qcom.video.decoder.h263",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVdec.so",
- {
- "video_decoder.h263"
- }
- },
- {
- "OMX.qcom.video.encoder.mpeg4",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVenc.so",
- {
- "video_encoder.mpeg4"
- }
- },
- {
- "OMX.qcom.video.encoder.h263",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVenc.so",
- {
- "video_encoder.h263"
- }
- },
- {
- "OMX.qcom.video.encoder.avc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxVenc.so",
- {
- "video_encoder.avc"
- }
- },
- {
- "OMX.qcom.audio.decoder.Qcelp13",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxQcelpDec.so",
- {
- "audio_decoder.Qcelp13"
- }
- },
- {
- "OMX.qcom.audio.decoder.evrc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxEvrcDec.so",
- {
- "audio_decoder.evrc"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrwbp",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrwbDec.so",
- {
- "audio_decoder.amrwbp"
- }
- },
-#ifndef _ANDROID_
- {
- "OMX.qcom.audio.decoder.mp3",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxMp3Dec.so",
- {
- "audio_decoder.mp3"
- }
- },
- {
- "OMX.qcom.audio.decoder.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAacDec.so",
- {
- "audio_decoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrnb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrDec.so",
- {
- "audio_decoder.amrnb"
- }
- },
- {
- "OMX.qcom.audio.decoder.amrwb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrwbDec.so",
- {
- "audio_decoder.amrwb"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.mp3",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxMp3Dec.so",
- {
- "audio_decoder.mp3"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAacDec.so",
- {
- "audio_decoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrnb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrDec.so",
- {
- "audio_decoder.amrnb"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.aac",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAacEnc.so",
- {
- "audio_encoder.aac"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.Qcelp13",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxQcelpDec.so",
- {
- "audio_decoder.Qcelp13"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.evrc",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxEvrcDec.so",
- {
- "audio_decoder.evrc"
- }
- },
- {
- "OMX.qcom.audio.encoder.tunneled.amr",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrEnc.so",
- {
- "audio_encoder.amr"
- }
- },
- {
- "OMX.qcom.audio.decoder.wma",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxWmaDec.so",
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.wma",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxWmaDec.so",
- {
- "audio_decoder.wma"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrwb",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- }
- NULL, // Shared object library handle
- "libOmxAmrwbDec.so",
- {
- "audio_decoder.amrwb"
- }
- },
- {
- "OMX.qcom.audio.decoder.tunneled.amrwbp",
- NULL, // Create instance function
- // Unique instance handle
- {
- NULL,
- NULL,
- NULL,
- NULL
- },
- NULL, // Shared object library handle
- "libOmxAmrwbDec.so",
- {
- "audio_decoder.amrwbp"
- }
- }
-#endif
-};
-
-const unsigned int SIZE_OF_CORE = sizeof(core) / sizeof(omx_core_cb_type);
-
-
diff --git a/mm-core/omxcore/src/common/omx_core_cmp.cpp b/mm-core/omxcore/src/common/omx_core_cmp.cpp
deleted file mode 100644
index a6417434..00000000
--- a/mm-core/omxcore/src/common/omx_core_cmp.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- This module contains the implementation of the OpenMAX core Macros which
- operate directly on the component.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-#include "qc_omx_common.h"
-#include "omx_core_cmp.h"
-#include "qc_omx_component.h"
-#include <string.h>
-
-
-void * qc_omx_create_component_wrapper(OMX_PTR obj_ptr)
-{
- qc_omx_component *pThis = (qc_omx_component *)obj_ptr;
- OMX_COMPONENTTYPE* component = &(pThis->m_cmp);
- memset(&pThis->m_cmp,0,sizeof(OMX_COMPONENTTYPE));
-
- component->nSize = sizeof(OMX_COMPONENTTYPE);
- component->nVersion.nVersion = OMX_SPEC_VERSION;
- component->pApplicationPrivate = 0;
- component->pComponentPrivate = obj_ptr;
-
- component->AllocateBuffer = &qc_omx_component_allocate_buffer;
- component->FreeBuffer = &qc_omx_component_free_buffer;
- component->GetParameter = &qc_omx_component_get_parameter;
- component->SetParameter = &qc_omx_component_set_parameter;
- component->SendCommand = &qc_omx_component_send_command;
- component->FillThisBuffer = &qc_omx_component_fill_this_buffer;
- component->EmptyThisBuffer = &qc_omx_component_empty_this_buffer;
- component->GetState = &qc_omx_component_get_state;
- component->GetComponentVersion = &qc_omx_component_get_version;
- component->GetConfig = &qc_omx_component_get_config;
- component->SetConfig = &qc_omx_component_set_config;
- component->GetExtensionIndex = &qc_omx_component_get_extension_index;
- component->ComponentTunnelRequest = &qc_omx_component_tunnel_request;
- component->UseBuffer = &qc_omx_component_use_buffer;
- component->SetCallbacks = &qc_omx_component_set_callbacks;
- component->UseEGLImage = &qc_omx_component_use_EGL_image;
- component->ComponentRoleEnum = &qc_omx_component_role_enum;
- component->ComponentDeInit = &qc_omx_component_deinit;
- return (void *)component;
-}
-
-
-
-/************************************************************************/
-/* COMPONENT INTERFACE */
-/************************************************************************/
-
-OMX_ERRORTYPE
-qc_omx_component_init(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_STRING componentName)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_init %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- // call the init fuction
- eRet = pThis->component_init(componentName);
-
- if(eRet != OMX_ErrorNone)
- {
- // in case of error, please destruct the component created
- delete pThis;
- }
- }
- return eRet;
-}
-
-
-OMX_ERRORTYPE
-qc_omx_component_get_version(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STRING componentName,
- OMX_OUT OMX_VERSIONTYPE* componentVersion,
- OMX_OUT OMX_VERSIONTYPE* specVersion,
- OMX_OUT OMX_UUIDTYPE* componentUUID)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_get_version %x, %s , %x\n",(unsigned)hComp,componentName,(unsigned)componentVersion);
- if(pThis)
- {
- eRet = pThis->get_component_version(hComp,componentName,componentVersion,specVersion,componentUUID);
- }
- return eRet;
-}
-
-OMX_ERRORTYPE
-qc_omx_component_send_command(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_send_command %x, %d , %d\n",(unsigned)hComp,(unsigned)cmd,(unsigned)param1);
-
- if(pThis)
- {
- eRet = pThis->send_command(hComp,cmd,param1,cmdData);
- }
- return eRet;
-}
-
-OMX_ERRORTYPE
-qc_omx_component_get_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_INOUT OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_get_parameter %x, %x , %d\n",(unsigned)hComp,(unsigned)paramData,paramIndex);
-
- if(pThis)
- {
- eRet = pThis->get_parameter(hComp,paramIndex,paramData);
- }
- return eRet;
-}
-
-OMX_ERRORTYPE
-qc_omx_component_set_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_IN OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_set_parameter %x, %x , %d\n",(unsigned)hComp,(unsigned)paramData,paramIndex);
-
- if(pThis)
- {
- eRet = pThis->set_parameter(hComp,paramIndex,paramData);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_get_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_INOUT OMX_PTR configData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_get_config %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- eRet = pThis->get_config(hComp,
- configIndex,
- configData);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_set_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_IN OMX_PTR configData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_set_config %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- eRet = pThis->set_config(hComp,
- configIndex,
- configData);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_STRING paramName,
- OMX_OUT OMX_INDEXTYPE* indexType)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- if(pThis)
- {
- eRet = pThis->get_extension_index(hComp,paramName,indexType);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_get_state(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STATETYPE* state)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_get_state %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- eRet = pThis->get_state(hComp,state);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_tunnel_request(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_HANDLETYPE peerComponent,
- OMX_IN OMX_U32 peerPort,
- OMX_INOUT OMX_TUNNELSETUPTYPE* tunnelSetup)
-{
- DEBUG_PRINT("Error: qc_omx_component_tunnel_request Not Implemented\n");
- return OMX_ErrorNotImplemented;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_use_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_use_buffer %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- eRet = pThis->use_buffer(hComp,
- bufferHdr,
- port,
- appData,
- bytes,
- buffer);
- }
- return eRet;
-}
-
-
-// qc_omx_component_allocate_buffer -- API Call
- OMX_ERRORTYPE
-qc_omx_component_allocate_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_allocate_buffer %x, %x , %d\n",(unsigned)hComp,(unsigned)bufferHdr,(unsigned)port);
-
- if(pThis)
- {
- eRet = pThis->allocate_buffer(hComp,bufferHdr,port,appData,bytes);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_free_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_free_buffer[%d] %x, %x\n", (unsigned)port, (unsigned)hComp, (unsigned)buffer);
-
- if(pThis)
- {
- eRet = pThis->free_buffer(hComp,port,buffer);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_empty_this_buffer %x, %x\n",(unsigned)hComp,(unsigned)buffer);
-
- if(pThis)
- {
- eRet = pThis->empty_this_buffer(hComp,buffer);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_fill_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_fill_this_buffer %x, %x\n",(unsigned)hComp,(unsigned)buffer);
- if(pThis)
- {
- eRet = pThis->fill_this_buffer(hComp,buffer);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_set_callbacks(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_CALLBACKTYPE* callbacks,
- OMX_IN OMX_PTR appData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_set_callbacks %x, %x , %x\n",(unsigned)hComp,(unsigned)callbacks,(unsigned)appData);
-
- if(pThis)
- {
- eRet = pThis->set_callbacks(hComp,callbacks,appData);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_deinit(OMX_IN OMX_HANDLETYPE hComp)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_deinit %x\n",(unsigned)hComp);
-
- if(pThis)
- {
- // call the deinit fuction first
- OMX_STATETYPE state;
- pThis->get_state(hComp,&state);
- DEBUG_PRINT("Calling FreeHandle in state %d \n", state);
- eRet = pThis->component_deinit(hComp);
- // destroy the component.
- delete pThis;
- ((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate = NULL;
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_use_EGL_image(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN void* eglImage)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_use_EGL_image %x, %x , %d\n",(unsigned)hComp,(unsigned)bufferHdr,(unsigned)port);
- if(pThis)
- {
- eRet = pThis->use_EGL_image(hComp,bufferHdr,port,appData,eglImage);
- }
- return eRet;
-}
-
- OMX_ERRORTYPE
-qc_omx_component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_U8* role,
- OMX_IN OMX_U32 index)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorBadParameter;
- qc_omx_component *pThis = (hComp)? (qc_omx_component *)(((OMX_COMPONENTTYPE *)hComp)->pComponentPrivate):NULL;
- DEBUG_PRINT("OMXCORE: qc_omx_component_role_enum %x, %x , %d\n",(unsigned)hComp,(unsigned)role,(unsigned)index);
-
- if(pThis)
- {
- eRet = pThis->component_role_enum(hComp,role,index);
- }
- return eRet;
-}
diff --git a/mm-core/omxcore/src/common/omx_core_cmp.h b/mm-core/omxcore/src/common/omx_core_cmp.h
deleted file mode 100644
index 1daf26ed..00000000
--- a/mm-core/omxcore/src/common/omx_core_cmp.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- OpenMAX Core Macros interface.
-
-============================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-#ifndef OMX_CORE_CMP_H
-#define OMX_CORE_CMP_H
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-void * qc_omx_create_component_wrapper(OMX_PTR obj_ptr);
-
-
-OMX_ERRORTYPE
-qc_omx_component_init(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_STRING componentName);
-
-
-OMX_ERRORTYPE
-qc_omx_component_get_version(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STRING componentName,
- OMX_OUT OMX_VERSIONTYPE* componentVersion,
- OMX_OUT OMX_VERSIONTYPE* specVersion,
- OMX_OUT OMX_UUIDTYPE* componentUUID);
-
-OMX_ERRORTYPE
-qc_omx_component_send_command(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData);
-
-OMX_ERRORTYPE
-qc_omx_component_get_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_INOUT OMX_PTR paramData);
-
-OMX_ERRORTYPE
-qc_omx_component_set_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_IN OMX_PTR paramData);
-
-OMX_ERRORTYPE
-qc_omx_component_get_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_INOUT OMX_PTR configData);
-
-OMX_ERRORTYPE
-qc_omx_component_set_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_IN OMX_PTR configData);
-
-OMX_ERRORTYPE
-qc_omx_component_get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_STRING paramName,
- OMX_OUT OMX_INDEXTYPE* indexType);
-
-OMX_ERRORTYPE
-qc_omx_component_get_state(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STATETYPE* state);
-
-OMX_ERRORTYPE
-qc_omx_component_tunnel_request(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_HANDLETYPE peerComponent,
- OMX_IN OMX_U32 peerPort,
- OMX_INOUT OMX_TUNNELSETUPTYPE* tunnelSetup);
-
-OMX_ERRORTYPE
-qc_omx_component_use_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer);
-
-
-// qc_omx_component_allocate_buffer -- API Call
-OMX_ERRORTYPE
-qc_omx_component_allocate_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes);
-
-OMX_ERRORTYPE
-qc_omx_component_free_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer);
-
-OMX_ERRORTYPE
-qc_omx_component_empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer);
-
-OMX_ERRORTYPE
-qc_omx_component_fill_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer);
-
-OMX_ERRORTYPE
-qc_omx_component_set_callbacks(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_CALLBACKTYPE* callbacks,
- OMX_IN OMX_PTR appData);
-
-OMX_ERRORTYPE
-qc_omx_component_deinit(OMX_IN OMX_HANDLETYPE hComp);
-
-OMX_ERRORTYPE
-qc_omx_component_use_EGL_image(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN void* eglImage);
-
-OMX_ERRORTYPE
-qc_omx_component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_U8* role,
- OMX_IN OMX_U32 index);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/mm-core/omxcore/src/common/qc_omx_core.c b/mm-core/omxcore/src/common/qc_omx_core.c
deleted file mode 100644
index d41397fe..00000000
--- a/mm-core/omxcore/src/common/qc_omx_core.c
+++ /dev/null
@@ -1,847 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- This module contains the implementation of the OpenMAX core.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include <dlfcn.h> // dynamic library
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "qc_omx_core.h"
-#include "omx_core_cmp.h"
-
-#define DEBUG_PRINT_ERROR printf
-#define DEBUG_PRINT printf
-#define DEBUG_DETAIL printf
-
-extern omx_core_cb_type core[];
-extern const unsigned int SIZE_OF_CORE;
-
-
-/* ======================================================================
-FUNCTION
- omx_core_load_cmp_library
-
-DESCRIPTION
- Loads up the libary name mentioned in the argument
-
-PARAMETERS
- None
-
-RETURN VALUE
- Constructor for creating component instances.
-========================================================================== */
-static create_qc_omx_component
-omx_core_load_cmp_library(char *libname, void **handle_ptr)
-{
- create_qc_omx_component fn_ptr = NULL;
- if(handle_ptr)
- {
- DEBUG_PRINT("Dynamically Loading the library : %s\n",libname);
- *handle_ptr = dlopen(libname,RTLD_NOW);
- if(*handle_ptr)
- {
- fn_ptr = dlsym(*handle_ptr, "get_omx_component_factory_fn");
-
- if(fn_ptr == NULL)
- {
- DEBUG_PRINT("Error: Library %s incompatible as QCOM OMX component loader - %s\n",
- libname, dlerror());
- *handle_ptr = NULL;
- }
- }
- else
- {
- DEBUG_PRINT("Error: Couldn't load %s: %s\n",libname,dlerror());
- }
- }
- return fn_ptr;
-}
-
-/* ======================================================================
-FUNCTION
- OMX_Init
-
-DESCRIPTION
- This is the first function called by the application.
- There is nothing to do here since components shall be loaded
- whenever the get handle method is called.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_Init()
-{
- DEBUG_PRINT("OMXCORE API - OMX_Init \n");
- /* Nothing to do here ; shared objects shall be loaded at the get handle method */
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- get_cmp_index
-
-DESCRIPTION
- Obtains the index associated with the name.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None.
-========================================================================== */
-static int get_cmp_index(char *cmp_name)
-{
- int rc = -1,i=0;
- DEBUG_PRINT("before get_cmp_index **********%d\n", rc);
-
- for(i=0; i< (int)SIZE_OF_CORE; i++)
- {
- DEBUG_PRINT("get_cmp_index: cmp_name = %s , core[i].name = %s ,count = %d \n",cmp_name,core[i].name,i);
-
- if(!strcmp(cmp_name, core[i].name))
- {
- rc = i;
- break;
- }
- }
- DEBUG_PRINT("returning index %d\n", rc);
- return rc;
-}
-
-/* ======================================================================
-FUNCTION
- clear_cmp_handle
-
-DESCRIPTION
- Clears the component handle from the component table.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-static void clear_cmp_handle(OMX_HANDLETYPE inst)
-{
- unsigned i = 0,j=0;
-
- if(NULL == inst)
- return;
-
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(inst == core[i].inst[j])
- {
- core[i].inst[j] = NULL;
- return;
- }
- }
- }
- return;
-}
-/* ======================================================================
-FUNCTION
- is_cmp_handle_exists
-
-DESCRIPTION
- Check if the component handle already exists or not.
-
-PARAMETERS
- None
-
-RETURN VALUE
- index pointer if the handle exists
- negative value otherwise
-========================================================================== */
-static int is_cmp_handle_exists(OMX_HANDLETYPE inst)
-{
- unsigned i=0,j=0;
- int rc = -1;
-
- if(NULL == inst)
- return rc;
-
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(inst == core[i].inst[j])
- {
- rc = i;
- return rc;
- }
- }
- }
- return rc;
-}
-
-/* ======================================================================
-FUNCTION
- get_comp_handle_index
-
-DESCRIPTION
- Gets the index to store the next handle for specified component name.
-
-PARAMETERS
- cmp_name : Component Name
-
-RETURN VALUE
- Index of next handle to be stored
-========================================================================== */
-static int get_comp_handle_index(char *cmp_name)
-{
- unsigned i=0,j=0;
- int rc = -1;
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- if(!strcmp(cmp_name, core[i].name))
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(NULL == core[i].inst[j])
- {
- rc = j;
- DEBUG_PRINT("free handle slot exists %d\n", rc);
- return rc;
- }
- }
- break;
- }
- }
- return rc;
-}
-
-/* ======================================================================
-FUNCTION
- check_lib_unload
-
-DESCRIPTION
- Check if any component instance is using the library
-
-PARAMETERS
- index: Component Index in core array.
-
-RETURN VALUE
- 1: Library Unused and can be unloaded.
- 0: Library used and shouldnt be unloaded.
-========================================================================== */
-static int check_lib_unload(int index)
-{
- unsigned i=0;
- int rc = 1;
-
- for(i=0; i< OMX_COMP_MAX_INST; i++)
- {
- if(core[index].inst[i])
- {
- rc = 0;
- DEBUG_PRINT("Library Used \n");
- break;
- }
- }
- return rc;
-}
-/* ======================================================================
-FUNCTION
- is_cmp_already_exists
-
-DESCRIPTION
- Check if the component already exists or not. Used in the
- management of component handles.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None.
-========================================================================== */
-static int is_cmp_already_exists(char *cmp_name)
-{
- unsigned i =0,j=0;
- int rc = -1;
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- if(!strcmp(cmp_name, core[i].name))
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(core[i].inst[j])
- {
- rc = i;
- DEBUG_PRINT("Component exists %d\n", rc);
- return rc;
- }
- }
- break;
- }
- }
- return rc;
-}
-
-/* ======================================================================
-FUNCTION
- get_cmp_handle
-
-DESCRIPTION
- Get component handle.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None.
-========================================================================== */
-void* get_cmp_handle(char *cmp_name)
-{
- unsigned i =0,j=0;
-
- DEBUG_PRINT("get_cmp_handle \n");
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- if(!strcmp(cmp_name, core[i].name))
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(core[i].inst[j])
- {
- DEBUG_PRINT("get_cmp_handle match\n");
- return core[i].inst[j];
- }
- }
- }
- }
- DEBUG_PRINT("get_cmp_handle returning NULL \n");
- return NULL;
-}
-
-/* ======================================================================
-FUNCTION
- OMX_DeInit
-
-DESCRIPTION
- DeInitialize all the the relevant OMX components.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_Deinit()
-{
- int err;
- unsigned i=0,j=0;
- OMX_ERRORTYPE eRet;
-
- /* Free the dangling handles here if any */
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- for(j=0; j< OMX_COMP_MAX_INST; j++)
- {
- if(core[i].inst[j])
- {
- DEBUG_PRINT("OMX DeInit: Freeing handle for %s\n",
- core[i].name);
-
- /* Release the component and unload dynmaic library */
- eRet = OMX_FreeHandle(core[i].inst[j]);
- if(eRet != OMX_ErrorNone)
- return eRet;
- }
- }
- }
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- OMX_GetHandle
-
-DESCRIPTION
- Constructs requested component. Relevant library is loaded if needed.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None if everything goes fine.
-========================================================================== */
-
- OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_GetHandle(OMX_OUT OMX_HANDLETYPE* handle,
- OMX_IN OMX_STRING componentName,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_CALLBACKTYPE* callBacks)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- int cmp_index = -1;
- int hnd_index = -1;
-
- DEBUG_PRINT("OMXCORE API : Get Handle %x %s %x\n",(unsigned) handle,
- componentName,
- (unsigned) appData);
- if(handle)
- {
- struct stat sd;
-
- *handle = NULL;
- if(stat("/dev/pmem_adsp",&sd) != 0)
- return OMX_ErrorInsufficientResources;
-
- cmp_index = get_cmp_index(componentName);
-
- if(cmp_index >= 0)
- {
- DEBUG_PRINT("getting fn pointer\n");
-
- // dynamically load the so
- core[cmp_index].fn_ptr =
- omx_core_load_cmp_library(core[cmp_index].so_lib_name,
- &core[cmp_index].so_lib_handle);
-
- if(core[cmp_index].fn_ptr)
- {
- // Construct the component requested
- // Function returns the opaque handle
- void* pThis = (*(core[cmp_index].fn_ptr))();
- if(pThis)
- {
- void *hComp = NULL;
- hComp = qc_omx_create_component_wrapper((OMX_PTR)pThis);
- if((eRet = qc_omx_component_init(hComp, core[cmp_index].name)) !=
- OMX_ErrorNone)
- {
- DEBUG_PRINT("Component not created succesfully\n");
- return eRet;
-
- }
- qc_omx_component_set_callbacks(hComp,callBacks,appData);
- hnd_index = get_comp_handle_index(componentName);
- if(hnd_index >= 0)
- {
- core[cmp_index].inst[hnd_index]= *handle = (OMX_HANDLETYPE) hComp;
- }
- else
- {
- DEBUG_PRINT("OMX_GetHandle:NO free slot available to store Component Handle\n");
- return OMX_ErrorInsufficientResources;
- }
- DEBUG_PRINT("Component %x Successfully created\n",(unsigned)*handle);
- }
- else
- {
- eRet = OMX_ErrorInsufficientResources;
- DEBUG_PRINT("Component Creation failed\n");
- }
- }
- else
- {
- eRet = OMX_ErrorNotImplemented;
- DEBUG_PRINT("library couldnt return create instance fn\n");
- }
-
- }
- else
- {
- eRet = OMX_ErrorNotImplemented;
- DEBUG_PRINT("ERROR: Already another instance active ;rejecting \n");
- }
- }
- else
- {
- eRet = OMX_ErrorBadParameter;
- DEBUG_PRINT("\n OMX_GetHandle: NULL handle \n");
- }
- return eRet;
-}
-/* ======================================================================
-FUNCTION
- OMX_FreeHandle
-
-DESCRIPTION
- Destructs the component handles.
-
-PARAMETERS
- None
-
-RETURN VALUE
- Error None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_FreeHandle(OMX_IN OMX_HANDLETYPE hComp)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- int err = 0, i = 0;
- DEBUG_PRINT("OMXCORE API : Free Handle %x\n",(unsigned) hComp);
-
- // 0. Check that we have an active instance
- if((i=is_cmp_handle_exists(hComp)) >=0)
- {
- // 1. Delete the component
- if ((eRet = qc_omx_component_deinit(hComp)) == OMX_ErrorNone)
- {
- /* Unload component library */
- if( ((unsigned int)i < SIZE_OF_CORE) && core[i].so_lib_handle)
- {
- if(check_lib_unload(i))
- {
- DEBUG_PRINT_ERROR(" Unloading the dynamic library for %s\n",
- core[i].name);
- err = dlclose(core[i].so_lib_handle);
- if(err)
- {
- DEBUG_PRINT_ERROR("Error %d in dlclose of lib %s\n",
- err,core[i].name);
- }
- core[i].so_lib_handle = NULL;
- }
- }
- clear_cmp_handle(hComp);
- }
- else
- {
- DEBUG_PRINT(" OMX_FreeHandle failed on %x\n",(unsigned) hComp);
- return eRet;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("OMXCORE Warning: Free Handle called with no active instances\n");
- }
- return OMX_ErrorNone;
-}
-/* ======================================================================
-FUNCTION
- OMX_SetupTunnel
-
-DESCRIPTION
- Not Implemented.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_SetupTunnel(OMX_IN OMX_HANDLETYPE outputComponent,
- OMX_IN OMX_U32 outputPort,
- OMX_IN OMX_HANDLETYPE inputComponent,
- OMX_IN OMX_U32 inputPort)
-{
- /* Not supported right now */
- DEBUG_PRINT("OMXCORE API: OMX_SetupTunnel Not implemented \n");
- return OMX_ErrorNotImplemented;
-}
-/* ======================================================================
-FUNCTION
- OMX_GetContentPipe
-
-DESCRIPTION
- Not Implemented.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE
-OMX_GetContentPipe(OMX_OUT OMX_HANDLETYPE* pipe,
- OMX_IN OMX_STRING uri)
-{
- /* Not supported right now */
- DEBUG_PRINT("OMXCORE API: OMX_GetContentPipe Not implemented \n");
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- OMX_GetComponentNameEnum
-
-DESCRIPTION
- Returns the component name associated with the index.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE OMX_APIENTRY
-OMX_ComponentNameEnum(OMX_OUT OMX_STRING componentName,
- OMX_IN OMX_U32 nameLen,
- OMX_IN OMX_U32 index)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- DEBUG_PRINT("OMXCORE API - OMX_ComponentNameEnum %x %d %d\n",(unsigned) componentName
- ,(unsigned)nameLen
- ,(unsigned)index);
- if(index < SIZE_OF_CORE)
- {
- #ifdef _ANDROID_
- strlcpy(componentName, core[index].name,nameLen);
- #else
- strncpy(componentName, core[index].name,nameLen);
- #endif
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- OMX_GetComponentsOfRole
-
-DESCRIPTION
- Returns the component name which can fulfill the roles passed in the
- argument.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE
-OMX_GetComponentsOfRole(OMX_IN OMX_STRING role,
- OMX_INOUT OMX_U32* numComps,
- OMX_INOUT OMX_U8** compNames)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned i,j,namecount=0;
-
- printf(" Inside OMX_GetComponentsOfRole \n");
-
- /*If CompNames is NULL then return*/
- if (compNames == NULL)
- {
- if (numComps == NULL)
- {
- eRet = OMX_ErrorBadParameter;
- }
- else
- {
- *numComps = 0;
- for (i=0; i<SIZE_OF_CORE;i++)
- {
- for(j=0; j<OMX_CORE_MAX_CMP_ROLES && core[i].roles[j] ; j++)
- {
- if(!strcmp(role,core[i].roles[j]))
- {
- (*numComps)++;
- }
- }
- }
- }
- return eRet;
- }
-
- if(numComps)
- {
- namecount = *numComps;
-
- if (namecount == 0)
- {
- return OMX_ErrorBadParameter;
- }
-
- *numComps = 0;
-
- for (i=0; i<SIZE_OF_CORE;i++)
- {
- for(j=0; j<OMX_CORE_MAX_CMP_ROLES && core[i].roles[j] ; j++)
- {
- if(!strcmp(role,core[i].roles[j]))
- {
- #ifdef _ANDROID_
- strlcpy((char *)compNames[*numComps],core[i].name, OMX_MAX_STRINGNAME_SIZE);
- #else
- strncpy((char *)compNames[*numComps],core[i].name, OMX_MAX_STRINGNAME_SIZE);
- #endif
- (*numComps)++;
- break;
- }
- }
- if (*numComps == namecount)
- {
- break;
- }
- }
- }
- else
- {
- eRet = OMX_ErrorBadParameter;
- }
-
- printf(" Leaving OMX_GetComponentsOfRole \n");
- return eRet;
-}
-/* ======================================================================
-FUNCTION
- OMX_GetRolesOfComponent
-
-DESCRIPTION
- Returns the primary role of the components supported.
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-OMX_API OMX_ERRORTYPE
-OMX_GetRolesOfComponent(OMX_IN OMX_STRING compName,
- OMX_INOUT OMX_U32* numRoles,
- OMX_OUT OMX_U8** roles)
-{
- /* Not supported right now */
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned i,j,numofroles = 0;;
- DEBUG_PRINT("GetRolesOfComponent %s\n",compName);
-
- if (roles == NULL)
- {
- if (numRoles == NULL)
- {
- eRet = OMX_ErrorBadParameter;
- }
- else
- {
- *numRoles = 0;
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- if(!strcmp(compName,core[i].name))
- {
- for(j=0; (j<OMX_CORE_MAX_CMP_ROLES) && core[i].roles[j];j++)
- {
- (*numRoles)++;
- }
- break;
- }
- }
-
- }
- return eRet;
- }
-
- if(numRoles)
- {
- if (*numRoles == 0)
- {
- return OMX_ErrorBadParameter;
- }
-
- numofroles = *numRoles;
- *numRoles = 0;
- for(i=0; i< SIZE_OF_CORE; i++)
- {
- if(!strcmp(compName,core[i].name))
- {
- for(j=0; (j<OMX_CORE_MAX_CMP_ROLES) && core[i].roles[j];j++)
- {
- if(roles && roles[*numRoles])
- {
- #ifdef _ANDROID_
- strlcpy((char *)roles[*numRoles],core[i].roles[j],OMX_MAX_STRINGNAME_SIZE);
- #else
- strncpy((char *)roles[*numRoles],core[i].roles[j],OMX_MAX_STRINGNAME_SIZE);
- #endif
- }
- (*numRoles)++;
- if (numofroles == *numRoles)
- {
- break;
- }
- }
- break;
- }
- }
- }
- else
- {
- DEBUG_PRINT("ERROR: Both Roles and numRoles Invalid\n");
- eRet = OMX_ErrorBadParameter;
- }
- return eRet;
-}
-
-OMX_API OMX_BOOL
-OMXConfigParser(
- OMX_PTR aInputParameters,
- OMX_PTR aOutputParameters)
-{
- OMX_BOOL Status = OMX_TRUE;
- VideoOMXConfigParserOutputs *aOmxOutputParameters;
- OMXConfigParserInputs *aOmxInputParameters;
- aOmxOutputParameters = (VideoOMXConfigParserOutputs *)aOutputParameters;
- aOmxInputParameters = (OMXConfigParserInputs *)aInputParameters;
-
- aOmxOutputParameters->width = 176; //setting width to QCIF
- aOmxOutputParameters->height = 144; //setting height to QCIF
-
- //TODO
- //Qcom component do not use the level/profile from IL client .They are parsing the first buffer
- //sent in ETB so for now setting the defalut values . Going farward we can call
- //QC parser here.
- if (0 == strcmp(aOmxInputParameters->cComponentRole, (OMX_STRING)"video_decoder.avc"))
- {
- aOmxOutputParameters->profile = 66; //minimum supported h264 profile - setting to baseline profile
- aOmxOutputParameters->level = 0; // minimum supported h264 level
- }
- else if ((0 == strcmp(aOmxInputParameters->cComponentRole, (OMX_STRING)"video_decoder.mpeg4")) || (0 == strcmp(aOmxInputParameters ->cComponentRole, (OMX_STRING)"video_decoder.h263")))
- {
- aOmxOutputParameters->profile = 8; //minimum supported h263/mpeg4 profile
- aOmxOutputParameters->level = 0; // minimum supported h263/mpeg4 level
- }
-
- return Status;
-}
diff --git a/mm-core/omxcore/src/common/qc_omx_core.h b/mm-core/omxcore/src/common/qc_omx_core.h
deleted file mode 100644
index c3ae26a1..00000000
--- a/mm-core/omxcore/src/common/qc_omx_core.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
- This module contains the definitions of the OpenMAX core.
-
-*//*========================================================================*/
-
-#ifndef QC_OMX_CORE_H
-#define QC_OMX_CORE_H
-
-#include "qc_omx_common.h" // OMX API
-#include <string.h>
-
-#define OMX_COMP_MAX_INST 4
-
-typedef struct _omx_core_cb_type
-{
- char* name;// Component name
- create_qc_omx_component fn_ptr;// create instance fn ptr
- void* inst[OMX_COMP_MAX_INST];// Instance handle
- void* so_lib_handle;// So Library handle
- char* so_lib_name;// so directory
- char* roles[OMX_CORE_MAX_CMP_ROLES];// roles played
-}omx_core_cb_type;
-
-typedef struct
-{
- OMX_U32 width;
- OMX_U32 height;
- OMX_U32 profile;
- OMX_U32 level;
-} VideoOMXConfigParserOutputs;
-
-
-typedef struct
-{
- OMX_U8* inPtr; //pointer to codec configuration header
- OMX_U32 inBytes; //length of codec configuration header
- OMX_STRING cComponentRole; //OMX component codec type
- OMX_STRING cComponentName; //OMX component name
-} OMXConfigParserInputs;
-
-#endif
-
diff --git a/mm-video/Android.mk b/mm-video/Android.mk
deleted file mode 100644
index 13756a29..00000000
--- a/mm-video/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#--------------------------------------------------------------------------
-#Copyright (c) 2009, Code Aurora Forum. All rights reserved.
-
-#Redistribution and use in source and binary forms, with or without
-#modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Code Aurora nor
-# the names of its contributors may be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#--------------------------------------------------------------------------
-
-OMX_VIDEO_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-ifneq ($(BUILD_TINY_ANDROID),true)
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7x30)
- include $(OMX_VIDEO_PATH)/vidc/vdec/Android.mk
- include $(OMX_VIDEO_PATH)/vidc/venc/Android.mk
-endif
-
-endif #BUILD_TINY_ANDROID
diff --git a/mm-video/vidc/vdec/Android.mk b/mm-video/vidc/vdec/Android.mk
deleted file mode 100644
index 42ba3c53..00000000
--- a/mm-video/vidc/vdec/Android.mk
+++ /dev/null
@@ -1,110 +0,0 @@
-#--------------------------------------------------------------------------
-#Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-#Redistribution and use in source and binary forms, with or without
-#modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Code Aurora nor
-# the names of its contributors may be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#--------------------------------------------------------------------------
-
-ROOT_DIR := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_PATH:= $(ROOT_DIR)
-
-# ---------------------------------------------------------------------------------
-# Common definitons
-# ---------------------------------------------------------------------------------
-
-libOmxVdec-def := -D__alignx\(x\)=__attribute__\(\(__aligned__\(x\)\)\)
-libOmxVdec-def += -D__align=__alignx
-libOmxVdec-def += -Dinline=__inline
-libOmxVdec-def += -g -O3
-libOmxVdec-def += -DIMAGE_APPS_PROC
-libOmxVdec-def += -D_ANDROID_
-libOmxVdec-def += -DCDECL
-libOmxVdec-def += -DT_ARM
-libOmxVdec-def += -DNO_ARM_CLZ
-libOmxVdec-def += -UENABLE_DEBUG_LOW
-libOmxVdec-def += -DENABLE_DEBUG_HIGH
-libOmxVdec-def += -DENABLE_DEBUG_ERROR
-libOmxVdec-def += -UMULTI_DEC_INST
-libOmxVdec-def += -DMAX_RES_720P
-
-# ---------------------------------------------------------------------------------
-# Make the Shared library (libOmxVdec)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-LOCAL_PATH:= $(ROOT_DIR)
-
-libmm-vdec-inc := $(LOCAL_PATH)/inc
-libmm-vdec-inc += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-
-LOCAL_MODULE := libOmxVdec
-LOCAL_CFLAGS := $(libOmxVdec-def)
-LOCAL_C_INCLUDES := $(libmm-vdec-inc)
-
-LOCAL_SHARED_LIBRARIES := liblog libutils libbinder
-
-LOCAL_SRC_FILES := src/frameparser.cpp
-LOCAL_SRC_FILES += src/h264_utils.cpp
-LOCAL_SRC_FILES += src/omx_vdec.cpp
-
-include $(BUILD_SHARED_LIBRARY)
-
-# ---------------------------------------------------------------------------------
-# Make the apps-test (mm-vdec-omx-test)
-# ---------------------------------------------------------------------------------
-include $(CLEAR_VARS)
-
-mm-vdec-test-inc := $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-vdec-test-inc += $(LOCAL_PATH)/inc
-
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE := mm-vdec-omx-test
-LOCAL_CFLAGS := $(libOmxVdec-def)
-LOCAL_C_INCLUDES := $(mm-vdec-test-inc)
-LOCAL_SHARED_LIBRARIES := libutils libOmxCore libOmxVdec libbinder
-
-LOCAL_SRC_FILES := src/queue.c
-LOCAL_SRC_FILES += test/omx_vdec_test.cpp
-
-include $(BUILD_EXECUTABLE)
-
-# ---------------------------------------------------------------------------------
-# Make the driver-test (mm-video-driver-test)
-# ---------------------------------------------------------------------------------
-include $(CLEAR_VARS)
-
-mm-vdec-drv-test-inc := $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-vdec-drv-test-inc += $(LOCAL_PATH)/inc
-
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE := mm-video-driver-test
-LOCAL_CFLAGS := $(libOmxVdec-def)
-LOCAL_C_INCLUDES := $(mm-vdec-drv-test-inc)
-
-LOCAL_SRC_FILES := src/message_queue.c
-LOCAL_SRC_FILES += test/decoder_driver_test.c
-
-include $(BUILD_EXECUTABLE)
diff --git a/mm-video/vidc/vdec/inc/Map.h b/mm-video/vidc/vdec/inc/Map.h
deleted file mode 100644
index 87cf6de7..00000000
--- a/mm-video/vidc/vdec/inc/Map.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef _MAP_H_
-#define _MAP_H_
-
-#include <stdio.h>
-using namespace std;
-
-template <typename T,typename T2>
-class Map
-{
- struct node
- {
- T data;
- T2 data2;
- node* prev;
- node* next;
- node(T t, T2 t2,node* p, node* n) :
- data(t), data2(t2), prev(p), next(n) {}
- };
- node* head;
- node* tail;
- node* tmp;
- unsigned size_of_list;
- static Map<T,T2> *m_self;
-public:
- Map() : head( NULL ), tail ( NULL ),tmp(head),size_of_list(0) {}
- bool empty() const { return ( !head || !tail ); }
- operator bool() const { return !empty(); }
- void insert(T,T2);
- void show();
- int size();
- T2 find(T); // Return VALUE
- T find_ele(T);// Check if the KEY is present or not
- T2 begin(); //give the first ele
- bool erase(T);
- bool eraseall();
- bool isempty();
- ~Map()
- {
- while(head)
- {
- node* temp(head);
- head=head->next;
- size_of_list--;
- delete temp;
- }
- }
-};
-
-template <typename T,typename T2>
-T2 Map<T,T2>::find(T d1)
-{
- tmp = head;
- while(tmp)
- {
- if(tmp->data == d1)
- {
- return tmp->data2;
- }
- tmp = tmp->next;
- }
- return 0;
-}
-
-template <typename T,typename T2>
-T Map<T,T2>::find_ele(T d1)
-{
- tmp = head;
- while(tmp)
- {
- if(tmp->data == d1)
- {
- return tmp->data;
- }
- tmp = tmp->next;
- }
- return 0;
-}
-
-template <typename T,typename T2>
-T2 Map<T,T2>::begin()
-{
- tmp = head;
- if(tmp)
- {
- return (tmp->data2);
- }
- return 0;
-}
-
-template <typename T,typename T2>
-void Map<T,T2>::show()
-{
- tmp = head;
- while(tmp)
- {
- printf("%d-->%d\n",tmp->data,tmp->data2);
- tmp = tmp->next;
- }
-}
-
-template <typename T,typename T2>
-int Map<T,T2>::size()
-{
- int count =0;
- tmp = head;
- while(tmp)
- {
- tmp = tmp->next;
- count++;
- }
- return count;
-}
-
-template <typename T,typename T2>
-void Map<T,T2>::insert(T data, T2 data2)
-{
- tail = new node(data, data2,tail, NULL);
- if( tail->prev )
- tail->prev->next = tail;
-
- if( empty() )
- {
- head = tail;
- tmp=head;
- }
- tmp = head;
- size_of_list++;
-}
-
-template <typename T,typename T2>
-bool Map<T,T2>::erase(T d)
-{
- bool found = false;
- tmp = head;
- node* prevnode = tmp;
- node *tempnode;
-
- while(tmp)
- {
- if((head == tail) && (head->data == d))
- {
- found = true;
- tempnode = head;
- head = tail = NULL;
- delete tempnode;
- break;
- }
- if((tmp ==head) && (tmp->data ==d))
- {
- found = true;
- tempnode = tmp;
- tmp = tmp->next;
- tmp->prev = NULL;
- head = tmp;
- tempnode->next = NULL;
- delete tempnode;
- break;
- }
- if((tmp == tail) && (tmp->data ==d))
- {
- found = true;
- tempnode = tmp;
- prevnode->next = NULL;
- tmp->prev = NULL;
- tail = prevnode;
- delete tempnode;
- break;
- }
- if(tmp->data == d)
- {
- found = true;
- prevnode->next = tmp->next;
- tmp->next->prev = prevnode->next;
- tempnode = tmp;
- //tmp = tmp->next;
- delete tempnode;
- break;
- }
- prevnode = tmp;
- tmp = tmp->next;
- }
- if(found)size_of_list--;
- return found;
-}
-
-template <typename T,typename T2>
-bool Map<T,T2>::eraseall()
-{
- node *tempnode;
- tmp = head;
- while(head)
- {
- tempnode = head;
- tempnode->next = NULL;
- head = head->next;
- delete tempnode;
- }
- tail = head = NULL;
- return true;
-}
-
-
-template <typename T,typename T2>
-bool Map<T,T2>::isempty()
-{
- if(!size_of_list) return true;
- else return false;
-}
-
-#endif // _MAP_H_
diff --git a/mm-video/vidc/vdec/inc/decoder_driver_test.h b/mm-video/vidc/vdec/inc/decoder_driver_test.h
deleted file mode 100644
index c8cbd1d2..00000000
--- a/mm-video/vidc/vdec/inc/decoder_driver_test.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "message_queue.h"
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include <linux/msm_vidc_dec.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <stdio.h>
-
-struct video_decoder_context
-{
- enum vdec_codec decoder_format;
- enum vdec_output_fromat output_format;
- struct vdec_picsize video_resoultion;
- struct vdec_allocatorproperty input_buffer;
- struct vdec_allocatorproperty output_buffer;
- struct vdec_bufferpayload **ptr_inputbuffer;
- struct vdec_bufferpayload **ptr_outputbuffer;
- struct vdec_output_frameinfo **ptr_respbuffer;
- struct video_queue_context queue_context;
- int video_driver_fd;
-
- FILE * inputBufferFile;
- FILE * outputBufferFile;
-
- pthread_t videothread_id;
- pthread_t asyncthread_id;
- sem_t sem_synchronize;
-};
-
-int init_decoder ( struct video_decoder_context *init_decode );
-int allocate_buffer ( enum vdec_buffer,
- struct video_decoder_context *decode_context
- );
-int free_buffer ( enum vdec_buffer,
- struct video_decoder_context *decode_context
- );
-int start_decoding (struct video_decoder_context *decode_context);
-int stop_decoding (struct video_decoder_context *decode_context);
-int deinit_decoder (struct video_decoder_context *init_decode);
diff --git a/mm-video/vidc/vdec/inc/frameparser.h b/mm-video/vidc/vdec/inc/frameparser.h
deleted file mode 100644
index 4575b093..00000000
--- a/mm-video/vidc/vdec/inc/frameparser.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef FRAMEPARSER_H
-#define FRAMEPARSER_H
-
-#include "OMX_Core.h"
-#include "OMX_QCOMExtns.h"
-#include "h264_utils.h"
-//#include <stdlib.h>
-
-
-enum codec_type
-{
- CODEC_TYPE_MPEG4 = 0,
- CODEC_TYPE_H263 = 1,
- CODEC_TYPE_H264 = 2,
- CODEC_TYPE_VC1 = 3
-};
-
-enum state_start_code_parse
-{
- A0,
- A1,
- A2,
- A3,
- A4
-};
-
-enum state_nal_parse
-{
- NAL_LENGTH_ACC,
- NAL_PARSING
-};
-
-class frame_parse
-{
-
-public:
- H264_Utils *mutils;
- int init_start_codes (codec_type codec_type_parse);
- int parse_mpeg4_frame (OMX_BUFFERHEADERTYPE *source,
- OMX_BUFFERHEADERTYPE *dest ,
- OMX_U32 *partialframe);
- int init_nal_length (unsigned int nal_length);
- int parse_h264_nallength (OMX_BUFFERHEADERTYPE *source,
- OMX_BUFFERHEADERTYPE *dest ,
- OMX_U32 *partialframe);
- void flush ();
- void update_metadata (unsigned int time_stamp ,unsigned int flags);
- frame_parse ();
- ~frame_parse ();
-
-private:
- /*Variables for Start code based Parsing*/
- enum state_start_code_parse parse_state;
- unsigned char start_code[4];
- char mask_code[4];
- unsigned char last_byte,prev_one;
-
- /*Variables for NAL Length Parsing*/
- enum state_nal_parse state_nal;
- unsigned int nal_length;
- unsigned int accum_length;
- unsigned int bytes_tobeparsed;
- unsigned int time_stamp;
- unsigned int flags;
-};
-
-#endif /* FRAMEPARSER_H */
diff --git a/mm-video/vidc/vdec/inc/h264_utils.h b/mm-video/vidc/vdec/inc/h264_utils.h
deleted file mode 100644
index 9c28caaf..00000000
--- a/mm-video/vidc/vdec/inc/h264_utils.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef H264_UTILS_H
-#define H264_UTILS_H
-
-/*========================================================================
-
- O p e n M M
- U t i l i t i e s a n d H e l p e r R o u t i n e s
-
-*//** @file H264_Utils.h
-This module contains H264 video decoder utilities and helper routines.
-
-*//*====================================================================== */
-
-/* =======================================================================
-
- INCLUDE FILES FOR MODULE
-
-========================================================================== */
-#include <stdio.h>
-#include "Map.h"
-#include "qtypes.h"
-#include "OMX_Core.h"
-
-#define STD_MIN(x,y) (((x) < (y)) ? (x) : (y))
-
-#define OMX_CORE_720P_HEIGHT 720
-#define OMX_CORE_720P_WIDTH 1280
-
-/* =======================================================================
-
- DATA DECLARATIONS
-
-========================================================================== */
-
-/* -----------------------------------------------------------------------
-** Constant / Define Declarations
-** ----------------------------------------------------------------------- */
-// Common format block header definitions
-#define MT_VIDEO_META_STREAM_HEADER 0x00
-#define MT_VIDEO_MEDIA_STREAM_HEADER 0x01
-#define MT_VIDEO_META_MEDIA_STREAM_HEADER 0x02
-
-// H.264 format block header definitions
-#define MT_VIDEO_H264_ACCESS_UNIT_FORMAT 0x00
-#define MT_VIDEO_H264_NAL_FORMT 0x01
-#define MT_VIDEO_H264_BYTE_FORMAT 0x02
-#define MT_VIDEO_H264_BYTE_STREAM_FORMAT 0x00
-#define MT_VIDEO_H264_NAL_UNIT_STREAM_FORMAT 0x01
-#define MT_VIDEO_H264_FORMAT_BLOCK_HEADER_SIZE 18
-
-// MPEG-4 format block header definitions
-#define MT_VIDEO_MPEG4_VOP_FORMAT 0x00
-#define MT_VIDEO_MPEG4_SLICE_FORMAT 0x01
-#define MT_VIDEO_MPEG4_BYTE_FORMAT 0x02
-#define MT_VIDEO_MPEG4_FORMAT_BLOCK_HEADER_SIZE 15
-
-// H.263 format block header definitions
-#define MT_VIDEO_H263_PICTURE_FORMAT 0x00
-#define MT_VIDEO_H263_GOB_FORMAT 0x01
-#define MT_VIDEO_H263_SLICE_STRUCTURED_FORMAT 0x02
-#define MT_VIDEO_H263_BYTE_FORMAT 0x03
-#define MT_VIDEO_H263_FORMAT_BLOCK_HEADER_SIZE 16
-
-/* =======================================================================
-** Function Declarations
-** ======================================================================= */
-
-/* -----------------------------------------------------------------------
-** Type Declarations
-** ----------------------------------------------------------------------- */
-
-// This type is used when parsing an H.264 bitstream to collect H.264 NAL
-// units that need to go in the meta data.
-struct H264ParamNalu {
- uint32 picSetID;
- uint32 seqSetID;
- uint32 picOrderCntType;
- bool frameMbsOnlyFlag;
- bool picOrderPresentFlag;
- uint32 picWidthInMbsMinus1;
- uint32 picHeightInMapUnitsMinus1;
- uint32 log2MaxFrameNumMinus4;
- uint32 log2MaxPicOrderCntLsbMinus4;
- bool deltaPicOrderAlwaysZeroFlag;
- //std::vector<uint8> nalu;
- uint32 nalu;
- uint32 crop_left;
- uint32 crop_right;
- uint32 crop_top;
- uint32 crop_bot;
-};
-//typedef map<uint32, H264ParamNalu> H264ParamNaluSet;
-typedef Map<uint32, H264ParamNalu *> H264ParamNaluSet;
-
-typedef enum {
- NALU_TYPE_UNSPECIFIED = 0,
- NALU_TYPE_NON_IDR,
- NALU_TYPE_PARTITION_A,
- NALU_TYPE_PARTITION_B,
- NALU_TYPE_PARTITION_C,
- NALU_TYPE_IDR,
- NALU_TYPE_SEI,
- NALU_TYPE_SPS,
- NALU_TYPE_PPS,
- NALU_TYPE_ACCESS_DELIM,
- NALU_TYPE_EOSEQ,
- NALU_TYPE_EOSTREAM,
- NALU_TYPE_FILLER_DATA,
- NALU_TYPE_RESERVED,
-} NALU_TYPE;
-
-// NAL header information
-typedef struct {
- uint32 nal_ref_idc;
- uint32 nalu_type;
- uint32 forbidden_zero_bit;
-} NALU;
-
-// This structure contains persistent information about an H.264 stream as it
-// is parsed.
-//struct H264StreamInfo {
-// H264ParamNaluSet pic;
-// H264ParamNaluSet seq;
-//};
-
-class RbspParser
-/******************************************************************************
- ** This class is used to convert an H.264 NALU (network abstraction layer
- ** unit) into RBSP (raw byte sequence payload) and extract bits from it.
- *****************************************************************************/
-{
-public:
- RbspParser (const uint8 *begin, const uint8 *end);
-
- virtual ~RbspParser ();
-
- uint32 next ();
- void advance ();
- uint32 u (uint32 n);
- uint32 ue ();
- int32 se ();
-
-private:
- const uint8 *begin, *end;
- int32 pos;
- uint32 bit;
- uint32 cursor;
- bool advanceNeeded;
-};
-
-class H264_Utils
-{
-public:
- H264_Utils();
- ~H264_Utils();
- void initialize_frame_checking_environment();
- void allocate_rbsp_buffer(uint32 inputBufferSize);
- bool isNewFrame(OMX_IN OMX_U8 *bitstream,
- OMX_IN OMX_U32 bitstream_length,
- OMX_IN OMX_U32 size_of_nal_length_field,
- OMX_OUT OMX_BOOL &isNewFrame);
-
-private:
- boolean extract_rbsp(OMX_IN OMX_U8 *buffer,
- OMX_IN OMX_U32 buffer_length,
- OMX_IN OMX_U32 size_of_nal_length_field,
- OMX_OUT OMX_U8 *rbsp_bistream,
- OMX_OUT OMX_U32 *rbsp_length,
- OMX_OUT NALU *nal_unit);
-
- unsigned m_height;
- unsigned m_width;
- H264ParamNaluSet pic;
- H264ParamNaluSet seq;
- uint8 *m_rbspBytes;
- NALU m_prv_nalu;
- bool m_forceToStichNextNAL;
- bool m_au_data;
-};
-
-
-#endif /* H264_UTILS_H */
diff --git a/mm-video/vidc/vdec/inc/message_queue.h b/mm-video/vidc/vdec/inc/message_queue.h
deleted file mode 100644
index e9edadb8..00000000
--- a/mm-video/vidc/vdec/inc/message_queue.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef QUEUE_H
-#define QUEUE_H
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Message Queue structure */
-struct video_msgq
-{
- /* Command to be executed */
- unsigned int cmd;
-
- unsigned int status;
-
- /* Client-specific data */
- void *clientdata;
-};
-
-
-/* Thread & Message Queue information */
-struct video_queue_context
-{
- /* Message Queue related members */
- pthread_mutex_t mutex;
- sem_t sem_message;
- int commandq_size;
- int dataq_size;
- struct video_msgq *ptr_dataq;
- struct video_msgq *ptr_cmdq;
- int write_dataq ;
- int read_dataq;
- int write_comq ;
- int read_comq ;
-
-};
-
-int check_if_queue_empty ( unsigned int queuetocheck,void* queuecontext );
-
-struct video_msgq * queue_get_cmd ( void* queuecontext );
-
-int queue_post_cmdq ( void *queuecontext,
- struct video_msgq *post_msg
- );
-
-int queue_post_dataq ( void *queuecontext,
- struct video_msgq *post_msg
- );
-
-#endif /* QUEUE_H */
diff --git a/mm-video/vidc/vdec/inc/omx_vdec.h b/mm-video/vidc/vdec/inc/omx_vdec.h
deleted file mode 100644
index aec4b09e..00000000
--- a/mm-video/vidc/vdec/inc/omx_vdec.h
+++ /dev/null
@@ -1,615 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef __OMX_VDEC_H__
-#define __OMX_VDEC_H__
-/*============================================================================
- O p e n M A X Component
- Video Decoder
-
-*//** @file comx_vdec.h
- This module contains the class definition for openMAX decoder component.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include<stdlib.h>
-
-#include <stdio.h>
-
-#ifdef _ANDROID_
-#include <binder/MemoryHeapBase.h>
-extern "C"{
-#include<utils/Log.h>
-}
-//#define LOG_TAG "OMX-VDEC-720P"
-#ifdef ENABLE_DEBUG_LOW
-#define DEBUG_PRINT_LOW ALOGE
-#else
-#define DEBUG_PRINT_LOW
-#endif
-#ifdef ENABLE_DEBUG_HIGH
-#define DEBUG_PRINT_HIGH ALOGE
-#else
-#define DEBUG_PRINT_HIGH
-#endif
-#ifdef ENABLE_DEBUG_ERROR
-#define DEBUG_PRINT_ERROR ALOGE
-#else
-#define DEBUG_PRINT_ERROR
-#endif
-#endif // _ANDROID_
-
-#include <pthread.h>
-#ifndef PC_DEBUG
-#include <semaphore.h>
-#endif
-#include "OMX_Core.h"
-#include "OMX_QCOMExtns.h"
-//#include "vdec.h"
-#include "qc_omx_component.h"
-//#include "Map.h"
-//#include "OmxUtils.h"
-#include <linux/msm_vidc_dec.h>
-#include "frameparser.h"
-#include <linux/android_pmem.h>
-
-extern "C" {
- OMX_API void * get_omx_component_factory_fn(void);
-}
-
-
-#ifdef _ANDROID_
- using namespace android;
- // local pmem heap object
- class VideoHeap : public MemoryHeapBase
- {
- public:
- VideoHeap(int fd, size_t size, void* base);
- virtual ~VideoHeap() {}
- };
-#endif // _ANDROID_
-//////////////////////////////////////////////////////////////////////////////
-// Module specific globals
-//////////////////////////////////////////////////////////////////////////////
-#define OMX_SPEC_VERSION 0x00000101
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Macros
-//////////////////////////////////////////////////////////////////////////////
-#define PrintFrameHdr(bufHdr) DEBUG_PRINT("bufHdr %x buf %x size %d TS %d\n",\
- (unsigned) bufHdr,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp)
-
-// BitMask Management logic
-#define BITS_PER_BYTE 32
-#define BITMASK_SIZE(mIndex) (((mIndex) + BITS_PER_BYTE - 1)/BITS_PER_BYTE)
-#define BITMASK_OFFSET(mIndex) ((mIndex)/BITS_PER_BYTE)
-#define BITMASK_FLAG(mIndex) (1 << ((mIndex) % BITS_PER_BYTE))
-#define BITMASK_CLEAR(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
- &= ~(BITMASK_FLAG(mIndex))
-#define BITMASK_SET(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
- |= BITMASK_FLAG(mIndex)
-#define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex))
-#define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex)) == 0x0)
-#define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex))
-#define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex)) == 0x0)
-
-#define OMX_VIDEO_DEC_NUM_INPUT_BUFFERS 2
-#define OMX_VIDEO_DEC_NUM_OUTPUT_BUFFERS 2
-
-#ifdef FEATURE_QTV_WVGA_ENABLE
-#define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE (256*1024)
-#else
-#define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE (128*1024)
-#endif
-
-#define OMX_CORE_CONTROL_CMDQ_SIZE 100
-#define OMX_CORE_QCIF_HEIGHT 144
-#define OMX_CORE_QCIF_WIDTH 176
-#define OMX_CORE_VGA_HEIGHT 480
-#define OMX_CORE_VGA_WIDTH 640
-#define OMX_CORE_WVGA_HEIGHT 480
-#define OMX_CORE_WVGA_WIDTH 800
-
-
-struct video_driver_context
-{
- int video_driver_fd;
- enum vdec_codec decoder_format;
- enum vdec_output_fromat output_format;
- struct vdec_picsize video_resoultion;
- struct vdec_allocatorproperty input_buffer;
- struct vdec_allocatorproperty output_buffer;
- struct vdec_bufferpayload *ptr_inputbuffer;
- struct vdec_bufferpayload *ptr_outputbuffer;
- struct vdec_output_frameinfo *ptr_respbuffer;
- char kind[128];
-};
-
-class OmxUtils;
-
-// OMX video decoder class
-class omx_vdec: public qc_omx_component
-{
-
-public:
- omx_vdec(); // constructor
- virtual ~omx_vdec(); // destructor
-
- static int async_message_process (void *context, void* message);
- static void process_event_cb(void *ctxt,unsigned char id);
-
- OMX_ERRORTYPE allocate_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes
- );
-
-
- OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
-
- OMX_ERRORTYPE component_init(OMX_STRING role);
-
- OMX_ERRORTYPE component_role_enum(
- OMX_HANDLETYPE hComp,
- OMX_U8 *role,
- OMX_U32 index
- );
-
- OMX_ERRORTYPE component_tunnel_request(
- OMX_HANDLETYPE hComp,
- OMX_U32 port,
- OMX_HANDLETYPE peerComponent,
- OMX_U32 peerPort,
- OMX_TUNNELSETUPTYPE *tunnelSetup
- );
-
- OMX_ERRORTYPE empty_this_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
-
-
- OMX_ERRORTYPE fill_this_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
-
- OMX_ERRORTYPE free_buffer(
- OMX_HANDLETYPE hComp,
- OMX_U32 port,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
- OMX_ERRORTYPE get_component_version(
- OMX_HANDLETYPE hComp,
- OMX_STRING componentName,
- OMX_VERSIONTYPE *componentVersion,
- OMX_VERSIONTYPE *specVersion,
- OMX_UUIDTYPE *componentUUID
- );
-
- OMX_ERRORTYPE get_config(
- OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE configIndex,
- OMX_PTR configData
- );
-
- OMX_ERRORTYPE get_extension_index(
- OMX_HANDLETYPE hComp,
- OMX_STRING paramName,
- OMX_INDEXTYPE *indexType
- );
-
- OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE paramIndex,
- OMX_PTR paramData);
-
- OMX_ERRORTYPE get_state(OMX_HANDLETYPE hComp,
- OMX_STATETYPE *state);
-
-
-
- OMX_ERRORTYPE send_command(OMX_HANDLETYPE hComp,
- OMX_COMMANDTYPE cmd,
- OMX_U32 param1,
- OMX_PTR cmdData);
-
-
- OMX_ERRORTYPE set_callbacks(OMX_HANDLETYPE hComp,
- OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData);
-
- OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE configIndex,
- OMX_PTR configData);
-
- OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE paramIndex,
- OMX_PTR paramData);
-
- OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
-
- OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- void * eglImage);
-
-
-
- struct video_driver_context driver_context;
- int m_pipe_in;
- int m_pipe_out;
- pthread_t msg_thread_id;
- pthread_t async_thread_id;
-
-private:
- // Bit Positions
- enum flags_bit_positions
- {
- // Defer transition to IDLE
- OMX_COMPONENT_IDLE_PENDING =0x1,
- // Defer transition to LOADING
- OMX_COMPONENT_LOADING_PENDING =0x2,
- // First Buffer Pending
- OMX_COMPONENT_FIRST_BUFFER_PENDING =0x3,
- // Second Buffer Pending
- OMX_COMPONENT_SECOND_BUFFER_PENDING =0x4,
- // Defer transition to Enable
- OMX_COMPONENT_INPUT_ENABLE_PENDING =0x5,
- // Defer transition to Enable
- OMX_COMPONENT_OUTPUT_ENABLE_PENDING =0x6,
- // Defer transition to Disable
- OMX_COMPONENT_INPUT_DISABLE_PENDING =0x7,
- // Defer transition to Disable
- OMX_COMPONENT_OUTPUT_DISABLE_PENDING =0x8,
- //defer flush notification
- OMX_COMPONENT_OUTPUT_FLUSH_PENDING =0x9,
- OMX_COMPONENT_INPUT_FLUSH_PENDING =0xA,
- OMX_COMPONENT_PAUSE_PENDING =0xB,
- OMX_COMPONENT_EXECUTE_PENDING =0xC
-
- };
-
- // Deferred callback identifiers
- enum
- {
- //Event Callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_EVENT = 0x1,
- //Buffer Done callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_BUFFER_DONE = 0x2,
- //Frame Done callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_FRAME_DONE = 0x3,
- //Buffer Done callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_FTB = 0x4,
- //Frame Done callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_ETB = 0x5,
- //Command
- OMX_COMPONENT_GENERATE_COMMAND = 0x6,
- //Push-Pending Buffers
- OMX_COMPONENT_PUSH_PENDING_BUFS = 0x7,
- // Empty Buffer Done callbacks
- OMX_COMPONENT_GENERATE_EBD = 0x8,
- //Flush Event Callbacks from the vdec component thread context
- OMX_COMPONENT_GENERATE_EVENT_FLUSH = 0x9,
- OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH = 0x0A,
- OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH = 0x0B,
- OMX_COMPONENT_GENERATE_FBD = 0xc,
- OMX_COMPONENT_GENERATE_START_DONE = 0xD,
- OMX_COMPONENT_GENERATE_PAUSE_DONE = 0xE,
- OMX_COMPONENT_GENERATE_RESUME_DONE = 0xF,
- OMX_COMPONENT_GENERATE_STOP_DONE = 0x10,
- OMX_COMPONENT_GENERATE_HARDWARE_ERROR = 0x11,
- OMX_COMPONENT_GENERATE_ETB_ARBITRARY = 0x12
- };
-
- enum port_indexes
- {
- OMX_CORE_INPUT_PORT_INDEX =0,
- OMX_CORE_OUTPUT_PORT_INDEX =1
- };
-
- enum vc1_profile_type
- {
- VC1_SP_MP_RCV = 1,
- VC1_AP = 2
- };
-
- struct omx_event
- {
- unsigned param1;
- unsigned param2;
- unsigned id;
- };
-
- struct omx_cmd_queue
- {
- omx_event m_q[OMX_CORE_CONTROL_CMDQ_SIZE];
- unsigned m_read;
- unsigned m_write;
- unsigned m_size;
-
- omx_cmd_queue();
- ~omx_cmd_queue();
- bool insert_entry(unsigned p1, unsigned p2, unsigned id);
- bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
- // get msgtype of the first ele from the queue
- unsigned get_q_msg_type();
-
- };
-
- OMX_ERRORTYPE omx_vdec_check_port_settings(bool *port_setting_changed);
- OMX_ERRORTYPE omx_vdec_validate_port_param(int height, int width);
-
-
- bool allocate_done(void);
- bool allocate_input_done(void);
- bool allocate_output_done(void);
-
- OMX_ERRORTYPE free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
- OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
-
- OMX_ERRORTYPE allocate_input_heap_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes);
-
-
- OMX_ERRORTYPE allocate_input_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes);
-
- OMX_ERRORTYPE allocate_output_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,OMX_PTR appData,
- OMX_U32 bytes);
-
- OMX_ERRORTYPE use_input_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
- OMX_ERRORTYPE use_output_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
- bool execute_omx_flush(OMX_U32);
- bool execute_output_flush(OMX_U32);
- bool execute_input_flush(OMX_U32);
- bool register_output_buffers();
- OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer);
-
- OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer);
- OMX_ERRORTYPE empty_this_buffer_proxy(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer);
-
- OMX_ERRORTYPE empty_this_buffer_proxy_arbitrary(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
- OMX_ERRORTYPE push_input_buffer (OMX_HANDLETYPE hComp);
- OMX_ERRORTYPE push_input_sc_codec (OMX_HANDLETYPE hComp);
- OMX_ERRORTYPE push_input_h264 (OMX_HANDLETYPE hComp);
- OMX_ERRORTYPE push_input_vc1 (OMX_HANDLETYPE hComp);
-
- OMX_ERRORTYPE fill_this_buffer_proxy(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer);
- bool release_done();
-
- bool release_output_done();
- bool release_input_done();
-
- bool align_pmem_buffers(int pmem_fd, OMX_U32 buffer_size,
- OMX_U32 alignment);
-
- OMX_ERRORTYPE send_command_proxy(OMX_HANDLETYPE hComp,
- OMX_COMMANDTYPE cmd,
- OMX_U32 param1,
- OMX_PTR cmdData);
- bool post_event( unsigned int p1,
- unsigned int p2,
- unsigned int id
- );
- inline int clip2(int x)
- {
- x = x -1;
- x = x | x >> 1;
- x = x | x >> 2;
- x = x | x >> 4;
- x = x | x >> 16;
- x = x + 1;
- return x;
- }
-
- inline void omx_report_error ()
- {
- DEBUG_PRINT_ERROR("\nERROR: Sending OMX_EventError to Client");
- if (m_cb.EventHandler && !m_error_propogated)
- {
- m_error_propogated = true;
- m_cb.EventHandler(&m_cmp,m_app_data,
- OMX_EventError,OMX_ErrorHardware,0,NULL);
- }
- }
-
-
- //*************************************************************
- //*******************MEMBER VARIABLES *************************
- //*************************************************************
- pthread_mutex_t m_lock;
- //sem to handle the minimum procesing of commands
- sem_t m_cmd_lock;
- bool m_error_propogated;
- // compression format
- OMX_VIDEO_CODINGTYPE eCompressionFormat;
- // OMX State
- OMX_STATETYPE m_state;
- // Application data
- OMX_PTR m_app_data;
- // Application callbacks
- OMX_CALLBACKTYPE m_cb;
- OMX_COLOR_FORMATTYPE m_color_format;
- OMX_PRIORITYMGMTTYPE m_priority_mgm ;
- OMX_PARAM_BUFFERSUPPLIERTYPE m_buffer_supplier;
- // fill this buffer queue
- omx_cmd_queue m_ftb_q;
- // Command Q for rest of the events
- omx_cmd_queue m_cmd_q;
- omx_cmd_queue m_etb_q;
- // Input memory pointer
- OMX_BUFFERHEADERTYPE *m_inp_mem_ptr;
- // Output memory pointer
- OMX_BUFFERHEADERTYPE *m_out_mem_ptr;
-
- bool input_flush_progress;
- bool output_flush_progress;
- bool input_use_buffer;
- bool output_use_buffer;
- int pending_input_buffers;
- int pending_output_buffers;
- int m_ineos_reached;
- int m_outeos_pending;
- int m_outeos_reached;
- // bitmask array size for output side
- unsigned int m_out_bm_count;
- // Number of Output Buffers
- unsigned int m_out_buf_count;
- unsigned int m_out_buf_count_min;
- unsigned int m_out_buf_size;
- // Number of Input Buffers
- unsigned int m_inp_buf_count;
- unsigned int m_inp_buf_count_min;
- // Size of Input Buffers
- unsigned int m_inp_buf_size;
- // bitmask array size for input side
- unsigned int m_inp_bm_count;
- //Input port Populated
- OMX_BOOL m_inp_bPopulated;
- //Output port Populated
- OMX_BOOL m_out_bPopulated;
- //Height
- unsigned int m_height;
- // Width
- unsigned int m_width;
- unsigned int stride;
- unsigned int scan_lines;
- // Storage of HxW during dynamic port reconfig
- unsigned int m_port_height;
- unsigned int m_port_width;
-
- unsigned int m_crop_x;
- unsigned int m_crop_y;
- unsigned int m_crop_dx;
- unsigned int m_crop_dy;
- // encapsulate the waiting states.
- unsigned int m_flags;
-
-#ifdef _ANDROID_
- // Heap pointer to frame buffers
- sp<MemoryHeapBase> m_heap_ptr;
-#endif //_ANDROID_
- // store I/P PORT state
- OMX_BOOL m_inp_bEnabled;
- // store O/P PORT state
- OMX_BOOL m_out_bEnabled;
- // to know whether Event Port Settings change has been triggered or not.
- bool m_event_port_settings_sent;
- OMX_U8 m_cRole[OMX_MAX_STRINGNAME_SIZE];
- // Platform specific details
- OMX_QCOM_PLATFORM_PRIVATE_LIST *m_platform_list;
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY *m_platform_entry;
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *m_pmem_info;
- // SPS+PPS sent as part of set_config
- OMX_VENDOR_EXTRADATATYPE m_vendor_config;
-
- /*Variables for arbitrary Byte parsing support*/
- frame_parse m_frame_parser;
- omx_cmd_queue m_input_pending_q;
- omx_cmd_queue m_input_free_q;
- bool arbitrary_bytes;
- OMX_BUFFERHEADERTYPE h264_scratch;
- OMX_BUFFERHEADERTYPE *psource_frame;
- OMX_BUFFERHEADERTYPE *pdest_frame;
- OMX_BUFFERHEADERTYPE *m_inp_heap_ptr;
- OMX_BUFFERHEADERTYPE **m_phdr_pmem_ptr;
- unsigned int m_heap_inp_bm_count;
- codec_type codec_type_parse;
- bool first_frame_meta;
- unsigned frame_count;
- unsigned nal_count;
- unsigned nal_length;
- bool look_ahead_nal;
- int first_frame;
- unsigned char *first_buffer;
- int first_frame_size;
- unsigned int mp4h263_flags;
- unsigned int mp4h263_timestamp;
- bool set_seq_header_done;
- bool gate_output_buffers;
- bool gate_input_buffers;
- bool sent_first_frame;
- unsigned int m_out_buf_count_recon;
- unsigned int m_out_buf_count_min_recon;
- unsigned int m_out_buf_size_recon;
- unsigned char m_hwdevice_name[80];
- FILE *m_device_file_ptr;
- enum vc1_profile_type m_vc1_profile;
-};
-
-#endif // __OMX_VDEC_H__
diff --git a/mm-video/vidc/vdec/inc/qtypes.h b/mm-video/vidc/vdec/inc/qtypes.h
deleted file mode 100644
index 8fc7a866..00000000
--- a/mm-video/vidc/vdec/inc/qtypes.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef QTYPES_H
-#define QTYPES_H
-/*===========================================================================
-
- Data Declarations
-
-===========================================================================*/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* ------------------------------------------------------------------------
-** Constants
-** ------------------------------------------------------------------------ */
-
-#ifdef TRUE
-#undef TRUE
-#endif
-
-#ifdef FALSE
-#undef FALSE
-#endif
-
-#define TRUE 1 /* Boolean true value. */
-#define FALSE 0 /* Boolean false value. */
-
-
-
-/* -----------------------------------------------------------------------
-** Standard Types
-** ----------------------------------------------------------------------- */
-
-/* The following definitions are the same accross platforms. This first
-** group are the sanctioned types.
-*/
-
-typedef unsigned char boolean; /* Boolean value type. */
-
-typedef unsigned long int uint32; /* Unsigned 32 bit value */
-typedef unsigned short uint16; /* Unsigned 16 bit value */
-typedef unsigned char uint8; /* Unsigned 8 bit value */
-
-typedef signed long int int32; /* Signed 32 bit value */
-typedef signed short int16; /* Signed 16 bit value */
-typedef signed char int8; /* Signed 8 bit value */
-
-/* This group are the deprecated types. Their use should be
-** discontinued and new code should use the types above
-*/
-typedef unsigned char byte; /* Unsigned 8 bit value type. */
-typedef unsigned short word; /* Unsinged 16 bit value type. */
-typedef unsigned long dword; /* Unsigned 32 bit value type. */
-
-typedef long long int64;
-typedef unsigned long long uint64;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* QTYPES_H */
diff --git a/mm-video/vidc/vdec/inc/queue.h b/mm-video/vidc/vdec/inc/queue.h
deleted file mode 100644
index 2a7d331e..00000000
--- a/mm-video/vidc/vdec/inc/queue.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef QUEUE_H
-#define QUEUE_H
-
-typedef struct Queue Queue;
-
-Queue *alloc_queue();
-void free_queue(Queue *q);
-void free_queue_and_qelement(Queue *q);
-int push(Queue *q, void * element);
-void *pop(Queue *q);
-
-#endif
diff --git a/mm-video/vidc/vdec/src/frameparser.cpp b/mm-video/vidc/vdec/src/frameparser.cpp
deleted file mode 100644
index 46ad9e88..00000000
--- a/mm-video/vidc/vdec/src/frameparser.cpp
+++ /dev/null
@@ -1,508 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "frameparser.h"
-#include "omx_vdec.h"
-
-#ifdef _ANDROID_
- extern "C"{
- #include<utils/Log.h>
- }
-#endif//_ANDROID_
-
-static unsigned char H264_mask_code[4] = {0xFF,0xFF,0xFF,0xFF};
-static unsigned char H264_start_code[4] = {0x00,0x00,0x00,0x01};
-
-static unsigned char MPEG4_start_code[4] = {0x00,0x00,0x01,0xB6};
-static unsigned char MPEG4_mask_code[4] = {0xFF,0xFF,0xFF,0xFF};
-
-static unsigned char H263_start_code[4] = {0x00,0x00,0x80,0x00};
-static unsigned char H263_mask_code[4] = {0xFF,0xFF,0xFC,0x00};
-
-static unsigned char VC1_AP_start_code[4] = {0x00,0x00,0x01,0x0D};
-static unsigned char VC1_AP_mask_code[4] = {0xFF,0xFF,0xFF,0xFF};
-
-frame_parse::frame_parse():mutils(NULL),
- parse_state(A0),
- last_byte(0),
- prev_one(0),
- state_nal(NAL_LENGTH_ACC),
- nal_length(0),
- accum_length(0),
- bytes_tobeparsed(0),
- time_stamp (0),
- flags (0)
-{
- memset (start_code,0,sizeof (start_code));
- memset (mask_code,0,sizeof (mask_code));
-}
-
-frame_parse::~frame_parse ()
-{
- if (mutils)
- delete mutils;
-
- mutils = NULL;
-}
-
-int frame_parse::init_start_codes (codec_type codec_type_parse)
-{
- /*Check if Codec Type is proper and we are in proper state*/
- if (codec_type_parse > CODEC_TYPE_VC1 || parse_state != A0)
- {
- return -1;
- }
-
- switch (codec_type_parse)
- {
- case CODEC_TYPE_MPEG4:
- memcpy (start_code,MPEG4_start_code,4);
- memcpy (mask_code,MPEG4_mask_code,4);
- break;
- case CODEC_TYPE_H263:
- memcpy (start_code,H263_start_code,4);
- memcpy (mask_code,H263_mask_code,4);
- break;
- case CODEC_TYPE_H264:
- memcpy (start_code,H264_start_code,4);
- memcpy (mask_code,H264_mask_code,4);
- break;
- case CODEC_TYPE_VC1:
- memcpy (start_code,VC1_AP_start_code,4);
- memcpy (mask_code,VC1_AP_mask_code,4);
- break;
- }
- return 1;
-}
-
-
-int frame_parse::init_nal_length (unsigned int nal_len)
-{
- if (nal_len == 0 || nal_len > 4 || state_nal != NAL_LENGTH_ACC)
- {
- return -1;
- }
- nal_length = nal_len;
-
- return 1;
-}
-
-int frame_parse::parse_mpeg4_frame ( OMX_BUFFERHEADERTYPE *source,
- OMX_BUFFERHEADERTYPE *dest ,
- OMX_U32 *partialframe)
-{
- OMX_U8 *pdest = NULL,*psource = NULL;
- OMX_U32 dest_len =0, source_len = 0, temp_len = 0;
- OMX_U32 parsed_length = 0,i=0;
- int residue_byte = 0;
-
- if (source == NULL || dest == NULL || partialframe == NULL)
- {
- return -1;
- }
-
- /*Calculate how many bytes are left in source and destination*/
- dest_len = dest->nAllocLen - (dest->nFilledLen + dest->nOffset);
- psource = source->pBuffer + source->nOffset;
- pdest = dest->pBuffer + (dest->nFilledLen + dest->nOffset);
- source_len = source->nFilledLen;
-
- /*Need Minimum of 4 for destination to copy atleast Start code*/
- if (dest_len < 4 || source_len == 0)
- {
- DEBUG_PRINT_LOW("\n Dest_len %d source_len %d",dest_len,source_len);
- if (source_len == 0 && (source->nFlags & 0x01))
- {
- DEBUG_PRINT_LOW("\n EOS condition Inform Client that it is complete frame");
- *partialframe = 0;
- return 1;
- }
- DEBUG_PRINT_LOW("\n Error in Parsing bitstream");
- return -1;
- }
-
- /*Check if State of the previous find is a Start code*/
- if (parse_state == A4)
- {
- /*Check for minimun size should be 4*/
- dest->nFlags = flags;
- dest->nTimeStamp = time_stamp;
- update_metadata(source->nTimeStamp,source->nFlags);
- memcpy (pdest,start_code,4);
- pdest [2] = prev_one;
- pdest [3] = last_byte;
- dest->nFilledLen += 4;
- pdest += 4;
- parse_state = A0;
- }
-
- /*Entry State Machine*/
- while ( source->nFilledLen > 0 && parse_state != A0
- && parse_state != A4 && dest_len > 0
- )
- {
- //printf ("\n In the Entry Loop");
- switch (parse_state)
- {
- case A3:
- /*If fourth Byte is matching then start code is found*/
- if ((*psource & mask_code [3]) == start_code [3])
- {
- last_byte = *psource;
- parse_state = A4;
- source->nFilledLen--;
- source->nOffset++;
- psource++;
- }
- else if ((start_code [1] == start_code [0]) && (start_code [2] == start_code [1]))
- {
- parse_state = A2;
- memcpy (pdest,start_code,1);
- pdest++;
- dest->nFilledLen++;
- dest_len--;
- }
- else if (start_code [2] == start_code [0])
- {
- parse_state = A1;
- memcpy (pdest,start_code,2);
- pdest += 2;
- dest->nFilledLen += 2;
- dest_len -= 2;
- }
- else
- {
- parse_state = A0;
- memcpy (pdest,start_code,3);
- pdest += 3;
- dest->nFilledLen +=3;
- dest_len -= 3;
- }
- break;
-
- case A2:
- if ((*psource & mask_code [2]) == start_code [2])
- {
- prev_one = *psource;
- parse_state = A3;
- source->nFilledLen--;
- source->nOffset++;
- psource++;
- }
- else if ( start_code [1] == start_code [0])
- {
- parse_state = A1;
- memcpy (pdest,start_code,1);
- dest->nFilledLen +=1;
- dest_len--;
- pdest++;
- }
- else
- {
- parse_state = A0;
- memcpy (pdest,start_code,2);
- dest->nFilledLen +=2;
- dest_len -= 2;
- pdest += 2;
- }
- break;
-
- case A1:
- if ((*psource & mask_code [1]) == start_code [1])
- {
- parse_state = A2;
- source->nFilledLen--;
- source->nOffset++;
- psource++;
- }
- else
- {
- memcpy (pdest,start_code,1);
- dest->nFilledLen +=1;
- pdest++;
- dest_len--;
- parse_state = A0;
- }
- break;
- case A4:
- case A0:
- break;
- }
- dest_len = dest->nAllocLen - (dest->nFilledLen + dest->nOffset);
- }
-
- if (parse_state == A4)
- {
- *partialframe = 0;
- DEBUG_PRINT_LOW("\n Nal Found length is %d",dest->nFilledLen);
- return 1;
- }
-
- /*Partial Frame is true*/
- *partialframe = 1;
-
- /*Calculate how many bytes are left in source and destination*/
- dest_len = dest->nAllocLen - (dest->nFilledLen + dest->nOffset);
- psource = source->pBuffer + source->nOffset;
- pdest = dest->pBuffer + (dest->nFilledLen + dest->nOffset);
- source_len = source->nFilledLen;
-
- temp_len = (source_len < dest_len)?source_len:dest_len;
-
- /*Check if entry state machine consumed source or destination*/
- if (temp_len == 0)
- {
- return 1;
- }
-
- /*Parsing State Machine*/
- while (parsed_length < temp_len)
- {
- switch (parse_state)
- {
- case A0:
- if ((psource [parsed_length] & mask_code [0]) == start_code[0])
- {
- parse_state = A1;
- }
- parsed_length++;
- break;
- case A1:
- if ((psource [parsed_length] & mask_code [1]) == start_code [1])
- {
- parsed_length++;
- parse_state = A2;
- }
- else
- {
- parse_state = A0;
- }
- break;
- case A2:
- if ((psource [parsed_length] & mask_code [2]) == start_code [2])
- {
- prev_one = psource [parsed_length];
- parsed_length++;
- parse_state = A3;
- }
- else if (start_code [1] == start_code [0])
- {
- parse_state = A1;
- }
- else
- {
- parse_state = A0;
- }
- break;
- case A3:
- if ((psource [parsed_length] & mask_code [3]) == start_code [3])
- {
- last_byte = psource [parsed_length];
- parsed_length++;
- parse_state = A4;
- }
- else if ((start_code [1] == start_code [0]) && (start_code [2] == start_code [1]))
- {
- parse_state = A2;
- }
- else if (start_code [2] == start_code [0])
- {
- parse_state = A1;
- }
- else
- {
- parse_state = A0;
- }
- break;
- default:
- break;
- }
-
- /*Found the code break*/
- if (parse_state == A4)
- {
- break;
- }
- }
-
- /*Exit State Machine*/
- psource = source->pBuffer + source->nOffset;
- switch (parse_state)
- {
- case A4:
- *partialframe = 0;
- if (parsed_length > 4)
- {
- memcpy (pdest,psource,(parsed_length-4));
- dest->nFilledLen += (parsed_length-4);
- }
- break;
- case A3:
- if (parsed_length > 3)
- {
- memcpy (pdest,psource,(parsed_length-3));
- dest->nFilledLen += (parsed_length-3);
- }
- break;
- case A2:
- if (parsed_length > 2)
- {
- memcpy (pdest,psource,(parsed_length-2));
- dest->nFilledLen += (parsed_length-2);
- }
- break;
- case A1:
- if (parsed_length > 1)
- {
- memcpy (pdest,psource,(parsed_length-1));
- dest->nFilledLen += (parsed_length-1);
- }
- break;
- case A0:
- memcpy (pdest,psource,(parsed_length));
- dest->nFilledLen += (parsed_length);
- break;
- }
-
- if (source->nFilledLen < parsed_length)
- {
- printf ("\n FATAL Error");
- return -1;
- }
- source->nFilledLen -= parsed_length;
- source->nOffset += parsed_length;
-
- return 1;
-}
-
-
-int frame_parse::parse_h264_nallength (OMX_BUFFERHEADERTYPE *source,
- OMX_BUFFERHEADERTYPE *dest ,
- OMX_U32 *partialframe)
-{
- OMX_U8 *pdest = NULL,*psource = NULL;
- OMX_U32 dest_len =0, source_len = 0, temp_len = 0,parsed_length = 0;
-
- if (source == NULL || dest == NULL || partialframe == NULL)
- {
- return -1;
- }
-
- /*Calculate the length's*/
- dest_len = dest->nAllocLen - (dest->nFilledLen + dest->nOffset);
- source_len = source->nFilledLen;
-
- if (dest_len < 4 || source_len == 0 || nal_length == 0)
- {
- DEBUG_PRINT_LOW("\n Destination %d source %d nal length %d",\
- dest_len,source_len,nal_length);
- return -1;
- }
- *partialframe = 1;
- temp_len = (source_len < dest_len)?source_len:dest_len;
- psource = source->pBuffer + source->nOffset;
- pdest = dest->pBuffer + (dest->nFilledLen + dest->nOffset);
-
- /* Find the Bytes to Accumalte*/
- if (state_nal == NAL_LENGTH_ACC)
- {
- while (parsed_length < temp_len )
- {
- bytes_tobeparsed |= (((OMX_U32)(*psource))) << (((nal_length-accum_length-1) << 3));
-
- /*COPY THE DATA FOR C-SIM TO BE REOMVED ON TARGET*/
- //*pdest = *psource;
- accum_length++;
- source->nFilledLen--;
- source->nOffset++;
- psource++;
- //dest->nFilledLen++;
- //pdest++;
- parsed_length++;
-
- if (accum_length == nal_length)
- {
- accum_length = 0;
- state_nal = NAL_PARSING;
- memcpy (pdest,H264_start_code,4);
- dest->nFilledLen += 4;
- break;
- }
- }
- }
-
- dest_len = dest->nAllocLen - (dest->nFilledLen + dest->nOffset);
- source_len = source->nFilledLen;
- temp_len = (source_len < dest_len)?source_len:dest_len;
-
- psource = source->pBuffer + source->nOffset;
- pdest = dest->pBuffer + (dest->nFilledLen + dest->nOffset);
-
- /*Already in Parsing state go ahead and copy*/
- if(state_nal == NAL_PARSING && temp_len > 0)
- {
- if (temp_len < bytes_tobeparsed)
- {
- memcpy (pdest,psource,temp_len);
- dest->nFilledLen += temp_len;
- source->nOffset += temp_len;
- source->nFilledLen -= temp_len;
- bytes_tobeparsed -= temp_len;
- }
- else
- {
- memcpy (pdest,psource,bytes_tobeparsed);
- temp_len -= bytes_tobeparsed;
- dest->nFilledLen += bytes_tobeparsed;
- source->nOffset += bytes_tobeparsed;
- source->nFilledLen -= bytes_tobeparsed;
- bytes_tobeparsed = 0;
- }
- }
-
- if (bytes_tobeparsed == 0 && state_nal == NAL_PARSING)
- {
- *partialframe = 0;
- state_nal = NAL_LENGTH_ACC;
- }
-
- return 1;
-}
-
-void frame_parse::flush ()
-{
- parse_state = A0;
- state_nal = NAL_LENGTH_ACC;
- accum_length = 0;
- bytes_tobeparsed = 0;
-}
-
-void frame_parse::update_metadata (unsigned int ts ,unsigned int flgs)
-{
- time_stamp = ts;
- flags = flgs;
-}
diff --git a/mm-video/vidc/vdec/src/h264_utils.cpp b/mm-video/vidc/vdec/src/h264_utils.cpp
deleted file mode 100644
index ff9f0804..00000000
--- a/mm-video/vidc/vdec/src/h264_utils.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*========================================================================
-
- O p e n M M
- V i d e o U t i l i t i e s
-
-*//** @file VideoUtils.cpp
- This module contains utilities and helper routines.
-
-@par EXTERNALIZED FUNCTIONS
-
-@par INITIALIZATION AND SEQUENCING REQUIREMENTS
- (none)
-
-*//*====================================================================== */
-
-/* =======================================================================
-
- INCLUDE FILES FOR MODULE
-
-========================================================================== */
-#include "h264_utils.h"
-#include "omx_vdec.h"
-#include <string.h>
-#include <stdlib.h>
-
-/* =======================================================================
-
- DEFINITIONS AND DECLARATIONS FOR MODULE
-
-This section contains definitions for constants, macros, types, variables
-and other items needed by this module.
-
-========================================================================== */
-
-#define SIZE_NAL_FIELD_MAX 4
-#define BASELINE_PROFILE 66
-#define MAIN_PROFILE 77
-#define HIGH_PROFILE 100
-
-#define MAX_SUPPORTED_LEVEL 32
-
-
-RbspParser::RbspParser (const uint8 *_begin, const uint8 *_end)
-: begin (_begin), end(_end), pos (- 1), bit (0),
-cursor (0xFFFFFF), advanceNeeded (true)
-{
-}
-
-// Destructor
-/*lint -e{1540} Pointer member neither freed nor zeroed by destructor
- * No problem
- */
-RbspParser::~RbspParser () {}
-
-// Return next RBSP byte as a word
-uint32 RbspParser::next ()
-{
- if (advanceNeeded) advance ();
- //return static_cast<uint32> (*pos);
- return static_cast<uint32> (begin[pos]);
-}
-
-// Advance RBSP decoder to next byte
-void RbspParser::advance ()
-{
- ++pos;
- //if (pos >= stop)
- if (begin + pos == end)
- {
- /*lint -e{730} Boolean argument to function
- * I don't see a problem here
- */
- //throw false;
- DEBUG_PRINT_LOW("H264Parser-->NEED TO THROW THE EXCEPTION...\n");
- }
- cursor <<= 8;
- //cursor |= static_cast<uint32> (*pos);
- cursor |= static_cast<uint32> (begin[pos]);
- if ((cursor & 0xFFFFFF) == 0x000003)
- {
- advance ();
- }
- advanceNeeded = false;
-}
-
-// Decode unsigned integer
-uint32 RbspParser::u (uint32 n)
-{
- uint32 i, s, x = 0;
- for (i = 0; i < n; i += s)
- {
- s = static_cast<uint32>STD_MIN(static_cast<int>(8 - bit),
- static_cast<int>(n - i));
- x <<= s;
-
- x |= ((next () >> ((8 - static_cast<uint32>(bit)) - s)) &
- ((1 << s) - 1));
-
- bit = (bit + s) % 8;
- if (!bit)
- {
- advanceNeeded = true;
- }
- }
- return x;
-}
-
-// Decode unsigned integer Exp-Golomb-coded syntax element
-uint32 RbspParser::ue ()
-{
- int leadingZeroBits = -1;
- for (uint32 b = 0; !b; ++leadingZeroBits)
- {
- b = u (1);
- }
- return ((1 << leadingZeroBits) - 1) +
- u (static_cast<uint32>(leadingZeroBits));
-}
-
-// Decode signed integer Exp-Golomb-coded syntax element
-int32 RbspParser::se ()
-{
- const uint32 x = ue ();
- if (!x) return 0;
- else if (x & 1) return static_cast<int32> ((x >> 1) + 1);
- else return - static_cast<int32> (x >> 1);
-}
-
-void H264_Utils::allocate_rbsp_buffer(uint32 inputBufferSize)
-{
- m_rbspBytes = (byte *) calloc(1,inputBufferSize);
- m_prv_nalu.nal_ref_idc = 0;
- m_prv_nalu.nalu_type = NALU_TYPE_UNSPECIFIED;
-}
-
-H264_Utils::H264_Utils(): m_height(0),
- m_width(0),
- m_rbspBytes(NULL),
- m_au_data (false)
-{
- initialize_frame_checking_environment();
-}
-
-H264_Utils::~H264_Utils()
-{
-/* if(m_pbits)
- {
- delete(m_pbits);
- m_pbits = NULL;
- }
-*/
- if (m_rbspBytes)
- {
- free(m_rbspBytes);
- m_rbspBytes = NULL;
- }
-}
-
-/***********************************************************************/
-/*
-FUNCTION:
- H264_Utils::initialize_frame_checking_environment
-
-DESCRIPTION:
- Extract RBSP data from a NAL
-
-INPUT/OUTPUT PARAMETERS:
- None
-
-RETURN VALUE:
- boolean
-
-SIDE EFFECTS:
- None.
-*/
-/***********************************************************************/
-void H264_Utils::initialize_frame_checking_environment()
-{
- m_forceToStichNextNAL = false;
- m_au_data = false;
- m_prv_nalu.nal_ref_idc = 0;
- m_prv_nalu.nalu_type = NALU_TYPE_UNSPECIFIED;
-}
-
-/***********************************************************************/
-/*
-FUNCTION:
- H264_Utils::extract_rbsp
-
-DESCRIPTION:
- Extract RBSP data from a NAL
-
-INPUT/OUTPUT PARAMETERS:
- <In>
- buffer : buffer containing start code or nal length + NAL units
- buffer_length : the length of the NAL buffer
- start_code : If true, start code is detected,
- otherwise size nal length is detected
- size_of_nal_length_field: size of nal length field
-
- <Out>
- rbsp_bistream : extracted RBSP bistream
- rbsp_length : the length of the RBSP bitstream
- nal_unit : decoded NAL header information
-
-RETURN VALUE:
- boolean
-
-SIDE EFFECTS:
- None.
-*/
-/***********************************************************************/
-
-boolean H264_Utils::extract_rbsp(OMX_IN OMX_U8 *buffer,
- OMX_IN OMX_U32 buffer_length,
- OMX_IN OMX_U32 size_of_nal_length_field,
- OMX_OUT OMX_U8 *rbsp_bistream,
- OMX_OUT OMX_U32 *rbsp_length,
- OMX_OUT NALU *nal_unit)
-{
- byte coef1, coef2, coef3;
- uint32 pos = 0;
- uint32 nal_len = buffer_length;
- uint32 sizeofNalLengthField = 0;
- uint32 zero_count;
- boolean eRet = true;
- boolean start_code = (size_of_nal_length_field==0)?true:false;
-
- DEBUG_PRINT_LOW("extract_rbsp\n");
-
- if(start_code) {
- // Search start_code_prefix_one_3bytes (0x000001)
- coef2 = buffer[pos++];
- coef3 = buffer[pos++];
- do {
- if(pos >= buffer_length)
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__);
- return false;
- }
-
- coef1 = coef2;
- coef2 = coef3;
- coef3 = buffer[pos++];
- } while(coef1 || coef2 || coef3 != 1);
- }
- else if (size_of_nal_length_field)
- {
- /* This is the case to play multiple NAL units inside each access unit*/
- /* Extract the NAL length depending on sizeOfNALength field */
- sizeofNalLengthField = size_of_nal_length_field;
- nal_len = 0;
- while(size_of_nal_length_field--)
- {
- nal_len |= buffer[pos++]<<(size_of_nal_length_field<<3);
- }
- if (nal_len >= buffer_length)
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__);
- return false;
- }
- }
-
- if (nal_len > buffer_length)
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__);
- return false;
- }
- if(pos + 1 > (nal_len + sizeofNalLengthField))
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__);
- return false;
- }
- if (nal_unit->forbidden_zero_bit = (buffer[pos] & 0x80))
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - line %d", __func__, __LINE__);
- }
- nal_unit->nal_ref_idc = (buffer[pos] & 0x60) >> 5;
- nal_unit->nalu_type = buffer[pos++] & 0x1f;
- DEBUG_PRINT_LOW("\n@#@# Pos = %x NalType = %x buflen = %d",pos-1,nal_unit->nalu_type,buffer_length);
- *rbsp_length = 0;
-
-
- if( nal_unit->nalu_type == NALU_TYPE_EOSEQ ||
- nal_unit->nalu_type == NALU_TYPE_EOSTREAM)
- return (nal_len + sizeofNalLengthField);
-
- zero_count = 0;
- while (pos < (nal_len+sizeofNalLengthField)) //similar to for in p-42
- {
- if( zero_count == 2 ) {
- if( buffer[pos] == 0x03 ) {
- pos ++;
- zero_count = 0;
- continue;
- }
- if( buffer[pos] <= 0x01 ) {
- if( start_code ) {
- *rbsp_length -= 2;
- pos -= 2;
- return pos;
- }
- }
- zero_count = 0;
- }
- zero_count ++;
- if( buffer[pos] != 0 )
- zero_count = 0;
-
- rbsp_bistream[(*rbsp_length)++] = buffer[pos++];
- }
-
- return eRet;
-}
-
-/*===========================================================================
-FUNCTION:
- H264_Utils::iSNewFrame
-
-DESCRIPTION:
- Returns true if NAL parsing successfull otherwise false.
-
-INPUT/OUTPUT PARAMETERS:
- <In>
- buffer : buffer containing start code or nal length + NAL units
- buffer_length : the length of the NAL buffer
- start_code : If true, start code is detected,
- otherwise size nal length is detected
- size_of_nal_length_field: size of nal length field
- <out>
- isNewFrame: true if the NAL belongs to a differenet frame
- false if the NAL belongs to a current frame
-
-RETURN VALUE:
- boolean true, if nal parsing is successful
- false, if the nal parsing has errors
-
-SIDE EFFECTS:
- None.
-===========================================================================*/
-bool H264_Utils::isNewFrame(OMX_IN OMX_U8 *buffer,
- OMX_IN OMX_U32 buffer_length,
- OMX_IN OMX_U32 size_of_nal_length_field,
- OMX_OUT OMX_BOOL &isNewFrame)
-{
- NALU nal_unit;
- uint16 first_mb_in_slice = 0;
- uint32 numBytesInRBSP = 0;
- bool eRet = true;
-
- DEBUG_PRINT_LOW("get_h264_nal_type %p nal_length %d nal_length_field %d\n",
- buffer, buffer_length, size_of_nal_length_field);
-
- if ( false == extract_rbsp(buffer, buffer_length, size_of_nal_length_field,
- m_rbspBytes, &numBytesInRBSP, &nal_unit) )
- {
- DEBUG_PRINT_ERROR("ERROR: In %s() - extract_rbsp() failed", __func__);
- isNewFrame = OMX_FALSE;
- eRet = false;
- }
- else
- {
- switch (nal_unit.nalu_type)
- {
- case NALU_TYPE_IDR:
- case NALU_TYPE_NON_IDR:
- {
- DEBUG_PRINT_LOW("\n Found a AU Boundary %d ",nal_unit.nalu_type);
- if (m_forceToStichNextNAL)
- {
- isNewFrame = OMX_FALSE;
- }
- else
- {
- RbspParser rbsp_parser(m_rbspBytes, (m_rbspBytes+numBytesInRBSP));
- first_mb_in_slice = rbsp_parser.ue();
-
- if((!first_mb_in_slice) || /*(slice.prv_frame_num != slice.frame_num ) ||*/
- ( (m_prv_nalu.nal_ref_idc != nal_unit.nal_ref_idc) && ( nal_unit.nal_ref_idc * m_prv_nalu.nal_ref_idc == 0 ) ) ||
- /*( ((m_prv_nalu.nalu_type == NALU_TYPE_IDR) && (nal_unit.nalu_type == NALU_TYPE_IDR)) && (slice.idr_pic_id != slice.prv_idr_pic_id) ) || */
- ( (m_prv_nalu.nalu_type != nal_unit.nalu_type ) && ((m_prv_nalu.nalu_type == NALU_TYPE_IDR) || (nal_unit.nalu_type == NALU_TYPE_IDR)) ) )
- {
- //DEBUG_PRINT_LOW("Found a New Frame due to NALU_TYPE_IDR/NALU_TYPE_NON_IDR");
- isNewFrame = OMX_TRUE;
- }
- else
- {
- isNewFrame = OMX_FALSE;
- }
- }
- m_au_data = true;
- m_forceToStichNextNAL = false;
- break;
- }
- case NALU_TYPE_SPS:
- case NALU_TYPE_PPS:
- case NALU_TYPE_SEI:
- case NALU_TYPE_UNSPECIFIED:
- case NALU_TYPE_EOSEQ:
- case NALU_TYPE_EOSTREAM:
- {
- DEBUG_PRINT_LOW("\n Non AU boundary NAL %d",nal_unit.nalu_type);
- if(m_au_data)
- {
- isNewFrame = OMX_TRUE;
- m_au_data = false;
- }
- else
- {
- isNewFrame = OMX_FALSE;
- }
-
- m_forceToStichNextNAL = true;
- break;
- }
- case NALU_TYPE_ACCESS_DELIM:
- default:
- {
- isNewFrame = OMX_FALSE;
- // Do not update m_forceToStichNextNAL
- break;
- }
- } // end of switch
- } // end of if
- m_prv_nalu = nal_unit;
- DEBUG_PRINT_LOW("get_h264_nal_type - newFrame value %d\n",isNewFrame);
- return eRet;
-}
diff --git a/mm-video/vidc/vdec/src/message_queue.c b/mm-video/vidc/vdec/src/message_queue.c
deleted file mode 100644
index 50b6ada0..00000000
--- a/mm-video/vidc/vdec/src/message_queue.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "message_queue.h"
-
-int check_if_queue_empty ( unsigned int queuetocheck, void* queuecontext )
-{
- struct video_queue_context *ptr_q = NULL;
- /*
- * queuetocheck - 0 command queue
- * queuetocheck - 1 data queue
- */
- if ( queuecontext == NULL || (queuetocheck > 1 ) )
- {
- return 1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- if (queuetocheck == 0)
- {
- if (ptr_q->read_comq == ptr_q->write_comq)
- {
- return 1;
- }
- }
- else if (queuetocheck == 1)
- {
- if (ptr_q->write_dataq == ptr_q->read_dataq)
- {
- return 1;
- }
- }
-
- return 0;
-}
-
-
-
-struct video_msgq * queue_get_cmd (void* queuecontext )
-{
- struct video_queue_context *ptr_q = NULL;
- struct video_msgq *pitem = NULL;
-
- if( NULL == queuecontext )
- {
- printf("\n queue_get_cmd: Invalid Input parameter\n");
- return NULL;
- }
-
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Wait on the semaphore till it is released */
- sem_wait(&ptr_q->sem_message);
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if (ptr_q->read_comq != ptr_q->write_comq)
- {
- pitem = &ptr_q->ptr_cmdq [ptr_q->read_comq];
- ptr_q->read_comq = (ptr_q->read_comq + 1) % \
- ptr_q->commandq_size;
- }
- else if (ptr_q->write_dataq != ptr_q->read_dataq)
- {
- pitem = &ptr_q->ptr_dataq [ptr_q->read_dataq];
- ptr_q->read_dataq = (ptr_q->read_dataq + 1) % \
- ptr_q->dataq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- return pitem;
-}
-
-
-int queue_post_cmdq ( void* queuecontext,
- struct video_msgq *pitem
- )
-{
- struct video_queue_context *ptr_q = NULL;
-
- if (pitem == NULL || queuecontext == NULL)
- {
- return -1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if ((ptr_q->write_comq + 1) % ptr_q->commandq_size == ptr_q->read_comq)
- {
- printf("\n QUEUE is FULL");
- return 0;
- }
- else
- {
- /* Store the command in the Message Queue & increment write offset */
- memcpy ( &ptr_q->ptr_cmdq [ptr_q->write_comq],pitem, \
- sizeof (struct video_msgq));
- ptr_q->write_comq = (ptr_q->write_comq + 1) % ptr_q->commandq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- /* Post the semaphore */
- sem_post(&ptr_q->sem_message);
- return 1;
-}
-
-
-int queue_post_dataq ( void *queuecontext,
- struct video_msgq *pitem
- )
-{
- struct video_queue_context *ptr_q = NULL;
-
- if (pitem == NULL || queuecontext == NULL)
- {
- return -1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if ((ptr_q->write_dataq + 1) % ptr_q->dataq_size == ptr_q->read_dataq)
- {
- printf("\n QUEUE is FULL");
- return 0;
- }
- else
- {
- /* Store the command in the Message Queue & increment write offset */
- memcpy ( &ptr_q->ptr_dataq [ptr_q->write_dataq],pitem, \
- sizeof (struct video_msgq));
- ptr_q->write_dataq = (ptr_q->write_dataq + 1) % ptr_q->dataq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- /* Post the semaphore */
- sem_post(&ptr_q->sem_message);
- return 1;
-
-}
diff --git a/mm-video/vidc/vdec/src/omx_vdec.cpp b/mm-video/vidc/vdec/src/omx_vdec.cpp
deleted file mode 100644
index fbfe853b..00000000
--- a/mm-video/vidc/vdec/src/omx_vdec.cpp
+++ /dev/null
@@ -1,6203 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file omx_vdec.cpp
- This module contains the implementation of the OpenMAX core & component.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include <string.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include "omx_vdec.h"
-#include <fcntl.h>
-
-#define BITSTREAM_LOG 0
-
-#if BITSTREAM_LOG
-FILE *outputBufferFile1;
-char filename [] = "/data/input-bitstream.m4v";
-#endif
-
-#define H264_SUPPORTED_WIDTH (480)
-#define H264_SUPPORTED_HEIGHT (368)
-
-#define MPEG4_SUPPORTED_WIDTH (480)
-#define MPEG4_SUPPORTED_HEIGHT (368)
-
-#define VC1_SP_MP_START_CODE 0xC5000000
-#define VC1_SP_MP_START_CODE_MASK 0xFF000000
-#define VC1_AP_SEQ_START_CODE 0x0F010000
-#define VC1_STRUCT_C_PROFILE_MASK 0xF0
-#define VC1_STRUCT_B_LEVEL_MASK 0xE0000000
-#define VC1_SIMPLE_PROFILE 0
-#define VC1_MAIN_PROFILE 1
-#define VC1_ADVANCE_PROFILE 3
-#define VC1_SIMPLE_PROFILE_LOW_LEVEL 0
-#define VC1_SIMPLE_PROFILE_MED_LEVEL 2
-#define VC1_STRUCT_C_LEN 4
-#define VC1_STRUCT_C_POS 8
-#define VC1_STRUCT_A_POS 12
-#define VC1_STRUCT_B_POS 24
-#define VC1_SEQ_LAYER_SIZE 36
-
-#ifdef _ANDROID_
- extern "C"{
- #include<utils/Log.h>
- }
-#endif//_ANDROID_
-
-#define DEBUG_PRINT(...) printf(__VA_ARGS__)
-#define DEBUG_PRINT_ERROR(...) printf(__VA_ARGS__)
-#define DEBUG_PRINT_LOW(...) printf(__VA_ARGS__)
-
-
-void* async_message_thread (void *input)
-{
- struct vdec_ioctl_msg ioctl_msg;
- struct vdec_msginfo vdec_msg;
- omx_vdec *omx = reinterpret_cast<omx_vdec*>(input);
-
- DEBUG_PRINT_HIGH("omx_vdec: Async thread start\n");
- while (1)
- {
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&vdec_msg;
-
- /*Wait for a message from the video decoder driver*/
- if (ioctl ( omx->driver_context.video_driver_fd,VDEC_IOCTL_GET_NEXT_MSG,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Error in ioctl read next msg");
- break;
- }
- else
- {
- /*Call Instance specific process function*/
- if (omx->async_message_process(input,&vdec_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR:Wrong ioctl message");
- }
- }
- }
- DEBUG_PRINT_HIGH("omx_vdec: Async thread stop\n");
- return NULL;
-}
-
-void* message_thread(void *input)
-{
- omx_vdec* omx = reinterpret_cast<omx_vdec*>(input);
- unsigned char id;
- int n;
-
- DEBUG_PRINT_HIGH("omx_vdec: message thread start\n");
- while (1)
- {
-
- n = read(omx->m_pipe_in, &id, 1);
-
- if(0 == n)
- {
- break;
- }
-
- if (1 == n)
- {
- omx->process_event_cb(omx, id);
- }
- if ((n < 0) && (errno != EINTR))
- {
- DEBUG_PRINT_ERROR("\nERROR: read from pipe failed, ret %d errno %d", n, errno);
- break;
- }
- }
- DEBUG_PRINT_HIGH("omx_vdec: message thread stop\n");
- return 0;
-}
-
-void post_message(omx_vdec *omx, unsigned char id)
-{
- int ret_value;
- DEBUG_PRINT_LOW("omx_vdec: post_message %d pipe out%d\n", id,omx->m_pipe_out);
- ret_value = write(omx->m_pipe_out, &id, 1);
- DEBUG_PRINT_LOW("post_message to pipe done %d\n",ret_value);
-}
-
-// omx_cmd_queue destructor
-omx_vdec::omx_cmd_queue::~omx_cmd_queue()
-{
- // Nothing to do
-}
-
-// omx cmd queue constructor
-omx_vdec::omx_cmd_queue::omx_cmd_queue(): m_read(0),m_write(0),m_size(0)
-{
- memset(m_q,0,sizeof(omx_event)*OMX_CORE_CONTROL_CMDQ_SIZE);
-}
-
-// omx cmd queue insert
-bool omx_vdec::omx_cmd_queue::insert_entry(unsigned p1, unsigned p2, unsigned id)
-{
- bool ret = true;
- if(m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_q[m_write].id = id;
- m_q[m_write].param1 = p1;
- m_q[m_write].param2 = p2;
- m_write++;
- m_size ++;
- if(m_write >= OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_write = 0;
- }
- }
- else
- {
- ret = false;
- DEBUG_PRINT_ERROR("ERROR: %s()::Command Queue Full\n", __func__);
- }
- return ret;
-}
-
-// omx cmd queue pop
-bool omx_vdec::omx_cmd_queue::pop_entry(unsigned *p1, unsigned *p2, unsigned *id)
-{
- bool ret = true;
- if (m_size > 0)
- {
- *id = m_q[m_read].id;
- *p1 = m_q[m_read].param1;
- *p2 = m_q[m_read].param2;
- // Move the read pointer ahead
- ++m_read;
- --m_size;
- if(m_read >= OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_read = 0;
- }
- }
- else
- {
- ret = false;
- }
- return ret;
-}
-
-// Retrieve the first mesg type in the queue
-unsigned omx_vdec::omx_cmd_queue::get_q_msg_type()
-{
- return m_q[m_read].id;
-}
-
-// factory function executed by the core to create instances
-void *get_omx_component_factory_fn(void)
-{
- return (new omx_vdec);
-}
-
-#ifdef _ANDROID_
-VideoHeap::VideoHeap(int fd, size_t size, void* base)
-{
- // dup file descriptor, map once, use pmem
- init(dup(fd), base, size, 0 , "/dev/pmem_adsp");
-}
-#endif // _ANDROID_
-
-/* ======================================================================
-FUNCTION
- omx_vdec::omx_vdec
-
-DESCRIPTION
- Constructor
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-omx_vdec::omx_vdec(): m_state(OMX_StateInvalid),
- m_app_data(NULL),
- m_color_format(OMX_COLOR_FormatYUV420Planar),
- m_inp_mem_ptr(NULL),
- m_out_mem_ptr(NULL),
- pending_input_buffers(0),
- pending_output_buffers(0),
- m_out_bm_count(0),
- m_out_buf_count(0),
- m_inp_buf_count(OMX_VIDEO_DEC_NUM_INPUT_BUFFERS),
- m_inp_buf_size(OMX_VIDEO_DEC_INPUT_BUFFER_SIZE),
- m_inp_bm_count(0),
- m_inp_bPopulated(OMX_FALSE),
- m_out_bPopulated(OMX_FALSE),
- m_height(0),
- m_width(0),
- m_port_height(0),
- m_port_width(0),
- m_crop_x(0),
- m_crop_y(0),
- m_crop_dx(0),
- m_crop_dy(0),
- m_flags(0),
- m_inp_bEnabled(OMX_TRUE),
- m_out_bEnabled(OMX_TRUE),
- m_event_port_settings_sent(false),
- input_flush_progress (false),
- output_flush_progress (false),
- m_platform_list(NULL),
- m_platform_entry(NULL),
- m_pmem_info(NULL),
- input_use_buffer (false),
- output_use_buffer (false),
- m_ineos_reached (0),
- m_outeos_pending (0),
- m_outeos_reached (0),
- arbitrary_bytes (true),
- psource_frame (NULL),
- pdest_frame (NULL),
- m_inp_heap_ptr (NULL),
- m_heap_inp_bm_count (0),
- codec_type_parse ((codec_type)0),
- first_frame_meta (true),
- frame_count (0),
- nal_count (0),
- nal_length(0),
- look_ahead_nal (false),
- first_frame(0),
- first_buffer(NULL),
- first_frame_size (0),
- set_seq_header_done(false),
- gate_output_buffers(true),
- gate_input_buffers(false),
- stride(0),
- sent_first_frame(false),
- m_error_propogated(false),
- scan_lines(0),
- m_device_file_ptr(NULL),
- m_vc1_profile((vc1_profile_type)0)
-{
- /* Assumption is that , to begin with , we have all the frames with decoder */
- DEBUG_PRINT_HIGH("\n In OMX vdec Constuctor");
- memset(&m_cmp,0,sizeof(m_cmp));
- memset(&m_cb,0,sizeof(m_cb));
- memset (&driver_context,0,sizeof(driver_context));
- memset (&h264_scratch,0,sizeof (OMX_BUFFERHEADERTYPE));
- memset (m_hwdevice_name,0,sizeof(m_hwdevice_name));
- driver_context.video_driver_fd = -1;
- m_vendor_config.pData = NULL;
- pthread_mutex_init(&m_lock, NULL);
- sem_init(&m_cmd_lock,0,0);
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::~omx_vdec
-
-DESCRIPTION
- Destructor
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-omx_vdec::~omx_vdec()
-{
- m_pmem_info = NULL;
- m_port_width = m_port_height = 0;
- DEBUG_PRINT_HIGH("\n In OMX vdec Destructor");
- if(m_pipe_in) close(m_pipe_in);
- if(m_pipe_out) close(m_pipe_out);
- m_pipe_in = -1;
- m_pipe_out = -1;
- DEBUG_PRINT_HIGH("\n Waiting on OMX Msg Thread exit");
- pthread_join(msg_thread_id,NULL);
- DEBUG_PRINT_HIGH("\n Waiting on OMX Async Thread exit");
- pthread_join(async_thread_id,NULL);
- pthread_mutex_destroy(&m_lock);
- sem_destroy(&m_cmd_lock);
- DEBUG_PRINT_HIGH("\n Exit OMX vdec Destructor");
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::OMXCntrlProcessMsgCb
-
-DESCRIPTION
- IL Client callbacks are generated through this routine. The decoder
- provides the thread context for this routine.
-
-PARAMETERS
- ctxt -- Context information related to the self.
- id -- Event identifier. This could be any of the following:
- 1. Command completion event
- 2. Buffer done callback event
- 3. Frame done callback event
-
-RETURN VALUE
- None.
-
-========================================================================== */
-void omx_vdec::process_event_cb(void *ctxt, unsigned char id)
-{
- unsigned p1; // Parameter - 1
- unsigned p2; // Parameter - 2
- unsigned ident;
- unsigned qsize=0; // qsize
- omx_vdec *pThis = (omx_vdec *) ctxt;
-
- if(!pThis)
- {
- DEBUG_PRINT_ERROR("ERROR: %s()::Context is incorrect, bailing out\n",
- __func__);
- return;
- }
-
- // Protect the shared queue data structure
- do
- {
- /*Read the message id's from the queue*/
- pthread_mutex_lock(&pThis->m_lock);
- qsize = pThis->m_cmd_q.m_size;
- if(qsize)
- {
- pThis->m_cmd_q.pop_entry(&p1,&p2,&ident);
- }
-
- if (qsize == 0 && !pThis->gate_output_buffers)
- {
- qsize = pThis->m_ftb_q.m_size;
- if (qsize)
- {
- pThis->m_ftb_q.pop_entry(&p1,&p2,&ident);
- }
- }
-
- if (qsize == 0)
- {
- qsize = pThis->m_etb_q.m_size;
- if (qsize)
- {
- pThis->m_etb_q.pop_entry(&p1,&p2,&ident);
- }
- }
- pthread_mutex_unlock(&pThis->m_lock);
-
- /*process message if we have one*/
- if(qsize > 0)
- {
- id = ident;
- switch (id)
- {
- case OMX_COMPONENT_GENERATE_EVENT:
- if (pThis->m_cb.EventHandler)
- {
- switch (p1)
- {
- case OMX_CommandStateSet:
- pThis->m_state = (OMX_STATETYPE) p2;
- DEBUG_PRINT_HIGH("\n OMX_CommandStateSet complete, m_state = %d",
- pThis->m_state);
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL);
- break;
-
- case OMX_EventError:
- if(p2 == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("\n OMX_EventError: p2 is OMX_StateInvalid");
- pThis->m_state = (OMX_STATETYPE) p2;
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError, OMX_ErrorInvalidState, p2, NULL);
- }
- else if (p2 == (unsigned)OMX_ErrorHardware)
- {
- pThis->omx_report_error();
- }
- else
- {
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError, p2, NULL, NULL );
- }
- break;
-
- case OMX_CommandPortDisable:
- DEBUG_PRINT_HIGH("\n OMX_CommandPortDisable complete for port [%d]", p2);
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL );
- //TODO: Check if output port is one that got disabled
- pThis->gate_output_buffers = false;
- break;
- case OMX_CommandPortEnable:
- DEBUG_PRINT_HIGH("\n OMX_CommandPortEnable complete for port [%d]", p2);
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,\
- OMX_EventCmdComplete, p1, p2, NULL );
- break;
-
- default:
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL );
- break;
-
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: %s()::EventHandler is NULL\n", __func__);
- }
- break;
- case OMX_COMPONENT_GENERATE_ETB_ARBITRARY:
- if (pThis->empty_this_buffer_proxy_arbitrary((OMX_HANDLETYPE)p1,\
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n empty_this_buffer_proxy_arbitrary failure");
- pThis->omx_report_error ();
- }
- break;
- case OMX_COMPONENT_GENERATE_ETB:
- if (pThis->empty_this_buffer_proxy((OMX_HANDLETYPE)p1,\
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n empty_this_buffer_proxy failure");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_FTB:
- if ( pThis->fill_this_buffer_proxy((OMX_HANDLETYPE)p1,\
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n fill_this_buffer_proxy failure");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_COMMAND:
- pThis->send_command_proxy(&pThis->m_cmp,(OMX_COMMANDTYPE)p1,\
- (OMX_U32)p2,(OMX_PTR)NULL);
- break;
-
- case OMX_COMPONENT_GENERATE_EBD:
-
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_EBD failure");
- pThis->omx_report_error ();
- }
- else
- {
- if ( pThis->empty_buffer_done(&pThis->m_cmp,
- (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n empty_buffer_done failure");
- pThis->omx_report_error ();
- }
- }
- break;
-
- case OMX_COMPONENT_GENERATE_FBD:
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_FBD failure");
- pThis->omx_report_error ();
- }
- else
- {
- if ( pThis->fill_buffer_done(&pThis->m_cmp,
- (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone )
- {
- DEBUG_PRINT_ERROR("\n fill_buffer_done failure");
- pThis->omx_report_error ();
- }
- }
- break;
-
- case OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH:
- DEBUG_PRINT_HIGH("\n Flush i/p Port complete");
- pThis->input_flush_progress = false;
- DEBUG_PRINT_LOW("\n Input flush done pending input %d",
- pThis->pending_input_buffers);
-
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\nOMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH failure");
- pThis->omx_report_error ();
- }
- else
- {
- /*Check if we need generate event for Flush done*/
- if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_INPUT_FLUSH_PENDING))
- {
- BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_INPUT_FLUSH_PENDING);
- DEBUG_PRINT_LOW("\n Input Flush completed - Notify Client");
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandFlush,
- OMX_CORE_INPUT_PORT_INDEX,NULL );
- }
- if (BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_IDLE_PENDING))
- {
- if (!pThis->output_flush_progress)
- {
- DEBUG_PRINT_LOW("\n Output flush done hence issue stop");
- if (ioctl (pThis->driver_context.video_driver_fd,
- VDEC_IOCTL_CMD_STOP,NULL ) < 0)
- {
- DEBUG_PRINT_ERROR("\n VDEC_IOCTL_CMD_STOP failed");
- pThis->omx_report_error ();
- }
- }
- }
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH:
- DEBUG_PRINT_HIGH("\n Flush o/p Port complete");
- pThis->output_flush_progress = false;
- DEBUG_PRINT_LOW("\n Output flush done pending buf %d",pThis->pending_output_buffers);
-
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH failed");
- pThis->omx_report_error ();
- }
- else
- {
- /*Check if we need generate event for Flush done*/
- if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_OUTPUT_FLUSH_PENDING))
- {
- DEBUG_PRINT_LOW("\n Notify Output Flush done");
- BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING);
-
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandFlush,
- OMX_CORE_OUTPUT_PORT_INDEX,NULL );
- }
- if (BITMASK_PRESENT(&pThis->m_flags ,OMX_COMPONENT_IDLE_PENDING))
- {
- if (!pThis->input_flush_progress)
- {
- DEBUG_PRINT_LOW("\n Input flush done hence issue stop");
- if (ioctl (pThis->driver_context.video_driver_fd,
- VDEC_IOCTL_CMD_STOP,NULL ) < 0)
- {
- DEBUG_PRINT_ERROR("\n VDEC_IOCTL_CMD_STOP failed");
- pThis->omx_report_error ();
- }
- }
- }
- }
- }
- break;
-
- case OMX_COMPONENT_GENERATE_START_DONE:
- DEBUG_PRINT_HIGH("\n Rxd OMX_COMPONENT_GENERATE_START_DONE");
-
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_START_DONE Failure");
- pThis->omx_report_error ();
- }
- else
- {
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_START_DONE Success");
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING))
- {
- DEBUG_PRINT_LOW("\n Move to executing");
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING);
- pThis->m_state = OMX_StateExecuting;
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateExecuting, NULL);
- }
- else if (BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_PAUSE_PENDING))
- {
- if (ioctl (pThis->driver_context.video_driver_fd,
- VDEC_IOCTL_CMD_PAUSE,NULL ) < 0)
- {
- DEBUG_PRINT_ERROR("\n VDEC_IOCTL_CMD_PAUSE failed");
- pThis->omx_report_error ();
- }
- }
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n Event Handler callback is NULL");
- }
- break;
-
- case OMX_COMPONENT_GENERATE_PAUSE_DONE:
- DEBUG_PRINT_HIGH("\n Rxd OMX_COMPONENT_GENERATE_PAUSE_DONE");
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("OMX_COMPONENT_GENERATE_PAUSE_DONE ret failed");
- pThis->omx_report_error ();
- }
- else
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_PAUSE_PENDING))
- {
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_PAUSE_DONE nofity");
- //Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_PAUSE_PENDING);
- pThis->m_state = OMX_StatePause;
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StatePause, NULL);
- }
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_RESUME_DONE:
- DEBUG_PRINT_HIGH("\n Rxd OMX_COMPONENT_GENERATE_RESUME_DONE");
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_RESUME_DONE failed");
- pThis->omx_report_error ();
- }
- else
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING))
- {
- DEBUG_PRINT_LOW("\n Moving the decoder to execute state");
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING);
- pThis->m_state = OMX_StateExecuting;
- pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateExecuting,NULL);
- }
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_STOP_DONE:
- DEBUG_PRINT_HIGH("\n Rxd OMX_COMPONENT_GENERATE_STOP_DONE");
- if (pThis->m_cb.EventHandler)
- {
- if (p2 != VDEC_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_STOP_DONE ret failed");
- pThis->omx_report_error ();
- }
- else
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_STOP_DONE Success");
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_IDLE_PENDING);
- pThis->m_state = OMX_StateIdle;
- DEBUG_PRINT_LOW("\n Move to Idle State");
- pThis->m_cb.EventHandler(&pThis->m_cmp,pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateIdle,NULL);
- }
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_HARDWARE_ERROR:
- DEBUG_PRINT_ERROR("\n OMX_COMPONENT_GENERATE_HARDWARE_ERROR");
- pThis->omx_report_error ();
- break;
-
- default:
- break;
- }
- }
- pthread_mutex_lock(&pThis->m_lock);
- if(!pThis->gate_output_buffers)
- {
- qsize = pThis->m_cmd_q.m_size + pThis->m_ftb_q.m_size +\
- pThis->m_etb_q.m_size;
- }
- else
- {
- qsize = pThis->m_cmd_q.m_size + pThis->m_etb_q.m_size;
- }
- pthread_mutex_unlock(&pThis->m_lock);
- }
- while(qsize>0);
-
-}
-
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ComponentInit
-
-DESCRIPTION
- Initialize the component.
-
-PARAMETERS
- ctxt -- Context information related to the self.
- id -- Event identifier. This could be any of the following:
- 1. Command completion event
- 2. Buffer done callback event
- 3. Frame done callback event
-
-RETURN VALUE
- None.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::component_init(OMX_STRING role)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned int alignment = 0,buffer_size = 0;
- int fds[2];
- int r;
- bool is_fluid = false;
-
- if (!m_device_file_ptr) {
- int bytes_read = 0,count = 0;
- unsigned min_size;
- m_device_file_ptr = fopen("/sys/devices/system/soc/soc0/hw_platform","rb");
- if (m_device_file_ptr) {
- (void)fgets((char *)m_hwdevice_name,sizeof(m_hwdevice_name),m_device_file_ptr);
- DEBUG_PRINT_HIGH ("\n Name of the device is %s",m_hwdevice_name);
- min_size = strnlen((const char *)m_hwdevice_name,sizeof(m_hwdevice_name));
- if (strlen("Fluid") < min_size) {
- min_size = strnlen("Fluid",sizeof("Fluid"));
- }
- if (!strncmp("Fluid",(const char *)m_hwdevice_name,min_size)) {
- is_fluid = true;
- }
- fclose (m_device_file_ptr);
- } else {
- DEBUG_PRINT_HIGH("\n Could not open hw_platform file");
- }
- }
-
- DEBUG_PRINT_HIGH("\n omx_vdec::component_init(): Start of New Playback");
- driver_context.video_driver_fd = open ("/dev/msm_vidc_dec",\
- O_RDWR|O_NONBLOCK);
-
- DEBUG_PRINT_HIGH("\n omx_vdec::component_init(): Open returned fd %d",
- driver_context.video_driver_fd);
-
- if(driver_context.video_driver_fd == 0){
- driver_context.video_driver_fd = open ("/dev/msm_vidc_dec",\
- O_RDWR|O_NONBLOCK);
- }
-
- if(driver_context.video_driver_fd < 0)
- {
- DEBUG_PRINT_ERROR("Omx_vdec::Comp Init Returning failure\n");
- return OMX_ErrorInsufficientResources;
- }
-
-#ifndef MULTI_DEC_INST
- unsigned int instance_count = 0;
- if (!is_fluid) {
- ioctl_msg.outputparam = &instance_count;
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_NUMBER_INSTANCES,
- (void*)&ioctl_msg) < 0){
- DEBUG_PRINT_ERROR("\n Instance Query Failed");
- return OMX_ErrorInsufficientResources;
- }
- if (instance_count > 1) {
- close(driver_context.video_driver_fd);
- DEBUG_PRINT_ERROR("\n Reject Second instance of Decoder");
- driver_context.video_driver_fd = -1;
- return OMX_ErrorInsufficientResources;
- }
- }
-#endif
-
-#if BITSTREAM_LOG
- outputBufferFile1 = fopen (filename, "ab");
-#endif
-
- // Copy the role information which provides the decoder kind
- strncpy(driver_context.kind,role,128);
-
- if(!strncmp(driver_context.kind,"OMX.qcom.video.decoder.mpeg4",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_decoder.mpeg4",\
- OMX_MAX_STRINGNAME_SIZE);
- driver_context.decoder_format = VDEC_CODECTYPE_MPEG4;
- eCompressionFormat = OMX_VIDEO_CodingMPEG4;
- /*Initialize Start Code for MPEG4*/
- codec_type_parse = CODEC_TYPE_MPEG4;
- m_frame_parser.init_start_codes (codec_type_parse);
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.h263",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_decoder.h263",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("\n H263 Decoder selected");
- driver_context.decoder_format = VDEC_CODECTYPE_H263;
- eCompressionFormat = OMX_VIDEO_CodingH263;
- codec_type_parse = CODEC_TYPE_H263;
- m_frame_parser.init_start_codes (codec_type_parse);
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.avc",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_decoder.avc",OMX_MAX_STRINGNAME_SIZE);
- driver_context.decoder_format = VDEC_CODECTYPE_H264;
- eCompressionFormat = OMX_VIDEO_CodingAVC;
- codec_type_parse = CODEC_TYPE_H264;
- m_frame_parser.init_start_codes (codec_type_parse);
- m_frame_parser.init_nal_length(nal_length);
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.vc1",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_decoder.vc1",OMX_MAX_STRINGNAME_SIZE);
- driver_context.decoder_format = VDEC_CODECTYPE_VC1;
- eCompressionFormat = OMX_VIDEO_CodingWMV;
- codec_type_parse = CODEC_TYPE_VC1;
- m_frame_parser.init_start_codes (codec_type_parse);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Unknown Component\n");
- eRet = OMX_ErrorInvalidComponentName;
- }
-
- if (eRet == OMX_ErrorNone)
- {
- driver_context.output_format = VDEC_YUV_FORMAT_NV12;
-
- if (is_fluid) {
-
- FILE * pFile;
- char disable_overlay = '0';
- pFile = fopen
- ("/data/data/com.arcsoft.videowall/files/disableoverlay.txt", "rb" );
- if (pFile == NULL) {
- DEBUG_PRINT_HIGH(" fopen FAiLED for disableoverlay.txt\n");
- } else {
- int count = fread(&disable_overlay, 1, 1, pFile);
- fclose(pFile);
- }
-
- if(disable_overlay == '1') {
- DEBUG_PRINT_HIGH(" vdec : TILE format \n");
- driver_context.output_format = VDEC_YUV_FORMAT_TILE_4x2;
- } else {
- DEBUG_PRINT_HIGH(" vdec : NV 12 format \n");
- driver_context.output_format = VDEC_YUV_FORMAT_NV12;
- }
- }
-
- /*Initialize Decoder with codec type and resolution*/
- ioctl_msg.inputparam = &driver_context.decoder_format;
- ioctl_msg.outputparam = NULL;
-
- if ( (eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_CODEC,
- (void*)&ioctl_msg) < 0)
-
- {
- DEBUG_PRINT_ERROR("\n Set codec type failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
- /*Set the output format*/
- ioctl_msg.inputparam = &driver_context.output_format;
- ioctl_msg.outputparam = NULL;
-
- if ( (eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_OUTPUT_FORMAT,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set output format failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
-#ifdef MAX_RES_720P
- driver_context.video_resoultion.frame_height = 720;
- driver_context.video_resoultion.frame_width = 1280;
- driver_context.video_resoultion.stride = 1280;
- driver_context.video_resoultion.scan_lines = 720;
-#endif
-#ifdef MAX_RES_1080P
- driver_context.video_resoultion.frame_height = 1088;
- driver_context.video_resoultion.frame_width = 1920;
- driver_context.video_resoultion.stride = 1920;
- driver_context.video_resoultion.scan_lines = 1088;
-#endif
-
- ioctl_msg.inputparam = &driver_context.video_resoultion;
- ioctl_msg.outputparam = NULL;
-
- if ( (eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_PICRES,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set Resolution failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
- /*Get the Buffer requirements for input and output ports*/
- driver_context.input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.input_buffer;
-
- if ( (eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Requesting for input buffer requirements failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
- m_inp_buf_count = driver_context.input_buffer.actualcount;
- buffer_size = driver_context.input_buffer.buffer_size;
- alignment = driver_context.input_buffer.alignment;
- m_inp_buf_size = ((buffer_size + alignment -1 ) & (~(alignment -1)));
- m_inp_buf_count_min = driver_context.input_buffer.mincount;
-
- /*Get the Buffer requirements for input and output ports*/
- driver_context.input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- ioctl_msg.inputparam = &driver_context.input_buffer;
- ioctl_msg.outputparam = NULL;
-
- m_inp_buf_count_min = m_inp_buf_count = driver_context.input_buffer.actualcount =
- driver_context.input_buffer.mincount + 3;
-
- if ( (eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set input buffer requirements failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
-
- driver_context.output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.output_buffer;
-
- if ((eRet == OMX_ErrorNone) &&
- ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Requesting for output buffer requirements failed");
- eRet = OMX_ErrorInsufficientResources;
- }
-
- m_out_buf_count_recon = m_out_buf_count = driver_context.output_buffer.actualcount;
- m_out_buf_count_min_recon = m_out_buf_count_min = driver_context.output_buffer.mincount;
-
- alignment = driver_context.output_buffer.alignment;
- buffer_size = driver_context.output_buffer.buffer_size;
- m_out_buf_size_recon = m_out_buf_size =
- ((buffer_size + alignment - 1) & (~(alignment -1)));
-#ifdef MAX_RES_720P
- scan_lines = m_crop_dy = m_height = 720;
- stride = m_crop_dx = m_width = 1280;
-#endif
-#ifdef MAX_RES_1080P
- scan_lines = m_crop_dy = m_height = 1088;
- stride = m_crop_dx = m_width = 1920;
-#endif
- m_port_height = m_height;
- m_port_width = m_width;
- m_state = OMX_StateLoaded;
-
- if(pipe(fds))
- {
- DEBUG_PRINT_ERROR("pipe creation failed\n");
- eRet = OMX_ErrorInsufficientResources;
- }
- else
- {
- int temp1[2];
- if(fds[0] == 0 || fds[1] == 0)
- {
- if (pipe (temp1))
- {
- DEBUG_PRINT_ERROR("pipe creation failed\n");
- return OMX_ErrorInsufficientResources;
- }
- //close (fds[0]);
- //close (fds[1]);
- fds[0] = temp1 [0];
- fds[1] = temp1 [1];
- }
- m_pipe_in = fds[0];
- m_pipe_out = fds[1];
- r = pthread_create(&msg_thread_id,0,message_thread,this);
-
- if(r < 0)
- {
- DEBUG_PRINT_ERROR("\n component_init(): message_thread creation failed");
- eRet = OMX_ErrorInsufficientResources;
- }
- else
- {
- r = pthread_create(&async_thread_id,0,async_message_thread,this);
- if(r < 0)
- {
- DEBUG_PRINT_ERROR("\n component_init(): async_message_thread creation failed");
- eRet = OMX_ErrorInsufficientResources;
- }
- }
- }
- }
-
- if (eRet != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n Component Init Failed");
- DEBUG_PRINT_HIGH("\n Calling VDEC_IOCTL_STOP_NEXT_MSG");
- (void)ioctl(driver_context.video_driver_fd, VDEC_IOCTL_STOP_NEXT_MSG,
- NULL);
- DEBUG_PRINT_HIGH("\n Calling close() on Video Driver");
- close (driver_context.video_driver_fd);
- driver_context.video_driver_fd = -1;
- }
- else
- {
- DEBUG_PRINT_HIGH("\n omx_vdec::component_init() success");
- }
-
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::GetComponentVersion
-
-DESCRIPTION
- Returns the component version.
-
-PARAMETERS
- TBD.
-
-RETURN VALUE
- OMX_ErrorNone.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::get_component_version
- (
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STRING componentName,
- OMX_OUT OMX_VERSIONTYPE* componentVersion,
- OMX_OUT OMX_VERSIONTYPE* specVersion,
- OMX_OUT OMX_UUIDTYPE* componentUUID
- )
-{
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Get Comp Version in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- /* TBD -- Return the proper version */
- return OMX_ErrorNone;
-}
-/* ======================================================================
-FUNCTION
- omx_vdec::SendCommand
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::send_command(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData
- )
-{
- DEBUG_PRINT_LOW("\n send_command: Recieved a Command from Client");
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Send Command in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- post_event((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
- sem_wait(&m_cmd_lock);
- DEBUG_PRINT_LOW("\n send_command: Command Processed\n");
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::SendCommand
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::send_command_proxy(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData
- )
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_STATETYPE eState = (OMX_STATETYPE) param1;
- int bFlag = 1,sem_posted = 0;;
-
- DEBUG_PRINT_LOW("\n send_command_proxy(): cmd = %d", cmd);
- DEBUG_PRINT_HIGH("\n send_command_proxy(): Current State %d, Expected State %d",
- m_state, eState);
-
- if(cmd == OMX_CommandStateSet)
- {
- DEBUG_PRINT_HIGH("\n send_command_proxy(): OMX_CommandStateSet issued");
- DEBUG_PRINT_HIGH("\n Current State %d, Expected State %d", m_state, eState);
- /***************************/
- /* Current State is Loaded */
- /***************************/
- if(m_state == OMX_StateLoaded)
- {
- if(eState == OMX_StateIdle)
- {
- //if all buffers are allocated or all ports disabled
- if(allocate_done() ||
- (m_inp_bEnabled == OMX_FALSE && m_out_bEnabled == OMX_FALSE))
- {
- DEBUG_PRINT_LOW("send_command_proxy(): Loaded-->Idle\n");
- }
- else
- {
- DEBUG_PRINT_LOW("send_command_proxy(): Loaded-->Idle-Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_IDLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- /* Requesting transition from Loaded to Loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Loaded-->Loaded\n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Loaded to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("send_command_proxy(): Loaded-->WaitForResources\n");
- }
- /* Requesting transition from Loaded to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Loaded-->Executing\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Loaded to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Loaded-->Pause\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Loaded to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Loaded-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Loaded-->Invalid(%d Not Handled)\n",\
- eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
-
- /***************************/
- /* Current State is IDLE */
- /***************************/
- else if(m_state == OMX_StateIdle)
- {
- if(eState == OMX_StateLoaded)
- {
- if(release_done())
- {
- /*
- Since error is None , we will post an event at the end
- of this function definition
- */
- DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Loaded\n");
- }
- else
- {
- DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Loaded-Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_LOADING_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- /* Requesting transition from Idle to Executing */
- else if(eState == OMX_StateExecuting)
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_EXECUTE_PENDING);
- DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Executing\n");
- post_event (NULL,VDEC_S_SUCCESS,OMX_COMPONENT_GENERATE_START_DONE);
- bFlag = 0;
- }
- /* Requesting transition from Idle to Idle */
- else if(eState == OMX_StateIdle)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Idle-->Idle\n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Idle to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Idle-->WaitForResources\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Idle to Pause */
- else if(eState == OMX_StatePause)
- {
- /*To pause the Video core we need to start the driver*/
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_CMD_START,
- NULL) < 0)
- {
- DEBUG_PRINT_ERROR("\n VDEC_IOCTL_CMD_START FAILED");
- omx_report_error ();
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_PAUSE_PENDING);
- DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Pause\n");
- bFlag = 0;
- }
- }
- /* Requesting transition from Idle to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Idle-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Idle --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
-
- /******************************/
- /* Current State is Executing */
- /******************************/
- else if(m_state == OMX_StateExecuting)
- {
- DEBUG_PRINT_LOW("\n Command Recieved in OMX_StateExecuting");
- /* Requesting transition from Executing to Idle */
- if(eState == OMX_StateIdle)
- {
- /* Since error is None , we will post an event
- at the end of this function definition
- */
- DEBUG_PRINT_LOW("\n send_command_proxy(): Executing --> Idle \n");
- BITMASK_SET(&m_flags,OMX_COMPONENT_IDLE_PENDING);
- if(!sem_posted)
- {
- sem_posted = 1;
- sem_post (&m_cmd_lock);
- execute_omx_flush(OMX_ALL);
- }
- bFlag = 0;
- }
- /* Requesting transition from Executing to Paused */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_LOW("\n PAUSE Command Issued");
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_CMD_PAUSE,
- NULL) < 0)
- {
- DEBUG_PRINT_ERROR("\n Error In Pause State");
- post_event(OMX_EventError,OMX_ErrorHardware,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_PAUSE_PENDING);
- DEBUG_PRINT_LOW("send_command_proxy(): Pause-->Executing\n");
- bFlag = 0;
- }
- }
- /* Requesting transition from Executing to Loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("\n send_command_proxy(): Executing --> Loaded \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Executing to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("\n send_command_proxy(): Executing --> WaitForResources \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Executing to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("\n send_command_proxy(): Executing --> Executing \n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Executing to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("\n send_command_proxy(): Executing --> Invalid \n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Executing --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /***************************/
- /* Current State is Pause */
- /***************************/
- else if(m_state == OMX_StatePause)
- {
- /* Requesting transition from Pause to Executing */
- if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_LOW("\n Pause --> Executing \n");
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_CMD_RESUME,
- NULL) < 0)
- {
- DEBUG_PRINT_ERROR("\n VDEC_IOCTL_CMD_RESUME failed");
- post_event(OMX_EventError,OMX_ErrorHardware,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_EXECUTE_PENDING);
- DEBUG_PRINT_LOW("send_command_proxy(): Idle-->Executing\n");
- post_event (NULL,VDEC_S_SUCCESS,\
- OMX_COMPONENT_GENERATE_RESUME_DONE);
- bFlag = 0;
- }
- }
- /* Requesting transition from Pause to Idle */
- else if(eState == OMX_StateIdle)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("\n Pause --> Idle \n");
- BITMASK_SET(&m_flags,OMX_COMPONENT_IDLE_PENDING);
- if(!sem_posted)
- {
- sem_posted = 1;
- sem_post (&m_cmd_lock);
- execute_omx_flush(OMX_ALL);
- }
- bFlag = 0;
- }
- /* Requesting transition from Pause to loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("\n Pause --> loaded \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Pause to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("\n Pause --> WaitForResources \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Pause to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("\n Pause --> Pause \n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Pause to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("\n Pause --> Invalid \n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Paused --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /***************************/
- /* Current State is WaitForResources */
- /***************************/
- else if(m_state == OMX_StateWaitForResources)
- {
- /* Requesting transition from WaitForResources to Loaded */
- if(eState == OMX_StateLoaded)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("send_command_proxy(): WaitForResources-->Loaded\n");
- }
- /* Requesting transition from WaitForResources to WaitForResources */
- else if (eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): WaitForResources-->WaitForResources\n");
- post_event(OMX_EventError,OMX_ErrorSameState,
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from WaitForResources to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): WaitForResources-->Executing\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from WaitForResources to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): WaitForResources-->Pause\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from WaitForResources to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): WaitForResources-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- /* Requesting transition from WaitForResources to Loaded -
- is NOT tested by Khronos TS */
-
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): %d --> %d(Not Handled)\n",m_state,eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /********************************/
- /* Current State is Invalid */
- /*******************************/
- else if(m_state == OMX_StateInvalid)
- {
- /* State Transition from Inavlid to any state */
- if(eState == (OMX_StateLoaded || OMX_StateWaitForResources
- || OMX_StateIdle || OMX_StateExecuting
- || OMX_StatePause || OMX_StateInvalid))
- {
- DEBUG_PRINT_ERROR("ERROR::send_command_proxy(): Invalid -->Loaded\n");
- post_event(OMX_EventError,OMX_ErrorInvalidState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- }
- else if (cmd == OMX_CommandFlush)
- {
- DEBUG_PRINT_HIGH("\n send_command_proxy(): OMX_CommandFlush issued"
- "with param1: %d", param1);
- if(0 == param1 || OMX_ALL == param1)
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_FLUSH_PENDING);
- }
- if(1 == param1 || OMX_ALL == param1)
- {
- //generate output flush event only.
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_FLUSH_PENDING);
- }
- if (!sem_posted){
- sem_posted = 1;
- DEBUG_PRINT_LOW("\n Set the Semaphore");
- sem_post (&m_cmd_lock);
- execute_omx_flush(param1);
- }
- bFlag = 0;
- }
- else if ( cmd == OMX_CommandPortEnable)
- {
- DEBUG_PRINT_HIGH("\n send_command_proxy(): OMX_CommandPortEnable issued"
- "with param1: %d", param1);
- if(param1 == OMX_CORE_INPUT_PORT_INDEX || param1 == OMX_ALL)
- {
- m_inp_bEnabled = OMX_TRUE;
-
- if( (m_state == OMX_StateLoaded &&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- || allocate_input_done())
- {
- post_event(OMX_CommandPortEnable,OMX_CORE_INPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- DEBUG_PRINT_LOW("send_command_proxy(): Disabled-->Enabled Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_ENABLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- if(param1 == OMX_CORE_OUTPUT_PORT_INDEX || param1 == OMX_ALL)
- {
- DEBUG_PRINT_LOW("\n Enable output Port command recieved");
- m_out_bEnabled = OMX_TRUE;
-
- if( (m_state == OMX_StateLoaded &&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- || (allocate_output_done()))
- {
- post_event(OMX_CommandPortEnable,OMX_CORE_OUTPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
-
- }
- else
- {
- DEBUG_PRINT_LOW("send_command_proxy(): Disabled-->Enabled Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- }
- else if (cmd == OMX_CommandPortDisable)
- {
- DEBUG_PRINT_HIGH("\n send_command_proxy(): OMX_CommandPortDisable issued"
- "with param1: %d", param1);
- if(param1 == OMX_CORE_INPUT_PORT_INDEX || param1 == OMX_ALL)
- {
- m_inp_bEnabled = OMX_FALSE;
- if((m_state == OMX_StateLoaded || m_state == OMX_StateIdle)
- && release_input_done())
- {
- post_event(OMX_CommandPortDisable,OMX_CORE_INPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_DISABLE_PENDING);
- if(m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
- {
- if(!sem_posted)
- {
- sem_posted = 1;
- sem_post (&m_cmd_lock);
- execute_omx_flush(OMX_CORE_INPUT_PORT_INDEX);
- }
- }
-
- // Skip the event notification
- bFlag = 0;
- }
- }
- if(param1 == OMX_CORE_OUTPUT_PORT_INDEX || param1 == OMX_ALL)
- {
- m_out_bEnabled = OMX_FALSE;
- DEBUG_PRINT_LOW("\n Disable output Port command recieved");
- if((m_state == OMX_StateLoaded || m_state == OMX_StateIdle)
- && release_output_done())
- {
- post_event(OMX_CommandPortDisable,OMX_CORE_OUTPUT_PORT_INDEX,\
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
- if(m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
- {
- if(!sem_posted)
- {
- sem_posted = 1;
- sem_post (&m_cmd_lock);
- execute_omx_flush(OMX_CORE_OUTPUT_PORT_INDEX);
- }
- }
- // Skip the event notification
- bFlag = 0;
-
- }
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Invalid Command other than StateSet (%d)\n",cmd);
- eRet = OMX_ErrorNotImplemented;
- }
- if(eRet == OMX_ErrorNone && bFlag)
- {
- post_event(cmd,eState,OMX_COMPONENT_GENERATE_EVENT);
- }
- if(!sem_posted)
- {
- sem_post(&m_cmd_lock);
- }
-
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ExecuteOmxFlush
-
-DESCRIPTION
- Executes the OMX flush.
-
-PARAMETERS
- flushtype - input flush(1)/output flush(0)/ both.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_vdec::execute_omx_flush(OMX_U32 flushType)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- enum vdec_bufferflush flush_dir = VDEC_FLUSH_TYPE_ALL;
- bool bRet = false;
-
- if(flushType == 0 || flushType == OMX_ALL)
- {
- input_flush_progress = true;
- //flush input only
- bRet = execute_input_flush(flushType);
- }
- if(flushType == 1 || flushType == OMX_ALL)
- {
- //flush output only
- output_flush_progress = true;
- bRet = execute_output_flush(flushType);
- }
-
- if(flushType == OMX_ALL)
- {
- /*Check if there are buffers with the Driver*/
- DEBUG_PRINT_LOW("\n Flush ALL ioctl issued");
- ioctl_msg.inputparam = &flush_dir;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(driver_context.video_driver_fd,VDEC_IOCTL_CMD_FLUSH,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Flush ALL Failed ");
- return false;
- }
- }
-
- return bRet;
-}
-/*=========================================================================
-FUNCTION : execute_output_flush
-
-DESCRIPTION
- Executes the OMX flush at OUTPUT PORT.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-==========================================================================*/
-bool omx_vdec::execute_output_flush(OMX_U32 flushType)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- enum vdec_bufferflush flush_dir = VDEC_FLUSH_TYPE_OUTPUT;
- unsigned p1 = 0; // Parameter - 1
- unsigned p2 = 0; // Parameter - 2
- unsigned ident = 0;
- bool bRet = true;
-
- /*Generate FBD for all Buffers in the FTBq*/
- pthread_mutex_lock(&m_lock);
- DEBUG_PRINT_LOW("\n Initiate Output Flush");
- while (m_ftb_q.m_size)
- {
- DEBUG_PRINT_LOW("\n Buffer queue size %d pending buf cnt %d",
- m_ftb_q.m_size,pending_output_buffers);
- m_ftb_q.pop_entry(&p1,&p2,&ident);
-
- if(ident == OMX_COMPONENT_GENERATE_FTB )
- {
- DEBUG_PRINT_LOW("\n Inside Flush Buffer OMX_COMPONENT_GENERATE_FTB");
- pending_output_buffers++;
- fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p2);
- }
- else if (ident == OMX_COMPONENT_GENERATE_FBD)
- {
- fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p1);
- }
- }
- pthread_mutex_unlock(&m_lock);
-
- if(gate_output_buffers)
- {
- DEBUG_PRINT_LOW("\n Output Buffers gated Check flush response");
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING))
- {
- DEBUG_PRINT_LOW("\n Notify Output Flush done");
- BITMASK_CLEAR (&m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING);
- m_cb.EventHandler(&m_cmp,m_app_data,OMX_EventCmdComplete,OMX_CommandFlush,
- OMX_CORE_OUTPUT_PORT_INDEX,NULL );
- }
- output_flush_progress = false;
- return bRet;
- }
-
- DEBUG_PRINT_LOW("\n output buffers count = %d",pending_output_buffers);
-
- if(flushType == 1)
- {
- /*Check if there are buffers with the Driver*/
- DEBUG_PRINT_LOW("\n ioctl command flush for output");
- ioctl_msg.inputparam = &flush_dir;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(driver_context.video_driver_fd,VDEC_IOCTL_CMD_FLUSH,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n output flush failed");
- return false;
- }
- }
-
- return bRet;
-}
-/*=========================================================================
-FUNCTION : execute_input_flush
-
-DESCRIPTION
- Executes the OMX flush at INPUT PORT.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-==========================================================================*/
-bool omx_vdec::execute_input_flush(OMX_U32 flushType)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- enum vdec_bufferflush flush_dir = VDEC_FLUSH_TYPE_INPUT;
- unsigned i =0;
- unsigned p1 = 0; // Parameter - 1
- unsigned p2 = 0; // Parameter - 2
- unsigned ident = 0;
- bool bRet = true;
-
- /*Generate EBD for all Buffers in the ETBq*/
- DEBUG_PRINT_LOW("\n Initiate Input Flush \n");
-
- pthread_mutex_lock(&m_lock);
- DEBUG_PRINT_LOW("\n Check if the Queue is empty \n");
- while (m_etb_q.m_size)
- {
- m_etb_q.pop_entry(&p1,&p2,&ident);
-
- if (ident == OMX_COMPONENT_GENERATE_ETB_ARBITRARY)
- {
- DEBUG_PRINT_LOW("\n Flush Input Heap Buffer %p",(OMX_BUFFERHEADERTYPE *)p2);
- m_cb.EmptyBufferDone(&m_cmp ,m_app_data, (OMX_BUFFERHEADERTYPE *)p2);
- }
- else if(ident == OMX_COMPONENT_GENERATE_ETB)
- {
- pending_input_buffers++;
- empty_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p2);
- }
- else if (ident == OMX_COMPONENT_GENERATE_EBD)
- {
- empty_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p1);
- }
- }
-
- /*Check if Heap Buffers are to be flushed*/
- if (arbitrary_bytes)
- {
- DEBUG_PRINT_LOW("\n Reset all the variables before flusing");
- h264_scratch.nFilledLen = 0;
- nal_count = 0;
- look_ahead_nal = false;
- frame_count = 0;
- DEBUG_PRINT_LOW("\n Initialize parser");
- if (m_frame_parser.mutils)
- {
- m_frame_parser.mutils->initialize_frame_checking_environment();
- }
-
- while (m_input_pending_q.m_size)
- {
- m_input_pending_q.pop_entry(&p1,&p2,&ident);
- m_cb.EmptyBufferDone(&m_cmp ,m_app_data, (OMX_BUFFERHEADERTYPE *)p1);
- }
-
- if (psource_frame)
- {
- m_cb.EmptyBufferDone(&m_cmp ,m_app_data,psource_frame);
- psource_frame = NULL;
- }
-
- if (pdest_frame)
- {
- pdest_frame->nFilledLen = 0;
- m_input_free_q.insert_entry((unsigned) pdest_frame,NULL,NULL);
- pdest_frame = NULL;
- }
- m_frame_parser.flush();
- }
-
- pthread_mutex_unlock(&m_lock);
- DEBUG_PRINT_LOW("\n Value of pending input buffers %d \n",pending_input_buffers);
-
- if(flushType == 0)
- {
- /*Check if there are buffers with the Driver*/
- DEBUG_PRINT_LOW("\n Input Flush ioctl issued");
- ioctl_msg.inputparam = &flush_dir;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(driver_context.video_driver_fd,VDEC_IOCTL_CMD_FLUSH,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Input Flush Failed ");
- return false;
- }
- }
-
- return bRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::SendCommandEvent
-
-DESCRIPTION
- Send the event to decoder pipe. This is needed to generate the callbacks
- in decoder thread context.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_vdec::post_event(unsigned int p1,
- unsigned int p2,
- unsigned int id)
-{
- bool bRet = false;
-
-
- pthread_mutex_lock(&m_lock);
-
- if( id == OMX_COMPONENT_GENERATE_FTB || \
- (id == OMX_COMPONENT_GENERATE_FBD)||
- (id == OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH))
- {
- m_ftb_q.insert_entry(p1,p2,id);
- }
- else if((id == OMX_COMPONENT_GENERATE_ETB) \
- || (id == OMX_COMPONENT_GENERATE_EBD)||
- (id == OMX_COMPONENT_GENERATE_ETB_ARBITRARY)||
- (id == OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH))
- {
- m_etb_q.insert_entry(p1,p2,id);
- }
- else
- {
- m_cmd_q.insert_entry(p1,p2,id);
- }
-
- bRet = true;
- DEBUG_PRINT_LOW("\n Value of this pointer in post_event %p",this);
- post_message(this, id);
-
- pthread_mutex_unlock(&m_lock);
-
- return bRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::GetParameter
-
-DESCRIPTION
- OMX Get Parameter method implementation
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_INOUT OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned int height=0,width = 0;
-
- DEBUG_PRINT_LOW("get_parameter: \n");
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Get Param in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(paramData == NULL)
- {
- DEBUG_PRINT_LOW("Get Param in Invalid paramData \n");
- return OMX_ErrorBadParameter;
- }
- switch(paramIndex)
- {
- case OMX_IndexParamPortDefinition:
- {
- OMX_PARAM_PORTDEFINITIONTYPE *portDefn;
- portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
-
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPortDefinition\n");
-
- portDefn->nVersion.nVersion = OMX_SPEC_VERSION;
- portDefn->nSize = sizeof(portDefn);
- portDefn->eDomain = OMX_PortDomainVideo;
- portDefn->format.video.nFrameHeight = m_crop_dy;
- portDefn->format.video.nFrameWidth = m_crop_dx;
- portDefn->format.video.nStride = m_width;
- portDefn->format.video.nSliceHeight = m_height;
- portDefn->format.video.xFramerate= 25;
-
- if (0 == portDefn->nPortIndex)
- {
- portDefn->eDir = OMX_DirInput;
- /*Actual count is based on input buffer count*/
- portDefn->nBufferCountActual = m_inp_buf_count;
- /*Set the Min count*/
- portDefn->nBufferCountMin = m_inp_buf_count_min;
- portDefn->nBufferSize = m_inp_buf_size;
- portDefn->format.video.eColorFormat = OMX_COLOR_FormatUnused;
- portDefn->format.video.eCompressionFormat = eCompressionFormat;
- portDefn->bEnabled = m_inp_bEnabled;
- portDefn->bPopulated = m_inp_bPopulated;
- }
- else if (1 == portDefn->nPortIndex)
- {
- m_out_buf_count = m_out_buf_count_recon;
- m_out_buf_count_min = m_out_buf_count_min_recon;
- m_out_buf_size = m_out_buf_size_recon;
- portDefn->eDir = OMX_DirOutput;
- portDefn->nBufferCountActual = m_out_buf_count;
- portDefn->nBufferCountMin = m_out_buf_count_min;
- portDefn->nBufferSize = m_out_buf_size;
- portDefn->bEnabled = m_out_bEnabled;
- portDefn->bPopulated = m_out_bPopulated;
- height = driver_context.video_resoultion.frame_height;
- width = driver_context.video_resoultion.frame_width;
-
- portDefn->format.video.nFrameHeight = height;
- portDefn->format.video.nFrameWidth = width;
- portDefn->format.video.nStride = stride;
- portDefn->format.video.nSliceHeight = scan_lines;
- DEBUG_PRINT_LOW("\n Get Param Slice Height %d Slice Width %d",
- scan_lines,stride);
- //TODO: Need to add color format
- portDefn->format.video.eColorFormat = m_color_format;
- portDefn->format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
- DEBUG_PRINT_LOW("\n Output Actual %d Output Min %d",
- portDefn->nBufferCountActual,portDefn->nBufferCountMin);
- }
- else
- {
- portDefn->eDir = OMX_DirMax;
- DEBUG_PRINT_LOW(" get_parameter: Bad Port idx %d",
- (int)portDefn->nPortIndex);
- eRet = OMX_ErrorBadPortIndex;
- }
-
- break;
- }
- case OMX_IndexParamVideoInit:
- {
- OMX_PORT_PARAM_TYPE *portParamType =
- (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoInit\n");
-
- portParamType->nVersion.nVersion = OMX_SPEC_VERSION;
- portParamType->nSize = sizeof(portParamType);
- portParamType->nPorts = 2;
- portParamType->nStartPortNumber = 0;
- break;
- }
- case OMX_IndexParamVideoPortFormat:
- {
- OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt =
- (OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoPortFormat\n");
-
- portFmt->nVersion.nVersion = OMX_SPEC_VERSION;
- portFmt->nSize = sizeof(portFmt);
-
- if (0 == portFmt->nPortIndex)
- {
- if (0 == portFmt->nIndex)
- {
- portFmt->eColorFormat = OMX_COLOR_FormatUnused;
- portFmt->eCompressionFormat = eCompressionFormat;
- }
- else
- {
- DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamVideoPortFormat:"\
- " NoMore compression formats\n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if (1 == portFmt->nPortIndex)
- {
- if (0 == portFmt->nIndex)
- {
- if (driver_context.output_format == VDEC_YUV_FORMAT_NV12)
- portFmt->eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
- else
- portFmt->eColorFormat = (OMX_COLOR_FORMATTYPE)0x7F000000;
-
- portFmt->eCompressionFormat = OMX_VIDEO_CodingUnused;
- }
- else
- {
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoPortFormat:"\
- " NoMore Color formats\n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("get_parameter: Bad port index %d\n",
- (int)portFmt->nPortIndex);
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
- /*Component should support this port definition*/
- case OMX_IndexParamAudioInit:
- {
- OMX_PORT_PARAM_TYPE *audioPortParamType =
- (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamAudioInit\n");
- audioPortParamType->nVersion.nVersion = OMX_SPEC_VERSION;
- audioPortParamType->nSize = sizeof(audioPortParamType);
- audioPortParamType->nPorts = 0;
- audioPortParamType->nStartPortNumber = 0;
- break;
- }
- /*Component should support this port definition*/
- case OMX_IndexParamImageInit:
- {
- OMX_PORT_PARAM_TYPE *imagePortParamType =
- (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamImageInit\n");
- imagePortParamType->nVersion.nVersion = OMX_SPEC_VERSION;
- imagePortParamType->nSize = sizeof(imagePortParamType);
- imagePortParamType->nPorts = 0;
- imagePortParamType->nStartPortNumber = 0;
- break;
-
- }
- /*Component should support this port definition*/
- case OMX_IndexParamOtherInit:
- {
- DEBUG_PRINT_ERROR("get_parameter: OMX_IndexParamOtherInit %08x\n",
- paramIndex);
- eRet =OMX_ErrorUnsupportedIndex;
- break;
- }
- case OMX_IndexParamStandardComponentRole:
- {
- OMX_PARAM_COMPONENTROLETYPE *comp_role;
- comp_role = (OMX_PARAM_COMPONENTROLETYPE *) paramData;
- comp_role->nVersion.nVersion = OMX_SPEC_VERSION;
- comp_role->nSize = sizeof(*comp_role);
-
- DEBUG_PRINT_LOW("Getparameter: OMX_IndexParamStandardComponentRole %d\n",
- paramIndex);
- strncpy((char*)comp_role->cRole,(const char*)m_cRole,
- OMX_MAX_STRINGNAME_SIZE);
- break;
- }
- /* Added for parameter test */
- case OMX_IndexParamPriorityMgmt:
- {
-
- OMX_PRIORITYMGMTTYPE *priorityMgmType =
- (OMX_PRIORITYMGMTTYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPriorityMgmt\n");
- priorityMgmType->nVersion.nVersion = OMX_SPEC_VERSION;
- priorityMgmType->nSize = sizeof(priorityMgmType);
-
- break;
- }
- /* Added for parameter test */
- case OMX_IndexParamCompBufferSupplier:
- {
- OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplierType =
- (OMX_PARAM_BUFFERSUPPLIERTYPE*) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamCompBufferSupplier\n");
-
- bufferSupplierType->nSize = sizeof(bufferSupplierType);
- bufferSupplierType->nVersion.nVersion = OMX_SPEC_VERSION;
- if(0 == bufferSupplierType->nPortIndex)
- bufferSupplierType->nPortIndex = OMX_BufferSupplyUnspecified;
- else if (1 == bufferSupplierType->nPortIndex)
- bufferSupplierType->nPortIndex = OMX_BufferSupplyUnspecified;
- else
- eRet = OMX_ErrorBadPortIndex;
-
-
- break;
- }
- case OMX_IndexParamVideoAvc:
- {
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoAvc %08x\n",
- paramIndex);
- break;
- }
- case OMX_IndexParamVideoH263:
- {
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoH263 %08x\n",
- paramIndex);
- break;
- }
- case OMX_IndexParamVideoMpeg4:
- {
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoMpeg4 %08x\n",
- paramIndex);
- break;
- }
- default:
- {
- DEBUG_PRINT_ERROR("get_parameter: unknown param %08x\n", paramIndex);
- eRet =OMX_ErrorUnsupportedIndex;
- }
-
- }
-
- DEBUG_PRINT_LOW("\n get_parameter returning Height %d , Width %d \n",
- m_height, m_width);
- return eRet;
-
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::Setparameter
-
-DESCRIPTION
- OMX Set Parameter method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_IN OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned int alignment = 0,buffer_size = 0;
- int i;
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Set Param in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(paramData == NULL)
- {
- DEBUG_PRINT_ERROR("Get Param in Invalid paramData \n");
- return OMX_ErrorBadParameter;
- }
- switch(paramIndex)
- {
- case OMX_IndexParamPortDefinition:
- {
- OMX_PARAM_PORTDEFINITIONTYPE *portDefn;
- portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
-
- /*set_parameter can be called in loaded state
- or disabled port */
-
- /* When the component is in Loaded state and IDLE Pending*/
- if(((m_state == OMX_StateLoaded)&&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- /* Or while the I/P or the O/P port or disabled */
- ||((OMX_DirInput == portDefn->eDir && m_inp_bEnabled == OMX_FALSE)||
- (OMX_DirOutput == portDefn->eDir && m_out_bEnabled == OMX_FALSE)))
- {
- DEBUG_PRINT_LOW("Set Parameter called in valid state");
- }
- else
- {
- DEBUG_PRINT_ERROR("Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPortDefinition H= %d, W = %d\n",
- (int)portDefn->format.video.nFrameHeight,
- (int)portDefn->format.video.nFrameWidth);
-
- eRet = omx_vdec_validate_port_param(portDefn->format.video.nFrameHeight,
- portDefn->format.video.nFrameWidth);
- if(eRet != OMX_ErrorNone)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- if(OMX_DirOutput == portDefn->eDir)
- {
- if ( portDefn->nBufferCountActual < m_out_buf_count_min ||
- portDefn->nBufferSize != m_out_buf_size
- )
- {
- return OMX_ErrorBadParameter;
- }
- driver_context.output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.output_buffer;
-
- if (ioctl (driver_context.video_driver_fd,
- VDEC_IOCTL_GET_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Request output buffer requirements failed");
- return OMX_ErrorUnsupportedSetting;
- }
- driver_context.output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- driver_context.output_buffer.actualcount =
- portDefn->nBufferCountActual;
- ioctl_msg.inputparam = &driver_context.output_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,
- VDEC_IOCTL_SET_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Request output buffer requirements failed");
- return OMX_ErrorUnsupportedSetting;
- }
- m_out_buf_count = portDefn->nBufferCountActual;
- m_out_buf_count_recon = m_out_buf_count;
- DEBUG_PRINT_LOW("set_parameter:OMX_IndexParamPortDefinition output port\n");
- }
- else if(OMX_DirInput == portDefn->eDir)
- {
- if(m_height != portDefn->format.video.nFrameHeight ||
- m_width != portDefn->format.video.nFrameWidth)
- {
- DEBUG_PRINT_LOW("set_parameter ip port: stride %d\n",
- (int)portDefn->format.video.nStride);
- // set the HxW only if non-zero
- if((portDefn->format.video.nFrameHeight != 0x0)
- && (portDefn->format.video.nFrameWidth != 0x0))
- {
- m_crop_x = m_crop_y = 0;
- m_crop_dy = m_port_height = m_height =
- portDefn->format.video.nFrameHeight;
- m_crop_dx = m_port_width = m_width =
- portDefn->format.video.nFrameWidth;
- scan_lines = portDefn->format.video.nSliceHeight;
- stride = portDefn->format.video.nStride;
- DEBUG_PRINT_LOW("\n SetParam with new H %d and W %d\n",
- m_height, m_width );
- driver_context.video_resoultion.frame_height = m_height;
- driver_context.video_resoultion.frame_width = m_width;
- driver_context.video_resoultion.stride = stride;
- driver_context.video_resoultion.scan_lines = scan_lines;
- ioctl_msg.inputparam = &driver_context.video_resoultion;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_PICRES,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set Resolution failed");
- return OMX_ErrorUnsupportedSetting;
- }
- driver_context.output_buffer.buffer_type =
- VDEC_BUFFER_TYPE_OUTPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.output_buffer;
-
- if (ioctl (driver_context.video_driver_fd,
- VDEC_IOCTL_GET_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Request output buffer requirements failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- m_out_buf_count_recon = m_out_buf_count = driver_context.output_buffer.actualcount;
- m_out_buf_count_min_recon = m_out_buf_count_min = driver_context.output_buffer.mincount;
-
- alignment = driver_context.output_buffer.alignment;
- buffer_size = driver_context.output_buffer.buffer_size;
- m_out_buf_size_recon = m_out_buf_size =
- ((buffer_size + alignment - 1) & (~(alignment - 1)));
- }
- }
- else
- {
- /*
- If actual buffer count is greater than the Min buffer
- count,change the actual count.
- m_inp_buf_count is initialized to OMX_CORE_NUM_INPUT_BUFFERS
- in the constructor
- */
- if ( portDefn->nBufferCountActual < m_inp_buf_count_min ||
- portDefn->nBufferSize != m_inp_buf_size
- )
- {
- return OMX_ErrorBadParameter;
- }
- /*Get the Buffer requirements for input and output ports*/
- driver_context.input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.input_buffer;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Request input buffer requirements failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- driver_context.input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- driver_context.input_buffer.actualcount =
- portDefn->nBufferCountActual;
- ioctl_msg.inputparam = &driver_context.input_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Request input buffer requirements failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- m_inp_buf_count = portDefn->nBufferCountActual;
- DEBUG_PRINT_LOW("\n set_parameter: Image Dimensions same \n");
- }
-
- }
- else if (portDefn->eDir == OMX_DirMax)
- {
- DEBUG_PRINT_ERROR(" Set_parameter: Bad Port idx %d",
- (int)portDefn->nPortIndex);
- eRet = OMX_ErrorBadPortIndex;
- }
- }
- break;
-
-
- case OMX_IndexParamVideoPortFormat:
- {
- OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt =
- (OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoPortFormat %d\n",
- portFmt->eColorFormat);
-
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoPortFormat %d\n",
- portFmt->eColorFormat);
- if(1 == portFmt->nPortIndex)
- {
-
- m_color_format = portFmt->eColorFormat;
- }
- }
- break;
-
- case OMX_QcomIndexPortDefn:
- {
- OMX_QCOM_PARAM_PORTDEFINITIONTYPE *portFmt =
- (OMX_QCOM_PARAM_PORTDEFINITIONTYPE *) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexQcomParamPortDefinitionType %d\n",
- portFmt->nFramePackingFormat);
-
- /* Input port */
- if (portFmt->nPortIndex == 0)
- {
- if (portFmt->nFramePackingFormat == OMX_QCOM_FramePacking_Arbitrary)
- {
- arbitrary_bytes = true;
- }
- else if (portFmt->nFramePackingFormat ==
- OMX_QCOM_FramePacking_OnlyOneCompleteFrame)
- {
- arbitrary_bytes = false;
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown FramePacking format %d\n",
- portFmt->nFramePackingFormat);
- eRet = OMX_ErrorUnsupportedSetting;
- }
- }
- }
- break;
-
- case OMX_IndexParamStandardComponentRole:
- {
- OMX_PARAM_COMPONENTROLETYPE *comp_role;
- comp_role = (OMX_PARAM_COMPONENTROLETYPE *) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamStandardComponentRole %s\n",
- comp_role->cRole);
-
- if((m_state == OMX_StateLoaded)&&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- DEBUG_PRINT_LOW("Set Parameter called in valid state");
- }
- else
- {
- DEBUG_PRINT_ERROR("Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((char*)comp_role->cRole,"video_decoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_decoder.avc",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet =OMX_ErrorUnsupportedSetting;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((const char*)comp_role->cRole,"video_decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet = OMX_ErrorUnsupportedSetting;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((const char*)comp_role->cRole,"video_decoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_decoder.h263",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet =OMX_ErrorUnsupportedSetting;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.vc1",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((const char*)comp_role->cRole,"video_decoder.vc1",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_decoder.vc1",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet =OMX_ErrorUnsupportedSetting;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown param %s\n", driver_context.kind);
- eRet = OMX_ErrorInvalidComponentName;
- }
- break;
- }
-
- case OMX_IndexParamPriorityMgmt:
- {
- if(m_state != OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
- OMX_PRIORITYMGMTTYPE *priorityMgmtype = (OMX_PRIORITYMGMTTYPE*) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPriorityMgmt %d\n",
- priorityMgmtype->nGroupID);
-
- DEBUG_PRINT_LOW("set_parameter: priorityMgmtype %d\n",
- priorityMgmtype->nGroupPriority);
-
- m_priority_mgm.nGroupID = priorityMgmtype->nGroupID;
- m_priority_mgm.nGroupPriority = priorityMgmtype->nGroupPriority;
-
- break;
- }
-
- case OMX_IndexParamCompBufferSupplier:
- {
- OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplierType = (OMX_PARAM_BUFFERSUPPLIERTYPE*) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamCompBufferSupplier %d\n",
- bufferSupplierType->eBufferSupplier);
- if(bufferSupplierType->nPortIndex == 0 || bufferSupplierType->nPortIndex ==1)
- m_buffer_supplier.eBufferSupplier = bufferSupplierType->eBufferSupplier;
-
- else
-
- eRet = OMX_ErrorBadPortIndex;
-
- break;
-
- }
- case OMX_IndexParamVideoAvc:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoAvc %d\n",
- paramIndex);
- break;
- }
- case OMX_IndexParamVideoH263:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoH263 %d\n",
- paramIndex);
- break;
- }
- case OMX_IndexParamVideoMpeg4:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoMpeg4 %d\n",
- paramIndex);
- break;
- }
-
- default:
- {
- DEBUG_PRINT_ERROR("Setparameter: unknown param %d\n", paramIndex);
- eRet = OMX_ErrorUnsupportedIndex;
- }
- }
-
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::GetConfig
-
-DESCRIPTION
- OMX Get Config Method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::get_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_INOUT OMX_PTR configData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
- if (m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Get Config in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- switch (configIndex)
- {
- case OMX_QcomIndexConfigInterlaced:
- {
- OMX_QCOM_CONFIG_INTERLACETYPE *configFmt =
- (OMX_QCOM_CONFIG_INTERLACETYPE *) configData;
- if (configFmt->nPortIndex == 1)
- {
- if (configFmt->nIndex == 0)
- {
- configFmt->eInterlaceType = OMX_QCOM_InterlaceFrameProgressive;
- }
- else if (configFmt->nIndex == 1)
- {
- configFmt->eInterlaceType =
- OMX_QCOM_InterlaceInterleaveFrameTopFieldFirst;
- }
- else if (configFmt->nIndex == 2)
- {
- configFmt->eInterlaceType =
- OMX_QCOM_InterlaceInterleaveFrameBottomFieldFirst;
- }
- else
- {
- DEBUG_PRINT_ERROR("get_config: OMX_QcomIndexConfigInterlaced:"
- " NoMore Interlaced formats\n");
- eRet = OMX_ErrorNoMore;
- }
-
- }
- else
- {
- DEBUG_PRINT_ERROR("get_config: Bad port index %d queried on only o/p port\n",
- (int)configFmt->nPortIndex);
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
- case OMX_QcomIndexQueryNumberOfVideoDecInstance:
- {
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- QOMX_VIDEO_QUERY_DECODER_INSTANCES *decoderinstances =
- (QOMX_VIDEO_QUERY_DECODER_INSTANCES*)configData;
- ioctl_msg.outputparam = (void*)&decoderinstances->nNumOfInstances;
- (void)(ioctl(driver_context.video_driver_fd,
- VDEC_IOCTL_GET_NUMBER_INSTANCES,&ioctl_msg));
- break;
- }
- default:
- {
- DEBUG_PRINT_ERROR("get_config: unknown param %d\n",configIndex);
- eRet = OMX_ErrorBadParameter;
- }
-
- }
-
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::SetConfig
-
-DESCRIPTION
- OMX Set Config method implementation
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::set_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_IN OMX_PTR configData)
-{
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Get Config in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- OMX_VIDEO_CONFIG_NALSIZE *pNal;
-
- DEBUG_PRINT_LOW("\n Set Config Called");
-
- if (m_state == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("set_config:Ignore in Exe state\n");
- return ret;
- }
-
- if (configIndex == OMX_IndexVendorVideoExtraData)
- {
- OMX_VENDOR_EXTRADATATYPE *config = (OMX_VENDOR_EXTRADATATYPE *) configData;
- DEBUG_PRINT_LOW("\n Index OMX_IndexVendorVideoExtraData called");
- if (!strcmp(driver_context.kind, "OMX.qcom.video.decoder.avc"))
- {
- DEBUG_PRINT_LOW("\n Index OMX_IndexVendorVideoExtraData AVC");
- OMX_U32 extra_size;
- // Parsing done here for the AVC atom is definitely not generic
- // Currently this piece of code is working, but certainly
- // not tested with all .mp4 files.
- // Incase of failure, we might need to revisit this
- // for a generic piece of code.
-
- // Retrieve size of NAL length field
- // byte #4 contains the size of NAL lenght field
- nal_length = (config->pData[4] & 0x03) + 1;
-
- extra_size = 0;
- if (nal_length > 2)
- {
- /* Presently we assume that only one SPS and one PPS in AvC1 Atom */
- extra_size = (nal_length - 2) * 2;
- }
-
- // SPS starts from byte #6
- OMX_U8 *pSrcBuf = (OMX_U8 *) (&config->pData[6]);
- OMX_U8 *pDestBuf;
- m_vendor_config.nPortIndex = config->nPortIndex;
-
- // minus 6 --> SPS starts from byte #6
- // minus 1 --> picture param set byte to be ignored from avcatom
- m_vendor_config.nDataSize = config->nDataSize - 6 - 1 + extra_size;
- m_vendor_config.pData = (OMX_U8 *) malloc(m_vendor_config.nDataSize);
- OMX_U32 len;
- OMX_U8 index = 0;
- // case where SPS+PPS is sent as part of set_config
- pDestBuf = m_vendor_config.pData;
-
- DEBUG_PRINT_LOW("Rxd SPS+PPS nPortIndex[%d] len[%d] data[0x%x]\n",
- m_vendor_config.nPortIndex,
- m_vendor_config.nDataSize,
- m_vendor_config.pData);
- while (index < 2)
- {
- uint8 *psize;
- len = *pSrcBuf;
- len = len << 8;
- len |= *(pSrcBuf + 1);
- psize = (uint8 *) & len;
- memcpy(pDestBuf + nal_length, pSrcBuf + 2,len);
- for (int i = 0; i < nal_length; i++)
- {
- pDestBuf[i] = psize[nal_length - 1 - i];
- }
- //memcpy(pDestBuf,pSrcBuf,(len+2));
- pDestBuf += len + nal_length;
- pSrcBuf += len + 2;
- index++;
- pSrcBuf++; // skip picture param set
- len = 0;
- }
- }
- else if (!strcmp(driver_context.kind, "OMX.qcom.video.decoder.mpeg4"))
- {
- m_vendor_config.nPortIndex = config->nPortIndex;
- m_vendor_config.nDataSize = config->nDataSize;
- m_vendor_config.pData = (OMX_U8 *) malloc((config->nDataSize));
- memcpy(m_vendor_config.pData, config->pData,config->nDataSize);
- }
- else if (!strcmp(driver_context.kind, "OMX.qcom.video.decoder.vc1"))
- {
- if(m_vendor_config.pData)
- {
- free(m_vendor_config.pData);
- m_vendor_config.pData = NULL;
- m_vendor_config.nDataSize = 0;
- }
-
- if (((*((OMX_U32 *) config->pData)) &
- VC1_SP_MP_START_CODE_MASK) ==
- VC1_SP_MP_START_CODE)
- {
- DEBUG_PRINT_LOW("set_config - VC1 simple/main profile\n");
- m_vendor_config.nPortIndex = config->nPortIndex;
- m_vendor_config.nDataSize = config->nDataSize;
- m_vendor_config.pData =
- (OMX_U8 *) malloc(config->nDataSize);
- memcpy(m_vendor_config.pData, config->pData,
- config->nDataSize);
- m_vc1_profile = VC1_SP_MP_RCV;
- }
- else if (*((OMX_U32 *) config->pData) == VC1_AP_SEQ_START_CODE)
- {
- DEBUG_PRINT_LOW("set_config - VC1 Advance profile\n");
- m_vendor_config.nPortIndex = config->nPortIndex;
- m_vendor_config.nDataSize = config->nDataSize;
- m_vendor_config.pData =
- (OMX_U8 *) malloc((config->nDataSize));
- memcpy(m_vendor_config.pData, config->pData,
- config->nDataSize);
- m_vc1_profile = VC1_AP;
- }
- else if ((config->nDataSize == VC1_STRUCT_C_LEN))
- {
- DEBUG_PRINT_LOW("set_config - VC1 Simple/Main profile struct C only\n");
- m_vendor_config.nPortIndex = config->nPortIndex;
- m_vendor_config.nDataSize = config->nDataSize;
- m_vendor_config.pData = (OMX_U8*)malloc(config->nDataSize);
- memcpy(m_vendor_config.pData,config->pData,config->nDataSize);
- m_vc1_profile = VC1_SP_MP_RCV;
- }
- else
- {
- DEBUG_PRINT_LOW("set_config - Error: Unknown VC1 profile\n");
- }
- }
- return ret;
- }
- else if (configIndex == OMX_IndexConfigVideoNalSize)
- {
-
- pNal = reinterpret_cast < OMX_VIDEO_CONFIG_NALSIZE * >(configData);
- nal_length = pNal->nNaluBytes;
- m_frame_parser.init_nal_length(nal_length);
- DEBUG_PRINT_LOW("\n Nal Length option called with Size %d",nal_length);
- return ret;
- }
-
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::GetExtensionIndex
-
-DESCRIPTION
- OMX GetExtensionIndex method implementaion. <TBD>
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_STRING paramName,
- OMX_OUT OMX_INDEXTYPE* indexType)
-{
- DEBUG_PRINT_ERROR("get_extension_index: Error, Not implemented\n");
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Get Extension Index in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::GetState
-
-DESCRIPTION
- Returns the state information back to the caller.<TBD>
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Error None if everything is successful.
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::get_state(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STATETYPE* state)
-{
- *state = m_state;
- DEBUG_PRINT_LOW("get_state: Returning the state %d\n",*state);
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ComponentTunnelRequest
-
-DESCRIPTION
- OMX Component Tunnel Request method implementation. <TBD>
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::component_tunnel_request(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_HANDLETYPE peerComponent,
- OMX_IN OMX_U32 peerPort,
- OMX_INOUT OMX_TUNNELSETUPTYPE* tunnelSetup)
-{
- DEBUG_PRINT_ERROR("Error: component_tunnel_request Not Implemented\n");
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::UseInputBuffer
-
-DESCRIPTION
- Helper function for Use buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::use_input_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- struct vdec_setbuffer_cmd setbuffers;
- OMX_BUFFERHEADERTYPE *input = NULL;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned i = 0;
- unsigned char *buf_addr = NULL;
- int pmem_fd = -1;
-
- if(bytes != m_inp_buf_size)
- {
- return OMX_ErrorBadParameter;
- }
-
- if(!m_inp_mem_ptr)
- {
- DEBUG_PRINT_HIGH("\n Use i/p buffer case - Header List allocation");
- input_use_buffer = true;
- m_inp_mem_ptr = (OMX_BUFFERHEADERTYPE*) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE)), m_inp_buf_count);
-
- if (m_inp_mem_ptr == NULL)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- driver_context.ptr_inputbuffer = (struct vdec_bufferpayload *) \
- calloc ((sizeof (struct vdec_bufferpayload)),m_inp_buf_count);
-
- if (driver_context.ptr_inputbuffer == NULL)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- for (i=0; i < m_inp_buf_count; i++)
- {
- driver_context.ptr_inputbuffer [i].pmem_fd = -1;
- }
- }
-
- for(i=0; i< m_inp_buf_count; i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- break;
- }
- }
-
- if(i < m_inp_buf_count)
- {
- pmem_fd = open ("/dev/pmem_adsp",O_RDWR | O_SYNC);
-
- if (pmem_fd < 0)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- if(pmem_fd == 0)
- {
- pmem_fd = open ("/dev/pmem_adsp",O_RDWR | O_SYNC);
- if (pmem_fd < 0)
- {
- return OMX_ErrorInsufficientResources;
- }
- }
-
- if(!align_pmem_buffers(pmem_fd, m_inp_buf_size,
- driver_context.input_buffer.alignment))
- {
- DEBUG_PRINT_ERROR("\n align_pmem_buffers() failed");
- close(pmem_fd);
- return OMX_ErrorInsufficientResources;
- }
-
- buf_addr = (unsigned char *)mmap(NULL,m_inp_buf_size,PROT_READ|PROT_WRITE,
- MAP_SHARED,pmem_fd,0);
-
- if (buf_addr == MAP_FAILED)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- driver_context.ptr_inputbuffer [i].bufferaddr = buf_addr;
- driver_context.ptr_inputbuffer [i].pmem_fd = pmem_fd;
- driver_context.ptr_inputbuffer [i].mmaped_size = m_inp_buf_size;
- driver_context.ptr_inputbuffer [i].offset = 0;
-
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_inputbuffer [i],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER,
- &ioctl_msg) < 0)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- *bufferHdr = (m_inp_mem_ptr + i);
- input = *bufferHdr;
- BITMASK_SET(&m_inp_bm_count,i);
-
- input->pBuffer = (OMX_U8 *)buffer;
- input->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- input->nVersion.nVersion = OMX_SPEC_VERSION;
- input->nAllocLen = m_inp_buf_size;
- input->pAppPrivate = appData;
- input->nInputPortIndex = OMX_CORE_INPUT_PORT_INDEX;
- input->pInputPortPrivate = (void *)&driver_context.ptr_inputbuffer [i];
- }
- else
- {
- eRet = OMX_ErrorInsufficientResources;
- }
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::UseOutputBuffer
-
-DESCRIPTION
- Helper function for Use buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::use_output_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_BUFFERHEADERTYPE *bufHdr= NULL; // buffer header
- unsigned i= 0; // Temporary counter
-
- if(!m_out_mem_ptr)
- {
- DEBUG_PRINT_HIGH("\n Use o/p buffer case - Header List allocation");
- output_use_buffer = true;
- int nBufHdrSize = 0;
- int nPlatformEntrySize = 0;
- int nPlatformListSize = 0;
- int nPMEMInfoSize = 0;
- OMX_QCOM_PLATFORM_PRIVATE_LIST *pPlatformList;
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY *pPlatformEntry;
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pPMEMInfo;
-
- DEBUG_PRINT_LOW("Allocating First Output Buffer(%d)\n",m_out_buf_count);
- nBufHdrSize = m_out_buf_count * sizeof(OMX_BUFFERHEADERTYPE);
-
- nPMEMInfoSize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO);
- nPlatformListSize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_LIST);
- nPlatformEntrySize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_ENTRY);
-
- DEBUG_PRINT_LOW("TotalBufHdr %d BufHdrSize %d PMEM %d PL %d\n",nBufHdrSize,
- sizeof(OMX_BUFFERHEADERTYPE),
- nPMEMInfoSize,
- nPlatformListSize);
- DEBUG_PRINT_LOW("PE %d bmSize %d \n",nPlatformEntrySize,
- m_out_bm_count);
-
- /*
- * Memory for output side involves the following:
- * 1. Array of Buffer Headers
- * 2. Platform specific information List
- * 3. Platform specific Entry List
- * 4. PMem Information entries
- * 5. Bitmask array to hold the buffer allocation details
- * In order to minimize the memory management entire allocation
- * is done in one step.
- */
- m_out_mem_ptr = (OMX_BUFFERHEADERTYPE *)calloc(nBufHdrSize,1);
- // Alloc mem for platform specific info
- char *pPtr=NULL;
- pPtr = (char*) calloc(nPlatformListSize + nPlatformEntrySize +
- nPMEMInfoSize,1);
- driver_context.ptr_outputbuffer = (struct vdec_bufferpayload *) \
- calloc (sizeof(struct vdec_bufferpayload),m_out_buf_count);
- driver_context.ptr_respbuffer = (struct vdec_output_frameinfo *)\
- calloc (sizeof (struct vdec_output_frameinfo),m_out_buf_count);
-
- if(m_out_mem_ptr && pPtr && driver_context.ptr_outputbuffer
- && driver_context.ptr_respbuffer)
- {
- bufHdr = m_out_mem_ptr;
- m_platform_list = (OMX_QCOM_PLATFORM_PRIVATE_LIST *)(pPtr);
- m_platform_entry= (OMX_QCOM_PLATFORM_PRIVATE_ENTRY *)
- (((char *) m_platform_list) + nPlatformListSize);
- m_pmem_info = (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *)
- (((char *) m_platform_entry) + nPlatformEntrySize);
- pPlatformList = m_platform_list;
- pPlatformEntry = m_platform_entry;
- pPMEMInfo = m_pmem_info;
-
- DEBUG_PRINT_LOW("Memory Allocation Succeeded for OUT port%p\n",m_out_mem_ptr);
-
- // Settting the entire storage nicely
- DEBUG_PRINT_LOW("bHdr %p OutMem %p PE %p\n",bufHdr, m_out_mem_ptr,pPlatformEntry);
- DEBUG_PRINT_LOW(" Pmem Info = %p \n",pPMEMInfo);
- for(i=0; i < m_out_buf_count ; i++)
- {
- bufHdr->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
- // Set the values when we determine the right HxW param
- bufHdr->nAllocLen = bytes;
- bufHdr->nFilledLen = 0;
- bufHdr->pAppPrivate = appData;
- bufHdr->nOutputPortIndex = OMX_CORE_OUTPUT_PORT_INDEX;
- // Platform specific PMEM Information
- // Initialize the Platform Entry
- //DEBUG_PRINT_LOW("Initializing the Platform Entry for %d\n",i);
- pPlatformEntry->type = OMX_QCOM_PLATFORM_PRIVATE_PMEM;
- pPlatformEntry->entry = pPMEMInfo;
- // Initialize the Platform List
- pPlatformList->nEntries = 1;
- pPlatformList->entryList = pPlatformEntry;
- // Keep pBuffer NULL till vdec is opened
- bufHdr->pBuffer = NULL;
-
- pPMEMInfo->offset = 0;
- pPMEMInfo->pmem_fd = 0;
- bufHdr->pPlatformPrivate = pPlatformList;
-
- driver_context.ptr_outputbuffer[i].pmem_fd = -1;
-
- /*Create a mapping between buffers*/
- bufHdr->pOutputPortPrivate = &driver_context.ptr_respbuffer[i];
- driver_context.ptr_respbuffer[i].client_data = (void *) \
- &driver_context.ptr_outputbuffer[i];
- // Move the buffer and buffer header pointers
- bufHdr++;
- pPMEMInfo++;
- pPlatformEntry++;
- pPlatformList++;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("Output buf mem alloc failed[0x%x][0x%x]\n",\
- m_out_mem_ptr, pPtr);
- if(m_out_mem_ptr)
- {
- free(m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
- if(pPtr)
- {
- free(pPtr);
- pPtr = NULL;
- }
- if(driver_context.ptr_outputbuffer)
- {
- free(driver_context.ptr_outputbuffer);
- driver_context.ptr_outputbuffer = NULL;
- }
- if(driver_context.ptr_respbuffer)
- {
- free(driver_context.ptr_respbuffer);
- driver_context.ptr_respbuffer = NULL;
- }
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- for(i=0; i< m_out_buf_count; i++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,i))
- {
- break;
- }
- }
-
- if (eRet == OMX_ErrorNone)
- {
- if(i < m_out_buf_count)
- {
- driver_context.ptr_outputbuffer[i].pmem_fd = \
- open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (driver_context.ptr_outputbuffer[i].pmem_fd < 0)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- if(driver_context.ptr_outputbuffer[i].pmem_fd == 0)
- {
- driver_context.ptr_outputbuffer[i].pmem_fd = \
- open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (driver_context.ptr_outputbuffer[i].pmem_fd < 0)
- {
- return OMX_ErrorInsufficientResources;
- }
- }
-
- if(!align_pmem_buffers(driver_context.ptr_outputbuffer[i].pmem_fd,
- m_out_buf_size, driver_context.output_buffer.alignment))
- {
- DEBUG_PRINT_ERROR("\n align_pmem_buffers() failed");
- close(driver_context.ptr_outputbuffer[i].pmem_fd);
- return OMX_ErrorInsufficientResources;
- }
-
- driver_context.ptr_outputbuffer[i].bufferaddr =
- (unsigned char *)mmap(NULL,m_out_buf_size,PROT_READ|PROT_WRITE,
- MAP_SHARED,driver_context.ptr_outputbuffer[i].pmem_fd,0);
-
- if (driver_context.ptr_outputbuffer[i].bufferaddr == MAP_FAILED)
- {
- return OMX_ErrorInsufficientResources;
- }
- driver_context.ptr_outputbuffer[i].offset = 0;
- m_pmem_info[i].offset = driver_context.ptr_outputbuffer[i].offset;
- m_pmem_info[i].pmem_fd = driver_context.ptr_outputbuffer[i].pmem_fd;
-
- // found an empty buffer at i
- *bufferHdr = (m_out_mem_ptr + i );
- (*bufferHdr)->pBuffer = buffer;
- (*bufferHdr)->pAppPrivate = appData;
- BITMASK_SET(&m_out_bm_count,i);
- }
- else
- {
- DEBUG_PRINT_ERROR("All the Output Buffers have been Allocated ; Returning Insufficient \n");
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::UseBuffer
-
-DESCRIPTION
- OMX Use Buffer method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None , if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::use_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Use Buffer in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(port == OMX_CORE_INPUT_PORT_INDEX)
- {
- eRet = use_input_buffer(hComp,bufferHdr,port,appData,bytes,buffer);
- }
- else if(port == OMX_CORE_OUTPUT_PORT_INDEX)
- {
- eRet = use_output_buffer(hComp,bufferHdr,port,appData,bytes,buffer);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Invalid Port Index received %d\n",(int)port);
- eRet = OMX_ErrorBadPortIndex;
- }
- DEBUG_PRINT_LOW("Use Buffer: port %u, buffer %p, eRet %d", port, *bufferHdr, eRet);
-
- if(eRet == OMX_ErrorNone)
- {
- if(allocate_done())
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_IDLE_PENDING);
- post_event(OMX_CommandStateSet,OMX_StateIdle,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == OMX_CORE_INPUT_PORT_INDEX && m_inp_bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_INPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- OMX_CORE_INPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
-
- }
- else if(port == OMX_CORE_OUTPUT_PORT_INDEX && m_out_bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- OMX_CORE_OUTPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- m_event_port_settings_sent = false;
- }
- }
- }
- return eRet;
-}
-
-OMX_ERRORTYPE omx_vdec::free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr)
-{
- unsigned int index = 0;
-
- if (bufferHdr == NULL || m_inp_mem_ptr == NULL)
- {
- return OMX_ErrorBadParameter;
- }
-
- index = bufferHdr - m_inp_mem_ptr;
- DEBUG_PRINT_LOW("\n Free Input Buffer index = %d",index);
-
- if (index < m_inp_buf_count && driver_context.ptr_inputbuffer)
- {
- DEBUG_PRINT_LOW("\n Free Input Buffer index = %d",index);
- if (driver_context.ptr_inputbuffer[index].pmem_fd > 0)
- {
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_setbuffer_cmd setbuffers;
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_inputbuffer[index],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
- int ioctl_r = ioctl (driver_context.video_driver_fd,
- VDEC_IOCTL_FREE_BUFFER, &ioctl_msg);
- if (ioctl_r < 0)
- {
- DEBUG_PRINT_ERROR("\nVDEC_IOCTL_FREE_BUFFER returned error %d", ioctl_r);
- }
-
- DEBUG_PRINT_LOW("\n unmap the input buffer fd=%d",
- driver_context.ptr_inputbuffer[index].pmem_fd);
- DEBUG_PRINT_LOW("\n unmap the input buffer size=%d address = %d",
- driver_context.ptr_inputbuffer[index].mmaped_size,
- driver_context.ptr_inputbuffer[index].bufferaddr);
- munmap (driver_context.ptr_inputbuffer[index].bufferaddr,
- driver_context.ptr_inputbuffer[index].mmaped_size);
- close (driver_context.ptr_inputbuffer[index].pmem_fd);
- driver_context.ptr_inputbuffer[index].pmem_fd = -1;
- }
- }
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_vdec::free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr)
-{
- unsigned int index = 0;
-
- if (bufferHdr == NULL || m_out_mem_ptr == NULL)
- {
- return OMX_ErrorBadParameter;
- }
-
- index = bufferHdr - m_out_mem_ptr;
- DEBUG_PRINT_LOW("\n Free ouput Buffer index = %d",index);
-
- if (index < m_out_buf_count && driver_context.ptr_outputbuffer)
- {
- DEBUG_PRINT_LOW("\n Free ouput Buffer index = %d addr = %x", index,
- driver_context.ptr_outputbuffer[index].bufferaddr);
-
- if (!gate_output_buffers)
- {
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_setbuffer_cmd setbuffers;
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_outputbuffer[index],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
- DEBUG_PRINT_LOW("\nRelease the Output Buffer");
- if (ioctl (driver_context.video_driver_fd, VDEC_IOCTL_FREE_BUFFER,
- &ioctl_msg) < 0)
- DEBUG_PRINT_ERROR("\nRelease output buffer failed in VCD");
- }
-
- if (driver_context.ptr_outputbuffer[0].pmem_fd > 0)
- {
- DEBUG_PRINT_LOW("\n unmap the output buffer fd = %d",
- driver_context.ptr_outputbuffer[0].pmem_fd);
- DEBUG_PRINT_LOW("\n unmap the ouput buffer size=%d address = %d",
- driver_context.ptr_outputbuffer[0].mmaped_size,
- driver_context.ptr_outputbuffer[0].bufferaddr);
- munmap (driver_context.ptr_outputbuffer[0].bufferaddr,
- driver_context.ptr_outputbuffer[0].mmaped_size);
- close (driver_context.ptr_outputbuffer[0].pmem_fd);
- driver_context.ptr_outputbuffer[0].pmem_fd = -1;
- }
- }
-
- return OMX_ErrorNone;
-
-}
-
-OMX_ERRORTYPE omx_vdec::allocate_input_heap_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes)
-{
- OMX_BUFFERHEADERTYPE *input = NULL;
- unsigned char *buf_addr = NULL;
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned i = 0;
-
- /* Sanity Check*/
- if (bufferHdr == NULL)
- {
- return OMX_ErrorBadParameter;
- }
-
- if (m_inp_heap_ptr == NULL)
- {
- m_inp_heap_ptr = (OMX_BUFFERHEADERTYPE*) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE)), m_inp_buf_count);
- m_phdr_pmem_ptr = (OMX_BUFFERHEADERTYPE**) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE*)), m_inp_buf_count);
-
- if (m_inp_heap_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("\n m_inp_heap_ptr Allocation failed ");
- return OMX_ErrorInsufficientResources;
- }
-
- h264_scratch.nAllocLen = m_inp_buf_size;
- h264_scratch.pBuffer = (OMX_U8 *)malloc (m_inp_buf_size);
- h264_scratch.nFilledLen = 0;
- h264_scratch.nOffset = 0;
-
- if (h264_scratch.pBuffer == NULL)
- {
- DEBUG_PRINT_ERROR("\n h264_scratch.pBuffer Allocation failed ");
- return OMX_ErrorInsufficientResources;
- }
-
- if (m_frame_parser.mutils == NULL)
- {
- m_frame_parser.mutils = new H264_Utils();
-
- if (m_frame_parser.mutils == NULL)
- {
- DEBUG_PRINT_ERROR("\n parser utils Allocation failed ");
- return OMX_ErrorInsufficientResources;
- }
-
- m_frame_parser.mutils->initialize_frame_checking_environment();
- m_frame_parser.mutils->allocate_rbsp_buffer (m_inp_buf_size);
- }
- }
-
- /*Find a Free index*/
- for(i=0; i< m_inp_buf_count; i++)
- {
- if(BITMASK_ABSENT(&m_heap_inp_bm_count,i))
- {
- DEBUG_PRINT_LOW("\n Free Input Buffer Index %d",i);
- break;
- }
- }
-
- if (i < m_inp_buf_count)
- {
- buf_addr = (unsigned char *)malloc (m_inp_buf_size);
-
- if (buf_addr == NULL)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- *bufferHdr = (m_inp_heap_ptr + i);
- input = *bufferHdr;
- BITMASK_SET(&m_heap_inp_bm_count,i);
-
- input->pBuffer = (OMX_U8 *)buf_addr;
- input->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- input->nVersion.nVersion = OMX_SPEC_VERSION;
- input->nAllocLen = m_inp_buf_size;
- input->pAppPrivate = appData;
- input->nInputPortIndex = OMX_CORE_INPUT_PORT_INDEX;
- DEBUG_PRINT_LOW("\n Address of Heap Buffer %p",*bufferHdr );
- eRet = allocate_input_buffer(hComp,&m_phdr_pmem_ptr [i],port,appData,bytes);
- DEBUG_PRINT_LOW("\n Address of Pmem Buffer %p",m_phdr_pmem_ptr [i] );
- /*Add the Buffers to freeq*/
- if (!m_input_free_q.insert_entry((unsigned)m_phdr_pmem_ptr [i],NULL,NULL))
- {
- DEBUG_PRINT_ERROR("\nERROR:Free_q is full");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- return OMX_ErrorBadParameter;
- }
-
- return eRet;
-
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateInputBuffer
-
-DESCRIPTION
- Helper function for allocate buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::allocate_input_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- struct vdec_setbuffer_cmd setbuffers;
- OMX_BUFFERHEADERTYPE *input = NULL;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned i = 0;
- unsigned char *buf_addr = NULL;
- int pmem_fd = -1;
-
- if(bytes != m_inp_buf_size)
- {
- DEBUG_PRINT_LOW("\n Requested Size is wrong %d epected is %d",bytes,m_inp_buf_size);
- //return OMX_ErrorBadParameter;
- }
-
- if(!m_inp_mem_ptr)
- {
- DEBUG_PRINT_HIGH("\n Allocate i/p buffer case - Header List allocation");
- DEBUG_PRINT_LOW("\n Allocating input buffer count %d ",m_inp_buf_count);
- DEBUG_PRINT_LOW("\n Size of input buffer is %d",m_inp_buf_size);
-
- m_inp_mem_ptr = (OMX_BUFFERHEADERTYPE*) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE)), m_inp_buf_count);
-
- if (m_inp_mem_ptr == NULL)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- driver_context.ptr_inputbuffer = (struct vdec_bufferpayload *) \
- calloc ((sizeof (struct vdec_bufferpayload)),m_inp_buf_count);
-
- if (driver_context.ptr_inputbuffer == NULL)
- {
- return OMX_ErrorInsufficientResources;
- }
-
- for (i=0; i < m_inp_buf_count; i++)
- {
- driver_context.ptr_inputbuffer [i].pmem_fd = -1;
- }
- }
-
- for(i=0; i< m_inp_buf_count; i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- DEBUG_PRINT_LOW("\n Free Input Buffer Index %d",i);
- break;
- }
- }
-
- if(i < m_inp_buf_count)
- {
- DEBUG_PRINT_LOW("\n Allocate input Buffer");
- pmem_fd = open ("/dev/pmem_adsp", O_RDWR, O_SYNC);
-
- if (pmem_fd < 0)
- {
- DEBUG_PRINT_ERROR("\n open failed for pmem/adsp for input buffer");
- return OMX_ErrorInsufficientResources;
- }
-
- if (pmem_fd == 0)
- {
- pmem_fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (pmem_fd < 0)
- {
- DEBUG_PRINT_ERROR("\n open failed for pmem/adsp for input buffer");
- return OMX_ErrorInsufficientResources;
- }
- }
-
- if(!align_pmem_buffers(pmem_fd, m_inp_buf_size,
- driver_context.input_buffer.alignment))
- {
- DEBUG_PRINT_ERROR("\n align_pmem_buffers() failed");
- close(pmem_fd);
- return OMX_ErrorInsufficientResources;
- }
-
- buf_addr = (unsigned char *)mmap(NULL,m_inp_buf_size,PROT_READ|PROT_WRITE,
- MAP_SHARED,pmem_fd,0);
-
- if (buf_addr == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\n Map Failed to allocate input buffer");
- return OMX_ErrorInsufficientResources;
- }
-
- driver_context.ptr_inputbuffer [i].bufferaddr = buf_addr;
- driver_context.ptr_inputbuffer [i].pmem_fd = pmem_fd;
- driver_context.ptr_inputbuffer [i].buffer_len = m_inp_buf_size;
- driver_context.ptr_inputbuffer [i].mmaped_size = m_inp_buf_size;
- driver_context.ptr_inputbuffer [i].offset = 0;
-
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_inputbuffer [i],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set Buffers Failed");
- return OMX_ErrorInsufficientResources;
- }
-
- *bufferHdr = (m_inp_mem_ptr + i);
- input = *bufferHdr;
- BITMASK_SET(&m_inp_bm_count,i);
- DEBUG_PRINT_LOW("\n Buffer address %p of pmem",*bufferHdr);
-
- input->pBuffer = (OMX_U8 *)buf_addr;
- input->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- input->nVersion.nVersion = OMX_SPEC_VERSION;
- input->nAllocLen = m_inp_buf_size;
- input->pAppPrivate = appData;
- input->nInputPortIndex = OMX_CORE_INPUT_PORT_INDEX;
- input->pInputPortPrivate = (void *)&driver_context.ptr_inputbuffer [i];
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Input Buffer Index not found");
- eRet = OMX_ErrorInsufficientResources;
- }
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateOutputBuffer
-
-DESCRIPTION
- Helper fn for AllocateBuffer in the output pin
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything went well.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::allocate_output_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_BUFFERHEADERTYPE *bufHdr= NULL; // buffer header
- unsigned i= 0; // Temporary counter
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_setbuffer_cmd setbuffers;
-
- if(!m_out_mem_ptr)
- {
- DEBUG_PRINT_HIGH("\n Allocate o/p buffer case - Header List allocation");
- int nBufHdrSize = 0;
- int nPlatformEntrySize = 0;
- int nPlatformListSize = 0;
- int nPMEMInfoSize = 0;
- int pmem_fd = -1;
- unsigned char *pmem_baseaddress = NULL;
-
- OMX_QCOM_PLATFORM_PRIVATE_LIST *pPlatformList;
- OMX_QCOM_PLATFORM_PRIVATE_ENTRY *pPlatformEntry;
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pPMEMInfo;
-
- DEBUG_PRINT_LOW("Allocating First Output Buffer(%d)\n",m_out_buf_count);
- nBufHdrSize = m_out_buf_count * sizeof(OMX_BUFFERHEADERTYPE);
-
- nPMEMInfoSize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO);
- nPlatformListSize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_LIST);
- nPlatformEntrySize = m_out_buf_count *
- sizeof(OMX_QCOM_PLATFORM_PRIVATE_ENTRY);
-
- DEBUG_PRINT_LOW("TotalBufHdr %d BufHdrSize %d PMEM %d PL %d\n",nBufHdrSize,
- sizeof(OMX_BUFFERHEADERTYPE),
- nPMEMInfoSize,
- nPlatformListSize);
- DEBUG_PRINT_LOW("PE %d OutputBuffer Count %d \n",nPlatformEntrySize,
- m_out_buf_count);
-
- pmem_fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (pmem_fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR:pmem fd for output buffer %d",m_out_buf_size);
- return OMX_ErrorInsufficientResources;
- }
-
- if(pmem_fd == 0)
- {
- pmem_fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (pmem_fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR:pmem fd for output buffer %d",m_out_buf_size);
- return OMX_ErrorInsufficientResources;
- }
- }
-
- if(!align_pmem_buffers(pmem_fd, m_out_buf_size * m_out_buf_count,
- driver_context.output_buffer.alignment))
- {
- DEBUG_PRINT_ERROR("\n align_pmem_buffers() failed");
- close(pmem_fd);
- return OMX_ErrorInsufficientResources;
- }
-
- pmem_baseaddress = (unsigned char *)mmap(NULL,(m_out_buf_size * m_out_buf_count),
- PROT_READ|PROT_WRITE,MAP_SHARED,pmem_fd,0);
- m_heap_ptr = new VideoHeap (pmem_fd,
- m_out_buf_size*m_out_buf_count,
- pmem_baseaddress);
-
-
- if (pmem_baseaddress == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\n MMAP failed for Size %d",m_out_buf_size);
- return OMX_ErrorInsufficientResources;
- }
- m_out_mem_ptr = (OMX_BUFFERHEADERTYPE *)calloc(nBufHdrSize,1);
- // Alloc mem for platform specific info
- char *pPtr=NULL;
- pPtr = (char*) calloc(nPlatformListSize + nPlatformEntrySize +
- nPMEMInfoSize,1);
- driver_context.ptr_outputbuffer = (struct vdec_bufferpayload *) \
- calloc (sizeof(struct vdec_bufferpayload),m_out_buf_count);
- driver_context.ptr_respbuffer = (struct vdec_output_frameinfo *)\
- calloc (sizeof (struct vdec_output_frameinfo),m_out_buf_count);
-
- if(m_out_mem_ptr && pPtr && driver_context.ptr_outputbuffer
- && driver_context.ptr_respbuffer)
- {
- driver_context.ptr_outputbuffer[0].mmaped_size =
- (m_out_buf_size * m_out_buf_count);
- bufHdr = m_out_mem_ptr;
- m_platform_list = (OMX_QCOM_PLATFORM_PRIVATE_LIST *)(pPtr);
- m_platform_entry= (OMX_QCOM_PLATFORM_PRIVATE_ENTRY *)
- (((char *) m_platform_list) + nPlatformListSize);
- m_pmem_info = (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *)
- (((char *) m_platform_entry) + nPlatformEntrySize);
- pPlatformList = m_platform_list;
- pPlatformEntry = m_platform_entry;
- pPMEMInfo = m_pmem_info;
-
- DEBUG_PRINT_LOW("Memory Allocation Succeeded for OUT port%p\n",m_out_mem_ptr);
-
- // Settting the entire storage nicely
- DEBUG_PRINT_LOW("bHdr %p OutMem %p PE %p\n",bufHdr, m_out_mem_ptr,pPlatformEntry);
- DEBUG_PRINT_LOW(" Pmem Info = %p \n",pPMEMInfo);
- for(i=0; i < m_out_buf_count ; i++)
- {
- bufHdr->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
- // Set the values when we determine the right HxW param
- bufHdr->nAllocLen = bytes;
- bufHdr->nFilledLen = 0;
- bufHdr->pAppPrivate = appData;
- bufHdr->nOutputPortIndex = OMX_CORE_OUTPUT_PORT_INDEX;
- // Platform specific PMEM Information
- // Initialize the Platform Entry
- //DEBUG_PRINT_LOW("Initializing the Platform Entry for %d\n",i);
- pPlatformEntry->type = OMX_QCOM_PLATFORM_PRIVATE_PMEM;
- pPlatformEntry->entry = pPMEMInfo;
- // Initialize the Platform List
- pPlatformList->nEntries = 1;
- pPlatformList->entryList = pPlatformEntry;
- // Keep pBuffer NULL till vdec is opened
- bufHdr->pBuffer = NULL;
- bufHdr->nOffset = 0;
-
- pPMEMInfo->offset = m_out_buf_size*i;
- pPMEMInfo->pmem_fd = 0;
- bufHdr->pPlatformPrivate = pPlatformList;
-
- driver_context.ptr_outputbuffer[i].pmem_fd = pmem_fd;
-
- /*Create a mapping between buffers*/
- bufHdr->pOutputPortPrivate = &driver_context.ptr_respbuffer[i];
- driver_context.ptr_respbuffer[i].client_data = (void *) \
- &driver_context.ptr_outputbuffer[i];
- driver_context.ptr_outputbuffer[i].offset = m_out_buf_size*i;
- driver_context.ptr_outputbuffer[i].bufferaddr = \
- pmem_baseaddress + (m_out_buf_size*i);
-
- DEBUG_PRINT_LOW("\n pmem_fd = %d offset = %d address = %p",\
- pmem_fd,driver_context.ptr_outputbuffer[i].offset,driver_context.ptr_outputbuffer[i].bufferaddr);
- // Move the buffer and buffer header pointers
- bufHdr++;
- pPMEMInfo++;
- pPlatformEntry++;
- pPlatformList++;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("Output buf mem alloc failed[0x%x][0x%x]\n",\
- m_out_mem_ptr, pPtr);
- if(m_out_mem_ptr)
- {
- free(m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
- if(pPtr)
- {
- free(pPtr);
- pPtr = NULL;
- }
- if(driver_context.ptr_outputbuffer)
- {
- free(driver_context.ptr_outputbuffer);
- driver_context.ptr_outputbuffer = NULL;
- }
- if(driver_context.ptr_respbuffer)
- {
- free(driver_context.ptr_respbuffer);
- driver_context.ptr_respbuffer = NULL;
- }
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- for(i=0; i< m_out_buf_count; i++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,i))
- {
- DEBUG_PRINT_LOW("\n Found a Free Output Buffer %d",i);
- break;
- }
- }
-
- if (eRet == OMX_ErrorNone)
- {
- if(i < m_out_buf_count)
- {
- m_pmem_info[i].offset = driver_context.ptr_outputbuffer[i].offset;
- m_pmem_info[i].pmem_fd = (OMX_U32) m_heap_ptr.get ();
- driver_context.ptr_outputbuffer[i].buffer_len = m_out_buf_size;
- //driver_context.ptr_outputbuffer[i].mmaped_size = m_out_buf_size;
- if(!gate_output_buffers)
- {
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_outputbuffer [i],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n Set the Output Buffer");
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set output buffer failed");
- return OMX_ErrorInsufficientResources;
- }
- }
-
- // found an empty buffer at i
- *bufferHdr = (m_out_mem_ptr + i );
- (*bufferHdr)->pBuffer = driver_context.ptr_outputbuffer[i].bufferaddr;
- (*bufferHdr)->pAppPrivate = appData;
- BITMASK_SET(&m_out_bm_count,i);
- }
- else
- {
- DEBUG_PRINT_ERROR("All the Output Buffers have been Allocated ; Returning Insufficient \n");
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- return eRet;
-}
-
-
-// AllocateBuffer -- API Call
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateBuffer
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::allocate_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
- unsigned i = 0;
- OMX_ERRORTYPE eRet = OMX_ErrorNone; // OMX return type
-
- DEBUG_PRINT_LOW("\n Allocate buffer on port %d \n", (int)port);
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Allocate Buf in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if(port == OMX_CORE_INPUT_PORT_INDEX)
- {
- if (arbitrary_bytes)
- {
- eRet = allocate_input_heap_buffer (hComp,bufferHdr,port,appData,bytes);
- }
- else
- {
- eRet = allocate_input_buffer(hComp,bufferHdr,port,appData,bytes);
- }
- }
- else if(port == OMX_CORE_OUTPUT_PORT_INDEX)
- {
- eRet = allocate_output_buffer(hComp,bufferHdr,port,appData,bytes);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Invalid Port Index received %d\n",(int)port);
- eRet = OMX_ErrorBadPortIndex;
- }
- DEBUG_PRINT_LOW("Checking for Output Allocate buffer Done");
- if(eRet == OMX_ErrorNone)
- {
- if(allocate_done()){
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_IDLE_PENDING);
- post_event(OMX_CommandStateSet,OMX_StateIdle,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == OMX_CORE_INPUT_PORT_INDEX && m_inp_bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_INPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- OMX_CORE_INPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == OMX_CORE_OUTPUT_PORT_INDEX && m_out_bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- OMX_CORE_OUTPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- m_event_port_settings_sent = false;
- }
- }
- }
- DEBUG_PRINT_LOW("Allocate Buffer exit with ret Code %d\n",eRet);
- return eRet;
-}
-
-// Free Buffer - API call
-/* ======================================================================
-FUNCTION
- omx_vdec::FreeBuffer
-
-DESCRIPTION
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned int nPortIndex;
-
- DEBUG_PRINT_LOW("In for decoder free_buffer \n");
-
- if(m_state == OMX_StateIdle &&
- (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING)))
- {
- DEBUG_PRINT_LOW(" free buffer while Component in Loading pending\n");
- }
- else if((m_inp_bEnabled == OMX_FALSE && port == OMX_CORE_INPUT_PORT_INDEX)||
- (m_out_bEnabled == OMX_FALSE && port == OMX_CORE_OUTPUT_PORT_INDEX))
- {
- DEBUG_PRINT_LOW("Free Buffer while port %d disabled\n", port);
- }
- else if(m_state == OMX_StateExecuting || m_state == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("Invalid state to free buffer,ports need to be disabled\n");
- post_event(OMX_EventError,
- OMX_ErrorPortUnpopulated,
- OMX_COMPONENT_GENERATE_EVENT);
-
- return eRet;
- }
- else if (m_state != OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Invalid state to free buffer,port lost Buffers\n");
- post_event(OMX_EventError,
- OMX_ErrorPortUnpopulated,
- OMX_COMPONENT_GENERATE_EVENT);
- }
-
- if(port == OMX_CORE_INPUT_PORT_INDEX)
- {
- /*Check if arbitrary bytes*/
- if (!arbitrary_bytes)
- {
- // check if the buffer is valid
- nPortIndex = buffer - m_inp_mem_ptr;
- }
- else
- {
- nPortIndex = buffer - m_inp_heap_ptr;
- }
-
- DEBUG_PRINT_LOW("free_buffer on i/p port - Port idx %d \n", nPortIndex);
- if(nPortIndex < m_inp_buf_count)
- {
- // Clear the bit associated with it.
- BITMASK_CLEAR(&m_inp_bm_count,nPortIndex);
-
- if (arbitrary_bytes)
- {
- if (m_inp_heap_ptr[nPortIndex].pBuffer)
- {
- BITMASK_CLEAR(&m_heap_inp_bm_count,nPortIndex);
- DEBUG_PRINT_LOW("\n Free Heap Buffer index %d",nPortIndex);
- free (m_inp_heap_ptr[nPortIndex].pBuffer);
- m_inp_heap_ptr[nPortIndex].pBuffer = NULL;
- }
- if (m_phdr_pmem_ptr[nPortIndex])
- {
- DEBUG_PRINT_LOW("\n Free pmem Buffer index %d",nPortIndex);
- free_input_buffer(m_phdr_pmem_ptr[nPortIndex]);
- }
- }
- else
- {
- free_input_buffer(buffer);
- }
-
- m_inp_bPopulated = OMX_FALSE;
-
- /*Free the Buffer Header*/
- if (release_input_done())
- {
- DEBUG_PRINT_HIGH("\n ALL input buffers are freed/released");
- input_use_buffer = false;
- if (arbitrary_bytes)
- {
- if (m_frame_parser.mutils)
- {
- DEBUG_PRINT_LOW("\n Free utils parser");
- delete (m_frame_parser.mutils);
- m_frame_parser.mutils = NULL;
- }
-
- if (m_inp_heap_ptr)
- {
- DEBUG_PRINT_LOW("\n Free input Heap Pointer");
- free (m_inp_heap_ptr);
- m_inp_heap_ptr = NULL;
- }
-
- if (m_phdr_pmem_ptr)
- {
- DEBUG_PRINT_LOW("\n Free input pmem header Pointer");
- free (m_phdr_pmem_ptr);
- m_phdr_pmem_ptr = NULL;
- }
- }
- if (m_inp_mem_ptr)
- {
- DEBUG_PRINT_LOW("\n Free input pmem Pointer area");
- free (m_inp_mem_ptr);
- m_inp_mem_ptr = NULL;
- }
-
- if (driver_context.ptr_inputbuffer)
- {
- DEBUG_PRINT_LOW("\n Free Driver Context pointer");
- free (driver_context.ptr_inputbuffer);
- driver_context.ptr_inputbuffer = NULL;
- }
- }
-
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: free_buffer ,Port Index Invalid\n");
- eRet = OMX_ErrorBadPortIndex;
- }
-
- if(BITMASK_PRESENT((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING)
- && release_input_done())
- {
- DEBUG_PRINT_LOW("MOVING TO DISABLED STATE \n");
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING);
- post_event(OMX_CommandPortDisable,
- OMX_CORE_INPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- else if(port == OMX_CORE_OUTPUT_PORT_INDEX)
- {
- // check if the buffer is valid
- nPortIndex = buffer - (OMX_BUFFERHEADERTYPE*)m_out_mem_ptr;
- if(nPortIndex < m_out_buf_count)
- {
- DEBUG_PRINT_LOW("free_buffer on o/p port - Port idx %d \n", nPortIndex);
- // Clear the bit associated with it.
- BITMASK_CLEAR(&m_out_bm_count,nPortIndex);
- m_out_bPopulated = OMX_FALSE;
- free_output_buffer (buffer);
-
- if (release_output_done())
- {
- DEBUG_PRINT_HIGH("\n ALL output buffers are freed/released");
- output_use_buffer = false;
- if (m_out_mem_ptr)
- {
- free (m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
- if (driver_context.ptr_respbuffer)
- {
- free (driver_context.ptr_respbuffer);
- driver_context.ptr_respbuffer = NULL;
- }
- if (driver_context.ptr_outputbuffer)
- {
- free (driver_context.ptr_outputbuffer);
- driver_context.ptr_outputbuffer = NULL;
- }
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: free_buffer , Port Index Invalid\n");
- eRet = OMX_ErrorBadPortIndex;
- }
- if(BITMASK_PRESENT((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING)
- && release_output_done() )
- {
- DEBUG_PRINT_LOW("FreeBuffer : If any Disable event pending,post it\n");
-
- DEBUG_PRINT_LOW("MOVING TO DISABLED STATE \n");
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
- post_event(OMX_CommandPortDisable,
- OMX_CORE_OUTPUT_PORT_INDEX,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- else
- {
- eRet = OMX_ErrorBadPortIndex;
- }
- if((eRet == OMX_ErrorNone) &&
- (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING)))
- {
- if(release_done())
- {
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_LOADING_PENDING);
- post_event(OMX_CommandStateSet, OMX_StateLoaded,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::EmptyThisBuffer
-
-DESCRIPTION
- This routine is used to push the encoded video frames to
- the video decoder.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything went successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE ret1 = OMX_ErrorNone;
- unsigned int nBufferIndex = m_inp_buf_count;
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("Empty this buffer in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if (buffer == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR:ETB Buffer is NULL");
- return OMX_ErrorBadParameter;
- }
-
- if (arbitrary_bytes)
- {
- nBufferIndex = buffer - m_inp_heap_ptr;
- }
- else
- {
- nBufferIndex = buffer - m_inp_mem_ptr;
- }
-
- if (nBufferIndex > m_inp_buf_count )
- {
- DEBUG_PRINT_ERROR("\nERROR:ETB nBufferIndex is invalid");
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n ETB: bufhdr = %p, bufhdr->pBuffer = %p", buffer, buffer->pBuffer);
- if (arbitrary_bytes)
- {
- post_event ((unsigned)hComp,(unsigned)buffer,
- OMX_COMPONENT_GENERATE_ETB_ARBITRARY);
- }
- else
- {
- post_event ((unsigned)hComp,(unsigned)buffer,OMX_COMPONENT_GENERATE_ETB);
- }
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::empty_this_buffer_proxy
-
-DESCRIPTION
- This routine is used to push the encoded video frames to
- the video decoder.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything went successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::empty_this_buffer_proxy(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- int push_cnt = 0,i=0;
- unsigned nPortIndex = 0;
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- struct vdec_input_frameinfo frameinfo;
- struct vdec_bufferpayload *temp_buffer;
- struct vdec_ioctl_msg ioctl_msg;
- struct vdec_seqheader seq_header;
- bool port_setting_changed = true;
-
- /*Should we generate a Aync error event*/
- if (buffer == NULL || buffer->pInputPortPrivate == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR:empty_this_buffer_proxy is invalid");
- return OMX_ErrorBadParameter;
- }
-
- nPortIndex = buffer-((OMX_BUFFERHEADERTYPE *)m_inp_mem_ptr);
-
- if (nPortIndex > m_inp_buf_count)
- {
- DEBUG_PRINT_ERROR("\nERROR:empty_this_buffer_proxy invalid nPortIndex[%u]",
- nPortIndex);
- return OMX_ErrorBadParameter;
- }
-
- pending_input_buffers++;
-
- if( input_flush_progress == true || m_ineos_reached == 1)
- {
- DEBUG_PRINT_LOW("\n Flush in progress return buffer ");
- post_event ((unsigned int)buffer,VDEC_S_SUCCESS,
- OMX_COMPONENT_GENERATE_EBD);
- return OMX_ErrorNone;
- }
-
- if(m_event_port_settings_sent && !arbitrary_bytes)
- {
- post_event((unsigned)hComp,(unsigned)buffer,OMX_COMPONENT_GENERATE_ETB);
- return OMX_ErrorNone;
- }
-
- temp_buffer = (struct vdec_bufferpayload *)buffer->pInputPortPrivate;
-
- if ((temp_buffer - driver_context.ptr_inputbuffer) > m_inp_buf_count)
- {
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n ETBProxy: bufhdr = %p, bufhdr->pBuffer = %p", buffer, buffer->pBuffer);
- /*for use buffer we need to memcpy the data*/
- temp_buffer->buffer_len = buffer->nFilledLen;
-
- if (input_use_buffer)
- {
- if (buffer->nFilledLen <= temp_buffer->buffer_len)
- {
- memcpy (temp_buffer->bufferaddr,(buffer->pBuffer + buffer->nOffset),
- buffer->nFilledLen);
- }
- else
- {
- return OMX_ErrorBadParameter;
- }
-
- }
-
- if (!arbitrary_bytes && first_frame < 2 && codec_type_parse == CODEC_TYPE_MPEG4)
- {
-
- if (first_frame == 0)
- {
- first_buffer = (unsigned char *)malloc (m_inp_buf_size);
- DEBUG_PRINT_LOW("\n Copied the first buffer data size %d ",
- temp_buffer->buffer_len);
- first_frame = 1;
- memcpy (first_buffer,temp_buffer->bufferaddr,temp_buffer->buffer_len);
- first_frame_size = buffer->nFilledLen;
- buffer->nFilledLen = 0;
- post_event ((unsigned int)buffer,VDEC_S_SUCCESS,
- OMX_COMPONENT_GENERATE_EBD);
- return OMX_ErrorNone;
- }
- else if (first_frame == 1)
- {
- first_frame = 2;
- DEBUG_PRINT_LOW("\n Second buffer copy the header size %d frame size %d",
- first_frame_size,temp_buffer->buffer_len);
- memcpy (&first_buffer [first_frame_size],temp_buffer->bufferaddr,
- temp_buffer->buffer_len);
- first_frame_size += temp_buffer->buffer_len;
- memcpy (temp_buffer->bufferaddr,first_buffer,first_frame_size);
- temp_buffer->buffer_len = first_frame_size;
- free (first_buffer);
- }
- }
-
- frameinfo.bufferaddr = temp_buffer->bufferaddr;
- frameinfo.client_data = (void *) buffer;
- frameinfo.datalen = temp_buffer->buffer_len;
- frameinfo.flags = 0;
- frameinfo.offset = buffer->nOffset;
- frameinfo.pmem_fd = temp_buffer->pmem_fd;
- frameinfo.pmem_offset = temp_buffer->offset;
- frameinfo.timestamp = buffer->nTimeStamp;
-
-#if BITSTREAM_LOG
- int bytes_written;
- bytes_written = fwrite((const char *)temp_buffer->bufferaddr,
- temp_buffer->buffer_len,1,outputBufferFile1);
-
-#endif
-
- if(!set_seq_header_done)
- {
- set_seq_header_done = true;
- DEBUG_PRINT_HIGH("\n Set Sequence Header");
- seq_header.ptr_seqheader = frameinfo.bufferaddr;
- seq_header.seq_header_len = frameinfo.datalen;
- seq_header.pmem_fd = frameinfo.pmem_fd;
- seq_header.pmem_offset = frameinfo.pmem_offset;
- ioctl_msg.inputparam = &seq_header;
- ioctl_msg.outputparam = NULL;
- if (ioctl(driver_context.video_driver_fd,VDEC_IOCTL_SET_SEQUENCE_HEADER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set Sequence Header Failed");
- /*Generate an async error and move to invalid state*/
- return OMX_ErrorBadParameter;
- }
- if(omx_vdec_check_port_settings (&port_setting_changed) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n Check port setting failed");
- return OMX_ErrorBadParameter;
- }
-
- if(port_setting_changed)
- {
- DEBUG_PRINT_HIGH("\n Port settings changed");
- m_event_port_settings_sent = true;
- m_cb.EventHandler(&m_cmp, m_app_data,OMX_EventPortSettingsChanged,
- OMX_CORE_OUTPUT_PORT_INDEX, 0, NULL );
- DEBUG_PRINT_HIGH("\n EventHandler for Port Setting changed done");
- return OMX_ErrorNone;
- }
- else
- {
- if(!register_output_buffers())
- {
- DEBUG_PRINT_ERROR("\n register output failed");
- return OMX_ErrorBadParameter;
- }
- DEBUG_PRINT_HIGH("\n Port settings Not changed");
- }
- }
-
- if (temp_buffer->buffer_len == 0 || (buffer->nFlags & 0x01))
- {
- DEBUG_PRINT_HIGH("\n Rxd i/p EOS, Notify Driver that EOS has been reached");
- frameinfo.flags |= VDEC_BUFFERFLAG_EOS;
- m_ineos_reached = 1;
- }
-
- sent_first_frame = true;
- DEBUG_PRINT_LOW("\n Decode Input Frame Size %d",frameinfo.datalen);
- ioctl_msg.inputparam = &frameinfo;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(driver_context.video_driver_fd,VDEC_IOCTL_DECODE_FRAME,
- &ioctl_msg) < 0)
- {
- /*Generate an async error and move to invalid state*/
- return OMX_ErrorBadParameter;
- }
-
- return ret;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::FillThisBuffer
-
-DESCRIPTION
- IL client uses this method to release the frame buffer
- after displaying them.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::fill_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("FTB in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if (buffer == NULL || ((buffer - m_out_mem_ptr) > m_out_buf_size))
- {
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n FTB: bufhdr = %p, bufhdr->pBuffer = %p", buffer, buffer->pBuffer);
- post_event((unsigned) hComp, (unsigned)buffer,OMX_COMPONENT_GENERATE_FTB);
- return OMX_ErrorNone;
-}
-/* ======================================================================
-FUNCTION
- omx_vdec::fill_this_buffer_proxy
-
-DESCRIPTION
- IL client uses this method to release the frame buffer
- after displaying them.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::fill_this_buffer_proxy(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* bufferAdd)
-{
- OMX_ERRORTYPE nRet = OMX_ErrorNone;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- OMX_BUFFERHEADERTYPE *buffer = bufferAdd;
- struct vdec_fillbuffer_cmd fillbuffer;
- struct vdec_bufferpayload *ptr_outputbuffer = NULL;
- struct vdec_output_frameinfo *ptr_respbuffer = NULL;
-
-
- if (bufferAdd == NULL || ((buffer - m_out_mem_ptr) > m_out_buf_count) )
- {
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n FTBProxy: bufhdr = %p, bufhdr->pBuffer = %p",
- bufferAdd, bufferAdd->pBuffer);
- /*Return back the output buffer to client*/
- if( (m_event_port_settings_sent == true) || (m_out_bEnabled != OMX_TRUE)
- || output_flush_progress == true || m_outeos_reached == 1)
- {
- DEBUG_PRINT_LOW("\n Output Buffers return in EOS condition");
- buffer->nFlags |= m_outeos_reached;
- m_cb.FillBufferDone (hComp,m_app_data,buffer);
- return OMX_ErrorNone;
- }
- pending_output_buffers++;
- ptr_respbuffer = (struct vdec_output_frameinfo*)buffer->pOutputPortPrivate;
- if (ptr_respbuffer)
- {
- ptr_outputbuffer = (struct vdec_bufferpayload*)ptr_respbuffer->client_data;
- }
-
- if (ptr_respbuffer == NULL || ptr_outputbuffer == NULL)
- {
- return OMX_ErrorBadParameter;
- }
-
- memcpy (&fillbuffer.buffer,ptr_outputbuffer,\
- sizeof(struct vdec_bufferpayload));
- fillbuffer.client_data = bufferAdd;
-
- ioctl_msg.inputparam = &fillbuffer;
- ioctl_msg.outputparam = NULL;
- if (ioctl (driver_context.video_driver_fd,
- VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Decoder frame failed");
- m_cb.FillBufferDone (hComp,m_app_data,buffer);
- return OMX_ErrorBadParameter;
- }
-
- if(gate_input_buffers)
- {
- gate_input_buffers = false;
- if(pdest_frame)
- {
- /*Push the frame to the Decoder*/
- if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone)
- {
- return OMX_ErrorBadParameter;
- }
- frame_count++;
- pdest_frame = NULL;
- }
- }
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::SetCallbacks
-
-DESCRIPTION
- Set the callbacks.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::set_callbacks(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_CALLBACKTYPE* callbacks,
- OMX_IN OMX_PTR appData)
-{
-
- m_cb = *callbacks;
- DEBUG_PRINT_LOW("\n Callbacks Set %p %p %p",m_cb.EmptyBufferDone,\
- m_cb.EventHandler,m_cb.FillBufferDone);
- m_app_data = appData;
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ComponentDeInit
-
-DESCRIPTION
- Destroys the component and release memory allocated to the heap.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::component_deinit(OMX_IN OMX_HANDLETYPE hComp)
-{
- int i = 0;
- if (OMX_StateLoaded != m_state)
- {
- DEBUG_PRINT_ERROR("WARNING:Rxd DeInit,OMX not in LOADED state %d\n",\
- m_state);
- DEBUG_PRINT_ERROR("\nPlayback Ended - FAILED");
- }
- else
- {
- DEBUG_PRINT_HIGH("\n Playback Ended - PASSED");
- }
-
- /*Check if the output buffers have to be cleaned up*/
- if(m_out_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing the Output Memory\n");
- for (i=0; i<m_out_buf_count; i++ )
- {
- free_output_buffer (&m_out_mem_ptr[i]);
- }
- if (driver_context.ptr_outputbuffer)
- {
- free (driver_context.ptr_outputbuffer);
- driver_context.ptr_outputbuffer = NULL;
- }
-
- if (driver_context.ptr_respbuffer)
- {
- free (driver_context.ptr_respbuffer);
- driver_context.ptr_respbuffer = NULL;
- }
- free(m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
-
- /*Check if the input buffers have to be cleaned up*/
- if(m_inp_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing the Input Memory\n");
- for (i=0; i<m_inp_buf_count; i++ )
- {
- free_input_buffer (&m_inp_mem_ptr[i]);
- }
-
- if (driver_context.ptr_inputbuffer)
- {
- free (driver_context.ptr_inputbuffer);
- driver_context.ptr_inputbuffer = NULL;
- }
-
- free(m_inp_mem_ptr);
- m_inp_mem_ptr = NULL;
- }
-
- if(h264_scratch.pBuffer)
- {
- free(h264_scratch.pBuffer);
- h264_scratch.pBuffer = NULL;
- }
-
- if(m_platform_list)
- {
- free(m_platform_list);
- m_platform_list = NULL;
- }
- if(m_vendor_config.pData)
- {
- free(m_vendor_config.pData);
- m_vendor_config.pData = NULL;
- }
-
- // Reset counters in mesg queues
- m_ftb_q.m_size=0;
- m_cmd_q.m_size=0;
- m_etb_q.m_size=0;
- m_ftb_q.m_read = m_ftb_q.m_write =0;
- m_cmd_q.m_read = m_cmd_q.m_write =0;
- m_etb_q.m_read = m_etb_q.m_write =0;
-
- DEBUG_PRINT_LOW("\n Calling VDEC_IOCTL_STOP_NEXT_MSG");
- (void)ioctl(driver_context.video_driver_fd, VDEC_IOCTL_STOP_NEXT_MSG,
- NULL);
- DEBUG_PRINT_HIGH("\n Close the driver instance");
- close(driver_context.video_driver_fd);
-
-#if BITSTREAM_LOG
- fclose (outputBufferFile1);
-#endif
-#ifdef _ANDROID_
- //for (i=0; i<m_out_buf_count; i++ )
- {
- // Clear the strong reference
- m_heap_ptr.clear();
- }
-#endif // _ANDROID_
- DEBUG_PRINT_HIGH("\n omx_vdec::component_deinit() complete");
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::UseEGLImage
-
-DESCRIPTION
- OMX Use EGL Image method implementation <TBD>.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Not Implemented error.
-
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::use_EGL_image(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN void* eglImage)
-{
- DEBUG_PRINT_ERROR("Error : use_EGL_image: Not Implemented \n");
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ComponentRoleEnum
-
-DESCRIPTION
- OMX Component Role Enum method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything is successful.
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_U8* role,
- OMX_IN OMX_U32 index)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
- if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.h263",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_LOW("\n No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.avc",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_LOW("\n No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp(driver_context.kind, "OMX.qcom.video.decoder.vc1",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.vc1",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_LOW("\n No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Querying Role on Unknown Component\n");
- eRet = OMX_ErrorInvalidComponentName;
- }
- return eRet;
-}
-
-
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateDone
-
-DESCRIPTION
- Checks if entire buffer pool is allocated by IL Client or not.
- Need this to move to IDLE state.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_vdec::allocate_done(void)
-{
- bool bRet = false;
- bool bRet_In = false;
- bool bRet_Out = false;
-
- bRet_In = allocate_input_done();
- bRet_Out = allocate_output_done();
-
- if(bRet_In && bRet_Out)
- {
- bRet = true;
- }
-
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateInputDone
-
-DESCRIPTION
- Checks if I/P buffer pool is allocated by IL Client or not.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_vdec::allocate_input_done(void)
-{
- bool bRet = false;
- unsigned i=0;
-
- if (m_inp_mem_ptr == NULL)
- {
- return bRet;
- }
- if(m_inp_mem_ptr )
- {
- for(;i<m_inp_buf_count;i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- break;
- }
- }
- }
- if(i==m_inp_buf_count)
- {
- bRet = true;
- DEBUG_PRINT_HIGH("\n Allocate done for all i/p buffers");
- }
- if(i==m_inp_buf_count && m_inp_bEnabled)
- {
- m_inp_bPopulated = OMX_TRUE;
- }
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_vdec::AllocateOutputDone
-
-DESCRIPTION
- Checks if entire O/P buffer pool is allocated by IL Client or not.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_vdec::allocate_output_done(void)
-{
- bool bRet = false;
- unsigned j=0;
-
- if (m_out_mem_ptr == NULL)
- {
- return bRet;
- }
-
- if(m_out_mem_ptr )
- {
- for(;j<m_out_buf_count;j++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,j))
- {
- break;
- }
- }
- }
-
- if(j==m_out_buf_count)
- {
- bRet = true;
- DEBUG_PRINT_HIGH("\n Allocate done for all o/p buffers");
- }
-
- if(j==m_out_buf_count && m_out_bEnabled)
- {
- m_out_bPopulated = OMX_TRUE;
- }
- return bRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ReleaseDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_vdec::release_done(void)
-{
- bool bRet = false;
-
- if(release_input_done())
- {
- if(release_output_done())
- {
- bRet = true;
- }
- }
- return bRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::ReleaseOutputDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_vdec::release_output_done(void)
-{
- bool bRet = false;
- unsigned i=0,j=0;
-
- DEBUG_PRINT_LOW("\n Value of m_out_mem_ptr %p",m_inp_mem_ptr);
- if(m_out_mem_ptr)
- {
- for(;j<m_out_buf_count;j++)
- {
- if(BITMASK_PRESENT(&m_out_bm_count,j))
- {
- break;
- }
- }
- if(j==m_out_buf_count)
- {
- m_out_bm_count = 0;
- bRet = true;
- }
- }
- else
- {
- m_out_bm_count = 0;
- bRet = true;
- }
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_vdec::ReleaseInputDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_vdec::release_input_done(void)
-{
- bool bRet = false;
- unsigned i=0,j=0;
-
- DEBUG_PRINT_LOW("\n Value of m_inp_mem_ptr %p",m_inp_mem_ptr);
- if(m_inp_mem_ptr)
- {
- for(;j<m_inp_buf_count;j++)
- {
- if( BITMASK_PRESENT(&m_inp_bm_count,j))
- {
- break;
- }
- }
- if(j==m_inp_buf_count)
- {
- bRet = true;
- }
- }
- else
- {
- bRet = true;
- }
- return bRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_vdec::omx_vdec_check_port_settings
-
-DESCRIPTION
- Parse meta data to check the height and width param
- Check the level and profile
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX_ErrorNone, if profile and level are supported
- OMX_ErrorUnsupportedSetting, if profile and level are not supported
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::omx_vdec_check_port_settings(bool *port_setting_changed)
-{
- struct vdec_ioctl_msg ioctl_msg;
- unsigned int alignment = 0,buffer_size = 0;
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
- *port_setting_changed = false;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.video_resoultion;
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_PICRES,&ioctl_msg))
- {
- DEBUG_PRINT_ERROR("\n Error in VDEC_IOCTL_GET_PICRES in port_setting");
- return OMX_ErrorHardware;
- }
-
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &driver_context.output_buffer;
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- &ioctl_msg))
- {
- DEBUG_PRINT_ERROR("\n Error in VDEC_IOCTL_GET_BUFFER_REQ in port_setting");
- return OMX_ErrorHardware;
- }
- DEBUG_PRINT_HIGH("\n Queried Dimensions H=%d W=%d Act H=%d W=%d",
- driver_context.video_resoultion.frame_height,
- driver_context.video_resoultion.frame_width,
- m_height,m_width);
- DEBUG_PRINT_HIGH("\n Queried Buffer ACnt=%d BSiz=%d Act Acnt=%d Bsiz=%d",
- driver_context.output_buffer.actualcount,
- driver_context.output_buffer.buffer_size,
- m_out_buf_count,m_out_buf_size);
-
- DEBUG_PRINT_HIGH("\n Queried stride cuur Str=%d cur scan=%d Act str=%d act scan =%d",
- driver_context.video_resoultion.stride,driver_context.video_resoultion.scan_lines,
- stride,scan_lines);
-
-
- if(driver_context.video_resoultion.frame_height != m_height ||
- driver_context.video_resoultion.frame_width != m_width ||
- driver_context.video_resoultion.scan_lines != scan_lines ||
- driver_context.video_resoultion.stride != stride ||
- driver_context.output_buffer.actualcount != m_out_buf_count ||
- driver_context.output_buffer.buffer_size > m_out_buf_size)
- {
- *port_setting_changed = true;
- ioctl_msg.inputparam = &driver_context.output_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ,
- &ioctl_msg))
- {
- DEBUG_PRINT_ERROR("\n Error in VDEC_IOCTL_GET_BUFFER_REQ in port_setting");
- return OMX_ErrorHardware;
- }
- m_out_buf_size_recon = driver_context.output_buffer.buffer_size;
- m_out_buf_count_recon = driver_context.output_buffer.actualcount;
- m_out_buf_count_min_recon = driver_context.output_buffer.mincount;
-
- alignment = driver_context.output_buffer.alignment;
- buffer_size = driver_context.output_buffer.buffer_size;
- m_out_buf_size_recon =
- ((buffer_size + alignment - 1) & (~(alignment - 1)));
- m_crop_dy = m_height = driver_context.video_resoultion.frame_height;
- m_crop_dx = m_width = driver_context.video_resoultion.frame_width;
- scan_lines = driver_context.video_resoultion.scan_lines;
- stride = driver_context.video_resoultion.stride;
- m_port_height = m_height;
- m_port_width = m_width;
- }
-
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_vdec::omx_vdec_validate_port_param
-
-DESCRIPTION
- Get the PMEM area from video decoder
-
-PARAMETERS
- None.
-
-RETURN VALUE
- None
-========================================================================== */
-OMX_ERRORTYPE omx_vdec::omx_vdec_validate_port_param(int height, int width)
-{
- OMX_ERRORTYPE ret = OMX_ErrorNone;
- long hxw = height*width;
- long lmt_hxw = 0;
-
- return ret;
-}
-
-static FILE * outputBufferFile = NULL;
-
-OMX_ERRORTYPE omx_vdec::fill_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer)
-{
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pPMEMInfo = NULL;
-
- if (buffer == NULL || ((buffer - m_out_mem_ptr) > m_out_buf_count))
- {
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n fill_buffer_done: bufhdr = %p, bufhdr->pBuffer = %p",
- buffer, buffer->pBuffer);
- pending_output_buffers --;
-
- if (buffer->nFlags & 0x01)
- {
- DEBUG_PRINT_LOW("\n Output EOS has been reached");
-
- m_outeos_reached = 0;
- m_ineos_reached = 0;
- h264_scratch.nFilledLen = 0;
- nal_count = 0;
- look_ahead_nal = false;
- frame_count = 0;
-
- if (m_frame_parser.mutils)
- {
- m_frame_parser.mutils->initialize_frame_checking_environment();
- }
- if (psource_frame)
- {
- m_cb.EmptyBufferDone(&m_cmp ,m_app_data,psource_frame);
- psource_frame = NULL;
- }
-
- if (pdest_frame)
- {
- pdest_frame->nFilledLen = 0;
- m_input_free_q.insert_entry((unsigned) pdest_frame,NULL,NULL);
- pdest_frame = NULL;
- }
- m_frame_parser.flush();
- }
-
- DEBUG_PRINT_LOW("\n In fill Buffer done call address %p ",buffer);
-
- if (outputBufferFile == NULL)
- {
- outputBufferFile = fopen ("/data/output.yuv","wb");
- }
- if (outputBufferFile)
- {
- /*fwrite (buffer->pBuffer,1,buffer->nFilledLen,
- outputBufferFile); */
- }
- /* For use buffer we need to copy the data */
- if (m_cb.FillBufferDone)
- {
- pPMEMInfo = (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *)
- ((OMX_QCOM_PLATFORM_PRIVATE_LIST *)
- buffer->pPlatformPrivate)->entryList->entry;
- DEBUG_PRINT_LOW("\n Before FBD callback Accessed Pmeminfo %d",pPMEMInfo->pmem_fd);
- m_cb.FillBufferDone (hComp,m_app_data,buffer);
- DEBUG_PRINT_LOW("\n After Fill Buffer Done callback %d",pPMEMInfo->pmem_fd);
- }
- else
- {
- return OMX_ErrorBadParameter;
- }
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_vdec::empty_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE* buffer)
-{
-
- if (buffer == NULL || ((buffer - m_inp_mem_ptr) > m_inp_buf_count))
- {
- return OMX_ErrorBadParameter;
- }
-
- DEBUG_PRINT_LOW("\n empty_buffer_done: bufhdr = %p, bufhdr->pBuffer = %p",
- buffer, buffer->pBuffer);
- pending_input_buffers--;
-
- if (arbitrary_bytes)
- {
- if (pdest_frame == NULL && input_flush_progress == false)
- {
- DEBUG_PRINT_LOW("\n Push input from buffer done address of Buffer %p",buffer);
- pdest_frame = buffer;
- buffer->nFilledLen = 0;
- push_input_buffer (hComp);
- }
- else
- {
- DEBUG_PRINT_LOW("\n Push buffer into freeq address of Buffer %p",buffer);
- buffer->nFilledLen = 0;
- if (!m_input_free_q.insert_entry((unsigned)buffer,NULL,NULL))
- {
- DEBUG_PRINT_ERROR("\nERROR:i/p free Queue is FULL Error");
- }
- }
- }
- else if(m_cb.EmptyBufferDone)
- {
- buffer->nFilledLen = 0;
- m_cb.EmptyBufferDone(hComp ,m_app_data, buffer);
- }
- return OMX_ErrorNone;
-}
-
-
-int omx_vdec::async_message_process (void *context, void* message)
-{
- omx_vdec* omx = NULL;
- struct vdec_msginfo *vdec_msg = NULL;
- OMX_BUFFERHEADERTYPE* omxhdr = NULL;
- struct vdec_output_frameinfo *output_respbuf = NULL;
-
- if (context == NULL || message == NULL)
- {
- DEBUG_PRINT_ERROR("\n FATAL ERROR in omx_vdec::async_message_process NULL Check");
- return -1;
- }
- vdec_msg = (struct vdec_msginfo *)message;
-
- omx = reinterpret_cast<omx_vdec*>(context);
- switch (vdec_msg->msgcode)
- {
-
- case VDEC_MSG_EVT_HW_ERROR:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_HARDWARE_ERROR);
- break;
-
- case VDEC_MSG_RESP_START_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_START_DONE);
- break;
-
- case VDEC_MSG_RESP_STOP_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_STOP_DONE);
- break;
-
- case VDEC_MSG_RESP_RESUME_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_RESUME_DONE);
- break;
-
- case VDEC_MSG_RESP_PAUSE_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_PAUSE_DONE);
- break;
-
- case VDEC_MSG_RESP_FLUSH_INPUT_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH);
- break;
- case VDEC_MSG_RESP_FLUSH_OUTPUT_DONE:
- omx->post_event (NULL,vdec_msg->status_code,\
- OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH);
- break;
- case VDEC_MSG_RESP_INPUT_FLUSHED:
- case VDEC_MSG_RESP_INPUT_BUFFER_DONE:
-
- omxhdr = (OMX_BUFFERHEADERTYPE* )\
- vdec_msg->msgdata.input_frame_clientdata;
-
-
- if (omxhdr == NULL ||
- ((omxhdr - omx->m_inp_mem_ptr) > omx->m_inp_buf_count) )
- {
- omxhdr = NULL;
- vdec_msg->status_code = VDEC_S_EFATAL;
- }
-
- omx->post_event ((unsigned int)omxhdr,vdec_msg->status_code,
- OMX_COMPONENT_GENERATE_EBD);
- break;
- case VDEC_MSG_RESP_OUTPUT_FLUSHED:
- case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE:
- omxhdr = (OMX_BUFFERHEADERTYPE*)vdec_msg->msgdata.output_frame.client_data;
- DEBUG_PRINT_LOW("\n Got Buffer back from Driver %p omxhdr time stamp = %d " ,omxhdr,vdec_msg->msgdata.output_frame.time_stamp);
-
- if ( (omxhdr != NULL) &&
- ((omxhdr - omx->m_out_mem_ptr) < omx->m_out_buf_count) &&
- (omxhdr->pOutputPortPrivate != NULL) &&
- ( ((struct vdec_output_frameinfo *)omxhdr->pOutputPortPrivate
- - omx->driver_context.ptr_respbuffer) < omx->m_out_buf_count)
- )
- {
- if (vdec_msg->msgdata.output_frame.len <= omxhdr->nAllocLen)
- {
- omxhdr->nFilledLen = vdec_msg->msgdata.output_frame.len;
- omxhdr->nOffset = vdec_msg->msgdata.output_frame.offset;
- omxhdr->nTimeStamp = vdec_msg->msgdata.output_frame.time_stamp;
- omxhdr->nFlags = (vdec_msg->msgdata.output_frame.flags & 0x01);
-
- output_respbuf = (struct vdec_output_frameinfo *)\
- omxhdr->pOutputPortPrivate;
- output_respbuf->framesize.bottom = \
- vdec_msg->msgdata.output_frame.framesize.bottom;
- output_respbuf->framesize.left = \
- vdec_msg->msgdata.output_frame.framesize.left;
- output_respbuf->framesize.right = \
- vdec_msg->msgdata.output_frame.framesize.right;
- output_respbuf->framesize.top = \
- vdec_msg->msgdata.output_frame.framesize.top;
- output_respbuf->len = vdec_msg->msgdata.output_frame.len;
- output_respbuf->offset = vdec_msg->msgdata.output_frame.offset;
- output_respbuf->time_stamp = vdec_msg->msgdata.output_frame.time_stamp;
- output_respbuf->flags = vdec_msg->msgdata.output_frame.flags;
-
- /*Use buffer case*/
- if (omx->output_use_buffer)
- {
- if (vdec_msg->msgdata.output_frame.len <= omxhdr->nAllocLen)
- {
- memcpy ( omxhdr->pBuffer,
- (vdec_msg->msgdata.output_frame.bufferaddr +
- vdec_msg->msgdata.output_frame.offset),
- vdec_msg->msgdata.output_frame.len );
- }
- else
- {
- omxhdr->nFilledLen = 0;
- }
- }
- }
- else
- {
- omxhdr->nFilledLen = 0;
- }
-
- }
- else
- {
- omxhdr = NULL;
- vdec_msg->status_code = VDEC_S_EFATAL;
- }
-
- DEBUG_PRINT_LOW("\n Driver returned a output Buffer status %d",
- vdec_msg->status_code);
- omx->post_event ((unsigned int)omxhdr,vdec_msg->status_code,
- OMX_COMPONENT_GENERATE_FBD);
- break;
- default:
- break;
- }
- return 1;
-}
-
-OMX_ERRORTYPE omx_vdec::empty_this_buffer_proxy_arbitrary (
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- )
-{
- unsigned address,p2,id;
- DEBUG_PRINT_LOW("\n Empty this arbitrary");
-
- if (buffer == NULL)
- {
- return OMX_ErrorBadParameter;
- }
- DEBUG_PRINT_LOW("\n ETBProxyArb: bufhdr = %p, bufhdr->pBuffer = %p", buffer, buffer->pBuffer);
- DEBUG_PRINT_LOW("\n ETBProxyArb: nFilledLen %u, flags %d, timestamp %u",
- buffer->nFilledLen, buffer->nFlags, (unsigned)buffer->nTimeStamp);
-
- if( input_flush_progress == true || m_ineos_reached == 1)
- {
- DEBUG_PRINT_LOW("\n Flush in progress return buffer ");
- m_cb.EmptyBufferDone (hComp,m_app_data,buffer);
- return OMX_ErrorNone;
- }
-
- if (psource_frame == NULL)
- {
- DEBUG_PRINT_LOW("\n Set Buffer as source Buffer %p time stamp %d",buffer,buffer->nTimeStamp);
- psource_frame = buffer;
- DEBUG_PRINT_LOW("\n Try to Push One Input Buffer ");
- push_input_buffer (hComp);
- }
- else
- {
- DEBUG_PRINT_LOW("\n Push the source buffer into pendingq %p",buffer);
- if (!m_input_pending_q.insert_entry((unsigned)buffer,NULL,NULL))
- {
- return OMX_ErrorBadParameter;
- }
- }
-
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_vdec::push_input_buffer (OMX_HANDLETYPE hComp)
-{
- unsigned address,p2,id;
- OMX_ERRORTYPE ret = OMX_ErrorNone;
-
- if (pdest_frame == NULL || psource_frame == NULL)
- {
- /*Check if we have a destination buffer*/
- if (pdest_frame == NULL)
- {
- DEBUG_PRINT_LOW("\n Get a Destination buffer from the queue");
- if (m_input_free_q.m_size && !gate_input_buffers)
- {
- m_input_free_q.pop_entry(&address,&p2,&id);
- pdest_frame = (OMX_BUFFERHEADERTYPE *)address;
- pdest_frame->nFilledLen = 0;
- DEBUG_PRINT_LOW("\n Address of Pmem Buffer %p",pdest_frame);
- }
- }
-
- /*Check if we have a destination buffer*/
- if (psource_frame == NULL)
- {
- DEBUG_PRINT_LOW("\n Get a source buffer from the queue");
- if (m_input_pending_q.m_size && !gate_input_buffers)
- {
- m_input_pending_q.pop_entry(&address,&p2,&id);
- psource_frame = (OMX_BUFFERHEADERTYPE *)address;
- DEBUG_PRINT_LOW("\n Next source Buffer %p time stamp %d",psource_frame,
- psource_frame->nTimeStamp);
- DEBUG_PRINT_LOW("\n Next source Buffer flag %d length %d",
- psource_frame->nFlags,psource_frame->nFilledLen);
-
- }
- }
-
- }
-
- while ((pdest_frame != NULL) && (psource_frame != NULL)&& !gate_input_buffers)
- {
- switch (codec_type_parse)
- {
- case CODEC_TYPE_MPEG4:
- case CODEC_TYPE_H263:
- ret = push_input_sc_codec(hComp);
- break;
- case CODEC_TYPE_H264:
- ret = push_input_h264(hComp);
- break;
- case CODEC_TYPE_VC1:
- ret = push_input_vc1(hComp);
- break;
- }
- if (ret != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n Pushing input Buffer Failed");
- omx_report_error ();
- break;
- }
- }
-
- return ret;
-}
-
-OMX_ERRORTYPE omx_vdec::push_input_sc_codec(OMX_HANDLETYPE hComp)
-{
- OMX_U32 partial_frame = 1;
- OMX_BOOL genarte_edb = OMX_TRUE,generate_eos = OMX_TRUE;
- unsigned address,p2,id;
-
- DEBUG_PRINT_LOW("\n Start Parsing the bit stream address %p TimeStamp %d",
- psource_frame,psource_frame->nTimeStamp);
- if (m_frame_parser.parse_mpeg4_frame(psource_frame,
- pdest_frame,&partial_frame) == -1)
- {
- DEBUG_PRINT_ERROR("\n Error In Parsing Return Error");
- return OMX_ErrorBadParameter;
- }
-
- if (partial_frame == 0)
- {
- DEBUG_PRINT_LOW("\n Frame size %d source %p frame count %d",
- pdest_frame->nFilledLen,psource_frame,frame_count);
-
-
- DEBUG_PRINT_LOW("\n TimeStamp updated %d",pdest_frame->nTimeStamp);
- /*First Parsed buffer will have only header Hence skip*/
- if (frame_count == 0)
- {
- DEBUG_PRINT_LOW("\n H263/MPEG4 Codec First Frame ");
- mp4h263_flags = psource_frame->nFlags;
- mp4h263_timestamp = psource_frame->nTimeStamp;
- frame_count++;
- }
- else
- {
- pdest_frame->nTimeStamp = mp4h263_timestamp;
- mp4h263_timestamp = psource_frame->nTimeStamp;
- pdest_frame->nFlags = mp4h263_flags;
- mp4h263_flags = psource_frame->nFlags;
-
- if(psource_frame->nFilledLen == 0)
- {
- pdest_frame->nFlags = mp4h263_flags;
- generate_eos = OMX_FALSE;
- }
-
-
- /*Push the frame to the Decoder*/
- if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone)
- {
- return OMX_ErrorBadParameter;
- }
- if(m_event_port_settings_sent)
- {
- gate_input_buffers = true;
- return OMX_ErrorNone;
- }
- frame_count++;
- pdest_frame = NULL;
-
- if (m_input_free_q.m_size && !gate_input_buffers)
- {
- m_input_free_q.pop_entry(&address,&p2,&id);
- pdest_frame = (OMX_BUFFERHEADERTYPE *) address;
- pdest_frame->nFilledLen = 0;
- }
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n Not a Complete Frame %d",pdest_frame->nFilledLen);
- /*Check if Destination Buffer is full*/
- if (pdest_frame->nAllocLen ==
- pdest_frame->nFilledLen + pdest_frame->nOffset)
- {
- DEBUG_PRINT_ERROR("\nERROR:Frame Not found though Destination Filled");
- return OMX_ErrorStreamCorrupt;
- }
- }
-
- if (psource_frame->nFilledLen == 0)
- {
- if ((psource_frame->nFlags & 0x01) && generate_eos)
- {
- if (pdest_frame)
- {
- pdest_frame->nTimeStamp = psource_frame->nTimeStamp;
- pdest_frame->nFlags = psource_frame->nFlags;
- DEBUG_PRINT_LOW("\n Frame Found start Decoding Size =%d TimeStamp = %x",
- pdest_frame->nFilledLen,pdest_frame->nTimeStamp);
- DEBUG_PRINT_LOW("\n Found a frame size = %d number = %d",
- pdest_frame->nFilledLen,frame_count++);
- /*Push the frame to the Decoder*/
- if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone)
- {
- return OMX_ErrorBadParameter;
- }
- frame_count++;
- pdest_frame = NULL;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Last frame in else dest addr") ;
- genarte_edb = OMX_FALSE;
- }
- }
- if(genarte_edb)
- {
- DEBUG_PRINT_LOW("\n Buffer Consumed return back to client %p",psource_frame);
- m_cb.EmptyBufferDone (hComp,m_app_data,psource_frame);
- psource_frame = NULL;
-
- if (m_input_pending_q.m_size)
- {
- DEBUG_PRINT_LOW("\n Pull Next source Buffer %p",psource_frame);
- m_input_pending_q.pop_entry(&address,&p2,&id);
- psource_frame = (OMX_BUFFERHEADERTYPE *) address;
- DEBUG_PRINT_LOW("\n Next source Buffer %p time stamp %d",psource_frame,
- psource_frame->nTimeStamp);
- DEBUG_PRINT_LOW("\n Next source Buffer flag %d length %d",
- psource_frame->nFlags,psource_frame->nFilledLen);
- }
- }
- }
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_vdec::push_input_h264 (OMX_HANDLETYPE hComp)
-{
- OMX_U32 partial_frame = 1;
- unsigned address,p2,id;
- OMX_BOOL isNewFrame = OMX_FALSE;
- OMX_BOOL genarte_edb = OMX_TRUE;
- OMX_BOOL skip_parsing = OMX_FALSE;
-
- if (h264_scratch.pBuffer == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR:H.264 Scratch Buffer not allocated");
- return OMX_ErrorBadParameter;
- }
- DEBUG_PRINT_LOW("\n Values of h264_scratch.nFilledLen %d look_ahead_nal %d",
- h264_scratch.nFilledLen,look_ahead_nal);
- DEBUG_PRINT_LOW("\n pdest_frame->nFilledLen %d",pdest_frame->nFilledLen);
- if (h264_scratch.nFilledLen && look_ahead_nal)
- {
- look_ahead_nal = false;
- DEBUG_PRINT_LOW("\n Copy the previous NAL into Buffer %d ",
- h264_scratch.nFilledLen);
- if ((pdest_frame->nAllocLen - pdest_frame->nFilledLen) >=
- h264_scratch.nFilledLen)
- {
- memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen),
- h264_scratch.pBuffer,h264_scratch.nFilledLen);
- pdest_frame->nFilledLen += h264_scratch.nFilledLen;
- DEBUG_PRINT_LOW("\n Total filled length %d",pdest_frame->nFilledLen);
- h264_scratch.nFilledLen = 0;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Destination buffer overflow for H264");
- return OMX_ErrorBadParameter;
- }
- }
-
- if(psource_frame->nFlags & 0x01)
- {
- DEBUG_PRINT_LOW("\n EOS has been reached no parsing required");
- skip_parsing = OMX_TRUE;
- if ((pdest_frame->nAllocLen - pdest_frame->nFilledLen) >=
- psource_frame->nFilledLen)
- {
- memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen),
- (psource_frame->pBuffer+psource_frame->nOffset),
- psource_frame->nFilledLen);
- pdest_frame->nFilledLen += psource_frame->nFilledLen;
- DEBUG_PRINT_LOW("\n Total filled length %d",pdest_frame->nFilledLen);
- psource_frame->nFilledLen = 0;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Destination buffer overflow for H264");
- return OMX_ErrorBadParameter;
- }
- }
-
- if(!skip_parsing)
- {
- if (nal_length == 0)
- {
- DEBUG_PRINT_LOW("\n NAL length Zero hence parse using start code");
- if (m_frame_parser.parse_mpeg4_frame(psource_frame,
- &h264_scratch,&partial_frame) == -1)
- {
- DEBUG_PRINT_ERROR("\n Error In Parsing Return Error");
- return OMX_ErrorBadParameter;
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n NAL length %d hence parse with NAL length %d",nal_length);
- if (m_frame_parser.parse_h264_nallength(psource_frame,
- &h264_scratch,&partial_frame) == -1)
- {
- DEBUG_PRINT_ERROR("\n Error In Parsing NAL Return Error");
- return OMX_ErrorBadParameter;
- }
- }
-
- if (partial_frame == 0)
- {
-
- if (nal_count == 0 && h264_scratch.nFilledLen == 0)
- {
- DEBUG_PRINT_LOW("\n First NAL with Zero Length Hence Skip");
- nal_count++;
- h264_scratch.nTimeStamp = psource_frame->nTimeStamp;
- h264_scratch.nFlags = psource_frame->nFlags;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Length of New NAL is %d",h264_scratch.nFilledLen);
-
- m_frame_parser.mutils->isNewFrame(h264_scratch.pBuffer,
- h264_scratch.nFilledLen,0,isNewFrame);
- nal_count++;
-
- if (!isNewFrame)
- {
- if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >=
- h264_scratch.nFilledLen)
- {
- DEBUG_PRINT_LOW("\n Not a NewFrame Copy into Dest len %d",
- h264_scratch.nFilledLen);
- memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen),
- h264_scratch.pBuffer,h264_scratch.nFilledLen);
- pdest_frame->nFilledLen += h264_scratch.nFilledLen;
- h264_scratch.nFilledLen = 0;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Destination buffer overflow for H264");
- return OMX_ErrorBadParameter;
- }
- }
- else
- {
- look_ahead_nal = true;
- pdest_frame->nTimeStamp = h264_scratch.nTimeStamp;
- pdest_frame->nFlags = h264_scratch.nFlags;
- h264_scratch.nTimeStamp = psource_frame->nTimeStamp;
- h264_scratch.nFlags = psource_frame->nFlags;
-
- DEBUG_PRINT_LOW("\n Frame Found start Decoding Size =%d TimeStamp = %x",
- pdest_frame->nFilledLen,pdest_frame->nTimeStamp);
- DEBUG_PRINT_LOW("\n Found a frame size = %d number = %d",
- pdest_frame->nFilledLen,frame_count++);
-
- if (pdest_frame->nFilledLen == 0)
- {
- DEBUG_PRINT_LOW("\n Copy the Current Frame since and push it");
- look_ahead_nal = false;
- if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >=
- h264_scratch.nFilledLen)
- {
- memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen),
- h264_scratch.pBuffer,h264_scratch.nFilledLen);
- pdest_frame->nFilledLen += h264_scratch.nFilledLen;
- h264_scratch.nFilledLen = 0;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Destination buffer overflow for H264");
- return OMX_ErrorBadParameter;
- }
- }
- else
- {
- /*Push the frame to the Decoder*/
- if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone)
- {
- return OMX_ErrorBadParameter;
- }
- if(m_event_port_settings_sent)
- {
- gate_input_buffers = true;
- return OMX_ErrorNone;
- }
- //frame_count++;
- pdest_frame = NULL;
- if (m_input_free_q.m_size && !gate_input_buffers)
- {
- m_input_free_q.pop_entry(&address,&p2,&id);
- pdest_frame = (OMX_BUFFERHEADERTYPE *) address;
- DEBUG_PRINT_LOW("\n Pop the next pdest_buffer %p",pdest_frame);
- pdest_frame->nFilledLen = 0;
- }
- }
- }
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n Not a Complete Frame %d",pdest_frame->nFilledLen);
- /*Check if Destination Buffer is full*/
- if (h264_scratch.nAllocLen ==
- h264_scratch.nFilledLen + h264_scratch.nOffset)
- {
- DEBUG_PRINT_ERROR("\nERROR: Frame Not found though Destination Filled");
- return OMX_ErrorStreamCorrupt;
- }
- }
- }
-
- if (psource_frame->nFilledLen == 0)
- {
- DEBUG_PRINT_LOW("\n Buffer Consumed return back to client %p",psource_frame);
-
- if (psource_frame->nFlags & 0x01)
- {
- if (pdest_frame)
- {
- DEBUG_PRINT_LOW("\n EOS Reached Pass Last Buffer");
- if ( (pdest_frame->nAllocLen - pdest_frame->nFilledLen) >=
- h264_scratch.nFilledLen)
- {
- memcpy ((pdest_frame->pBuffer + pdest_frame->nFilledLen),
- h264_scratch.pBuffer,h264_scratch.nFilledLen);
- pdest_frame->nFilledLen += h264_scratch.nFilledLen;
- h264_scratch.nFilledLen = 0;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR:Destination buffer overflow for H264");
- return OMX_ErrorBadParameter;
- }
- pdest_frame->nTimeStamp = psource_frame->nTimeStamp;
- pdest_frame->nFlags = psource_frame->nFlags;
-
- DEBUG_PRINT_LOW("\n Frame Found start Decoding Size =%d TimeStamp = %x",
- pdest_frame->nFilledLen,pdest_frame->nTimeStamp);
- DEBUG_PRINT_LOW("\n Found a frame size = %d number = %d",
- pdest_frame->nFilledLen,frame_count++);
- /*Push the frame to the Decoder*/
- if (empty_this_buffer_proxy(hComp,pdest_frame) != OMX_ErrorNone)
- {
- return OMX_ErrorBadParameter;
- }
- if(m_event_port_settings_sent)
- {
- gate_input_buffers = true;
- return OMX_ErrorNone;
- }
- frame_count++;
- pdest_frame = NULL;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Last frame in else dest addr %p size %d",
- pdest_frame,h264_scratch.nFilledLen);
- genarte_edb = OMX_FALSE;
- }
- }
- if(genarte_edb)
- {
- m_cb.EmptyBufferDone (hComp,m_app_data,psource_frame);
- psource_frame = NULL;
- if (m_input_pending_q.m_size && !gate_input_buffers)
- {
- DEBUG_PRINT_LOW("\n Pull Next source Buffer %p",psource_frame);
- m_input_pending_q.pop_entry(&address,&p2,&id);
- psource_frame = (OMX_BUFFERHEADERTYPE *) address;
- DEBUG_PRINT_LOW("\nNext source Buffer flag %d length %d",
- psource_frame->nFlags,psource_frame->nFilledLen);
- }
- }
- }
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_vdec::push_input_vc1 (OMX_HANDLETYPE hComp)
-{
- OMX_U8 *buf, *pdest;
- OMX_U32 partial_frame = 1;
- OMX_U32 buf_len, dest_len;
-
- if(frame_count == 0)
- {
- DEBUG_PRINT_LOW("\nFirst i/p buffer for VC1 arbitrary bytes\n");
- if(!m_vendor_config.pData)
- {
- DEBUG_PRINT_LOW("\nCheck profile type in 1st source buffer\n");
- buf = psource_frame->pBuffer;
- buf_len = psource_frame->nFilledLen;
-
- if ((*((OMX_U32 *) buf) & VC1_SP_MP_START_CODE_MASK) ==
- VC1_SP_MP_START_CODE)
- {
- m_vc1_profile = VC1_SP_MP_RCV;
- }
- else if(*((OMX_U32 *) buf) & VC1_AP_SEQ_START_CODE)
- {
- m_vc1_profile = VC1_AP;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nInvalid sequence layer in first buffer\n");
- return OMX_ErrorStreamCorrupt;
- }
- }
- else
- {
- pdest = pdest_frame->pBuffer + pdest_frame->nFilledLen +
- pdest_frame->nOffset;
- dest_len = pdest_frame->nAllocLen - (pdest_frame->nFilledLen +
- pdest_frame->nOffset);
-
- if(dest_len < m_vendor_config.nDataSize)
- {
- DEBUG_PRINT_ERROR("\nDestination buffer full\n");
- return OMX_ErrorBadParameter;
- }
- else
- {
- memcpy(pdest, m_vendor_config.pData, m_vendor_config.nDataSize);
- pdest_frame->nFilledLen += m_vendor_config.nDataSize;
- }
- }
- }
-
- switch(m_vc1_profile)
- {
- case VC1_AP:
- DEBUG_PRINT_LOW("\n VC1 AP, hence parse using frame start code");
- if (push_input_sc_codec(hComp) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n Error In Parsing VC1 AP start code");
- return OMX_ErrorBadParameter;
- }
- break;
-
- case VC1_SP_MP_RCV:
- default:
- DEBUG_PRINT_ERROR("\n Unsupported VC1 profile in ArbitraryBytes Mode\n");
- return OMX_ErrorBadParameter;
- }
- return OMX_ErrorNone;
-}
-
-bool omx_vdec::register_output_buffers()
-{
- struct vdec_ioctl_msg ioctl_msg;
- struct vdec_setbuffer_cmd setbuffers;
- int i = 0;
- unsigned p1 =0,p2 = 0,ident = 0;
-
- for(i=0;i<m_out_buf_count;i++)
- {
- setbuffers.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- memcpy (&setbuffers.buffer,&driver_context.ptr_outputbuffer [i],
- sizeof (vdec_bufferpayload));
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n Set the Output Buffer");
- if (ioctl (driver_context.video_driver_fd,VDEC_IOCTL_SET_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\n Set output buffer failed");
- return false;
- }
- }
- if(gate_output_buffers)
- {
- /*Generate FBD for all Buffers in the FTBq*/
- pthread_mutex_lock(&m_lock);
- DEBUG_PRINT_LOW("\n Initiate Pushing Output Buffers");
- while (m_ftb_q.m_size)
- {
- m_ftb_q.pop_entry(&p1,&p2,&ident);
- if(ident == OMX_COMPONENT_GENERATE_FTB )
- {
- if (fill_this_buffer_proxy ((OMX_HANDLETYPE)p1,
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\n fill_this_buffer_proxy failure");
- omx_report_error ();
- return false;
- }
- }
- else if (ident == OMX_COMPONENT_GENERATE_FBD)
- {
- fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p1);
- }
- }
- gate_output_buffers = false;
- pthread_mutex_unlock(&m_lock);
- }
- return true;
-}
-
-bool omx_vdec::align_pmem_buffers(int pmem_fd, OMX_U32 buffer_size,
- OMX_U32 alignment)
-{
-//TODO: figure out if this is really necessary (PMEM_ALLOCATE_ALIGNED is a
-// QCOM extension to pmem
- return true;
-#if 0
- struct pmem_allocation allocation;
- allocation.size = buffer_size;
- allocation.align = clip2(alignment);
- if (allocation.align < 4096)
- {
- allocation.align = 4096;
- }
- if (ioctl(pmem_fd, PMEM_ALLOCATE_ALIGNED, &allocation) < 0)
- {
- DEBUG_PRINT_ERROR("\n Aligment failed with pmem driver");
- return false;
- }
- return true;
-#endif
-}
-
diff --git a/mm-video/vidc/vdec/src/queue.c b/mm-video/vidc/vdec/src/queue.c
deleted file mode 100644
index aefb6811..00000000
--- a/mm-video/vidc/vdec/src/queue.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*
- Queue with Linked list
-*/
-
-#include "queue.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-
-typedef struct Node
-{
- void *element;
- struct Node *next;
-} Node;
-
-struct Queue
-{
- Node *head;
- Node *tail;
- int current_size;
-};
-
-Queue *alloc_queue()
-{
- Queue *q = (Queue *) malloc(sizeof(Queue));
- if (q)
- {
- q->head = q->tail = NULL;
- q->current_size = 0;
- }
- return q;
-}
-
-void free_queue(Queue *q)
-{
- while (q->current_size)
- {
- pop(q);
- }
-}
-
-void free_queue_and_qelement(Queue *q)
-{
- while (q->current_size)
- {
- void *element = pop(q);
- if (element)
- free(element);
- }
-}
-
-int push(Queue *q, void * element)
-{
- Node *new_node = (Node *) malloc(sizeof(Node));
-
- if (new_node == NULL)
- return -1;
-
- new_node->element = element;
- new_node->next = NULL;
-
- if (q->current_size == 0)
- {
- q->head = new_node;
- }
- else
- {
- q->tail->next = new_node;
- }
-
- q->tail = new_node;
- q->current_size++;
-
- return 0;
-}
-
-void *pop(Queue *q)
-{
- Node *temp;
- void *element;
-
- if (q->current_size == 0)
- return NULL;
-
- temp = q->head;
- element = temp->element;
-
- if (q->current_size == 1)
- {
- q->head = q->tail = NULL;
- }
- else
- {
- q->head = q->head->next;
- }
-
- free(temp);
- q->current_size--;
- return element;
-}
-
diff --git a/mm-video/vidc/vdec/test/decoder_driver_test.c b/mm-video/vidc/vdec/test/decoder_driver_test.c
deleted file mode 100644
index 2e0bc19f..00000000
--- a/mm-video/vidc/vdec/test/decoder_driver_test.c
+++ /dev/null
@@ -1,1189 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "decoder_driver_test.h"
-
-#define DEBUG_PRINT printf
-/************************************************************************/
-/* #DEFINES */
-/************************************************************************/
-
-#define VOP_START_CODE 0x000001B6
-#define SHORT_HEADER_START_CODE 0x00008000
-#define H264_START_CODE 0x00000001
-
-/************************************************************************/
-/* STATIC VARIABLES */
-/************************************************************************/
-
-static int Code_type;
-static int total_frames = 0;
-static unsigned int header_code = 0;
-static pthread_mutex_t read_lock;
-
-static unsigned int read_frame ( unsigned char *dataptr,unsigned int length,
- FILE * inputBufferFile
- );
-static int Read_Buffer_From_DAT_File( unsigned char *dataptr, unsigned int length,
- FILE * inputBufferFile
- );
-
-static unsigned clp2(unsigned x)
-{
- x = x - 1;
- x = x | (x >> 1);
- x = x | (x >> 2);
- x = x | (x >> 4);
- x = x | (x >> 8);
- x = x | (x >>16);
- return x + 1;
-}
-
-static void* video_thread (void *);
-static void* async_thread (void *);
-
-int main (int argc, char **argv)
-{
- struct video_decoder_context *decoder_context = NULL;
- char *file_name = NULL;
- FILE *file_ptr = NULL;
- int temp1 =0,temp2 =0;
- int error = 1;
- unsigned int i = 0;
-
- file_name = argv [1];
- file_ptr = fopen (file_name,"rb");
-
- if (file_ptr == NULL)
- {
- DEBUG_PRINT("\n File is not located ");
- return -1;
- }
-
-
- decoder_context = (struct video_decoder_context *) \
- calloc (sizeof (struct video_decoder_context),1);
-
- decoder_context->outputBufferFile = NULL;
- decoder_context->inputBufferFile = NULL;
- decoder_context->video_driver_fd = -1;
-
- if (decoder_context == NULL)
- {
- return -1;
- }
-
- decoder_context->inputBufferFile = file_ptr;
-
- file_ptr = fopen ("/data/output.yuv","wb");
- if (file_ptr == NULL)
- {
- DEBUG_PRINT("\n File can't be created");
- return -1;
- }
- decoder_context->outputBufferFile = file_ptr;
-
- switch (atoi(argv[2]))
- {
- case 0:
- DEBUG_PRINT("\n MPEG4 codec selected");
- decoder_context->decoder_format = VDEC_CODECTYPE_MPEG4;
- Code_type = 0;
- break;
- case 1:
- DEBUG_PRINT("\n H.263");
- decoder_context->decoder_format = VDEC_CODECTYPE_H263;
- Code_type = 0;
- break;
- case 2:
- DEBUG_PRINT("\n H.264");
- decoder_context->decoder_format = VDEC_CODECTYPE_H264;
- Code_type = 1;
- break;
- default:
- DEBUG_PRINT("\n Wrong codec type");
- error = -1;
- break;
- }
-
- if (error != -1)
- {
- temp1 = atoi(argv[3]);
- temp2 = atoi(argv[4]);
-
- if (((temp1%16) != 0) || ((temp2%16) != 0))
- {
- error = -1;
- }
- else
- {
- decoder_context->video_resoultion.frame_height = temp1;
- decoder_context->video_resoultion.frame_width = temp2;
- }
- }
-
- switch (atoi(argv[5]))
- {
- case 0:
- DEBUG_PRINT("\n No Sink");
- decoder_context->outputBufferFile = NULL;
- break;
- }
-
- if ( error != -1 && (init_decoder (decoder_context) == -1 ))
- {
- DEBUG_PRINT("\n Init decoder fails ");
- error = -1;
- }
- DEBUG_PRINT("\n Decoder open successfull");
-
-
- /*Allocate input and output buffers*/
- if (error != -1 && (allocate_buffer (VDEC_BUFFER_TYPE_INPUT,
- decoder_context)== -1))
- {
- DEBUG_PRINT("\n Error in input Buffer allocation");
- error = -1;
- }
-
- if (error != -1 && (allocate_buffer (VDEC_BUFFER_TYPE_OUTPUT,
- decoder_context)== -1))
- {
- DEBUG_PRINT("\n Error in output Buffer allocation");
- error = -1;
- }
-
-
- if (error != -1 && (start_decoding (decoder_context) == -1))
- {
- DEBUG_PRINT("\n Error in start decoding call");
- error = -1;
- }
-
- if (error != -1 && (stop_decoding (decoder_context) == -1))
- {
- DEBUG_PRINT("\n Error in stop decoding call");
- error = -1;
- }
-
- DEBUG_PRINT("\n De-init the decoder");
- if ((deinit_decoder (decoder_context) == -1))
- {
- error = -1;
- }
-
-
- (void)free_buffer (VDEC_BUFFER_TYPE_INPUT,decoder_context);
- (void)free_buffer (VDEC_BUFFER_TYPE_OUTPUT,decoder_context);
-
- if (decoder_context->inputBufferFile != NULL)
- {
- fclose (decoder_context->inputBufferFile);
- }
- if (decoder_context->outputBufferFile != NULL)
- {
- fclose (decoder_context->outputBufferFile);
- }
- DEBUG_PRINT ("\n Total Number of frames decoded %d",total_frames);
- DEBUG_PRINT("\n closing the driver");
- free (decoder_context);
-
- return error;
-}
-
-int init_decoder ( struct video_decoder_context *init_decode )
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct video_queue_context *queue_ptr = NULL;
- enum vdec_output_fromat output_format = VDEC_YUV_FORMAT_NV12;
- pthread_mutexattr_t init_values;
-
- DEBUG_PRINT("\n Before calling the open");
-
- init_decode->video_driver_fd = open ("/dev/msm_vidc_dec", \
- O_RDWR | O_NONBLOCK);
-
-
-
- if (init_decode->video_driver_fd < 0)
- {
- DEBUG_PRINT("\n Open failed");
- return -1;
- }
-
-
- /*Initialize Decoder with codec type and resolution*/
- ioctl_msg.inputparam = &init_decode->decoder_format;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_SET_CODEC,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set codec type failed");
- return -1;
- }
-
- /*Set the output format*/
- ioctl_msg.inputparam = &output_format;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_SET_OUTPUT_FORMAT,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set output format failed");
- return -1;
- }
-
- ioctl_msg.inputparam = &init_decode->video_resoultion;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_SET_PICRES,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set Resolution failed");
- return -1;
- }
- DEBUG_PRINT("\n After Set Resolution");
-
- DEBUG_PRINT("\n Query Input bufffer requirements");
- /*Get the Buffer requirements for input and output ports*/
-
- init_decode->input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &init_decode->input_buffer;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Requesting for input buffer requirements failed");
- return -1;
- }
-
- DEBUG_PRINT("\n input Size=%d min count =%d actual count = %d", \
- init_decode->input_buffer.buffer_size,\
- init_decode->input_buffer.mincount,\
- init_decode->input_buffer.actualcount);
-
-
- init_decode->input_buffer.buffer_type = VDEC_BUFFER_TYPE_INPUT;
- ioctl_msg.inputparam = &init_decode->input_buffer;
- ioctl_msg.outputparam = NULL;
- init_decode->input_buffer.actualcount = init_decode->input_buffer.mincount + 2;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_SET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set Buffer Requirements Failed");
- return -1;
- }
-
-
- DEBUG_PRINT("\n Query output bufffer requirements");
- init_decode->output_buffer.buffer_type = VDEC_BUFFER_TYPE_OUTPUT;
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &init_decode->output_buffer;
-
- if (ioctl (init_decode->video_driver_fd,VDEC_IOCTL_GET_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Requesting for output buffer requirements failed");
- return -1;
- }
-
- DEBUG_PRINT("\n output Size=%d min count =%d actual count = %d", \
- init_decode->output_buffer.buffer_size,\
- init_decode->output_buffer.mincount,\
- init_decode->output_buffer.actualcount);
-
- /*Create Queue related data structures*/
- queue_ptr = &init_decode->queue_context;
- queue_ptr->commandq_size = 50;
- queue_ptr->dataq_size = 50;
-
- sem_init(&queue_ptr->sem_message,0, 0);
- sem_init(&init_decode->sem_synchronize,0, 0);
-
- pthread_mutexattr_init (&init_values);
- pthread_mutex_init (&queue_ptr->mutex,&init_values);
- pthread_mutex_init (&read_lock,&init_values);
- DEBUG_PRINT("\n create Queues");
- queue_ptr->ptr_cmdq = (struct video_msgq*) \
- calloc (sizeof (struct video_msgq),
- queue_ptr->commandq_size);
- queue_ptr->ptr_dataq = (struct video_msgq*) \
- calloc (sizeof (struct video_msgq),
- queue_ptr->dataq_size
- );
-
- if ( queue_ptr->ptr_cmdq == NULL ||
- queue_ptr->ptr_dataq == NULL
- )
- {
- return -1;
- }
- DEBUG_PRINT("\n create Threads");
- /*Create two threads*/
- if ( (pthread_create (&init_decode->videothread_id,NULL,video_thread,
- init_decode) < 0) ||
- (pthread_create (&init_decode->asyncthread_id,NULL,async_thread,
- init_decode) < 0)
- )
- {
- return -1;
- }
-
- return 1;
-}
-
-
-
-int free_buffer ( enum vdec_buffer buffer_dir,
- struct video_decoder_context *decode_context
- )
-{
- unsigned int buffercount = 0,i=0;
- struct vdec_bufferpayload **ptemp = NULL;
-
- if (decode_context == NULL)
- {
- return -1;
- }
-
- if (buffer_dir == VDEC_BUFFER_TYPE_INPUT && decode_context->ptr_inputbuffer)
- {
- buffercount = decode_context->input_buffer.actualcount;
- ptemp = decode_context->ptr_inputbuffer;
-
- for (i=0;i<buffercount;i++)
- {
- if (ptemp [i])
- {
- if (ptemp [i]->pmem_fd != -1)
- {
- munmap ( ptemp [i]->bufferaddr,ptemp [i]->mmaped_size);
- ptemp [i]->bufferaddr = NULL;
- close (ptemp [i]->pmem_fd);
- }
- free (ptemp [i]);
- ptemp [i] = NULL;
- }
- }
- free (decode_context->ptr_inputbuffer);
- decode_context->ptr_inputbuffer = NULL;
- }
- else if ( buffer_dir == VDEC_BUFFER_TYPE_OUTPUT )
- {
- buffercount = decode_context->output_buffer.actualcount;
- ptemp = decode_context->ptr_outputbuffer;
-
- if (decode_context->ptr_respbuffer)
- {
- for (i=0;i<buffercount;i++)
- {
- if (decode_context->ptr_respbuffer [i])
- {
- free (decode_context->ptr_respbuffer[i]);
- decode_context->ptr_respbuffer [i] = NULL;
- }
- }
- free (decode_context->ptr_respbuffer);
- decode_context->ptr_respbuffer = NULL;
- }
-
- if (ptemp)
- {
- for (i=0;i<buffercount;i++)
- {
- if (ptemp [i])
- {
- if (ptemp [i]->pmem_fd != -1)
- {
- munmap ( ptemp [i]->bufferaddr,ptemp [i]->mmaped_size);
- ptemp [i]->bufferaddr = NULL;
- close (ptemp [i]->pmem_fd);
- }
- free (ptemp [i]);
- ptemp [i] = NULL;
- }
- }
- free (ptemp);
- decode_context->ptr_outputbuffer = NULL;
- }
- }
-
- return 1;
-}
-
-int allocate_buffer ( enum vdec_buffer buffer_dir,
- struct video_decoder_context *decode_context
- )
-{
- struct vdec_setbuffer_cmd setbuffers;
- struct vdec_bufferpayload **ptemp = NULL;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned int buffercount = 0,i=0,alignedsize=0;
- unsigned int buffersize = 0;
-
- if ( decode_context == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: context is NULL");
- return -1;
- }
-
- if ( buffer_dir == VDEC_BUFFER_TYPE_INPUT )
- {
- /*Check if buffers are allocated*/
- if (decode_context->ptr_inputbuffer != NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: decode_context->ptr_inputbuffer is set");
- return -1;
- }
-
- buffercount = decode_context->input_buffer.actualcount;
- alignedsize = decode_context->input_buffer.alignment;
- buffersize = decode_context->input_buffer.buffer_size;
- buffersize = (buffersize + alignedsize) & (~alignedsize);
- }
- else if (buffer_dir == VDEC_BUFFER_TYPE_OUTPUT)
- {
- /*Check if buffers are allocated*/
- if (decode_context->ptr_outputbuffer != NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: Double allcoate output");
- return -1;
- }
-
- buffercount = decode_context->output_buffer.actualcount;
- alignedsize = decode_context->output_buffer.alignment;
- buffersize = decode_context->output_buffer.buffer_size;
- buffersize = (buffersize + alignedsize) & (~alignedsize);
-
- decode_context->ptr_respbuffer = (struct vdec_output_frameinfo **)\
- calloc (sizeof (struct vdec_output_frameinfo *),buffercount);
-
- if (decode_context->ptr_respbuffer == NULL)
- {
- DEBUG_PRINT ("\n Allocate failure ptr_respbuffer");
- }
-
- for (i=0; i< buffercount; i++)
- {
- decode_context->ptr_respbuffer [i] = (struct vdec_output_frameinfo *)\
- calloc (sizeof (struct vdec_output_frameinfo),buffercount);
- if (decode_context->ptr_respbuffer [i] == NULL)
- {
- DEBUG_PRINT ("\nfailed to allocate vdec_output_frameinfo");
- return -1;
- }
- }
- }
- else
- {
- DEBUG_PRINT ("\nallocate_buffer: Wrong buffer directions");
- return -1;
- }
-
- ptemp = (struct vdec_bufferpayload **)\
- calloc (sizeof (struct vdec_bufferpayload *),buffercount);
-
- if (ptemp == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: vdec_bufferpayload failure");
- return -1;
- }
-
-
- if (buffer_dir == VDEC_BUFFER_TYPE_OUTPUT)
- {
- DEBUG_PRINT ("\nallocate_buffer: OUT");
- decode_context->ptr_outputbuffer = ptemp;
- }
- else
- {
- DEBUG_PRINT ("\nallocate_buffer: IN");
- decode_context->ptr_inputbuffer = ptemp;
- }
-
- /*Allocate buffer headers*/
- for (i=0; i< buffercount; i++)
- {
- ptemp [i] = (struct vdec_bufferpayload*)\
- calloc (sizeof (struct vdec_bufferpayload),1);
-
- if (ptemp [i] == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: ptemp [i] calloc failure");
- return -1;
- }
-
- if (buffer_dir == VDEC_BUFFER_TYPE_OUTPUT)
- {
- decode_context->ptr_respbuffer [i]->client_data = \
- (void *) ptemp [i];
- }
- ptemp [i]->pmem_fd = -1;
-
- }
-
- for (i=0; i< buffercount; i++)
- {
- ptemp [i]->pmem_fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (ptemp [i]->pmem_fd < 0)
- {
- DEBUG_PRINT ("\nallocate_buffer: open pmem failed");
- return -1;
- }
-
- ptemp [i]->bufferaddr = mmap(NULL,clp2(buffersize),PROT_READ|PROT_WRITE,
- MAP_SHARED,ptemp [i]->pmem_fd,0);
- DEBUG_PRINT ("\n pmem fd = %d virt addr = %p",ptemp [i]->pmem_fd,\
- ptemp [i]->bufferaddr);
- if (ptemp [i]->bufferaddr == MAP_FAILED)
- {
- ptemp [i]->bufferaddr = NULL;
- DEBUG_PRINT ("\nallocate_buffer: MMAP failed");
- return -1;
- }
- ptemp [i]->buffer_len = buffersize;
- ptemp [i]->mmaped_size = clp2 (buffersize);
-
- setbuffers.buffer_type = buffer_dir;
- memcpy (&setbuffers.buffer,ptemp [i],sizeof (struct vdec_bufferpayload));
-
- ioctl_msg.inputparam = &setbuffers;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_SET_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT ("\nallocate_buffer: Set Buffer IOCTL failed");
- return -1;
- }
-
- }
- DEBUG_PRINT ("\nallocate_buffer: Success");
- return 1;
-}
-
-
-
-int start_decoding (struct video_decoder_context *decode_context)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_input_frameinfo frameinfo;
- struct vdec_fillbuffer_cmd fillbuffer;
- unsigned int i = 0;
- unsigned int data_len =0;
-
- memset ((unsigned char*)&frameinfo,0,sizeof (struct vdec_input_frameinfo));
- memset ((unsigned char*)&fillbuffer,0,sizeof (struct vdec_fillbuffer_cmd));
-
- if (decode_context == NULL)
- {
- return -1;
- }
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_CMD_START,
- NULL) < 0)
- {
- DEBUG_PRINT("\n Start failed");
- return -1;
- }
-
- DEBUG_PRINT("\n Start Issued successfully waiting for Start Done");
- /*Wait for Start command response*/
- sem_wait (&decode_context->sem_synchronize);
-
- /*Push output Buffers*/
- i = 0;
- while (i < decode_context->output_buffer.mincount)
- {
- fillbuffer.buffer.buffer_len =
- decode_context->ptr_outputbuffer [i]->buffer_len;
- fillbuffer.buffer.bufferaddr =
- decode_context->ptr_outputbuffer [i]->bufferaddr;
- fillbuffer.buffer.offset =
- decode_context->ptr_outputbuffer [i]->offset;
- fillbuffer.buffer.pmem_fd =
- decode_context->ptr_outputbuffer [i]->pmem_fd;
- fillbuffer.client_data = (void *)decode_context->ptr_respbuffer [i];
- DEBUG_PRINT ("\n Client Data on output = %p",fillbuffer.client_data);
- ioctl_msg.inputparam = &fillbuffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (decode_context->video_driver_fd,
- VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- return -1;
- }
- i++;
- }
-
-
- /*push input buffers*/
- i = 0;
- while (i < decode_context->input_buffer.mincount)
- {
- DEBUG_PRINT("\n Read Frame from File");
- data_len = read_frame ( decode_context->ptr_inputbuffer [i]->bufferaddr,
- decode_context->ptr_inputbuffer [i]->buffer_len,
- decode_context->inputBufferFile);
- if (data_len == 0)
- {
- DEBUG_PRINT("\n Length is zero error");
- return -1;
- }
- DEBUG_PRINT("\n Read Frame from File szie = %u",data_len);
- frameinfo.bufferaddr =
- decode_context->ptr_inputbuffer [i]->bufferaddr;
- frameinfo.offset = 0;
- frameinfo.pmem_fd = decode_context->ptr_inputbuffer [i]->pmem_fd;
- frameinfo.pmem_offset = decode_context->ptr_inputbuffer [i]->offset;
- frameinfo.datalen = data_len;
- frameinfo.client_data = (struct vdec_bufferpayload *)\
- decode_context->ptr_inputbuffer [i];
- /*TODO: Time stamp needs to be updated*/
- ioctl_msg.inputparam = &frameinfo;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_DECODE_FRAME,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- return -1;
- }
- total_frames++;
- i++;
- }
- DEBUG_PRINT ("\n Wait for EOS");
- /*Wait for EOS or Error condition*/
- sem_wait (&decode_context->sem_synchronize);
- DEBUG_PRINT ("\n Reached EOS");
-
- return 1;
-}
-
-int stop_decoding (struct video_decoder_context *decode_context)
-{
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- enum vdec_bufferflush flush_dir = VDEC_FLUSH_TYPE_INPUT;
-
- if (decode_context == NULL)
- {
- return -1;
- }
-
- ioctl_msg.inputparam = &flush_dir;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(decode_context->video_driver_fd,VDEC_IOCTL_CMD_FLUSH,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Flush input failed");
- }
- else
- {
- sem_wait (&decode_context->sem_synchronize);
- }
-
- flush_dir = VDEC_FLUSH_TYPE_OUTPUT;
- ioctl_msg.inputparam = &flush_dir;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(decode_context->video_driver_fd,VDEC_IOCTL_CMD_FLUSH,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Flush output failed");
- }
- else
- {
- sem_wait (&decode_context->sem_synchronize);
- }
-
- DEBUG_PRINT("\n Stop VDEC_IOCTL_CMD_STOP");
- if (ioctl(decode_context->video_driver_fd,VDEC_IOCTL_CMD_STOP,
- NULL) < 0)
- {
- DEBUG_PRINT("\n Stop failed");
- }
- else
- {
- sem_wait (&decode_context->sem_synchronize);
- }
- return 1;
-}
-
-int deinit_decoder (struct video_decoder_context *init_decode)
-{
- if (init_decode == NULL)
- {
- return -1;
- }
-
- /*Close the driver*/
- if (init_decode->video_driver_fd != -1)
- {
- close (init_decode->video_driver_fd);
- }
-
- if (init_decode->queue_context.ptr_cmdq)
- {
- free (init_decode->queue_context.ptr_cmdq);
- init_decode->queue_context.ptr_cmdq = NULL;
- }
-
- if (init_decode->queue_context.ptr_dataq)
- {
- free (init_decode->queue_context.ptr_dataq);
- init_decode->queue_context.ptr_dataq = NULL;
- }
-
- sem_destroy (&init_decode->queue_context.sem_message);
- sem_destroy (&init_decode->sem_synchronize);
-
- pthread_mutex_destroy(&init_decode->queue_context.mutex);
- pthread_mutex_destroy (&read_lock);
-
- return 1;
-}
-
-static void* video_thread (void *context)
-{
- struct video_decoder_context *decode_context = NULL;
- struct video_msgq *queueitem = NULL;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- struct vdec_input_frameinfo frameinfo;
- struct vdec_fillbuffer_cmd fillbuffer;
- struct vdec_output_frameinfo *outputbuffer = NULL;
- struct vdec_bufferpayload *tempbuffer = NULL;
- unsigned int data_len =0;
-
-
- if (context == NULL)
- {
- DEBUG_PRINT("\n video thread recieved NULL context");
- return NULL;
- }
- decode_context = (struct video_decoder_context *) context;
-
- /* Thread function which will accept commands from async thread
- * or main thread
- */
- while (1)
- {
- queueitem = queue_get_cmd (&decode_context ->queue_context);
- if (queueitem != NULL)
- {
- switch (queueitem->cmd)
- {
- case VDEC_MSG_EVT_HW_ERROR:
- DEBUG_PRINT("\n FATAL ERROR ");
- break;
- case VDEC_MSG_RESP_INPUT_FLUSHED:
- DEBUG_PRINT("\n Input Buffer Flushed");
- break;
- case VDEC_MSG_RESP_OUTPUT_FLUSHED:
- DEBUG_PRINT("\n Output buffer Flushed");
- break;
- case VDEC_MSG_RESP_START_DONE:
- DEBUG_PRINT("\n recived start done command");
- sem_post (&decode_context->sem_synchronize);
- break;
-
- case VDEC_MSG_RESP_STOP_DONE:
- DEBUG_PRINT("\n recieved stop done");
- sem_post (&decode_context->sem_synchronize);
- break;
-
- case VDEC_MSG_RESP_INPUT_BUFFER_DONE:
-
- tempbuffer = (struct vdec_bufferpayload *)queueitem->clientdata;
- if (tempbuffer == NULL)
- {
- DEBUG_PRINT("\n FATAL ERROR input buffer address is bad");
- sem_post (&decode_context->sem_synchronize);
- break;
- }
- data_len = read_frame ( tempbuffer->bufferaddr,
- tempbuffer->buffer_len,
- decode_context->inputBufferFile
- );
-
- if (data_len == 0)
- {
- DEBUG_PRINT ("\n End of stream reached");
- sem_post (&decode_context->sem_synchronize);
- break;
- }
-
- frameinfo.bufferaddr = tempbuffer->bufferaddr;
- frameinfo.offset = 0;
- frameinfo.pmem_fd = tempbuffer->pmem_fd;
- frameinfo.pmem_offset = tempbuffer->offset;
- frameinfo.datalen = data_len;
- frameinfo.client_data = (struct vdec_bufferpayload *)\
- tempbuffer;
- /*TODO: Time stamp needs to be updated*/
- ioctl_msg.inputparam = &frameinfo;
- ioctl_msg.outputparam = NULL;
- total_frames++;
- if (ioctl(decode_context->video_driver_fd,VDEC_IOCTL_DECODE_FRAME,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- sem_post (&decode_context->sem_synchronize);
- }
- DEBUG_PRINT("\n Input buffer done send next buffer current value = %d",\
- total_frames);
- break;
-
- case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE:
-
- outputbuffer = (struct vdec_output_frameinfo *)\
- queueitem->clientdata;
- DEBUG_PRINT("\n Value of client Data in VT %p",queueitem->clientdata);
- if (outputbuffer == NULL || outputbuffer->bufferaddr == NULL ||
- outputbuffer->client_data == NULL
- )
- {
- DEBUG_PRINT("\n FATAL ERROR output buffer is bad");
- DEBUG_PRINT("\nValues outputbuffer = %p",outputbuffer);
- DEBUG_PRINT("\nValues outputbuffer->bufferaddr = %p",\
- outputbuffer->bufferaddr);
- DEBUG_PRINT("\nValues outputbuffer->client_data = %p",\
- outputbuffer->client_data);
- sem_post (&decode_context->sem_synchronize);
- break;
- }
-
-
- if (outputbuffer->len == 0)
- {
- DEBUG_PRINT("\n Filled Length is zero Close decoding");
- sem_post (&decode_context->sem_synchronize);
- break;
- }
-
- if (decode_context->outputBufferFile != NULL)
- {
- fwrite (outputbuffer->bufferaddr,1,outputbuffer->len,
- decode_context->outputBufferFile);
- }
-
- tempbuffer = (struct vdec_bufferpayload *)\
- outputbuffer->client_data;
-
- DEBUG_PRINT("\n recieved output buffer consume outbuffer");
- DEBUG_PRINT("\nValues outputbuffer->bufferaddr = %p",\
- outputbuffer->bufferaddr);
- DEBUG_PRINT ("\n Vir address of allocated buffer %p",\
- tempbuffer->bufferaddr);
- fillbuffer.buffer.buffer_len = tempbuffer->buffer_len;
- fillbuffer.buffer.bufferaddr = tempbuffer->bufferaddr;
- fillbuffer.buffer.offset = tempbuffer->offset;
- fillbuffer.buffer.pmem_fd = tempbuffer->pmem_fd;
- fillbuffer.client_data = (void *)outputbuffer;
-
- ioctl_msg.inputparam = &fillbuffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (decode_context->video_driver_fd,
- VDEC_IOCTL_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- return NULL;
- }
-
- break;
-
- case VDEC_MSG_RESP_FLUSH_INPUT_DONE:
- DEBUG_PRINT("\n Flush input complete");
- sem_post (&decode_context->sem_synchronize);
- break;
-
- case VDEC_MSG_RESP_FLUSH_OUTPUT_DONE:
- DEBUG_PRINT("\n Flush output complete");
- sem_post (&decode_context->sem_synchronize);
- break;
- }
- }
- else
- {
- DEBUG_PRINT("\n Error condition recieved NULL from Queue");
- }
-
- if (queueitem->cmd == VDEC_MSG_RESP_STOP_DONE)
- {
- DEBUG_PRINT("\n Playback has ended thread will exit");
- return NULL;
- }
- }
-}
-
-static void* async_thread (void *context)
-{
- struct video_decoder_context *decode_context = NULL;
- struct vdec_output_frameinfo *outputframe = NULL;
- struct video_msgq queueitem ;
- struct vdec_msginfo vdec_msg;
- struct vdec_ioctl_msg ioctl_msg = {NULL,NULL};
- int result = -1;
-
- if (context == NULL)
- {
- DEBUG_PRINT("\n aynsc thread recieved NULL context");
- return NULL;
- }
- decode_context = (struct video_decoder_context *) context;
- DEBUG_PRINT("\n Entering the async thread");
-
- while (1)
- {
- ioctl_msg.inputparam = NULL;
-
- ioctl_msg.outputparam = (void*)&vdec_msg;
- DEBUG_PRINT ("\n Sizeof vdec_msginfo = %d ",sizeof (vdec_msg));
- DEBUG_PRINT("\n Address of Vdec msg in async thread %p",\
- ioctl_msg.outputparam);
- if (ioctl (decode_context->video_driver_fd,VDEC_IOCTL_GET_NEXT_MSG,\
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Error in ioctl read next msg");
- }
- else
- {
- switch (vdec_msg.msgcode)
- {
- case VDEC_MSG_RESP_FLUSH_INPUT_DONE:
- case VDEC_MSG_RESP_FLUSH_OUTPUT_DONE:
- case VDEC_MSG_RESP_START_DONE:
- case VDEC_MSG_RESP_STOP_DONE:
- case VDEC_MSG_EVT_HW_ERROR:
- DEBUG_PRINT("\nioctl read next msg");
- queueitem.cmd = vdec_msg.msgcode;
- queueitem.status = vdec_msg.status_code;
- queueitem.clientdata = NULL;
- break;
-
- case VDEC_MSG_RESP_INPUT_FLUSHED:
- case VDEC_MSG_RESP_INPUT_BUFFER_DONE:
-
- queueitem.cmd = vdec_msg.msgcode;
- queueitem.status = vdec_msg.status_code;
- queueitem.clientdata = (void *)\
- vdec_msg.msgdata.input_frame_clientdata;
- break;
-
- case VDEC_MSG_RESP_OUTPUT_FLUSHED:
- case VDEC_MSG_RESP_OUTPUT_BUFFER_DONE:
- queueitem.cmd = vdec_msg.msgcode;
- queueitem.status = vdec_msg.status_code;
- outputframe = (struct vdec_output_frameinfo *)\
- vdec_msg.msgdata.output_frame.client_data;
- DEBUG_PRINT ("\n Client Data value in %p", \
- vdec_msg.msgdata.output_frame.client_data);
- outputframe->bufferaddr = vdec_msg.msgdata.output_frame.bufferaddr;
- outputframe->framesize.bottom = \
- vdec_msg.msgdata.output_frame.framesize.bottom;
- outputframe->framesize.left = \
- vdec_msg.msgdata.output_frame.framesize.left;
- outputframe->framesize.right = \
- vdec_msg.msgdata.output_frame.framesize.right;
- outputframe->framesize.top = \
- vdec_msg.msgdata.output_frame.framesize.top;
- outputframe->framesize = vdec_msg.msgdata.output_frame.framesize;
- outputframe->len = vdec_msg.msgdata.output_frame.len;
- outputframe->time_stamp = vdec_msg.msgdata.output_frame.time_stamp;
- queueitem.clientdata = (void *)outputframe;
- DEBUG_PRINT ("\n Client Data value Copy %p",queueitem.clientdata);
- break;
-
- default:
- DEBUG_PRINT("\nIn Default of get next message %d",vdec_msg.msgcode);
- queueitem.cmd = vdec_msg.msgcode;
- queueitem.status = vdec_msg.status_code;
- queueitem.clientdata = NULL;
- break;
- }
- result = queue_post_cmdq (&decode_context->queue_context,&queueitem);
- while (result == 0)
- {
- result = queue_post_cmdq (&decode_context->queue_context,
- &queueitem);
- }
-
- if (result == -1)
- {
- DEBUG_PRINT("\n FATAL ERROR WITH Queue");
- }
- }
- if (vdec_msg.msgcode == VDEC_MSG_RESP_STOP_DONE)
- {
- /*Thread can exit at this point*/
- return NULL;
- }
- }
-}
-
-
-static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
- FILE * inputBufferFile)
-{
-
- unsigned int readOffset = 0;
- int bytes_read = 0;
- unsigned int code = 0;
- int found = 0;
-
- DEBUG_PRINT ("\n Inside the readframe");
-
- if (dataptr == NULL && length == 0)
- {
- DEBUG_PRINT ("\n dataptr = %p length = %u",dataptr,length);
- return 0;
- }
-
- if (!Code_type)
- {
- /* Start of Critical Section*/
- pthread_mutex_lock(&read_lock);
- do
- {
- //Start codes are always byte aligned.
- bytes_read = fread(&dataptr[readOffset],1, 1,inputBufferFile);
- if( !bytes_read)
- {
- DEBUG_PRINT("\n Bytes read Zero \n");
- break;
- }
- code <<= 8;
- code |= (0x000000FF & dataptr[readOffset]);
- //VOP start code comparision
- if (readOffset>3)
- {
- if(!header_code )
- {
- if( VOP_START_CODE == code)
- {
- DEBUG_PRINT ("\n Found VOP Code");
- header_code = VOP_START_CODE;
- }
- else if ( (0xFFFFFC00 & code) == SHORT_HEADER_START_CODE )
- {
- header_code = SHORT_HEADER_START_CODE;
- }
- }
- if ((header_code == VOP_START_CODE) && (code == VOP_START_CODE))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=4;
- found = 1;
- break;
-
- }
- else if (( header_code == SHORT_HEADER_START_CODE ) &&
- ( SHORT_HEADER_START_CODE == (code & 0xFFFFFC00)))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=4;
- found = 1;
- break;
- }
- }
- readOffset++;
- }while (readOffset < length);
- pthread_mutex_unlock(&read_lock);
- /* End of Critical Section*/
- if (found == 1)
- {
- //DEBUG_PRINT ("Found a Frame");
- return (readOffset+1);
- }
- else
- {
- //DEBUG_PRINT ("No Frames detected");
- return 0;
- }
- }
- else
- {
-
- readOffset = Read_Buffer_From_DAT_File(dataptr,length,inputBufferFile);
- if (total_frames == 0)
- {
- bytes_read = Read_Buffer_From_DAT_File(&dataptr[readOffset],
- (length-readOffset),
- inputBufferFile);
- readOffset += bytes_read;
- }
- return (readOffset);
- }
-
-}
-
-static int Read_Buffer_From_DAT_File(unsigned char *dataptr, unsigned int length,
- FILE * inputBufferFile)
-{
-
-
- long frameSize=0;
- char temp_buffer[10];
- char temp_byte;
- int bytes_read=0;
- int i=0;
- unsigned char *read_buffer=NULL;
- char c = '1'; //initialize to anything except '\0'(0)
- char inputFrameSize[10];
- int count =0; int cnt =0;
- memset(temp_buffer, 0, sizeof(temp_buffer));
-
- while (cnt < 10)
- /* Check the input file format, may result in infinite loop */
- {
- count = fread(&inputFrameSize[cnt],1,1,inputBufferFile);
- if(inputFrameSize[cnt] == '\0' )
- break;
- cnt++;
- }
- inputFrameSize[cnt]='\0';
- frameSize = atoi(inputFrameSize);
- //length = 0;
- DEBUG_PRINT ("\n Frame Size is %ld",frameSize);
-
- /* get the frame length */
- fseek(inputBufferFile, -1, SEEK_CUR);
- bytes_read = fread(dataptr, 1, frameSize, inputBufferFile);
-
- if(bytes_read == 0 || bytes_read < frameSize ) {
- return 0;
- }
- return bytes_read;
-}
diff --git a/mm-video/vidc/vdec/test/omx_vdec_test.cpp b/mm-video/vidc/vdec/test/omx_vdec_test.cpp
deleted file mode 100644
index b528fbcd..00000000
--- a/mm-video/vidc/vdec/test/omx_vdec_test.cpp
+++ /dev/null
@@ -1,2470 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*
- An Open max test application ....
-*/
-
-#define LOG_TAG "OMX-VDEC-TEST"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include "OMX_QCOMExtns.h"
-
-#ifdef _ANDROID_
-#include <binder/MemoryHeapBase.h>
-
-extern "C"{
-#include<utils/Log.h>
-}
-#define DEBUG_PRINT
-#define DEBUG_PRINT_ERROR
-
-#else
-#define DEBUG_PRINT printf
-#define DEBUG_PRINT_ERROR printf
-#endif /* _ANDROID_ */
-
-#include "OMX_Core.h"
-#include "OMX_Component.h"
-#include "OMX_QCOMExtns.h"
-extern "C" {
-#include "queue.h"
-}
-
-#include <linux/msm_mdp.h>
-#include <linux/fb.h>
-//#include "qutility.h"
-
-#define DEBUG_PRINT(...) printf(__VA_ARGS__)
-#define DEBUG_PRINT_ERROR(...) printf(__VA_ARGS__)
-#define DEBUG_PRINT_LOW(...) printf(__VA_ARGS__)
-
-/************************************************************************/
-/* #DEFINES */
-/************************************************************************/
-#define DELAY 66
-#define false 0
-#define true 1
-#define VOP_START_CODE 0x000001B6
-#define SHORT_HEADER_START_CODE 0x00008000
-#define VC1_START_CODE 0x00000100
-#define VC1_FRAME_START_CODE 0x0000010D
-#define NUMBER_OF_ARBITRARYBYTES_READ (4 * 1024)
-#define VC1_SEQ_LAYER_SIZE_WITHOUT_STRUCTC 32
-#define VC1_SEQ_LAYER_SIZE_V1_WITHOUT_STRUCTC 16
-
-#define CONFIG_VERSION_SIZE(param) \
- param.nVersion.nVersion = CURRENT_OMX_SPEC_VERSION;\
- param.nSize = sizeof(param);
-
-#define FAILED(result) (result != OMX_ErrorNone)
-
-#define SUCCEEDED(result) (result == OMX_ErrorNone)
-#define SWAPBYTES(ptrA, ptrB) { char t = *ptrA; *ptrA = *ptrB; *ptrB = t;}
-#define SIZE_NAL_FIELD_MAX 4
-#define MDP_DEINTERLACE 0x80000000
-
-/************************************************************************/
-/* GLOBAL DECLARATIONS */
-/************************************************************************/
-#ifdef _ANDROID_
-using namespace android;
-#endif
-
-typedef enum {
- CODEC_FORMAT_H264 = 1,
- CODEC_FORMAT_MP4,
- CODEC_FORMAT_H263,
- CODEC_FORMAT_VC1,
- CODEC_FORMAT_MAX = CODEC_FORMAT_VC1
-} codec_format;
-
-typedef enum {
- FILE_TYPE_DAT_PER_AU = 1,
- FILE_TYPE_ARBITRARY_BYTES,
- FILE_TYPE_COMMON_CODEC_MAX,
-
- FILE_TYPE_START_OF_H264_SPECIFIC = 10,
- FILE_TYPE_264_NAL_SIZE_LENGTH = FILE_TYPE_START_OF_H264_SPECIFIC,
-
- FILE_TYPE_START_OF_MP4_SPECIFIC = 20,
- FILE_TYPE_PICTURE_START_CODE = FILE_TYPE_START_OF_MP4_SPECIFIC,
-
- FILE_TYPE_START_OF_VC1_SPECIFIC = 30,
- FILE_TYPE_RCV = FILE_TYPE_START_OF_VC1_SPECIFIC,
- FILE_TYPE_VC1
-} file_type;
-
-typedef enum {
- GOOD_STATE = 0,
- PORT_SETTING_CHANGE_STATE,
- ERROR_STATE,
- INVALID_STATE
-} test_status;
-
-typedef enum {
- FREE_HANDLE_AT_LOADED = 1,
- FREE_HANDLE_AT_IDLE,
- FREE_HANDLE_AT_EXECUTING,
- FREE_HANDLE_AT_PAUSE
-} freeHandle_test;
-
-static int (*Read_Buffer)(OMX_BUFFERHEADERTYPE *pBufHdr );
-
-FILE * inputBufferFile;
-FILE * outputBufferFile;
-FILE * seqFile;
-int takeYuvLog = 0;
-int displayWindow = 0;
-int realtime_display = 0;
-struct timeval t_avsync={0,0};
-
-Queue *etb_queue = NULL;
-Queue *fbd_queue = NULL;
-
-pthread_t ebd_thread_id;
-pthread_t fbd_thread_id;
-void* ebd_thread(void*);
-void* fbd_thread(void*);
-
-pthread_mutex_t etb_lock;
-pthread_mutex_t fbd_lock;
-pthread_mutex_t lock;
-pthread_cond_t cond;
-pthread_mutex_t elock;
-pthread_cond_t econd;
-pthread_cond_t fcond;
-pthread_mutex_t eos_lock;
-pthread_cond_t eos_cond;
-
-sem_t etb_sem;
-sem_t fbd_sem;
-sem_t seq_sem;
-sem_t in_flush_sem, out_flush_sem;
-
-OMX_PARAM_PORTDEFINITIONTYPE portFmt;
-OMX_PORT_PARAM_TYPE portParam;
-OMX_ERRORTYPE error;
-
-#define CLR_KEY 0xe8fd
-#define COLOR_BLACK_RGBA_8888 0x00000000
-#define FRAMEBUFFER_32
-
-static int fb_fd = -1;
-static struct fb_var_screeninfo vinfo;
-static struct fb_fix_screeninfo finfo;
-static int vid_buf_front_id;
-int overlay_fb(struct OMX_BUFFERHEADERTYPE *pBufHdr);
-void overlay_set();
-void overlay_unset();
-void render_fb(struct OMX_BUFFERHEADERTYPE *pBufHdr);
-
-/************************************************************************/
-/* GLOBAL INIT */
-/************************************************************************/
-unsigned int input_buf_cnt = 0;
-int height =0, width =0;
-int sliceheight = 0, stride = 0;
-int used_ip_buf_cnt = 0;
-volatile int event_is_done = 0;
-int ebd_cnt, fbd_cnt;
-int bInputEosReached = 0;
-int bOutputEosReached = 0;
-char in_filename[512];
-char seq_file_name[512];
-unsigned char seq_enabled = 0, flush_in_progress = 0;
-unsigned int cmd_data = 0, etb_count = 0;;
-
-char curr_seq_command[100];
-int timeStampLfile = 0;
-int timestampInterval = 33333;
-codec_format codec_format_option;
-file_type file_type_option;
-freeHandle_test freeHandle_option;
-int nalSize;
-int sent_disabled = 0;
-int waitForPortSettingsChanged = 1;
-test_status currentStatus = GOOD_STATE;
-
-//* OMX Spec Version supported by the wrappers. Version = 1.1 */
-const OMX_U32 CURRENT_OMX_SPEC_VERSION = 0x00000101;
-OMX_COMPONENTTYPE* dec_handle = 0;
-
-OMX_BUFFERHEADERTYPE **pInputBufHdrs = NULL;
-OMX_BUFFERHEADERTYPE **pOutYUVBufHdrs= NULL;
-
-int rcv_v1=0;
-
-/* Performance related variable*/
-//QPERF_INIT(render_fb);
-//QPERF_INIT(client_decode);
-
-/************************************************************************/
-/* GLOBAL FUNC DECL */
-/************************************************************************/
-int Init_Decoder();
-int Play_Decoder();
-int run_tests();
-
-/**************************************************************************/
-/* STATIC DECLARATIONS */
-/**************************************************************************/
-static int video_playback_count = 1;
-static int open_video_file ();
-static int Read_Buffer_From_DAT_File(OMX_BUFFERHEADERTYPE *pBufHdr );
-static int Read_Buffer_ArbitraryBytes(OMX_BUFFERHEADERTYPE *pBufHdr);
-static int Read_Buffer_From_Vop_Start_Code_File(OMX_BUFFERHEADERTYPE *pBufHdr);
-static int Read_Buffer_From_Size_Nal(OMX_BUFFERHEADERTYPE *pBufHdr);
-static int Read_Buffer_From_RCV_File_Seq_Layer(OMX_BUFFERHEADERTYPE *pBufHdr);
-static int Read_Buffer_From_RCV_File(OMX_BUFFERHEADERTYPE *pBufHdr);
-static int Read_Buffer_From_VC1_File(OMX_BUFFERHEADERTYPE *pBufHdr);
-
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *dec_handle,
- OMX_BUFFERHEADERTYPE ***pBufHdrs,
- OMX_U32 nPortIndex,
- long bufCntMin, long bufSize);
-
-
-static OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData);
-static OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
-static OMX_ERRORTYPE FillBufferDone(OMX_OUT OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_PTR pAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
-
-static void do_freeHandle_and_clean_up(bool isDueToError);
-
-/*static usecs_t get_time(void)
-{
- struct timeval tv;
- gettimeofday(&tv, 0);
- return ((usecs_t)tv.tv_usec) +
- (((usecs_t)tv.tv_sec) * ((usecs_t)1000000));
-}*/
-
-
-void wait_for_event(void)
-{
- DEBUG_PRINT("Waiting for event\n");
- pthread_mutex_lock(&lock);
- while (event_is_done == 0) {
- pthread_cond_wait(&cond, &lock);
- }
- event_is_done = 0;
- pthread_mutex_unlock(&lock);
- DEBUG_PRINT("Running .... get the event\n");
-}
-
-void event_complete(void )
-{
- pthread_mutex_lock(&lock);
- if (event_is_done == 0) {
- event_is_done = 1;
- pthread_cond_broadcast(&cond);
- }
- pthread_mutex_unlock(&lock);
-}
-int get_next_command(FILE *seq_file)
-{
- int i = -1;
- do{
- i++;
- if(fread(&curr_seq_command[i], 1, 1, seq_file) != 1)
- return -1;
- }while(curr_seq_command[i] != '\n');
- curr_seq_command[i] = 0;
- printf("\n cmd_str = %s", curr_seq_command);
- return 0;
-}
-
-void process_current_command(const char *seq_command)
-{
- char *data_str = NULL;
- unsigned int data = 0, bufCnt = 0, i = 0;
- int frameSize;
- OMX_ERRORTYPE ret;
-
- if(strstr(seq_command, "pause") == seq_command)
- {
- printf("\n\n $$$$$ PAUSE $$$$$");
- data_str = (char*)seq_command + strlen("pause") + 1;
- data = atoi(data_str);
- printf("\n After frame number %u", data);
- cmd_data = data;
- sem_wait(&seq_sem);
- printf("\n Sending PAUSE cmd to OMX compt");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StatePause,0);
- wait_for_event();
- printf("\n EventHandler for PAUSE DONE");
- }
- else if(strstr(seq_command, "sleep") == seq_command)
- {
- printf("\n\n $$$$$ SLEEP $$$$$");
- data_str = (char*)seq_command + strlen("sleep") + 1;
- data = atoi(data_str);
- printf("\n Sleep Time = %u ms", data);
- usleep(data*1000);
- }
- else if(strstr(seq_command, "resume") == seq_command)
- {
- printf("\n\n $$$$$ RESUME $$$$$");
- printf("\n Immediate effect");
- printf("\n Sending PAUSE cmd to OMX compt");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
- wait_for_event();
- printf("\n EventHandler for RESUME DONE");
- }
- else if(strstr(seq_command, "flush") == seq_command)
- {
- printf("\n\n $$$$$ FLUSH $$$$$");
- data_str = (char*)seq_command + strlen("flush") + 1;
- data = atoi(data_str);
- printf("\n After frame number %u", data);
- cmd_data = data;
- sem_wait(&seq_sem);
- printf("\n Sending FLUSH cmd to OMX compt");
- flush_in_progress = 1;
- OMX_SendCommand(dec_handle, OMX_CommandFlush, OMX_ALL, 0);
- wait_for_event();
- flush_in_progress = 0;
- printf("\n EventHandler for FLUSH DONE");
- printf("\n Post EBD_thread flush sem");
- sem_post(&in_flush_sem);
- printf("\n Post FBD_thread flush sem");
- sem_post(&out_flush_sem);
- }
- else
- {
- printf("\n\n $$$$$ INVALID CMD $$$$$");
- printf("\n seq_command[%s] is invalid", seq_command);
- seq_enabled = 0;
- }
-}
-
-void* ebd_thread(void* pArg)
-{
- while(currentStatus != INVALID_STATE)
- {
- int readBytes =0;
- OMX_BUFFERHEADERTYPE* pBuffer = NULL;
-
- if(flush_in_progress)
- {
- printf("\n EBD_thread flush wait start");
- sem_wait(&in_flush_sem);
- printf("\n EBD_thread flush wait complete");
- }
-
- sem_wait(&etb_sem);
- pthread_mutex_lock(&etb_lock);
- pBuffer = (OMX_BUFFERHEADERTYPE *) pop(etb_queue);
- pthread_mutex_unlock(&etb_lock);
- if(pBuffer == NULL)
- {
- DEBUG_PRINT_ERROR("Error - No etb pBuffer to dequeue\n");
- continue;
- }
-
- pBuffer->nOffset = 0;
- if((readBytes = Read_Buffer(pBuffer)) > 0) {
- pBuffer->nFilledLen = readBytes;
- OMX_EmptyThisBuffer(dec_handle,pBuffer);
- etb_count++;
- if(cmd_data == etb_count)
- {
- sem_post(&seq_sem);
- printf("\n Posted seq_sem");
- }
- }
- else
- {
- pBuffer->nFlags |= OMX_BUFFERFLAG_EOS;
- bInputEosReached = true;
- pBuffer->nFilledLen = readBytes;
- OMX_EmptyThisBuffer(dec_handle,pBuffer);
- DEBUG_PRINT("EBD::Either EOS or Some Error while reading file\n");
- etb_count++;
- if(cmd_data == etb_count)
- {
- sem_post(&seq_sem);
- printf("\n Posted seq_sem");
- }
- break;
- }
- }
- return NULL;
-}
-
-void* fbd_thread(void* pArg)
-{
- while(currentStatus != INVALID_STATE)
- {
- long current_avsync_time = 0, delta_time = 0;
- int canDisplay = 1;
- static int contigous_drop_frame = 0;
- static long base_avsync_time = 0;
- static long base_timestamp = 0;
- long lipsync_time = 250000;
- int bytes_written = 0;
- OMX_BUFFERHEADERTYPE *pBuffer;
-
- if(flush_in_progress)
- {
- printf("\n FBD_thread flush wait start");
- sem_wait(&out_flush_sem);
- printf("\n FBD_thread flush wait complete");
- }
-
- sem_wait(&fbd_sem);
- DEBUG_PRINT("Inside %s fbd_cnt[%d] \n", __FUNCTION__, fbd_cnt);
-
- fbd_cnt++;
- pthread_mutex_lock(&fbd_lock);
- pBuffer = (OMX_BUFFERHEADERTYPE *) pop(fbd_queue);
- pthread_mutex_unlock(&fbd_lock);
- if (pBuffer == NULL)
- {
- DEBUG_PRINT("Error - No pBuffer to dequeue\n");
- continue;
- }
-
- /*********************************************
- Write the output of the decoder to the file.
- *********************************************/
-
- if (sent_disabled)
- {
- DEBUG_PRINT("Ignoring FillBufferDone\n");
- continue;
- }
-
- if (realtime_display)
- {
- if(!gettimeofday(&t_avsync,NULL))
- {
- current_avsync_time =(t_avsync.tv_sec*1000000)+t_avsync.tv_usec;
- }
-
- if (base_avsync_time != 0)
- {
- pthread_mutex_lock(&fbd_lock);
- delta_time = (current_avsync_time - base_avsync_time) - ((long)pBuffer->nTimeStamp - base_timestamp);
- if (delta_time < 0 )
- {
- DEBUG_PRINT_ERROR("Sleep %d us. AV Sync time is left behind\n",
- -delta_time);
- usleep(-delta_time);
- canDisplay = 1;
- }
- else if ((delta_time>lipsync_time) && (contigous_drop_frame < 6))
- {
- DEBUG_PRINT_ERROR("Error - Drop the frame at the renderer. Video frame with ts %lu usec behind by %ld usec"
- ", pBuffer->nFilledLen %u\n",
- (unsigned long)pBuffer->nTimeStamp, delta_time, pBuffer->nFilledLen);
- canDisplay = 0;
- contigous_drop_frame++;
- }
- else
- {
- canDisplay = 1;
- }
- pthread_mutex_unlock(&fbd_lock);
- }
- else
- {
- base_avsync_time = current_avsync_time;
- base_timestamp = (long)pBuffer->nTimeStamp;
- }
- }
-
- if (!flush_in_progress && takeYuvLog) {
- pthread_mutex_lock(&fbd_lock);
- bytes_written = fwrite((const char *)pBuffer->pBuffer,
- pBuffer->nFilledLen,1,outputBufferFile);
- pthread_mutex_unlock(&fbd_lock);
- if (bytes_written < 0) {
- DEBUG_PRINT("\nFillBufferDone: Failed to write to the file\n");
- }
- else {
- DEBUG_PRINT("\nFillBufferDone: Wrote %d YUV bytes to the file\n",
- bytes_written);
- }
- }
-
- /********************************************************************/
- /* De-Initializing the open max and relasing the buffers and */
- /* closing the files.*/
- /********************************************************************/
- if (pBuffer->nFlags & OMX_BUFFERFLAG_EOS ) {
- DEBUG_PRINT("***************************************************\n");
- DEBUG_PRINT("FillBufferDone: End Of Stream Reached\n");
- DEBUG_PRINT("***************************************************\n");
- pthread_mutex_lock(&eos_lock);
- bOutputEosReached = true;
- pthread_cond_broadcast(&eos_cond);
- pthread_mutex_unlock(&eos_lock);
- //QPERF_END(client_decode);
- //QPERF_SET_ITERATION(client_decode, fbd_cnt);
- DEBUG_PRINT("***************************************************\n");
- DEBUG_PRINT("FBD_THREAD bOutputEosReached %d\n",bOutputEosReached);
- break;
- }
- OMX_FillThisBuffer(dec_handle, pBuffer);
- }
- return NULL;
-}
-
-OMX_ERRORTYPE EventHandler(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData)
-{
- DEBUG_PRINT("Function %s \n", __FUNCTION__);
-
- switch(eEvent) {
- case OMX_EventCmdComplete:
- DEBUG_PRINT("\n OMX_EventCmdComplete \n");
- // check nData1 for DISABLE event
- if(OMX_CommandPortDisable == (OMX_COMMANDTYPE)nData1)
- {
- DEBUG_PRINT("*********************************************\n");
- DEBUG_PRINT("Recieved DISABLE Event Command Complete[%d]\n",nData2);
- DEBUG_PRINT("*********************************************\n");
- sent_disabled = 0;
- }
- else if(OMX_CommandPortEnable == (OMX_COMMANDTYPE)nData1)
- {
- DEBUG_PRINT("*********************************************\n");
- DEBUG_PRINT("Recieved ENABLE Event Command Complete[%d]\n",nData2);
- DEBUG_PRINT("*********************************************\n");
- }
- currentStatus = GOOD_STATE;
- event_complete();
- break;
-
- case OMX_EventError:
- DEBUG_PRINT("OMX_EventError \n");
- currentStatus = ERROR_STATE;
- if (OMX_ErrorInvalidState == (OMX_ERRORTYPE)nData1 ||
- OMX_ErrorHardware == (OMX_ERRORTYPE)nData1)
- {
- DEBUG_PRINT("Invalid State or hardware error \n");
- currentStatus = INVALID_STATE;
- if(event_is_done == 0)
- {
- DEBUG_PRINT("Event error in the middle of Decode \n");
- pthread_mutex_lock(&eos_lock);
- bOutputEosReached = true;
- pthread_cond_broadcast(&eos_cond);
- pthread_mutex_unlock(&eos_lock);
-
- }
- }
-
- event_complete();
- break;
- case OMX_EventPortSettingsChanged:
- DEBUG_PRINT("OMX_EventPortSettingsChanged port[%d]\n",nData1);
- waitForPortSettingsChanged = 0;
- currentStatus = PORT_SETTING_CHANGE_STATE;
- // reset the event
- event_complete();
- break;
-
- default:
- DEBUG_PRINT_ERROR("ERROR - Unknown Event \n");
- break;
- }
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE EmptyBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
- int readBytes =0; int bufCnt=0;
- OMX_ERRORTYPE result;
-
- DEBUG_PRINT("Function %s cnt[%d]\n", __FUNCTION__, ebd_cnt);
- ebd_cnt++;
-
-
- if(bInputEosReached) {
- DEBUG_PRINT("*****EBD:Input EoS Reached************\n");
- return OMX_ErrorNone;
- }
-
- pthread_mutex_lock(&etb_lock);
- if(push(etb_queue, (void *) pBuffer) < 0)
- {
- DEBUG_PRINT_ERROR("Error in enqueue ebd data\n");
- return OMX_ErrorUndefined;
- }
- pthread_mutex_unlock(&etb_lock);
- sem_post(&etb_sem);
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE FillBufferDone(OMX_OUT OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_PTR pAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer)
-{
- DEBUG_PRINT("Inside %s callback_count[%d] \n", __FUNCTION__, fbd_cnt);
-
- /* Test app will assume there is a dynamic port setting
- * In case that there is no dynamic port setting, OMX will not call event cb,
- * instead OMX will send empty this buffer directly and we need to clear an event here
- */
- if(waitForPortSettingsChanged)
- {
- currentStatus = GOOD_STATE;
- waitForPortSettingsChanged = 0;
-
- event_complete();
- }
-
- if(!sent_disabled)
- {
- pthread_mutex_lock(&fbd_lock);
- if(push(fbd_queue, (void *)pBuffer) < 0)
- {
- DEBUG_PRINT_ERROR("Error in enqueueing fbd_data\n");
- return OMX_ErrorUndefined;
- }
- pthread_mutex_unlock(&fbd_lock);
- sem_post(&fbd_sem);
- }
- return OMX_ErrorNone;
-}
-
-int main(int argc, char **argv)
-{
- int i=0;
- int bufCnt=0;
- int num=0;
- int outputOption = 0;
- int test_option = 0;
- OMX_ERRORTYPE result;
-
- if (argc < 2)
- {
- printf("To use it: ./mm-vdec-omx-test <clip location> \n");
- printf("Command line argument is also available\n");
- return -1;
- }
-
- strncpy(in_filename, argv[1], strlen(argv[1])+1);
-
- if(argc > 5)
- {
- codec_format_option = (codec_format)atoi(argv[2]);
- file_type_option = (file_type)atoi(argv[3]);
- }
- else
- {
- printf("Command line argument is available\n");
- printf("To use it: ./mm-vdec-omx-test <clip location> <codec_type> \n");
- printf(" <input_type: 1. per AU(.dat), 2. arbitrary, 3.per NAL/frame>\n");
- printf(" <output_type> <test_case> <size_nal if H264>\n\n\n");
-
- printf(" *********************************************\n");
- printf(" ENTER THE TEST CASE YOU WOULD LIKE TO EXECUTE\n");
- printf(" *********************************************\n");
- printf(" 1--> H264\n");
- printf(" 2--> MP4\n");
- printf(" 3--> H263\n");
- printf(" 4--> VC1\n");
- fflush(stdin);
- scanf("%d", (int *)&codec_format_option);
- fflush(stdin);
-
- if (codec_format_option > CODEC_FORMAT_MAX)
- {
- printf(" Wrong test case...[%d] \n", codec_format_option);
- return -1;
- }
-
- printf(" *********************************************\n");
- printf(" ENTER THE TEST CASE YOU WOULD LIKE TO EXECUTE\n");
- printf(" *********************************************\n");
- printf(" 1--> PER ACCESS UNIT CLIP (.dat). Clip only available for H264 and Mpeg4\n");
- printf(" 2--> ARBITRARY BYTES (need .264/.264c/.mv4/.263/.rcv/.vc1)\n");
- if (codec_format_option == CODEC_FORMAT_H264)
- {
- printf(" 3--> NAL LENGTH SIZE CLIP (.264c)\n");
- }
- else if ( (codec_format_option == CODEC_FORMAT_MP4) || (codec_format_option == CODEC_FORMAT_H263) )
- {
- printf(" 3--> MP4 VOP or H263 P0 SHORT HEADER START CODE CLIP (.m4v or .263)\n");
- }
- else if (codec_format_option == CODEC_FORMAT_VC1)
- {
- printf(" 3--> VC1 clip Simple/Main Profile (.rcv)\n");
- printf(" 4--> VC1 clip Advance Profile (.vc1)\n");
- }
- fflush(stdin);
- scanf("%d", (int *)&file_type_option);
- fflush(stdin);
- }
-
- if (file_type_option >= FILE_TYPE_COMMON_CODEC_MAX)
- {
- switch (codec_format_option)
- {
- case CODEC_FORMAT_H264:
- file_type_option = (file_type)(FILE_TYPE_START_OF_H264_SPECIFIC + file_type_option - FILE_TYPE_COMMON_CODEC_MAX);
- break;
- case CODEC_FORMAT_MP4:
- case CODEC_FORMAT_H263:
- file_type_option = (file_type)(FILE_TYPE_START_OF_MP4_SPECIFIC + file_type_option - FILE_TYPE_COMMON_CODEC_MAX);
- break;
- case CODEC_FORMAT_VC1:
- file_type_option = (file_type)(FILE_TYPE_START_OF_VC1_SPECIFIC + file_type_option - FILE_TYPE_COMMON_CODEC_MAX);
- break;
- default:
- printf("Error: Unknown code %d\n", codec_format_option);
- }
- }
-
- if(argc > 5)
- {
- outputOption = atoi(argv[4]);
- test_option = atoi(argv[5]);
- if (argc > 6)
- {
- nalSize = atoi(argv[6]);
- }
- else
- {
- nalSize = 0;
- }
-
- if(argc > 7)
- {
- displayWindow = atoi(argv[7]);
- if(displayWindow > 0)
- {
- printf(" Curently display window 0 only supported; ignoring other values\n");
- displayWindow = 0;
- }
- }
- else
- {
- displayWindow = 0;
- }
-
- if(file_type_option == FILE_TYPE_PICTURE_START_CODE ||
- file_type_option == FILE_TYPE_RCV ||
- (file_type_option == FILE_TYPE_VC1 && argc > 8))
- {
- realtime_display = atoi(argv[8]);
- }
-
- if(realtime_display)
- {
- takeYuvLog = 0;
- if(argc > 9)
- {
- int fps = atoi(argv[9]);
- timestampInterval = 1000000/fps;
- }
- else if(argc > 10)
- {
- strncpy(seq_file_name, argv[10], strlen(argv[10])+1);
- }
- }
- else
- {
- if(argc > 9)
- {
- strncpy(seq_file_name, argv[9], strlen(argv[9])+1);
- }
- }
- height=144;width=176; // Assume Default as QCIF
- sliceheight = 144;
- stride = 176;
- printf("Executing DynPortReconfig QCIF 144 x 176 \n");
- }
- else
- {
- int fps = 30;
- switch(file_type_option)
- {
- case FILE_TYPE_DAT_PER_AU:
- case FILE_TYPE_ARBITRARY_BYTES:
- case FILE_TYPE_264_NAL_SIZE_LENGTH:
- case FILE_TYPE_PICTURE_START_CODE:
- case FILE_TYPE_RCV:
- case FILE_TYPE_VC1:
- {
- nalSize = 0;
- if ((file_type_option == FILE_TYPE_264_NAL_SIZE_LENGTH) ||
- ((codec_format_option == CODEC_FORMAT_H264) && (file_type_option == FILE_TYPE_ARBITRARY_BYTES)))
- {
- printf(" Enter Nal length size [2 or 4] \n");
- if (file_type_option == FILE_TYPE_ARBITRARY_BYTES)
- {
- printf(" Enter 0 if it is a start code based clip\n");
- }
- scanf("%d", &nalSize);
- if ((file_type_option == FILE_TYPE_264_NAL_SIZE_LENGTH) &&
- (nalSize == 0))
- {
- printf("Error - Can't pass NAL length size = 0\n");
- return -1;
- }
- }
-
- height=144;width=176; // Assume Default as QCIF
- printf("Executing DynPortReconfig QCIF 144 x 176 \n");
- break;
- }
-
- default:
- {
- printf(" Wrong test case...[%d] \n",file_type_option);
- return -1;
- }
- }
-
- printf(" *********************************************\n");
- printf(" Output buffer option:\n");
- printf(" *********************************************\n");
- printf(" 0 --> No display and no YUV log\n");
- printf(" 1 --> Diplay YUV\n");
- printf(" 2 --> Take YUV log\n");
- printf(" 3 --> Display YUV and take YUV log\n");
- fflush(stdin);
- scanf("%d", &outputOption);
- fflush(stdin);
-
- printf(" *********************************************\n");
- printf(" ENTER THE TEST CASE YOU WOULD LIKE TO EXECUTE\n");
- printf(" *********************************************\n");
- printf(" 1 --> Play the clip till the end\n");
- printf(" 2 --> Run compliance test. Do NOT expect any display for most option. \n");
- printf(" Please only see \"TEST SUCCESSFULL\" to indidcate test pass\n");
- fflush(stdin);
- scanf("%d", &test_option);
- fflush(stdin);
-
- printf(" *********************************************\n");
- printf(" ENTER THE PORTION OF DISPLAY TO USE\n");
- printf(" *********************************************\n");
- printf(" 0 --> Entire Screen\n");
- printf(" 1 --> 1/4 th of the screen starting from top left corner to middle \n");
- printf(" 2 --> 1/4 th of the screen starting from middle to top right corner \n");
- printf(" 3 --> 1/4 th of the screen starting from middle to bottom left \n");
- printf(" 4 --> 1/4 th of the screen starting from middle to bottom right \n");
- printf(" Please only see \"TEST SUCCESSFULL\" to indidcate test pass\n");
- fflush(stdin);
- scanf("%d", &displayWindow);
- fflush(stdin);
-
- if(displayWindow > 0)
- {
- printf(" Curently display window 0 only supported; ignoring other values\n");
- displayWindow = 0;
- }
-
- if((file_type_option == FILE_TYPE_PICTURE_START_CODE) ||
- (file_type_option == FILE_TYPE_RCV) ||
- (file_type_option == FILE_TYPE_VC1))
- {
- printf(" *********************************************\n");
- printf(" DO YOU WANT TEST APP TO RENDER in Real time \n");
- printf(" 0 --> NO\n 1 --> YES\n");
- printf(" Warning: For H264, it require one NAL per frame clip.\n");
- printf(" For Arbitrary bytes option, Real time display is not recommended\n");
- printf(" *********************************************\n");
- fflush(stdin);
- scanf("%d", &realtime_display);
- fflush(stdin);
- }
-
-
- if (realtime_display)
- {
- printf(" *********************************************\n");
- printf(" ENTER THE CLIP FPS\n");
- printf(" Exception: Timestamp extracted from clips will be used.\n");
- printf(" *********************************************\n");
- fflush(stdin);
- scanf("%d", &fps);
- fflush(stdin);
- timestampInterval = 1000000/fps;
- }
- printf(" *********************************************\n");
- printf(" ENTER THE SEQ FILE NAME\n");
- printf(" *********************************************\n");
- fflush(stdin);
- scanf("%[^\n]", (char *)&seq_file_name);
- fflush(stdin);
- }
-
- if (outputOption == 0)
- {
- takeYuvLog = 0;
- realtime_display = 0;
- }
- else if (outputOption == 1)
- {
- printf("Sorry, cannot display to screen\n");
- return -1;
- }
- else if (outputOption == 2)
- {
- takeYuvLog = 1;
- realtime_display = 0;
- }
- else if (outputOption == 3)
- {
- printf("Sorry, cannot display to screen\n");
- return -1;
- }
- else
- {
- printf("Wrong option. Assume you want to take YUV log\n");
- takeYuvLog = 1;
- realtime_display = 0;
- }
-
- if (test_option == 2)
- {
- printf(" *********************************************\n");
- printf(" ENTER THE COMPLIANCE TEST YOU WOULD LIKE TO EXECUTE\n");
- printf(" *********************************************\n");
- printf(" 1 --> Call Free Handle at the OMX_StateLoaded\n");
- printf(" 2 --> Call Free Handle at the OMX_StateIdle\n");
- printf(" 3 --> Call Free Handle at the OMX_StateExecuting\n");
- printf(" 4 --> Call Free Handle at the OMX_StatePause\n");
- fflush(stdin);
- scanf("%d", (int *)&freeHandle_option);
- fflush(stdin);
- }
- else
- {
- freeHandle_option = (freeHandle_test)0;
- }
-
- printf("Input values: inputfilename[%s]\n", in_filename);
- printf("*******************************************************\n");
- pthread_cond_init(&cond, 0);
- pthread_cond_init(&eos_cond, 0);
- pthread_mutex_init(&eos_lock, 0);
- pthread_mutex_init(&lock, 0);
- pthread_mutex_init(&etb_lock, 0);
- pthread_mutex_init(&fbd_lock, 0);
- if (-1 == sem_init(&etb_sem, 0, 0))
- {
- printf("Error - sem_init failed %d\n", errno);
- }
- if (-1 == sem_init(&fbd_sem, 0, 0))
- {
- printf("Error - sem_init failed %d\n", errno);
- }
- if (-1 == sem_init(&seq_sem, 0, 0))
- {
- printf("Error - sem_init failed %d\n", errno);
- }
- if (-1 == sem_init(&in_flush_sem, 0, 0))
- {
- printf("Error - sem_init failed %d\n", errno);
- }
- if (-1 == sem_init(&out_flush_sem, 0, 0))
- {
- printf("Error - sem_init failed %d\n", errno);
- }
- etb_queue = alloc_queue();
- if (etb_queue == NULL)
- {
- printf("\n Error in Creating etb_queue\n");
- return -1;
- }
-
- fbd_queue = alloc_queue();
- if (fbd_queue == NULL)
- {
- printf("\n Error in Creating fbd_queue\n");
- free_queue(etb_queue);
- return -1;
- }
-
- if(0 != pthread_create(&fbd_thread_id, NULL, fbd_thread, NULL))
- {
- printf("\n Error in Creating fbd_thread \n");
- free_queue(etb_queue);
- free_queue(fbd_queue);
- return -1;
- }
-
- run_tests();
- pthread_cond_destroy(&cond);
- pthread_mutex_destroy(&lock);
- pthread_mutex_destroy(&etb_lock);
- pthread_mutex_destroy(&fbd_lock);
- pthread_cond_destroy(&eos_cond);
- pthread_mutex_destroy(&eos_lock);
- if (-1 == sem_destroy(&etb_sem))
- {
- DEBUG_PRINT_ERROR("Error - sem_destroy failed %d\n", errno);
- }
- if (-1 == sem_destroy(&fbd_sem))
- {
- DEBUG_PRINT_ERROR("Error - sem_destroy failed %d\n", errno);
- }
- if (-1 == sem_destroy(&seq_sem))
- {
- DEBUG_PRINT_ERROR("Error - sem_destroy failed %d\n", errno);
- }
- if (-1 == sem_destroy(&in_flush_sem))
- {
- DEBUG_PRINT_ERROR("Error - sem_destroy failed %d\n", errno);
- }
- if (-1 == sem_destroy(&out_flush_sem))
- {
- DEBUG_PRINT_ERROR("Error - sem_destroy failed %d\n", errno);
- }
- //QPERF_TERMINATE(client_decode);
- return 0;
-}
-
-int run_tests()
-{
- DEBUG_PRINT("Inside %s\n", __FUNCTION__);
- waitForPortSettingsChanged = 1;
- currentStatus = GOOD_STATE;
-
- if(file_type_option == FILE_TYPE_DAT_PER_AU) {
- Read_Buffer = Read_Buffer_From_DAT_File;
- }
- else if(file_type_option == FILE_TYPE_ARBITRARY_BYTES) {
- Read_Buffer = Read_Buffer_ArbitraryBytes;
- }
- else if(codec_format_option == CODEC_FORMAT_H264) {
- Read_Buffer = Read_Buffer_From_Size_Nal;
- }
- else if((codec_format_option == CODEC_FORMAT_H263) ||
- (codec_format_option == CODEC_FORMAT_MP4)) {
- Read_Buffer = Read_Buffer_From_Vop_Start_Code_File;
- }
- else if(file_type_option == FILE_TYPE_RCV) {
- Read_Buffer = Read_Buffer_From_RCV_File;
- }
- else if(file_type_option == FILE_TYPE_VC1) {
- Read_Buffer = Read_Buffer_From_VC1_File;
- }
-
- DEBUG_PRINT("file_type_option %d!\n", file_type_option);
-
- switch(file_type_option)
- {
- case FILE_TYPE_DAT_PER_AU:
- case FILE_TYPE_ARBITRARY_BYTES:
- case FILE_TYPE_264_NAL_SIZE_LENGTH:
- case FILE_TYPE_PICTURE_START_CODE:
- case FILE_TYPE_RCV:
- case FILE_TYPE_VC1:
- if(Init_Decoder()!= 0x00)
- {
- DEBUG_PRINT_ERROR("Error - Decoder Init failed\n");
- return -1;
- }
- if(Play_Decoder() != 0x00)
- {
- return -1;
- }
- break;
- default:
- DEBUG_PRINT_ERROR("Error - Invalid Entry...%d\n",file_type_option);
- break;
- }
-
- if(strlen(seq_file_name))
- {
- seqFile = fopen (seq_file_name, "rb");
- if (seqFile == NULL)
- {
- DEBUG_PRINT_ERROR("Error - Seq file %s could NOT be opened\n",
- seq_file_name);
- }
- else
- {
- DEBUG_PRINT("Seq file %s is opened \n", seq_file_name);
- seq_enabled = 1;
- }
- }
-
- pthread_mutex_lock(&eos_lock);
- while (bOutputEosReached == false)
- {
- if(seq_enabled)
- {
- if(!get_next_command(seqFile))
- {
- process_current_command(curr_seq_command);
- }
- else
- {
- printf("\n Error in get_next_cmd or EOF");
- seq_enabled = 0;
- }
- }
- else
- {
- pthread_cond_wait(&eos_cond, &eos_lock);
- }
- }
- pthread_mutex_unlock(&eos_lock);
-
- // Wait till EOS is reached...
- if(bOutputEosReached)
- {
- unsigned int bufCnt = 0;
-
- DEBUG_PRINT("Moving the decoder to idle state \n");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
- wait_for_event();
- if (currentStatus == INVALID_STATE)
- {
- do_freeHandle_and_clean_up(true);
- return 0;
- }
-
- DEBUG_PRINT("Moving the decoder to loaded state \n");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StateLoaded,0);
-
- DEBUG_PRINT("[OMX Vdec Test] - Deallocating i/p and o/p buffers \n");
- for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
- {
- OMX_FreeBuffer(dec_handle, 0, pInputBufHdrs[bufCnt]);
- }
-
- for(bufCnt=0; bufCnt < portFmt.nBufferCountActual; ++bufCnt)
- {
- OMX_FreeBuffer(dec_handle, 1, pOutYUVBufHdrs[bufCnt]);
- }
-
- fbd_cnt = 0; ebd_cnt=0;
- bInputEosReached = false;
- bOutputEosReached = false;
-
- wait_for_event();
-
- DEBUG_PRINT("[OMX Vdec Test] - Free handle decoder\n");
- OMX_ERRORTYPE result = OMX_FreeHandle(dec_handle);
- if (result != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("[OMX Vdec Test] - Terminate: OMX_FreeHandle error. Error code: %d\n", result);
- }
- dec_handle = NULL;
-
- /* Deinit OpenMAX */
- DEBUG_PRINT("[OMX Vdec Test] - Terminate: De-initializing OMX \n");
- OMX_Deinit();
-
- DEBUG_PRINT("[OMX Vdec Test] - Terminate: closing all files\n");
- if(inputBufferFile)
- {
- fclose(inputBufferFile);
- inputBufferFile = NULL;
- }
-
-
- if (takeYuvLog && outputBufferFile) {
- fclose(outputBufferFile);
- outputBufferFile = NULL;
- }
-
- if(etb_queue)
- {
- free_queue(etb_queue);
- etb_queue = NULL;
- }
- if(fbd_queue)
- {
- free_queue(fbd_queue);
- fbd_queue = NULL;
- }
-
- printf("*****************************************\n");
- printf("******...TEST SUCCESSFULL...*******\n");
- printf("*****************************************\n");
-
- }
-
- return 0;
-}
-
-int Init_Decoder()
-{
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
- OMX_ERRORTYPE omxresult;
- OMX_U32 total = 0;
- char vdecCompNames[50];
- typedef OMX_U8* OMX_U8_PTR;
- char role[] ="video_decoder";
-
- static OMX_CALLBACKTYPE call_back = {&EventHandler, &EmptyBufferDone, &FillBufferDone};
-
- unsigned int i = 0;
- long bufCnt = 0;
-
- /* Init. the OpenMAX Core */
- DEBUG_PRINT("\nInitializing OpenMAX Core....\n");
- omxresult = OMX_Init();
-
- if(OMX_ErrorNone != omxresult) {
- DEBUG_PRINT_ERROR("\n Failed to Init OpenMAX core");
- return -1;
- }
- else {
- DEBUG_PRINT_ERROR("\nOpenMAX Core Init Done\n");
- }
-
- /* Query for video decoders*/
- OMX_GetComponentsOfRole(role, &total, 0);
- DEBUG_PRINT("\nTotal components of role=%s :%d", role, total);
-
- if(total)
- {
- /* Allocate memory for pointers to component name */
- OMX_U8** vidCompNames = (OMX_U8**)malloc((sizeof(OMX_U8*))*total);
-
- for (i = 0; i < total; ++i) {
- vidCompNames[i] = (OMX_U8*)malloc(sizeof(OMX_U8)*OMX_MAX_STRINGNAME_SIZE);
- }
- OMX_GetComponentsOfRole(role, &total, vidCompNames);
- DEBUG_PRINT("\nComponents of Role:%s\n", role);
- for (i = 0; i < total; ++i) {
- DEBUG_PRINT("\nComponent Name [%s]\n",vidCompNames[i]);
- free(vidCompNames[i]);
- }
- free(vidCompNames);
- }
- else {
- DEBUG_PRINT_ERROR("No components found with Role:%s", role);
- }
-
- if (codec_format_option == CODEC_FORMAT_H264)
- {
- strncpy(vdecCompNames, "OMX.qcom.video.decoder.avc", 27);
- }
- else if (codec_format_option == CODEC_FORMAT_MP4)
- {
- strncpy(vdecCompNames, "OMX.qcom.video.decoder.mpeg4", 29);
- }
- else if (codec_format_option == CODEC_FORMAT_H263)
- {
- strncpy(vdecCompNames, "OMX.qcom.video.decoder.h263", 28);
- }
- else if (codec_format_option == CODEC_FORMAT_VC1)
- {
- strncpy(vdecCompNames, "OMX.qcom.video.decoder.vc1", 27);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Unsupported codec %d\n", codec_format_option);
- return -1;
- }
-
- omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&dec_handle),
- (OMX_STRING)vdecCompNames, NULL, &call_back);
- if (FAILED(omxresult)) {
- DEBUG_PRINT_ERROR("\nFailed to Load the component:%s\n", vdecCompNames);
- return -1;
- }
- else
- {
- DEBUG_PRINT("\nComponent %s is in LOADED state\n", vdecCompNames);
- }
-
- QOMX_VIDEO_QUERY_DECODER_INSTANCES decoder_instances;
- omxresult = OMX_GetConfig(dec_handle,
- (OMX_INDEXTYPE)OMX_QcomIndexQueryNumberOfVideoDecInstance,
- &decoder_instances);
- DEBUG_PRINT("\n Number of decoder instances %d",
- decoder_instances.nNumOfInstances);
-
- /* Get the port information */
- CONFIG_VERSION_SIZE(portParam);
- omxresult = OMX_GetParameter(dec_handle, OMX_IndexParamVideoInit,
- (OMX_PTR)&portParam);
-
- if(FAILED(omxresult)) {
- DEBUG_PRINT_ERROR("ERROR - Failed to get Port Param\n");
- return -1;
- }
- else
- {
- DEBUG_PRINT("portParam.nPorts:%d\n", portParam.nPorts);
- DEBUG_PRINT("portParam.nStartPortNumber:%d\n", portParam.nStartPortNumber);
- }
-
- DEBUG_PRINT("Set parameter immediately followed by getparameter");
- omxresult = OMX_SetParameter(dec_handle,
- OMX_IndexParamPortDefinition,
- &portFmt);
-
- if(OMX_ErrorNone != omxresult)
- {
- DEBUG_PRINT_ERROR("ERROR - Set parameter failed");
- }
-
- /* Set the compression format on i/p port */
- if (codec_format_option == CODEC_FORMAT_H264)
- {
- portFmt.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
- }
- else if (codec_format_option == CODEC_FORMAT_MP4)
- {
- portFmt.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
- }
- else if (codec_format_option == CODEC_FORMAT_H263)
- {
- portFmt.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
- }
- else if (codec_format_option == CODEC_FORMAT_VC1)
- {
- portFmt.format.video.eCompressionFormat = OMX_VIDEO_CodingWMV;
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Unsupported codec %d\n", codec_format_option);
- }
-
-
- return 0;
-}
-
-int Play_Decoder()
-{
- int i;
- unsigned int bufCnt;
- int frameSize=0;
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
- OMX_ERRORTYPE ret;
-
- DEBUG_PRINT("sizeof[%d]\n", sizeof(OMX_BUFFERHEADERTYPE));
-
- /* open the i/p and o/p files based on the video file format passed */
- if(open_video_file()) {
- DEBUG_PRINT_ERROR("Error in opening video file\n");
- return -1;
- }
-
- OMX_QCOM_PARAM_PORTDEFINITIONTYPE inputPortFmt;
- memset(&inputPortFmt, 0, sizeof(OMX_QCOM_PARAM_PORTDEFINITIONTYPE));
- CONFIG_VERSION_SIZE(inputPortFmt);
- inputPortFmt.nPortIndex = 0; // input port
- switch (file_type_option)
- {
- case FILE_TYPE_DAT_PER_AU:
- case FILE_TYPE_PICTURE_START_CODE:
- case FILE_TYPE_RCV:
- case FILE_TYPE_VC1:
- {
- inputPortFmt.nFramePackingFormat = OMX_QCOM_FramePacking_OnlyOneCompleteFrame;
- break;
- }
-
- case FILE_TYPE_ARBITRARY_BYTES:
- case FILE_TYPE_264_NAL_SIZE_LENGTH:
- {
- inputPortFmt.nFramePackingFormat = OMX_QCOM_FramePacking_Arbitrary;
- break;
- }
-
- default:
- inputPortFmt.nFramePackingFormat = OMX_QCOM_FramePacking_Unspecified;
- }
- OMX_SetParameter(dec_handle,(OMX_INDEXTYPE)OMX_QcomIndexPortDefn,
- (OMX_PTR)&inputPortFmt);
-
- /* Query the decoder outport's min buf requirements */
- CONFIG_VERSION_SIZE(portFmt);
-
- /* Port for which the Client needs to obtain info */
- portFmt.nPortIndex = portParam.nStartPortNumber;
-
- OMX_GetParameter(dec_handle,OMX_IndexParamPortDefinition,&portFmt);
- DEBUG_PRINT("\nDec: Min Buffer Count %d\n", portFmt.nBufferCountMin);
- DEBUG_PRINT("\nDec: Buffer Size %d\n", portFmt.nBufferSize);
-
- if(OMX_DirInput != portFmt.eDir) {
- printf ("\nDec: Expect Input Port\n");
- return -1;
- }
-
- bufCnt = 0;
- portFmt.format.video.nFrameHeight = height;
- portFmt.format.video.nFrameWidth = width;
- OMX_SetParameter(dec_handle,OMX_IndexParamPortDefinition,
- (OMX_PTR)&portFmt);
- OMX_GetParameter(dec_handle,OMX_IndexParamPortDefinition,
- &portFmt);
- DEBUG_PRINT("\nDec: New Min Buffer Count %d", portFmt.nBufferCountMin);
-
-
- DEBUG_PRINT("\nVideo format, height = %d", portFmt.format.video.nFrameHeight);
- DEBUG_PRINT("\nVideo format, height = %d\n", portFmt.format.video.nFrameWidth);
- if(codec_format_option == CODEC_FORMAT_H264)
- {
- OMX_VIDEO_CONFIG_NALSIZE naluSize;
- naluSize.nNaluBytes = nalSize;
- DEBUG_PRINT("\n Nal length is %d index %d",nalSize,OMX_IndexConfigVideoNalSize);
- OMX_SetConfig(dec_handle,OMX_IndexConfigVideoNalSize,(OMX_PTR)&naluSize);
- DEBUG_PRINT("SETTING THE NAL SIZE to %d\n",naluSize.nNaluBytes);
- }
- DEBUG_PRINT("\nOMX_SendCommand Decoder -> IDLE\n");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StateIdle,0);
-
- input_buf_cnt = portFmt.nBufferCountActual;
- DEBUG_PRINT("Transition to Idle State succesful...\n");
- /* Allocate buffer on decoder's i/p port */
- error = Allocate_Buffer(dec_handle, &pInputBufHdrs, portFmt.nPortIndex,
- portFmt.nBufferCountActual, portFmt.nBufferSize);
- if (error != OMX_ErrorNone) {
- DEBUG_PRINT_ERROR("Error - OMX_AllocateBuffer Input buffer error\n");
- return -1;
- }
- else {
- DEBUG_PRINT("\nOMX_AllocateBuffer Input buffer success\n");
- }
-
- portFmt.nPortIndex = portParam.nStartPortNumber+1;
- /* Port for which the Client needs to obtain info */
-
- OMX_GetParameter(dec_handle,OMX_IndexParamPortDefinition,&portFmt);
- DEBUG_PRINT("nMin Buffer Count=%d", portFmt.nBufferCountMin);
- DEBUG_PRINT("nBuffer Size=%d", portFmt.nBufferSize);
- if(OMX_DirOutput != portFmt.eDir) {
- DEBUG_PRINT_ERROR("Error - Expect Output Port\n");
- return -1;
- }
-
- /* Allocate buffer on decoder's o/p port */
- error = Allocate_Buffer(dec_handle, &pOutYUVBufHdrs, portFmt.nPortIndex,
- portFmt.nBufferCountActual, portFmt.nBufferSize);
- if (error != OMX_ErrorNone) {
- DEBUG_PRINT_ERROR("Error - OMX_AllocateBuffer Output buffer error\n");
- return -1;
- }
- else
- {
- DEBUG_PRINT("OMX_AllocateBuffer Output buffer success\n");
- }
-
- wait_for_event();
- if (currentStatus == INVALID_STATE)
- {
- do_freeHandle_and_clean_up(true);
- return -1;
- }
-
- if (freeHandle_option == FREE_HANDLE_AT_IDLE)
- {
- OMX_STATETYPE state = OMX_StateInvalid;
- OMX_GetState(dec_handle, &state);
- if (state == OMX_StateIdle)
- {
- DEBUG_PRINT("Decoder is in OMX_StateIdle and trying to call OMX_FreeHandle \n");
- do_freeHandle_and_clean_up(false);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error - Decoder is in state %d and trying to call OMX_FreeHandle \n", state);
- do_freeHandle_and_clean_up(true);
- }
- return -1;
- }
-
-
- DEBUG_PRINT("OMX_SendCommand Decoder -> Executing\n");
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StateExecuting,0);
- wait_for_event();
- if (currentStatus == INVALID_STATE)
- {
- do_freeHandle_and_clean_up(true);
- return -1;
- }
-
- for(bufCnt=0; bufCnt < portFmt.nBufferCountActual; ++bufCnt) {
- DEBUG_PRINT("OMX_FillThisBuffer on output buf no.%d\n",bufCnt);
- pOutYUVBufHdrs[bufCnt]->nOutputPortIndex = 1;
- pOutYUVBufHdrs[bufCnt]->nFlags &= ~OMX_BUFFERFLAG_EOS;
- ret = OMX_FillThisBuffer(dec_handle, pOutYUVBufHdrs[bufCnt]);
- if (OMX_ErrorNone != ret) {
- DEBUG_PRINT_ERROR("Error - OMX_FillThisBuffer failed with result %d\n", ret);
- }
- else {
- DEBUG_PRINT("OMX_FillThisBuffer success!\n");
- }
- }
-
- used_ip_buf_cnt = input_buf_cnt;
-
- rcv_v1 = 0;
-
- //QPERF_START(client_decode);
- if (codec_format_option == CODEC_FORMAT_VC1)
- {
- pInputBufHdrs[0]->nOffset = 0;
- if(file_type_option == FILE_TYPE_RCV)
- {
- frameSize = Read_Buffer_From_RCV_File_Seq_Layer(pInputBufHdrs[0]);
- pInputBufHdrs[0]->nFilledLen = frameSize;
- DEBUG_PRINT("After Read_Buffer_From_RCV_File_Seq_Layer, "
- "frameSize %d\n", frameSize);
- }
- else if(file_type_option == FILE_TYPE_VC1)
- {
- pInputBufHdrs[0]->nFilledLen = Read_Buffer(pInputBufHdrs[0]);
- DEBUG_PRINT_ERROR("After 1st Read_Buffer for VC1, "
- "pInputBufHdrs[0]->nFilledLen %d\n", pInputBufHdrs[0]->nFilledLen);
- }
- else
- {
- pInputBufHdrs[0]->nFilledLen = Read_Buffer(pInputBufHdrs[0]);
- DEBUG_PRINT("After Read_Buffer pInputBufHdrs[0]->nFilledLen %d\n",
- pInputBufHdrs[0]->nFilledLen);
- }
-
- pInputBufHdrs[0]->nInputPortIndex = 0;
- pInputBufHdrs[0]->nOffset = 0;
- pInputBufHdrs[0]->nFlags = 0;
-
- ret = OMX_EmptyThisBuffer(dec_handle, pInputBufHdrs[0]);
- if (ret != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("ERROR - OMX_EmptyThisBuffer failed with result %d\n", ret);
- do_freeHandle_and_clean_up(true);
- return -1;
- }
- else
- {
- etb_count++;
- DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
- if(cmd_data == etb_count)
- {
- sem_post(&seq_sem);
- printf("\n Posted seq_sem");
- }
- }
- i = 1;
- }
- else
- {
- i = 0;
- }
-
- for (i; i < used_ip_buf_cnt;i++) {
- pInputBufHdrs[i]->nInputPortIndex = 0;
- pInputBufHdrs[i]->nOffset = 0;
- if((frameSize = Read_Buffer(pInputBufHdrs[i])) <= 0 ){
- DEBUG_PRINT("NO FRAME READ\n");
- pInputBufHdrs[i]->nFilledLen = frameSize;
- pInputBufHdrs[i]->nInputPortIndex = 0;
- pInputBufHdrs[i]->nFlags |= OMX_BUFFERFLAG_EOS;;
- bInputEosReached = true;
-
- OMX_EmptyThisBuffer(dec_handle, pInputBufHdrs[i]);
- etb_count++;
- if(cmd_data == etb_count)
- {
- sem_post(&seq_sem);
- printf("\n Posted seq_sem");
- }
- DEBUG_PRINT("File is small::Either EOS or Some Error while reading file\n");
- break;
- }
- pInputBufHdrs[i]->nFilledLen = frameSize;
- pInputBufHdrs[i]->nInputPortIndex = 0;
- pInputBufHdrs[i]->nFlags = 0;
-//pBufHdr[bufCnt]->pAppPrivate = this;
- ret = OMX_EmptyThisBuffer(dec_handle, pInputBufHdrs[i]);
- if (OMX_ErrorNone != ret) {
- DEBUG_PRINT_ERROR("ERROR - OMX_EmptyThisBuffer failed with result %d\n", ret);
- do_freeHandle_and_clean_up(true);
- return -1;
- }
- else {
- DEBUG_PRINT("OMX_EmptyThisBuffer success!\n");
- etb_count++;
- if(cmd_data == etb_count)
- {
- sem_post(&seq_sem);
- printf("\n Posted seq_sem");
- }
- }
- }
-
- if(0 != pthread_create(&ebd_thread_id, NULL, ebd_thread, NULL))
- {
- printf("\n Error in Creating fbd_thread \n");
- free_queue(etb_queue);
- free_queue(fbd_queue);
- return -1;
- }
-
- // wait for event port settings changed event
- wait_for_event();
- DEBUG_PRINT("RECIEVED EVENT PORT TO DETERMINE IF DYN PORT RECONFIGURATION NEEDED, currentStatus %d\n",
- currentStatus);
- if (currentStatus == INVALID_STATE)
- {
- DEBUG_PRINT_ERROR("Error - INVALID_STATE\n");
- do_freeHandle_and_clean_up(true);
- return -1;
- }
- else if (currentStatus == PORT_SETTING_CHANGE_STATE)
- {
- DEBUG_PRINT("PORT_SETTING_CHANGE_STATE\n");
- // Send DISABLE command
- sent_disabled = 1;
- OMX_SendCommand(dec_handle, OMX_CommandPortDisable, 1, 0);
-
- DEBUG_PRINT("FREEING BUFFERS\n");
- // Free output Buffer
- for(bufCnt=0; bufCnt < portFmt.nBufferCountActual; ++bufCnt) {
- OMX_FreeBuffer(dec_handle, 1, pOutYUVBufHdrs[bufCnt]);
- }
-
- // wait for Disable event to come back
- wait_for_event();
- if (currentStatus == INVALID_STATE)
- {
- do_freeHandle_and_clean_up(true);
- return -1;
- }
- DEBUG_PRINT("DISABLE EVENT RECD\n");
- // GetParam and SetParam
-
- // Send Enable command
- OMX_SendCommand(dec_handle, OMX_CommandPortEnable, 1, 0);
- // AllocateBuffers
- /* Allocate buffer on decoder's o/p port */
-
- portFmt.nPortIndex = 1;
- /* Port for which the Client needs to obtain info */
-
- OMX_GetParameter(dec_handle,OMX_IndexParamPortDefinition,&portFmt);
- DEBUG_PRINT("Min Buffer Count=%d", portFmt.nBufferCountMin);
- DEBUG_PRINT("Buffer Size=%d", portFmt.nBufferSize);
- if(OMX_DirOutput != portFmt.eDir) {
- DEBUG_PRINT_ERROR("Error - Expect Output Port\n");
- return -1;
- }
- height = portFmt.format.video.nFrameHeight;
- width = portFmt.format.video.nFrameWidth;
- stride = portFmt.format.video.nStride;
- sliceheight = portFmt.format.video.nSliceHeight;
-
- error = Allocate_Buffer(dec_handle, &pOutYUVBufHdrs, portFmt.nPortIndex,
- portFmt.nBufferCountActual, portFmt.nBufferSize);
- if (error != OMX_ErrorNone) {
- DEBUG_PRINT_ERROR("Error - OMX_AllocateBuffer Output buffer error\n");
- return -1;
- }
- else
- {
- DEBUG_PRINT("OMX_AllocateBuffer Output buffer success\n");
- }
-
- // wait for enable event to come back
- wait_for_event();
- if (currentStatus == INVALID_STATE)
- {
- do_freeHandle_and_clean_up(true);
- return -1;
- }
- DEBUG_PRINT("ENABLE EVENT HANDLER RECD\n");
-
- for(bufCnt=0; bufCnt < portFmt.nBufferCountActual; ++bufCnt) {
- DEBUG_PRINT("OMX_FillThisBuffer on output buf no.%d\n",bufCnt);
- pOutYUVBufHdrs[bufCnt]->nOutputPortIndex = 1;
- pOutYUVBufHdrs[bufCnt]->nFlags &= ~OMX_BUFFERFLAG_EOS;
- ret = OMX_FillThisBuffer(dec_handle, pOutYUVBufHdrs[bufCnt]);
- if (OMX_ErrorNone != ret) {
- DEBUG_PRINT_ERROR("ERROR - OMX_FillThisBuffer failed with result %d\n", ret);
- }
- else {
- DEBUG_PRINT("OMX_FillThisBuffer success!\n");
- }
- }
- }
-
- if (freeHandle_option == FREE_HANDLE_AT_EXECUTING)
- {
- OMX_STATETYPE state = OMX_StateInvalid;
- OMX_GetState(dec_handle, &state);
- if (state == OMX_StateExecuting)
- {
- DEBUG_PRINT("Decoder is in OMX_StateExecuting and trying to call OMX_FreeHandle \n");
- do_freeHandle_and_clean_up(false);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error - Decoder is in state %d and trying to call OMX_FreeHandle \n", state);
- do_freeHandle_and_clean_up(true);
- }
- return -1;
- }
- else if (freeHandle_option == FREE_HANDLE_AT_PAUSE)
- {
- OMX_SendCommand(dec_handle, OMX_CommandStateSet, OMX_StatePause,0);
- wait_for_event();
-
- OMX_STATETYPE state = OMX_StateInvalid;
- OMX_GetState(dec_handle, &state);
- if (state == OMX_StatePause)
- {
- DEBUG_PRINT("Decoder is in OMX_StatePause and trying to call OMX_FreeHandle \n");
- do_freeHandle_and_clean_up(false);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error - Decoder is in state %d and trying to call OMX_FreeHandle \n", state);
- do_freeHandle_and_clean_up(true);
- }
- return -1;
- }
-
- return 0;
-}
-
-static OMX_ERRORTYPE Allocate_Buffer ( OMX_COMPONENTTYPE *dec_handle,
- OMX_BUFFERHEADERTYPE ***pBufHdrs,
- OMX_U32 nPortIndex,
- long bufCntMin, long bufSize)
-{
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
- OMX_ERRORTYPE error=OMX_ErrorNone;
- long bufCnt=0;
-
- DEBUG_PRINT("pBufHdrs = %x,bufCntMin = %d\n", pBufHdrs, bufCntMin);
- *pBufHdrs= (OMX_BUFFERHEADERTYPE **)
- malloc(sizeof(OMX_BUFFERHEADERTYPE)*bufCntMin);
-
- for(bufCnt=0; bufCnt < bufCntMin; ++bufCnt) {
- DEBUG_PRINT("OMX_AllocateBuffer No %d \n", bufCnt);
- error = OMX_AllocateBuffer(dec_handle, &((*pBufHdrs)[bufCnt]),
- nPortIndex, NULL, bufSize);
- }
-
- return error;
-}
-
-static void do_freeHandle_and_clean_up(bool isDueToError)
-{
- unsigned int bufCnt = 0;
-
- for(bufCnt=0; bufCnt < input_buf_cnt; ++bufCnt)
- {
- OMX_FreeBuffer(dec_handle, 0, pInputBufHdrs[bufCnt]);
- }
-
- for(bufCnt=0; bufCnt < portFmt.nBufferCountActual; ++bufCnt)
- {
- OMX_FreeBuffer(dec_handle, 1, pOutYUVBufHdrs[bufCnt]);
- }
-
- DEBUG_PRINT("[OMX Vdec Test] - Free handle decoder\n");
- OMX_ERRORTYPE result = OMX_FreeHandle(dec_handle);
- if (result != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("[OMX Vdec Test] - OMX_FreeHandle error. Error code: %d\n", result);
- }
- dec_handle = NULL;
-
- /* Deinit OpenMAX */
- DEBUG_PRINT("[OMX Vdec Test] - De-initializing OMX \n");
- OMX_Deinit();
-
- DEBUG_PRINT("[OMX Vdec Test] - closing all files\n");
- if(inputBufferFile)
- {
- fclose(inputBufferFile);
- inputBufferFile = NULL;
- }
-
- DEBUG_PRINT("[OMX Vdec Test] - after free inputfile\n");
-
- if (takeYuvLog && outputBufferFile) {
- fclose(outputBufferFile);
- outputBufferFile = NULL;
- }
- DEBUG_PRINT("[OMX Vdec Test] - after free outputfile\n");
-
- if(etb_queue)
- {
- free_queue(etb_queue);
- etb_queue = NULL;
- }
- DEBUG_PRINT("[OMX Vdec Test] - after free etb_queue \n");
- if(fbd_queue)
- {
- free_queue(fbd_queue);
- fbd_queue = NULL;
- }
- DEBUG_PRINT("[OMX Vdec Test] - after free iftb_queue\n");
-
-
- printf("*****************************************\n");
- if (isDueToError)
- {
- printf("************...TEST FAILED...************\n");
- }
- else
- {
- printf("**********...TEST SUCCESSFULL...*********\n");
- }
- printf("*****************************************\n");
-}
-
-static int Read_Buffer_From_DAT_File(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- long frameSize=0;
- char temp_buffer[10];
- char temp_byte;
- int bytes_read=0;
- int i=0;
- unsigned char *read_buffer=NULL;
- char c = '1'; //initialize to anything except '\0'(0)
- char inputFrameSize[10];
- int count =0;
- int cnt = 0;
- memset(temp_buffer, 0, sizeof(temp_buffer));
-
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- while (cnt < 10)
- /* Check the input file format, may result in infinite loop */
- {
- DEBUG_PRINT("loop[%d] count[%d]\n",cnt,count);
- count = fread(&inputFrameSize[cnt], 1, 1, inputBufferFile);
- if(inputFrameSize[cnt] == '\0' )
- break;
- cnt++;
- }
- inputFrameSize[cnt]='\0';
- frameSize = atoi(inputFrameSize);
- pBufHdr->nFilledLen = 0;
-
- /* get the frame length */
- fseek(inputBufferFile, -1, SEEK_CUR);
- bytes_read = fread(pBufHdr->pBuffer, 1, frameSize, inputBufferFile);
-
- DEBUG_PRINT("Actual frame Size [%d] bytes_read using fread[%d]\n",
- frameSize, bytes_read);
-
- if(bytes_read == 0 || bytes_read < frameSize ) {
- DEBUG_PRINT("Bytes read Zero After Read frame Size \n");
- DEBUG_PRINT("Checking VideoPlayback Count:video_playback_count is:%d\n",
- video_playback_count);
- return 0;
- }
- pBufHdr->nTimeStamp = timeStampLfile;
- timeStampLfile += timestampInterval;
- return bytes_read;
-}
-
-static int Read_Buffer_ArbitraryBytes(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- char temp_buffer[10];
- char temp_byte;
- int bytes_read=0;
- int i=0;
- unsigned char *read_buffer=NULL;
- char c = '1'; //initialize to anything except '\0'(0)
- char inputFrameSize[10];
- int count =0; char cnt =0;
- memset(temp_buffer, 0, sizeof(temp_buffer));
-
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- bytes_read = fread(pBufHdr->pBuffer, 1, NUMBER_OF_ARBITRARYBYTES_READ, inputBufferFile);
-
- if(bytes_read == 0) {
- DEBUG_PRINT("Bytes read Zero After Read frame Size \n");
- DEBUG_PRINT("Checking VideoPlayback Count:video_playback_count is:%d\n",
- video_playback_count);
- return 0;
- }
- pBufHdr->nTimeStamp = timeStampLfile;
- timeStampLfile += timestampInterval;
- return bytes_read;
-}
-
-static int Read_Buffer_From_Vop_Start_Code_File(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- unsigned int readOffset = 0;
- int bytes_read = 0;
- unsigned int code = 0;
- pBufHdr->nFilledLen = 0;
- static unsigned int header_code = 0;
-
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- do
- {
- //Start codes are always byte aligned.
- bytes_read = fread(&pBufHdr->pBuffer[readOffset],1, 1,inputBufferFile);
- if(!bytes_read)
- {
- DEBUG_PRINT("Bytes read Zero \n");
- break;
- }
- code <<= 8;
- code |= (0x000000FF & pBufHdr->pBuffer[readOffset]);
- //VOP start code comparision
- if (readOffset>3)
- {
- if(!header_code ){
- if( VOP_START_CODE == code)
- {
- header_code = VOP_START_CODE;
- }
- else if ( (0xFFFFFC00 & code) == SHORT_HEADER_START_CODE )
- {
- header_code = SHORT_HEADER_START_CODE;
- }
- }
- if ((header_code == VOP_START_CODE) && (code == VOP_START_CODE))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=3;
- break;
-
- }
- else if (( header_code == SHORT_HEADER_START_CODE ) && ( SHORT_HEADER_START_CODE == (code & 0xFFFFFC00)))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=3;
- break;
- }
- }
- readOffset++;
- }while (1);
- pBufHdr->nTimeStamp = timeStampLfile;
- timeStampLfile += timestampInterval;
- return readOffset;
-}
-
-static int Read_Buffer_From_Size_Nal(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- // NAL unit stream processing
- char temp_size[SIZE_NAL_FIELD_MAX];
- int i = 0;
- int j = 0;
- unsigned int size = 0; // Need to make sure that uint32 has SIZE_NAL_FIELD_MAX (4) bytes
- unsigned int bytes_read = 0;
-
- // read the "size_nal_field"-byte size field
- bytes_read = fread(pBufHdr->pBuffer + pBufHdr->nOffset, 1, nalSize, inputBufferFile);
- if (bytes_read == 0)
- {
- DEBUG_PRINT("Failed to read frame or it might be EOF\n");
- return 0;
- }
-
- for (i=0; i<SIZE_NAL_FIELD_MAX-nalSize; i++)
- {
- temp_size[SIZE_NAL_FIELD_MAX - 1 - i] = 0;
- }
-
- /* Due to little endiannes, Reorder the size based on size_nal_field */
- for (j=0; i<SIZE_NAL_FIELD_MAX; i++, j++)
- {
- temp_size[SIZE_NAL_FIELD_MAX - 1 - i] = pBufHdr->pBuffer[pBufHdr->nOffset + j];
- }
- size = (unsigned int)(*((unsigned int *)(temp_size)));
-
- // now read the data
- bytes_read = fread(pBufHdr->pBuffer + pBufHdr->nOffset + nalSize, 1, size, inputBufferFile);
- if (bytes_read != size)
- {
- DEBUG_PRINT_ERROR("Failed to read frame\n");
- }
-
- return bytes_read + nalSize;
-}
-
-static int Read_Buffer_From_RCV_File_Seq_Layer(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- unsigned int readOffset = 0, size_struct_C = 0;
- unsigned int startcode = 0;
- pBufHdr->nFilledLen = 0;
- pBufHdr->nFlags = 0;
-
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- fread(&startcode, 4, 1, inputBufferFile);
-
- /* read size of struct C as it need not be 4 always*/
- fread(&size_struct_C, 1, 4, inputBufferFile);
-
- /* reseek to beginning of sequence header */
- fseek(inputBufferFile, -8, SEEK_CUR);
-
- if ((startcode & 0xFF000000) == 0xC5000000)
- {
-
- DEBUG_PRINT("Read_Buffer_From_RCV_File_Seq_Layer size_struct_C: %d\n", size_struct_C);
-
- readOffset = fread(pBufHdr->pBuffer, 1, VC1_SEQ_LAYER_SIZE_WITHOUT_STRUCTC + size_struct_C, inputBufferFile);
- }
- else if((startcode & 0xFF000000) == 0x85000000)
- {
- // .RCV V1 file
-
- rcv_v1 = 1;
-
- DEBUG_PRINT("Read_Buffer_From_RCV_File_Seq_Layer size_struct_C: %d\n", size_struct_C);
-
- readOffset = fread(pBufHdr->pBuffer, 1, VC1_SEQ_LAYER_SIZE_V1_WITHOUT_STRUCTC + size_struct_C, inputBufferFile);
- }
- else
- {
- DEBUG_PRINT_ERROR("Error: Unknown VC1 clip format %x\n", startcode);
- }
-
-#if 0
- {
- int i=0;
- printf("Read_Buffer_From_RCV_File, length %d readOffset %d\n", readOffset, readOffset);
- for (i=0; i<36; i++)
- {
- printf("0x%.2x ", pBufHdr->pBuffer[i]);
- if (i%16 == 15) {
- printf("\n");
- }
- }
- printf("\n");
- }
-#endif
- return readOffset;
-}
-
-static int Read_Buffer_From_RCV_File(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- unsigned int readOffset = 0;
- unsigned int len = 0;
- unsigned int key = 0;
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- DEBUG_PRINT("Read_Buffer_From_RCV_File - nOffset %d\n", pBufHdr->nOffset);
- if(rcv_v1)
- {
- /* for the case of RCV V1 format, the frame header is only of 4 bytes and has
- only the frame size information */
- readOffset = fread(&len, 1, 4, inputBufferFile);
- DEBUG_PRINT("Read_Buffer_From_RCV_File - framesize %d %x\n", len, len);
-
- }
- else
- {
- /* for a regular RCV file, 3 bytes comprise the frame size and 1 byte for key*/
- readOffset = fread(&len, 1, 3, inputBufferFile);
- DEBUG_PRINT("Read_Buffer_From_RCV_File - framesize %d %x\n", len, len);
-
- readOffset = fread(&key, 1, 1, inputBufferFile);
- if ( (key & 0x80) == false)
- {
- DEBUG_PRINT("Read_Buffer_From_RCV_File - Non IDR frame key %x\n", key);
- }
-
- }
-
- if(!rcv_v1)
- {
- /* There is timestamp field only for regular RCV format and not for RCV V1 format*/
- readOffset = fread(&pBufHdr->nTimeStamp, 1, 4, inputBufferFile);
- DEBUG_PRINT("Read_Buffer_From_RCV_File - timeStamp %d\n", pBufHdr->nTimeStamp);
- pBufHdr->nTimeStamp *= 1000;
- }
- else
- {
- pBufHdr->nTimeStamp = timeStampLfile;
- timeStampLfile += timestampInterval;
- }
-
- if(len > pBufHdr->nAllocLen)
- {
- DEBUG_PRINT_ERROR("Error in sufficient buffer framesize %d, allocalen %d noffset %d\n",len,pBufHdr->nAllocLen, pBufHdr->nOffset);
- readOffset = fread(pBufHdr->pBuffer+pBufHdr->nOffset, 1, pBufHdr->nAllocLen - pBufHdr->nOffset , inputBufferFile);
- fseek(inputBufferFile, len - readOffset,SEEK_CUR);
- return readOffset;
- }
- else
- readOffset = fread(pBufHdr->pBuffer+pBufHdr->nOffset, 1, len, inputBufferFile);
- if (readOffset != len)
- {
- DEBUG_PRINT("EOS reach or Reading error %d, %s \n", readOffset, strerror( errno ));
- return 0;
- }
-
-#if 0
- {
- int i=0;
- printf("Read_Buffer_From_RCV_File, length %d readOffset %d\n", len, readOffset);
- for (i=0; i<64; i++)
- {
- printf("0x%.2x ", pBufHdr->pBuffer[i]);
- if (i%16 == 15) {
- printf("\n");
- }
- }
- printf("\n");
- }
-#endif
-
- return readOffset;
-}
-
-static int Read_Buffer_From_VC1_File(OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- static int timeStampLfile = 0;
- OMX_U8 *pBuffer = pBufHdr->pBuffer + pBufHdr->nOffset;
- DEBUG_PRINT("Inside %s \n", __FUNCTION__);
-
- unsigned int readOffset = 0;
- int bytes_read = 0;
- unsigned int code = 0;
-
- do
- {
- //Start codes are always byte aligned.
- bytes_read = fread(&pBuffer[readOffset],1, 1,inputBufferFile);
- if(!bytes_read)
- {
- DEBUG_PRINT("\n Bytes read Zero \n");
- break;
- }
- code <<= 8;
- code |= (0x000000FF & pBufHdr->pBuffer[readOffset]);
- //VOP start code comparision
- if (readOffset>3)
- {
- if (VC1_FRAME_START_CODE == (code & 0xFFFFFFFF))
- {
- //Seek backwards by 4
- fseek(inputBufferFile, -4, SEEK_CUR);
- readOffset-=3;
-
- while(pBufHdr->pBuffer[readOffset-1] == 0)
- readOffset--;
-
- break;
- }
- }
- readOffset++;
- }while (1);
-
- pBufHdr->nTimeStamp = timeStampLfile;
- timeStampLfile += timestampInterval;
-
-#if 0
- {
- int i=0;
- printf("Read_Buffer_From_VC1_File, readOffset %d\n", readOffset);
- for (i=0; i<64; i++)
- {
- printf("0x%.2x ", pBufHdr->pBuffer[i]);
- if (i%16 == 15) {
- printf("\n");
- }
- }
- printf("\n");
- }
-#endif
-
- return readOffset;
-}
-
-static int open_video_file ()
-{
- int error_code = 0;
- char outputfilename[512];
- DEBUG_PRINT("Inside %s filename=%s\n", __FUNCTION__, in_filename);
-
- inputBufferFile = fopen (in_filename, "rb");
- if (inputBufferFile == NULL) {
- DEBUG_PRINT_ERROR("Error - i/p file %s could NOT be opened\n",
- in_filename);
- error_code = -1;
- }
- else {
- DEBUG_PRINT("I/p file %s is opened \n", in_filename);
- }
-
- if (takeYuvLog) {
- strcpy(outputfilename, "/data/misc/yuv");
- outputBufferFile = fopen (outputfilename, "ab");
- if (outputBufferFile == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR - o/p file %s could NOT be opened\n", outputfilename);
- error_code = -1;
- }
- else
- {
- DEBUG_PRINT("O/p file %s is opened \n", outputfilename);
- }
- }
- return error_code;
-}
-
-void swap_byte(char *pByte, int nbyte)
-{
- int i=0;
-
- for (i=0; i<nbyte/2; i++)
- {
- pByte[i] ^= pByte[nbyte-i-1];
- pByte[nbyte-i-1] ^= pByte[i];
- pByte[i] ^= pByte[nbyte-i-1];
- }
-}
-
-int drawBG(void)
-{
- int result;
- unsigned int i;
-#ifdef FRAMEBUFFER_32
- long * p;
-#else
- short * p;
-#endif
- void *fb_buf = mmap (NULL, finfo.smem_len,PROT_READ|PROT_WRITE, MAP_SHARED, fb_fd, 0);
-
- if (fb_buf == MAP_FAILED)
- {
- printf("ERROR: Framebuffer MMAP failed!\n");
- close(fb_fd);
- return -1;
- }
-
- vinfo.yoffset = 0;
- p = (long *)fb_buf;
-
- for (i=0; i < vinfo.xres * vinfo.yres; i++)
- {
- #ifdef FRAMEBUFFER_32
- *p++ = COLOR_BLACK_RGBA_8888;
- #else
- *p++ = CLR_KEY;
- #endif
- }
-
- if (ioctl(fb_fd, FBIOPAN_DISPLAY, &vinfo) < 0)
- {
- printf("ERROR: FBIOPAN_DISPLAY failed! line=%d\n", __LINE__);
- return -1;
- }
-
- DEBUG_PRINT("drawBG success!\n");
- return 0;
-}
-
-void render_fb(struct OMX_BUFFERHEADERTYPE *pBufHdr)
-{
- unsigned int addr = 0;
- OMX_OTHER_EXTRADATATYPE *pExtraData = 0;
- OMX_QCOM_EXTRADATA_FRAMEINFO *pExtraFrameInfo = 0;
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pPMEMInfo = NULL;
- unsigned int destx, desty,destW, destH;
-#ifdef _ANDROID_
- MemoryHeapBase *vheap = NULL;
-#endif
-
- unsigned int end = (unsigned int)(pBufHdr->pBuffer + pBufHdr->nAllocLen);
-
- struct mdp_blit_req *e;
- union {
- char dummy[sizeof(struct mdp_blit_req_list) +
- sizeof(struct mdp_blit_req) * 1];
- struct mdp_blit_req_list list;
- } img;
-
- if (fb_fd < 0)
- {
- DEBUG_PRINT_ERROR("Warning: /dev/fb0 is not opened!\n");
- return;
- }
-
- img.list.count = 1;
- e = &img.list.req[0];
-
- addr = (unsigned int)(pBufHdr->pBuffer + pBufHdr->nFilledLen);
- // align to a 4 byte boundary
- addr = (addr + 3) & (~3);
-
- // read to the end of existing extra data sections
- pExtraData = (OMX_OTHER_EXTRADATATYPE*)addr;
-
- while (addr < end && pExtraData->eType != (enum OMX_EXTRADATATYPE)OMX_ExtraDataFrameInfo)
- {
- addr += pExtraData->nSize;
- pExtraData = (OMX_OTHER_EXTRADATATYPE*)addr;
- }
-
- if (pExtraData->eType != (enum OMX_EXTRADATATYPE)OMX_ExtraDataFrameInfo)
- {
- DEBUG_PRINT_ERROR("pExtraData->eType %d pExtraData->nSize %d\n",pExtraData->eType,pExtraData->nSize);
- }
- pExtraFrameInfo = (OMX_QCOM_EXTRADATA_FRAMEINFO *)pExtraData->data;
-
- pPMEMInfo = (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *)
- ((OMX_QCOM_PLATFORM_PRIVATE_LIST *)
- pBufHdr->pPlatformPrivate)->entryList->entry;
-#ifdef _ANDROID_
- vheap = (MemoryHeapBase *)pPMEMInfo->pmem_fd;
-#endif
-
-
- DEBUG_PRINT_ERROR("DecWidth %d DecHeight %d\n",portFmt.format.video.nStride,portFmt.format.video.nSliceHeight);
- DEBUG_PRINT_ERROR("DispWidth %d DispHeight %d\n",portFmt.format.video.nFrameWidth,portFmt.format.video.nFrameHeight);
-
-
-
- e->src.width = portFmt.format.video.nStride;
- e->src.height = portFmt.format.video.nSliceHeight;
- e->src.format = MDP_Y_CBCR_H2V2;
- e->src.offset = pPMEMInfo->offset;
-#ifdef _ANDROID_
- e->src.memory_id = vheap->getHeapID();
-#else
- e->src.memory_id = pPMEMInfo->pmem_fd;
-#endif
-
- DEBUG_PRINT_ERROR("pmemOffset %d pmemID %d\n",e->src.offset,e->src.memory_id);
-
- e->dst.width = vinfo.xres;
- e->dst.height = vinfo.yres;
- e->dst.format = MDP_RGB_565;
- e->dst.offset = 0;
- e->dst.memory_id = fb_fd;
-
- e->transp_mask = 0xffffffff;
- DEBUG_PRINT("Frame interlace type %d!\n", pExtraFrameInfo->interlaceType);
- if(pExtraFrameInfo->interlaceType != OMX_QCOM_InterlaceFrameProgressive)
- {
- DEBUG_PRINT("Interlaced Frame!\n");
- e->flags = MDP_DEINTERLACE;
- }
- else
- e->flags = 0;
- e->alpha = 0xff;
-
- switch(displayWindow)
- {
- case 1: destx = 0;
- desty = 0;
- destW = vinfo.xres/2;
- destH = vinfo.yres/2;
- break;
- case 2: destx = vinfo.xres/2;
- desty = 0;
- destW = vinfo.xres/2;
- destH = vinfo.yres/2;
- break;
-
- case 3: destx = 0;
- desty = vinfo.yres/2;
- destW = vinfo.xres/2;
- destH = vinfo.yres/2;
- break;
- case 4: destx = vinfo.xres/2;
- desty = vinfo.yres/2;
- destW = vinfo.xres/2;
- destH = vinfo.yres/2;
- break;
- case 0:
- default:
- destx = 0;
- desty = 0;
- destW = vinfo.xres;
- destH = vinfo.yres;
- }
-
-
- if(portFmt.format.video.nFrameWidth < destW)
- destW = portFmt.format.video.nFrameWidth ;
-
-
- if(portFmt.format.video.nFrameHeight < destH)
- destH = portFmt.format.video.nFrameHeight;
-
- e->dst_rect.x = destx;
- e->dst_rect.y = desty;
- e->dst_rect.w = destW;
- e->dst_rect.h = destH;
-
- //e->dst_rect.w = 800;
- //e->dst_rect.h = 480;
-
- e->src_rect.x = 0;
- e->src_rect.y = 0;
- e->src_rect.w = portFmt.format.video.nFrameWidth;
- e->src_rect.h = portFmt.format.video.nFrameHeight;
-
- //e->src_rect.w = portFmt.format.video.nStride;
- //e->src_rect.h = portFmt.format.video.nSliceHeight;
-
- if (ioctl(fb_fd, MSMFB_BLIT, &img)) {
- DEBUG_PRINT_ERROR("MSMFB_BLIT ioctl failed!\n");
- return;
- }
-
- if (ioctl(fb_fd, FBIOPAN_DISPLAY, &vinfo) < 0) {
- DEBUG_PRINT_ERROR("FBIOPAN_DISPLAY failed! line=%d\n", __LINE__);
- return;
- }
-
- DEBUG_PRINT("render_fb complete!\n");
-}
-
diff --git a/mm-video/vidc/venc/Android.mk b/mm-video/vidc/venc/Android.mk
deleted file mode 100644
index fd86b3f9..00000000
--- a/mm-video/vidc/venc/Android.mk
+++ /dev/null
@@ -1,106 +0,0 @@
-#--------------------------------------------------------------------------
-#Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-#Redistribution and use in source and binary forms, with or without
-#modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of Code Aurora nor
-# the names of its contributors may be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-#IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-#NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-#CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-#EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-#PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-#OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-#OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-#ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#--------------------------------------------------------------------------
-
-ROOT_DIR := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_PATH:= $(ROOT_DIR)
-
-# ---------------------------------------------------------------------------------
-# Common definitons
-# ---------------------------------------------------------------------------------
-
-libmm-venc-def := -g -O3 -Dlrintf=_ffix_r
-libmm-venc-def += -D__align=__alignx
-libmm-venc-def += -D__alignx\(x\)=__attribute__\(\(__aligned__\(x\)\)\)
-libmm-venc-def += -DT_ARM
-libmm-venc-def += -Dinline=__inline
-libmm-venc-def += -D_ANDROID_
-libmm-venc-def += -UENABLE_DEBUG_LOW
-libmm-venc-def += -DENABLE_DEBUG_HIGH
-libmm-venc-def += -DENABLE_DEBUG_ERROR
-
-# ---------------------------------------------------------------------------------
-# Make the Shared library (libOmxVenc)
-# ---------------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-libmm-venc-inc := $(LOCAL_PATH)/inc
-libmm-venc-inc += $(TARGET_OUT_HEADERS)/mm-core/omxcore
-
-LOCAL_MODULE := libOmxVenc
-LOCAL_CFLAGS := $(libmm-venc-def)
-LOCAL_C_INCLUDES := $(libmm-venc-inc)
-
-LOCAL_SHARED_LIBRARIES := liblog libutils libbinder
-
-LOCAL_SRC_FILES := src/omx_video_base.cpp
-LOCAL_SRC_FILES += src/omx_video_encoder.cpp
-LOCAL_SRC_FILES += src/video_encoder_device.cpp
-
-include $(BUILD_SHARED_LIBRARY)
-
-# -----------------------------------------------------------------------------
-# # Make the apps-test (mm-venc-omx-test720p)
-# -----------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-mm-venc-test720p-inc := $(TARGET_OUT_HEADERS)/mm-core/omxcore
-mm-venc-test720p-inc += $(LOCAL_PATH)/inc
-
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE := mm-venc-omx-test720p
-LOCAL_CFLAGS := $(libmm-venc-def)
-LOCAL_C_INCLUDES := $(mm-venc-test720p-inc)
-LOCAL_SHARED_LIBRARIES := libmm-omxcore libOmxVenc libbinder
-
-LOCAL_SRC_FILES := test/venc_test.cpp
-LOCAL_SRC_FILES += test/camera_test.cpp
-LOCAL_SRC_FILES += test/venc_util.c
-LOCAL_SRC_FILES += test/fb_test.c
-
-include $(BUILD_EXECUTABLE)
-
-# -----------------------------------------------------------------------------
-# Make the apps-test (mm-video-driver-test)
-# -----------------------------------------------------------------------------
-
-include $(CLEAR_VARS)
-
-venc-test-inc += $(LOCAL_PATH)/inc
-
-LOCAL_MODULE_TAGS := eng
-LOCAL_MODULE := mm-video-encdrv-test
-LOCAL_C_INCLUDES := $(venc-test-inc)
-
-LOCAL_SRC_FILES := test/video_encoder_test.c
-LOCAL_SRC_FILES += test/queue.c
-
-include $(BUILD_EXECUTABLE)
diff --git a/mm-video/vidc/venc/inc/camera_test.h b/mm-video/vidc/venc/inc/camera_test.h
deleted file mode 100644
index f531ac99..00000000
--- a/mm-video/vidc/venc/inc/camera_test.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef _CAMERA_TEST_H
-#define _CAMERA_TEST_H
-
-#define EXTERN_C_START extern "C" {
-#define EXTERN_C_END }
-
-#ifdef __cplusplus
-EXTERN_C_START
-#endif
-
-typedef void (*CameraPreviewCallback)(int nFD,
- int nOffset,
- void* pPhys,
- void* pVirt,
- long long nTimeStamp);
-
-
-int CameraTest_Initialize(int nFrameRate,
- int nFrameWidth,
- int nFrameHeight,
- CameraPreviewCallback pfnPreviewCallback);
-int CameraTest_Run();
-int CameraTest_ReleaseFrame(void* pPhys, void* pVirt);
-int CameraTest_Exit();
-
-
-#ifdef __cplusplus
-EXTERN_C_END
-#endif
-
-#endif
diff --git a/mm-video/vidc/venc/inc/fb_test.h b/mm-video/vidc/venc/inc/fb_test.h
deleted file mode 100644
index 44fdf232..00000000
--- a/mm-video/vidc/venc/inc/fb_test.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef _FB_TEST_H
-#define _FB_TEST_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-int FBTest_Initialize(int nFrameWidth,
- int nFrameHeight);
-int FBTest_DisplayImage(int nPmemFd, int nOffset);
-int FBTest_Exit();
-
-int FBTest_RunTest();
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // _FB_TEST_H
diff --git a/mm-video/vidc/venc/inc/omx_video_base.h b/mm-video/vidc/venc/inc/omx_video_base.h
deleted file mode 100644
index 034a43bb..00000000
--- a/mm-video/vidc/venc/inc/omx_video_base.h
+++ /dev/null
@@ -1,496 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-#ifndef __OMX_VIDEO_BASE_H__
-#define __OMX_VIDEO_BASE_H__
-/*============================================================================
- O p e n M A X Component
- Video Encoder
-
-*//** @file comx_video_base.h
- This module contains the class definition for openMAX decoder component.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include<stdlib.h>
-#include <stdio.h>
-#ifdef _ANDROID_
- #include <binder/MemoryHeapBase.h>
-#endif // _ANDROID_
-#include <pthread.h>
-#include <semaphore.h>
-#include <linux/msm_vidc_enc.h>
-#include "OMX_Core.h"
-#include "OMX_QCOMExtns.h"
-#include "qc_omx_component.h"
-#include "omx_video_common.h"
-
-
-#ifdef _ANDROID_
-using namespace android;
-// local pmem heap object
-class VideoHeap : public MemoryHeapBase
-{
-public:
- VideoHeap(int fd, size_t size, void* base);
- virtual ~VideoHeap() {}
-};
-
-#include <utils/Log.h>
-//#define LOG_TAG "OMX-VENC-720p"
-#ifdef ENABLE_DEBUG_LOW
-#define DEBUG_PRINT_LOW ALOGE
-#else
-#define DEBUG_PRINT_LOW
-#endif
-#ifdef ENABLE_DEBUG_HIGH
-#define DEBUG_PRINT_HIGH ALOGE
-#else
-#define DEBUG_PRINT_HIGH
-#endif
-#ifdef ENABLE_DEBUG_ERROR
-#define DEBUG_PRINT_ERROR ALOGE
-#else
-#define DEBUG_PRINT_ERROR
-#endif
-#endif // _ANDROID_
-//////////////////////////////////////////////////////////////////////////////
-// Module specific globals
-//////////////////////////////////////////////////////////////////////////////
-
-#define OMX_SPEC_VERSION 0x00000101
-
-
-//////////////////////////////////////////////////////////////////////////////
-// Macros
-//////////////////////////////////////////////////////////////////////////////
-#define PrintFrameHdr(bufHdr) DEBUG_PRINT("bufHdr %x buf %x size %d TS %d\n",\
- (unsigned) bufHdr,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->pBuffer,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nFilledLen,\
- (unsigned)((OMX_BUFFERHEADERTYPE *)bufHdr)->nTimeStamp)
-
-// BitMask Management logic
-#define BITS_PER_BYTE 32
-#define BITMASK_SIZE(mIndex) (((mIndex) + BITS_PER_BYTE - 1)/BITS_PER_BYTE)
-#define BITMASK_OFFSET(mIndex) ((mIndex)/BITS_PER_BYTE)
-#define BITMASK_FLAG(mIndex) (1 << ((mIndex) % BITS_PER_BYTE))
-#define BITMASK_CLEAR(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
- &= ~(BITMASK_FLAG(mIndex))
-#define BITMASK_SET(mArray,mIndex) (mArray)[BITMASK_OFFSET(mIndex)] \
- |= BITMASK_FLAG(mIndex)
-#define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex))
-#define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex)) == 0x0)
-#define BITMASK_PRESENT(mArray,mIndex) ((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex))
-#define BITMASK_ABSENT(mArray,mIndex) (((mArray)[BITMASK_OFFSET(mIndex)] \
- & BITMASK_FLAG(mIndex)) == 0x0)
-
-void* message_thread(void *);
-// OMX video class
-class omx_video: public qc_omx_component
-{
-
-public:
- omx_video(); // constructor
- virtual ~omx_video(); // destructor
-
- // virtual int async_message_process (void *context, void* message);
- void process_event_cb(void *ctxt,unsigned char id);
-
- OMX_ERRORTYPE allocate_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes
- );
-
-
- virtual OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp)= 0;
-
- virtual OMX_ERRORTYPE component_init(OMX_STRING role)= 0;
-
- virtual OMX_U32 dev_stop(void) = 0;
- virtual OMX_U32 dev_pause(void) = 0;
- virtual OMX_U32 dev_start(void) = 0;
- virtual OMX_U32 dev_flush(unsigned) = 0;
- virtual OMX_U32 dev_resume(void) = 0;
- virtual bool dev_use_buf(void *,unsigned) = 0;
- virtual bool dev_free_buf(void *,unsigned) = 0;
- virtual bool dev_empty_buf(void *, void *) = 0;
- virtual bool dev_fill_buf(void *buffer, void *) = 0;
- virtual bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32) = 0;
-
-
- OMX_ERRORTYPE component_role_enum(
- OMX_HANDLETYPE hComp,
- OMX_U8 *role,
- OMX_U32 index
- );
-
- OMX_ERRORTYPE component_tunnel_request(
- OMX_HANDLETYPE hComp,
- OMX_U32 port,
- OMX_HANDLETYPE peerComponent,
- OMX_U32 peerPort,
- OMX_TUNNELSETUPTYPE *tunnelSetup
- );
-
- OMX_ERRORTYPE empty_this_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
-
-
- OMX_ERRORTYPE fill_this_buffer(
- OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
-
- OMX_ERRORTYPE free_buffer(
- OMX_HANDLETYPE hComp,
- OMX_U32 port,
- OMX_BUFFERHEADERTYPE *buffer
- );
-
- OMX_ERRORTYPE get_component_version(
- OMX_HANDLETYPE hComp,
- OMX_STRING componentName,
- OMX_VERSIONTYPE *componentVersion,
- OMX_VERSIONTYPE *specVersion,
- OMX_UUIDTYPE *componentUUID
- );
-
- OMX_ERRORTYPE get_config(
- OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE configIndex,
- OMX_PTR configData
- );
-
- OMX_ERRORTYPE get_extension_index(
- OMX_HANDLETYPE hComp,
- OMX_STRING paramName,
- OMX_INDEXTYPE *indexType
- );
-
- OMX_ERRORTYPE get_parameter(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE paramIndex,
- OMX_PTR paramData);
-
- OMX_ERRORTYPE get_state(OMX_HANDLETYPE hComp,
- OMX_STATETYPE *state);
-
-
-
- OMX_ERRORTYPE send_command(OMX_HANDLETYPE hComp,
- OMX_COMMANDTYPE cmd,
- OMX_U32 param1,
- OMX_PTR cmdData);
-
-
- OMX_ERRORTYPE set_callbacks(OMX_HANDLETYPE hComp,
- OMX_CALLBACKTYPE *callbacks,
- OMX_PTR appData);
-
- virtual OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE configIndex,
- OMX_PTR configData) = 0;
-
- virtual OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE paramIndex,
- OMX_PTR paramData) =0;
-
- OMX_ERRORTYPE use_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
-
- OMX_ERRORTYPE use_EGL_image(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- void * eglImage);
-
-
-
- int m_pipe_in;
- int m_pipe_out;
-
- pthread_t msg_thread_id;
- pthread_t async_thread_id;
-
- OMX_U8 m_nkind[128];
-
-
- //int *input_pmem_fd;
- //int *output_pmem_fd;
- struct pmem *m_pInput_pmem;
- struct pmem *m_pOutput_pmem;
-
-
-public:
- // Bit Positions
- enum flags_bit_positions
- {
- // Defer transition to IDLE
- OMX_COMPONENT_IDLE_PENDING =0x1,
- // Defer transition to LOADING
- OMX_COMPONENT_LOADING_PENDING =0x2,
- // First Buffer Pending
- OMX_COMPONENT_FIRST_BUFFER_PENDING =0x3,
- // Second Buffer Pending
- OMX_COMPONENT_SECOND_BUFFER_PENDING =0x4,
- // Defer transition to Enable
- OMX_COMPONENT_INPUT_ENABLE_PENDING =0x5,
- // Defer transition to Enable
- OMX_COMPONENT_OUTPUT_ENABLE_PENDING =0x6,
- // Defer transition to Disable
- OMX_COMPONENT_INPUT_DISABLE_PENDING =0x7,
- // Defer transition to Disable
- OMX_COMPONENT_OUTPUT_DISABLE_PENDING =0x8,
- //defer flush notification
- OMX_COMPONENT_OUTPUT_FLUSH_PENDING =0x9,
- OMX_COMPONENT_INPUT_FLUSH_PENDING =0xA,
- OMX_COMPONENT_PAUSE_PENDING =0xB,
- OMX_COMPONENT_EXECUTE_PENDING =0xC
-
- };
-
- // Deferred callback identifiers
- enum
- {
- //Event Callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_EVENT = 0x1,
- //Buffer Done callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_BUFFER_DONE = 0x2,
- //Frame Done callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_FRAME_DONE = 0x3,
- //Buffer Done callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_FTB = 0x4,
- //Frame Done callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_ETB = 0x5,
- //Command
- OMX_COMPONENT_GENERATE_COMMAND = 0x6,
- //Push-Pending Buffers
- OMX_COMPONENT_PUSH_PENDING_BUFS = 0x7,
- // Empty Buffer Done callbacks
- OMX_COMPONENT_GENERATE_EBD = 0x8,
- //Flush Event Callbacks from the venc component thread context
- OMX_COMPONENT_GENERATE_EVENT_FLUSH = 0x9,
- OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH = 0x0A,
- OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH = 0x0B,
- OMX_COMPONENT_GENERATE_FBD = 0xc,
- OMX_COMPONENT_GENERATE_START_DONE = 0xD,
- OMX_COMPONENT_GENERATE_PAUSE_DONE = 0xE,
- OMX_COMPONENT_GENERATE_RESUME_DONE = 0xF,
- OMX_COMPONENT_GENERATE_STOP_DONE = 0x10,
- OMX_COMPONENT_GENERATE_HARDWARE_ERROR = 0x11
- };
-
- struct omx_event
- {
- unsigned param1;
- unsigned param2;
- unsigned id;
- };
-
- struct omx_cmd_queue
- {
- omx_event m_q[OMX_CORE_CONTROL_CMDQ_SIZE];
- unsigned m_read;
- unsigned m_write;
- unsigned m_size;
-
- omx_cmd_queue();
- ~omx_cmd_queue();
- bool insert_entry(unsigned p1, unsigned p2, unsigned id);
- bool pop_entry(unsigned *p1,unsigned *p2, unsigned *id);
- // get msgtype of the first ele from the queue
- unsigned get_q_msg_type();
-
- };
-
- bool allocate_done(void);
- bool allocate_input_done(void);
- bool allocate_output_done(void);
-
- OMX_ERRORTYPE free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
- OMX_ERRORTYPE free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr);
-
- OMX_ERRORTYPE allocate_input_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes);
-
- OMX_ERRORTYPE allocate_output_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,OMX_PTR appData,
- OMX_U32 bytes);
-
- OMX_ERRORTYPE use_input_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
- OMX_ERRORTYPE use_output_buffer(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE **bufferHdr,
- OMX_U32 port,
- OMX_PTR appData,
- OMX_U32 bytes,
- OMX_U8 *buffer);
-
- bool execute_omx_flush(OMX_U32);
- bool execute_output_flush(void);
- bool execute_input_flush(void);
- OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer);
-
- OMX_ERRORTYPE fill_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer);
- OMX_ERRORTYPE empty_this_buffer_proxy(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer);
-
- OMX_ERRORTYPE fill_this_buffer_proxy(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE *buffer);
- bool release_done();
-
- bool release_output_done();
- bool release_input_done();
-
- OMX_ERRORTYPE send_command_proxy(OMX_HANDLETYPE hComp,
- OMX_COMMANDTYPE cmd,
- OMX_U32 param1,
- OMX_PTR cmdData);
- bool post_event( unsigned int p1,
- unsigned int p2,
- unsigned int id
- );
-
- inline void omx_report_error ()
- {
- m_state = OMX_StateInvalid;
- if(m_pCallbacks.EventHandler)
- {
- m_pCallbacks.EventHandler(&m_cmp,m_app_data,
- OMX_EventError,OMX_ErrorHardware,0,NULL);
- m_pCallbacks.EventHandler(&m_cmp,m_app_data,
- OMX_EventError, OMX_ErrorInvalidState,0, NULL);
- }
- }
-
-
- //*************************************************************
- //*******************MEMBER VARIABLES *************************
- //*************************************************************
-
- pthread_mutex_t m_lock;
- sem_t m_cmd_lock;
-
-
- //sem to handle the minimum procesing of commands
-
-
- // compression format
- //OMX_VIDEO_CODINGTYPE eCompressionFormat;
- // OMX State
- OMX_STATETYPE m_state;
- // Application data
- OMX_PTR m_app_data;
- OMX_BOOL m_use_input_pmem;
- OMX_BOOL m_use_output_pmem;
- // Application callbacks
- OMX_CALLBACKTYPE m_pCallbacks;
- OMX_PORT_PARAM_TYPE m_sPortParam;
- OMX_VIDEO_PARAM_PROFILELEVELTYPE m_sParamProfileLevel;
- OMX_VIDEO_PARAM_PORTFORMATTYPE m_sInPortFormat;
- OMX_VIDEO_PARAM_PORTFORMATTYPE m_sOutPortFormat;
- OMX_PARAM_PORTDEFINITIONTYPE m_sInPortDef;
- OMX_PARAM_PORTDEFINITIONTYPE m_sOutPortDef;
- OMX_VIDEO_PARAM_MPEG4TYPE m_sParamMPEG4;
- OMX_VIDEO_PARAM_H263TYPE m_sParamH263;
- OMX_VIDEO_PARAM_AVCTYPE m_sParamAVC;
- OMX_PORT_PARAM_TYPE m_sPortParam_img;
- OMX_PORT_PARAM_TYPE m_sPortParam_audio;
- OMX_VIDEO_CONFIG_BITRATETYPE m_sConfigBitrate;
- OMX_CONFIG_FRAMERATETYPE m_sConfigFramerate;
- OMX_VIDEO_PARAM_BITRATETYPE m_sParamBitrate;
- OMX_PRIORITYMGMTTYPE m_sPriorityMgmt;
- OMX_PARAM_BUFFERSUPPLIERTYPE m_sInBufSupplier;
- OMX_PARAM_BUFFERSUPPLIERTYPE m_sOutBufSupplier;
- OMX_CONFIG_ROTATIONTYPE m_sConfigFrameRotation;
- OMX_CONFIG_INTRAREFRESHVOPTYPE m_sConfigIntraRefreshVOP;
- OMX_VIDEO_PARAM_QUANTIZATIONTYPE m_sSessionQuantization;
- OMX_VIDEO_PARAM_AVCSLICEFMO m_sAVCSliceFMO;
-
- // fill this buffer queue
- omx_cmd_queue m_ftb_q;
- // Command Q for rest of the events
- omx_cmd_queue m_cmd_q;
- omx_cmd_queue m_etb_q;
- // Input memory pointer
- OMX_BUFFERHEADERTYPE *m_inp_mem_ptr;
- // Output memory pointer
- OMX_BUFFERHEADERTYPE *m_out_mem_ptr;
-
- bool input_flush_progress;
- bool output_flush_progress;
- bool input_use_buffer;
- bool output_use_buffer;
- int pending_input_buffers;
- int pending_output_buffers;
-
- unsigned int m_out_bm_count;
- unsigned int m_inp_bm_count;
- unsigned int m_flags;
- unsigned int m_etb_count;
- unsigned int m_fbd_count;
-#ifdef _ANDROID_
- // Heap pointer to frame buffers
- sp<MemoryHeapBase> m_heap_ptr;
-#endif //_ANDROID_
- // to know whether Event Port Settings change has been triggered or not.
- bool m_event_port_settings_sent;
- OMX_U8 m_cRole[OMX_MAX_STRINGNAME_SIZE];
-};
-
-#endif // __OMX_VIDEO_BASE_H__
diff --git a/mm-video/vidc/venc/inc/omx_video_common.h b/mm-video/vidc/venc/inc/omx_video_common.h
deleted file mode 100644
index 74803ab8..00000000
--- a/mm-video/vidc/venc/inc/omx_video_common.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-
-#ifndef __OMX_VIDEO_COMMON_H__
-#define __OMX_VIDEO_COMMON_H__
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include<stdlib.h>
-#include <stdio.h>
-
-#define OMX_VIDEO_DEC_NUM_INPUT_BUFFERS 2
-#define OMX_VIDEO_DEC_NUM_OUTPUT_BUFFERS 2
-
-#ifdef FEATURE_QTV_WVGA_ENABLE
-#define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE (256*1024)
-#else
-#define OMX_VIDEO_DEC_INPUT_BUFFER_SIZE (128*1024)
-#endif
-
-#define OMX_CORE_CONTROL_CMDQ_SIZE 100
-#define OMX_CORE_QCIF_HEIGHT 144
-#define OMX_CORE_QCIF_WIDTH 176
-#define OMX_CORE_VGA_HEIGHT 480
-#define OMX_CORE_VGA_WIDTH 640
-#define OMX_CORE_WVGA_HEIGHT 480
-#define OMX_CORE_WVGA_WIDTH 800
-
-enum PortIndexType
-{
- PORT_INDEX_IN = 0,
- PORT_INDEX_OUT = 1,
- PORT_INDEX_BOTH = -1,
- PORT_INDEX_NONE = -2
-};
-
-struct pmem
-{
- void *buffer;
- int fd;
- unsigned offset;
- unsigned size;
-};
-
-#endif // __OMX_VIDEO_COMMON_H__
-
-
-
-
diff --git a/mm-video/vidc/venc/inc/omx_video_encoder.h b/mm-video/vidc/venc/inc/omx_video_encoder.h
deleted file mode 100644
index df3e1fa3..00000000
--- a/mm-video/vidc/venc/inc/omx_video_encoder.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef __OMX_VENC__H
-#define __OMX_VENC__H
-
-#include "omx_video_base.h"
-#include "video_encoder_device.h"
-
-extern "C" {
- OMX_API void * get_omx_component_factory_fn(void);
-}
-
-class omx_venc: public omx_video
-{
-public:
- omx_venc(); //constructor
- ~omx_venc(); //des
- static int async_message_process (void *context, void* message);
- OMX_ERRORTYPE component_init(OMX_STRING role);
- OMX_ERRORTYPE set_parameter(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE paramIndex,
- OMX_PTR paramData);
- OMX_ERRORTYPE set_config(OMX_HANDLETYPE hComp,
- OMX_INDEXTYPE configIndex,
- OMX_PTR configData);
- OMX_ERRORTYPE component_deinit(OMX_HANDLETYPE hComp);
- //OMX strucutres
- OMX_U32 m_nVenc_format;
- class venc_dev *handle;
-
-private:
- OMX_U32 dev_stop(void);
- OMX_U32 dev_pause(void);
- OMX_U32 dev_start(void);
- OMX_U32 dev_flush(unsigned);
- OMX_U32 dev_resume(void);
- bool dev_use_buf( void *,unsigned);
- bool dev_free_buf( void *,unsigned);
- bool dev_empty_buf(void *, void *);
- bool dev_fill_buf(void *, void *);
- bool dev_get_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
- bool dev_set_buf_req(OMX_U32 *,OMX_U32 *,OMX_U32 *,OMX_U32);
-};
-
-#endif //__OMX_VENC__H
diff --git a/mm-video/vidc/venc/inc/queue.h b/mm-video/vidc/venc/inc/queue.h
deleted file mode 100644
index 35200e00..00000000
--- a/mm-video/vidc/venc/inc/queue.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef QUEUE_H
-#define QUEUE_H
-
-#include<pthread.h>
-#include <semaphore.h>
-#include <stdio.h>
-#include <string.h>
-
-/* Message Queue structure */
-struct video_msgq
-{
- /* Command to be executed */
- unsigned int cmd;
-
- unsigned int status;
-
- /* Client-specific data */
- void *clientdata;
-};
-
-
-/* Thread & Message Queue information */
-struct video_queue_context
-{
- /* Message Queue related members */
- pthread_mutex_t mutex;
- sem_t sem_message;
- int commandq_size;
- int dataq_size;
- struct video_msgq *ptr_dataq;
- struct video_msgq *ptr_cmdq;
- int write_dataq ;
- int read_dataq;
- int write_comq ;
- int read_comq ;
-
-};
-
-int check_if_queue_empty ( unsigned int queuetocheck,void* queuecontext );
-
-struct video_msgq * queue_get_cmd ( void* queuecontext );
-
-
-
-int queue_post_cmdq ( void *queuecontext,
- struct video_msgq *post_msg
- );
-
-int queue_post_dataq ( void *queuecontext,
- struct video_msgq *post_msg
- );
-
-#endif /* QUEUE_H */
diff --git a/mm-video/vidc/venc/inc/venc_util.h b/mm-video/vidc/venc/inc/venc_util.h
deleted file mode 100644
index b315e4c6..00000000
--- a/mm-video/vidc/venc/inc/venc_util.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- V E N C _ U T I L. H
-
-DESCRIPTION
-
-
-REFERENCES
-
-
-============================================================================*/
-
-#ifndef _VENC_UTIL_H
-#define _VENC_UTIL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-long long GetTimeStamp();
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/mm-video/vidc/venc/inc/video_encoder_device.h b/mm-video/vidc/venc/inc/video_encoder_device.h
deleted file mode 100644
index 56870187..00000000
--- a/mm-video/vidc/venc/inc/video_encoder_device.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#ifndef __OMX_VENC_DEV__
-#define __OMX_VENC_DEV__
-
-#include "OMX_Types.h"
-#include "OMX_Core.h"
-#include "OMX_QCOMExtns.h"
-#include "qc_omx_component.h"
-#include "omx_video_common.h"
-#include <linux/msm_vidc_enc.h>
-
-
-void* async_venc_message_thread (void *);
-
-class venc_dev
-{
-public:
- venc_dev(); //constructor
- ~venc_dev(); //des
-
- bool venc_open(OMX_U32);
- void venc_close();
- unsigned venc_stop(void);
- unsigned venc_pause(void);
- unsigned venc_start(void);
- unsigned venc_flush(unsigned);
-
- unsigned venc_resume(void);
- bool venc_use_buf(void*, unsigned);
- bool venc_free_buf(void*, unsigned);
- bool venc_empty_buf(void *, void *);
- bool venc_fill_buf(void *, void *);
-
- bool venc_get_buf_req(unsigned long *,unsigned long *,
- unsigned long *,unsigned long);
- bool venc_set_buf_req(unsigned long *,unsigned long *,
- unsigned long *,unsigned long);
- bool venc_set_param(void *,OMX_INDEXTYPE);
- bool venc_set_config(void *configData, OMX_INDEXTYPE index);
- bool venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel);
- OMX_U32 m_nDriver_fd;
- bool m_profile_set;
- bool m_level_set;
-
-private:
- struct venc_basecfg m_sVenc_cfg;
- struct venc_ratectrlcfg rate_ctrl;
- struct venc_targetbitrate bit_rate;
- struct venc_intraperiod intra_period;
- struct venc_profile codec_profile;
- struct ven_profilelevel profile_level;
- struct venc_switch set_param;
- struct venc_voptimingcfg time_inc;
- struct venc_allocatorproperty m_sInput_buff_property;
- struct venc_allocatorproperty m_sOutput_buff_property;
- struct venc_sessionqp session_qp;
- struct venc_multiclicecfg multislice_cfg;
-
- bool venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel);
- bool venc_set_intra_period(OMX_U32 nPFrames);
- bool venc_set_target_bitrate(OMX_U32 nTargetBitrate);
- bool venc_set_ratectrl_cfg(OMX_VIDEO_CONTROLRATETYPE eControlRate);
- bool venc_set_session_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp);
- bool venc_set_encode_framerate(OMX_U32 encode_framerate);
- bool venc_set_intra_vop_refresh(OMX_BOOL intra_vop_refresh);
- bool venc_set_color_format(OMX_COLOR_FORMATTYPE color_format);
- bool venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel);
- bool venc_set_multislice_cfg(OMX_VIDEO_AVCSLICEMODETYPE eSliceMode);
-};
-
-#endif
diff --git a/mm-video/vidc/venc/inc/video_encoder_test.h b/mm-video/vidc/venc/inc/video_encoder_test.h
deleted file mode 100644
index d67ffeff..00000000
--- a/mm-video/vidc/venc/inc/video_encoder_test.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include <stdio.h>
-#include <stdlib.h>
-#include "queue.h"
-#include<fcntl.h>
-#include<sys/ioctl.h>
-#include <sys/mman.h>
-#include <linux/msm_vidc_enc.h>
-#include<pthread.h>
-#include <semaphore.h>
-#include <stdio.h>
-
-#define INPUT_BUFFER 0
-#define OUTPUT_BUFFER 1
-
-struct video_encoder_context
-{
- unsigned long input_width;
- unsigned long input_height;
- unsigned long codectype;
- unsigned long fps_num;
- unsigned long fps_den;
- unsigned long targetbitrate;
- unsigned long inputformat;
-
- struct venc_allocatorproperty input_buffer;
- struct venc_allocatorproperty output_buffer;
- struct venc_bufferpayload **ptr_inputbuffer;
- struct venc_bufferpayload **ptr_outputbuffer;
- struct video_queue_context queue_context;
- int video_driver_fd;
-
- FILE * inputBufferFile;
- FILE * outputBufferFile;
-
- pthread_t videothread_id;
- pthread_t asyncthread_id;
- sem_t sem_synchronize;
-};
-
-int init_encoder ( struct video_encoder_context *init_decode );
-int allocate_buffer ( unsigned int buffer_dir,
- struct video_encoder_context *decode_context
- );
-int free_buffer ( unsigned int buffer_dir,
- struct video_encoder_context *decode_context
- );
-int start_encoding (struct video_encoder_context *decode_context);
-int stop_encoding (struct video_encoder_context *decode_context);
-int deinit_encoder (struct video_encoder_context *init_decode);
diff --git a/mm-video/vidc/venc/src/omx_video_base.cpp b/mm-video/vidc/venc/src/omx_video_base.cpp
deleted file mode 100644
index 2255b552..00000000
--- a/mm-video/vidc/venc/src/omx_video_base.cpp
+++ /dev/null
@@ -1,3530 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- O p e n M A X w r a p p e r s
- O p e n M A X C o r e
-
-*//** @file omx_video_base.cpp
- This module contains the implementation of the OpenMAX core & component.
-
-*//*========================================================================*/
-
-//////////////////////////////////////////////////////////////////////////////
-// Include Files
-//////////////////////////////////////////////////////////////////////////////
-
-#include <string.h>
-#include "omx_video_base.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#define H264_SUPPORTED_WIDTH (480)
-#define H264_SUPPORTED_HEIGHT (368)
-
-#define MPEG4_SUPPORTED_WIDTH (480)
-#define MPEG4_SUPPORTED_HEIGHT (368)
-
-#define VC1_SP_MP_START_CODE 0xC5000000
-#define VC1_SP_MP_START_CODE_MASK 0xFF000000
-#define VC1_AP_START_CODE 0x00000100
-#define VC1_AP_START_CODE_MASK 0xFFFFFF00
-#define VC1_STRUCT_C_PROFILE_MASK 0xF0
-#define VC1_STRUCT_B_LEVEL_MASK 0xE0000000
-#define VC1_SIMPLE_PROFILE 0
-#define VC1_MAIN_PROFILE 1
-#define VC1_ADVANCE_PROFILE 3
-#define VC1_SIMPLE_PROFILE_LOW_LEVEL 0
-#define VC1_SIMPLE_PROFILE_MED_LEVEL 2
-#define VC1_STRUCT_C_LEN 4
-#define VC1_STRUCT_C_POS 8
-#define VC1_STRUCT_A_POS 12
-#define VC1_STRUCT_B_POS 24
-#define VC1_SEQ_LAYER_SIZE 36
-
-typedef struct OMXComponentCapabilityFlagsType
-{
- ////////////////// OMX COMPONENT CAPABILITY RELATED MEMBERS
- OMX_BOOL iIsOMXComponentMultiThreaded;
- OMX_BOOL iOMXComponentSupportsExternalOutputBufferAlloc;
- OMX_BOOL iOMXComponentSupportsExternalInputBufferAlloc;
- OMX_BOOL iOMXComponentSupportsMovableInputBuffers;
- OMX_BOOL iOMXComponentSupportsPartialFrames;
- OMX_BOOL iOMXComponentUsesNALStartCodes;
- OMX_BOOL iOMXComponentCanHandleIncompleteFrames;
- OMX_BOOL iOMXComponentUsesFullAVCFrames;
-
-} OMXComponentCapabilityFlagsType;
-#define OMX_COMPONENT_CAPABILITY_TYPE_INDEX 0xFF7A347
-
-void* message_thread(void *input)
-{
- omx_video* omx = reinterpret_cast<omx_video*>(input);
- unsigned char id;
- int n;
-
- DEBUG_PRINT_LOW("omx_venc: message thread start\n");
- while(1)
- {
- n = read(omx->m_pipe_in, &id, 1);
- if(0 == n)
- {
- break;
- }
-
- if(1 == n)
- {
- omx->process_event_cb(omx, id);
- }
-#ifdef QLE_BUILD
- if(n < 0) break;
-#else
- if((n < 0) && (errno != EINTR)) break;
-#endif
- }
- DEBUG_PRINT_LOW("omx_venc: message thread stop\n");
- return 0;
-}
-
-void post_message(omx_video *omx, unsigned char id)
-{
- DEBUG_PRINT_LOW("omx_venc: post_message %d\n", id);
- write(omx->m_pipe_out, &id, 1);
-}
-
-// omx_cmd_queue destructor
-omx_video::omx_cmd_queue::~omx_cmd_queue()
-{
- // Nothing to do
-}
-
-// omx cmd queue constructor
-omx_video::omx_cmd_queue::omx_cmd_queue(): m_read(0),m_write(0),m_size(0)
-{
- memset(m_q,0,sizeof(omx_event)*OMX_CORE_CONTROL_CMDQ_SIZE);
-}
-
-// omx cmd queue insert
-bool omx_video::omx_cmd_queue::insert_entry(unsigned p1, unsigned p2, unsigned id)
-{
- bool ret = true;
- if(m_size < OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_q[m_write].id = id;
- m_q[m_write].param1 = p1;
- m_q[m_write].param2 = p2;
- m_write++;
- m_size ++;
- if(m_write >= OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_write = 0;
- }
- }
- else
- {
- ret = false;
- DEBUG_PRINT_ERROR("ERROR!!! Command Queue Full\n");
- }
- return ret;
-}
-
-// omx cmd queue pop
-bool omx_video::omx_cmd_queue::pop_entry(unsigned *p1, unsigned *p2, unsigned *id)
-{
- bool ret = true;
- if(m_size > 0)
- {
- *id = m_q[m_read].id;
- *p1 = m_q[m_read].param1;
- *p2 = m_q[m_read].param2;
- // Move the read pointer ahead
- ++m_read;
- --m_size;
- if(m_read >= OMX_CORE_CONTROL_CMDQ_SIZE)
- {
- m_read = 0;
- }
- }
- else
- {
- ret = false;
- }
- return ret;
-}
-
-// Retrieve the first mesg type in the queue
-unsigned omx_video::omx_cmd_queue::get_q_msg_type()
-{
- return m_q[m_read].id;
-}
-
-
-
-#ifdef _ANDROID_
-VideoHeap::VideoHeap(int fd, size_t size, void* base)
-{
- // dup file descriptor, map once, use pmem
- init(dup(fd), base, size, 0 , "/dev/pmem_adsp");
-}
-#endif // _ANDROID_
-
-/* ======================================================================
-FUNCTION
- omx_venc::omx_venc
-
-DESCRIPTION
- Constructor
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-omx_video::omx_video(): m_state(OMX_StateInvalid),
- m_app_data(NULL),
- m_inp_mem_ptr(NULL),
- m_out_mem_ptr(NULL),
- pending_input_buffers(0),
- pending_output_buffers(0),
- m_out_bm_count(0),
- m_inp_bm_count(0),
- m_flags(0),
- m_event_port_settings_sent(false),
- output_flush_progress (false),
- input_flush_progress (false),
- input_use_buffer (false),
- output_use_buffer (false),
- m_use_input_pmem(OMX_FALSE),
- m_use_output_pmem(OMX_FALSE),
- m_etb_count(0),
- m_fbd_count(0)
-{
- DEBUG_PRINT_HIGH("\n omx_video(): Inside Constructor()");
- memset(&m_cmp,0,sizeof(m_cmp));
- memset(&m_pCallbacks,0,sizeof(m_pCallbacks));
-
- pthread_mutex_init(&m_lock, NULL);
- sem_init(&m_cmd_lock,0,0);
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::~omx_venc
-
-DESCRIPTION
- Destructor
-
-PARAMETERS
- None
-
-RETURN VALUE
- None.
-========================================================================== */
-omx_video::~omx_video()
-{
- DEBUG_PRINT_HIGH("\n ~omx_video(): Inside Destructor()");
- if(m_pipe_in) close(m_pipe_in);
- if(m_pipe_out) close(m_pipe_out);
- DEBUG_PRINT_HIGH("omx_video: Waiting on Msg Thread exit\n");
- pthread_join(msg_thread_id,NULL);
- DEBUG_PRINT_HIGH("omx_video: Waiting on Async Thread exit\n");
- pthread_join(async_thread_id,NULL);
- pthread_mutex_destroy(&m_lock);
- sem_destroy(&m_cmd_lock);
- DEBUG_PRINT_HIGH("\n m_etb_count = %u, m_fbd_count = %u\n", m_etb_count,
- m_fbd_count);
- DEBUG_PRINT_HIGH("omx_video: Destructor exit\n");
- DEBUG_PRINT_HIGH("Exiting 7x30 OMX Video Encoder ...\n");
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::OMXCntrlProcessMsgCb
-
-DESCRIPTION
- IL Client callbacks are generated through this routine. The decoder
- provides the thread context for this routine.
-
-PARAMETERS
- ctxt -- Context information related to the self.
- id -- Event identifier. This could be any of the following:
- 1. Command completion event
- 2. Buffer done callback event
- 3. Frame done callback event
-
-RETURN VALUE
- None.
-
-========================================================================== */
-void omx_video::process_event_cb(void *ctxt, unsigned char id)
-{
- unsigned p1; // Parameter - 1
- unsigned p2; // Parameter - 2
- unsigned ident;
- unsigned qsize=0; // qsize
- omx_video *pThis = (omx_video *) ctxt;
-
- if(!pThis)
- {
- DEBUG_PRINT_ERROR("ERROR:ProcessMsgCb:Context is incorrect; bailing out\n");
- return;
- }
-
- // Protect the shared queue data structure
- do
- {
- /*Read the message id's from the queue*/
-
- pthread_mutex_lock(&pThis->m_lock);
- qsize = pThis->m_cmd_q.m_size;
- if(qsize)
- {
- pThis->m_cmd_q.pop_entry(&p1,&p2,&ident);
- }
-
- if(qsize == 0)
- {
- qsize = pThis->m_ftb_q.m_size;
- if(qsize)
- {
- pThis->m_ftb_q.pop_entry(&p1,&p2,&ident);
- }
- }
-
- if(qsize == 0)
- {
- qsize = pThis->m_etb_q.m_size;
- if(qsize)
- {
- pThis->m_etb_q.pop_entry(&p1,&p2,&ident);
- }
- }
-
- pthread_mutex_unlock(&pThis->m_lock);
-
- /*process message if we have one*/
- if(qsize > 0)
- {
- id = ident;
- switch(id)
- {
- case OMX_COMPONENT_GENERATE_EVENT:
- if(pThis->m_pCallbacks.EventHandler)
- {
- switch(p1)
- {
- case OMX_CommandStateSet:
- pThis->m_state = (OMX_STATETYPE) p2;
- DEBUG_PRINT_LOW("Process -> state set to %d \n", pThis->m_state);
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL);
- break;
-
- case OMX_EventError:
- DEBUG_PRINT_ERROR("\nERROR: OMX_EventError: p2 = %d\n", p2);
- if(p2 == OMX_StateInvalid)
- {
- pThis->m_state = (OMX_STATETYPE) p2;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError, OMX_ErrorInvalidState, p2, NULL);
- }
- else if(p2 == OMX_ErrorHardware)
- {
- pThis->m_state = OMX_StateInvalid;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError,OMX_ErrorHardware,0,NULL);
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError, OMX_ErrorInvalidState, p2, NULL);
-
- }
- else
- {
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventError, p2, NULL, NULL );
-
- }
- break;
-
- case OMX_CommandPortDisable:
- DEBUG_PRINT_LOW("Process -> Port %d set to PORT_STATE_DISABLED" \
- "state \n", p2);
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL );
- break;
- case OMX_CommandPortEnable:
- DEBUG_PRINT_LOW("Process ->Port %d set PORT_STATE_ENABLED state\n" \
- , p2);
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,\
- OMX_EventCmdComplete, p1, p2, NULL );
- break;
-
- default:
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete, p1, p2, NULL );
- break;
-
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: ProcessMsgCb NULL callbacks\n");
- }
- break;
-
- case OMX_COMPONENT_GENERATE_ETB:
- if(pThis->empty_this_buffer_proxy((OMX_HANDLETYPE)p1,\
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\nERROR: ETBProxy() failed!\n");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_FTB:
- if( pThis->fill_this_buffer_proxy((OMX_HANDLETYPE)p1,\
- (OMX_BUFFERHEADERTYPE *)p2) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\nERROR: FTBProxy() failed!\n");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_COMMAND:
- pThis->send_command_proxy(&pThis->m_cmp,(OMX_COMMANDTYPE)p1,\
- (OMX_U32)p2,(OMX_PTR)NULL);
- break;
-
- case OMX_COMPONENT_GENERATE_EBD:
- if( pThis->empty_buffer_done(&pThis->m_cmp,
- (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone)
- {
- DEBUG_PRINT_ERROR("\nERROR: empty_buffer_done() failed!\n");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_FBD:
- if( pThis->fill_buffer_done(&pThis->m_cmp,
- (OMX_BUFFERHEADERTYPE *)p1) != OMX_ErrorNone )
- {
- DEBUG_PRINT_ERROR("\nERROR: fill_buffer_done() failed!\n");
- pThis->omx_report_error ();
- }
- break;
-
- case OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH:
-
- pThis->input_flush_progress = false;
- DEBUG_PRINT_HIGH("\nm_etb_count at i/p flush = %u", m_etb_count);
- m_etb_count = 0;
- if(pThis->m_pCallbacks.EventHandler)
- {
- /*Check if we need generate event for Flush done*/
- if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_INPUT_FLUSH_PENDING))
- {
- BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_INPUT_FLUSH_PENDING);
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandFlush,
- PORT_INDEX_IN,NULL );
- }
- else if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_IDLE_PENDING))
- {
- if(!pThis->output_flush_progress)
- {
- printf("\n dev_stop called after input flush complete\n");
- if(dev_stop() != 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_stop() failed in i/p flush!\n");
- pThis->omx_report_error ();
- }
- }
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH:
-
- pThis->output_flush_progress = false;
- DEBUG_PRINT_HIGH("\nm_fbd_count at o/p flush = %u", m_fbd_count);
- m_fbd_count = 0;
- if(pThis->m_pCallbacks.EventHandler)
- {
- /*Check if we need generate event for Flush done*/
- if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_OUTPUT_FLUSH_PENDING))
- {
- BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING);
-
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandFlush,
- PORT_INDEX_OUT,NULL );
- }
- else if(BITMASK_PRESENT(&pThis->m_flags ,OMX_COMPONENT_IDLE_PENDING))
- {
- printf("\n dev_stop called after Output flush complete\n");
- if(!pThis->input_flush_progress)
- {
- if(dev_stop() != 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_stop() failed in o/p flush!\n");
- pThis->omx_report_error ();
- }
- }
- }
- }
- break;
-
- case OMX_COMPONENT_GENERATE_START_DONE:
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_START_DONE msg");
-
- if(pThis->m_pCallbacks.EventHandler)
- {
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_START_DONE Success");
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING))
- {
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_START_DONE Move to \
- executing");
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING);
- pThis->m_state = OMX_StateExecuting;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateExecuting, NULL);
- }
- else if(BITMASK_PRESENT(&pThis->m_flags,
- OMX_COMPONENT_PAUSE_PENDING))
- {
- if(dev_pause())
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_pause() failed in Start Done!\n");
- pThis->omx_report_error ();
- }
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n Event Handler callback is NULL");
- }
- break;
-
- case OMX_COMPONENT_GENERATE_PAUSE_DONE:
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_PAUSE_DONE msg");
- if(pThis->m_pCallbacks.EventHandler)
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_PAUSE_PENDING))
- {
- //Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_PAUSE_PENDING);
- pThis->m_state = OMX_StatePause;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StatePause, NULL);
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_RESUME_DONE:
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_RESUME_DONE msg");
- if(pThis->m_pCallbacks.EventHandler)
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING);
- pThis->m_state = OMX_StateExecuting;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp, pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateExecuting,NULL);
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_STOP_DONE:
- DEBUG_PRINT_LOW("\n OMX_COMPONENT_GENERATE_STOP_DONE msg");
- if(pThis->m_pCallbacks.EventHandler)
- {
- if(BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_IDLE_PENDING);
- pThis->m_state = OMX_StateIdle;
- pThis->m_pCallbacks.EventHandler(&pThis->m_cmp,pThis->m_app_data,
- OMX_EventCmdComplete,OMX_CommandStateSet,
- OMX_StateIdle,NULL);
- }
- }
-
- break;
-
- case OMX_COMPONENT_GENERATE_HARDWARE_ERROR:
- DEBUG_PRINT_ERROR("\nERROR: OMX_COMPONENT_GENERATE_HARDWARE_ERROR!\n");
- pThis->omx_report_error ();
- break;
-
- default:
- break;
- }
- }
-
- pthread_mutex_lock(&pThis->m_lock);
- qsize = pThis->m_cmd_q.m_size + pThis->m_ftb_q.m_size +\
- pThis->m_etb_q.m_size;
-
- pthread_mutex_unlock(&pThis->m_lock);
-
- }
- while(qsize>0);
- printf("\n exited the while loop\n");
-
-}
-
-
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::GetComponentVersion
-
-DESCRIPTION
- Returns the component version.
-
-PARAMETERS
- TBD.
-
-RETURN VALUE
- OMX_ErrorNone.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::get_component_version
-(
-OMX_IN OMX_HANDLETYPE hComp,
-OMX_OUT OMX_STRING componentName,
-OMX_OUT OMX_VERSIONTYPE* componentVersion,
-OMX_OUT OMX_VERSIONTYPE* specVersion,
-OMX_OUT OMX_UUIDTYPE* componentUUID
-)
-{
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Get Comp Version in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- /* TBD -- Return the proper version */
- return OMX_ErrorNone;
-}
-/* ======================================================================
-FUNCTION
- omx_venc::SendCommand
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::send_command(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData
- )
-{
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Send Command in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if(cmd == OMX_CommandFlush || cmd == OMX_CommandPortDisable || cmd == OMX_CommandPortEnable)
- {
- if((param1 != PORT_INDEX_IN) && (param1 != PORT_INDEX_OUT) && (param1 != PORT_INDEX_BOTH))
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::send_command-->bad port index\n");
- return OMX_ErrorBadPortIndex;
- }
- }
- if(cmd == OMX_CommandMarkBuffer)
- {
- if(param1 != PORT_INDEX_IN)
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::send_command-->bad port index \n");
- return OMX_ErrorBadPortIndex;
- }
- if(!cmdData)
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::send_command-->param is null");
- return OMX_ErrorBadParameter;
- }
- }
-
- post_event((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
- sem_wait(&m_cmd_lock);
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::SendCommand
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::send_command_proxy(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_COMMANDTYPE cmd,
- OMX_IN OMX_U32 param1,
- OMX_IN OMX_PTR cmdData
- )
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_STATETYPE eState = (OMX_STATETYPE) param1;
- int bFlag = 1;
-
- if(cmd == OMX_CommandStateSet)
- {
- /***************************/
- /* Current State is Loaded */
- /***************************/
- if(m_state == OMX_StateLoaded)
- {
- if(eState == OMX_StateIdle)
- {
- //if all buffers are allocated or all ports disabled
- if(allocate_done() ||
- ( m_sInPortDef.bEnabled == OMX_FALSE && m_sOutPortDef.bEnabled == OMX_FALSE))
- {
- DEBUG_PRINT_LOW("OMXCORE-SM: Loaded-->Idle\n");
- }
- else
- {
- DEBUG_PRINT_LOW("OMXCORE-SM: Loaded-->Idle-Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_IDLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- /* Requesting transition from Loaded to Loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Loaded-->Loaded\n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Loaded to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("OMXCORE-SM: Loaded-->WaitForResources\n");
- }
- /* Requesting transition from Loaded to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Loaded-->Executing\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Loaded to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Loaded-->Pause\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Loaded to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Loaded-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Loaded-->Invalid(%d Not Handled)\n",\
- eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
-
- /***************************/
- /* Current State is IDLE */
- /***************************/
- else if(m_state == OMX_StateIdle)
- {
- if(eState == OMX_StateLoaded)
- {
- if(release_done())
- {
- /*
- Since error is None , we will post an event at the end
- of this function definition
- */
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Loaded\n");
- if(dev_stop() != 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_stop() failed at Idle --> Loaded");
- eRet = OMX_ErrorHardware;
- }
- }
- else
- {
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Loaded-Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_LOADING_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- /* Requesting transition from Idle to Executing */
- else if(eState == OMX_StateExecuting)
- {
- if( dev_start() )
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_start() failed in SCP on Idle --> Exe\n");
- omx_report_error ();
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_EXECUTE_PENDING);
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Executing\n");
- bFlag = 0;
- }
-
- }
- /* Requesting transition from Idle to Idle */
- else if(eState == OMX_StateIdle)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Idle-->Idle\n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Idle to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Idle-->WaitForResources\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Idle to Pause */
- else if(eState == OMX_StatePause)
- {
- /*To pause the Video core we need to start the driver*/
- if( dev_start() )
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_start() failed in SCP on Idle --> Pause\n");
- omx_report_error ();
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_PAUSE_PENDING);
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Executing\n");
- bFlag = 0;
- }
- }
- /* Requesting transition from Idle to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Idle-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Idle --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
-
- /******************************/
- /* Current State is Executing */
- /******************************/
- else if(m_state == OMX_StateExecuting)
- {
- /* Requesting transition from Executing to Idle */
- if(eState == OMX_StateIdle)
- {
- /* Since error is None , we will post an event
- at the end of this function definition
- */
- DEBUG_PRINT_LOW("\n OMXCORE-SM: Executing --> Idle \n");
- //here this should be Pause-Idle pending and should be cleared when flush is complete and change the state to Idle
- BITMASK_SET(&m_flags,OMX_COMPONENT_IDLE_PENDING);
- execute_omx_flush(OMX_ALL);
- bFlag = 0;
- }
- /* Requesting transition from Executing to Paused */
- else if(eState == OMX_StatePause)
- {
-
- if(dev_pause())
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_pause() failed in SCP on Exe --> Pause\n");
- post_event(OMX_EventError,OMX_ErrorHardware,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_PAUSE_PENDING);
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Executing\n");
- bFlag = 0;
- }
- }
- /* Requesting transition from Executing to Loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("\nERROR: OMXCORE-SM: Executing --> Loaded \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Executing to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("\nERROR: OMXCORE-SM: Executing --> WaitForResources \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Executing to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("\nERROR: OMXCORE-SM: Executing --> Executing \n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Executing to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("\nERROR: OMXCORE-SM: Executing --> Invalid \n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Executing --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /***************************/
- /* Current State is Pause */
- /***************************/
- else if(m_state == OMX_StatePause)
- {
- /* Requesting transition from Pause to Executing */
- if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_LOW("\n Pause --> Executing \n");
- if( dev_resume() )
- {
- post_event(OMX_EventError,OMX_ErrorHardware,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorHardware;
- }
- else
- {
- BITMASK_SET(&m_flags,OMX_COMPONENT_EXECUTE_PENDING);
- DEBUG_PRINT_LOW("OMXCORE-SM: Idle-->Executing\n");
- bFlag = 0;
- }
- }
- /* Requesting transition from Pause to Idle */
- else if(eState == OMX_StateIdle)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("\n Pause --> Idle \n");
- BITMASK_SET(&m_flags,OMX_COMPONENT_IDLE_PENDING);
- execute_omx_flush(OMX_ALL);
- bFlag = 0;
- }
- /* Requesting transition from Pause to loaded */
- else if(eState == OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("\nERROR: Pause --> loaded \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Pause to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("\nERROR: Pause --> WaitForResources \n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from Pause to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("\nERROR: Pause --> Pause \n");
- post_event(OMX_EventError,OMX_ErrorSameState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from Pause to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("\nERROR: Pause --> Invalid \n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Paused --> %d Not Handled\n",eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /***************************/
- /* Current State is WaitForResources */
- /***************************/
- else if(m_state == OMX_StateWaitForResources)
- {
- /* Requesting transition from WaitForResources to Loaded */
- if(eState == OMX_StateLoaded)
- {
- /* Since error is None , we will post an event
- at the end of this function definition */
- DEBUG_PRINT_LOW("OMXCORE-SM: WaitForResources-->Loaded\n");
- }
- /* Requesting transition from WaitForResources to WaitForResources */
- else if(eState == OMX_StateWaitForResources)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: WaitForResources-->WaitForResources\n");
- post_event(OMX_EventError,OMX_ErrorSameState,
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorSameState;
- }
- /* Requesting transition from WaitForResources to Executing */
- else if(eState == OMX_StateExecuting)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: WaitForResources-->Executing\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from WaitForResources to Pause */
- else if(eState == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: WaitForResources-->Pause\n");
- post_event(OMX_EventError,OMX_ErrorIncorrectStateTransition,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorIncorrectStateTransition;
- }
- /* Requesting transition from WaitForResources to Invalid */
- else if(eState == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: WaitForResources-->Invalid\n");
- post_event(OMX_EventError,eState,OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- /* Requesting transition from WaitForResources to Loaded -
- is NOT tested by Khronos TS */
-
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: %d --> %d(Not Handled)\n",m_state,eState);
- eRet = OMX_ErrorBadParameter;
- }
- }
- /********************************/
- /* Current State is Invalid */
- /*******************************/
- else if(m_state == OMX_StateInvalid)
- {
- /* State Transition from Inavlid to any state */
- if(eState == (OMX_StateLoaded || OMX_StateWaitForResources
- || OMX_StateIdle || OMX_StateExecuting
- || OMX_StatePause || OMX_StateInvalid))
- {
- DEBUG_PRINT_ERROR("ERROR: OMXCORE-SM: Invalid -->Loaded\n");
- post_event(OMX_EventError,OMX_ErrorInvalidState,\
- OMX_COMPONENT_GENERATE_EVENT);
- eRet = OMX_ErrorInvalidState;
- }
- }
- else if(cmd == OMX_CommandFlush)
- {
- if(0 == param1 || OMX_ALL == param1)
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_FLUSH_PENDING);
- }
- if(1 == param1 || OMX_ALL == param1)
- {
- //generate output flush event only.
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_FLUSH_PENDING);
- }
-
- execute_omx_flush(param1);
- bFlag = 0;
- }
- else if( cmd == OMX_CommandPortEnable)
- {
- if(param1 == PORT_INDEX_IN || param1 == OMX_ALL)
- {
- m_sInPortDef.bEnabled = OMX_TRUE;
-
- if( (m_state == OMX_StateLoaded &&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- || allocate_input_done())
- {
- post_event(OMX_CommandPortEnable,PORT_INDEX_IN,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- DEBUG_PRINT_LOW("OMXCORE-SM: Disabled-->Enabled Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_ENABLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- if(param1 == PORT_INDEX_OUT || param1 == OMX_ALL)
- {
- m_sOutPortDef.bEnabled = OMX_TRUE;
-
- if( (m_state == OMX_StateLoaded &&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- || (allocate_output_done()))
- {
- post_event(OMX_CommandPortEnable,PORT_INDEX_OUT,
- OMX_COMPONENT_GENERATE_EVENT);
-
- }
- else
- {
- DEBUG_PRINT_LOW("OMXCORE-SM: Disabled-->Enabled Pending\n");
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- // Skip the event notification
- bFlag = 0;
- }
- }
- }
- else if(cmd == OMX_CommandPortDisable)
- {
- if(param1 == PORT_INDEX_IN || param1 == OMX_ALL)
- {
- m_sInPortDef.bEnabled = OMX_FALSE;
- if((m_state == OMX_StateLoaded || m_state == OMX_StateIdle)
- && release_input_done())
- {
- post_event(OMX_CommandPortDisable,PORT_INDEX_IN,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_DISABLE_PENDING);
- if(m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
- {
- execute_omx_flush(PORT_INDEX_IN);
- }
-
- // Skip the event notification
- bFlag = 0;
- }
- }
- if(param1 == PORT_INDEX_OUT || param1 == OMX_ALL)
- {
- m_sOutPortDef.bEnabled = OMX_FALSE;
-
- if((m_state == OMX_StateLoaded || m_state == OMX_StateIdle)
- && release_output_done())
- {
- post_event(OMX_CommandPortDisable,PORT_INDEX_OUT,\
- OMX_COMPONENT_GENERATE_EVENT);
- }
- else
- {
- BITMASK_SET(&m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
- if(m_state == OMX_StatePause ||m_state == OMX_StateExecuting)
- {
- execute_omx_flush(PORT_INDEX_OUT);
- }
- // Skip the event notification
- bFlag = 0;
-
- }
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid Command received other than StateSet (%d)\n",cmd);
- eRet = OMX_ErrorNotImplemented;
- }
- if(eRet == OMX_ErrorNone && bFlag)
- {
- post_event(cmd,eState,OMX_COMPONENT_GENERATE_EVENT);
- }
- sem_post(&m_cmd_lock);
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::ExecuteOmxFlush
-
-DESCRIPTION
- Executes the OMX flush.
-
-PARAMETERS
- flushtype - input flush(1)/output flush(0)/ both.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_video::execute_omx_flush(OMX_U32 flushType)
-{
- bool bRet = false;
- DEBUG_PRINT_LOW("\n execute_omx_flush - %d\n", flushType);
- if(flushType == 0 || flushType == OMX_ALL)
- {
- input_flush_progress = true;
- //flush input only
- bRet = execute_input_flush();
- }
- if(flushType == 1 || flushType == OMX_ALL)
- {
- //flush output only
- output_flush_progress = true;
- bRet = execute_output_flush();
- }
- return bRet;
-}
-/*=========================================================================
-FUNCTION : execute_output_flush
-
-DESCRIPTION
- Executes the OMX flush at OUTPUT PORT.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-==========================================================================*/
-bool omx_video::execute_output_flush(void)
-{
- unsigned p1 = 0; // Parameter - 1
- unsigned p2 = 0; // Parameter - 2
- unsigned ident = 0;
- bool bRet = true;
-
- /*Generate FBD for all Buffers in the FTBq*/
- DEBUG_PRINT_LOW("\n execute_output_flush\n");
- pthread_mutex_lock(&m_lock);
- while(m_ftb_q.m_size)
- {
- m_ftb_q.pop_entry(&p1,&p2,&ident);
-
- if(ident == OMX_COMPONENT_GENERATE_FTB )
- {
- pending_output_buffers++;
- fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p2);
- }
- else if(ident == OMX_COMPONENT_GENERATE_FBD)
- {
- fill_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p1);
- }
- }
-
- pthread_mutex_unlock(&m_lock);
- /*Check if there are buffers with the Driver*/
- if(dev_flush(PORT_INDEX_OUT))
- {
- DEBUG_PRINT_ERROR("\nERROR: o/p dev_flush() Failed");
- return false;
- }
-
- return bRet;
-}
-/*=========================================================================
-FUNCTION : execute_input_flush
-
-DESCRIPTION
- Executes the OMX flush at INPUT PORT.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-==========================================================================*/
-bool omx_video::execute_input_flush(void)
-{
- unsigned p1 = 0; // Parameter - 1
- unsigned p2 = 0; // Parameter - 2
- unsigned ident = 0;
- bool bRet = true;
-
- /*Generate EBD for all Buffers in the ETBq*/
- DEBUG_PRINT_LOW("\n execute_input_flush\n");
-
- pthread_mutex_lock(&m_lock);
- while(m_etb_q.m_size)
- {
- m_etb_q.pop_entry(&p1,&p2,&ident);
- if(ident == OMX_COMPONENT_GENERATE_ETB)
- {
- pending_input_buffers++;
- empty_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p2);
- }
- else if(ident == OMX_COMPONENT_GENERATE_EBD)
- {
- empty_buffer_done(&m_cmp,(OMX_BUFFERHEADERTYPE *)p1);
- }
- }
-
- pthread_mutex_unlock(&m_lock);
- /*Check if there are buffers with the Driver*/
- if(dev_flush(PORT_INDEX_IN))
- {
- DEBUG_PRINT_ERROR("\nERROR: i/p dev_flush() Failed");
- return false;
- }
-
- return bRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::SendCommandEvent
-
-DESCRIPTION
- Send the event to decoder pipe. This is needed to generate the callbacks
- in decoder thread context.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_video::post_event(unsigned int p1,
- unsigned int p2,
- unsigned int id)
-{
- bool bRet = false;
-
-
- pthread_mutex_lock(&m_lock);
-
- if( id == OMX_COMPONENT_GENERATE_FTB || \
- (id == OMX_COMPONENT_GENERATE_FRAME_DONE))
- {
- m_ftb_q.insert_entry(p1,p2,id);
- }
- else if((id == OMX_COMPONENT_GENERATE_ETB) \
- || (id == OMX_COMPONENT_GENERATE_EBD))
- {
- m_etb_q.insert_entry(p1,p2,id);
- }
- else
- {
- m_cmd_q.insert_entry(p1,p2,id);
- }
-
- bRet = true;
- DEBUG_PRINT_LOW("\n Value of this pointer in post_event %p",this);
- post_message(this, id);
- pthread_mutex_unlock(&m_lock);
-
- return bRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::GetParameter
-
-DESCRIPTION
- OMX Get Parameter method implementation
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_INOUT OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned int height=0,width = 0;
-
- DEBUG_PRINT_LOW("get_parameter: \n");
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Get Param in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(paramData == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: Get Param in Invalid paramData \n");
- return OMX_ErrorBadParameter;
- }
- switch(paramIndex)
- {
- case OMX_IndexParamPortDefinition:
- {
- OMX_PARAM_PORTDEFINITIONTYPE *portDefn;
- portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
-
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPortDefinition\n");
- if(portDefn->nPortIndex == (OMX_U32) PORT_INDEX_IN)
- {
- DEBUG_PRINT_LOW("\n i/p actual cnt = %d\n", m_sInPortDef.nBufferCountActual);
- DEBUG_PRINT_LOW("\n i/p min cnt = %d\n", m_sInPortDef.nBufferCountMin);
- memcpy(portDefn, &m_sInPortDef, sizeof(m_sInPortDef));
- }
- else if(portDefn->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- DEBUG_PRINT_LOW("\n o/p actual cnt = %d\n", m_sOutPortDef.nBufferCountActual);
- DEBUG_PRINT_LOW("\n o/p min cnt = %d\n", m_sOutPortDef.nBufferCountMin);
- memcpy(portDefn, &m_sOutPortDef, sizeof(m_sOutPortDef));
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: GetParameter called on Bad Port Index");
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
- case OMX_IndexParamVideoInit:
- {
- OMX_PORT_PARAM_TYPE *portParamType =
- (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoInit\n");
-
- memcpy(portParamType, &m_sPortParam, sizeof(m_sPortParam));
- break;
- }
- case OMX_IndexParamVideoPortFormat:
- {
- OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt =
- (OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoPortFormat\n");
-
- if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_IN)
- {
- memcpy(portFmt, &m_sInPortFormat, sizeof(m_sInPortFormat));
- }
- else if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- memcpy(portFmt, &m_sOutPortFormat, sizeof(m_sOutPortFormat));
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: GetParameter called on Bad Port Index");
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
- case OMX_IndexParamVideoBitrate:
- {
- OMX_VIDEO_PARAM_BITRATETYPE* pParam = (OMX_VIDEO_PARAM_BITRATETYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoBitrate\n");
-
- if(pParam->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- memcpy(pParam, &m_sParamBitrate, sizeof(m_sParamBitrate));
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: GetParameter called on Bad Port Index");
- eRet = OMX_ErrorBadPortIndex;
- }
-
- break;
- }
- case OMX_IndexParamVideoMpeg4:
- {
- OMX_VIDEO_PARAM_MPEG4TYPE* pParam = (OMX_VIDEO_PARAM_MPEG4TYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoMpeg4\n");
- memcpy(pParam, &m_sParamMPEG4, sizeof(m_sParamMPEG4));
- break;
- }
- case OMX_IndexParamVideoH263:
- {
- OMX_VIDEO_PARAM_H263TYPE* pParam = (OMX_VIDEO_PARAM_H263TYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoH263\n");
- memcpy(pParam, &m_sParamH263, sizeof(m_sParamH263));
- break;
- }
- case OMX_IndexParamVideoAvc:
- {
- OMX_VIDEO_PARAM_AVCTYPE* pParam = (OMX_VIDEO_PARAM_AVCTYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoAvc\n");
- memcpy(pParam, &m_sParamAVC, sizeof(m_sParamAVC));
- break;
- }
- case OMX_IndexParamVideoProfileLevelQuerySupported:
- {
-
- OMX_VIDEO_PARAM_PROFILELEVELTYPE* pParam = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoProfileLevelQuerySupported\n");
- //TODO include all the profiles and corresponding levels
- if(m_sOutPortDef.format.video.eCompressionFormat == OMX_VIDEO_CodingMPEG4)
- {
- static const OMX_U32 MPEG4Profile[][2] =
- { { (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple, (OMX_U32) OMX_VIDEO_MPEG4Level0},
- { (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple, (OMX_U32) OMX_VIDEO_MPEG4Level0b},
- { (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple, (OMX_U32) OMX_VIDEO_MPEG4Level1},
- { (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple, (OMX_U32) OMX_VIDEO_MPEG4Level2},
- { (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple, (OMX_U32) OMX_VIDEO_MPEG4Level3}};
-
- static const OMX_U32 nSupport = sizeof(MPEG4Profile) / (sizeof(OMX_U32) * 2);
- if(pParam->nProfileIndex >= 0 && pParam->nProfileIndex < nSupport)
- {
- pParam->eProfile = (OMX_VIDEO_MPEG4PROFILETYPE) MPEG4Profile[pParam->nProfileIndex][0];
- pParam->eLevel = (OMX_VIDEO_MPEG4LEVELTYPE) MPEG4Profile[pParam->nProfileIndex][1];
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(m_sOutPortDef.format.video.eCompressionFormat == OMX_VIDEO_CodingH263)
- {
- static const OMX_U32 H263Profile[][2] =
- { { (OMX_U32) OMX_VIDEO_H263ProfileBaseline, (OMX_U32) OMX_VIDEO_H263Level10},
- { (OMX_U32) OMX_VIDEO_H263ProfileBaseline, (OMX_U32) OMX_VIDEO_H263Level20},
- { (OMX_U32) OMX_VIDEO_H263ProfileBaseline, (OMX_U32) OMX_VIDEO_H263Level30},
- { (OMX_U32) OMX_VIDEO_H263ProfileBaseline, (OMX_U32) OMX_VIDEO_H263Level45},
- { (OMX_U32) OMX_VIDEO_H263ProfileISWV2, (OMX_U32) OMX_VIDEO_H263Level10},
- { (OMX_U32) OMX_VIDEO_H263ProfileISWV2, (OMX_U32) OMX_VIDEO_H263Level45}};
-
- static const OMX_U32 nSupport = sizeof(H263Profile) / (sizeof(OMX_U32) * 2);
- if(pParam->nProfileIndex >= 0 && pParam->nProfileIndex < nSupport)
- {
- pParam->eProfile = (OMX_VIDEO_H263PROFILETYPE) H263Profile[pParam->nProfileIndex][0];
- pParam->eLevel = (OMX_VIDEO_H263LEVELTYPE) H263Profile[pParam->nProfileIndex][1];
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC)
- {
- //TODO
- }
- break;
- }
- case OMX_IndexParamVideoProfileLevelCurrent:
- {
- OMX_VIDEO_PARAM_PROFILELEVELTYPE* pParam = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoProfileLevelCurrent\n");
- memcpy(pParam, &m_sParamProfileLevel, sizeof(m_sParamProfileLevel));
- break;
- }
- /*Component should support this port definition*/
- case OMX_IndexParamAudioInit:
- {
- OMX_PORT_PARAM_TYPE *audioPortParamType = (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamAudioInit\n");
- memcpy(audioPortParamType, &m_sPortParam_audio, sizeof(m_sPortParam_audio));
- break;
- }
- /*Component should support this port definition*/
- case OMX_IndexParamImageInit:
- {
- OMX_PORT_PARAM_TYPE *imagePortParamType = (OMX_PORT_PARAM_TYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamImageInit\n");
- memcpy(imagePortParamType, &m_sPortParam_img, sizeof(m_sPortParam_img));
- break;
-
- }
- /*Component should support this port definition*/
- case OMX_IndexParamOtherInit:
- {
- DEBUG_PRINT_ERROR("ERROR: get_parameter: OMX_IndexParamOtherInit %08x\n", paramIndex);
- eRet =OMX_ErrorUnsupportedIndex;
- break;
- }
- case OMX_IndexParamStandardComponentRole:
- {
- OMX_PARAM_COMPONENTROLETYPE *comp_role;
- comp_role = (OMX_PARAM_COMPONENTROLETYPE *) paramData;
- comp_role->nVersion.nVersion = OMX_SPEC_VERSION;
- comp_role->nSize = sizeof(*comp_role);
-
- DEBUG_PRINT_LOW("Getparameter: OMX_IndexParamStandardComponentRole %d\n",paramIndex);
- if(NULL != comp_role->cRole)
- {
- strncpy((char*)comp_role->cRole,(const char*)m_cRole,OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Getparameter: OMX_IndexParamStandardComponentRole %d is passed with NULL parameter for role\n",paramIndex);
- eRet =OMX_ErrorBadParameter;
- }
- break;
- }
- /* Added for parameter test */
- case OMX_IndexParamPriorityMgmt:
- {
-
- OMX_PRIORITYMGMTTYPE *priorityMgmType = (OMX_PRIORITYMGMTTYPE *) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamPriorityMgmt\n");
- memcpy(priorityMgmType, &m_sPriorityMgmt, sizeof(m_sPriorityMgmt));
- break;
- }
- /* Added for parameter test */
- case OMX_IndexParamCompBufferSupplier:
- {
- OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplierType = (OMX_PARAM_BUFFERSUPPLIERTYPE*) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamCompBufferSupplier\n");
- if(bufferSupplierType->nPortIndex ==(OMX_U32) PORT_INDEX_IN)
- {
- memcpy(bufferSupplierType, &m_sInBufSupplier, sizeof(m_sInBufSupplier));
- }
- else if(bufferSupplierType->nPortIndex ==(OMX_U32) PORT_INDEX_OUT)
- {
- memcpy(bufferSupplierType, &m_sOutBufSupplier, sizeof(m_sOutBufSupplier));
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: GetParameter called on Bad Port Index");
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
-
- case OMX_IndexParamVideoQuantization:
- {
- OMX_VIDEO_PARAM_QUANTIZATIONTYPE *session_qp = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE*) paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoQuantization\n");
- memcpy(session_qp, &m_sSessionQuantization, sizeof(m_sSessionQuantization));
- break;
- }
-
- case OMX_QcomIndexPortDefn:
- //TODO
- break;
- case OMX_COMPONENT_CAPABILITY_TYPE_INDEX:
- {
- OMXComponentCapabilityFlagsType *pParam = reinterpret_cast<OMXComponentCapabilityFlagsType*>(paramData);
- DEBUG_PRINT_LOW("get_parameter: OMX_COMPONENT_CAPABILITY_TYPE_INDEX\n");
- pParam->iIsOMXComponentMultiThreaded = OMX_TRUE;
- pParam->iOMXComponentSupportsExternalOutputBufferAlloc = OMX_FALSE;
- pParam->iOMXComponentSupportsExternalInputBufferAlloc = OMX_TRUE;
- pParam->iOMXComponentSupportsMovableInputBuffers = OMX_TRUE;
- pParam->iOMXComponentUsesNALStartCodes = OMX_TRUE;
- pParam->iOMXComponentSupportsPartialFrames = OMX_FALSE;
- pParam->iOMXComponentCanHandleIncompleteFrames = OMX_FALSE;
- pParam->iOMXComponentUsesFullAVCFrames = OMX_FALSE;
- m_use_input_pmem = OMX_TRUE;
- DEBUG_PRINT_LOW("Supporting capability index in encoder node");
- break;
- }
- case OMX_IndexParamVideoSliceFMO:
- {
- OMX_VIDEO_PARAM_AVCSLICEFMO *avc_slice_fmo = (OMX_VIDEO_PARAM_AVCSLICEFMO*)paramData;
- DEBUG_PRINT_LOW("get_parameter: OMX_IndexParamVideoSliceFMO\n");
- if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.avc",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- memcpy(avc_slice_fmo, &m_sAVCSliceFMO, sizeof(m_sAVCSliceFMO));
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: get_parameter: AVCSliceFMO queried non-AVC codec\n");
- eRet = OMX_ErrorBadParameter;
- }
- break;
- }
- default:
- {
- DEBUG_PRINT_ERROR("ERROR: get_parameter: unknown param %08x\n", paramIndex);
- eRet =OMX_ErrorUnsupportedIndex;
- break;
- }
-
- }
-
- return eRet;
-
-}
-/* ======================================================================
-FUNCTION
- omx_video::GetConfig
-
-DESCRIPTION
- OMX Get Config Method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::get_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_INOUT OMX_PTR configData)
-{
- ////////////////////////////////////////////////////////////////
- // Supported Config Index Type
- // =============================================================
- // OMX_IndexConfigVideoBitrate OMX_VIDEO_CONFIG_BITRATETYPE
- // OMX_IndexConfigVideoFramerate OMX_CONFIG_FRAMERATETYPE
- // OMX_IndexConfigCommonRotate OMX_CONFIG_ROTATIONTYPE
- ////////////////////////////////////////////////////////////////
-
- if(configData == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: param is null");
- return OMX_ErrorBadParameter;
- }
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: can't be in invalid state");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- //@todo need to validate params
- switch(configIndex)
- {
- case OMX_IndexConfigVideoBitrate:
- {
- OMX_VIDEO_CONFIG_BITRATETYPE* pParam = reinterpret_cast<OMX_VIDEO_CONFIG_BITRATETYPE*>(configData);
- memcpy(pParam, &m_sConfigBitrate, sizeof(m_sConfigBitrate));
- break;
- }
- case OMX_IndexConfigVideoFramerate:
- {
- OMX_CONFIG_FRAMERATETYPE* pParam = reinterpret_cast<OMX_CONFIG_FRAMERATETYPE*>(configData);
- if(m_state != OMX_StateLoaded)
- {
- // we only allow this at init time!
- DEBUG_PRINT_ERROR("ERROR: frame rate can only be configured in loaded state");
- return OMX_ErrorIncorrectStateOperation;
- }
- memcpy(pParam, &m_sConfigFramerate, sizeof(m_sConfigFramerate));
- break;
- }
- case OMX_IndexConfigCommonRotate:
- {
- OMX_CONFIG_ROTATIONTYPE* pParam = reinterpret_cast<OMX_CONFIG_ROTATIONTYPE*>(configData);
- if(m_state != OMX_StateLoaded)
- {
- // we only allow this at init time!
- DEBUG_PRINT_ERROR("ERROR: frame rate can only be configured in loaded state",0,0,0);
- return OMX_ErrorIncorrectStateOperation;
- }
- memcpy(pParam, &m_sConfigFrameRotation, sizeof(m_sConfigFrameRotation));
- break;
- }
- default:
- DEBUG_PRINT_ERROR("ERROR: unsupported index %d", (int) configIndex);
- return OMX_ErrorUnsupportedIndex;
- }
- return OMX_ErrorNone;
-
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::GetExtensionIndex
-
-DESCRIPTION
- OMX GetExtensionIndex method implementaion. <TBD>
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::get_extension_index(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_STRING paramName,
- OMX_OUT OMX_INDEXTYPE* indexType)
-{
- DEBUG_PRINT_ERROR("ERROR: get_extension_index: Error, Not implemented\n");
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Get Extension Index in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::GetState
-
-DESCRIPTION
- Returns the state information back to the caller.<TBD>
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Error None if everything is successful.
-========================================================================== */
-OMX_ERRORTYPE omx_video::get_state(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_STATETYPE* state)
-{
- *state = m_state;
- DEBUG_PRINT_LOW("get_state: Returning the state %d\n",*state);
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::ComponentTunnelRequest
-
-DESCRIPTION
- OMX Component Tunnel Request method implementation. <TBD>
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::component_tunnel_request(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_HANDLETYPE peerComponent,
- OMX_IN OMX_U32 peerPort,
- OMX_INOUT OMX_TUNNELSETUPTYPE* tunnelSetup)
-{
- DEBUG_PRINT_ERROR("ERROR: component_tunnel_request Not Implemented\n");
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::UseInputBuffer
-
-DESCRIPTION
- Helper function for Use buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::use_input_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
- unsigned i = 0;
- unsigned char *buf_addr = NULL;
-
- DEBUG_PRINT_HIGH("use_input_buffer: port = %d appData = %p bytes = %d buffer = %p",port,appData,bytes,buffer);
- if(bytes != m_sInPortDef.nBufferSize)
- {
- DEBUG_PRINT_ERROR("\nERROR: use_input_buffer: Size Mismatch!! "
- "bytes[%d] != Port.nBufferSize[%d]", bytes, m_sInPortDef.nBufferSize);
- return OMX_ErrorBadParameter;
- }
-
- if(!m_inp_mem_ptr)
- {
- input_use_buffer = true;
- m_inp_mem_ptr = (OMX_BUFFERHEADERTYPE*) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE)), m_sInPortDef.nBufferCountActual);
- if(m_inp_mem_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_inp_mem_ptr");
- return OMX_ErrorInsufficientResources;
- }
-
- m_pInput_pmem = (struct pmem *) calloc(sizeof (struct pmem), m_sInPortDef.nBufferCountActual);
- if(m_pInput_pmem == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_pInput_pmem");
- return OMX_ErrorInsufficientResources;
- }
- for(i=0; i< m_sInPortDef.nBufferCountActual; i++)
- {
- m_pInput_pmem[i].fd = -1;
- }
-
- }
-
- for(i=0; i< m_sInPortDef.nBufferCountActual; i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- break;
- }
- }
-
- if(i < m_sInPortDef.nBufferCountActual)
- {
-
- *bufferHdr = (m_inp_mem_ptr + i);
- BITMASK_SET(&m_inp_bm_count,i);
-
- (*bufferHdr)->pBuffer = (OMX_U8 *)buffer;
- (*bufferHdr)->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- (*bufferHdr)->nVersion.nVersion = OMX_SPEC_VERSION;
- (*bufferHdr)->nAllocLen = m_sInPortDef.nBufferSize;
- (*bufferHdr)->pAppPrivate = appData;
- (*bufferHdr)->nInputPortIndex = PORT_INDEX_IN;
-
- if(!m_use_input_pmem)
- {
- m_pInput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
- if(m_pInput_pmem[i].fd == 0)
- {
- m_pInput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
- }
-
- if(m_pInput_pmem[i] .fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: /dev/pmem_adsp open() Failed");
- return OMX_ErrorInsufficientResources;
- }
- m_pInput_pmem[i].size = m_sInPortDef.nBufferSize;
- m_pInput_pmem[i].offset = 0;
- m_pInput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
- MAP_SHARED,m_pInput_pmem[i].fd,0);
-
- if(m_pInput_pmem[i].buffer == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pParam = reinterpret_cast<OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *>((*bufferHdr)->pAppPrivate);
- DEBUG_PRINT_LOW("Inside qcom_ext with luma:(fd:%d,offset:0x%x)", pParam->pmem_fd, pParam->offset);
-
- if(pParam)
- {
- m_pInput_pmem[i].fd = pParam->pmem_fd;
- m_pInput_pmem[i].offset = pParam->offset;
- m_pInput_pmem[i].size = m_sInPortDef.nBufferSize;
- m_pInput_pmem[i].buffer = (unsigned char *)buffer;
- DEBUG_PRINT_LOW("\n DBG:: pParam->pmem_fd = %u, pParam->offset = %u",
- pParam->pmem_fd, pParam->offset);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid AppData given for PMEM i/p UseBuffer case");
- return OMX_ErrorBadParameter;
- }
- }
-
- DEBUG_PRINT_LOW("\n use_inp:: bufhdr = %p, pBuffer = %p, m_pInput_pmem[i].buffer = %p",
- (*bufferHdr), (*bufferHdr)->pBuffer, m_pInput_pmem[i].buffer);
- if( dev_use_buf(&m_pInput_pmem[i],PORT_INDEX_IN) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_use_buf() Failed for i/p buf");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: All buffers are already used, invalid use_buf call for "
- "index = %u", i);
- eRet = OMX_ErrorInsufficientResources;
- }
-
- return eRet;
-}
-
-
-
-/* ======================================================================
-FUNCTION
- omx_video::UseOutputBuffer
-
-DESCRIPTION
- Helper function for Use buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::use_output_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_BUFFERHEADERTYPE *bufHdr= NULL; // buffer header
- unsigned i= 0; // Temporary counter
- unsigned char *buf_addr = NULL;
-
- DEBUG_PRINT_HIGH("\n Inside use_output_buffer()");
- if(bytes != m_sOutPortDef.nBufferSize)
- {
- DEBUG_PRINT_ERROR("\nERROR: use_output_buffer: Size Mismatch!! "
- "bytes[%d] != Port.nBufferSize[%d]", bytes, m_sOutPortDef.nBufferSize);
- return OMX_ErrorBadParameter;
- }
-
- if(!m_out_mem_ptr)
- {
- output_use_buffer = true;
- int nBufHdrSize = 0;
-
- DEBUG_PRINT_LOW("Allocating First Output Buffer(%d)\n",m_sOutPortDef.nBufferCountActual);
- nBufHdrSize = m_sOutPortDef.nBufferCountActual * sizeof(OMX_BUFFERHEADERTYPE);
- /*
- * Memory for output side involves the following:
- * 1. Array of Buffer Headers
- * 2. Bitmask array to hold the buffer allocation details
- * In order to minimize the memory management entire allocation
- * is done in one step.
- */
- //OMX Buffer header
- m_out_mem_ptr = (OMX_BUFFERHEADERTYPE *)calloc(nBufHdrSize,1);
- if(m_out_mem_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_out_mem_ptr");
- return OMX_ErrorInsufficientResources;
- }
-
- m_pOutput_pmem = (struct pmem *) calloc(sizeof (struct pmem), m_sOutPortDef.nBufferCountActual);
- if(m_pOutput_pmem == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_pOutput_pmem");
- return OMX_ErrorInsufficientResources;
- }
-
- if(m_out_mem_ptr)
- {
- bufHdr = m_out_mem_ptr;
- DEBUG_PRINT_LOW("Memory Allocation Succeeded for OUT port%p\n",m_out_mem_ptr);
-
- // Settting the entire storage nicely
- for(i=0; i < m_sOutPortDef.nBufferCountActual ; i++)
- {
- bufHdr->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
- bufHdr->nAllocLen = bytes;
- bufHdr->nFilledLen = 0;
- bufHdr->pAppPrivate = appData;
- bufHdr->nOutputPortIndex = PORT_INDEX_OUT;
- bufHdr->pBuffer = NULL;
- bufHdr++;
- m_pOutput_pmem[i].fd = -1;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Output buf mem alloc failed[0x%x]\n",m_out_mem_ptr);
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- for(i=0; i< m_sOutPortDef.nBufferCountActual; i++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,i))
- {
- break;
- }
- }
-
- if(eRet == OMX_ErrorNone)
- {
- if(i < m_sOutPortDef.nBufferCountActual)
- {
- *bufferHdr = (m_out_mem_ptr + i );
- (*bufferHdr)->pBuffer = (OMX_U8 *)buffer;
- BITMASK_SET(&m_out_bm_count,i);
-
- if(!m_use_output_pmem)
- {
- m_pOutput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if(m_pOutput_pmem[i].fd == 0)
- {
- m_pOutput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
- }
-
- if(m_pOutput_pmem[i].fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: /dev/pmem_adsp open() Failed");
- return OMX_ErrorInsufficientResources;
- }
- m_pOutput_pmem[i].size = m_sOutPortDef.nBufferSize;
- m_pOutput_pmem[i].offset = 0;
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
- MAP_SHARED,m_pOutput_pmem[i].fd,0);
- if(m_pOutput_pmem[i].buffer == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\nERROR: mmap() Failed");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pParam = reinterpret_cast<OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO*>((*bufferHdr)->pAppPrivate);
- DEBUG_PRINT_LOW("Inside qcom_ext pParam:0x%x )", pParam);
-
- if(pParam)
- {
- DEBUG_PRINT_LOW("Inside qcom_ext with luma:(fd:%d,offset:0x%x)", pParam->pmem_fd, pParam->offset);
- m_pOutput_pmem[i].fd = pParam->pmem_fd;
- m_pOutput_pmem[i].offset = pParam->offset;
- m_pOutput_pmem[i].size = m_sOutPortDef.nBufferSize;
- m_pOutput_pmem[i].buffer = (unsigned char *)buffer;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid AppData given for PMEM o/p UseBuffer case");
- return OMX_ErrorBadParameter;
- }
- buf_addr = (unsigned char *)buffer;
- }
-
- DEBUG_PRINT_LOW("\n use_out:: bufhdr = %p, pBuffer = %p, m_pOutput_pmem[i].buffer = %p",
- (*bufferHdr), (*bufferHdr)->pBuffer, m_pOutput_pmem[i].buffer);
- if(dev_use_buf(&m_pOutput_pmem[i],PORT_INDEX_OUT) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: dev_use_buf Failed for o/p buf");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: All o/p Buffers have been Used, invalid use_buf call for "
- "index = %u", i);
- eRet = OMX_ErrorInsufficientResources;
- }
- }
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_video::UseBuffer
-
-DESCRIPTION
- OMX Use Buffer method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None , if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::use_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes,
- OMX_IN OMX_U8* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Use Buffer in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(port == PORT_INDEX_IN)
- {
- eRet = use_input_buffer(hComp,bufferHdr,port,appData,bytes,buffer);
- }
- else if(port == PORT_INDEX_OUT)
- {
- eRet = use_output_buffer(hComp,bufferHdr,port,appData,bytes,buffer);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid Port Index received %d\n",(int)port);
- eRet = OMX_ErrorBadPortIndex;
- }
-
- if(eRet == OMX_ErrorNone)
- {
- if(allocate_done())
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_IDLE_PENDING);
- post_event(OMX_CommandStateSet,OMX_StateIdle,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == PORT_INDEX_IN && m_sInPortDef.bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_INPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- PORT_INDEX_IN,
- OMX_COMPONENT_GENERATE_EVENT);
- }
-
- }
- else if(port == PORT_INDEX_OUT && m_sOutPortDef.bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- PORT_INDEX_OUT,
- OMX_COMPONENT_GENERATE_EVENT);
- m_event_port_settings_sent = false;
- }
- }
- }
- return eRet;
-}
-
-OMX_ERRORTYPE omx_video::free_input_buffer(OMX_BUFFERHEADERTYPE *bufferHdr)
-{
- unsigned int index = 0;
- OMX_U8 *temp_buff ;
-
- if(bufferHdr == NULL || m_inp_mem_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: free_input: Invalid bufferHdr[%p] or m_inp_mem_ptr[%p]",
- bufferHdr, m_inp_mem_ptr);
- return OMX_ErrorBadParameter;
- }
-
- index = bufferHdr - m_inp_mem_ptr;
-
- if(index < m_sInPortDef.nBufferCountActual && m_pInput_pmem)
- {
- if(m_pInput_pmem[index].fd > 0 && input_use_buffer == false)
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: i/p AllocateBuffer case");
- if(dev_free_buf(&m_pInput_pmem[index],PORT_INDEX_IN) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_free_buf() Failed for i/p buf");
- }
- munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
- close (m_pInput_pmem[index].fd);
- m_pInput_pmem[index].fd = -1;
- }
- else if(m_pInput_pmem[index].fd > 0 && (input_use_buffer == true &&
- m_use_input_pmem == OMX_FALSE))
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: i/p Heap UseBuffer case");
- if(dev_free_buf(&m_pInput_pmem[index],PORT_INDEX_IN) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_free_buf() Failed for i/p buf");
- }
- munmap (m_pInput_pmem[index].buffer,m_pInput_pmem[index].size);
- close (m_pInput_pmem[index].fd);
- m_pInput_pmem[index].fd = -1;
- }
- else
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: fd is invalid or i/p PMEM UseBuffer case");
- }
- }
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_video::free_output_buffer(OMX_BUFFERHEADERTYPE *bufferHdr)
-{
- unsigned int index = 0;
- OMX_U8 *temp_buff ;
-
- if(bufferHdr == NULL || m_out_mem_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: free_output: Invalid bufferHdr[%p] or m_out_mem_ptr[%p]",
- bufferHdr, m_out_mem_ptr);
- return OMX_ErrorBadParameter;
- }
- index = bufferHdr - m_out_mem_ptr;
-
- if(index < m_sOutPortDef.nBufferCountActual && m_pOutput_pmem)
- {
- if(m_pOutput_pmem[index].fd > 0 && output_use_buffer == false )
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: o/p AllocateBuffer case");
- if(dev_free_buf(&m_pOutput_pmem[index],PORT_INDEX_OUT) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: dev_free_buf Failed for o/p buf");
- }
- munmap (m_pOutput_pmem[index].buffer,m_pOutput_pmem[index].size);
- close (m_pOutput_pmem[index].fd);
- m_pOutput_pmem[index].fd = -1;
- }
- else if( m_pOutput_pmem[index].fd > 0 && (output_use_buffer == true
- && m_use_output_pmem == OMX_FALSE))
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: o/p Heap UseBuffer case");
- if(dev_free_buf(&m_pOutput_pmem[index],PORT_INDEX_OUT) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: dev_free_buf Failed for o/p buf");
- }
- munmap (m_pOutput_pmem[index].buffer,m_pOutput_pmem[index].size);
- close (m_pOutput_pmem[index].fd);
- m_pOutput_pmem[index].fd = -1;
- }
- else
- {
- DEBUG_PRINT_LOW("\n FreeBuffer:: fd is invalid or o/p PMEM UseBuffer case");
- }
- }
- return OMX_ErrorNone;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::AllocateInputBuffer
-
-DESCRIPTION
- Helper function for allocate buffer in the input pin
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::allocate_input_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned i = 0;
-
- DEBUG_PRINT_HIGH("\n allocate_input_buffer()::");
- if(bytes != m_sInPortDef.nBufferSize)
- {
- DEBUG_PRINT_ERROR("\nERROR: Buffer size mismatch error: bytes[%u] != nBufferSize[%u]\n",
- bytes, m_sInPortDef.nBufferSize);
- return OMX_ErrorBadParameter;
- }
-
- if(!m_inp_mem_ptr)
- {
- m_inp_mem_ptr = (OMX_BUFFERHEADERTYPE*) \
- calloc( (sizeof(OMX_BUFFERHEADERTYPE)), m_sInPortDef.nBufferCountActual);
- if(m_inp_mem_ptr == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_inp_mem_ptr");
- return OMX_ErrorInsufficientResources;
- }
-
- m_pInput_pmem = (struct pmem *) calloc(sizeof (struct pmem), m_sInPortDef.nBufferCountActual);
-
- if(m_pInput_pmem == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: calloc() Failed for m_pInput_pmem");
- return OMX_ErrorInsufficientResources;
- }
-
- for(i=0; i< m_sInPortDef.nBufferCountActual; i++)
- {
- m_pInput_pmem[i].fd = -1;
- }
- }
-
- for(i=0; i< m_sInPortDef.nBufferCountActual; i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- break;
- }
- }
-
- if(i < m_sInPortDef.nBufferCountActual)
- {
-
- *bufferHdr = (m_inp_mem_ptr + i);
- (*bufferHdr)->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- (*bufferHdr)->nVersion.nVersion = OMX_SPEC_VERSION;
- (*bufferHdr)->nAllocLen = m_sInPortDef.nBufferSize;
- (*bufferHdr)->pAppPrivate = appData;
- (*bufferHdr)->nInputPortIndex = PORT_INDEX_IN;
-
- m_pInput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if(m_pInput_pmem[i].fd == 0)
- {
- m_pInput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
- }
-
- if(m_pInput_pmem[i].fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: /dev/pmem_adsp open() Failed\n");
- return OMX_ErrorInsufficientResources;
- }
- m_pInput_pmem[i].size = m_sInPortDef.nBufferSize;
- m_pInput_pmem[i].offset = 0;
-
- m_pInput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pInput_pmem[i].size,PROT_READ|PROT_WRITE,
- MAP_SHARED,m_pInput_pmem[i].fd,0);
- if(m_pInput_pmem[i].buffer == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\nERROR: mmap FAILED\n");
- return OMX_ErrorInsufficientResources;
- }
-
- (*bufferHdr)->pBuffer = (OMX_U8 *)m_pInput_pmem[i].buffer;
-
- BITMASK_SET(&m_inp_bm_count,i);
- //here change the I/P param here from buf_adr to pmem
- if( dev_use_buf(&m_pInput_pmem[i],PORT_INDEX_IN) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_use_buf FAILED for i/p buf\n");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: All i/p buffers are allocated, invalid allocate buf call"
- "for index [%d]\n", i);
- eRet = OMX_ErrorInsufficientResources;
- }
-
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::AllocateOutputBuffer
-
-DESCRIPTION
- Helper fn for AllocateBuffer in the output pin
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything went well.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::allocate_output_buffer(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- OMX_BUFFERHEADERTYPE *bufHdr= NULL; // buffer header
- unsigned i= 0; // Temporary counter
- DEBUG_PRINT_HIGH("\n allocate_output_buffer()::");
- if(!m_out_mem_ptr)
- {
- int nBufHdrSize = 0;
- DEBUG_PRINT_LOW("Allocating First Output Buffer(%d)\n",m_sOutPortDef.nBufferCountActual);
- nBufHdrSize = m_sOutPortDef.nBufferCountActual * sizeof(OMX_BUFFERHEADERTYPE);
-
- /*
- * Memory for output side involves the following:
- * 1. Array of Buffer Headers
- * 2. Bitmask array to hold the buffer allocation details
- * In order to minimize the memory management entire allocation
- * is done in one step.
- */
- m_out_mem_ptr = (OMX_BUFFERHEADERTYPE *)calloc(nBufHdrSize,1);
-
- m_pOutput_pmem = (struct pmem *) calloc(sizeof(struct pmem), m_sOutPortDef.nBufferCountActual);
-
- if(m_out_mem_ptr && m_pOutput_pmem)
- {
- bufHdr = m_out_mem_ptr;
-
- for(i=0; i < m_sOutPortDef.nBufferCountActual ; i++)
- {
- bufHdr->nSize = sizeof(OMX_BUFFERHEADERTYPE);
- bufHdr->nVersion.nVersion = OMX_SPEC_VERSION;
- // Set the values when we determine the right HxW param
- bufHdr->nAllocLen = bytes;
- bufHdr->nFilledLen = 0;
- bufHdr->pAppPrivate = appData;
- bufHdr->nOutputPortIndex = PORT_INDEX_OUT;
- bufHdr->pBuffer = NULL;
- bufHdr++;
- m_pOutput_pmem[i].fd = -1;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: calloc() failed for m_out_mem_ptr/m_pOutput_pmem");
- eRet = OMX_ErrorInsufficientResources;
- }
- }
-
- DEBUG_PRINT_HIGH("\n actual cnt = %u", m_sOutPortDef.nBufferCountActual);
- for(i=0; i< m_sOutPortDef.nBufferCountActual; i++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,i))
- {
- DEBUG_PRINT_LOW("\n Found a Free Output Buffer %d",i);
- break;
- }
- }
-
- if(eRet == OMX_ErrorNone)
- {
- if(i < m_sOutPortDef.nBufferCountActual)
- {
- m_pOutput_pmem[i].fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
- if(m_pOutput_pmem[i].fd == 0)
- {
- m_pOutput_pmem[i].fd = open ("/dev/pmem_adsp",O_RDWR | O_SYNC);
- }
-
- if(m_pOutput_pmem[i].fd < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: /dev/pmem_adsp open() failed");
- return OMX_ErrorInsufficientResources;
- }
- m_pOutput_pmem[i].size = m_sOutPortDef.nBufferSize;
- m_pOutput_pmem[i].offset = 0;
- m_pOutput_pmem[i].buffer = (unsigned char *)mmap(NULL,m_pOutput_pmem[i].size,PROT_READ|PROT_WRITE,
- MAP_SHARED,m_pOutput_pmem[i].fd,0);
- if(m_pOutput_pmem[i].buffer == MAP_FAILED)
- {
- DEBUG_PRINT_ERROR("\nERROR: MMAP_FAILED in o/p alloc buffer");
- return OMX_ErrorInsufficientResources;
- }
-
- *bufferHdr = (m_out_mem_ptr + i );
- (*bufferHdr)->pBuffer = (OMX_U8 *)m_pOutput_pmem[i].buffer;
-
- BITMASK_SET(&m_out_bm_count,i);
-
- if(dev_use_buf(&m_pOutput_pmem[i],PORT_INDEX_OUT) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_use_buf FAILED for o/p buf");
- return OMX_ErrorInsufficientResources;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: All o/p buffers are allocated, invalid allocate buf call"
- "for index [%d]\n", i);
- }
- }
-
- return eRet;
-}
-
-
-// AllocateBuffer -- API Call
-/* ======================================================================
-FUNCTION
- omx_video::AllocateBuffer
-
-DESCRIPTION
- Returns zero if all the buffers released..
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::allocate_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN OMX_U32 bytes)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorNone; // OMX return type
-
- DEBUG_PRINT_LOW("\n Allocate buffer on port %d \n", (int)port);
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Allocate Buf in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- // What if the client calls again.
- if(port == PORT_INDEX_IN)
- {
- eRet = allocate_input_buffer(hComp,bufferHdr,port,appData,bytes);
- }
- else if(port == PORT_INDEX_OUT)
- {
- eRet = allocate_output_buffer(hComp,bufferHdr,port,appData,bytes);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid Port Index received %d\n",(int)port);
- eRet = OMX_ErrorBadPortIndex;
- }
- DEBUG_PRINT_LOW("Checking for Output Allocate buffer Done");
- if(eRet == OMX_ErrorNone)
- {
- if(allocate_done())
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_IDLE_PENDING);
- post_event(OMX_CommandStateSet,OMX_StateIdle,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == PORT_INDEX_IN && m_sInPortDef.bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_INPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- PORT_INDEX_IN,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- if(port == PORT_INDEX_OUT && m_sOutPortDef.bPopulated)
- {
- if(BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_ENABLE_PENDING))
- {
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_ENABLE_PENDING);
- post_event(OMX_CommandPortEnable,
- PORT_INDEX_OUT,
- OMX_COMPONENT_GENERATE_EVENT);
- m_event_port_settings_sent = false;
- }
- }
- }
- DEBUG_PRINT_LOW("Allocate Buffer exit with ret Code %d\n",eRet);
- return eRet;
-}
-
-
-// Free Buffer - API call
-/* ======================================================================
-FUNCTION
- omx_video::FreeBuffer
-
-DESCRIPTION
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::free_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- unsigned int nPortIndex;
-
- DEBUG_PRINT_LOW("In for decoder free_buffer \n");
-
- if(m_state == OMX_StateIdle &&
- (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING)))
- {
- DEBUG_PRINT_LOW(" free buffer while Component in Loading pending\n");
- }
- else if((m_sInPortDef.bEnabled == OMX_FALSE && port == PORT_INDEX_IN)||
- (m_sOutPortDef.bEnabled == OMX_FALSE && port == PORT_INDEX_OUT))
- {
- DEBUG_PRINT_LOW("Free Buffer while port %d disabled\n", port);
- }
- else if(m_state == OMX_StateExecuting || m_state == OMX_StatePause)
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid state to free buffer,ports need to be disabled\n");
- post_event(OMX_EventError,
- OMX_ErrorPortUnpopulated,
- OMX_COMPONENT_GENERATE_EVENT);
-
- return eRet;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Invalid state to free buffer,port lost Buffers\n");
- post_event(OMX_EventError,
- OMX_ErrorPortUnpopulated,
- OMX_COMPONENT_GENERATE_EVENT);
- }
-
- if(port == PORT_INDEX_IN)
- {
- // check if the buffer is valid
- nPortIndex = buffer - m_inp_mem_ptr;
-
- DEBUG_PRINT_LOW("free_buffer on i/p port - Port idx %d, actual cnt %d \n",
- nPortIndex, m_sInPortDef.nBufferCountActual);
- if(nPortIndex < m_sInPortDef.nBufferCountActual)
- {
- // Clear the bit associated with it.
- BITMASK_CLEAR(&m_inp_bm_count,nPortIndex);
- free_input_buffer (buffer);
- m_sInPortDef.bPopulated = OMX_FALSE;
-
- /*Free the Buffer Header*/
- if(release_input_done())
- {
- input_use_buffer = false;
- if(m_inp_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing m_inp_mem_ptr\n");
- free (m_inp_mem_ptr);
- m_inp_mem_ptr = NULL;
- }
- if(m_pInput_pmem)
- {
- DEBUG_PRINT_LOW("Freeing m_pInput_pmem\n");
- free(m_pInput_pmem);
- m_pInput_pmem = NULL;
- }
-
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: free_buffer ,Port Index Invalid\n");
- eRet = OMX_ErrorBadPortIndex;
- }
-
- if(BITMASK_PRESENT((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING)
- && release_input_done())
- {
- DEBUG_PRINT_LOW("MOVING TO DISABLED STATE \n");
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_DISABLE_PENDING);
- post_event(OMX_CommandPortDisable,
- PORT_INDEX_IN,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
- else if(port == PORT_INDEX_OUT)
- {
- // check if the buffer is valid
- nPortIndex = buffer - (OMX_BUFFERHEADERTYPE*)m_out_mem_ptr;
-
- DEBUG_PRINT_LOW("free_buffer on o/p port - Port idx %d, actual cnt %d \n",
- nPortIndex, m_sOutPortDef.nBufferCountActual);
- if(nPortIndex < m_sOutPortDef.nBufferCountActual)
- {
- // Clear the bit associated with it.
- BITMASK_CLEAR(&m_out_bm_count,nPortIndex);
- m_sOutPortDef.bPopulated = OMX_FALSE;
- free_output_buffer (buffer);
-
- if(release_output_done())
- {
- output_use_buffer = false;
- if(m_out_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing m_out_mem_ptr\n");
- free (m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
- if(m_pOutput_pmem)
- {
- DEBUG_PRINT_LOW("Freeing m_pOutput_pmem\n");
- free(m_pOutput_pmem);
- m_pOutput_pmem = NULL;
- }
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: free_buffer , Port Index Invalid\n");
- eRet = OMX_ErrorBadPortIndex;
- }
- if(BITMASK_PRESENT((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING)
- && release_output_done() )
- {
- DEBUG_PRINT_LOW("FreeBuffer : If any Disable event pending,post it\n");
-
- DEBUG_PRINT_LOW("MOVING TO DISABLED STATE \n");
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_DISABLE_PENDING);
- post_event(OMX_CommandPortDisable,
- PORT_INDEX_OUT,
- OMX_COMPONENT_GENERATE_EVENT);
-
- }
- }
- else
- {
- eRet = OMX_ErrorBadPortIndex;
- }
- if((eRet == OMX_ErrorNone) &&
- (BITMASK_PRESENT(&m_flags ,OMX_COMPONENT_LOADING_PENDING)))
- {
- if(release_done())
- {
- if(dev_stop() != 0)
- {
- DEBUG_PRINT_ERROR("ERROR: dev_stop() FAILED\n");
- eRet = OMX_ErrorHardware;
- }
- // Send the callback now
- BITMASK_CLEAR((&m_flags),OMX_COMPONENT_LOADING_PENDING);
- post_event(OMX_CommandStateSet, OMX_StateLoaded,
- OMX_COMPONENT_GENERATE_EVENT);
- }
- }
-
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_video::EmptyThisBuffer
-
-DESCRIPTION
- This routine is used to push the encoded video frames to
- the video decoder.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything went successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::empty_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_ERRORTYPE ret1 = OMX_ErrorNone;
- unsigned int nBufferIndex ;
-
- DEBUG_PRINT_LOW("\n ETB: buffer = %p, buffer->pBuffer[%p]\n", buffer, buffer->pBuffer);
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Empty this buffer in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if (buffer == NULL || (buffer->nSize != sizeof(OMX_BUFFERHEADERTYPE)))
- {
- DEBUG_PRINT_ERROR("\nERROR: omx_video::etb--> buffer is null or buffer size is invalid");
- return OMX_ErrorBadParameter;
- }
-
- if(buffer->nVersion.nVersion != OMX_SPEC_VERSION)
- {
- DEBUG_PRINT_ERROR("\nERROR: omx_video::etb--> OMX Version Invalid");
- return OMX_ErrorVersionMismatch;
- }
-
- if (buffer->nInputPortIndex != (OMX_U32)PORT_INDEX_IN)
- {
- DEBUG_PRINT_ERROR("\nERROR: Bad port index to call empty_this_buffer");
- return OMX_ErrorBadPortIndex;
- }
- if(!m_sInPortDef.bEnabled)
- {
- DEBUG_PRINT_ERROR("\nERROR: Cannot call empty_this_buffer while I/P port is disabled");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- nBufferIndex = buffer - m_inp_mem_ptr;
-
- if(nBufferIndex > m_sInPortDef.nBufferCountActual )
- {
- DEBUG_PRINT_ERROR("ERROR: ETB: Invalid buffer index[%d]\n", nBufferIndex);
- return OMX_ErrorBadParameter;
- }
-
- m_etb_count++;
- DEBUG_PRINT_LOW("\n DBG: i/p nTimestamp = %u", (unsigned)buffer->nTimeStamp);
- post_event ((unsigned)hComp,(unsigned)buffer,OMX_COMPONENT_GENERATE_ETB);
- return OMX_ErrorNone;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_video::empty_this_buffer_proxy
-
-DESCRIPTION
- This routine is used to push the encoded video frames to
- the video decoder.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything went successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::empty_this_buffer_proxy(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- OMX_U8 *pmem_data_buf = NULL;
- int push_cnt = 0;
- unsigned nBufIndex = 0;
- OMX_ERRORTYPE ret = OMX_ErrorNone;
-
- DEBUG_PRINT_LOW("\n ETBProxy: buffer->pBuffer[%p]\n", buffer->pBuffer);
-
- if(buffer == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: ETBProxy: Invalid buffer[%p]\n", buffer);
- return OMX_ErrorBadParameter;
- }
-
- nBufIndex = buffer - ((OMX_BUFFERHEADERTYPE *)m_inp_mem_ptr);
-
- if(nBufIndex >= m_sInPortDef.nBufferCountActual)
- {
- DEBUG_PRINT_ERROR("\nERROR: ETBProxy: Invalid bufindex = %u\n", nBufIndex);
- return OMX_ErrorBadParameter;
- }
-
- pending_input_buffers++;
- if(input_flush_progress == true)
- {
- post_event ((unsigned int)buffer,0,
- OMX_COMPONENT_GENERATE_EBD);
- DEBUG_PRINT_ERROR("\nERROR: ETBProxy: Input flush in progress");
- return OMX_ErrorNone;
- }
-
- if(input_use_buffer && !m_use_input_pmem)
- {
- DEBUG_PRINT_LOW("\n Heap UseBuffer case, so memcpy the data");
- pmem_data_buf = (OMX_U8 *)m_pInput_pmem[nBufIndex].buffer;
-
- memcpy (pmem_data_buf, (buffer->pBuffer + buffer->nOffset),
- buffer->nFilledLen);
- DEBUG_PRINT_LOW("memcpy() done in ETBProxy for i/p Heap UseBuf");
- }
-
- if(dev_empty_buf(buffer, pmem_data_buf) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: ETBProxy: dev_empty_buf failed");
- /*Generate an async error and move to invalid state*/
- pending_input_buffers--;
- return OMX_ErrorBadParameter;
- }
-
- return ret;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::FillThisBuffer
-
-DESCRIPTION
- IL client uses this method to release the frame buffer
- after displaying them.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::fill_this_buffer(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* buffer)
-{
- DEBUG_PRINT_LOW("\n FTB: buffer->pBuffer[%p]\n", buffer->pBuffer);
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: FTB in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
-
- if (buffer == NULL ||(buffer->nSize != sizeof(OMX_BUFFERHEADERTYPE)))
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::ftb-->Invalid buffer or size\n");
- return OMX_ErrorBadParameter;
- }
-
- if(buffer->nVersion.nVersion != OMX_SPEC_VERSION)
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::ftb-->OMX Version Invalid\n");
- return OMX_ErrorVersionMismatch;
- }
-
- if (buffer->nOutputPortIndex != (OMX_U32)PORT_INDEX_OUT)
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::ftb-->Bad port index\n");
- return OMX_ErrorBadPortIndex;
- }
-
- if(!m_sOutPortDef.bEnabled)
- {
- DEBUG_PRINT_ERROR("ERROR: omx_video::ftb-->port is disabled\n");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- post_event((unsigned) hComp, (unsigned)buffer,OMX_COMPONENT_GENERATE_FTB);
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::fill_this_buffer_proxy
-
-DESCRIPTION
- IL client uses this method to release the frame buffer
- after displaying them.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::fill_this_buffer_proxy(
- OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_BUFFERHEADERTYPE* bufferAdd)
-{
- OMX_U8 *pmem_data_buf = NULL;
- OMX_ERRORTYPE nRet = OMX_ErrorNone;
-
- DEBUG_PRINT_LOW("\n FTBProxy: bufferAdd->pBuffer[%p]\n", bufferAdd->pBuffer);
-
- if(bufferAdd == NULL || ((bufferAdd - m_out_mem_ptr) >= m_sOutPortDef.nBufferCountActual) )
- {
- DEBUG_PRINT_ERROR("\nERROR: FTBProxy: Invalid i/p params\n");
- return OMX_ErrorBadParameter;
- }
-
- pending_output_buffers++;
- /*Return back the output buffer to client*/
- if( m_sOutPortDef.bEnabled != OMX_TRUE || output_flush_progress == true)
- {
- DEBUG_PRINT_LOW("\n o/p port is Disabled or Flush in Progress");
- post_event ((unsigned int)bufferAdd,0,
- OMX_COMPONENT_GENERATE_FBD);
- return OMX_ErrorNone;
- }
-
- if(output_use_buffer && !m_use_output_pmem)
- {
- DEBUG_PRINT_LOW("\n Heap UseBuffer case");
- pmem_data_buf = (OMX_U8 *)m_pOutput_pmem[bufferAdd - m_out_mem_ptr].buffer;
- }
-
- if(dev_fill_buf(bufferAdd, pmem_data_buf) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: dev_fill_buf() Failed");
- pending_output_buffers--;
- return OMX_ErrorBadParameter;
- }
-
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::SetCallbacks
-
-DESCRIPTION
- Set the callbacks.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::set_callbacks(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_CALLBACKTYPE* callbacks,
- OMX_IN OMX_PTR appData)
-{
-
- m_pCallbacks = *callbacks;
- DEBUG_PRINT_LOW("\n Callbacks Set %p %p %p",m_pCallbacks.EmptyBufferDone,\
- m_pCallbacks.EventHandler,m_pCallbacks.FillBufferDone);
- m_app_data = appData;
- return OMX_ErrorNotImplemented;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::UseEGLImage
-
-DESCRIPTION
- OMX Use EGL Image method implementation <TBD>.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- Not Implemented error.
-
-========================================================================== */
-OMX_ERRORTYPE omx_video::use_EGL_image(OMX_IN OMX_HANDLETYPE hComp,
- OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr,
- OMX_IN OMX_U32 port,
- OMX_IN OMX_PTR appData,
- OMX_IN void* eglImage)
-{
- DEBUG_PRINT_ERROR("ERROR: use_EGL_image: Not Implemented \n");
- return OMX_ErrorNotImplemented;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::ComponentRoleEnum
-
-DESCRIPTION
- OMX Component Role Enum method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything is successful.
-========================================================================== */
-OMX_ERRORTYPE omx_video::component_role_enum(OMX_IN OMX_HANDLETYPE hComp,
- OMX_OUT OMX_U8* role,
- OMX_IN OMX_U32 index)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
- if(!strncmp((char*)m_nkind, "OMX.qcom.video.decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.mpeg4",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.decoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.h263",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.decoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.avc",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.decoder.vc1",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_decoder.vc1",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_encoder.mpeg4",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_encoder.h263",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- if((0 == index) && role)
- {
- strncpy((char *)role, "video_encoder.avc",OMX_MAX_STRINGNAME_SIZE);
- DEBUG_PRINT_LOW("component_role_enum: role %s\n",role);
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: No more roles \n");
- eRet = OMX_ErrorNoMore;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Querying Role on Unknown Component\n");
- eRet = OMX_ErrorInvalidComponentName;
- }
- return eRet;
-}
-
-
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::AllocateDone
-
-DESCRIPTION
- Checks if entire buffer pool is allocated by IL Client or not.
- Need this to move to IDLE state.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_video::allocate_done(void)
-{
- bool bRet = false;
- bool bRet_In = false;
- bool bRet_Out = false;
-
- bRet_In = allocate_input_done();
- bRet_Out = allocate_output_done();
-
- if(bRet_In && bRet_Out)
- {
- bRet = true;
- }
-
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_venc::AllocateInputDone
-
-DESCRIPTION
- Checks if I/P buffer pool is allocated by IL Client or not.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_video::allocate_input_done(void)
-{
- bool bRet = false;
- unsigned i=0;
-
- if(m_inp_mem_ptr == NULL)
- {
- return bRet;
- }
- if(m_inp_mem_ptr )
- {
- for(;i<m_sInPortDef.nBufferCountActual;i++)
- {
- if(BITMASK_ABSENT(&m_inp_bm_count,i))
- {
- break;
- }
- }
- }
- if(i==m_sInPortDef.nBufferCountActual)
- {
- bRet = true;
- }
- if(i==m_sInPortDef.nBufferCountActual && m_sInPortDef.bEnabled)
- {
- m_sInPortDef.bPopulated = OMX_TRUE;
- }
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_venc::AllocateOutputDone
-
-DESCRIPTION
- Checks if entire O/P buffer pool is allocated by IL Client or not.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false.
-
-========================================================================== */
-bool omx_video::allocate_output_done(void)
-{
- bool bRet = false;
- unsigned j=0;
-
- if(m_out_mem_ptr == NULL)
- {
- return bRet;
- }
-
- if(m_out_mem_ptr )
- {
- for(;j<m_sOutPortDef.nBufferCountActual;j++)
- {
- if(BITMASK_ABSENT(&m_out_bm_count,j))
- {
- break;
- }
- }
- }
-
- if(j==m_sOutPortDef.nBufferCountActual)
- {
- bRet = true;
- }
-
- if(j==m_sOutPortDef.nBufferCountActual && m_sOutPortDef.bEnabled)
- {
- m_sOutPortDef.bPopulated = OMX_TRUE;
- }
- return bRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::ReleaseDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_video::release_done(void)
-{
- bool bRet = false;
- DEBUG_PRINT_LOW("Inside release_done()\n");
- if(release_input_done())
- {
- if(release_output_done())
- {
- bRet = true;
- }
- }
- return bRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::ReleaseOutputDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_video::release_output_done(void)
-{
- bool bRet = false;
- unsigned i=0,j=0;
-
- DEBUG_PRINT_LOW("Inside release_output_done()\n");
- if(m_out_mem_ptr)
- {
- for(;j<m_sOutPortDef.nBufferCountActual;j++)
- {
- if(BITMASK_PRESENT(&m_out_bm_count,j))
- {
- break;
- }
- }
- if(j==m_sOutPortDef.nBufferCountActual)
- {
- bRet = true;
- }
- }
- else
- {
- bRet = true;
- }
- return bRet;
-}
-/* ======================================================================
-FUNCTION
- omx_venc::ReleaseInputDone
-
-DESCRIPTION
- Checks if IL client has released all the buffers.
-
-PARAMETERS
- None.
-
-RETURN VALUE
- true/false
-
-========================================================================== */
-bool omx_video::release_input_done(void)
-{
- bool bRet = false;
- unsigned i=0,j=0;
-
- DEBUG_PRINT_LOW("Inside release_input_done()\n");
- if(m_inp_mem_ptr)
- {
- for(;j<m_sInPortDef.nBufferCountActual;j++)
- {
- if( BITMASK_PRESENT(&m_inp_bm_count,j))
- {
- break;
- }
- }
- if(j==m_sInPortDef.nBufferCountActual)
- {
- bRet = true;
- }
- }
- else
- {
- bRet = true;
- }
- return bRet;
-}
-
-OMX_ERRORTYPE omx_video::fill_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE * buffer)
-{
- DEBUG_PRINT_LOW("\nfill_buffer_done: buffer->pBuffer[%p]\n", buffer->pBuffer);
- if(buffer == NULL || ((buffer - m_out_mem_ptr) > m_sOutPortDef.nBufferCountActual))
- {
- return OMX_ErrorBadParameter;
- }
-
- pending_output_buffers--;
-
- /* For use buffer we need to copy the data */
- if(m_pCallbacks.FillBufferDone)
- {
- if(buffer->nFilledLen > 0)
- {
- m_fbd_count++;
- }
- m_pCallbacks.FillBufferDone (hComp,m_app_data,buffer);
- }
- else
- {
- return OMX_ErrorBadParameter;
- }
-
- return OMX_ErrorNone;
-}
-
-OMX_ERRORTYPE omx_video::empty_buffer_done(OMX_HANDLETYPE hComp,
- OMX_BUFFERHEADERTYPE* buffer)
-{
- DEBUG_PRINT_LOW("\nempty_buffer_done: buffer->pBuffer[%p]\n", buffer->pBuffer);
- if(buffer == NULL || ((buffer - m_inp_mem_ptr) > m_sInPortDef.nBufferCountActual))
- {
- return OMX_ErrorBadParameter;
- }
-
- pending_input_buffers--;
- if(m_pCallbacks.EmptyBufferDone)
- {
- m_pCallbacks.EmptyBufferDone(hComp ,m_app_data, buffer);
- }
- return OMX_ErrorNone;
-}
diff --git a/mm-video/vidc/venc/src/omx_video_encoder.cpp b/mm-video/vidc/venc/src/omx_video_encoder.cpp
deleted file mode 100644
index 87785102..00000000
--- a/mm-video/vidc/venc/src/omx_video_encoder.cpp
+++ /dev/null
@@ -1,1230 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "omx_video_encoder.h"
-#include <string.h>
-#include "video_encoder_device.h"
-#include <stdio.h>
-
-/*----------------------------------------------------------------------------
-* Preprocessor Definitions and Constants
-* -------------------------------------------------------------------------*/
-
-#define OMX_SPEC_VERSION 0x00000101
-#define OMX_INIT_STRUCT(_s_, _name_) \
- memset((_s_), 0x0, sizeof(_name_)); \
- (_s_)->nSize = sizeof(_name_); \
- (_s_)->nVersion.nVersion = OMX_SPEC_VERSION
-
-extern int m_pipe;
-
-// factory function executed by the core to create instances
-void *get_omx_component_factory_fn(void)
-{
- return(new omx_venc);
-}
-
-//constructor
-
-omx_venc::omx_venc()
-{
- //nothing to do
-}
-
-omx_venc::~omx_venc()
-{
- //nothing to do
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::ComponentInit
-
-DESCRIPTION
- Initialize the component.
-
-PARAMETERS
- ctxt -- Context information related to the self.
- id -- Event identifier. This could be any of the following:
- 1. Command completion event
- 2. Buffer done callback event
- 3. Frame done callback event
-
-RETURN VALUE
- None.
-
-========================================================================== */
-OMX_ERRORTYPE omx_venc::component_init(OMX_STRING role)
-{
-
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
- int fds[2];
- int r;
-
- OMX_VIDEO_CODINGTYPE codec_type;
-
- DEBUG_PRINT_HIGH("\n omx_venc(): Inside component_init()");
- // Copy the role information which provides the decoder m_nkind
- strncpy((char *)m_nkind,role,OMX_MAX_STRINGNAME_SIZE);
-
- if(!strncmp((char *)m_nkind,"OMX.qcom.video.encoder.mpeg4",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_encoder.mpeg4",\
- OMX_MAX_STRINGNAME_SIZE);
- codec_type = OMX_VIDEO_CodingMPEG4;
- }
- else if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.h263",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_encoder.h263",OMX_MAX_STRINGNAME_SIZE);
- codec_type = OMX_VIDEO_CodingH263;
- }
- else if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.avc",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char *)m_cRole, "video_encoder.avc",OMX_MAX_STRINGNAME_SIZE);
- codec_type = OMX_VIDEO_CodingAVC;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Unknown Component\n");
- eRet = OMX_ErrorInvalidComponentName;
- }
-
-
- if(eRet != OMX_ErrorNone)
- {
- return eRet;
- }
-
- handle = new venc_dev();
-
- if(handle == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: handle is NULL");
- return OMX_ErrorInsufficientResources;
- }
-
- if(handle->venc_open(codec_type) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_open failed");
- return OMX_ErrorInsufficientResources;
- }
-
- //Intialise the OMX layer variables
- memset(&m_pCallbacks,0,sizeof(OMX_CALLBACKTYPE));
-
- OMX_INIT_STRUCT(&m_sPortParam, OMX_PORT_PARAM_TYPE);
- m_sPortParam.nPorts = 0x2;
- m_sPortParam.nStartPortNumber = (OMX_U32) PORT_INDEX_IN;
-
- OMX_INIT_STRUCT(&m_sPortParam_audio, OMX_PORT_PARAM_TYPE);
- m_sPortParam_audio.nPorts = 0;
- m_sPortParam_audio.nStartPortNumber = 0;
-
- OMX_INIT_STRUCT(&m_sPortParam_img, OMX_PORT_PARAM_TYPE);
- m_sPortParam_img.nPorts = 0;
- m_sPortParam_img.nStartPortNumber = 0;
-
- OMX_INIT_STRUCT(&m_sParamBitrate, OMX_VIDEO_PARAM_BITRATETYPE);
- m_sParamBitrate.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sParamBitrate.eControlRate = OMX_Video_ControlRateVariableSkipFrames;
- m_sParamBitrate.nTargetBitrate = 64000;
-
- OMX_INIT_STRUCT(&m_sConfigBitrate, OMX_VIDEO_CONFIG_BITRATETYPE);
- m_sConfigBitrate.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sConfigBitrate.nEncodeBitrate = 64000;
-
- OMX_INIT_STRUCT(&m_sConfigFramerate, OMX_CONFIG_FRAMERATETYPE);
- m_sConfigFramerate.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sConfigFramerate.xEncodeFramerate = 30 << 16;
-
- OMX_INIT_STRUCT(&m_sConfigIntraRefreshVOP, OMX_CONFIG_INTRAREFRESHVOPTYPE);
- m_sConfigIntraRefreshVOP.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sConfigIntraRefreshVOP.IntraRefreshVOP = OMX_FALSE;
-
- OMX_INIT_STRUCT(&m_sConfigFrameRotation, OMX_CONFIG_ROTATIONTYPE);
- m_sConfigFrameRotation.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sConfigFrameRotation.nRotation = 0;
-
- OMX_INIT_STRUCT(&m_sSessionQuantization, OMX_VIDEO_PARAM_QUANTIZATIONTYPE);
- m_sSessionQuantization.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sSessionQuantization.nQpI = 9;
- m_sSessionQuantization.nQpP = 6;
- m_sSessionQuantization.nQpB = 2;
-
- OMX_INIT_STRUCT(&m_sAVCSliceFMO, OMX_VIDEO_PARAM_AVCSLICEFMO);
- m_sAVCSliceFMO.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sAVCSliceFMO.eSliceMode = OMX_VIDEO_SLICEMODE_AVCDefault;
- m_sAVCSliceFMO.nNumSliceGroups = 0;
- m_sAVCSliceFMO.nSliceGroupMapType = 0;
- OMX_INIT_STRUCT(&m_sParamProfileLevel, OMX_VIDEO_PARAM_PROFILELEVELTYPE);
- m_sParamProfileLevel.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
-
- if(codec_type == OMX_VIDEO_CodingMPEG4)
- {
- m_sParamProfileLevel.eProfile = (OMX_U32) OMX_VIDEO_MPEG4ProfileSimple;
- m_sParamProfileLevel.eLevel = (OMX_U32) OMX_VIDEO_MPEG4Level0;
- }
- else if(codec_type == OMX_VIDEO_CodingH263)
- {
- m_sParamProfileLevel.eProfile = (OMX_U32) OMX_VIDEO_H263ProfileBaseline;
- m_sParamProfileLevel.eLevel = (OMX_U32) OMX_VIDEO_H263Level10;
- }
- else if(codec_type == OMX_VIDEO_CodingAVC)
- {
- m_sParamProfileLevel.eProfile = (OMX_U32) OMX_VIDEO_AVCProfileBaseline;
- m_sParamProfileLevel.eLevel = (OMX_U32) OMX_VIDEO_AVCLevel1;
- }
-
- // Initialize the video parameters for input port
- OMX_INIT_STRUCT(&m_sInPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
- m_sInPortDef.nPortIndex= (OMX_U32) PORT_INDEX_IN;
- m_sInPortDef.bEnabled = OMX_TRUE;
- m_sInPortDef.bPopulated = OMX_FALSE;
- m_sInPortDef.eDomain = OMX_PortDomainVideo;
- m_sInPortDef.eDir = OMX_DirInput;
- m_sInPortDef.format.video.cMIMEType = "YUV420";
- m_sInPortDef.format.video.nFrameWidth = OMX_CORE_QCIF_WIDTH;
- m_sInPortDef.format.video.nFrameHeight = OMX_CORE_QCIF_HEIGHT;
- m_sInPortDef.format.video.nBitrate = 64000;
- m_sInPortDef.format.video.xFramerate = 15 << 16;
- m_sInPortDef.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
- m_sInPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
-
- if(dev_get_buf_req(&m_sInPortDef.nBufferCountMin,
- &m_sInPortDef.nBufferCountActual,
- &m_sInPortDef.nBufferSize,
- m_sInPortDef.nPortIndex) != true)
- {
- eRet = OMX_ErrorUndefined;
-
- }
-
- // Initialize the video parameters for output port
- OMX_INIT_STRUCT(&m_sOutPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
- m_sOutPortDef.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sOutPortDef.bEnabled = OMX_TRUE;
- m_sOutPortDef.bPopulated = OMX_FALSE;
- m_sOutPortDef.eDomain = OMX_PortDomainVideo;
- m_sOutPortDef.eDir = OMX_DirOutput;
- m_sOutPortDef.format.video.nFrameWidth = OMX_CORE_QCIF_WIDTH;
- m_sOutPortDef.format.video.nFrameHeight = OMX_CORE_QCIF_HEIGHT;
- m_sOutPortDef.format.video.nBitrate = 64000;
- m_sOutPortDef.format.video.xFramerate = 15 << 16;
- m_sOutPortDef.format.video.eColorFormat = OMX_COLOR_FormatUnused;
- if(codec_type == OMX_VIDEO_CodingMPEG4)
- {
- m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
- }
- else if(codec_type == OMX_VIDEO_CodingH263)
- {
- m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingH263;
- }
- else
- {
- m_sOutPortDef.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
- }
- if(dev_get_buf_req(&m_sOutPortDef.nBufferCountMin,
- &m_sOutPortDef.nBufferCountActual,
- &m_sOutPortDef.nBufferSize,
- m_sOutPortDef.nPortIndex) != true)
- {
- eRet = OMX_ErrorUndefined;
- }
-
- // Initialize the video color format for input port
- OMX_INIT_STRUCT(&m_sInPortFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE);
- m_sInPortFormat.nPortIndex = (OMX_U32) PORT_INDEX_IN;
- m_sInPortFormat.nIndex = 0;
- m_sInPortFormat.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
- m_sInPortFormat.eCompressionFormat = OMX_VIDEO_CodingUnused;
-
-
- // Initialize the compression format for output port
- OMX_INIT_STRUCT(&m_sOutPortFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE);
- m_sOutPortFormat.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sOutPortFormat.nIndex = 0;
- m_sOutPortFormat.eColorFormat = OMX_COLOR_FormatUnused;
- if(codec_type == OMX_VIDEO_CodingMPEG4)
- {
- m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
- }
- else if(codec_type == OMX_VIDEO_CodingH263)
- {
- m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingH263;
- }
- else
- {
- m_sOutPortFormat.eCompressionFormat = OMX_VIDEO_CodingAVC;
- }
-
- // mandatory Indices for kronos test suite
- OMX_INIT_STRUCT(&m_sPriorityMgmt, OMX_PRIORITYMGMTTYPE);
-
- OMX_INIT_STRUCT(&m_sInBufSupplier, OMX_PARAM_BUFFERSUPPLIERTYPE);
- m_sInBufSupplier.nPortIndex = (OMX_U32) PORT_INDEX_IN;
-
- OMX_INIT_STRUCT(&m_sOutBufSupplier, OMX_PARAM_BUFFERSUPPLIERTYPE);
- m_sOutBufSupplier.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
-
-
- // mp4 specific init
- OMX_INIT_STRUCT(&m_sParamMPEG4, OMX_VIDEO_PARAM_MPEG4TYPE);
- m_sParamMPEG4.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sParamMPEG4.eProfile = OMX_VIDEO_MPEG4ProfileSimple;
- m_sParamMPEG4.eLevel = OMX_VIDEO_MPEG4Level0;
- m_sParamMPEG4.nSliceHeaderSpacing = 0;
- m_sParamMPEG4.bSVH = OMX_FALSE;
- m_sParamMPEG4.bGov = OMX_FALSE;
- m_sParamMPEG4.nPFrames = 29; // 2 second intra period for default 15 fps
- m_sParamMPEG4.bACPred = OMX_TRUE;
- m_sParamMPEG4.nTimeIncRes = 30; // delta = 2 @ 15 fps
- m_sParamMPEG4.nAllowedPictureTypes = 2; // pframe and iframe
- m_sParamMPEG4.nHeaderExtension = 1; // number of video packet headers per vop
- m_sParamMPEG4.bReversibleVLC = OMX_FALSE;
-
- // h263 specific init
- OMX_INIT_STRUCT(&m_sParamH263, OMX_VIDEO_PARAM_H263TYPE);
- m_sParamH263.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sParamH263.nPFrames = 29;
- m_sParamH263.nBFrames = 0;
- m_sParamH263.eProfile = OMX_VIDEO_H263ProfileBaseline;
- m_sParamH263.eLevel = OMX_VIDEO_H263Level10;
- m_sParamH263.bPLUSPTYPEAllowed = OMX_FALSE;
- m_sParamH263.nAllowedPictureTypes = 2;
- m_sParamH263.bForceRoundingTypeToZero = OMX_TRUE; ///@todo determine what this should be
- m_sParamH263.nPictureHeaderRepetition = 0; ///@todo determine what this should be
- m_sParamH263.nGOBHeaderInterval = 0; ///@todo determine what this should be
-
- // h264 specific init
- OMX_INIT_STRUCT(&m_sParamH263, OMX_VIDEO_PARAM_AVCTYPE);
- m_sParamAVC.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- m_sParamAVC.nSliceHeaderSpacing =
- m_sParamAVC.nPFrames = 29;
- m_sParamAVC.nBFrames = 0;
- m_sParamAVC.bUseHadamard = OMX_FALSE;//todo: to decide the value
- m_sParamAVC.nRefFrames = 0; //todo: to decide the value
- m_sParamAVC.nRefIdx10ActiveMinus1 = 0; //todo: to decide the value
- m_sParamAVC.nRefIdx11ActiveMinus1 = 0; //todo: to decide the value
- m_sParamAVC.bEnableUEP = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bEnableFMO = OMX_FALSE;//todo: to decide the value
- m_sParamAVC.bEnableASO = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bEnableRS = OMX_FALSE;//todo: to decide the value
- m_sParamAVC.eProfile = OMX_VIDEO_AVCProfileBaseline;
- m_sParamAVC.eLevel = OMX_VIDEO_AVCLevel1;
- m_sParamAVC.nAllowedPictureTypes = 2;
- m_sParamAVC.bFrameMBsOnly = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bMBAFF = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bEntropyCodingCABAC = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bWeightedPPrediction = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.nWeightedBipredicitonMode = 0;//todo: to decide the value
- m_sParamAVC.bconstIpred = OMX_FALSE;//todo: to decide the value
- m_sParamAVC.bDirect8x8Inference = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.bDirectSpatialTemporal = OMX_FALSE; //todo: to decide the value
- m_sParamAVC.nCabacInitIdc = 0; //todo: to decide the value
- //m_sParamAVC.eLoopFilterMode = 0; //todo: to decide the value
-
- m_state = OMX_StateLoaded;
-
- if(eRet == OMX_ErrorNone)
- {
- if(pipe(fds))
- {
- DEBUG_PRINT_ERROR("ERROR: pipe creation failed\n");
- eRet = OMX_ErrorInsufficientResources;
- }
- else
- {
- if(fds[0] == 0 || fds[1] == 0)
- {
- if(pipe(fds))
- {
- DEBUG_PRINT_ERROR("ERROR: pipe creation failed\n");
- eRet = OMX_ErrorInsufficientResources;
- }
- }
- if(eRet == OMX_ErrorNone)
- {
- m_pipe_in = fds[0];
- m_pipe_out = fds[1];
- }
- }
- r = pthread_create(&msg_thread_id,0,message_thread,this);
-
- if(r < 0)
- {
- eRet = OMX_ErrorInsufficientResources;
- }
- else
- {
- r = pthread_create(&async_thread_id,0,async_venc_message_thread,this);
- if(r < 0)
- {
- eRet = OMX_ErrorInsufficientResources;
- }
- }
- }
-
- DEBUG_PRINT_HIGH("\n Component_init return value = 0x%x", eRet);
- return eRet;
-}
-
-
-/* ======================================================================
-FUNCTION
- omx_venc::Setparameter
-
-DESCRIPTION
- OMX Set Parameter method implementation.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE paramIndex,
- OMX_IN OMX_PTR paramData)
-{
- OMX_ERRORTYPE eRet = OMX_ErrorNone;
-
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: Set Param in Invalid State\n");
- return OMX_ErrorInvalidState;
- }
- if(paramData == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: Get Param in Invalid paramData \n");
- return OMX_ErrorBadParameter;
- }
-
- /*set_parameter can be called in loaded state
- or disabled port */
- if(m_state == OMX_StateLoaded
- || m_sInPortDef.bEnabled == OMX_FALSE
- || m_sOutPortDef.bEnabled == OMX_FALSE)
- {
- DEBUG_PRINT_LOW("Set Parameter called in valid state");
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- switch(paramIndex)
- {
- case OMX_IndexParamPortDefinition:
- {
- OMX_PARAM_PORTDEFINITIONTYPE *portDefn;
- portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPortDefinition H= %d, W = %d\n",
- (int)portDefn->format.video.nFrameHeight,
- (int)portDefn->format.video.nFrameWidth);
-
- if(PORT_INDEX_IN == portDefn->nPortIndex)
- {
- DEBUG_PRINT_LOW("\n i/p actual cnt requested = %d\n", portDefn->nBufferCountActual);
- DEBUG_PRINT_LOW("\n i/p min cnt requested = %d\n", portDefn->nBufferCountMin);
- DEBUG_PRINT_LOW("\n i/p buffersize requested = %d\n", portDefn->nBufferSize);
- if(handle->venc_set_param(paramData,OMX_IndexParamPortDefinition) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_set_param input failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- DEBUG_PRINT_LOW("\n i/p previous actual cnt = %d\n", m_sInPortDef.nBufferCountActual);
- DEBUG_PRINT_LOW("\n i/p previous min cnt = %d\n", m_sInPortDef.nBufferCountMin);
- m_sInPortDef.format.video.nFrameWidth = portDefn->format.video.nFrameWidth;
- m_sInPortDef.format.video.nFrameHeight = portDefn->format.video.nFrameHeight;
- m_sInPortDef.format.video.xFramerate = portDefn->format.video.xFramerate;
- m_sInPortDef.format.video.nBitrate = portDefn->format.video.nBitrate;
- m_sInPortDef.format.video.eColorFormat = portDefn->format.video.eColorFormat;
-
-
- /*Query Input Buffer Requirements*/
- dev_get_buf_req (&m_sInPortDef.nBufferCountMin,
- &m_sInPortDef.nBufferCountActual,
- &m_sInPortDef.nBufferSize,
- m_sInPortDef.nPortIndex);
-
- /*Query ouput Buffer Requirements*/
- dev_get_buf_req (&m_sOutPortDef.nBufferCountMin,
- &m_sOutPortDef.nBufferCountActual,
- &m_sOutPortDef.nBufferSize,
- m_sOutPortDef.nPortIndex);
- m_sInPortDef.nBufferCountActual = portDefn->nBufferCountActual;
- }
- else if(PORT_INDEX_OUT == portDefn->nPortIndex)
- {
- DEBUG_PRINT_LOW("\n o/p actual cnt requested = %d\n", portDefn->nBufferCountActual);
- DEBUG_PRINT_LOW("\n o/p min cnt requested = %d\n", portDefn->nBufferCountMin);
- DEBUG_PRINT_LOW("\n o/p buffersize requested = %d\n", portDefn->nBufferSize);
- if(handle->venc_set_param(paramData,OMX_IndexParamPortDefinition) != true)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_set_param output failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- DEBUG_PRINT_LOW("\n o/p previous actual cnt = %d\n", m_sOutPortDef.nBufferCountActual);
- DEBUG_PRINT_LOW("\n o/p previous min cnt = %d\n", m_sOutPortDef.nBufferCountMin);
- m_sOutPortDef.nBufferCountActual = portDefn->nBufferCountActual;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Set_parameter: Bad Port idx %d",
- (int)portDefn->nPortIndex);
- eRet = OMX_ErrorBadPortIndex;
- }
- m_sConfigFramerate.xEncodeFramerate = portDefn->format.video.xFramerate;
- m_sConfigBitrate.nEncodeBitrate = portDefn->format.video.nBitrate;
- m_sParamBitrate.nTargetBitrate = portDefn->format.video.nBitrate;
- }
- break;
-
- case OMX_IndexParamVideoPortFormat:
- {
- OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt =
- (OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoPortFormat %d\n",
- portFmt->eColorFormat);
- //set the driver with the corresponding values
- if(PORT_INDEX_IN == portFmt->nPortIndex)
- {
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoPortFormat) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
-
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoPortFormat %d\n",
- portFmt->eColorFormat);
-
- m_sInPortFormat.eColorFormat = portFmt->eColorFormat;
- m_sInPortFormat.xFramerate = portFmt->xFramerate;
- }
- //TODO if no use case for O/P port,delet m_sOutPortFormat
- }
- break;
- case OMX_IndexParamVideoInit:
- { //TODO, do we need this index set param
- OMX_PORT_PARAM_TYPE* pParam = (OMX_PORT_PARAM_TYPE*)(paramData);
- DEBUG_PRINT_LOW("\n Set OMX_IndexParamVideoInit called");
- break;
- }
-
- case OMX_IndexParamVideoBitrate:
- {
- OMX_VIDEO_PARAM_BITRATETYPE* pParam = (OMX_VIDEO_PARAM_BITRATETYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoBitrate");
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoBitrate) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- m_sParamBitrate.nTargetBitrate = pParam->nTargetBitrate;
- m_sParamBitrate.eControlRate = pParam->eControlRate;
-
- m_sConfigBitrate.nEncodeBitrate = pParam->nTargetBitrate;
- m_sInPortDef.format.video.nBitrate = pParam->nTargetBitrate;
- m_sOutPortDef.format.video.nBitrate = pParam->nTargetBitrate;
- DEBUG_PRINT_LOW("\nbitrate = %u", m_sOutPortDef.format.video.nBitrate);
- break;
- }
- case OMX_IndexParamVideoMpeg4:
- {
- OMX_VIDEO_PARAM_MPEG4TYPE* pParam = (OMX_VIDEO_PARAM_MPEG4TYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoMpeg4");
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoMpeg4) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- //.. more than one variable storing the npframes,profile,level details
- m_sParamMPEG4.nPFrames = pParam->nPFrames;
- m_sParamMPEG4.eProfile = pParam->eProfile;
- m_sParamMPEG4.eLevel = pParam->eLevel;
- m_sParamMPEG4.bACPred = pParam->bACPred;
- m_sParamMPEG4.nTimeIncRes = pParam->nTimeIncRes;
- m_sParamMPEG4.bReversibleVLC = pParam->bReversibleVLC;
-
- m_sParamProfileLevel.eProfile = pParam->eProfile;
- m_sParamProfileLevel.eLevel = pParam->eLevel;
- break;
- }
- case OMX_IndexParamVideoH263:
- {
- OMX_VIDEO_PARAM_H263TYPE* pParam = (OMX_VIDEO_PARAM_H263TYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoH263");
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoH263) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- //.. more than one variable storing the npframes,profile,level details
- m_sParamH263.nPFrames = pParam->nPFrames;
- m_sParamH263.eProfile = pParam->eProfile;
- m_sParamH263.eLevel = pParam->eLevel;
-
- m_sParamProfileLevel.eProfile = pParam->eProfile;
- m_sParamProfileLevel.eLevel = pParam->eLevel;
- break;
- }
- case OMX_IndexParamVideoAvc:
- {
- OMX_VIDEO_PARAM_AVCTYPE* pParam = (OMX_VIDEO_PARAM_AVCTYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoAvc");
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoAvc) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- //.. more than one variable storing the npframes,profile,level details
- m_sParamAVC.nPFrames = pParam->nPFrames;
- m_sParamAVC.eProfile = pParam->eProfile;
- m_sParamAVC.eLevel = pParam->eLevel;
-
- m_sParamProfileLevel.eProfile = pParam->eProfile;
- m_sParamProfileLevel.eLevel = pParam->eLevel;
- break;
- }
- case OMX_IndexParamVideoProfileLevelCurrent:
- {
- OMX_VIDEO_PARAM_PROFILELEVELTYPE* pParam = (OMX_VIDEO_PARAM_PROFILELEVELTYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoProfileLevelCurrent");
- if(handle->venc_set_param(paramData,OMX_IndexParamVideoProfileLevelCurrent) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- m_sParamProfileLevel.eProfile = pParam->eProfile;
- m_sParamProfileLevel.eLevel = pParam->eLevel;
-
- if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.mpeg4",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- m_sParamMPEG4.eProfile = (OMX_VIDEO_MPEG4PROFILETYPE)m_sParamProfileLevel.eProfile;
- m_sParamMPEG4.eLevel = (OMX_VIDEO_MPEG4LEVELTYPE)m_sParamProfileLevel.eLevel;
- DEBUG_PRINT_LOW("\n MPEG4 profile = %d, level = %d", m_sParamMPEG4.eProfile,
- m_sParamMPEG4.eLevel);
- }
- else if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.h263",\
- OMX_MAX_STRINGNAME_SIZE))
- {
- m_sParamH263.eProfile = (OMX_VIDEO_H263PROFILETYPE)m_sParamProfileLevel.eProfile;
- m_sParamH263.eLevel = (OMX_VIDEO_H263LEVELTYPE)m_sParamProfileLevel.eLevel;
- DEBUG_PRINT_LOW("\n H263 profile = %d, level = %d", m_sParamH263.eProfile,
- m_sParamH263.eLevel);
- }
- else
- {
- m_sParamAVC.eProfile = (OMX_VIDEO_AVCPROFILETYPE)m_sParamProfileLevel.eProfile;
- m_sParamAVC.eLevel = (OMX_VIDEO_AVCLEVELTYPE)m_sParamProfileLevel.eLevel;
- DEBUG_PRINT_LOW("\n AVC profile = %d, level = %d", m_sParamAVC.eProfile,
- m_sParamAVC.eLevel);
- }
- break;
- }
- case OMX_IndexParamStandardComponentRole:
- {
- OMX_PARAM_COMPONENTROLETYPE *comp_role;
- comp_role = (OMX_PARAM_COMPONENTROLETYPE *) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamStandardComponentRole %s\n",
- comp_role->cRole);
-
- if((m_state == OMX_StateLoaded)&&
- !BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING))
- {
- DEBUG_PRINT_LOW("Set Parameter called in valid state");
- }
- else
- {
- DEBUG_PRINT_ERROR("Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((char*)comp_role->cRole,"video_encoder.avc",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_encoder.avc",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet =OMX_ErrorUnsupportedSetting;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((const char*)comp_role->cRole,"video_encoder.mpeg4",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_encoder.mpeg4",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet = OMX_ErrorUnsupportedSetting;
- }
- }
- else if(!strncmp((char*)m_nkind, "OMX.qcom.video.encoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- if(!strncmp((const char*)comp_role->cRole,"video_encoder.h263",OMX_MAX_STRINGNAME_SIZE))
- {
- strncpy((char*)m_cRole,"video_encoder.h263",OMX_MAX_STRINGNAME_SIZE);
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown Index %s\n", comp_role->cRole);
- eRet =OMX_ErrorUnsupportedSetting;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown param %s\n", m_nkind);
- eRet = OMX_ErrorInvalidComponentName;
- }
- break;
- }
-
- case OMX_IndexParamPriorityMgmt:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPriorityMgmt");
- if(m_state != OMX_StateLoaded)
- {
- DEBUG_PRINT_ERROR("ERROR: Set Parameter called in Invalid State\n");
- return OMX_ErrorIncorrectStateOperation;
- }
- OMX_PRIORITYMGMTTYPE *priorityMgmtype = (OMX_PRIORITYMGMTTYPE*) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamPriorityMgmt %d\n",
- priorityMgmtype->nGroupID);
-
- DEBUG_PRINT_LOW("set_parameter: priorityMgmtype %d\n",
- priorityMgmtype->nGroupPriority);
-
- m_sPriorityMgmt.nGroupID = priorityMgmtype->nGroupID;
- m_sPriorityMgmt.nGroupPriority = priorityMgmtype->nGroupPriority;
-
- break;
- }
-
- case OMX_IndexParamCompBufferSupplier:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamCompBufferSupplier");
- OMX_PARAM_BUFFERSUPPLIERTYPE *bufferSupplierType = (OMX_PARAM_BUFFERSUPPLIERTYPE*) paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamCompBufferSupplier %d\n",
- bufferSupplierType->eBufferSupplier);
- if(bufferSupplierType->nPortIndex == 0 || bufferSupplierType->nPortIndex ==1)
- m_sInBufSupplier.eBufferSupplier = bufferSupplierType->eBufferSupplier;
-
- else
-
- eRet = OMX_ErrorBadPortIndex;
-
- break;
-
- }
- case OMX_IndexParamVideoQuantization:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoQuantization\n");
- OMX_VIDEO_PARAM_QUANTIZATIONTYPE *session_qp = (OMX_VIDEO_PARAM_QUANTIZATIONTYPE*) paramData;
- if(session_qp->nPortIndex == PORT_INDEX_OUT)
- {
- if(handle->venc_set_param(paramData, OMX_IndexParamVideoQuantization) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- m_sSessionQuantization.nQpI = session_qp->nQpI;
- m_sSessionQuantization.nQpP = session_qp->nQpP;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Unsupported port Index for Session QP setting\n");
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
-
- case OMX_QcomIndexPortDefn:
- {
- OMX_QCOM_PARAM_PORTDEFINITIONTYPE* pParam =
- (OMX_QCOM_PARAM_PORTDEFINITIONTYPE*)paramData;
- DEBUG_PRINT_LOW("set_parameter: OMX_QcomIndexPortDefn");
- if(pParam->nPortIndex == (OMX_U32)PORT_INDEX_IN)
- {
- if(pParam->nMemRegion > OMX_QCOM_MemRegionInvalid &&
- pParam->nMemRegion < OMX_QCOM_MemRegionMax)
- {
- m_use_input_pmem = OMX_TRUE;
- }
- else
- {
- m_use_input_pmem = OMX_FALSE;
- }
- }
- else if (pParam->nPortIndex == (OMX_U32)PORT_INDEX_OUT)
- {
- if(pParam->nMemRegion > OMX_QCOM_MemRegionInvalid &&
- pParam->nMemRegion < OMX_QCOM_MemRegionMax)
- {
- m_use_output_pmem = OMX_TRUE;
- }
- else
- {
- m_use_output_pmem = OMX_FALSE;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: SetParameter called on unsupported Port Index for QcomPortDefn");
- return OMX_ErrorBadPortIndex;
- }
- break;
- }
-//#endif //# QCOM_EXT
- case OMX_IndexParamVideoSliceFMO:
- {
- DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoSliceFMO\n");
- OMX_VIDEO_PARAM_AVCSLICEFMO *avc_slice_fmo = (OMX_VIDEO_PARAM_AVCSLICEFMO*)paramData;
- if(!strncmp((char *)m_nkind, "OMX.qcom.video.encoder.avc",\
- OMX_MAX_STRINGNAME_SIZE) && avc_slice_fmo->nPortIndex == PORT_INDEX_OUT)
- {
- if(handle->venc_set_param(paramData, OMX_IndexParamVideoSliceFMO) != true)
- {
- return OMX_ErrorUnsupportedSetting;
- }
- m_sAVCSliceFMO.eSliceMode = avc_slice_fmo->eSliceMode;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Unsupported codec type/port Index for AVCSliceFMO setting\n");
- eRet = OMX_ErrorBadPortIndex;
- }
- break;
- }
- case OMX_IndexParamVideoErrorCorrection:
- {
- DEBUG_PRINT_ERROR("ERROR: OMX_IndexParamVideoErrorCorrection unsupported\n");
- eRet = OMX_ErrorUnsupportedIndex;
- break;
- }
- case OMX_IndexParamVideoIntraRefresh:
- {
- DEBUG_PRINT_ERROR("ERROR: OMX_IndexParamVideoIntraRefresh unsupported\n");
- eRet = OMX_ErrorUnsupportedIndex;
- break;
- }
- default:
- {
- DEBUG_PRINT_ERROR("ERROR: Setparameter: unknown param %d\n", paramIndex);
- eRet = OMX_ErrorUnsupportedIndex;
- break;
- }
- }
- return eRet;
-}
-
-/* ======================================================================
-FUNCTION
- omx_video::SetConfig
-
-DESCRIPTION
- OMX Set Config method implementation
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if successful.
-========================================================================== */
-OMX_ERRORTYPE omx_venc::set_config(OMX_IN OMX_HANDLETYPE hComp,
- OMX_IN OMX_INDEXTYPE configIndex,
- OMX_IN OMX_PTR configData)
-{
- if(configData == NULL)
- {
- DEBUG_PRINT_ERROR("ERROR: param is null");
- return OMX_ErrorBadParameter;
- }
-
- if(m_state == OMX_StateInvalid)
- {
- DEBUG_PRINT_ERROR("ERROR: config called in Invalid state");
- return OMX_ErrorIncorrectStateOperation;
- }
-
- // params will be validated prior to venc_init
- switch(configIndex)
- {
- case OMX_IndexConfigVideoBitrate:
- {
- OMX_VIDEO_CONFIG_BITRATETYPE* pParam =
- reinterpret_cast<OMX_VIDEO_CONFIG_BITRATETYPE*>(configData);
- DEBUG_PRINT_LOW("\n omx_venc:: set_config(): OMX_IndexConfigVideoBitrate");
-
- if(pParam->nPortIndex == PORT_INDEX_OUT)
- {
- if(handle->venc_set_config(configData, OMX_IndexConfigVideoBitrate) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: Setting OMX_IndexConfigVideoBitrate failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- m_sConfigBitrate.nEncodeBitrate = pParam->nEncodeBitrate;
- m_sParamBitrate.nTargetBitrate = pParam->nEncodeBitrate;
- m_sOutPortDef.format.video.nBitrate = pParam->nEncodeBitrate;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Unsupported port index: %u", pParam->nPortIndex);
- return OMX_ErrorBadPortIndex;
- }
- break;
- }
- case OMX_IndexConfigVideoFramerate:
- {
- OMX_CONFIG_FRAMERATETYPE* pParam =
- reinterpret_cast<OMX_CONFIG_FRAMERATETYPE*>(configData);
- DEBUG_PRINT_LOW("\n omx_venc:: set_config(): OMX_IndexConfigVideoFramerate");
-
- if(pParam->nPortIndex == PORT_INDEX_OUT)
- {
- if(handle->venc_set_config(configData, OMX_IndexConfigVideoFramerate) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: Setting OMX_IndexConfigVideoFramerate failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- m_sConfigFramerate.xEncodeFramerate = pParam->xEncodeFramerate;
- m_sOutPortDef.format.video.xFramerate = pParam->xEncodeFramerate;
- m_sOutPortFormat.xFramerate = pParam->xEncodeFramerate;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Unsupported port index: %u", pParam->nPortIndex);
- return OMX_ErrorBadPortIndex;
- }
-
- break;
- }
- case OMX_IndexConfigVideoIntraVOPRefresh:
- {
- OMX_CONFIG_INTRAREFRESHVOPTYPE* pParam =
- reinterpret_cast<OMX_CONFIG_INTRAREFRESHVOPTYPE*>(configData);
-
- if(pParam->nPortIndex == PORT_INDEX_OUT)
- {
- if(handle->venc_set_config(configData,
- OMX_IndexConfigVideoIntraVOPRefresh) != true)
- {
- DEBUG_PRINT_ERROR("ERROR: Setting OMX_IndexConfigVideoIntraVOPRefresh failed");
- return OMX_ErrorUnsupportedSetting;
- }
-
- m_sConfigIntraRefreshVOP.IntraRefreshVOP = pParam->IntraRefreshVOP;
- }
- else
- {
- DEBUG_PRINT_ERROR("ERROR: Unsupported port index: %u", pParam->nPortIndex);
- return OMX_ErrorBadPortIndex;
- }
-
- break;
- }
- case OMX_IndexConfigCommonRotate:
- {
- DEBUG_PRINT_ERROR("ERROR: OMX_IndexConfigCommonRotate is currently unsupported");
- break;
- }
- default:
- DEBUG_PRINT_ERROR("ERROR: unsupported index %d", (int) configIndex);
- break;
- }
-
- return OMX_ErrorNone;
-}
-
-/* ======================================================================
-FUNCTION
- omx_venc::ComponentDeInit
-
-DESCRIPTION
- Destroys the component and release memory allocated to the heap.
-
-PARAMETERS
- <TBD>.
-
-RETURN VALUE
- OMX Error None if everything successful.
-
-========================================================================== */
-OMX_ERRORTYPE omx_venc::component_deinit(OMX_IN OMX_HANDLETYPE hComp)
-{
- OMX_U32 i = 0;
- DEBUG_PRINT_HIGH("\n omx_venc(): Inside component_deinit()");
- if(OMX_StateLoaded != m_state)
- {
- DEBUG_PRINT_ERROR("WARNING:Rxd DeInit,OMX not in LOADED state %d\n",\
- m_state);
- }
- if(m_out_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing the Output Memory\n");
- for(i=0; i< m_sOutPortDef.nBufferCountActual; i++ )
- {
- free_output_buffer (&m_out_mem_ptr[i]);
- }
- free(m_out_mem_ptr);
- m_out_mem_ptr = NULL;
- }
-
- /*Check if the input buffers have to be cleaned up*/
- if(m_inp_mem_ptr)
- {
- DEBUG_PRINT_LOW("Freeing the Input Memory\n");
- for(i=0; i<m_sInPortDef.nBufferCountActual; i++ )
- {
- free_input_buffer (&m_inp_mem_ptr[i]);
- }
-
-
- free(m_inp_mem_ptr);
- m_inp_mem_ptr = NULL;
- }
-
- // Reset counters in mesg queues
- m_ftb_q.m_size=0;
- m_cmd_q.m_size=0;
- m_etb_q.m_size=0;
- m_ftb_q.m_read = m_ftb_q.m_write =0;
- m_cmd_q.m_read = m_cmd_q.m_write =0;
- m_etb_q.m_read = m_etb_q.m_write =0;
-
-#ifdef _ANDROID_
- // Clear the strong reference
- DEBUG_PRINT_HIGH("Calling m_heap_ptr.clear()\n");
- m_heap_ptr.clear();
-#endif // _ANDROID_
- DEBUG_PRINT_HIGH("Calling venc_close()\n");
- handle->venc_close();
- DEBUG_PRINT_HIGH("Deleting HANDLE[%p]\n", handle);
- delete (handle);
- DEBUG_PRINT_HIGH("OMX_Venc:Component Deinit\n");
- return OMX_ErrorNone;
-}
-
-
-OMX_U32 omx_venc::dev_stop( void)
-{
- return handle->venc_stop();
-}
-
-
-OMX_U32 omx_venc::dev_pause(void)
-{
- return handle->venc_pause();
-}
-
-OMX_U32 omx_venc::dev_start(void)
-{
- return handle->venc_start();
-}
-
-OMX_U32 omx_venc::dev_flush(unsigned port)
-{
- return handle->venc_flush(port);
-}
-OMX_U32 omx_venc::dev_resume(void)
-{
- return handle->venc_resume();
-}
-
-bool omx_venc::dev_use_buf(void *buf_addr,unsigned port)
-{
- return handle->venc_use_buf(buf_addr,port);
-}
-
-bool omx_venc::dev_free_buf(void *buf_addr,unsigned port)
-{
- return handle->venc_free_buf(buf_addr,port);
-}
-
-bool omx_venc::dev_empty_buf(void *buffer, void *pmem_data_buf)
-{
- return handle->venc_empty_buf(buffer, pmem_data_buf);
-}
-
-bool omx_venc::dev_fill_buf(void *buffer, void *pmem_data_buf)
-{
- return handle->venc_fill_buf(buffer, pmem_data_buf);
-}
-
-
-bool omx_venc::dev_get_buf_req(OMX_U32 *min_buff_count,
- OMX_U32 *actual_buff_count,
- OMX_U32 *buff_size,
- OMX_U32 port)
-{
- return handle->venc_get_buf_req(min_buff_count,
- actual_buff_count,
- buff_size,
- port);
-
-}
-
-bool omx_venc::dev_set_buf_req(OMX_U32 *min_buff_count,
- OMX_U32 *actual_buff_count,
- OMX_U32 *buff_size,
- OMX_U32 port)
-{
- return handle->venc_set_buf_req(min_buff_count,
- actual_buff_count,
- buff_size,
- port);
-
-}
-
-int omx_venc::async_message_process (void *context, void* message)
-{
- omx_video* omx = NULL;
- struct venc_msg *m_sVenc_msg = NULL;
- OMX_BUFFERHEADERTYPE* omxhdr = NULL;
- struct venc_buffer *temp_buff = NULL;
-
- if(context == NULL || message == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: omx_venc::async_message_process invalid i/p params");
- return -1;
- }
- m_sVenc_msg = (struct venc_msg *)message;
-
- omx = reinterpret_cast<omx_video*>(context);
-
- if(m_sVenc_msg->statuscode != VEN_S_SUCCESS)
- {
- DEBUG_PRINT_ERROR("\nERROR: async_msg_process() - Error statuscode = %d\n",
- m_sVenc_msg->statuscode);
- omx->omx_report_error();
- }
-
- DEBUG_PRINT_LOW("\n omx_venc::async_message_process- msgcode = %d\n",
- m_sVenc_msg->msgcode);
- switch(m_sVenc_msg->msgcode)
- {
-
- case VEN_MSG_START:
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_START_DONE);
- break;
-
- case VEN_MSG_STOP:
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_STOP_DONE);
- break;
-
- case VEN_MSG_RESUME:
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_RESUME_DONE);
- break;
-
- case VEN_MSG_PAUSE:
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_PAUSE_DONE);
-
- break;
-
- case VEN_MSG_FLUSH_INPUT_DONE:
-
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH);
- break;
- case VEN_MSG_FLUSH_OUPUT_DONE:
- omx->post_event (NULL,m_sVenc_msg->statuscode,\
- OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH);
- break;
- case VEN_MSG_INPUT_BUFFER_DONE:
- omxhdr = (OMX_BUFFERHEADERTYPE* )\
- m_sVenc_msg->buf.clientdata;
-
- if(omxhdr == NULL ||
- ((OMX_U32)(omxhdr - omx->m_inp_mem_ptr) > omx->m_sInPortDef.nBufferCountActual) )
- {
- omxhdr = NULL;
- m_sVenc_msg->statuscode = VEN_S_EFAIL;
- }
-
- omx->post_event ((unsigned int)omxhdr,m_sVenc_msg->statuscode,
- OMX_COMPONENT_GENERATE_EBD);
- break;
- case VEN_MSG_OUTPUT_BUFFER_DONE:
-
- omxhdr = (OMX_BUFFERHEADERTYPE*)m_sVenc_msg->buf.clientdata;
-
- if( (omxhdr != NULL) &&
- ((OMX_U32)(omxhdr - omx->m_out_mem_ptr) < omx->m_sOutPortDef.nBufferCountActual))
- {
- if(m_sVenc_msg->buf.len <= omxhdr->nAllocLen)
- {
- omxhdr->nFilledLen = m_sVenc_msg->buf.len;
- omxhdr->nOffset = m_sVenc_msg->buf.offset;
- omxhdr->nTimeStamp = m_sVenc_msg->buf.timestamp;
- DEBUG_PRINT_LOW("\n o/p TS = %u", (OMX_U32)m_sVenc_msg->buf.timestamp);
- omxhdr->nFlags = m_sVenc_msg->buf.flags;
-
- /*Use buffer case*/
- if(omx->output_use_buffer && !omx->m_use_output_pmem)
- {
- DEBUG_PRINT_LOW("\n memcpy() for o/p Heap UseBuffer");
- memcpy(omxhdr->pBuffer,
- (m_sVenc_msg->buf.ptrbuffer),
- m_sVenc_msg->buf.len);
- }
- }
- else
- {
- omxhdr->nFilledLen = 0;
- }
-
- }
- else
- {
- omxhdr = NULL;
- m_sVenc_msg->statuscode = VEN_S_EFAIL;
- }
-
- omx->post_event ((unsigned int)omxhdr,m_sVenc_msg->statuscode,
- OMX_COMPONENT_GENERATE_FBD);
- break;
- case VEN_MSG_NEED_OUTPUT_BUFFER:
- //TBD what action needs to be done here??
- break;
- default:
- break;
- }
- return 0;
-}
diff --git a/mm-video/vidc/venc/src/video_encoder_device.cpp b/mm-video/vidc/venc/src/video_encoder_device.cpp
deleted file mode 100644
index 33d57174..00000000
--- a/mm-video/vidc/venc/src/video_encoder_device.cpp
+++ /dev/null
@@ -1,1883 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include<string.h>
-#include <sys/ioctl.h>
-#include<unistd.h>
-#include <fcntl.h>
-#include "video_encoder_device.h"
-#include "omx_video_encoder.h"
-
-#define MPEG4_SP_START 0
-#define MPEG4_ASP_START (MPEG4_SP_START + 8)
-#define MPEG4_720P_LEVEL 6
-#define H263_BP_START 0
-#define H264_BP_START 0
-#define H264_HP_START (H264_BP_START + 11)
-#define H264_MP_START (H264_BP_START + 21)
-
-/* MPEG4 profile and level table*/
-static const unsigned int mpeg4_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_MPEG4Level0,OMX_VIDEO_MPEG4ProfileSimple},
- {99,1485,128000,OMX_VIDEO_MPEG4Level1,OMX_VIDEO_MPEG4ProfileSimple},
- {396,5940,128000,OMX_VIDEO_MPEG4Level2,OMX_VIDEO_MPEG4ProfileSimple},
- {396,11880,384000,OMX_VIDEO_MPEG4Level3,OMX_VIDEO_MPEG4ProfileSimple},
- {1200,36000,4000000,OMX_VIDEO_MPEG4Level4a,OMX_VIDEO_MPEG4ProfileSimple},
- {1620,40500,8000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileSimple},
- {3600,108000,14000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileSimple},
- {0,0,0,0,0},
-
- {99,2970,128000,OMX_VIDEO_MPEG4Level0,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {99,2970,128000,OMX_VIDEO_MPEG4Level1,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {396,5940,384000,OMX_VIDEO_MPEG4Level2,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {396,11880,768000,OMX_VIDEO_MPEG4Level3,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {792,23760,3000000,OMX_VIDEO_MPEG4Level4,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {1620,48600,8000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {3600,108000,14000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {0,0,0,0,0}
-};
-
-/* H264 profile and level table*/
-static const unsigned int h264_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_AVCLevel1,OMX_VIDEO_AVCProfileBaseline},
- {99,1485,128000,OMX_VIDEO_AVCLevel1b,OMX_VIDEO_AVCProfileBaseline},
- {396,3000,192000,OMX_VIDEO_AVCLevel11,OMX_VIDEO_AVCProfileBaseline},
- {396,6000,384000,OMX_VIDEO_AVCLevel12,OMX_VIDEO_AVCProfileBaseline},
- {396,11880,768000,OMX_VIDEO_AVCLevel13,OMX_VIDEO_AVCProfileBaseline},
- {396,11880,2000000,OMX_VIDEO_AVCLevel2,OMX_VIDEO_AVCProfileBaseline},
- {792,19800,4000000,OMX_VIDEO_AVCLevel21,OMX_VIDEO_AVCProfileBaseline},
- {1620,20250,4000000,OMX_VIDEO_AVCLevel22,OMX_VIDEO_AVCProfileBaseline},
- {1620,40500,10000000,OMX_VIDEO_AVCLevel3,OMX_VIDEO_AVCProfileBaseline},
- {3600,108000,14000000,OMX_VIDEO_AVCLevel31,OMX_VIDEO_AVCProfileBaseline},
- {0,0,0,0,0},
-
- {99,1485,64000,OMX_VIDEO_AVCLevel1,OMX_VIDEO_AVCProfileHigh},
- {99,1485,160000,OMX_VIDEO_AVCLevel1b,OMX_VIDEO_AVCProfileHigh},
- {396,3000,240000,OMX_VIDEO_AVCLevel11,OMX_VIDEO_AVCProfileHigh},
- {396,6000,480000,OMX_VIDEO_AVCLevel12,OMX_VIDEO_AVCProfileHigh},
- {396,11880,960000,OMX_VIDEO_AVCLevel13,OMX_VIDEO_AVCProfileHigh},
- {396,11880,2500000,OMX_VIDEO_AVCLevel2,OMX_VIDEO_AVCProfileHigh},
- {792,19800,5000000,OMX_VIDEO_AVCLevel21,OMX_VIDEO_AVCProfileHigh},
- {1620,20250,5000000,OMX_VIDEO_AVCLevel22,OMX_VIDEO_AVCProfileHigh},
- {1620,40500,12500000,OMX_VIDEO_AVCLevel3,OMX_VIDEO_AVCProfileHigh},
- {3600,108000,17500000,OMX_VIDEO_AVCLevel31,OMX_VIDEO_AVCProfileHigh},
- {0,0,0,0,0},
-
- {99,1485,64000,OMX_VIDEO_AVCLevel1,OMX_VIDEO_AVCProfileMain},
- {99,1485,160000,OMX_VIDEO_AVCLevel1b,OMX_VIDEO_AVCProfileMain},
- {396,3000,240000,OMX_VIDEO_AVCLevel11,OMX_VIDEO_AVCProfileMain},
- {396,6000,480000,OMX_VIDEO_AVCLevel12,OMX_VIDEO_AVCProfileMain},
- {396,11880,960000,OMX_VIDEO_AVCLevel13,OMX_VIDEO_AVCProfileMain},
- {396,11880,2500000,OMX_VIDEO_AVCLevel2,OMX_VIDEO_AVCProfileMain},
- {792,19800,5000000,OMX_VIDEO_AVCLevel21,OMX_VIDEO_AVCProfileMain},
- {1620,20250,5000000,OMX_VIDEO_AVCLevel22,OMX_VIDEO_AVCProfileMain},
- {1620,40500,12500000,OMX_VIDEO_AVCLevel3,OMX_VIDEO_AVCProfileMain},
- {3600,108000,17500000,OMX_VIDEO_AVCLevel31,OMX_VIDEO_AVCProfileMain},
- {0,0,0,0,0}
-};
-
-/* H263 profile and level table*/
-static const unsigned int h263_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_H263Level10,OMX_VIDEO_H263ProfileBaseline},
- {396,5940,128000,OMX_VIDEO_H263Level20,OMX_VIDEO_H263ProfileBaseline},
- {396,11880,384000,OMX_VIDEO_H263Level30,OMX_VIDEO_H263ProfileBaseline},
- {396,11880,2048000,OMX_VIDEO_H263Level40,OMX_VIDEO_H263ProfileBaseline},
- {99,1485,128000,OMX_VIDEO_H263Level45,OMX_VIDEO_H263ProfileBaseline},
- {396,19800,4096000,OMX_VIDEO_H263Level50,OMX_VIDEO_H263ProfileBaseline},
- {810,40500,8192000,OMX_VIDEO_H263Level60,OMX_VIDEO_H263ProfileBaseline},
- {1620,81000,16384000,OMX_VIDEO_H263Level70,OMX_VIDEO_H263ProfileBaseline},
- {0,0,0,0,0}
-};
-
-//constructor
-venc_dev::venc_dev()
-{
-//nothing to do
-
-}
-
-venc_dev::~venc_dev()
-{
- //nothing to do
-}
-
-void* async_venc_message_thread (void *input)
-{
- struct venc_ioctl_msg ioctl_msg ={NULL,NULL};
- struct venc_timeout timeout;
- struct venc_msg venc_msg;
- omx_venc *omx = reinterpret_cast<omx_venc*>(input);
-
- timeout.millisec = VEN_TIMEOUT_INFINITE;
- while(1)
- {
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&venc_msg;
-
- /*Wait for a message from the video decoder driver*/
- if(ioctl(omx->handle->m_nDriver_fd,VEN_IOCTL_CMD_READ_NEXT_MSG,(void *)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nioctl VEN_IOCTL_CMD_READ_NEXT_MSG failed/stopped");
- break;
- }
- else
- {
- /*Call Instance specific process function*/
- if(omx->async_message_process(input,&venc_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Wrong ioctl message");
- break;
- }
- }
- }
- DEBUG_PRINT_HIGH("omx_venc: Async Thread exit\n");
- return NULL;
-}
-
-bool venc_dev::venc_open(OMX_U32 codec)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- int r;
- unsigned int alignment = 0,buffer_size = 0, temp =0;
-
- m_nDriver_fd = open ("/dev/msm_vidc_enc",O_RDWR|O_NONBLOCK);
- if(m_nDriver_fd == 0)
- {
- DEBUG_PRINT_ERROR("ERROR: Got fd as 0 for msm_vidc_enc, Opening again\n");
- m_nDriver_fd = open ("/dev/msm_vidc_enc",O_RDWR|O_NONBLOCK);
- }
-
- if((int)m_nDriver_fd < 0)
- {
- DEBUG_PRINT_ERROR("ERROR: Omx_venc::Comp Init Returning failure\n");
- return false;
- }
-
- DEBUG_PRINT_LOW("\nm_nDriver_fd = %d\n", m_nDriver_fd);
- // set the basic configuration of the video encoder driver
- m_sVenc_cfg.input_width = OMX_CORE_QCIF_WIDTH;
- m_sVenc_cfg.input_height= OMX_CORE_QCIF_HEIGHT;
- m_sVenc_cfg.dvs_width = OMX_CORE_QCIF_WIDTH;
- m_sVenc_cfg.dvs_height = OMX_CORE_QCIF_HEIGHT;
- m_sVenc_cfg.fps_num = 30;
- m_sVenc_cfg.fps_den = 1;
- m_sVenc_cfg.targetbitrate = 64000;
- m_sVenc_cfg.inputformat= VEN_INPUTFMT_NV12;
- if(codec == OMX_VIDEO_CodingMPEG4)
- {
- m_sVenc_cfg.codectype = VEN_CODEC_MPEG4;
- codec_profile.profile = VEN_PROFILE_MPEG4_SP;
- profile_level.level = VEN_LEVEL_MPEG4_2;
- }
- else if(codec == OMX_VIDEO_CodingH263)
- {
- m_sVenc_cfg.codectype = VEN_CODEC_H263;
- codec_profile.profile = VEN_PROFILE_H263_BASELINE;
- profile_level.level = VEN_LEVEL_H263_20;
- }
- if(codec == OMX_VIDEO_CodingAVC)
- {
- m_sVenc_cfg.codectype = VEN_CODEC_H264;
- codec_profile.profile = VEN_PROFILE_H264_BASELINE;
- profile_level.level = VEN_LEVEL_H264_1p1;
- }
- ioctl_msg.inputparam = (void*)&m_sVenc_cfg;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_BASE_CFG,(void*)&ioctl_msg) < 0 )
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting base configuration failed");
- return false;
- }
-
- // Get the I/P and O/P buffer requirements
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sInput_buff_property;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_GET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting i/p buffer requirement failed");
- return false;
- }
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sOutput_buff_property;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_GET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting o/p buffer requirement failed");
- return false;
- }
-
- m_profile_set = false;
- m_level_set = false;
- if(venc_set_profile_level(0, 0))
- {
- DEBUG_PRINT_HIGH("\n %s(): Init Profile/Level setting success",
- __func__);
- }
-
- return true;
-}
-
-void venc_dev::venc_close()
-{
- DEBUG_PRINT_LOW("\nvenc_close: fd = %d", m_nDriver_fd);
- if((int)m_nDriver_fd >= 0)
- {
- DEBUG_PRINT_HIGH("\n venc_close(): Calling VEN_IOCTL_CMD_STOP_READ_MSG");
- (void)ioctl(m_nDriver_fd, VEN_IOCTL_CMD_STOP_READ_MSG,
- NULL);
- DEBUG_PRINT_LOW("\nCalling close()\n");
- close(m_nDriver_fd);
- m_nDriver_fd = -1;
- }
-}
-
-bool venc_dev::venc_set_buf_req(unsigned long *min_buff_count,
- unsigned long *actual_buff_count,
- unsigned long *buff_size,
- unsigned long port)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned long temp_count = 0;
-
- if(port == 0)
- {
- if(*actual_buff_count > m_sInput_buff_property.mincount)
- {
- temp_count = m_sInput_buff_property.actualcount;
- m_sInput_buff_property.actualcount = *actual_buff_count;
- ioctl_msg.inputparam = (void*)&m_sInput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting i/p buffer requirement failed");
- m_sInput_buff_property.actualcount = temp_count;
- return false;
- }
- DEBUG_PRINT_LOW("\n I/P Count set to %lu\n", *actual_buff_count);
- }
- }
- else
- {
- if(*actual_buff_count > m_sOutput_buff_property.mincount)
- {
- temp_count = m_sOutput_buff_property.actualcount;
- m_sOutput_buff_property.actualcount = *actual_buff_count;
- ioctl_msg.inputparam = (void*)&m_sOutput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting o/p buffer requirement failed");
- m_sOutput_buff_property.actualcount = temp_count;
- return false;
- }
- DEBUG_PRINT_LOW("\n O/P Count set to %lu\n", *actual_buff_count);
- }
- }
-
- return true;
-
-}
-
-bool venc_dev::venc_get_buf_req(unsigned long *min_buff_count,
- unsigned long *actual_buff_count,
- unsigned long *buff_size,
- unsigned long port)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
-
- if(port == 0)
- {
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sInput_buff_property;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_GET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting i/p buffer requirement failed");
- return false;
- }
- *min_buff_count = m_sInput_buff_property.mincount;
- *actual_buff_count = m_sInput_buff_property.actualcount;
- *buff_size = m_sInput_buff_property.datasize
- + (m_sInput_buff_property.datasize % m_sInput_buff_property.alignment) ;
- }
- else
- {
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sOutput_buff_property;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_GET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting o/p buffer requirement failed");
- return false;
- }
- *min_buff_count = m_sOutput_buff_property.mincount;
- *actual_buff_count = m_sOutput_buff_property.actualcount;
- *buff_size = m_sOutput_buff_property.datasize
- + (m_sOutput_buff_property.datasize % m_sOutput_buff_property.alignment) ;
- }
-
- return true;
-
-}
-
-bool venc_dev::venc_set_param(void *paramData,OMX_INDEXTYPE index )
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- OMX_U32 temp_out_buf_count = 0;
- DEBUG_PRINT_LOW("venc_set_param:: venc-720p\n");
- switch(index)
- {
- case OMX_IndexParamPortDefinition:
- {
- OMX_PARAM_PORTDEFINITIONTYPE *portDefn;
- portDefn = (OMX_PARAM_PORTDEFINITIONTYPE *) paramData;
- DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamPortDefinition\n");
- if(portDefn->nPortIndex == PORT_INDEX_IN)
- {
- if(!venc_set_color_format(portDefn->format.video.eColorFormat))
- {
- return false;
- }
- if(m_sVenc_cfg.input_height != portDefn->format.video.nFrameHeight ||
- m_sVenc_cfg.input_width != portDefn->format.video.nFrameWidth)
- {
- DEBUG_PRINT_LOW("\n Basic parameter has changed");
- m_sVenc_cfg.input_height = portDefn->format.video.nFrameHeight;
- m_sVenc_cfg.input_width = portDefn->format.video.nFrameWidth;
-
- temp_out_buf_count = m_sOutput_buff_property.actualcount;
- ioctl_msg.inputparam = (void*)&m_sVenc_cfg;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_BASE_CFG,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting base config failed");
- return false;
- }
-
- DEBUG_PRINT_LOW("\n Updating the buffer count/size for the new resolution");
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sInput_buff_property;
- if(ioctl (m_nDriver_fd, VEN_IOCTL_GET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting i/p bufreq failed");
- return false;
- }
- DEBUG_PRINT_LOW("\n Got updated m_sInput_buff_property values: "
- "datasize = %u, maxcount = %u, actualcnt = %u, "
- "mincount = %u", m_sInput_buff_property.datasize,
- m_sInput_buff_property.maxcount, m_sInput_buff_property.actualcount,
- m_sInput_buff_property.mincount);
-
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&m_sOutput_buff_property;
- if(ioctl (m_nDriver_fd, VEN_IOCTL_GET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for getting o/p bufreq failed");
- return false;
- }
-
- DEBUG_PRINT_LOW("\n Got updated m_sOutput_buff_property values: "
- "datasize = %u, maxcount = %u, actualcnt = %u, "
- "mincount = %u", m_sOutput_buff_property.datasize,
- m_sOutput_buff_property.maxcount, m_sOutput_buff_property.actualcount,
- m_sOutput_buff_property.mincount);
-
- if(temp_out_buf_count < 7)
- temp_out_buf_count = 7;
- m_sOutput_buff_property.actualcount = temp_out_buf_count;
- ioctl_msg.inputparam = (void*)&m_sOutput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd, VEN_IOCTL_SET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting o/p bufreq failed");
- return false;
- }
-
- if((portDefn->nBufferCountActual >= m_sInput_buff_property.mincount) &&
- (portDefn->nBufferCountActual <= m_sInput_buff_property.maxcount))
- {
- m_sInput_buff_property.actualcount = portDefn->nBufferCountActual;
- ioctl_msg.inputparam = (void*)&m_sInput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl(m_nDriver_fd,VEN_IOCTL_SET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting i/p buffer requirements failed");
- return false;
- }
- }
- if(m_sInput_buff_property.datasize != portDefn->nBufferSize)
- {
- DEBUG_PRINT_ERROR("\nWARNING: Requested i/p bufsize[%u],"
- "Driver's updated i/p bufsize = %u", portDefn->nBufferSize,
- m_sInput_buff_property.datasize);
- }
- m_level_set = false;
- if(venc_set_profile_level(0, 0))
- {
- DEBUG_PRINT_HIGH("\n %s(): Dynamic Profile/Level setting success",
- __func__);
- }
- }
- else
- {
- if((portDefn->nBufferCountActual >= m_sInput_buff_property.mincount) &&
- (m_sInput_buff_property.actualcount <= portDefn->nBufferCountActual) &&
- (m_sInput_buff_property.datasize == portDefn->nBufferSize))
- {
- m_sInput_buff_property.actualcount = portDefn->nBufferCountActual;
- ioctl_msg.inputparam = (void*)&m_sInput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_INPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: ioctl VEN_IOCTL_SET_INPUT_BUFFER_REQ failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Input buffer requirements failed");
- return false;
- }
- }
- }
- else if(portDefn->nPortIndex == PORT_INDEX_OUT)
- {
- if(!venc_set_encode_framerate(portDefn->format.video.xFramerate))
- {
- return false;
- }
-
- if(!venc_set_target_bitrate(portDefn->format.video.nBitrate))
- {
- return false;
- }
-
- if( (portDefn->nBufferCountActual >= m_sOutput_buff_property.mincount)
- &&
- (m_sOutput_buff_property.actualcount <= portDefn->nBufferCountActual)
- &&
- (m_sOutput_buff_property.datasize == portDefn->nBufferSize)
- )
- {
- m_sOutput_buff_property.actualcount = portDefn->nBufferCountActual;
- ioctl_msg.inputparam = (void*)&m_sOutput_buff_property;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_OUTPUT_BUFFER_REQ,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: ioctl VEN_IOCTL_SET_OUTPUT_BUFFER_REQ failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Output buffer requirements failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamPortDefinition");
- }
- break;
- }
- case OMX_IndexParamVideoPortFormat:
- {
- OMX_VIDEO_PARAM_PORTFORMATTYPE *portFmt;
- portFmt =(OMX_VIDEO_PARAM_PORTFORMATTYPE *)paramData;
- DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamVideoPortFormat\n");
-
- if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_IN)
- {
- if(!venc_set_color_format(portFmt->eColorFormat))
- {
- return false;
- }
- }
- else if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(!venc_set_encode_framerate(portFmt->xFramerate))
- {
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoPortFormat");
- }
- break;
- }
- case OMX_IndexParamVideoBitrate:
- {
- OMX_VIDEO_PARAM_BITRATETYPE* pParam;
- pParam = (OMX_VIDEO_PARAM_BITRATETYPE*)paramData;
- DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamVideoBitrate\n");
-
- if(pParam->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(!venc_set_target_bitrate(pParam->nTargetBitrate))
- {
- DEBUG_PRINT_ERROR("\nERROR: Target Bit Rate setting failed");
- return false;
- }
- if(!venc_set_ratectrl_cfg(pParam->eControlRate))
- {
- DEBUG_PRINT_ERROR("\nERROR: Rate Control setting failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoBitrate");
- }
- break;
- }
- case OMX_IndexParamVideoMpeg4:
- {
- OMX_VIDEO_PARAM_MPEG4TYPE* pParam;
- pParam = (OMX_VIDEO_PARAM_MPEG4TYPE*)paramData;
- DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamVideoMpeg4\n");
- if(pParam->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(!venc_set_intra_period (pParam->nPFrames))
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting intra period failed");
- return false;
- }
-
- m_profile_set = false;
- m_level_set = false;
- if(!venc_set_profile_level (pParam->eProfile, pParam->eLevel))
- {
- DEBUG_PRINT_ERROR("\nWARNING: Unsuccessful in updating Profile and level");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoMpeg4");
- }
- break;
- }
- case OMX_IndexParamVideoH263:
- {
- OMX_VIDEO_PARAM_H263TYPE* pParam = (OMX_VIDEO_PARAM_H263TYPE*)paramData;
- DEBUG_PRINT_LOW("venc_set_param: OMX_IndexParamVideoH263\n");
- if(pParam->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(venc_set_intra_period (pParam->nPFrames) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting intra period failed");
- return false;
- }
-
- m_profile_set = false;
- m_level_set = false;
- if(!venc_set_profile_level (pParam->eProfile, pParam->eLevel))
- {
- DEBUG_PRINT_ERROR("\nWARNING: Unsuccessful in updating Profile and level");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoH263");
- }
- break;
- }
- case OMX_IndexParamVideoAvc:
- {
- DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoAvc\n");
- OMX_VIDEO_PARAM_AVCTYPE* pParam = (OMX_VIDEO_PARAM_AVCTYPE*)paramData;
- if(pParam->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(venc_set_intra_period (pParam->nPFrames) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting intra period failed");
- return false;
- }
- DEBUG_PRINT_LOW("pParam->eProfile :%d ,pParam->eLevel %d\n",
- pParam->eProfile,pParam->eLevel);
-
- m_profile_set = false;
- m_level_set = false;
- if(!venc_set_profile_level (pParam->eProfile,pParam->eLevel))
- {
- DEBUG_PRINT_ERROR("\nWARNING: Unsuccessful in updating Profile and level");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoAvc");
- }
- //TBD, lot of other variables to be updated, yet to decide
- break;
- }
- case OMX_IndexParamVideoProfileLevelCurrent:
- {
- DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoProfileLevelCurrent\n");
- OMX_VIDEO_PARAM_PROFILELEVELTYPE *profile_level =
- (OMX_VIDEO_PARAM_PROFILELEVELTYPE *)paramData;
- if(profile_level->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- m_profile_set = false;
- m_level_set = false;
- if(!venc_set_profile_level (profile_level->eProfile,
- profile_level->eLevel))
- {
- DEBUG_PRINT_ERROR("\nWARNING: Unsuccessful in updating Profile and level");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoProfileLevelCurrent");
- }
- break;
- }
- case OMX_IndexParamVideoQuantization:
- {
- DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoQuantization\n");
- OMX_VIDEO_PARAM_QUANTIZATIONTYPE *session_qp =
- (OMX_VIDEO_PARAM_QUANTIZATIONTYPE *)paramData;
- if(session_qp->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(venc_set_session_qp (session_qp->nQpI,
- session_qp->nQpP) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Session QP failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexParamVideoQuantization");
- }
- break;
- }
- case OMX_IndexParamVideoSliceFMO:
- {
- DEBUG_PRINT_LOW("venc_set_param:OMX_IndexParamVideoSliceFMO\n");
- OMX_VIDEO_PARAM_AVCSLICEFMO *avc_slice_fmo =
- (OMX_VIDEO_PARAM_AVCSLICEFMO*)paramData;
- DEBUG_PRINT_LOW("\n portindex = %u", avc_slice_fmo->nPortIndex);
- if(avc_slice_fmo->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
- {
- if(venc_set_multislice_cfg(avc_slice_fmo->eSliceMode) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Multislice cfg failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for Multislice cfg");
- }
- break;
- }
- default:
- DEBUG_PRINT_ERROR("\nERROR: Unsupported parameter in venc_set_param: %u",
- index);
- break;
- //case
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_config(void *configData, OMX_INDEXTYPE index)
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- DEBUG_PRINT_LOW("\n Inside venc_set_config");
-
- switch(index)
- {
- case OMX_IndexConfigVideoBitrate:
- {
- OMX_VIDEO_CONFIG_BITRATETYPE *bit_rate = (OMX_VIDEO_CONFIG_BITRATETYPE *)
- configData;
- DEBUG_PRINT_LOW("\n venc_set_config: OMX_IndexConfigVideoBitrate");
- if(bit_rate->nPortIndex == (OMX_U32)PORT_INDEX_OUT)
- {
- if(venc_set_target_bitrate(bit_rate->nEncodeBitrate) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Target Bit rate failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexConfigVideoBitrate");
- }
- break;
- }
- case OMX_IndexConfigVideoFramerate:
- {
- OMX_CONFIG_FRAMERATETYPE *frame_rate = (OMX_CONFIG_FRAMERATETYPE *)
- configData;
- DEBUG_PRINT_LOW("\n venc_set_config: OMX_IndexConfigVideoFramerate");
- if(frame_rate->nPortIndex == (OMX_U32)PORT_INDEX_OUT)
- {
- if(venc_set_encode_framerate(frame_rate->xEncodeFramerate) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Encode Framerate failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexConfigVideoFramerate");
- }
- break;
- }
- case OMX_IndexConfigVideoIntraVOPRefresh:
- {
- OMX_CONFIG_INTRAREFRESHVOPTYPE *intra_vop_refresh = (OMX_CONFIG_INTRAREFRESHVOPTYPE *)
- configData;
- DEBUG_PRINT_LOW("\n venc_set_config: OMX_IndexConfigVideoIntraVOPRefresh");
- if(intra_vop_refresh->nPortIndex == (OMX_U32)PORT_INDEX_OUT)
- {
- if(venc_set_intra_vop_refresh(intra_vop_refresh->IntraRefreshVOP) == false)
- {
- DEBUG_PRINT_ERROR("\nERROR: Setting Encode Framerate failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: Invalid Port Index for OMX_IndexConfigVideoFramerate");
- }
- break;
- }
- default:
- DEBUG_PRINT_ERROR("\n Unsupported config index = %u", index);
- break;
- }
-
- return true;
-}
-
-unsigned venc_dev::venc_stop( void)
-{
- return ioctl(m_nDriver_fd,VEN_IOCTL_CMD_STOP,NULL);
-}
-
-unsigned venc_dev::venc_pause(void)
-{
- return ioctl(m_nDriver_fd,VEN_IOCTL_CMD_PAUSE,NULL);
-}
-
-unsigned venc_dev::venc_resume(void)
-{
- return ioctl(m_nDriver_fd,VEN_IOCTL_CMD_RESUME,NULL) ;
-}
-
-unsigned venc_dev::venc_start(void)
-{
- DEBUG_PRINT_HIGH("\n %s(): Check Profile/Level set in driver before start",
- __func__);
- if (!venc_set_profile_level(0, 0))
- {
- DEBUG_PRINT_ERROR("\n ERROR: %s(): Driver Profile/Level is NOT SET",
- __func__);
- }
- else
- {
- DEBUG_PRINT_HIGH("\n %s(): Driver Profile[%lu]/Level[%lu] successfully SET",
- __func__, codec_profile.profile, profile_level.level);
- }
-
- return ioctl(m_nDriver_fd, VEN_IOCTL_CMD_START, NULL);
-}
-
-unsigned venc_dev::venc_flush( unsigned port)
-{
- struct venc_ioctl_msg ioctl_msg;
- struct venc_bufferflush buffer_index;
-
- if(port == PORT_INDEX_IN)
- {
- buffer_index.flush_mode = VEN_FLUSH_INPUT;
- ioctl_msg.inputparam = (void*)&buffer_index;
- ioctl_msg.outputparam = NULL;
-
- return ioctl (m_nDriver_fd,VEN_IOCTL_CMD_FLUSH,(void*)&ioctl_msg);
- }
- else if(port == PORT_INDEX_OUT)
- {
- buffer_index.flush_mode = VEN_FLUSH_OUTPUT;
- ioctl_msg.inputparam = (void*)&buffer_index;
- ioctl_msg.outputparam = NULL;
- return ioctl (m_nDriver_fd,VEN_IOCTL_CMD_FLUSH,(void*)&ioctl_msg);
- }
- else
- {
- return -1;
- }
-}
-
-//allocating I/P memory from pmem and register with the device
-
-
-bool venc_dev::venc_use_buf(void *buf_addr, unsigned port)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct pmem *pmem_tmp;
- struct venc_bufferpayload dev_buffer = {0};
-
- pmem_tmp = (struct pmem *)buf_addr;
-
- DEBUG_PRINT_LOW("\n venc_use_buf:: pmem_tmp = %p", pmem_tmp);
-
- if(port == PORT_INDEX_IN)
- {
- dev_buffer.pbuffer = (OMX_U8 *)pmem_tmp->buffer;
- dev_buffer.fd = pmem_tmp->fd;
- dev_buffer.maped_size = pmem_tmp->size;
- dev_buffer.nsize = pmem_tmp->size;
- dev_buffer.offset = pmem_tmp->offset;
- ioctl_msg.inputparam = (void*)&dev_buffer;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n venc_use_buf:pbuffer = %x,fd = %x, offset = %d, maped_size = %d", \
- dev_buffer.pbuffer, \
- dev_buffer.fd, \
- dev_buffer.offset, \
- dev_buffer.maped_size);
-
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_INPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_use_buf:set input buffer failed ");
- return false;
- }
- }
- else if(port == PORT_INDEX_OUT)
- {
- dev_buffer.pbuffer = (OMX_U8 *)pmem_tmp->buffer;
- dev_buffer.fd = pmem_tmp->fd;
- dev_buffer.nsize = pmem_tmp->size;
- dev_buffer.maped_size = pmem_tmp->size;
- dev_buffer.offset = pmem_tmp->offset;
- ioctl_msg.inputparam = (void*)&dev_buffer;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n venc_use_buf:pbuffer = %x,fd = %x, offset = %d, maped_size = %d", \
- dev_buffer.pbuffer, \
- dev_buffer.fd, \
- dev_buffer.offset, \
- dev_buffer.maped_size);
-
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_use_buf:set output buffer failed ");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_use_buf:Invalid Port Index ");
- return false;
- }
-
- return true;
-}
-
-bool venc_dev::venc_free_buf(void *buf_addr, unsigned port)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct pmem *pmem_tmp;
- struct venc_bufferpayload dev_buffer = {0};
-
- pmem_tmp = (struct pmem *)buf_addr;
-
- DEBUG_PRINT_LOW("\n venc_use_buf:: pmem_tmp = %p", pmem_tmp);
-
- if(port == PORT_INDEX_IN)
- {
- dev_buffer.pbuffer = (OMX_U8 *)pmem_tmp->buffer;
- dev_buffer.fd = pmem_tmp->fd;
- dev_buffer.maped_size = pmem_tmp->size;
- dev_buffer.nsize = pmem_tmp->size;
- dev_buffer.offset = pmem_tmp->offset;
- ioctl_msg.inputparam = (void*)&dev_buffer;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n venc_free_buf:pbuffer = %x,fd = %x, offset = %d, maped_size = %d", \
- dev_buffer.pbuffer, \
- dev_buffer.fd, \
- dev_buffer.offset, \
- dev_buffer.maped_size);
-
- if(ioctl (m_nDriver_fd,VEN_IOCTL_CMD_FREE_INPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_free_buf: free input buffer failed ");
- return false;
- }
- }
- else if(port == PORT_INDEX_OUT)
- {
- dev_buffer.pbuffer = (OMX_U8 *)pmem_tmp->buffer;
- dev_buffer.fd = pmem_tmp->fd;
- dev_buffer.nsize = pmem_tmp->size;
- dev_buffer.maped_size = pmem_tmp->size;
- dev_buffer.offset = pmem_tmp->offset;
- ioctl_msg.inputparam = (void*)&dev_buffer;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("\n venc_free_buf:pbuffer = %x,fd = %x, offset = %d, maped_size = %d", \
- dev_buffer.pbuffer, \
- dev_buffer.fd, \
- dev_buffer.offset, \
- dev_buffer.maped_size);
-
- if(ioctl (m_nDriver_fd,VEN_IOCTL_CMD_FREE_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_free_buf: free output buffer failed ");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_free_buf:Invalid Port Index ");
- return false;
- }
-
- return true;
-}
-
-bool venc_dev::venc_empty_buf(void *buffer, void *pmem_data_buf)
-{
- struct venc_buffer frameinfo;
- struct pmem *temp_buffer;
- struct venc_ioctl_msg ioctl_msg;
- struct OMX_BUFFERHEADERTYPE *bufhdr;
-
- if(buffer == NULL)
- {
- DEBUG_PRINT_ERROR("\nERROR: venc_etb: buffer is NULL");
- return false;
- }
- bufhdr = (OMX_BUFFERHEADERTYPE *)buffer;
-
- DEBUG_PRINT_LOW("\n Input buffer length %d",bufhdr->nFilledLen);
-
- if(pmem_data_buf)
- {
- DEBUG_PRINT_LOW("\n Internal PMEM addr for i/p Heap UseBuf: %p", pmem_data_buf);
- frameinfo.ptrbuffer = (OMX_U8 *)pmem_data_buf;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Shared PMEM addr for i/p PMEM UseBuf/AllocateBuf: %p", bufhdr->pBuffer);
- frameinfo.ptrbuffer = (OMX_U8 *)bufhdr->pBuffer;
- }
-
- frameinfo.clientdata = (void *) buffer;
- frameinfo.size = bufhdr->nFilledLen;
- frameinfo.len = bufhdr->nFilledLen;
- frameinfo.flags = bufhdr->nFlags;
- frameinfo.offset = bufhdr->nOffset;
- frameinfo.timestamp = bufhdr->nTimeStamp;
- DEBUG_PRINT_LOW("\n i/p TS = %u", (OMX_U32)frameinfo.timestamp);
- ioctl_msg.inputparam = &frameinfo;
- ioctl_msg.outputparam = NULL;
-
- DEBUG_PRINT_LOW("DBG: i/p frameinfo: bufhdr->pBuffer = %p, ptrbuffer = %p, offset = %u, len = %u",
- bufhdr->pBuffer, frameinfo.ptrbuffer, frameinfo.offset, frameinfo.len);
- if(ioctl(m_nDriver_fd,VEN_IOCTL_CMD_ENCODE_FRAME,&ioctl_msg) < 0)
- {
- /*Generate an async error and move to invalid state*/
- return false;
- }
-
- return true;
-}
-bool venc_dev::venc_fill_buf(void *buffer, void *pmem_data_buf)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct pmem *temp_buffer = NULL;
- struct venc_buffer frameinfo;
- struct OMX_BUFFERHEADERTYPE *bufhdr;
-
- if(buffer == NULL)
- {
- return false;
- }
- bufhdr = (OMX_BUFFERHEADERTYPE *)buffer;
-
- if(pmem_data_buf)
- {
- DEBUG_PRINT_LOW("\n Internal PMEM addr for o/p Heap UseBuf: %p", pmem_data_buf);
- frameinfo.ptrbuffer = (OMX_U8 *)pmem_data_buf;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Shared PMEM addr for o/p PMEM UseBuf/AllocateBuf: %p", bufhdr->pBuffer);
- frameinfo.ptrbuffer = (OMX_U8 *)bufhdr->pBuffer;
- }
-
- frameinfo.clientdata = buffer;
- frameinfo.size = bufhdr->nAllocLen;
- frameinfo.flags = bufhdr->nFlags;
- frameinfo.offset = bufhdr->nOffset;
-
- ioctl_msg.inputparam = &frameinfo;
- ioctl_msg.outputparam = NULL;
- DEBUG_PRINT_LOW("DBG: o/p frameinfo: bufhdr->pBuffer = %p, ptrbuffer = %p, offset = %u, len = %u",
- bufhdr->pBuffer, frameinfo.ptrbuffer, frameinfo.offset, frameinfo.len);
- if(ioctl (m_nDriver_fd,VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: ioctl VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER failed");
- return false;
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_session_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp)
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_sessionqp qp = {0, 0};
- DEBUG_PRINT_LOW("venc_set_session_qp:: i_frame_qp = %d, p_frame_qp = %d", i_frame_qp,
- p_frame_qp);
-
- qp.iframeqp = i_frame_qp;
- qp.pframqp = p_frame_qp;
-
- ioctl_msg.inputparam = (void*)&qp;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_SESSION_QP,(void*)&ioctl_msg)< 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting session qp failed");
- return false;
- }
-
- session_qp.iframeqp = i_frame_qp;
- session_qp.pframqp = p_frame_qp;
-
- return true;
-}
-
-bool venc_dev::venc_set_profile_level(OMX_U32 eProfile,OMX_U32 eLevel)
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_profile requested_profile;
- struct ven_profilelevel requested_level;
- unsigned const int *profile_tbl = NULL;
- unsigned long mb_per_frame = 0, mb_per_sec = 0;
- DEBUG_PRINT_LOW("venc_set_profile_level:: eProfile = %d, Level = %d",
- eProfile, eLevel);
-
- if((eProfile == 0) && (eLevel == 0) && m_profile_set && m_level_set)
- {
- DEBUG_PRINT_LOW("\n Profile/Level setting complete before venc_start");
- return true;
- }
-
- DEBUG_PRINT_LOW("\n Validating Profile/Level from table");
- if(!venc_validate_profile_level(&eProfile, &eLevel))
- {
- DEBUG_PRINT_LOW("\nERROR: Profile/Level validation failed");
- return false;
- }
-
- if(m_sVenc_cfg.codectype == VEN_CODEC_MPEG4)
- {
- DEBUG_PRINT_LOW("eProfile = %d, OMX_VIDEO_MPEG4ProfileSimple = %d and "
- "OMX_VIDEO_MPEG4ProfileAdvancedSimple = %d", eProfile,
- OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4ProfileAdvancedSimple);
- if(eProfile == OMX_VIDEO_MPEG4ProfileSimple)
- {
- requested_profile.profile = VEN_PROFILE_MPEG4_SP;
- profile_tbl = (unsigned int const *)
- (&mpeg4_profile_level_table[MPEG4_SP_START]);
- profile_tbl += MPEG4_720P_LEVEL*5;
- }
- else if(eProfile == OMX_VIDEO_MPEG4ProfileAdvancedSimple)
- {
- requested_profile.profile = VEN_PROFILE_MPEG4_ASP;
- profile_tbl = (unsigned int const *)
- (&mpeg4_profile_level_table[MPEG4_ASP_START]);
- profile_tbl += MPEG4_720P_LEVEL*5;
- }
- else
- {
- DEBUG_PRINT_LOW("\nERROR: Unsupported MPEG4 profile = %u",
- eProfile);
- return false;
- }
-
- DEBUG_PRINT_LOW("eLevel = %d, OMX_VIDEO_MPEG4Level0 = %d, OMX_VIDEO_MPEG4Level1 = %d,"
- "OMX_VIDEO_MPEG4Level2 = %d, OMX_VIDEO_MPEG4Level3 = %d, OMX_VIDEO_MPEG4Level4 = %d,"
- "OMX_VIDEO_MPEG4Level5 = %d", eLevel, OMX_VIDEO_MPEG4Level0, OMX_VIDEO_MPEG4Level1,
- OMX_VIDEO_MPEG4Level2, OMX_VIDEO_MPEG4Level3, OMX_VIDEO_MPEG4Level4, OMX_VIDEO_MPEG4Level5);
-
- switch(eLevel)
- {
- case OMX_VIDEO_MPEG4Level0:
- requested_level.level = VEN_LEVEL_MPEG4_0;
- break;
- case OMX_VIDEO_MPEG4Level1:
- requested_level.level = VEN_LEVEL_MPEG4_1;
- break;
- case OMX_VIDEO_MPEG4Level2:
- requested_level.level = VEN_LEVEL_MPEG4_2;
- break;
- case OMX_VIDEO_MPEG4Level3:
- requested_level.level = VEN_LEVEL_MPEG4_3;
- break;
- case OMX_VIDEO_MPEG4Level4a:
- requested_level.level = VEN_LEVEL_MPEG4_4;
- break;
- case OMX_VIDEO_MPEG4Level5:
- mb_per_frame = ((m_sVenc_cfg.input_height + 15) >> 4)*
- ((m_sVenc_cfg.input_width + 15) >> 4);
- mb_per_sec = mb_per_frame * (m_sVenc_cfg.fps_num / m_sVenc_cfg.fps_den);
-
- if((mb_per_frame >= profile_tbl[0]) &&
- (mb_per_sec >= profile_tbl[1]))
- {
- DEBUG_PRINT_LOW("\nMPEG4 Level 6 is set for 720p resolution");
- requested_level.level = VEN_LEVEL_MPEG4_6;
- }
- else
- {
- DEBUG_PRINT_LOW("\nMPEG4 Level 5 is set for non-720p resolution");
- requested_level.level = VEN_LEVEL_MPEG4_5;
- }
- break;
- default:
- return false;
- // TODO update corresponding levels for MPEG4_LEVEL_3b,MPEG4_LEVEL_6
- break;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H263)
- {
- if(eProfile == OMX_VIDEO_H263ProfileBaseline)
- {
- requested_profile.profile = VEN_PROFILE_H263_BASELINE;
- }
- else
- {
- DEBUG_PRINT_LOW("\nERROR: Unsupported H.263 profile = %u",
- requested_profile.profile);
- return false;
- }
- //profile level
- switch(eLevel)
- {
- case OMX_VIDEO_H263Level10:
- requested_level.level = VEN_LEVEL_H263_10;
- break;
- case OMX_VIDEO_H263Level20:
- requested_level.level = VEN_LEVEL_H263_20;
- break;
- case OMX_VIDEO_H263Level30:
- requested_level.level = VEN_LEVEL_H263_30;
- break;
- case OMX_VIDEO_H263Level40:
- requested_level.level = VEN_LEVEL_H263_40;
- break;
- case OMX_VIDEO_H263Level45:
- requested_level.level = VEN_LEVEL_H263_45;
- break;
- case OMX_VIDEO_H263Level50:
- requested_level.level = VEN_LEVEL_H263_50;
- break;
- case OMX_VIDEO_H263Level60:
- requested_level.level = VEN_LEVEL_H263_60;
- break;
- case OMX_VIDEO_H263Level70:
- requested_level.level = VEN_LEVEL_H263_70;
- break;
- default:
- return false;
- break;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H264)
- {
- if(eProfile == OMX_VIDEO_AVCProfileBaseline)
- {
- requested_profile.profile = VEN_PROFILE_H264_BASELINE;
- }
- else if(eProfile == OMX_VIDEO_AVCProfileMain)
- {
- requested_profile.profile = VEN_PROFILE_H264_MAIN;
- }
- else if(eProfile == OMX_VIDEO_AVCProfileHigh)
- {
- requested_profile.profile = VEN_PROFILE_H264_HIGH;
- }
- else
- {
- DEBUG_PRINT_LOW("\nERROR: Unsupported H.264 profile = %u",
- requested_profile.profile);
- return false;
- }
- //profile level
- switch(eLevel)
- {
- case OMX_VIDEO_AVCLevel1:
- requested_level.level = VEN_LEVEL_H264_1;
- break;
- case OMX_VIDEO_AVCLevel1b:
- requested_level.level = VEN_LEVEL_H264_1b;
- break;
- case OMX_VIDEO_AVCLevel11:
- requested_level.level = VEN_LEVEL_H264_1p1;
- break;
- case OMX_VIDEO_AVCLevel12:
- requested_level.level = VEN_LEVEL_H264_1p2;
- break;
- case OMX_VIDEO_AVCLevel13:
- requested_level.level = VEN_LEVEL_H264_1p3;
- break;
- case OMX_VIDEO_AVCLevel2:
- requested_level.level = VEN_LEVEL_H264_2;
- break;
- case OMX_VIDEO_AVCLevel21:
- requested_level.level = VEN_LEVEL_H264_2p1;
- break;
- case OMX_VIDEO_AVCLevel22:
- requested_level.level = VEN_LEVEL_H264_2p2;
- break;
- case OMX_VIDEO_AVCLevel3:
- requested_level.level = VEN_LEVEL_H264_3;
- break;
- case OMX_VIDEO_AVCLevel31:
- requested_level.level = VEN_LEVEL_H264_3p1;
- break;
- default :
- return false;
- break;
- }
- }
-
- if(!m_profile_set)
- {
- ioctl_msg.inputparam = (void*)&requested_profile;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_CODEC_PROFILE,(void*)&ioctl_msg)< 0)
- {
- DEBUG_PRINT_LOW("\nERROR: Request for setting profile failed");
- return false;
- }
- codec_profile.profile = requested_profile.profile;
- m_profile_set = true;
- }
-
- if(!m_level_set)
- {
- ioctl_msg.inputparam = (void*)&requested_level;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_PROFILE_LEVEL,(void*)&ioctl_msg)< 0)
- {
- DEBUG_PRINT_LOW("\nERROR: Request for setting profile level failed");
- return false;
- }
- profile_level.level = requested_level.level;
- m_level_set = true;
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_intra_period(OMX_U32 nPFrames)
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_intraperiod intra_period;
-
- DEBUG_PRINT_LOW("\n venc_set_intra_period: nPFrames = %u",
- nPFrames);
- intra_period.num_pframes = nPFrames;
- ioctl_msg.inputparam = (void*)&intra_period;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_INTRA_PERIOD,(void*)&ioctl_msg)< 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting intra period failed");
- return false;
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_target_bitrate(OMX_U32 nTargetBitrate)
-{
- venc_ioctl_msg ioctl_msg = {NULL, NULL};
- struct venc_targetbitrate bit_rate;
-
- DEBUG_PRINT_LOW("\n venc_set_target_bitrate: bitrate = %u",
- nTargetBitrate);
- bit_rate.target_bitrate = nTargetBitrate ;
- ioctl_msg.inputparam = (void*)&bit_rate;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_TARGET_BITRATE,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting bit rate failed");
- return false;
- }
- m_sVenc_cfg.targetbitrate = nTargetBitrate;
- m_level_set = false;
- if(venc_set_profile_level(0, 0))
- {
- DEBUG_PRINT_HIGH("\n %s(): Dynamic Profile/Level setting success",
- __func__);
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_encode_framerate(OMX_U32 encode_framerate)
-{
- venc_ioctl_msg ioctl_msg = {NULL, NULL};
- struct venc_framerate frame_rate;
-
- DEBUG_PRINT_LOW("\n venc_set_encode_framerate: framerate(Q16) = %u",
- encode_framerate);
- frame_rate.fps_numerator = 30;
- if((encode_framerate >> 16)== 30)
- {
- frame_rate.fps_denominator = 1;
- }
- else if((encode_framerate >>16) == 15)
- {
- frame_rate.fps_denominator = 2;
- }
- else if((encode_framerate >> 16)== 7.5)
- {
- frame_rate.fps_denominator = 4;
- }
- else
- {
- frame_rate.fps_denominator = 1;
- }
-
- ioctl_msg.inputparam = (void*)&frame_rate;
- ioctl_msg.outputparam = NULL;
- if(ioctl(m_nDriver_fd, VEN_IOCTL_SET_FRAME_RATE,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting framerate failed");
- return false;
- }
-
- m_sVenc_cfg.fps_den = frame_rate.fps_denominator;
- m_sVenc_cfg.fps_num = frame_rate.fps_numerator;
- m_level_set = false;
- if(venc_set_profile_level(0, 0))
- {
- DEBUG_PRINT_HIGH("\n %s(): Dynamic Profile/Level setting success",
- __func__);
- }
-
- return true;
-}
-
-bool venc_dev::venc_set_color_format(OMX_COLOR_FORMATTYPE color_format)
-{
- venc_ioctl_msg ioctl_msg = {NULL, NULL};
- DEBUG_PRINT_LOW("\n venc_set_color_format: color_format = %u ", color_format);
-
- if(color_format == OMX_COLOR_FormatYUV420SemiPlanar)
- {
- m_sVenc_cfg.inputformat = VEN_INPUTFMT_NV12;
- }
- else
- {
- DEBUG_PRINT_ERROR("\nWARNING: Unsupported Color format [%d]", color_format);
- m_sVenc_cfg.inputformat = VEN_INPUTFMT_NV12;
- DEBUG_PRINT_HIGH("\n Default color format YUV420SemiPlanar is set");
- }
- ioctl_msg.inputparam = (void*)&m_sVenc_cfg;
- ioctl_msg.outputparam = NULL;
- if (ioctl(m_nDriver_fd, VEN_IOCTL_SET_BASE_CFG, (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting color format failed");
- return false;
- }
- return true;
-}
-
-bool venc_dev::venc_set_intra_vop_refresh(OMX_BOOL intra_vop_refresh)
-{
- DEBUG_PRINT_LOW("\n venc_set_intra_vop_refresh: intra_vop = %uc", intra_vop_refresh);
- if(intra_vop_refresh == OMX_TRUE)
- {
- if(ioctl(m_nDriver_fd, VEN_IOCTL_CMD_REQUEST_IFRAME, NULL) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting Intra VOP Refresh failed");
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_ERROR("\nERROR: VOP Refresh is False, no effect");
- }
- return true;
-}
-
-bool venc_dev::venc_set_ratectrl_cfg(OMX_VIDEO_CONTROLRATETYPE eControlRate)
-{
- venc_ioctl_msg ioctl_msg = {NULL,NULL};
- bool status = true;
-
- //rate control
- switch(eControlRate)
- {
- case OMX_Video_ControlRateDisable:
- rate_ctrl.rcmode = VEN_RC_OFF;
- break;
- case OMX_Video_ControlRateVariableSkipFrames:
- rate_ctrl.rcmode = VEN_RC_VBR_VFR;
- break;
- case OMX_Video_ControlRateVariable:
- rate_ctrl.rcmode = VEN_RC_VBR_CFR;
- break;
- case OMX_Video_ControlRateConstantSkipFrames:
- rate_ctrl.rcmode = VEN_RC_CBR_VFR;
- break;
- default:
- status = false;
- break;
- }
-
- if(status)
- {
- ioctl_msg.inputparam = (void*)&rate_ctrl;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_RATE_CTRL_CFG,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting rate control failed");
- status = false;
- }
- }
- return status;
-}
-
-bool venc_dev::venc_get_profile_level(OMX_U32 *eProfile,OMX_U32 *eLevel)
-{
- bool status = true;
- if(eProfile == NULL || eLevel == NULL)
- {
- return false;
- }
-
- if(m_sVenc_cfg.codectype == VEN_CODEC_MPEG4)
- {
- switch(codec_profile.profile)
- {
- case VEN_PROFILE_MPEG4_SP:
- *eProfile = OMX_VIDEO_MPEG4ProfileSimple;
- break;
- case VEN_PROFILE_MPEG4_ASP:
- *eProfile = OMX_VIDEO_MPEG4ProfileAdvancedSimple;
- break;
- default:
- *eProfile = OMX_VIDEO_MPEG4ProfileMax;
- status = false;
- break;
- }
-
- if(!status)
- {
- return status;
- }
-
- //profile level
- switch(profile_level.level)
- {
- case VEN_LEVEL_MPEG4_0:
- *eLevel = OMX_VIDEO_MPEG4Level0;
- break;
- case VEN_LEVEL_MPEG4_1:
- *eLevel = OMX_VIDEO_MPEG4Level1;
- break;
- case VEN_LEVEL_MPEG4_2:
- *eLevel = OMX_VIDEO_MPEG4Level2;
- break;
- case VEN_LEVEL_MPEG4_3:
- *eLevel = OMX_VIDEO_MPEG4Level3;
- break;
- case VEN_LEVEL_MPEG4_4:
- *eLevel = OMX_VIDEO_MPEG4Level4a;
- break;
- case VEN_LEVEL_MPEG4_5:
- case VEN_LEVEL_MPEG4_6:
- *eLevel = OMX_VIDEO_MPEG4Level5;
- break;
- default:
- *eLevel = OMX_VIDEO_MPEG4LevelMax;
- status = false;
- break;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H263)
- {
- if(codec_profile.profile == VEN_PROFILE_H263_BASELINE)
- {
- *eProfile = OMX_VIDEO_H263ProfileBaseline;
- }
- else
- {
- *eProfile = OMX_VIDEO_H263ProfileMax;
- return false;
- }
- switch(profile_level.level)
- {
- case VEN_LEVEL_H263_10:
- *eLevel = OMX_VIDEO_H263Level10;
- break;
- case VEN_LEVEL_H263_20:
- *eLevel = OMX_VIDEO_H263Level20;
- break;
- case VEN_LEVEL_H263_30:
- *eLevel = OMX_VIDEO_H263Level30;
- break;
- case VEN_LEVEL_H263_40:
- *eLevel = OMX_VIDEO_H263Level40;
- break;
- case VEN_LEVEL_H263_45:
- *eLevel = OMX_VIDEO_H263Level45;
- break;
- case VEN_LEVEL_H263_50:
- *eLevel = OMX_VIDEO_H263Level50;
- break;
- case VEN_LEVEL_H263_60:
- *eLevel = OMX_VIDEO_H263Level60;
- break;
- case VEN_LEVEL_H263_70:
- *eLevel = OMX_VIDEO_H263Level70;
- break;
- default:
- *eLevel = OMX_VIDEO_H263LevelMax;
- status = false;
- break;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H264)
- {
- switch(codec_profile.profile)
- {
- case VEN_PROFILE_H264_BASELINE:
- *eProfile = OMX_VIDEO_AVCProfileBaseline;
- break;
- case VEN_PROFILE_H264_MAIN:
- *eProfile = OMX_VIDEO_AVCProfileMain;
- break;
- case VEN_PROFILE_H264_HIGH:
- *eProfile = OMX_VIDEO_AVCProfileHigh;
- break;
- default:
- *eProfile = OMX_VIDEO_AVCProfileMax;
- status = false;
- break;
- }
-
- if(!status)
- {
- return status;
- }
-
- switch(profile_level.level)
- {
- case VEN_LEVEL_H264_1:
- *eLevel = OMX_VIDEO_AVCLevel1;
- break;
- case VEN_LEVEL_H264_1b:
- *eLevel = OMX_VIDEO_AVCLevel1b;
- break;
- case VEN_LEVEL_H264_1p1:
- *eLevel = OMX_VIDEO_AVCLevel11;
- break;
- case VEN_LEVEL_H264_1p2:
- *eLevel = OMX_VIDEO_AVCLevel12;
- break;
- case VEN_LEVEL_H264_1p3:
- *eLevel = OMX_VIDEO_AVCLevel13;
- break;
- case VEN_LEVEL_H264_2:
- *eLevel = OMX_VIDEO_AVCLevel2;
- break;
- case VEN_LEVEL_H264_2p1:
- *eLevel = OMX_VIDEO_AVCLevel21;
- break;
- case VEN_LEVEL_H264_2p2:
- *eLevel = OMX_VIDEO_AVCLevel22;
- break;
- case VEN_LEVEL_H264_3:
- *eLevel = OMX_VIDEO_AVCLevel3;
- break;
- case VEN_LEVEL_H264_3p1:
- *eLevel = OMX_VIDEO_AVCLevel31;
- break;
- default :
- *eLevel = OMX_VIDEO_AVCLevelMax;
- status = false;
- break;
- }
- }
- return status;
-}
-
-bool venc_dev::venc_validate_profile_level(OMX_U32 *eProfile, OMX_U32 *eLevel)
-{
- OMX_U32 new_profile = 0, new_level = 0;
- unsigned const int *profile_tbl = NULL;
- OMX_U32 mb_per_frame, mb_per_sec;
- bool profile_level_found = false;
-
- DEBUG_PRINT_LOW("\n Init profile table for respective codec");
- //validate the ht,width,fps,bitrate and set the appropriate profile and level
- if(m_sVenc_cfg.codectype == VEN_CODEC_MPEG4)
- {
- if(*eProfile == 0)
- {
- if(!m_profile_set)
- {
- *eProfile = OMX_VIDEO_MPEG4ProfileSimple;
- }
- else
- {
- switch(codec_profile.profile)
- {
- case VEN_PROFILE_MPEG4_ASP:
- *eProfile = OMX_VIDEO_MPEG4ProfileAdvancedSimple;
- break;
- case VEN_PROFILE_MPEG4_SP:
- *eProfile = OMX_VIDEO_MPEG4ProfileSimple;
- break;
- default:
- DEBUG_PRINT_LOW("\n %s(): Unknown Error", __func__);
- return false;
- }
- }
- }
-
- if(*eLevel == 0 && !m_level_set)
- {
- *eLevel = OMX_VIDEO_MPEG4LevelMax;
- }
-
- if(*eProfile == OMX_VIDEO_MPEG4ProfileSimple)
- {
- profile_tbl = (unsigned int const *)mpeg4_profile_level_table;
- }
- else if(*eProfile == OMX_VIDEO_MPEG4ProfileAdvancedSimple)
- {
- profile_tbl = (unsigned int const *)
- (&mpeg4_profile_level_table[MPEG4_ASP_START]);
- }
- else
- {
- DEBUG_PRINT_LOW("\n Unsupported MPEG4 profile type %lu", *eProfile);
- return false;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H264)
- {
- if(*eProfile == 0)
- {
- if(!m_profile_set)
- {
- *eProfile = OMX_VIDEO_AVCProfileBaseline;
- }
- else
- {
- switch(codec_profile.profile)
- {
- case VEN_PROFILE_H264_BASELINE:
- *eProfile = OMX_VIDEO_AVCProfileBaseline;
- break;
- case VEN_PROFILE_H264_MAIN:
- *eProfile = OMX_VIDEO_AVCProfileMain;
- break;
- case VEN_PROFILE_H264_HIGH:
- *eProfile = OMX_VIDEO_AVCProfileHigh;
- break;
- default:
- DEBUG_PRINT_LOW("\n %s(): Unknown Error", __func__);
- return false;
- }
- }
- }
-
- if(*eLevel == 0 && !m_level_set)
- {
- *eLevel = OMX_VIDEO_AVCLevelMax;
- }
-
- if(*eProfile == OMX_VIDEO_AVCProfileBaseline)
- {
- profile_tbl = (unsigned int const *)h264_profile_level_table;
- }
- else if(*eProfile == OMX_VIDEO_AVCProfileHigh)
- {
- profile_tbl = (unsigned int const *)
- (&h264_profile_level_table[H264_HP_START]);
- }
- else if(*eProfile == OMX_VIDEO_AVCProfileMain)
- {
- profile_tbl = (unsigned int const *)
- (&h264_profile_level_table[H264_MP_START]);
- }
- else
- {
- DEBUG_PRINT_LOW("\n Unsupported AVC profile type %lu", *eProfile);
- return false;
- }
- }
- else if(m_sVenc_cfg.codectype == VEN_CODEC_H263)
- {
- if(*eProfile == 0)
- {
- if(!m_profile_set)
- {
- *eProfile = OMX_VIDEO_H263ProfileBaseline;
- }
- else
- {
- switch(codec_profile.profile)
- {
- case VEN_PROFILE_H263_BASELINE:
- *eProfile = OMX_VIDEO_H263ProfileBaseline;
- break;
- default:
- DEBUG_PRINT_LOW("\n %s(): Unknown Error", __func__);
- return false;
- }
- }
- }
-
- if(*eLevel == 0 && !m_level_set)
- {
- *eLevel = OMX_VIDEO_H263LevelMax;
- }
-
- if(*eProfile == OMX_VIDEO_H263ProfileBaseline)
- {
- profile_tbl = (unsigned int const *)h263_profile_level_table;
- }
- else
- {
- DEBUG_PRINT_LOW("\n Unsupported H.263 profile type %lu", *eProfile);
- return false;
- }
- }
- else
- {
- DEBUG_PRINT_LOW("\n Invalid codec type");
- return false;
- }
-
- mb_per_frame = ((m_sVenc_cfg.input_height + 15) >> 4)*
- ((m_sVenc_cfg.input_width + 15)>> 4);
-
- mb_per_sec = mb_per_frame * m_sVenc_cfg.fps_num / m_sVenc_cfg.fps_den;
-
- do{
- if(mb_per_frame <= (int)profile_tbl[0])
- {
- if(mb_per_sec <= (int)profile_tbl[1])
- {
- if(m_sVenc_cfg.targetbitrate <= (int)profile_tbl[2])
- {
- DEBUG_PRINT_LOW("\n Appropriate profile/level found \n");
- new_level = (int)profile_tbl[3];
- new_profile = (int)profile_tbl[4];
- profile_level_found = true;
- break;
- }
- }
- }
- profile_tbl = profile_tbl + 5;
- }while(profile_tbl[0] != 0);
-
- if ((profile_level_found != true) || (new_profile != *eProfile)
- || (new_level > *eLevel))
- {
- DEBUG_PRINT_LOW("\n ERROR: Unsupported profile/level\n");
- return false;
- }
-
- if((*eLevel == OMX_VIDEO_MPEG4LevelMax) || (*eLevel == OMX_VIDEO_AVCLevelMax)
- || (*eLevel == OMX_VIDEO_H263LevelMax))
- {
- *eLevel = new_level;
- }
- DEBUG_PRINT_HIGH("%s: Returning with eProfile = %lu"
- "Level = %lu", __func__, *eProfile, *eLevel);
-
- return true;
-}
-bool venc_dev::venc_set_multislice_cfg(OMX_VIDEO_AVCSLICEMODETYPE eSliceMode)
-{
- venc_ioctl_msg ioctl_msg = {NULL, NULL};
- bool status = true;
- DEBUG_PRINT_LOW("\n %s(): eSliceMode = %u", __func__, eSliceMode);
- switch(eSliceMode)
- {
- case OMX_VIDEO_SLICEMODE_AVCDefault:
- DEBUG_PRINT_LOW("\n %s(): OMX_VIDEO_SLICEMODE_AVCDefault", __func__);
- multislice_cfg.mslice_mode = VEN_MSLICE_OFF;
- multislice_cfg.mslice_size = 0;
- break;
- case OMX_VIDEO_SLICEMODE_AVCMBSlice:
- DEBUG_PRINT_LOW("\n %s(): OMX_VIDEO_SLICEMODE_AVCMBSlice", __func__);
- multislice_cfg.mslice_mode = VEN_MSLICE_CNT_MB;
- multislice_cfg.mslice_size = ((m_sVenc_cfg.input_width/16) *
- (m_sVenc_cfg.input_height/16))/2;
- break;
- case OMX_VIDEO_SLICEMODE_AVCByteSlice:
- DEBUG_PRINT_LOW("\n %s(): OMX_VIDEO_SLICEMODE_AVCByteSlice", __func__);
- multislice_cfg.mslice_mode = VEN_MSLICE_CNT_BYTE;
- multislice_cfg.mslice_size = 1920;
- break;
- default:
- DEBUG_PRINT_ERROR("\n %s(): Unsupported SliceMode = %u",__func__, eSliceMode);
- status = false;
- break;
- }
- DEBUG_PRINT_LOW("\n %s(): mode = %u, size = %u", __func__, multislice_cfg.mslice_mode,
- multislice_cfg.mslice_size);
-
- if(status)
- {
- ioctl_msg.inputparam = (void*)&multislice_cfg;
- ioctl_msg.outputparam = NULL;
- if(ioctl (m_nDriver_fd,VEN_IOCTL_SET_MULTI_SLICE_CFG,(void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT_ERROR("\nERROR: Request for setting multi-slice cfg failed");
- status = false;
- }
- }
- return status;
-}
diff --git a/mm-video/vidc/venc/test/camera_test.cpp b/mm-video/vidc/venc/test/camera_test.cpp
deleted file mode 100644
index fbbc409f..00000000
--- a/mm-video/vidc/venc/test/camera_test.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "camera_test.h"
-// #include "camera_class.h"
-
-EXTERN_C_START
-
-// static android::Camera* pCamera = NULL;
-
-int CameraTest_Initialize(int nFrameRate,
- int nFrameWidth,
- int nFrameHeight,
- CameraPreviewCallback pfnPreviewCallback)
-{
- int result = 0;
-
-// pCamera = new android::Camera;
-// if (!pCamera)
-// return 1;
-
-// pCamera->init_camera(nFrameWidth,
-// nFrameHeight,
-// nFrameRate,
-// pfnPreviewCallback);
-
- return result;
-}
-
-int CameraTest_Run()
-{
- int result = 0;
-
-// if (pCamera)
-// pCamera->startPreview();
-// else
-// return 1;
-
- return result;
-}
-
-int CameraTest_ReleaseFrame(void* pPhys, void* pVirt)
-{
- int result = 0;
-
-// if (pCamera)
-// pCamera->releaseFrame(pPhys, pVirt);
-// else
-// return 1;
-
- return result;
-}
-
-int CameraTest_Exit()
-{
- int result = 0;
-
-// if (pCamera)
-// {
-// pCamera->stopPreview();
-// delete pCamera;
-// }
-// pCamera = NULL;
-
- return result;
-}
-
-
-EXTERN_C_END
diff --git a/mm-video/vidc/venc/test/fb_test.c b/mm-video/vidc/venc/test/fb_test.c
deleted file mode 100644
index 258218e6..00000000
--- a/mm-video/vidc/venc/test/fb_test.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "fb_test.h"
-
-int FBTest_Initialize(int nFrameWidth,
- int nFrameHeight)
-{
- return 0;
-}
-int FBTest_DisplayImage(int nPmemFd, int nOffset)
-{
- return 0;
-}
-
-int FBTest_Exit()
-{
- return 0;
-}
-
-int FBTest_RunTest()
-{
- return 0;
-}
diff --git a/mm-video/vidc/venc/test/queue.c b/mm-video/vidc/venc/test/queue.c
deleted file mode 100644
index 3f17c9e7..00000000
--- a/mm-video/vidc/venc/test/queue.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "queue.h"
-
-int check_if_queue_empty ( unsigned int queuetocheck, void* queuecontext )
-{
- struct video_queue_context *ptr_q = NULL;
- /*
- * queuetocheck - 0 command queue
- * queuetocheck - 1 data queue
- */
- if ( queuecontext == NULL || (queuetocheck > 1 ) )
- {
- return 1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- if (queuetocheck == 0)
- {
- if (ptr_q->read_comq == ptr_q->write_comq)
- {
- return 1;
- }
- }
- else if (queuetocheck == 1)
- {
- if (ptr_q->write_dataq == ptr_q->read_dataq)
- {
- return 1;
- }
- }
-
- return 0;
-}
-
-
-
-struct video_msgq * queue_get_cmd (void* queuecontext )
-{
- struct video_queue_context *ptr_q = NULL;
- struct video_msgq *pitem = NULL;
-
- if( NULL == queuecontext )
- {
- printf("\n queue_get_cmd: Invalid Input parameter\n");
- return NULL;
- }
-
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Wait on the semaphore till it is released */
- sem_wait(&ptr_q->sem_message);
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if (ptr_q->read_comq != ptr_q->write_comq)
- {
- pitem = &ptr_q->ptr_cmdq [ptr_q->read_comq];
- ptr_q->read_comq = (ptr_q->read_comq + 1) % \
- ptr_q->commandq_size;
- }
- else if (ptr_q->write_dataq != ptr_q->read_dataq)
- {
- pitem = &ptr_q->ptr_dataq [ptr_q->read_dataq];
- ptr_q->read_dataq = (ptr_q->read_dataq + 1) % \
- ptr_q->dataq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- return pitem;
-}
-
-
-int queue_post_cmdq ( void* queuecontext,
- struct video_msgq *pitem
- )
-{
- struct video_queue_context *ptr_q = NULL;
-
- if (pitem == NULL || queuecontext == NULL)
- {
- return -1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if ((ptr_q->write_comq + 1) % ptr_q->commandq_size == ptr_q->read_comq)
- {
- printf("\n QUEUE is FULL");
- return 0;
- }
- else
- {
- /* Store the command in the Message Queue & increment write offset */
- memcpy ( &ptr_q->ptr_cmdq [ptr_q->write_comq],pitem, \
- sizeof (struct video_msgq));
- ptr_q->write_comq = (ptr_q->write_comq + 1) % ptr_q->commandq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- /* Post the semaphore */
- sem_post(&ptr_q->sem_message);
- return 1;
-}
-
-
-int queue_post_dataq ( void *queuecontext,
- struct video_msgq *pitem
- )
-{
- struct video_queue_context *ptr_q = NULL;
-
- if (pitem == NULL || queuecontext == NULL)
- {
- return -1;
- }
- ptr_q = (struct video_queue_context *)queuecontext;
-
- /* Lock the mutex to protect the critical section */
- pthread_mutex_lock(&ptr_q->mutex);
-
- if ((ptr_q->write_dataq + 1) % ptr_q->dataq_size == ptr_q->read_dataq)
- {
- printf("\n QUEUE is FULL");
- return 0;
- }
- else
- {
- /* Store the command in the Message Queue & increment write offset */
- memcpy ( &ptr_q->ptr_dataq [ptr_q->write_dataq],pitem, \
- sizeof (struct video_msgq));
- ptr_q->write_dataq = (ptr_q->write_dataq + 1) % ptr_q->dataq_size;
- }
-
- /* Unlock the mutex to release the critical section */
- pthread_mutex_unlock(&ptr_q->mutex);
-
- /* Post the semaphore */
- sem_post(&ptr_q->sem_message);
- return 1;
-
-}
diff --git a/mm-video/vidc/venc/test/venc_test.cpp b/mm-video/vidc/venc/test/venc_test.cpp
deleted file mode 100644
index e3a0d034..00000000
--- a/mm-video/vidc/venc/test/venc_test.cpp
+++ /dev/null
@@ -1,1635 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- V E N C _ T E S T. C P P
-
-DESCRIPTION
-
- This is the OMX test app .
-
-REFERENCES
-
-============================================================================*/
-
-//usage
-// FILE QVGA MP4 24 384000 100 enc_qvga.yuv QVGA_24.m4v
-// FILE QCIF MP4 15 96000 0 foreman.qcif.yuv output_qcif.m4v
-// FILE VGA MP4 24 1200000 218 enc_vga.yuv vga_output.m4v
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-//#include <sys/time.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <string.h>
-//#include <sys/stat.h>
-#include "OMX_QCOMExtns.h"
-#include "OMX_Core.h"
-
-
-#define QCOM_EXT 1
-
-#include "OMX_Core.h"
-#include "OMX_Video.h"
-#include "OMX_Component.h"
-#include "camera_test.h"
-#include "fb_test.h"
-#include "venc_util.h"
-
-//////////////////////////
-// MACROS
-//////////////////////////
-
-#define CHK(result) if (result != OMX_ErrorNone) { E("*************** error *************"); exit(0); }
-#define TEST_LOG
-#ifdef VENC_SYSLOG
-#include "cutils/log.h"
-/// Debug message macro
-#define D(fmt, ...) ALOGE("venc_test Debug %s::%d "fmt"\n", \
- __FUNCTION__, __LINE__, \
- ## __VA_ARGS__)
-
-/// Error message macro
-#define E(fmt, ...) ALOGE("venc_test Error %s::%d "fmt"\n", \
- __FUNCTION__, __LINE__, \
- ## __VA_ARGS__)
-
-#else
- #ifdef TEST_LOG
- #define D(fmt, ...) fprintf(stderr, "venc_test Debug %s::%d "fmt"\n", \
- __FUNCTION__, __LINE__, \
- ## __VA_ARGS__)
-
- /// Error message macro
- #define E(fmt, ...) fprintf(stderr, "venc_test Error %s::%d "fmt"\n", \
- __FUNCTION__, __LINE__, \
- ## __VA_ARGS__)
- #else
- #define D(fmt, ...)
- #define E(fmt, ...)
- #endif
-
-#endif
-
-//////////////////////////
-// CONSTANTS
-//////////////////////////
-static const int MAX_MSG = 100;
-//#warning do not hardcode these use port definition
-static const int PORT_INDEX_IN = 0;
-static const int PORT_INDEX_OUT = 1;
-
-static const int NUM_IN_BUFFERS = 10;
-static const int NUM_OUT_BUFFERS = 10;
-
-unsigned int num_in_buffers = 0;
-unsigned int num_out_buffers = 0;
-
-//////////////////////////
-/* MPEG4 profile and level table*/
-static const unsigned int mpeg4_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_MPEG4Level0,OMX_VIDEO_MPEG4ProfileSimple},
- {99,1485,128000,OMX_VIDEO_MPEG4Level1,OMX_VIDEO_MPEG4ProfileSimple},
- {396,5940,128000,OMX_VIDEO_MPEG4Level2,OMX_VIDEO_MPEG4ProfileSimple},
- {396,11880,384000,OMX_VIDEO_MPEG4Level3,OMX_VIDEO_MPEG4ProfileSimple},
- {1200,36000,4000000,OMX_VIDEO_MPEG4Level4a,OMX_VIDEO_MPEG4ProfileSimple},
- {1620,40500,8000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileSimple},
- {3600,108000,14000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileSimple},
-
- {99,2970,128000,OMX_VIDEO_MPEG4Level0,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {99,2970,128000,OMX_VIDEO_MPEG4Level1,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {396,5940,384000,OMX_VIDEO_MPEG4Level2,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {396,11880,768000,OMX_VIDEO_MPEG4Level3,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {792,23760,3000000,OMX_VIDEO_MPEG4Level4,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {1620,48600,8000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {3600,108000,14000000,OMX_VIDEO_MPEG4Level5,OMX_VIDEO_MPEG4ProfileAdvancedSimple},
- {0 ,0 ,0 ,0 ,0 }
-};
-
-/* H264 profile and level table*/
-static const unsigned int h264_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_AVCLevel1,OMX_VIDEO_AVCProfileBaseline},
- {99,1485,128000,OMX_VIDEO_AVCLevel1b,OMX_VIDEO_AVCProfileBaseline},
- {396,3000,192000,OMX_VIDEO_AVCLevel11,OMX_VIDEO_AVCProfileBaseline},
- {396,6000,384000,OMX_VIDEO_AVCLevel12,OMX_VIDEO_AVCProfileBaseline},
- {396,11880,768000,OMX_VIDEO_AVCLevel13,OMX_VIDEO_AVCProfileBaseline},
- {396,11880,2000000,OMX_VIDEO_AVCLevel2,OMX_VIDEO_AVCProfileBaseline},
- {792,19800,4000000,OMX_VIDEO_AVCLevel21,OMX_VIDEO_AVCProfileBaseline},
- {1620,20250,4000000,OMX_VIDEO_AVCLevel22,OMX_VIDEO_AVCProfileBaseline},
- {1620,40500,10000000,OMX_VIDEO_AVCLevel3,OMX_VIDEO_AVCProfileBaseline},
- {3600,108000,14000000,OMX_VIDEO_AVCLevel31,OMX_VIDEO_AVCProfileBaseline},
-
- {99,1485,64000,OMX_VIDEO_AVCLevel1,OMX_VIDEO_AVCProfileHigh},
- {99,1485,160000,OMX_VIDEO_AVCLevel1b,OMX_VIDEO_AVCProfileHigh},
- {396,3000,240000,OMX_VIDEO_AVCLevel11,OMX_VIDEO_AVCProfileHigh},
- {396,6000,480000,OMX_VIDEO_AVCLevel12,OMX_VIDEO_AVCProfileHigh},
- {396,11880,960000,OMX_VIDEO_AVCLevel13,OMX_VIDEO_AVCProfileHigh},
- {396,11880,2500000,OMX_VIDEO_AVCLevel2,OMX_VIDEO_AVCProfileHigh},
- {792,19800,5000000,OMX_VIDEO_AVCLevel21,OMX_VIDEO_AVCProfileHigh},
- {1620,20250,5000000,OMX_VIDEO_AVCLevel22,OMX_VIDEO_AVCProfileHigh},
- {1620,40500,12500000,OMX_VIDEO_AVCLevel3,OMX_VIDEO_AVCProfileHigh},
- {3600,108000,17500000,OMX_VIDEO_AVCLevel31,OMX_VIDEO_AVCProfileHigh},
- {0 ,0 ,0 ,0 }
-};
-
-/* H263 profile and level table*/
-static const unsigned int h263_profile_level_table[][5]=
-{
- /*max mb per frame, max mb per sec, max bitrate, level, profile*/
- {99,1485,64000,OMX_VIDEO_H263Level10,OMX_VIDEO_H263ProfileBaseline},
- {396,5940,128000,OMX_VIDEO_H263Level20,OMX_VIDEO_H263ProfileBaseline},
- {396,11880,384000,OMX_VIDEO_H263Level30,OMX_VIDEO_H263ProfileBaseline},
- {396,11880,2048000,OMX_VIDEO_H263Level40,OMX_VIDEO_H263ProfileBaseline},
- {99,1485,128000,OMX_VIDEO_H263Level45,OMX_VIDEO_H263ProfileBaseline},
- {396,19800,4096000,OMX_VIDEO_H263Level50,OMX_VIDEO_H263ProfileBaseline},
- {810,40500,8192000,OMX_VIDEO_H263Level60,OMX_VIDEO_H263ProfileBaseline},
- {1620,81000,16384000,OMX_VIDEO_H263Level70,OMX_VIDEO_H263ProfileBaseline},
- {0 , 0 , 0 , 0 }
-};
-
-//////////////////////////
-// TYPES
-//////////////////////////
-struct ProfileType
-{
- OMX_VIDEO_CODINGTYPE eCodec;
- OMX_VIDEO_MPEG4LEVELTYPE eLevel;
- OMX_VIDEO_CONTROLRATETYPE eControlRate;
- OMX_VIDEO_AVCSLICEMODETYPE eSliceMode;
- OMX_U32 nFrameWidth;
- OMX_U32 nFrameHeight;
- OMX_U32 nFrameBytes;
- OMX_U32 nBitrate;
- OMX_U32 nFramerate;
- char* cInFileName;
- char* cOutFileName;
-};
-
-enum MsgId
-{
- MSG_ID_OUTPUT_FRAME_DONE,
- MSG_ID_INPUT_FRAME_DONE,
- MSG_ID_MAX
-};
-union MsgData
-{
- struct
- {
- OMX_BUFFERHEADERTYPE* pBuffer;
- } sBitstreamData;
-};
-struct Msg
-{
- MsgId id;
- MsgData data;
-};
-struct MsgQ
-{
- Msg q[MAX_MSG];
- int head;
- int size;
-};
-
-enum Mode
-{
- MODE_PREVIEW,
- MODE_DISPLAY,
- MODE_PROFILE,
- MODE_FILE_ENCODE,
- MODE_LIVE_ENCODE
-};
-
-//////////////////////////
-// MODULE VARS
-//////////////////////////
-static pthread_mutex_t m_mutex;
-static pthread_cond_t m_signal;
-static MsgQ m_sMsgQ;
-
-//#warning determine how many buffers we really have
-OMX_STATETYPE m_eState = OMX_StateInvalid;
-OMX_COMPONENTTYPE m_sComponent;
-OMX_HANDLETYPE m_hHandle = NULL;
-OMX_BUFFERHEADERTYPE* m_pOutBuffers[NUM_OUT_BUFFERS] = {NULL};
-OMX_BUFFERHEADERTYPE* m_pInBuffers[NUM_IN_BUFFERS] = {NULL};
-OMX_BOOL m_bInFrameFree[NUM_IN_BUFFERS];
-
-ProfileType m_sProfile;
-
-static int m_nFramePlay = 0;
-static int m_eMode = MODE_PREVIEW;
-static int m_nInFd = -1;
-static int m_nOutFd = -1;
-static int m_nTimeStamp = 0;
-static int m_nFrameIn = 0; // frames pushed to encoder
-static int m_nFrameOut = 0; // frames returned by encoder
-static int m_nAVCSliceMode = 0;
-
-static bool m_bWatchDogKicked = false;
-
-/* Statistics Logging */
-static long long tot_bufsize = 0;
-int ebd_cnt=0, fbd_cnt=0;
-
-//////////////////////////
-// MODULE FUNCTIONS
-//////////////////////////
-
-void* PmemMalloc(OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO* pMem, int nSize)
-{
- void *pvirt = NULL;
-
- if (!pMem)
- return NULL;
-
- pMem->pmem_fd = open("/dev/pmem_adsp", O_RDWR | O_SYNC);
- if ((int)(pMem->pmem_fd) < 0)
- return NULL;
- nSize = (nSize + 4095) & (~4095);
- pMem->offset = 0;
- pvirt = mmap(NULL, nSize,
- PROT_READ | PROT_WRITE,
- MAP_SHARED, pMem->pmem_fd, pMem->offset);
- if (pvirt == (void*) MAP_FAILED)
- {
- close(pMem->pmem_fd);
- pMem->pmem_fd = -1;
- return NULL;
- }
- D("allocated pMem->fd = %d pvirt=0x%x, pMem->phys=0x%x, size = %d", pMem->pmem_fd,
- pvirt, pMem->offset, nSize);
- return pvirt;
-}
-
-int PmemFree(OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO* pMem, void* pvirt, int nSize)
-{
- if (!pMem || !pvirt)
- return -1;
-
- nSize = (nSize + 4095) & (~4095);
- munmap(pvirt, nSize);
- close(pMem->pmem_fd);
- pMem->pmem_fd = -1;
- return 0;
-}
-
-void SetState(OMX_STATETYPE eState)
-{
-#define GOTO_STATE(eState) \
- case eState: \
- { \
- D("Going to state " # eState"..."); \
- OMX_SendCommand(m_hHandle, \
- OMX_CommandStateSet, \
- (OMX_U32) eState, \
- NULL); \
- while (m_eState != eState) \
- { \
- sleep(1); \
- } \
- D("Now in state " # eState); \
- break; \
- }
-
- switch (eState)
- {
- GOTO_STATE(OMX_StateLoaded);
- GOTO_STATE(OMX_StateIdle);
- GOTO_STATE(OMX_StateExecuting);
- GOTO_STATE(OMX_StateInvalid);
- GOTO_STATE(OMX_StateWaitForResources);
- GOTO_STATE(OMX_StatePause);
- }
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE ConfigureEncoder()
-{
- OMX_ERRORTYPE result = OMX_ErrorNone;
- unsigned const int *profile_tbl = NULL;
- OMX_U32 mb_per_sec, mb_per_frame;
- bool profile_level_found = false;
- OMX_U32 eProfile,eLevel;
-
- OMX_PARAM_PORTDEFINITIONTYPE portdef; // OMX_IndexParamPortDefinition
-#ifdef QCOM_EXT
- OMX_QCOM_PARAM_PORTDEFINITIONTYPE qPortDefnType;
-#endif
-
- portdef.nPortIndex = (OMX_U32) 0; // input
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamPortDefinition,
- &portdef);
- E("\n OMX_IndexParamPortDefinition Get Paramter on input port");
- CHK(result);
- portdef.format.video.nFrameWidth = m_sProfile.nFrameWidth;
- portdef.format.video.nFrameHeight = m_sProfile.nFrameHeight;
-
- E ("\n Height %d width %d bit rate %d",portdef.format.video.nFrameHeight
- ,portdef.format.video.nFrameWidth,portdef.format.video.nBitrate);
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamPortDefinition,
- &portdef);
- E("\n OMX_IndexParamPortDefinition Set Paramter on input port");
- CHK(result);
- portdef.nPortIndex = (OMX_U32) 1; // output
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamPortDefinition,
- &portdef);
- E("\n OMX_IndexParamPortDefinition Get Paramter on output port");
- CHK(result);
- portdef.format.video.nFrameWidth = m_sProfile.nFrameWidth;
- portdef.format.video.nFrameHeight = m_sProfile.nFrameHeight;
- portdef.format.video.nBitrate = m_sProfile.nBitrate;
- portdef.format.video.xFramerate = m_sProfile.nFramerate << 16;
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamPortDefinition,
- &portdef);
- E("\n OMX_IndexParamPortDefinition Set Paramter on output port");
- CHK(result);
-
-#ifdef QCOM_EXT
-
-qPortDefnType.nPortIndex = PORT_INDEX_IN;
-qPortDefnType.nMemRegion = OMX_QCOM_MemRegionEBI1;
-qPortDefnType.nSize = sizeof(OMX_QCOM_PARAM_PORTDEFINITIONTYPE);
-
-result = OMX_SetParameter(m_hHandle,
- (OMX_INDEXTYPE)OMX_QcomIndexPortDefn,
- &qPortDefnType);
-
-#endif
- //validate the ht,width,fps,bitrate and set the appropriate profile and level
- if(m_sProfile.eCodec == OMX_VIDEO_CodingMPEG4)
- {
- profile_tbl = (unsigned int const *)mpeg4_profile_level_table;
- }
- else if(m_sProfile.eCodec == OMX_VIDEO_CodingAVC)
- {
- profile_tbl = (unsigned int const *)h264_profile_level_table;
- }
- else if(m_sProfile.eCodec == OMX_VIDEO_CodingH263)
- {
- profile_tbl = (unsigned int const *)h263_profile_level_table;
- }
-
- mb_per_frame = ((m_sProfile.nFrameHeight+15)>>4)*
- ((m_sProfile.nFrameWidth+15)>>4);
-
- mb_per_sec = mb_per_frame*(m_sProfile.nFramerate);
-
- do{
- if(mb_per_frame <= (int)profile_tbl[0])
- {
- if(mb_per_sec <= (int)profile_tbl[1])
- {
- if(m_sProfile.nBitrate <= (int)profile_tbl[2])
- {
- eLevel = (int)profile_tbl[3];
- eProfile = (int)profile_tbl[4];
- E("\n profile and level found \n");
- profile_level_found = true;
- break;
- }
- }
- }
- profile_tbl = profile_tbl + 5;
- }while(profile_tbl[0] != 0);
-
- if ( profile_level_found != true )
- {
- E("\n Error: Unsupported profile/level\n");
- return OMX_ErrorNone;
- }
-
- if (m_sProfile.eCodec == OMX_VIDEO_CodingH263)
- {
- D("Configuring H263...");
-
- OMX_VIDEO_PARAM_H263TYPE h263;
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoH263,
- &h263);
- CHK(result);
- h263.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
- h263.nPFrames = m_sProfile.nFramerate * 2 - 1; // intra period
- h263.nBFrames = 0;
- h263.eProfile = (OMX_VIDEO_H263PROFILETYPE)eProfile;
- h263.eLevel = (OMX_VIDEO_H263LEVELTYPE)eLevel;
- h263.bPLUSPTYPEAllowed = OMX_FALSE;
- h263.nAllowedPictureTypes = 2;
- h263.bForceRoundingTypeToZero = OMX_TRUE; ///@todo determine what this should be
- h263.nPictureHeaderRepetition = 0; ///@todo determine what this should be
- h263.nGOBHeaderInterval = 0; ///@todo determine what this should be
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoH263,
- &h263);
- }
- else
- {
- D("Configuring MP4/H264...");
-
- OMX_VIDEO_PARAM_PROFILELEVELTYPE profileLevel; // OMX_IndexParamVideoProfileLevelCurrent
- profileLevel.eProfile = eProfile;
- profileLevel.eLevel = eLevel;
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoProfileLevelCurrent,
- &profileLevel);
- E("\n OMX_IndexParamVideoProfileLevelCurrent Set Paramter port");
- CHK(result);
- //profileLevel.eLevel = (OMX_U32) m_sProfile.eLevel;
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoProfileLevelCurrent,
- &profileLevel);
- E("\n OMX_IndexParamVideoProfileLevelCurrent Get Paramter port");
- D ("\n Profile = %d level = %d",profileLevel.eProfile,profileLevel.eLevel);
- CHK(result);
-
- /*OMX_VIDEO_PARAM_MPEG4TYPE mp4;
-
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoMpeg4,
- &mp4);
- E("\n OMX_IndexParamVideoMpeg4 Set Paramter port");
- CHK(result);
-
- mp4.nTimeIncRes = m_sProfile.nFramerate * 2;
- mp4.nPFrames = mp4.nTimeIncRes - 1; // intra period
-
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoMpeg4,
- &mp4);
- CHK(result);*/
-
-// OMX_VIDEO_PARAM_MPEG4TYPE mp4; // OMX_IndexParamVideoMpeg4
-// result = OMX_GetParameter(m_hHandle,
-// OMX_IndexParamVideoMpeg4,
-// &mp4);
-// CHK(result);
-// mp4.nPortIndex = (OMX_U32) PORT_INDEX_OUT;
-// mp4.eProfile = OMX_VIDEO_MPEG4ProfileSimple;
-// mp4.eLevel = m_sProfile.eLevel;
-// mp4.nSliceHeaderSpacing = 0;
-// mp4.bSVH = OMX_FALSE;
-// mp4.bGov = OMX_FALSE;
-// mp4.nPFrames = m_sProfile.nFramerate * 2 - 1; // intra period
-// mp4.bACPred = OMX_TRUE;
-// mp4.nTimeIncRes = m_sProfile.nFramerate * 2; // delta = 2 @ 15 fps
-// mp4.nAllowedPictureTypes = 2; // pframe and iframe
-// result = OMX_SetParameter(m_hHandle,
-// OMX_IndexParamVideoMpeg4,
-// &mp4);
-// CHK(result);
- }
-
- if (m_sProfile.eCodec == OMX_VIDEO_CodingAVC)
- {
- OMX_VIDEO_PARAM_AVCSLICEFMO avcslicefmo;
- avcslicefmo.nPortIndex = (OMX_U32)PORT_INDEX_OUT;
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoSliceFMO,
- &avcslicefmo);
- E("\n OMX_IndexParamVideoSliceFMO Get Paramter port");
- CHK(result);
-
- avcslicefmo.eSliceMode = m_sProfile.eSliceMode;
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoSliceFMO,
- &avcslicefmo);
- E("\n OMX_IndexParamVideoSliceFMO Set Paramter port");
- CHK(result);
- }
-
- OMX_VIDEO_PARAM_BITRATETYPE bitrate; // OMX_IndexParamVideoBitrate
- bitrate.nPortIndex = (OMX_U32)PORT_INDEX_OUT;
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoBitrate,
- &bitrate);
- E("\n OMX_IndexParamVideoBitrate Get Paramter port");
- CHK(result);
- bitrate.eControlRate = m_sProfile.eControlRate;
- bitrate.nTargetBitrate = m_sProfile.nBitrate;
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoBitrate,
- &bitrate);
- E("\n OMX_IndexParamVideoBitrate Set Paramter port");
- CHK(result);
-
- OMX_VIDEO_PARAM_PORTFORMATTYPE framerate; // OMX_IndexParamVidePortFormat
- framerate.nPortIndex = 0;
- result = OMX_GetParameter(m_hHandle,
- OMX_IndexParamVideoPortFormat,
- &framerate);
- E("\n OMX_IndexParamVideoPortFormat Get Paramter port");
- CHK(result);
- framerate.xFramerate = m_sProfile.nFramerate << 16;
- result = OMX_SetParameter(m_hHandle,
- OMX_IndexParamVideoPortFormat,
- &framerate);
- E("\n OMX_IndexParamVideoPortFormat Set Paramter port");
- CHK(result);
-
-#if 1
- OMX_CONFIG_FRAMERATETYPE enc_framerate; // OMX_IndexConfigVideoFramerate
- enc_framerate.nPortIndex = (OMX_U32)PORT_INDEX_OUT;
- result = OMX_GetConfig(m_hHandle,
- OMX_IndexConfigVideoFramerate,
- &enc_framerate);
- E("\n OMX_IndexConfigVideoFramerate Get config port");
- CHK(result);
- enc_framerate.xEncodeFramerate = m_sProfile.nFramerate << 16;
- result = OMX_SetConfig(m_hHandle,
- OMX_IndexConfigVideoFramerate,
- &enc_framerate);
- E("\n OMX_IndexConfigVideoFramerate Set config port");
- CHK(result);
-#endif
- return OMX_ErrorNone;
-}
-////////////////////////////////////////////////////////////////////////////////
-void SendMessage(MsgId id, MsgData* data)
-{
- pthread_mutex_lock(&m_mutex);
- if (m_sMsgQ.size >= MAX_MSG)
- {
- E("main msg m_sMsgQ is full");
- return;
- }
- m_sMsgQ.q[(m_sMsgQ.head + m_sMsgQ.size) % MAX_MSG].id = id;
- if (data)
- m_sMsgQ.q[(m_sMsgQ.head + m_sMsgQ.size) % MAX_MSG].data = *data;
- ++m_sMsgQ.size;
- pthread_cond_signal(&m_signal);
- pthread_mutex_unlock(&m_mutex);
-}
-////////////////////////////////////////////////////////////////////////////////
-void PopMessage(Msg* msg)
-{
- pthread_mutex_lock(&m_mutex);
- while (m_sMsgQ.size == 0)
- {
- pthread_cond_wait(&m_signal, &m_mutex);
- }
- *msg = m_sMsgQ.q[m_sMsgQ.head];
- --m_sMsgQ.size;
- m_sMsgQ.head = (m_sMsgQ.head + 1) % MAX_MSG;
- pthread_mutex_unlock(&m_mutex);
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE EVT_CB(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_EVENTTYPE eEvent,
- OMX_IN OMX_U32 nData1,
- OMX_IN OMX_U32 nData2,
- OMX_IN OMX_PTR pEventData)
-{
-#define SET_STATE(eState) \
- case eState: \
- { \
- D("" # eState " complete"); \
- m_eState = eState; \
- break; \
- }
-
- if (eEvent == OMX_EventCmdComplete)
- {
- if ((OMX_COMMANDTYPE) nData1 == OMX_CommandStateSet)
- {
- switch ((OMX_STATETYPE) nData2)
- {
- SET_STATE(OMX_StateLoaded);
- SET_STATE(OMX_StateIdle);
- SET_STATE(OMX_StateExecuting);
- SET_STATE(OMX_StateInvalid);
- SET_STATE(OMX_StateWaitForResources);
- SET_STATE(OMX_StatePause);
- default:
- E("invalid state %d", (int) nData2);
- }
- }
- }
-
- else if (eEvent == OMX_EventError)
- {
- E("OMX_EventError");
- }
-
- else
- {
- E("unexpected event %d", (int) eEvent);
- }
- return OMX_ErrorNone;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE EBD_CB(OMX_IN OMX_HANDLETYPE hComponent,
- OMX_IN OMX_PTR pAppData,
- OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
-{
- D("Got EBD callback ts=%lld", pBuffer->nTimeStamp);
-
- for (int i = 0; i < num_in_buffers; i++)
- {
- // mark this buffer ready for use again
- if (m_pInBuffers[i] == pBuffer)
- {
-
- D("Marked input buffer idx %d as free, buf %p", i, pBuffer->pBuffer);
- m_bInFrameFree[i] = OMX_TRUE;
- break;
- }
- }
-
- if (m_eMode == MODE_LIVE_ENCODE)
- {
- CameraTest_ReleaseFrame(pBuffer->pBuffer,
- ((OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO*)pBuffer->pAppPrivate));
- }
- else
- {
- // wake up main thread and tell it to send next frame
- MsgData data;
- data.sBitstreamData.pBuffer = pBuffer;
- SendMessage(MSG_ID_INPUT_FRAME_DONE,
- &data);
-
- }
- return OMX_ErrorNone;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE FBD_CB(OMX_OUT OMX_HANDLETYPE hComponent,
- OMX_OUT OMX_PTR pAppData,
- OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer)
-{
- D("Got FBD callback ts=%lld", pBuffer->nTimeStamp);
-
- static long long prevTime = 0;
- long long currTime = GetTimeStamp();
-
- m_bWatchDogKicked = true;
-
- /* Empty Buffers should not be counted */
- if(pBuffer->nFilledLen !=0)
- {
- /* Counting Buffers supplied from OpneMax Encoder */
- fbd_cnt++;
- tot_bufsize += pBuffer->nFilledLen;
- }
- if (prevTime != 0)
- {
- long long currTime = GetTimeStamp();
- D("FBD_DELTA = %lld\n", currTime - prevTime);
- }
- prevTime = currTime;
-
- if (m_eMode == MODE_PROFILE)
- {
- // if we are profiling we are not doing file I/O
- // so just give back to encoder
- if (OMX_FillThisBuffer(m_hHandle, pBuffer) != OMX_ErrorNone)
- {
- E("empty buffer failed for profiling");
- }
- }
- else
- {
- // wake up main thread and tell it to write to file
- MsgData data;
- data.sBitstreamData.pBuffer = pBuffer;
- SendMessage(MSG_ID_OUTPUT_FRAME_DONE,
- &data);
- }
- return OMX_ErrorNone;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE VencTest_Initialize()
-{
- OMX_ERRORTYPE result = OMX_ErrorNone;
- static OMX_CALLBACKTYPE sCallbacks = {EVT_CB, EBD_CB, FBD_CB};
- int i;
-
- for (i = 0; i < num_in_buffers; i++)
- {
- m_pInBuffers[i] = NULL;
- }
-
- result = OMX_Init();
- CHK(result);
-
- if (m_sProfile.eCodec == OMX_VIDEO_CodingMPEG4)
- {
- result = OMX_GetHandle(&m_hHandle,
- "OMX.qcom.video.encoder.mpeg4",
- NULL,
- &sCallbacks);
- // CHK(result);
- }
- else if (m_sProfile.eCodec == OMX_VIDEO_CodingH263)
- {
- result = OMX_GetHandle(&m_hHandle,
- "OMX.qcom.video.encoder.h263",
- NULL,
- &sCallbacks);
- CHK(result);
- }
- else
- {
- result = OMX_GetHandle(&m_hHandle,
- "OMX.qcom.video.encoder.avc",
- NULL,
- &sCallbacks);
- CHK(result);
- }
-
-
- result = ConfigureEncoder();
- CHK(result);
-
- return result;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE VencTest_RegisterYUVBuffer(OMX_BUFFERHEADERTYPE** ppBufferHeader,
- OMX_U8 *pBuffer,
- OMX_PTR pAppPrivate)
-{
- OMX_ERRORTYPE result = OMX_ErrorNone;
-#if 0
- D("register buffer");
- if ((result = OMX_AllocateBuffer(m_hHandle,
- ppBufferHeader,
- (OMX_U32) PORT_INDEX_IN,
- pAppPrivate,
- m_sProfile.nFrameBytes
- )) != OMX_ErrorNone)
- {
- E("use buffer failed");
- }
- else
- {
- E("Allocate Buffer Success %x", (*ppBufferHeader)->pBuffer);
- }
- #endif
- D("register buffer");
- D("Calling UseBuffer for Input port");
- if ((result = OMX_UseBuffer(m_hHandle,
- ppBufferHeader,
- (OMX_U32) PORT_INDEX_IN,
- pAppPrivate,
- m_sProfile.nFrameBytes,
- pBuffer)) != OMX_ErrorNone)
- {
- E("use buffer failed");
- }
-
- return result;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE VencTest_EncodeFrame(void* pYUVBuff,
- long long nTimeStamp)
-{
- OMX_ERRORTYPE result = OMX_ErrorUndefined;
- D("calling OMX empty this buffer");
- for (int i = 0; i < num_in_buffers; i++)
- {
- if (pYUVBuff == m_pInBuffers[i]->pBuffer)
- {
- m_pInBuffers[i]->nTimeStamp = nTimeStamp;
- D("Sending Buffer - %x", m_pInBuffers[i]->pBuffer);
- result = OMX_EmptyThisBuffer(m_hHandle,
- m_pInBuffers[i]);
- /* Counting Buffers supplied to OpenMax Encoder */
- if(OMX_ErrorNone == result)
- ebd_cnt++;
- CHK(result);
- break;
- }
- }
- return result;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE VencTest_Exit(void)
-{
- int i;
- OMX_ERRORTYPE result = OMX_ErrorNone;
- D("trying to exit venc");
-
- D("going to idle state");
- SetState(OMX_StateIdle);
-
-
- D("going to loaded state");
- //SetState(OMX_StateLoaded);
- OMX_SendCommand(m_hHandle,
- OMX_CommandStateSet,
- (OMX_U32) OMX_StateLoaded,
- NULL);
-
- for (i = 0; i < num_in_buffers; i++)
- {
- D("free buffer");
- if (m_pInBuffers[i]->pBuffer)
- {
- // free(m_pInBuffers[i]->pBuffer);
- result = OMX_FreeBuffer(m_hHandle,
- PORT_INDEX_IN,
- m_pInBuffers[i]);
- CHK(result);
- }
- else
- {
- E("buffer %d is null", i);
- result = OMX_ErrorUndefined;
- CHK(result);
- }
- }
- for (i = 0; i < num_out_buffers; i++)
- {
- D("free buffer");
- if (m_pOutBuffers[i]->pBuffer)
- {
- free(m_pOutBuffers[i]->pBuffer);
- result = OMX_FreeBuffer(m_hHandle,
- PORT_INDEX_OUT,
- m_pOutBuffers[i]);
- CHK(result);
-
- }
- else
- {
- E("buffer %d is null", i);
- result = OMX_ErrorUndefined;
- CHK(result);
- }
- }
-
- while (m_eState != OMX_StateLoaded)
- {
- sleep(1);
- }
- D("component_deinit...");
- result = OMX_Deinit();
- CHK(result);
-
- D("venc is exiting...");
- return result;
-}
-////////////////////////////////////////////////////////////////////////////////
-OMX_ERRORTYPE VencTest_ReadAndEmpty(OMX_BUFFERHEADERTYPE* pYUVBuffer)
-{
- OMX_ERRORTYPE result = OMX_ErrorNone;
-#ifdef T_ARM
- if (read(m_nInFd,
- pYUVBuffer->pBuffer,
- m_sProfile.nFrameBytes) != m_sProfile.nFrameBytes)
- {
- return OMX_ErrorUndefined;
- }
-#else
- {
- char * pInputbuf = (char *)(pYUVBuffer->pBuffer) ;
- read(m_nInFd,pInputbuf,m_sProfile.nFrameBytes) ;
-
- }
-#endif
- D("about to call VencTest_EncodeFrame...");
- pthread_mutex_lock(&m_mutex);
- ++m_nFrameIn;
- pYUVBuffer->nFilledLen = m_sProfile.nFrameBytes;
- D("Called Buffer with Data filled length %d",pYUVBuffer->nFilledLen);
-
- result = VencTest_EncodeFrame(pYUVBuffer->pBuffer,
- m_nTimeStamp);
-
- m_nTimeStamp += (1000000) / m_sProfile.nFramerate;
- CHK(result);
- pthread_mutex_unlock(&m_mutex);
- return result;
-}
-////////////////////////////////////////////////////////////////////////////////
-void PreviewCallback(int nFD,
- int nOffset,
- void* pPhys,
- void* pVirt,
- long long nTimeStamp)
-{
-
- D("================= preview frame %d, phys=0x%x, nTimeStamp(millis)=%lld",
- m_nFrameIn+1, pPhys, (nTimeStamp / 1000));
-
- if (m_nFrameIn == m_nFramePlay &&
- m_nFramePlay != 0)
- {
- // we will stop camera after last frame is encoded.
- // for now just ignore input frames
-
- CameraTest_ReleaseFrame(pPhys, pVirt);
- return;
- }
-
- // see if we should stop
- pthread_mutex_lock(&m_mutex);
- ++m_nFrameIn;
- pthread_mutex_unlock(&m_mutex);
-
-
- if (m_eMode == MODE_LIVE_ENCODE)
- {
-
- OMX_ERRORTYPE result;
-
- // register new camera buffers with encoder
- int i;
- for (i = 0; i < num_in_buffers; i++)
- {
- if (m_pInBuffers[i] != NULL &&
- m_pInBuffers[i]->pBuffer == pPhys)
- {
- break;
- }
- else if (m_pInBuffers[i] == NULL)
- {
- D("registering buffer...");
- result = VencTest_RegisterYUVBuffer(&m_pInBuffers[i],
- (OMX_U8*) pPhys,
- (OMX_PTR) pVirt); // store virt in app private field
- D("register done");
- CHK(result);
- break;
- }
- }
-
- if (i == num_in_buffers)
- {
- E("There are more camera buffers than we thought");
- CHK(1);
- }
-
- // encode the yuv frame
-
- D("StartEncodeTime=%lld", GetTimeStamp());
- result = VencTest_EncodeFrame(pPhys,
- nTimeStamp);
- CHK(result);
- // FBTest_DisplayImage(nFD, nOffset);
- }
- else
- {
- // FBTest_DisplayImage(nFD, nOffset);
- CameraTest_ReleaseFrame(pPhys, pVirt);
- }
-}
-////////////////////////////////////////////////////////////////////////////////
-void usage(char* filename)
-{
- char* fname = strrchr(filename, (int) '/');
- fname = (fname == NULL) ? filename : fname;
-
- fprintf(stderr, "usage: %s LIVE <QCIF|QVGA> <MP4|H263> <FPS> <BITRATE> <NFRAMES> <OUTFILE>\n", fname);
- fprintf(stderr, "usage: %s FILE <QCIF|QVGA> <MP4|H263 <FPS> <BITRATE> <NFRAMES> <INFILE> <OUTFILE> ", fname);
- fprintf(stderr, "<Rate Control - optional> <AVC Slice Mode - optional\n", fname);
- fprintf(stderr, "usage: %s PROFILE <QCIF|QVGA> <MP4|H263 <FPS> <BITRATE> <NFRAMES> <INFILE>\n", fname);
- fprintf(stderr, "usage: %s PREVIEW <QCIF|QVGA> <FPS> <NFRAMES>\n", fname);
- fprintf(stderr, "usage: %s DISPLAY <QCIF|QVGA> <FPS> <NFRAMES> <INFILE>\n", fname);
- fprintf(stderr, "\n BITRATE - bitrate in kbps\n");
- fprintf(stderr, " FPS - frames per second\n");
- fprintf(stderr, " NFRAMES - number of frames to play, 0 for infinite\n");
- fprintf(stderr, " RateControl (Values 0 - 4 for RC_OFF, RC_CBR_CFR, RC_CBR_VFR, RC_VBR_CFR, RC_VBR_VFR\n");
- exit(1);
-}
-////////////////////////////////////////////////////////////////////////////////
-void parseArgs(int argc, char** argv)
-{
-
- if (argc == 1)
- {
- usage(argv[0]);
- }
- else if (strcmp("PREVIEW", argv[1]) == 0 ||
- strcmp("preview", argv[1]) == 0)
- {
- m_eMode = MODE_PREVIEW;
- if (argc != 5)
- {
- usage(argv[0]);
- }
- }
- else if (strcmp("DISPLAY", argv[1]) == 0 ||
- strcmp("display", argv[1]) == 0)
- {
- m_eMode = MODE_DISPLAY;
- if (argc != 6)
- {
- usage(argv[0]);
- }
- m_sProfile.cInFileName = argv[5];
- m_sProfile.cOutFileName = NULL;
- }
- else if (strcmp("LIVE", argv[1]) == 0 ||
- strcmp("live", argv[1]) == 0)
- {//263
- m_eMode = MODE_LIVE_ENCODE;
- if (argc != 8)
- {
- usage(argv[0]);
- }
- m_sProfile.cInFileName = NULL;
- m_sProfile.cOutFileName = argv[7];
- }
- else if (strcmp("FILE", argv[1]) == 0 ||
- strcmp("file", argv[1]) == 0)
- {//263
- m_eMode = MODE_FILE_ENCODE;
-
- if(argc < 9 || argc > 11)
- {
- usage(argv[0]);
- }
- else
- {
- if ((argc == 10))
- {
- m_sProfile.eControlRate = OMX_Video_ControlRateVariable;
- int RC = atoi(argv[9]);
-
- switch (RC)
- {
- case 0:
- m_sProfile.eControlRate = OMX_Video_ControlRateDisable ;//VENC_RC_NONE
- break;
- case 1:
- m_sProfile.eControlRate = OMX_Video_ControlRateConstant;//VENC_RC_CBR_CFR
- break;
-
- case 2:
- m_sProfile.eControlRate = OMX_Video_ControlRateConstantSkipFrames;//VENC_RC_CBR_VFR
- break;
-
- case 3:
- m_sProfile.eControlRate =OMX_Video_ControlRateVariable ;//VENC_RC_VBR_CFR
- break;
-
- case 4:
- m_sProfile.eControlRate = OMX_Video_ControlRateVariableSkipFrames;//VENC_RC_VBR_VFR
- break;
-
- default:
- E("invalid rate control selection");
- m_sProfile.eControlRate = OMX_Video_ControlRateVariable; //VENC_RC_VBR_CFR
- break;
- }
- }
-
- if (argc == 11)
- {
- if(!strcmp(argv[3], "H264") || !strcmp(argv[3], "h264"))
- {
- E("\nSetting AVCSliceMode ... ");
- int AVCSliceMode = atoi(argv[10]);
- switch(AVCSliceMode)
- {
- case 0:
- m_sProfile.eSliceMode = OMX_VIDEO_SLICEMODE_AVCDefault;
- break;
-
- case 1:
- m_sProfile.eSliceMode = OMX_VIDEO_SLICEMODE_AVCMBSlice;
- break;
-
- case 2:
- m_sProfile.eSliceMode = OMX_VIDEO_SLICEMODE_AVCByteSlice;
- break;
-
- default:
- E("invalid Slice Mode");
- m_sProfile.eSliceMode = OMX_VIDEO_SLICEMODE_AVCDefault;
- break;
- }
- }
- else
- {
- E("SliceMode support only for H.264 codec");
- usage(argv[0]);
- }
- }
- }
- m_sProfile.cInFileName = argv[7];
- m_sProfile.cOutFileName = argv[8];
- }
- else if (strcmp("PROFILE", argv[1]) == 0 ||
- strcmp("profile", argv[1]) == 0)
- {//263
- m_eMode = MODE_PROFILE;
- if (argc != 8)
- {
- usage(argv[0]);
- }
- m_sProfile.cInFileName = argv[7];
- m_sProfile.cOutFileName = NULL;
- }
- else
- {
- usage(argv[0]);
- }
-
-
- if (strcmp("QCIF", argv[2]) == 0 ||
- strcmp("qcif", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 176;
- m_sProfile.nFrameHeight = 144;
- m_sProfile.nFrameBytes = 176*144*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level0;
- }
- else if (strcmp("QVGA", argv[2]) == 0 ||
- strcmp("qvga", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 320;
- m_sProfile.nFrameHeight = 240;
- m_sProfile.nFrameBytes = 320*240*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level1;
- }
-
-
- else if (strcmp("VGA", argv[2]) == 0 ||
- strcmp("vga", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 640;
- m_sProfile.nFrameHeight = 480;
- m_sProfile.nFrameBytes = 640*480*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level1;
- }
-
- else if (strcmp("WVGA", argv[2]) == 0 ||
- strcmp("wvga", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 800;
- m_sProfile.nFrameHeight = 480;
- m_sProfile.nFrameBytes = 800*480*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level1;
- }
- else if (strcmp("CIF", argv[2]) == 0 ||
- strcmp("CIF", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 352;
- m_sProfile.nFrameHeight = 288;
- m_sProfile.nFrameBytes = 352*288*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level1;
- }
- else if (strcmp("720", argv[2]) == 0 ||
- strcmp("720", argv[2]) == 0)
- {
- m_sProfile.nFrameWidth = 1280;
- m_sProfile.nFrameHeight = 720;
- m_sProfile.nFrameBytes = 720*1280*3/2;
- m_sProfile.eLevel = OMX_VIDEO_MPEG4Level1;
- }
- else
- {
- usage(argv[0]);
- }
-
- if (m_eMode == MODE_DISPLAY ||
- m_eMode == MODE_PREVIEW)
- {
- m_sProfile.nFramerate = atoi(argv[3]);
- m_nFramePlay = atoi(argv[4]);
-
- }
- else if (m_eMode == MODE_LIVE_ENCODE ||
- m_eMode == MODE_FILE_ENCODE ||
- m_eMode == MODE_PROFILE)
- {//263
- if ((!strcmp(argv[3], "MP4")) || (!strcmp(argv[3], "mp4")))
- {
- m_sProfile.eCodec = OMX_VIDEO_CodingMPEG4;
- }
- else if ((!strcmp(argv[3], "H263")) || (!strcmp(argv[3], "h263")))
- {
- m_sProfile.eCodec = OMX_VIDEO_CodingH263;
- }
- else if ((!strcmp(argv[3], "H264")) || (!strcmp(argv[3], "h264")))
- {
- m_sProfile.eCodec = OMX_VIDEO_CodingAVC;
- }
- else
- {
- usage(argv[0]);
- }
-
- m_sProfile.nFramerate = atoi(argv[4]);
- m_sProfile.nBitrate = atoi(argv[5]);
-// m_sProfile.eControlRate = OMX_Video_ControlRateVariable;
- m_nFramePlay = atoi(argv[6]);
- }
-}
-
-
-void* Watchdog(void* data)
-{
- while (1)
- {
- sleep(1000);
- if (m_bWatchDogKicked == true)
- m_bWatchDogKicked = false;
- else
- E("watchdog has not been kicked. we may have a deadlock");
- }
- return NULL;
-}
-
-int main(int argc, char** argv)
-{
- OMX_U8* pvirt = NULL;
- int result;
- float enc_time_sec=0.0,enc_time_usec=0.0;
-
- m_nInFd = -1;
- m_nOutFd = -1;
- m_nTimeStamp = 0;
- m_nFrameIn = 0;
- m_nFrameOut = 0;
-
- memset(&m_sMsgQ, 0, sizeof(MsgQ));
- parseArgs(argc, argv);
-
- D("fps=%d, bitrate=%d, width=%d, height=%d",
- m_sProfile.nFramerate,
- m_sProfile.nBitrate,
- m_sProfile.nFrameWidth,
- m_sProfile.nFrameHeight);
-
-
- //if (m_eMode != MODE_PREVIEW && m_eMode != MODE_DISPLAY)
- //{
- // pthread_t wd;
- // pthread_create(&wd, NULL, Watchdog, NULL);
- //}
-
- for (int x = 0; x < num_in_buffers; x++)
- {
- // mark all buffers as ready to use
- m_bInFrameFree[x] = OMX_TRUE;
- }
-
-
- if (m_eMode != MODE_PROFILE)
- {
- #if T_ARM
- m_nOutFd = open(m_sProfile.cOutFileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
- #else
- m_nOutFd = open(m_sProfile.cOutFileName,0);
- #endif
- if (m_nOutFd < 0)
- {
- E("could not open output file %s", m_sProfile.cOutFileName);
- CHK(1);
- }
- }
-
- pthread_mutex_init(&m_mutex, NULL);
- pthread_cond_init(&m_signal, NULL);
-
- if (m_eMode != MODE_PREVIEW)
- {
- VencTest_Initialize();
- }
-
- ////////////////////////////////////////
- // Camera + Encode
- ////////////////////////////////////////
- if (m_eMode == MODE_LIVE_ENCODE)
- {
- CameraTest_Initialize(m_sProfile.nFramerate,
- m_sProfile.nFrameWidth,
- m_sProfile.nFrameHeight,
- PreviewCallback);
- CameraTest_Run();
- }
-
- if (m_eMode == MODE_FILE_ENCODE ||
- m_eMode == MODE_PROFILE)
- {
- int i;
- #if T_ARM
- m_nInFd = open(m_sProfile.cInFileName, O_RDONLY);
- #else
- m_nInFd = open(m_sProfile.cInFileName,1);
- #endif
- if (m_nInFd < 0)
- {
- E("could not open input file");
- CHK(1);
- }
- D("going to idle state");
- //SetState(OMX_StateIdle);
- OMX_SendCommand(m_hHandle,
- OMX_CommandStateSet,
- (OMX_U32) OMX_StateIdle,
- NULL);
-
- OMX_PARAM_PORTDEFINITIONTYPE portDef;
-
- portDef.nPortIndex = 0;
- result = OMX_GetParameter(m_hHandle, OMX_IndexParamPortDefinition, &portDef);
- CHK(result);
-
- D("allocating output buffers");
-
- D("allocating Input buffers");
- num_in_buffers = portDef.nBufferCountActual;
- for (i = 0; i < portDef.nBufferCountActual; i++)
- {
- OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO* pMem = new OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO;
- pvirt = (OMX_U8*)PmemMalloc(pMem, m_sProfile.nFrameBytes);
-
- if(pvirt == NULL)
- {
- CHK(1);
- }
- result = VencTest_RegisterYUVBuffer(&m_pInBuffers[i],
- (OMX_U8*) pvirt,
- (OMX_PTR) pMem);
- CHK(result);
- }
- }
- else if (m_eMode == MODE_LIVE_ENCODE)
- {
- D("going to idle state");
- //SetState(OMX_StateIdle);
- OMX_SendCommand(m_hHandle,
- OMX_CommandStateSet,
- (OMX_U32) OMX_StateIdle,
- NULL);
- }
-
- int i;
- OMX_PARAM_PORTDEFINITIONTYPE portDef;
-
- portDef.nPortIndex = 1;
- result = OMX_GetParameter(m_hHandle, OMX_IndexParamPortDefinition, &portDef);
- CHK(result);
-
- D("allocating output buffers");
- D("Calling UseBuffer for Output port");
- num_out_buffers = portDef.nBufferCountActual;
- for (i = 0; i < portDef.nBufferCountActual; i++)
- {
- void* pBuff;
-
- pBuff = malloc(portDef.nBufferSize);
- D("portDef.nBufferSize = %d ",portDef.nBufferSize);
- result = OMX_UseBuffer(m_hHandle,
- &m_pOutBuffers[i],
- (OMX_U32) PORT_INDEX_OUT,
- NULL,
- portDef.nBufferSize,
- (OMX_U8*) pBuff);
- CHK(result);
- }
- D("allocate done");
-
- // D("Going to state " # eState"...");
-
- while (m_eState != OMX_StateIdle)
- {
- sleep(1);
- }
- //D("Now in state " # eState);
-
-
- D("going to executing state");
- SetState(OMX_StateExecuting);
-
- for (i = 0; i < num_out_buffers; i++)
- {
- D("filling buffer %d", i);
- result = OMX_FillThisBuffer(m_hHandle, m_pOutBuffers[i]);
- //sleep(1000);
- CHK(result);
- }
-
- if (m_eMode == MODE_FILE_ENCODE)
- {
- // encode the first frame to kick off the whole process
- VencTest_ReadAndEmpty(m_pInBuffers[0]);
- // FBTest_DisplayImage(((PmemBuffer*) m_pInBuffers[0]->pAppPrivate)->fd,0);
- }
-
- if (m_eMode == MODE_PROFILE)
- {
- int i;
-
- // read several frames into memory
- D("reading frames into memory");
- for (i = 0; i < num_in_buffers; i++)
- {
- D("[%d] address 0x%x",i, m_pInBuffers[i]->pBuffer);
- read(m_nInFd,
- m_pInBuffers[i]->pBuffer,
- m_sProfile.nFrameBytes);
-
- }
-
- // FBTest_Initialize(m_sProfile.nFrameWidth, m_sProfile.nFrameHeight);
-
- // loop over the mem-resident frames and encode them
- D("beging playing mem-resident frames...");
- for (i = 0; m_nFramePlay == 0 || i < m_nFramePlay; i++)
- {
- int idx = i % num_in_buffers;
- if (m_bInFrameFree[idx] == OMX_FALSE)
- {
- int j;
- E("the expected buffer is not free, but lets find another");
-
- idx = -1;
-
- // lets see if we can find another free buffer
- for (j = 0; j < num_in_buffers; j++)
- {
- if(m_bInFrameFree[j])
- {
- idx = j;
- break;
- }
- }
- }
-
- // if we have a free buffer let's encode it
- if (idx >= 0)
- {
- D("encode frame %d...m_pInBuffers[idx]->pBuffer=0x%x", i,m_pInBuffers[idx]->pBuffer);
- m_bInFrameFree[idx] = OMX_FALSE;
- VencTest_EncodeFrame(m_pInBuffers[idx]->pBuffer,
- m_nTimeStamp);
- D("display frame %d...", i);
- // FBTest_DisplayImage(((PmemBuffer*) m_pInBuffers[idx]->pAppPrivate)->fd,0);
- m_nTimeStamp += 1000000 / m_sProfile.nFramerate;
- }
- else
- {
- E("wow, no buffers are free, performance "
- "is not so good. lets just sleep some more");
-
- }
- D("sleep for %d microsec", 1000000/m_sProfile.nFramerate);
- sleep (1000000 / m_sProfile.nFramerate);
- }
- // FBTest_Exit();
- }
-
- Msg msg;
- bool bQuit = false;
- while ((m_eMode == MODE_FILE_ENCODE || m_eMode == MODE_LIVE_ENCODE) &&
- !bQuit)
- {
- PopMessage(&msg);
- switch (msg.id)
- {
- //////////////////////////////////
- // FRAME IS ENCODED
- //////////////////////////////////
- case MSG_ID_INPUT_FRAME_DONE:
- /*pthread_mutex_lock(&m_mutex);
- ++m_nFrameOut;
- if (m_nFrameOut == m_nFramePlay && m_nFramePlay != 0)
- {
- bQuit = true;
- }
- pthread_mutex_unlock(&m_mutex);*/
-
- if (!bQuit && m_eMode == MODE_FILE_ENCODE)
- {
- D("pushing another frame down to encoder");
- if (VencTest_ReadAndEmpty(msg.data.sBitstreamData.pBuffer))
- {
- // we have read the last frame
- D("main is exiting...");
- bQuit = true;
- }
- }
- break;
- case MSG_ID_OUTPUT_FRAME_DONE:
- D("================ writing frame %d = %d bytes to output file",
- m_nFrameOut+1,
- msg.data.sBitstreamData.pBuffer->nFilledLen);
- D("StopEncodeTime=%lld", GetTimeStamp());
-
-
- write(m_nOutFd,
- msg.data.sBitstreamData.pBuffer->pBuffer,
- msg.data.sBitstreamData.pBuffer->nFilledLen);
-
-
- result = OMX_FillThisBuffer(m_hHandle,
- msg.data.sBitstreamData.pBuffer);
-
- if (result != OMX_ErrorNone)
- {
- CHK(result);
- }
-
- pthread_mutex_lock(&m_mutex);
- ++m_nFrameOut;
- if (m_nFrameOut == m_nFramePlay && m_nFramePlay != 0)
- {
- bQuit = true;
- }
- pthread_mutex_unlock(&m_mutex);
- break;
-
- default:
- E("invalid msg id %d", (int) msg.id);
- } // end switch (msg.id)
- } // end while (!bQuit)
-
-
- if (m_eMode == MODE_LIVE_ENCODE)
- {
- CameraTest_Exit();
- close(m_nOutFd);
- }
- else if (m_eMode == MODE_FILE_ENCODE ||
- m_eMode == MODE_PROFILE)
- {
- // deallocate pmem buffers
- for (int i = 0; i < num_in_buffers; i++)
- {
- PmemFree((OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO*)m_pInBuffers[i]->pAppPrivate,
- m_pInBuffers[i]->pBuffer,
- m_sProfile.nFrameBytes);
- delete (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO*) m_pInBuffers[i]->pAppPrivate;
- }
- close(m_nInFd);
-
- if (m_eMode == MODE_FILE_ENCODE)
- {
- close(m_nOutFd);
- }
- }
-
- if (m_eMode != MODE_PREVIEW)
- {
- D("exit encoder test");
- VencTest_Exit();
- }
-
- pthread_mutex_destroy(&m_mutex);
- pthread_cond_destroy(&m_signal);
-
- /* Time Statistics Logging */
- if(0 != m_sProfile.nFramerate)
- {
- enc_time_usec = m_nTimeStamp - (1000000 / m_sProfile.nFramerate);
- enc_time_sec =enc_time_usec/1000000;
- if(0 != enc_time_sec)
- {
- printf("Total Frame Rate: %f",ebd_cnt/enc_time_sec);
- printf("\nEncoder Bitrate :%lf Kbps",(tot_bufsize*8)/(enc_time_sec*1000));
- }
- }
- else
- {
- printf("\n\n Encode Time is zero");
- }
- printf("\nTotal Number of Frames :%d",ebd_cnt);
- printf("\nNumber of dropped frames during encoding:%d\n",ebd_cnt-fbd_cnt);
- /* End of Time Statistics Logging */
-
- D("main has exited");
- return 0;
-}
diff --git a/mm-video/vidc/venc/test/venc_util.c b/mm-video/vidc/venc/test/venc_util.c
deleted file mode 100644
index 6e4364fc..00000000
--- a/mm-video/vidc/venc/test/venc_util.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-/*============================================================================
- V E N C _ U T I L. C
-
-DESCRIPTION
-
-
-REFERENCES
-
-============================================================================*/
-
-#include "venc_util.h"
-#include <time.h>
-#include <sys/time.h>
-
-long long GetTimeStamp()
-{
- struct timeval tv;
- long long microsec;
- gettimeofday(&tv, NULL);
- microsec = (tv.tv_sec * 1000000) + (tv.tv_usec);
- return microsec;
-
-}
-
diff --git a/mm-video/vidc/venc/test/video_encoder_test.c b/mm-video/vidc/venc/test/video_encoder_test.c
deleted file mode 100644
index 8ff49c05..00000000
--- a/mm-video/vidc/venc/test/video_encoder_test.c
+++ /dev/null
@@ -1,1065 +0,0 @@
-/*--------------------------------------------------------------------------
-Copyright (c) 2010, Code Aurora Forum. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of Code Aurora nor
- the names of its contributors may be used to endorse or promote
- products derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------*/
-#include "video_encoder_test.h"
-
-#define DEBUG_PRINT printf
-/************************************************************************/
-/* #DEFINES */
-/************************************************************************/
-
-#define VOP_START_CODE 0x000001B6
-#define SHORT_HEADER_START_CODE 0x00008000
-#define H264_START_CODE 0x00000001
-
-/************************************************************************/
-/* STATIC VARIABLES */
-/************************************************************************/
-
-static int Code_type;
-static int total_frames = 0;
-static unsigned int header_code = 0;
-static pthread_mutex_t read_lock;
-
-static unsigned int read_frame ( unsigned char *dataptr,unsigned int length,
- FILE * inputBufferFile
- );
-static unsigned clp2(unsigned x)
-{
- x = x - 1;
- x = x | (x >> 1);
- x = x | (x >> 2);
- x = x | (x >> 4);
- x = x | (x >> 8);
- x = x | (x >>16);
- return x + 1;
-}
-
-
-static void* video_thread (void *);
-static void* async_thread (void *);
-
-
-
-int main (int argc, char **argv)
-{
- struct video_encoder_context *encoder_context = NULL;
- char *file_name = NULL;
- FILE *file_ptr = NULL;
- int temp1 =0,temp2 =0;
- int error = 1;
- unsigned int i = 0;
-
- file_name = argv [1];
- file_ptr = fopen (file_name,"rb");
-
- if (file_ptr == NULL)
- {
- DEBUG_PRINT("\n File is not located ");
- return -1;
- }
-
-
- encoder_context = (struct video_encoder_context *) \
- calloc (sizeof (struct video_encoder_context),1);
-
- encoder_context->outputBufferFile = NULL;
- encoder_context->inputBufferFile = NULL;
- encoder_context->video_driver_fd = -1;
-
- if (encoder_context == NULL)
- {
- return -1;
- }
-
- encoder_context->inputBufferFile = file_ptr;
- encoder_context->input_width = 176;
- encoder_context->input_height = 144;
- encoder_context->codectype = VEN_CODEC_MPEG4;
- encoder_context->fps_num = 60;
- encoder_context->fps_den = 2;
- encoder_context->inputformat = VEN_INPUTFMT_NV12;
- encoder_context->targetbitrate = 128000;
-
- file_ptr = fopen ("/data/output.m4v","wb");
- if (file_ptr == NULL)
- {
- DEBUG_PRINT("\n File can't be created");
- return -1;
- }
- encoder_context->outputBufferFile = file_ptr;
-
- switch (atoi(argv[2]))
- {
- case 0:
- DEBUG_PRINT("\n MPEG4 codec selected");
- encoder_context->codectype = VEN_CODEC_MPEG4;
- Code_type = 0;
- break;
- case 1:
- DEBUG_PRINT("\n H.263");
- encoder_context->codectype = VEN_CODEC_H263;
- Code_type = 0;
- break;
- case 2:
- DEBUG_PRINT("\n H.264");
- encoder_context->codectype = VEN_CODEC_H264;
- Code_type = 1;
- break;
- default:
- DEBUG_PRINT("\n Wrong codec type");
- error = -1;
- break;
- }
-
- if (error != -1)
- {
- temp1 = atoi(argv[3]);
- temp2 = atoi(argv[4]);
-
- if (((temp1%16) != 0) || ((temp2%16) != 0))
- {
- error = -1;
- }
- else
- {
- encoder_context->input_width = temp1;
- encoder_context->input_height = temp2;
- }
- }
-
- switch (atoi(argv[5]))
- {
- case 0:
- DEBUG_PRINT("\n No Sink");
- encoder_context->outputBufferFile = NULL;
- break;
- }
-
- if (error != -1)
- {
- encoder_context->targetbitrate = atoi (argv[6]);
- }
-
- if ( error != -1 && (init_encoder (encoder_context) == -1 ))
- {
- DEBUG_PRINT("\n Init decoder fails ");
- error = -1;
- }
- DEBUG_PRINT("\n Decoder open successfull");
-
-
- /*Allocate input and output buffers*/
- if (error != -1 && (allocate_buffer (0,encoder_context)== -1))
- {
- DEBUG_PRINT("\n Error in input Buffer allocation");
- error = -1;
- }
-
- if (error != -1 && (allocate_buffer (1,encoder_context)== -1))
- {
- DEBUG_PRINT("\n Error in output Buffer allocation");
- error = -1;
- }
-
-
- if (error != -1 && (start_encoding (encoder_context) == -1))
- {
- DEBUG_PRINT("\n Error in start decoding call");
- error = -1;
- }
-
- if (error != -1 && (stop_encoding (encoder_context) == -1))
- {
- DEBUG_PRINT("\n Error in stop decoding call");
- error = -1;
- }
-
- DEBUG_PRINT("\n De-init the decoder");
- if ((deinit_encoder (encoder_context) == -1))
- {
- error = -1;
- }
-
-
- (void)free_buffer (INPUT_BUFFER,encoder_context);
- (void)free_buffer (OUTPUT_BUFFER,encoder_context);
-
- if (encoder_context->inputBufferFile != NULL)
- {
- fclose (encoder_context->inputBufferFile);
- }
- if (encoder_context->outputBufferFile != NULL)
- {
- fclose (encoder_context->outputBufferFile);
- }
- DEBUG_PRINT ("\n Total Number of frames decoded %d",total_frames);
- DEBUG_PRINT("\n closing the driver");
- free (encoder_context);
-
- return error;
-}
-
-int init_encoder ( struct video_encoder_context *init_decode )
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_basecfg basecfg;
- struct video_queue_context *queue_ptr = NULL;
- struct venc_ratectrlcfg ratecrl;
- pthread_mutexattr_t init_values;
- struct venc_profile profile;
- struct ven_profilelevel profilelevel;
-
- DEBUG_PRINT("\n Before calling the open");
-
- init_decode->video_driver_fd = open ("/dev/msm_vidc_enc", \
- O_RDWR | O_NONBLOCK);
-
-
-
- if (init_decode->video_driver_fd < 0)
- {
- DEBUG_PRINT("\n Open failed");
- return -1;
- }
-
- basecfg.codectype = init_decode->codectype;
- basecfg.dvs_height = 0;
- basecfg.dvs_width = 0;
- basecfg.fps_den = init_decode->fps_den;
- basecfg.fps_num = init_decode->fps_num;
- basecfg.input_height = init_decode->input_height;
- basecfg.input_width = init_decode->input_width;
- basecfg.inputformat = init_decode->inputformat;
- basecfg.targetbitrate = init_decode->targetbitrate;
-
- /*Initialize Decoder with codec type and resolution*/
- ioctl_msg.inputparam = &basecfg;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_BASE_CFG,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set base config type failed");
- return -1;
- }
-
- /*Initialize Decoder with codec type and resolution*/
- DEBUG_PRINT ("\n Switch off rate control");
- ioctl_msg.inputparam = &ratecrl;
- ioctl_msg.outputparam = NULL;
- ratecrl.rcmode = VEN_RC_OFF;
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_RATE_CTRL_CFG,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set rate control failed");
- return -1;
- }
-
- if (basecfg.codectype == VEN_CODEC_H264)
- {
- DEBUG_PRINT ("\n Set the VEN_IOCTL_SET_CODEC_PROFILE High");
- ioctl_msg.inputparam = &profile;
- ioctl_msg.outputparam = NULL;
- profile.profile = VEN_PROFILE_H264_BASELINE;
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_CODEC_PROFILE,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set VEN_IOCTL_SET_CODEC_PROFILE failed");
- return -1;
- }
-
- DEBUG_PRINT ("\n Set the VEN_IOCTL_SET_CODEC_PROFILE High");
- ioctl_msg.inputparam = &profilelevel;
- ioctl_msg.outputparam = NULL;
- profilelevel.level = VEN_LEVEL_H264_1p1;
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_PROFILE_LEVEL,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set VEN_IOCTL_SET_CODEC_PROFILE failed");
- return -1;
- }
-
- if (basecfg.input_width > 720)
- {
- DEBUG_PRINT ("\n Set the VEN_IOCTL_SET_CODEC_PROFILE High");
- ioctl_msg.inputparam = &profile;
- ioctl_msg.outputparam = NULL;
- profile.profile = VEN_PROFILE_H264_HIGH;
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_CODEC_PROFILE,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set VEN_IOCTL_SET_CODEC_PROFILE failed");
- return -1;
- }
-
- DEBUG_PRINT ("\n Set the VEN_IOCTL_SET_CODEC_PROFILE High");
- ioctl_msg.inputparam = &profilelevel;
- ioctl_msg.outputparam = NULL;
- profilelevel.level = VEN_LEVEL_H264_3p1;
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_PROFILE_LEVEL,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set VEN_IOCTL_SET_CODEC_PROFILE failed");
- return -1;
- }
- }
- }
-
- DEBUG_PRINT("\n Query Input bufffer requirements");
- /*Get the Buffer requirements for input and output ports*/
-
-
-
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &init_decode->input_buffer;
-
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_GET_INPUT_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Requesting for input buffer requirements failed");
- return -1;
- }
-
- DEBUG_PRINT("\n input Size=%d min count =%d actual count = %d", \
- (int)init_decode->input_buffer.datasize,\
- (int)init_decode->input_buffer.mincount,\
- (int)init_decode->input_buffer.actualcount);
-
-
- ioctl_msg.inputparam = &init_decode->input_buffer;
- ioctl_msg.outputparam = NULL;
- init_decode->input_buffer.actualcount = init_decode->input_buffer.mincount + 2;
-
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_SET_INPUT_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Set Buffer Requirements Failed");
- return -1;
- }
-
-
- DEBUG_PRINT("\n Query output bufffer requirements");
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = &init_decode->output_buffer;
-
- if (ioctl (init_decode->video_driver_fd,VEN_IOCTL_GET_OUTPUT_BUFFER_REQ,
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Requesting for output buffer requirements failed");
- return -1;
- }
-
- DEBUG_PRINT("\n output Size=%d min count =%d actual count = %d", \
- (int)init_decode->output_buffer.datasize,\
- (int)init_decode->output_buffer.mincount,\
- (int)init_decode->output_buffer.actualcount);
-
- /*Create Queue related data structures*/
- queue_ptr = &init_decode->queue_context;
- queue_ptr->commandq_size = 50;
- queue_ptr->dataq_size = 50;
-
- sem_init(&queue_ptr->sem_message,0, 0);
- sem_init(&init_decode->sem_synchronize,0, 0);
-
- pthread_mutexattr_init (&init_values);
- pthread_mutex_init (&queue_ptr->mutex,&init_values);
- pthread_mutex_init (&read_lock,&init_values);
- DEBUG_PRINT("\n create Queues");
- queue_ptr->ptr_cmdq = (struct video_msgq*) \
- calloc (sizeof (struct video_msgq),
- queue_ptr->commandq_size);
- queue_ptr->ptr_dataq = (struct video_msgq*) \
- calloc (sizeof (struct video_msgq),
- queue_ptr->dataq_size
- );
-
- if ( queue_ptr->ptr_cmdq == NULL ||
- queue_ptr->ptr_dataq == NULL
- )
- {
- return -1;
- }
- DEBUG_PRINT("\n create Threads");
- /*Create two threads*/
- if ( (pthread_create (&init_decode->videothread_id,NULL,video_thread,
- init_decode) < 0) ||
- (pthread_create (&init_decode->asyncthread_id,NULL,async_thread,
- init_decode) < 0)
- )
- {
- return -1;
- }
-
- return 1;
-}
-
-
-
-int free_buffer ( unsigned int buffer_dir,
- struct video_encoder_context *encoder_context
- )
-{
- unsigned int buffercount = 0,i=0;
- struct venc_bufferpayload **ptemp = NULL;
-
- if (encoder_context == NULL)
- {
- return -1;
- }
-
- if (buffer_dir == INPUT_BUFFER && encoder_context->ptr_inputbuffer)
- {
- buffercount = encoder_context->input_buffer.actualcount;
- ptemp = encoder_context->ptr_inputbuffer;
-
- for (i=0;i<buffercount;i++)
- {
- if (ptemp [i])
- {
- if (ptemp [i]->fd != -1)
- {
- munmap ( ptemp [i]->pbuffer,ptemp [i]->maped_size);
- ptemp [i]->pbuffer = NULL;
- close (ptemp [i]->fd);
- }
- free (ptemp [i]);
- ptemp [i] = NULL;
- }
- }
- free (encoder_context->ptr_inputbuffer);
- encoder_context->ptr_inputbuffer = NULL;
- }
- else if ( buffer_dir == OUTPUT_BUFFER && encoder_context->ptr_outputbuffer )
- {
- buffercount = encoder_context->output_buffer.actualcount;
- ptemp = encoder_context->ptr_outputbuffer;
-
- if (ptemp)
- {
- for (i=0;i<buffercount;i++)
- {
- if (ptemp [i])
- {
- if (ptemp [i]->fd != -1)
- {
- munmap ( ptemp [i]->pbuffer,ptemp [i]->maped_size);
- ptemp [i]->pbuffer = NULL;
- close (ptemp [i]->fd);
- }
- free (ptemp [i]);
- ptemp [i] = NULL;
- }
- }
- free (ptemp);
- encoder_context->ptr_outputbuffer = NULL;
- }
- }
-
- return 1;
-}
-
-int allocate_buffer ( unsigned int buffer_dir,
- struct video_encoder_context *encoder_context
- )
-{
- struct venc_bufferpayload **ptemp = NULL;
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- unsigned int buffercount = 0,i=0,alignedsize=0;
- unsigned int buffersize = 0;
-
- if ( encoder_context == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: context is NULL");
- return -1;
- }
-
- if ( buffer_dir == INPUT_BUFFER )
- {
- /*Check if buffers are allocated*/
- if (encoder_context->ptr_inputbuffer != NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: encoder_context->ptr_inputbuffer is set");
- return -1;
- }
-
- buffercount = encoder_context->input_buffer.actualcount;
- alignedsize = encoder_context->input_buffer.alignment;
- buffersize = encoder_context->input_buffer.datasize;
- buffersize = (buffersize + alignedsize) & (~alignedsize);
- }
- else if (buffer_dir == OUTPUT_BUFFER)
- {
- /*Check if buffers are allocated*/
- if (encoder_context->ptr_outputbuffer != NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: Double allcoate output");
- return -1;
- }
-
- buffercount = encoder_context->output_buffer.actualcount;
- alignedsize = encoder_context->output_buffer.alignment;
- buffersize = encoder_context->output_buffer.datasize;
- buffersize = (buffersize + alignedsize) & (~alignedsize);
-
- }
- else
- {
- DEBUG_PRINT ("\nallocate_buffer: Wrong buffer directions");
- return -1;
- }
-
- ptemp = (struct venc_bufferpayload **)\
- calloc (sizeof (struct venc_bufferpayload *),buffercount);
-
- if (ptemp == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: venc_bufferpayload failure");
- return -1;
- }
-
-
- if (buffer_dir == OUTPUT_BUFFER)
- {
- DEBUG_PRINT ("\nallocate_buffer: OUT");
- encoder_context->ptr_outputbuffer = ptemp;
- }
- else
- {
- DEBUG_PRINT ("\nallocate_buffer: IN");
- encoder_context->ptr_inputbuffer = ptemp;
- }
-
- /*Allocate buffer headers*/
- for (i=0; i< buffercount; i++)
- {
- ptemp [i] = (struct venc_bufferpayload*)\
- calloc (sizeof (struct venc_bufferpayload),1);
-
- if (ptemp [i] == NULL)
- {
- DEBUG_PRINT ("\nallocate_buffer: ptemp [i] calloc failure");
- return -1;
- }
- ptemp [i]->fd = -1;
- }
-
- for (i=0; i< buffercount; i++)
- {
- ptemp [i]->fd = open ("/dev/pmem_adsp", O_RDWR | O_SYNC);
-
- if (ptemp [i]->fd < 0)
- {
- DEBUG_PRINT ("\nallocate_buffer: open pmem failed");
- return -1;
- }
-
- ptemp [i]->pbuffer = mmap(NULL,clp2(buffersize),PROT_READ|PROT_WRITE,
- MAP_SHARED,ptemp [i]->fd,0);
- DEBUG_PRINT ("\n pmem fd = %d virt addr = %p",ptemp [i]->fd,\
- ptemp [i]->pbuffer);
- if (ptemp [i]->pbuffer == MAP_FAILED)
- {
- ptemp [i]->pbuffer = NULL;
- DEBUG_PRINT ("\nallocate_buffer: MMAP failed");
- return -1;
- }
- ptemp [i]->nsize = buffersize;
- ptemp [i]->maped_size = clp2 (buffersize);
-
- ioctl_msg.inputparam = ptemp [i];
- ioctl_msg.outputparam = NULL;
-
- if (buffer_dir == OUTPUT_BUFFER)
- {
- if (ioctl (encoder_context->video_driver_fd,VEN_IOCTL_SET_OUTPUT_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT ("\nallocate_buffer: Set Output Buffer IOCTL failed");
- return -1;
- }
- }
- else
- {
- if (ioctl (encoder_context->video_driver_fd,VEN_IOCTL_SET_INPUT_BUFFER,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT ("\nallocate_buffer: Set input Buffer IOCTL failed");
- return -1;
- }
- }
-
- }
- DEBUG_PRINT ("\nallocate_buffer: Success");
- return 1;
-}
-
-
-
-int start_encoding (struct video_encoder_context *encoder_context)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_buffer enc_buffer;
- unsigned int i = 0;
- unsigned int data_len =0;
-
-
- if (encoder_context == NULL)
- {
- return -1;
- }
-
- if (ioctl (encoder_context->video_driver_fd,VEN_IOCTL_CMD_START,
- NULL) < 0)
- {
- DEBUG_PRINT("\n Start failed");
- return -1;
- }
-
- DEBUG_PRINT("\n Start Issued successfully waiting for Start Done");
- /*Wait for Start command response*/
- sem_wait (&encoder_context->sem_synchronize);
-
- /*Push output Buffers*/
- i = 0;
- while (i < encoder_context->output_buffer.actualcount)
- {
- enc_buffer.clientdata = (void *)encoder_context->ptr_outputbuffer [i];
- enc_buffer.flags = 0;
- enc_buffer.size = encoder_context->ptr_outputbuffer [i]->nsize;
- enc_buffer.len = 0;
- enc_buffer.ptrbuffer = encoder_context->ptr_outputbuffer [i]->pbuffer;
- enc_buffer.offset = 0;
- enc_buffer.timestamp = 0;
-
- DEBUG_PRINT ("\n Client Data on output = %p",(void *)enc_buffer.clientdata);
- ioctl_msg.inputparam = &enc_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (encoder_context->video_driver_fd,
- VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n fill output frame failed");
- return -1;
- }
- i++;
- }
-
-
- /*push input buffers*/
- i = 0;
- while (i < encoder_context->input_buffer.actualcount)
- {
- DEBUG_PRINT("\n Read Frame from File");
-
- enc_buffer.clientdata = (void *)encoder_context->ptr_inputbuffer [i];
- enc_buffer.flags = 0;
- enc_buffer.size = encoder_context->ptr_inputbuffer [i]->nsize;
- enc_buffer.len = 0;
- enc_buffer.ptrbuffer = encoder_context->ptr_inputbuffer [i]->pbuffer;
- enc_buffer.offset = 0;
- enc_buffer.timestamp = total_frames *
- ((encoder_context->fps_den * 1000000)/encoder_context->fps_num);
- enc_buffer.len = (encoder_context->input_height *
- encoder_context->input_width *3)/2;
- data_len = read_frame ( enc_buffer.ptrbuffer,
- enc_buffer.len,
- encoder_context->inputBufferFile);
- if (data_len == 0)
- {
- DEBUG_PRINT("\n Length is zero error");
- return -1;
- }
- enc_buffer.len = data_len;
- DEBUG_PRINT("\n Read Frame from File szie = %d",(int)data_len);
-
- DEBUG_PRINT ("\n Client Data on output = %p",(void *)enc_buffer.clientdata);
- ioctl_msg.inputparam = &enc_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (encoder_context->video_driver_fd,
- VEN_IOCTL_CMD_ENCODE_FRAME,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Encode input frame failed");
- return -1;
- }
- total_frames++;
- i++;
- }
- DEBUG_PRINT ("\n Wait for EOS");
- /*Wait for EOS or Error condition*/
- sem_wait (&encoder_context->sem_synchronize);
- DEBUG_PRINT ("\n Reached EOS");
-
- return 1;
-}
-
-int stop_encoding (struct video_encoder_context *encoder_context)
-{
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_bufferflush buffer_flush;
-
- if (encoder_context == NULL)
- {
- return -1;
- }
- buffer_flush.flush_mode = VEN_FLUSH_INPUT;
- ioctl_msg.inputparam = &buffer_flush;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(encoder_context->video_driver_fd,VEN_IOCTL_CMD_FLUSH,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Flush input failed");
- }
- else
- {
- sem_wait (&encoder_context->sem_synchronize);
- }
-
- buffer_flush.flush_mode = VEN_FLUSH_OUTPUT;
- ioctl_msg.inputparam = &buffer_flush;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl(encoder_context->video_driver_fd,VEN_IOCTL_CMD_FLUSH,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Flush output failed");
- }
- else
- {
- sem_wait (&encoder_context->sem_synchronize);
- }
-
- DEBUG_PRINT("\n Stop VEN_IOCTL_CMD_STOP");
- if (ioctl(encoder_context->video_driver_fd,VEN_IOCTL_CMD_STOP,NULL) < 0)
- {
- DEBUG_PRINT("\n Stop failed");
- }
- else
- {
- sem_wait (&encoder_context->sem_synchronize);
- }
- return 1;
-}
-
-int deinit_encoder (struct video_encoder_context *init_decode)
-{
- if (init_decode == NULL)
- {
- return -1;
- }
-
- /*Close the driver*/
- if (init_decode->video_driver_fd != -1)
- {
- close (init_decode->video_driver_fd);
- }
-
- if (init_decode->queue_context.ptr_cmdq)
- {
- free (init_decode->queue_context.ptr_cmdq);
- init_decode->queue_context.ptr_cmdq = NULL;
- }
-
- if (init_decode->queue_context.ptr_dataq)
- {
- free (init_decode->queue_context.ptr_dataq);
- init_decode->queue_context.ptr_dataq = NULL;
- }
-
- sem_destroy (&init_decode->queue_context.sem_message);
- sem_destroy (&init_decode->sem_synchronize);
-
- pthread_mutex_destroy(&init_decode->queue_context.mutex);
- pthread_mutex_destroy (&read_lock);
-
- return 1;
-}
-
-static void* video_thread (void *context)
-{
- struct video_encoder_context *encoder_context = NULL;
- struct video_msgq *queueitem = NULL;
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- struct venc_bufferpayload *tempbuffer = NULL;
- struct venc_buffer enc_buffer;
- unsigned int data_len =0;
-
-
- if (context == NULL)
- {
- DEBUG_PRINT("\n video thread recieved NULL context");
- return NULL;
- }
- encoder_context = (struct video_encoder_context *) context;
-
- /* Thread function which will accept commands from async thread
- * or main thread
- */
- while (1)
- {
- queueitem = queue_get_cmd (&encoder_context ->queue_context);
- if (queueitem != NULL)
- {
- switch (queueitem->cmd)
- {
- case VEN_MSG_START:
- DEBUG_PRINT("\n recived start done command");
- sem_post (&encoder_context->sem_synchronize);
- break;
-
- case VEN_MSG_STOP:
- DEBUG_PRINT("\n recieved stop done");
- sem_post (&encoder_context->sem_synchronize);
- break;
-
- case VEN_MSG_INPUT_BUFFER_DONE:
-
- tempbuffer = (struct venc_bufferpayload *)queueitem->clientdata;
- if (tempbuffer == NULL)
- {
- DEBUG_PRINT("\n FATAL ERROR input buffer address is bad");
- sem_post (&encoder_context->sem_synchronize);
- break;
- }
- tempbuffer->filled_len = (encoder_context->input_height *
- encoder_context->input_width *3)/2;
-
- data_len = read_frame ( tempbuffer->pbuffer,
- tempbuffer->filled_len,
- encoder_context->inputBufferFile);
-
- if (data_len == 0)
- {
- DEBUG_PRINT ("\n End of stream reached");
- sem_post (&encoder_context->sem_synchronize);
- break;
- }
- enc_buffer.clientdata = (void *)tempbuffer;
- enc_buffer.flags = 0;
- enc_buffer.ptrbuffer = tempbuffer->pbuffer;
- enc_buffer.size = tempbuffer->nsize;
- enc_buffer.len = tempbuffer->filled_len;
- enc_buffer.offset = 0;
- enc_buffer.timestamp = total_frames *
- ((encoder_context->fps_den * 1000000)/encoder_context->fps_num);
-
- /*TODO: Time stamp needs to be updated*/
- ioctl_msg.inputparam = &enc_buffer;
- ioctl_msg.outputparam = NULL;
- total_frames++;
- if (ioctl(encoder_context->video_driver_fd,VEN_IOCTL_CMD_ENCODE_FRAME,
- &ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- sem_post (&encoder_context->sem_synchronize);
- }
- DEBUG_PRINT("\n Input buffer done send next buffer current value = %d",\
- total_frames);
- break;
-
- case VEN_MSG_OUTPUT_BUFFER_DONE:
-
- tempbuffer = (struct venc_bufferpayload *)queueitem->clientdata;
- if (tempbuffer == NULL)
- {
- DEBUG_PRINT("\n FATAL ERROR input buffer address is bad");
- sem_post (&encoder_context->sem_synchronize);
- break;
- }
-
- if (encoder_context->outputBufferFile != NULL)
- {
- fwrite (tempbuffer->pbuffer,1,tempbuffer->filled_len,
- encoder_context->outputBufferFile);
- }
-
-
- DEBUG_PRINT("\n recieved output buffer consume outbuffer");
- DEBUG_PRINT("\nValues outputbuffer->bufferaddr = %p",\
- tempbuffer->pbuffer);
- enc_buffer.clientdata = (void *)tempbuffer;
- enc_buffer.flags = 0;
- enc_buffer.size = tempbuffer->nsize;
- enc_buffer.len = 0;
- enc_buffer.ptrbuffer = tempbuffer->pbuffer;
- enc_buffer.offset = 0;
- enc_buffer.timestamp = 0;
-
- ioctl_msg.inputparam = &enc_buffer;
- ioctl_msg.outputparam = NULL;
-
- if (ioctl (encoder_context->video_driver_fd,
- VEN_IOCTL_CMD_FILL_OUTPUT_BUFFER,&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Decoder frame failed");
- return NULL;
- }
-
- break;
-
- case VEN_MSG_FLUSH_INPUT_DONE:
- DEBUG_PRINT("\n Flush input complete");
- sem_post (&encoder_context->sem_synchronize);
- break;
-
- case VEN_MSG_FLUSH_OUPUT_DONE:
- DEBUG_PRINT("\n Flush output complete");
- sem_post (&encoder_context->sem_synchronize);
- break;
- }
- }
- else
- {
- DEBUG_PRINT("\n Error condition recieved NULL from Queue");
- }
-
- if (queueitem->cmd == VEN_MSG_STOP)
- {
- DEBUG_PRINT("\n Playback has ended thread will exit");
- return NULL;
- }
- }
-}
-
-static void* async_thread (void *context)
-{
- struct video_encoder_context *encoder_context = NULL;
- struct video_msgq queueitem ;
- struct venc_msg venc_msg;
- struct venc_bufferpayload *tempbuffer = NULL;
- struct venc_ioctl_msg ioctl_msg = {NULL,NULL};
- int result = -1;
-
- if (context == NULL)
- {
- DEBUG_PRINT("\n aynsc thread recieved NULL context");
- return NULL;
- }
- encoder_context = (struct video_encoder_context *) context;
- DEBUG_PRINT("\n Entering the async thread");
-
- while (1)
- {
- ioctl_msg.inputparam = NULL;
- ioctl_msg.outputparam = (void*)&venc_msg;
- DEBUG_PRINT ("\n Sizeof venc_msginfo = %d ",sizeof (venc_msg));
- DEBUG_PRINT("\n Address of Venc msg in async thread %p",\
- ioctl_msg.outputparam);
- if (ioctl (encoder_context->video_driver_fd,VEN_IOCTL_CMD_READ_NEXT_MSG,\
- (void*)&ioctl_msg) < 0)
- {
- DEBUG_PRINT("\n Error in ioctl read next msg");
- }
- else
- {
- switch (venc_msg.msgcode)
- {
- case VEN_MSG_START:
- case VEN_MSG_STOP:
- case VEN_MSG_INDICATION:
- DEBUG_PRINT("\nSTOP/START Indiacation");
- queueitem.cmd = venc_msg.msgcode;
- queueitem.status = venc_msg.statuscode;
- queueitem.clientdata = NULL;
- break;
-
- case VEN_MSG_INPUT_BUFFER_DONE:
- DEBUG_PRINT("\nINPUT buffer done Indiacation");
- queueitem.cmd = venc_msg.msgcode;
- queueitem.status = venc_msg.statuscode;
- queueitem.clientdata = (void *)venc_msg.buf.clientdata;
- DEBUG_PRINT("\nInput Client data pointer is %p",queueitem.clientdata);
- tempbuffer = (struct venc_bufferpayload *) queueitem.clientdata;
- DEBUG_PRINT ("\n Input Address of tempbuffer %p",tempbuffer);
- tempbuffer->filled_len = venc_msg.buf.len;
- DEBUG_PRINT ("\n Input value of tempbuffer tempbuffer->filled_len %d",(int)tempbuffer->filled_len);
- break;
- case VEN_MSG_OUTPUT_BUFFER_DONE:
- DEBUG_PRINT("\nOUPUT buffer done Indiacation");
- queueitem.cmd = venc_msg.msgcode;
- queueitem.status = venc_msg.statuscode;
- queueitem.clientdata = (void *)venc_msg.buf.clientdata;
- DEBUG_PRINT("\nOutput Client data pointer is %p",queueitem.clientdata);
- tempbuffer = (struct venc_bufferpayload *) queueitem.clientdata;
- DEBUG_PRINT ("\n Output Address of tempbuffer %p",tempbuffer);
- tempbuffer->filled_len = venc_msg.buf.len;
- DEBUG_PRINT ("\n Output value of tempbuffer tempbuffer->filled_len %d",(int)tempbuffer->filled_len);
- break;
-
- default:
- DEBUG_PRINT("\nIn Default of get next message %d",(int)venc_msg.msgcode);
- queueitem.cmd = venc_msg.msgcode;
- queueitem.status = venc_msg.statuscode;
- queueitem.clientdata = NULL;
- break;
- }
- result = queue_post_cmdq (&encoder_context->queue_context,&queueitem);
- while (result == 0)
- {
- result = queue_post_cmdq (&encoder_context->queue_context,&queueitem);
- }
-
- if (result == -1)
- {
- DEBUG_PRINT("\n FATAL ERROR WITH Queue");
- }
- }
- if (venc_msg.msgcode == VEN_MSG_STOP)
- {
- /*Thread can exit at this point*/
- return NULL;
- }
- }
-}
-
-
-static unsigned int read_frame (unsigned char *dataptr, unsigned int length,
- FILE * inputBufferFile)
-{
-
- unsigned int readOffset = 0;
- int bytes_read = 0;
- unsigned int code = 0;
- int found = 0;
-
- DEBUG_PRINT ("\n Inside the readframe");
-
- if (dataptr == NULL && length == 0)
- {
- DEBUG_PRINT ("\n dataptr = %p length = %d",dataptr,(int)length);
- return 0;
- }
-
- pthread_mutex_lock(&read_lock);
- bytes_read = fread(&dataptr[readOffset],1,length,inputBufferFile);
- pthread_mutex_unlock(&read_lock);
-
- return bytes_read;
-}