blob: d1ecaafea88b1c2c45f3e1700635a456dd154aa7 [file] [log] [blame]
Andreas Huberc8d7c142009-11-11 16:33:17 -08001/*
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
Andreas Huberb0caf942009-12-03 11:39:54 -080021#include <media/stagefright/OMXPluginBase.h>
Jamie Gennis33a78142010-08-30 16:48:38 -070022#include <ui/android_native_buffer.h>
Andreas Huberc8d7c142009-11-11 16:33:17 -080023#include <utils/RefBase.h>
24
25#include <OMX_Component.h>
26
Jamie Gennis33a78142010-08-30 16:48:38 -070027namespace android {
28
29// A pointer to this struct is passed to the OMX_SetParameter when the extension
30// index for the 'OMX.google.android.index.enableAndroidNativeBuffers' extension
31// is given.
32//
33// When Android native buffer use is disabled for a port (the default state),
34// the OMX node should operate as normal, and expect UseBuffer calls to set its
35// buffers. This is the mode that will be used when CPU access to the buffer is
36// required.
37//
Jamie Gennis044ace62010-10-29 15:19:29 -070038// When Android native buffer use has been enabled for a given port, the video
39// color format for the port is to be interpreted as an Android pixel format
40// rather than an OMX color format. The node should then expect to receive
Jamie Gennis33a78142010-08-30 16:48:38 -070041// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer
Jamie Gennis044ace62010-10-29 15:19:29 -070042// calls for that port.
Jamie Gennis33a78142010-08-30 16:48:38 -070043struct EnableAndroidNativeBuffersParams {
44 OMX_U32 nSize;
45 OMX_VERSIONTYPE nVersion;
46 OMX_U32 nPortIndex;
47 OMX_BOOL enable;
48};
49
James Dong387e38d2010-10-20 17:38:41 -070050// A pointer to this struct is passed to OMX_SetParameter() when the extension
51// index "OMX.google.android.index.storeMetaDataInBuffers"
52// is given.
53//
54// When meta data is stored in the video buffers passed between OMX clients
55// and OMX components, interpretation of the buffer data is up to the
56// buffer receiver, and the data may or may not be the actual video data, but
57// some information helpful for the receiver to locate the actual data.
58// The buffer receiver thus needs to know how to interpret what is stored
59// in these buffers, with mechanisms pre-determined externally. How to
60// interpret the meta data is outside of the scope of this method.
61//
62// Currently, this is specifically used to pass meta data from video source
63// (camera component, for instance) to video encoder to avoid memcpying of
64// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE.
65// If bStoreMetaData is set to false, real YUV frame data will be stored
66// in the buffers. In addition, if no OMX_SetParameter() call is made
67// with the corresponding extension index, real YUV data is stored
68// in the buffers.
69struct StoreMetaDataInBuffersParams {
70 OMX_U32 nSize;
71 OMX_VERSIONTYPE nVersion;
72 OMX_U32 nPortIndex;
73 OMX_BOOL bStoreMetaData;
74};
75
Jamie Gennis33a78142010-08-30 16:48:38 -070076// A pointer to this struct is passed to OMX_SetParameter when the extension
77// index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is
78// given. This call will only be performed if a prior call was made with the
79// 'OMX.google.android.index.enableAndroidNativeBuffers' extension index,
80// enabling use of Android native buffers.
81struct UseAndroidNativeBufferParams {
82 OMX_U32 nSize;
83 OMX_VERSIONTYPE nVersion;
84 OMX_U32 nPortIndex;
85 OMX_PTR pAppPrivate;
86 OMX_BUFFERHEADERTYPE **bufferHeader;
87 const sp<android_native_buffer_t>& nativeBuffer;
88};
89
Jamie Gennise6befb82011-02-23 19:01:28 -080090// A pointer to this struct is passed to OMX_GetParameter when the extension
91// index for the 'OMX.google.android.index.getAndroidNativeBufferUsage'
92// extension is given. The usage bits returned from this query will be used to
93// allocate the Gralloc buffers that get passed to the useAndroidNativeBuffer
94// command.
95struct GetAndroidNativeBufferUsageParams {
96 OMX_U32 nSize; // IN
97 OMX_VERSIONTYPE nVersion; // IN
98 OMX_U32 nPortIndex; // IN
99 OMX_U32 nUsage; // OUT
100};
101
Jamie Gennis33a78142010-08-30 16:48:38 -0700102} // namespace android
103
Andreas Huberb0caf942009-12-03 11:39:54 -0800104extern android::OMXPluginBase *createOMXPlugin();
105
Andreas Huberc8d7c142009-11-11 16:33:17 -0800106#endif // HARDWARE_API_H_