2 * Copyright (c) 2008 The Khronos Group Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject
10 * to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 /** OMX_Component.h - OpenMax IL version 1.1.2
25 * The OMX_Component header file contains the definitions used to define
26 * the public interface of a component. This header file is intended to
27 * be used by both the application and the component.
30 #ifndef OMX_Component_h
31 #define OMX_Component_h
35 #endif /* __cplusplus */
39 /* Each OMX header must include all required header files to allow the
40 * header to compile without errors. The includes below are required
41 * for this header file to compile successfully
44 #include <OMX_Audio.h>
45 #include <OMX_Video.h>
46 #include <OMX_Image.h>
47 #include <OMX_Other.h>
50 typedef enum OMX_PORTDOMAINTYPE {
55 OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
56 OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
57 OMX_PortDomainMax = 0x7ffffff
61 typedef struct OMX_PARAM_PORTDEFINITIONTYPE {
62 OMX_U32 nSize; /**< Size of the structure in bytes */
63 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
64 OMX_U32 nPortIndex; /**< Port number the structure applies to */
65 OMX_DIRTYPE eDir; /**< Direction (input or output) of this port */
66 OMX_U32 nBufferCountActual; /**< The actual number of buffers allocated on this port */
67 OMX_U32 nBufferCountMin; /**< The minimum number of buffers this port requires */
68 OMX_U32 nBufferSize; /**< Size, in bytes, for buffers to be used for this channel */
69 OMX_BOOL bEnabled; /**< Ports default to enabled and are enabled/disabled by
70 OMX_CommandPortEnable/OMX_CommandPortDisable.
71 When disabled a port is unpopulated. A disabled port
72 is not populated with buffers on a transition to IDLE. */
73 OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by
74 nBufferCountActual. A disabled port is always unpopulated.
75 An enabled port is populated on a transition to OMX_StateIdle
76 and unpopulated on a transition to loaded. */
77 OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */
79 OMX_AUDIO_PORTDEFINITIONTYPE audio;
80 OMX_VIDEO_PORTDEFINITIONTYPE video;
81 OMX_IMAGE_PORTDEFINITIONTYPE image;
82 OMX_OTHER_PORTDEFINITIONTYPE other;
84 OMX_BOOL bBuffersContiguous;
85 OMX_U32 nBufferAlignment;
86 } OMX_PARAM_PORTDEFINITIONTYPE;
89 typedef struct OMX_PARAM_U32TYPE {
90 OMX_U32 nSize; /**< Size of this structure, in Bytes */
91 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
92 OMX_U32 nPortIndex; /**< port that this structure applies to */
93 OMX_U32 nU32; /**< U32 value */
97 typedef enum OMX_SUSPENSIONPOLICYTYPE {
98 OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */
99 OMX_SuspensionEnabled, /**< Suspension allowed */
100 OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
101 OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
102 OMX_SuspensionPolicyMax = 0x7fffffff
103 } OMX_SUSPENSIONPOLICYTYPE;
106 typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE {
108 OMX_VERSIONTYPE nVersion;
109 OMX_SUSPENSIONPOLICYTYPE ePolicy;
110 } OMX_PARAM_SUSPENSIONPOLICYTYPE;
113 typedef enum OMX_SUSPENSIONTYPE {
114 OMX_NotSuspended, /**< component is not suspended */
115 OMX_Suspended, /**< component is suspended */
116 OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
117 OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
118 OMX_SuspendMax = 0x7FFFFFFF
119 } OMX_SUSPENSIONTYPE;
122 typedef struct OMX_PARAM_SUSPENSIONTYPE {
124 OMX_VERSIONTYPE nVersion;
125 OMX_SUSPENSIONTYPE eType;
126 } OMX_PARAM_SUSPENSIONTYPE ;
128 typedef struct OMX_CONFIG_BOOLEANTYPE {
130 OMX_VERSIONTYPE nVersion;
132 } OMX_CONFIG_BOOLEANTYPE;
134 /* Parameter specifying the content uri to use. */
136 typedef struct OMX_PARAM_CONTENTURITYPE
138 OMX_U32 nSize; /**< size of the structure in bytes, including
140 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
141 OMX_U8 contentURI[1]; /**< The URI name */
142 } OMX_PARAM_CONTENTURITYPE;
144 /* Parameter specifying the pipe to use. */
146 typedef struct OMX_PARAM_CONTENTPIPETYPE
148 OMX_U32 nSize; /**< size of the structure in bytes */
149 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
150 OMX_HANDLETYPE hPipe; /**< The pipe handle*/
151 } OMX_PARAM_CONTENTPIPETYPE;
154 typedef struct OMX_RESOURCECONCEALMENTTYPE {
155 OMX_U32 nSize; /**< size of the structure in bytes */
156 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */
157 OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment
158 methods (like degrading algorithm quality to
159 lower resource consumption or functional bypass)
160 on a component as a resolution to resource conflicts. */
161 } OMX_RESOURCECONCEALMENTTYPE;
164 /** @ingroup metadata */
165 typedef enum OMX_METADATACHARSETTYPE {
166 OMX_MetadataCharsetUnknown = 0,
167 OMX_MetadataCharsetASCII,
168 OMX_MetadataCharsetBinary,
169 OMX_MetadataCharsetCodePage1252,
170 OMX_MetadataCharsetUTF8,
171 OMX_MetadataCharsetJavaConformantUTF8,
172 OMX_MetadataCharsetUTF7,
173 OMX_MetadataCharsetImapUTF7,
174 OMX_MetadataCharsetUTF16LE,
175 OMX_MetadataCharsetUTF16BE,
176 OMX_MetadataCharsetGB12345,
177 OMX_MetadataCharsetHZGB2312,
178 OMX_MetadataCharsetGB2312,
179 OMX_MetadataCharsetGB18030,
180 OMX_MetadataCharsetGBK,
181 OMX_MetadataCharsetBig5,
182 OMX_MetadataCharsetISO88591,
183 OMX_MetadataCharsetISO88592,
184 OMX_MetadataCharsetISO88593,
185 OMX_MetadataCharsetISO88594,
186 OMX_MetadataCharsetISO88595,
187 OMX_MetadataCharsetISO88596,
188 OMX_MetadataCharsetISO88597,
189 OMX_MetadataCharsetISO88598,
190 OMX_MetadataCharsetISO88599,
191 OMX_MetadataCharsetISO885910,
192 OMX_MetadataCharsetISO885913,
193 OMX_MetadataCharsetISO885914,
194 OMX_MetadataCharsetISO885915,
195 OMX_MetadataCharsetShiftJIS,
196 OMX_MetadataCharsetISO2022JP,
197 OMX_MetadataCharsetISO2022JP1,
198 OMX_MetadataCharsetISOEUCJP,
199 OMX_MetadataCharsetSMS7Bit,
200 OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
201 OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
202 OMX_MetadataCharsetTypeMax= 0x7FFFFFFF
203 } OMX_METADATACHARSETTYPE;
205 /** @ingroup metadata */
206 typedef enum OMX_METADATASCOPETYPE
208 OMX_MetadataScopeAllLevels,
209 OMX_MetadataScopeTopLevel,
210 OMX_MetadataScopePortLevel,
211 OMX_MetadataScopeNodeLevel,
212 OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
213 OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
214 OMX_MetadataScopeTypeMax = 0x7fffffff
215 } OMX_METADATASCOPETYPE;
217 /** @ingroup metadata */
218 typedef enum OMX_METADATASEARCHMODETYPE
220 OMX_MetadataSearchValueSizeByIndex,
221 OMX_MetadataSearchItemByIndex,
222 OMX_MetadataSearchNextItemByKey,
223 OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
224 OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
225 OMX_MetadataSearchTypeMax = 0x7fffffff
226 } OMX_METADATASEARCHMODETYPE;
227 /** @ingroup metadata */
228 typedef struct OMX_CONFIG_METADATAITEMCOUNTTYPE
231 OMX_VERSIONTYPE nVersion;
232 OMX_METADATASCOPETYPE eScopeMode;
233 OMX_U32 nScopeSpecifier;
234 OMX_U32 nMetadataItemCount;
235 } OMX_CONFIG_METADATAITEMCOUNTTYPE;
237 /** @ingroup metadata */
238 typedef struct OMX_CONFIG_METADATAITEMTYPE
241 OMX_VERSIONTYPE nVersion;
242 OMX_METADATASCOPETYPE eScopeMode;
243 OMX_U32 nScopeSpecifier;
244 OMX_U32 nMetadataItemIndex;
245 OMX_METADATASEARCHMODETYPE eSearchMode;
246 OMX_METADATACHARSETTYPE eKeyCharset;
249 OMX_METADATACHARSETTYPE eValueCharset;
250 OMX_STRING sLanguageCountry;
251 OMX_U32 nValueMaxSize;
252 OMX_U32 nValueSizeUsed;
254 } OMX_CONFIG_METADATAITEMTYPE;
256 /* @ingroup metadata */
257 typedef struct OMX_CONFIG_CONTAINERNODECOUNTTYPE
260 OMX_VERSIONTYPE nVersion;
262 OMX_U32 nParentNodeID;
264 } OMX_CONFIG_CONTAINERNODECOUNTTYPE;
266 /** @ingroup metadata */
267 typedef struct OMX_CONFIG_CONTAINERNODEIDTYPE
270 OMX_VERSIONTYPE nVersion;
272 OMX_U32 nParentNodeID;
275 OMX_STRING cNodeName;
276 OMX_BOOL bIsLeafType;
277 } OMX_CONFIG_CONTAINERNODEIDTYPE;
279 /** @ingroup metadata */
280 typedef struct OMX_PARAM_METADATAFILTERTYPE
283 OMX_VERSIONTYPE nVersion;
284 OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and
285 * the three key fields below are ignored */
286 OMX_METADATACHARSETTYPE eKeyCharset;
287 OMX_U32 nKeySizeUsed;
289 OMX_U32 nLanguageCountrySizeUsed;
290 OMX_U8 nLanguageCountry[128];
291 OMX_BOOL bEnabled; /* if true then key is part of filter (e.g.
292 * retained for query later). If false then
293 * key is not part of filter */
294 } OMX_PARAM_METADATAFILTERTYPE;
296 /** The OMX_HANDLETYPE structure defines the component handle. The component
297 * handle is used to access all of the component's public methods and also
298 * contains pointers to the component's private data area. The component
299 * handle is initialized by the OMX core (with help from the component)
300 * during the process of loading the component. After the component is
301 * successfully loaded, the application can safely access any of the
302 * component's public functions (although some may return an error because
303 * the state is inappropriate for the access).
307 typedef struct OMX_COMPONENTTYPE
309 /** The size of this structure, in bytes. It is the responsibility
310 of the allocator of this structure to fill in this value. Since
311 this structure is allocated by the GetHandle function, this
312 function will fill in this value. */
315 /** nVersion is the version of the OMX specification that the structure
316 is built against. It is the responsibility of the creator of this
317 structure to initialize this value and every user of this structure
318 should verify that it knows how to use the exact version of
319 this structure found herein. */
320 OMX_VERSIONTYPE nVersion;
322 /** pComponentPrivate is a pointer to the component private data area.
323 This member is allocated and initialized by the component when the
324 component is first loaded. The application should not access this
326 OMX_PTR pComponentPrivate;
328 /** pApplicationPrivate is a pointer that is a parameter to the
329 OMX_GetHandle method, and contains an application private value
330 provided by the IL client. This application private data is
331 returned to the IL Client by OMX in all callbacks */
332 OMX_PTR pApplicationPrivate;
334 /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL
335 specification for details on the GetComponentVersion method.
337 OMX_ERRORTYPE (*GetComponentVersion)(
338 OMX_IN OMX_HANDLETYPE hComponent,
339 OMX_OUT OMX_STRING pComponentName,
340 OMX_OUT OMX_VERSIONTYPE* pComponentVersion,
341 OMX_OUT OMX_VERSIONTYPE* pSpecVersion,
342 OMX_OUT OMX_UUIDTYPE* pComponentUUID);
344 /** refer to OMX_SendCommand in OMX_core.h or the OMX IL
345 specification for details on the SendCommand method.
347 OMX_ERRORTYPE (*SendCommand)(
348 OMX_IN OMX_HANDLETYPE hComponent,
349 OMX_IN OMX_COMMANDTYPE Cmd,
350 OMX_IN OMX_U32 nParam1,
351 OMX_IN OMX_PTR pCmdData);
353 /** refer to OMX_GetParameter in OMX_core.h or the OMX IL
354 specification for details on the GetParameter method.
356 OMX_ERRORTYPE (*GetParameter)(
357 OMX_IN OMX_HANDLETYPE hComponent,
358 OMX_IN OMX_INDEXTYPE nParamIndex,
359 OMX_INOUT OMX_PTR pComponentParameterStructure);
362 /** refer to OMX_SetParameter in OMX_core.h or the OMX IL
363 specification for details on the SetParameter method.
365 OMX_ERRORTYPE (*SetParameter)(
366 OMX_IN OMX_HANDLETYPE hComponent,
367 OMX_IN OMX_INDEXTYPE nIndex,
368 OMX_IN OMX_PTR pComponentParameterStructure);
371 /** refer to OMX_GetConfig in OMX_core.h or the OMX IL
372 specification for details on the GetConfig method.
374 OMX_ERRORTYPE (*GetConfig)(
375 OMX_IN OMX_HANDLETYPE hComponent,
376 OMX_IN OMX_INDEXTYPE nIndex,
377 OMX_INOUT OMX_PTR pComponentConfigStructure);
380 /** refer to OMX_SetConfig in OMX_core.h or the OMX IL
381 specification for details on the SetConfig method.
383 OMX_ERRORTYPE (*SetConfig)(
384 OMX_IN OMX_HANDLETYPE hComponent,
385 OMX_IN OMX_INDEXTYPE nIndex,
386 OMX_IN OMX_PTR pComponentConfigStructure);
389 /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL
390 specification for details on the GetExtensionIndex method.
392 OMX_ERRORTYPE (*GetExtensionIndex)(
393 OMX_IN OMX_HANDLETYPE hComponent,
394 OMX_IN OMX_STRING cParameterName,
395 OMX_OUT OMX_INDEXTYPE* pIndexType);
398 /** refer to OMX_GetState in OMX_core.h or the OMX IL
399 specification for details on the GetState method.
401 OMX_ERRORTYPE (*GetState)(
402 OMX_IN OMX_HANDLETYPE hComponent,
403 OMX_OUT OMX_STATETYPE* pState);
406 /** The ComponentTunnelRequest method will interact with another OMX
407 component to determine if tunneling is possible and to setup the
408 tunneling. The return codes for this method can be used to
409 determine if tunneling is not possible, or if tunneling is not
412 Base profile components (i.e. non-interop) do not support this
413 method and should return OMX_ErrorNotImplemented
415 The interop profile component MUST support tunneling to another
416 interop profile component with a compatible port parameters.
417 A component may also support proprietary communication.
419 If proprietary communication is supported the negotiation of
420 proprietary communication is done outside of OMX in a vendor
421 specific way. It is only required that the proper result be
422 returned and the details of how the setup is done is left
423 to the component implementation.
425 When this method is invoked when nPort in an output port, the
427 1. Populate the pTunnelSetup structure with the output port's
428 requirements and constraints for the tunnel.
430 When this method is invoked when nPort in an input port, the
432 1. Query the necessary parameters from the output port to
433 determine if the ports are compatible for tunneling
434 2. If the ports are compatible, the component should store
435 the tunnel step provided by the output port
436 3. Determine which port (either input or output) is the buffer
437 supplier, and call OMX_SetParameter on the output port to
438 indicate this selection.
440 The component will return from this call within 5 msec.
443 Handle of the component to be accessed. This is the component
444 handle returned by the call to the OMX_GetHandle method.
446 nPort is used to select the port on the component to be used
448 @param [in] hTunneledComp
449 Handle of the component to tunnel with. This is the component
450 handle returned by the call to the OMX_GetHandle method. When
451 this parameter is 0x0 the component should setup the port for
452 communication with the application / IL Client.
453 @param [in] nPortOutput
454 nPortOutput is used indicate the port the component should
456 @param [in] pTunnelSetup
457 Pointer to the tunnel setup structure. When nPort is an output port
458 the component should populate the fields of this structure. When
459 When nPort is an input port the component should review the setup
460 provided by the component with the output port.
461 @return OMX_ERRORTYPE
462 If the command successfully executes, the return code will be
463 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
467 OMX_ERRORTYPE (*ComponentTunnelRequest)(
468 OMX_IN OMX_HANDLETYPE hComp,
469 OMX_IN OMX_U32 nPort,
470 OMX_IN OMX_HANDLETYPE hTunneledComp,
471 OMX_IN OMX_U32 nTunneledPort,
472 OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup);
474 /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL
475 specification for details on the UseBuffer method.
478 OMX_ERRORTYPE (*UseBuffer)(
479 OMX_IN OMX_HANDLETYPE hComponent,
480 OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
481 OMX_IN OMX_U32 nPortIndex,
482 OMX_IN OMX_PTR pAppPrivate,
483 OMX_IN OMX_U32 nSizeBytes,
484 OMX_IN OMX_U8* pBuffer);
486 /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL
487 specification for details on the AllocateBuffer method.
490 OMX_ERRORTYPE (*AllocateBuffer)(
491 OMX_IN OMX_HANDLETYPE hComponent,
492 OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
493 OMX_IN OMX_U32 nPortIndex,
494 OMX_IN OMX_PTR pAppPrivate,
495 OMX_IN OMX_U32 nSizeBytes);
497 /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL
498 specification for details on the FreeBuffer method.
501 OMX_ERRORTYPE (*FreeBuffer)(
502 OMX_IN OMX_HANDLETYPE hComponent,
503 OMX_IN OMX_U32 nPortIndex,
504 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
506 /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL
507 specification for details on the EmptyThisBuffer method.
510 OMX_ERRORTYPE (*EmptyThisBuffer)(
511 OMX_IN OMX_HANDLETYPE hComponent,
512 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
514 /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL
515 specification for details on the FillThisBuffer method.
518 OMX_ERRORTYPE (*FillThisBuffer)(
519 OMX_IN OMX_HANDLETYPE hComponent,
520 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer);
522 /** The SetCallbacks method is used by the core to specify the callback
523 structure from the application to the component. This is a blocking
524 call. The component will return from this call within 5 msec.
525 @param [in] hComponent
526 Handle of the component to be accessed. This is the component
527 handle returned by the call to the GetHandle function.
528 @param [in] pCallbacks
529 pointer to an OMX_CALLBACKTYPE structure used to provide the
530 callback information to the component
532 pointer to an application defined value. It is anticipated that
533 the application will pass a pointer to a data structure or a "this
534 pointer" in this area to allow the callback (in the application)
535 to determine the context of the call
536 @return OMX_ERRORTYPE
537 If the command successfully executes, the return code will be
538 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
540 OMX_ERRORTYPE (*SetCallbacks)(
541 OMX_IN OMX_HANDLETYPE hComponent,
542 OMX_IN OMX_CALLBACKTYPE* pCallbacks,
543 OMX_IN OMX_PTR pAppData);
545 /** ComponentDeInit method is used to deinitialize the component
546 providing a means to free any resources allocated at component
547 initialization. NOTE: After this call the component handle is
548 not valid for further use.
549 @param [in] hComponent
550 Handle of the component to be accessed. This is the component
551 handle returned by the call to the GetHandle function.
552 @return OMX_ERRORTYPE
553 If the command successfully executes, the return code will be
554 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned.
556 OMX_ERRORTYPE (*ComponentDeInit)(
557 OMX_IN OMX_HANDLETYPE hComponent);
560 OMX_ERRORTYPE (*UseEGLImage)(
561 OMX_IN OMX_HANDLETYPE hComponent,
562 OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
563 OMX_IN OMX_U32 nPortIndex,
564 OMX_IN OMX_PTR pAppPrivate,
565 OMX_IN void* eglImage);
567 OMX_ERRORTYPE (*ComponentRoleEnum)(
568 OMX_IN OMX_HANDLETYPE hComponent,
569 OMX_OUT OMX_U8 *cRole,
570 OMX_IN OMX_U32 nIndex);
576 #endif /* __cplusplus */