os/mm/mmapitest/mmsvs/suite/common/src/T_MMUtil.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
sl@0
    20
#include <e32std.h>
sl@0
    21
#include <mmf/common/mmffourcc.h>
sl@0
    22
sl@0
    23
//	User Includes
sl@0
    24
#include "T_MMUtil.h"
sl@0
    25
#include "DataWrapperBase.h"
sl@0
    26
sl@0
    27
/*@{*/
sl@0
    28
_LIT(KPriority,								"priority");
sl@0
    29
sl@0
    30
_LIT(KMdaPriorityMin,						"EMdaPriorityMin");
sl@0
    31
_LIT(KMdaPriorityNormal,					"EMdaPriorityNormal");
sl@0
    32
_LIT(KMdaPriorityMax,						"EMdaPriorityMax");
sl@0
    33
sl@0
    34
_LIT(KPriorityPreference,					"prioritypreference");
sl@0
    35
sl@0
    36
_LIT(KMdaPriorityPreferenceNone,			"None");
sl@0
    37
_LIT(KMdaPriorityPreferenceTime,			"Time");
sl@0
    38
_LIT(KMdaPriorityPreferenceQuality,			"Quality");
sl@0
    39
_LIT(KMdaPriorityPreferenceTimeAndQuality,	"TimeAndQuality");
sl@0
    40
sl@0
    41
_LIT(KThreadPriority,						"threadpriority");
sl@0
    42
sl@0
    43
_LIT(KEPriorityNull,						"EPriorityNull");
sl@0
    44
_LIT(KEPriorityMuchLess,					"EPriorityMuchLess");
sl@0
    45
_LIT(KEPriorityLess,						"EPriorityLess");
sl@0
    46
_LIT(KEPriorityNormal,						"EPriorityNormal");
sl@0
    47
_LIT(KEPriorityMore,						"EPriorityMore");
sl@0
    48
_LIT(KEPriorityMuchMore,					"EPriorityMuchMore");
sl@0
    49
_LIT(KEPriorityRealTime,					"EPriorityRealTime");
sl@0
    50
_LIT(KEPriorityAbsoluteVeryLow,				"EPriorityAbsoluteVeryLow");
sl@0
    51
_LIT(KEPriorityAbsoluteLow,					"EPriorityAbsoluteLow");
sl@0
    52
_LIT(KEPriorityAbsoluteBackground,			"EPriorityAbsoluteBackground");
sl@0
    53
_LIT(KEPriorityAbsoluteForeground,			"EPriorityAbsoluteForeground");
sl@0
    54
_LIT(KEPriorityAbsoluteHigh,				"EPriorityAbsoluteHigh");
sl@0
    55
sl@0
    56
_LIT(KFourCC,								"fourcc");
sl@0
    57
sl@0
    58
_LIT(KDesMMFFourCCCodePCM8, 				"KMMFFourCCCodePCM8");
sl@0
    59
_LIT(KDesMMFFourCCCodePCMU8,		 		"KMMFFourCCCodePCMU8");
sl@0
    60
_LIT(KDesMMFFourCCCodePCM16, 				"KMMFFourCCCodePCM16");
sl@0
    61
_LIT(KDesMMFFourCCCodePCMU16,		 		"KMMFFourCCCodePCMU16");
sl@0
    62
_LIT(KDesMMFFourCCCodePCM16B, 				"KMMFFourCCCodePCM16B");
sl@0
    63
_LIT(KDesMMFFourCCCodePCMU16B,		 		"KMMFFourCCCodePCMU16B");
sl@0
    64
_LIT(KDesMMFFourCCCodeIMAD, 				"KMMFFourCCCodeIMAD");
sl@0
    65
_LIT(KDesMMFFourCCCodeIMAS,		 			"KMMFFourCCCodeIMAS");
sl@0
    66
_LIT(KDesMMFFourCCCodeALAW,					"KMMFFourCCCodeALAW");
sl@0
    67
_LIT(KDesMMFFourCCCodeMuLAW,		 		"KMMFFourCCCodeMuLAW");
sl@0
    68
_LIT(KDesMMFFourCCCodeGSM610,				"KMMFFourCCCodeGSM610");
sl@0
    69
_LIT(KDesFourCCCodeNULL,					"KMMFFourCCCodeNULL");
sl@0
    70
_LIT(KDesMMFFourCCCodeAMR,					"KMMFFourCCCodeAMR");
sl@0
    71
_LIT(KDesMMFFourCCCodeAAC,					"KMMFFourCCCodeAAC");
sl@0
    72
_LIT(KDesMMFFourCCCodeAWB,					"KMMFFourCCCodeAWB");
sl@0
    73
_LIT(KDesMMFFourCCCodeMP3,					"KMMFFourCCCodeMP3");
sl@0
    74
_LIT(KDesMMFFourCCCodeATRAC3, 				"KMMFFourCCCodeATRAC3");
sl@0
    75
_LIT(KDesMMFFourCCCodeSBC,					"KMMFFourCCCodeSBC");
sl@0
    76
_LIT(KDesMMFFourCCCodeAMRW,					"KMMFFourCCCodeAMRW");
sl@0
    77
_LIT(KDesMMFFourCCCodeADTS,					"KMMFFourCCCodeADTS");
sl@0
    78
_LIT(KDesMMFFourCCCodeUnknown,				"KMMFFourCCCodeUnknown");
sl@0
    79
sl@0
    80
_LIT(KImageType,							"imagetype");
sl@0
    81
sl@0
    82
_LIT(KImageTypeThumbnail,					"EImageTypeThumbnail");
sl@0
    83
_LIT(KImageTypeMain,						"EImageTypeMain");
sl@0
    84
sl@0
    85
_LIT(KIntent,								"intent");
sl@0
    86
sl@0
    87
_LIT(KIntentPeek,							"EPeek");
sl@0
    88
_LIT(KIntentPlay,							"EPlay");
sl@0
    89
_LIT(KIntentView,							"EView");
sl@0
    90
_LIT(KIntentExecute,						"EExecute");
sl@0
    91
_LIT(KIntentPrint,							"EPrint");
sl@0
    92
_LIT(KIntentPause,							"EPause");
sl@0
    93
_LIT(KIntentContinue,						"EContinue");
sl@0
    94
_LIT(KIntentStop,							"EStop");
sl@0
    95
_LIT(KIntentUnknown,						"EUnknown");
sl@0
    96
_LIT(KIntentInstall,						"EInstall");
sl@0
    97
sl@0
    98
_LIT(KMidiStateClosedDisengaged,			"EMidiStateClosedDisengaged");
sl@0
    99
_LIT(KMidiStateOpenDisengaged,				"EMidiStateOpenDisengaged");
sl@0
   100
_LIT(KMidiStateOpenPlaying,					"EMidiStateOpenPlaying");
sl@0
   101
_LIT(KMidiStateClosedEngaged,				"EMidiStateClosedEngaged");
sl@0
   102
_LIT(KMidiStateOpenEngaged,					"EMidiStateOpenEngaged");
sl@0
   103
sl@0
   104
_LIT(KSampleRateFixed,						"SampleRateFixed");
sl@0
   105
_LIT(KSampleRateAnyInRange,					"SampleRateAnyInRange");
sl@0
   106
_LIT(KSampleRate8000Hz,						"SampleRate8000Hz");
sl@0
   107
_LIT(KSampleRate11025Hz,					"SampleRate11025Hz");
sl@0
   108
_LIT(KSampleRate12000Hz,					"SampleRate12000Hz");
sl@0
   109
_LIT(KSampleRate16000Hz,					"SampleRate16000Hz");
sl@0
   110
_LIT(KSampleRate22050Hz,					"SampleRate22050Hz");
sl@0
   111
_LIT(KSampleRate24000Hz,					"SampleRate24000Hz");
sl@0
   112
_LIT(KSampleRate32000Hz,					"SampleRate32000Hz");
sl@0
   113
_LIT(KSampleRate44100Hz,					"SampleRate44100Hz");
sl@0
   114
_LIT(KSampleRate48000Hz,					"SampleRate48000Hz");
sl@0
   115
_LIT(KSampleRate96000Hz,					"SampleRate96000Hz");
sl@0
   116
_LIT(KSampleRate64000Hz,					"SampleRate64000Hz");
sl@0
   117
_LIT(KChannelsMono,							"ChannelsMono");
sl@0
   118
_LIT(KChannelsStereo,						"ChannelsStereo");
sl@0
   119
_LIT(KRoutingControl,						"RoutingControl");
sl@0
   120
_LIT(KRealTime,								"RealTime");
sl@0
   121
sl@0
   122
