1 /* |
1 /* |
2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1141 } |
1141 } |
1142 |
1142 |
1143 return ETrue; |
1143 return ETrue; |
1144 } |
1144 } |
1145 |
1145 |
|
1146 TBool ROmxScriptTest::MosSetVideoPortFormatsL(const TDesC8& aComp, TInt aPortIndex, OMX_COLOR_FORMATTYPE* aColorFormat, OMX_VIDEO_CODINGTYPE* aCodingType, TInt aFramerate, OMX_ERRORTYPE aExpectedError) |
|
1147 { |
|
1148 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
|
1149 if(!component) |
|
1150 { |
|
1151 return EFalse; |
|
1152 } |
|
1153 |
|
1154 INFO_PRINTF1(_L("MosSetVideoPortFormatsL")); |
|
1155 |
|
1156 OMX_VIDEO_PARAM_PORTFORMATTYPE format; |
|
1157 |
|
1158 format.nSize = sizeof(format); |
|
1159 format.nVersion = KOmxVersion; |
|
1160 format.nPortIndex = aPortIndex; |
|
1161 format.xFramerate = aFramerate; |
|
1162 format.eColorFormat = *aColorFormat; |
|
1163 format.eCompressionFormat = *aCodingType; |
|
1164 |
|
1165 OMX_ERRORTYPE error = component->SetParameter(component, OMX_IndexParamVideoPortFormat, &format); |
|
1166 if(error != aExpectedError) |
|
1167 { |
|
1168 ERR_PRINTF3(_L("MosSetVideoPortFormatsL SetParameter() error 0x%X, expected 0x%X"), error, aExpectedError); |
|
1169 return EFalse; |
|
1170 } |
|
1171 return ETrue; |
|
1172 } |
|
1173 |
1146 TBool ROmxScriptTest::MosSetVideoPortDefL(const TDesC8& aComp, TInt aPortIndex, TInt aWidth, TInt aHeight, OMX_COLOR_FORMATTYPE* aColorFormat, OMX_VIDEO_CODINGTYPE* aCodingType, TInt aStride, TReal aFps, OMX_ERRORTYPE aExpectedError) |
1174 TBool ROmxScriptTest::MosSetVideoPortDefL(const TDesC8& aComp, TInt aPortIndex, TInt aWidth, TInt aHeight, OMX_COLOR_FORMATTYPE* aColorFormat, OMX_VIDEO_CODINGTYPE* aCodingType, TInt aStride, TReal aFps, OMX_ERRORTYPE aExpectedError) |
1147 { |
1175 { |
1148 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1176 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1149 if(!component) |
1177 if(!component) |
1150 { |
1178 { |
1154 OMX_PARAM_PORTDEFINITIONTYPE portDef; |
1182 OMX_PARAM_PORTDEFINITIONTYPE portDef; |
1155 portDef.nSize = sizeof(portDef); |
1183 portDef.nSize = sizeof(portDef); |
1156 portDef.nVersion = KOmxVersion; |
1184 portDef.nVersion = KOmxVersion; |
1157 portDef.nPortIndex = aPortIndex; |
1185 portDef.nPortIndex = aPortIndex; |
1158 OMX_ERRORTYPE error = component->GetParameter(component, OMX_IndexParamPortDefinition, &portDef); |
1186 OMX_ERRORTYPE error = component->GetParameter(component, OMX_IndexParamPortDefinition, &portDef); |
|
1187 |
1159 if(error) |
1188 if(error) |
1160 { |
1189 { |
1161 FailWithOmxError(_L("GetParameter()"), error); |
1190 FailWithOmxError(_L("GetParameter()"), error); |
1162 return EFalse; |
1191 return EFalse; |
1163 } |
1192 } |
1407 |
1436 |
1408 ERR_PRINTF1(_L("MosSetParameterUnknownIndexTypeL unexpectedly received OMX_ErrorNone")); |
1437 ERR_PRINTF1(_L("MosSetParameterUnknownIndexTypeL unexpectedly received OMX_ErrorNone")); |
1409 StopTest(EFail); |
1438 StopTest(EFail); |
1410 return EFalse; |
1439 return EFalse; |
1411 } |
1440 } |
1412 TBool ROmxScriptTest::MosDisablePort(const TDesC8& aComp, TInt aPortIndex) |
1441 TBool ROmxScriptTest::MosDisablePort(const TDesC8& aComp, TInt aPortIndex, OMX_ERRORTYPE aExpectedError) |
1413 { |
1442 { |
1414 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1443 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1415 if(!component) |
1444 if(!component) |
1416 { |
1445 { |
1417 return EFalse; |
1446 return EFalse; |
1418 } |
1447 } |
1419 |
1448 |
1420 OMX_ERRORTYPE error = component->SendCommand(component, OMX_CommandPortDisable, aPortIndex, NULL); |
1449 OMX_ERRORTYPE error = component->SendCommand(component, OMX_CommandPortDisable, aPortIndex, NULL); |
1421 if(error) |
1450 if(error != aExpectedError) |
1422 { |
1451 { |
1423 FailWithOmxError(aComp, _L("OMX_SendCommand(OMX_CommandPortDisable)"), error); |
1452 FailWithOmxError(aComp, _L("OMX_SendCommand(OMX_CommandPortDisable)"), error); |
1424 return EFalse; |
1453 return EFalse; |
1425 } |
1454 } |
1426 |
1455 |
1427 return ETrue; |
1456 return ETrue; |
1428 } |
1457 } |
1429 |
1458 |
1430 TBool ROmxScriptTest::MosEnablePort(const TDesC8& aComp, TInt aPortIndex) |
1459 TBool ROmxScriptTest::MosEnablePort(const TDesC8& aComp, TInt aPortIndex, OMX_ERRORTYPE aExpectedError) |
1431 { |
1460 { |
1432 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1461 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
1433 if(!component) |
1462 if(!component) |
1434 { |
1463 { |
1435 return EFalse; |
1464 return EFalse; |
1436 } |
1465 } |
1437 |
1466 |
1438 OMX_ERRORTYPE error = component->SendCommand(component, OMX_CommandPortEnable, aPortIndex, NULL); |
1467 OMX_ERRORTYPE error = component->SendCommand(component, OMX_CommandPortEnable, aPortIndex, NULL); |
1439 if(error) |
1468 if(error != aExpectedError) |
1440 { |
1469 { |
1441 FailWithOmxError(aComp, _L("OMX_SendCommand(OMX_CommandPortEnable)"), error); |
1470 FailWithOmxError(aComp, _L("OMX_SendCommand(OMX_CommandPortEnable)"), error); |
1442 return EFalse; |
1471 return EFalse; |
1443 } |
1472 } |
1444 |
1473 |
1590 } |
1619 } |
1591 return ETrue; |
1620 return ETrue; |
1592 } |
1621 } |
1593 |
1622 |
1594 |
1623 |
|
1624 TBool ROmxScriptTest::MosCheckConfigCommonScaleL(const TDesC8& aComp, |
|
1625 TInt aPortIndex, |
|
1626 TInt aWidth, TInt aHeight, OMX_ERRORTYPE aExpectedError) |
|
1627 { |
|
1628 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
|
1629 if(!component) |
|
1630 { |
|
1631 User::Leave(KErrGeneral); |
|
1632 } |
|
1633 |
|
1634 OMX_CONFIG_SCALEFACTORTYPE commonScale; |
|
1635 commonScale.nSize = sizeof(commonScale); |
|
1636 commonScale.nVersion = KOmxVersion; |
|
1637 commonScale.nPortIndex = aPortIndex; |
|
1638 |
|
1639 OMX_ERRORTYPE error = component->GetConfig(component, OMX_IndexConfigCommonScale, &commonScale); |
|
1640 if(error != aExpectedError) |
|
1641 { |
|
1642 FailWithOmxError(_L("GetConfig() with unexpected error "), error); |
|
1643 return EFalse; |
|
1644 } |
|
1645 |
|
1646 if (error) |
|
1647 { |
|
1648 return ETrue; |
|
1649 } |
|
1650 |
|
1651 if(commonScale.xWidth != aWidth || commonScale.xHeight != aHeight) |
|
1652 { |
|
1653 ERR_PRINTF1(_L("CommonScale not what expected.")); |
|
1654 StopTest(KErrGeneral, EFail); |
|
1655 return EFalse; |
|
1656 } |
|
1657 return ETrue; |
|
1658 } |
|
1659 |
|
1660 TBool ROmxScriptTest::MosSetConfigCommonScaleL(const TDesC8& aComp, |
|
1661 TInt aPortIndex, |
|
1662 TInt aWidth, TInt aHeight, OMX_ERRORTYPE aExpectedError) |
|
1663 { |
|
1664 OMX_COMPONENTTYPE* component = ComponentByName(aComp); |
|
1665 if(!component) |
|
1666 { |
|
1667 User::Leave(KErrGeneral); |
|
1668 } |
|
1669 |
|
1670 OMX_CONFIG_SCALEFACTORTYPE commonScale; |
|
1671 commonScale.nSize = sizeof(commonScale); |
|
1672 commonScale.nVersion = KOmxVersion; |
|
1673 commonScale.nPortIndex = aPortIndex; |
|
1674 commonScale.xWidth = aWidth; |
|
1675 commonScale.xHeight = aHeight; |
|
1676 |
|
1677 OMX_ERRORTYPE error = component->SetConfig(component, OMX_IndexConfigCommonScale, &commonScale); |
|
1678 if(error != aExpectedError) |
|
1679 { |
|
1680 FailWithOmxError(_L("SetConfig() with unexpected error"), error); |
|
1681 return EFalse; |
|
1682 } |
|
1683 |
|
1684 return ETrue; |
|
1685 } |
1595 |
1686 |
1596 |
1687 |
1597 TBool ROmxScriptTest::MosSetConfigAudioVolumeL(const TDesC8& aComp, |
1688 TBool ROmxScriptTest::MosSetConfigAudioVolumeL(const TDesC8& aComp, |
1598 TInt aPortIndex, |
1689 TInt aPortIndex, |
1599 TBool aLinear, |
1690 TBool aLinear, |