OpenMAX

From DaphneWiki

(Difference between revisions)
Jump to: navigation, search
(hello_video OMX API calls)
Line 63: Line 63:
==hello_video OMX API calls==
==hello_video OMX API calls==
Here is a sequence of all the OMX API calls that the hello_video sample program makes (from raspberry pi raspbian sample image).
Here is a sequence of all the OMX API calls that the hello_video sample program makes (from raspberry pi raspbian sample image).
 +
 +
#OMX_Init()
 +
#OMX_GetHandle(pHandle, "OMX.broadcom.video_decode", pAppData, &callbacks)
 +
#OMX_GetComponentVersion(pHandle, pszNameArray, pCompVersion, pSpecVersion, pUID) name: "OMX.broadcom.video_decode:22", version: 0's, spec version: 1.1.2, uid same as name
 +
#OMX_GetParameter(pHandle, OMX_IndexParamAudioInit, &pPorts)  (nPorts returned as 0)
 +
#OMX_GetParameter(pHandle, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 2) (ports.nStartPortNumber returned 130)
 +
#OMX_SendCommand(pHandle, OMX_CommandPortDisable, 130, NULL)
 +
#(waits for event callback to fire in other thread to indicate that port has been disabled)
 +
#OMX_SendCommand(pHandle, OMX_CommandPortDisable, 131, NULL)
 +
#(waits for event callback to fire in other thread to indicate that port has been disabled)
 +
#OMX_GetHandle(pHandleRender, "OMX.broadcom.video_render", pAppData, &callbacks)
 +
#OMX_GetComponentVersion(pHandleRender, ...)
 +
#OMX_GetParameter(pHandleRender, OMX_IndexParamAudioInit, &pPorts)  (nPorts returned as 0)
 +
#OMX_GetParameter(pHandleRender, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 1) (ports.nStartPortNumber returned 90)
 +
#OMX_GetHandle(pHandleClock, "OMX.broadcom.clock", ...)
 +
#OMX_GetParameter(pHandleClock, OMX_IndexParamOtherInit, ...) (nPorts returned as 6) (ports.nStartPortNumber returned
 +
#OMX_SetParameter(pHandleClock?, OMX_IndexConfigTimeClockState, &cState)
 +
#OMX_GetHandle(pHandleSched, "OMX.broadcom.video_scheduler", ...)
 +
#OMX_GetParameter(pHandleSched, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 2) (ports.nStartPortNumber returned 10)
 +
#OMX_GetParameter(pHandleSched, OMX_IndexParamAudioInit, &pPorts) (nPorts returned 1) (ports.nStartPortNumber returned 12)

Revision as of 16:02, 21 August 2012

Contents

OpenMAX IL

Core

Dynamically loads/unloads components.

Sets up tunnels between two components.

Accesses component's methods.

API is probably the same across platforms.

Component

Individual blocks of functionality, including "sources, sinks, codecs, filters, splitters, mixers, or any other data operator."

Types of components:
Source: component with single output port
Sink: component with single input port
Host: run entirely on host processor

Component provider defines functionality of given component.

Operate on four types of data: audio, video, image, and other (time data for sync).

Provides access to standard set of component functions via component handle.

Must have at least one port to conform to official standard.

Data communication calls to components are non-blocking.

Ports

"Data communication to and from a component is conducted through interfaces called ports. Ports represent both the connection for components to the data stream and the buffers needed to maintain the connection. Users may send data to components through input ports or receive data through output ports. Similarly, a communication tunnel between two components can be established by connecting the output port of one component to a similarly formatted input port of another component."

Ports must support callbacks to the IL client.

Communication

  1. Non-tunneled communication: buffer exchange between IL client and component.
  2. Tunneled communication: direct buffer exchange between two components.
  3. Proprietary: we don't want to deal with this nonsense.

Profiles

  1. Base: does not need to implement tunneling
  2. Interop: must implement tunneling

States

All components start in the "unloaded" state and must be "loaded" via a call to the core. All other state transitions may then be achieved by communicating directly with the component. On error, the component automatically reverts to the "unloaded" state.

  1. WAIT FOR RESOURCES: waiting for initialization to finish
  2. IDLE: component has all static resources but is not processing data ("stopped")
  3. EXECUTING: pending reception of buffers to process data, will make callbacks
  4. PAUSED: won't process any data, can resume where it left off (idle cannot)


IL client

Your application, some third-party framework, or OpenMAX AL.

Always communicates to components via core.

hello_video OMX API calls

Here is a sequence of all the OMX API calls that the hello_video sample program makes (from raspberry pi raspbian sample image).

  1. OMX_Init()
  2. OMX_GetHandle(pHandle, "OMX.broadcom.video_decode", pAppData, &callbacks)
  3. OMX_GetComponentVersion(pHandle, pszNameArray, pCompVersion, pSpecVersion, pUID) name: "OMX.broadcom.video_decode:22", version: 0's, spec version: 1.1.2, uid same as name
  4. OMX_GetParameter(pHandle, OMX_IndexParamAudioInit, &pPorts) (nPorts returned as 0)
  5. OMX_GetParameter(pHandle, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 2) (ports.nStartPortNumber returned 130)
  6. OMX_SendCommand(pHandle, OMX_CommandPortDisable, 130, NULL)
  7. (waits for event callback to fire in other thread to indicate that port has been disabled)
  8. OMX_SendCommand(pHandle, OMX_CommandPortDisable, 131, NULL)
  9. (waits for event callback to fire in other thread to indicate that port has been disabled)
  10. OMX_GetHandle(pHandleRender, "OMX.broadcom.video_render", pAppData, &callbacks)
  11. OMX_GetComponentVersion(pHandleRender, ...)
  12. OMX_GetParameter(pHandleRender, OMX_IndexParamAudioInit, &pPorts) (nPorts returned as 0)
  13. OMX_GetParameter(pHandleRender, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 1) (ports.nStartPortNumber returned 90)
  14. OMX_GetHandle(pHandleClock, "OMX.broadcom.clock", ...)
  15. OMX_GetParameter(pHandleClock, OMX_IndexParamOtherInit, ...) (nPorts returned as 6) (ports.nStartPortNumber returned
  16. OMX_SetParameter(pHandleClock?, OMX_IndexConfigTimeClockState, &cState)
  17. OMX_GetHandle(pHandleSched, "OMX.broadcom.video_scheduler", ...)
  18. OMX_GetParameter(pHandleSched, OMX_IndexParamVideoInit, &pPorts) (nPorts returned 2) (ports.nStartPortNumber returned 10)
  19. OMX_GetParameter(pHandleSched, OMX_IndexParamAudioInit, &pPorts) (nPorts returned 1) (ports.nStartPortNumber returned 12)
Personal tools