佛山禅城五金批发市场:OpenMAX Call Sequences

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 12:18:28
 

将codec集成到PV OpenCORE多媒体框架的方法有几种:1)作为压缩多媒体输入输出(MIO)组件,2)作为节点(node),3)作为OpenMAX组件集成到OpenMAX codecs节点中。许多codecs,特别是包含硬件加速器的codes都执行OpenMAX IL接口,并且将OpenMAX接口当成最简单的集成方法。

OpenCOREOMX core/component的交互

1) OMX core初始化

PlayerDriver::playerThread()

->OMX_MasterInit() (pv_omxmastercore.cpp)

->_Try_OMX_MasterInit(error, status, data)

->_OMX_MasterInit(data) 执行所有的OpenMAX IL Core标准函数

->OMX_Init()

  OMX_ComponentNameEnum()

  OMX_GetRolesOfComponent()OMX Core Initialization 
2)
OMX Component instantiation, capabilities and port indicesAfter the OMX Core is initialized, the next step is typically to instantiate a specific component and enumerate capabilities and port indices. The PV framework will:  

l       利用OMX_GetHandle调用来实例化想要的OMX组件

l       利用OMX_GetParameter调用来获取OMX组件的能力和OMX组件上可用端口的数量

l       遍历可用的端口以查找输入端口的索引

l       遍历可用的端口以查找输出端口的索引

 

OMX Component Instantiation through OMX_GetHandle

3) OMX component input and output buffer negotiation

Before any data can be exchanged, parameters for input and output buffers need to be negotiated. To accomplish this, the PV framework:

l       调用OMX_GetParameter来获取input port buffer参数

l       核实(verify) input buffer参数的有效性

l       调用OMX_SetParameter来设置input buffer参数

l       调用OMX_GetParameter来获取output port buffer参数

l       核实(verify) output buffer参数的有效性

l       调用OMX_SetParameter来设置output buffer参数  OMX Component Buffer Negotiation 4) OMX Transition Loaded->Idel State

The buffer allocation is handled as part of the allocation to the Idle state. During this transition, PV Framework:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件状态(Loaded->Idel)

l       调用OMX_UseBuffer或OMX_AllocateBuffer向OMX组件发送命令。The call is used NumInputBuffer times for input port, and NumOutputBuffer for output port.

l       等待组件的EventHandler回调。这个callback通知框架组件的状态转换已经完成。 OMX Component state transition from OMX_StateLoaded->OMX_StateIdle 5) Transition to “Executing”state and data exchange

The transition to executing starts the active processing of data. In this step, PV Framework:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件状态(Idle->Executing)

l       等待EventHandler callback,组件的状态转换已完成

l       调用OMX_EmptyThisBuffer或OMX_FillThisBuffer向音频组件发送input或output buffers。组件利用适当的callback返回buffers。

  OMX component state transition from idle to execute and data exchange

 6) Pausing

A common use-case involves pausing and resuming. In this case, the PV framework:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件状态(Executing->Pause)

l       等待EventHandler callback,组件的状态转换已完成

向OMX组件发送pause命令后,PV框架立即停止向OMX组件发送inpupt/output buffers。

 In order to resume, the PV framework:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件状态(Pause->Executing)

l       等待EventHandler callback,组件的状态转换已完成

当接到callback组件状态转换成Executing后,PV框架可以恢复向组件发送OMX input/output buffers。

OMX component state transition from execute to pause and back

 7) Port flush (if applicable)

The port flush call is typically used with a decoder component during repositioning so that any queued data is discarded. In this situation, the PV framework:

l       调用OMX_SendCommand向OMX组件发送命令flush所有ports。

l       等待两个来自组件input和output ports的EventHandler callback,组件已完成ports flushing。

当发送flush命令后,PV框架立刻停止向OMX组件发送input/output buffers。当收到第二个callback后,PV框架可以恢复向组件发送input/output buffers。

OMX component port flush procedure

 8) Stop/Transition to “Idle” state

In order to stop processing, the PV framework:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件的状态(Executing/Pause->Idle)

l       等待EventHandler callback,组件的状态转换已完成

当接收到Idle状态转换命令完成的callback时,PV框架认为所有的OMX输入buffers和输出buffers都已经从OMX组件返回。

OMX component state transition from OMX_StateExecuting/Paused->OMX_StateIdle

 9) OMX Component Transition from Idle->Loaded State and De-initialization

当结束与OMX组件的交互后,PV框架将:

l       调用OMX_SendCommand向OMX组件发送命令以改变组件的状态(Idle->Loaded)

l       发起一系列的OMX_FreeBuffer调用

l       等待EventHandler callback,组件的状态转换已完成

l       向OMX Core发起OMX_FreeHandle调用以释放组件的Handle

在发起状态转换命令之前,PV框架需要等待所有的输入输出buffers从OMX组件返回。

OMX component state transition from OMX_StateIdle->OMX_StateLoaded

 10)   OMX Core De-initialization

PV框架简单地调用OMX_Deinit()。