OMX_ERRORTYPE StdCompCommonOther_ContainerDemuxerPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_TIME_CONFIG_TIMESTAMPTYPE sTimePosition; OMX_TIME_CONFIG_SEEKMODETYPE sTimeSeekMode; OMX_CONF_INIT_STRUCT(sTimePosition, OMX_TIME_CONFIG_TIMESTAMPTYPE); OMX_CONF_INIT_STRUCT(sTimeSeekMode, OMX_TIME_CONFIG_SEEKMODETYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Container Demuxer port %i common parameters\n", nPortIndex); /* Verify support for the common standard component port parameters. */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* There are no default values mentioned in the specification. Just verify the access at present. */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexConfigTimePosition\n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigTimePosition, (OMX_PTR)&sTimePosition, eError); // R/W OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexConfigTimeSeekMode \n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigTimeSeekMode, (OMX_PTR)&sTimeSeekMode, eError); // R/W OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdCompCommonImage_QcifPlusPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex, OMX_COLOR_FORMATTYPE eColorFormat) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_IMAGE_PARAM_PORTFORMATTYPE sPortFormat; OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_CONF_INIT_STRUCT(sPortFormat, OMX_IMAGE_PARAM_PORTFORMATTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying QCIF+ image port %i default parameters\n", nPortIndex); /* Verify support for the common standard component port parameters */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify default port definition settings */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support and default settings for QcifPlus port definition\n"); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); if ((sPortDefinition.eDomain != OMX_PortDomainImage) || (sPortDefinition.format.image.nFrameWidth != 176) || (sPortDefinition.format.image.nFrameHeight != 220) || (sPortDefinition.format.image.nStride != 352) || (sPortDefinition.format.image.nSliceHeight != 16) || (sPortDefinition.format.image.eCompressionFormat != OMX_IMAGE_CodingUnused) || (sPortDefinition.format.image.eColorFormat != eColorFormat)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eDomain = %d (OMX_PortDomainImage)\n", sPortDefinition.eDomain); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nFrameWidth = %d, nFrameHeight = %d\n", sPortDefinition.format.image.nFrameWidth, sPortDefinition.format.image.nFrameHeight); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nStride = %d, nSliceHeight = %d\n", sPortDefinition.format.image.nStride, sPortDefinition.format.image.nSliceHeight); /* Verify default settings for OMX_IndexParamImagePortFormat */ eError = StdCompCommonImage_PortFormatSupported(pCtx, nPortIndex, OMX_IMAGE_CodingUnused, eColorFormat); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eCompressionFormat = OMX_VIDEO_CodingUnused\n"); if (OMX_COLOR_FormatYUV420Planar == eColorFormat) OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eColorFormat = OMX_COLOR_FormatYUV420Planar\n"); else if (OMX_COLOR_Format16bitRGB565 == eColorFormat) OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eColorFormat = OMX_COLOR_Format16bitRGB565\n"); eError = StdCompCommonImage_IVRendererPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdCompCommonOther_OtherPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_OTHER_PARAM_PORTFORMATTYPE sPortFormat; OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_CONF_INIT_STRUCT(sPortFormat, OMX_OTHER_PARAM_PORTFORMATTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying OTHER port %i Default parameters\n", nPortIndex); /* Verify support for the common standard component port parameters. */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify Port Definition */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support and default settings for OMX_IndexParamPortDefinition\n"); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); if ((sPortDefinition.eDomain != OMX_PortDomainOther) || (sPortDefinition.format.other.eFormat != OMX_OTHER_FormatTime)) eError = OMX_ErrorBadParameter; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eDomain = %d (OMX_PortDomainOther)\n", sPortDefinition.eDomain); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eFormat = %d (OMX_OTHER_FormatTime)\n", sPortDefinition.format.other.eFormat); /* Verify support for OMX_IndexParamOtherPortFormat and verify that the port format is as expected. */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support and default settings for OMX_IndexParamOtherPortFormat\n"); sPortFormat.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamOtherPortFormat, (OMX_PTR) & sPortFormat); if (sPortFormat.eFormat != OMX_OTHER_FormatTime) eError = OMX_ErrorBadParameter; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eFormat = %d (OMX_OTHER_FormatTime)\n", sPortFormat.eFormat); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE ResourceExhaustionTest_AllocateAllBuffers(ResourceExhaustionTestContext *pCtxt) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDef; OMX_U32 i, j, k; OMX_BUFFERHEADERTYPE *pBufferHdr = NULL; BufferList *pBufferListObj; BufferList *pTemp; /* for all ports */ for (j = 0; j < NUM_DOMAINS; j++) { for (i = pCtxt->sPortParam[j].nStartPortNumber; i < pCtxt->sPortParam[j].nStartPortNumber + pCtxt->sPortParam[j].nPorts; i++) { OMX_CONF_INIT_STRUCT(sPortDef, OMX_PARAM_PORTDEFINITIONTYPE); sPortDef.nPortIndex = i; OMX_CONF_BAIL_IF_ERROR(OMX_GetParameter(pCtxt->hWComp[pCtxt->nInst], OMX_IndexParamPortDefinition, (OMX_PTR)&sPortDef)); if (sPortDef.nBufferCountActual == 0x0 || sPortDef.nBufferCountActual < sPortDef.nBufferCountMin) OMX_CONF_SET_ERROR_BAIL("Incorrect nBufferCountActual\n", OMX_ErrorUndefined); for (k = 0x0; k < sPortDef.nBufferCountActual; k++) { pBufferListObj = (BufferList *)OMX_OSAL_Malloc(sizeof(BufferList)); if (!pBufferListObj) { OMX_CONF_SET_ERROR_BAIL("Malloc internal list failed\n", OMX_ErrorInsufficientResources); } OMX_CONF_BAIL_IF_ERROR(OMX_AllocateBuffer(pCtxt->hWComp[pCtxt->nInst], &pBufferHdr, sPortDef.nPortIndex, 0, sPortDef.nBufferSize)); pBufferListObj->pNextBuf = NULL; pBufferListObj->pBufHdr = pBufferHdr; if (sPortDef.eDir == OMX_DirInput) pBufferListObj->pBufHdr->nOutputPortIndex = OMX_NOPORT; else pBufferListObj->pBufHdr->nInputPortIndex = OMX_NOPORT; if (pCtxt->pBufferList[pCtxt->nInst] == NULL) pCtxt->pBufferList[pCtxt->nInst] = pBufferListObj; else { pTemp = pCtxt->pBufferList[pCtxt->nInst]; while (pTemp->pNextBuf) { pTemp = pTemp->pNextBuf; } pTemp->pNextBuf = pBufferListObj; } } } } OMX_CONF_TEST_BAIL: return eError; }
static OMX_ERRORTYPE StdCompCommonImage_PortFormatSupported( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex, OMX_IMAGE_CODINGTYPE eCompressionFormat, OMX_COLOR_FORMATTYPE eColorFormat) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_IMAGE_PARAM_PORTFORMATTYPE sPortFormat; OMX_CONF_INIT_STRUCT(sPortFormat, OMX_IMAGE_PARAM_PORTFORMATTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying port format support\n"); sPortFormat.nPortIndex = nPortIndex; for (sPortFormat.nIndex = 0; ; sPortFormat.nIndex++) { eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamImagePortFormat, (OMX_PTR) & sPortFormat); if (OMX_ErrorNoMore == eError) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); if ((sPortFormat.eCompressionFormat == eCompressionFormat) && (sPortFormat.eColorFormat == eColorFormat)) break; } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdCompCommonImage_RawPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_IMAGE_PARAM_PORTFORMATTYPE sPortFormat; OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_CONF_INIT_STRUCT(sPortFormat, OMX_IMAGE_PARAM_PORTFORMATTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Raw Image port %i Default parameters\n", nPortIndex); /* Verify support for the common standard component port parameters */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify default port definition settings */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Raw port definition\n"); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); if ((sPortDefinition.eDomain != OMX_PortDomainImage) || (sPortDefinition.format.image.nFrameWidth != 640) || (sPortDefinition.format.image.nFrameHeight != 480) || (sPortDefinition.format.image.eCompressionFormat != OMX_IMAGE_CodingUnused) || (sPortDefinition.format.image.eColorFormat != OMX_COLOR_FormatYUV420Planar)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "eDomain = %d, nFrameWidth = %d, nFrameHeight = %d, " "eCompressionFormat= %d, eColorFormat = %d\n", sPortDefinition.eDomain, sPortDefinition.format.image.nFrameWidth, sPortDefinition.format.image.nFrameHeight, sPortDefinition.format.image.eCompressionFormat, sPortDefinition.format.image.eColorFormat); /* Verify default settings for OMX_IndexParamImagePortFormat */ eError = StdCompCommonImage_PortFormatSupported(pCtx, nPortIndex, OMX_IMAGE_CodingUnused, OMX_COLOR_FormatYUV420Planar); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eCompressionFormat = OMX_IMAGE_CodingUnused\n"); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eColorFormat = OMX_COLOR_FormatYUV420Planar\n"); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdContainerDemuxerTest_3GpDemuxer(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; OMX_PARAM_U32TYPE sTestParam; OMX_CONF_INIT_STRUCT(sTestParam, OMX_PARAM_U32TYPE); eError = StdComponentTest_SetRole(pCtx, "container_demuxer.3gp"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard 3GP Container Demuxer component, there must be at least one port each of the audio, video and other domains. */ if (pCtx->sPortParamAudio.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); if (pCtx->sPortParamVideo.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); if (pCtx->sPortParamOther.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = APB + 0; Output port, format? */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying PCM output port 0 \n"); nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + 0; if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonOther_ContainerDemuxerPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify addition APB+0 settings No defaults mentioned in the specification. Verify access. */ sTestParam.nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + 0; OMX_CONF_PARAM_REQUIREDGETSET(pCtx, OMX_IndexParamActiveStream, (OMX_PTR)&sTestParam, eError); OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_GetParameter(pCtx, OMX_IndexParamNumAvailableStreams, (OMX_PTR) & sTestParam); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = VPB + 0; output port, format? */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Raw video output port 0 \n"); nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 0; if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonOther_ContainerDemuxerPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify addition VPB+0 settings No defaults mentioned in the specification. Verify access. */ sTestParam.nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 0; OMX_CONF_PARAM_REQUIREDGETSET(pCtx, OMX_IndexParamActiveStream, (OMX_PTR)&sTestParam, eError); OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_GetParameter(pCtx, OMX_IndexParamNumAvailableStreams, (OMX_PTR) & sTestParam); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = OPB + 0; input port, OTHER format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying other (media time) input port 0 \n"); nPortIndex = pCtx->sPortParamOther.nStartPortNumber + 0; if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonOther_OtherPortParameters(pCtx, nPortIndex); eError = StdCompCommonOther_ContainerDemuxerPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_BufferTest(OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_ERRORTYPE eCleanupError = OMX_ErrorNone; TEST_CTXTYPE ctx; TEST_CTXTYPE *pCtx; OMX_HANDLETYPE hComp = 0x0; OMX_CALLBACKTYPE oCallbacks; OMX_HANDLETYPE hWrappedComp = 0x0; OMX_CALLBACKTYPE *pWrappedCallbacks; OMX_PTR pWrappedAppData; OMX_BOOL bTimeout; TEST_PORTTYPE *pPort; OMX_U32 i; OMX_U32 nPortIndex; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; oCallbacks.EventHandler = BufferTest_EventHandler; oCallbacks.EmptyBufferDone = StubbedEmptyBufferDone; oCallbacks.FillBufferDone = StubbedFillBufferDone; pCtx = &ctx; pCtx->hStateChangeEvent = 0x0; pCtx->hPortDisableEvent = 0x0; pCtx->hPortEnableEvent = 0x0; pCtx->hPortErrorEvent = 0x0; pCtx->aPorts = 0x0; pCtx->bRestartAllPorts = OMX_FALSE; pCtx->bStopAllPorts = OMX_FALSE; /* initialize events to track callbacks */ OMX_OSAL_EventCreate(&pCtx->hStateChangeEvent); OMX_OSAL_EventReset(pCtx->hStateChangeEvent); OMX_OSAL_EventCreate(&pCtx->hPortDisableEvent); OMX_OSAL_EventReset(pCtx->hPortDisableEvent); OMX_OSAL_EventCreate(&pCtx->hPortEnableEvent); OMX_OSAL_EventReset(pCtx->hPortEnableEvent); OMX_OSAL_EventCreate(&pCtx->hPortErrorEvent); OMX_OSAL_EventReset(pCtx->hPortErrorEvent); eError = OMX_CONF_CallbackTracerCreate(&oCallbacks, (OMX_PTR)pCtx, cComponentName, &pWrappedCallbacks, &pWrappedAppData); OMX_CONF_BAIL_ON_ERROR(eError); /* Initialize OpenMax */ eError = OMX_Init(); OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_GetHandle(&hComp, cComponentName, pWrappedAppData, pWrappedCallbacks); OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_CONF_ComponentTracerCreate(hComp, cComponentName, &hWrappedComp); OMX_CONF_BAIL_ON_ERROR(eError); pCtx->hWrappedComp = hWrappedComp; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected all port on component %s\n", cComponentName); /* inspect component's ports */ OMX_CONF_INIT_STRUCT(pCtx->sPortParam[0], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(hWrappedComp, OMX_IndexParamAudioInit, (OMX_PTR) & pCtx->sPortParam[0]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i audio ports starting at %i \n", pCtx->sPortParam[0].nPorts, pCtx->sPortParam[0].nStartPortNumber); /* detect all video ports on the component */ OMX_CONF_INIT_STRUCT(pCtx->sPortParam[1], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(hWrappedComp, OMX_IndexParamVideoInit, (OMX_PTR) & pCtx->sPortParam[1]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i video ports starting at %i \n", pCtx->sPortParam[1].nPorts, pCtx->sPortParam[1].nStartPortNumber); /* detect all image ports on the component */ OMX_CONF_INIT_STRUCT(pCtx->sPortParam[2], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(hWrappedComp, OMX_IndexParamImageInit, (OMX_PTR) & pCtx->sPortParam[2]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i image ports starting at %i \n", pCtx->sPortParam[2].nPorts, pCtx->sPortParam[2].nStartPortNumber); /* detect all other ports on the component */ OMX_CONF_INIT_STRUCT(pCtx->sPortParam[3], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(hWrappedComp, OMX_IndexParamOtherInit, (OMX_PTR) & pCtx->sPortParam[3]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i other ports starting at %i \n", pCtx->sPortParam[3].nPorts, pCtx->sPortParam[3].nStartPortNumber); /* record total number of ports and allocate port structures */ pCtx->nNumPorts = pCtx->sPortParam[0].nPorts + pCtx->sPortParam[1].nPorts + pCtx->sPortParam[2].nPorts + pCtx->sPortParam[3].nPorts; if (0x0 == pCtx->nNumPorts) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Component has no ports\n"); } /* allocate port structures */ eError = BufferTest_AllocatePortStructures(pCtx); OMX_CONF_BAIL_ON_ERROR(eError); /* transition component to idle, verifying that the component does not go to IDLE within a certain timeout */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command component to OMX_StateIdle\n"); OMX_OSAL_EventReset(pCtx->hStateChangeEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); /* allocate some buffers on the ports, vertifying the component does not transition to idle */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocate some buffers on all ports\n"); eError = BufferTest_AllocateAllButOne(pCtx); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimeout); if (OMX_FALSE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Unexpected state transition to OMX_StateIdle\n"); } /* allocate all buffers on the ports, vertifying the component does transition to idle */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocate remaining buffers on all ports\n"); eError = BufferTest_AllocateAllPlusOne(pCtx); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "State transition to OMX_StateIdle never occured\n"); } /* transition the component to from idle to loaded, verifying the component does not transition */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command component to OMX_StateLoaded\n"); OMX_OSAL_EventReset(pCtx->hStateChangeEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateLoaded, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); /* free some buffers */ eError = BufferTest_FreeAllButOne(pCtx); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimeout); if (OMX_FALSE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Unexpected state transition to OMX_StateLoaded\n"); } /* free all buffers and confirm component transitions to loaded */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Free buffers on all ports\n"); eError = BufferTest_FreeAll(pCtx); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Expected state transition to OMX_StateLoaded\n"); } /* stop all ports */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command all ports to disabled\n"); pCtx->bStopAllPorts = OMX_TRUE; pCtx->nNumPortsStopped = 0x0; OMX_OSAL_EventReset(pCtx->hPortDisableEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortDisable, OMX_ALL, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortDisableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "All ports not disabled\n"); } pCtx->bStopAllPorts = OMX_FALSE; /* set the component to idle */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command component to OMX_StateIdle\n"); OMX_OSAL_EventReset(pCtx->hStateChangeEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateIdle, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Expected state transition to OMX_StateIdle\n"); } pPort = pCtx->aPorts; for (i = 0; i < pCtx->nNumPorts; i++) { /* verify port enable and populated status */ nPortIndex = pPort->sPortDef.nPortIndex; OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); /* enable port, and verify it does not restart */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command port %i to enabled\n", nPortIndex); OMX_OSAL_EventReset(pCtx->hPortEnableEvent); pCtx->nRestartPort = nPortIndex; eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortEnable, nPortIndex, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortEnableEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimeout); if (OMX_FALSE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port enabled unexpectedly\n"); } /* verify port enabled, but not populated */ OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_TRUE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); /* allocate buffers on the port, and verify it restarts */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocate buffers on port %i\n", nPortIndex); eError = BufferTest_PortAllocateNumBuffers(pCtx, pPort, (pPort->sPortDef.nBufferCountActual)); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortEnableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port never enabled\n"); } /* verify port enabled and populated */ OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_TRUE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_TRUE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); /* stop port, verifying it does not stop */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command port %i to disabled\n", nPortIndex); OMX_OSAL_EventReset(pCtx->hPortDisableEvent); pCtx->nStopPort = nPortIndex; eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortDisable, nPortIndex, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortDisableEvent, OMX_CONF_TIMEOUT_EXPECTING_FAILURE, &bTimeout); if (OMX_FALSE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port disabled unexpectedly\n"); } /* free buffers on the port, verifying it stops */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Free buffers on port %i\n", nPortIndex); eError = BufferTest_PortFreeNumBuffers(pCtx, pPort, LIFO_INQUEUE(pPort->pLifo)); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortDisableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port never disabled\n"); } /* verify port not enabled, not populated */ OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); /* enable the port and allocate buffers */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command port %i to enabled\n", nPortIndex); OMX_OSAL_EventReset(pCtx->hPortEnableEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortEnable, nPortIndex, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocate buffers on port %i\n", nPortIndex); eError = BufferTest_PortAllocateNumBuffers(pCtx, pPort, (pPort->sPortDef.nBufferCountActual)); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortEnableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port never enabled\n"); } /* test the port errors when buffers are freed */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Free buffers on port %i\n", nPortIndex); OMX_OSAL_EventReset(pCtx->hPortErrorEvent); eError = BufferTest_PortFreeNumBuffers(pCtx, pPort, LIFO_INQUEUE(pPort->pLifo)); OMX_CONF_BAIL_ON_ERROR(eError); /* waiting for component to report error due to lost buffers */ OMX_OSAL_EventWait(pCtx->hPortErrorEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Component did not report OMX_ErrorPortUnpopulated\n"); } /* verify port enabled, but not populated */ OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_TRUE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); /* stop the port */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command port %i to disabled\n", nPortIndex); OMX_OSAL_EventReset(pCtx->hPortDisableEvent); pCtx->nStopPort = nPortIndex; eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortDisable, nPortIndex, 0x0); OMX_OSAL_EventWait(pCtx->hPortDisableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Port never disabled\n"); } /* verify port not enabled, but not populated */ OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bEnabled), "Incorrect value in PortDefinition bEnabled field\n"); OMX_CONF_ASSERT(eError, (OMX_FALSE == sPortDefinition.bPopulated), "Incorrect value in PortDefinition bPopulated field\n"); pPort++; } /* transition component from idle to loaded */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command component to OMX_StateLoaded\n"); OMX_OSAL_EventReset(pCtx->hStateChangeEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandStateSet, OMX_StateLoaded, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hStateChangeEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "Expected state transition to OMX_StateLoaded\n"); } /* restart all ports */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Command all ports to enable\n"); pCtx->bRestartAllPorts = OMX_TRUE; pCtx->nNumPortsRestarted = 0x0; OMX_OSAL_EventReset(pCtx->hPortEnableEvent); eError = OMX_SendCommand(hWrappedComp, OMX_CommandPortEnable, OMX_ALL, 0x0); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_EventWait(pCtx->hPortEnableEvent, OMX_CONF_TIMEOUT_EXPECTING_SUCCESS, &bTimeout); if (OMX_TRUE == bTimeout) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "All ports not enabled\n"); } pCtx->bRestartAllPorts = OMX_FALSE; OMX_CONF_TEST_BAIL: eCleanupError = BufferTest_FreePortStructures(pCtx); if (hWrappedComp) { OMX_CONF_ComponentTracerDestroy(hWrappedComp); } if (hComp) { if (OMX_ErrorNone == eCleanupError) { eCleanupError = OMX_FreeHandle(hComp); } else { OMX_FreeHandle(hComp); } } if (OMX_ErrorNone != eCleanupError) { OMX_Deinit(); } else { eCleanupError = OMX_Deinit(); } OMX_OSAL_EventDestroy(pCtx->hStateChangeEvent); OMX_OSAL_EventDestroy(pCtx->hPortDisableEvent); OMX_OSAL_EventDestroy(pCtx->hPortEnableEvent); OMX_OSAL_EventDestroy(pCtx->hPortErrorEvent); if (OMX_ErrorNone == eError) { /* if there were no failures during the test, report any errors found during cleanup */ eError = eCleanupError; } return(eError); }
OMX_ERRORTYPE BufferTest_AllocatePortStructures( TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_PORTTYPE *pPort; OMX_U32 nSize; OMX_U32 i, j; OMX_U32 nPortIndex; /* allocate port structures */ nSize = (sizeof(TEST_PORTTYPE) * pCtx->nNumPorts); pCtx->aPorts = (TEST_PORTTYPE*)OMX_OSAL_Malloc(nSize); if (0x0 == pCtx->aPorts) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "OMX_OSAL_Malloc failed\n"); } memset(pCtx->aPorts, 0x0, nSize); pPort = pCtx->aPorts; /* initialize port structures */ for (i = 0; i < NUM_DOMAINS; i++) { for (j = 0x0; j < pCtx->sPortParam[i].nPorts; j++) { nPortIndex = pCtx->sPortParam[i].nStartPortNumber + j; OMX_CONF_INIT_STRUCT(pPort->sPortDef, OMX_PARAM_PORTDEFINITIONTYPE); pPort->sPortDef.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & pPort->sPortDef); OMX_CONF_BAIL_ON_ERROR(eError); if (0x0 == pPort->sPortDef.nBufferCountMin) { /* a buffer count of 0x0 is not allowed */ OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "PortDefinition nBufferCountMin incorrect\n"); } if (pPort->sPortDef.nBufferCountMin > pPort->sPortDef.nBufferCountActual) { /* a buffer count of 0x0 is not allowed */ OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "PortDefinition nBufferCountActual incorrect\n"); } /* set the actual buffer count to min + 1 */ pPort->sPortDef.nBufferCountActual = pPort->sPortDef.nBufferCountMin + 1; /* set actual buffer count on the port */ eError = OMX_SetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & pPort->sPortDef); OMX_CONF_BAIL_ON_ERROR(eError); /* allocate LIFO with one more entry that the required minimum as the test will allocate 1 more than needed to exercise allocating buffers during the IDLE state */ LIFO_ALLOC(pPort->pLifo, (pPort->sPortDef.nBufferCountActual)); if (0x0 == pPort->pLifo) { OMX_CONF_SET_ERROR_BAIL(eError, OMX_ErrorUndefined, "memory allocation failure\n"); } pPort++; } } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE OMX_CONF_ResourceExhaustionTest(OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_CALLBACKTYPE oCallbacks; ResourceExhaustionTestContext oAppData; OMX_CALLBACKTYPE *pWrapCallbacks; OMX_PTR pWrapAppData; ResourceExhaustionTestContext *pCtxt; OMX_U32 i; pCtxt = &oAppData; memset(pCtxt, 0x0, sizeof(ResourceExhaustionTestContext)); oCallbacks.EventHandler = ResourceExhaustionTest_EventHandler; oCallbacks.EmptyBufferDone = StubbedEmptyBufferDone; oCallbacks.FillBufferDone = StubbedFillBufferDone; eError = OMX_CONF_CallbackTracerCreate(&oCallbacks, (OMX_PTR)pCtxt, cComponentName, &pWrapCallbacks, &pWrapAppData); OMX_OSAL_EventCreate(&pCtxt->hStateSetEvent); OMX_OSAL_EventReset(pCtxt->hStateSetEvent); /* Initialize OpenMax */ eError = OMX_Init(); OMX_CONF_BAIL_IF_ERROR(eError); eError = ResourceExhaustionTest_LOAD(pCtxt, cComponentName, pWrapAppData, pWrapCallbacks); OMX_CONF_BAIL_IF_ERROR(eError); /* detect all audio ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[0], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp[pCtxt->nInst], OMX_IndexParamAudioInit, (OMX_PTR) & pCtxt->sPortParam[0]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i audio ports starting at %i \n", pCtxt->sPortParam[0].nPorts, pCtxt->sPortParam[0].nStartPortNumber); /* detect all video ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[1], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp[pCtxt->nInst], OMX_IndexParamVideoInit, (OMX_PTR) & pCtxt->sPortParam[1]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i video ports starting at %i \n", pCtxt->sPortParam[1].nPorts, pCtxt->sPortParam[1].nStartPortNumber); /* detect all image ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[2], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp[pCtxt->nInst], OMX_IndexParamImageInit, (OMX_PTR) & pCtxt->sPortParam[2]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i image ports starting at %i \n", pCtxt->sPortParam[2].nPorts, pCtxt->sPortParam[2].nStartPortNumber); /* detect all other ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[3], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp[pCtxt->nInst], OMX_IndexParamOtherInit, (OMX_PTR) & pCtxt->sPortParam[3]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i other ports starting at %i \n", pCtxt->sPortParam[3].nPorts, pCtxt->sPortParam[3].nStartPortNumber); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateIdle)); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Repeatedly load and idle component\n"); /* JVW-NVIDIA: set bound to MAX_INSTANCE-1 http://cvs.khronos.org/bugzilla/show_bug.cgi?id=219 */ while (pCtxt->nInst++ < MAX_INSTANCE - 1) { eError = ResourceExhaustionTest_LOAD(pCtxt, cComponentName, pWrapAppData, pWrapCallbacks); if (eError != OMX_ErrorNone) break; eError = ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateIdle); if (eError != OMX_ErrorNone) break; } if (eError == OMX_ErrorInsufficientResources) eError = OMX_ErrorNone; if (pCtxt->nInst == MAX_INSTANCE) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Resources not exhausted - increase max instance\n"); eError = OMX_ErrorUndefined; } OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Resources exhausted by instance %d\n", pCtxt->nInst); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Alternatively de-allocate/allocate last 2 instances\n"); for (i = 0x0; i < MAX_ITERATIONS; i++) { /* Unload last successfully idled instance */ pCtxt->nInst--; OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateLoaded)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_UNLOAD(pCtxt)); /* Load last failing instance */ pCtxt->nInst++; OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_UNLOAD(pCtxt)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_LOAD(pCtxt, cComponentName, pWrapAppData, pWrapCallbacks)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateIdle)); /* Unload last successfully idled instance */ OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateLoaded)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_UNLOAD(pCtxt)); /* Load last failing instance */ pCtxt->nInst--; OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_LOAD(pCtxt, cComponentName, pWrapAppData, pWrapCallbacks)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateIdle)); pCtxt->nInst++; } OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "De-allocate all instances\n"); while (pCtxt->nInst--) { OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateLoaded)); OMX_CONF_BAIL_IF_ERROR(ResourceExhaustionTest_UNLOAD(pCtxt)); } OMX_CONF_TEST_BAIL: /* cleanup: return function errors rather than closing errors if appropriate */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Cleanup\n"); if (OMX_ErrorNone == eError) { eError = OMX_CONF_CallbackTracerDestroy(pWrapCallbacks, pWrapAppData); eError = OMX_Deinit(); } else { do { if (pCtxt->hWComp[pCtxt->nInst]) { ResourceExhaustionTest_TransitionWait(pCtxt, OMX_StateInvalid); ResourceExhaustionTest_DeInitBuffer(pCtxt); ResourceExhaustionTest_UNLOAD(pCtxt); } } while (pCtxt->nInst--); OMX_CONF_CallbackTracerDestroy(pWrapCallbacks, pWrapAppData); OMX_Deinit(); } OMX_OSAL_EventDestroy(pCtxt->hStateSetEvent); return eError; }
OMX_ERRORTYPE base_camera_video_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput) { omx_base_camera_video_PortType *omx_base_video_Port; if(!(*openmaxStandPort)) { OMXDBUG(OMXDBUG_ERR, "Input openmaxStandPort is NULL!\n"); *openmaxStandPort = calloc(1, sizeof(omx_base_camera_video_PortType)); } if(!(*openmaxStandPort)) { return OMX_ErrorInsufficientResources; } base_video_port_Constructor(openmaxStandComp, openmaxStandPort, nPortIndex, isInput); omx_base_video_Port = (omx_base_camera_video_PortType *)*openmaxStandPort; omx_base_video_Port->nSensorSelect = -1; omx_base_video_Port->isCapture = OMX_FALSE; omx_base_video_Port->bCapturePause = OMX_FALSE; omx_base_video_Port->pCapMode = calloc(1, sizeof(OMX_CONFIG_CAPTUREMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapMode, OMX_CONFIG_CAPTUREMODETYPE); omx_base_video_Port->pCapMode->nPortIndex = nPortIndex; omx_base_video_Port->pCapMode->bContinuous = OMX_FALSE; omx_base_video_Port->pCapMode->bFrameLimited = OMX_FALSE; omx_base_video_Port->pCapMode->nFrameLimit = 0; omx_base_video_Port->pCapExtMode = calloc(1, sizeof(OMX_CONFIG_EXTCAPTUREMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapExtMode, OMX_CONFIG_EXTCAPTUREMODETYPE); omx_base_video_Port->pCapExtMode->nPortIndex = nPortIndex; omx_base_video_Port->pCapExtMode->nFrameBefore = 0; omx_base_video_Port->pCapExtMode->bPrepareCapture = OMX_FALSE; /* Banding Config, default Auto */ omx_base_video_Port->pFlicktype = calloc(1, sizeof(OMX_CONFIG_FLICKERREJECTIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFlicktype, OMX_CONFIG_FLICKERREJECTIONTYPE); omx_base_video_Port->pFlicktype->nPortIndex = nPortIndex; omx_base_video_Port->pFlicktype->eFlickerRejection = OMX_FlickerRejectionAuto; /* Noise reduce, default as closed */ omx_base_video_Port->pNs_level = calloc(1, sizeof(OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pNs_level, OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE); omx_base_video_Port->pNs_level->nPortIndex = nPortIndex; omx_base_video_Port->pNs_level->bAuto = OMX_FALSE; omx_base_video_Port->pNs_level->nLevel = 0; /* Sharpness enhance,only supoort one level */ omx_base_video_Port->pSharp_level = calloc(1, sizeof(OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSharp_level, OMX_IMAGE_CONFIG_PROCESSINGLEVELTYPE); omx_base_video_Port->pSharp_level->nPortIndex = nPortIndex; omx_base_video_Port->pNs_level->bAuto = OMX_FALSE; omx_base_video_Port->pNs_level->nLevel = 0; omx_base_video_Port->pAF_Dis = calloc(1, sizeof(OMX_ACT_CONFIG_FOCUSDISTANCETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAF_Dis, OMX_ACT_CONFIG_FOCUSDISTANCETYPE); omx_base_video_Port->pAF_Dis->nPortIndex = nPortIndex; //Gamma Table,Default is 2.2 omx_base_video_Port->pGamma = calloc(1, sizeof(OMX_CONFIG_GAMMATYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pGamma, OMX_CONFIG_GAMMATYPE); omx_base_video_Port->pGamma->nPortIndex = nPortIndex; omx_base_video_Port->pGamma->nGamma = (22 * (1 << 16)) / 10; omx_base_video_Port->pBlitComp = calloc(1, sizeof(OMX_ACT_CONFIG_BLITCOMPENSATIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pBlitComp, OMX_ACT_CONFIG_BLITCOMPENSATIONTYPE); omx_base_video_Port->pBlitComp->nPortIndex = nPortIndex; omx_base_video_Port->pBlitComp->eControl = OMX_ACT_BceModeOff; //omx_base_video_Port->pCapMode = calloc(1,sizeof(OMX_CONFIG_CAPTUREMODETYPE)); //OMX_CONF_INIT_STRUCT(omx_base_video_Port->pCapMode,OMX_CONFIG_CAPTUREMODETYPE); //omx_base_video_Port->pCapMode->nPortIndex = nPortIndex; //omx_base_video_Port->pCapMode->bContinuous = OMX_FALSE; //omx_base_video_Port->pCapMode->bFrameLimited = OMX_FALSE; omx_base_video_Port->pFlashType = calloc(1, sizeof(OMX_IMAGE_PARAM_FLASHCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFlashType, OMX_IMAGE_PARAM_FLASHCONTROLTYPE); omx_base_video_Port->pFlashType->nPortIndex = nPortIndex; omx_base_video_Port->pFlashType->eFlashControl = OMX_IMAGE_FlashControlOff; omx_base_video_Port->pFocusType = calloc(1, sizeof(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pFocusType, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE); omx_base_video_Port->pFocusType->nPortIndex = nPortIndex; omx_base_video_Port->pFocusType->eFocusControl = OMX_IMAGE_FocusControlOff;//Control by user only when nFocusSteps > 0 omx_base_video_Port->pSensorMode = calloc(1, sizeof(OMX_PARAM_SENSORMODETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSensorMode, OMX_PARAM_SENSORMODETYPE); omx_base_video_Port->pSensorMode->nPortIndex = nPortIndex; omx_base_video_Port->pSensorMode->nFrameRate = DEFAULT_FPS; omx_base_video_Port->pSensorMode->bOneShot = OMX_FALSE;//Default is Video Mode omx_base_video_Port->pSensorMode->sFrameSize.nSize = sizeof(OMX_FRAMESIZETYPE); omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nVersionMajor = 1; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nVersionMinor = 1; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nRevision = 0; omx_base_video_Port->pSensorMode->sFrameSize.nVersion.s.nStep = 0; omx_base_video_Port->pSensorMode->sFrameSize.nPortIndex = nPortIndex; omx_base_video_Port->pSensorMode->sFrameSize.nWidth = DEFAULT_WIDTH; omx_base_video_Port->pSensorMode->sFrameSize.nHeight = DEFAULT_HEIGHT; omx_base_video_Port->pColorFix = calloc(1, sizeof(OMX_CONFIG_COLORCONVERSIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pColorFix, OMX_CONFIG_COLORCONVERSIONTYPE); omx_base_video_Port->pColorFix->nPortIndex = nPortIndex; omx_base_video_Port->pColorFix->xColorMatrix[0][0] = 257 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[0][1] = 504 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[0][2] = 98 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][0] = -148 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][1] = -291 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[1][2] = 439 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][0] = 439 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][1] = -368 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorMatrix[2][2] = -71 * (1 << 16) / 1000; omx_base_video_Port->pColorFix->xColorOffset[0] = 16 * (1 << 16); omx_base_video_Port->pColorFix->xColorOffset[1] = 128 * (1 << 16); omx_base_video_Port->pColorFix->xColorOffset[2] = 128 * (1 << 16); omx_base_video_Port->pColorEft = calloc(1, sizeof(OMX_CONFIG_COLORENHANCEMENTTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pColorEft, OMX_CONFIG_COLORENHANCEMENTTYPE); omx_base_video_Port->pColorEft->bColorEnhancement = OMX_FALSE; omx_base_video_Port->pImageFilter = calloc(1, sizeof(OMX_CONFIG_IMAGEFILTERTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pImageFilter, OMX_CONFIG_IMAGEFILTERTYPE); omx_base_video_Port->pImageFilter->nPortIndex = nPortIndex; omx_base_video_Port->pImageFilter->eImageFilter = OMX_ImageFilterNone; omx_base_video_Port->pImageMirror = calloc(1, sizeof(OMX_CONFIG_MIRRORTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pImageMirror, OMX_CONFIG_MIRRORTYPE); omx_base_video_Port->pImageMirror->nPortIndex = nPortIndex; omx_base_video_Port->pImageMirror->eMirror = OMX_MirrorNone; omx_base_video_Port->pOpticZoomType = calloc(1, sizeof(OMX_CONFIG_SCALEFACTORTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pOpticZoomType, OMX_CONFIG_SCALEFACTORTYPE); omx_base_video_Port->pOpticZoomType->nPortIndex = nPortIndex; omx_base_video_Port->pOpticZoomType->xWidth = 0;//Not Used omx_base_video_Port->pOpticZoomType->xHeight = 0; omx_base_video_Port->pWBType = calloc(1, sizeof(OMX_CONFIG_WHITEBALCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pWBType, OMX_CONFIG_WHITEBALCONTROLTYPE); omx_base_video_Port->pWBType->nPortIndex = nPortIndex; omx_base_video_Port->pWBType->eWhiteBalControl = OMX_WhiteBalControlAuto; omx_base_video_Port->pExpType = calloc(1, sizeof(OMX_CONFIG_EXPOSURECONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pExpType, OMX_CONFIG_EXPOSURECONTROLTYPE); omx_base_video_Port->pExpType->nPortIndex = nPortIndex; omx_base_video_Port->pExpType->eExposureControl = OMX_ExposureControlAuto; omx_base_video_Port->pContrast = calloc(1, sizeof(OMX_CONFIG_CONTRASTTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pContrast, OMX_CONFIG_CONTRASTTYPE); omx_base_video_Port->pContrast->nPortIndex = nPortIndex; omx_base_video_Port->pContrast->nContrast = 0; omx_base_video_Port->pBright = calloc(1, sizeof(OMX_CONFIG_BRIGHTNESSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pBright, OMX_CONFIG_BRIGHTNESSTYPE); omx_base_video_Port->pBright->nPortIndex = nPortIndex; omx_base_video_Port->pBright->nBrightness = 0; omx_base_video_Port->pSat = calloc(1, sizeof(OMX_CONFIG_SATURATIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pSat, OMX_CONFIG_SATURATIONTYPE); omx_base_video_Port->pSat->nPortIndex = nPortIndex; omx_base_video_Port->pSat->nSaturation = 0; omx_base_video_Port->pExpVal = calloc(1, sizeof(OMX_CONFIG_EXPOSUREVALUETYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pExpVal, OMX_CONFIG_EXPOSUREVALUETYPE); omx_base_video_Port->pExpVal->nPortIndex = nPortIndex; omx_base_video_Port->pExpVal->eMetering = OMX_MeteringModeAverage; omx_base_video_Port->pHdrParam = calloc(1, sizeof(OMX_ACT_CONFIG_HDR_EVParams)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pHdrParam, OMX_ACT_CONFIG_HDR_EVParams); omx_base_video_Port->pExpVal->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegionL = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFRegionL, OMX_CONFIG_FOCUSREGIONTYPE); omx_base_video_Port->pAFRegionL->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegionL->bCenter = OMX_FALSE; omx_base_video_Port->pAFRegionL->bLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bRight = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTop = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottom = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTopLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bTopRight = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottomLeft = OMX_FALSE; omx_base_video_Port->pAFRegionL->bBottomRight = OMX_FALSE; omx_base_video_Port->pAFStatusL = calloc(1, sizeof(OMX_PARAM_FOCUSSTATUSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFStatusL, OMX_PARAM_FOCUSSTATUSTYPE); omx_base_video_Port->pAFStatusL->eFocusStatus = OMX_FocusStatusOff; omx_base_video_Port->pAFStatusL->bCenterStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bRightStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bTopRightStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomLeftStatus = OMX_FALSE; omx_base_video_Port->pAFStatusL->bBottomRightStatus = OMX_FALSE; omx_base_video_Port->pAFRegion = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONCONTROLTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFRegion, OMX_CONFIG_FOCUSREGIONCONTROLTYPE); //omx_base_video_Port->pAFRegion->nPortIndex = nPortIndex; omx_base_video_Port->pAFRegion->nFAreas = 1; omx_base_video_Port->pAFRegion->eFocusRegionsControl = OMX_FocusRegionControlAuto; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectX = DEFAULT_WIDTH / 2 - 32; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectY = DEFAULT_HEIGHT / 2 - 32; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectWidth = 64; omx_base_video_Port->pAFRegion->sManualFRegions[0].nRectHeight = 64; omx_base_video_Port->pAFStatus = calloc(1, sizeof(OMX_CONFIG_FOCUSREGIONSTATUSTYPE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->pAFStatus, OMX_CONFIG_FOCUSREGIONSTATUSTYPE); omx_base_video_Port->pAFStatus->bFocused = OMX_FALSE; omx_base_video_Port->pAFStatus->nMaxFAreas = 1; omx_base_video_Port->pAFStatus->nFAreas = 1; omx_base_video_Port->pAFStatus->sFROIs[0].nRectX = DEFAULT_WIDTH / 2 - 32; omx_base_video_Port->pAFStatus->sFROIs[0].nRectY = DEFAULT_HEIGHT / 2 - 32; omx_base_video_Port->pAFStatus->sFROIs[0].nRectWidth = 64; omx_base_video_Port->pAFStatus->sFROIs[0].nRectHeight = 64; omx_base_video_Port->pAFStatus->sFROIs[0].xFocusDistance = 0; omx_base_video_Port->pAFStatus->sFROIs[0].eFocusStatus = OMX_FocusStatusOff; omx_base_video_Port->act_agc = calloc(1, sizeof(OMX_ACT_CONFIG_AGCVALUE)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->act_agc, OMX_ACT_CONFIG_AGCVALUE); omx_base_video_Port->act_agc->nPortIndex = 0; omx_base_video_Port->act_flashstrobe = calloc(1, sizeof(OMX_ACT_CONFIG_FlashStrobeParams)); OMX_CONF_INIT_STRUCT(omx_base_video_Port->act_flashstrobe, OMX_ACT_CONFIG_FlashStrobeParams); omx_base_video_Port->act_flashstrobe->nPortIndex = 0; omx_base_video_Port->queue_dq = calloc(1, sizeof(queue_t)); queue_init(omx_base_video_Port->queue_dq); if(isInput == OMX_FALSE && nPortIndex == 0) { //OUTPUT setHeader(&omx_base_video_Port->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); omx_base_video_Port->sVideoParam.nPortIndex = nPortIndex; omx_base_video_Port->sVideoParam.nIndex = 0; omx_base_video_Port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sVideoParam.xFramerate = (25 << 16); omx_base_video_Port->sPortParam.eDomain = OMX_PortDomainVideo; #ifndef _OPENMAX_V1_2_ omx_base_video_Port->sPortParam.format.video.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); strcpy(omx_base_video_Port->sPortParam.format.video.cMIMEType, "video/camera"); #endif omx_base_video_Port->sPortParam.format.video.pNativeRender = 0; omx_base_video_Port->sPortParam.format.video.bFlagErrorConcealment = OMX_FALSE; omx_base_video_Port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sPortParam.format.video.nFrameWidth = 0; omx_base_video_Port->sPortParam.format.video.nFrameHeight = 0; omx_base_video_Port->sPortParam.format.video.nStride = 0; omx_base_video_Port->sPortParam.format.video.nSliceHeight = 0; omx_base_video_Port->sPortParam.format.video.nBitrate = 0; omx_base_video_Port->sPortParam.format.video.xFramerate = (25 << 16); omx_base_video_Port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.format.video.pNativeWindow = NULL; //Video Capture omx_base_video_Port->sPortParam.nBufferCountMin = 6; omx_base_video_Port->sPortParam.nBufferCountActual = 6; } else if(isInput == OMX_FALSE && nPortIndex == 1) { //OUTPUT omx_base_video_Port->pSensorMode->bOneShot = OMX_TRUE;//Default is Video Mode setHeader(&omx_base_video_Port->sImageParam, sizeof(OMX_IMAGE_PARAM_PORTFORMATTYPE)); omx_base_video_Port->sImageParam.nPortIndex = nPortIndex; omx_base_video_Port->sImageParam.nIndex = 0; omx_base_video_Port->sImageParam.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sImageParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.eDomain = OMX_PortDomainImage; #ifndef _OPENMAX_V1_2_ if(omx_base_video_Port->sPortParam.format.video.cMIMEType) { free(omx_base_video_Port->sPortParam.format.video.cMIMEType); omx_base_video_Port->sPortParam.format.video.cMIMEType = NULL; } omx_base_video_Port->sPortParam.format.image.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH); strcpy(omx_base_video_Port->sPortParam.format.image.cMIMEType, "video/camera"); #endif omx_base_video_Port->sPortParam.format.image.pNativeRender = 0; omx_base_video_Port->sPortParam.format.image.bFlagErrorConcealment = OMX_FALSE; omx_base_video_Port->sPortParam.format.image.eCompressionFormat = OMX_VIDEO_CodingUnused; omx_base_video_Port->sPortParam.format.image.nFrameWidth = 0; omx_base_video_Port->sPortParam.format.image.nFrameHeight = 0; omx_base_video_Port->sPortParam.format.image.nStride = 0; omx_base_video_Port->sPortParam.format.image.nSliceHeight = 0; omx_base_video_Port->sPortParam.format.image.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar; omx_base_video_Port->sPortParam.format.image.pNativeWindow = NULL; //Image Capture omx_base_video_Port->sPortParam.nBufferCountMin = 2; omx_base_video_Port->sPortParam.nBufferCountActual = 2; } omx_base_video_Port->pBufferHeadAct = NULL; //Module_Cap_Init(omx_base_video_Port,nPortIndex); omx_base_video_Port->omx_camera = calloc(1, sizeof(OMX_CAMERATYPE)); omx_base_video_Port->omx_camera->nSize = sizeof(OMX_CAMERATYPE); omx_base_video_Port->omx_camera->pApplicationPrivate = (void *)omx_base_video_Port; omx_base_video_Port->omx_camera->pIppHnale = omx_base_video_Port->device_handle; omx_base_video_Port->sPortParam.nBufferSize = DEFAULT_WIDTH * DEFAULT_HEIGHT * 3 / 2 + 4096; omx_base_video_Port->PortDestructor = &camera_video_port_Destructor; omx_base_video_Port->Port_AllocateBuffer = &camera_video_port_AllocateBuffer; omx_base_video_Port->Port_UseBuffer = &camera_video_port_UseBuffer; omx_base_video_Port->Port_FreeBuffer = &camera_video_port_FreeBuffer; return OMX_ErrorNone; }
OMX_ERRORTYPE StdCompCommonImage_IVRendererPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_U32 i; OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_CONFIG_ROTATIONTYPE sRotation; OMX_CONFIG_MIRRORTYPE sMirror; OMX_CONFIG_SCALEFACTORTYPE sScale; OMX_CONFIG_RECTTYPE sRect; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_CONF_INIT_STRUCT(sRotation, OMX_CONFIG_ROTATIONTYPE); OMX_CONF_INIT_STRUCT(sMirror, OMX_CONFIG_MIRRORTYPE); OMX_CONF_INIT_STRUCT(sScale, OMX_CONFIG_SCALEFACTORTYPE); OMX_CONF_INIT_STRUCT(sRect, OMX_CONFIG_RECTTYPE); OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying common image renderer input port parameters\n"); /* Verify support for OMX_IndexConfigCommonRotate */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying default setting for OMX_IndexConfigCommonRotate\n"); sRotation.nPortIndex = nPortIndex; eError = OMX_GetConfig(pCtx->hWrappedComp, OMX_IndexConfigCommonRotate, (OMX_PTR) & sRotation); if (sRotation.nRotation != 0) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "nRotation = %d\n", sRotation.nRotation); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for other values of OMX_IndexConfigCommonRotate\n"); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonRotate, (OMX_PTR)&sRotation, sRotation.nRotation, 90, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d\n", sRotation.nRotation); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonRotate, (OMX_PTR)&sRotation, sRotation.nRotation, 180, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d\n", sRotation.nRotation); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonRotate, (OMX_PTR)&sRotation, sRotation.nRotation, 270, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d\n", sRotation.nRotation); /* Verify support for OMX_IndexConfigCommonMirror */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying default setting for OMX_IndexConfigCommonMirror\n"); sMirror.nPortIndex = nPortIndex; eError = OMX_GetConfig(pCtx->hWrappedComp, OMX_IndexConfigCommonMirror, (OMX_PTR) & sMirror); if (sMirror.eMirror != OMX_MirrorNone) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d (OMX_MirrorNone)\n", sMirror.eMirror); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for other values of OMX_IndexConfigCommonMirror\n"); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonMirror, (OMX_PTR)&sMirror, sMirror.eMirror, OMX_MirrorVertical, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d (OMX_MirrorVertical)\n", sMirror.eMirror); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonMirror, (OMX_PTR)&sMirror, sMirror.eMirror, OMX_MirrorHorizontal, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d (OMX_MirrorHorizontal)\n", sMirror.eMirror); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonMirror, (OMX_PTR)&sMirror, sMirror.eMirror, OMX_MirrorBoth, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " %d (OMX_MirrorBoth)\n", sMirror.eMirror); /* Verify support for OMX_IndexConfigCommonScale */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying settings for OMX_IndexConfigCommonScale\n"); sScale.nPortIndex = nPortIndex; OMX_CONF_CONFIG_READ_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonScale, (OMX_PTR)&sScale, sScale.xWidth, (1 << 15), 0, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " xWidth = ox%x (1 << 15)\n", sScale.xWidth); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonScale, (OMX_PTR)&sScale, sScale.xHeight, (1 << 15), eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " xHeight = ox%x (1 << 15)\n", sScale.xHeight); /* Get frame width and height */ sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); /* Verify support for OMX_IndexConfigCommonInputCrop */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying default settings for OMX_IndexConfigCommonInputCrop\n"); sRect.nPortIndex = nPortIndex; eError = OMX_GetConfig(pCtx->hWrappedComp, OMX_IndexConfigCommonInputCrop, (OMX_PTR) & sRect); if ((sRect.nLeft != 0) || (sRect.nTop != 0) || (sRect.nWidth != sPortDefinition.format.image.nFrameWidth) || (sRect.nHeight != sPortDefinition.format.image.nFrameHeight)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying other settings for OMX_IndexConfigCommonInputCrop\n"); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonInputCrop, (OMX_PTR)&sRect, sRect.nLeft, 1, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nLeft = %d\n", sRect.nLeft); OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonInputCrop, (OMX_PTR)&sRect, sRect.nTop, 1, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nTop = %d\n", sRect.nTop); i = sRect.nWidth >> 1; OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonInputCrop, (OMX_PTR)&sRect, sRect.nWidth, i, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nWidth/2 = %d\n", sRect.nWidth); i = sRect.nHeight >> 1; OMX_CONF_CONFIG_WRITE_VERIFY(pCtx, OMX_IndexConfigCommonInputCrop, (OMX_PTR)&sRect, sRect.nHeight, i, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " nHeight/2 = %d\n", sRect.nHeight); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE PortCommTest_OperateOnPorts(PortCommTestCtxt* pContext, PortOpType eOp) { OMX_PARAM_PORTDEFINITIONTYPE sPortDef; OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 i, j; OMX_BUFFERHEADERTYPE sBufHdr; for (j = 0; j < NUM_DOMAINS; j++) { for (i = pContext->sPortParam[j].nStartPortNumber; i < pContext->sPortParam[j].nStartPortNumber + pContext->sPortParam[j].nPorts; i++) { OMX_CONF_INIT_STRUCT(sPortDef, OMX_PARAM_PORTDEFINITIONTYPE); sPortDef.nPortIndex = i; OMX_CONF_BAIL_IF_ERROR(OMX_GetParameter(pContext->hWComp, OMX_IndexParamPortDefinition , (OMX_PTR)&sPortDef)); switch (eOp) { case AllocBuf: if (0x0 == sPortDef.nBufferCountMin || sPortDef.nBufferCountMin > sPortDef.nBufferCountActual) { OMX_CONF_SET_ERROR_BAIL("PortDefinition nBufferCount incorrect\n", OMX_ErrorUndefined); } OMX_CONF_BAIL_IF_ERROR(PortCommTest_AllocateBuffers(pContext, &sPortDef)); break; case NonTunnelTest: if (sPortDef.eDir == OMX_DirInput) { eError = OMX_SetupTunnel(NULL, 0, pContext->hWComp, sPortDef.nPortIndex); OMX_CONF_ErrorToString(eError, szDesc); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Setup tunnel reported error code %s\n", szDesc); } else { eError = OMX_SetupTunnel(pContext->hWComp, sPortDef.nPortIndex, NULL, 0); OMX_CONF_ErrorToString(eError, szDesc); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Setup tunnel reported error code %s\n", szDesc); } eError = OMX_ErrorNone; break; case OpenFile: /* set buffercount actual */ if (0x0 == sPortDef.nBufferCountMin || sPortDef.nBufferCountMin > sPortDef.nBufferCountActual) { OMX_CONF_SET_ERROR_BAIL("PortDefinition nBufferCount incorrect\n", OMX_ErrorUndefined); } sPortDef.nBufferCountActual = sPortDef.nBufferCountMin + 1; OMX_CONF_BAIL_IF_ERROR(OMX_SetParameter(pContext->hWComp, OMX_IndexParamPortDefinition, (OMX_PTR)&sPortDef)); /* open files for input ports */ if (sPortDef.eDir == OMX_DirInput) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Opened input file for port %d\n", i); OMX_CONF_BAIL_IF_ERROR(OMX_OSAL_OpenInputFile(i)); } break; case CloseFile: if (sPortDef.eDir == OMX_DirInput) { OMX_CONF_BAIL_IF_ERROR(OMX_OSAL_CloseInputFile(i)); } break; case EmptyFill: OMX_CONF_INIT_STRUCT(sBufHdr, OMX_BUFFERHEADERTYPE); if (sPortDef.eDir == OMX_DirInput) { sBufHdr.nInputPortIndex = i; eError = OMX_EmptyThisBuffer(pContext->hWComp, &sBufHdr); } else { sBufHdr.nOutputPortIndex = i; eError = OMX_FillThisBuffer(pContext->hWComp, &sBufHdr); } if (eError != OMX_ErrorIncorrectStateOperation) OMX_CONF_SET_ERROR_BAIL("Buffer handling while stopped\n", OMX_ErrorUndefined); eError = OMX_ErrorNone; break; default: eError = OMX_ErrorBadParameter; } } } OMX_CONF_TEST_BAIL: return eError; }
OMX_ERRORTYPE StdCompCommonOther_YuvCameraPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_VIDEO_PARAM_PORTFORMATTYPE sPortFormat; OMX_PARAM_SENSORMODETYPE sSensorMode; //OMX_IndexParamCommonSensorMode OMX_CONFIG_WHITEBALCONTROLTYPE sWhiteBalance; //OMX_IndexConfigCommonWhiteBalance OMX_CONFIG_SCALEFACTORTYPE sScaleFactor; //OMX_IndexConfigCommonDigitalZoom // OMX_CONFIG_EVCOMPENSATIONTYPE sEvComp; //OMX_IndexConfigCommonEVCompensation OMX_CONFIG_BOOLEANTYPE sConfigCapturing; // OMX_IndexConfigCapturing OMX_CONFIG_BOOLEANTYPE sAutoPauseCapture; //OMX_IndexConfigAutoPauseAfterCapture OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_CONF_INIT_STRUCT(sPortFormat, OMX_VIDEO_PARAM_PORTFORMATTYPE); OMX_CONF_INIT_STRUCT(sSensorMode, OMX_PARAM_SENSORMODETYPE); OMX_CONF_INIT_STRUCT(sWhiteBalance, OMX_CONFIG_WHITEBALCONTROLTYPE); OMX_CONF_INIT_STRUCT(sScaleFactor, OMX_CONFIG_SCALEFACTORTYPE); //OMX_CONF_INIT_STRUCT(sEvComp, OMX_CONFIG_EVCOMPENSATIONTYPE); OMX_CONF_INIT_STRUCT(sConfigCapturing, OMX_CONFIG_BOOLEANTYPE); OMX_CONF_INIT_STRUCT(sAutoPauseCapture, OMX_CONFIG_BOOLEANTYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Camera port %i Default parameters\n", nPortIndex); /* There are no default values specified for most of the above. Just verify access for now. */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexParamCommonSensorMode\n"); OMX_CONF_PARAM_REQUIREDGETSET(pCtx, OMX_IndexParamCommonSensorMode, (OMX_PTR)&sSensorMode, eError); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexConfigCommonWhiteBalance\n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigCommonWhiteBalance, (OMX_PTR)&sWhiteBalance, eError); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexConfigCommonDigitalZoom\n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigCommonDigitalZoom, (OMX_PTR)&sScaleFactor, eError); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexConfigCapturing\n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigCapturing, (OMX_PTR)&sConfigCapturing, eError); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support for OMX_IndexAutoPauseAfterCapture\n"); OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexAutoPauseAfterCapture, (OMX_PTR)&sAutoPauseCapture, eError); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify support for the common standard component port parameters. */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify Port Definition */ sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); /* Verify support for OMX_IndexParamVideoPortFormat and verify that the port format is as expected. */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying support and defaults for OMX_IndexParamVideoPortFormat\n"); sPortFormat.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamVideoPortFormat, (OMX_PTR) & sPortFormat); if ((sPortFormat.eCompressionFormat != OMX_VIDEO_CodingUnused) || (sPortFormat.eColorFormat != OMX_COLOR_FormatYUV420Planar)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eCompressionFormat = %d (OMX_VIDEO_CodingUnused)\n", sPortFormat.eCompressionFormat); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eColorFormat = %d (OMX_COLOR_FormatYUV420Planar)\n", sPortFormat.eColorFormat); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdCompCommonImage_JpegPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_PARAM_PORTDEFINITIONTYPE sPortDefinition; OMX_IMAGE_PARAM_PORTFORMATTYPE sPortFormat; OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE sQuantTable; OMX_IMAGE_PARAM_HUFFMANTTABLETYPE sHuffTable; OMX_CONF_INIT_STRUCT(sPortDefinition, OMX_PARAM_PORTDEFINITIONTYPE); OMX_CONF_INIT_STRUCT(sPortFormat, OMX_IMAGE_PARAM_PORTFORMATTYPE); OMX_CONF_INIT_STRUCT(sQuantTable, OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE); OMX_CONF_INIT_STRUCT(sHuffTable, OMX_IMAGE_PARAM_HUFFMANTTABLETYPE); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying JPEG port %i Default parameters\n", nPortIndex); /* Verify support for the common standard component port parameters */ eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify default port definition settings */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying JPEG port definition\n"); sPortDefinition.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamPortDefinition, (OMX_PTR) & sPortDefinition); if ((sPortDefinition.eDomain != OMX_PortDomainImage) || (sPortDefinition.format.image.nFrameWidth != 640) || (sPortDefinition.format.image.nFrameHeight != 480) || (sPortDefinition.format.image.eCompressionFormat != OMX_IMAGE_CodingJPEG) || (sPortDefinition.format.image.eColorFormat != OMX_COLOR_FormatUnused)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "eDomain = %d, nFrameWidth = %d, nFrameHeight = %d, " "eCompressionFormat= %d, eColorFormat = %d\n", sPortDefinition.eDomain, sPortDefinition.format.image.nFrameWidth, sPortDefinition.format.image.nFrameHeight, sPortDefinition.format.image.eCompressionFormat, sPortDefinition.format.image.eColorFormat); /* Verify default settings for OMX_IndexParamImagePortFormat */ eError = StdCompCommonImage_PortFormatSupported(pCtx, nPortIndex, OMX_IMAGE_CodingJPEG, OMX_COLOR_FormatUnused); OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eCompressionFormat = OMX_IMAGE_CodingJPEG\n"); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " eColorFormat = OMX_COLOR_FormatUnused\n"); /* Verify default settings for OMX_IndexParamQuantizationTable */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying default settings for OMX_IndexParamQuantizationTable\n"); sQuantTable.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamQuantizationTable, (OMX_PTR) & sQuantTable); if (sQuantTable.eQuantizationTable != OMX_IMAGE_QuantizationTableLuma) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " OMX_IMAGE_QuantizationTableLuma\n"); /* Verify setting alternate values for OMX_IndexParamQuantization */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying other settings for OMX_IndexParamQuantizationTable\n"); OMX_CONF_PARAM_WRITE_VERIFY(pCtx, OMX_IndexParamQuantizationTable, (OMX_PTR)&sQuantTable, sQuantTable.eQuantizationTable, OMX_IMAGE_QuantizationTableChroma, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " OMX_IMAGE_QuantizationTableChroma\n"); /* Parameter verification for decoders*/ if (sPortDefinition.eDir == OMX_DirInput) { /* Verify default settings for OMX_IndexParamHuffmanTable */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying default settings for OMX_IndexParamHuffmanTable\n"); sHuffTable.nPortIndex = nPortIndex; eError = OMX_GetParameter(pCtx->hWrappedComp, OMX_IndexParamHuffmanTable, (OMX_PTR) & sHuffTable); if (sHuffTable.eHuffmanTable != OMX_IMAGE_HuffmanTableAC) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " OMX_IMAGE_HuffmanTableAC\n"); /* Verify setting alternate values for OMX_IndexParamHuffman*/ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying other settings for OMX_IndexParamHuffmanTable\n"); OMX_CONF_PARAM_WRITE_VERIFY(pCtx, OMX_IndexParamHuffmanTable, (OMX_PTR)&sHuffTable, sHuffTable.eHuffmanTable, OMX_IMAGE_HuffmanTableDC, eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, " OMX_IMAGE_HuffmanTableDC\n"); } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE StdVideoEncoderTest_Mpeg4Encoder(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; OMX_CONFIG_FRAMERATETYPE sVideoFrameRate; OMX_VIDEO_CONFIG_BITRATETYPE sVideoBitRate; OMX_CONF_INIT_STRUCT(sVideoFrameRate, OMX_CONFIG_FRAMERATETYPE); OMX_CONF_INIT_STRUCT(sVideoBitRate, OMX_VIDEO_CONFIG_BITRATETYPE); eError = StdComponentTest_SetRole(pCtx, "video_encoder.mpeg4"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard MPEG4 encoder component, there must be at least two video domain ports. */ if (pCtx->sPortParamVideo.nPorts < 2) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = VPB + 0; input port, raw video format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Raw video input port 0 \n"); nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 0; if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonVideo_RawPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = VPB + 1; output port, MPEG4 format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying MPEG4 output port 1 \n"); nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 1; if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonVideo_Mpeg4PortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify support for OMX_IndexConfigVideoFramerate and verify the default value. */ sVideoFrameRate.nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 1; eError = OMX_GetConfig(pCtx->hWrappedComp, OMX_IndexConfigVideoFramerate, (OMX_PTR) & sVideoFrameRate); if (sVideoFrameRate.xEncodeFramerate != (15 << 16)) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); /* Verify this value can be changed.*/ OMX_CONF_CONFIG_READ_WRITE_VERIFY(pCtx, OMX_IndexConfigVideoFramerate, (OMX_PTR)&sVideoFrameRate, sVideoFrameRate.xEncodeFramerate, (5 << 16), (10 << 16), eError); /* Verify support for OMX_IndexConfigVideoBitrate and verify the default value. */ sVideoBitRate.nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 1; eError = OMX_GetConfig(pCtx->hWrappedComp, OMX_IndexConfigVideoBitrate, (OMX_PTR) & sVideoBitRate); if (sVideoBitRate.nEncodeBitrate != 64000) eError = OMX_ErrorBadParameter; // OMX_ErrorBadPortFormatEncoding OMX_CONF_BAIL_ON_ERROR(eError); /* Verify this value can be changed.*/ OMX_CONF_CONFIG_READ_WRITE_VERIFY(pCtx, OMX_IndexConfigVideoBitrate, (OMX_PTR)&sVideoBitRate, sVideoBitRate.nEncodeBitrate, 32000, 11111, eError); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE StdBinaryClockTest_BinaryClock(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex, i; OMX_TIME_CONFIG_SCALETYPE sScale; //OMX_IndexConfigTimeScale OMX_TIME_CONFIG_CLOCKSTATETYPE sClockState; //OMX_IndexConfigTimeClockState OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE sActiveRefClock; //OMX_IndexConfigTimeActiveRefClock OMX_TIME_CONFIG_TIMESTAMPTYPE sTimeStamp; // OMX_IndexConfigTimeCurrentMediaTime, // OMX_IndexConfigTimeCurrentWallTime // OMX_IndexConfigTimeCurrentAudioReference // OMX_IndexConfigTimeCurrentVideoReference // OMX_IndexConfigTimeClientStartTime OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE sMediaTimeRequest; //OMX_IndexConfigTimeMediaTimeRequest OMX_CONF_INIT_STRUCT(sScale, OMX_TIME_CONFIG_SCALETYPE); OMX_CONF_INIT_STRUCT(sClockState, OMX_TIME_CONFIG_CLOCKSTATETYPE); OMX_CONF_INIT_STRUCT(sActiveRefClock, OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE); OMX_CONF_INIT_STRUCT(sTimeStamp, OMX_TIME_CONFIG_TIMESTAMPTYPE); OMX_CONF_INIT_STRUCT(sMediaTimeRequest, OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE); eError = StdComponentTest_SetRole(pCtx, "clock.binary"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard binary clock component, there must be at least one OTHER domain ports. There is no limit on the maximum number of ports.*/ if (pCtx->sPortParamOther.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = OPB + i; output port, other format */ for (i = 0; i < pCtx->sPortParamOther.nPorts; i++) { nPortIndex = pCtx->sPortParamOther.nStartPortNumber + i; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Other output port %d \n", nPortIndex); if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonOther_OtherPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify R/W accesses. There are no default values in the specification. */ OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigTimeScale, (OMX_PTR)&sScale, eError); // R/W OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigTimeClockState, (OMX_PTR)&sClockState, eError); // R/W OMX_CONF_CONFIG_REQUIREDGETSET(pCtx, OMX_IndexConfigTimeActiveRefClock, (OMX_PTR)&sActiveRefClock, eError); // R/W eError = OMX_GetConfig(pCtx, OMX_IndexConfigTimeCurrentMediaTime, (OMX_PTR) & sTimeStamp); //Read Access. OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_GetConfig(pCtx, OMX_IndexConfigTimeCurrentWallTime, (OMX_PTR) & sTimeStamp); //Read Access. OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_SetConfig(pCtx, OMX_IndexConfigTimeCurrentAudioReference, (OMX_PTR) & sTimeStamp); //Write Access. OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_SetConfig(pCtx, OMX_IndexConfigTimeCurrentVideoReference, (OMX_PTR) & sTimeStamp); //Write Access. OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_SetConfig(pCtx, OMX_IndexConfigTimeCurrentVideoReference, (OMX_PTR) & sTimeStamp); //Write Access. OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_SetConfig(pCtx, OMX_IndexConfigTimeMediaTimeRequest, (OMX_PTR) & sMediaTimeRequest); //Write Access. OMX_CONF_BAIL_ON_ERROR(eError); } OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_PortCommunicationTest(OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_HANDLETYPE hComp = 0; OMX_CALLBACKTYPE sCallbacks; PortCommTestCtxt sContext; OMX_HANDLETYPE hWrappedComp = 0; OMX_CALLBACKTYPE *pWrappedCallbacks; OMX_PTR pWrappedAppData; PortCommTestCtxt *pCtxt; pCtxt = &sContext; memset(pCtxt, 0x0, sizeof(PortCommTestCtxt)); sCallbacks.EventHandler = PortCommTest_EventHandler; sCallbacks.EmptyBufferDone = PortCommTest_EmptyBufferDone; sCallbacks.FillBufferDone = PortCommTest_FillBufferDone; eError = OMX_CONF_CallbackTracerCreate(&sCallbacks, (OMX_PTR)pCtxt, cComponentName, &pWrappedCallbacks, &pWrappedAppData); /* initialize events to track callbacks */ OMX_OSAL_EventCreate(&pCtxt->hStateSetEvent); OMX_OSAL_EventReset(pCtxt->hStateSetEvent); OMX_OSAL_EventCreate(&pCtxt->hPortDisableEvent); OMX_OSAL_EventReset(pCtxt->hPortDisableEvent); OMX_OSAL_EventCreate(&pCtxt->hPortEnableEvent); OMX_OSAL_EventReset(pCtxt->hPortEnableEvent); OMX_OSAL_EventCreate(&pCtxt->hBufDoneEvent); OMX_OSAL_EventReset(pCtxt->hBufDoneEvent); OMX_OSAL_EventCreate(&pCtxt->hEmptyBufDoneEvent); OMX_OSAL_EventReset(pCtxt->hEmptyBufDoneEvent); /* Initialize OpenMax */ eError = OMX_Init(); OMX_CONF_BAIL_IF_ERROR(eError); OMX_CONF_BAIL_IF_ERROR(OMX_GetHandle(&hComp, cComponentName, pWrappedAppData, pWrappedCallbacks)); OMX_CONF_BAIL_IF_ERROR(OMX_CONF_ComponentTracerCreate(hComp, cComponentName, &hWrappedComp)); pCtxt->hWComp = hWrappedComp; /* Verify start in Loaded state */ OMX_CONF_BAIL_IF_ERROR(OMX_GetState(pCtxt->hWComp, &pCtxt->eState)); if (pCtxt->eState != OMX_StateLoaded) OMX_CONF_SET_ERROR_BAIL("Component not in loaded state at init\n", OMX_ErrorUndefined); /* detect all audio ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[0], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp, OMX_IndexParamAudioInit, (OMX_PTR) & pCtxt->sPortParam[0]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i audio ports starting at %i \n", pCtxt->sPortParam[0].nPorts, pCtxt->sPortParam[0].nStartPortNumber); /* detect all video ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[1], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp, OMX_IndexParamVideoInit, (OMX_PTR) & pCtxt->sPortParam[1]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i video ports starting at %i \n", pCtxt->sPortParam[1].nPorts, pCtxt->sPortParam[1].nStartPortNumber); /* detect all image ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[2], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp, OMX_IndexParamImageInit, (OMX_PTR) & pCtxt->sPortParam[2]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i image ports starting at %i \n", pCtxt->sPortParam[2].nPorts, pCtxt->sPortParam[2].nStartPortNumber); /* detect all other ports on the component */ OMX_CONF_INIT_STRUCT(pCtxt->sPortParam[3], OMX_PORT_PARAM_TYPE); eError = OMX_GetParameter(pCtxt->hWComp, OMX_IndexParamOtherInit, (OMX_PTR) & pCtxt->sPortParam[3]); if (OMX_ErrorUnsupportedIndex == eError) eError = OMX_ErrorNone; OMX_CONF_BAIL_IF_ERROR(eError); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "detected %i other ports starting at %i \n", pCtxt->sPortParam[3].nPorts, pCtxt->sPortParam[3].nStartPortNumber); pCtxt->nPorts = pCtxt->sPortParam[0].nPorts + pCtxt->sPortParam[1].nPorts + pCtxt->sPortParam[2].nPorts + pCtxt->sPortParam[3].nPorts; /* 3.4.1. Non-Tunneling Setup Test */ /* TODO: reference core does not take null as port */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Non-Tunneling Setup Test\n"); OMX_CONF_BAIL_IF_ERROR(PortCommTest_OperateOnPorts(pCtxt, NonTunnelTest)); /* 3.4.2. Transmit Buffers Between Input and Output Ports and Application */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transmit Test - Client allocates - Full payload\n"); pCtxt->nBufFactor = 1; pCtxt->bClientAllocBuf = OMX_TRUE; OMX_CONF_BAIL_IF_ERROR(PortCommTest_TransmitTest(pCtxt, OMX_TRUE, OMX_TRUE)); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transmit Test - Client allocates - Half payload\n"); pCtxt->nBufFactor = 2; OMX_CONF_BAIL_IF_ERROR(PortCommTest_TransmitTest(pCtxt, OMX_TRUE, OMX_TRUE)); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transmit Test - Client allocates - Quarter payload\n"); pCtxt->nBufFactor = 4; OMX_CONF_BAIL_IF_ERROR(PortCommTest_TransmitTest(pCtxt, OMX_TRUE, OMX_TRUE)); OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Transmit Test - Component allocates - Full payload\n"); pCtxt->bClientAllocBuf = OMX_FALSE; pCtxt->nBufFactor = 1; OMX_CONF_BAIL_IF_ERROR(PortCommTest_TransmitTest(pCtxt, OMX_TRUE, OMX_TRUE)); /* 3.4.3. Port Repack Test */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Repack Test\n"); pCtxt->bClientAllocBuf = OMX_TRUE; OMX_CONF_BAIL_IF_ERROR(PortCommTest_RepackTest(pCtxt)); /* 3.4.4. Port Stop and Restart Test */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Port Stop and Restart Test\n"); pCtxt->nBufFactor = 1; OMX_CONF_BAIL_IF_ERROR(PortCommTest_StopRestartTest(pCtxt)); /* 3.4.5. Component Pause and Resume Test*/ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Component Pause and Resume Test\n"); OMX_CONF_BAIL_IF_ERROR(PortCommTest_PauseResume(pCtxt)); OMX_CONF_TEST_BAIL: /* cleanup: return function errors rather than closing errors if appropriate */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Cleanup\n"); if (OMX_ErrorNone == eError) { if (hWrappedComp) { eError = OMX_CONF_ComponentTracerDestroy(hWrappedComp); } if (hComp) { eError = OMX_FreeHandle(hComp); } eError = OMX_CONF_CallbackTracerDestroy(pWrappedCallbacks, pWrappedAppData); eError = OMX_Deinit(); } else { PortCommTest_TransitionWait(OMX_StateInvalid, pCtxt); PortCommTest_DeInitBuffer(pCtxt); if (hWrappedComp) { OMX_CONF_ComponentTracerDestroy(hWrappedComp); } if (hComp) { OMX_FreeHandle(hComp); } OMX_CONF_CallbackTracerDestroy(pWrappedCallbacks, pWrappedAppData); OMX_Deinit(); } OMX_OSAL_EventDestroy(pCtxt->hStateSetEvent); OMX_OSAL_EventDestroy(pCtxt->hPortDisableEvent); OMX_OSAL_EventDestroy(pCtxt->hPortEnableEvent); OMX_OSAL_EventDestroy(pCtxt->hBufDoneEvent); OMX_OSAL_EventDestroy(pCtxt->hEmptyBufDoneEvent); return eError; }