_LIT(KNoLocalRouting,						"NoLocalRouting");
sl@0
   123
_LIT(KNoNetworkRouting,						"NoNetworkRouting");
sl@0
   124
sl@0
   125
_LIT(KOptionNone,							"OptionNone");
sl@0
   126
_LIT(KOptionNoDither,						"OptionNoDither");
sl@0
   127
_LIT(KOptionAlwaysThread,					"OptionAlwaysThread");
sl@0
   128
_LIT(KOptionAllowZeroFrameOpen,				"OptionAllowZeroFrameOpen");
sl@0
   129
_LIT(KAllowGeneratedMask,					"AllowGeneratedMask");
sl@0
   130
sl@0
   131
_LIT(KAgentPropertyBufferSize,				"AgentPropertyBufferSize");
sl@0
   132
_LIT(KAgentPropertyAgentUI,					"AgentPropertyAgentUI");
sl@0
   133
_LIT(KAgentPropertyMultipleSequence,		"AgentPropertyMultipleSequence");
sl@0
   134
sl@0
   135
_LIT(KCmdCapabilty,							"capabilty%d");
sl@0
   136
_LIT(KCmdChannels,							"channels");
sl@0
   137
_LIT(KCmdFlags,								"flags");
sl@0
   138
_LIT(KCmdMaxVolume,							"maxvolume");
sl@0
   139
_LIT(KCmdSampleRate,						"samplerate");
sl@0
   140
_LIT(KCmdVolume,							"volume");
sl@0
   141
sl@0
   142
_LIT(KDModeNone,							"None");
sl@0
   143
_LIT(KDModeGray2,							"Gray2");
sl@0
   144
_LIT(KDModeGray4,							"Gray4");
sl@0
   145
_LIT(KDModeGray16,							"Gray16");
sl@0
   146
_LIT(KDModeGray256,							"Gray256");
sl@0
   147
_LIT(KDModeColor16,							"Color16");
sl@0
   148
_LIT(KDModeColor256,						"Color256");
sl@0
   149
_LIT(KDModeColor64K,						"Color64K");
sl@0
   150
_LIT(KDModeColor16M,						"Color16M");
sl@0
   151
_LIT(KDModeRgb,								"Rgb");
sl@0
   152
_LIT(KDModeColor4K,							"Color4K");
sl@0
   153
_LIT(KDModeColor16MU,						"Color16MU");
sl@0
   154
_LIT(KDModeColor16MA,						"Color16MA");
sl@0
   155
_LIT(KDModeColorLast,						"ColorLast");
sl@0
   156
sl@0
   157
_LIT(KEVideoRotationNone,					"None");
sl@0
   158
_LIT(KEVideoRotationClockwise90,			"Clockwise90");
sl@0
   159
_LIT(KEVideoRotationClockwise180,			"Clockwise180");
sl@0
   160
_LIT(KEVideoRotationClockwise270,			"Clockwise270");
sl@0
   161
_LIT(KEVideoRotationUnknown,				"Unknown");
sl@0
   162
sl@0
   163
sl@0
   164
sl@0
   165
_LIT(KCount,								"count");
sl@0
   166
/*@}*/
sl@0
   167
sl@0
   168
TBool CT_MMUtil::ReadMdaPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TInt& aPriority)
sl@0
   169
	{
sl@0
   170
	TPtrC	str;
sl@0
   171
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KPriority(), str);
sl@0
   172
	if ( ret )
sl@0
   173
		{
sl@0
   174
		if ( str==KMdaPriorityMin )
sl@0
   175
			{
sl@0
   176
			aPriority=EMdaPriorityMin;
sl@0
   177
			}
sl@0
   178
		else if ( str==KMdaPriorityNormal )
sl@0
   179
			{
sl@0
   180
			aPriority=EMdaPriorityNormal;
sl@0
   181
			}
sl@0
   182
		else if ( str==KMdaPriorityMax )
sl@0
   183
			{
sl@0
   184
			aPriority=EMdaPriorityMax;
sl@0
   185
			}
sl@0
   186
		else
sl@0
   187
			{
sl@0
   188
			if ( !aDataWrapper.GetIntFromConfig(aSection, KPriority(), aPriority) )
sl@0
   189
				{
sl@0
   190
				aDataWrapper.ERR_PRINTF2(_L("Illegal priority %S"), &KPriority());
sl@0
   191
				aDataWrapper.SetBlockResult(EFail);
sl@0
   192
				}
sl@0
   193
			}
sl@0
   194
		}
sl@0
   195
sl@0
   196
	aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriority %S = %d"), &KPriority(), ret);
sl@0
   197
sl@0
   198
	return ret;
sl@0
   199
	}
sl@0
   200
sl@0
   201
TBool CT_MMUtil::ReadMdaPriorityPreference(CDataWrapper& aDataWrapper, const TDesC& aSection, TMdaPriorityPreference& aPreference)
sl@0
   202
	{
sl@0
   203
	TPtrC	str;
sl@0
   204
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KPriorityPreference(), str);
sl@0
   205
	if ( ret )
sl@0
   206
		{
sl@0
   207
		if ( str==KMdaPriorityPreferenceNone )
sl@0
   208
			{
sl@0
   209
			aPreference=EMdaPriorityPreferenceNone;
sl@0
   210
			}
sl@0
   211
		else if ( str==KMdaPriorityPreferenceTime )
sl@0
   212
			{
sl@0
   213
			aPreference=EMdaPriorityPreferenceTime;
sl@0
   214
			}
sl@0
   215
		else if ( str==KMdaPriorityPreferenceQuality )
sl@0
   216
			{
sl@0
   217
			aPreference=EMdaPriorityPreferenceQuality;
sl@0
   218
			}
sl@0
   219
		else if ( str==KMdaPriorityPreferenceTimeAndQuality )
sl@0
   220
			{
sl@0
   221
			aPreference=EMdaPriorityPreferenceTimeAndQuality;
sl@0
   222
			}
sl@0
   223
		else
sl@0
   224
			{
sl@0
   225
			TInt	intVal;
sl@0
   226
			if ( aDataWrapper.GetIntFromConfig(aSection, KPriorityPreference(), intVal) )
sl@0
   227
				{
sl@0
   228
				aPreference=(TMdaPriorityPreference)intVal;
sl@0
   229
				}
sl@0
   230
			else
sl@0
   231
				{
sl@0
   232
				aDataWrapper.ERR_PRINTF2(_L("Illegal TMdaPriorityPreference %S"), &KPriorityPreference());
sl@0
   233
				aDataWrapper.SetBlockResult(EFail);
sl@0
   234
				}
sl@0
   235
			}
sl@0
   236
		}
sl@0
   237
sl@0
   238
	aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriorityPreference %S = %d"), &KPriorityPreference(), ret);
sl@0
   239
sl@0
   240
	return ret;
sl@0
   241
	}
sl@0
   242
sl@0
   243
TBool CT_MMUtil::ReadThreadPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TThreadPriority& aPriority)
sl@0
   244
	{
sl@0
   245
	TPtrC	str;
sl@0
   246
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KThreadPriority(), str);
sl@0
   247
	if ( ret )
sl@0
   248
		{
sl@0
   249
		if ( str==KEPriorityNull )
sl@0
   250
			{
sl@0
   251
			aPriority = EPriorityNull;
sl@0
   252
			}
sl@0
   253
		else if ( str==KEPriorityMuchLess )
sl@0
   254
			{
sl@0
   255
			aPriority = EPriorityMuchLess;
sl@0
   256
			}
sl@0
   257
		else if ( str==KEPriorityLess )
sl@0
   258
			{
sl@0
   259
			aPriority = EPriorityLess;
sl@0
   260
			}
sl@0
   261
		else if ( str==KEPriorityNormal )
sl@0
   262
			{
sl@0
   263
			aPriority = EPriorityNormal;
sl@0
   264
			}
sl@0
   265
		else if ( str==KEPriorityMore )
sl@0
   266
			{
sl@0
   267
			aPriority = EPriorityMore;
sl@0
   268
			}
sl@0
   269
		else if ( str==KEPriorityMuchMore )
sl@0
   270
			{
sl@0
   271
			aPriority = EPriorityMuchMore;
sl@0
   272
			}
sl@0
   273
		else if ( str==KEPriorityRealTime )
sl@0
   274
			{
sl@0
   275
			aPriority = EPriorityRealTime;
sl@0
   276
			}
sl@0
   277
		else if ( str==KEPriorityAbsoluteVeryLow )
sl@0
   278
			{
sl@0
   279
			aPriority = EPriorityAbsoluteVeryLow;
sl@0
   280
			}
sl@0
   281
		else if ( str==KEPriorityAbsoluteLow )
sl@0
   282
			{
sl@0
   283
			aPriority = EPriorityAbsoluteLow;
sl@0
   284
			}
sl@0
   285
		else if ( str==KEPriorityAbsoluteBackground )
sl@0
   286
			{
sl@0
   287
			aPriority = EPriorityAbsoluteBackground;
sl@0
   288
			}
sl@0
   289
		else if ( str==KEPriorityAbsoluteForeground )
sl@0
   290
			{
sl@0
   291
			aPriority = EPriorityAbsoluteForeground;
sl@0
   292
			}
sl@0
   293
		else if ( str==KEPriorityAbsoluteHigh )
sl@0
   294
			{
sl@0
   295
			aPriority = EPriorityAbsoluteHigh;
sl@0
   296
			}
sl@0
   297
		else
sl@0
   298
			{
sl@0
   299
			TInt	intVal;
sl@0
   300
			if ( aDataWrapper.GetIntFromConfig(aSection, KThreadPriority(), intVal) )
sl@0
   301
				{
sl@0
   302
				aPriority=(TThreadPriority)intVal;
sl@0
   303
				}
sl@0
   304
			else
sl@0
   305
				{
sl@0
   306
				aDataWrapper.ERR_PRINTF2(_L("Illegal TThreadPriority %S"), &KThreadPriority());
sl@0
   307
				aDataWrapper.SetBlockResult(EFail);
sl@0
   308
				}
sl@0
   309
			}
sl@0
   310
		}
