/* ========================================================================== */ static void writeMsg(TIMM_OSAL_PTR pBuffer, TIMM_OSAL_U32 nNumBytes) { static systemMessage_t* tmpMsg = NULL; if (!pBuffer){ SCREXEC_DBG_PRINT("Invalid return buffer supplied!\n"); return TIMM_OSAL_ERR_PARAMETER; } if(nNumBytes == sizeof(systemMessage_t*)){ tmpMsg = TIMM_OSAL_MallocExtn(sizeof(systemMessage_t), TIMM_OSAL_TRUE, 32, 0, NULL); TIMM_OSAL_Memcpy(tmpMsg, pBuffer, sizeof(systemMessage_t)); if(tmpMsg->nPayloadSize > 0){ tmpMsg->pPayload = TIMM_OSAL_MallocExtn(tmpMsg->nPayloadSize, TIMM_OSAL_TRUE, 32, 0, NULL); TIMM_OSAL_Memcpy(tmpMsg->pPayload, ((systemMessage_t*)pBuffer)->pPayload, tmpMsg->nPayloadSize); }else { tmpMsg->pPayload = NULL; } if (TIMM_OSAL_ERR_NONE != TIMM_OSAL_WriteToPipe(STAND1_Script_Execution_PipeI, &tmpMsg, sizeof(systemMessage_t*), TIMM_OSAL_SUSPEND)){ SCREXEC_DBG_PRINT("TIMM_OSAL_WriteToPipe failed!\n"); return TIMM_OSAL_ERR_UNKNOWN; } SCREXEC_DBG_PRINT("Successful message write!\nSent %08X", &tmpMsg); }else { SCREXEC_DBG_PRINT("Out of sequence message!\n"); return TIMM_OSAL_ERR_UNKNOWN; } return TIMM_OSAL_ERR_NONE; }
/**=========================================================================**/ OMX_ERRORTYPE OMX_BASE_CB_ReturnDataNotify(OMX_HANDLETYPE hComponent, OMX_S32 nPortIndex, OMX_BUFFERHEADERTYPE* pBuffer) { OMX_COMPONENTTYPE* pComp ; OMX_BASE_PRIVATETYPE* pBaseComPvt; OMX_BASE_INTERNALTYPE* pBaseComInt; OMX_BASE_PORTTYPE *pPort; OMX_ERRORTYPE tError = OMX_ErrorNone; OMX_BASE_Entering(); OMX_BASE_REQUIRE((hComponent != NULL) && (pBuffer != NULL), OMX_ErrorBadParameter); pComp = (OMX_COMPONENTTYPE *)hComponent; pBaseComPvt = (OMX_BASE_PRIVATETYPE *)pComp->pComponentPrivate; pBaseComInt = (OMX_BASE_INTERNALTYPE*)pBaseComPvt->hOMXBaseInt; pPort = pBaseComInt->ports[nPortIndex]; TIMM_OSAL_MutexObtain(pBaseComPvt->pMutex, TIMM_OSAL_SUSPEND); /* If port is Not-Tunneled, return buffers back to the IL Client by calling * FillBufferDone/EmptyBufferDone depending on the directin of port */ if (!PORT_IS_TUNNEL(pPort)){ TIMM_OSAL_MutexRelease(pBaseComPvt->pMutex); if(pPort->tPortDefParams.eDir == OMX_DirInput) pBaseComInt->tCbInfo.EmptyBufferDone(hComponent, pComp->pApplicationPrivate, pBuffer); else if(pPort->tPortDefParams.eDir == OMX_DirOutput) pBaseComInt->tCbInfo.FillBufferDone(hComponent, pComp->pApplicationPrivate, pBuffer); TIMM_OSAL_MutexObtain(pBaseComPvt->pMutex, TIMM_OSAL_SUSPEND); } /* If port is tunneled,OpenMax components directly pass data buffers among * themselves without returning them to the IL Client, thus it calls * FillThisBuffer/EmptyThisBuffer on to the corresponding tunneled port */ else if (PORT_IS_TUNNEL(pPort) && !PORT_IS_BUFFER_SUPPLIER(pPort)) { TIMM_OSAL_MutexRelease(pBaseComPvt->pMutex); if (pPort->tPortDefParams.eDir == OMX_DirInput) { pBuffer->nOutputPortIndex = pPort->unTunnelPort; pBuffer->nInputPortIndex = pPort->tPortDefParams.nPortIndex; tError = ((OMX_COMPONENTTYPE*)(pPort->hTunnelComp))->FillThisBuffer( pPort->hTunnelComp, pBuffer); } else { pBuffer->nInputPortIndex = pPort->unTunnelPort; pBuffer->nOutputPortIndex = pPort->tPortDefParams.nPortIndex; tError = ((OMX_COMPONENTTYPE*)(pPort->hTunnelComp))->EmptyThisBuffer( pPort->hTunnelComp, pBuffer); } TIMM_OSAL_MutexObtain(pBaseComPvt->pMutex, TIMM_OSAL_SUSPEND); } /* Incase the port is Tunneled and buffer supplier, it calls FTB/ETB on the tunneled port , * but if the tunneled comp is not in executing state which results in * incorrect state operation then the buffer need to be returned to pipe which * will be processed once after the tunneled comp goes to exeucting state */ else if(PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort) && (pPort->bIsPortflushed==OMX_FALSE)) { TIMM_OSAL_MutexRelease(pBaseComPvt->pMutex); if(pPort->tPortDefParams.eDir == OMX_DirInput) { pBuffer->nOutputPortIndex = pPort->unTunnelPort; pBuffer->nInputPortIndex = pPort->tPortDefParams.nPortIndex; tError = ((OMX_COMPONENTTYPE*)(pPort->hTunnelComp))->FillThisBuffer( pPort->hTunnelComp, pBuffer); if(tError != OMX_ErrorNone) TIMM_OSAL_WriteToPipe((pPort->dataPipe), &pBuffer, sizeof(pBuffer), TIMM_OSAL_SUSPEND); } else { pBuffer->nInputPortIndex = pPort->unTunnelPort; pBuffer->nOutputPortIndex = pPort->tPortDefParams.nPortIndex; tError = ((OMX_COMPONENTTYPE*)(pPort->hTunnelComp))->EmptyThisBuffer( pPort->hTunnelComp, pBuffer); if(tError != OMX_ErrorNone) TIMM_OSAL_WriteToPipe((pPort->dataPipe), &pBuffer, sizeof(pBuffer), TIMM_OSAL_SUSPEND); } TIMM_OSAL_MutexObtain(pBaseComPvt->pMutex, TIMM_OSAL_SUSPEND); } TIMM_OSAL_MutexRelease(pBaseComPvt->pMutex); EXIT: OMX_BASE_Exiting(tError); return tError; }
TIMM_OSAL_ERRORTYPE CCommunicationChannelImplementation::WriteAssembledMsg(systemMessage_t* message) { //send message to internalMsgPipe return TIMM_OSAL_WriteToPipe(internalMsgPipe, message, sizeof(systemMessage_t), TIMM_OSAL_SUSPEND); }