OpenMax IL: component 概述

 OpenMax IL 有四个部分组成:        

 客户端(Client)OpenMax IL的调用者

 组件(Component)OpenMax IL的单元,每一个组件实现一种功能

 端口(Port):组件的输入输出接口

 隧道化(Tunneled):让两个组件直接连接的方式

OpenMax IL 中重要的组成部分是componentcomponentOpenMax IL实现的核心内容,一个组件以输入、输出端口为接口,端口可以被连接到另一个组件上。外部对组件可以发送命令,还进行设置/获取参数、配置等内容。component的端口可以包含缓冲区(Buffer)的队列。

OpenMAL IL的客户端,通过调用四个OpenMAL IL组件,实现了一个功能。四个组件分别是Source组件、Host组件、Accelerator组件和Sink组件。Source组件只有一个输出端口;Host组件有一个输入端口和一个输出端口;Accelerator组件具有一个输入端口,调用了硬件的编解码器,加速主要体现在这个环节上。Accelerator组件和Sink组件通过私有通讯方式在内部进行连接,没有经过明确的组件端口。如下图

 

组件的处理的核心内容是:通过输入端口消耗Buffer,通过输出端口填充Buffer,由此多组件相联接可以构成流式的处理。

 

component state有如下,具体定义在OMX_Core.h

framework/base/include/media/libstagefright/openmax/OMX_Core.h

typedef enum OMX_STATETYPE

{

    OMX_StateInvalid,      /**< component has detected that it's internal data

                                structures are corrupted to the point that

                                it cannot determine it's state properly */

    OMX_StateLoaded,      /**< component has been loaded but has not completed

                                initialization.  The OMX_SetParameter macro

                                and the OMX_GetParameter macro are the only

                                valid macros allowed to be sent to the

                                component in this state. */

    OMX_StateIdle,        /**< component initialization has been completed

                                successfully and the component is ready to

                                to start. */

    OMX_StateExecuting,   /**< component has accepted the start command and

                                is processing data (if data is available) */

    OMX_StatePause,       /**< component has received pause command */

    OMX_StateWaitForResources, /**< component is waiting for resources, either after

                                preemption or before it gets the resources requested.

                                See specification for complete details. */

    OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */

    OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */

    OMX_StateMax = 0X7FFFFFFF

} OMX_STATETYPE;

 

componentLOADER状态下,只能建立它本身一些属性和配置信息,客户端能做什么呢?客户端可以发*  SetParameters/GetParameters and SetConfig/GetConfig这些commandcomponent,以便以后component记录下这些parameterconfiguration的变化。在IDLE状态下,就可以分得buffer之类的资源,但是不能操作这些buffer直到component处于Executing状态下。

component state 如何转换呢?

一般change state可以通过OMX_SendCommand的方式通知给component,格式如下:

OMX_SendCommand(  hComponent, Cmd,mParam,pCmdData)

hComponent:执行该commandcomponent

Cmd:component执行的command        

mParam:执行command的一些参数值

如客户端发给componentmOMX->sendCommand(mNode, OMX_CommandStateSet, OMX_StateIdle);

 

说到command 那就列举下有哪些command吧:

coder在如下路径

framework/base/include/media/libstagefright/openmax/OMX_Core.h

typedef enum OMX_COMMANDTYPE

{

    OMX_CommandStateSet,    /**< Change the component state */

    OMX_CommandFlush,       /**< Flush the data queue(s) of a component */

    OMX_CommandPortDisable, /**< Disable a port on a component. */

    OMX_CommandPortEnable,  /**< Enable a port on a component. */

    OMX_CommandMarkBuffer,  /**< Mark a component/buffer for observation */

    OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */

    OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */

    OMX_CommandMax = 0X7FFFFFFF

} OMX_COMMANDTYPE;

具体command如何传到component,可以参考本博的OMXCodec与OMX事件处理流程

http://blog.csdn.net/tjy1985/article/details/7397752

 

你可能感兴趣的:(command,buffer,processing,resources,initialization,macros)