sl@0
   311
sl@0
   312
	aDataWrapper.INFO_PRINTF3(_L("ReadThreadPriority %S = %d"), &KThreadPriority(), ret);
sl@0
   313
sl@0
   314
	return ret;
sl@0
   315
	}
sl@0
   316
sl@0
   317
TBool CT_MMUtil::ReadFourCC(CDataWrapper& aDataWrapper, const TDesC& aSection, TFourCC& aFourCC)
sl@0
   318
	{
sl@0
   319
	TPtrC	str;
sl@0
   320
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KFourCC(), str);
sl@0
   321
sl@0
   322
	if ( ret )
sl@0
   323
		{
sl@0
   324
		if( str==KDesMMFFourCCCodePCM8 )
sl@0
   325
			{
sl@0
   326
			aFourCC=KMMFFourCCCodePCM8;
sl@0
   327
			}
sl@0
   328
		else if( str==KDesMMFFourCCCodePCMU8 )
sl@0
   329
			{
sl@0
   330
	 		aFourCC=KMMFFourCCCodePCMU8;
sl@0
   331
			}
sl@0
   332
		else if( str==KDesMMFFourCCCodePCM16 )
sl@0
   333
			{
sl@0
   334
			aFourCC=KMMFFourCCCodePCM16;
sl@0
   335
			}
sl@0
   336
		else if( str==KDesMMFFourCCCodePCMU16 )
sl@0
   337
			{
sl@0
   338
			aFourCC=KMMFFourCCCodePCMU16;
sl@0
   339
			}
sl@0
   340
		else if( str==KDesMMFFourCCCodePCM16B )
sl@0
   341
			{
sl@0
   342
			aFourCC=KMMFFourCCCodePCM16B;
sl@0
   343
			}
sl@0
   344
		else if( str==KDesMMFFourCCCodePCMU16B )
sl@0
   345
			{
sl@0
   346
	 		aFourCC=KMMFFourCCCodePCMU16B;
sl@0
   347
			}
sl@0
   348
		else if( str==KDesMMFFourCCCodeIMAD )
sl@0
   349
			{
sl@0
   350
			aFourCC=KMMFFourCCCodeIMAD;
sl@0
   351
			}
sl@0
   352
		else if( str==KDesMMFFourCCCodeIMAS )
sl@0
   353
			{
sl@0
   354
	 		aFourCC=KMMFFourCCCodeIMAS;
sl@0
   355
			}
sl@0
   356
		else if( str==KDesMMFFourCCCodeALAW )
sl@0
   357
			{
sl@0
   358
	 		aFourCC=KMMFFourCCCodeALAW;
sl@0
   359
			}
sl@0
   360
		else if( str==KDesMMFFourCCCodeMuLAW )
sl@0
   361
			{
sl@0
   362
	 		aFourCC=KMMFFourCCCodeMuLAW;
sl@0
   363
			}
sl@0
   364
		else if( str==KDesMMFFourCCCodeGSM610 )
sl@0
   365
			{
sl@0
   366
	 		aFourCC=KMMFFourCCCodeGSM610;
sl@0
   367
			}
sl@0
   368
		else if( str==KDesFourCCCodeNULL )
sl@0
   369
			{
sl@0
   370
	 		aFourCC=KMMFFourCCCodeNULL;
sl@0
   371
			}
sl@0
   372
		else if( str==KDesMMFFourCCCodeAMR )
sl@0
   373
			{
sl@0
   374
	 		aFourCC=KMMFFourCCCodeAMR;
sl@0
   375
			}
sl@0
   376
		else if( str==KDesMMFFourCCCodeAAC )
sl@0
   377
			{
sl@0
   378
	 		aFourCC=KMMFFourCCCodeAAC;
sl@0
   379
			}
sl@0
   380
		else if( str==KDesMMFFourCCCodeAWB )
sl@0
   381
			{
sl@0
   382
	 		aFourCC=KMMFFourCCCodeAWB;
sl@0
   383
			}
sl@0
   384
		else if( str==KDesMMFFourCCCodeMP3	)
sl@0
   385
			{
sl@0
   386
	 		aFourCC=KMMFFourCCCodeMP3;
sl@0
   387
			}
sl@0
   388
		else if( str==KDesMMFFourCCCodeATRAC3 )
sl@0
   389
			{
sl@0
   390
	 		aFourCC=KMMFFourCCCodeATRAC3;
sl@0
   391
			}
sl@0
   392
		else if( str==KDesMMFFourCCCodeSBC )
sl@0
   393
			{
sl@0
   394
	 		aFourCC=KMMFFourCCCodeSBC;
sl@0
   395
			}
sl@0
   396
		else if( str==KDesMMFFourCCCodeAMRW )
sl@0
   397
			{
sl@0
   398
	 		aFourCC=KMMFFourCCCodeAMRW;
sl@0
   399
			}
sl@0
   400
		else if( str==KDesMMFFourCCCodeADTS )
sl@0
   401
			{
sl@0
   402
	 		aFourCC=KMMFFourCCCodeADTS;
sl@0
   403
			}
sl@0
   404
		else
sl@0
   405
			{
sl@0
   406
			TInt	intVal;
sl@0
   407
			if ( aDataWrapper.GetIntFromConfig(aSection, KFourCC(), intVal) )
sl@0
   408
				{
sl@0
   409
				aFourCC=intVal;
sl@0
   410
				}
sl@0
   411
			else
sl@0
   412
				{
sl@0
   413
				aDataWrapper.ERR_PRINTF2(_L("Illegal TFourCC %S"), &KFourCC());
sl@0
   414
				aDataWrapper.SetBlockResult(EFail);
sl@0
   415
				}
sl@0
   416
			}
sl@0
   417
		}
sl@0
   418
sl@0
   419
	return ret;
sl@0
   420
	}
sl@0
   421
sl@0
   422
TBool CT_MMUtil::ReadImageType(CDataWrapper& aDataWrapper, const TDesC& aSection, CImageDecoder::TImageType& aImageType)
sl@0
   423
	{
sl@0
   424
	TPtrC	str;
sl@0
   425
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KImageType(), str);
sl@0
   426
sl@0
   427
	if ( ret )
sl@0
   428
		{
sl@0
   429
		if ( str==KImageTypeThumbnail )
sl@0
   430
			{
sl@0
   431
			aImageType=CImageDecoder::EImageTypeThumbnail;
sl@0
   432
			}
sl@0
   433
		else if ( str==KImageTypeMain )
sl@0
   434
			{
sl@0
   435
			aImageType=CImageDecoder::EImageTypeMain;
sl@0
   436
			}
sl@0
   437
		else
sl@0
   438
			{
sl@0
   439
			TInt	intVal;
sl@0
   440
			if ( aDataWrapper.GetIntFromConfig(aSection, KImageType(), intVal) )
sl@0
   441
				{
sl@0
   442
				aImageType=(CImageDecoder::TImageType)intVal;
sl@0
   443
				}
sl@0
   444
			else
sl@0
   445
				{
sl@0
   446
				aDataWrapper.ERR_PRINTF2(_L("Illegal CImageDecoder::TImageType %S"), &KImageType());
sl@0
   447
				aDataWrapper.SetBlockResult(EFail);
sl@0
   448
				}
sl@0
   449
			}
sl@0
   450
		}
