Stagefright 之 与Openmax IL一起工作

Stagefright之二

                                                            ——与Openmax一起工作

 

       Stagefright的编解码功能是利用Openmax框架,而且用的还是OpencoreOMX组件,我们来看一下StagefrightOMX是如何工作的。

 

(1) OMX_Init

 

OMXClient mClient;                                                 ……AwesomePlayer.cpp

AwesomePlayer::AwesomePlayer()

{

  CHECK_EQ(mClient.connect(), OK);

}

 

status_t OMXClient::connect()                                   ……OMXClient.cpp

{

  mOMX = service->getOMX();

}

 

sp<IOMX> MediaPlayerService::getOMX()                 ……MediaPlayerService.cpp

{

  mOMX = new OMX;

}

 

OMX::OMX() : mMaster(new OMXMaster)             ……OMX.cpp

 

OMXMaster::OMXMaster()                                          ……OMXMaster.cpp

{

  addPlugin(new OMXPVCodecsPlugin);

}

 

OMXPVCodecsPlugin::OMXPVCodecsPlugin()                ……OMXPVCodecsPlugin.cpp

{

  OMX_MasterInit();

}

 

OMX_ERRORTYPE OMX_MasterInit() <-- under Opencore      ……Pv_omxcore.cpp

(gingerbread 下,已移除Opencore代码)

{

  return OMX_Init();

}

 

 

(2) OMX_SendCommand

 

OMXCodec::function_name()                                         ……OMXCodec.cpp

{

  mOMX->sendCommand(mNode, OMX_CommandStateSet, OMX_StateIdle);

}

 

status_t OMX::sendCommand(node, cmd, param)            ……OMX.cpp

{

  return findInstance(node)->sendCommand(cmd, param);

}

 

status_t OMXNodeInstance::sendCommand(cmd, param)         ……OMXNodeInstance.cpp

{

  OMX_SendCommand(mHandle, cmd, param, NULL);

}

                            ****OMX_Core.h****

#define OMX_SendCommand(                                    \

         hComponent,                                        \

         Cmd,                                               \

         nParam,                                            \

         pCmdData)                                          \

     ((OMX_COMPONENTTYPE*)hComponent)->SendCommand(         \

         hComponent,                                        \

         Cmd,                                               \

         nParam,                                            \

         pCmdData)                          /* Macro End */

 

(3) 其它作用在 OMX组件的指令

其它指令也和OMX_SendCommandcall path一样,请见下表:

OMXCodec

OMX

OMXNodeInstance

 

useBuffer

useBuffer (OMX_UseBuffer)

 

getParameter

getParameter (OMX_GetParameter)

 

fillBuffer

fillBuffer (OMX_FillThisBuffer)

 

emptyBuffer

emptyBuffer (OMX_EmptyThisBuffer)

 

(4) Callback Functions

 

OMX_CALLBACKTYPE OMXNodeInstance::kCallbacks =

{

  &OnEvent, <--------------- omx_message::EVENT

  &OnEmptyBufferDone, <----- omx_message::EMPTY_BUFFER_DONE

  &OnFillBufferDone <------- omx_message::FILL_BUFFER_DONE

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值