summaryrefslogtreecommitdiffstats
blob: 5945b4474d74949c8b337570700df5b343b19a3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/*
 * 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.
 */

package android.hardware.media.omx@1.0;

import IOmxBufferSource;

import android.hardware.media@1.0::types;

/**
 * Ref: frameworks/av/include/media/IOMX.h: IOMXNode
 * Ref: https://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pdf
 */

/**
 * IOmxNode is an interface for communicating with an OMX component (called
 * "node" here) that has been previously obtained by calling
 * IOmx::allocateNode().
 */
interface IOmxNode {

    /**
     * Free the node.
     *
     * @param[out] status will be the status of the call.
     */
    freeNode(
        ) generates (
            Status status
        );

    /**
     * Invoke a command on the node.
     *
     * @param[in] cmd indicates the type of the command.
     * @param[in] param is a parameter for the command.
     * @param[out] status will be the status of the call.
     *
     * @see OMX_SendCommand() in the OpenMax IL standard.
     */
    sendCommand(
            uint32_t cmd,
            int32_t param
        ) generates (
            Status status
        );

    /**
     * Retrieve a parameter setting from the node.
     *
     * @param[in] index indicates the type of the parameter to retrieve.
     * @param[in] inParams holds some information about the retrieval.
     * @param[out] status will be the status of the call.
     * @param[out] outParams will be the current parameter setting.
     *
     * @see OMX_GetParameter() in the OpenMax IL standard.
     */
    getParameter(
            uint32_t index,
            Bytes inParams // TODO: describe structure better or point at standard
        ) generates (
            Status status,
            Bytes outParams // TODO: describe structure better or point at standard
        );

    /**
     * Change a parameter setting of the node.
     *
     * @param[in] index indicates the type of the parameter to change.
     * @param[in] params holds the new parameter setting.
     * @param[out] status will be the status of the call.
     *
     * @see OMX_SetParameter() in the OpenMax IL standard.
     */
    setParameter(
            uint32_t index,
            Bytes params // TODO: describe structure better or point at standard
        ) generates (
            Status status
        );

    /**
     * Retrieve a configuration from the node.
     *
     * @param[in] index indicates the type of the configuration to retrieve.
     * @param[in] inConfig holds some information about the retrieval.
     * @param[out] status will be the status of the call.
     * @param[out] outConfig will be the current configuration.
     *
     * @see OMX_GetConfig() in the OpenMax IL standard.
     */
    getConfig(
            uint32_t index,
            Bytes inConfig // TODO: describe structure better or point at standard
        ) generates (
            Status status,
            Bytes outConfig // TODO: describe structure better or point at standard
        );

    /**
     * Change a configuration of the node.
     *
     * @param[in] index indicates the type of the configuration to change.
     * @param[in] config holds the new configuration.
     * @param[out] status will be the status of the call.
     *
     * @see OMX_SetConfig() in the OpenMax IL standard.
     */
    setConfig(
            uint32_t index,
            Bytes config // TODO: describe structure better or point at standard
        ) generates (
            Status status
        );

    /**
     * Set the mode of a port on the node.
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] mode is the target mode on the specified port.
     */
    setPortMode(
            uint32_t portIndex,
            PortMode mode
        ) generates (
            Status status
        );

    /**
     * Prepare a port for adaptive playback. This is based on the extension
     * "OMX.google.android.index.prepareForAdaptivePlayback".
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] enable indicates whether adaptive playback is enabled or not.
     * @param[in] maxFrameWidth specifies the maximum frame width.
     * @param[in] maxFrameHeight specifies the maximum frame height.
     * @param[out] status status will be the status of the call.
     */
    prepareForAdaptivePlayback(
            uint32_t portIndex,
            bool enable,
            uint32_t maxFrameWidth,
            uint32_t maxFrameHeight
        ) generates (
            Status status
        );

    /**
     * Configure a port for a tunneled playback mode. This is based on the
     * extension "OMX.google.android.index.configureVideoTunnelMode".
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] tunneled indicates whether the tunneled mode is used or not.
     * @param[in] audioHwSync is the HW SYNC ID of the audio HAL output stream
     * to sync the video with.
     * @param[out] status will be the status of the call.
     * @param[out] sidebandHandle will contain the codec-allocated sideband
     * window handle.
     */
    configureVideoTunnelMode(
            uint32_t portIndex,
            bool tunneled,
            uint32_t audioHwSync
        ) generates (
            Status status,
            handle sidebandHandle
        );

    /**
     * Retrieve the buffer usage on a port. This is based on the extension
     * "OMX.google.android.index.getAndroidNativeBufferUsage".
     *
     * @param[in] portIndex is the index of the port.
     * @param[out] status will be the status of the call.
     * @param[out] usage will be the usage.
     */
    getGraphicBufferUsage(
            uint32_t portIndex
        ) generates (
            Status status,
            uint32_t usage // TODO: Ask graphics team to define an enum.
        );

