ENS_API_EXPORT OMX_ERRORTYPE NmfHostMpc_ProcessingComponent::fillThisBuffer(OMX_BUFFERHEADERTYPE* pBuffer)
{
  OMX_U32 portIndex = pBuffer->nOutputPortIndex;
  if (portIndex>=mENSComponent.getPortCount() || mENSComponent.getPort(pBuffer->nOutputPortIndex)==0) {
      return OMX_ErrorBadPortIndex;
  }

  ENS_Port * port = static_cast<ENS_Port *>(mENSComponent.getPort(pBuffer->nOutputPortIndex));

  if(port->isMpc())
  {
    SharedBuffer *sharedbuffer = static_cast<SharedBuffer *>(pBuffer->pOutputPortPrivate);

    pBuffer->nFlags = 0;
	pBuffer->nFilledLen = 0;
	pBuffer->nOffset = 0;

    sharedbuffer->updateMPCHeader();
    mIfillThisBufferMpc[pBuffer->nOutputPortIndex].fillThisBuffer(sharedbuffer->getMPCHeader());
  }
  else
  {
    mIfillThisBuffer[pBuffer->nOutputPortIndex].fillThisBuffer(pBuffer);
  }

  return OMX_ErrorNone;
}
ENS_API_EXPORT OMX_ERRORTYPE NmfHostMpc_ProcessingComponent::emptyThisBuffer(OMX_BUFFERHEADERTYPE* pBuffer)
{
  OMX_U32 portIndex = pBuffer->nInputPortIndex;
  if (portIndex>=mENSComponent.getPortCount() || mENSComponent.getPort(pBuffer->nInputPortIndex)==0) {
      return OMX_ErrorBadPortIndex;
  }

  ENS_Port * port = static_cast<ENS_Port *>(mENSComponent.getPort(pBuffer->nInputPortIndex));

  if(port->isMpc())
  {
    SharedBuffer *sharedbuffer = static_cast<SharedBuffer *>(pBuffer->pInputPortPrivate);

    DBC_ASSERT(pBuffer->nFilledLen <= pBuffer->nAllocLen);

    sharedbuffer->updateMPCHeader();
    mIemptyThisBufferMpc[pBuffer->nInputPortIndex].emptyThisBuffer(sharedbuffer->getMPCHeader());
  }
  else
  {
    mIemptyThisBuffer[pBuffer->nInputPortIndex].emptyThisBuffer(pBuffer);
  }

  return OMX_ErrorNone;
}
ENS_API_EXPORT OMX_ERRORTYPE NmfMpc_ProcessingComponent::emptyThisBuffer(
        OMX_BUFFERHEADERTYPE* pBuffer) {

    SharedBuffer *sharedbuffer = static_cast<SharedBuffer *>(pBuffer->pInputPortPrivate);

    DBC_ASSERT(pBuffer->nFilledLen <= pBuffer->nAllocLen);

    sharedbuffer->updateMPCHeader();
    
    mIemptyThisBuffer[pBuffer->nInputPortIndex].emptyThisBuffer(sharedbuffer->getMPCHeader());

    return OMX_ErrorNone;
}
ENS_API_EXPORT OMX_ERRORTYPE NmfMpc_ProcessingComponent::fillThisBuffer(
        OMX_BUFFERHEADERTYPE* pBuffer) {
    
    SharedBuffer *sharedbuffer = static_cast<SharedBuffer *>(pBuffer->pOutputPortPrivate);

    pBuffer->nFlags = 0;
    pBuffer->nFilledLen = 0; 
    pBuffer->nOffset = 0;

    sharedbuffer->updateMPCHeader();
    
    mIfillThisBuffer[pBuffer->nOutputPortIndex].fillThisBuffer(sharedbuffer->getMPCHeader());

    return OMX_ErrorNone;
}
ENS_API_EXPORT void NmfHostMpc_ProcessingComponent::fillBufferDoneMpc_cb(t_uint32 dspBufferHdrArmAddress)
{
  SharedBuffer * sharedbuffer =  getSharedBuffer(dspBufferHdrArmAddress, true);

  doSpecificFillBufferDone_cb(sharedbuffer->getOMXHeader());
  OstTraceFiltInst2(TRACE_DEBUG, "ENS_PROXY: NmfHostMpc_ProcessingComponent:fillBufferDone_cb  (HOST)0x%x (MPC)0x%x", (unsigned int)sharedbuffer->getOMXHeader(), (unsigned int)sharedbuffer->getMPCHeader());
  mENSComponent.fillBufferDone(sharedbuffer->getOMXHeader());
}