1 /* ------------------------------------------------------------------ 2 * Copyright (C) 1998-2009 PacketVideo 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 13 * express or implied. 14 * See the License for the specific language governing permissions 15 * and limitations under the License. 16 * ------------------------------------------------------------------- 17 */ 18 /* 19 * Copyright (c) 2008 The Khronos Group Inc. 20 * 21 * Permission is hereby granted, free of charge, to any person obtaining 22 * a copy of this software and associated documentation files (the 23 * "Software"), to deal in the Software without restriction, including 24 * without limitation the rights to use, copy, modify, merge, publish, 25 * distribute, sublicense, and/or sell copies of the Software, and to 26 * permit persons to whom the Software is furnished to do so, subject 27 * to the following conditions: 28 * The above copyright notice and this permission notice shall be included 29 * in all copies or substantial portions of the Software. 30 * 31 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 32 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 33 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 34 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 35 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 36 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 37 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 38 * 39 */ 40 41 /** OMX_Core.h - OpenMax IL version 1.1.2 42 * The OMX_Core header file contains the definitions used by both the 43 * application and the component to access common items. 44 */ 45 46 #ifndef OMX_Core_h 47 #define OMX_Core_h 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif /* __cplusplus */ 52 53 54 /* Each OMX header shall include all required header files to allow the 55 * header to compile without errors. The includes below are required 56 * for this header file to compile successfully 57 */ 58 59 #include <OMX_Index.h> 60 61 62 /** The OMX_COMMANDTYPE enumeration is used to specify the action in the 63 * OMX_SendCommand macro. 64 * @ingroup core 65 */ 66 typedef enum OMX_COMMANDTYPE 67 { 68 OMX_CommandStateSet, /**< Change the component state */ 69 OMX_CommandFlush, /**< Flush the data queue(s) of a component */ 70 OMX_CommandPortDisable, /**< Disable a port on a component. */ 71 OMX_CommandPortEnable, /**< Enable a port on a component. */ 72 OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */ 73 OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 74 OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 75 OMX_CommandMax = 0X7FFFFFFF 76 } OMX_COMMANDTYPE; 77 78 79 80 /** The OMX_STATETYPE enumeration is used to indicate or change the component 81 * state. This enumeration reflects the current state of the component when 82 * used with the OMX_GetState macro or becomes the parameter in a state change 83 * command when used with the OMX_SendCommand macro. 84 * 85 * The component will be in the Loaded state after the component is initially 86 * loaded into memory. In the Loaded state, the component is not allowed to 87 * allocate or hold resources other than to build it's internal parameter 88 * and configuration tables. The application will send one or more 89 * SetParameters/GetParameters and SetConfig/GetConfig commands to the 90 * component and the component will record each of these parameter and 91 * configuration changes for use later. When the application sends the 92 * Idle command, the component will acquire the resources needed for the 93 * specified configuration and will transition to the idle state if the 94 * allocation is successful. If the component cannot successfully 95 * transition to the idle state for any reason, the state of the component 96 * shall be fully rolled back to the Loaded state (e.g. all allocated 97 * resources shall be released). When the component receives the command 98 * to go to the Executing state, it shall begin processing buffers by 99 * sending all input buffers it holds to the application. While 100 * the component is in the Idle state, the application may also send the 101 * Pause command. If the component receives the pause command while in the 102 * Idle state, the component shall send all input buffers it holds to the 103 * application, but shall not begin processing buffers. This will allow the 104 * application to prefill buffers. 105 * 106 * @ingroup comp 107 */ 108 109 typedef enum OMX_STATETYPE 110 { 111 OMX_StateInvalid, /**< component has detected that it's internal data 112 structures are corrupted to the point that 113 it cannot determine it's state properly */ 114 OMX_StateLoaded, /**< component has been loaded but has not completed 115 initialization. The OMX_SetParameter macro 116 and the OMX_GetParameter macro are the only 117 valid macros allowed to be sent to the 118 component in this state. */ 119 OMX_StateIdle, /**< component initialization has been completed 120 successfully and the component is ready to 121 to start. */ 122 OMX_StateExecuting, /**< component has accepted the start command and 123 is processing data (if data is available) */ 124 OMX_StatePause, /**< component has received pause command */ 125 OMX_StateWaitForResources, /**< component is waiting for resources, either after 126 preemption or before it gets the resources requested. 127 See specification for complete details. */ 128 OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 129 OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 130 OMX_StateMax = 0X7FFFFFFF 131 } OMX_STATETYPE; 132 133 /** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These 134 * errors should cover most of the common failure cases. However, 135 * vendors are free to add additional error messages of their own as 136 * long as they follow these rules: 137 * 1. Vendor error messages shall be in the range of 0x90000000 to 138 * 0x9000FFFF. 139 * 2. Vendor error messages shall be defined in a header file provided 140 * with the component. No error messages are allowed that are 141 * not defined. 142 */ 143 typedef enum OMX_ERRORTYPE 144 { 145 OMX_ErrorNone = 0, 146 147 /** There were insufficient resources to perform the requested operation */ 148 OMX_ErrorInsufficientResources = (OMX_S32) 0x80001000, 149 150 /** There was an error, but the cause of the error could not be determined */ 151 OMX_ErrorUndefined = (OMX_S32) 0x80001001, 152 153 /** The component name string was not valid */ 154 OMX_ErrorInvalidComponentName = (OMX_S32) 0x80001002, 155 156 /** No component with the specified name string was found */ 157 OMX_ErrorComponentNotFound = (OMX_S32) 0x80001003, 158 159 /** The component specified did not have a "OMX_ComponentInit" or 160 "OMX_ComponentDeInit entry point */ 161 OMX_ErrorInvalidComponent = (OMX_S32) 0x80001004, 162 163 /** One or more parameters were not valid */ 164 OMX_ErrorBadParameter = (OMX_S32) 0x80001005, 165 166 /** The requested function is not implemented */ 167 OMX_ErrorNotImplemented = (OMX_S32) 0x80001006, 168 169 /** The buffer was emptied before the next buffer was ready */ 170 OMX_ErrorUnderflow = (OMX_S32) 0x80001007, 171 172 /** The buffer was not available when it was needed */ 173 OMX_ErrorOverflow = (OMX_S32) 0x80001008, 174 175 /** The hardware failed to respond as expected */ 176 OMX_ErrorHardware = (OMX_S32) 0x80001009, 177 178 /** The component is in the state OMX_StateInvalid */ 179 OMX_ErrorInvalidState = (OMX_S32) 0x8000100A, 180 181 /** Stream is found to be corrupt */ 182 OMX_ErrorStreamCorrupt = (OMX_S32) 0x8000100B, 183 184 /** Ports being connected are not compatible */ 185 OMX_ErrorPortsNotCompatible = (OMX_S32) 0x8000100C, 186 187 /** Resources allocated to an idle component have been 188 lost resulting in the component returning to the loaded state */ 189 OMX_ErrorResourcesLost = (OMX_S32) 0x8000100D, 190 191 /** No more indicies can be enumerated */ 192 OMX_ErrorNoMore = (OMX_S32) 0x8000100E, 193 194 /** The component detected a version mismatch */ 195 OMX_ErrorVersionMismatch = (OMX_S32) 0x8000100F, 196 197 /** The component is not ready to return data at this time */ 198 OMX_ErrorNotReady = (OMX_S32) 0x80001010, 199 200 /** There was a timeout that occurred */ 201 OMX_ErrorTimeout = (OMX_S32) 0x80001011, 202 203 /** This error occurs when trying to transition into the state you are already in */ 204 OMX_ErrorSameState = (OMX_S32) 0x80001012, 205 206 /** Resources allocated to an executing or paused component have been 207 preempted, causing the component to return to the idle state */ 208 OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, 209 210 /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 211 during the allocation of buffers (on a transition from the LOADED to the IDLE state or 212 on a port restart) when it deems that it has waited an unusually long time for the supplier 213 to send it an allocated buffer via a UseBuffer call. */ 214 OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014, 215 216 /** A non-supplier port sends this error to the IL client (via the EventHandler callback) 217 during the deallocation of buffers (on a transition from the IDLE to LOADED state or 218 on a port stop) when it deems that it has waited an unusually long time for the supplier 219 to request the deallocation of a buffer header via a FreeBuffer call. */ 220 OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015, 221 222 /** A supplier port sends this error to the IL client (via the EventHandler callback) 223 during the stopping of a port (either on a transition from the IDLE to LOADED 224 state or a port stop) when it deems that it has waited an unusually long time for 225 the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */ 226 OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016, 227 228 /** Attempting a state transtion that is not allowed */ 229 OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017, 230 231 /* Attempting a command that is not allowed during the present state. */ 232 OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, 233 234 /** The values encapsulated in the parameter or config structure are not supported. */ 235 OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019, 236 237 /** The parameter or config indicated by the given index is not supported. */ 238 OMX_ErrorUnsupportedIndex = (OMX_S32) 0x8000101A, 239 240 /** The port index supplied is incorrect. */ 241 OMX_ErrorBadPortIndex = (OMX_S32) 0x8000101B, 242 243 /** The port has lost one or more of its buffers and it thus unpopulated. */ 244 OMX_ErrorPortUnpopulated = (OMX_S32) 0x8000101C, 245 246 /** Component suspended due to temporary loss of resources */ 247 OMX_ErrorComponentSuspended = (OMX_S32) 0x8000101D, 248 249 /** Component suspended due to an inability to acquire dynamic resources */ 250 OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E, 251 252 /** When the macroblock error reporting is enabled the component returns new error 253 for every frame that has errors */ 254 OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F, 255 256 /** A component reports this error when it cannot parse or determine the format of an input stream. */ 257 OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, 258 259 /** The content open operation failed. */ 260 OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021, 261 262 /** The content creation operation failed. */ 263 OMX_ErrorContentPipeCreationFailed = (OMX_S32) 0x80001022, 264 265 /** Separate table information is being used */ 266 OMX_ErrorSeperateTablesUsed = (OMX_S32) 0x80001023, 267 268 /** Tunneling is unsupported by the component*/ 269 OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024, 270 271 OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 272 OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */ 273 OMX_ErrorMax = 0x7FFFFFFF 274 } OMX_ERRORTYPE; 275 276 /** @ingroup core */ 277 typedef OMX_ERRORTYPE (* OMX_COMPONENTINITTYPE)(OMX_IN OMX_HANDLETYPE hComponent); 278 279 /** @ingroup core */ 280 typedef struct OMX_COMPONENTREGISTERTYPE 281 { 282 const char * pName; /* Component name, 128 byte limit (including '\0') applies */ 283 OMX_COMPONENTINITTYPE pInitialize; /* Component instance initialization function */ 284 } OMX_COMPONENTREGISTERTYPE; 285 286 /** @ingroup core */ 287 extern OMX_COMPONENTREGISTERTYPE OMX_ComponentRegistered[]; 288 289 /** @ingroup rpm */ 290 typedef struct OMX_PRIORITYMGMTTYPE { 291 OMX_U32 nSize; /**< size of the structure in bytes */ 292 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 293 OMX_U32 nGroupPriority; /**< Priority of the component group */ 294 OMX_U32 nGroupID; /**< ID of the component group */ 295 } OMX_PRIORITYMGMTTYPE; 296 297 /* Component name and Role names are limited to 128 characters including the terminating '\0'. */ 298 #define OMX_MAX_STRINGNAME_SIZE 128 299 300 /** @ingroup comp */ 301 typedef struct OMX_PARAM_COMPONENTROLETYPE { 302 OMX_U32 nSize; /**< size of the structure in bytes */ 303 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 304 OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */ 305 } OMX_PARAM_COMPONENTROLETYPE; 306 307 /** End of Stream Buffer Flag: 308 * 309 * A component sets EOS when it has no more data to emit on a particular 310 * output port. Thus an output port shall set EOS on the last buffer it 311 * emits. A component's determination of when an output port should 312 * cease sending data is implemenation specific. 313 * @ingroup buf 314 */ 315 316 #define OMX_BUFFERFLAG_EOS 0x00000001 317 318 /** Start Time Buffer Flag: 319 * 320 * The source of a stream (e.g. a demux component) sets the STARTTIME 321 * flag on the buffer that contains the starting timestamp for the 322 * stream. The starting timestamp corresponds to the first data that 323 * should be displayed at startup or after a seek. 324 * The first timestamp of the stream is not necessarily the start time. 325 * For instance, in the case of a seek to a particular video frame, 326 * the target frame may be an interframe. Thus the first buffer of 327 * the stream will be the intra-frame preceding the target frame and 328 * the starttime will occur with the target frame (with any other 329 * required frames required to reconstruct the target intervening). 330 * 331 * The STARTTIME flag is directly associated with the buffer's 332 * timestamp ' thus its association to buffer data and its 333 * propagation is identical to the timestamp's. 334 * 335 * When a Sync Component client receives a buffer with the 336 * STARTTIME flag it shall perform a SetConfig on its sync port 337 * using OMX_ConfigTimeClientStartTime and passing the buffer's 338 * timestamp. 339 * 340 * @ingroup buf 341 */ 342 343 #define OMX_BUFFERFLAG_STARTTIME 0x00000002 344 345 346 347 /** Decode Only Buffer Flag: 348 * 349 * The source of a stream (e.g. a demux component) sets the DECODEONLY 350 * flag on any buffer that should shall be decoded but should not be 351 * displayed. This flag is used, for instance, when a source seeks to 352 * a target interframe that requires the decode of frames preceding the 353 * target to facilitate the target's reconstruction. In this case the 354 * source would emit the frames preceding the target downstream 355 * but mark them as decode only. 356 * 357 * The DECODEONLY is associated with buffer data and propagated in a 358 * manner identical to the buffer timestamp. 359 * 360 * A component that renders data should ignore all buffers with 361 * the DECODEONLY flag set. 362 * 363 * @ingroup buf 364 */ 365 366 #define OMX_BUFFERFLAG_DECODEONLY 0x00000004 367 368 369 /* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt 370 * @ingroup buf 371 */ 372 373 #define OMX_BUFFERFLAG_DATACORRUPT 0x00000008 374 375 /* End of Frame: The buffer contains exactly one end of frame and no data 376 * occurs after the end of frame. This flag is an optional hint. The absence 377 * of this flag does not imply the absence of an end of frame within the buffer. 378 * @ingroup buf 379 */ 380 #define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010 381 382 /* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' 383 * a frame that has no dependency on any other frame information 384 * @ingroup buf 385 */ 386 #define OMX_BUFFERFLAG_SYNCFRAME 0x00000020 387 388 /* Extra data present flag: there is extra data appended to the data stream 389 * residing in the buffer 390 * @ingroup buf 391 */ 392 #define OMX_BUFFERFLAG_EXTRADATA 0x00000040 393 394 /** Codec Config Buffer Flag: 395 * OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an 396 * output port when all bytes in the buffer form part or all of a set of 397 * codec specific configuration data. Examples include SPS/PPS nal units 398 * for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for 399 * OMX_AUDIO_CodingAAC. Any component that for a given stream sets 400 * OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes 401 * with frame data in the same buffer, and shall send all buffers 402 * containing codec configuration bytes before any buffers containing 403 * frame data that those configurations bytes describe. 404 * If the stream format for a particular codec has a frame specific 405 * header at the start of each frame, for example OMX_AUDIO_CodingMP3 or 406 * OMX_AUDIO_CodingAAC in ADTS mode, then these shall be presented as 407 * normal without setting OMX_BUFFERFLAG_CODECCONFIG. 408 * @ingroup buf 409 */ 410 #define OMX_BUFFERFLAG_CODECCONFIG 0x00000080 411 412 413 414 /** @ingroup buf */ 415 typedef struct OMX_BUFFERHEADERTYPE 416 { 417 OMX_U32 nSize; /**< size of the structure in bytes */ 418 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 419 OMX_U8* pBuffer; /**< Pointer to actual block of memory 420 that is acting as the buffer */ 421 OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */ 422 OMX_U32 nFilledLen; /**< number of bytes currently in the 423 buffer */ 424 OMX_U32 nOffset; /**< start offset of valid data in bytes from 425 the start of the buffer */ 426 OMX_PTR pAppPrivate; /**< pointer to any data the application 427 wants to associate with this buffer */ 428 OMX_PTR pPlatformPrivate; /**< pointer to any data the platform 429 wants to associate with this buffer */ 430 OMX_PTR pInputPortPrivate; /**< pointer to any data the input port 431 wants to associate with this buffer */ 432 OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port 433 wants to associate with this buffer */ 434 OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a 435 mark event upon processing this buffer. */ 436 OMX_PTR pMarkData; /**< Application specific data associated with 437 the mark sent on a mark event to disambiguate 438 this mark from others. */ 439 OMX_U32 nTickCount; /**< Optional entry that the component and 440 application can update with a tick count 441 when they access the component. This 442 value should be in microseconds. Since 443 this is a value relative to an arbitrary 444 starting point, this value cannot be used 445 to determine absolute time. This is an 446 optional entry and not all components 447 will update it.*/ 448 OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample 449 starting at the first logical sample 450 boundary in the buffer. Timestamps of 451 successive samples within the buffer may 452 be inferred by adding the duration of the 453 of the preceding buffer to the timestamp 454 of the preceding buffer.*/ 455 OMX_U32 nFlags; /**< buffer specific flags */ 456 OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using 457 this buffer */ 458 OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using 459 this buffer */ 460 } OMX_BUFFERHEADERTYPE; 461 462 /** The OMX_EXTRADATATYPE enumeration is used to define the 463 * possible extra data payload types. 464 * NB: this enum is binary backwards compatible with the previous 465 * OMX_EXTRADATA_QUANT define. This should be replaced with 466 * OMX_ExtraDataQuantization. 467 */ 468 typedef enum OMX_EXTRADATATYPE 469 { 470 OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */ 471 OMX_ExtraDataQuantization, /**< The data payload contains quantization data */ 472 OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 473 OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 474 OMX_ExtraDataMax = 0x7FFFFFFF 475 } OMX_EXTRADATATYPE; 476 477 478 typedef struct OMX_OTHER_EXTRADATATYPE { 479 OMX_U32 nSize; 480 OMX_VERSIONTYPE nVersion; 481 OMX_U32 nPortIndex; 482 OMX_EXTRADATATYPE eType; /* Extra Data type */ 483 OMX_U32 nDataSize; /* Size of the supporting data to follow */ 484 OMX_U8 data[1]; /* Supporting data hint */ 485 } OMX_OTHER_EXTRADATATYPE; 486 487 /** @ingroup comp */ 488 typedef struct OMX_PORT_PARAM_TYPE { 489 OMX_U32 nSize; /**< size of the structure in bytes */ 490 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 491 OMX_U32 nPorts; /**< The number of ports for this component */ 492 OMX_U32 nStartPortNumber; /** first port number for this type of port */ 493 } OMX_PORT_PARAM_TYPE; 494 495 /** @ingroup comp */ 496 typedef enum OMX_EVENTTYPE 497 { 498 OMX_EventCmdComplete, /**< component has sucessfully completed a command */ 499 OMX_EventError, /**< component has detected an error condition */ 500 OMX_EventMark, /**< component has detected a buffer mark */ 501 OMX_EventPortSettingsChanged, /**< component is reported a port settings change */ 502 OMX_EventBufferFlag, /**< component has detected an EOS */ 503 OMX_EventResourcesAcquired, /**< component has been granted resources and is 504 automatically starting the state change from 505 OMX_StateWaitForResources to OMX_StateIdle. */ 506 OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */ 507 OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */ 508 OMX_EventPortFormatDetected, /**< Component has detected a supported format. */ 509 OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 510 OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 511 OMX_EventMax = 0x7FFFFFFF 512 } OMX_EVENTTYPE; 513 514 typedef struct OMX_CALLBACKTYPE 515 { 516 /** The EventHandler method is used to notify the application when an 517 event of interest occurs. Events are defined in the OMX_EVENTTYPE 518 enumeration. Please see that enumeration for details of what will 519 be returned for each type of event. Callbacks should not return 520 an error to the component, so if an error occurs, the application 521 shall handle it internally. This is a blocking call. 522 523 The application should return from this call within 5 msec to avoid 524 blocking the component for an excessively long period of time. 525 526 @param hComponent 527 handle of the component to access. This is the component 528 handle returned by the call to the GetHandle function. 529 @param pAppData 530 pointer to an application defined value that was provided in the 531 pAppData parameter to the OMX_GetHandle method for the component. 532 This application defined value is provided so that the application 533 can have a component specific context when receiving the callback. 534 @param eEvent 535 Event that the component wants to notify the application about. 536 @param nData1 537 nData will be the OMX_ERRORTYPE for an error event and will be 538 an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event. 539 @param nData2 540 nData2 will hold further information related to the event. Can be OMX_STATETYPE for 541 a OMX_CommandStateSet command or port index for a OMX_PortSettingsChanged event. 542 Default value is 0 if not used. ) 543 @param pEventData 544 Pointer to additional event-specific data (see spec for meaning). 545 */ 546 547 OMX_ERRORTYPE (*EventHandler)( 548 OMX_IN OMX_HANDLETYPE hComponent, 549 OMX_IN OMX_PTR pAppData, 550 OMX_IN OMX_EVENTTYPE eEvent, 551 OMX_IN OMX_U32 nData1, 552 OMX_IN OMX_U32 nData2, 553 OMX_IN OMX_PTR pEventData); 554 555 /** The EmptyBufferDone method is used to return emptied buffers from an 556 input port back to the application for reuse. This is a blocking call 557 so the application should not attempt to refill the buffers during this 558 call, but should queue them and refill them in another thread. There 559 is no error return, so the application shall handle any errors generated 560 internally. 561 562 The application should return from this call within 5 msec. 563 564 @param hComponent 565 handle of the component to access. This is the component 566 handle returned by the call to the GetHandle function. 567 @param pAppData 568 pointer to an application defined value that was provided in the 569 pAppData parameter to the OMX_GetHandle method for the component. 570 This application defined value is provided so that the application 571 can have a component specific context when receiving the callback. 572 @param pBuffer 573 pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer 574 or AllocateBuffer indicating the buffer that was emptied. 575 @ingroup buf 576 */ 577 OMX_ERRORTYPE (*EmptyBufferDone)( 578 OMX_IN OMX_HANDLETYPE hComponent, 579 OMX_IN OMX_PTR pAppData, 580 OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); 581 582 /** The FillBufferDone method is used to return filled buffers from an 583 output port back to the application for emptying and then reuse. 584 This is a blocking call so the application should not attempt to 585 empty the buffers during this call, but should queue the buffers 586 and empty them in another thread. There is no error return, so 587 the application shall handle any errors generated internally. The 588 application shall also update the buffer header to indicate the 589 number of bytes placed into the buffer. 590 591 The application should return from this call within 5 msec. 592 593 @param hComponent 594 handle of the component to access. This is the component 595 handle returned by the call to the GetHandle function. 596 @param pAppData 597 pointer to an application defined value that was provided in the 598 pAppData parameter to the OMX_GetHandle method for the component. 599 This application defined value is provided so that the application 600 can have a component specific context when receiving the callback. 601 @param pBuffer 602 pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer 603 or AllocateBuffer indicating the buffer that was filled. 604 @ingroup buf 605 */ 606 OMX_ERRORTYPE (*FillBufferDone)( 607 OMX_OUT OMX_HANDLETYPE hComponent, 608 OMX_OUT OMX_PTR pAppData, 609 OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); 610 611 } OMX_CALLBACKTYPE; 612 613 /** The OMX_BUFFERSUPPLIERTYPE enumeration is used to dictate port supplier 614 preference when tunneling between two ports. 615 @ingroup tun buf 616 */ 617 typedef enum OMX_BUFFERSUPPLIERTYPE 618 { 619 OMX_BufferSupplyUnspecified = 0x0, /**< port supplying the buffers is unspecified, 620 or don't care */ 621 OMX_BufferSupplyInput, /**< input port supplies the buffers */ 622 OMX_BufferSupplyOutput, /**< output port supplies the buffers */ 623 OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ 624 OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ 625 OMX_BufferSupplyMax = 0x7FFFFFFF 626 } OMX_BUFFERSUPPLIERTYPE; 627 628 629 /** buffer supplier parameter 630 * @ingroup tun 631 */ 632 typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE { 633 OMX_U32 nSize; /**< size of the structure in bytes */ 634 OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ 635 OMX_U32 nPortIndex; /**< port that this structure applies to */ 636 OMX_BUFFERSUPPLIERTYPE eBufferSupplier; /**< buffer supplier */ 637 } OMX_PARAM_BUFFERSUPPLIERTYPE; 638 639 640 /**< indicates that buffers received by an input port of a tunnel 641 may not modify the data in the buffers 642 @ingroup tun 643 */ 644 #define OMX_PORTTUNNELFLAG_READONLY 0x00000001 645 646 647 /** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output 648 port to an input port as part the two ComponentTunnelRequest calls 649 resulting from a OMX_SetupTunnel call from the IL Client. 650 @ingroup tun 651 */ 652 typedef struct OMX_TUNNELSETUPTYPE 653 { 654 OMX_U32 nTunnelFlags; /**< bit flags for tunneling */ 655 OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */ 656 } OMX_TUNNELSETUPTYPE; 657 658 /* OMX Component headers is included to enable the core to use 659 macros for functions into the component for OMX release 1.0. 660 Developers should not access any structures or data from within 661 the component header directly */ 662 /* TO BE REMOVED - #include <OMX_Component.h> */ 663 664 /** GetComponentVersion will return information about the component. 665 This is a blocking call. This macro will go directly from the 666 application to the component (via a core macro). The 667 component will return from this call within 5 msec. 668 @param [in] hComponent 669 handle of component to execute the command 670 @param [out] pComponentName 671 pointer to an empty string of length 128 bytes. The component 672 will write its name into this string. The name will be 673 terminated by a single zero byte. The name of a component will 674 be 127 bytes or less to leave room for the trailing zero byte. 675 An example of a valid component name is "OMX.ABC.ChannelMixer\0". 676 @param [out] pComponentVersion 677 pointer to an OMX Version structure that the component will fill 678 in. The component will fill in a value that indicates the 679 component version. NOTE: the component version is NOT the same 680 as the OMX Specification version (found in all structures). The 681 component version is defined by the vendor of the component and 682 its value is entirely up to the component vendor. 683 @param [out] pSpecVersion 684 pointer to an OMX Version structure that the component will fill 685 in. The SpecVersion is the version of the specification that the 686 component was built against. Please note that this value may or 687 may not match the structure's version. For example, if the 688 component was built against the 2.0 specification, but the 689 application (which creates the structure is built against the 690 1.0 specification the versions would be different. 691 @param [out] pComponentUUID 692 pointer to the UUID of the component which will be filled in by 693 the component. The UUID is a unique identifier that is set at 694 RUN time for the component and is unique to each instantion of 695 the component. 696 @return OMX_ERRORTYPE 697 If the command successfully executes, the return code will be 698 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 699 @ingroup comp 700 */ 701 #define OMX_GetComponentVersion( \ 702 hComponent, \ 703 pComponentName, \ 704 pComponentVersion, \ 705 pSpecVersion, \ 706 pComponentUUID) \ 707 ((OMX_COMPONENTTYPE*)hComponent)->GetComponentVersion( \ 708 hComponent, \ 709 pComponentName, \ 710 pComponentVersion, \ 711 pSpecVersion, \ 712 pComponentUUID) /* Macro End */ 713 714 715 /** Send a command to the component. This call is a non-blocking call. 716 The component should check the parameters and then queue the command 717 to the component thread to be executed. The component thread shall 718 send the EventHandler() callback at the conclusion of the command. 719 This macro will go directly from the application to the component (via 720 a core macro). The component will return from this call within 5 msec. 721 722 When the command is "OMX_CommandStateSet" the component will queue a 723 state transition to the new state idenfied in nParam. 724 725 When the command is "OMX_CommandFlush", to flush a port's buffer queues, 726 the command will force the component to return all buffers NOT CURRENTLY 727 BEING PROCESSED to the application, in the order in which the buffers 728 were received. 729 730 When the command is "OMX_CommandPortDisable" or 731 "OMX_CommandPortEnable", the component's port (given by the value of 732 nParam) will be stopped or restarted. 733 734 When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the 735 pCmdData will point to a OMX_MARKTYPE structure containing the component 736 handle of the component to examine the buffer chain for the mark. nParam1 737 contains the index of the port on which the buffer mark is applied. 738 739 Specification text for more details. 740 741 @param [in] hComponent 742 handle of component to execute the command 743 @param [in] Cmd 744 Command for the component to execute 745 @param [in] nParam 746 Parameter for the command to be executed. When Cmd has the value 747 OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has 748 the value OMX_CommandFlush, value of nParam indicates which port(s) 749 to flush. -1 is used to flush all ports a single port index will 750 only flush that port. When Cmd has the value "OMX_CommandPortDisable" 751 or "OMX_CommandPortEnable", the component's port is given by 752 the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer" 753 the components pot is given by the value of nParam. 754 @param [in] pCmdData 755 Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value 756 "OMX_CommandMarkBuffer". 757 @return OMX_ERRORTYPE 758 If the command successfully executes, the return code will be 759 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 760 @ingroup comp 761 */ 762 #define OMX_SendCommand( \ 763 hComponent, \ 764 Cmd, \ 765 nParam, \ 766 pCmdData) \ 767 ((OMX_COMPONENTTYPE*)hComponent)->SendCommand( \ 768 hComponent, \ 769 Cmd, \ 770 nParam, \ 771 pCmdData) /* Macro End */ 772 773 774 /** The OMX_GetParameter macro will get one of the current parameter 775 settings from the component. This macro cannot only be invoked when 776 the component is in the OMX_StateInvalid state. The nParamIndex 777 parameter is used to indicate which structure is being requested from 778 the component. The application shall allocate the correct structure 779 and shall fill in the structure size and version information before 780 invoking this macro. When the parameter applies to a port, the 781 caller shall fill in the appropriate nPortIndex value indicating the 782 port on which the parameter applies. If the component has not had 783 any settings changed, then the component should return a set of 784 valid DEFAULT parameters for the component. This is a blocking 785 call. 786 787 The component should return from this call within 20 msec. 788 789 @param [in] hComponent 790 Handle of the component to be accessed. This is the component 791 handle returned by the call to the OMX_GetHandle function. 792 @param [in] nParamIndex 793 Index of the structure to be filled. This value is from the 794 OMX_INDEXTYPE enumeration. 795 @param [in,out] pComponentParameterStructure 796 Pointer to application allocated structure to be filled by the 797 component. 798 @return OMX_ERRORTYPE 799 If the command successfully executes, the return code will be 800 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 801 @ingroup comp 802 */ 803 #define OMX_GetParameter( \ 804 hComponent, \ 805 nParamIndex, \ 806 pComponentParameterStructure) \ 807 ((OMX_COMPONENTTYPE*)hComponent)->GetParameter( \ 808 hComponent, \ 809 nParamIndex, \ 810 pComponentParameterStructure) /* Macro End */ 811 812 813 /** The OMX_SetParameter macro will send an initialization parameter 814 structure to a component. Each structure shall be sent one at a time, 815 in a separate invocation of the macro. This macro can only be 816 invoked when the component is in the OMX_StateLoaded state, or the 817 port is disabled (when the parameter applies to a port). The 818 nParamIndex parameter is used to indicate which structure is being 819 passed to the component. The application shall allocate the 820 correct structure and shall fill in the structure size and version 821 information (as well as the actual data) before invoking this macro. 822 The application is free to dispose of this structure after the call 823 as the component is required to copy any data it shall retain. This 824 is a blocking call. 825 826 The component should return from this call within 20 msec. 827 828 @param [in] hComponent 829 Handle of the component to be accessed. This is the component 830 handle returned by the call to the OMX_GetHandle function. 831 @param [in] nIndex 832 Index of the structure to be sent. This value is from the 833 OMX_INDEXTYPE enumeration. 834 @param [in] pComponentParameterStructure 835 pointer to application allocated structure to be used for 836 initialization by the component. 837 @return OMX_ERRORTYPE 838 If the command successfully executes, the return code will be 839 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 840 @ingroup comp 841 */ 842 #define OMX_SetParameter( \ 843 hComponent, \ 844 nParamIndex, \ 845 pComponentParameterStructure) \ 846 ((OMX_COMPONENTTYPE*)hComponent)->SetParameter( \ 847 hComponent, \ 848 nParamIndex, \ 849 pComponentParameterStructure) /* Macro End */ 850 851 852 /** The OMX_GetConfig macro will get one of the configuration structures 853 from a component. This macro can be invoked anytime after the 854 component has been loaded. The nParamIndex call parameter is used to 855 indicate which structure is being requested from the component. The 856 application shall allocate the correct structure and shall fill in the 857 structure size and version information before invoking this macro. 858 If the component has not had this configuration parameter sent before, 859 then the component should return a set of valid DEFAULT values for the 860 component. This is a blocking call. 861 862 The component should return from this call within 5 msec. 863 864 @param [in] hComponent 865 Handle of the component to be accessed. This is the component 866 handle returned by the call to the OMX_GetHandle function. 867 @param [in] nIndex 868 Index of the structure to be filled. This value is from the 869 OMX_INDEXTYPE enumeration. 870 @param [in,out] pComponentConfigStructure 871 pointer to application allocated structure to be filled by the 872 component. 873 @return OMX_ERRORTYPE 874 If the command successfully executes, the return code will be 875 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 876 @ingroup comp 877 */ 878 #define OMX_GetConfig( \ 879 hComponent, \ 880 nConfigIndex, \ 881 pComponentConfigStructure) \ 882 ((OMX_COMPONENTTYPE*)hComponent)->GetConfig( \ 883 hComponent, \ 884 nConfigIndex, \ 885 pComponentConfigStructure) /* Macro End */ 886 887 888 /** The OMX_SetConfig macro will send one of the configuration 889 structures to a component. Each structure shall be sent one at a time, 890 each in a separate invocation of the macro. This macro can be invoked 891 anytime after the component has been loaded. The application shall 892 allocate the correct structure and shall fill in the structure size 893 and version information (as well as the actual data) before invoking 894 this macro. The application is free to dispose of this structure after 895 the call as the component is required to copy any data it shall retain. 896 This is a blocking call. 897 898 The component should return from this call within 5 msec. 899 900 @param [in] hComponent 901 Handle of the component to be accessed. This is the component 902 handle returned by the call to the OMX_GetHandle function. 903 @param [in] nConfigIndex 904 Index of the structure to be sent. This value is from the 905 OMX_INDEXTYPE enumeration above. 906 @param [in] pComponentConfigStructure 907 pointer to application allocated structure to be used for 908 initialization by the component. 909 @return OMX_ERRORTYPE 910 If the command successfully executes, the return code will be 911 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 912 @ingroup comp 913 */ 914 #define OMX_SetConfig( \ 915 hComponent, \ 916 nConfigIndex, \ 917 pComponentConfigStructure) \ 918 ((OMX_COMPONENTTYPE*)hComponent)->SetConfig( \ 919 hComponent, \ 920 nConfigIndex, \ 921 pComponentConfigStructure) /* Macro End */ 922 923 924 /** The OMX_GetExtensionIndex macro will invoke a component to translate 925 a vendor specific configuration or parameter string into an OMX 926 structure index. There is no requirement for the vendor to support 927 this command for the indexes already found in the OMX_INDEXTYPE 928 enumeration (this is done to save space in small components). The 929 component shall support all vendor supplied extension indexes not found 930 in the master OMX_INDEXTYPE enumeration. This is a blocking call. 931 932 The component should return from this call within 5 msec. 933 934 @param [in] hComponent 935 Handle of the component to be accessed. This is the component 936 handle returned by the call to the GetHandle function. 937 @param [in] cParameterName 938 OMX_STRING that shall be less than 128 characters long including 939 the trailing null byte. This is the string that will get 940 translated by the component into a configuration index. 941 @param [out] pIndexType 942 a pointer to a OMX_INDEXTYPE to receive the index value. 943 @return OMX_ERRORTYPE 944 If the command successfully executes, the return code will be 945 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 946 @ingroup comp 947 */ 948 #define OMX_GetExtensionIndex( \ 949 hComponent, \ 950 cParameterName, \ 951 pIndexType) \ 952 ((OMX_COMPONENTTYPE*)hComponent)->GetExtensionIndex( \ 953 hComponent, \ 954 cParameterName, \ 955 pIndexType) /* Macro End */ 956 957 958 /** The OMX_GetState macro will invoke the component to get the current 959 state of the component and place the state value into the location 960 pointed to by pState. 961 962 The component should return from this call within 5 msec. 963 964 @param [in] hComponent 965 Handle of the component to be accessed. This is the component 966 handle returned by the call to the OMX_GetHandle function. 967 @param [out] pState 968 pointer to the location to receive the state. The value returned 969 is one of the OMX_STATETYPE members 970 @return OMX_ERRORTYPE 971 If the command successfully executes, the return code will be 972 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 973 @ingroup comp 974 */ 975 #define OMX_GetState( \ 976 hComponent, \ 977 pState) \ 978 ((OMX_COMPONENTTYPE*)hComponent)->GetState( \ 979 hComponent, \ 980 pState) /* Macro End */ 981 982 983 /** The OMX_UseBuffer macro will request that the component use 984 a buffer (and allocate its own buffer header) already allocated 985 by another component, or by the IL Client. This is a blocking 986 call. 987 988 The component should return from this call within 20 msec. 989 990 @param [in] hComponent 991 Handle of the component to be accessed. This is the component 992 handle returned by the call to the OMX_GetHandle function. 993 @param [out] ppBuffer 994 pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 995 pointer to the buffer header 996 @return OMX_ERRORTYPE 997 If the command successfully executes, the return code will be 998 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 999 @ingroup comp buf 1000 */ 1001 1002 #define OMX_UseBuffer( \ 1003 hComponent, \ 1004 ppBufferHdr, \ 1005 nPortIndex, \ 1006 pAppPrivate, \ 1007 nSizeBytes, \ 1008 pBuffer) \ 1009 ((OMX_COMPONENTTYPE*)hComponent)->UseBuffer( \ 1010 hComponent, \ 1011 ppBufferHdr, \ 1012 nPortIndex, \ 1013 pAppPrivate, \ 1014 nSizeBytes, \ 1015 pBuffer) 1016 1017 1018 /** The OMX_AllocateBuffer macro will request that the component allocate 1019 a new buffer and buffer header. The component will allocate the 1020 buffer and the buffer header and return a pointer to the buffer 1021 header. This is a blocking call. 1022 1023 The component should return from this call within 5 msec. 1024 1025 @param [in] hComponent 1026 Handle of the component to be accessed. This is the component 1027 handle returned by the call to the OMX_GetHandle function. 1028 @param [out] ppBuffer 1029 pointer to an OMX_BUFFERHEADERTYPE structure used to receive 1030 the pointer to the buffer header 1031 @param [in] nPortIndex 1032 nPortIndex is used to select the port on the component the buffer will 1033 be used with. The port can be found by using the nPortIndex 1034 value as an index into the Port Definition array of the component. 1035 @param [in] pAppPrivate 1036 pAppPrivate is used to initialize the pAppPrivate member of the 1037 buffer header structure. 1038 @param [in] nSizeBytes 1039 size of the buffer to allocate. Used when bAllocateNew is true. 1040 @return OMX_ERRORTYPE 1041 If the command successfully executes, the return code will be 1042 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1043 @ingroup comp buf 1044 */ 1045 #define OMX_AllocateBuffer( \ 1046 hComponent, \ 1047 ppBuffer, \ 1048 nPortIndex, \ 1049 pAppPrivate, \ 1050 nSizeBytes) \ 1051 ((OMX_COMPONENTTYPE*)hComponent)->AllocateBuffer( \ 1052 hComponent, \ 1053 ppBuffer, \ 1054 nPortIndex, \ 1055 pAppPrivate, \ 1056 nSizeBytes) /* Macro End */ 1057 1058 1059 /** The OMX_FreeBuffer macro will release a buffer header from the component 1060 which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If 1061 the component allocated the buffer (see the OMX_UseBuffer macro) then 1062 the component shall free the buffer and buffer header. This is a 1063 blocking call. 1064 1065 The component should return from this call within 20 msec. 1066 1067 @param [in] hComponent 1068 Handle of the component to be accessed. This is the component 1069 handle returned by the call to the OMX_GetHandle function. 1070 @param [in] nPortIndex 1071 nPortIndex is used to select the port on the component the buffer will 1072 be used with. 1073 @param [in] pBuffer 1074 pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer 1075 or AllocateBuffer. 1076 @return OMX_ERRORTYPE 1077 If the command successfully executes, the return code will be 1078 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1079 @ingroup comp buf 1080 */ 1081 #define OMX_FreeBuffer( \ 1082 hComponent, \ 1083 nPortIndex, \ 1084 pBuffer) \ 1085 ((OMX_COMPONENTTYPE*)hComponent)->FreeBuffer( \ 1086 hComponent, \ 1087 nPortIndex, \ 1088 pBuffer) /* Macro End */ 1089 1090 1091 /** The OMX_EmptyThisBuffer macro will send a buffer full of data to an 1092 input port of a component. The buffer will be emptied by the component 1093 and returned to the application via the EmptyBufferDone call back. 1094 This is a non-blocking call in that the component will record the buffer 1095 and return immediately and then empty the buffer, later, at the proper 1096 time. As expected, this macro may be invoked only while the component 1097 is in the OMX_StateExecuting. If nPortIndex does not specify an input 1098 port, the component shall return an error. 1099 1100 The component should return from this call within 5 msec. 1101 1102 @param [in] hComponent 1103 Handle of the component to be accessed. This is the component 1104 handle returned by the call to the OMX_GetHandle function. 1105 @param [in] pBuffer 1106 pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer 1107 or AllocateBuffer. 1108 @return OMX_ERRORTYPE 1109 If the command successfully executes, the return code will be 1110 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1111 @ingroup comp buf 1112 */ 1113 #define OMX_EmptyThisBuffer( \ 1114 hComponent, \ 1115 pBuffer) \ 1116 ((OMX_COMPONENTTYPE*)hComponent)->EmptyThisBuffer( \ 1117 hComponent, \ 1118 pBuffer) /* Macro End */ 1119 1120 1121 /** The OMX_FillThisBuffer macro will send an empty buffer to an 1122 output port of a component. The buffer will be filled by the component 1123 and returned to the application via the FillBufferDone call back. 1124 This is a non-blocking call in that the component will record the buffer 1125 and return immediately and then fill the buffer, later, at the proper 1126 time. As expected, this macro may be invoked only while the component 1127 is in the OMX_ExecutingState. If nPortIndex does not specify an output 1128 port, the component shall return an error. 1129 1130 The component should return from this call within 5 msec. 1131 1132 @param [in] hComponent 1133 Handle of the component to be accessed. This is the component 1134 handle returned by the call to the OMX_GetHandle function. 1135 @param [in] pBuffer 1136 pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer 1137 or AllocateBuffer. 1138 @return OMX_ERRORTYPE 1139 If the command successfully executes, the return code will be 1140 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1141 @ingroup comp buf 1142 */ 1143 #define OMX_FillThisBuffer( \ 1144 hComponent, \ 1145 pBuffer) \ 1146 ((OMX_COMPONENTTYPE*)hComponent)->FillThisBuffer( \ 1147 hComponent, \ 1148 pBuffer) /* Macro End */ 1149 1150 1151 1152 /** The OMX_UseEGLImage macro will request that the component use 1153 a EGLImage provided by EGL (and allocate its own buffer header) 1154 This is a blocking call. 1155 1156 The component should return from this call within 20 msec. 1157 1158 @param [in] hComponent 1159 Handle of the component to be accessed. This is the component 1160 handle returned by the call to the OMX_GetHandle function. 1161 @param [out] ppBuffer 1162 pointer to an OMX_BUFFERHEADERTYPE structure used to receive the 1163 pointer to the buffer header. Note that the memory location used 1164 for this buffer is NOT visible to the IL Client. 1165 @param [in] nPortIndex 1166 nPortIndex is used to select the port on the component the buffer will 1167 be used with. The port can be found by using the nPortIndex 1168 value as an index into the Port Definition array of the component. 1169 @param [in] pAppPrivate 1170 pAppPrivate is used to initialize the pAppPrivate member of the 1171 buffer header structure. 1172 @param [in] eglImage 1173 eglImage contains the handle of the EGLImage to use as a buffer on the 1174 specified port. The component is expected to validate properties of 1175 the EGLImage against the configuration of the port to ensure the component 1176 can use the EGLImage as a buffer. 1177 @return OMX_ERRORTYPE 1178 If the command successfully executes, the return code will be 1179 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1180 @ingroup comp buf 1181 */ 1182 #define OMX_UseEGLImage( \ 1183 hComponent, \ 1184 ppBufferHdr, \ 1185 nPortIndex, \ 1186 pAppPrivate, \ 1187 eglImage) \ 1188 ((OMX_COMPONENTTYPE*)hComponent)->UseEGLImage( \ 1189 hComponent, \ 1190 ppBufferHdr, \ 1191 nPortIndex, \ 1192 pAppPrivate, \ 1193 eglImage) 1194 1195 /** The OMX_Init method is used to initialize the OMX core. It shall be the 1196 first call made into OMX and it should only be executed one time without 1197 an interviening OMX_Deinit call. 1198 1199 The core should return from this call within 20 msec. 1200 1201 @return OMX_ERRORTYPE 1202 If the command successfully executes, the return code will be 1203 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1204 @ingroup core 1205 */ 1206 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void); 1207 1208 1209 /** The OMX_Deinit method is used to deinitialize the OMX core. It shall be 1210 the last call made into OMX. In the event that the core determines that 1211 thare are components loaded when this call is made, the core may return 1212 with an error rather than try to unload the components. 1213 1214 The core should return from this call within 20 msec. 1215 1216 @return OMX_ERRORTYPE 1217 If the command successfully executes, the return code will be 1218 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1219 @ingroup core 1220 */ 1221 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Deinit(void); 1222 1223 1224 /** The OMX_ComponentNameEnum method will enumerate through all the names of 1225 recognised valid components in the system. This function is provided 1226 as a means to detect all the components in the system run-time. There is 1227 no strict ordering to the enumeration order of component names, although 1228 each name will only be enumerated once. If the OMX core supports run-time 1229 installation of new components, it is only requried to detect newly 1230 installed components when the first call to enumerate component names 1231 is made (i.e. when nIndex is 0x0). 1232 1233 The core should return from this call in 20 msec. 1234 1235 @param [out] cComponentName 1236 pointer to a null terminated string with the component name. The 1237 names of the components are strings less than 127 bytes in length 1238 plus the trailing null for a maximum size of 128 bytes. An example 1239 of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are 1240 assigned by the vendor, but shall start with "OMX." and then have 1241 the Vendor designation next. 1242 @param [in] nNameLength 1243 number of characters in the cComponentName string. With all 1244 component name strings restricted to less than 128 characters 1245 (including the trailing null) it is recomended that the caller 1246 provide a input string for the cComponentName of 128 characters. 1247 @param [in] nIndex 1248 number containing the enumeration index for the component. 1249 Multiple calls to OMX_ComponentNameEnum with increasing values 1250 of nIndex will enumerate through the component names in the 1251 system until OMX_ErrorNoMore is returned. The value of nIndex 1252 is 0 to (N-1), where N is the number of valid installed components 1253 in the system. 1254 @return OMX_ERRORTYPE 1255 If the command successfully executes, the return code will be 1256 OMX_ErrorNone. When the value of nIndex exceeds the number of 1257 components in the system minus 1, OMX_ErrorNoMore will be 1258 returned. Otherwise the appropriate OMX error will be returned. 1259 @ingroup core 1260 */ 1261 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_ComponentNameEnum( 1262 OMX_OUT OMX_STRING cComponentName, 1263 OMX_IN OMX_U32 nNameLength, 1264 OMX_IN OMX_U32 nIndex); 1265 1266 1267 /** The OMX_GetHandle method will locate the component specified by the 1268 component name given, load that component into memory and then invoke 1269 the component's methods to create an instance of the component. 1270 1271 The core should return from this call within 20 msec. 1272 1273 @param [out] pHandle 1274 pointer to an OMX_HANDLETYPE pointer to be filled in by this method. 1275 @param [in] cComponentName 1276 pointer to a null terminated string with the component name. The 1277 names of the components are strings less than 127 bytes in length 1278 plus the trailing null for a maximum size of 128 bytes. An example 1279 of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are 1280 assigned by the vendor, but shall start with "OMX." and then have 1281 the Vendor designation next. 1282 @param [in] pAppData 1283 pointer to an application defined value that will be returned 1284 during callbacks so that the application can identify the source 1285 of the callback. 1286 @param [in] pCallBacks 1287 pointer to a OMX_CALLBACKTYPE structure that will be passed to the 1288 component to initialize it with. 1289 @return OMX_ERRORTYPE 1290 If the command successfully executes, the return code will be 1291 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1292 @ingroup core 1293 */ 1294 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( 1295 OMX_OUT OMX_HANDLETYPE* pHandle, 1296 OMX_IN OMX_STRING cComponentName, 1297 OMX_IN OMX_PTR pAppData, 1298 OMX_IN OMX_CALLBACKTYPE* pCallBacks); 1299 1300 1301 /** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle 1302 method. If the component reference count goes to zero, the component will 1303 be unloaded from memory. 1304 1305 The core should return from this call within 20 msec when the component is 1306 in the OMX_StateLoaded state. 1307 1308 @param [in] hComponent 1309 Handle of the component to be accessed. This is the component 1310 handle returned by the call to the GetHandle function. 1311 @return OMX_ERRORTYPE 1312 If the command successfully executes, the return code will be 1313 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1314 @ingroup core 1315 */ 1316 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle( 1317 OMX_IN OMX_HANDLETYPE hComponent); 1318 1319 1320 1321 /** The OMX_SetupTunnel method will handle the necessary calls to the components 1322 to setup the specified tunnel the two components. NOTE: This is 1323 an actual method (not a #define macro). This method will make calls into 1324 the component ComponentTunnelRequest method to do the actual tunnel 1325 connection. 1326 1327 The ComponentTunnelRequest method on both components will be called. 1328 This method shall not be called unless the component is in the 1329 OMX_StateLoaded state except when the ports used for the tunnel are 1330 disabled. In this case, the component may be in the OMX_StateExecuting, 1331 OMX_StatePause, or OMX_StateIdle states. 1332 1333 The core should return from this call within 20 msec. 1334 1335 @param [in] hOutput 1336 Handle of the component to be accessed. Also this is the handle 1337 of the component whose port, specified in the nPortOutput parameter 1338 will be used the source for the tunnel. This is the component handle 1339 returned by the call to the OMX_GetHandle function. There is a 1340 requirement that hOutput be the source for the data when 1341 tunelling (i.e. nPortOutput is an output port). If 0x0, the component 1342 specified in hInput will have it's port specified in nPortInput 1343 setup for communication with the application / IL client. 1344 @param [in] nPortOutput 1345 nPortOutput is used to select the source port on component to be 1346 used in the tunnel. 1347 @param [in] hInput 1348 This is the component to setup the tunnel with. This is the handle 1349 of the component whose port, specified in the nPortInput parameter 1350 will be used the destination for the tunnel. This is the component handle 1351 returned by the call to the OMX_GetHandle function. There is a 1352 requirement that hInput be the destination for the data when 1353 tunelling (i.e. nPortInut is an input port). If 0x0, the component 1354 specified in hOutput will have it's port specified in nPortPOutput 1355 setup for communication with the application / IL client. 1356 @param [in] nPortInput 1357 nPortInput is used to select the destination port on component to be 1358 used in the tunnel. 1359 @return OMX_ERRORTYPE 1360 If the command successfully executes, the return code will be 1361 OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. 1362 When OMX_ErrorNotImplemented is returned, one or both components is 1363 a non-interop component and does not support tunneling. 1364 1365 On failure, the ports of both components are setup for communication 1366 with the application / IL Client. 1367 @ingroup core tun 1368 */ 1369 OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_SetupTunnel( 1370 OMX_IN OMX_HANDLETYPE hOutput, 1371 OMX_IN OMX_U32 nPortOutput, 1372 OMX_IN OMX_HANDLETYPE hInput, 1373 OMX_IN OMX_U32 nPortInput); 1374 1375 /** @ingroup cp */ 1376 OMX_API OMX_ERRORTYPE OMX_GetContentPipe( 1377 OMX_OUT OMX_HANDLETYPE *hPipe, 1378 OMX_IN OMX_STRING szURI); 1379 1380 /** The OMX_GetComponentsOfRole method will return the number of components that support the given 1381 role and (if the compNames field is non-NULL) the names of those components. The call will fail if 1382 an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the 1383 client should: 1384 * first call this function with the compNames field NULL to determine the number of component names 1385 * second call this function with the compNames field pointing to an array of names allocated 1386 according to the number returned by the first call. 1387 1388 The core should return from this call within 5 msec. 1389 1390 @param [in] role 1391 This is generic standard component name consisting only of component class 1392 name and the type within that class (e.g. 'audio_decoder.aac'). 1393 @param [inout] pNumComps 1394 This is used both as input and output. 1395 1396 If compNames is NULL, the input is ignored and the output specifies how many components support 1397 the given role. 1398 1399 If compNames is not NULL, on input it bounds the size of the input structure and 1400 on output, it specifies the number of components string names listed within the compNames parameter. 1401 @param [inout] compNames 1402 If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts 1403 a list of the names of all physical components that implement the specified standard component name. 1404 Each name is NULL terminated. numComps indicates the number of names. 1405 @ingroup core 1406 */ 1407 OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( 1408 OMX_IN OMX_STRING role, 1409 OMX_INOUT OMX_U32 *pNumComps, 1410 OMX_INOUT OMX_U8 **compNames); 1411 1412 /** The OMX_GetRolesOfComponent method will return the number of roles supported by the given 1413 component and (if the roles field is non-NULL) the names of those roles. The call will fail if 1414 an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the 1415 client should: 1416 * first call this function with the roles field NULL to determine the number of role names 1417 * second call this function with the roles field pointing to an array of names allocated 1418 according to the number returned by the first call. 1419 1420 The core should return from this call within 5 msec. 1421 1422 @param [in] compName 1423 This is the name of the component being queried about. 1424 @param [inout] pNumRoles 1425 This is used both as input and output. 1426 1427 If roles is NULL, the input is ignored and the output specifies how many roles the component supports. 1428 1429 If compNames is not NULL, on input it bounds the size of the input structure and 1430 on output, it specifies the number of roles string names listed within the roles parameter. 1431 @param [out] roles 1432 If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings 1433 which accepts a list of the names of all standard components roles implemented on the 1434 specified component name. numComps indicates the number of names. 1435 @ingroup core 1436 */ 1437 OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( 1438 OMX_IN OMX_STRING compName, 1439 OMX_INOUT OMX_U32 *pNumRoles, 1440 OMX_OUT OMX_U8 **roles); 1441 1442 #ifdef __cplusplus 1443 } 1444 #endif /* __cplusplus */ 1445 1446 #endif 1447 /* File EOF */ 1448 1449