    /**
     * Set up a listener to events related to the input surface.
     *
     * @param[in] bufferSource is the listener object that implements
     * IOmxBufferSource.
     * @param[out] status will be the status of the call.
     *
     * @see IOmxBufferSource.
     */
    setInputSurface(
            IOmxBufferSource bufferSource
        ) generates (
            Status status
        );

    /**
     * Allocate an opaque buffer on a port as a native handle.
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] size is the desired size of the buffer.
     * @param[out] status will be the status of the call.
     * @param[out] buffer will be the id of the allocated buffer, which will be
     * needed in some other buffer-related function calls.
     * @param[out] nativeHandle will be the native handle of the allocated
     * buffer.
     *
     * @see OMX_AllocateBuffer() in the OpenMax IL standard.
     */
    allocateSecureBuffer(
            uint32_t portIndex,
            uint64_t size
        ) generates (
            Status status,
            BufferId buffer,
            handle nativeHandle
        );

    /**
     * Assign a buffer to a port.
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] omxBuffer is the buffer to be assigned to the port.
     * @param[out] status will be the status of the call.
     * @param[out] buffer will be the id of the assigned buffer, which will be
     * needed in some other buffer-related function calls.
     *
     * @see OMX_UseBuffer() in the OpenMax IL standard.
     */
    useBuffer(
            uint32_t portIndex,
            CodecBuffer omxBuffer
        ) generates (
            Status status,
            BufferId buffer
        );

    /**
     * Free a buffer previously assigned to a port by allocateSecureBuffer() or
     * useBuffer().
     *
     * @param[in] portIndex is the index of the port.
     * @param[in] buffer is the id of the buffer to be freed.
     * @param[out] status will be the status of the call.
     *
     * @see OMX_FreeBuffer() in the OpenMax IL standard.
     */
    freeBuffer(
            uint32_t portIndex,
            BufferId buffer
        ) generates (
            Status status
        );

    /**
     * Pass \p fence to the node if it supports fences. Otherwise, it waits on
     * \p fence before calling OMX_FillThisBuffer(). The node will take
     * ownership of the fence even if this call fails.
     *
     * If the port is in metadata mode, the buffer will be updated to point to
     * the new buffer passed in via \p omxBuffer before OMX_FillThisBuffer() is
     * called. Otherwise, \p omxBuffer is not used.
     *
     * @param[in] buffer is the id of the buffer to fill.
     * @param[in] omxBuffer points to the new buffer in metadata mode.
     * @param[in] fence is the fence to wait for (if not null).
     * @param[out] status is the status of the call.
     *
     * @see OMX_FillThisBuffer() in the OpenMax IL standard.
     */
    fillBuffer(
            BufferId buffer,
            CodecBuffer omxBuffer,
            Fence fence
        ) generates (
            Status status
        );

    /**
     * Pass \p fence to the node if it supports fences. Otherwise, wait on
     * \p fence before calling OMX_EmptyThisBuffer(). The node will take
     * ownership of the fence even if this call fails.
     *
     * If the port is in metadata mode, the buffer will be updated to point to
     * the new buffer passed in via \p omxBuffer before OMX_EmptyThisBuffer() is
     * called. Otherwise, \p omxBuffer is not used.
     *
     * @param[in] buffer is the id of the buffer to fill.
     * @param[in] omxBuffer points to the new buffer in metadata mode.
     * @param[in] flags is put into the header information that is passed to
     * OMX_EmptyBuffer().
     * @param[in] timestampUs is put into the header information that is passed
     * to OMX_EmptyBuffer().
     * @param[in] fence is the fence to wait for (if not null).
     * @param[out] status is the status of the call.
     *
     * @see OMX_EmptyThisBuffer() in the OpenMax IL standard.
     */
    emptyBuffer(
            BufferId buffer,
            CodecBuffer omxBuffer,
            uint32_t flags, // TODO: describe structure better or point at standard
            uint64_t timestampUs,
            Fence fence
        ) generates (
            Status status
        );

    /**
     * Request the node to translate an extension string to an index.
     *
     * @param[in] parameterName is the requested extension string.
     * @param[out] status is the status of the call.
     * @param[out] index is the translated index.
     *
     * @see OMX_GetExtensionIndex() in the OpenMax IL standard.
     */
    getExtensionIndex(
            string parameterName
        ) generates (
            Status status,
            uint32_t index
        );

    /**
     * Add an OMX message on the node's message queue. The instance of
     * IOmxObserver that was obtained during the creation of the node will
     * receive the message in batches by the callback
     * IOmxObserver::onMessages().
     *
     * @param[in] msg is the message to send.
     * @param[out] status is the status of the call.
     *
     * @see IOmxObserver::onMessages().
     */
    dispatchMessage(
            Message msg
        ) generates (
            Status status
        );

};