sl@0
   451
sl@0
   452
	return ret;
sl@0
   453
	}
sl@0
   454
sl@0
   455
TBool CT_MMUtil::ReadIntent(CDataWrapper& aDataWrapper, const TDesC& aSection, ContentAccess::TIntent& aIntent)
sl@0
   456
	{
sl@0
   457
	TPtrC	str;
sl@0
   458
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, KIntent(), str);
sl@0
   459
sl@0
   460
	if ( ret )
sl@0
   461
		{
sl@0
   462
		if ( str==KIntentPeek )
sl@0
   463
			{
sl@0
   464
			aIntent=ContentAccess::EPeek;
sl@0
   465
			}
sl@0
   466
		else if ( str==KIntentPlay )
sl@0
   467
			{
sl@0
   468
			aIntent=ContentAccess::EPlay;
sl@0
   469
			}
sl@0
   470
		else if ( str==KIntentView )
sl@0
   471
			{
sl@0
   472
			aIntent=ContentAccess::EView;
sl@0
   473
			}
sl@0
   474
		else if ( str==KIntentExecute )
sl@0
   475
			{
sl@0
   476
			aIntent=ContentAccess::EExecute;
sl@0
   477
			}
sl@0
   478
		else if ( str==KIntentPrint )
sl@0
   479
			{
sl@0
   480
			aIntent=ContentAccess::EPrint;
sl@0
   481
			}
sl@0
   482
		else if ( str==KIntentPause )
sl@0
   483
			{
sl@0
   484
			aIntent=ContentAccess::EPause;
sl@0
   485
			}
sl@0
   486
		else if ( str==KIntentContinue )
sl@0
   487
			{
sl@0
   488
			aIntent=ContentAccess::EContinue;
sl@0
   489
			}
sl@0
   490
		else if ( str==KIntentStop )
sl@0
   491
			{
sl@0
   492
			aIntent=ContentAccess::EStop;
sl@0
   493
			}
sl@0
   494
		else if ( str==KIntentUnknown )
sl@0
   495
			{
sl@0
   496
			aIntent=ContentAccess::EUnknown;
sl@0
   497
			}
sl@0
   498
		else if ( str==KIntentInstall )
sl@0
   499
			{
sl@0
   500
			aIntent=ContentAccess::EInstall;
sl@0
   501
			}
sl@0
   502
		else
sl@0
   503
			{
sl@0
   504
			TInt	intVal;
sl@0
   505
			if ( aDataWrapper.GetIntFromConfig(aSection, KIntent(), intVal) )
sl@0
   506
				{
sl@0
   507
				aIntent=(ContentAccess::TIntent)intVal;
sl@0
   508
				}
sl@0
   509
			else
sl@0
   510
				{
sl@0
   511
				aDataWrapper.ERR_PRINTF2(_L("Illegal ContentAccess::TIntent %S"), &KIntent());
sl@0
   512
				aDataWrapper.SetBlockResult(EFail);
sl@0
   513
				}
sl@0
   514
			}
sl@0
   515
		}
sl@0
   516
sl@0
   517
	return ret;
sl@0
   518
	}
sl@0
   519
sl@0
   520
TBool CT_MMUtil::ReadMidiState(CDataWrapper& aDataWrapper, const TDesC& aSection, const TDesC& aKeyName, TMidiState& aState)
sl@0
   521
	{
sl@0
   522
	TPtrC	str;
sl@0
   523
	TBool	ret=aDataWrapper.GetStringFromConfig(aSection, aKeyName, str);
sl@0
   524
sl@0
   525
	if ( ret )
sl@0
   526
		{
sl@0
   527
		if ( str==KMidiStateClosedDisengaged )
sl@0
   528
			{
sl@0
   529
			aState=EMidiStateClosedDisengaged;
sl@0
   530
			}
sl@0
   531
		else if ( str==KMidiStateOpenDisengaged )
sl@0
   532
			{
sl@0
   533
			aState=EMidiStateOpenDisengaged;
sl@0
   534
			}
sl@0
   535
		else if ( str==KMidiStateOpenPlaying )
sl@0
   536
			{
sl@0
   537
			aState=EMidiStateOpenPlaying;
sl@0
   538
			}
sl@0
   539
		else if ( str==KMidiStateClosedEngaged )
sl@0
   540
			{
sl@0
   541
			aState=EMidiStateClosedEngaged;
sl@0
   542
			}
sl@0
   543
		else if ( str==KMidiStateOpenEngaged )
sl@0
   544
			{
sl@0
   545
			aState=EMidiStateOpenEngaged;
sl@0
   546
			}
sl@0
   547
		else
sl@0
   548
			{
sl@0
   549
			TInt	intVal;
sl@0
   550
			if ( aDataWrapper.GetIntFromConfig(aSection, aKeyName, intVal) )
sl@0
   551
				{
sl@0
   552
				aState=(TMidiState)intVal;
sl@0
   553
				}
sl@0
   554
			else
sl@0
   555
				{
sl@0
   556
				ret=EFalse;
sl@0
   557
				aDataWrapper.ERR_PRINTF2(_L("Illegal TMidiState %S"), &aKeyName);
sl@0
   558
				aDataWrapper.SetBlockResult(EFail);
sl@0
   559
				}
sl@0
   560
			}
sl@0
   561
		}
sl@0
   562
sl@0
   563
	return ret;
sl@0
   564
	}
sl@0
   565
sl@0
   566
TBool CT_MMUtil::ConvertToAudioCaps(const TDesC& aDesc, TMdaAudioDataSettings::TAudioCaps& aAudioCaps)
sl@0
   567
	{
sl@0
   568
	TBool	ret=ETrue;
sl@0
   569
sl@0
   570
	if ( aDesc==KSampleRateFixed )
sl@0
   571
		{
sl@0
   572
		aAudioCaps=TMdaAudioDataSettings::ESampleRateFixed;
sl@0
   573
		}
sl@0
   574
	else if ( aDesc==KSampleRateAnyInRange )
sl@0
   575
		{
sl@0
   576
		aAudioCaps=TMdaAudioDataSettings::ESampleRateAnyInRange;
sl@0
   577
		}
sl@0
   578
	else if ( aDesc==KSampleRate8000Hz )
sl@0
   579
		{
sl@0
   580
		aAudioCaps=TMdaAudioDataSettings::ESampleRate8000Hz;
sl@0
   581
		}
sl@0
   582
	else if ( aDesc==KSampleRate11025Hz )
sl@0
   583
		{
sl@0
   584
		aAudioCaps=TMdaAudioDataSettings::ESampleRate11025Hz;
sl@0
   585
		}
sl@0
   586
	else if ( aDesc==KSampleRate12000Hz )
sl@0
   587
		{
sl@0
   588
		aAudioCaps=TMdaAudioDataSettings::ESampleRate12000Hz;
sl@0
   589
		}
sl@0
   590
	else if ( aDesc==KSampleRate16000Hz )
sl@0
   591
		{
sl@0
   592
		aAudioCaps=TMdaAudioDataSettings::ESampleRate16000Hz;
sl@0
   593
		}
sl@0
   594
	else if ( aDesc==KSampleRate22050Hz )
sl@0
   595
		{
sl@0
   596
		aAudioCaps=TMdaAudioDataSettings::ESampleRate22050Hz;
sl@0
   597
		}
sl@0
   598
	else if ( aDesc==KSampleRate24000Hz )
sl@0
   599
		{
sl@0
   600
		aAudioCaps=TMdaAudioDataSettings::ESampleRate24000Hz;
sl@0
   601
		}
sl@0
   602
	else if ( aDesc==KSampleRate32000Hz )
sl@0
   603
		{
sl@0
   604
		aAudioCaps=TMdaAudioDataSettings::ESampleRate32000Hz;
sl@0
   605
		}
sl@0
   606
	else if ( aDesc==KSampleRate44100Hz )
sl@0
   607
		{
sl@0
   608
		aAudioCaps=TMdaAudioDataSettings::ESampleRate44100Hz;
sl@0
   609
		}
sl@0
   610
	else if ( aDesc==KSampleRate48000Hz )
sl@0
   611
		{
sl@0
   612
		aAudioCaps=TMdaAudioDataSettings::ESampleRate48000Hz;
sl@0
   613
		}
sl@0
   614
	else if ( aDesc==KSampleRate96000Hz )
sl@0
   615
		{
sl@0
   616
		aAudioCaps=TMdaAudioDataSettings::ESampleRate96000Hz;
sl@0
   617
		}
sl@0
   618
	else if ( aDesc==KSampleRate64000Hz )
sl@0
   619
		{
sl@0
   620
		aAudioCaps=TMdaAudioDataSettings::ESampleRate64000Hz;
sl@0
   621
		}
sl@0
   622
	else if ( aDesc==KChannelsMono )
sl@0
   623
		{
sl@0
   624
		aAudioCaps=TMdaAudioDataSettings::EChannelsMono;
sl@0
   625
		}
sl@0
   626
	else if ( aDesc==KChannelsStereo )
sl@0
   627
		{
sl@0
   628
		aAudioCaps=TMdaAudioDataSettings::EChannelsStereo;
sl@0
   629
		}
sl@0
   630
	else if ( aDesc==KRoutingControl )
sl@0
   631
		{
sl@0
   632
		aAudioCaps=TMdaAudioDataSettings::ERoutingControl;
sl@0
   633
		}
sl@0
   634
	else if ( aDesc==KRealTime )
sl@0
   635
		{
sl@0
   636
		aAudioCaps=TMdaAudioDataSettings::ERealTime;
sl@0
   637
		}
sl@0
   638
	else
sl@0
   639
		{
sl@0
   640
		ret=EFalse;
sl@0
   641
		}
sl@0
   642
sl@0
   643
	return ret;
sl@0
   644
	}
