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 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); }