use libOmxCore
This commit is contained in:
103
Android.bp
103
Android.bp
@@ -1,103 +0,0 @@
|
||||
|
||||
cc_library_shared {
|
||||
name: "libstagefright_redroid_omx",
|
||||
vendor: true,
|
||||
|
||||
srcs: [
|
||||
"SimpleRedroidOMXComponent.cpp",
|
||||
"RedroidOMXComponent.cpp",
|
||||
"RedroidVideoDecoderOMXComponent.cpp",
|
||||
"RedroidVideoEncoderOMXComponent.cpp",
|
||||
],
|
||||
|
||||
export_include_dirs: [
|
||||
"include",
|
||||
"include/media/openmax",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libstagefright_foundation",
|
||||
"liblog",
|
||||
"libui",
|
||||
"libutils",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wno-documentation",
|
||||
],
|
||||
|
||||
sanitize: {
|
||||
misc_undefined: [
|
||||
"signed-integer-overflow",
|
||||
"unsigned-integer-overflow",
|
||||
],
|
||||
cfi: true,
|
||||
},
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libstagefrighthw",
|
||||
vendor: true,
|
||||
|
||||
srcs: [
|
||||
"RedroidOMXPlugin.cpp",
|
||||
],
|
||||
|
||||
export_include_dirs: [
|
||||
"include",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libstagefright_redroid_omx",
|
||||
"libstagefright_foundation",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libbase",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Werror",
|
||||
"-Wall",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wno-documentation",
|
||||
],
|
||||
|
||||
sanitize: {
|
||||
misc_undefined: [
|
||||
"signed-integer-overflow",
|
||||
"unsigned-integer-overflow",
|
||||
],
|
||||
cfi: true,
|
||||
},
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "libstagefright_redroid_omx-defaults",
|
||||
vendor: true,
|
||||
|
||||
cflags: [
|
||||
"-Werror",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libstagefright_redroid_omx",
|
||||
"libstagefright_foundation",
|
||||
"libutils",
|
||||
"liblog",
|
||||
],
|
||||
|
||||
sanitize: {
|
||||
misc_undefined: [
|
||||
"signed-integer-overflow",
|
||||
"unsigned-integer-overflow",
|
||||
],
|
||||
cfi: true,
|
||||
},
|
||||
|
||||
compile_multilib: "32",
|
||||
}
|
||||
|
||||
subdirs = [ "codecs/*" ]
|
||||
@@ -1,4 +0,0 @@
|
||||
// fix for <= Android 8.1
|
||||
// build/soong/root.bp
|
||||
|
||||
subdirs = [ "*" ]
|
||||
1
Android.mk
Normal file
1
Android.mk
Normal file
@@ -0,0 +1 @@
|
||||
include $(call my-dir)/libstagefrighthw/Android.mk
|
||||
@@ -1,325 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RedroidOMXComponent"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <media/stagefright/omx/RedroidOMXComponent.h>
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
RedroidOMXComponent::RedroidOMXComponent(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component)
|
||||
: mName(name),
|
||||
mCallbacks(callbacks),
|
||||
mComponent(new OMX_COMPONENTTYPE),
|
||||
mLibHandle(NULL) {
|
||||
mComponent->nSize = sizeof(*mComponent);
|
||||
mComponent->nVersion.s.nVersionMajor = 1;
|
||||
mComponent->nVersion.s.nVersionMinor = 0;
|
||||
mComponent->nVersion.s.nRevision = 0;
|
||||
mComponent->nVersion.s.nStep = 0;
|
||||
mComponent->pComponentPrivate = this;
|
||||
mComponent->pApplicationPrivate = appData;
|
||||
|
||||
mComponent->GetComponentVersion = NULL;
|
||||
mComponent->SendCommand = SendCommandWrapper;
|
||||
mComponent->GetParameter = GetParameterWrapper;
|
||||
mComponent->SetParameter = SetParameterWrapper;
|
||||
mComponent->GetConfig = GetConfigWrapper;
|
||||
mComponent->SetConfig = SetConfigWrapper;
|
||||
mComponent->GetExtensionIndex = GetExtensionIndexWrapper;
|
||||
mComponent->GetState = GetStateWrapper;
|
||||
mComponent->ComponentTunnelRequest = NULL;
|
||||
mComponent->UseBuffer = UseBufferWrapper;
|
||||
mComponent->AllocateBuffer = AllocateBufferWrapper;
|
||||
mComponent->FreeBuffer = FreeBufferWrapper;
|
||||
mComponent->EmptyThisBuffer = EmptyThisBufferWrapper;
|
||||
mComponent->FillThisBuffer = FillThisBufferWrapper;
|
||||
mComponent->SetCallbacks = NULL;
|
||||
mComponent->ComponentDeInit = NULL;
|
||||
mComponent->UseEGLImage = NULL;
|
||||
mComponent->ComponentRoleEnum = NULL;
|
||||
|
||||
*component = mComponent;
|
||||
}
|
||||
|
||||
RedroidOMXComponent::~RedroidOMXComponent() {
|
||||
delete mComponent;
|
||||
mComponent = NULL;
|
||||
}
|
||||
|
||||
void RedroidOMXComponent::setLibHandle(void *libHandle) {
|
||||
CHECK(libHandle != NULL);
|
||||
mLibHandle = libHandle;
|
||||
}
|
||||
|
||||
void *RedroidOMXComponent::libHandle() const {
|
||||
return mLibHandle;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::initCheck() const {
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
const char *RedroidOMXComponent::name() const {
|
||||
return mName.c_str();
|
||||
}
|
||||
|
||||
void RedroidOMXComponent::notify(
|
||||
OMX_EVENTTYPE event,
|
||||
OMX_U32 data1, OMX_U32 data2, OMX_PTR data) {
|
||||
(*mCallbacks->EventHandler)(
|
||||
mComponent,
|
||||
mComponent->pApplicationPrivate,
|
||||
event,
|
||||
data1,
|
||||
data2,
|
||||
data);
|
||||
}
|
||||
|
||||
void RedroidOMXComponent::notifyEmptyBufferDone(OMX_BUFFERHEADERTYPE *header) {
|
||||
(*mCallbacks->EmptyBufferDone)(
|
||||
mComponent, mComponent->pApplicationPrivate, header);
|
||||
}
|
||||
|
||||
void RedroidOMXComponent::notifyFillBufferDone(OMX_BUFFERHEADERTYPE *header) {
|
||||
(*mCallbacks->FillBufferDone)(
|
||||
mComponent, mComponent->pApplicationPrivate, header);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::SendCommandWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_COMMANDTYPE cmd,
|
||||
OMX_U32 param,
|
||||
OMX_PTR data) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->sendCommand(cmd, param, data);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::GetParameterWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->getParameter(index, params);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::SetParameterWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->setParameter(index, params);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::GetConfigWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->getConfig(index, params);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::SetConfigWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->setConfig(index, params);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::GetExtensionIndexWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_STRING name,
|
||||
OMX_INDEXTYPE *index) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->getExtensionIndex(name, index);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::UseBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size,
|
||||
OMX_U8 *ptr) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->useBuffer(buffer, portIndex, appPrivate, size, ptr);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::AllocateBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->allocateBuffer(buffer, portIndex, appPrivate, size);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::FreeBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_U32 portIndex,
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->freeBuffer(portIndex, buffer);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::EmptyThisBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->emptyThisBuffer(buffer);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::FillThisBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->fillThisBuffer(buffer);
|
||||
}
|
||||
|
||||
// static
|
||||
OMX_ERRORTYPE RedroidOMXComponent::GetStateWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_STATETYPE *state) {
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
return me->getState(state);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::sendCommand(
|
||||
OMX_COMMANDTYPE /* cmd */, OMX_U32 /* param */, OMX_PTR /* data */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::getParameter(
|
||||
OMX_INDEXTYPE /* index */, OMX_PTR /* params */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::setParameter(
|
||||
OMX_INDEXTYPE /* index */, const OMX_PTR /* params */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::getConfig(
|
||||
OMX_INDEXTYPE /* index */, OMX_PTR /* params */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::setConfig(
|
||||
OMX_INDEXTYPE /* index */, const OMX_PTR /* params */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::getExtensionIndex(
|
||||
const char * /* name */, OMX_INDEXTYPE * /* index */) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::useBuffer(
|
||||
OMX_BUFFERHEADERTYPE ** /* buffer */,
|
||||
OMX_U32 /* portIndex */,
|
||||
OMX_PTR /* appPrivate */,
|
||||
OMX_U32 /* size */,
|
||||
OMX_U8 * /* ptr */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::allocateBuffer(
|
||||
OMX_BUFFERHEADERTYPE ** /* buffer */,
|
||||
OMX_U32 /* portIndex */,
|
||||
OMX_PTR /* appPrivate */,
|
||||
OMX_U32 /* size */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::freeBuffer(
|
||||
OMX_U32 /* portIndex */,
|
||||
OMX_BUFFERHEADERTYPE * /* buffer */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::emptyThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE * /* buffer */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::fillThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE * /* buffer */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXComponent::getState(OMX_STATETYPE * /* state */) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RedroidOMXPlugin"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include <media/stagefright/omx/RedroidOMXPlugin.h>
|
||||
#include <media/stagefright/omx/RedroidOMXComponent.h>
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/AString.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define d(...) ALOGD(__VA_ARGS__)
|
||||
|
||||
namespace android {
|
||||
|
||||
static const struct {
|
||||
const char *mName;
|
||||
const char *mLibNameSuffix;
|
||||
const char *mRole;
|
||||
|
||||
} kComponents[] = {
|
||||
{ "OMX.redroid.h264.encoder", "avcenc", "video_encoder.avc" },
|
||||
};
|
||||
|
||||
static const size_t kNumComponents =
|
||||
sizeof(kComponents) / sizeof(kComponents[0]);
|
||||
|
||||
extern "C" OMXPluginBase* createOMXPlugin() {
|
||||
d(__func__);
|
||||
return new RedroidOMXPlugin();
|
||||
}
|
||||
|
||||
extern "C" void destroyOMXPlugin(OMXPluginBase* plugin) {
|
||||
d(__func__);
|
||||
delete plugin;
|
||||
}
|
||||
|
||||
RedroidOMXPlugin::RedroidOMXPlugin() { }
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::makeComponentInstance(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component) {
|
||||
d("%s, name: %s", __func__, name);
|
||||
|
||||
for (size_t i = 0; i < kNumComponents; ++i) {
|
||||
if (strcmp(name, kComponents[i].mName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AString libName = "libstagefright_redroid_";
|
||||
libName.append(kComponents[i].mLibNameSuffix);
|
||||
libName.append(".so");
|
||||
|
||||
// RTLD_NODELETE means we keep the shared library around forever.
|
||||
// this eliminates thrashing during sequences like loading soundpools.
|
||||
// It also leaves the rest of the logic around the dlopen()/dlclose()
|
||||
// calls in this file unchanged.
|
||||
//
|
||||
// Implications of the change:
|
||||
// -- the codec process (where this happens) will have a slightly larger
|
||||
// long-term memory footprint as it accumulates the loaded shared libraries.
|
||||
// This is expected to be a small amount of memory.
|
||||
// -- plugin codecs can no longer (and never should have) depend on a
|
||||
// free reset of any static data as the library would have crossed
|
||||
// a dlclose/dlopen cycle.
|
||||
//
|
||||
|
||||
void *libHandle = dlopen(libName.c_str(), RTLD_NOW|RTLD_NODELETE);
|
||||
|
||||
if (libHandle == NULL) {
|
||||
ALOGE("unable to dlopen %s: %s", libName.c_str(), dlerror());
|
||||
|
||||
return OMX_ErrorComponentNotFound;
|
||||
}
|
||||
|
||||
typedef RedroidOMXComponent *(*CreateRedroidOMXComponentFunc)(
|
||||
const char *, const OMX_CALLBACKTYPE *,
|
||||
OMX_PTR, OMX_COMPONENTTYPE **);
|
||||
|
||||
CreateRedroidOMXComponentFunc createRedroidOMXComponent =
|
||||
(CreateRedroidOMXComponentFunc)dlsym(
|
||||
libHandle,
|
||||
"createRedroidOMXComponent");
|
||||
|
||||
if (createRedroidOMXComponent == NULL) {
|
||||
dlclose(libHandle);
|
||||
libHandle = NULL;
|
||||
|
||||
return OMX_ErrorComponentNotFound;
|
||||
}
|
||||
|
||||
sp<RedroidOMXComponent> codec =
|
||||
(*createRedroidOMXComponent)(name, callbacks, appData, component);
|
||||
|
||||
if (codec == NULL) {
|
||||
dlclose(libHandle);
|
||||
libHandle = NULL;
|
||||
|
||||
return OMX_ErrorInsufficientResources;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE err = codec->initCheck();
|
||||
if (err != OMX_ErrorNone) {
|
||||
dlclose(libHandle);
|
||||
libHandle = NULL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
codec->incStrong(this);
|
||||
codec->setLibHandle(libHandle);
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
return OMX_ErrorInvalidComponentName;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::destroyComponentInstance(
|
||||
OMX_COMPONENTTYPE *component) {
|
||||
d(__func__);
|
||||
RedroidOMXComponent *me =
|
||||
(RedroidOMXComponent *)
|
||||
((OMX_COMPONENTTYPE *)component)->pComponentPrivate;
|
||||
|
||||
me->prepareForDestruction();
|
||||
|
||||
void *libHandle = me->libHandle();
|
||||
|
||||
CHECK_EQ(me->getStrongCount(), 1);
|
||||
me->decStrong(this);
|
||||
me = NULL;
|
||||
|
||||
dlclose(libHandle);
|
||||
libHandle = NULL;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::enumerateComponents(
|
||||
OMX_STRING name,
|
||||
size_t /* size */,
|
||||
OMX_U32 index) {
|
||||
if (!android::base::GetBoolProperty("sys.use_redroid_omx", false)) return OMX_ErrorNoMore;
|
||||
if (index >= kNumComponents) {
|
||||
return OMX_ErrorNoMore;
|
||||
}
|
||||
|
||||
strcpy(name, kComponents[index].mName);
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::getRolesOfComponent(
|
||||
const char *name,
|
||||
Vector<String8> *roles) {
|
||||
for (size_t i = 0; i < kNumComponents; ++i) {
|
||||
if (strcmp(name, kComponents[i].mName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
roles->clear();
|
||||
roles->push(String8(kComponents[i].mRole));
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
return OMX_ErrorInvalidComponentName;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,805 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 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 <inttypes.h>
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RedroidVideoDecoderOMXComponent"
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <media/stagefright/omx/RedroidVideoDecoderOMXComponent.h>
|
||||
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/ALooper.h>
|
||||
#include <media/stagefright/foundation/AMessage.h>
|
||||
#include <media/stagefright/foundation/AUtils.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
template<class T>
|
||||
static void InitOMXParams(T *params) {
|
||||
params->nSize = sizeof(T);
|
||||
params->nVersion.s.nVersionMajor = 1;
|
||||
params->nVersion.s.nVersionMinor = 0;
|
||||
params->nVersion.s.nRevision = 0;
|
||||
params->nVersion.s.nStep = 0;
|
||||
}
|
||||
|
||||
RedroidVideoDecoderOMXComponent::RedroidVideoDecoderOMXComponent(
|
||||
const char *name,
|
||||
const char *componentRole,
|
||||
OMX_VIDEO_CODINGTYPE codingType,
|
||||
const CodecProfileLevel *profileLevels,
|
||||
size_t numProfileLevels,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component)
|
||||
: SimpleRedroidOMXComponent(name, callbacks, appData, component),
|
||||
mIsAdaptive(false),
|
||||
mAdaptiveMaxWidth(0),
|
||||
mAdaptiveMaxHeight(0),
|
||||
mWidth(width),
|
||||
mHeight(height),
|
||||
mCropLeft(0),
|
||||
mCropTop(0),
|
||||
mCropWidth(width),
|
||||
mCropHeight(height),
|
||||
mOutputFormat(OMX_COLOR_FormatYUV420Planar),
|
||||
mOutputPortSettingsChange(NONE),
|
||||
mUpdateColorAspects(false),
|
||||
mMinInputBufferSize(384), // arbitrary, using one uncompressed macroblock
|
||||
mMinCompressionRatio(1), // max input size is normally the output size
|
||||
mComponentRole(componentRole),
|
||||
mCodingType(codingType),
|
||||
mProfileLevels(profileLevels),
|
||||
mNumProfileLevels(numProfileLevels) {
|
||||
|
||||
// init all the color aspects to be Unspecified.
|
||||
memset(&mDefaultColorAspects, 0, sizeof(ColorAspects));
|
||||
memset(&mBitstreamColorAspects, 0, sizeof(ColorAspects));
|
||||
memset(&mFinalColorAspects, 0, sizeof(ColorAspects));
|
||||
memset(&mHdrStaticInfo, 0, sizeof(HDRStaticInfo));
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::initPorts(
|
||||
OMX_U32 numInputBuffers,
|
||||
OMX_U32 inputBufferSize,
|
||||
OMX_U32 numOutputBuffers,
|
||||
const char *mimeType,
|
||||
OMX_U32 minCompressionRatio) {
|
||||
initPorts(numInputBuffers, numInputBuffers, inputBufferSize,
|
||||
numOutputBuffers, numOutputBuffers, mimeType, minCompressionRatio);
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::initPorts(
|
||||
OMX_U32 numMinInputBuffers,
|
||||
OMX_U32 numInputBuffers,
|
||||
OMX_U32 inputBufferSize,
|
||||
OMX_U32 numMinOutputBuffers,
|
||||
OMX_U32 numOutputBuffers,
|
||||
const char *mimeType,
|
||||
OMX_U32 minCompressionRatio) {
|
||||
mMinInputBufferSize = inputBufferSize;
|
||||
mMinCompressionRatio = minCompressionRatio;
|
||||
|
||||
OMX_PARAM_PORTDEFINITIONTYPE def;
|
||||
InitOMXParams(&def);
|
||||
|
||||
def.nPortIndex = kInputPortIndex;
|
||||
def.eDir = OMX_DirInput;
|
||||
def.nBufferCountMin = numMinInputBuffers;
|
||||
def.nBufferCountActual = numInputBuffers;
|
||||
def.nBufferSize = inputBufferSize;
|
||||
def.bEnabled = OMX_TRUE;
|
||||
def.bPopulated = OMX_FALSE;
|
||||
def.eDomain = OMX_PortDomainVideo;
|
||||
def.bBuffersContiguous = OMX_FALSE;
|
||||
def.nBufferAlignment = 1;
|
||||
|
||||
def.format.video.cMIMEType = const_cast<char *>(mimeType);
|
||||
def.format.video.pNativeRender = NULL;
|
||||
/* size is initialized in updatePortDefinitions() */
|
||||
def.format.video.nBitrate = 0;
|
||||
def.format.video.xFramerate = 0;
|
||||
def.format.video.bFlagErrorConcealment = OMX_FALSE;
|
||||
def.format.video.eCompressionFormat = mCodingType;
|
||||
def.format.video.eColorFormat = OMX_COLOR_FormatUnused;
|
||||
def.format.video.pNativeWindow = NULL;
|
||||
|
||||
addPort(def);
|
||||
|
||||
def.nPortIndex = kOutputPortIndex;
|
||||
def.eDir = OMX_DirOutput;
|
||||
def.nBufferCountMin = numMinOutputBuffers;
|
||||
def.nBufferCountActual = numOutputBuffers;
|
||||
def.bEnabled = OMX_TRUE;
|
||||
def.bPopulated = OMX_FALSE;
|
||||
def.eDomain = OMX_PortDomainVideo;
|
||||
def.bBuffersContiguous = OMX_FALSE;
|
||||
def.nBufferAlignment = 2;
|
||||
|
||||
def.format.video.cMIMEType = const_cast<char *>("video/raw");
|
||||
def.format.video.pNativeRender = NULL;
|
||||
/* size is initialized in updatePortDefinitions() */
|
||||
def.format.video.nBitrate = 0;
|
||||
def.format.video.xFramerate = 0;
|
||||
def.format.video.bFlagErrorConcealment = OMX_FALSE;
|
||||
def.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
|
||||
def.format.video.pNativeWindow = NULL;
|
||||
|
||||
addPort(def);
|
||||
|
||||
updatePortDefinitions(true /* updateCrop */, true /* updateInputSize */);
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::updatePortDefinitions(bool updateCrop, bool updateInputSize) {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *outDef = &editPortInfo(kOutputPortIndex)->mDef;
|
||||
outDef->format.video.nFrameWidth = outputBufferWidth();
|
||||
outDef->format.video.nFrameHeight = outputBufferHeight();
|
||||
outDef->format.video.eColorFormat = mOutputFormat;
|
||||
outDef->format.video.nSliceHeight = outDef->format.video.nFrameHeight;
|
||||
|
||||
int32_t bpp = (mOutputFormat == OMX_COLOR_FormatYUV420Planar16) ? 2 : 1;
|
||||
outDef->format.video.nStride = outDef->format.video.nFrameWidth * bpp;
|
||||
outDef->nBufferSize =
|
||||
(outDef->format.video.nStride * outDef->format.video.nSliceHeight * 3) / 2;
|
||||
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *inDef = &editPortInfo(kInputPortIndex)->mDef;
|
||||
inDef->format.video.nFrameWidth = mWidth;
|
||||
inDef->format.video.nFrameHeight = mHeight;
|
||||
// input port is compressed, hence it has no stride
|
||||
inDef->format.video.nStride = 0;
|
||||
inDef->format.video.nSliceHeight = 0;
|
||||
|
||||
// when output format changes, input buffer size does not actually change
|
||||
if (updateInputSize) {
|
||||
inDef->nBufferSize = max(
|
||||
outDef->nBufferSize / mMinCompressionRatio,
|
||||
max(mMinInputBufferSize, inDef->nBufferSize));
|
||||
}
|
||||
|
||||
if (updateCrop) {
|
||||
mCropLeft = 0;
|
||||
mCropTop = 0;
|
||||
mCropWidth = mWidth;
|
||||
mCropHeight = mHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t RedroidVideoDecoderOMXComponent::outputBufferWidth() {
|
||||
return max(mIsAdaptive ? mAdaptiveMaxWidth : 0, mWidth);
|
||||
}
|
||||
|
||||
uint32_t RedroidVideoDecoderOMXComponent::outputBufferHeight() {
|
||||
return max(mIsAdaptive ? mAdaptiveMaxHeight : 0, mHeight);
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::handlePortSettingsChange(
|
||||
bool *portWillReset, uint32_t width, uint32_t height,
|
||||
OMX_COLOR_FORMATTYPE outputFormat,
|
||||
CropSettingsMode cropSettingsMode, bool fakeStride) {
|
||||
*portWillReset = false;
|
||||
bool sizeChanged = (width != mWidth || height != mHeight);
|
||||
bool formatChanged = (outputFormat != mOutputFormat);
|
||||
bool updateCrop = (cropSettingsMode == kCropUnSet);
|
||||
bool cropChanged = (cropSettingsMode == kCropChanged);
|
||||
bool strideChanged = false;
|
||||
if (fakeStride) {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(kOutputPortIndex)->mDef;
|
||||
if (def->format.video.nStride != (OMX_S32)width
|
||||
|| def->format.video.nSliceHeight != (OMX_U32)height) {
|
||||
strideChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (formatChanged || sizeChanged || cropChanged || strideChanged) {
|
||||
if (formatChanged) {
|
||||
ALOGD("formatChanged: 0x%08x -> 0x%08x", mOutputFormat, outputFormat);
|
||||
}
|
||||
mOutputFormat = outputFormat;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
|
||||
if ((sizeChanged && !mIsAdaptive)
|
||||
|| width > mAdaptiveMaxWidth
|
||||
|| height > mAdaptiveMaxHeight
|
||||
|| formatChanged) {
|
||||
if (mIsAdaptive) {
|
||||
if (width > mAdaptiveMaxWidth) {
|
||||
mAdaptiveMaxWidth = width;
|
||||
}
|
||||
if (height > mAdaptiveMaxHeight) {
|
||||
mAdaptiveMaxHeight = height;
|
||||
}
|
||||
}
|
||||
updatePortDefinitions(updateCrop);
|
||||
notify(OMX_EventPortSettingsChanged, kOutputPortIndex, 0, NULL);
|
||||
mOutputPortSettingsChange = AWAITING_DISABLED;
|
||||
*portWillReset = true;
|
||||
} else {
|
||||
updatePortDefinitions(updateCrop);
|
||||
|
||||
if (fakeStride) {
|
||||
// MAJOR HACK that is not pretty, it's just to fool the renderer to read the correct
|
||||
// data.
|
||||
// Some software decoders (e.g. RedroidMPEG4) fill decoded frame directly to output
|
||||
// buffer without considering the output buffer stride and slice height. So this is
|
||||
// used to signal how the buffer is arranged. The alternative is to re-arrange the
|
||||
// output buffer in RedroidMPEG4, but that results in memcopies.
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(kOutputPortIndex)->mDef;
|
||||
def->format.video.nStride = mWidth;
|
||||
def->format.video.nSliceHeight = mHeight;
|
||||
}
|
||||
|
||||
notify(OMX_EventPortSettingsChanged, kOutputPortIndex,
|
||||
OMX_IndexConfigCommonOutputCrop, NULL);
|
||||
}
|
||||
} else if (mUpdateColorAspects) {
|
||||
notify(OMX_EventPortSettingsChanged, kOutputPortIndex,
|
||||
kDescribeColorAspectsIndex, NULL);
|
||||
mUpdateColorAspects = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::dumpColorAspects(const ColorAspects &colorAspects) {
|
||||
ALOGD("dumpColorAspects: (R:%d(%s), P:%d(%s), M:%d(%s), T:%d(%s)) ",
|
||||
colorAspects.mRange, asString(colorAspects.mRange),
|
||||
colorAspects.mPrimaries, asString(colorAspects.mPrimaries),
|
||||
colorAspects.mMatrixCoeffs, asString(colorAspects.mMatrixCoeffs),
|
||||
colorAspects.mTransfer, asString(colorAspects.mTransfer));
|
||||
}
|
||||
|
||||
bool RedroidVideoDecoderOMXComponent::colorAspectsDiffer(
|
||||
const ColorAspects &a, const ColorAspects &b) {
|
||||
if (a.mRange != b.mRange
|
||||
|| a.mPrimaries != b.mPrimaries
|
||||
|| a.mTransfer != b.mTransfer
|
||||
|| a.mMatrixCoeffs != b.mMatrixCoeffs) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::updateFinalColorAspects(
|
||||
const ColorAspects &otherAspects, const ColorAspects &preferredAspects) {
|
||||
Mutex::Autolock autoLock(mColorAspectsLock);
|
||||
ColorAspects newAspects;
|
||||
newAspects.mRange = preferredAspects.mRange != ColorAspects::RangeUnspecified ?
|
||||
preferredAspects.mRange : otherAspects.mRange;
|
||||
newAspects.mPrimaries = preferredAspects.mPrimaries != ColorAspects::PrimariesUnspecified ?
|
||||
preferredAspects.mPrimaries : otherAspects.mPrimaries;
|
||||
newAspects.mTransfer = preferredAspects.mTransfer != ColorAspects::TransferUnspecified ?
|
||||
preferredAspects.mTransfer : otherAspects.mTransfer;
|
||||
newAspects.mMatrixCoeffs = preferredAspects.mMatrixCoeffs != ColorAspects::MatrixUnspecified ?
|
||||
preferredAspects.mMatrixCoeffs : otherAspects.mMatrixCoeffs;
|
||||
|
||||
// Check to see if need update mFinalColorAspects.
|
||||
if (colorAspectsDiffer(mFinalColorAspects, newAspects)) {
|
||||
mFinalColorAspects = newAspects;
|
||||
mUpdateColorAspects = true;
|
||||
}
|
||||
}
|
||||
|
||||
status_t RedroidVideoDecoderOMXComponent::handleColorAspectsChange() {
|
||||
int perference = getColorAspectPreference();
|
||||
ALOGD("Color Aspects preference: %d ", perference);
|
||||
|
||||
if (perference == kPreferBitstream) {
|
||||
updateFinalColorAspects(mDefaultColorAspects, mBitstreamColorAspects);
|
||||
} else if (perference == kPreferContainer) {
|
||||
updateFinalColorAspects(mBitstreamColorAspects, mDefaultColorAspects);
|
||||
} else {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::copyYV12FrameToOutputBuffer(
|
||||
uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
|
||||
size_t srcYStride, size_t srcUStride, size_t srcVStride) {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *outDef = &editPortInfo(kOutputPortIndex)->mDef;
|
||||
int32_t bpp = (outDef->format.video.eColorFormat == OMX_COLOR_FormatYUV420Planar16) ? 2 : 1;
|
||||
|
||||
size_t dstYStride = outputBufferWidth() * bpp;
|
||||
size_t dstUVStride = dstYStride / 2;
|
||||
size_t dstHeight = outputBufferHeight();
|
||||
uint8_t *dstStart = dst;
|
||||
|
||||
for (size_t i = 0; i < mHeight; ++i) {
|
||||
memcpy(dst, srcY, mWidth * bpp);
|
||||
srcY += srcYStride;
|
||||
dst += dstYStride;
|
||||
}
|
||||
|
||||
dst = dstStart + dstYStride * dstHeight;
|
||||
for (size_t i = 0; i < mHeight / 2; ++i) {
|
||||
memcpy(dst, srcU, mWidth / 2 * bpp);
|
||||
srcU += srcUStride;
|
||||
dst += dstUVStride;
|
||||
}
|
||||
|
||||
dst = dstStart + (5 * dstYStride * dstHeight) / 4;
|
||||
for (size_t i = 0; i < mHeight / 2; ++i) {
|
||||
memcpy(dst, srcV, mWidth / 2 * bpp);
|
||||
srcV += srcVStride;
|
||||
dst += dstUVStride;
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoDecoderOMXComponent::internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params) {
|
||||
switch (index) {
|
||||
case OMX_IndexParamVideoPortFormat:
|
||||
{
|
||||
OMX_VIDEO_PARAM_PORTFORMATTYPE *formatParams =
|
||||
(OMX_VIDEO_PARAM_PORTFORMATTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(formatParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (formatParams->nPortIndex > kMaxPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
if (formatParams->nIndex != 0) {
|
||||
return OMX_ErrorNoMore;
|
||||
}
|
||||
|
||||
if (formatParams->nPortIndex == kInputPortIndex) {
|
||||
formatParams->eCompressionFormat = mCodingType;
|
||||
formatParams->eColorFormat = OMX_COLOR_FormatUnused;
|
||||
formatParams->xFramerate = 0;
|
||||
} else {
|
||||
CHECK_EQ(formatParams->nPortIndex, 1u);
|
||||
|
||||
formatParams->eCompressionFormat = OMX_VIDEO_CodingUnused;
|
||||
formatParams->eColorFormat = OMX_COLOR_FormatYUV420Planar;
|
||||
formatParams->xFramerate = 0;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoProfileLevelQuerySupported:
|
||||
{
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevel =
|
||||
(OMX_VIDEO_PARAM_PROFILELEVELTYPE *) params;
|
||||
|
||||
if (!isValidOMXParam(profileLevel)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (profileLevel->nPortIndex != kInputPortIndex) {
|
||||
ALOGE("Invalid port index: %" PRIu32, profileLevel->nPortIndex);
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
if (profileLevel->nProfileIndex >= mNumProfileLevels) {
|
||||
return OMX_ErrorNoMore;
|
||||
}
|
||||
|
||||
profileLevel->eProfile = mProfileLevels[profileLevel->nProfileIndex].mProfile;
|
||||
profileLevel->eLevel = mProfileLevels[profileLevel->nProfileIndex].mLevel;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return SimpleRedroidOMXComponent::internalGetParameter(index, params);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoDecoderOMXComponent::internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) {
|
||||
// Include extension index OMX_INDEXEXTTYPE.
|
||||
const int32_t indexFull = index;
|
||||
|
||||
switch (indexFull) {
|
||||
case OMX_IndexParamStandardComponentRole:
|
||||
{
|
||||
const OMX_PARAM_COMPONENTROLETYPE *roleParams =
|
||||
(const OMX_PARAM_COMPONENTROLETYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(roleParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (strncmp((const char *)roleParams->cRole,
|
||||
mComponentRole,
|
||||
OMX_MAX_STRINGNAME_SIZE - 1)) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoPortFormat:
|
||||
{
|
||||
OMX_VIDEO_PARAM_PORTFORMATTYPE *formatParams =
|
||||
(OMX_VIDEO_PARAM_PORTFORMATTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(formatParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (formatParams->nPortIndex > kMaxPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
if (formatParams->nPortIndex == kInputPortIndex) {
|
||||
if (formatParams->eCompressionFormat != mCodingType
|
||||
|| formatParams->eColorFormat != OMX_COLOR_FormatUnused) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
} else {
|
||||
if (formatParams->eCompressionFormat != OMX_VIDEO_CodingUnused
|
||||
|| formatParams->eColorFormat != OMX_COLOR_FormatYUV420Planar) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case kPrepareForAdaptivePlaybackIndex:
|
||||
{
|
||||
const PrepareForAdaptivePlaybackParams* adaptivePlaybackParams =
|
||||
(const PrepareForAdaptivePlaybackParams *)params;
|
||||
|
||||
if (!isValidOMXParam(adaptivePlaybackParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
mIsAdaptive = adaptivePlaybackParams->bEnable;
|
||||
if (mIsAdaptive) {
|
||||
mAdaptiveMaxWidth = adaptivePlaybackParams->nMaxFrameWidth;
|
||||
mAdaptiveMaxHeight = adaptivePlaybackParams->nMaxFrameHeight;
|
||||
mWidth = mAdaptiveMaxWidth;
|
||||
mHeight = mAdaptiveMaxHeight;
|
||||
} else {
|
||||
mAdaptiveMaxWidth = 0;
|
||||
mAdaptiveMaxHeight = 0;
|
||||
}
|
||||
updatePortDefinitions(true /* updateCrop */, true /* updateInputSize */);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamPortDefinition:
|
||||
{
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *newParams =
|
||||
(OMX_PARAM_PORTDEFINITIONTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(newParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &newParams->format.video;
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(newParams->nPortIndex)->mDef;
|
||||
|
||||
uint32_t oldWidth = def->format.video.nFrameWidth;
|
||||
uint32_t oldHeight = def->format.video.nFrameHeight;
|
||||
uint32_t newWidth = video_def->nFrameWidth;
|
||||
uint32_t newHeight = video_def->nFrameHeight;
|
||||
// We need width, height, stride and slice-height to be non-zero and sensible.
|
||||
// These values were chosen to prevent integer overflows further down the line, and do
|
||||
// not indicate support for 32kx32k video.
|
||||
if (newWidth > 32768 || newHeight > 32768
|
||||
|| video_def->nStride > 32768 || video_def->nStride < -32768
|
||||
|| video_def->nSliceHeight > 32768) {
|
||||
ALOGE("b/22885421");
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
if (newWidth != oldWidth || newHeight != oldHeight) {
|
||||
bool outputPort = (newParams->nPortIndex == kOutputPortIndex);
|
||||
if (outputPort) {
|
||||
// only update (essentially crop) if size changes
|
||||
mWidth = newWidth;
|
||||
mHeight = newHeight;
|
||||
|
||||
updatePortDefinitions(true /* updateCrop */, true /* updateInputSize */);
|
||||
// reset buffer size based on frame size
|
||||
newParams->nBufferSize = def->nBufferSize;
|
||||
} else {
|
||||
// For input port, we only set nFrameWidth and nFrameHeight. Buffer size
|
||||
// is updated when configuring the output port using the max-frame-size,
|
||||
// though client can still request a larger size.
|
||||
def->format.video.nFrameWidth = newWidth;
|
||||
def->format.video.nFrameHeight = newHeight;
|
||||
}
|
||||
}
|
||||
return SimpleRedroidOMXComponent::internalSetParameter(index, params);
|
||||
}
|
||||
|
||||
default:
|
||||
return SimpleRedroidOMXComponent::internalSetParameter(index, params);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoDecoderOMXComponent::getConfig(
|
||||
OMX_INDEXTYPE index, OMX_PTR params) {
|
||||
switch ((int)index) {
|
||||
case OMX_IndexConfigCommonOutputCrop:
|
||||
{
|
||||
OMX_CONFIG_RECTTYPE *rectParams = (OMX_CONFIG_RECTTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(rectParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (rectParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
rectParams->nLeft = mCropLeft;
|
||||
rectParams->nTop = mCropTop;
|
||||
rectParams->nWidth = mCropWidth;
|
||||
rectParams->nHeight = mCropHeight;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
case kDescribeColorAspectsIndex:
|
||||
{
|
||||
if (!supportsDescribeColorAspects()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
DescribeColorAspectsParams* colorAspectsParams =
|
||||
(DescribeColorAspectsParams *)params;
|
||||
|
||||
if (!isValidOMXParam(colorAspectsParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (colorAspectsParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
colorAspectsParams->sAspects = mFinalColorAspects;
|
||||
if (colorAspectsParams->bRequestingDataSpace || colorAspectsParams->bDataSpaceChanged) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case kDescribeHdrStaticInfoIndex:
|
||||
{
|
||||
if (!supportDescribeHdrStaticInfo()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
DescribeHDRStaticInfoParams* hdrStaticInfoParams =
|
||||
(DescribeHDRStaticInfoParams *)params;
|
||||
|
||||
if (!isValidOMXParam(hdrStaticInfoParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (hdrStaticInfoParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
hdrStaticInfoParams->sInfo = mHdrStaticInfo;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case kDescribeHdr10PlusInfoIndex:
|
||||
{
|
||||
if (!supportDescribeHdr10PlusInfo()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
if (mHdr10PlusOutputs.size() > 0) {
|
||||
auto it = mHdr10PlusOutputs.begin();
|
||||
|
||||
auto info = (*it).get();
|
||||
|
||||
DescribeHDR10PlusInfoParams* outParams =
|
||||
(DescribeHDR10PlusInfoParams *)params;
|
||||
|
||||
outParams->nParamSizeUsed = info->size();
|
||||
|
||||
// If the buffer provided by the client does not have enough
|
||||
// storage, return the size only and do not remove the param yet.
|
||||
if (outParams->nParamSize >= info->size()) {
|
||||
memcpy(outParams->nValue, info->data(), info->size());
|
||||
mHdr10PlusOutputs.erase(it);
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
return OMX_ErrorUnderflow;
|
||||
}
|
||||
|
||||
default:
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoDecoderOMXComponent::internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params, bool *frameConfig){
|
||||
switch ((int)index) {
|
||||
case kDescribeColorAspectsIndex:
|
||||
{
|
||||
if (!supportsDescribeColorAspects()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
const DescribeColorAspectsParams* colorAspectsParams =
|
||||
(const DescribeColorAspectsParams *)params;
|
||||
|
||||
if (!isValidOMXParam(colorAspectsParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (colorAspectsParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
// Update color aspects if necessary.
|
||||
if (colorAspectsDiffer(colorAspectsParams->sAspects, mDefaultColorAspects)) {
|
||||
mDefaultColorAspects = colorAspectsParams->sAspects;
|
||||
status_t err = handleColorAspectsChange();
|
||||
CHECK(err == OK);
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case kDescribeHdrStaticInfoIndex:
|
||||
{
|
||||
if (!supportDescribeHdrStaticInfo()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
const DescribeHDRStaticInfoParams* hdrStaticInfoParams =
|
||||
(DescribeHDRStaticInfoParams *)params;
|
||||
|
||||
if (!isValidOMXParam(hdrStaticInfoParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (hdrStaticInfoParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
mHdrStaticInfo = hdrStaticInfoParams->sInfo;
|
||||
updatePortDefinitions(false);
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case kDescribeHdr10PlusInfoIndex:
|
||||
{
|
||||
if (!supportDescribeHdr10PlusInfo()) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
const DescribeHDR10PlusInfoParams* inParams =
|
||||
(DescribeHDR10PlusInfoParams *)params;
|
||||
|
||||
if (*frameConfig) {
|
||||
// This is a request to append to the current frame config set.
|
||||
// For now, we only support kDescribeHdr10PlusInfoIndex, which
|
||||
// we simply replace with the last set value.
|
||||
if (mHdr10PlusInputs.size() > 0) {
|
||||
*(--mHdr10PlusInputs.end()) = ABuffer::CreateAsCopy(
|
||||
inParams->nValue, inParams->nParamSizeUsed);
|
||||
} else {
|
||||
ALOGW("Ignoring kDescribeHdr10PlusInfoIndex: append to "
|
||||
"frame config while no frame config is present");
|
||||
}
|
||||
} else {
|
||||
// This is a frame config, setting *frameConfig to true so that
|
||||
// the client marks the next queued input frame to apply it.
|
||||
*frameConfig = true;
|
||||
mHdr10PlusInputs.push_back(ABuffer::CreateAsCopy(
|
||||
inParams->nValue, inParams->nParamSizeUsed));
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
sp<ABuffer> RedroidVideoDecoderOMXComponent::dequeueInputFrameConfig() {
|
||||
auto it = mHdr10PlusInputs.begin();
|
||||
sp<ABuffer> info = *it;
|
||||
mHdr10PlusInputs.erase(it);
|
||||
return info;
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::queueOutputFrameConfig(const sp<ABuffer> &info) {
|
||||
mHdr10PlusOutputs.push_back(info);
|
||||
notify(OMX_EventConfigUpdate,
|
||||
kOutputPortIndex,
|
||||
kDescribeHdr10PlusInfoIndex,
|
||||
NULL);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoDecoderOMXComponent::getExtensionIndex(
|
||||
const char *name, OMX_INDEXTYPE *index) {
|
||||
if (!strcmp(name, "OMX.google.android.index.prepareForAdaptivePlayback")) {
|
||||
*(int32_t*)index = kPrepareForAdaptivePlaybackIndex;
|
||||
return OMX_ErrorNone;
|
||||
} else if (!strcmp(name, "OMX.google.android.index.describeColorAspects")
|
||||
&& supportsDescribeColorAspects()) {
|
||||
*(int32_t*)index = kDescribeColorAspectsIndex;
|
||||
return OMX_ErrorNone;
|
||||
} else if (!strcmp(name, "OMX.google.android.index.describeHDRStaticInfo")
|
||||
&& supportDescribeHdrStaticInfo()) {
|
||||
*(int32_t*)index = kDescribeHdrStaticInfoIndex;
|
||||
return OMX_ErrorNone;
|
||||
} else if (!strcmp(name, "OMX.google.android.index.describeHDR10PlusInfo")
|
||||
&& supportDescribeHdr10PlusInfo()) {
|
||||
*(int32_t*)index = kDescribeHdr10PlusInfoIndex;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
return SimpleRedroidOMXComponent::getExtensionIndex(name, index);
|
||||
}
|
||||
|
||||
bool RedroidVideoDecoderOMXComponent::supportsDescribeColorAspects() {
|
||||
return getColorAspectPreference() != kNotSupported;
|
||||
}
|
||||
|
||||
int RedroidVideoDecoderOMXComponent::getColorAspectPreference() {
|
||||
return kNotSupported;
|
||||
}
|
||||
|
||||
bool RedroidVideoDecoderOMXComponent::supportDescribeHdrStaticInfo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RedroidVideoDecoderOMXComponent::supportDescribeHdr10PlusInfo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::onReset() {
|
||||
mOutputPortSettingsChange = NONE;
|
||||
}
|
||||
|
||||
void RedroidVideoDecoderOMXComponent::onPortEnableCompleted(OMX_U32 portIndex, bool enabled) {
|
||||
if (portIndex != kOutputPortIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mOutputPortSettingsChange) {
|
||||
case NONE:
|
||||
break;
|
||||
|
||||
case AWAITING_DISABLED:
|
||||
{
|
||||
CHECK(!enabled);
|
||||
mOutputPortSettingsChange = AWAITING_ENABLED;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
CHECK_EQ((int)mOutputPortSettingsChange, (int)AWAITING_ENABLED);
|
||||
CHECK(enabled);
|
||||
mOutputPortSettingsChange = NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,679 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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 <inttypes.h>
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RedroidVideoEncoderOMXComponent"
|
||||
#include <utils/Log.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include <media/stagefright/omx/RedroidVideoEncoderOMXComponent.h>
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/ALooper.h>
|
||||
#include <media/stagefright/foundation/AMessage.h>
|
||||
#include <media/stagefright/foundation/AUtils.h>
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media/openmax/OMX_IndexExt.h>
|
||||
|
||||
#include <ui/Fence.h>
|
||||
#include <ui/GraphicBufferMapper.h>
|
||||
#include <ui/Rect.h>
|
||||
|
||||
#include <hardware/gralloc.h>
|
||||
#include <nativebase/nativebase.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
const static OMX_COLOR_FORMATTYPE kSupportedColorFormats[] = {
|
||||
OMX_COLOR_FormatYUV420Planar,
|
||||
OMX_COLOR_FormatYUV420SemiPlanar,
|
||||
OMX_COLOR_FormatAndroidOpaque
|
||||
};
|
||||
|
||||
template<class T>
|
||||
static void InitOMXParams(T *params) {
|
||||
params->nSize = sizeof(T);
|
||||
params->nVersion.s.nVersionMajor = 1;
|
||||
params->nVersion.s.nVersionMinor = 0;
|
||||
params->nVersion.s.nRevision = 0;
|
||||
params->nVersion.s.nStep = 0;
|
||||
}
|
||||
|
||||
RedroidVideoEncoderOMXComponent::RedroidVideoEncoderOMXComponent(
|
||||
const char *name,
|
||||
const char *componentRole,
|
||||
OMX_VIDEO_CODINGTYPE codingType,
|
||||
const CodecProfileLevel *profileLevels,
|
||||
size_t numProfileLevels,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component)
|
||||
: SimpleRedroidOMXComponent(name, callbacks, appData, component),
|
||||
mInputDataIsMeta(false),
|
||||
mWidth(width),
|
||||
mHeight(height),
|
||||
mBitrate(192000),
|
||||
mFramerate(30 << 16), // Q16 format
|
||||
mColorFormat(OMX_COLOR_FormatYUV420Planar),
|
||||
mMinOutputBufferSize(384), // arbitrary, using one uncompressed macroblock
|
||||
mMinCompressionRatio(1), // max output size is normally the input size
|
||||
mComponentRole(componentRole),
|
||||
mCodingType(codingType),
|
||||
mProfileLevels(profileLevels),
|
||||
mNumProfileLevels(numProfileLevels) {
|
||||
}
|
||||
|
||||
void RedroidVideoEncoderOMXComponent::initPorts(
|
||||
OMX_U32 numInputBuffers, OMX_U32 numOutputBuffers, OMX_U32 outputBufferSize,
|
||||
const char *mime, OMX_U32 minCompressionRatio) {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE def;
|
||||
|
||||
mMinOutputBufferSize = outputBufferSize;
|
||||
mMinCompressionRatio = minCompressionRatio;
|
||||
|
||||
InitOMXParams(&def);
|
||||
|
||||
def.nPortIndex = kInputPortIndex;
|
||||
def.eDir = OMX_DirInput;
|
||||
def.nBufferCountMin = numInputBuffers;
|
||||
def.nBufferCountActual = def.nBufferCountMin;
|
||||
def.bEnabled = OMX_TRUE;
|
||||
def.bPopulated = OMX_FALSE;
|
||||
def.eDomain = OMX_PortDomainVideo;
|
||||
def.bBuffersContiguous = OMX_FALSE;
|
||||
def.format.video.pNativeRender = NULL;
|
||||
def.format.video.nFrameWidth = mWidth;
|
||||
def.format.video.nFrameHeight = mHeight;
|
||||
def.format.video.nStride = def.format.video.nFrameWidth;
|
||||
def.format.video.nSliceHeight = def.format.video.nFrameHeight;
|
||||
def.format.video.nBitrate = 0;
|
||||
// frameRate is in Q16 format.
|
||||
def.format.video.xFramerate = mFramerate;
|
||||
def.format.video.bFlagErrorConcealment = OMX_FALSE;
|
||||
def.nBufferAlignment = kInputBufferAlignment;
|
||||
def.format.video.cMIMEType = const_cast<char *>("video/raw");
|
||||
def.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
|
||||
def.format.video.eColorFormat = mColorFormat;
|
||||
def.format.video.pNativeWindow = NULL;
|
||||
// buffersize set in updatePortParams
|
||||
|
||||
addPort(def);
|
||||
|
||||
InitOMXParams(&def);
|
||||
|
||||
def.nPortIndex = kOutputPortIndex;
|
||||
def.eDir = OMX_DirOutput;
|
||||
def.nBufferCountMin = numOutputBuffers;
|
||||
def.nBufferCountActual = def.nBufferCountMin;
|
||||
def.bEnabled = OMX_TRUE;
|
||||
def.bPopulated = OMX_FALSE;
|
||||
def.eDomain = OMX_PortDomainVideo;
|
||||
def.bBuffersContiguous = OMX_FALSE;
|
||||
def.format.video.pNativeRender = NULL;
|
||||
def.format.video.nFrameWidth = mWidth;
|
||||
def.format.video.nFrameHeight = mHeight;
|
||||
def.format.video.nStride = 0;
|
||||
def.format.video.nSliceHeight = 0;
|
||||
def.format.video.nBitrate = mBitrate;
|
||||
def.format.video.xFramerate = 0 << 16;
|
||||
def.format.video.bFlagErrorConcealment = OMX_FALSE;
|
||||
def.nBufferAlignment = kOutputBufferAlignment;
|
||||
def.format.video.cMIMEType = const_cast<char *>(mime);
|
||||
def.format.video.eCompressionFormat = mCodingType;
|
||||
def.format.video.eColorFormat = OMX_COLOR_FormatUnused;
|
||||
def.format.video.pNativeWindow = NULL;
|
||||
// buffersize set in updatePortParams
|
||||
|
||||
addPort(def);
|
||||
|
||||
updatePortParams();
|
||||
}
|
||||
|
||||
void RedroidVideoEncoderOMXComponent::updatePortParams() {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *inDef = &editPortInfo(kInputPortIndex)->mDef;
|
||||
inDef->format.video.nFrameWidth = mWidth;
|
||||
inDef->format.video.nFrameHeight = mHeight;
|
||||
inDef->format.video.nStride = inDef->format.video.nFrameWidth;
|
||||
inDef->format.video.nSliceHeight = inDef->format.video.nFrameHeight;
|
||||
inDef->format.video.xFramerate = mFramerate;
|
||||
inDef->format.video.eColorFormat = mColorFormat;
|
||||
uint32_t rawBufferSize =
|
||||
inDef->format.video.nStride * inDef->format.video.nSliceHeight * 3 / 2;
|
||||
if (inDef->format.video.eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
|
||||
inDef->nBufferSize = max(sizeof(VideoNativeMetadata), sizeof(VideoGrallocMetadata));
|
||||
} else {
|
||||
inDef->nBufferSize = rawBufferSize;
|
||||
}
|
||||
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *outDef = &editPortInfo(kOutputPortIndex)->mDef;
|
||||
outDef->format.video.nFrameWidth = mWidth;
|
||||
outDef->format.video.nFrameHeight = mHeight;
|
||||
outDef->format.video.nBitrate = mBitrate;
|
||||
|
||||
outDef->nBufferSize = max(mMinOutputBufferSize, rawBufferSize / mMinCompressionRatio);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoEncoderOMXComponent::internalSetPortParams(
|
||||
const OMX_PARAM_PORTDEFINITIONTYPE *port) {
|
||||
|
||||
if (!isValidOMXParam(port)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (port->nPortIndex == kInputPortIndex) {
|
||||
mWidth = port->format.video.nFrameWidth;
|
||||
mHeight = port->format.video.nFrameHeight;
|
||||
|
||||
// xFramerate comes in Q16 format, in frames per second unit
|
||||
mFramerate = port->format.video.xFramerate;
|
||||
|
||||
if (port->format.video.eCompressionFormat != OMX_VIDEO_CodingUnused
|
||||
|| (port->format.video.eColorFormat != OMX_COLOR_FormatYUV420Planar
|
||||
&& port->format.video.eColorFormat != OMX_COLOR_FormatYUV420SemiPlanar
|
||||
&& port->format.video.eColorFormat != OMX_COLOR_FormatAndroidOpaque)) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
mColorFormat = port->format.video.eColorFormat;
|
||||
} else if (port->nPortIndex == kOutputPortIndex) {
|
||||
if (port->format.video.eCompressionFormat != mCodingType
|
||||
|| port->format.video.eColorFormat != OMX_COLOR_FormatUnused) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
mBitrate = port->format.video.nBitrate;
|
||||
} else {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
updatePortParams();
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoEncoderOMXComponent::internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR param) {
|
||||
// can include extension index OMX_INDEXEXTTYPE
|
||||
const int32_t indexFull = index;
|
||||
|
||||
switch (indexFull) {
|
||||
case OMX_IndexParamVideoErrorCorrection:
|
||||
{
|
||||
return OMX_ErrorNotImplemented;
|
||||
}
|
||||
|
||||
case OMX_IndexParamStandardComponentRole:
|
||||
{
|
||||
const OMX_PARAM_COMPONENTROLETYPE *roleParams =
|
||||
(const OMX_PARAM_COMPONENTROLETYPE *)param;
|
||||
|
||||
if (!isValidOMXParam(roleParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (strncmp((const char *)roleParams->cRole,
|
||||
mComponentRole,
|
||||
OMX_MAX_STRINGNAME_SIZE - 1)) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamPortDefinition:
|
||||
{
|
||||
OMX_ERRORTYPE err = internalSetPortParams((const OMX_PARAM_PORTDEFINITIONTYPE *)param);
|
||||
|
||||
if (err != OMX_ErrorNone) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return SimpleRedroidOMXComponent::internalSetParameter(index, param);
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoPortFormat:
|
||||
{
|
||||
const OMX_VIDEO_PARAM_PORTFORMATTYPE* format =
|
||||
(const OMX_VIDEO_PARAM_PORTFORMATTYPE *)param;
|
||||
|
||||
if (!isValidOMXParam(format)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (format->nPortIndex == kInputPortIndex) {
|
||||
if (format->eColorFormat == OMX_COLOR_FormatYUV420Planar ||
|
||||
format->eColorFormat == OMX_COLOR_FormatYUV420SemiPlanar ||
|
||||
format->eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
|
||||
mColorFormat = format->eColorFormat;
|
||||
|
||||
updatePortParams();
|
||||
return OMX_ErrorNone;
|
||||
} else {
|
||||
ALOGE("Unsupported color format %i", format->eColorFormat);
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
} else if (format->nPortIndex == kOutputPortIndex) {
|
||||
if (format->eCompressionFormat == mCodingType) {
|
||||
return OMX_ErrorNone;
|
||||
} else {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
} else {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
}
|
||||
|
||||
case kStoreMetaDataExtensionIndex:
|
||||
{
|
||||
// storeMetaDataInBuffers
|
||||
const StoreMetaDataInBuffersParams *storeParam =
|
||||
(const StoreMetaDataInBuffersParams *)param;
|
||||
|
||||
if (!isValidOMXParam(storeParam)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (storeParam->nPortIndex == kOutputPortIndex) {
|
||||
return storeParam->bStoreMetaData ? OMX_ErrorUnsupportedSetting : OMX_ErrorNone;
|
||||
} else if (storeParam->nPortIndex != kInputPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
mInputDataIsMeta = (storeParam->bStoreMetaData == OMX_TRUE);
|
||||
if (mInputDataIsMeta) {
|
||||
mColorFormat = OMX_COLOR_FormatAndroidOpaque;
|
||||
} else if (mColorFormat == OMX_COLOR_FormatAndroidOpaque) {
|
||||
mColorFormat = OMX_COLOR_FormatYUV420Planar;
|
||||
}
|
||||
updatePortParams();
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return SimpleRedroidOMXComponent::internalSetParameter(index, param);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoEncoderOMXComponent::internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR param) {
|
||||
switch ((int)index) {
|
||||
case OMX_IndexParamVideoErrorCorrection:
|
||||
{
|
||||
return OMX_ErrorNotImplemented;
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoPortFormat:
|
||||
{
|
||||
OMX_VIDEO_PARAM_PORTFORMATTYPE *formatParams =
|
||||
(OMX_VIDEO_PARAM_PORTFORMATTYPE *)param;
|
||||
|
||||
if (!isValidOMXParam(formatParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (formatParams->nPortIndex == kInputPortIndex) {
|
||||
if (formatParams->nIndex >= NELEM(kSupportedColorFormats)) {
|
||||
return OMX_ErrorNoMore;
|
||||
}
|
||||
|
||||
// Color formats, in order of preference
|
||||
formatParams->eColorFormat = kSupportedColorFormats[formatParams->nIndex];
|
||||
formatParams->eCompressionFormat = OMX_VIDEO_CodingUnused;
|
||||
formatParams->xFramerate = mFramerate;
|
||||
return OMX_ErrorNone;
|
||||
} else if (formatParams->nPortIndex == kOutputPortIndex) {
|
||||
formatParams->eCompressionFormat = mCodingType;
|
||||
formatParams->eColorFormat = OMX_COLOR_FormatUnused;
|
||||
formatParams->xFramerate = 0;
|
||||
return OMX_ErrorNone;
|
||||
} else {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoProfileLevelQuerySupported:
|
||||
{
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE *profileLevel =
|
||||
(OMX_VIDEO_PARAM_PROFILELEVELTYPE *) param;
|
||||
|
||||
if (!isValidOMXParam(profileLevel)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (profileLevel->nPortIndex != kOutputPortIndex) {
|
||||
ALOGE("Invalid port index: %u", profileLevel->nPortIndex);
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
if (profileLevel->nProfileIndex >= mNumProfileLevels) {
|
||||
return OMX_ErrorNoMore;
|
||||
}
|
||||
|
||||
profileLevel->eProfile = mProfileLevels[profileLevel->nProfileIndex].mProfile;
|
||||
profileLevel->eLevel = mProfileLevels[profileLevel->nProfileIndex].mLevel;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamConsumerUsageBits:
|
||||
{
|
||||
OMX_U32 *usageBits = (OMX_U32 *)param;
|
||||
*usageBits = GRALLOC_USAGE_SW_READ_OFTEN;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return SimpleRedroidOMXComponent::internalGetParameter(index, param);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
__attribute__((no_sanitize("integer")))
|
||||
void RedroidVideoEncoderOMXComponent::ConvertFlexYUVToPlanar(
|
||||
uint8_t *dst, size_t dstStride, size_t dstVStride,
|
||||
struct android_ycbcr *ycbcr, int32_t width, int32_t height) {
|
||||
const uint8_t *src = (const uint8_t *)ycbcr->y;
|
||||
const uint8_t *srcU = (const uint8_t *)ycbcr->cb;
|
||||
const uint8_t *srcV = (const uint8_t *)ycbcr->cr;
|
||||
uint8_t *dstU = dst + dstVStride * dstStride;
|
||||
uint8_t *dstV = dstU + (dstVStride >> 1) * (dstStride >> 1);
|
||||
|
||||
for (size_t y = height; y > 0; --y) {
|
||||
memcpy(dst, src, width);
|
||||
dst += dstStride;
|
||||
src += ycbcr->ystride;
|
||||
}
|
||||
if (ycbcr->cstride == ycbcr->ystride >> 1 && ycbcr->chroma_step == 1) {
|
||||
// planar
|
||||
for (size_t y = height >> 1; y > 0; --y) {
|
||||
memcpy(dstU, srcU, width >> 1);
|
||||
dstU += dstStride >> 1;
|
||||
srcU += ycbcr->cstride;
|
||||
memcpy(dstV, srcV, width >> 1);
|
||||
dstV += dstStride >> 1;
|
||||
srcV += ycbcr->cstride;
|
||||
}
|
||||
} else {
|
||||
// arbitrary
|
||||
for (size_t y = height >> 1; y > 0; --y) {
|
||||
for (size_t x = width >> 1; x > 0; --x) {
|
||||
*dstU++ = *srcU;
|
||||
*dstV++ = *srcV;
|
||||
srcU += ycbcr->chroma_step;
|
||||
srcV += ycbcr->chroma_step;
|
||||
}
|
||||
dstU += (dstStride >> 1) - (width >> 1);
|
||||
dstV += (dstStride >> 1) - (width >> 1);
|
||||
srcU += ycbcr->cstride - (width >> 1) * ycbcr->chroma_step;
|
||||
srcV += ycbcr->cstride - (width >> 1) * ycbcr->chroma_step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
__attribute__((no_sanitize("integer")))
|
||||
void RedroidVideoEncoderOMXComponent::ConvertYUV420SemiPlanarToYUV420Planar(
|
||||
const uint8_t *inYVU, uint8_t* outYUV, int32_t width, int32_t height) {
|
||||
// TODO: add support for stride
|
||||
int32_t outYsize = width * height;
|
||||
uint32_t *outY = (uint32_t *) outYUV;
|
||||
uint16_t *outCb = (uint16_t *) (outYUV + outYsize);
|
||||
uint16_t *outCr = (uint16_t *) (outYUV + outYsize + (outYsize >> 2));
|
||||
|
||||
/* Y copying */
|
||||
memcpy(outY, inYVU, outYsize);
|
||||
|
||||
/* U & V copying */
|
||||
// FIXME this only works if width is multiple of 4
|
||||
uint32_t *inYVU_4 = (uint32_t *) (inYVU + outYsize);
|
||||
for (int32_t i = height >> 1; i > 0; --i) {
|
||||
for (int32_t j = width >> 2; j > 0; --j) {
|
||||
uint32_t temp = *inYVU_4++;
|
||||
uint32_t tempU = temp & 0xFF;
|
||||
tempU = tempU | ((temp >> 8) & 0xFF00);
|
||||
|
||||
uint32_t tempV = (temp >> 8) & 0xFF;
|
||||
tempV = tempV | ((temp >> 16) & 0xFF00);
|
||||
|
||||
*outCb++ = tempU;
|
||||
*outCr++ = tempV;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
__attribute__((no_sanitize("integer")))
|
||||
void RedroidVideoEncoderOMXComponent::ConvertRGB32ToPlanar(
|
||||
uint8_t *dstY, size_t dstStride, size_t dstVStride,
|
||||
const uint8_t *src, size_t width, size_t height, size_t srcStride,
|
||||
bool bgr) {
|
||||
CHECK((width & 1) == 0);
|
||||
CHECK((height & 1) == 0);
|
||||
|
||||
uint8_t *dstU = dstY + dstStride * dstVStride;
|
||||
uint8_t *dstV = dstU + (dstStride >> 1) * (dstVStride >> 1);
|
||||
|
||||
#ifdef SURFACE_IS_BGR32
|
||||
bgr = !bgr;
|
||||
#endif
|
||||
|
||||
const size_t redOffset = bgr ? 2 : 0;
|
||||
const size_t greenOffset = 1;
|
||||
const size_t blueOffset = bgr ? 0 : 2;
|
||||
|
||||
for (size_t y = 0; y < height; ++y) {
|
||||
for (size_t x = 0; x < width; ++x) {
|
||||
unsigned red = src[redOffset];
|
||||
unsigned green = src[greenOffset];
|
||||
unsigned blue = src[blueOffset];
|
||||
|
||||
// Using ITU-R BT.601-7 (03/2011)
|
||||
// 2.5.1: Ey' = ( 0.299*R + 0.587*G + 0.114*B)
|
||||
// 2.5.2: ECr' = ( 0.701*R - 0.587*G - 0.114*B) / 1.402
|
||||
// ECb' = (-0.299*R - 0.587*G + 0.886*B) / 1.772
|
||||
// 2.5.3: Y = 219 * Ey' + 16
|
||||
// Cr = 224 * ECr' + 128
|
||||
// Cb = 224 * ECb' + 128
|
||||
|
||||
unsigned luma =
|
||||
((red * 65 + green * 129 + blue * 25 + 128) >> 8) + 16;
|
||||
|
||||
dstY[x] = luma;
|
||||
|
||||
if ((x & 1) == 0 && (y & 1) == 0) {
|
||||
unsigned U =
|
||||
((-red * 38 - green * 74 + blue * 112 + 128) >> 8) + 128;
|
||||
|
||||
unsigned V =
|
||||
((red * 112 - green * 94 - blue * 18 + 128) >> 8) + 128;
|
||||
|
||||
dstU[x >> 1] = U;
|
||||
dstV[x >> 1] = V;
|
||||
}
|
||||
src += 4;
|
||||
}
|
||||
|
||||
if ((y & 1) == 0) {
|
||||
dstU += dstStride >> 1;
|
||||
dstV += dstStride >> 1;
|
||||
}
|
||||
|
||||
src += srcStride - 4 * width;
|
||||
dstY += dstStride;
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t *RedroidVideoEncoderOMXComponent::extractGraphicBuffer(
|
||||
uint8_t *dst, size_t dstSize,
|
||||
const uint8_t *src, size_t srcSize,
|
||||
size_t width, size_t height) const {
|
||||
size_t dstStride = width;
|
||||
size_t dstVStride = height;
|
||||
|
||||
MetadataBufferType bufferType = *(MetadataBufferType *)src;
|
||||
bool usingANWBuffer = bufferType == kMetadataBufferTypeANWBuffer;
|
||||
if (!usingANWBuffer && bufferType != kMetadataBufferTypeGrallocSource) {
|
||||
ALOGE("Unsupported metadata type (%d)", bufferType);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer_handle_t handle;
|
||||
int format;
|
||||
size_t srcStride;
|
||||
size_t srcVStride;
|
||||
if (usingANWBuffer) {
|
||||
if (srcSize < sizeof(VideoNativeMetadata)) {
|
||||
ALOGE("Metadata is too small (%zu vs %zu)", srcSize, sizeof(VideoNativeMetadata));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VideoNativeMetadata &nativeMeta = *(VideoNativeMetadata *)src;
|
||||
ANativeWindowBuffer *buffer = nativeMeta.pBuffer;
|
||||
handle = buffer->handle;
|
||||
format = buffer->format;
|
||||
srcStride = buffer->stride;
|
||||
srcVStride = buffer->height;
|
||||
// convert stride from pixels to bytes
|
||||
if (format != HAL_PIXEL_FORMAT_YV12 &&
|
||||
format != HAL_PIXEL_FORMAT_YCrCb_420_SP &&
|
||||
format != HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
// TODO do we need to support other formats?
|
||||
srcStride *= 4;
|
||||
}
|
||||
|
||||
if (nativeMeta.nFenceFd >= 0) {
|
||||
sp<Fence> fence = new Fence(nativeMeta.nFenceFd);
|
||||
nativeMeta.nFenceFd = -1;
|
||||
status_t err = fence->wait(kFenceTimeoutMs);
|
||||
if (err != OK) {
|
||||
ALOGE("Timed out waiting on input fence");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: remove this part. Check if anyone uses this.
|
||||
|
||||
if (srcSize < sizeof(VideoGrallocMetadata)) {
|
||||
ALOGE("Metadata is too small (%zu vs %zu)", srcSize, sizeof(VideoGrallocMetadata));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VideoGrallocMetadata &grallocMeta = *(VideoGrallocMetadata *)(src);
|
||||
handle = grallocMeta.pHandle;
|
||||
// assume HAL_PIXEL_FORMAT_RGBA_8888
|
||||
// there is no way to get the src stride without the graphic buffer
|
||||
format = HAL_PIXEL_FORMAT_RGBA_8888;
|
||||
srcStride = width * 4;
|
||||
srcVStride = height;
|
||||
}
|
||||
|
||||
size_t neededSize =
|
||||
dstStride * dstVStride + (width >> 1)
|
||||
+ (dstStride >> 1) * ((dstVStride >> 1) + (height >> 1) - 1);
|
||||
if (dstSize < neededSize) {
|
||||
ALOGE("destination buffer is too small (%zu vs %zu)", dstSize, neededSize);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
auto& mapper = GraphicBufferMapper::get();
|
||||
|
||||
void *bits = NULL;
|
||||
struct android_ycbcr ycbcr;
|
||||
status_t res;
|
||||
if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) {
|
||||
res = mapper.lockYCbCr(
|
||||
handle,
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER,
|
||||
Rect(width, height), &ycbcr);
|
||||
} else {
|
||||
res = mapper.lock(
|
||||
handle,
|
||||
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_NEVER,
|
||||
Rect(width, height), &bits);
|
||||
}
|
||||
if (res != OK) {
|
||||
ALOGE("Unable to lock image buffer %p for access", handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YV12: // YCrCb / YVU planar
|
||||
ycbcr.y = bits;
|
||||
ycbcr.cr = (uint8_t *)bits + srcStride * srcVStride;
|
||||
ycbcr.cb = (uint8_t *)ycbcr.cr + (srcStride >> 1) * (srcVStride >> 1);
|
||||
ycbcr.chroma_step = 1;
|
||||
ycbcr.cstride = srcStride >> 1;
|
||||
ycbcr.ystride = srcStride;
|
||||
ConvertFlexYUVToPlanar(dst, dstStride, dstVStride, &ycbcr, width, height);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP: // YCrCb / YVU semiplanar, NV21
|
||||
ycbcr.y = bits;
|
||||
ycbcr.cr = (uint8_t *)bits + srcStride * srcVStride;
|
||||
ycbcr.cb = (uint8_t *)ycbcr.cr + 1;
|
||||
ycbcr.chroma_step = 2;
|
||||
ycbcr.cstride = srcStride;
|
||||
ycbcr.ystride = srcStride;
|
||||
ConvertFlexYUVToPlanar(dst, dstStride, dstVStride, &ycbcr, width, height);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_888: // YCbCr / YUV planar
|
||||
ConvertFlexYUVToPlanar(dst, dstStride, dstVStride, &ycbcr, width, height);
|
||||
break;
|
||||
case HAL_PIXEL_FORMAT_RGBX_8888:
|
||||
case HAL_PIXEL_FORMAT_RGBA_8888:
|
||||
case HAL_PIXEL_FORMAT_BGRA_8888:
|
||||
ConvertRGB32ToPlanar(
|
||||
dst, dstStride, dstVStride,
|
||||
(const uint8_t *)bits, width, height, srcStride,
|
||||
format == HAL_PIXEL_FORMAT_BGRA_8888);
|
||||
break;
|
||||
default:
|
||||
ALOGE("Unsupported pixel format %#x", format);
|
||||
dst = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mapper.unlock(handle) != OK) {
|
||||
ALOGE("Unable to unlock image buffer %p for access", handle);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoEncoderOMXComponent::getExtensionIndex(
|
||||
const char *name, OMX_INDEXTYPE *index) {
|
||||
if (!strcmp(name, "OMX.google.android.index.storeMetaDataInBuffers") ||
|
||||
!strcmp(name, "OMX.google.android.index.storeANWBufferInMetadata")) {
|
||||
*(int32_t*)index = kStoreMetaDataExtensionIndex;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
return SimpleRedroidOMXComponent::getExtensionIndex(name, index);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidVideoEncoderOMXComponent::validateInputBuffer(
|
||||
const OMX_BUFFERHEADERTYPE *inputBufferHeader) {
|
||||
size_t frameSize = mInputDataIsMeta ?
|
||||
max(sizeof(VideoNativeMetadata), sizeof(VideoGrallocMetadata))
|
||||
: mWidth * mHeight * 3 / 2;
|
||||
if (inputBufferHeader->nFilledLen < frameSize) {
|
||||
return OMX_ErrorUndefined;
|
||||
} else if (inputBufferHeader->nFilledLen > frameSize) {
|
||||
ALOGW("Input buffer contains more data than expected.");
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,757 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "SimpleRedroidOMXComponent"
|
||||
#include <utils/Log.h>
|
||||
#include <OMX_Core.h>
|
||||
#include <OMX_Audio.h>
|
||||
#include <OMX_IndexExt.h>
|
||||
#include <OMX_AudioExt.h>
|
||||
|
||||
#include <media/stagefright/omx/SimpleRedroidOMXComponent.h>
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <media/stagefright/foundation/ALooper.h>
|
||||
#include <media/stagefright/foundation/AMessage.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
SimpleRedroidOMXComponent::SimpleRedroidOMXComponent(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component)
|
||||
: RedroidOMXComponent(name, callbacks, appData, component),
|
||||
mLooper(new ALooper),
|
||||
mHandler(new AHandlerReflector<SimpleRedroidOMXComponent>(this)),
|
||||
mState(OMX_StateLoaded),
|
||||
mTargetState(OMX_StateLoaded),
|
||||
mFrameConfig(false) {
|
||||
mLooper->setName(name);
|
||||
mLooper->registerHandler(mHandler);
|
||||
|
||||
mLooper->start(
|
||||
false, // runOnCallingThread
|
||||
false, // canCallJava
|
||||
ANDROID_PRIORITY_VIDEO);
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::prepareForDestruction() {
|
||||
// The looper's queue may still contain messages referencing this
|
||||
// object. Make sure those are flushed before returning so that
|
||||
// a subsequent dlunload() does not pull out the rug from under us.
|
||||
|
||||
mLooper->unregisterHandler(mHandler->id());
|
||||
mLooper->stop();
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::sendCommand(
|
||||
OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR data) {
|
||||
CHECK(data == NULL);
|
||||
|
||||
sp<AMessage> msg = new AMessage(kWhatSendCommand, mHandler);
|
||||
msg->setInt32("cmd", cmd);
|
||||
msg->setInt32("param", param);
|
||||
msg->post();
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
bool SimpleRedroidOMXComponent::isSetParameterAllowed(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) const {
|
||||
if (mState == OMX_StateLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
OMX_U32 portIndex;
|
||||
|
||||
switch ((int)index) {
|
||||
case OMX_IndexParamPortDefinition:
|
||||
{
|
||||
const OMX_PARAM_PORTDEFINITIONTYPE *portDefs =
|
||||
(const OMX_PARAM_PORTDEFINITIONTYPE *) params;
|
||||
if (!isValidOMXParam(portDefs)) {
|
||||
return false;
|
||||
}
|
||||
portIndex = portDefs->nPortIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
case OMX_IndexParamAudioPcm:
|
||||
{
|
||||
const OMX_AUDIO_PARAM_PCMMODETYPE *pcmMode =
|
||||
(const OMX_AUDIO_PARAM_PCMMODETYPE *) params;
|
||||
if (!isValidOMXParam(pcmMode)) {
|
||||
return false;
|
||||
}
|
||||
portIndex = pcmMode->nPortIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
case OMX_IndexParamAudioAac:
|
||||
{
|
||||
const OMX_AUDIO_PARAM_AACPROFILETYPE *aacMode =
|
||||
(const OMX_AUDIO_PARAM_AACPROFILETYPE *) params;
|
||||
if (!isValidOMXParam(aacMode)) {
|
||||
return false;
|
||||
}
|
||||
portIndex = aacMode->nPortIndex;
|
||||
break;
|
||||
}
|
||||
|
||||
case OMX_IndexParamAudioAndroidAacDrcPresentation:
|
||||
{
|
||||
if (mState == OMX_StateInvalid) {
|
||||
return false;
|
||||
}
|
||||
const OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE *aacPresParams =
|
||||
(const OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE *)params;
|
||||
if (!isValidOMXParam(aacPresParams)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK(portIndex < mPorts.size());
|
||||
|
||||
return !mPorts.itemAt(portIndex).mDef.bEnabled;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::getParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
return internalGetParameter(index, params);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::setParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
CHECK(isSetParameterAllowed(index, params));
|
||||
|
||||
return internalSetParameter(index, params);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params) {
|
||||
switch (index) {
|
||||
case OMX_IndexParamPortDefinition:
|
||||
{
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *defParams =
|
||||
(OMX_PARAM_PORTDEFINITIONTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(defParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (defParams->nPortIndex >= mPorts.size()
|
||||
|| defParams->nSize
|
||||
!= sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
const PortInfo *port =
|
||||
&mPorts.itemAt(defParams->nPortIndex);
|
||||
|
||||
memcpy(defParams, &port->mDef, sizeof(port->mDef));
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) {
|
||||
switch (index) {
|
||||
case OMX_IndexParamPortDefinition:
|
||||
{
|
||||
OMX_PARAM_PORTDEFINITIONTYPE *defParams =
|
||||
(OMX_PARAM_PORTDEFINITIONTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(defParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (defParams->nPortIndex >= mPorts.size()) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
if (defParams->nSize != sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) {
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
PortInfo *port =
|
||||
&mPorts.editItemAt(defParams->nPortIndex);
|
||||
|
||||
// default behavior is that we only allow buffer size to increase
|
||||
if (defParams->nBufferSize > port->mDef.nBufferSize) {
|
||||
port->mDef.nBufferSize = defParams->nBufferSize;
|
||||
}
|
||||
|
||||
if (defParams->nBufferCountActual < port->mDef.nBufferCountMin) {
|
||||
ALOGW("component requires at least %u buffers (%u requested)",
|
||||
port->mDef.nBufferCountMin, defParams->nBufferCountActual);
|
||||
return OMX_ErrorUnsupportedSetting;
|
||||
}
|
||||
|
||||
port->mDef.nBufferCountActual = defParams->nBufferCountActual;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params, bool *frameConfig) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::setConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) {
|
||||
bool frameConfig = mFrameConfig;
|
||||
OMX_ERRORTYPE err = internalSetConfig(index, params, &frameConfig);
|
||||
if (err == OMX_ErrorNone) {
|
||||
mFrameConfig = frameConfig;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::useBuffer(
|
||||
OMX_BUFFERHEADERTYPE **header,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size,
|
||||
OMX_U8 *ptr) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
|
||||
PortInfo *port = &mPorts.editItemAt(portIndex);
|
||||
if (size < port->mDef.nBufferSize) {
|
||||
ALOGE("b/63522430, Buffer size is too small.");
|
||||
android_errorWriteLog(0x534e4554, "63522430");
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
*header = new OMX_BUFFERHEADERTYPE;
|
||||
(*header)->nSize = sizeof(OMX_BUFFERHEADERTYPE);
|
||||
(*header)->nVersion.s.nVersionMajor = 1;
|
||||
(*header)->nVersion.s.nVersionMinor = 0;
|
||||
(*header)->nVersion.s.nRevision = 0;
|
||||
(*header)->nVersion.s.nStep = 0;
|
||||
(*header)->pBuffer = ptr;
|
||||
(*header)->nAllocLen = size;
|
||||
(*header)->nFilledLen = 0;
|
||||
(*header)->nOffset = 0;
|
||||
(*header)->pAppPrivate = appPrivate;
|
||||
(*header)->pPlatformPrivate = NULL;
|
||||
(*header)->pInputPortPrivate = NULL;
|
||||
(*header)->pOutputPortPrivate = NULL;
|
||||
(*header)->hMarkTargetComponent = NULL;
|
||||
(*header)->pMarkData = NULL;
|
||||
(*header)->nTickCount = 0;
|
||||
(*header)->nTimeStamp = 0;
|
||||
(*header)->nFlags = 0;
|
||||
(*header)->nOutputPortIndex = portIndex;
|
||||
(*header)->nInputPortIndex = portIndex;
|
||||
|
||||
CHECK(mState == OMX_StateLoaded || port->mDef.bEnabled == OMX_FALSE);
|
||||
|
||||
CHECK_LT(port->mBuffers.size(), port->mDef.nBufferCountActual);
|
||||
|
||||
port->mBuffers.push();
|
||||
|
||||
BufferInfo *buffer =
|
||||
&port->mBuffers.editItemAt(port->mBuffers.size() - 1);
|
||||
|
||||
buffer->mHeader = *header;
|
||||
buffer->mOwnedByUs = false;
|
||||
|
||||
if (port->mBuffers.size() == port->mDef.nBufferCountActual) {
|
||||
port->mDef.bPopulated = OMX_TRUE;
|
||||
checkTransitions();
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::allocateBuffer(
|
||||
OMX_BUFFERHEADERTYPE **header,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size) {
|
||||
OMX_U8 *ptr = new OMX_U8[size];
|
||||
|
||||
OMX_ERRORTYPE err =
|
||||
useBuffer(header, portIndex, appPrivate, size, ptr);
|
||||
|
||||
if (err != OMX_ErrorNone) {
|
||||
delete[] ptr;
|
||||
ptr = NULL;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
CHECK((*header)->pPlatformPrivate == NULL);
|
||||
(*header)->pPlatformPrivate = ptr;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::freeBuffer(
|
||||
OMX_U32 portIndex,
|
||||
OMX_BUFFERHEADERTYPE *header) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
|
||||
PortInfo *port = &mPorts.editItemAt(portIndex);
|
||||
|
||||
#if 0 // XXX
|
||||
CHECK((mState == OMX_StateIdle && mTargetState == OMX_StateLoaded)
|
||||
|| port->mDef.bEnabled == OMX_FALSE);
|
||||
#endif
|
||||
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < port->mBuffers.size(); ++i) {
|
||||
BufferInfo *buffer = &port->mBuffers.editItemAt(i);
|
||||
|
||||
if (buffer->mHeader == header) {
|
||||
CHECK(!buffer->mOwnedByUs);
|
||||
|
||||
if (header->pPlatformPrivate != NULL) {
|
||||
// This buffer's data was allocated by us.
|
||||
CHECK(header->pPlatformPrivate == header->pBuffer);
|
||||
|
||||
delete[] header->pBuffer;
|
||||
header->pBuffer = NULL;
|
||||
}
|
||||
|
||||
delete header;
|
||||
header = NULL;
|
||||
|
||||
port->mBuffers.removeAt(i);
|
||||
port->mDef.bPopulated = OMX_FALSE;
|
||||
|
||||
checkTransitions();
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(found);
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::emptyThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
sp<AMessage> msg = new AMessage(kWhatEmptyThisBuffer, mHandler);
|
||||
msg->setPointer("header", buffer);
|
||||
if (mFrameConfig) {
|
||||
msg->setInt32("frame-config", mFrameConfig);
|
||||
mFrameConfig = false;
|
||||
}
|
||||
msg->post();
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::fillThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer) {
|
||||
sp<AMessage> msg = new AMessage(kWhatFillThisBuffer, mHandler);
|
||||
msg->setPointer("header", buffer);
|
||||
msg->post();
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE SimpleRedroidOMXComponent::getState(OMX_STATETYPE *state) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
|
||||
*state = mState;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onMessageReceived(const sp<AMessage> &msg) {
|
||||
Mutex::Autolock autoLock(mLock);
|
||||
uint32_t msgType = msg->what();
|
||||
ALOGV("msgType = %d", msgType);
|
||||
switch (msgType) {
|
||||
case kWhatSendCommand:
|
||||
{
|
||||
int32_t cmd, param;
|
||||
CHECK(msg->findInt32("cmd", &cmd));
|
||||
CHECK(msg->findInt32("param", ¶m));
|
||||
|
||||
onSendCommand((OMX_COMMANDTYPE)cmd, (OMX_U32)param);
|
||||
break;
|
||||
}
|
||||
|
||||
case kWhatEmptyThisBuffer:
|
||||
case kWhatFillThisBuffer:
|
||||
{
|
||||
OMX_BUFFERHEADERTYPE *header;
|
||||
CHECK(msg->findPointer("header", (void **)&header));
|
||||
int32_t frameConfig;
|
||||
if (!msg->findInt32("frame-config", &frameConfig)) {
|
||||
frameConfig = 0;
|
||||
}
|
||||
|
||||
CHECK(mState == OMX_StateExecuting && mTargetState == mState);
|
||||
|
||||
bool found = false;
|
||||
size_t portIndex = (kWhatEmptyThisBuffer == msgType)?
|
||||
header->nInputPortIndex: header->nOutputPortIndex;
|
||||
PortInfo *port = &mPorts.editItemAt(portIndex);
|
||||
|
||||
for (size_t j = 0; j < port->mBuffers.size(); ++j) {
|
||||
BufferInfo *buffer = &port->mBuffers.editItemAt(j);
|
||||
|
||||
if (buffer->mHeader == header) {
|
||||
CHECK(!buffer->mOwnedByUs);
|
||||
|
||||
buffer->mOwnedByUs = true;
|
||||
buffer->mFrameConfig = (bool)frameConfig;
|
||||
|
||||
CHECK((msgType == kWhatEmptyThisBuffer
|
||||
&& port->mDef.eDir == OMX_DirInput)
|
||||
|| (port->mDef.eDir == OMX_DirOutput));
|
||||
|
||||
port->mQueue.push_back(buffer);
|
||||
onQueueFilled(portIndex);
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK(found);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
TRESPASS();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onSendCommand(
|
||||
OMX_COMMANDTYPE cmd, OMX_U32 param) {
|
||||
switch (cmd) {
|
||||
case OMX_CommandStateSet:
|
||||
{
|
||||
onChangeState((OMX_STATETYPE)param);
|
||||
break;
|
||||
}
|
||||
|
||||
case OMX_CommandPortEnable:
|
||||
case OMX_CommandPortDisable:
|
||||
{
|
||||
onPortEnable(param, cmd == OMX_CommandPortEnable);
|
||||
break;
|
||||
}
|
||||
|
||||
case OMX_CommandFlush:
|
||||
{
|
||||
onPortFlush(param, true /* sendFlushComplete */);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
TRESPASS();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onChangeState(OMX_STATETYPE state) {
|
||||
ALOGV("%p requesting change from %d to %d", this, mState, state);
|
||||
// We shouldn't be in a state transition already.
|
||||
|
||||
if (mState == OMX_StateLoaded
|
||||
&& mTargetState == OMX_StateIdle
|
||||
&& state == OMX_StateLoaded) {
|
||||
// OMX specifically allows "canceling" a state transition from loaded
|
||||
// to idle. Pretend we made it to idle, and go back to loaded
|
||||
ALOGV("load->idle canceled");
|
||||
mState = mTargetState = OMX_StateIdle;
|
||||
state = OMX_StateLoaded;
|
||||
}
|
||||
|
||||
if (mState != mTargetState) {
|
||||
ALOGE("State change to state %d requested while still transitioning from state %d to %d",
|
||||
state, mState, mTargetState);
|
||||
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (mState) {
|
||||
case OMX_StateLoaded:
|
||||
CHECK_EQ((int)state, (int)OMX_StateIdle);
|
||||
break;
|
||||
case OMX_StateIdle:
|
||||
CHECK(state == OMX_StateLoaded || state == OMX_StateExecuting);
|
||||
break;
|
||||
case OMX_StateExecuting:
|
||||
{
|
||||
CHECK_EQ((int)state, (int)OMX_StateIdle);
|
||||
|
||||
for (size_t i = 0; i < mPorts.size(); ++i) {
|
||||
onPortFlush(i, false /* sendFlushComplete */);
|
||||
}
|
||||
|
||||
mState = OMX_StateIdle;
|
||||
notify(OMX_EventCmdComplete, OMX_CommandStateSet, state, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
TRESPASS();
|
||||
}
|
||||
|
||||
mTargetState = state;
|
||||
|
||||
checkTransitions();
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onReset() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onPortEnable(OMX_U32 portIndex, bool enable) {
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
|
||||
PortInfo *port = &mPorts.editItemAt(portIndex);
|
||||
CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE);
|
||||
CHECK(port->mDef.bEnabled == !enable);
|
||||
|
||||
if (port->mDef.eDir != OMX_DirOutput) {
|
||||
ALOGE("Port enable/disable allowed only on output ports.");
|
||||
notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
|
||||
android_errorWriteLog(0x534e4554, "29421804");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
port->mDef.bEnabled = OMX_FALSE;
|
||||
port->mTransition = PortInfo::DISABLING;
|
||||
|
||||
for (size_t i = 0; i < port->mBuffers.size(); ++i) {
|
||||
BufferInfo *buffer = &port->mBuffers.editItemAt(i);
|
||||
|
||||
if (buffer->mOwnedByUs) {
|
||||
buffer->mOwnedByUs = false;
|
||||
|
||||
if (port->mDef.eDir == OMX_DirInput) {
|
||||
notifyEmptyBufferDone(buffer->mHeader);
|
||||
} else {
|
||||
CHECK_EQ(port->mDef.eDir, OMX_DirOutput);
|
||||
notifyFillBufferDone(buffer->mHeader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
port->mQueue.clear();
|
||||
} else {
|
||||
port->mTransition = PortInfo::ENABLING;
|
||||
}
|
||||
|
||||
checkTransitions();
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onPortFlush(
|
||||
OMX_U32 portIndex, bool sendFlushComplete) {
|
||||
if (portIndex == OMX_ALL) {
|
||||
for (size_t i = 0; i < mPorts.size(); ++i) {
|
||||
onPortFlush(i, sendFlushComplete);
|
||||
}
|
||||
|
||||
if (sendFlushComplete) {
|
||||
notify(OMX_EventCmdComplete, OMX_CommandFlush, OMX_ALL, NULL);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
|
||||
PortInfo *port = &mPorts.editItemAt(portIndex);
|
||||
// Ideally, the port should not in transitioning state when flushing.
|
||||
// However, in error handling case, e.g., the client can't allocate buffers
|
||||
// when it tries to re-enable the port, the port will be stuck in ENABLING.
|
||||
// The client will then transition the component from Executing to Idle,
|
||||
// which leads to flushing ports. At this time, it should be ok to notify
|
||||
// the client of the error and still clear all buffers on the port.
|
||||
if (port->mTransition != PortInfo::NONE) {
|
||||
notify(OMX_EventError, OMX_ErrorUndefined, 0, 0);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < port->mBuffers.size(); ++i) {
|
||||
BufferInfo *buffer = &port->mBuffers.editItemAt(i);
|
||||
|
||||
if (!buffer->mOwnedByUs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
buffer->mHeader->nFilledLen = 0;
|
||||
buffer->mHeader->nOffset = 0;
|
||||
buffer->mHeader->nFlags = 0;
|
||||
|
||||
buffer->mOwnedByUs = false;
|
||||
|
||||
if (port->mDef.eDir == OMX_DirInput) {
|
||||
notifyEmptyBufferDone(buffer->mHeader);
|
||||
} else {
|
||||
CHECK_EQ(port->mDef.eDir, OMX_DirOutput);
|
||||
|
||||
notifyFillBufferDone(buffer->mHeader);
|
||||
}
|
||||
}
|
||||
|
||||
port->mQueue.clear();
|
||||
|
||||
if (sendFlushComplete) {
|
||||
notify(OMX_EventCmdComplete, OMX_CommandFlush, portIndex, NULL);
|
||||
|
||||
onPortFlushCompleted(portIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::checkTransitions() {
|
||||
if (mState != mTargetState) {
|
||||
bool transitionComplete = true;
|
||||
|
||||
if (mState == OMX_StateLoaded) {
|
||||
CHECK_EQ((int)mTargetState, (int)OMX_StateIdle);
|
||||
|
||||
for (size_t i = 0; i < mPorts.size(); ++i) {
|
||||
const PortInfo &port = mPorts.itemAt(i);
|
||||
if (port.mDef.bEnabled == OMX_FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (port.mDef.bPopulated == OMX_FALSE) {
|
||||
transitionComplete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mTargetState == OMX_StateLoaded) {
|
||||
CHECK_EQ((int)mState, (int)OMX_StateIdle);
|
||||
|
||||
for (size_t i = 0; i < mPorts.size(); ++i) {
|
||||
const PortInfo &port = mPorts.itemAt(i);
|
||||
if (port.mDef.bEnabled == OMX_FALSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t n = port.mBuffers.size();
|
||||
|
||||
if (n > 0) {
|
||||
CHECK_LE(n, port.mDef.nBufferCountActual);
|
||||
|
||||
if (n == port.mDef.nBufferCountActual) {
|
||||
CHECK_EQ((int)port.mDef.bPopulated, (int)OMX_TRUE);
|
||||
} else {
|
||||
CHECK_EQ((int)port.mDef.bPopulated, (int)OMX_FALSE);
|
||||
}
|
||||
|
||||
transitionComplete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (transitionComplete) {
|
||||
ALOGV("state transition from %d to %d complete", mState, mTargetState);
|
||||
mState = mTargetState;
|
||||
|
||||
if (mState == OMX_StateLoaded) {
|
||||
onReset();
|
||||
}
|
||||
|
||||
notify(OMX_EventCmdComplete, OMX_CommandStateSet, mState, NULL);
|
||||
} else {
|
||||
ALOGV("state transition from %d to %d not yet complete", mState, mTargetState);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mPorts.size(); ++i) {
|
||||
PortInfo *port = &mPorts.editItemAt(i);
|
||||
|
||||
if (port->mTransition == PortInfo::DISABLING) {
|
||||
if (port->mBuffers.empty()) {
|
||||
ALOGV("Port %zu now disabled.", i);
|
||||
|
||||
port->mTransition = PortInfo::NONE;
|
||||
notify(OMX_EventCmdComplete, OMX_CommandPortDisable, i, NULL);
|
||||
|
||||
onPortEnableCompleted(i, false /* enabled */);
|
||||
}
|
||||
} else if (port->mTransition == PortInfo::ENABLING) {
|
||||
if (port->mDef.bPopulated == OMX_TRUE) {
|
||||
ALOGV("Port %zu now enabled.", i);
|
||||
|
||||
port->mTransition = PortInfo::NONE;
|
||||
port->mDef.bEnabled = OMX_TRUE;
|
||||
notify(OMX_EventCmdComplete, OMX_CommandPortEnable, i, NULL);
|
||||
|
||||
onPortEnableCompleted(i, true /* enabled */);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::addPort(const OMX_PARAM_PORTDEFINITIONTYPE &def) {
|
||||
CHECK_EQ(def.nPortIndex, mPorts.size());
|
||||
|
||||
mPorts.push();
|
||||
PortInfo *info = &mPorts.editItemAt(mPorts.size() - 1);
|
||||
info->mDef = def;
|
||||
info->mTransition = PortInfo::NONE;
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onQueueFilled(OMX_U32 portIndex __unused) {
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onPortFlushCompleted(OMX_U32 portIndex __unused) {
|
||||
}
|
||||
|
||||
void SimpleRedroidOMXComponent::onPortEnableCompleted(
|
||||
OMX_U32 portIndex __unused, bool enabled __unused) {
|
||||
}
|
||||
|
||||
List<SimpleRedroidOMXComponent::BufferInfo *> &
|
||||
SimpleRedroidOMXComponent::getPortQueue(OMX_U32 portIndex) {
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
return mPorts.editItemAt(portIndex).mQueue;
|
||||
}
|
||||
|
||||
SimpleRedroidOMXComponent::PortInfo *SimpleRedroidOMXComponent::editPortInfo(
|
||||
OMX_U32 portIndex) {
|
||||
CHECK_LT(portIndex, mPorts.size());
|
||||
return &mPorts.editItemAt(portIndex);
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,16 +0,0 @@
|
||||
cc_library_shared {
|
||||
name: "libstagefright_redroid_avcenc",
|
||||
defaults: ["libstagefright_redroid_omx-defaults"],
|
||||
|
||||
srcs: ["RedroidAVCEnc.cpp"],
|
||||
|
||||
header_libs: [
|
||||
"libnativebase_headers",
|
||||
],
|
||||
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wno-unused-variable",
|
||||
],
|
||||
ldflags: ["-Wl,-Bsymbolic"],
|
||||
}
|
||||
@@ -1,465 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 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.
|
||||
*/
|
||||
|
||||
//#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "RedroidAVCEnc"
|
||||
#include <utils/Log.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
#include "OMX_Video.h"
|
||||
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <media/hardware/MetadataBufferType.h>
|
||||
#include <media/stagefright/foundation/ADebug.h>
|
||||
#include <OMX_IndexExt.h>
|
||||
#include <OMX_VideoExt.h>
|
||||
|
||||
#include <nativebase/nativebase.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "RedroidAVCEnc.h"
|
||||
|
||||
#define d(...) ALOGD(__VA_ARGS__)
|
||||
#define i(...) ALOGI(__VA_ARGS__)
|
||||
#define e(...) ALOGE(__VA_ARGS__)
|
||||
|
||||
namespace android {
|
||||
|
||||
|
||||
static ANativeWindowBuffer *getANWBuffer(void *src, size_t srcSize) {
|
||||
MetadataBufferType bufferType = *(MetadataBufferType *)src;
|
||||
bool usingANWBuffer = bufferType == kMetadataBufferTypeANWBuffer;
|
||||
if (!usingANWBuffer && bufferType != kMetadataBufferTypeGrallocSource) {
|
||||
ALOGE("Unsupported metadata type (%d)", bufferType);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (usingANWBuffer) {
|
||||
if (srcSize < sizeof(VideoNativeMetadata)) {
|
||||
ALOGE("Metadata is too small (%zu vs %zu)", srcSize, sizeof(VideoNativeMetadata));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
VideoNativeMetadata &nativeMeta = *(VideoNativeMetadata *)src;
|
||||
return nativeMeta.pBuffer;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const CodecProfileLevel kProfileLevels[] = {
|
||||
{ OMX_VIDEO_AVCProfileConstrainedBaseline, OMX_VIDEO_AVCLevel41 },
|
||||
|
||||
{ OMX_VIDEO_AVCProfileBaseline, OMX_VIDEO_AVCLevel41 },
|
||||
|
||||
{ OMX_VIDEO_AVCProfileMain, OMX_VIDEO_AVCLevel41 },
|
||||
};
|
||||
|
||||
RedroidAVCEnc::RedroidAVCEnc(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component)
|
||||
: RedroidVideoEncoderOMXComponent(
|
||||
name, "video_encoder.avc", OMX_VIDEO_CodingAVC,
|
||||
kProfileLevels, NELEM(kProfileLevels),
|
||||
176 /* width */, 144 /* height */,
|
||||
callbacks, appData, component),
|
||||
mUpdateFlag(0),
|
||||
mStarted(false),
|
||||
mCodecLibHandle(nullptr),
|
||||
mCodec(nullptr),
|
||||
mCodecCtx(nullptr),
|
||||
mSawInputEOS(false),
|
||||
mSawOutputEOS(false),
|
||||
mSignalledError(false) {
|
||||
|
||||
initPorts(kNumBuffers, kNumBuffers, ((mWidth * mHeight * 3) >> 1),
|
||||
"video/avc", 2);
|
||||
|
||||
// If dump is enabled, then open create an empty file
|
||||
GENERATE_FILE_NAMES();
|
||||
CREATE_DUMP_FILE(mInFile);
|
||||
CREATE_DUMP_FILE(mOutFile);
|
||||
memset(mConversionBuffers, 0, sizeof(mConversionBuffers));
|
||||
memset(mInputBufferInfo, 0, sizeof(mInputBufferInfo));
|
||||
|
||||
}
|
||||
|
||||
RedroidAVCEnc::~RedroidAVCEnc() {
|
||||
d(__func__);
|
||||
releaseEncoder();
|
||||
List<BufferInfo *> &outQueue = getPortQueue(1);
|
||||
List<BufferInfo *> &inQueue = getPortQueue(0);
|
||||
CHECK(outQueue.empty());
|
||||
CHECK(inQueue.empty());
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::setBitRate() {
|
||||
ALOGW("TODO unsupported setBitRate()");
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::initEncoder() {
|
||||
mCodecLibHandle = dlopen("libmedia_codec.so", RTLD_NOW|RTLD_NODELETE);
|
||||
CHECK(mCodecLibHandle);
|
||||
|
||||
// extern "C" media_codec_t *get_media_codec()
|
||||
typedef media_codec_t *(*get_media_codec_func)();
|
||||
get_media_codec_func func = (get_media_codec_func) dlsym(mCodecLibHandle, "get_media_codec");
|
||||
CHECK(func);
|
||||
|
||||
mCodec = func();
|
||||
CHECK(mCodec);
|
||||
|
||||
mCodecCtx = mCodec->codec_alloc(H264_ENCODE, nullptr);
|
||||
CHECK(mCodecCtx);
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::releaseEncoder() {
|
||||
d(__func__);
|
||||
if (mCodecCtx) {
|
||||
mCodec->codec_free(mCodecCtx);
|
||||
mCodecCtx = nullptr;
|
||||
}
|
||||
|
||||
if (mCodecLibHandle) {
|
||||
dlclose(mCodecLibHandle);
|
||||
mCodecLibHandle = nullptr;
|
||||
mCodec = nullptr;
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::internalGetParameter(OMX_INDEXTYPE index, OMX_PTR params) {
|
||||
switch (index) {
|
||||
case OMX_IndexParamVideoBitrate:
|
||||
{
|
||||
OMX_VIDEO_PARAM_BITRATETYPE *bitRate =
|
||||
(OMX_VIDEO_PARAM_BITRATETYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(bitRate)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (bitRate->nPortIndex != 1) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
bitRate->eControlRate = OMX_Video_ControlRateVariable;
|
||||
bitRate->nTargetBitrate = mBitrate;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoAvc:
|
||||
{
|
||||
OMX_VIDEO_PARAM_AVCTYPE *avcParams = (OMX_VIDEO_PARAM_AVCTYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(avcParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (avcParams->nPortIndex != 1) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
// TODO: maintain profile
|
||||
avcParams->eProfile = (OMX_VIDEO_AVCPROFILETYPE)OMX_VIDEO_AVCProfileConstrainedBaseline;
|
||||
avcParams->eLevel = OMX_VIDEO_AVCLevel41;
|
||||
avcParams->nRefFrames = 1;
|
||||
avcParams->bUseHadamard = OMX_TRUE;
|
||||
avcParams->nAllowedPictureTypes = (OMX_VIDEO_PictureTypeI
|
||||
| OMX_VIDEO_PictureTypeP | OMX_VIDEO_PictureTypeB);
|
||||
avcParams->nRefIdx10ActiveMinus1 = 0;
|
||||
avcParams->nRefIdx11ActiveMinus1 = 0;
|
||||
avcParams->bWeightedPPrediction = OMX_FALSE;
|
||||
avcParams->bconstIpred = OMX_FALSE;
|
||||
avcParams->bDirect8x8Inference = OMX_FALSE;
|
||||
avcParams->bDirectSpatialTemporal = OMX_FALSE;
|
||||
avcParams->nCabacInitIdc = 0;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return RedroidVideoEncoderOMXComponent::internalGetParameter(index, params);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR params) {
|
||||
int32_t indexFull = index;
|
||||
|
||||
switch (indexFull) {
|
||||
case OMX_IndexParamVideoBitrate:
|
||||
{
|
||||
OMX_VIDEO_PARAM_BITRATETYPE *bitRate =
|
||||
(OMX_VIDEO_PARAM_BITRATETYPE *)params;
|
||||
|
||||
if (!isValidOMXParam(bitRate)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
return internalSetBitrateParams(bitRate);
|
||||
}
|
||||
|
||||
case OMX_IndexParamVideoAvc:
|
||||
{
|
||||
ALOGW("TODO unsupported settings [OMX_IndexParamVideoAvc]");
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return RedroidVideoEncoderOMXComponent::internalSetParameter(index, params);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::getConfig(
|
||||
OMX_INDEXTYPE index, OMX_PTR _params) {
|
||||
switch ((int)index) {
|
||||
case OMX_IndexConfigAndroidIntraRefresh:
|
||||
{
|
||||
OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE *intraRefreshParams =
|
||||
(OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE *)_params;
|
||||
|
||||
if (!isValidOMXParam(intraRefreshParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (intraRefreshParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
intraRefreshParams->nRefreshPeriod = 0;
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return RedroidVideoEncoderOMXComponent::getConfig(index, _params);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR _params, bool *frameConfig) {
|
||||
switch ((int)index) {
|
||||
case OMX_IndexConfigVideoIntraVOPRefresh:
|
||||
{
|
||||
OMX_CONFIG_INTRAREFRESHVOPTYPE *params =
|
||||
(OMX_CONFIG_INTRAREFRESHVOPTYPE *)_params;
|
||||
|
||||
if (!isValidOMXParam(params)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (params->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
if (params->IntraRefreshVOP) {
|
||||
mUpdateFlag |= kRequestKeyFrame;
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexConfigVideoBitrate:
|
||||
{
|
||||
OMX_VIDEO_CONFIG_BITRATETYPE *params =
|
||||
(OMX_VIDEO_CONFIG_BITRATETYPE *)_params;
|
||||
|
||||
if (!isValidOMXParam(params)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (params->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorBadPortIndex;
|
||||
}
|
||||
|
||||
if (mBitrate != params->nEncodeBitrate) {
|
||||
mBitrate = params->nEncodeBitrate;
|
||||
mUpdateFlag |= kUpdateBitrate;
|
||||
}
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
case OMX_IndexConfigAndroidIntraRefresh:
|
||||
{
|
||||
const OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE *intraRefreshParams =
|
||||
(const OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE *)_params;
|
||||
|
||||
if (!isValidOMXParam(intraRefreshParams)) {
|
||||
return OMX_ErrorBadParameter;
|
||||
}
|
||||
|
||||
if (intraRefreshParams->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
default:
|
||||
return SimpleRedroidOMXComponent::internalSetConfig(index, _params, frameConfig);
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidAVCEnc::internalSetBitrateParams(
|
||||
const OMX_VIDEO_PARAM_BITRATETYPE *bitrate) {
|
||||
if (bitrate->nPortIndex != kOutputPortIndex) {
|
||||
return OMX_ErrorUnsupportedIndex;
|
||||
}
|
||||
|
||||
mBitrate = bitrate->nTargetBitrate;
|
||||
mUpdateFlag |= kUpdateBitrate;
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
void RedroidAVCEnc::onQueueFilled(OMX_U32 portIndex) {
|
||||
UNUSED(portIndex);
|
||||
|
||||
if (mSignalledError) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mCodecCtx) initEncoder();
|
||||
|
||||
List<BufferInfo *> &inQueue = getPortQueue(0);
|
||||
List<BufferInfo *> &outQueue = getPortQueue(1);
|
||||
|
||||
if (outQueue.empty()) {
|
||||
ALOGW("outQueue is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
BufferInfo *outputBufferInfo = *outQueue.begin();
|
||||
OMX_BUFFERHEADERTYPE *outputBufferHeader = outputBufferInfo->mHeader;
|
||||
|
||||
BufferInfo *inputBufferInfo;
|
||||
OMX_BUFFERHEADERTYPE *inputBufferHeader;
|
||||
|
||||
if (mSawInputEOS) {
|
||||
inputBufferHeader = NULL;
|
||||
inputBufferInfo = NULL;
|
||||
} else if (!inQueue.empty()) {
|
||||
inputBufferInfo = *inQueue.begin();
|
||||
inputBufferHeader = inputBufferInfo->mHeader;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
outputBufferHeader->nTimeStamp = 0;
|
||||
outputBufferHeader->nFlags = 0;
|
||||
outputBufferHeader->nOffset = 0;
|
||||
outputBufferHeader->nFilledLen = 0;
|
||||
outputBufferHeader->nOffset = 0;
|
||||
|
||||
if (inputBufferHeader != NULL) {
|
||||
outputBufferHeader->nFlags = inputBufferHeader->nFlags;
|
||||
}
|
||||
|
||||
|
||||
if (mUpdateFlag) {
|
||||
if (mUpdateFlag & kUpdateBitrate) {
|
||||
setBitRate();
|
||||
}
|
||||
if (mUpdateFlag & kRequestKeyFrame) {
|
||||
mCodec->request_key_frame(mCodecCtx);
|
||||
}
|
||||
mUpdateFlag = 0;
|
||||
}
|
||||
|
||||
if ((inputBufferHeader != NULL)
|
||||
&& (inputBufferHeader->nFlags & OMX_BUFFERFLAG_EOS)) {
|
||||
mSawInputEOS = true;
|
||||
}
|
||||
|
||||
if ((inputBufferHeader != NULL) && inputBufferHeader->nFilledLen) {
|
||||
OMX_ERRORTYPE error = validateInputBuffer(inputBufferHeader);
|
||||
if (error != OMX_ErrorNone) {
|
||||
ALOGE("b/69065651");
|
||||
android_errorWriteLog(0x534e4554, "69065651");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mInputDataIsMeta) {
|
||||
ANativeWindowBuffer *buffer = getANWBuffer(inputBufferHeader->pBuffer + inputBufferHeader->nOffset,
|
||||
inputBufferHeader->nFilledLen);
|
||||
if (!buffer) {
|
||||
ALOGE("ANativeWindowBuffer null!");
|
||||
return;
|
||||
}
|
||||
|
||||
buffer_handle_t handle = buffer->handle;
|
||||
if (!handle) {
|
||||
ALOGE("buffer_handle_t handle is null!");
|
||||
return;
|
||||
}
|
||||
ALOGV("before encode");
|
||||
void *out_buf = outputBufferHeader->pBuffer + outputBufferHeader->nFilledLen;
|
||||
int out_size = 0;
|
||||
mCodec->encode_frame(mCodecCtx, (void *) handle, out_buf, &out_size);
|
||||
outputBufferHeader->nFilledLen += out_size;
|
||||
ALOGV("after encode");
|
||||
}
|
||||
|
||||
//DUMP_TO_FILE();
|
||||
}
|
||||
|
||||
if (inputBufferHeader != NULL) {
|
||||
inQueue.erase(inQueue.begin());
|
||||
|
||||
/* If in meta data, call EBD on input */
|
||||
/* In case of normal mode, EBD will be done once encoder
|
||||
releases the input buffer */
|
||||
if (mInputDataIsMeta) {
|
||||
inputBufferInfo->mOwnedByUs = false;
|
||||
notifyEmptyBufferDone(inputBufferHeader);
|
||||
}
|
||||
}
|
||||
|
||||
if (false) { // TODO
|
||||
outputBufferHeader->nFlags |= OMX_BUFFERFLAG_EOS;
|
||||
mSawOutputEOS = true;
|
||||
} else {
|
||||
outputBufferHeader->nFlags &= ~OMX_BUFFERFLAG_EOS;
|
||||
}
|
||||
|
||||
if (outputBufferHeader->nFilledLen) {
|
||||
if (inputBufferHeader) outputBufferHeader->nTimeStamp = inputBufferHeader->nTimeStamp;
|
||||
|
||||
outputBufferInfo->mOwnedByUs = false;
|
||||
outQueue.erase(outQueue.begin());
|
||||
DUMP_TO_FILE(mOutFile, outputBufferHeader->pBuffer,
|
||||
outputBufferHeader->nFilledLen);
|
||||
notifyFillBufferDone(outputBufferHeader);
|
||||
}
|
||||
}
|
||||
|
||||
void RedroidAVCEnc::onReset() {
|
||||
d(__func__);
|
||||
RedroidVideoEncoderOMXComponent::onReset();
|
||||
|
||||
if (releaseEncoder() != OMX_ErrorNone) {
|
||||
ALOGW("releaseEncoder failed");
|
||||
}
|
||||
}
|
||||
} // namespace android
|
||||
|
||||
extern "C"
|
||||
android::RedroidOMXComponent *createRedroidOMXComponent(
|
||||
const char *name, const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData, OMX_COMPONENTTYPE **component) {
|
||||
return new android::RedroidAVCEnc(name, callbacks, appData, component);
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <media/stagefright/foundation/ABase.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#include <media/stagefright/omx/RedroidVideoEncoderOMXComponent.h>
|
||||
|
||||
#include "media_codec.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
#define MAX_INPUT_BUFFER_HEADERS 4
|
||||
#define MAX_CONVERSION_BUFFERS 4
|
||||
#define CODEC_MAX_CORES 4
|
||||
#define LEN_STATUS_BUFFER (10 * 1024)
|
||||
#define MAX_VBV_BUFF_SIZE (120 * 16384)
|
||||
#define MAX_NUM_IO_BUFS 3
|
||||
|
||||
#define DEFAULT_MAX_REF_FRM 2
|
||||
#define DEFAULT_MAX_REORDER_FRM 0
|
||||
#define DEFAULT_QP_MIN 10
|
||||
#define DEFAULT_QP_MAX 40
|
||||
#define DEFAULT_MAX_BITRATE 240000000
|
||||
#define DEFAULT_MAX_SRCH_RANGE_X 256
|
||||
#define DEFAULT_MAX_SRCH_RANGE_Y 256
|
||||
#define DEFAULT_MAX_FRAMERATE 120000
|
||||
#define DEFAULT_NUM_CORES 1
|
||||
#define DEFAULT_NUM_CORES_PRE_ENC 0
|
||||
#define DEFAULT_FPS 30
|
||||
#define DEFAULT_ENC_SPEED IVE_NORMAL
|
||||
|
||||
#define DEFAULT_MEM_REC_CNT 0
|
||||
#define DEFAULT_RECON_ENABLE 0
|
||||
#define DEFAULT_CHKSUM_ENABLE 0
|
||||
#define DEFAULT_START_FRM 0
|
||||
#define DEFAULT_NUM_FRMS 0xFFFFFFFF
|
||||
#define DEFAULT_INP_COLOR_FORMAT IV_YUV_420SP_VU
|
||||
#define DEFAULT_RECON_COLOR_FORMAT IV_YUV_420P
|
||||
#define DEFAULT_LOOPBACK 0
|
||||
#define DEFAULT_SRC_FRAME_RATE 30
|
||||
#define DEFAULT_TGT_FRAME_RATE 30
|
||||
#define DEFAULT_MAX_WD 1920
|
||||
#define DEFAULT_MAX_HT 1920
|
||||
#define DEFAULT_MAX_LEVEL 41
|
||||
#define DEFAULT_STRIDE 0
|
||||
#define DEFAULT_WD 1280
|
||||
#define DEFAULT_HT 720
|
||||
#define DEFAULT_PSNR_ENABLE 0
|
||||
#define DEFAULT_ME_SPEED 100
|
||||
#define DEFAULT_ENABLE_FAST_SAD 0
|
||||
#define DEFAULT_ENABLE_ALT_REF 0
|
||||
#define DEFAULT_RC_MODE IVE_RC_STORAGE
|
||||
#define DEFAULT_BITRATE 6000000
|
||||
#define DEFAULT_I_QP 22
|
||||
#define DEFAULT_I_QP_MAX DEFAULT_QP_MAX
|
||||
#define DEFAULT_I_QP_MIN DEFAULT_QP_MIN
|
||||
#define DEFAULT_P_QP 28
|
||||
#define DEFAULT_P_QP_MAX DEFAULT_QP_MAX
|
||||
#define DEFAULT_P_QP_MIN DEFAULT_QP_MIN
|
||||
#define DEFAULT_B_QP 22
|
||||
#define DEFAULT_B_QP_MAX DEFAULT_QP_MAX
|
||||
#define DEFAULT_B_QP_MIN DEFAULT_QP_MIN
|
||||
#define DEFAULT_AIR IVE_AIR_MODE_NONE
|
||||
#define DEFAULT_AIR_REFRESH_PERIOD 30
|
||||
#define DEFAULT_SRCH_RNG_X 64
|
||||
#define DEFAULT_SRCH_RNG_Y 48
|
||||
#define DEFAULT_I_INTERVAL 30
|
||||
#define DEFAULT_IDR_INTERVAL 1000
|
||||
#define DEFAULT_B_FRAMES 0
|
||||
#define DEFAULT_DISABLE_DEBLK_LEVEL 0
|
||||
#define DEFAULT_HPEL 1
|
||||
#define DEFAULT_QPEL 1
|
||||
#define DEFAULT_I4 1
|
||||
#define DEFAULT_EPROFILE IV_PROFILE_BASE
|
||||
#define DEFAULT_ENTROPY_MODE 0
|
||||
#define DEFAULT_SLICE_MODE IVE_SLICE_MODE_NONE
|
||||
#define DEFAULT_SLICE_PARAM 256
|
||||
#define DEFAULT_ARCH ARCH_ARM_A9Q
|
||||
#define DEFAULT_SOC SOC_GENERIC
|
||||
#define DEFAULT_INTRA4x4 0
|
||||
#define STRLENGTH 500
|
||||
#define DEFAULT_CONSTRAINED_INTRA 0
|
||||
|
||||
#define MIN(a, b) ((a) < (b))? (a) : (b)
|
||||
#define MAX(a, b) ((a) > (b))? (a) : (b)
|
||||
#define ALIGN16(x) ((((x) + 15) >> 4) << 4)
|
||||
#define ALIGN128(x) ((((x) + 127) >> 7) << 7)
|
||||
#define ALIGN4096(x) ((((x) + 4095) >> 12) << 12)
|
||||
|
||||
/** Used to remove warnings about unused parameters */
|
||||
#define UNUSED(x) ((void)(x))
|
||||
|
||||
/** Get time */
|
||||
#define GETTIME(a, b) gettimeofday(a, b);
|
||||
|
||||
/** Compute difference between start and end */
|
||||
#define TIME_DIFF(start, end, diff) \
|
||||
diff = (((end).tv_sec - (start).tv_sec) * 1000000) + \
|
||||
((end).tv_usec - (start).tv_usec);
|
||||
|
||||
#define ive_aligned_malloc(alignment, size) memalign(alignment, size)
|
||||
#define ive_aligned_free(buf) free(buf)
|
||||
|
||||
struct RedroidAVCEnc : public RedroidVideoEncoderOMXComponent {
|
||||
|
||||
RedroidAVCEnc(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component);
|
||||
|
||||
// Override SimpleRedroidOMXComponent methods
|
||||
virtual OMX_ERRORTYPE internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual void onQueueFilled(OMX_U32 portIndex);
|
||||
|
||||
protected:
|
||||
virtual ~RedroidAVCEnc();
|
||||
|
||||
virtual void onReset();
|
||||
|
||||
private:
|
||||
enum {
|
||||
kNumBuffers = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
kUpdateBitrate = 1 << 0,
|
||||
kRequestKeyFrame = 1 << 1,
|
||||
kUpdateAIRMode = 1 << 2,
|
||||
};
|
||||
|
||||
// OMX input buffer's timestamp and flags
|
||||
typedef struct {
|
||||
int64_t mTimeUs;
|
||||
int32_t mFlags;
|
||||
} InputBufferInfo;
|
||||
|
||||
int32_t mStride;
|
||||
|
||||
struct timeval mTimeStart; // Time at the start of decode()
|
||||
struct timeval mTimeEnd; // Time at the end of decode()
|
||||
|
||||
int mUpdateFlag;
|
||||
|
||||
#ifdef FILE_DUMP_ENABLE
|
||||
char mInFile[200];
|
||||
char mOutFile[200];
|
||||
#endif /* FILE_DUMP_ENABLE */
|
||||
|
||||
|
||||
bool mKeyFrameRequest;
|
||||
bool mStarted;
|
||||
bool mSpsPpsHeaderReceived;
|
||||
|
||||
// redroid codec
|
||||
void *mCodecLibHandle;
|
||||
media_codec_t *mCodec;
|
||||
void *mCodecCtx;
|
||||
|
||||
|
||||
bool mSawInputEOS;
|
||||
bool mSawOutputEOS;
|
||||
bool mSignalledError;
|
||||
bool mIntra4x4;
|
||||
bool mEnableFastSad;
|
||||
bool mEnableAltRef;
|
||||
bool mReconEnable;
|
||||
bool mPSNREnable;
|
||||
bool mEntropyMode;
|
||||
bool mConstrainedIntraFlag;
|
||||
|
||||
uint8_t *mConversionBuffers[MAX_CONVERSION_BUFFERS];
|
||||
bool mConversionBuffersFree[MAX_CONVERSION_BUFFERS];
|
||||
BufferInfo *mInputBufferInfo[MAX_INPUT_BUFFER_HEADERS];
|
||||
size_t mNumMemRecords; // Number of memory records requested by codec
|
||||
size_t mNumCores; // Number of cores used by the codec
|
||||
|
||||
void initEncParams();
|
||||
OMX_ERRORTYPE initEncoder();
|
||||
OMX_ERRORTYPE releaseEncoder();
|
||||
|
||||
// Verifies the component role tried to be set to this OMX component is
|
||||
// strictly video_encoder.avc
|
||||
OMX_ERRORTYPE internalSetRoleParams(
|
||||
const OMX_PARAM_COMPONENTROLETYPE *role);
|
||||
|
||||
// Updates bitrate to reflect port settings.
|
||||
OMX_ERRORTYPE internalSetBitrateParams(
|
||||
const OMX_VIDEO_PARAM_BITRATETYPE *bitrate);
|
||||
|
||||
OMX_ERRORTYPE internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR _params, bool *frameConfig);
|
||||
|
||||
OMX_ERRORTYPE getConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR _params);
|
||||
|
||||
// Handles port definition changes.
|
||||
OMX_ERRORTYPE internalSetPortParams(
|
||||
const OMX_PARAM_PORTDEFINITIONTYPE *port);
|
||||
|
||||
OMX_ERRORTYPE internalSetFormatParams(
|
||||
const OMX_VIDEO_PARAM_PORTFORMATTYPE *format);
|
||||
|
||||
OMX_ERRORTYPE setQp();
|
||||
OMX_ERRORTYPE setDimensions();
|
||||
OMX_ERRORTYPE setNumCores();
|
||||
OMX_ERRORTYPE setFrameRate();
|
||||
OMX_ERRORTYPE setIpeParams();
|
||||
OMX_ERRORTYPE setBitRate();
|
||||
OMX_ERRORTYPE setAirParams();
|
||||
OMX_ERRORTYPE setMeParams();
|
||||
OMX_ERRORTYPE setGopParams();
|
||||
OMX_ERRORTYPE setProfileParams();
|
||||
OMX_ERRORTYPE setDeblockParams();
|
||||
OMX_ERRORTYPE setVbvParams();
|
||||
void logVersion();
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(RedroidAVCEnc);
|
||||
};
|
||||
|
||||
#ifdef FILE_DUMP_ENABLE
|
||||
|
||||
#define INPUT_DUMP_PATH "/sdcard/media/avce_input"
|
||||
#define INPUT_DUMP_EXT "yuv"
|
||||
#define OUTPUT_DUMP_PATH "/sdcard/media/avce_output"
|
||||
#define OUTPUT_DUMP_EXT "h264"
|
||||
|
||||
#define GENERATE_FILE_NAMES() { \
|
||||
GETTIME(&mTimeStart, NULL); \
|
||||
strcpy(mInFile, ""); \
|
||||
sprintf(mInFile, "%s_%ld.%ld.%s", INPUT_DUMP_PATH, \
|
||||
mTimeStart.tv_sec, mTimeStart.tv_usec, \
|
||||
INPUT_DUMP_EXT); \
|
||||
strcpy(mOutFile, ""); \
|
||||
sprintf(mOutFile, "%s_%ld.%ld.%s", OUTPUT_DUMP_PATH,\
|
||||
mTimeStart.tv_sec, mTimeStart.tv_usec, \
|
||||
OUTPUT_DUMP_EXT); \
|
||||
}
|
||||
|
||||
#define CREATE_DUMP_FILE(m_filename) { \
|
||||
FILE *fp = fopen(m_filename, "wb"); \
|
||||
if (fp != NULL) { \
|
||||
ALOGD("Opened file %s", m_filename); \
|
||||
fclose(fp); \
|
||||
} else { \
|
||||
ALOGD("Could not open file %s", m_filename); \
|
||||
} \
|
||||
}
|
||||
#define DUMP_TO_FILE(m_filename, m_buf, m_size) \
|
||||
{ \
|
||||
FILE *fp = fopen(m_filename, "ab"); \
|
||||
if (fp != NULL && m_buf != NULL) { \
|
||||
int i; \
|
||||
i = fwrite(m_buf, 1, m_size, fp); \
|
||||
ALOGD("fwrite ret %d to write %d", i, m_size); \
|
||||
if (i != (int)m_size) { \
|
||||
ALOGD("Error in fwrite, returned %d", i); \
|
||||
perror("Error in write to file"); \
|
||||
} \
|
||||
fclose(fp); \
|
||||
} else { \
|
||||
ALOGD("Could not write to file %s", m_filename);\
|
||||
if (fp != NULL) \
|
||||
fclose(fp); \
|
||||
} \
|
||||
}
|
||||
#else /* FILE_DUMP_ENABLE */
|
||||
#define INPUT_DUMP_PATH
|
||||
#define INPUT_DUMP_EXT
|
||||
#define OUTPUT_DUMP_PATH
|
||||
#define OUTPUT_DUMP_EXT
|
||||
#define GENERATE_FILE_NAMES()
|
||||
#define CREATE_DUMP_FILE(m_filename)
|
||||
#define DUMP_TO_FILE(m_filename, m_buf, m_size)
|
||||
#endif /* FILE_DUMP_ENABLE */
|
||||
|
||||
} // namespace android
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
global:
|
||||
createRedroidOMXComponent;
|
||||
local: *;
|
||||
};
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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 <media/stagefright/MediaErrors.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
#ifndef CRYPTO_API_H_
|
||||
|
||||
#define CRYPTO_API_H_
|
||||
|
||||
namespace android {
|
||||
|
||||
struct AString;
|
||||
struct CryptoPlugin;
|
||||
|
||||
struct CryptoFactory {
|
||||
CryptoFactory() {}
|
||||
virtual ~CryptoFactory() {}
|
||||
|
||||
virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const = 0;
|
||||
|
||||
virtual status_t createPlugin(
|
||||
const uint8_t uuid[16], const void *data, size_t size,
|
||||
CryptoPlugin **plugin) = 0;
|
||||
|
||||
private:
|
||||
CryptoFactory(const CryptoFactory &);
|
||||
CryptoFactory &operator=(const CryptoFactory &);
|
||||
};
|
||||
|
||||
struct CryptoPlugin {
|
||||
enum Mode {
|
||||
kMode_Unencrypted = 0,
|
||||
kMode_AES_CTR = 1,
|
||||
kMode_AES_WV = 2,
|
||||
kMode_AES_CBC = 3,
|
||||
};
|
||||
|
||||
struct SubSample {
|
||||
uint32_t mNumBytesOfClearData;
|
||||
uint32_t mNumBytesOfEncryptedData;
|
||||
};
|
||||
|
||||
struct Pattern {
|
||||
// Number of blocks to be encrypted in the pattern. If zero, pattern
|
||||
// encryption is inoperative.
|
||||
uint32_t mEncryptBlocks;
|
||||
|
||||
// Number of blocks to be skipped (left clear) in the pattern. If zero,
|
||||
// pattern encryption is inoperative.
|
||||
uint32_t mSkipBlocks;
|
||||
};
|
||||
|
||||
CryptoPlugin() {}
|
||||
virtual ~CryptoPlugin() {}
|
||||
|
||||
// If this method returns false, a non-secure decoder will be used to
|
||||
// decode the data after decryption. The decrypt API below will have
|
||||
// to support insecure decryption of the data (secure = false) for
|
||||
// media data of the given mime type.
|
||||
virtual bool requiresSecureDecoderComponent(const char *mime) const = 0;
|
||||
|
||||
// To implement resolution constraints, the crypto plugin needs to know
|
||||
// the resolution of the video being decrypted. The media player should
|
||||
// call this method when the resolution is determined and any time it
|
||||
// is subsequently changed.
|
||||
|
||||
virtual void notifyResolution(uint32_t /* width */, uint32_t /* height */) {}
|
||||
|
||||
// A MediaDrm session may be associated with a MediaCrypto session. The
|
||||
// associated MediaDrm session is used to load decryption keys
|
||||
// into the crypto/drm plugin. The keys are then referenced by key-id
|
||||
// in the 'key' parameter to the decrypt() method.
|
||||
// Should return NO_ERROR on success, ERROR_DRM_SESSION_NOT_OPENED if
|
||||
// the session is not opened and a code from MediaErrors.h otherwise.
|
||||
virtual status_t setMediaDrmSession(const Vector<uint8_t> & /*sessionId */) {
|
||||
return ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// If the error returned falls into the range
|
||||
// ERROR_DRM_VENDOR_MIN..ERROR_DRM_VENDOR_MAX, errorDetailMsg should be
|
||||
// filled in with an appropriate string.
|
||||
// At the java level these special errors will then trigger a
|
||||
// MediaCodec.CryptoException that gives clients access to both
|
||||
// the error code and the errorDetailMsg.
|
||||
// Returns a non-negative result to indicate the number of bytes written
|
||||
// to the dstPtr, or a negative result to indicate an error.
|
||||
virtual ssize_t decrypt(
|
||||
bool secure,
|
||||
const uint8_t key[16],
|
||||
const uint8_t iv[16],
|
||||
Mode mode,
|
||||
const Pattern &pattern,
|
||||
const void *srcPtr,
|
||||
const SubSample *subSamples, size_t numSubSamples,
|
||||
void *dstPtr,
|
||||
AString *errorDetailMsg) = 0;
|
||||
|
||||
private:
|
||||
CryptoPlugin(const CryptoPlugin &);
|
||||
CryptoPlugin &operator=(const CryptoPlugin &);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
extern "C" {
|
||||
extern android::CryptoFactory *createCryptoFactory();
|
||||
}
|
||||
|
||||
#endif // CRYPTO_API_H_
|
||||
@@ -1,163 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2012 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 HDCP_API_H_
|
||||
#define HDCP_API_H_
|
||||
|
||||
#include <utils/Errors.h>
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
// Two different kinds of modules are covered under the same HDCPModule
|
||||
// structure below, a module either implements decryption or encryption.
|
||||
struct HDCPModule {
|
||||
typedef void (*ObserverFunc)(void *cookie, int msg, int ext1, int ext2);
|
||||
|
||||
// The msg argument in calls to the observer notification function.
|
||||
enum {
|
||||
// Sent in response to a call to "HDCPModule::initAsync" once
|
||||
// initialization has either been successfully completed,
|
||||
// i.e. the HDCP session is now fully setup (AKE, Locality Check,
|
||||
// SKE and any authentication with repeaters completed) or failed.
|
||||
// ext1 should be a suitable error code (status_t), ext2 is
|
||||
// unused for ENCRYPTION and in the case of HDCP_INITIALIZATION_COMPLETE
|
||||
// holds the local TCP port the module is listening on.
|
||||
HDCP_INITIALIZATION_COMPLETE,
|
||||
HDCP_INITIALIZATION_FAILED,
|
||||
|
||||
// Sent upon completion of a call to "HDCPModule::shutdownAsync".
|
||||
// ext1 should be a suitable error code, ext2 is unused.
|
||||
HDCP_SHUTDOWN_COMPLETE,
|
||||
HDCP_SHUTDOWN_FAILED,
|
||||
|
||||
HDCP_UNAUTHENTICATED_CONNECTION,
|
||||
HDCP_UNAUTHORIZED_CONNECTION,
|
||||
HDCP_REVOKED_CONNECTION,
|
||||
HDCP_TOPOLOGY_EXECEEDED,
|
||||
HDCP_UNKNOWN_ERROR,
|
||||
|
||||
// DECRYPTION only: Indicates that a client has successfully connected,
|
||||
// a secure session established and the module is ready to accept
|
||||
// future calls to "decrypt".
|
||||
HDCP_SESSION_ESTABLISHED,
|
||||
};
|
||||
|
||||
// HDCPModule capability bit masks
|
||||
enum {
|
||||
// HDCP_CAPS_ENCRYPT: mandatory, meaning the HDCP module can encrypt
|
||||
// from an input byte-array buffer to an output byte-array buffer
|
||||
HDCP_CAPS_ENCRYPT = (1 << 0),
|
||||
// HDCP_CAPS_ENCRYPT_NATIVE: the HDCP module supports encryption from
|
||||
// a native buffer to an output byte-array buffer. The format of the
|
||||
// input native buffer is specific to vendor's encoder implementation.
|
||||
// It is the same format as that used by the encoder when
|
||||
// "storeMetaDataInBuffers" extension is enabled on its output port.
|
||||
HDCP_CAPS_ENCRYPT_NATIVE = (1 << 1),
|
||||
};
|
||||
|
||||
// Module can call the notification function to signal completion/failure
|
||||
// of asynchronous operations (such as initialization) or out of band
|
||||
// events.
|
||||
HDCPModule(void * /*cookie*/, ObserverFunc /*observerNotify*/) {};
|
||||
|
||||
virtual ~HDCPModule() {};
|
||||
|
||||
// ENCRYPTION: Request to setup an HDCP session with the host specified
|
||||
// by addr and listening on the specified port.
|
||||
// DECRYPTION: Request to setup an HDCP session, addr is the interface
|
||||
// address the module should bind its socket to. port will be 0.
|
||||
// The module will pick the port to listen on itself and report its choice
|
||||
// in the "ext2" argument of the HDCP_INITIALIZATION_COMPLETE callback.
|
||||
virtual status_t initAsync(const char *addr, unsigned port) = 0;
|
||||
|
||||
// Request to shutdown the active HDCP session.
|
||||
virtual status_t shutdownAsync() = 0;
|
||||
|
||||
// Returns the capability bitmask of this HDCP session.
|
||||
virtual uint32_t getCaps() {
|
||||
return HDCP_CAPS_ENCRYPT;
|
||||
}
|
||||
|
||||
// ENCRYPTION only:
|
||||
// Encrypt data according to the HDCP spec. "size" bytes of data are
|
||||
// available at "inData" (virtual address), "size" may not be a multiple
|
||||
// of 128 bits (16 bytes). An equal number of encrypted bytes should be
|
||||
// written to the buffer at "outData" (virtual address).
|
||||
// This operation is to be synchronous, i.e. this call does not return
|
||||
// until outData contains size bytes of encrypted data.
|
||||
// streamCTR will be assigned by the caller (to 0 for the first PES stream,
|
||||
// 1 for the second and so on)
|
||||
// inputCTR _will_be_maintained_by_the_callee_ for each PES stream.
|
||||
virtual status_t encrypt(
|
||||
const void * /*inData*/, size_t /*size*/, uint32_t /*streamCTR*/,
|
||||
uint64_t * /*outInputCTR*/, void * /*outData*/) {
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
|
||||
// Encrypt data according to the HDCP spec. "size" bytes of data starting
|
||||
// at location "offset" are available in "buffer" (buffer handle). "size"
|
||||
// may not be a multiple of 128 bits (16 bytes). An equal number of
|
||||
// encrypted bytes should be written to the buffer at "outData" (virtual
|
||||
// address). This operation is to be synchronous, i.e. this call does not
|
||||
// return until outData contains size bytes of encrypted data.
|
||||
// streamCTR will be assigned by the caller (to 0 for the first PES stream,
|
||||
// 1 for the second and so on)
|
||||
// inputCTR _will_be_maintained_by_the_callee_ for each PES stream.
|
||||
virtual status_t encryptNative(
|
||||
buffer_handle_t /*buffer*/, size_t /*offset*/, size_t /*size*/,
|
||||
uint32_t /*streamCTR*/, uint64_t * /*outInputCTR*/, void * /*outData*/) {
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
// DECRYPTION only:
|
||||
// Decrypt data according to the HDCP spec.
|
||||
// "size" bytes of encrypted data are available at "inData"
|
||||
// (virtual address), "size" may not be a multiple of 128 bits (16 bytes).
|
||||
// An equal number of decrypted bytes should be written to the buffer
|
||||
// at "outData" (virtual address).
|
||||
// This operation is to be synchronous, i.e. this call does not return
|
||||
// until outData contains size bytes of decrypted data.
|
||||
// Both streamCTR and inputCTR will be provided by the caller.
|
||||
virtual status_t decrypt(
|
||||
const void * /*inData*/, size_t /*size*/,
|
||||
uint32_t /*streamCTR*/, uint64_t /*inputCTR*/,
|
||||
void * /*outData*/) {
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
|
||||
private:
|
||||
HDCPModule(const HDCPModule &);
|
||||
HDCPModule &operator=(const HDCPModule &);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
// A shared library exporting the following methods should be included to
|
||||
// support HDCP functionality. The shared library must be called
|
||||
// "libstagefright_hdcp.so", it will be dynamically loaded into the
|
||||
// mediaserver process.
|
||||
extern "C" {
|
||||
// Create a module for ENCRYPTION.
|
||||
extern android::HDCPModule *createHDCPModule(
|
||||
void *cookie, android::HDCPModule::ObserverFunc);
|
||||
|
||||
// Create a module for DECRYPTION.
|
||||
extern android::HDCPModule *createHDCPModuleForDecryption(
|
||||
void *cookie, android::HDCPModule::ObserverFunc);
|
||||
}
|
||||
|
||||
#endif // HDCP_API_H_
|
||||
|
||||
@@ -1,561 +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 HARDWARE_API_H_
|
||||
|
||||
#define HARDWARE_API_H_
|
||||
|
||||
#include <media/hardware/OMXPluginBase.h>
|
||||
#include <media/hardware/MetadataBufferType.h>
|
||||
#include <cutils/native_handle.h>
|
||||
#include <utils/RefBase.h>
|
||||
|
||||
#include "VideoAPI.h"
|
||||
|
||||
#include <OMX_Component.h>
|
||||
|
||||
struct ANativeWindowBuffer;
|
||||
|
||||
namespace android {
|
||||
|
||||
// This structure is used to enable Android native buffer use for either
|
||||
// graphic buffers or secure buffers.
|
||||
//
|
||||
// TO CONTROL ANDROID GRAPHIC BUFFER USAGE:
|
||||
//
|
||||
// A pointer to this struct is passed to the OMX_SetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
|
||||
// is given.
|
||||
//
|
||||
// When Android native buffer use is disabled for a port (the default state),
|
||||
// the OMX node should operate as normal, and expect UseBuffer calls to set its
|
||||
// buffers. This is the mode that will be used when CPU access to the buffer is
|
||||
// required.
|
||||
//
|
||||
// When Android native buffer use has been enabled for a given port, the video
|
||||
// color format for the port is to be interpreted as an Android pixel format
|
||||
// rather than an OMX color format. Enabling Android native buffers may also
|
||||
// change how the component receives the native buffers. If store-metadata-mode
|
||||
// is enabled on the port, the component will receive the buffers as specified
|
||||
// in the section below. Otherwise, unless the node supports the
|
||||
// 'OMX.google.android.index.useAndroidNativeBuffer2' extension, it should
|
||||
// expect to receive UseAndroidNativeBuffer calls (via OMX_SetParameter) rather
|
||||
// than UseBuffer calls for that port.
|
||||
//
|
||||
// TO CONTROL ANDROID SECURE BUFFER USAGE:
|
||||
//
|
||||
// A pointer to this struct is passed to the OMX_SetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.allocateNativeHandle' extension
|
||||
// is given.
|
||||
//
|
||||
// When native handle use is disabled for a port (the default state),
|
||||
// the OMX node should operate as normal, and expect AllocateBuffer calls to
|
||||
// return buffer pointers. This is the mode that will be used for non-secure
|
||||
// buffers if component requires allocate buffers instead of use buffers.
|
||||
//
|
||||
// When native handle use has been enabled for a given port, the component
|
||||
// shall allocate native_buffer_t objects containing that can be passed between
|
||||
// processes using binder. This is the mode that will be used for secure buffers.
|
||||
// When an OMX component allocates native handle for buffers, it must close and
|
||||
// delete that handle when it frees those buffers. Even though pBuffer will point
|
||||
// to a native handle, nFilledLength, nAllocLength and nOffset will correspond
|
||||
// to the data inside the opaque buffer.
|
||||
struct EnableAndroidNativeBuffersParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL enable;
|
||||
};
|
||||
|
||||
typedef struct EnableAndroidNativeBuffersParams AllocateNativeHandleParams;
|
||||
|
||||
// A pointer to this struct is passed to OMX_SetParameter() when the extension index
|
||||
// "OMX.google.android.index.storeMetaDataInBuffers" or
|
||||
// "OMX.google.android.index.storeANWBufferInMetadata" is given.
|
||||
//
|
||||
// When meta data is stored in the video buffers passed between OMX clients
|
||||
// and OMX components, interpretation of the buffer data is up to the
|
||||
// buffer receiver, and the data may or may not be the actual video data, but
|
||||
// some information helpful for the receiver to locate the actual data.
|
||||
// The buffer receiver thus needs to know how to interpret what is stored
|
||||
// in these buffers, with mechanisms pre-determined externally. How to
|
||||
// interpret the meta data is outside of the scope of this parameter.
|
||||
//
|
||||
// Currently, this is used to pass meta data from video source (camera component, for instance) to
|
||||
// video encoder to avoid memcpying of input video frame data, as well as to pass dynamic output
|
||||
// buffer to video decoder. To do this, bStoreMetaData is set to OMX_TRUE.
|
||||
//
|
||||
// If bStoreMetaData is set to false, real YUV frame data will be stored in input buffers, and
|
||||
// the output buffers contain either real YUV frame data, or are themselves native handles as
|
||||
// directed by enable/use-android-native-buffer parameter settings.
|
||||
// In addition, if no OMX_SetParameter() call is made on a port with the corresponding extension
|
||||
// index, the component should not assume that the client is not using metadata mode for the port.
|
||||
//
|
||||
// If the component supports this using the "OMX.google.android.index.storeANWBufferInMetadata"
|
||||
// extension and bStoreMetaData is set to OMX_TRUE, data is passed using the VideoNativeMetadata
|
||||
// layout as defined below. Each buffer will be accompanied by a fence. The fence must signal
|
||||
// before the buffer can be used (e.g. read from or written into). When returning such buffer to
|
||||
// the client, component must provide a new fence that must signal before the returned buffer can
|
||||
// be used (e.g. read from or written into). The component owns the incoming fenceFd, and must close
|
||||
// it when fence has signaled. The client will own and close the returned fence file descriptor.
|
||||
//
|
||||
// If the component supports this using the "OMX.google.android.index.storeMetaDataInBuffers"
|
||||
// extension and bStoreMetaData is set to OMX_TRUE, data is passed using VideoGrallocMetadata
|
||||
// (the layout of which is the VideoGrallocMetadata defined below). Camera input can be also passed
|
||||
// as "CameraSource", the layout of which is vendor dependent.
|
||||
//
|
||||
// Metadata buffers are registered with the component using UseBuffer calls, or can be allocated
|
||||
// by the component for encoder-metadata-output buffers.
|
||||
struct StoreMetaDataInBuffersParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bStoreMetaData;
|
||||
};
|
||||
|
||||
// Meta data buffer layout used to transport output frames to the decoder for
|
||||
// dynamic buffer handling.
|
||||
struct VideoGrallocMetadata {
|
||||
MetadataBufferType eType; // must be kMetadataBufferTypeGrallocSource
|
||||
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
OMX_PTR pHandle;
|
||||
#else
|
||||
buffer_handle_t pHandle;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Legacy name for VideoGrallocMetadata struct.
|
||||
struct VideoDecoderOutputMetaData : public VideoGrallocMetadata {};
|
||||
|
||||
struct VideoNativeMetadata {
|
||||
MetadataBufferType eType; // must be kMetadataBufferTypeANWBuffer
|
||||
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
OMX_PTR pBuffer;
|
||||
#else
|
||||
struct ANativeWindowBuffer* pBuffer;
|
||||
#endif
|
||||
int nFenceFd; // -1 if unused
|
||||
};
|
||||
|
||||
// Meta data buffer layout for passing a native_handle to codec
|
||||
struct VideoNativeHandleMetadata {
|
||||
MetadataBufferType eType; // must be kMetadataBufferTypeNativeHandleSource
|
||||
|
||||
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
OMX_PTR pHandle;
|
||||
#else
|
||||
native_handle_t *pHandle;
|
||||
#endif
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_SetParameter() when the extension
|
||||
// index "OMX.google.android.index.prepareForAdaptivePlayback" is given.
|
||||
//
|
||||
// This method is used to signal a video decoder, that the user has requested
|
||||
// seamless resolution change support (if bEnable is set to OMX_TRUE).
|
||||
// nMaxFrameWidth and nMaxFrameHeight are the dimensions of the largest
|
||||
// anticipated frames in the video. If bEnable is OMX_FALSE, no resolution
|
||||
// change is expected, and the nMaxFrameWidth/Height fields are unused.
|
||||
//
|
||||
// If the decoder supports dynamic output buffers, it may ignore this
|
||||
// request. Otherwise, it shall request resources in such a way so that it
|
||||
// avoids full port-reconfiguration (due to output port-definition change)
|
||||
// during resolution changes.
|
||||
//
|
||||
// DO NOT USE THIS STRUCTURE AS IT WILL BE REMOVED. INSTEAD, IMPLEMENT
|
||||
// METADATA SUPPORT FOR VIDEO DECODERS.
|
||||
struct PrepareForAdaptivePlaybackParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bEnable;
|
||||
OMX_U32 nMaxFrameWidth;
|
||||
OMX_U32 nMaxFrameHeight;
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_SetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is
|
||||
// given. This call will only be performed if a prior call was made with the
|
||||
// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index,
|
||||
// enabling use of Android native buffers.
|
||||
struct UseAndroidNativeBufferParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_PTR pAppPrivate;
|
||||
OMX_BUFFERHEADERTYPE **bufferHeader;
|
||||
const sp<ANativeWindowBuffer>& nativeBuffer;
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_GetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage'
|
||||
// extension is given. The usage bits returned from this query will be used to
|
||||
// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer
|
||||
// command.
|
||||
struct GetAndroidNativeBufferUsageParams {
|
||||
OMX_U32 nSize; // IN
|
||||
OMX_VERSIONTYPE nVersion; // IN
|
||||
OMX_U32 nPortIndex; // IN
|
||||
OMX_U32 nUsage; // OUT
|
||||
};
|
||||
|
||||
// An enum OMX_COLOR_FormatAndroidOpaque to indicate an opaque colorformat
|
||||
// is declared in media/stagefright/openmax/OMX_IVCommon.h
|
||||
// This will inform the encoder that the actual
|
||||
// colorformat will be relayed by the GRalloc Buffers.
|
||||
// OMX_COLOR_FormatAndroidOpaque = 0x7F000001,
|
||||
|
||||
// A pointer to this struct is passed to OMX_SetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.prependSPSPPSToIDRFrames' extension
|
||||
// is given.
|
||||
// A successful result indicates that future IDR frames will be prefixed by
|
||||
// SPS/PPS.
|
||||
struct PrependSPSPPSToIDRFramesParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_BOOL bEnable;
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_GetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.describeColorFormat'
|
||||
// extension is given. This method can be called from any component state
|
||||
// other than invalid. The color-format, frame width/height, and stride/
|
||||
// slice-height parameters are ones that are associated with a raw video
|
||||
// port (input or output), but the stride/slice height parameters may be
|
||||
// incorrect. bUsingNativeBuffers is OMX_TRUE if native android buffers will
|
||||
// be used (while specifying this color format).
|
||||
//
|
||||
// The component shall fill out the MediaImage structure that
|
||||
// corresponds to the described raw video format, and the potentially corrected
|
||||
// stride and slice-height info.
|
||||
//
|
||||
// The behavior is slightly different if bUsingNativeBuffers is OMX_TRUE,
|
||||
// though most implementations can ignore this difference. When using native buffers,
|
||||
// the component may change the configured color format to an optimized format.
|
||||
// Additionally, when allocating these buffers for flexible usecase, the framework
|
||||
// will set the SW_READ/WRITE_OFTEN usage flags. In this case (if bUsingNativeBuffers
|
||||
// is OMX_TRUE), the component shall fill out the MediaImage information for the
|
||||
// scenario when these SW-readable/writable buffers are locked using gralloc_lock.
|
||||
// Note, that these buffers may also be locked using gralloc_lock_ycbcr, which must
|
||||
// be supported for vendor-specific formats.
|
||||
//
|
||||
// For non-YUV packed planar/semiplanar image formats, or if bUsingNativeBuffers
|
||||
// is OMX_TRUE and the component does not support this color format with native
|
||||
// buffers, the component shall set mNumPlanes to 0, and mType to MEDIA_IMAGE_TYPE_UNKNOWN.
|
||||
|
||||
// @deprecated: use DescribeColorFormat2Params
|
||||
struct DescribeColorFormat2Params;
|
||||
struct DescribeColorFormatParams {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
// input: parameters from OMX_VIDEO_PORTDEFINITIONTYPE
|
||||
OMX_COLOR_FORMATTYPE eColorFormat;
|
||||
OMX_U32 nFrameWidth;
|
||||
OMX_U32 nFrameHeight;
|
||||
OMX_U32 nStride;
|
||||
OMX_U32 nSliceHeight;
|
||||
OMX_BOOL bUsingNativeBuffers;
|
||||
|
||||
// output: fill out the MediaImage fields
|
||||
MediaImage sMediaImage;
|
||||
|
||||
explicit DescribeColorFormatParams(const DescribeColorFormat2Params&); // for internal use only
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_GetParameter when the extension
|
||||
// index for the 'OMX.google.android.index.describeColorFormat2'
|
||||
// extension is given. This is operationally the same as DescribeColorFormatParams
|
||||
// but can be used for HDR and RGBA/YUVA formats.
|
||||
struct DescribeColorFormat2Params {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
// input: parameters from OMX_VIDEO_PORTDEFINITIONTYPE
|
||||
OMX_COLOR_FORMATTYPE eColorFormat;
|
||||
OMX_U32 nFrameWidth;
|
||||
OMX_U32 nFrameHeight;
|
||||
OMX_U32 nStride;
|
||||
OMX_U32 nSliceHeight;
|
||||
OMX_BOOL bUsingNativeBuffers;
|
||||
|
||||
// output: fill out the MediaImage2 fields
|
||||
MediaImage2 sMediaImage;
|
||||
|
||||
void initFromV1(const DescribeColorFormatParams&); // for internal use only
|
||||
};
|
||||
|
||||
// A pointer to this struct is passed to OMX_SetParameter or OMX_GetParameter
|
||||
// when the extension index for the
|
||||
// 'OMX.google.android.index.configureVideoTunnelMode' extension is given.
|
||||
// If the extension is supported then tunneled playback mode should be supported
|
||||
// by the codec. If bTunneled is set to OMX_TRUE then the video decoder should
|
||||
// operate in "tunneled" mode and output its decoded frames directly to the
|
||||
// sink. In this case nAudioHwSync is the HW SYNC ID of the audio HAL Output
|
||||
// stream to sync the video with. If bTunneled is set to OMX_FALSE, "tunneled"
|
||||
// mode should be disabled and nAudioHwSync should be ignored.
|
||||
// OMX_GetParameter is used to query tunneling configuration. bTunneled should
|
||||
// return whether decoder is operating in tunneled mode, and if it is,
|
||||
// pSidebandWindow should contain the codec allocated sideband window handle.
|
||||
struct ConfigureVideoTunnelModeParams {
|
||||
OMX_U32 nSize; // IN
|
||||
OMX_VERSIONTYPE nVersion; // IN
|
||||
OMX_U32 nPortIndex; // IN
|
||||
OMX_BOOL bTunneled; // IN/OUT
|
||||
OMX_U32 nAudioHwSync; // IN
|
||||
OMX_PTR pSidebandWindow; // OUT
|
||||
};
|
||||
|
||||
// Color space description (aspects) parameters.
|
||||
// This is passed via OMX_SetConfig or OMX_GetConfig to video encoders and decoders when the
|
||||
// 'OMX.google.android.index.describeColorAspects' extension is given. Component SHALL behave
|
||||
// as described below if it supports this extension.
|
||||
//
|
||||
// bDataSpaceChanged and bRequestingDataSpace is assumed to be OMX_FALSE unless noted otherwise.
|
||||
//
|
||||
// VIDEO ENCODERS: the framework uses OMX_SetConfig to specify color aspects of the coded video.
|
||||
// This may happen:
|
||||
// a) before the component transitions to idle state
|
||||
// b) before the input frame is sent via OMX_EmptyThisBuffer in executing state
|
||||
// c) during execution, just before an input frame with a different color aspect information
|
||||
// is sent.
|
||||
//
|
||||
// The framework also uses OMX_GetConfig to
|
||||
// d) verify the color aspects that will be written to the stream
|
||||
// e) (optional) verify the color aspects that should be reported to the container for a
|
||||
// given dataspace/pixelformat received
|
||||
//
|
||||
// 1. Encoders SHOULD maintain an internal color aspect state, initialized to Unspecified values.
|
||||
// This represents the values that will be written into the bitstream.
|
||||
// 2. Upon OMX_SetConfig, they SHOULD update their internal state to the aspects received
|
||||
// (including Unspecified values). For specific aspect values that are not supported by the
|
||||
// codec standard, encoders SHOULD substitute Unspecified values; or they MAY use a suitable
|
||||
// alternative (e.g. to suggest the use of BT.709 EOTF instead of SMPTE 240M.)
|
||||
// 3. OMX_GetConfig SHALL return the internal state (values that will be written).
|
||||
// 4. OMX_SetConfig SHALL always succeed before receiving the first frame. It MAY fail afterwards,
|
||||
// but only if the configured values would change AND the component does not support updating the
|
||||
// color information to those values mid-stream. If component supports updating a portion of
|
||||
// the color information, those values should be updated in the internal state, and OMX_SetConfig
|
||||
// SHALL succeed. Otherwise, the internal state SHALL remain intact and OMX_SetConfig SHALL fail
|
||||
// with OMX_ErrorUnsupportedSettings.
|
||||
// 5. When the framework receives an input frame with an unexpected dataspace, it will query
|
||||
// encoders for the color aspects that should be reported to the container using OMX_GetConfig
|
||||
// with bDataSpaceChanged set to OMX_TRUE, and nPixelFormat/nDataSpace containing the new
|
||||
// format/dataspace values. This allows vendors to use extended dataspace during capture and
|
||||
// composition (e.g. screenrecord) - while performing color-space conversion inside the encoder -
|
||||
// and encode and report a different color-space information in the bitstream/container.
|
||||
// sColorAspects contains the requested color aspects by the client for reference, which may
|
||||
// include aspects not supported by the encoding. This is used together with guidance for
|
||||
// dataspace selection; see 6. below.
|
||||
//
|
||||
// VIDEO DECODERS: the framework uses OMX_SetConfig to specify the default color aspects to use
|
||||
// for the video.
|
||||
// This may happen:
|
||||
// a) before the component transitions to idle state
|
||||
// b) during execution, when the resolution or the default color aspects change.
|
||||
//
|
||||
// The framework also uses OMX_GetConfig to
|
||||
// c) get the final color aspects reported by the coded bitstream after taking the default values
|
||||
// into account.
|
||||
//
|
||||
// 1. Decoders should maintain two color aspect states - the default state as reported by the
|
||||
// framework, and the coded state as reported by the bitstream - as each state can change
|
||||
// independently from the other.
|
||||
// 2. Upon OMX_SetConfig, it SHALL update its default state regardless of whether such aspects
|
||||
// could be supplied by the component bitstream. (E.g. it should blindly support all enumeration
|
||||
// values, even unknown ones, and the Other value). This SHALL always succeed.
|
||||
// 3. Upon OMX_GetConfig, the component SHALL return the final color aspects by replacing
|
||||
// Unspecified coded values with the default values. This SHALL always succeed.
|
||||
// 4. Whenever the component processes color aspect information in the bitstream even with an
|
||||
// Unspecified value, it SHOULD update its internal coded state with that information just before
|
||||
// the frame with the new information would be outputted, and the component SHALL signal an
|
||||
// OMX_EventPortSettingsChanged event with data2 set to the extension index.
|
||||
// NOTE: Component SHOULD NOT signal a separate event purely for color aspect change, if it occurs
|
||||
// together with a port definition (e.g. size) or crop change.
|
||||
// 5. If the aspects a component encounters in the bitstream cannot be represented with enumeration
|
||||
// values as defined below, the component SHALL set those aspects to Other. Restricted values in
|
||||
// the bitstream SHALL be treated as defined by the relevant bitstream specifications/standards,
|
||||
// or as Unspecified, if not defined.
|
||||
//
|
||||
// BOTH DECODERS AND ENCODERS: the framework uses OMX_GetConfig during idle and executing state to
|
||||
// f) (optional) get guidance for the dataspace to set for given color aspects, by setting
|
||||
// bRequestingDataSpace to OMX_TRUE. The component SHALL return OMX_ErrorUnsupportedSettings
|
||||
// IF it does not support this request.
|
||||
//
|
||||
// 6. This is an information request that can happen at any time, independent of the normal
|
||||
// configuration process. This allows vendors to use extended dataspace during capture, playback
|
||||
// and composition - while performing color-space conversion inside the component. Component
|
||||
// SHALL set the desired dataspace into nDataSpace. Otherwise, it SHALL return
|
||||
// OMX_ErrorUnsupportedSettings to let the framework choose a nearby standard dataspace.
|
||||
//
|
||||
// 6.a. For encoders, this query happens before the first frame is received using surface encoding.
|
||||
// This allows the encoder to use a specific dataspace for the color aspects (e.g. because the
|
||||
// device supports additional dataspaces, or because it wants to perform color-space extension
|
||||
// to facilitate a more optimal rendering/capture pipeline.).
|
||||
//
|
||||
// 6.b. For decoders, this query happens before the first frame, and every time the color aspects
|
||||
// change, while using surface buffers. This allows the decoder to use a specific dataspace for
|
||||
// the color aspects (e.g. because the device supports additional dataspaces, or because it wants
|
||||
// to perform color-space extension by inline color-space conversion to facilitate a more optimal
|
||||
// rendering pipeline.).
|
||||
//
|
||||
// Note: the size of sAspects may increase in the future by additional fields.
|
||||
// Implementations SHOULD NOT require a certain size.
|
||||
struct DescribeColorAspectsParams {
|
||||
OMX_U32 nSize; // IN
|
||||
OMX_VERSIONTYPE nVersion; // IN
|
||||
OMX_U32 nPortIndex; // IN
|
||||
OMX_BOOL bRequestingDataSpace; // IN
|
||||
OMX_BOOL bDataSpaceChanged; // IN
|
||||
OMX_U32 nPixelFormat; // IN
|
||||
OMX_U32 nDataSpace; // OUT
|
||||
ColorAspects sAspects; // IN/OUT
|
||||
};
|
||||
|
||||
// HDR color description parameters.
|
||||
// This is passed via OMX_SetConfig or OMX_GetConfig to video encoders and decoders when the
|
||||
// 'OMX.google.android.index.describeHDRStaticInfo' extension is given and an HDR stream
|
||||
// is detected. Component SHALL behave as described below if it supports this extension.
|
||||
//
|
||||
// Currently, only Static Metadata Descriptor Type 1 support is required.
|
||||
//
|
||||
// VIDEO ENCODERS: the framework uses OMX_SetConfig to specify the HDR static information of the
|
||||
// coded video.
|
||||
// This may happen:
|
||||
// a) before the component transitions to idle state
|
||||
// b) before the input frame is sent via OMX_EmptyThisBuffer in executing state
|
||||
// c) during execution, just before an input frame with a different HDR static
|
||||
// information is sent.
|
||||
//
|
||||
// The framework also uses OMX_GetConfig to
|
||||
// d) verify the HDR static information that will be written to the stream.
|
||||
//
|
||||
// 1. Encoders SHOULD maintain an internal HDR static info data, initialized to Unspecified values.
|
||||
// This represents the values that will be written into the bitstream.
|
||||
// 2. Upon OMX_SetConfig, they SHOULD update their internal state to the info received
|
||||
// (including Unspecified values). For specific parameters that are not supported by the
|
||||
// codec standard, encoders SHOULD substitute Unspecified values. NOTE: no other substitution
|
||||
// is allowed.
|
||||
// 3. OMX_GetConfig SHALL return the internal state (values that will be written).
|
||||
// 4. OMX_SetConfig SHALL always succeed before receiving the first frame if the encoder is
|
||||
// configured into an HDR compatible profile. It MAY fail with OMX_ErrorUnsupportedSettings error
|
||||
// code if it is not configured into such a profile, OR if the configured values would change
|
||||
// AND the component does not support updating the HDR static information mid-stream. If the
|
||||
// component supports updating a portion of the information, those values should be updated in
|
||||
// the internal state, and OMX_SetConfig SHALL succeed. Otherwise, the internal state SHALL
|
||||
// remain intact.
|
||||
//
|
||||
// VIDEO DECODERS: the framework uses OMX_SetConfig to specify the default HDR static information
|
||||
// to use for the video.
|
||||
// a) This only happens if the client supplies this information, in which case it occurs before
|
||||
// the component transitions to idle state.
|
||||
// b) This may also happen subsequently if the default HDR static information changes.
|
||||
//
|
||||
// The framework also uses OMX_GetConfig to
|
||||
// c) get the final HDR static information reported by the coded bitstream after taking the
|
||||
// default values into account.
|
||||
//
|
||||
// 1. Decoders should maintain two HDR static information structures - the default values as
|
||||
// reported by the framework, and the coded values as reported by the bitstream - as each
|
||||
// structure can change independently from the other.
|
||||
// 2. Upon OMX_SetConfig, it SHALL update its default structure regardless of whether such static
|
||||
// parameters could be supplied by the component bitstream. (E.g. it should blindly support all
|
||||
// parameter values, even seemingly illegal ones). This SHALL always succeed.
|
||||
// Note: The descriptor ID used in sInfo may change in subsequent calls. (although for now only
|
||||
// Type 1 support is required.)
|
||||
// 3. Upon OMX_GetConfig, the component SHALL return the final HDR static information by replacing
|
||||
// Unspecified coded values with the default values. This SHALL always succeed. This may be
|
||||
// provided using any supported descriptor ID (currently only Type 1) with the goal of expressing
|
||||
// the most of the available static information.
|
||||
// 4. Whenever the component processes HDR static information in the bitstream even ones with
|
||||
// Unspecified parameters, it SHOULD update its internal coded structure with that information
|
||||
// just before the frame with the new information would be outputted, and the component SHALL
|
||||
// signal an OMX_EventPortSettingsChanged event with data2 set to the extension index.
|
||||
// NOTE: Component SHOULD NOT signal a separate event purely for HDR static info change, if it
|
||||
// occurs together with a port definition (e.g. size), color aspect or crop change.
|
||||
// 5. If certain parameters of the HDR static information encountered in the bitstream cannot be
|
||||
// represented using sInfo, the component SHALL use the closest representation.
|
||||
//
|
||||
// Note: the size of sInfo may increase in the future by supporting additional descriptor types.
|
||||
// Implementations SHOULD NOT require a certain size.
|
||||
struct DescribeHDRStaticInfoParams {
|
||||
OMX_U32 nSize; // IN
|
||||
OMX_VERSIONTYPE nVersion; // IN
|
||||
OMX_U32 nPortIndex; // IN
|
||||
HDRStaticInfo sInfo; // IN/OUT
|
||||
};
|
||||
|
||||
// HDR10+ metadata configuration.
|
||||
//
|
||||
// nParamSize: size of the storage starting at nValue (must be at least 1 and at most
|
||||
// MAX_HDR10PLUSINFO_SIZE). This field must not be modified by the component.
|
||||
// nParamSizeUsed: size of the actual HDR10+ metadata starting at nValue. For OMX_SetConfig,
|
||||
// it must not be modified by the component. For OMX_GetConfig, the component
|
||||
// should put the actual size of the retrieved config in this field (and in
|
||||
// case where nParamSize is smaller than nParamSizeUsed, the component should
|
||||
// still update nParamSizeUsed without actually copying the metadata to nValue).
|
||||
// nValue: storage of the HDR10+ metadata conforming to the user_data_registered_itu_t_t35()
|
||||
// syntax of SEI message for ST 2094-40.
|
||||
//
|
||||
// This is passed via OMX_SetConfig or OMX_GetConfig to video encoders and decoders when the
|
||||
// 'OMX.google.android.index.describeHDR10PlusInfo' extension is given. In general, this config
|
||||
// is associated with a particular frame. A typical sequence of usage is as follows:
|
||||
//
|
||||
// a) OMX_SetConfig associates the config with the next input buffer sent in OMX_EmptyThisBuffer
|
||||
// (input A);
|
||||
// b) The component sends OMX_EventConfigUpdate to notify the client that there is a config
|
||||
// update on the output port that is associated with the next output buffer that's about to
|
||||
// be sent via FillBufferDone callback (output A);
|
||||
// c) The client, upon receiving the OMX_EventConfigUpdate, calls OMX_GetConfig to retrieve
|
||||
// the config and associates it with output A.
|
||||
//
|
||||
// All config updates will be retrieved in the order reported, and the client is required to
|
||||
// call OMX_GetConfig for each OMX_EventConfigUpdate for this config. Note that the order of
|
||||
// OMX_EventConfigUpdate relative to FillBufferDone callback determines which output frame
|
||||
// the config should be associated with, the actual OMX_GetConfig for the config could happen
|
||||
// before or after the component calls the FillBufferDone callback.
|
||||
//
|
||||
// Depending on the video codec type (in particular, whether the codec uses in-band or out-of-
|
||||
// band HDR10+ metadata), the component shall behave as detailed below:
|
||||
//
|
||||
// VIDEO DECODERS:
|
||||
// 1) If the codec utilizes out-of-band HDR10+ metadata, the decoder must support the sequence
|
||||
// a) ~ c) outlined above;
|
||||
// 2) If the codec utilizes in-band HDR10+ metadata, OMX_SetConfig for this config should be
|
||||
// ignored (as the metadata is embedded in the input buffer), while the notification and
|
||||
// retrieval of the config on the output as outlined in b) & c) must be supported.
|
||||
//
|
||||
// VIDEO ENCODERS:
|
||||
// 1) If the codec utilizes out-of-band HDR10+ metadata, the decoder must support the sequence
|
||||
// a) ~ c) outlined above;
|
||||
// 2) If the codec utilizes in-band HDR10+ metadata, OMX_SetConfig for this config outlined in
|
||||
// a) must be supported. The notification as outlined in b) must not be sent, and the
|
||||
// retrieval of the config via OMX_GetConfig should be ignored (as the metadata is embedded
|
||||
// in the output buffer).
|
||||
|
||||
#define MAX_HDR10PLUSINFO_SIZE 1024
|
||||
struct DescribeHDR10PlusInfoParams {
|
||||
OMX_U32 nSize; // IN
|
||||
OMX_VERSIONTYPE nVersion; // IN
|
||||
OMX_U32 nPortIndex; // IN
|
||||
OMX_U32 nParamSize; // IN
|
||||
OMX_U32 nParamSizeUsed; // IN/OUT
|
||||
OMX_U8 nValue[1]; // IN/OUT
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
extern android::OMXPluginBase *createOMXPlugin();
|
||||
|
||||
#endif // HARDWARE_API_H_
|
||||
@@ -1,149 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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 METADATA_BUFFER_TYPE_H
|
||||
#define METADATA_BUFFER_TYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
namespace android {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MetadataBufferType defines the type of the metadata buffers that
|
||||
* can be passed to video encoder component for encoding, via Stagefright
|
||||
* media recording framework. To see how to work with the metadata buffers
|
||||
* in media recording framework, please consult HardwareAPI.h
|
||||
*
|
||||
* The creator of metadata buffers and video encoder share common knowledge
|
||||
* on what is actually being stored in these metadata buffers, and
|
||||
* how the information can be used by the video encoder component
|
||||
* to locate the actual pixel data as the source input for video
|
||||
* encoder, plus whatever other information that is necessary. Stagefright
|
||||
* media recording framework does not need to know anything specific about the
|
||||
* metadata buffers, except for receving each individual metadata buffer
|
||||
* as the source input, making a copy of the metadata buffer, and passing the
|
||||
* copy via OpenMAX API to the video encoder component.
|
||||
*
|
||||
* The creator of the metadata buffers must ensure that the first
|
||||
* 4 bytes in every metadata buffer indicates its buffer type,
|
||||
* and the rest of the metadata buffer contains the
|
||||
* actual metadata information. When a video encoder component receives
|
||||
* a metadata buffer, it uses the first 4 bytes in that buffer to find
|
||||
* out the type of the metadata buffer, and takes action appropriate
|
||||
* to that type of metadata buffers (for instance, locate the actual
|
||||
* pixel data input and then encoding the input data to produce a
|
||||
* compressed output buffer).
|
||||
*
|
||||
* The following shows the layout of a metadata buffer,
|
||||
* where buffer type is a 4-byte field of MetadataBufferType,
|
||||
* and the payload is the metadata information.
|
||||
*
|
||||
* --------------------------------------------------------------
|
||||
* | buffer type | payload |
|
||||
* --------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
|
||||
/*
|
||||
* kMetadataBufferTypeCameraSource is used to indicate that
|
||||
* the source of the metadata buffer is the camera component.
|
||||
*/
|
||||
kMetadataBufferTypeCameraSource = 0,
|
||||
|
||||
/*
|
||||
* kMetadataBufferTypeGrallocSource is used to indicate that
|
||||
* the payload of the metadata buffers can be interpreted as
|
||||
* a buffer_handle_t.
|
||||
* So in this case,the metadata that the encoder receives
|
||||
* will have a byte stream that consists of two parts:
|
||||
* 1. First, there is an integer indicating that it is a GRAlloc
|
||||
* source (kMetadataBufferTypeGrallocSource)
|
||||
* 2. This is followed by the buffer_handle_t that is a handle to the
|
||||
* GRalloc buffer. The encoder needs to interpret this GRalloc handle
|
||||
* and encode the frames.
|
||||
* --------------------------------------------------------------
|
||||
* | kMetadataBufferTypeGrallocSource | buffer_handle_t buffer |
|
||||
* --------------------------------------------------------------
|
||||
*
|
||||
* See the VideoGrallocMetadata structure.
|
||||
*/
|
||||
kMetadataBufferTypeGrallocSource = 1,
|
||||
|
||||
/*
|
||||
* kMetadataBufferTypeGraphicBuffer is used to indicate that
|
||||
* the payload of the metadata buffers can be interpreted as
|
||||
* an ANativeWindowBuffer, and that a fence is provided.
|
||||
*
|
||||
* In this case, the metadata will have a byte stream that consists of three parts:
|
||||
* 1. First, there is an integer indicating that the metadata
|
||||
* contains an ANativeWindowBuffer (kMetadataBufferTypeANWBuffer)
|
||||
* 2. This is followed by the pointer to the ANativeWindowBuffer.
|
||||
* Codec must not free this buffer as it does not actually own this buffer.
|
||||
* 3. Finally, there is an integer containing a fence file descriptor.
|
||||
* The codec must wait on the fence before encoding or decoding into this
|
||||
* buffer. When the buffer is returned, codec must replace this file descriptor
|
||||
* with a new fence, that will be waited on before the buffer is replaced
|
||||
* (encoder) or read (decoder).
|
||||
* ---------------------------------
|
||||
* | kMetadataBufferTypeANWBuffer |
|
||||
* ---------------------------------
|
||||
* | ANativeWindowBuffer *buffer |
|
||||
* ---------------------------------
|
||||
* | int fenceFd |
|
||||
* ---------------------------------
|
||||
*
|
||||
* See the VideoNativeMetadata structure.
|
||||
*/
|
||||
kMetadataBufferTypeANWBuffer = 2,
|
||||
|
||||
/*
|
||||
* kMetadataBufferTypeNativeHandleSource is used to indicate that
|
||||
* the payload of the metadata buffers can be interpreted as
|
||||
* a native_handle_t.
|
||||
*
|
||||
* In this case, the metadata that the encoder receives
|
||||
* will have a byte stream that consists of two parts:
|
||||
* 1. First, there is an integer indicating that the metadata contains a
|
||||
* native handle (kMetadataBufferTypeNativeHandleSource).
|
||||
* 2. This is followed by a pointer to native_handle_t. The encoder needs
|
||||
* to interpret this native handle and encode the frame. The encoder must
|
||||
* not free this native handle as it does not actually own this native
|
||||
* handle. The handle will be freed after the encoder releases the buffer
|
||||
* back to camera.
|
||||
* ----------------------------------------------------------------
|
||||
* | kMetadataBufferTypeNativeHandleSource | native_handle_t* nh |
|
||||
* ----------------------------------------------------------------
|
||||
*
|
||||
* See the VideoNativeHandleMetadata structure.
|
||||
*/
|
||||
kMetadataBufferTypeNativeHandleSource = 3,
|
||||
|
||||
/* This value is used by framework, but is never used inside a metadata buffer */
|
||||
kMetadataBufferTypeInvalid = -1,
|
||||
|
||||
|
||||
// Add more here...
|
||||
|
||||
} MetadataBufferType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // namespace android
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // METADATA_BUFFER_TYPE_H
|
||||
@@ -1,59 +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 OMX_PLUGIN_BASE_H_
|
||||
|
||||
#define OMX_PLUGIN_BASE_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <OMX_Component.h>
|
||||
|
||||
#include <utils/String8.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
struct OMXPluginBase {
|
||||
OMXPluginBase() {}
|
||||
virtual ~OMXPluginBase() {}
|
||||
|
||||
virtual OMX_ERRORTYPE makeComponentInstance(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component) = 0;
|
||||
|
||||
virtual OMX_ERRORTYPE destroyComponentInstance(
|
||||
OMX_COMPONENTTYPE *component) = 0;
|
||||
|
||||
virtual OMX_ERRORTYPE enumerateComponents(
|
||||
OMX_STRING name,
|
||||
size_t size,
|
||||
OMX_U32 index) = 0;
|
||||
|
||||
virtual OMX_ERRORTYPE getRolesOfComponent(
|
||||
const char *name,
|
||||
Vector<String8> *roles) = 0;
|
||||
|
||||
private:
|
||||
OMXPluginBase(const OMXPluginBase &);
|
||||
OMXPluginBase &operator=(const OMXPluginBase &);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // OMX_PLUGIN_BASE_H_
|
||||
@@ -1,344 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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 VIDEO_API_H_
|
||||
|
||||
#define VIDEO_API_H_
|
||||
|
||||
namespace android {
|
||||
|
||||
/**
|
||||
* Structure describing a media image (frame)
|
||||
* Currently only supporting YUV
|
||||
* @deprecated. Use MediaImage2 instead
|
||||
*/
|
||||
struct MediaImage {
|
||||
enum Type {
|
||||
MEDIA_IMAGE_TYPE_UNKNOWN = 0,
|
||||
MEDIA_IMAGE_TYPE_YUV,
|
||||
};
|
||||
|
||||
enum PlaneIndex {
|
||||
Y = 0,
|
||||
U,
|
||||
V,
|
||||
MAX_NUM_PLANES
|
||||
};
|
||||
|
||||
Type mType;
|
||||
uint32_t mNumPlanes; // number of planes
|
||||
uint32_t mWidth; // width of largest plane (unpadded, as in nFrameWidth)
|
||||
uint32_t mHeight; // height of largest plane (unpadded, as in nFrameHeight)
|
||||
uint32_t mBitDepth; // useable bit depth
|
||||
struct PlaneInfo {
|
||||
uint32_t mOffset; // offset of first pixel of the plane in bytes
|
||||
// from buffer offset
|
||||
uint32_t mColInc; // column increment in bytes
|
||||
uint32_t mRowInc; // row increment in bytes
|
||||
uint32_t mHorizSubsampling; // subsampling compared to the largest plane
|
||||
uint32_t mVertSubsampling; // subsampling compared to the largest plane
|
||||
};
|
||||
PlaneInfo mPlane[MAX_NUM_PLANES];
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure describing a media image (frame)
|
||||
*/
|
||||
struct __attribute__ ((__packed__)) MediaImage2 {
|
||||
enum Type : uint32_t {
|
||||
MEDIA_IMAGE_TYPE_UNKNOWN = 0,
|
||||
MEDIA_IMAGE_TYPE_YUV,
|
||||
MEDIA_IMAGE_TYPE_YUVA,
|
||||
MEDIA_IMAGE_TYPE_RGB,
|
||||
MEDIA_IMAGE_TYPE_RGBA,
|
||||
MEDIA_IMAGE_TYPE_Y,
|
||||
};
|
||||
|
||||
enum PlaneIndex : uint32_t {
|
||||
Y = 0,
|
||||
U = 1,
|
||||
V = 2,
|
||||
R = 0,
|
||||
G = 1,
|
||||
B = 2,
|
||||
A = 3,
|
||||
MAX_NUM_PLANES = 4,
|
||||
};
|
||||
|
||||
Type mType;
|
||||
uint32_t mNumPlanes; // number of planes
|
||||
uint32_t mWidth; // width of largest plane (unpadded, as in nFrameWidth)
|
||||
uint32_t mHeight; // height of largest plane (unpadded, as in nFrameHeight)
|
||||
uint32_t mBitDepth; // useable bit depth (always MSB)
|
||||
uint32_t mBitDepthAllocated; // bits per component (must be 8 or 16)
|
||||
|
||||
struct __attribute__ ((__packed__)) PlaneInfo {
|
||||
uint32_t mOffset; // offset of first pixel of the plane in bytes
|
||||
// from buffer offset
|
||||
int32_t mColInc; // column increment in bytes
|
||||
int32_t mRowInc; // row increment in bytes
|
||||
uint32_t mHorizSubsampling; // subsampling compared to the largest plane
|
||||
uint32_t mVertSubsampling; // subsampling compared to the largest plane
|
||||
};
|
||||
PlaneInfo mPlane[MAX_NUM_PLANES];
|
||||
|
||||
void initFromV1(const MediaImage&); // for internal use only
|
||||
};
|
||||
|
||||
static_assert(sizeof(MediaImage2::PlaneInfo) == 20, "wrong struct size");
|
||||
static_assert(sizeof(MediaImage2) == 104, "wrong struct size");
|
||||
|
||||
/**
|
||||
* Aspects of color.
|
||||
*/
|
||||
|
||||
// NOTE: this structure is expected to grow in the future if new color aspects are
|
||||
// added to codec bitstreams. OMX component should not require a specific nSize
|
||||
// though could verify that nSize is at least the size of the structure at the
|
||||
// time of implementation. All new fields will be added at the end of the structure
|
||||
// ensuring backward compatibility.
|
||||
struct __attribute__ ((__packed__, aligned(alignof(uint32_t)))) ColorAspects {
|
||||
// this is in sync with the range values in graphics.h
|
||||
enum Range : uint32_t {
|
||||
RangeUnspecified,
|
||||
RangeFull,
|
||||
RangeLimited,
|
||||
RangeOther = 0xff,
|
||||
};
|
||||
|
||||
enum Primaries : uint32_t {
|
||||
PrimariesUnspecified,
|
||||
PrimariesBT709_5, // Rec.ITU-R BT.709-5 or equivalent
|
||||
PrimariesBT470_6M, // Rec.ITU-R BT.470-6 System M or equivalent
|
||||
PrimariesBT601_6_625, // Rec.ITU-R BT.601-6 625 or equivalent
|
||||
PrimariesBT601_6_525, // Rec.ITU-R BT.601-6 525 or equivalent
|
||||
PrimariesGenericFilm, // Generic Film
|
||||
PrimariesBT2020, // Rec.ITU-R BT.2020 or equivalent
|
||||
PrimariesOther = 0xff,
|
||||
};
|
||||
|
||||
// this partially in sync with the transfer values in graphics.h prior to the transfers
|
||||
// unlikely to be required by Android section
|
||||
enum Transfer : uint32_t {
|
||||
TransferUnspecified,
|
||||
TransferLinear, // Linear transfer characteristics
|
||||
TransferSRGB, // sRGB or equivalent
|
||||
TransferSMPTE170M, // SMPTE 170M or equivalent (e.g. BT.601/709/2020)
|
||||
TransferGamma22, // Assumed display gamma 2.2
|
||||
TransferGamma28, // Assumed display gamma 2.8
|
||||
TransferST2084, // SMPTE ST 2084 for 10/12/14/16 bit systems
|
||||
TransferHLG, // ARIB STD-B67 hybrid-log-gamma
|
||||
|
||||
// transfers unlikely to be required by Android
|
||||
TransferSMPTE240M = 0x40, // SMPTE 240M
|
||||
TransferXvYCC, // IEC 61966-2-4
|
||||
TransferBT1361, // Rec.ITU-R BT.1361 extended gamut
|
||||
TransferST428, // SMPTE ST 428-1
|
||||
TransferOther = 0xff,
|
||||
};
|
||||
|
||||
enum MatrixCoeffs : uint32_t {
|
||||
MatrixUnspecified,
|
||||
MatrixBT709_5, // Rec.ITU-R BT.709-5 or equivalent
|
||||
MatrixBT470_6M, // KR=0.30, KB=0.11 or equivalent
|
||||
MatrixBT601_6, // Rec.ITU-R BT.601-6 625 or equivalent
|
||||
MatrixSMPTE240M, // SMPTE 240M or equivalent
|
||||
MatrixBT2020, // Rec.ITU-R BT.2020 non-constant luminance
|
||||
MatrixBT2020Constant, // Rec.ITU-R BT.2020 constant luminance
|
||||
MatrixOther = 0xff,
|
||||
};
|
||||
|
||||
// this is in sync with the standard values in graphics.h
|
||||
enum Standard : uint32_t {
|
||||
StandardUnspecified,
|
||||
StandardBT709, // PrimariesBT709_5 and MatrixBT709_5
|
||||
StandardBT601_625, // PrimariesBT601_6_625 and MatrixBT601_6
|
||||
StandardBT601_625_Unadjusted, // PrimariesBT601_6_625 and KR=0.222, KB=0.071
|
||||
StandardBT601_525, // PrimariesBT601_6_525 and MatrixBT601_6
|
||||
StandardBT601_525_Unadjusted, // PrimariesBT601_6_525 and MatrixSMPTE240M
|
||||
StandardBT2020, // PrimariesBT2020 and MatrixBT2020
|
||||
StandardBT2020Constant, // PrimariesBT2020 and MatrixBT2020Constant
|
||||
StandardBT470M, // PrimariesBT470_6M and MatrixBT470_6M
|
||||
StandardFilm, // PrimariesGenericFilm and KR=0.253, KB=0.068
|
||||
StandardOther = 0xff,
|
||||
};
|
||||
|
||||
Range mRange; // IN/OUT
|
||||
Primaries mPrimaries; // IN/OUT
|
||||
Transfer mTransfer; // IN/OUT
|
||||
MatrixCoeffs mMatrixCoeffs; // IN/OUT
|
||||
};
|
||||
|
||||
static_assert(sizeof(ColorAspects) == 16, "wrong struct size");
|
||||
|
||||
/**
|
||||
* HDR Metadata.
|
||||
*/
|
||||
|
||||
// HDR Static Metadata Descriptor as defined by CTA-861-3.
|
||||
struct __attribute__ ((__packed__)) HDRStaticInfo {
|
||||
// Static_Metadata_Descriptor_ID
|
||||
enum ID : uint8_t {
|
||||
kType1 = 0, // Static Metadata Type 1
|
||||
} mID;
|
||||
|
||||
struct __attribute__ ((__packed__)) Primaries1 {
|
||||
// values are in units of 0.00002
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
};
|
||||
|
||||
// Static Metadata Descriptor Type 1
|
||||
struct __attribute__ ((__packed__)) Type1 {
|
||||
Primaries1 mR; // display primary 0
|
||||
Primaries1 mG; // display primary 1
|
||||
Primaries1 mB; // display primary 2
|
||||
Primaries1 mW; // white point
|
||||
uint16_t mMaxDisplayLuminance; // in cd/m^2
|
||||
uint16_t mMinDisplayLuminance; // in 0.0001 cd/m^2
|
||||
uint16_t mMaxContentLightLevel; // in cd/m^2
|
||||
uint16_t mMaxFrameAverageLightLevel; // in cd/m^2
|
||||
};
|
||||
|
||||
union {
|
||||
Type1 sType1;
|
||||
};
|
||||
};
|
||||
|
||||
static_assert(sizeof(HDRStaticInfo::Primaries1) == 4, "wrong struct size");
|
||||
static_assert(sizeof(HDRStaticInfo::Type1) == 24, "wrong struct size");
|
||||
static_assert(sizeof(HDRStaticInfo) == 25, "wrong struct size");
|
||||
|
||||
#ifdef STRINGIFY_ENUMS
|
||||
|
||||
inline static const char *asString(MediaImage::Type i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case MediaImage::MEDIA_IMAGE_TYPE_UNKNOWN: return "Unknown";
|
||||
case MediaImage::MEDIA_IMAGE_TYPE_YUV: return "YUV";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(MediaImage::PlaneIndex i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case MediaImage::Y: return "Y";
|
||||
case MediaImage::U: return "U";
|
||||
case MediaImage::V: return "V";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(MediaImage2::Type i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_UNKNOWN: return "Unknown";
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_YUV: return "YUV";
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_YUVA: return "YUVA";
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_RGB: return "RGB";
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_RGBA: return "RGBA";
|
||||
case MediaImage2::MEDIA_IMAGE_TYPE_Y: return "Y";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static char asChar2(
|
||||
MediaImage2::PlaneIndex i, MediaImage2::Type j, char def = '?') {
|
||||
const char *planes = asString(j, NULL);
|
||||
// handle unknown values
|
||||
if (j == MediaImage2::MEDIA_IMAGE_TYPE_UNKNOWN || planes == NULL || i >= strlen(planes)) {
|
||||
return def;
|
||||
}
|
||||
return planes[i];
|
||||
}
|
||||
|
||||
inline static const char *asString(ColorAspects::Range i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case ColorAspects::RangeUnspecified: return "Unspecified";
|
||||
case ColorAspects::RangeFull: return "Full";
|
||||
case ColorAspects::RangeLimited: return "Limited";
|
||||
case ColorAspects::RangeOther: return "Other";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(ColorAspects::Primaries i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case ColorAspects::PrimariesUnspecified: return "Unspecified";
|
||||
case ColorAspects::PrimariesBT709_5: return "BT709_5";
|
||||
case ColorAspects::PrimariesBT470_6M: return "BT470_6M";
|
||||
case ColorAspects::PrimariesBT601_6_625: return "BT601_6_625";
|
||||
case ColorAspects::PrimariesBT601_6_525: return "BT601_6_525";
|
||||
case ColorAspects::PrimariesGenericFilm: return "GenericFilm";
|
||||
case ColorAspects::PrimariesBT2020: return "BT2020";
|
||||
case ColorAspects::PrimariesOther: return "Other";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(ColorAspects::Transfer i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case ColorAspects::TransferUnspecified: return "Unspecified";
|
||||
case ColorAspects::TransferLinear: return "Linear";
|
||||
case ColorAspects::TransferSRGB: return "SRGB";
|
||||
case ColorAspects::TransferSMPTE170M: return "SMPTE170M";
|
||||
case ColorAspects::TransferGamma22: return "Gamma22";
|
||||
case ColorAspects::TransferGamma28: return "Gamma28";
|
||||
case ColorAspects::TransferST2084: return "ST2084";
|
||||
case ColorAspects::TransferHLG: return "HLG";
|
||||
case ColorAspects::TransferSMPTE240M: return "SMPTE240M";
|
||||
case ColorAspects::TransferXvYCC: return "XvYCC";
|
||||
case ColorAspects::TransferBT1361: return "BT1361";
|
||||
case ColorAspects::TransferST428: return "ST428";
|
||||
case ColorAspects::TransferOther: return "Other";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(ColorAspects::MatrixCoeffs i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case ColorAspects::MatrixUnspecified: return "Unspecified";
|
||||
case ColorAspects::MatrixBT709_5: return "BT709_5";
|
||||
case ColorAspects::MatrixBT470_6M: return "BT470_6M";
|
||||
case ColorAspects::MatrixBT601_6: return "BT601_6";
|
||||
case ColorAspects::MatrixSMPTE240M: return "SMPTE240M";
|
||||
case ColorAspects::MatrixBT2020: return "BT2020";
|
||||
case ColorAspects::MatrixBT2020Constant: return "BT2020Constant";
|
||||
case ColorAspects::MatrixOther: return "Other";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
inline static const char *asString(ColorAspects::Standard i, const char *def = "??") {
|
||||
switch (i) {
|
||||
case ColorAspects::StandardUnspecified: return "Unspecified";
|
||||
case ColorAspects::StandardBT709: return "BT709";
|
||||
case ColorAspects::StandardBT601_625: return "BT601_625";
|
||||
case ColorAspects::StandardBT601_625_Unadjusted: return "BT601_625_Unadjusted";
|
||||
case ColorAspects::StandardBT601_525: return "BT601_525";
|
||||
case ColorAspects::StandardBT601_525_Unadjusted: return "BT601_525_Unadjusted";
|
||||
case ColorAspects::StandardBT2020: return "BT2020";
|
||||
case ColorAspects::StandardBT2020Constant: return "BT2020Constant";
|
||||
case ColorAspects::StandardBT470M: return "BT470M";
|
||||
case ColorAspects::StandardFilm: return "Film";
|
||||
case ColorAspects::StandardOther: return "Other";
|
||||
default: return def;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace android
|
||||
|
||||
#endif // VIDEO_API_H_
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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_AudioExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_AudioExt header file contains extensions to the
|
||||
* definitions used by both the application and the component to
|
||||
* access video items.
|
||||
*/
|
||||
|
||||
#ifndef OMX_AudioExt_h
|
||||
#define OMX_AudioExt_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_Core.h>
|
||||
|
||||
#define OMX_AUDIO_AACToolAndroidSSBR (OMX_AUDIO_AACToolVendor << 0) /**< SSBR: MPEG-4 Single-rate (downsampled) Spectral Band Replication tool allowed or active */
|
||||
#define OMX_AUDIO_AACToolAndroidDSBR (OMX_AUDIO_AACToolVendor << 1) /**< DSBR: MPEG-4 Dual-rate Spectral Band Replication tool allowed or active */
|
||||
|
||||
typedef enum OMX_AUDIO_CODINGEXTTYPE {
|
||||
OMX_AUDIO_CodingAndroidUnused = OMX_AUDIO_CodingKhronosExtensions + 0x00100000,
|
||||
OMX_AUDIO_CodingAndroidAC3, /**< AC3 encoded data */
|
||||
OMX_AUDIO_CodingAndroidOPUS, /**< OPUS encoded data */
|
||||
OMX_AUDIO_CodingAndroidEAC3, /**< EAC3 encoded data */
|
||||
OMX_AUDIO_CodingAndroidAC4, /**< AC4 encoded data */
|
||||
} OMX_AUDIO_CODINGEXTTYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_AC3TYPE {
|
||||
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 nSampleRate; /**< Sampling rate of the source data. Use 0 for
|
||||
variable or unknown sampling rate. */
|
||||
} OMX_AUDIO_PARAM_ANDROID_AC3TYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_EAC3TYPE {
|
||||
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 nSampleRate; /**< Sampling rate of the source data. Use 0 for
|
||||
variable or unknown sampling rate. */
|
||||
} OMX_AUDIO_PARAM_ANDROID_EAC3TYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_AC4TYPE {
|
||||
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 nSampleRate; /**< Sampling rate of the source data. Use 0 for
|
||||
variable or unknown sampling rate. */
|
||||
} OMX_AUDIO_PARAM_ANDROID_AC4TYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_OPUSTYPE {
|
||||
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 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_PARAM_ANDROID_OPUSTYPE;
|
||||
|
||||
/** deprecated. use OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE */
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_S32 nMaxOutputChannels; /**< Maximum channel count to be output, -1 if unspecified, 0 if downmixing disabled */
|
||||
OMX_S32 nDrcCut; /**< The DRC attenuation factor, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nDrcBoost; /**< The DRC amplification factor, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nHeavyCompression; /**< 0 for light compression, 1 for heavy compression, -1 if unspecified */
|
||||
OMX_S32 nTargetReferenceLevel; /**< Target reference level, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nEncodedTargetLevel; /**< Target reference level assumed at the encoder, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nPCMLimiterEnable; /**< Signal level limiting, 0 for disable, 1 for enable, -1 if unspecified */
|
||||
} OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_S32 nMaxOutputChannels; /**< Maximum channel count to be output, -1 if unspecified, 0 if downmixing disabled */
|
||||
OMX_S32 nDrcCut; /**< The DRC attenuation factor, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nDrcBoost; /**< The DRC amplification factor, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nHeavyCompression; /**< 0 for light compression, 1 for heavy compression, -1 if unspecified */
|
||||
OMX_S32 nTargetReferenceLevel; /**< Target reference level, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nEncodedTargetLevel; /**< Target reference level assumed at the encoder, between 0 and 127, -1 if unspecified */
|
||||
OMX_S32 nPCMLimiterEnable; /**< Signal level limiting, 0 for disable, 1 for enable, -1 if unspecified */
|
||||
OMX_S32 nDrcEffectType; /**< MPEG-D DRC effect type, between -1 and 6, -2 if unspecified */
|
||||
OMX_S32 nDrcOutputLoudness; /**< MPEG-D DRC Output Loudness, between -1 and 231, -2 if unspecified */
|
||||
OMX_S32 nDrcAlbumMode; /**< MPEG-D DRC Album Mode, between 0 and 1, -1 if unspecified */
|
||||
} OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_PARAM_ANDROID_PROFILETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 eProfile; /**< type is OMX_AUDIO_AACPROFILETYPE or OMX_AUDIO_WMAPROFILETYPE
|
||||
depending on context */
|
||||
OMX_U32 nProfileIndex; /**< Used to query for individual profile support information */
|
||||
} OMX_AUDIO_PARAM_ANDROID_PROFILETYPE;
|
||||
|
||||
typedef struct OMX_AUDIO_CONFIG_ANDROID_AUDIOPRESENTATION {
|
||||
OMX_U32 nSize; /**< size of the structure in bytes */
|
||||
OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
|
||||
OMX_S32 nPresentationId; /**< presentation id */
|
||||
OMX_S32 nProgramId; /**< program id */
|
||||
} OMX_AUDIO_CONFIG_ANDROID_AUDIOPRESENTATION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_AudioExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,596 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* 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 */
|
||||
@@ -1,212 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,966 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* 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 */
|
||||
/**<Reserved android opaque colorformat. Tells the encoder that
|
||||
* the actual colorformat will be relayed by the
|
||||
* Gralloc Buffers.
|
||||
* FIXME: In the process of reserving some enum values for
|
||||
* Android-specific OMX IL colorformats. Change this enum to
|
||||
* an acceptable range once that is done.
|
||||
* */
|
||||
OMX_COLOR_FormatAndroidOpaque = 0x7F000789,
|
||||
OMX_COLOR_Format32BitRGBA8888 = 0x7F00A000,
|
||||
/** Flexible 8-bit YUV format. Codec should report this format
|
||||
* as being supported if it supports any YUV420 packed planar
|
||||
* or semiplanar formats. When port is set to use this format,
|
||||
* codec can substitute any YUV420 packed planar or semiplanar
|
||||
* format for it. */
|
||||
OMX_COLOR_FormatYUV420Flexible = 0x7F420888,
|
||||
|
||||
// 10-bit or 12-bit YUV format, LSB-justified (0's on higher bits)
|
||||
OMX_COLOR_FormatYUV420Planar16 = 0x7F42016B,
|
||||
|
||||
// Packed 10-bit YUV444 representation that includes 2 bits of alpha. Each pixel is
|
||||
// 32-bit. Bits 0-9 contain the U sample, bits 10-19 contain the Y sample,
|
||||
// bits 20-29 contain the V sample, and bits 30-31 contain the alpha value.
|
||||
OMX_COLOR_FormatYUV444Y410 = 0x7F444AAA,
|
||||
|
||||
OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100,
|
||||
OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00,
|
||||
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03,
|
||||
OMX_SEC_COLOR_FormatNV12Tiled = 0x7FC00002,
|
||||
OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m = 0x7FA30C04,
|
||||
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 */
|
||||
@@ -1,345 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* 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 */
|
||||
@@ -1,280 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* 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_IndexComponentEndUnused,
|
||||
|
||||
OMX_IndexPortStartUnused = 0x02000000,
|
||||
OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */
|
||||
OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */
|
||||
OMX_IndexPortEndUnused,
|
||||
|
||||
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_IndexParamAudioFlac, /**< reference: OMX_AUDIO_PARAM_FLACTYPE */
|
||||
OMX_IndexAudioEndUnused,
|
||||
|
||||
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 */
|
||||
OMX_IndexVideoEndUnused,
|
||||
|
||||
/* 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 */
|
||||
OMX_IndexCommonEndUnused,
|
||||
|
||||
/* 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 */
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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_IndexExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_IndexExt header file contains extensions to the definitions
|
||||
* for both applications and components .
|
||||
*/
|
||||
|
||||
#ifndef OMX_IndexExt_h
|
||||
#define OMX_IndexExt_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>
|
||||
|
||||
|
||||
/** Khronos standard extension indices.
|
||||
|
||||
This enum lists the current Khronos extension indices to OpenMAX IL.
|
||||
*/
|
||||
typedef enum OMX_INDEXEXTTYPE {
|
||||
|
||||
/* Component parameters and configurations */
|
||||
OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000,
|
||||
OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */
|
||||
OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */
|
||||
OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */
|
||||
OMX_IndexConfigAndroidVendorExtension, /**< reference: OMX_CONFIG_VENDOR_EXTENSIONTYPE */
|
||||
|
||||
/* Port parameters and configurations */
|
||||
OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000,
|
||||
|
||||
/* Audio parameters and configurations */
|
||||
OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000,
|
||||
OMX_IndexParamAudioAndroidAc3, /**< reference: OMX_AUDIO_PARAM_ANDROID_AC3TYPE */
|
||||
OMX_IndexParamAudioAndroidOpus, /**< reference: OMX_AUDIO_PARAM_ANDROID_OPUSTYPE */
|
||||
OMX_IndexParamAudioAndroidAacPresentation, /**< reference: OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE */
|
||||
OMX_IndexParamAudioAndroidEac3, /**< reference: OMX_AUDIO_PARAM_ANDROID_EAC3TYPE */
|
||||
OMX_IndexParamAudioProfileQuerySupported, /**< reference: OMX_AUDIO_PARAM_ANDROID_PROFILETYPE */
|
||||
OMX_IndexParamAudioAndroidAacDrcPresentation, /**< reference: OMX_AUDIO_PARAM_ANDROID_AACDRCPRESENTATIONTYPE */
|
||||
OMX_IndexParamAudioAndroidAc4, /**< reference: OMX_AUDIO_PARAM_ANDROID_AC4TYPE */
|
||||
OMX_IndexConfigAudioPresentation, /**< reference: OMX_AUDIO_CONFIG_ANDROID_AUDIOPRESENTATION */
|
||||
OMX_IndexExtAudioEndUnused,
|
||||
|
||||
/* Image parameters and configurations */
|
||||
OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000,
|
||||
|
||||
/* Video parameters and configurations */
|
||||
OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000,
|
||||
OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */
|
||||
OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */
|
||||
OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */
|
||||
OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */
|
||||
OMX_IndexParamVideoAndroidVp8Encoder, /**< reference: OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE */
|
||||
OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */
|
||||
OMX_IndexParamSliceSegments, /**< reference: OMX_VIDEO_SLICESEGMENTSTYPE */
|
||||
OMX_IndexConfigAndroidIntraRefresh, /**< reference: OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE */
|
||||
OMX_IndexParamAndroidVideoTemporalLayering, /**< reference: OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE */
|
||||
OMX_IndexConfigAndroidVideoTemporalLayering, /**< reference: OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE */
|
||||
OMX_IndexParamMaxFrameDurationForBitrateControl,/**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexParamVideoVp9, /**< reference: OMX_VIDEO_PARAM_VP9TYPE */
|
||||
OMX_IndexParamVideoAndroidVp9Encoder, /**< reference: OMX_VIDEO_PARAM_ANDROID_VP9ENCODERTYPE */
|
||||
OMX_IndexParamVideoAndroidImageGrid, /**< reference: OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE */
|
||||
OMX_IndexParamVideoAndroidRequiresSwRenderer, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexExtVideoEndUnused,
|
||||
|
||||
/* Image & Video common configurations */
|
||||
OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000,
|
||||
|
||||
/* Other configurations */
|
||||
OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000,
|
||||
OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */
|
||||
OMX_IndexParamConsumerUsageBits, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexConfigLatency, /**< reference: OMX_PARAM_U32TYPE */
|
||||
OMX_IndexConfigLowLatency, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexConfigAndroidTunnelPeek, /**< reference: OMX_CONFIG_BOOLEANTYPE */
|
||||
OMX_IndexExtOtherEndUnused,
|
||||
|
||||
/* Time configurations */
|
||||
OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000,
|
||||
|
||||
OMX_IndexExtMax = 0x7FFFFFFF
|
||||
} OMX_INDEXEXTTYPE;
|
||||
|
||||
#define OMX_MAX_STRINGVALUE_SIZE OMX_MAX_STRINGNAME_SIZE
|
||||
#define OMX_MAX_ANDROID_VENDOR_PARAMCOUNT 32
|
||||
|
||||
typedef enum OMX_ANDROID_VENDOR_VALUETYPE {
|
||||
OMX_AndroidVendorValueInt32 = 0, /*<< int32_t value */
|
||||
OMX_AndroidVendorValueInt64, /*<< int64_t value */
|
||||
OMX_AndroidVendorValueString, /*<< string value */
|
||||
OMX_AndroidVendorValueEndUnused,
|
||||
} OMX_ANDROID_VENDOR_VALUETYPE;
|
||||
|
||||
/**
|
||||
* Structure describing a single value of an Android vendor extension.
|
||||
*
|
||||
* STRUCTURE MEMBERS:
|
||||
* cKey : parameter value name.
|
||||
* eValueType : parameter value type
|
||||
* bSet : if false, the parameter is not set (for OMX_GetConfig) or is unset (OMX_SetConfig)
|
||||
* if true, the parameter is set to the corresponding value below
|
||||
* nInt64 : int64 value
|
||||
* cString : string value
|
||||
*/
|
||||
typedef struct OMX_CONFIG_ANDROID_VENDOR_PARAMTYPE {
|
||||
OMX_U8 cKey[OMX_MAX_STRINGNAME_SIZE];
|
||||
OMX_ANDROID_VENDOR_VALUETYPE eValueType;
|
||||
OMX_BOOL bSet;
|
||||
union {
|
||||
OMX_S32 nInt32;
|
||||
OMX_S64 nInt64;
|
||||
OMX_U8 cString[OMX_MAX_STRINGVALUE_SIZE];
|
||||
};
|
||||
} OMX_CONFIG_ANDROID_VENDOR_PARAMTYPE;
|
||||
|
||||
/**
|
||||
* OMX_CONFIG_ANDROID_VENDOR_EXTENSIONTYPE is the structure for an Android vendor extension
|
||||
* supported by the component. This structure enumerates the various extension parameters and their
|
||||
* values.
|
||||
*
|
||||
* Android vendor extensions have a name and one or more parameter values - each with a string key -
|
||||
* that are set together. The values are exposed to Android applications via a string key that is
|
||||
* the concatenation of 'vendor', the extension name and the parameter key, each separated by dot
|
||||
* (.), with any trailing '.value' suffix(es) removed (though optionally allowed).
|
||||
*
|
||||
* Extension names and parameter keys are subject to the following rules:
|
||||
* - Each SHALL contain a set of lowercase alphanumeric (underscore allowed) tags separated by
|
||||
* dot (.) or dash (-).
|
||||
* - The first character of the first tag, and any tag following a dot SHALL not start with a
|
||||
* digit.
|
||||
* - Tags 'value', 'vendor', 'omx' and 'android' (even if trailed and/or followed by any number
|
||||
* of underscores) are prohibited in the extension name.
|
||||
* - Tags 'vendor', 'omx' and 'android' (even if trailed and/or followed by any number
|
||||
* of underscores) are prohibited in parameter keys.
|
||||
* - The tag 'value' (even if trailed and/or followed by any number
|
||||
* of underscores) is prohibited in parameter keys with the following exception:
|
||||
* the parameter key may be exactly 'value'
|
||||
* - The parameter key for extensions with a single parameter value SHALL be 'value'
|
||||
* - No two extensions SHALL have the same name
|
||||
* - No extension's name SHALL start with another extension's NAME followed by a dot (.)
|
||||
* - No two parameters of an extension SHALL have the same key
|
||||
*
|
||||
* This config can be used with both OMX_GetConfig and OMX_SetConfig. In the OMX_GetConfig
|
||||
* case, the caller specifies nIndex and nParamSizeUsed. The component fills in cName,
|
||||
* eDir and nParamCount. Additionally, if nParamSizeUsed is not less than nParamCount, the
|
||||
* component fills out the parameter values (nParam) with the current values for each parameter
|
||||
* of the vendor extension.
|
||||
*
|
||||
* The value of nIndex goes from 0 to N-1, where N is the number of Android vendor extensions
|
||||
* supported by the component. The component does not need to report N as the caller can determine
|
||||
* N by enumerating all extensions supported by the component. The component may not support any
|
||||
* extensions. If there are no more extensions, OMX_GetParameter returns OMX_ErrorNoMore. The
|
||||
* component supplies extensions in the order it wants clients to set them.
|
||||
*
|
||||
* The component SHALL return OMX_ErrorNone for all cases where nIndex is less than N (specifically
|
||||
* even in the case of where nParamCount is greater than nParamSizeUsed).
|
||||
*
|
||||
* In the OMX_SetConfig case the field nIndex is ignored. If the component supports an Android
|
||||
* vendor extension with the name in cName, it SHALL configure the parameter values for that
|
||||
* extension according to the parameters in nParam. nParamCount is the number of valid parameters
|
||||
* in the nParam array, and nParamSizeUsed is the size of the nParam array. (nParamSizeUsed
|
||||
* SHALL be at least nParamCount) Parameters that are part of a vendor extension but are not
|
||||
* in the nParam array are assumed to be unset (this is different from not changed).
|
||||
* All parameter values SHALL have distinct keys in nParam (the component can assume that this
|
||||
* is the case. Otherwise, the actual value for the parameters that are multiply defined can
|
||||
* be any of the set values.)
|
||||
*
|
||||
* Return values in case of OMX_SetConfig:
|
||||
* OMX_ErrorUnsupportedIndex: the component does not support the extension specified by cName
|
||||
* OMX_ErrorUnsupportedSetting: the component does not support some or any of the parameters
|
||||
* (names) specified in nParam
|
||||
* OMX_ErrorBadParameter: the parameter is invalid (e.g. nParamCount is greater than
|
||||
* nParamSizeUsed, or some parameter value has invalid type)
|
||||
*
|
||||
* STRUCTURE MEMBERS:
|
||||
* nSize : size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* cName : name of vendor extension
|
||||
* nParamCount : the number of parameter values that are part of this vendor extension
|
||||
* nParamSizeUsed : the size of nParam
|
||||
* (must be at least 1 and at most OMX_MAX_ANDROID_VENDOR_PARAMCOUNT)
|
||||
* param : the parameter values
|
||||
*/
|
||||
typedef struct OMX_CONFIG_ANDROID_VENDOR_EXTENSIONTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nIndex;
|
||||
OMX_U8 cName[OMX_MAX_STRINGNAME_SIZE];
|
||||
OMX_DIRTYPE eDir;
|
||||
OMX_U32 nParamCount;
|
||||
OMX_U32 nParamSizeUsed;
|
||||
OMX_CONFIG_ANDROID_VENDOR_PARAMTYPE param[1];
|
||||
} OMX_CONFIG_ANDROID_VENDOR_EXTENSIONTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_IndexExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,354 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* 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 */
|
||||
@@ -1,393 +0,0 @@
|
||||
/* ------------------------------------------------------------------
|
||||
* Copyright (C) 1998-2009 PacketVideo
|
||||
*
|
||||
* 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.
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <stdint.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)
|
||||
#define OMX_API
|
||||
# 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 uint32_t OMX_U32;
|
||||
|
||||
/** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */
|
||||
typedef int32_t 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;
|
||||
|
||||
/*
|
||||
* Temporary Android 64 bit modification
|
||||
*
|
||||
* #define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
* overrides all OMX pointer types to be uint32_t.
|
||||
*
|
||||
* After this change, OMX codecs will work in 32 bit only, so 64 bit processes
|
||||
* must communicate to a remote 32 bit process for OMX to work.
|
||||
*/
|
||||
|
||||
#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
|
||||
|
||||
typedef uint32_t OMX_PTR;
|
||||
typedef OMX_PTR OMX_STRING;
|
||||
typedef OMX_PTR OMX_BYTE;
|
||||
|
||||
#else /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */
|
||||
|
||||
/** 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;
|
||||
|
||||
#endif /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */
|
||||
|
||||
/** 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, unsigned or floating point (Android extension).
|
||||
|
||||
Android floating point support policy:
|
||||
If component does not support floating point raw audio, it can reset
|
||||
configuration to signed 16-bit integer (support for which is required.)
|
||||
nBitsPerSample will be set to 32 for float data.
|
||||
*/
|
||||
typedef enum OMX_NUMERICALDATATYPE
|
||||
{
|
||||
OMX_NumericalDataSigned, /**< signed data */
|
||||
OMX_NumericalDataUnsigned, /**< unsigned data */
|
||||
OMX_NumericalDataFloat = 0x7F000001, /**< floating point 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 OMX_PTR 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 OMX_PTR 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 OMX_PTR 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 */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,517 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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_VideoExt.h - OpenMax IL version 1.1.2
|
||||
* The OMX_VideoExt header file contains extensions to the
|
||||
* definitions used by both the application and the component to
|
||||
* access video items.
|
||||
*/
|
||||
|
||||
#ifndef OMX_VideoExt_h
|
||||
#define OMX_VideoExt_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_Core.h>
|
||||
|
||||
/** NALU Formats */
|
||||
typedef enum OMX_NALUFORMATSTYPE {
|
||||
OMX_NaluFormatStartCodes = 1,
|
||||
OMX_NaluFormatOneNaluPerBuffer = 2,
|
||||
OMX_NaluFormatOneByteInterleaveLength = 4,
|
||||
OMX_NaluFormatTwoByteInterleaveLength = 8,
|
||||
OMX_NaluFormatFourByteInterleaveLength = 16,
|
||||
OMX_NaluFormatCodingMax = 0x7FFFFFFF
|
||||
} OMX_NALUFORMATSTYPE;
|
||||
|
||||
/** NAL Stream Format */
|
||||
typedef struct OMX_NALSTREAMFORMATTYPE{
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_NALUFORMATSTYPE eNaluFormat;
|
||||
} OMX_NALSTREAMFORMATTYPE;
|
||||
|
||||
/** AVC additional profiles */
|
||||
typedef enum OMX_VIDEO_AVCPROFILEEXTTYPE {
|
||||
OMX_VIDEO_AVCProfileConstrainedBaseline = 0x10000, /**< Constrained baseline profile */
|
||||
OMX_VIDEO_AVCProfileConstrainedHigh = 0x80000, /**< Constrained high profile */
|
||||
} OMX_VIDEO_AVCPROFILEEXTTYPE;
|
||||
|
||||
/** VP8 profiles */
|
||||
typedef enum OMX_VIDEO_VP8PROFILETYPE {
|
||||
OMX_VIDEO_VP8ProfileMain = 0x01,
|
||||
OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP8PROFILETYPE;
|
||||
|
||||
/** VP8 levels */
|
||||
typedef enum OMX_VIDEO_VP8LEVELTYPE {
|
||||
OMX_VIDEO_VP8Level_Version0 = 0x01,
|
||||
OMX_VIDEO_VP8Level_Version1 = 0x02,
|
||||
OMX_VIDEO_VP8Level_Version2 = 0x04,
|
||||
OMX_VIDEO_VP8Level_Version3 = 0x08,
|
||||
OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP8LEVELTYPE;
|
||||
|
||||
/** VP8 Param */
|
||||
typedef struct OMX_VIDEO_PARAM_VP8TYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_VP8PROFILETYPE eProfile;
|
||||
OMX_VIDEO_VP8LEVELTYPE eLevel;
|
||||
OMX_U32 nDCTPartitions;
|
||||
OMX_BOOL bErrorResilientMode;
|
||||
} OMX_VIDEO_PARAM_VP8TYPE;
|
||||
|
||||
/** Structure for configuring VP8 reference frames */
|
||||
typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bPreviousFrameRefresh;
|
||||
OMX_BOOL bGoldenFrameRefresh;
|
||||
OMX_BOOL bAlternateFrameRefresh;
|
||||
OMX_BOOL bUsePreviousFrame;
|
||||
OMX_BOOL bUseGoldenFrame;
|
||||
OMX_BOOL bUseAlternateFrame;
|
||||
} OMX_VIDEO_VP8REFERENCEFRAMETYPE;
|
||||
|
||||
/** Structure for querying VP8 reference frame type */
|
||||
typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bIsIntraFrame;
|
||||
OMX_BOOL bIsGoldenOrAlternateFrame;
|
||||
} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE;
|
||||
|
||||
/** Maximum number of VP8 temporal layers */
|
||||
#define OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS 3
|
||||
|
||||
/** VP8 temporal layer patterns */
|
||||
typedef enum OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE {
|
||||
OMX_VIDEO_VPXTemporalLayerPatternNone = 0,
|
||||
OMX_VIDEO_VPXTemporalLayerPatternWebRTC = 1,
|
||||
OMX_VIDEO_VPXTemporalLayerPatternMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE;
|
||||
|
||||
/**
|
||||
* Android specific VP8/VP9 encoder params
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nKeyFrameInterval : Key frame interval in frames
|
||||
* eTemporalPattern : Type of temporal layer pattern
|
||||
* nTemporalLayerCount : Number of temporal coding layers
|
||||
* nTemporalLayerBitrateRatio : Bitrate ratio allocation between temporal
|
||||
* streams in percentage
|
||||
* nMinQuantizer : Minimum (best quality) quantizer
|
||||
* nMaxQuantizer : Maximum (worst quality) quantizer
|
||||
*/
|
||||
typedef struct OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nKeyFrameInterval; // distance between consecutive key_frames (including one
|
||||
// of the key_frames). 0 means interval is unspecified and
|
||||
// can be freely chosen by the codec. 1 means a stream of
|
||||
// only key_frames.
|
||||
|
||||
OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE eTemporalPattern;
|
||||
OMX_U32 nTemporalLayerCount;
|
||||
OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS];
|
||||
OMX_U32 nMinQuantizer;
|
||||
OMX_U32 nMaxQuantizer;
|
||||
} OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE;
|
||||
|
||||
/** VP9 profiles */
|
||||
typedef enum OMX_VIDEO_VP9PROFILETYPE {
|
||||
OMX_VIDEO_VP9Profile0 = 0x1,
|
||||
OMX_VIDEO_VP9Profile1 = 0x2,
|
||||
OMX_VIDEO_VP9Profile2 = 0x4,
|
||||
OMX_VIDEO_VP9Profile3 = 0x8,
|
||||
// HDR profiles also support passing HDR metadata
|
||||
OMX_VIDEO_VP9Profile2HDR = 0x1000,
|
||||
OMX_VIDEO_VP9Profile3HDR = 0x2000,
|
||||
OMX_VIDEO_VP9Profile2HDR10Plus = 0x4000,
|
||||
OMX_VIDEO_VP9Profile3HDR10Plus = 0x8000,
|
||||
OMX_VIDEO_VP9ProfileUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP9ProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP9PROFILETYPE;
|
||||
|
||||
/** VP9 levels */
|
||||
typedef enum OMX_VIDEO_VP9LEVELTYPE {
|
||||
OMX_VIDEO_VP9Level1 = 0x1,
|
||||
OMX_VIDEO_VP9Level11 = 0x2,
|
||||
OMX_VIDEO_VP9Level2 = 0x4,
|
||||
OMX_VIDEO_VP9Level21 = 0x8,
|
||||
OMX_VIDEO_VP9Level3 = 0x10,
|
||||
OMX_VIDEO_VP9Level31 = 0x20,
|
||||
OMX_VIDEO_VP9Level4 = 0x40,
|
||||
OMX_VIDEO_VP9Level41 = 0x80,
|
||||
OMX_VIDEO_VP9Level5 = 0x100,
|
||||
OMX_VIDEO_VP9Level51 = 0x200,
|
||||
OMX_VIDEO_VP9Level52 = 0x400,
|
||||
OMX_VIDEO_VP9Level6 = 0x800,
|
||||
OMX_VIDEO_VP9Level61 = 0x1000,
|
||||
OMX_VIDEO_VP9Level62 = 0x2000,
|
||||
OMX_VIDEO_VP9LevelUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_VP9LevelMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_VP9LEVELTYPE;
|
||||
|
||||
/**
|
||||
* VP9 Parameters.
|
||||
* Encoder specific parameters (decoders should ignore these fields):
|
||||
* - bErrorResilientMode
|
||||
* - nTileRows
|
||||
* - nTileColumns
|
||||
* - bEnableFrameParallelDecoding
|
||||
*/
|
||||
typedef struct OMX_VIDEO_PARAM_VP9TYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_VP9PROFILETYPE eProfile;
|
||||
OMX_VIDEO_VP9LEVELTYPE eLevel;
|
||||
OMX_BOOL bErrorResilientMode;
|
||||
OMX_U32 nTileRows;
|
||||
OMX_U32 nTileColumns;
|
||||
OMX_BOOL bEnableFrameParallelDecoding;
|
||||
} OMX_VIDEO_PARAM_VP9TYPE;
|
||||
|
||||
/** HEVC Profile enum type */
|
||||
typedef enum OMX_VIDEO_HEVCPROFILETYPE {
|
||||
OMX_VIDEO_HEVCProfileUnknown = 0x0,
|
||||
OMX_VIDEO_HEVCProfileMain = 0x1,
|
||||
OMX_VIDEO_HEVCProfileMain10 = 0x2,
|
||||
OMX_VIDEO_HEVCProfileMainStill = 0x4,
|
||||
// Main10 profile with HDR SEI support.
|
||||
OMX_VIDEO_HEVCProfileMain10HDR10 = 0x1000,
|
||||
OMX_VIDEO_HEVCProfileMain10HDR10Plus = 0x2000,
|
||||
OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_HEVCPROFILETYPE;
|
||||
|
||||
/** HEVC Level enum type */
|
||||
typedef enum OMX_VIDEO_HEVCLEVELTYPE {
|
||||
OMX_VIDEO_HEVCLevelUnknown = 0x0,
|
||||
OMX_VIDEO_HEVCMainTierLevel1 = 0x1,
|
||||
OMX_VIDEO_HEVCHighTierLevel1 = 0x2,
|
||||
OMX_VIDEO_HEVCMainTierLevel2 = 0x4,
|
||||
OMX_VIDEO_HEVCHighTierLevel2 = 0x8,
|
||||
OMX_VIDEO_HEVCMainTierLevel21 = 0x10,
|
||||
OMX_VIDEO_HEVCHighTierLevel21 = 0x20,
|
||||
OMX_VIDEO_HEVCMainTierLevel3 = 0x40,
|
||||
OMX_VIDEO_HEVCHighTierLevel3 = 0x80,
|
||||
OMX_VIDEO_HEVCMainTierLevel31 = 0x100,
|
||||
OMX_VIDEO_HEVCHighTierLevel31 = 0x200,
|
||||
OMX_VIDEO_HEVCMainTierLevel4 = 0x400,
|
||||
OMX_VIDEO_HEVCHighTierLevel4 = 0x800,
|
||||
OMX_VIDEO_HEVCMainTierLevel41 = 0x1000,
|
||||
OMX_VIDEO_HEVCHighTierLevel41 = 0x2000,
|
||||
OMX_VIDEO_HEVCMainTierLevel5 = 0x4000,
|
||||
OMX_VIDEO_HEVCHighTierLevel5 = 0x8000,
|
||||
OMX_VIDEO_HEVCMainTierLevel51 = 0x10000,
|
||||
OMX_VIDEO_HEVCHighTierLevel51 = 0x20000,
|
||||
OMX_VIDEO_HEVCMainTierLevel52 = 0x40000,
|
||||
OMX_VIDEO_HEVCHighTierLevel52 = 0x80000,
|
||||
OMX_VIDEO_HEVCMainTierLevel6 = 0x100000,
|
||||
OMX_VIDEO_HEVCHighTierLevel6 = 0x200000,
|
||||
OMX_VIDEO_HEVCMainTierLevel61 = 0x400000,
|
||||
OMX_VIDEO_HEVCHighTierLevel61 = 0x800000,
|
||||
OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000,
|
||||
OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000,
|
||||
OMX_VIDEO_HEVCHighTiermax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_HEVCLEVELTYPE;
|
||||
|
||||
/** Structure for controlling HEVC video encoding */
|
||||
typedef struct OMX_VIDEO_PARAM_HEVCTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_HEVCPROFILETYPE eProfile;
|
||||
OMX_VIDEO_HEVCLEVELTYPE eLevel;
|
||||
OMX_U32 nKeyFrameInterval; // distance between consecutive I-frames (including one
|
||||
// of the I frames). 0 means interval is unspecified and
|
||||
// can be freely chosen by the codec. 1 means a stream of
|
||||
// only I frames.
|
||||
} OMX_VIDEO_PARAM_HEVCTYPE;
|
||||
|
||||
/** Structure to define if dependent slice segments should be used */
|
||||
typedef struct OMX_VIDEO_SLICESEGMENTSTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bDepedentSegments;
|
||||
OMX_BOOL bEnableLoopFilterAcrossSlices;
|
||||
} OMX_VIDEO_SLICESEGMENTSTYPE;
|
||||
|
||||
/** Structure to return timestamps of rendered output frames as well as EOS
|
||||
* for tunneled components.
|
||||
*/
|
||||
typedef struct OMX_VIDEO_RENDEREVENTTYPE {
|
||||
OMX_S64 nMediaTimeUs; // timestamp of rendered video frame
|
||||
OMX_S64 nSystemTimeNs; // system monotonic time at the time frame was rendered
|
||||
// Use INT64_MAX for nMediaTimeUs to signal that the EOS
|
||||
// has been reached. In this case, nSystemTimeNs MUST be
|
||||
// the system time when the last frame was rendered.
|
||||
// This MUST be done in addition to returning (and
|
||||
// following) the render information for the last frame.
|
||||
} OMX_VIDEO_RENDEREVENTTYPE;
|
||||
|
||||
/** Dolby Vision Profile enum type */
|
||||
typedef enum OMX_VIDEO_DOLBYVISIONPROFILETYPE {
|
||||
OMX_VIDEO_DolbyVisionProfileUnknown = 0x0,
|
||||
OMX_VIDEO_DolbyVisionProfileDvavPer = 0x1,
|
||||
OMX_VIDEO_DolbyVisionProfileDvavPen = 0x2,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheDer = 0x4,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheDen = 0x8,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheDtr = 0x10,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheStn = 0x20,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheDth = 0x40,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheDtb = 0x80,
|
||||
OMX_VIDEO_DolbyVisionProfileDvheSt = 0x100,
|
||||
OMX_VIDEO_DolbyVisionProfileDvavSe = 0x200,
|
||||
OMX_VIDEO_DolbyVisionProfileDvav110 = 0x400,
|
||||
OMX_VIDEO_DolbyVisionProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_DOLBYVISIONPROFILETYPE;
|
||||
|
||||
/** Dolby Vision Level enum type */
|
||||
typedef enum OMX_VIDEO_DOLBYVISIONLEVELTYPE {
|
||||
OMX_VIDEO_DolbyVisionLevelUnknown = 0x0,
|
||||
OMX_VIDEO_DolbyVisionLevelHd24 = 0x1,
|
||||
OMX_VIDEO_DolbyVisionLevelHd30 = 0x2,
|
||||
OMX_VIDEO_DolbyVisionLevelFhd24 = 0x4,
|
||||
OMX_VIDEO_DolbyVisionLevelFhd30 = 0x8,
|
||||
OMX_VIDEO_DolbyVisionLevelFhd60 = 0x10,
|
||||
OMX_VIDEO_DolbyVisionLevelUhd24 = 0x20,
|
||||
OMX_VIDEO_DolbyVisionLevelUhd30 = 0x40,
|
||||
OMX_VIDEO_DolbyVisionLevelUhd48 = 0x80,
|
||||
OMX_VIDEO_DolbyVisionLevelUhd60 = 0x100,
|
||||
OMX_VIDEO_DolbyVisionLevelmax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_DOLBYVISIONLEVELTYPE;
|
||||
|
||||
/** AV1 Profile enum type */
|
||||
typedef enum OMX_VIDEO_AV1PROFILETYPE {
|
||||
OMX_VIDEO_AV1ProfileMain8 = 0x00000001,
|
||||
OMX_VIDEO_AV1ProfileMain10 = 0x00000002,
|
||||
OMX_VIDEO_AV1ProfileMain10HDR10 = 0x00001000,
|
||||
OMX_VIDEO_AV1ProfileMain10HDR10Plus = 0x00002000,
|
||||
OMX_VIDEO_AV1ProfileUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_AV1ProfileMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_AV1PROFILETYPE;
|
||||
|
||||
/** AV1 Level enum type */
|
||||
typedef enum OMX_VIDEO_AV1LEVELTYPE {
|
||||
OMX_VIDEO_AV1Level2 = 0x1,
|
||||
OMX_VIDEO_AV1Level21 = 0x2,
|
||||
OMX_VIDEO_AV1Level22 = 0x4,
|
||||
OMX_VIDEO_AV1Level23 = 0x8,
|
||||
OMX_VIDEO_AV1Level3 = 0x10,
|
||||
OMX_VIDEO_AV1Level31 = 0x20,
|
||||
OMX_VIDEO_AV1Level32 = 0x40,
|
||||
OMX_VIDEO_AV1Level33 = 0x80,
|
||||
OMX_VIDEO_AV1Level4 = 0x100,
|
||||
OMX_VIDEO_AV1Level41 = 0x200,
|
||||
OMX_VIDEO_AV1Level42 = 0x400,
|
||||
OMX_VIDEO_AV1Level43 = 0x800,
|
||||
OMX_VIDEO_AV1Level5 = 0x1000,
|
||||
OMX_VIDEO_AV1Level51 = 0x2000,
|
||||
OMX_VIDEO_AV1Level52 = 0x4000,
|
||||
OMX_VIDEO_AV1Level53 = 0x8000,
|
||||
OMX_VIDEO_AV1Level6 = 0x10000,
|
||||
OMX_VIDEO_AV1Level61 = 0x20000,
|
||||
OMX_VIDEO_AV1Level62 = 0x40000,
|
||||
OMX_VIDEO_AV1Level63 = 0x80000,
|
||||
OMX_VIDEO_AV1Level7 = 0x100000,
|
||||
OMX_VIDEO_AV1Level71 = 0x200000,
|
||||
OMX_VIDEO_AV1Level72 = 0x400000,
|
||||
OMX_VIDEO_AV1Level73 = 0x800000,
|
||||
OMX_VIDEO_AV1LevelUnknown = 0x6EFFFFFF,
|
||||
OMX_VIDEO_AV1LevelMax = 0x7FFFFFFF
|
||||
} OMX_VIDEO_AV1LEVELTYPE;
|
||||
|
||||
/**
|
||||
* Structure for configuring video compression intra refresh period
|
||||
*
|
||||
* STRUCT MEMBERS:
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to
|
||||
* nRefreshPeriod : Intra refreh period in frames. Value 0 means disable intra refresh
|
||||
*/
|
||||
typedef struct OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_U32 nRefreshPeriod;
|
||||
} OMX_VIDEO_CONFIG_ANDROID_INTRAREFRESHTYPE;
|
||||
|
||||
/** Maximum number of temporal layers supported by AVC/HEVC */
|
||||
#define OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS 8
|
||||
|
||||
/** temporal layer patterns */
|
||||
typedef enum OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE {
|
||||
OMX_VIDEO_AndroidTemporalLayeringPatternNone = 0,
|
||||
// pattern as defined by WebRTC
|
||||
OMX_VIDEO_AndroidTemporalLayeringPatternWebRTC = 1 << 0,
|
||||
// pattern where frames in any layer other than the base layer only depend on at most the very
|
||||
// last frame from each preceding layer (other than the base layer.)
|
||||
OMX_VIDEO_AndroidTemporalLayeringPatternAndroid = 1 << 1,
|
||||
} OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE;
|
||||
|
||||
/**
|
||||
* Android specific param for configuration of temporal layering.
|
||||
* Android only supports temporal layering where successive layers each double the
|
||||
* previous layer's framerate.
|
||||
* NOTE: Reading this parameter at run-time SHALL return actual run-time values.
|
||||
*
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to (output port for encoders)
|
||||
* eSupportedPatterns : A bitmask of supported layering patterns
|
||||
* nLayerCountMax : Max number of temporal coding layers supported
|
||||
* by the encoder (must be at least 1, 1 meaning temporal layering
|
||||
* is NOT supported)
|
||||
* nBLayerCountMax : Max number of layers that can contain B frames
|
||||
* (0) to (nLayerCountMax - 1)
|
||||
* ePattern : Layering pattern.
|
||||
* nPLayerCountActual : Number of temporal layers to be coded with non-B frames,
|
||||
* starting from and including the base-layer.
|
||||
* (1 to nLayerCountMax - nBLayerCountActual)
|
||||
* If nPLayerCountActual is 1 and nBLayerCountActual is 0, temporal
|
||||
* layering is disabled. Otherwise, it is enabled.
|
||||
* nBLayerCountActual : Number of temporal layers to be coded with B frames,
|
||||
* starting after non-B layers.
|
||||
* (0 to nBLayerCountMax)
|
||||
* bBitrateRatiosSpecified : Flag to indicate if layer-wise bitrate
|
||||
* distribution is specified.
|
||||
* nBitrateRatios : Bitrate ratio (100 based) per layer (index 0 is base layer).
|
||||
* Honored if bBitrateRatiosSpecified is set.
|
||||
* i.e for 4 layers with desired distribution (25% 25% 25% 25%),
|
||||
* nBitrateRatio = {25, 50, 75, 100, ... }
|
||||
* Values in indices not less than 'the actual number of layers
|
||||
* minus 1' MAY be ignored and assumed to be 100.
|
||||
*/
|
||||
typedef struct OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE eSupportedPatterns;
|
||||
OMX_U32 nLayerCountMax;
|
||||
OMX_U32 nBLayerCountMax;
|
||||
OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern;
|
||||
OMX_U32 nPLayerCountActual;
|
||||
OMX_U32 nBLayerCountActual;
|
||||
OMX_BOOL bBitrateRatiosSpecified;
|
||||
OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS];
|
||||
} OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE;
|
||||
|
||||
/**
|
||||
* Android specific config for changing the temporal-layer count or
|
||||
* bitrate-distribution at run-time.
|
||||
*
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to (output port for encoders)
|
||||
* ePattern : Layering pattern.
|
||||
* nPLayerCountActual : Number of temporal layers to be coded with non-B frames.
|
||||
* (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
|
||||
* nBLayerCountActual : Number of temporal layers to be coded with B frames.
|
||||
* (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
|
||||
* bBitrateRatiosSpecified : Flag to indicate if layer-wise bitrate
|
||||
* distribution is specified.
|
||||
* nBitrateRatios : Bitrate ratio (100 based, Q16 values) per layer (0 is base layer).
|
||||
* Honored if bBitrateRatiosSpecified is set.
|
||||
* (same OMX_VIDEO_PARAM_ANDROID_TEMPORALLAYERINGTYPE limits apply.)
|
||||
*/
|
||||
typedef struct OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_VIDEO_ANDROID_TEMPORALLAYERINGPATTERNTYPE ePattern;
|
||||
OMX_U32 nPLayerCountActual;
|
||||
OMX_U32 nBLayerCountActual;
|
||||
OMX_BOOL bBitrateRatiosSpecified;
|
||||
OMX_U32 nBitrateRatios[OMX_VIDEO_ANDROID_MAXTEMPORALLAYERS];
|
||||
} OMX_VIDEO_CONFIG_ANDROID_TEMPORALLAYERINGTYPE;
|
||||
|
||||
/**
|
||||
* Android specific param for specifying image grid layout information for image encoding
|
||||
* use cases, corresponding to index OMX_IndexParamVideoAndroidImageGrid.
|
||||
*
|
||||
* OMX_VIDEO_CodingImageHEIC encoders must handle this param type. When this param is set
|
||||
* on the component with bEnabled set to true, nTileWidth, nTileHeight, nGridRows,
|
||||
* nGridCols indicates the desired grid config by the client. The component can use this
|
||||
* as a heuristic, and is free to choose any suitable grid configs. The client shall
|
||||
* always get the actual from the component after the param is set. Encoder will receive
|
||||
* each input image in full, and shall encode it into tiles in row-major, top-row first,
|
||||
* left-to-right order, and send each encoded tile in a separate output buffer. All output
|
||||
* buffers for the same input buffer shall carry the same timestamp as the input buffer.
|
||||
* If the input buffer is marked EOS, the EOS should only appear on the last output buffer
|
||||
* for that input buffer.
|
||||
*
|
||||
* OMX_VIDEO_CodingHEVC encoders might also receive this param when it's used for image
|
||||
* encoding, although in this case the param only serves as a hint. The encoder will
|
||||
* receive the input image tiles in row-major, top-row first, left-to-right order.
|
||||
* The grid config can be used for quality control, or optimizations.
|
||||
*
|
||||
* If this param is not set, the component shall assume that grid option is disabled.
|
||||
*
|
||||
* nSize : Size of the structure in bytes
|
||||
* nVersion : OMX specification version information
|
||||
* nPortIndex : Port that this structure applies to (output port for encoders)
|
||||
* bEnabled : Whether grid is enabled. If true, the other parameters
|
||||
* specifies the grid config; otherwise they shall be ignored.
|
||||
* nTileWidth : Width of each tile.
|
||||
* nTileHeight : Height of each tile.
|
||||
* nGridRows : Number of rows in the grid.
|
||||
* nGridCols : Number of cols in the grid.
|
||||
*/
|
||||
typedef struct OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE {
|
||||
OMX_U32 nSize;
|
||||
OMX_VERSIONTYPE nVersion;
|
||||
OMX_U32 nPortIndex;
|
||||
OMX_BOOL bEnabled;
|
||||
OMX_U32 nTileWidth;
|
||||
OMX_U32 nTileHeight;
|
||||
OMX_U32 nGridRows;
|
||||
OMX_U32 nGridCols;
|
||||
} OMX_VIDEO_PARAM_ANDROID_IMAGEGRIDTYPE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* OMX_VideoExt_h */
|
||||
/* File EOF */
|
||||
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <media/stagefright/foundation/ABase.h>
|
||||
#include <media/stagefright/foundation/AString.h>
|
||||
#include <utils/RefBase.h>
|
||||
#include <utils/Log.h>
|
||||
#include <OMX_Component.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
struct RedroidOMXComponent : public RefBase {
|
||||
enum {
|
||||
kFenceTimeoutMs = 1000
|
||||
};
|
||||
RedroidOMXComponent(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component);
|
||||
|
||||
virtual OMX_ERRORTYPE initCheck() const;
|
||||
|
||||
void setLibHandle(void *libHandle);
|
||||
void *libHandle() const;
|
||||
|
||||
virtual void prepareForDestruction() {}
|
||||
|
||||
protected:
|
||||
virtual ~RedroidOMXComponent();
|
||||
|
||||
const char *name() const;
|
||||
|
||||
void notify(
|
||||
OMX_EVENTTYPE event,
|
||||
OMX_U32 data1, OMX_U32 data2, OMX_PTR data);
|
||||
|
||||
void notifyEmptyBufferDone(OMX_BUFFERHEADERTYPE *header);
|
||||
void notifyFillBufferDone(OMX_BUFFERHEADERTYPE *header);
|
||||
|
||||
virtual OMX_ERRORTYPE sendCommand(
|
||||
OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR data);
|
||||
|
||||
virtual OMX_ERRORTYPE getParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE setParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE getConfig(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE setConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE getExtensionIndex(
|
||||
const char *name, OMX_INDEXTYPE *index);
|
||||
|
||||
virtual OMX_ERRORTYPE useBuffer(
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size,
|
||||
OMX_U8 *ptr);
|
||||
|
||||
virtual OMX_ERRORTYPE allocateBuffer(
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size);
|
||||
|
||||
virtual OMX_ERRORTYPE freeBuffer(
|
||||
OMX_U32 portIndex,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE emptyThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE fillThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE getState(OMX_STATETYPE *state);
|
||||
|
||||
private:
|
||||
AString mName;
|
||||
const OMX_CALLBACKTYPE *mCallbacks;
|
||||
OMX_COMPONENTTYPE *mComponent;
|
||||
|
||||
void *mLibHandle;
|
||||
|
||||
static OMX_ERRORTYPE SendCommandWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_COMMANDTYPE cmd,
|
||||
OMX_U32 param,
|
||||
OMX_PTR data);
|
||||
|
||||
static OMX_ERRORTYPE GetParameterWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params);
|
||||
|
||||
static OMX_ERRORTYPE SetParameterWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params);
|
||||
|
||||
static OMX_ERRORTYPE GetConfigWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params);
|
||||
|
||||
static OMX_ERRORTYPE SetConfigWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_INDEXTYPE index,
|
||||
OMX_PTR params);
|
||||
|
||||
static OMX_ERRORTYPE GetExtensionIndexWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_STRING name,
|
||||
OMX_INDEXTYPE *index);
|
||||
|
||||
static OMX_ERRORTYPE UseBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size,
|
||||
OMX_U8 *ptr);
|
||||
|
||||
static OMX_ERRORTYPE AllocateBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size);
|
||||
|
||||
static OMX_ERRORTYPE FreeBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_U32 portIndex,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
static OMX_ERRORTYPE EmptyThisBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
static OMX_ERRORTYPE FillThisBufferWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
static OMX_ERRORTYPE GetStateWrapper(
|
||||
OMX_HANDLETYPE component,
|
||||
OMX_STATETYPE *state);
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(RedroidOMXComponent);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
bool isValidOMXParam(T *a) {
|
||||
static_assert(offsetof(typeof(*a), nSize) == 0, "nSize not at offset 0");
|
||||
static_assert(std::is_same< decltype(a->nSize), OMX_U32>::value, "nSize has wrong type");
|
||||
static_assert(offsetof(typeof(*a), nVersion) == 4, "nVersion not at offset 4");
|
||||
static_assert(std::is_same< decltype(a->nVersion), OMX_VERSIONTYPE>::value,
|
||||
"nVersion has wrong type");
|
||||
|
||||
if (a->nSize < sizeof(*a)) {
|
||||
ALOGE("b/27207275: need %zu, got %u", sizeof(*a), a->nSize);
|
||||
android_errorWriteLog(0x534e4554, "27207275");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,193 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SimpleRedroidOMXComponent.h"
|
||||
|
||||
#include <media/stagefright/foundation/ABuffer.h>
|
||||
#include <media/stagefright/foundation/AHandlerReflector.h>
|
||||
#include <media/stagefright/foundation/ColorUtils.h>
|
||||
#include <media/openmax/OMX_Core.h>
|
||||
#include <media/openmax/OMX_Video.h>
|
||||
#include <media/openmax/OMX_VideoExt.h>
|
||||
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
|
||||
#include <utils/RefBase.h>
|
||||
#include <utils/threads.h>
|
||||
#include <utils/Vector.h>
|
||||
#include <utils/List.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
struct RedroidVideoDecoderOMXComponent : public SimpleRedroidOMXComponent {
|
||||
RedroidVideoDecoderOMXComponent(
|
||||
const char *name,
|
||||
const char *componentRole,
|
||||
OMX_VIDEO_CODINGTYPE codingType,
|
||||
const CodecProfileLevel *profileLevels,
|
||||
size_t numProfileLevels,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component);
|
||||
|
||||
protected:
|
||||
enum {
|
||||
kDescribeColorAspectsIndex = kPrepareForAdaptivePlaybackIndex + 1,
|
||||
kDescribeHdrStaticInfoIndex = kPrepareForAdaptivePlaybackIndex + 2,
|
||||
kDescribeHdr10PlusInfoIndex = kPrepareForAdaptivePlaybackIndex + 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
kNotSupported,
|
||||
kPreferBitstream,
|
||||
kPreferContainer,
|
||||
};
|
||||
|
||||
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
|
||||
virtual void onReset();
|
||||
|
||||
virtual OMX_ERRORTYPE internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE getConfig(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params, bool *frameConfig);
|
||||
|
||||
virtual OMX_ERRORTYPE getExtensionIndex(
|
||||
const char *name, OMX_INDEXTYPE *index);
|
||||
|
||||
virtual bool supportsDescribeColorAspects();
|
||||
|
||||
virtual int getColorAspectPreference();
|
||||
|
||||
virtual bool supportDescribeHdrStaticInfo();
|
||||
|
||||
virtual bool supportDescribeHdr10PlusInfo();
|
||||
|
||||
// This function sets both minimum buffer count and actual buffer count of
|
||||
// input port to be |numInputBuffers|. It will also set both minimum buffer
|
||||
// count and actual buffer count of output port to be |numOutputBuffers|.
|
||||
void initPorts(OMX_U32 numInputBuffers,
|
||||
OMX_U32 inputBufferSize,
|
||||
OMX_U32 numOutputBuffers,
|
||||
const char *mimeType,
|
||||
OMX_U32 minCompressionRatio = 1u);
|
||||
|
||||
// This function sets input port's minimum buffer count to |numMinInputBuffers|,
|
||||
// sets input port's actual buffer count to |numInputBuffers|, sets output port's
|
||||
// minimum buffer count to |numMinOutputBuffers| and sets output port's actual buffer
|
||||
// count to be |numOutputBuffers|.
|
||||
void initPorts(OMX_U32 numMinInputBuffers,
|
||||
OMX_U32 numInputBuffers,
|
||||
OMX_U32 inputBufferSize,
|
||||
OMX_U32 numMinOutputBuffers,
|
||||
OMX_U32 numOutputBuffers,
|
||||
const char *mimeType,
|
||||
OMX_U32 minCompressionRatio = 1u);
|
||||
|
||||
virtual void updatePortDefinitions(bool updateCrop = true, bool updateInputSize = false);
|
||||
|
||||
uint32_t outputBufferWidth();
|
||||
uint32_t outputBufferHeight();
|
||||
|
||||
enum CropSettingsMode {
|
||||
kCropUnSet = 0,
|
||||
kCropSet,
|
||||
kCropChanged,
|
||||
};
|
||||
|
||||
// This function will handle several port change events which include
|
||||
// size changed, crop changed, stride changed and coloraspects changed.
|
||||
// It will trigger OMX_EventPortSettingsChanged event if necessary.
|
||||
void handlePortSettingsChange(
|
||||
bool *portWillReset, uint32_t width, uint32_t height,
|
||||
OMX_COLOR_FORMATTYPE outputFormat = OMX_COLOR_FormatYUV420Planar,
|
||||
CropSettingsMode cropSettingsMode = kCropUnSet,
|
||||
bool fakeStride = false);
|
||||
|
||||
void copyYV12FrameToOutputBuffer(
|
||||
uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV,
|
||||
size_t srcYStride, size_t srcUStride, size_t srcVStride);
|
||||
|
||||
enum {
|
||||
kInputPortIndex = 0,
|
||||
kOutputPortIndex = 1,
|
||||
kMaxPortIndex = 1,
|
||||
};
|
||||
|
||||
bool mIsAdaptive;
|
||||
uint32_t mAdaptiveMaxWidth, mAdaptiveMaxHeight;
|
||||
uint32_t mWidth, mHeight;
|
||||
uint32_t mCropLeft, mCropTop, mCropWidth, mCropHeight;
|
||||
OMX_COLOR_FORMATTYPE mOutputFormat;
|
||||
HDRStaticInfo mHdrStaticInfo;
|
||||
enum {
|
||||
NONE,
|
||||
AWAITING_DISABLED,
|
||||
AWAITING_ENABLED
|
||||
} mOutputPortSettingsChange;
|
||||
|
||||
bool mUpdateColorAspects;
|
||||
|
||||
Mutex mColorAspectsLock;
|
||||
// color aspects passed from the framework.
|
||||
ColorAspects mDefaultColorAspects;
|
||||
// color aspects parsed from the bitstream.
|
||||
ColorAspects mBitstreamColorAspects;
|
||||
// final color aspects after combining the above two aspects.
|
||||
ColorAspects mFinalColorAspects;
|
||||
|
||||
bool colorAspectsDiffer(const ColorAspects &a, const ColorAspects &b);
|
||||
|
||||
// This functions takes two color aspects and updates the mFinalColorAspects
|
||||
// based on |preferredAspects|.
|
||||
void updateFinalColorAspects(
|
||||
const ColorAspects &otherAspects, const ColorAspects &preferredAspects);
|
||||
|
||||
// This function will update the mFinalColorAspects based on codec preference.
|
||||
status_t handleColorAspectsChange();
|
||||
|
||||
// Helper function to dump the ColorAspects.
|
||||
void dumpColorAspects(const ColorAspects &colorAspects);
|
||||
|
||||
sp<ABuffer> dequeueInputFrameConfig();
|
||||
void queueOutputFrameConfig(const sp<ABuffer> &info);
|
||||
|
||||
private:
|
||||
uint32_t mMinInputBufferSize;
|
||||
uint32_t mMinCompressionRatio;
|
||||
|
||||
const char *mComponentRole;
|
||||
OMX_VIDEO_CODINGTYPE mCodingType;
|
||||
const CodecProfileLevel *mProfileLevels;
|
||||
size_t mNumProfileLevels;
|
||||
typedef List<sp<ABuffer> > Hdr10PlusInfoList;
|
||||
Hdr10PlusInfoList mHdr10PlusInputs;
|
||||
Hdr10PlusInfoList mHdr10PlusOutputs;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(RedroidVideoDecoderOMXComponent);
|
||||
};
|
||||
|
||||
} // namespace redroid
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <media/openmax/OMX_Core.h>
|
||||
#include <media/openmax/OMX_Video.h>
|
||||
#include <media/openmax/OMX_VideoExt.h>
|
||||
|
||||
#include "SimpleRedroidOMXComponent.h"
|
||||
|
||||
struct hw_module_t;
|
||||
|
||||
namespace android {
|
||||
|
||||
struct RedroidVideoEncoderOMXComponent : public SimpleRedroidOMXComponent {
|
||||
RedroidVideoEncoderOMXComponent(
|
||||
const char *name,
|
||||
const char *componentRole,
|
||||
OMX_VIDEO_CODINGTYPE codingType,
|
||||
const CodecProfileLevel *profileLevels,
|
||||
size_t numProfileLevels,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetParameter(OMX_INDEXTYPE index, const OMX_PTR param);
|
||||
virtual OMX_ERRORTYPE internalGetParameter(OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
protected:
|
||||
void initPorts(
|
||||
OMX_U32 numInputBuffers, OMX_U32 numOutputBuffers, OMX_U32 outputBufferSize,
|
||||
const char *mime, OMX_U32 minCompressionRatio = 1);
|
||||
|
||||
static void setRawVideoSize(OMX_PARAM_PORTDEFINITIONTYPE *def);
|
||||
|
||||
static void ConvertFlexYUVToPlanar(
|
||||
uint8_t *dst, size_t dstStride, size_t dstVStride,
|
||||
struct android_ycbcr *ycbcr, int32_t width, int32_t height);
|
||||
|
||||
static void ConvertYUV420SemiPlanarToYUV420Planar(
|
||||
const uint8_t *inYVU, uint8_t* outYUV, int32_t width, int32_t height);
|
||||
|
||||
static void ConvertRGB32ToPlanar(
|
||||
uint8_t *dstY, size_t dstStride, size_t dstVStride,
|
||||
const uint8_t *src, size_t width, size_t height, size_t srcStride,
|
||||
bool bgr);
|
||||
|
||||
const uint8_t *extractGraphicBuffer(
|
||||
uint8_t *dst, size_t dstSize, const uint8_t *src, size_t srcSize,
|
||||
size_t width, size_t height) const;
|
||||
|
||||
virtual OMX_ERRORTYPE getExtensionIndex(const char *name, OMX_INDEXTYPE *index);
|
||||
|
||||
OMX_ERRORTYPE validateInputBuffer(const OMX_BUFFERHEADERTYPE *inputBufferHeader);
|
||||
|
||||
enum {
|
||||
kInputPortIndex = 0,
|
||||
kOutputPortIndex = 1,
|
||||
};
|
||||
|
||||
bool mInputDataIsMeta;
|
||||
int32_t mWidth; // width of the input frames
|
||||
int32_t mHeight; // height of the input frames
|
||||
uint32_t mBitrate; // target bitrate set for the encoder, in bits per second
|
||||
uint32_t mFramerate; // target framerate set for the encoder, in Q16 format
|
||||
OMX_COLOR_FORMATTYPE mColorFormat; // Color format for the input port
|
||||
|
||||
private:
|
||||
void updatePortParams();
|
||||
OMX_ERRORTYPE internalSetPortParams(const OMX_PARAM_PORTDEFINITIONTYPE* port);
|
||||
|
||||
static const uint32_t kInputBufferAlignment = 1;
|
||||
static const uint32_t kOutputBufferAlignment = 2;
|
||||
|
||||
mutable const hw_module_t *mGrallocModule;
|
||||
|
||||
uint32_t mMinOutputBufferSize;
|
||||
uint32_t mMinCompressionRatio;
|
||||
|
||||
const char *mComponentRole;
|
||||
OMX_VIDEO_CODINGTYPE mCodingType;
|
||||
const CodecProfileLevel *mProfileLevels;
|
||||
size_t mNumProfileLevels;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(RedroidVideoEncoderOMXComponent);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RedroidOMXComponent.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <media/stagefright/foundation/AHandlerReflector.h>
|
||||
#include <utils/RefBase.h>
|
||||
#include <utils/threads.h>
|
||||
#include <utils/Vector.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
struct ALooper;
|
||||
struct ABuffer;
|
||||
|
||||
struct CodecProfileLevel {
|
||||
OMX_U32 mProfile;
|
||||
OMX_U32 mLevel;
|
||||
};
|
||||
|
||||
struct SimpleRedroidOMXComponent : public RedroidOMXComponent {
|
||||
SimpleRedroidOMXComponent(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component);
|
||||
|
||||
virtual void prepareForDestruction();
|
||||
|
||||
void onMessageReceived(const sp<AMessage> &msg);
|
||||
|
||||
protected:
|
||||
struct BufferInfo {
|
||||
OMX_BUFFERHEADERTYPE *mHeader;
|
||||
bool mOwnedByUs;
|
||||
bool mFrameConfig;
|
||||
};
|
||||
|
||||
struct PortInfo {
|
||||
OMX_PARAM_PORTDEFINITIONTYPE mDef;
|
||||
Vector<BufferInfo> mBuffers;
|
||||
List<BufferInfo *> mQueue;
|
||||
|
||||
enum {
|
||||
NONE,
|
||||
DISABLING,
|
||||
ENABLING,
|
||||
} mTransition;
|
||||
};
|
||||
|
||||
enum {
|
||||
kStoreMetaDataExtensionIndex = OMX_IndexVendorStartUnused + 1,
|
||||
kPrepareForAdaptivePlaybackIndex,
|
||||
};
|
||||
|
||||
void addPort(const OMX_PARAM_PORTDEFINITIONTYPE &def);
|
||||
|
||||
virtual OMX_ERRORTYPE internalGetParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE internalSetConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params, bool *frameConfig);
|
||||
|
||||
virtual void onQueueFilled(OMX_U32 portIndex);
|
||||
List<BufferInfo *> &getPortQueue(OMX_U32 portIndex);
|
||||
|
||||
virtual void onPortFlushCompleted(OMX_U32 portIndex);
|
||||
virtual void onPortEnableCompleted(OMX_U32 portIndex, bool enabled);
|
||||
virtual void onReset();
|
||||
|
||||
PortInfo *editPortInfo(OMX_U32 portIndex);
|
||||
|
||||
private:
|
||||
enum {
|
||||
kWhatSendCommand,
|
||||
kWhatEmptyThisBuffer,
|
||||
kWhatFillThisBuffer,
|
||||
};
|
||||
|
||||
Mutex mLock;
|
||||
|
||||
sp<ALooper> mLooper;
|
||||
sp<AHandlerReflector<SimpleRedroidOMXComponent> > mHandler;
|
||||
|
||||
OMX_STATETYPE mState;
|
||||
OMX_STATETYPE mTargetState;
|
||||
|
||||
Vector<PortInfo> mPorts;
|
||||
std::atomic_bool mFrameConfig;
|
||||
|
||||
bool isSetParameterAllowed(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params) const;
|
||||
|
||||
virtual OMX_ERRORTYPE sendCommand(
|
||||
OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR data);
|
||||
|
||||
virtual OMX_ERRORTYPE getParameter(
|
||||
OMX_INDEXTYPE index, OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE setParameter(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE setConfig(
|
||||
OMX_INDEXTYPE index, const OMX_PTR params);
|
||||
|
||||
virtual OMX_ERRORTYPE useBuffer(
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size,
|
||||
OMX_U8 *ptr);
|
||||
|
||||
virtual OMX_ERRORTYPE allocateBuffer(
|
||||
OMX_BUFFERHEADERTYPE **buffer,
|
||||
OMX_U32 portIndex,
|
||||
OMX_PTR appPrivate,
|
||||
OMX_U32 size);
|
||||
|
||||
virtual OMX_ERRORTYPE freeBuffer(
|
||||
OMX_U32 portIndex,
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE emptyThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE fillThisBuffer(
|
||||
OMX_BUFFERHEADERTYPE *buffer);
|
||||
|
||||
virtual OMX_ERRORTYPE getState(OMX_STATETYPE *state);
|
||||
|
||||
void onSendCommand(OMX_COMMANDTYPE cmd, OMX_U32 param);
|
||||
void onChangeState(OMX_STATETYPE state);
|
||||
void onPortEnable(OMX_U32 portIndex, bool enable);
|
||||
void onPortFlush(OMX_U32 portIndex, bool sendFlushComplete);
|
||||
|
||||
void checkTransitions();
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(SimpleRedroidOMXComponent);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
@@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
extern "C" {
|
||||
|
||||
enum codec_type_t {
|
||||
H264_ENCODE,
|
||||
H264_DECODE,
|
||||
};
|
||||
|
||||
struct media_codec_t {
|
||||
|
||||
void *(*codec_alloc)(codec_type_t type, char const *node);
|
||||
|
||||
int (*encode_frame)(void *context, void *buffer_handle, void *out_buf, int *out_size);
|
||||
|
||||
int (*request_key_frame)(void *context);
|
||||
|
||||
int (*codec_free)(void *context);
|
||||
};
|
||||
|
||||
}
|
||||
45
libstagefrighthw/Android.mk
Normal file
45
libstagefrighthw/Android.mk
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
RedroidOMXPlugin.cpp \
|
||||
|
||||
LOCAL_HEADER_LIBRARIES := media_plugin_headers
|
||||
|
||||
LOCAL_C_INCLUDES:= \
|
||||
frameworks/native/include/media/openmax \
|
||||
frameworks/native/include/media/hardware
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libbinder \
|
||||
libutils \
|
||||
libcutils \
|
||||
libdl \
|
||||
libui \
|
||||
liblog \
|
||||
|
||||
LOCAL_MODULE := libstagefrighthw
|
||||
|
||||
LOCAL_MULTILIB := 32
|
||||
|
||||
LOCAL_REQUIRED_MODULES := libOmxCore
|
||||
|
||||
LOCAL_PROPRIETARY_MODULE := true
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
0
libstagefrighthw/MODULE_LICENSE_APACHE2
Normal file
0
libstagefrighthw/MODULE_LICENSE_APACHE2
Normal file
189
libstagefrighthw/NOTICE
Normal file
189
libstagefrighthw/NOTICE
Normal file
@@ -0,0 +1,189 @@
|
||||
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
|
||||
|
||||
172
libstagefrighthw/RedroidOMXPlugin.cpp
Normal file
172
libstagefrighthw/RedroidOMXPlugin.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "RedroidOMXPlugin"
|
||||
#include "RedroidOMXPlugin.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <media/hardware/HardwareAPI.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <log/log.h>
|
||||
|
||||
#define d(...) ALOGD(__VA_ARGS__)
|
||||
|
||||
namespace android {
|
||||
|
||||
OMXPluginBase *createOMXPlugin() {
|
||||
return new RedroidOMXPlugin;
|
||||
}
|
||||
|
||||
RedroidOMXPlugin::RedroidOMXPlugin()
|
||||
: mLibHandle(NULL),
|
||||
mInit(NULL),
|
||||
mDeinit(NULL),
|
||||
mComponentNameEnum(NULL),
|
||||
mGetHandle(NULL),
|
||||
mFreeHandle(NULL),
|
||||
mGetRolesOfComponentHandle(NULL) {
|
||||
|
||||
d("%s", __func__);
|
||||
|
||||
if (!property_get_bool("ro.boot.use_redroid_omx", false)) {
|
||||
d("redroid OMX disabled; try with androidboot.use_redroid_omx=1 to enable");
|
||||
return;
|
||||
}
|
||||
|
||||
mLibHandle = dlopen("libOmxCore.so", RTLD_NOW);
|
||||
|
||||
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");
|
||||
|
||||
if (!mInit || !mDeinit || !mComponentNameEnum || !mGetHandle ||
|
||||
!mFreeHandle || !mGetRolesOfComponentHandle) {
|
||||
dlclose(mLibHandle);
|
||||
mLibHandle = NULL;
|
||||
} else
|
||||
(*mInit)();
|
||||
} else {
|
||||
d("%s", dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
RedroidOMXPlugin::~RedroidOMXPlugin() {
|
||||
if (mLibHandle != NULL) {
|
||||
(*mDeinit)();
|
||||
|
||||
dlclose(mLibHandle);
|
||||
mLibHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::makeComponentInstance(
|
||||
const char *name,
|
||||
const OMX_CALLBACKTYPE *callbacks,
|
||||
OMX_PTR appData,
|
||||
OMX_COMPONENTTYPE **component) {
|
||||
if (mLibHandle == NULL) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
return (*mGetHandle)(
|
||||
reinterpret_cast<OMX_HANDLETYPE *>(component),
|
||||
const_cast<char *>(name),
|
||||
appData, const_cast<OMX_CALLBACKTYPE *>(callbacks));
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::destroyComponentInstance(
|
||||
OMX_COMPONENTTYPE *component) {
|
||||
if (mLibHandle == NULL) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
return (*mFreeHandle)(reinterpret_cast<OMX_HANDLETYPE *>(component));
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::enumerateComponents(
|
||||
OMX_STRING name,
|
||||
size_t size,
|
||||
OMX_U32 index) {
|
||||
if (mLibHandle == NULL) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
return (*mComponentNameEnum)(name, size, index);
|
||||
}
|
||||
|
||||
OMX_ERRORTYPE RedroidOMXPlugin::getRolesOfComponent(
|
||||
const char *name,
|
||||
Vector<String8> *roles) {
|
||||
roles->clear();
|
||||
|
||||
if (mLibHandle == NULL) {
|
||||
return OMX_ErrorUndefined;
|
||||
}
|
||||
|
||||
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) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (numRoles2 != numRoles) {
|
||||
return err;
|
||||
}
|
||||
|
||||
for (OMX_U32 i = 0; i < numRoles; ++i) {
|
||||
String8 s((const char *)array[i]);
|
||||
roles->push(s);
|
||||
|
||||
delete[] array[i];
|
||||
array[i] = NULL;
|
||||
}
|
||||
|
||||
delete[] array;
|
||||
array = NULL;
|
||||
}
|
||||
|
||||
return OMX_ErrorNone;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 The Android Open Source Project
|
||||
* 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.
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <media/stagefright/foundation/ABase.h>
|
||||
#include <media/hardware/OMXPluginBase.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
struct RedroidOMXPlugin : public OMXPluginBase {
|
||||
RedroidOMXPlugin();
|
||||
virtual ~RedroidOMXPlugin();
|
||||
|
||||
virtual OMX_ERRORTYPE makeComponentInstance(
|
||||
const char *name,
|
||||
@@ -43,7 +43,30 @@ struct RedroidOMXPlugin : public OMXPluginBase {
|
||||
Vector<String8> *roles);
|
||||
|
||||
private:
|
||||
DISALLOW_EVIL_CONSTRUCTORS(RedroidOMXPlugin);
|
||||
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;
|
||||
|
||||
RedroidOMXPlugin(const RedroidOMXPlugin &);
|
||||
RedroidOMXPlugin &operator=(const RedroidOMXPlugin &);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
4
omx.mk
4
omx.mk
@@ -1,9 +1,7 @@
|
||||
DEVICE_MANIFEST_FILE += hardware/redroid/omx/android.hardware.media.omx@1.0.xml
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
libstagefrighthw_32 \
|
||||
libstagefright_redroid_avcenc \
|
||||
libmedia_codec_32 \
|
||||
libstagefrighthw \
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
hardware/redroid/omx/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
|
||||
|
||||
Reference in New Issue
Block a user