OMX_ERRORTYPE IFM_HostNmfProcessingComp::useBuffer( OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo) { /* do not call useBufferVisual as it is implemented for Video which does not do the same than imaging */ ENS_Port * port = mENSComponent.getPort(nPortIndex); OMX_PARAM_PORTDEFINITIONTYPE portdef; OMX_VERSIONTYPE version = {{0, 0, 0, 0}}; getOmxIlSpecVersion(&version); portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); portdef.nVersion = version; port->getParameter(OMX_IndexParamPortDefinition, &portdef); if(portdef.eDomain == OMX_PortDomainVideo){ OMX_ERRORTYPE error; void *bufferAllocInfo = 0; OMX_U8 *pBuffer; bufferAllocInfo = (void *)(port->getSharedChunk()); // bufferAllocINfo is now a MMHWBUffer if(!bufferAllocInfo) { return (OMX_ErrorInsufficientResources); } error = ((MMHwBuffer *)bufferAllocInfo)->AddBufferInfo(nBufferIndex, (OMX_U32)pBufferHdr->pBuffer, pBufferHdr->nAllocLen); if (error != OMX_ErrorNone) { return error; } pBuffer = pBufferHdr->pBuffer; /* it is freed when freeBuffer is called*/ //OMX_U32 bufPhysicalAddr = HwBuffer::GetBufferPhysicalAddress(bufferAllocInfo, pBuffer, pBufferHdr->nAllocLen); OMX_U32 bufPhysicalAddr; //= getBufferPhysicalAddress(bufferAllocInfo, pBuffer, pBufferHdr->nAllocLen); error = ((MMHwBuffer *)bufferAllocInfo)->PhysAddress((OMX_U32)pBuffer, pBufferHdr->nAllocLen,bufPhysicalAddr); if (error != OMX_ErrorNone) return error; SharedBuffer *sharedBuf = new SharedBuffer(mENSComponent.getNMFDomainHandle(), pBufferHdr->nAllocLen, pBuffer, bufPhysicalAddr, 0, NULL, error); // actually we dont care about bufferAllocInfo in case where we are buffer supplier but we do care in case where we are not buffer supplier, thus keep it anyway in both cases. if (sharedBuf == 0) return OMX_ErrorInsufficientResources; if (error != OMX_ErrorNone) return error; sharedBuf->setOMXHeader(pBufferHdr); *portPrivateInfo = sharedBuf; } else { /* do nothing: useBufferHeap is empty*/ } return OMX_ErrorNone; }
ENS_API_EXPORT OMX_ERRORTYPE NmfHostMpc_ProcessingComponent::useBuffer(OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo) { OMX_ERRORTYPE error; void *bufferAllocInfo = 0; OMX_U8 *pBuffer; if (useBufferNeedsMemcpy()) { error = doBufferAllocation(nPortIndex, nBufferIndex, pBufferHdr->nAllocLen, &pBuffer, &bufferAllocInfo); if (error != OMX_ErrorNone) return error; } else { *portPrivateInfo = pBufferHdr->pPlatformPrivate; // FIXME: should be removed when pAppPrivate mechanism deprecated pBuffer = pBufferHdr->pBuffer; } OMX_U32 bufPhysicalAddr = getBufferPhysicalAddress(bufferAllocInfo, pBuffer, pBufferHdr->nAllocLen); OMX_U32 bufMpcAddress = getBufferMpcAddress(bufferAllocInfo); SharedBuffer *sharedBuf = new SharedBuffer(mENSComponent.getNMFDomainHandle(), pBufferHdr->nAllocLen, pBuffer, bufPhysicalAddr, bufMpcAddress, bufferAllocInfo, error); if (sharedBuf == 0) return OMX_ErrorInsufficientResources; if (error != OMX_ErrorNone) return error; sharedBuf->setOMXHeader(pBufferHdr); *portPrivateInfo = sharedBuf; return OMX_ErrorNone; }
OMX_ERRORTYPE IFM_HostNmfProcessingComp::useBufferHeader( OMX_DIRTYPE dir, OMX_BUFFERHEADERTYPE* pBufferHdr) { OMX_PARAM_PORTDEFINITIONTYPE portdef; OMX_VERSIONTYPE version = {{0, 0, 0, 0}}; getOmxIlSpecVersion(&version); portdef.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE); portdef.nVersion = version; ENS_Port * port; if(NULL == pBufferHdr) return OMX_ErrorBadParameter; if(dir==OMX_DirOutput) port = mENSComponent.getPort(pBufferHdr->nOutputPortIndex); else port = mENSComponent.getPort(pBufferHdr->nInputPortIndex); port->getParameter(OMX_IndexParamPortDefinition, &portdef); if (portdef.eDomain == OMX_PortDomainVideo) { SharedBuffer *sharedBuf = 0; if(dir == OMX_DirInput) { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pInputPortPrivate); } else { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pOutputPortPrivate); } if(!sharedBuf) return OMX_ErrorBadParameter; return sharedBuf->setOMXHeader(pBufferHdr); }else return OMX_ErrorNone; }
ENS_API_EXPORT OMX_ERRORTYPE NmfHostMpc_ProcessingComponent::useBufferHeader(OMX_DIRTYPE dir, OMX_BUFFERHEADERTYPE* pBufferHdr) { SharedBuffer *sharedBuf = 0; if(!pBufferHdr) return OMX_ErrorBadParameter; if(dir == OMX_DirInput) { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pInputPortPrivate); } else { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pOutputPortPrivate); } if(!sharedBuf) return OMX_ErrorBadParameter; return sharedBuf->setOMXHeader(pBufferHdr); }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::useBufferHeader( OMX_DIRTYPE dir, OMX_BUFFERHEADERTYPE* pBufferHdr) //************************************************************************************************************* { OMX_PORTDOMAINTYPE domain; ENS_Port * port; if(!pBufferHdr) { ReportError(OMX_ErrorBadParameter, "Buffer header is null"); return OMX_ErrorBadParameter; } if(dir==OMX_DirOutput) port = mENSComponent.getPort(pBufferHdr->nOutputPortIndex); else port = mENSComponent.getPort(pBufferHdr->nInputPortIndex); domain= port->getDomain(); if(domain == OMX_PortDomainVideo) { #if USE_CAMERA_BUFFER SharedBuffer *sharedBuf = 0; if(dir == OMX_DirInput) { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pInputPortPrivate); } else { sharedBuf = static_cast<SharedBuffer *>(pBufferHdr->pOutputPortPrivate); } if(!sharedBuf) { ReportError(OMX_ErrorBadParameter, "Cannot retreive buffer address"); return OMX_ErrorBadParameter; } return sharedBuf->setOMXHeader(pBufferHdr); #endif } else { } return OMX_ErrorNone; }
ENS_API_EXPORT OMX_ERRORTYPE NmfMpc_ProcessingComponent::useBuffer( OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo) { OMX_ERRORTYPE error; void *bufferAllocInfo = 0; OMX_U8 *pBuffer; if (nPortIndex>=mENSComponent.getPortCount() || mENSComponent.getPort(nPortIndex)==0) { return OMX_ErrorBadPortIndex; } if (useBufferNeedsMemcpy()) { error = doBufferAllocation(nPortIndex, nBufferIndex, pBufferHdr->nAllocLen, &pBuffer, &bufferAllocInfo); if (error != OMX_ErrorNone) return error; } else { ENS_Port *port = mENSComponent.getPort(nPortIndex); bufferAllocInfo = port->getSharedChunk(); pBuffer = pBufferHdr->pBuffer; OMX_ERRORTYPE error = ((MMHwBuffer *)bufferAllocInfo)->AddBufferInfo(nBufferIndex, (OMX_U32)pBufferHdr->pBuffer, pBufferHdr->nAllocLen); if (error != OMX_ErrorNone) return error; } OMX_U32 bufPhysicalAddr = getBufferPhysicalAddress(bufferAllocInfo, pBuffer, pBufferHdr->nAllocLen); OMX_U32 bufMpcAddress = getBufferMpcAddress(bufferAllocInfo); SharedBuffer *sharedBuf = new SharedBuffer(mENSComponent.getNMFDomainHandle(), pBufferHdr->nAllocLen, pBuffer, bufPhysicalAddr, bufMpcAddress, bufferAllocInfo, error); if (sharedBuf == 0) return OMX_ErrorInsufficientResources; if (error != OMX_ErrorNone) return error; sharedBuf->setOMXHeader(pBufferHdr); *portPrivateInfo = sharedBuf; return OMX_ErrorNone; }
WRAPPER_OPENMAX_API OMX_ERRORTYPE OpenMax_Proxy::useBuffer( OMX_U32 nPortIndex, OMX_U32 nBufferIndex, OMX_BUFFERHEADERTYPE* pBufferHdr, void **portPrivateInfo) //************************************************************************************************************* { /* do not call useBufferVisual as it is implemented for Video which does not do the same than imaging */ ENS_Port * port = mENSComponent.getPort(nPortIndex); OMX_PORTDOMAINTYPE domain; domain= port->getDomain(); if(domain == OMX_PortDomainVideo) { #if USE_CAMERA_BUFFER OMX_ERRORTYPE error; void *bufferAllocInfo = 0; OMX_U8 *pBuffer; bufferAllocInfo = (void *)(port->getSharedChunk()); // bufferAllocINfo is now a MMHWBUffer if(!bufferAllocInfo) DBC_ASSERT(0); error = ((MMHwBuffer *)bufferAllocInfo)->AddBufferInfo(nBufferIndex, (OMX_U32)pBufferHdr->pBuffer, pBufferHdr->nAllocLen); if (error != OMX_ErrorNone) { ReportError(error, "Cannot AddBufferInfo"); return error; } pBuffer = pBufferHdr->pBuffer; /* it is freed when freeBuffer is called*/ OMX_U32 bufPhysicalAddr; error = ((MMHwBuffer *)bufferAllocInfo)->PhysAddress((OMX_U32)pBuffer, pBufferHdr->nAllocLen, bufPhysicalAddr); if (error != OMX_ErrorNone) { ReportError(error, "Cannot get physical address"); return error; } SharedBuffer *sharedBuf = new SharedBuffer(mENSComponent.getNMFDomainHandle(), pBufferHdr->nAllocLen, pBuffer, bufPhysicalAddr, NULL, NULL, error); // actually we dont care about bufferAllocInfo in case where we are buffer supplier but we do care in case where we are not buffer supplier, thus keep it anyway in both cases. if (sharedBuf == 0) { ReportError(error, "Cannot create shared buffer"); return OMX_ErrorInsufficientResources; } if (error != OMX_ErrorNone) { ReportError(error, "Cannot create shared buffer"); return error; } sharedBuf->setOMXHeader(pBufferHdr); *portPrivateInfo = sharedBuf; #endif } else { /* do nothing: useBufferHeap is empty*/ *portPrivateInfo = NULL; } return OMX_ErrorNone; }