blob: fc0f070ef1c7cfaa958c617fafc24540d5cd618d [file] [log] [blame]
James Dong334de522012-03-12 12:47:14 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef HARDWARE_API_H_
18
19#define HARDWARE_API_H_
20
21#include <OMXPluginBase.h>
Lajos Molnar07d93d12013-05-03 13:20:53 -070022#include <MetadataBufferType.h>
James Dong334de522012-03-12 12:47:14 -070023#include <system/window.h>
24#include <utils/RefBase.h>
25
26#include <OMX_Component.h>
27
28namespace android {
29
30// A pointer to this struct is passed to the OMX_SetParameter when the extension
31// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
32// is given.
33//
34// When Android native buffer use is disabled for a port (the default state),
35// the OMX node should operate as normal, and expect UseBuffer calls to set its
36// buffers. This is the mode that will be used when CPU access to the buffer is
37// required.
38//
39// When Android native buffer use has been enabled for a given port, the video
40// color format for the port is to be interpreted as an Android pixel format
41// rather than an OMX color format. The node should then expect to receive
42// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer
43// calls for that port.
44struct EnableAndroidNativeBuffersParams {
45 OMX_U32 nSize;
46 OMX_VERSIONTYPE nVersion;
47 OMX_U32 nPortIndex;
48 OMX_BOOL enable;
49};
50
51// A pointer to this struct is passed to OMX_SetParameter() when the extension
52// index "OMX.google.android.index.storeMetaDataInBuffers"
53// is given.
54//
55// When meta data is stored in the video buffers passed between OMX clients
56// and OMX components, interpretation of the buffer data is up to the
57// buffer receiver, and the data may or may not be the actual video data, but
58// some information helpful for the receiver to locate the actual data.
59// The buffer receiver thus needs to know how to interpret what is stored
60// in these buffers, with mechanisms pre-determined externally. How to
61// interpret the meta data is outside of the scope of this method.
62//
63// Currently, this is specifically used to pass meta data from video source
64// (camera component, for instance) to video encoder to avoid memcpying of
65// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE.
66// If bStoreMetaData is set to false, real YUV frame data will be stored
67// in the buffers. In addition, if no OMX_SetParameter() call is made
68// with the corresponding extension index, real YUV data is stored
69// in the buffers.
70struct StoreMetaDataInBuffersParams {
71 OMX_U32 nSize;
72 OMX_VERSIONTYPE nVersion;
73 OMX_U32 nPortIndex;
74 OMX_BOOL bStoreMetaData;
75};
76
Lajos Molnar07d93d12013-05-03 13:20:53 -070077// Meta data buffer layout used to transport output frames to the decoder for
78// dynamic buffer handling.
79struct VideoDecoderOutputMetaData {
80 MetadataBufferType eType;
81 buffer_handle_t pHandle;
82};
83
James Dong334de522012-03-12 12:47:14 -070084// A pointer to this struct is passed to OMX_SetParameter when the extension
85// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is
86// given. This call will only be performed if a prior call was made with the
87// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index,
88// enabling use of Android native buffers.
89struct UseAndroidNativeBufferParams {
90 OMX_U32 nSize;
91 OMX_VERSIONTYPE nVersion;
92 OMX_U32 nPortIndex;
93 OMX_PTR pAppPrivate;
94 OMX_BUFFERHEADERTYPE **bufferHeader;
95 const sp<ANativeWindowBuffer>& nativeBuffer;
96};
97
98// A pointer to this struct is passed to OMX_GetParameter when the extension
99// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage'
100// extension is given. The usage bits returned from this query will be used to
101// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer
102// command.
103struct GetAndroidNativeBufferUsageParams {
104 OMX_U32 nSize; // IN
105 OMX_VERSIONTYPE nVersion; // IN
106 OMX_U32 nPortIndex; // IN
107 OMX_U32 nUsage; // OUT
108};
109
110// An enum OMX_COLOR_FormatAndroidOpaque to indicate an opaque colorformat
111// is declared in media/stagefright/openmax/OMX_IVCommon.h
112// This will inform the encoder that the actual
113// colorformat will be relayed by the GRalloc Buffers.
114// OMX_COLOR_FormatAndroidOpaque = 0x7F000001,
115
Andreas Huber7682a9c2012-09-28 11:32:16 -0700116// A pointer to this struct is passed to OMX_SetParameter when the extension
117// index for the 'OMX.google.android.index.prependSPSPPSToIDRFrames' extension
118// is given.
119// A successful result indicates that future IDR frames will be prefixed by
120// SPS/PPS.
121struct PrependSPSPPSToIDRFramesParams {
122 OMX_U32 nSize;
123 OMX_VERSIONTYPE nVersion;
124 OMX_BOOL bEnable;
125};
James Dong334de522012-03-12 12:47:14 -0700126
127} // namespace android
128
129extern android::OMXPluginBase *createOMXPlugin();
130
131#endif // HARDWARE_API_H_