sl@0
   645
sl@0
   646
TBool CT_MMUtil::ConvertToAudioFlags(const TDesC& aDesc, TMdaAudioDataSettings::TAudioFlags& aAudioFlags)
sl@0
   647
	{
sl@0
   648
	TBool	ret=ETrue;
sl@0
   649
sl@0
   650
	if ( aDesc==KNoLocalRouting )
sl@0
   651
		{
sl@0
   652
		aAudioFlags=TMdaAudioDataSettings::ENoLocalRouting;
sl@0
   653
		}
sl@0
   654
	else if ( aDesc==KNoNetworkRouting )
sl@0
   655
		{
sl@0
   656
		aAudioFlags=TMdaAudioDataSettings::ENoNetworkRouting;
sl@0
   657
		}
sl@0
   658
	else
sl@0
   659
		{
sl@0
   660
		ret=EFalse;
sl@0
   661
		}
sl@0
   662
sl@0
   663
	return ret;
sl@0
   664
	}
sl@0
   665
sl@0
   666
TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageDecoder::TOptions& aOption)
sl@0
   667
	{
sl@0
   668
	TBool	ret=ETrue;
sl@0
   669
sl@0
   670
	if ( aDesc==KOptionNone )
sl@0
   671
		{
sl@0
   672
		aOption=CImageDecoder::EOptionNone;
sl@0
   673
		}
sl@0
   674
	else if ( aDesc==KOptionNoDither )
sl@0
   675
		{
sl@0
   676
		aOption=CImageDecoder::EOptionNoDither;
sl@0
   677
		}
sl@0
   678
	else if ( aDesc==KOptionAlwaysThread )
sl@0
   679
		{
sl@0
   680
		aOption=CImageDecoder::EOptionAlwaysThread;
sl@0
   681
		}
sl@0
   682
	else if ( aDesc==KOptionAllowZeroFrameOpen )
sl@0
   683
		{
sl@0
   684
		aOption=CImageDecoder::EOptionAllowZeroFrameOpen;
sl@0
   685
		}
sl@0
   686
	else if ( aDesc==KAllowGeneratedMask )
sl@0
   687
		{
sl@0
   688
		aOption=CImageDecoder::EAllowGeneratedMask;
sl@0
   689
		}
sl@0
   690
	else
sl@0
   691
		{
sl@0
   692
		ret=EFalse;
sl@0
   693
		}
sl@0
   694
sl@0
   695
	return ret;
sl@0
   696
	}
sl@0
   697
sl@0
   698
TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageEncoder::TOptions& aOption)
sl@0
   699
	{
sl@0
   700
	TBool	ret=ETrue;
sl@0
   701
sl@0
   702
	if ( aDesc==KOptionNone )
sl@0
   703
		{
sl@0
   704
		aOption=CImageEncoder::EOptionNone;
sl@0
   705
		}
sl@0
   706
	else if ( aDesc==KOptionAlwaysThread )
sl@0
   707
		{
sl@0
   708
		aOption=CImageEncoder::EOptionAlwaysThread;
sl@0
   709
		}
sl@0
   710
	else
sl@0
   711
		{
sl@0
   712
		ret=EFalse;
sl@0
   713
		}
sl@0
   714
sl@0
   715
	return ret;
sl@0
   716
	}
sl@0
   717
sl@0
   718
TBool CT_MMUtil::ConvertToAgentProperty(const TDesC& aDesc, ContentAccess::TAgentProperty& aAgentProperty)
sl@0
   719
	{
sl@0
   720
	TBool	ret=ETrue;
sl@0
   721
sl@0
   722
	if ( aDesc==KAgentPropertyBufferSize )
sl@0
   723
		{
sl@0
   724
		aAgentProperty=ContentAccess::EAgentPropertyBufferSize;
sl@0
   725
		}
sl@0
   726
	else if ( aDesc==KAgentPropertyAgentUI )
sl@0
   727
		{
sl@0
   728
		aAgentProperty=ContentAccess::EAgentPropertyAgentUI;
sl@0
   729
		}
sl@0
   730
	else if ( aDesc==KAgentPropertyMultipleSequence )
sl@0
   731
		{
sl@0
   732
		aAgentProperty=ContentAccess::EAgentPropertyMultipleSequence;
sl@0
   733
		}
sl@0
   734
	else
sl@0
   735
		{
sl@0
   736
		ret=EFalse;
sl@0
   737
		}
sl@0
   738
sl@0
   739
	return ret;
sl@0
   740
	}
sl@0
   741
sl@0
   742
const TDesC& CT_MMUtil::GetFourCCString(TUint32 aValue)
sl@0
   743
	{
sl@0
   744
	switch(aValue)
sl@0
   745
		{
sl@0
   746
	case KMMFFourCCCodePCM8:
sl@0
   747
		return KDesMMFFourCCCodePCM8;
sl@0
   748
	case KMMFFourCCCodePCMU8:
sl@0
   749
		return KDesMMFFourCCCodePCMU8;
sl@0
   750
	case KMMFFourCCCodePCM16:
sl@0
   751
		return KDesMMFFourCCCodePCM16;
sl@0
   752
	case KMMFFourCCCodePCMU16:
sl@0
   753
		return KDesMMFFourCCCodePCMU16;
sl@0
   754
	case KMMFFourCCCodePCM16B:
sl@0
   755
		return KDesMMFFourCCCodePCM16B;
sl@0
   756
	case KMMFFourCCCodePCMU16B:
sl@0
   757
		return KDesMMFFourCCCodePCMU16B;
sl@0
   758
	case KMMFFourCCCodeIMAD:
sl@0
   759
		return KDesMMFFourCCCodeIMAD;
sl@0
   760
	case KMMFFourCCCodeIMAS:
sl@0
   761
		return  KDesMMFFourCCCodeIMAS;
sl@0
   762
	case KMMFFourCCCodeALAW:
sl@0
   763
		return KDesMMFFourCCCodeALAW;
sl@0
   764
	case KMMFFourCCCodeMuLAW:
sl@0
   765
		return KDesMMFFourCCCodeMuLAW;
sl@0
   766
	case KMMFFourCCCodeGSM610:
sl@0
   767
		return KDesMMFFourCCCodeGSM610;
sl@0
   768
	case KMMFFourCCCodeNULL:
sl@0
   769
		return KDesFourCCCodeNULL;
sl@0
   770
	case KMMFFourCCCodeAMR:
sl@0
   771
		return KDesMMFFourCCCodeAMR;
sl@0
   772
	case KMMFFourCCCodeAAC:
sl@0
   773
		return KDesMMFFourCCCodeAAC;
sl@0
   774
	case KMMFFourCCCodeAWB:
sl@0
   775
		return KDesMMFFourCCCodeAWB;
sl@0
   776
	case KMMFFourCCCodeMP3:
sl@0
   777
		return KDesMMFFourCCCodeMP3;
sl@0
   778
	case KMMFFourCCCodeATRAC3:
sl@0
   779
		return KDesMMFFourCCCodeATRAC3;
sl@0
   780
	case KMMFFourCCCodeSBC:
sl@0
   781
		return KDesMMFFourCCCodeSBC;
sl@0
   782
	case KMMFFourCCCodeAMRW:
sl@0
   783
		return KDesMMFFourCCCodeAMRW;
sl@0
   784
	case KMMFFourCCCodeADTS:
sl@0
   785
		return KDesMMFFourCCCodeADTS;
sl@0
   786
	default:
sl@0
   787
		break;
sl@0
   788
		};
sl@0
   789
	return KDesMMFFourCCCodeUnknown;
sl@0
   790
	}
