Stagefright的編解碼功能是利用OpenMAX框架,而且用的還是OpenCORE之OMX的實作,我們來看一下Stagefright和OMX是如何運作的。
(1) OMX_Init
|
(2) OMX_SendCommand
|
(3) 其他作用在 OMX 元件的指令
其他作用在OMX元件的指令也和OMX_SendCommand的call 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
}