1.结构体定义及注册回调
frameworks/native/include/media/openmax/OMX_Core.h
typedef struct OMX_CALLBACKTYPE
{
OMX_ERRORTYPE (*FillBufferDone)(
OMX_OUT OMX_HANDLETYPE hComponent,
OMX_OUT OMX_PTR pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer);
}OMX_CALLBACKTYPE;
<1>.frameworks/av/media/libstagefright/omx/OMXNodeInstance.cpp
OMX_CALLBACKTYPE OMXNodeInstance::kCallbacks = {
&OnEvent, &OnEmptyBufferDone, &OnFillBufferDone
};
<2>.frameworks/av/media/libstagefright/omx/OMX.cpp
status_t OMX::allocateNode(const char *name, const sp<IOMXObserver> &observer, node_id *node)
{
OMXNodeInstance *instance = new OMXNodeInstance(this, observer, name);
OMX_COMPONENTTYPE *handle;
OMX_ERRORTYPE err = mMaster->makeComponentInstance(name, &OMXNodeInstance::kCallbacks,instance, &handle);
}
<3>.xxx_OMX_Plugin.cpp
OMX_ERRORTYPE OMXPlugin::makeComponentInstance(const char *name,