1334de520b0369215b7931fefa424fb92d295f0ebJames Dong/* 2334de520b0369215b7931fefa424fb92d295f0ebJames Dong * Copyright (C) 2009 The Android Open Source Project 3334de520b0369215b7931fefa424fb92d295f0ebJames Dong * 4334de520b0369215b7931fefa424fb92d295f0ebJames Dong * Licensed under the Apache License, Version 2.0 (the "License"); 5334de520b0369215b7931fefa424fb92d295f0ebJames Dong * you may not use this file except in compliance with the License. 6334de520b0369215b7931fefa424fb92d295f0ebJames Dong * You may obtain a copy of the License at 7334de520b0369215b7931fefa424fb92d295f0ebJames Dong * 8334de520b0369215b7931fefa424fb92d295f0ebJames Dong * http://www.apache.org/licenses/LICENSE-2.0 9334de520b0369215b7931fefa424fb92d295f0ebJames Dong * 10334de520b0369215b7931fefa424fb92d295f0ebJames Dong * Unless required by applicable law or agreed to in writing, software 11334de520b0369215b7931fefa424fb92d295f0ebJames Dong * distributed under the License is distributed on an "AS IS" BASIS, 12334de520b0369215b7931fefa424fb92d295f0ebJames Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13334de520b0369215b7931fefa424fb92d295f0ebJames Dong * See the License for the specific language governing permissions and 14334de520b0369215b7931fefa424fb92d295f0ebJames Dong * limitations under the License. 15334de520b0369215b7931fefa424fb92d295f0ebJames Dong */ 16334de520b0369215b7931fefa424fb92d295f0ebJames Dong 17334de520b0369215b7931fefa424fb92d295f0ebJames Dong#ifndef HARDWARE_API_H_ 18334de520b0369215b7931fefa424fb92d295f0ebJames Dong 19334de520b0369215b7931fefa424fb92d295f0ebJames Dong#define HARDWARE_API_H_ 20334de520b0369215b7931fefa424fb92d295f0ebJames Dong 2100e595f10f9a3a009b55c982b4f9fab3d18e5333Andreas Huber#include <media/hardware/OMXPluginBase.h> 2200e595f10f9a3a009b55c982b4f9fab3d18e5333Andreas Huber#include <media/hardware/MetadataBufferType.h> 23334de520b0369215b7931fefa424fb92d295f0ebJames Dong#include <system/window.h> 24334de520b0369215b7931fefa424fb92d295f0ebJames Dong#include <utils/RefBase.h> 25334de520b0369215b7931fefa424fb92d295f0ebJames Dong 26334de520b0369215b7931fefa424fb92d295f0ebJames Dong#include <OMX_Component.h> 27334de520b0369215b7931fefa424fb92d295f0ebJames Dong 28334de520b0369215b7931fefa424fb92d295f0ebJames Dongnamespace android { 29334de520b0369215b7931fefa424fb92d295f0ebJames Dong 30334de520b0369215b7931fefa424fb92d295f0ebJames Dong// A pointer to this struct is passed to the OMX_SetParameter when the extension 31334de520b0369215b7931fefa424fb92d295f0ebJames Dong// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension 32334de520b0369215b7931fefa424fb92d295f0ebJames Dong// is given. 33334de520b0369215b7931fefa424fb92d295f0ebJames Dong// 34334de520b0369215b7931fefa424fb92d295f0ebJames Dong// When Android native buffer use is disabled for a port (the default state), 35334de520b0369215b7931fefa424fb92d295f0ebJames Dong// the OMX node should operate as normal, and expect UseBuffer calls to set its 36334de520b0369215b7931fefa424fb92d295f0ebJames Dong// buffers. This is the mode that will be used when CPU access to the buffer is 37334de520b0369215b7931fefa424fb92d295f0ebJames Dong// required. 38334de520b0369215b7931fefa424fb92d295f0ebJames Dong// 39334de520b0369215b7931fefa424fb92d295f0ebJames Dong// When Android native buffer use has been enabled for a given port, the video 40334de520b0369215b7931fefa424fb92d295f0ebJames Dong// color format for the port is to be interpreted as an Android pixel format 415f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// rather than an OMX color format. Enabling Android native buffers may also 425f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// change how the component receives the native buffers. If store-metadata-mode 435f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// is enabled on the port, the component will receive the buffers as specified 445f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// in the section below. Otherwise, unless the node supports the 455f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// 'OMX.google.android.index.useAndroidNativeBuffer2' extension, it should 465f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// expect to receive UseAndroidNativeBuffer calls (via OMX_SetParameter) rather 475f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// than UseBuffer calls for that port. 48334de520b0369215b7931fefa424fb92d295f0ebJames Dongstruct EnableAndroidNativeBuffersParams { 49334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nSize; 50334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_VERSIONTYPE nVersion; 51334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nPortIndex; 52334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_BOOL enable; 53334de520b0369215b7931fefa424fb92d295f0ebJames Dong}; 54334de520b0369215b7931fefa424fb92d295f0ebJames Dong 55334de520b0369215b7931fefa424fb92d295f0ebJames Dong// A pointer to this struct is passed to OMX_SetParameter() when the extension 56334de520b0369215b7931fefa424fb92d295f0ebJames Dong// index "OMX.google.android.index.storeMetaDataInBuffers" 57334de520b0369215b7931fefa424fb92d295f0ebJames Dong// is given. 58334de520b0369215b7931fefa424fb92d295f0ebJames Dong// 59334de520b0369215b7931fefa424fb92d295f0ebJames Dong// When meta data is stored in the video buffers passed between OMX clients 60334de520b0369215b7931fefa424fb92d295f0ebJames Dong// and OMX components, interpretation of the buffer data is up to the 61334de520b0369215b7931fefa424fb92d295f0ebJames Dong// buffer receiver, and the data may or may not be the actual video data, but 62334de520b0369215b7931fefa424fb92d295f0ebJames Dong// some information helpful for the receiver to locate the actual data. 63334de520b0369215b7931fefa424fb92d295f0ebJames Dong// The buffer receiver thus needs to know how to interpret what is stored 64334de520b0369215b7931fefa424fb92d295f0ebJames Dong// in these buffers, with mechanisms pre-determined externally. How to 65334de520b0369215b7931fefa424fb92d295f0ebJames Dong// interpret the meta data is outside of the scope of this method. 66334de520b0369215b7931fefa424fb92d295f0ebJames Dong// 67334de520b0369215b7931fefa424fb92d295f0ebJames Dong// Currently, this is specifically used to pass meta data from video source 68334de520b0369215b7931fefa424fb92d295f0ebJames Dong// (camera component, for instance) to video encoder to avoid memcpying of 695f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// input video frame data. To do this, bStoreMetaData is set to OMX_TRUE. 70334de520b0369215b7931fefa424fb92d295f0ebJames Dong// If bStoreMetaData is set to false, real YUV frame data will be stored 71334de520b0369215b7931fefa424fb92d295f0ebJames Dong// in the buffers. In addition, if no OMX_SetParameter() call is made 72334de520b0369215b7931fefa424fb92d295f0ebJames Dong// with the corresponding extension index, real YUV data is stored 73334de520b0369215b7931fefa424fb92d295f0ebJames Dong// in the buffers. 745f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// 755f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// For video decoder output port, the metadata buffer layout is defined below. 765f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// 775f39f6043da49ca7ab1f682374e055deb73b0c89Lajos Molnar// Metadata buffers are registered with the component using UseBuffer calls. 78334de520b0369215b7931fefa424fb92d295f0ebJames Dongstruct StoreMetaDataInBuffersParams { 79334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nSize; 80334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_VERSIONTYPE nVersion; 81334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nPortIndex; 82334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_BOOL bStoreMetaData; 83334de520b0369215b7931fefa424fb92d295f0ebJames Dong}; 84334de520b0369215b7931fefa424fb92d295f0ebJames Dong 8507d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar// Meta data buffer layout used to transport output frames to the decoder for 8607d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar// dynamic buffer handling. 8707d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnarstruct VideoDecoderOutputMetaData { 8807d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar MetadataBufferType eType; 8907d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar buffer_handle_t pHandle; 9007d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar}; 9107d93d197ab41e60f91954592f6ffcd35ed757a0Lajos Molnar 92dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// A pointer to this struct is passed to OMX_SetParameter() when the extension 93dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// index "OMX.google.android.index.prepareForAdaptivePlayback" is given. 94dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// 95dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// This method is used to signal a video decoder, that the user has requested 96dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// seamless resolution change support (if bEnable is set to OMX_TRUE). 97dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// nMaxFrameWidth and nMaxFrameHeight are the dimensions of the largest 98dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// anticipated frames in the video. If bEnable is OMX_FALSE, no resolution 99dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// change is expected, and the nMaxFrameWidth/Height fields are unused. 100dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// 101dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// If the decoder supports dynamic output buffers, it may ignore this 102dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// request. Otherwise, it shall request resources in such a way so that it 103dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// avoids full port-reconfiguration (due to output port-definition change) 104dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// during resolution changes. 105dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// 106dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// DO NOT USE THIS STRUCTURE AS IT WILL BE REMOVED. INSTEAD, IMPLEMENT 107dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar// METADATA SUPPORT FOR VIDEO DECODERS. 108dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnarstruct PrepareForAdaptivePlaybackParams { 109dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_U32 nSize; 110dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_VERSIONTYPE nVersion; 111dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_U32 nPortIndex; 112dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_BOOL bEnable; 113dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_U32 nMaxFrameWidth; 114dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar OMX_U32 nMaxFrameHeight; 115dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar}; 116dde86f7b1802668a9c0986bcf7970c0e3565a92bLajos Molnar 117334de520b0369215b7931fefa424fb92d295f0ebJames Dong// A pointer to this struct is passed to OMX_SetParameter when the extension 118334de520b0369215b7931fefa424fb92d295f0ebJames Dong// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is 119334de520b0369215b7931fefa424fb92d295f0ebJames Dong// given. This call will only be performed if a prior call was made with the 120334de520b0369215b7931fefa424fb92d295f0ebJames Dong// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index, 121334de520b0369215b7931fefa424fb92d295f0ebJames Dong// enabling use of Android native buffers. 122334de520b0369215b7931fefa424fb92d295f0ebJames Dongstruct UseAndroidNativeBufferParams { 123334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nSize; 124334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_VERSIONTYPE nVersion; 125334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nPortIndex; 126334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_PTR pAppPrivate; 127334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_BUFFERHEADERTYPE **bufferHeader; 128334de520b0369215b7931fefa424fb92d295f0ebJames Dong const sp<ANativeWindowBuffer>& nativeBuffer; 129334de520b0369215b7931fefa424fb92d295f0ebJames Dong}; 130334de520b0369215b7931fefa424fb92d295f0ebJames Dong 131334de520b0369215b7931fefa424fb92d295f0ebJames Dong// A pointer to this struct is passed to OMX_GetParameter when the extension 132334de520b0369215b7931fefa424fb92d295f0ebJames Dong// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage' 133334de520b0369215b7931fefa424fb92d295f0ebJames Dong// extension is given. The usage bits returned from this query will be used to 134334de520b0369215b7931fefa424fb92d295f0ebJames Dong// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer 135334de520b0369215b7931fefa424fb92d295f0ebJames Dong// command. 136334de520b0369215b7931fefa424fb92d295f0ebJames Dongstruct GetAndroidNativeBufferUsageParams { 137334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nSize; // IN 138334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_VERSIONTYPE nVersion; // IN 139334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nPortIndex; // IN 140334de520b0369215b7931fefa424fb92d295f0ebJames Dong OMX_U32 nUsage; // OUT 141334de520b0369215b7931fefa424fb92d295f0ebJames Dong}; 142334de520b0369215b7931fefa424fb92d295f0ebJames Dong 143334de520b0369215b7931fefa424fb92d295f0ebJames Dong// An enum OMX_COLOR_FormatAndroidOpaque to indicate an opaque colorformat 144334de520b0369215b7931fefa424fb92d295f0ebJames Dong// is declared in media/stagefright/openmax/OMX_IVCommon.h 145334de520b0369215b7931fefa424fb92d295f0ebJames Dong// This will inform the encoder that the actual 146334de520b0369215b7931fefa424fb92d295f0ebJames Dong// colorformat will be relayed by the GRalloc Buffers. 147334de520b0369215b7931fefa424fb92d295f0ebJames Dong// OMX_COLOR_FormatAndroidOpaque = 0x7F000001, 148334de520b0369215b7931fefa424fb92d295f0ebJames Dong 1497682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber// A pointer to this struct is passed to OMX_SetParameter when the extension 1507682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber// index for the 'OMX.google.android.index.prependSPSPPSToIDRFrames' extension 1517682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber// is given. 1527682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber// A successful result indicates that future IDR frames will be prefixed by 1537682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber// SPS/PPS. 1547682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huberstruct PrependSPSPPSToIDRFramesParams { 1557682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber OMX_U32 nSize; 1567682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber OMX_VERSIONTYPE nVersion; 1577682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber OMX_BOOL bEnable; 1587682a9c35a5e9acae738974ea3a73a4ca7796323Andreas Huber}; 159334de520b0369215b7931fefa424fb92d295f0ebJames Dong 160524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// Structure describing a media image (frame) 161524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// Currently only supporting YUV 162524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnarstruct MediaImage { 163524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar enum Type { 164524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar MEDIA_IMAGE_TYPE_UNKNOWN = 0, 165524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar MEDIA_IMAGE_TYPE_YUV, 166524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar }; 167524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar 168524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar enum PlaneIndex { 169524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar Y = 0, 170524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar U, 171524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar V, 172524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar MAX_NUM_PLANES 173524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar }; 174524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar 175524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar Type mType; 176524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mNumPlanes; // number of planes 177ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar size_t mWidth; // width of largest plane (unpadded, as in nFrameWidth) 178ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar size_t mHeight; // height of largest plane (unpadded, as in nFrameHeight) 179524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mBitDepth; // useable bit depth 180524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar struct PlaneInfo { 181524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mOffset; // offset of first pixel of the plane in bytes 182524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar // from buffer offset 183524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mColInc; // column increment in bytes 184524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mRowInc; // row increment in bytes 185524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mHorizSubsampling; // subsampling compared to the largest plane 186524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar size_t mVertSubsampling; // subsampling compared to the largest plane 187524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar }; 188524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar PlaneInfo mPlane[MAX_NUM_PLANES]; 189524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar}; 190524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar 191524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// A pointer to this struct is passed to OMX_GetParameter when the extension 192524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// index for the 'OMX.google.android.index.describeColorFormat' 193524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// extension is given. This method can be called from any component state 194524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// other than invalid. The color-format, frame width/height, and stride/ 195524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// slice-height parameters are ones that are associated with a raw video 196524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// port (input or output), but the stride/slice height parameters may be 197ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// incorrect. bUsingNativeBuffers is OMX_TRUE if native android buffers will 198ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// be used (while specifying this color format). 199ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// 200ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// The component shall fill out the MediaImage structure that 201524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// corresponds to the described raw video format, and the potentially corrected 202524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// stride and slice-height info. 203524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar// 204ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// The behavior is slightly different if bUsingNativeBuffers is OMX_TRUE, 205ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// though most implementations can ignore this difference. When using native buffers, 206ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// the component may change the configured color format to an optimized format. 207ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// Additionally, when allocating these buffers for flexible usecase, the framework 208ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// will set the SW_READ/WRITE_OFTEN usage flags. In this case (if bUsingNativeBuffers 209ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// is OMX_TRUE), the component shall fill out the MediaImage information for the 210ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// scenario when these SW-readable/writable buffers are locked using gralloc_lock. 211ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// Note, that these buffers may also be locked using gralloc_lock_ycbcr, which must 212ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// be supported for vendor-specific formats. 213ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// 214ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// For non-YUV packed planar/semiplanar image formats, or if bUsingNativeBuffers 215ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// is OMX_TRUE and the component does not support this color format with native 216ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar// buffers, the component shall set mNumPlanes to 0, and mType to MEDIA_IMAGE_TYPE_UNKNOWN. 217524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnarstruct DescribeColorFormatParams { 218524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_U32 nSize; 219524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_VERSIONTYPE nVersion; 220524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar // input: parameters from OMX_VIDEO_PORTDEFINITIONTYPE 221524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_COLOR_FORMATTYPE eColorFormat; 222524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_U32 nFrameWidth; 223524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_U32 nFrameHeight; 224524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_U32 nStride; 225524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar OMX_U32 nSliceHeight; 226ea5da67d90647a1d4b395be51bf9cec218b98b71Lajos Molnar OMX_BOOL bUsingNativeBuffers; 227524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar 228524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar // output: fill out the MediaImage fields 229524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar MediaImage sMediaImage; 230524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar}; 231524077caa6a5e5508af40cf2012d45087ed9e7f3Lajos Molnar 2327cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// A pointer to this struct is passed to OMX_SetParameter or OMX_GetParameter 2337cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// when the extension index for the 2347cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// 'OMX.google.android.index.configureVideoTunnelMode' extension is given. 2357cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// If the extension is supported then tunneled playback mode should be supported 2367cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// by the codec. If bTunneled is set to OMX_TRUE then the video decoder should 2377cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// operate in "tunneled" mode and output its decoded frames directly to the 2387cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// sink. In this case nAudioHwSync is the HW SYNC ID of the audio HAL Output 2397cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// stream to sync the video with. If bTunneled is set to OMX_FALSE, "tunneled" 2407cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// mode should be disabled and nAudioHwSync should be ignored. 2417cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// OMX_GetParameter is used to query tunneling configuration. bTunneled should 2427cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// return whether decoder is operating in tunneled mode, and if it is, 2437cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad// pSidebandWindow should contain the codec allocated sideband window handle. 2447cb0d39016ff8061fe9fc2967870c145a6ffa2acRachadstruct ConfigureVideoTunnelModeParams { 2457cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_U32 nSize; // IN 2467cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_VERSIONTYPE nVersion; // IN 2477cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_U32 nPortIndex; // IN 2487cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_BOOL bTunneled; // IN/OUT 2497cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_U32 nAudioHwSync; // IN 2507cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad OMX_PTR pSidebandWindow; // OUT 2517cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad}; 2527cb0d39016ff8061fe9fc2967870c145a6ffa2acRachad 253334de520b0369215b7931fefa424fb92d295f0ebJames Dong} // namespace android 254334de520b0369215b7931fefa424fb92d295f0ebJames Dong 255334de520b0369215b7931fefa424fb92d295f0ebJames Dongextern android::OMXPluginBase *createOMXPlugin(); 256334de520b0369215b7931fefa424fb92d295f0ebJames Dong 257334de520b0369215b7931fefa424fb92d295f0ebJames Dong#endif // HARDWARE_API_H_ 258