sl@0
   791
sl@0
   792
TBool CT_MMUtil::ReadAudioDataSettings(CDataWrapper& aDataWrapper, TMdaAudioDataSettings& aSettings, const TDesC& aSection)
sl@0
   793
	{
sl@0
   794
	TBool	ret=EFalse;
sl@0
   795
	TBool	callQuery=ETrue;
sl@0
   796
sl@0
   797
	//	Read capabilities
sl@0
   798
	TInt	index=0;
sl@0
   799
	TBool	moreData=ETrue;
sl@0
   800
	TPtrC	capabilityString;
sl@0
   801
	TInt	capability=0;
sl@0
   802
	TBool	hasCapabilty=EFalse;
sl@0
   803
	while ( moreData )
sl@0
   804
		{
sl@0
   805
		TBuf<KMaxTestExecuteCommandLength>	capabilityTemp;
sl@0
   806
		capabilityTemp.Format(KCmdCapabilty(), ++index);
sl@0
   807
		if ( aDataWrapper.GetStringFromConfig(aSection, capabilityTemp, capabilityString) )
sl@0
   808
			{
sl@0
   809
			TMdaAudioDataSettings::TAudioCaps	audioCap;
sl@0
   810
			if ( ConvertToAudioCaps(capabilityString, audioCap) )
sl@0
   811
				{
sl@0
   812
				capability |= audioCap;
sl@0
   813
				hasCapabilty=ETrue;
sl@0
   814
				}
sl@0
   815
			else
sl@0
   816
				{
sl@0
   817
				aDataWrapper.ERR_PRINTF2(_L("Illegal capability %S"), &capabilityString);
sl@0
   818
				aDataWrapper.SetBlockResult(EFail);
sl@0
   819
				}
sl@0
   820
			}
sl@0
   821
		else
sl@0
   822
			{
sl@0
   823
			moreData=EFalse;
sl@0
   824
			}
sl@0
   825
		}
sl@0
   826
	if ( hasCapabilty )
sl@0
   827
		{
sl@0
   828
		aSettings.iCaps=capability;
sl@0
   829
		ret=ETrue;
sl@0
   830
		}
sl@0
   831
sl@0
   832
	//	Read channels
sl@0
   833
	TInt	channels=0;
sl@0
   834
	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdChannels(), channels) )
sl@0
   835
		{
sl@0
   836
		aSettings.iChannels=channels;
sl@0
   837
		callQuery=EFalse;
sl@0
   838
		ret=ETrue;
sl@0
   839
		}
sl@0
   840
sl@0
   841
	//	Read flags
sl@0
   842
	TMdaAudioDataSettings::TAudioFlags	flags;
sl@0
   843
	TPtrC								flagsString;
sl@0
   844
	if ( aDataWrapper.GetStringFromConfig(aSection, KCmdFlags(), flagsString) )
sl@0
   845
		{
sl@0
   846
		if ( ConvertToAudioFlags(flagsString, flags) )
sl@0
   847
			{
sl@0
   848
			aSettings.iFlags=flags;
sl@0
   849
			ret=ETrue;
sl@0
   850
			}
sl@0
   851
		else
sl@0
   852
			{
sl@0
   853
			aDataWrapper.ERR_PRINTF2(_L("Illegal flags %S"), &flagsString);
sl@0
   854
			aDataWrapper.SetBlockResult(EFail);
sl@0
   855
			}
sl@0
   856
		}
sl@0
   857
sl@0
   858
	//	Read max volume
sl@0
   859
	TInt	maxVolume=0;
sl@0
   860
	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdMaxVolume(), maxVolume) )
sl@0
   861
		{
sl@0
   862
		aSettings.iMaxVolume=maxVolume;
sl@0
   863
		ret=ETrue;
sl@0
   864
		}
sl@0
   865
sl@0
   866
	//	Read sample rate
sl@0
   867
	TInt	sampleRate=0;
sl@0
   868
	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdSampleRate(), sampleRate) )
sl@0
   869
		{
sl@0
   870
		aSettings.iSampleRate=sampleRate;
sl@0
   871
		callQuery=EFalse;
sl@0
   872
		ret=ETrue;
sl@0
   873
		}
sl@0
   874
sl@0
   875
	//	Read volume
sl@0
   876
	TInt	volume=0;
sl@0
   877
	if ( aDataWrapper.GetIntFromConfig(aSection, KCmdVolume(), volume) )
sl@0
   878
		{
sl@0
   879
		aSettings.iVolume=volume;
sl@0
   880
		callQuery=EFalse;
sl@0
   881
		ret=ETrue;
sl@0
   882
		}
sl@0
   883
sl@0
   884
	if ( callQuery )
sl@0
   885
		{
sl@0
   886
		aSettings.Query();
sl@0
   887
		}
sl@0
   888
sl@0
   889
	return ret;
sl@0
   890
	}
sl@0
   891
sl@0
   892
TBool CT_MMUtil::ConvertToDisplayMode(const TDesC& aDisplayModeStr, TDisplayMode& aDisplayMode)
sl@0
   893
	{
sl@0
   894
	TBool	ret = ETrue;
sl@0
   895
sl@0
   896
	if (aDisplayModeStr == KDModeNone)
sl@0
   897
		{
sl@0
   898
		aDisplayMode = ENone;
sl@0
   899
		}
sl@0
   900
	else if (aDisplayModeStr == KDModeGray2)
sl@0
   901
		{
sl@0
   902
		aDisplayMode = EGray2;
sl@0
   903
		}
sl@0
   904
	else if (aDisplayModeStr == KDModeGray4)
sl@0
   905
		{
sl@0
   906
		aDisplayMode = EGray4;
sl@0
   907
		}
sl@0
   908
	else if (aDisplayModeStr == KDModeGray16)
sl@0
   909
		{
sl@0
   910
		aDisplayMode = EGray16;
sl@0
   911
		}
sl@0
   912
	else if (aDisplayModeStr == KDModeGray256)
sl@0
   913
		{
sl@0
   914
		aDisplayMode = EGray256;
sl@0
   915
		}
sl@0
   916
	else if (aDisplayModeStr == KDModeColor16)
sl@0
   917
		{
sl@0
   918
		aDisplayMode = EColor16;
sl@0
   919
		}
sl@0
   920
	else if (aDisplayModeStr == KDModeColor256)
sl@0
   921
		{
sl@0
   922
		aDisplayMode = EColor256;
sl@0
   923
		}
sl@0
   924
	else if (aDisplayModeStr == KDModeColor64K)
sl@0
   925
		{
sl@0
   926
		aDisplayMode = EColor64K;
sl@0
   927
		}
sl@0
   928
	else if (aDisplayModeStr == KDModeColor16M)
sl@0
   929
		{
sl@0
   930
		aDisplayMode = EColor16M;
sl@0
   931
		}
sl@0
   932
	else if (aDisplayModeStr == KDModeRgb)
sl@0
   933
		{
sl@0
   934
		aDisplayMode = ERgb;
sl@0
   935
		}
sl@0
   936
	else if (aDisplayModeStr == KDModeColor4K)
sl@0
   937
		{
sl@0
   938
		aDisplayMode = EColor4K;
sl@0
   939
		}
sl@0
   940
	else if (aDisplayModeStr == KDModeColor16MU)
sl@0
   941
		{
sl@0
   942
		aDisplayMode = EColor16MU;
sl@0
   943
		}
sl@0
   944
	else if (aDisplayModeStr == KDModeColor16MA)
sl@0
   945
		{
sl@0
   946
		aDisplayMode = EColor16MA;
sl@0
   947
		}
sl@0
   948
	else if (aDisplayModeStr == KDModeColorLast)
sl@0
   949
		{
sl@0
   950
		aDisplayMode = EColorLast;
sl@0
   951
		}
sl@0
   952
	else
sl@0
   953
		{
sl@0
   954
		ret = EFalse;
sl@0
   955
		}
sl@0
   956
sl@0
   957
	return ret;
sl@0
   958
	}
sl@0
   959
sl@0
   960
