tsrc/xmltestharness/xmlclient/src/omxscriptparser.cpp
changeset 5 fb6faddbb212
parent 0 0e4a32b9112d
equal deleted inserted replaced
2:6add9366d894 5:fb6faddbb212
     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".
   528             ParseCompPortL(port, comp1, portIndex);
   528             ParseCompPortL(port, comp1, portIndex);
   529             
   529             
   530             OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
   530             OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
   531             CheckForAbortL(iCallback.MosSetCameraCaptureL(comp, portIndex, isCapturing, expectedErrorInt));
   531             CheckForAbortL(iCallback.MosSetCameraCaptureL(comp, portIndex, isCapturing, expectedErrorInt));
   532             }
   532             }
   533 		else if(elemName == _L8("SetVideoPortDef"))
   533 		else if(elemName == _L8("SetVideoPortDef") || elemName == _L8("SetVideoPortFormat"))
   534 			{
   534 			{
   535 			const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port"));
   535 			const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port"));
   536 			TPtrC8 comp;
   536 			TPtrC8 comp;
   537 			TInt port;
   537 			TInt port;
   538 			ParseCompPortL(compPort, comp, port);
   538 			ParseCompPortL(compPort, comp, port);
   539 			TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1);
       
   540 			TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1);
       
   541 			OMX_COLOR_FORMATTYPE colorFormat = OMX_COLOR_FormatMax;
   539 			OMX_COLOR_FORMATTYPE colorFormat = OMX_COLOR_FormatMax;
   542 			OMX_COLOR_FORMATTYPE* colorFormatPtr = NULL;
   540 			OMX_COLOR_FORMATTYPE* colorFormatPtr = NULL;
   543 			const TDesC8* colorFormatDes = FindAttribute(aAttributes, _L8("colorFormat"));
   541 			const TDesC8* colorFormatDes = FindAttribute(aAttributes, _L8("colorFormat"));
   544 			if(colorFormatDes)
   542 			if(colorFormatDes)
   545 				{
   543 				{
   552 			if(codingDes)
   550 			if(codingDes)
   553 				{
   551 				{
   554 				codingType = ParseOmxVideoCodingL(*codingDes);
   552 				codingType = ParseOmxVideoCodingL(*codingDes);
   555 				codingTypePtr = &codingType;
   553 				codingTypePtr = &codingType;
   556 				}
   554 				}
       
   555             const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr"));
       
   556             OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
       
   557             if (expectedError)
       
   558                 {
       
   559                 expectedErrorInt = ParseOmxErrorCode(*expectedError);
       
   560                 }
       
   561             
       
   562             if (elemName == _L8("SetVideoPortFormat"))
       
   563                 {
       
   564                 TInt rate = ParseOptionalIntL(aAttributes, _L8("framerate"), -1);
       
   565                 CheckForAbortL(iCallback.MosSetVideoPortFormatsL(comp, port, colorFormatPtr, codingTypePtr, rate, expectedErrorInt));
       
   566                 return;
       
   567                 }
       
   568             
       
   569             // The rest apply to SetVideoPortDef only
       
   570 			TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1);
       
   571             TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1);
   557 			TInt stride = ParseOptionalIntL(aAttributes, _L8("stride"), -1);
   572 			TInt stride = ParseOptionalIntL(aAttributes, _L8("stride"), -1);
   558 
   573 
   559 			const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr"));
       
   560 		    OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
       
   561 			if (expectedError)
       
   562 			    {
       
   563 			    expectedErrorInt = ParseOmxErrorCode(*expectedError);
       
   564 			    }
       
   565 			
   574 			
   566 #ifdef HREF_ED_WITHOUT_FLOATING_POINT
   575 #ifdef HREF_ED_WITHOUT_FLOATING_POINT
   567 			CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, 0, expectedErrorInt));
   576 			CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, 0, expectedErrorInt));
   568 #else
   577 #else
   569 			TReal32 fps = ParseOptionalRealL(aAttributes, _L8("fps"), -1);
   578 			TReal32 fps = ParseOptionalRealL(aAttributes, _L8("fps"), -1);
   665 			TLex8 lex(atomIndexDes);
   674 			TLex8 lex(atomIndexDes);
   666 			TUint32 atomIndex = ParseUint32L(atomIndexDes);				
   675 			TUint32 atomIndex = ParseUint32L(atomIndexDes);				
   667 			const TDesC8& data = FindAttributeL(aAttributes, _L8("data"));
   676 			const TDesC8& data = FindAttributeL(aAttributes, _L8("data"));
   668 			CheckForAbortL(iCallback.MosSetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data));			
   677 			CheckForAbortL(iCallback.MosSetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data));			
   669 			}						
   678 			}						
   670 		else if(elemName == _L8("DisablePort"))
   679 		else if(elemName == _L8("DisablePort") || elemName == _L8("EnablePort"))
   671 			{
   680 			{
   672 			const TDesC8& port = FindAttributeL(aAttributes, _L8("port"));
   681 			const TDesC8& port = FindAttributeL(aAttributes, _L8("port"));
   673 			TPtrC8 comp;
   682 			TPtrC8 comp;
   674 			TInt portIndex;
   683 			TInt portIndex;
   675 			ParseCompPortL(port, comp, portIndex);
   684 			ParseCompPortL(port, comp, portIndex);
   676 			CheckForAbortL(iCallback.MosDisablePort(comp, portIndex));
   685 
   677 			}
   686 			const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr"));
   678 		else if(elemName == _L8("EnablePort"))
   687 			OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
   679 			{
   688 			if (expectedError)
   680 			const TDesC8& port = FindAttributeL(aAttributes, _L8("port"));
   689 			    {
   681 			TPtrC8 comp;
   690 			    expectedErrorInt = ParseOmxErrorCode(*expectedError);
   682 			TInt portIndex;
   691 			    }
   683 			ParseCompPortL(port, comp, portIndex);
   692 
   684 			CheckForAbortL(iCallback.MosEnablePort(comp, portIndex));
   693 			if (elemName == _L8("EnablePort"))
       
   694 			    {
       
   695 			    CheckForAbortL(iCallback.MosEnablePort(comp, portIndex, expectedErrorInt));
       
   696 			    }
       
   697 			else
       
   698 			    {
       
   699 			    CheckForAbortL(iCallback.MosDisablePort(comp, portIndex, expectedErrorInt));
       
   700 			    }
   685 			}
   701 			}
   686 		else if(elemName == _L8("IgnoreEvent"))
   702 		else if(elemName == _L8("IgnoreEvent"))
   687 			{
   703 			{
   688 			const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp"));
   704 			const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp"));
   689 			const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event"));
   705 			const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event"));
   826 		    else
   842 		    else
   827 		        {
   843 		        {
   828 		        User::Leave(KErrArgument);
   844 		        User::Leave(KErrArgument);
   829 		        }
   845 		        }
   830 		    CheckForAbortL(iCallback.MosCheckConfigAudioMuteL(comp, port, mute));
   846 		    CheckForAbortL(iCallback.MosCheckConfigAudioMuteL(comp, port, mute));
       
   847 		    }   
       
   848 		else if(elemName == _L8("CheckCommonScale") || elemName == _L8("SetCommonScale"))
       
   849 		    {
       
   850 		    const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port"));
       
   851 		    TPtrC8 comp;
       
   852 		    TInt port;
       
   853 		    ParseCompPortL(compPort, comp, port);
       
   854 		    TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1);
       
   855 		    TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1);
       
   856 		    
       
   857 		    const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr"));
       
   858 		    OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone;
       
   859 		    if (expectedError)
       
   860 		        {
       
   861 		        expectedErrorInt = ParseOmxErrorCode(*expectedError);
       
   862 		        }
       
   863 
       
   864 		    if (elemName == _L8("CheckCommonScale"))
       
   865 		        {
       
   866 		        CheckForAbortL(iCallback.MosCheckConfigCommonScaleL(comp, port, width, height, expectedErrorInt));
       
   867 		        }
       
   868 		    else
       
   869 		        {
       
   870 		        CheckForAbortL(iCallback.MosSetConfigCommonScaleL(comp, port, width, height, expectedErrorInt));
       
   871 		        }
   831 		    }   
   872 		    }   
   832 		else if(elemName == _L8("SetAudioVolume"))
   873 		else if(elemName == _L8("SetAudioVolume"))
   833             {
   874             {
   834             const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port"));
   875             const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port"));
   835             TPtrC8 comp;
   876             TPtrC8 comp;