os/mm/mmapitest/mmsvs/suite/common/src/T_MMUtil.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmapitest/mmsvs/suite/common/src/T_MMUtil.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1233 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +#include <mmf/common/mmffourcc.h>
    1.25 +
    1.26 +//	User Includes
    1.27 +#include "T_MMUtil.h"
    1.28 +#include "DataWrapperBase.h"
    1.29 +
    1.30 +/*@{*/
    1.31 +_LIT(KPriority,								"priority");
    1.32 +
    1.33 +_LIT(KMdaPriorityMin,						"EMdaPriorityMin");
    1.34 +_LIT(KMdaPriorityNormal,					"EMdaPriorityNormal");
    1.35 +_LIT(KMdaPriorityMax,						"EMdaPriorityMax");
    1.36 +
    1.37 +_LIT(KPriorityPreference,					"prioritypreference");
    1.38 +
    1.39 +_LIT(KMdaPriorityPreferenceNone,			"None");
    1.40 +_LIT(KMdaPriorityPreferenceTime,			"Time");
    1.41 +_LIT(KMdaPriorityPreferenceQuality,			"Quality");
    1.42 +_LIT(KMdaPriorityPreferenceTimeAndQuality,	"TimeAndQuality");
    1.43 +
    1.44 +_LIT(KThreadPriority,						"threadpriority");
    1.45 +
    1.46 +_LIT(KEPriorityNull,						"EPriorityNull");
    1.47 +_LIT(KEPriorityMuchLess,					"EPriorityMuchLess");
    1.48 +_LIT(KEPriorityLess,						"EPriorityLess");
    1.49 +_LIT(KEPriorityNormal,						"EPriorityNormal");
    1.50 +_LIT(KEPriorityMore,						"EPriorityMore");
    1.51 +_LIT(KEPriorityMuchMore,					"EPriorityMuchMore");
    1.52 +_LIT(KEPriorityRealTime,					"EPriorityRealTime");
    1.53 +_LIT(KEPriorityAbsoluteVeryLow,				"EPriorityAbsoluteVeryLow");
    1.54 +_LIT(KEPriorityAbsoluteLow,					"EPriorityAbsoluteLow");
    1.55 +_LIT(KEPriorityAbsoluteBackground,			"EPriorityAbsoluteBackground");
    1.56 +_LIT(KEPriorityAbsoluteForeground,			"EPriorityAbsoluteForeground");
    1.57 +_LIT(KEPriorityAbsoluteHigh,				"EPriorityAbsoluteHigh");
    1.58 +
    1.59 +_LIT(KFourCC,								"fourcc");
    1.60 +
    1.61 +_LIT(KDesMMFFourCCCodePCM8, 				"KMMFFourCCCodePCM8");
    1.62 +_LIT(KDesMMFFourCCCodePCMU8,		 		"KMMFFourCCCodePCMU8");
    1.63 +_LIT(KDesMMFFourCCCodePCM16, 				"KMMFFourCCCodePCM16");
    1.64 +_LIT(KDesMMFFourCCCodePCMU16,		 		"KMMFFourCCCodePCMU16");
    1.65 +_LIT(KDesMMFFourCCCodePCM16B, 				"KMMFFourCCCodePCM16B");
    1.66 +_LIT(KDesMMFFourCCCodePCMU16B,		 		"KMMFFourCCCodePCMU16B");
    1.67 +_LIT(KDesMMFFourCCCodeIMAD, 				"KMMFFourCCCodeIMAD");
    1.68 +_LIT(KDesMMFFourCCCodeIMAS,		 			"KMMFFourCCCodeIMAS");
    1.69 +_LIT(KDesMMFFourCCCodeALAW,					"KMMFFourCCCodeALAW");
    1.70 +_LIT(KDesMMFFourCCCodeMuLAW,		 		"KMMFFourCCCodeMuLAW");
    1.71 +_LIT(KDesMMFFourCCCodeGSM610,				"KMMFFourCCCodeGSM610");
    1.72 +_LIT(KDesFourCCCodeNULL,					"KMMFFourCCCodeNULL");
    1.73 +_LIT(KDesMMFFourCCCodeAMR,					"KMMFFourCCCodeAMR");
    1.74 +_LIT(KDesMMFFourCCCodeAAC,					"KMMFFourCCCodeAAC");
    1.75 +_LIT(KDesMMFFourCCCodeAWB,					"KMMFFourCCCodeAWB");
    1.76 +_LIT(KDesMMFFourCCCodeMP3,					"KMMFFourCCCodeMP3");
    1.77 +_LIT(KDesMMFFourCCCodeATRAC3, 				"KMMFFourCCCodeATRAC3");
    1.78 +_LIT(KDesMMFFourCCCodeSBC,					"KMMFFourCCCodeSBC");
    1.79 +_LIT(KDesMMFFourCCCodeAMRW,					"KMMFFourCCCodeAMRW");
    1.80 +_LIT(KDesMMFFourCCCodeADTS,					"KMMFFourCCCodeADTS");
    1.81 +_LIT(KDesMMFFourCCCodeUnknown,				"KMMFFourCCCodeUnknown");
    1.82 +
    1.83 +_LIT(KImageType,							"imagetype");
    1.84 +
    1.85 +_LIT(KImageTypeThumbnail,					"EImageTypeThumbnail");
    1.86 +_LIT(KImageTypeMain,						"EImageTypeMain");
    1.87 +
    1.88 +_LIT(KIntent,								"intent");
    1.89 +
    1.90 +_LIT(KIntentPeek,							"EPeek");
    1.91 +_LIT(KIntentPlay,							"EPlay");
    1.92 +_LIT(KIntentView,							"EView");
    1.93 +_LIT(KIntentExecute,						"EExecute");
    1.94 +_LIT(KIntentPrint,							"EPrint");
    1.95 +_LIT(KIntentPause,							"EPause");
    1.96 +_LIT(KIntentContinue,						"EContinue");
    1.97 +_LIT(KIntentStop,							"EStop");
    1.98 +_LIT(KIntentUnknown,						"EUnknown");
    1.99 +_LIT(KIntentInstall,						"EInstall");
   1.100 +
   1.101 +_LIT(KMidiStateClosedDisengaged,			"EMidiStateClosedDisengaged");
   1.102 +_LIT(KMidiStateOpenDisengaged,				"EMidiStateOpenDisengaged");
   1.103 +_LIT(KMidiStateOpenPlaying,					"EMidiStateOpenPlaying");
   1.104 +_LIT(KMidiStateClosedEngaged,				"EMidiStateClosedEngaged");
   1.105 +_LIT(KMidiStateOpenEngaged,					"EMidiStateOpenEngaged");
   1.106 +
   1.107 +_LIT(KSampleRateFixed,						"SampleRateFixed");
   1.108 +_LIT(KSampleRateAnyInRange,					"SampleRateAnyInRange");
   1.109 +_LIT(KSampleRate8000Hz,						"SampleRate8000Hz");
   1.110 +_LIT(KSampleRate11025Hz,					"SampleRate11025Hz");
   1.111 +_LIT(KSampleRate12000Hz,					"SampleRate12000Hz");
   1.112 +_LIT(KSampleRate16000Hz,					"SampleRate16000Hz");
   1.113 +_LIT(KSampleRate22050Hz,					"SampleRate22050Hz");
   1.114 +_LIT(KSampleRate24000Hz,					"SampleRate24000Hz");
   1.115 +_LIT(KSampleRate32000Hz,					"SampleRate32000Hz");
   1.116 +_LIT(KSampleRate44100Hz,					"SampleRate44100Hz");
   1.117 +_LIT(KSampleRate48000Hz,					"SampleRate48000Hz");
   1.118 +_LIT(KSampleRate96000Hz,					"SampleRate96000Hz");
   1.119 +_LIT(KSampleRate64000Hz,					"SampleRate64000Hz");
   1.120 +_LIT(KChannelsMono,							"ChannelsMono");
   1.121 +_LIT(KChannelsStereo,						"ChannelsStereo");
   1.122 +_LIT(KRoutingControl,						"RoutingControl");
   1.123 +_LIT(KRealTime,								"RealTime");
   1.124 +
   1.125 +_LIT(KNoLocalRouting,						"NoLocalRouting");
   1.126 +_LIT(KNoNetworkRouting,						"NoNetworkRouting");
   1.127 +
   1.128 +_LIT(KOptionNone,							"OptionNone");
   1.129 +_LIT(KOptionNoDither,						"OptionNoDither");
   1.130 +_LIT(KOptionAlwaysThread,					"OptionAlwaysThread");
   1.131 +_LIT(KOptionAllowZeroFrameOpen,				"OptionAllowZeroFrameOpen");
   1.132 +_LIT(KAllowGeneratedMask,					"AllowGeneratedMask");
   1.133 +
   1.134 +_LIT(KAgentPropertyBufferSize,				"AgentPropertyBufferSize");
   1.135 +_LIT(KAgentPropertyAgentUI,					"AgentPropertyAgentUI");
   1.136 +_LIT(KAgentPropertyMultipleSequence,		"AgentPropertyMultipleSequence");
   1.137 +
   1.138 +_LIT(KCmdCapabilty,							"capabilty%d");
   1.139 +_LIT(KCmdChannels,							"channels");
   1.140 +_LIT(KCmdFlags,								"flags");
   1.141 +_LIT(KCmdMaxVolume,							"maxvolume");
   1.142 +_LIT(KCmdSampleRate,						"samplerate");
   1.143 +_LIT(KCmdVolume,							"volume");
   1.144 +
   1.145 +_LIT(KDModeNone,							"None");
   1.146 +_LIT(KDModeGray2,							"Gray2");
   1.147 +_LIT(KDModeGray4,							"Gray4");
   1.148 +_LIT(KDModeGray16,							"Gray16");
   1.149 +_LIT(KDModeGray256,							"Gray256");
   1.150 +_LIT(KDModeColor16,							"Color16");
   1.151 +_LIT(KDModeColor256,						"Color256");
   1.152 +_LIT(KDModeColor64K,						"Color64K");
   1.153 +_LIT(KDModeColor16M,						"Color16M");
   1.154 +_LIT(KDModeRgb,								"Rgb");
   1.155 +_LIT(KDModeColor4K,							"Color4K");
   1.156 +_LIT(KDModeColor16MU,						"Color16MU");
   1.157 +_LIT(KDModeColor16MA,						"Color16MA");
   1.158 +_LIT(KDModeColorLast,						"ColorLast");
   1.159 +
   1.160 +_LIT(KEVideoRotationNone,					"None");
   1.161 +_LIT(KEVideoRotationClockwise90,			"Clockwise90");
   1.162 +_LIT(KEVideoRotationClockwise180,			"Clockwise180");
   1.163 +_LIT(KEVideoRotationClockwise270,			"Clockwise270");
   1.164 +_LIT(KEVideoRotationUnknown,				"Unknown");
   1.165 +
   1.166 +
   1.167 +
   1.168 +_LIT(KCount,								"count");
   1.169 +/*@}*/
   1.170 +
   1.171 +TBool CT_MMUtil::ReadMdaPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TInt& aPriority)
   1.172 +	{
   1.173 +	TPtrC	str;
   1.174 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KPriority(), str);
   1.175 +	if ( ret )
   1.176 +		{
   1.177 +		if ( str==KMdaPriorityMin )
   1.178 +			{
   1.179 +			aPriority=EMdaPriorityMin;
   1.180 +			}
   1.181 +		else if ( str==KMdaPriorityNormal )
   1.182 +			{
   1.183 +			aPriority=EMdaPriorityNormal;
   1.184 +			}
   1.185 +		else if ( str==KMdaPriorityMax )
   1.186 +			{
   1.187 +			aPriority=EMdaPriorityMax;
   1.188 +			}
   1.189 +		else
   1.190 +			{
   1.191 +			if ( !aDataWrapper.GetIntFromConfig(aSection, KPriority(), aPriority) )
   1.192 +				{
   1.193 +				aDataWrapper.ERR_PRINTF2(_L("Illegal priority %S"), &KPriority());
   1.194 +				aDataWrapper.SetBlockResult(EFail);
   1.195 +				}
   1.196 +			}
   1.197 +		}
   1.198 +
   1.199 +	aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriority %S = %d"), &KPriority(), ret);
   1.200 +
   1.201 +	return ret;
   1.202 +	}
   1.203 +
   1.204 +TBool CT_MMUtil::ReadMdaPriorityPreference(CDataWrapper& aDataWrapper, const TDesC& aSection, TMdaPriorityPreference& aPreference)
   1.205 +	{
   1.206 +	TPtrC	str;
   1.207 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KPriorityPreference(), str);
   1.208 +	if ( ret )
   1.209 +		{
   1.210 +		if ( str==KMdaPriorityPreferenceNone )
   1.211 +			{
   1.212 +			aPreference=EMdaPriorityPreferenceNone;
   1.213 +			}
   1.214 +		else if ( str==KMdaPriorityPreferenceTime )
   1.215 +			{
   1.216 +			aPreference=EMdaPriorityPreferenceTime;
   1.217 +			}
   1.218 +		else if ( str==KMdaPriorityPreferenceQuality )
   1.219 +			{
   1.220 +			aPreference=EMdaPriorityPreferenceQuality;
   1.221 +			}
   1.222 +		else if ( str==KMdaPriorityPreferenceTimeAndQuality )
   1.223 +			{
   1.224 +			aPreference=EMdaPriorityPreferenceTimeAndQuality;
   1.225 +			}
   1.226 +		else
   1.227 +			{
   1.228 +			TInt	intVal;
   1.229 +			if ( aDataWrapper.GetIntFromConfig(aSection, KPriorityPreference(), intVal) )
   1.230 +				{
   1.231 +				aPreference=(TMdaPriorityPreference)intVal;
   1.232 +				}
   1.233 +			else
   1.234 +				{
   1.235 +				aDataWrapper.ERR_PRINTF2(_L("Illegal TMdaPriorityPreference %S"), &KPriorityPreference());
   1.236 +				aDataWrapper.SetBlockResult(EFail);
   1.237 +				}
   1.238 +			}
   1.239 +		}
   1.240 +
   1.241 +	aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriorityPreference %S = %d"), &KPriorityPreference(), ret);
   1.242 +
   1.243 +	return ret;
   1.244 +	}
   1.245 +
   1.246 +TBool CT_MMUtil::ReadThreadPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TThreadPriority& aPriority)
   1.247 +	{
   1.248 +	TPtrC	str;
   1.249 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KThreadPriority(), str);
   1.250 +	if ( ret )
   1.251 +		{
   1.252 +		if ( str==KEPriorityNull )
   1.253 +			{
   1.254 +			aPriority = EPriorityNull;
   1.255 +			}
   1.256 +		else if ( str==KEPriorityMuchLess )
   1.257 +			{
   1.258 +			aPriority = EPriorityMuchLess;
   1.259 +			}
   1.260 +		else if ( str==KEPriorityLess )
   1.261 +			{
   1.262 +			aPriority = EPriorityLess;
   1.263 +			}
   1.264 +		else if ( str==KEPriorityNormal )
   1.265 +			{
   1.266 +			aPriority = EPriorityNormal;
   1.267 +			}
   1.268 +		else if ( str==KEPriorityMore )
   1.269 +			{
   1.270 +			aPriority = EPriorityMore;
   1.271 +			}
   1.272 +		else if ( str==KEPriorityMuchMore )
   1.273 +			{
   1.274 +			aPriority = EPriorityMuchMore;
   1.275 +			}
   1.276 +		else if ( str==KEPriorityRealTime )
   1.277 +			{
   1.278 +			aPriority = EPriorityRealTime;
   1.279 +			}
   1.280 +		else if ( str==KEPriorityAbsoluteVeryLow )
   1.281 +			{
   1.282 +			aPriority = EPriorityAbsoluteVeryLow;
   1.283 +			}
   1.284 +		else if ( str==KEPriorityAbsoluteLow )
   1.285 +			{
   1.286 +			aPriority = EPriorityAbsoluteLow;
   1.287 +			}
   1.288 +		else if ( str==KEPriorityAbsoluteBackground )
   1.289 +			{
   1.290 +			aPriority = EPriorityAbsoluteBackground;
   1.291 +			}
   1.292 +		else if ( str==KEPriorityAbsoluteForeground )
   1.293 +			{
   1.294 +			aPriority = EPriorityAbsoluteForeground;
   1.295 +			}
   1.296 +		else if ( str==KEPriorityAbsoluteHigh )
   1.297 +			{
   1.298 +			aPriority = EPriorityAbsoluteHigh;
   1.299 +			}
   1.300 +		else
   1.301 +			{
   1.302 +			TInt	intVal;
   1.303 +			if ( aDataWrapper.GetIntFromConfig(aSection, KThreadPriority(), intVal) )
   1.304 +				{
   1.305 +				aPriority=(TThreadPriority)intVal;
   1.306 +				}
   1.307 +			else
   1.308 +				{
   1.309 +				aDataWrapper.ERR_PRINTF2(_L("Illegal TThreadPriority %S"), &KThreadPriority());
   1.310 +				aDataWrapper.SetBlockResult(EFail);
   1.311 +				}
   1.312 +			}
   1.313 +		}
   1.314 +
   1.315 +	aDataWrapper.INFO_PRINTF3(_L("ReadThreadPriority %S = %d"), &KThreadPriority(), ret);
   1.316 +
   1.317 +	return ret;
   1.318 +	}
   1.319 +
   1.320 +TBool CT_MMUtil::ReadFourCC(CDataWrapper& aDataWrapper, const TDesC& aSection, TFourCC& aFourCC)
   1.321 +	{
   1.322 +	TPtrC	str;
   1.323 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KFourCC(), str);
   1.324 +
   1.325 +	if ( ret )
   1.326 +		{
   1.327 +		if( str==KDesMMFFourCCCodePCM8 )
   1.328 +			{
   1.329 +			aFourCC=KMMFFourCCCodePCM8;
   1.330 +			}
   1.331 +		else if( str==KDesMMFFourCCCodePCMU8 )
   1.332 +			{
   1.333 +	 		aFourCC=KMMFFourCCCodePCMU8;
   1.334 +			}
   1.335 +		else if( str==KDesMMFFourCCCodePCM16 )
   1.336 +			{
   1.337 +			aFourCC=KMMFFourCCCodePCM16;
   1.338 +			}
   1.339 +		else if( str==KDesMMFFourCCCodePCMU16 )
   1.340 +			{
   1.341 +			aFourCC=KMMFFourCCCodePCMU16;
   1.342 +			}
   1.343 +		else if( str==KDesMMFFourCCCodePCM16B )
   1.344 +			{
   1.345 +			aFourCC=KMMFFourCCCodePCM16B;
   1.346 +			}
   1.347 +		else if( str==KDesMMFFourCCCodePCMU16B )
   1.348 +			{
   1.349 +	 		aFourCC=KMMFFourCCCodePCMU16B;
   1.350 +			}
   1.351 +		else if( str==KDesMMFFourCCCodeIMAD )
   1.352 +			{
   1.353 +			aFourCC=KMMFFourCCCodeIMAD;
   1.354 +			}
   1.355 +		else if( str==KDesMMFFourCCCodeIMAS )
   1.356 +			{
   1.357 +	 		aFourCC=KMMFFourCCCodeIMAS;
   1.358 +			}
   1.359 +		else if( str==KDesMMFFourCCCodeALAW )
   1.360 +			{
   1.361 +	 		aFourCC=KMMFFourCCCodeALAW;
   1.362 +			}
   1.363 +		else if( str==KDesMMFFourCCCodeMuLAW )
   1.364 +			{
   1.365 +	 		aFourCC=KMMFFourCCCodeMuLAW;
   1.366 +			}
   1.367 +		else if( str==KDesMMFFourCCCodeGSM610 )
   1.368 +			{
   1.369 +	 		aFourCC=KMMFFourCCCodeGSM610;
   1.370 +			}
   1.371 +		else if( str==KDesFourCCCodeNULL )
   1.372 +			{
   1.373 +	 		aFourCC=KMMFFourCCCodeNULL;
   1.374 +			}
   1.375 +		else if( str==KDesMMFFourCCCodeAMR )
   1.376 +			{
   1.377 +	 		aFourCC=KMMFFourCCCodeAMR;
   1.378 +			}
   1.379 +		else if( str==KDesMMFFourCCCodeAAC )
   1.380 +			{
   1.381 +	 		aFourCC=KMMFFourCCCodeAAC;
   1.382 +			}
   1.383 +		else if( str==KDesMMFFourCCCodeAWB )
   1.384 +			{
   1.385 +	 		aFourCC=KMMFFourCCCodeAWB;
   1.386 +			}
   1.387 +		else if( str==KDesMMFFourCCCodeMP3	)
   1.388 +			{
   1.389 +	 		aFourCC=KMMFFourCCCodeMP3;
   1.390 +			}
   1.391 +		else if( str==KDesMMFFourCCCodeATRAC3 )
   1.392 +			{
   1.393 +	 		aFourCC=KMMFFourCCCodeATRAC3;
   1.394 +			}
   1.395 +		else if( str==KDesMMFFourCCCodeSBC )
   1.396 +			{
   1.397 +	 		aFourCC=KMMFFourCCCodeSBC;
   1.398 +			}
   1.399 +		else if( str==KDesMMFFourCCCodeAMRW )
   1.400 +			{
   1.401 +	 		aFourCC=KMMFFourCCCodeAMRW;
   1.402 +			}
   1.403 +		else if( str==KDesMMFFourCCCodeADTS )
   1.404 +			{
   1.405 +	 		aFourCC=KMMFFourCCCodeADTS;
   1.406 +			}
   1.407 +		else
   1.408 +			{
   1.409 +			TInt	intVal;
   1.410 +			if ( aDataWrapper.GetIntFromConfig(aSection, KFourCC(), intVal) )
   1.411 +				{
   1.412 +				aFourCC=intVal;
   1.413 +				}
   1.414 +			else
   1.415 +				{
   1.416 +				aDataWrapper.ERR_PRINTF2(_L("Illegal TFourCC %S"), &KFourCC());
   1.417 +				aDataWrapper.SetBlockResult(EFail);
   1.418 +				}
   1.419 +			}
   1.420 +		}
   1.421 +
   1.422 +	return ret;
   1.423 +	}
   1.424 +
   1.425 +TBool CT_MMUtil::ReadImageType(CDataWrapper& aDataWrapper, const TDesC& aSection, CImageDecoder::TImageType& aImageType)
   1.426 +	{
   1.427 +	TPtrC	str;
   1.428 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KImageType(), str);
   1.429 +
   1.430 +	if ( ret )
   1.431 +		{
   1.432 +		if ( str==KImageTypeThumbnail )
   1.433 +			{
   1.434 +			aImageType=CImageDecoder::EImageTypeThumbnail;
   1.435 +			}
   1.436 +		else if ( str==KImageTypeMain )
   1.437 +			{
   1.438 +			aImageType=CImageDecoder::EImageTypeMain;
   1.439 +			}
   1.440 +		else
   1.441 +			{
   1.442 +			TInt	intVal;
   1.443 +			if ( aDataWrapper.GetIntFromConfig(aSection, KImageType(), intVal) )
   1.444 +				{
   1.445 +				aImageType=(CImageDecoder::TImageType)intVal;
   1.446 +				}
   1.447 +			else
   1.448 +				{
   1.449 +				aDataWrapper.ERR_PRINTF2(_L("Illegal CImageDecoder::TImageType %S"), &KImageType());
   1.450 +				aDataWrapper.SetBlockResult(EFail);
   1.451 +				}
   1.452 +			}
   1.453 +		}
   1.454 +
   1.455 +	return ret;
   1.456 +	}
   1.457 +
   1.458 +TBool CT_MMUtil::ReadIntent(CDataWrapper& aDataWrapper, const TDesC& aSection, ContentAccess::TIntent& aIntent)
   1.459 +	{
   1.460 +	TPtrC	str;
   1.461 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KIntent(), str);
   1.462 +
   1.463 +	if ( ret )
   1.464 +		{
   1.465 +		if ( str==KIntentPeek )
   1.466 +			{
   1.467 +			aIntent=ContentAccess::EPeek;
   1.468 +			}
   1.469 +		else if ( str==KIntentPlay )
   1.470 +			{
   1.471 +			aIntent=ContentAccess::EPlay;
   1.472 +			}
   1.473 +		else if ( str==KIntentView )
   1.474 +			{
   1.475 +			aIntent=ContentAccess::EView;
   1.476 +			}
   1.477 +		else if ( str==KIntentExecute )
   1.478 +			{
   1.479 +			aIntent=ContentAccess::EExecute;
   1.480 +			}
   1.481 +		else if ( str==KIntentPrint )
   1.482 +			{
   1.483 +			aIntent=ContentAccess::EPrint;
   1.484 +			}
   1.485 +		else if ( str==KIntentPause )
   1.486 +			{
   1.487 +			aIntent=ContentAccess::EPause;
   1.488 +			}
   1.489 +		else if ( str==KIntentContinue )
   1.490 +			{
   1.491 +			aIntent=ContentAccess::EContinue;
   1.492 +			}
   1.493 +		else if ( str==KIntentStop )
   1.494 +			{
   1.495 +			aIntent=ContentAccess::EStop;
   1.496 +			}
   1.497 +		else if ( str==KIntentUnknown )
   1.498 +			{
   1.499 +			aIntent=ContentAccess::EUnknown;
   1.500 +			}
   1.501 +		else if ( str==KIntentInstall )
   1.502 +			{
   1.503 +			aIntent=ContentAccess::EInstall;
   1.504 +			}
   1.505 +		else
   1.506 +			{
   1.507 +			TInt	intVal;
   1.508 +			if ( aDataWrapper.GetIntFromConfig(aSection, KIntent(), intVal) )
   1.509 +				{
   1.510 +				aIntent=(ContentAccess::TIntent)intVal;
   1.511 +				}
   1.512 +			else
   1.513 +				{
   1.514 +				aDataWrapper.ERR_PRINTF2(_L("Illegal ContentAccess::TIntent %S"), &KIntent());
   1.515 +				aDataWrapper.SetBlockResult(EFail);
   1.516 +				}
   1.517 +			}
   1.518 +		}
   1.519 +
   1.520 +	return ret;
   1.521 +	}
   1.522 +
   1.523 +TBool CT_MMUtil::ReadMidiState(CDataWrapper& aDataWrapper, const TDesC& aSection, const TDesC& aKeyName, TMidiState& aState)
   1.524 +	{
   1.525 +	TPtrC	str;
   1.526 +	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, aKeyName, str);
   1.527 +
   1.528 +	if ( ret )
   1.529 +		{
   1.530 +		if ( str==KMidiStateClosedDisengaged )
   1.531 +			{
   1.532 +			aState=EMidiStateClosedDisengaged;
   1.533 +			}
   1.534 +		else if ( str==KMidiStateOpenDisengaged )
   1.535 +			{
   1.536 +			aState=EMidiStateOpenDisengaged;
   1.537 +			}
   1.538 +		else if ( str==KMidiStateOpenPlaying )
   1.539 +			{
   1.540 +			aState=EMidiStateOpenPlaying;
   1.541 +			}
   1.542 +		else if ( str==KMidiStateClosedEngaged )
   1.543 +			{
   1.544 +			aState=EMidiStateClosedEngaged;
   1.545 +			}
   1.546 +		else if ( str==KMidiStateOpenEngaged )
   1.547 +			{
   1.548 +			aState=EMidiStateOpenEngaged;
   1.549 +			}
   1.550 +		else
   1.551 +			{
   1.552 +			TInt	intVal;
   1.553 +			if ( aDataWrapper.GetIntFromConfig(aSection, aKeyName, intVal) )
   1.554 +				{
   1.555 +				aState=(TMidiState)intVal;
   1.556 +				}
   1.557 +			else
   1.558 +				{
   1.559 +				ret=EFalse;
   1.560 +				aDataWrapper.ERR_PRINTF2(_L("Illegal TMidiState %S"), &aKeyName);
   1.561 +				aDataWrapper.SetBlockResult(EFail);
   1.562 +				}
   1.563 +			}
   1.564 +		}
   1.565 +
   1.566 +	return ret;
   1.567 +	}
   1.568 +
   1.569 +TBool CT_MMUtil::ConvertToAudioCaps(const TDesC& aDesc, TMdaAudioDataSettings::TAudioCaps& aAudioCaps)
   1.570 +	{
   1.571 +	TBool	ret=ETrue;
   1.572 +
   1.573 +	if ( aDesc==KSampleRateFixed )
   1.574 +		{
   1.575 +		aAudioCaps=TMdaAudioDataSettings::ESampleRateFixed;
   1.576 +		}
   1.577 +	else if ( aDesc==KSampleRateAnyInRange )
   1.578 +		{
   1.579 +		aAudioCaps=TMdaAudioDataSettings::ESampleRateAnyInRange;
   1.580 +		}
   1.581 +	else if ( aDesc==KSampleRate8000Hz )
   1.582 +		{
   1.583 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate8000Hz;
   1.584 +		}
   1.585 +	else if ( aDesc==KSampleRate11025Hz )
   1.586 +		{
   1.587 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate11025Hz;
   1.588 +		}
   1.589 +	else if ( aDesc==KSampleRate12000Hz )
   1.590 +		{
   1.591 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate12000Hz;
   1.592 +		}
   1.593 +	else if ( aDesc==KSampleRate16000Hz )
   1.594 +		{
   1.595 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate16000Hz;
   1.596 +		}
   1.597 +	else if ( aDesc==KSampleRate22050Hz )
   1.598 +		{
   1.599 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate22050Hz;
   1.600 +		}
   1.601 +	else if ( aDesc==KSampleRate24000Hz )
   1.602 +		{
   1.603 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate24000Hz;
   1.604 +		}
   1.605 +	else if ( aDesc==KSampleRate32000Hz )
   1.606 +		{
   1.607 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate32000Hz;
   1.608 +		}
   1.609 +	else if ( aDesc==KSampleRate44100Hz )
   1.610 +		{
   1.611 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate44100Hz;
   1.612 +		}
   1.613 +	else if ( aDesc==KSampleRate48000Hz )
   1.614 +		{
   1.615 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate48000Hz;
   1.616 +		}
   1.617 +	else if ( aDesc==KSampleRate96000Hz )
   1.618 +		{
   1.619 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate96000Hz;
   1.620 +		}
   1.621 +	else if ( aDesc==KSampleRate64000Hz )
   1.622 +		{
   1.623 +		aAudioCaps=TMdaAudioDataSettings::ESampleRate64000Hz;
   1.624 +		}
   1.625 +	else if ( aDesc==KChannelsMono )
   1.626 +		{
   1.627 +		aAudioCaps=TMdaAudioDataSettings::EChannelsMono;
   1.628 +		}
   1.629 +	else if ( aDesc==KChannelsStereo )
   1.630 +		{
   1.631 +		aAudioCaps=TMdaAudioDataSettings::EChannelsStereo;
   1.632 +		}
   1.633 +	else if ( aDesc==KRoutingControl )
   1.634 +		{
   1.635 +		aAudioCaps=TMdaAudioDataSettings::ERoutingControl;
   1.636 +		}
   1.637 +	else if ( aDesc==KRealTime )
   1.638 +		{
   1.639 +		aAudioCaps=TMdaAudioDataSettings::ERealTime;
   1.640 +		}
   1.641 +	else
   1.642 +		{
   1.643 +		ret=EFalse;
   1.644 +		}
   1.645 +
   1.646 +	return ret;
   1.647 +	}
   1.648 +
   1.649 +TBool CT_MMUtil::ConvertToAudioFlags(const TDesC& aDesc, TMdaAudioDataSettings::TAudioFlags& aAudioFlags)
   1.650 +	{
   1.651 +	TBool	ret=ETrue;
   1.652 +
   1.653 +	if ( aDesc==KNoLocalRouting )
   1.654 +		{
   1.655 +		aAudioFlags=TMdaAudioDataSettings::ENoLocalRouting;
   1.656 +		}
   1.657 +	else if ( aDesc==KNoNetworkRouting )
   1.658 +		{
   1.659 +		aAudioFlags=TMdaAudioDataSettings::ENoNetworkRouting;
   1.660 +		}
   1.661 +	else
   1.662 +		{
   1.663 +		ret=EFalse;
   1.664 +		}
   1.665 +
   1.666 +	return ret;
   1.667 +	}
   1.668 +
   1.669 +TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageDecoder::TOptions& aOption)
   1.670 +	{
   1.671 +	TBool	ret=ETrue;
   1.672 +
   1.673 +	if ( aDesc==KOptionNone )
   1.674 +		{
   1.675 +		aOption=CImageDecoder::EOptionNone;
   1.676 +		}
   1.677 +	else if ( aDesc==KOptionNoDither )
   1.678 +		{
   1.679 +		aOption=CImageDecoder::EOptionNoDither;
   1.680 +		}
   1.681 +	else if ( aDesc==KOptionAlwaysThread )
   1.682 +		{
   1.683 +		aOption=CImageDecoder::EOptionAlwaysThread;
   1.684 +		}
   1.685 +	else if ( aDesc==KOptionAllowZeroFrameOpen )
   1.686 +		{
   1.687 +		aOption=CImageDecoder::EOptionAllowZeroFrameOpen;
   1.688 +		}
   1.689 +	else if ( aDesc==KAllowGeneratedMask )
   1.690 +		{
   1.691 +		aOption=CImageDecoder::EAllowGeneratedMask;
   1.692 +		}
   1.693 +	else
   1.694 +		{
   1.695 +		ret=EFalse;
   1.696 +		}
   1.697 +
   1.698 +	return ret;
   1.699 +	}
   1.700 +
   1.701 +TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageEncoder::TOptions& aOption)
   1.702 +	{
   1.703 +	TBool	ret=ETrue;
   1.704 +
   1.705 +	if ( aDesc==KOptionNone )
   1.706 +		{
   1.707 +		aOption=CImageEncoder::EOptionNone;
   1.708 +		}
   1.709 +	else if ( aDesc==KOptionAlwaysThread )
   1.710 +		{
   1.711 +		aOption=CImageEncoder::EOptionAlwaysThread;
   1.712 +		}
   1.713 +	else
   1.714 +		{
   1.715 +		ret=EFalse;
   1.716 +		}
   1.717 +
   1.718 +	return ret;
   1.719 +	}
   1.720 +
   1.721 +TBool CT_MMUtil::ConvertToAgentProperty(const TDesC& aDesc, ContentAccess::TAgentProperty& aAgentProperty)
   1.722 +	{
   1.723 +	TBool	ret=ETrue;
   1.724 +
   1.725 +	if ( aDesc==KAgentPropertyBufferSize )
   1.726 +		{
   1.727 +		aAgentProperty=ContentAccess::EAgentPropertyBufferSize;
   1.728 +		}
   1.729 +	else if ( aDesc==KAgentPropertyAgentUI )
   1.730 +		{
   1.731 +		aAgentProperty=ContentAccess::EAgentPropertyAgentUI;
   1.732 +		}
   1.733 +	else if ( aDesc==KAgentPropertyMultipleSequence )
   1.734 +		{
   1.735 +		aAgentProperty=ContentAccess::EAgentPropertyMultipleSequence;
   1.736 +		}
   1.737 +	else
   1.738 +		{
   1.739 +		ret=EFalse;
   1.740 +		}
   1.741 +
   1.742 +	return ret;
   1.743 +	}
   1.744 +
   1.745 +const TDesC& CT_MMUtil::GetFourCCString(TUint32 aValue)
   1.746 +	{
   1.747 +	switch(aValue)
   1.748 +		{
   1.749 +	case KMMFFourCCCodePCM8:
   1.750 +		return KDesMMFFourCCCodePCM8;
   1.751 +	case KMMFFourCCCodePCMU8:
   1.752 +		return KDesMMFFourCCCodePCMU8;
   1.753 +	case KMMFFourCCCodePCM16:
   1.754 +		return KDesMMFFourCCCodePCM16;
   1.755 +	case KMMFFourCCCodePCMU16:
   1.756 +		return KDesMMFFourCCCodePCMU16;
   1.757 +	case KMMFFourCCCodePCM16B:
   1.758 +		return KDesMMFFourCCCodePCM16B;
   1.759 +	case KMMFFourCCCodePCMU16B:
   1.760 +		return KDesMMFFourCCCodePCMU16B;
   1.761 +	case KMMFFourCCCodeIMAD:
   1.762 +		return KDesMMFFourCCCodeIMAD;
   1.763 +	case KMMFFourCCCodeIMAS:
   1.764 +		return  KDesMMFFourCCCodeIMAS;
   1.765 +	case KMMFFourCCCodeALAW:
   1.766 +		return KDesMMFFourCCCodeALAW;
   1.767 +	case KMMFFourCCCodeMuLAW:
   1.768 +		return KDesMMFFourCCCodeMuLAW;
   1.769 +	case KMMFFourCCCodeGSM610:
   1.770 +		return KDesMMFFourCCCodeGSM610;
   1.771 +	case KMMFFourCCCodeNULL:
   1.772 +		return KDesFourCCCodeNULL;
   1.773 +	case KMMFFourCCCodeAMR:
   1.774 +		return KDesMMFFourCCCodeAMR;
   1.775 +	case KMMFFourCCCodeAAC:
   1.776 +		return KDesMMFFourCCCodeAAC;
   1.777 +	case KMMFFourCCCodeAWB:
   1.778 +		return KDesMMFFourCCCodeAWB;
   1.779 +	case KMMFFourCCCodeMP3:
   1.780 +		return KDesMMFFourCCCodeMP3;
   1.781 +	case KMMFFourCCCodeATRAC3:
   1.782 +		return KDesMMFFourCCCodeATRAC3;
   1.783 +	case KMMFFourCCCodeSBC:
   1.784 +		return KDesMMFFourCCCodeSBC;
   1.785 +	case KMMFFourCCCodeAMRW:
   1.786 +		return KDesMMFFourCCCodeAMRW;
   1.787 +	case KMMFFourCCCodeADTS:
   1.788 +		return KDesMMFFourCCCodeADTS;
   1.789 +	default:
   1.790 +		break;
   1.791 +		};
   1.792 +	return KDesMMFFourCCCodeUnknown;
   1.793 +	}
   1.794 +
   1.795 +TBool CT_MMUtil::ReadAudioDataSettings(CDataWrapper& aDataWrapper, TMdaAudioDataSettings& aSettings, const TDesC& aSection)
   1.796 +	{
   1.797 +	TBool	ret=EFalse;
   1.798 +	TBool	callQuery=ETrue;
   1.799 +
   1.800 +	//	Read capabilities
   1.801 +	TInt	index=0;
   1.802 +	TBool	moreData=ETrue;
   1.803 +	TPtrC	capabilityString;
   1.804 +	TInt	capability=0;
   1.805 +	TBool	hasCapabilty=EFalse;
   1.806 +	while ( moreData )
   1.807 +		{
   1.808 +		TBuf<KMaxTestExecuteCommandLength>	capabilityTemp;
   1.809 +		capabilityTemp.Format(KCmdCapabilty(), ++index);
   1.810 +		if ( aDataWrapper.GetStringFromConfig(aSection, capabilityTemp, capabilityString) )
   1.811 +			{
   1.812 +			TMdaAudioDataSettings::TAudioCaps	audioCap;
   1.813 +			if ( ConvertToAudioCaps(capabilityString, audioCap) )
   1.814 +				{
   1.815 +				capability |= audioCap;
   1.816 +				hasCapabilty=ETrue;
   1.817 +				}
   1.818 +			else
   1.819 +				{
   1.820 +				aDataWrapper.ERR_PRINTF2(_L("Illegal capability %S"), &capabilityString);
   1.821 +				aDataWrapper.SetBlockResult(EFail);
   1.822 +				}
   1.823 +			}
   1.824 +		else
   1.825 +			{
   1.826 +			moreData=EFalse;
   1.827 +			}
   1.828 +		}
   1.829 +	if ( hasCapabilty )
   1.830 +		{
   1.831 +		aSettings.iCaps=capability;
   1.832 +		ret=ETrue;
   1.833 +		}
   1.834 +
   1.835 +	//	Read channels
   1.836 +	TInt	channels=0;
   1.837 +	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdChannels(), channels) )
   1.838 +		{
   1.839 +		aSettings.iChannels=channels;
   1.840 +		callQuery=EFalse;
   1.841 +		ret=ETrue;
   1.842 +		}
   1.843 +
   1.844 +	//	Read flags
   1.845 +	TMdaAudioDataSettings::TAudioFlags	flags;
   1.846 +	TPtrC								flagsString;
   1.847 +	if ( aDataWrapper.GetStringFromConfig(aSection, KCmdFlags(), flagsString) )
   1.848 +		{
   1.849 +		if ( ConvertToAudioFlags(flagsString, flags) )
   1.850 +			{
   1.851 +			aSettings.iFlags=flags;
   1.852 +			ret=ETrue;
   1.853 +			}
   1.854 +		else
   1.855 +			{
   1.856 +			aDataWrapper.ERR_PRINTF2(_L("Illegal flags %S"), &flagsString);
   1.857 +			aDataWrapper.SetBlockResult(EFail);
   1.858 +			}
   1.859 +		}
   1.860 +
   1.861 +	//	Read max volume
   1.862 +	TInt	maxVolume=0;
   1.863 +	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdMaxVolume(), maxVolume) )
   1.864 +		{
   1.865 +		aSettings.iMaxVolume=maxVolume;
   1.866 +		ret=ETrue;
   1.867 +		}
   1.868 +
   1.869 +	//	Read sample rate
   1.870 +	TInt	sampleRate=0;
   1.871 +	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdSampleRate(), sampleRate) )
   1.872 +		{
   1.873 +		aSettings.iSampleRate=sampleRate;
   1.874 +		callQuery=EFalse;
   1.875 +		ret=ETrue;
   1.876 +		}
   1.877 +
   1.878 +	//	Read volume
   1.879 +	TInt	volume=0;
   1.880 +	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdVolume(), volume) )
   1.881 +		{
   1.882 +		aSettings.iVolume=volume;
   1.883 +		callQuery=EFalse;
   1.884 +		ret=ETrue;
   1.885 +		}
   1.886 +
   1.887 +	if ( callQuery )
   1.888 +		{
   1.889 +		aSettings.Query();
   1.890 +		}
   1.891 +
   1.892 +	return ret;
   1.893 +	}
   1.894 +
   1.895 +TBool CT_MMUtil::ConvertToDisplayMode(const TDesC& aDisplayModeStr, TDisplayMode& aDisplayMode)
   1.896 +	{
   1.897 +	TBool	ret = ETrue;
   1.898 +
   1.899 +	if (aDisplayModeStr == KDModeNone)
   1.900 +		{
   1.901 +		aDisplayMode = ENone;
   1.902 +		}
   1.903 +	else if (aDisplayModeStr == KDModeGray2)
   1.904 +		{
   1.905 +		aDisplayMode = EGray2;
   1.906 +		}
   1.907 +	else if (aDisplayModeStr == KDModeGray4)
   1.908 +		{
   1.909 +		aDisplayMode = EGray4;
   1.910 +		}
   1.911 +	else if (aDisplayModeStr == KDModeGray16)
   1.912 +		{
   1.913 +		aDisplayMode = EGray16;
   1.914 +		}
   1.915 +	else if (aDisplayModeStr == KDModeGray256)
   1.916 +		{
   1.917 +		aDisplayMode = EGray256;
   1.918 +		}
   1.919 +	else if (aDisplayModeStr == KDModeColor16)
   1.920 +		{
   1.921 +		aDisplayMode = EColor16;
   1.922 +		}
   1.923 +	else if (aDisplayModeStr == KDModeColor256)
   1.924 +		{
   1.925 +		aDisplayMode = EColor256;
   1.926 +		}
   1.927 +	else if (aDisplayModeStr == KDModeColor64K)
   1.928 +		{
   1.929 +		aDisplayMode = EColor64K;
   1.930 +		}
   1.931 +	else if (aDisplayModeStr == KDModeColor16M)
   1.932 +		{
   1.933 +		aDisplayMode = EColor16M;
   1.934 +		}
   1.935 +	else if (aDisplayModeStr == KDModeRgb)
   1.936 +		{
   1.937 +		aDisplayMode = ERgb;
   1.938 +		}
   1.939 +	else if (aDisplayModeStr == KDModeColor4K)
   1.940 +		{
   1.941 +		aDisplayMode = EColor4K;
   1.942 +		}
   1.943 +	else if (aDisplayModeStr == KDModeColor16MU)
   1.944 +		{
   1.945 +		aDisplayMode = EColor16MU;
   1.946 +		}
   1.947 +	else if (aDisplayModeStr == KDModeColor16MA)
   1.948 +		{
   1.949 +		aDisplayMode = EColor16MA;
   1.950 +		}
   1.951 +	else if (aDisplayModeStr == KDModeColorLast)
   1.952 +		{
   1.953 +		aDisplayMode = EColorLast;
   1.954 +		}
   1.955 +	else
   1.956 +		{
   1.957 +		ret = EFalse;
   1.958 +		}
   1.959 +
   1.960 +	return ret;
   1.961 +	}
   1.962 +
   1.963 +TBool CT_MMUtil::ConvertToVideoRotation(const TDesC& aVideoRotationStr, TVideoRotation& aVideoRotation)
   1.964 +	{
   1.965 +	TBool	ret = ETrue;
   1.966 +
   1.967 +	if (aVideoRotationStr == KEVideoRotationNone)
   1.968 +		{
   1.969 +		aVideoRotation = EVideoRotationNone;
   1.970 +		}
   1.971 +	else if (aVideoRotationStr == KEVideoRotationClockwise90)
   1.972 +		{
   1.973 +		aVideoRotation = EVideoRotationClockwise90;
   1.974 +		}
   1.975 +	else if (aVideoRotationStr == KEVideoRotationClockwise180)
   1.976 +		{
   1.977 +		aVideoRotation = EVideoRotationClockwise180;
   1.978 +		}
   1.979 +	else if (aVideoRotationStr == KEVideoRotationClockwise270)
   1.980 +		{
   1.981 +		aVideoRotation = EVideoRotationClockwise270;
   1.982 +		}
   1.983 +	else
   1.984 +		{
   1.985 +		ret = EFalse;
   1.986 +		}
   1.987 +
   1.988 +	return ret;
   1.989 +	}
   1.990 +
   1.991 +const TDesC& CT_MMUtil::GetVideoRotationString(TVideoRotation& aVideoRotation)
   1.992 +	{
   1.993 +	switch(aVideoRotation)
   1.994 +		{
   1.995 +	case EVideoRotationNone:
   1.996 +		return KEVideoRotationNone;
   1.997 +	case EVideoRotationClockwise90:
   1.998 +		return KEVideoRotationClockwise90;
   1.999 +	case EVideoRotationClockwise180:
  1.1000 +		return KEVideoRotationClockwise180;
  1.1001 +	case EVideoRotationClockwise270:
  1.1002 +		return KEVideoRotationClockwise270;
  1.1003 +	default:
  1.1004 +		break;
  1.1005 +		};
  1.1006 +	return KEVideoRotationUnknown;
  1.1007 +	}
  1.1008 +
  1.1009 +
  1.1010 +void CT_MMUtil::VerifyMIMETypeArrayL(CDataWrapper& aDataWrapper, const TDesC& aSection, const RFileExtensionMIMETypeArray& aFileExtensionArray)
  1.1011 +	{
  1.1012 +
  1.1013 +
  1.1014 +	TInt	count=aFileExtensionArray.Count();
  1.1015 +	for ( TInt index=0; index<count; ++index )
  1.1016 +		{
  1.1017 +		CFileExtensionMIMEType*	data=aFileExtensionArray[index];
  1.1018 +		const TDesC&			displayName=data->DisplayName();
  1.1019 +		const TDesC&			fileExtension=data->FileExtension();
  1.1020 +		TUid					imageSubType=data->ImageSubType();
  1.1021 +		TUid					imageType=data->ImageType();
  1.1022 +		TUid					implementationUid=data->ImplementationUid();
  1.1023 +		const TDesC8&			mimeType8=data->MIMEType();
  1.1024 +		HBufC*					mimeType=HBufC::NewLC(mimeType8.Length());
  1.1025 +		TPtr					mimeDes=mimeType->Des();
  1.1026 +		mimeDes.Copy(mimeType8);
  1.1027 +		aDataWrapper.INFO_PRINTF3(_L("DisplayName[%d]      =%S"), index, &displayName);
  1.1028 +		aDataWrapper.INFO_PRINTF3(_L("FileExtension[%d]    =%S"), index, &fileExtension);
  1.1029 +		aDataWrapper.INFO_PRINTF3(_L("ImageSubType[%d]     =0x%X"), index, imageSubType.iUid);
  1.1030 +		aDataWrapper.INFO_PRINTF3(_L("ImageType[%d]        =0x%X"), index, imageType.iUid);
  1.1031 +		aDataWrapper.INFO_PRINTF3(_L("ImplementationUid[%d]=0x%X"), index, implementationUid.iUid);
  1.1032 +		aDataWrapper.INFO_PRINTF3(_L("MIMEType[%d]         =%S"), index, &mimeDes);
  1.1033 +		CleanupStack::PopAndDestroy(mimeType);
  1.1034 +
  1.1035 +		//	Verify that it is unique in the array
  1.1036 +		for ( TInt index2=index+1; index2<count; ++index2 )
  1.1037 +			{
  1.1038 +			CFileExtensionMIMEType*	data2=aFileExtensionArray[index2];
  1.1039 +			if	(	(fileExtension.Compare(data2->FileExtension())==0) &&
  1.1040 +					(imageSubType==data2->ImageSubType()) &&
  1.1041 +					(imageType==data2->ImageType()) &&
  1.1042 +					(implementationUid==data2->ImplementationUid()) &&
  1.1043 +					(mimeType8.Compare(data2->MIMEType())==0)
  1.1044 +				)
  1.1045 +				{
  1.1046 +				aDataWrapper.ERR_PRINTF3(_L("Duplicate Types in entries %d and %d"), index, index2);
  1.1047 +				aDataWrapper.SetBlockResult(EFail);
  1.1048 +				}
  1.1049 +			}
  1.1050 +		}
  1.1051 +	TInt	expectedCount=0;
  1.1052 +	if ( aDataWrapper.GetIntFromConfig(aSection, KCount(), expectedCount) )
  1.1053 +		{
  1.1054 +		if ( count != expectedCount )
  1.1055 +			{
  1.1056 +			aDataWrapper.ERR_PRINTF3(_L("count (%d) != expectedCount (%d)"), count, expectedCount);
  1.1057 +			aDataWrapper.SetBlockResult(EFail);
  1.1058 +			}
  1.1059 +		}
  1.1060 +	}
  1.1061 +
  1.1062 +void CT_MMUtil::GetControllerAndFormatUidL(CDataWrapper& aDataWrapper, const TDesC& aFileName, TUid aMediaId, TBool aRecord, TUid& aControllerUid, TUid& aFormatUid)
  1.1063 +	{
  1.1064 +	RFs	fs;
  1.1065 +	User::LeaveIfError(fs.Connect());
  1.1066 +	CleanupClosePushL(fs);
  1.1067 +
  1.1068 +	TParse	parse;
  1.1069 +	fs.Parse(aFileName, parse);
  1.1070 +	TPtrC	extension=parse.Ext();
  1.1071 +
  1.1072 +	CMMFControllerPluginSelectionParameters*	controllerSelection = CMMFControllerPluginSelectionParameters::NewLC();
  1.1073 +	CMMFFormatSelectionParameters*				formatSelection = CMMFFormatSelectionParameters::NewLC();
  1.1074 +
  1.1075 +	// Set the play and record format selection parameters to be blank.
  1.1076 +	// Format support is only retrieved if requested.
  1.1077 +	controllerSelection->SetRequiredPlayFormatSupportL(*formatSelection);
  1.1078 +	controllerSelection->SetRequiredRecordFormatSupportL(*formatSelection);
  1.1079 +
  1.1080 +	// Set the media ids
  1.1081 +	RArray<TUid>	mediaIds;
  1.1082 +	CleanupClosePushL(mediaIds);
  1.1083 +	User::LeaveIfError(mediaIds.Append(aMediaId));
  1.1084 +
  1.1085 +	// Get plugins that support at least audio
  1.1086 +	controllerSelection->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
  1.1087 +	controllerSelection->SetPreferredSupplierL(KNullDesC, CMMFPluginSelectionParameters::EPreferredSupplierPluginsFirstInList);
  1.1088 +
  1.1089 +	// Array to hold all the controllers support the match data
  1.1090 +	RMMFControllerImplInfoArray	controllers;
  1.1091 +	CleanupResetAndDestroyPushL(controllers);
  1.1092 +	controllerSelection->ListImplementationsL(controllers);
  1.1093 +
  1.1094 +	// Find the first controller with at least one record format available
  1.1095 +	aControllerUid=TUid::Null();
  1.1096 +	aFormatUid=TUid::Null();
  1.1097 +
  1.1098 +	TBool	set = EFalse;
  1.1099 +	TBool	stillNull = ETrue;
  1.1100 +	for( TInt controllerIndex=0; (controllerIndex<controllers.Count()) && !set; ++controllerIndex )
  1.1101 +		{
  1.1102 +		const CMMFControllerImplementationInformation*	controller=controllers[controllerIndex];
  1.1103 +		LogL(aDataWrapper, *controller);
  1.1104 +
  1.1105 +		if ( aRecord )
  1.1106 +			{
  1.1107 +			const RMMFFormatImplInfoArray&	formats=controller->RecordFormats();
  1.1108 +
  1.1109 +			for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
  1.1110 +				{
  1.1111 +				CMMFFormatImplementationInformation*	formatInfo=formats[formatIndex];
  1.1112 +				const CDesC8Array&						extensions=formatInfo->SupportedFileExtensions();
  1.1113 +
  1.1114 +				for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
  1.1115 +					{
  1.1116 +					HBufC*	buffer=HBufC::NewLC(extensions[extensionsIndex].Length());
  1.1117 +					TPtr	bufferPtr=buffer->Des();
  1.1118 +					bufferPtr.Copy(extensions[extensionsIndex]);	// Create a 16 bit copy of the 8 bit original
  1.1119 +
  1.1120 +					if ( stillNull )
  1.1121 +						{
  1.1122 +						aControllerUid = controller->Uid();
  1.1123 +						aFormatUid = formats[0]->Uid();
  1.1124 +						stillNull = EFalse;
  1.1125 +						}
  1.1126 +					if ( bufferPtr == extension )
  1.1127 +						{
  1.1128 +						aControllerUid = controller->Uid();
  1.1129 +						aFormatUid = formats[0]->Uid();
  1.1130 +						set = ETrue;
  1.1131 +						}
  1.1132 +					CleanupStack::PopAndDestroy(buffer);
  1.1133 +					}
  1.1134 +				}
  1.1135 +			}
  1.1136 +		else
  1.1137 +			{
  1.1138 +			const RMMFFormatImplInfoArray&	formats=controller->PlayFormats();
  1.1139 +
  1.1140 +			for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
  1.1141 +				{
  1.1142 +				CMMFFormatImplementationInformation*	formatInfo=formats[formatIndex];
  1.1143 +				const CDesC8Array&						extensions=formatInfo->SupportedFileExtensions();
  1.1144 +
  1.1145 +				for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
  1.1146 +					{
  1.1147 +					HBufC*	buffer=HBufC::NewLC(extensions[extensionsIndex].Length());
  1.1148 +					TPtr	bufferPtr=buffer->Des();
  1.1149 +					bufferPtr.Copy(extensions[extensionsIndex]);	// Create a 16 bit copy of the 8 bit original
  1.1150 +
  1.1151 +					if ( stillNull )
  1.1152 +						{
  1.1153 +						aControllerUid = controller->Uid();
  1.1154 +						aFormatUid = formats[0]->Uid();
  1.1155 +						stillNull = EFalse;
  1.1156 +						}
  1.1157 +					if ( bufferPtr == extension )
  1.1158 +						{
  1.1159 +						aControllerUid = controller->Uid();
  1.1160 +						aFormatUid = formats[0]->Uid();
  1.1161 +						set = ETrue;
  1.1162 +						}
  1.1163 +					CleanupStack::PopAndDestroy(buffer);
  1.1164 +					}
  1.1165 +				}
  1.1166 +			}
  1.1167 +		}
  1.1168 +
  1.1169 +	CleanupStack::PopAndDestroy(5, &fs);
  1.1170 +	}
  1.1171 +
  1.1172 +void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFControllerImplementationInformation& aControllerInfo)
  1.1173 +	{
  1.1174 +	aDataWrapper.INFO_PRINTF2(_L("Controller DisplayName = %S"),	&(aControllerInfo.DisplayName()));
  1.1175 +	aDataWrapper.INFO_PRINTF2(_L("Controller Supplier = %S"),		&(aControllerInfo.Supplier()));
  1.1176 +	aDataWrapper.INFO_PRINTF2(_L("Controller Format Uid = 0x%X"),	aControllerInfo.Uid().iUid);
  1.1177 +
  1.1178 +	// Print out Play Formats information
  1.1179 +	TInt	index;
  1.1180 +
  1.1181 +	const RMMFFormatImplInfoArray&	playFormatArray = aControllerInfo.PlayFormats();
  1.1182 +	for ( index=0; index<playFormatArray.Count(); ++index )
  1.1183 +		{
  1.1184 +		CMMFFormatImplementationInformation*	formatInfo=playFormatArray[index];
  1.1185 +		aDataWrapper.INFO_PRINTF2(_L("PlayFormat [%d]"),		index);
  1.1186 +		LogL(aDataWrapper, *formatInfo);
  1.1187 +		}
  1.1188 +
  1.1189 +	// Print out Record Formats information
  1.1190 +	const RMMFFormatImplInfoArray&	recordFormatArray = aControllerInfo.RecordFormats();
  1.1191 +	for ( index=0; index<recordFormatArray.Count(); ++index )
  1.1192 +		{
  1.1193 +		CMMFFormatImplementationInformation*	formatInfo=recordFormatArray[index];
  1.1194 +		aDataWrapper.INFO_PRINTF2(_L("RecordFormat [%d]"),		index);
  1.1195 +		LogL(aDataWrapper, *formatInfo);
  1.1196 +		}
  1.1197 +	}
  1.1198 +
  1.1199 +void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFFormatImplementationInformation& aFormatInfo)
  1.1200 +	{
  1.1201 +	aDataWrapper.INFO_PRINTF2(_L("  DisplayName = %S"),	&(aFormatInfo.DisplayName()));
  1.1202 +	aDataWrapper.INFO_PRINTF2(_L("  Supplier = %S"),		&(aFormatInfo.Supplier()));
  1.1203 +	aDataWrapper.INFO_PRINTF2(_L("  Uid = 0x%X"),			aFormatInfo.Uid().iUid);
  1.1204 +
  1.1205 +	TInt				index;
  1.1206 +	const CDesC8Array&	fileext=aFormatInfo.SupportedFileExtensions();
  1.1207 +
  1.1208 +	for ( index=0; index<fileext.Count(); ++index )
  1.1209 +		{
  1.1210 +		HBufC*	buffer=HBufC::NewLC(fileext[index].Length());
  1.1211 +		TPtr	bufferPtr=buffer->Des();
  1.1212 +		bufferPtr.Copy(fileext[index]);	// Create a 16 bit copy of the 8 bit original
  1.1213 +		aDataWrapper.INFO_PRINTF3(_L("    Supported file extension [%d]: %S"), index, &bufferPtr);
  1.1214 +		CleanupStack::PopAndDestroy(buffer);
  1.1215 +		}
  1.1216 +
  1.1217 +	const CDesC8Array&	mimetypes=aFormatInfo.SupportedMimeTypes();
  1.1218 +	for ( index=0; index<mimetypes.Count(); ++index )
  1.1219 +		{
  1.1220 +		HBufC*	buffer=HBufC::NewLC(mimetypes[index].Length());
  1.1221 +		TPtr	bufferPtr=buffer->Des();
  1.1222 +		bufferPtr.Copy(mimetypes[index]);	// Create a 16 bit copy of the 8 bit original
  1.1223 +		aDataWrapper.INFO_PRINTF3(_L("    Supported mime type [%d]: %S"), index, &bufferPtr);
  1.1224 +		CleanupStack::PopAndDestroy(buffer);
  1.1225 +		}
  1.1226 +
  1.1227 +	const CDesC8Array&	headerdata=aFormatInfo.SupportedHeaderData();
  1.1228 +	for ( index=0; index<headerdata.Count(); ++index )
  1.1229 +		{
  1.1230 +		HBufC*	buffer=HBufC::NewLC(headerdata[index].Length());
  1.1231 +		TPtr	bufferPtr=buffer->Des();
  1.1232 +		bufferPtr.Copy(headerdata[index]);	// Create a 16 bit copy of the 8 bit original
  1.1233 +		aDataWrapper.INFO_PRINTF3(_L("    Supported header data [%d]: %S"), index, &bufferPtr);
  1.1234 +		CleanupStack::PopAndDestroy(buffer);
  1.1235 +		}
  1.1236 +	}