TBool CT_MMUtil::ConvertToVideoRotation(const TDesC& aVideoRotationStr, TVideoRotation& aVideoRotation)
sl@0
   961
	{
sl@0
   962
	TBool	ret = ETrue;
sl@0
   963
sl@0
   964
	if (aVideoRotationStr == KEVideoRotationNone)
sl@0
   965
		{
sl@0
   966
		aVideoRotation = EVideoRotationNone;
sl@0
   967
		}
sl@0
   968
	else if (aVideoRotationStr == KEVideoRotationClockwise90)
sl@0
   969
		{
sl@0
   970
		aVideoRotation = EVideoRotationClockwise90;
sl@0
   971
		}
sl@0
   972
	else if (aVideoRotationStr == KEVideoRotationClockwise180)
sl@0
   973
		{
sl@0
   974
		aVideoRotation = EVideoRotationClockwise180;
sl@0
   975
		}
sl@0
   976
	else if (aVideoRotationStr == KEVideoRotationClockwise270)
sl@0
   977
		{
sl@0
   978
		aVideoRotation = EVideoRotationClockwise270;
sl@0
   979
		}
sl@0
   980
	else
sl@0
   981
		{
sl@0
   982
		ret = EFalse;
sl@0
   983
		}
sl@0
   984
sl@0
   985
	return ret;
sl@0
   986
	}
sl@0
   987
sl@0
   988
const TDesC& CT_MMUtil::GetVideoRotationString(TVideoRotation& aVideoRotation)
sl@0
   989
	{
sl@0
   990
	switch(aVideoRotation)
sl@0
   991
		{
sl@0
   992
	case EVideoRotationNone:
sl@0
   993
		return KEVideoRotationNone;
sl@0
   994
	case EVideoRotationClockwise90:
sl@0
   995
		return KEVideoRotationClockwise90;
sl@0
   996
	case EVideoRotationClockwise180:
sl@0
   997
		return KEVideoRotationClockwise180;
sl@0
   998
	case EVideoRotationClockwise270:
sl@0
   999
		return KEVideoRotationClockwise270;
sl@0
  1000
	default:
sl@0
  1001
		break;
sl@0
  1002
		};
sl@0
  1003
	return KEVideoRotationUnknown;
sl@0
  1004
	}
sl@0
  1005
sl@0
  1006
sl@0
  1007
void CT_MMUtil::VerifyMIMETypeArrayL(CDataWrapper& aDataWrapper, const TDesC& aSection, const RFileExtensionMIMETypeArray& aFileExtensionArray)
sl@0
  1008
	{
sl@0
  1009
sl@0
  1010
sl@0
  1011
	TInt	count=aFileExtensionArray.Count();
sl@0
  1012
	for ( TInt index=0; index<count; ++index )
sl@0
  1013
		{
sl@0
  1014
		CFileExtensionMIMEType*	data=aFileExtensionArray[index];
sl@0
  1015
		const TDesC&			displayName=data->DisplayName();
sl@0
  1016
		const TDesC&			fileExtension=data->FileExtension();
sl@0
  1017
		TUid					imageSubType=data->ImageSubType();
sl@0
  1018
		TUid					imageType=data->ImageType();
sl@0
  1019
		TUid					implementationUid=data->ImplementationUid();
sl@0
  1020
		const TDesC8&			mimeType8=data->MIMEType();
sl@0
  1021
		HBufC*					mimeType=HBufC::NewLC(mimeType8.Length());
sl@0
  1022
		TPtr					mimeDes=mimeType->Des();
sl@0
  1023
		mimeDes.Copy(mimeType8);
sl@0
  1024
		aDataWrapper.INFO_PRINTF3(_L("DisplayName[%d]      =%S"), index, &displayName);
sl@0
  1025
		aDataWrapper.INFO_PRINTF3(_L("FileExtension[%d]    =%S"), index, &fileExtension);
sl@0
  1026
		aDataWrapper.INFO_PRINTF3(_L("ImageSubType[%d]     =0x%X"), index, imageSubType.iUid);
sl@0
  1027
		aDataWrapper.INFO_PRINTF3(_L("ImageType[%d]        =0x%X"), index, imageType.iUid);
sl@0
  1028
		aDataWrapper.INFO_PRINTF3(_L("ImplementationUid[%d]=0x%X"), index, implementationUid.iUid);
sl@0
  1029
		aDataWrapper.INFO_PRINTF3(_L("MIMEType[%d]         =%S"), index, &mimeDes);
sl@0
  1030
		CleanupStack::PopAndDestroy(mimeType);
sl@0
  1031
sl@0
  1032
		//	Verify that it is unique in the array
sl@0
  1033
		for ( TInt index2=index+1; index2<count; ++index2 )
sl@0
  1034
			{
sl@0
  1035
			CFileExtensionMIMEType*	data2=aFileExtensionArray[index2];
sl@0
  1036
			if	(	(fileExtension.Compare(data2->FileExtension())==0) &&
sl@0
  1037
					(imageSubType==data2->ImageSubType()) &&
sl@0
  1038
					(imageType==data2->ImageType()) &&
sl@0
  1039
					(implementationUid==data2->ImplementationUid()) &&
sl@0
  1040
					(mimeType8.Compare(data2->MIMEType())==0)
sl@0
  1041
				)
sl@0
  1042
				{
sl@0
  1043
				aDataWrapper.ERR_PRINTF3(_L("Duplicate Types in entries %d and %d"), index, index2);
sl@0
  1044
				aDataWrapper.SetBlockResult(EFail);
sl@0
  1045
				}
sl@0
  1046
			}
sl@0
  1047
		}
sl@0
  1048
	TInt	expectedCount=0;
sl@0
  1049
	if ( aDataWrapper.GetIntFromConfig(aSection, KCount(), expectedCount) )
sl@0
  1050
		{
sl@0
  1051
		if ( count != expectedCount )
sl@0
  1052
			{
sl@0
  1053
			aDataWrapper.ERR_PRINTF3(_L("count (%d) != expectedCount (%d)"), count, expectedCount);
sl@0
  1054
			aDataWrapper.SetBlockResult(EFail);
sl@0
  1055
			}
sl@0
  1056
		}
sl@0
  1057
	}
sl@0
  1058
sl@0
  1059
