OMX_ERRORTYPE StdAudioMixerTest_PcmMixer(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex, i; eError = StdComponentTest_SetRole(pCtx, "audio_mixer.pcm"); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = APB + 0; output port, PCM format */ nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + 0; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying PCM output port %d \n", nPortIndex); if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonAudio_PcmPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = (APB + 1) + i; input port, PCM format */ for (i = 1; i < pCtx->sPortParamAudio.nPorts; i++) { nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + i; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying PCM input port %d \n", nPortIndex); if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonAudio_PcmPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); } OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE StdIVRendererTest_RgbOverlay(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "iv_renderer.rgb.overlay"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard RGB overlay image/video renderer component, there must be at least one video domain ports. */ if (pCtx->sPortParamVideo.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = VPB + 0; input port, rgb format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying RGB input port 0 \n"); nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 0; OMX_CONF_BAIL_ON_ERROR(eError); if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonVideo_QcifPlusPortParameters(pCtx, nPortIndex, OMX_COLOR_Format16bitRGB565); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return (eError); }
/* This runs through and tests all standard components of the Audio Mixer class exposed and supported by the component. */ OMX_ERRORTYPE OMX_CONF_StdAudioMixerTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nNumRoles; OMX_STRING sRoles[MAX_COMPONENT_ROLES] = {NULL}; OMX_U32 i; /* The following utility function calls OMX_GetRolesOfComponent, allocates memory, and populates strings. */ eError = StdComponentTest_PopulateRolesArray(cComponentName, &nNumRoles, sRoles); OMX_CONF_BAIL_ON_ERROR(eError); eError = OMX_ErrorComponentNotFound; for (i = 0; i < nNumRoles; i++) { if (strstr(sRoles[i], "audio_mixer") != NULL) { eError = OMX_CONF_StdPcmMixerTest(cComponentName); } else { continue; } OMX_CONF_BAIL_ON_ERROR(eError); } OMX_CONF_TEST_BAIL: StdComponentTest_FreeRolesArray(nNumRoles, sRoles); 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 StdContainerDemuxerTest_RealDemuxer(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "container_demuxer.real"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard Real 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, PCM 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 = StdCompCommonAudio_PcmPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* TO DO: Verify additional support for some additional configs. */ /* OMX_IndexConfigAudioVolume, OMX_IndexConfigAudioMute */ /* Also need to verify the default value for bInterleaved (OMX_IndexParamAudioPcm). */ /* Verify - Port Index = VPB + 0; output port, raw 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 = StdCompCommonVideo_RawPortParameters(pCtx, nPortIndex); 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); 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 BufferTest_AllocateAllPlusOne(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_PORTTYPE *pPort; OMX_U32 i; OMX_U32 nCount; pPort = pCtx->aPorts; for (i = 0; i < pCtx->nNumPorts; i++) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocating all buffers plus one on port %i\n", pPort->sPortDef.nPortIndex); /* allocate all buffers on each port, but plus buffer */ nCount = pPort->sPortDef.nBufferCountActual; nCount -= LIFO_INQUEUE(pPort->pLifo); eError = BufferTest_PortAllocateNumBuffers(pCtx, pPort, nCount); OMX_CONF_BAIL_ON_ERROR(eError); pPort++; } OMX_CONF_TEST_BAIL: return(eError); }
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); }
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 StdImageDecoderTest_JpegDecoder(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "image_decoder.jpeg"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard JPEG decoder component, there must be at least two image domain ports. */ if (pCtx->sPortParamImage.nPorts < 2) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = IPB + 0; input port, JPEG format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying JPEG input port 0 \n"); nPortIndex = pCtx->sPortParamImage.nStartPortNumber + 0; OMX_CONF_BAIL_ON_ERROR(eError); if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonImage_JpegPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = IPB + 1; output port, raw image format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Raw image output port 1 \n"); nPortIndex = pCtx->sPortParamImage.nStartPortNumber + 1; if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonImage_RawPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); 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 StdVideoEncoderTest_AvcEncoder(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "video_encoder.avc"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard AVC 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, AVC format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying AVC 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_AvcPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE StdAudioEncoderTest_AacEncoder(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "audio_encoder.aac"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard AAC encoder component, there must be at least two audio domain ports. */ if (pCtx->sPortParamAudio.nPorts < 2) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = APB + 0; input port, PCM format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying PCM input port 0 \n"); nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + 0; if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonAudio_PcmPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = APB + 1; outpt port, AAC format */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying AAC output port 1 \n"); nPortIndex = pCtx->sPortParamAudio.nStartPortNumber + 1; if (StdComponentTest_IsOutputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdCompCommonAudio_AacPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE StdWriterTest_BinaryVideoWriter(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_U32 nPortIndex; eError = StdComponentTest_SetRole(pCtx, "video_writer.binary"); OMX_CONF_BAIL_ON_ERROR(eError); /* For the standard binary video writer component, there must be at least one video domain port. */ if (pCtx->sPortParamVideo.nPorts < 1) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); /* Verify - Port Index = VPB + 0; output port */ OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying OMX_VIDEOPORTBASE + 0 is input port \n\n"); nPortIndex = pCtx->sPortParamVideo.nStartPortNumber + 0; if (StdComponentTest_IsInputPort(pCtx, nPortIndex) == OMX_FALSE) eError = OMX_ErrorUndefined; OMX_CONF_BAIL_ON_ERROR(eError); eError = StdComponentTest_StdPortParameters(pCtx, nPortIndex); OMX_CONF_BAIL_ON_ERROR(eError); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE StdCompCommonOther_ContainerMuxerPortParameters( TEST_CTXTYPE *pCtx, OMX_U32 nPortIndex) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Verifying Container Muxer 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); OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE OMX_CONF_StdPcmMixerTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "audio_mixer.pcm"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdAudioMixerTest_PcmMixer); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_StdRealContainerDemuxerTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "container_demuxer.real"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdContainerDemuxerTest_RealDemuxer); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_StdMpeg4EncoderTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "video_encoder.mpeg4"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdVideoEncoderTest_Mpeg4Encoder); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_StdRgbOverlayTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "iv_renderer.rgb.overlay"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdIVRendererTest_RgbOverlay); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_StdBinaryClockTest_BinaryClockTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "clock.binary"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdBinaryClockTest_BinaryClock); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE OMX_CONF_StdJpegDecoderTest( OMX_IN OMX_STRING cComponentName) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_CTXTYPE ctx; eError = StdComponentTest_IsRoleSupported(cComponentName, "image_decoder.jpeg"); OMX_CONF_BAIL_ON_ERROR(eError); memset(&ctx, 0x0, sizeof(TEST_CTXTYPE)); eError = StdComponentTest_StdComp(cComponentName, &ctx, (STDCOMPTEST_COMPONENT)StdImageDecoderTest_JpegDecoder); OMX_CONF_TEST_BAIL: return (eError); }
OMX_ERRORTYPE BufferTest_PortFreeNumBuffers( TEST_CTXTYPE *pCtx, TEST_PORTTYPE *pPort, OMX_U32 nNumBuffers) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_BUFFERHEADERTYPE *pBufHdr; while ((0x0 != LIFO_INQUEUE(pPort->pLifo)) && (0x0 != nNumBuffers)) { LIFO_REMOVE(pPort->pLifo, pBufHdr); eError = OMX_FreeBuffer(pCtx->hWrappedComp, pPort->sPortDef.nPortIndex, pBufHdr); OMX_CONF_BAIL_ON_ERROR(eError); nNumBuffers--; } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE BufferTest_PortAllocateNumBuffers( TEST_CTXTYPE *pCtx, TEST_PORTTYPE *pPort, OMX_U32 nNumBuffers) { OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_BUFFERHEADERTYPE *pBufHdr; while (0x0 != nNumBuffers) { eError = OMX_AllocateBuffer(pCtx->hWrappedComp, &pBufHdr, pPort->sPortDef.nPortIndex, 0x0, pPort->sPortDef.nBufferSize); OMX_CONF_BAIL_ON_ERROR(eError); LIFO_ADD(pPort->pLifo, pBufHdr); nNumBuffers--; } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE BufferTest_AllocateAllButOne(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_PORTTYPE *pPort; OMX_U32 i; pPort = pCtx->aPorts; for (i = 0; i < pCtx->nNumPorts; i++) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Allocating all buffers but one on port %i\n", pPort->sPortDef.nPortIndex); /* allocate all but one buffer on each port */ eError = BufferTest_PortAllocateNumBuffers(pCtx, pPort, (pPort->sPortDef.nBufferCountMin - 1)); OMX_CONF_BAIL_ON_ERROR(eError); pPort++; } OMX_CONF_TEST_BAIL: return(eError); }
OMX_ERRORTYPE BufferTest_FreeAllButOne(TEST_CTXTYPE *pCtx) { OMX_ERRORTYPE eError = OMX_ErrorNone; TEST_PORTTYPE *pPort; OMX_U32 i; pPort = pCtx->aPorts; for (i = 0; i < pCtx->nNumPorts; i++) { OMX_OSAL_Trace(OMX_OSAL_TRACE_INFO, "Freeing all buffers but one on port %i\n", pPort->sPortDef.nPortIndex); /* free all buffers on each port, but one buffer */ eError = BufferTest_PortFreeNumBuffers(pCtx, pPort, (LIFO_INQUEUE(pPort->pLifo) - 1)); OMX_CONF_BAIL_ON_ERROR(eError); pPort++; } OMX_CONF_TEST_BAIL: 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 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 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 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 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); }