void CT_MMUtil::GetControllerAndFormatUidL(CDataWrapper& aDataWrapper, const TDesC& aFileName, TUid aMediaId, TBool aRecord, TUid& aControllerUid, TUid& aFormatUid)
sl@0
  1060
	{
sl@0
  1061
	RFs	fs;
sl@0
  1062
	User::LeaveIfError(fs.Connect());
sl@0
  1063
	CleanupClosePushL(fs);
sl@0
  1064
sl@0
  1065
	TParse	parse;
sl@0
  1066
	fs.Parse(aFileName, parse);
sl@0
  1067
	TPtrC	extension=parse.Ext();
sl@0
  1068
sl@0
  1069
	CMMFControllerPluginSelectionParameters*	controllerSelection = CMMFControllerPluginSelectionParameters::NewLC();
sl@0
  1070
	CMMFFormatSelectionParameters*				formatSelection = CMMFFormatSelectionParameters::NewLC();
sl@0
  1071
sl@0
  1072
	// Set the play and record format selection parameters to be blank.
sl@0
  1073
	// Format support is only retrieved if requested.
sl@0
  1074
	controllerSelection->SetRequiredPlayFormatSupportL(*formatSelection);
sl@0
  1075
	controllerSelection->SetRequiredRecordFormatSupportL(*formatSelection);
sl@0
  1076
sl@0
  1077
	// Set the media ids
sl@0
  1078
	RArray<TUid>	mediaIds;
sl@0
  1079
	CleanupClosePushL(mediaIds);
sl@0
  1080
	User::LeaveIfError(mediaIds.Append(aMediaId));
sl@0
  1081
sl@0
  1082
	// Get plugins that support at least audio
sl@0
  1083
	controllerSelection->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
sl@0
  1084
	controllerSelection->SetPreferredSupplierL(KNullDesC, CMMFPluginSelectionParameters::EPreferredSupplierPluginsFirstInList);
sl@0
  1085
sl@0
  1086
	// Array to hold all the controllers support the match data
sl@0
  1087
	RMMFControllerImplInfoArray	controllers;
sl@0
  1088
	CleanupResetAndDestroyPushL(controllers);
sl@0
  1089
	controllerSelection->ListImplementationsL(controllers);
sl@0
  1090
sl@0
  1091
	// Find the first controller with at least one record format available
sl@0
  1092
	aControllerUid=TUid::Null();
sl@0
  1093
	aFormatUid=TUid::Null();
sl@0
  1094
sl@0
  1095
	TBool	set = EFalse;
sl@0
  1096
	TBool	stillNull = ETrue;
sl@0
  1097
	for( TInt controllerIndex=0; (controllerIndex<controllers.Count()) && !set; ++controllerIndex )
sl@0
  1098
		{
sl@0
  1099
		const CMMFControllerImplementationInformation*	controller=controllers[controllerIndex];
sl@0
  1100
		LogL(aDataWrapper, *controller);
sl@0
  1101
sl@0
  1102
		if ( aRecord )
sl@0
  1103
			{
sl@0
  1104
			const RMMFFormatImplInfoArray&	formats=controller->RecordFormats();
sl@0
  1105
sl@0
  1106
			for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
sl@0
  1107
				{
sl@0
  1108
				CMMFFormatImplementationInformation*	formatInfo=formats[formatIndex];
sl@0
  1109
				const CDesC8Array&						extensions=formatInfo->SupportedFileExtensions();
sl@0
  1110
sl@0
  1111
				for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
sl@0
  1112
					{
sl@0
  1113
					HBufC*	buffer=HBufC::NewLC(extensions[extensionsIndex].Length());
sl@0
  1114
					TPtr	bufferPtr=buffer->Des();
sl@0
  1115
					bufferPtr.Copy(extensions[extensionsIndex]);	// Create a 16 bit copy of the 8 bit original
sl@0
  1116
sl@0
  1117
					if ( stillNull )
sl@0
  1118
						{
sl@0
  1119
						aControllerUid = controller->Uid();
sl@0
  1120
						aFormatUid = formats[0]->Uid();
sl@0
  1121
						stillNull = EFalse;
sl@0
  1122
						}
sl@0
  1123
					if ( bufferPtr == extension )
sl@0
  1124
						{
sl@0
  1125
						aControllerUid = controller->Uid();
sl@0
  1126
						aFormatUid = formats[0]->Uid();
sl@0
  1127
						set = ETrue;
sl@0
  1128
						}
sl@0
  1129
					CleanupStack::PopAndDestroy(buffer);
sl@0
  1130
					}
sl@0
  1131
				}
sl@0
  1132
			}
sl@0
  1133
		else
sl@0
  1134
			{
sl@0
  1135
			const RMMFFormatImplInfoArray&	formats=controller->PlayFormats();
sl@0
  1136
sl@0
  1137
			for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
sl@0
  1138
				{
sl@0
  1139
				CMMFFormatImplementationInformation*	formatInfo=formats[formatIndex];
sl@0
  1140
				const CDesC8Array&						extensions=formatInfo->SupportedFileExtensions();
sl@0
  1141
sl@0
  1142
				for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
sl@0
  1143
					{
sl@0
  1144
					HBufC*	buffer=HBufC::NewLC(extensions[extensionsIndex].Length());
sl@0
  1145
					TPtr	bufferPtr=buffer->Des();
sl@0
  1146
					bufferPtr.Copy(extensions[extensionsIndex]);	// Create a 16 bit copy of the 8 bit original
sl@0
  1147
sl@0
  1148
					if ( stillNull )
sl@0
  1149
						{
sl@0
  1150
						aControllerUid = controller->Uid();
sl@0
  1151
						aFormatUid = formats[0]->Uid();
sl@0
  1152
						stillNull = EFalse;
sl@0
  1153
						}
sl@0
  1154
					if ( bufferPtr == extension )
sl@0
  1155
						{
sl@0
  1156
						aControllerUid = controller->Uid();
sl@0
  1157
						aFormatUid = formats[0]->Uid();
sl@0
  1158
						set = ETrue;
sl@0
  1159
						}
sl@0
  1160
					CleanupStack::PopAndDestroy(buffer);
sl@0
  1161
					}
sl@0
  1162
				}
sl@0
  1163
			}
sl@0
  1164
		}
sl@0
  1165
sl@0
  1166
	CleanupStack::PopAndDestroy(5, &fs);
sl@0
  1167
	}
sl@0
  1168
sl@0
  1169
void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFControllerImplementationInformation& aControllerInfo)
sl@0
  1170
	{
sl@0
  1171
	aDataWrapper.INFO_PRINTF2(_L("Controller DisplayName = %S"),	&(aControllerInfo.DisplayName()));
sl@0
  1172
	aDataWrapper.INFO_PRINTF2(_L("Controller Supplier = %S"),		&(aControllerInfo.Supplier()));
sl@0
  1173
	aDataWrapper.INFO_PRINTF2(_L("Controller Format Uid = 0x%X"),	aControllerInfo.Uid().iUid);
sl@0
  1174
sl@0
  1175
	// Print out Play Formats information
sl@0
  1176
	TInt	index;
sl@0
  1177
sl@0
  1178
	const RMMFFormatImplInfoArray&	playFormatArray = aControllerInfo.PlayFormats();
sl@0
  1179
	for ( index=0; index<playFormatArray.Count(); ++index )
sl@0
  1180
		{
sl@0
  1181
		CMMFFormatImplementationInformation*	formatInfo=playFormatArray[index];
sl@0
  1182
		aDataWrapper.INFO_PRINTF2(_L("PlayFormat [%d]"),		index);
sl@0
  1183
		LogL(aDataWrapper, *formatInfo);
sl@0
  1184
		}
sl@0
  1185
sl@0
  1186
	// Print out Record Formats information
sl@0
  1187
	const RMMFFormatImplInfoArray&	recordFormatArray = aControllerInfo.RecordFormats();
sl@0
  1188
	for ( index=0; index<recordFormatArray.Count(); ++index )
sl@0
  1189
		{
sl@0
  1190
		CMMFFormatImplementationInformation*	formatInfo=recordFormatArray[index];
sl@0
  1191
		aDataWrapper.INFO_PRINTF2(_L("RecordFormat [%d]"),		index);
sl@0
  1192
		LogL(aDataWrapper, *formatInfo);
sl@0
  1193
		}
sl@0
  1194
	}
sl@0
  1195
sl@0
  1196
void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFFormatImplementationInformation& aFormatInfo)
sl@0
  1197
	{
sl@0
  1198
	aDataWrapper.INFO_PRINTF2(_L("  DisplayName = %S"),	&(aFormatInfo.DisplayName()));
sl@0
  1199
	aDataWrapper.INFO_PRINTF2(_L("  Supplier = %S"),		&(aFormatInfo.Supplier()));
sl@0
  1200
	aDataWrapper.INFO_PRINTF2(_L("  Uid = 0x%X"),			aFormatInfo.Uid().iUid);
sl@0
  1201
sl@0
  1202
	TInt				index;
sl@0
  1203
	const CDesC8Array&	fileext=aFormatInfo.SupportedFileExtensions();
sl@0
  1204
sl@0
  1205
	for ( index=0; index<fileext.Count(); ++index )
sl@0
  1206
		{
sl@0
  1207
		HBufC*	buffer=HBufC::NewLC(fileext[index].Length());
sl@0
  1208
		TPtr	bufferPtr=buffer->Des();
sl@0
  1209
		bufferPtr.Copy(fileext[index]);	// Create a 16 bit copy of the 8 bit original
sl@0
  1210
		aDataWrapper.INFO_PRINTF3(_L("    Supported file extension [%d]: %S"), index, &bufferPtr);
sl@0
  1211
		CleanupStack::PopAndDestroy(buffer);
sl@0
  1212
		}
sl@0
  1213
sl@0
  1214
	const CDesC8Array&	mimetypes=aFormatInfo.SupportedMimeTypes();
sl@0
  1215
	for ( index=0; index<mimetypes.Count(); ++index )
sl@0
  1216
		{
sl@0
  1217
		HBufC*	buffer=HBufC::NewLC(mimetypes[index].Length());
sl@0
  1218
		TPtr	bufferPtr=buffer->Des();
sl@0
  1219
		bufferPtr.Copy(mimetypes[index]);	// Create a 16 bit copy of the 8 bit original
sl@0
  1220
		aDataWrapper.INFO_PRINTF3(_L("    Supported mime type [%d]: %S"), index, &bufferPtr);
sl@0
  1221
		CleanupStack::PopAndDestroy(buffer);
sl@0
  1222
		}
sl@0
  1223
sl@0
  1224
	const CDesC8Array&	headerdata=aFormatInfo.SupportedHeaderData();
sl@0
  1225
	for ( index=0; index<headerdata.Count(); ++index )
sl@0
  1226
		{
sl@0
  1227
		HBufC*	buffer=HBufC::NewLC(headerdata[index].Length());
sl@0
  1228
		TPtr	bufferPtr=buffer->Des();
sl@0
  1229
		bufferPtr.Copy(headerdata[index]);	// Create a 16 bit copy of the 8 bit original
sl@0
  1230
		aDataWrapper.INFO_PRINTF3(_L("    Supported header data [%d]: %S"), index, &bufferPtr);
sl@0
  1231
		CleanupStack::PopAndDestroy(buffer);
sl@0
  1232
		}
sl@0
  1233
	}