os/mm/mmlibs/mmfw/src/ControllerFramework/MMFStandardCustomCommands.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include <mmf/common/mmfaudio.h>
sl@0
    17
#include "mmfstandardcustomcommands.h"
sl@0
    18
#include "MMFVideoFrameMessage.h"
sl@0
    19
#include "MMFSCCPanicCodes.h"
sl@0
    20
#include <badesca.h>
sl@0
    21
sl@0
    22
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    23
#include <mmf/common/mmfstandardcustomcommandsenums.h>
sl@0
    24
#include <mmf/common/mmfstandardcustomcommandsimpl.h>
sl@0
    25
#include <mmf/common/mmfvideoenums.h>
sl@0
    26
#endif
sl@0
    27
sl@0
    28
sl@0
    29
const TInt KBufExpandSize8 = 8;//two TInts!
sl@0
    30
const TInt KBufExpandSize32 = 32;
sl@0
    31
sl@0
    32
const TInt KBufMimeTypeGranularity = 4;
sl@0
    33
const TInt KMaxMimeTypeLength = 256;
sl@0
    34
sl@0
    35
class TMimeTypeBufferInfo 
sl@0
    36
	{
sl@0
    37
public:
sl@0
    38
	TInt32 count;
sl@0
    39
	TInt32 bufferLen;
sl@0
    40
	};
sl@0
    41
sl@0
    42
EXPORT_C RMMFAudioPlayDeviceCustomCommands::RMMFAudioPlayDeviceCustomCommands(RMMFController& aController) :
sl@0
    43
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayDevice)
sl@0
    44
	{
sl@0
    45
	}
sl@0
    46
sl@0
    47
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolume(TInt aVolume) const
sl@0
    48
	{
sl@0
    49
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
    50
	configPackage().iVolume = aVolume;
sl@0
    51
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
    52
										 EMMFAudioPlayDeviceSetVolume, 
sl@0
    53
										 configPackage,
sl@0
    54
										 KNullDesC8);
sl@0
    55
	}
sl@0
    56
sl@0
    57
sl@0
    58
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetMaxVolume(TInt& aMaxVolume) const
sl@0
    59
	{
sl@0
    60
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
    61
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
    62
												EMMFAudioPlayDeviceGetMaxVolume, 
sl@0
    63
												KNullDesC8,
sl@0
    64
												KNullDesC8,
sl@0
    65
												configPackage);
sl@0
    66
	if (!error)
sl@0
    67
		aMaxVolume = configPackage().iMaxVolume;
sl@0
    68
	return error;
sl@0
    69
	}
sl@0
    70
sl@0
    71
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetVolume(TInt& aVolume) const 
sl@0
    72
	{
sl@0
    73
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
    74
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
    75
												EMMFAudioPlayDeviceGetVolume, 
sl@0
    76
												KNullDesC8,
sl@0
    77
												KNullDesC8,
sl@0
    78
												configPackage);
sl@0
    79
	if (!error)
sl@0
    80
		aVolume = configPackage().iVolume;
sl@0
    81
	return error;
sl@0
    82
	}
sl@0
    83
sl@0
    84
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) const
sl@0
    85
	{
sl@0
    86
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
    87
	configPackage().iRampDuration = aRampDuration;
sl@0
    88
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
    89
										 EMMFAudioPlayDeviceSetVolumeRamp, 
sl@0
    90
										 configPackage,
sl@0
    91
										 KNullDesC8);
sl@0
    92
	}
sl@0
    93
sl@0
    94
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetBalance(TInt aBalance) const
sl@0
    95
	{
sl@0
    96
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
    97
	configPackage().iBalance = aBalance;
sl@0
    98
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
    99
										 EMMFAudioPlayDeviceSetBalance, 
sl@0
   100
										 configPackage,
sl@0
   101
										 KNullDesC8);
sl@0
   102
	}
sl@0
   103
sl@0
   104
EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetBalance(TInt& aBalance) const
sl@0
   105
	{
sl@0
   106
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   107
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   108
												EMMFAudioPlayDeviceGetBalance, 
sl@0
   109
												KNullDesC8,
sl@0
   110
												KNullDesC8,
sl@0
   111
												configPackage);
sl@0
   112
	if (!error)
sl@0
   113
		aBalance = configPackage().iBalance;
sl@0
   114
	return error;
sl@0
   115
	}
sl@0
   116
sl@0
   117
EXPORT_C CMMFAudioPlayDeviceCustomCommandParser* CMMFAudioPlayDeviceCustomCommandParser::NewL(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor)
sl@0
   118
	{
sl@0
   119
	return new(ELeave) CMMFAudioPlayDeviceCustomCommandParser(aImplementor);
sl@0
   120
	}
sl@0
   121
sl@0
   122
EXPORT_C CMMFAudioPlayDeviceCustomCommandParser::~CMMFAudioPlayDeviceCustomCommandParser()
sl@0
   123
	{
sl@0
   124
	}
sl@0
   125
sl@0
   126
CMMFAudioPlayDeviceCustomCommandParser::CMMFAudioPlayDeviceCustomCommandParser(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor) : 
sl@0
   127
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayDevice),
sl@0
   128
	iImplementor(aImplementor)
sl@0
   129
	{
sl@0
   130
	}
sl@0
   131
sl@0
   132
sl@0
   133
void CMMFAudioPlayDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
   134
	{
sl@0
   135
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayDevice)
sl@0
   136
		{
sl@0
   137
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   138
		if (error)
sl@0
   139
			aMessage.Complete(error);
sl@0
   140
		}
sl@0
   141
	else
sl@0
   142
		{
sl@0
   143
		aMessage.Complete(KErrNotSupported);
sl@0
   144
		}
sl@0
   145
	}
sl@0
   146
sl@0
   147
void CMMFAudioPlayDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   148
	{
sl@0
   149
	TBool complete = ETrue;
sl@0
   150
	switch (aMessage.Function())
sl@0
   151
		{
sl@0
   152
	case EMMFAudioPlayDeviceSetVolume:
sl@0
   153
		complete = DoSetVolumeL(aMessage);
sl@0
   154
		break;
sl@0
   155
	case EMMFAudioPlayDeviceGetMaxVolume:
sl@0
   156
		complete = DoGetMaxVolumeL(aMessage);
sl@0
   157
		break;
sl@0
   158
	case EMMFAudioPlayDeviceGetVolume:
sl@0
   159
		complete = DoGetVolumeL(aMessage);
sl@0
   160
		break;
sl@0
   161
	case EMMFAudioPlayDeviceSetVolumeRamp:
sl@0
   162
		complete = DoSetVolumeRampL(aMessage);
sl@0
   163
		break;
sl@0
   164
	case EMMFAudioPlayDeviceSetBalance:
sl@0
   165
		complete = DoSetBalanceL(aMessage);
sl@0
   166
		break;
sl@0
   167
	case EMMFAudioPlayDeviceGetBalance:
sl@0
   168
		complete = DoGetBalanceL(aMessage);
sl@0
   169
		break;
sl@0
   170
	default:
sl@0
   171
		User::Leave(KErrNotSupported);
sl@0
   172
		break;
sl@0
   173
		}
sl@0
   174
	if (complete)
sl@0
   175
		aMessage.Complete(KErrNone);
sl@0
   176
	}
sl@0
   177
sl@0
   178
sl@0
   179
TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeL(TMMFMessage& aMessage)
sl@0
   180
	{
sl@0
   181
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   182
	aMessage.ReadData1FromClientL(pckg);
sl@0
   183
	iImplementor.MapdSetVolumeL(pckg().iVolume);
sl@0
   184
	return ETrue;
sl@0
   185
	}
sl@0
   186
sl@0
   187
TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetMaxVolumeL(TMMFMessage& aMessage)
sl@0
   188
	{
sl@0
   189
	TInt maxVol = 0;
sl@0
   190
	iImplementor.MapdGetMaxVolumeL(maxVol);
sl@0
   191
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   192
	pckg().iMaxVolume = maxVol;
sl@0
   193
	aMessage.WriteDataToClientL(pckg);
sl@0
   194
	return ETrue;
sl@0
   195
	}
sl@0
   196
sl@0
   197
TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetVolumeL(TMMFMessage& aMessage)
sl@0
   198
	{
sl@0
   199
	TInt vol = 0;
sl@0
   200
	iImplementor.MapdGetVolumeL(vol);
sl@0
   201
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   202
	pckg().iVolume = vol;
sl@0
   203
	aMessage.WriteDataToClientL(pckg);
sl@0
   204
	return ETrue;
sl@0
   205
	}
sl@0
   206
sl@0
   207
TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeRampL(TMMFMessage& aMessage)
sl@0
   208
	{
sl@0
   209
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   210
	aMessage.ReadData1FromClientL(pckg);
sl@0
   211
	iImplementor.MapdSetVolumeRampL(pckg().iRampDuration);
sl@0
   212
	return ETrue;
sl@0
   213
	}
sl@0
   214
sl@0
   215
TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
sl@0
   216
	{
sl@0
   217
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   218
	aMessage.ReadData1FromClientL(pckg);
sl@0
   219
	iImplementor.MapdSetBalanceL(pckg().iBalance);
sl@0
   220
	return ETrue;
sl@0
   221
	}
sl@0
   222
sl@0
   223
TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
sl@0
   224
	{
sl@0
   225
	TInt bal = 0;
sl@0
   226
	iImplementor.MapdGetBalanceL(bal);
sl@0
   227
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   228
	pckg().iBalance = bal;
sl@0
   229
	aMessage.WriteDataToClientL(pckg);
sl@0
   230
	return ETrue;
sl@0
   231
	}
sl@0
   232
sl@0
   233
sl@0
   234
sl@0
   235
sl@0
   236
sl@0
   237
sl@0
   238
sl@0
   239
sl@0
   240
sl@0
   241
sl@0
   242
sl@0
   243
sl@0
   244
sl@0
   245
sl@0
   246
sl@0
   247
sl@0
   248
sl@0
   249
sl@0
   250
sl@0
   251
sl@0
   252
sl@0
   253
sl@0
   254
sl@0
   255
EXPORT_C RMMFAudioRecordDeviceCustomCommands::RMMFAudioRecordDeviceCustomCommands(RMMFController& aController) :
sl@0
   256
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordDevice)
sl@0
   257
	{
sl@0
   258
	}
sl@0
   259
sl@0
   260
EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetGain(TInt aGain) const
sl@0
   261
	{
sl@0
   262
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   263
	configPackage().iGain = aGain;
sl@0
   264
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   265
										 EMMFAudioRecordDeviceSetGain, 
sl@0
   266
										 configPackage,
sl@0
   267
										 KNullDesC8);
sl@0
   268
	}
sl@0
   269
sl@0
   270
EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetMaxGain(TInt& aMaxGain) const
sl@0
   271
	{
sl@0
   272
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   273
	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
   274
										 EMMFAudioRecordDeviceGetMaxGain, 
sl@0
   275
										 KNullDesC8,
sl@0
   276
										 KNullDesC8,
sl@0
   277
										 configPackage);
sl@0
   278
	if (!error)
sl@0
   279
		aMaxGain = configPackage().iMaxGain;
sl@0
   280
	return error;
sl@0
   281
	}
sl@0
   282
sl@0
   283
EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetGain(TInt& aGain) const
sl@0
   284
	{
sl@0
   285
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   286
	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
   287
										 EMMFAudioRecordDeviceGetGain, 
sl@0
   288
										 KNullDesC8,
sl@0
   289
										 KNullDesC8,
sl@0
   290
										 configPackage);
sl@0
   291
	if (!error)
sl@0
   292
		aGain = configPackage().iGain;
sl@0
   293
	return error;
sl@0
   294
	}
sl@0
   295
sl@0
   296
EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetBalance(TInt aBalance) const
sl@0
   297
	{
sl@0
   298
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   299
	configPackage().iBalance = aBalance;
sl@0
   300
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   301
										 EMMFAudioRecordDeviceSetBalance, 
sl@0
   302
										 configPackage,
sl@0
   303
										 KNullDesC8);
sl@0
   304
	}
sl@0
   305
sl@0
   306
EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetBalance(TInt& aBalance) const
sl@0
   307
	{
sl@0
   308
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   309
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   310
												EMMFAudioRecordDeviceGetBalance, 
sl@0
   311
												KNullDesC8,
sl@0
   312
												KNullDesC8,
sl@0
   313
												configPackage);
sl@0
   314
	if (!error)
sl@0
   315
		aBalance = configPackage().iBalance;
sl@0
   316
	return error;
sl@0
   317
	}
sl@0
   318
sl@0
   319
EXPORT_C CMMFAudioRecordDeviceCustomCommandParser* CMMFAudioRecordDeviceCustomCommandParser::NewL(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) 
sl@0
   320
	{
sl@0
   321
	return new(ELeave) CMMFAudioRecordDeviceCustomCommandParser(aImplementor);
sl@0
   322
	}
sl@0
   323
sl@0
   324
CMMFAudioRecordDeviceCustomCommandParser::CMMFAudioRecordDeviceCustomCommandParser(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) :
sl@0
   325
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordDevice),
sl@0
   326
	iImplementor(aImplementor)
sl@0
   327
	{
sl@0
   328
	}
sl@0
   329
sl@0
   330
EXPORT_C CMMFAudioRecordDeviceCustomCommandParser::~CMMFAudioRecordDeviceCustomCommandParser()
sl@0
   331
	{
sl@0
   332
	}
sl@0
   333
sl@0
   334
void CMMFAudioRecordDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
   335
	{
sl@0
   336
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordDevice)
sl@0
   337
		{
sl@0
   338
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   339
		if (error)
sl@0
   340
			aMessage.Complete(error);
sl@0
   341
		}
sl@0
   342
	else
sl@0
   343
		{
sl@0
   344
		aMessage.Complete(KErrNotSupported);
sl@0
   345
		}
sl@0
   346
	}
sl@0
   347
sl@0
   348
void CMMFAudioRecordDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   349
	{
sl@0
   350
	TBool complete = ETrue;
sl@0
   351
	switch (aMessage.Function())
sl@0
   352
		{
sl@0
   353
	case EMMFAudioRecordDeviceSetGain:
sl@0
   354
		complete = DoSetGainL(aMessage);
sl@0
   355
		break;
sl@0
   356
	case EMMFAudioRecordDeviceGetMaxGain:
sl@0
   357
		complete = DoGetMaxGainL(aMessage);
sl@0
   358
		break;
sl@0
   359
	case EMMFAudioRecordDeviceGetGain:
sl@0
   360
		complete = DoGetGainL(aMessage);
sl@0
   361
		break;
sl@0
   362
	case EMMFAudioRecordDeviceSetBalance:
sl@0
   363
		complete = DoSetBalanceL(aMessage);
sl@0
   364
		break;
sl@0
   365
	case EMMFAudioRecordDeviceGetBalance:
sl@0
   366
		complete = DoGetBalanceL(aMessage);
sl@0
   367
		break;
sl@0
   368
	default:
sl@0
   369
		User::Leave(KErrNotSupported);
sl@0
   370
		break;
sl@0
   371
		}
sl@0
   372
	if (complete)
sl@0
   373
		aMessage.Complete(KErrNone);
sl@0
   374
	}
sl@0
   375
sl@0
   376
TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetGainL(TMMFMessage& aMessage)
sl@0
   377
	{
sl@0
   378
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   379
	aMessage.ReadData1FromClientL(pckg);
sl@0
   380
	iImplementor.MardSetGainL(pckg().iGain);
sl@0
   381
	return ETrue;
sl@0
   382
	}
sl@0
   383
sl@0
   384
TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetMaxGainL(TMMFMessage& aMessage)
sl@0
   385
	{
sl@0
   386
	TInt maxGain = 0;
sl@0
   387
	iImplementor.MardGetMaxGainL(maxGain);
sl@0
   388
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   389
	pckg().iMaxGain = maxGain;
sl@0
   390
	aMessage.WriteDataToClientL(pckg);
sl@0
   391
	return ETrue;
sl@0
   392
	}
sl@0
   393
sl@0
   394
TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetGainL(TMMFMessage& aMessage)
sl@0
   395
	{
sl@0
   396
	TInt gain = 0;
sl@0
   397
	iImplementor.MardGetGainL(gain);
sl@0
   398
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   399
	pckg().iGain = gain;
sl@0
   400
	aMessage.WriteDataToClientL(pckg);
sl@0
   401
	return ETrue;
sl@0
   402
	}
sl@0
   403
sl@0
   404
TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
sl@0
   405
	{
sl@0
   406
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   407
	aMessage.ReadData1FromClientL(pckg);
sl@0
   408
	iImplementor.MardSetBalanceL(pckg().iBalance);
sl@0
   409
	return ETrue;
sl@0
   410
	}
sl@0
   411
sl@0
   412
TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
sl@0
   413
	{
sl@0
   414
	TInt balance = 0;
sl@0
   415
	iImplementor.MardGetBalanceL(balance);
sl@0
   416
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   417
	pckg().iBalance = balance;
sl@0
   418
	aMessage.WriteDataToClientL(pckg);
sl@0
   419
	return ETrue;
sl@0
   420
	}
sl@0
   421
sl@0
   422
sl@0
   423
sl@0
   424
sl@0
   425
sl@0
   426
sl@0
   427
sl@0
   428
sl@0
   429
sl@0
   430
sl@0
   431
sl@0
   432
sl@0
   433
sl@0
   434
sl@0
   435
sl@0
   436
sl@0
   437
sl@0
   438
sl@0
   439
sl@0
   440
sl@0
   441
sl@0
   442
EXPORT_C RMMFAudioPlayControllerCustomCommands::RMMFAudioPlayControllerCustomCommands(RMMFController& aController) :
sl@0
   443
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayController)
sl@0
   444
	{
sl@0
   445
	}
sl@0
   446
sl@0
   447
EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::SetPlaybackWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
sl@0
   448
	{
sl@0
   449
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   450
	configPackage().iStartPosition = aStart;
sl@0
   451
	configPackage().iEndPosition = aEnd;
sl@0
   452
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   453
										 EMMFAudioPlayControllerSetPlaybackWindow, 
sl@0
   454
										 configPackage,
sl@0
   455
										 KNullDesC8);
sl@0
   456
	}
sl@0
   457
sl@0
   458
sl@0
   459
EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::DeletePlaybackWindow()
sl@0
   460
	{
sl@0
   461
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   462
										 EMMFAudioPlayControllerDeletePlaybackWindow, 
sl@0
   463
										 KNullDesC8,
sl@0
   464
										 KNullDesC8);
sl@0
   465
	}
sl@0
   466
	
sl@0
   467
EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
sl@0
   468
	{
sl@0
   469
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   470
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   471
												EMMFAudioPlayControllerGetLoadingProgress, 
sl@0
   472
												KNullDesC8,
sl@0
   473
												KNullDesC8,
sl@0
   474
												configPackage);
sl@0
   475
	if (!error)
sl@0
   476
		aPercentageComplete = configPackage().iLoadingCompletePercentage;
sl@0
   477
	return error;
sl@0
   478
	}
sl@0
   479
sl@0
   480
sl@0
   481
sl@0
   482
EXPORT_C CMMFAudioPlayControllerCustomCommandParser* CMMFAudioPlayControllerCustomCommandParser::NewL(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor)
sl@0
   483
	{
sl@0
   484
	return new(ELeave) CMMFAudioPlayControllerCustomCommandParser(aImplementor);
sl@0
   485
	}
sl@0
   486
sl@0
   487
CMMFAudioPlayControllerCustomCommandParser::CMMFAudioPlayControllerCustomCommandParser(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor) :
sl@0
   488
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayController),
sl@0
   489
	iImplementor(aImplementor)
sl@0
   490
	{
sl@0
   491
	}
sl@0
   492
sl@0
   493
EXPORT_C CMMFAudioPlayControllerCustomCommandParser::~CMMFAudioPlayControllerCustomCommandParser()
sl@0
   494
	{
sl@0
   495
	}
sl@0
   496
sl@0
   497
void CMMFAudioPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
   498
	{
sl@0
   499
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayController)
sl@0
   500
		{
sl@0
   501
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   502
		if (error)
sl@0
   503
			aMessage.Complete(error);
sl@0
   504
		}
sl@0
   505
	else
sl@0
   506
		{
sl@0
   507
		aMessage.Complete(KErrNotSupported);
sl@0
   508
		}
sl@0
   509
	}
sl@0
   510
sl@0
   511
void CMMFAudioPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   512
	{
sl@0
   513
	TBool complete = ETrue;
sl@0
   514
	switch (aMessage.Function())
sl@0
   515
		{
sl@0
   516
	case EMMFAudioPlayControllerSetPlaybackWindow:
sl@0
   517
		complete = DoSetPlaybackWindowL(aMessage);
sl@0
   518
		break;
sl@0
   519
	case EMMFAudioPlayControllerDeletePlaybackWindow:
sl@0
   520
		complete = DoDeletePlaybackWindowL(aMessage);
sl@0
   521
		break;
sl@0
   522
	case EMMFAudioPlayControllerGetLoadingProgress:
sl@0
   523
		complete = DoGetLoadingProgressL(aMessage);
sl@0
   524
		break;
sl@0
   525
	default:
sl@0
   526
		User::Leave(KErrNotSupported);
sl@0
   527
		break;
sl@0
   528
		}
sl@0
   529
	if (complete)
sl@0
   530
		aMessage.Complete(KErrNone);
sl@0
   531
	}
sl@0
   532
sl@0
   533
TBool CMMFAudioPlayControllerCustomCommandParser::DoSetPlaybackWindowL(TMMFMessage& aMessage)
sl@0
   534
	{
sl@0
   535
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   536
	aMessage.ReadData1FromClientL(pckg);
sl@0
   537
	iImplementor.MapcSetPlaybackWindowL(pckg().iStartPosition, pckg().iEndPosition);
sl@0
   538
	return ETrue;
sl@0
   539
	}
sl@0
   540
sl@0
   541
TBool CMMFAudioPlayControllerCustomCommandParser::DoDeletePlaybackWindowL(TMMFMessage& /*aMessage*/)
sl@0
   542
	{
sl@0
   543
	iImplementor.MapcDeletePlaybackWindowL();
sl@0
   544
	return ETrue;
sl@0
   545
	}
sl@0
   546
sl@0
   547
TBool CMMFAudioPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
sl@0
   548
	{
sl@0
   549
	TInt progress;
sl@0
   550
	iImplementor.MapcGetLoadingProgressL(progress);
sl@0
   551
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   552
	pckg().iLoadingCompletePercentage = progress;
sl@0
   553
	aMessage.WriteDataToClientL(pckg);
sl@0
   554
	return ETrue;
sl@0
   555
	}
sl@0
   556
sl@0
   557
sl@0
   558
sl@0
   559
sl@0
   560
sl@0
   561
sl@0
   562
sl@0
   563
sl@0
   564
sl@0
   565
sl@0
   566
sl@0
   567
EXPORT_C RMMFAudioRecordControllerCustomCommands::RMMFAudioRecordControllerCustomCommands(RMMFController& aController) :
sl@0
   568
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordController)
sl@0
   569
	{
sl@0
   570
	}
sl@0
   571
sl@0
   572
EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
sl@0
   573
	{
sl@0
   574
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   575
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   576
												EMMFAudioRecordControllerGetRecordTimeAvailable, 
sl@0
   577
												KNullDesC8,
sl@0
   578
												KNullDesC8,
sl@0
   579
												configPackage);
sl@0
   580
	if (!error)
sl@0
   581
		aTime = configPackage().iRecordTimeAvailable;
sl@0
   582
	return error;
sl@0
   583
	}
sl@0
   584
sl@0
   585
EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxDuration(const TTimeIntervalMicroSeconds& aMaxDuration) const
sl@0
   586
	{
sl@0
   587
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   588
	configPackage().iMaxDuration = aMaxDuration;
sl@0
   589
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   590
										 EMMFAudioRecordControllerSetMaxDuration, 
sl@0
   591
										 configPackage,
sl@0
   592
										 KNullDesC8);
sl@0
   593
	}
sl@0
   594
sl@0
   595
EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
sl@0
   596
	{
sl@0
   597
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   598
	configPackage().iMaxFileSize = aMaxSize;
sl@0
   599
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   600
										 EMMFAudioRecordControllerSetMaxFileSize, 
sl@0
   601
										 configPackage,
sl@0
   602
										 KNullDesC8);
sl@0
   603
	}
sl@0
   604
sl@0
   605
EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::Crop(TBool aToEnd)
sl@0
   606
	{
sl@0
   607
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   608
	configPackage().iCropToEnd = aToEnd;
sl@0
   609
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   610
										 EMMFAudioRecordControllerCrop, 
sl@0
   611
										 configPackage,
sl@0
   612
										 KNullDesC8);
sl@0
   613
	}
sl@0
   614
sl@0
   615
EXPORT_C void RMMFAudioRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry)
sl@0
   616
	{
sl@0
   617
	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0
   618
	CleanupStack::PushL(buf);
sl@0
   619
	RBufWriteStream s;
sl@0
   620
	s.Open(*buf);
sl@0
   621
	CleanupClosePushL(s);
sl@0
   622
	aNewEntry.ExternalizeL(s);
sl@0
   623
	TPtr8 bufData = buf->Ptr(0);
sl@0
   624
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0
   625
													 EMMFAudioRecordControllerAddMetaDataEntry,
sl@0
   626
													 bufData,
sl@0
   627
													 KNullDesC8));
sl@0
   628
	CleanupStack::PopAndDestroy(2);//s, buf
sl@0
   629
	}
sl@0
   630
sl@0
   631
EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex)
sl@0
   632
	{
sl@0
   633
	TPckgBuf<TInt> pckg(aIndex);
sl@0
   634
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
   635
										 EMMFAudioRecordControllerRemoveMetaDataEntry,
sl@0
   636
										 pckg,
sl@0
   637
										 KNullDesC8);
sl@0
   638
	}
sl@0
   639
sl@0
   640
EXPORT_C void RMMFAudioRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry)
sl@0
   641
	{
sl@0
   642
	TPckgBuf<TInt> indexPckg(aIndex);
sl@0
   643
	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0
   644
	CleanupStack::PushL(buf);
sl@0
   645
	RBufWriteStream s;
sl@0
   646
	s.Open(*buf);
sl@0
   647
	CleanupClosePushL(s);
sl@0
   648
	aNewEntry.ExternalizeL(s);
sl@0
   649
	TPtr8 bufData = buf->Ptr(0);
sl@0
   650
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0
   651
													 EMMFAudioRecordControllerReplaceMetaDataEntry,
sl@0
   652
													 bufData,
sl@0
   653
													 indexPckg));
sl@0
   654
	CleanupStack::PopAndDestroy(2);//s, buf
sl@0
   655
	}
sl@0
   656
sl@0
   657
EXPORT_C CMMFAudioRecordControllerCustomCommandParser* CMMFAudioRecordControllerCustomCommandParser::NewL(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor)
sl@0
   658
	{
sl@0
   659
	return new(ELeave) CMMFAudioRecordControllerCustomCommandParser(aImplementor);
sl@0
   660
	}
sl@0
   661
sl@0
   662
CMMFAudioRecordControllerCustomCommandParser::CMMFAudioRecordControllerCustomCommandParser(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor) :
sl@0
   663
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordController),
sl@0
   664
	iImplementor(aImplementor)
sl@0
   665
	{
sl@0
   666
	}
sl@0
   667
sl@0
   668
EXPORT_C CMMFAudioRecordControllerCustomCommandParser::~CMMFAudioRecordControllerCustomCommandParser()
sl@0
   669
	{
sl@0
   670
	}
sl@0
   671
sl@0
   672
void CMMFAudioRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
   673
	{
sl@0
   674
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordController)
sl@0
   675
		{
sl@0
   676
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
   677
		if (error)
sl@0
   678
			aMessage.Complete(error);
sl@0
   679
		}
sl@0
   680
	else
sl@0
   681
		{
sl@0
   682
		aMessage.Complete(KErrNotSupported);
sl@0
   683
		}
sl@0
   684
	}
sl@0
   685
sl@0
   686
void CMMFAudioRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
   687
	{
sl@0
   688
	TBool complete = ETrue;
sl@0
   689
	switch (aMessage.Function())
sl@0
   690
		{
sl@0
   691
	case EMMFAudioRecordControllerGetRecordTimeAvailable:
sl@0
   692
		complete = DoGetRecordTimeAvailableL(aMessage);
sl@0
   693
		break;
sl@0
   694
	case EMMFAudioRecordControllerSetMaxDuration:
sl@0
   695
		complete = DoSetMaxDurationL(aMessage);
sl@0
   696
		break;
sl@0
   697
	case EMMFAudioRecordControllerSetMaxFileSize:
sl@0
   698
		complete = DoSetMaxFileSizeL(aMessage);
sl@0
   699
		break;
sl@0
   700
	case EMMFAudioRecordControllerCrop:
sl@0
   701
		complete = DoCropL(aMessage);
sl@0
   702
		break;
sl@0
   703
	case EMMFAudioRecordControllerAddMetaDataEntry:
sl@0
   704
		complete = DoAddMetaDataEntryL(aMessage);
sl@0
   705
		break;
sl@0
   706
	case EMMFAudioRecordControllerRemoveMetaDataEntry:
sl@0
   707
		complete = DoRemoveMetaDataEntryL(aMessage);
sl@0
   708
		break;
sl@0
   709
	case EMMFAudioRecordControllerReplaceMetaDataEntry:
sl@0
   710
		complete = DoReplaceMetaDataEntryL(aMessage);
sl@0
   711
		break;
sl@0
   712
	default:
sl@0
   713
		User::Leave(KErrNotSupported);
sl@0
   714
		break;
sl@0
   715
		}
sl@0
   716
	if (complete)
sl@0
   717
		aMessage.Complete(KErrNone);
sl@0
   718
	}
sl@0
   719
sl@0
   720
TBool CMMFAudioRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
sl@0
   721
	{
sl@0
   722
	TTimeIntervalMicroSeconds time;
sl@0
   723
	iImplementor.MarcGetRecordTimeAvailableL(time);
sl@0
   724
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   725
	pckg().iRecordTimeAvailable = time;
sl@0
   726
	aMessage.WriteDataToClientL(pckg);
sl@0
   727
	return ETrue;
sl@0
   728
	}
sl@0
   729
sl@0
   730
TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxDurationL(TMMFMessage& aMessage)
sl@0
   731
	{
sl@0
   732
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   733
	aMessage.ReadData1FromClientL(pckg);
sl@0
   734
	iImplementor.MarcSetMaxDurationL(pckg().iMaxDuration);
sl@0
   735
	return ETrue;
sl@0
   736
	}
sl@0
   737
sl@0
   738
TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
sl@0
   739
	{
sl@0
   740
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   741
	aMessage.ReadData1FromClientL(pckg);
sl@0
   742
	iImplementor.MarcSetMaxFileSizeL(pckg().iMaxFileSize);
sl@0
   743
	return ETrue;
sl@0
   744
	}
sl@0
   745
sl@0
   746
TBool CMMFAudioRecordControllerCustomCommandParser::DoCropL(TMMFMessage& aMessage)
sl@0
   747
	{
sl@0
   748
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
   749
	aMessage.ReadData1FromClientL(pckg);
sl@0
   750
	iImplementor.MarcCropL(pckg().iCropToEnd);
sl@0
   751
	return ETrue;
sl@0
   752
	}
sl@0
   753
sl@0
   754
TBool CMMFAudioRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
sl@0
   755
	{
sl@0
   756
	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0
   757
	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0
   758
	User::LeaveIfError(bufSize); 
sl@0
   759
	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0
   760
	TPtr8 ptr = buf->Des();
sl@0
   761
	aMessage.ReadData1FromClientL(ptr);
sl@0
   762
	RDesReadStream stream;
sl@0
   763
	stream.Open(ptr);
sl@0
   764
	CleanupClosePushL(stream);
sl@0
   765
	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0
   766
	CleanupStack::PushL(metaData);
sl@0
   767
	metaData->InternalizeL(stream);
sl@0
   768
	iImplementor.MarcAddMetaDataEntryL(*metaData);
sl@0
   769
	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0
   770
	return ETrue;
sl@0
   771
	}
sl@0
   772
sl@0
   773
TBool CMMFAudioRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
sl@0
   774
	{
sl@0
   775
	TPckgBuf<TInt> pckg;
sl@0
   776
	aMessage.ReadData1FromClientL(pckg);
sl@0
   777
	iImplementor.MarcRemoveMetaDataEntryL(pckg());
sl@0
   778
	return ETrue;
sl@0
   779
	}
sl@0
   780
sl@0
   781
TBool CMMFAudioRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
sl@0
   782
	{
sl@0
   783
	// Get new meta data
sl@0
   784
	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0
   785
	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0
   786
	User::LeaveIfError(bufSize); 
sl@0
   787
	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0
   788
	TPtr8 ptr = buf->Des();
sl@0
   789
	aMessage.ReadData1FromClientL(ptr);
sl@0
   790
	RDesReadStream stream;
sl@0
   791
	stream.Open(ptr);
sl@0
   792
	CleanupClosePushL(stream);
sl@0
   793
	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0
   794
	CleanupStack::PushL(metaData);
sl@0
   795
	metaData->InternalizeL(stream);
sl@0
   796
sl@0
   797
	
sl@0
   798
	// Get index to replace
sl@0
   799
	TPckgBuf<TInt> indexPckg;
sl@0
   800
	aMessage.ReadData2FromClientL(indexPckg);
sl@0
   801
	
sl@0
   802
	iImplementor.MarcReplaceMetaDataEntryL(indexPckg(), *metaData);
sl@0
   803
sl@0
   804
	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0
   805
	return ETrue;
sl@0
   806
	}
sl@0
   807
sl@0
   808
sl@0
   809
sl@0
   810
sl@0
   811
sl@0
   812
sl@0
   813
sl@0
   814
sl@0
   815
sl@0
   816
sl@0
   817
sl@0
   818
sl@0
   819
sl@0
   820
sl@0
   821
sl@0
   822
sl@0
   823
sl@0
   824
EXPORT_C RMMFAudioControllerCustomCommands::RMMFAudioControllerCustomCommands(RMMFController& aController) :
sl@0
   825
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioController)
sl@0
   826
	{
sl@0
   827
	}
sl@0
   828
sl@0
   829
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceSampleRate(TUint aSampleRate) const
sl@0
   830
	{
sl@0
   831
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   832
	configPackage().iSampleRate = aSampleRate;
sl@0
   833
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   834
										 EMMFAudioControllerSetSourceSampleRate, 
sl@0
   835
										 configPackage,
sl@0
   836
										 KNullDesC8);
sl@0
   837
	}
sl@0
   838
sl@0
   839
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceNumChannels(TUint aNumChannels) const
sl@0
   840
	{
sl@0
   841
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   842
	configPackage().iChannels = aNumChannels;
sl@0
   843
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   844
										 EMMFAudioControllerSetSourceNumChannels, 
sl@0
   845
										 configPackage,
sl@0
   846
										 KNullDesC8);
sl@0
   847
	}
sl@0
   848
sl@0
   849
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceFormat(TUid aFormatUid) const
sl@0
   850
	{
sl@0
   851
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   852
	configPackage().iFormatUid = aFormatUid;
sl@0
   853
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   854
										 EMMFAudioControllerSetSourceFormat, 
sl@0
   855
										 configPackage,
sl@0
   856
										 KNullDesC8);
sl@0
   857
	}
sl@0
   858
sl@0
   859
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkSampleRate(TUint aSampleRate) const
sl@0
   860
	{
sl@0
   861
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   862
	configPackage().iSampleRate = aSampleRate;
sl@0
   863
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   864
										 EMMFAudioControllerSetSinkSampleRate, 
sl@0
   865
										 configPackage,
sl@0
   866
										 KNullDesC8);
sl@0
   867
	}
sl@0
   868
sl@0
   869
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkNumChannels(TUint aNumChannels) const
sl@0
   870
	{
sl@0
   871
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   872
	configPackage().iChannels = aNumChannels;
sl@0
   873
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   874
										 EMMFAudioControllerSetSinkNumChannels, 
sl@0
   875
										 configPackage,
sl@0
   876
										 KNullDesC8);
sl@0
   877
	}
sl@0
   878
sl@0
   879
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkFormat(TUid aFormatUid) const
sl@0
   880
	{
sl@0
   881
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   882
	configPackage().iFormatUid = aFormatUid;
sl@0
   883
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   884
										 EMMFAudioControllerSetSinkFormat, 
sl@0
   885
										 configPackage,
sl@0
   886
										 KNullDesC8);
sl@0
   887
	}
sl@0
   888
sl@0
   889
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetCodec(TFourCC aSourceDataType, TFourCC aSinkDataType) const
sl@0
   890
	{
sl@0
   891
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   892
	configPackage().iSourceDataTypeCode = aSourceDataType;
sl@0
   893
	configPackage().iSinkDataTypeCode = aSinkDataType;
sl@0
   894
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   895
										 EMMFAudioControllerSetCodec, 
sl@0
   896
										 configPackage,
sl@0
   897
										 KNullDesC8);
sl@0
   898
	}
sl@0
   899
sl@0
   900
sl@0
   901
sl@0
   902
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceBitRate(TUint aRate) const
sl@0
   903
	{
sl@0
   904
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   905
	configPackage().iSampleRate = aRate;
sl@0
   906
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   907
										 EMMFAudioControllerSetSourceBitRate, 
sl@0
   908
										 configPackage,
sl@0
   909
										 KNullDesC8);
sl@0
   910
	}
sl@0
   911
sl@0
   912
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceDataType(TFourCC aDataType) const
sl@0
   913
	{
sl@0
   914
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   915
	configPackage().iSourceDataTypeCode = aDataType;
sl@0
   916
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   917
										 EMMFAudioControllerSetSourceDataType, 
sl@0
   918
										 configPackage,
sl@0
   919
										 KNullDesC8);
sl@0
   920
	}
sl@0
   921
sl@0
   922
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkBitRate(TUint aRate) const
sl@0
   923
	{
sl@0
   924
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   925
	configPackage().iSampleRate = aRate;
sl@0
   926
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   927
										 EMMFAudioControllerSetSinkBitRate, 
sl@0
   928
										 configPackage,
sl@0
   929
										 KNullDesC8);
sl@0
   930
	}
sl@0
   931
sl@0
   932
EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkDataType(TFourCC aDataType) const
sl@0
   933
	{
sl@0
   934
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   935
	configPackage().iSinkDataTypeCode = aDataType;
sl@0
   936
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
   937
										 EMMFAudioControllerSetSinkDataType, 
sl@0
   938
										 configPackage,
sl@0
   939
										 KNullDesC8);
sl@0
   940
	}
sl@0
   941
sl@0
   942
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceSampleRate(TUint& aRate) const
sl@0
   943
	{
sl@0
   944
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   945
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   946
												EMMFAudioControllerGetSourceSampleRate, 
sl@0
   947
												KNullDesC8,
sl@0
   948
												KNullDesC8,
sl@0
   949
												configPackage);
sl@0
   950
	if (!error)
sl@0
   951
		aRate = configPackage().iSampleRate;
sl@0
   952
	return error;
sl@0
   953
	}
sl@0
   954
sl@0
   955
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceBitRate(TUint& aRate) const
sl@0
   956
	{
sl@0
   957
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   958
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   959
												EMMFAudioControllerGetSourceBitRate, 
sl@0
   960
												KNullDesC8,
sl@0
   961
												KNullDesC8,
sl@0
   962
												configPackage);
sl@0
   963
	if (!error)
sl@0
   964
		aRate = configPackage().iSampleRate;
sl@0
   965
	return error;
sl@0
   966
	}
sl@0
   967
sl@0
   968
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceNumChannels(TUint& aNumChannels) const
sl@0
   969
	{
sl@0
   970
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   971
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   972
												EMMFAudioControllerGetSourceNumChannels, 
sl@0
   973
												KNullDesC8,
sl@0
   974
												KNullDesC8,
sl@0
   975
												configPackage);
sl@0
   976
	if (!error)
sl@0
   977
		aNumChannels = configPackage().iChannels;
sl@0
   978
	return error;
sl@0
   979
	}
sl@0
   980
sl@0
   981
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceFormat(TUid& aFormat) const
sl@0
   982
	{
sl@0
   983
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   984
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   985
												EMMFAudioControllerGetSourceFormat, 
sl@0
   986
												KNullDesC8,
sl@0
   987
												KNullDesC8,
sl@0
   988
												configPackage);
sl@0
   989
	if (!error)
sl@0
   990
		aFormat = configPackage().iFormatUid;
sl@0
   991
	return error;
sl@0
   992
	}
sl@0
   993
sl@0
   994
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceDataType(TFourCC& aDataType) const
sl@0
   995
	{
sl@0
   996
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
   997
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
   998
												EMMFAudioControllerGetSourceDataType, 
sl@0
   999
												KNullDesC8,
sl@0
  1000
												KNullDesC8,
sl@0
  1001
												configPackage);
sl@0
  1002
	if (!error)
sl@0
  1003
		aDataType = configPackage().iSourceDataTypeCode;
sl@0
  1004
	return error;
sl@0
  1005
	}
sl@0
  1006
sl@0
  1007
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkSampleRate(TUint& aRate) const
sl@0
  1008
	{
sl@0
  1009
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  1010
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1011
												EMMFAudioControllerGetSinkSampleRate, 
sl@0
  1012
												KNullDesC8,
sl@0
  1013
												KNullDesC8,
sl@0
  1014
												configPackage);
sl@0
  1015
	if (!error)
sl@0
  1016
		aRate = configPackage().iSampleRate;
sl@0
  1017
	return error;
sl@0
  1018
	}
sl@0
  1019
sl@0
  1020
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkBitRate(TUint& aRate) const
sl@0
  1021
	{
sl@0
  1022
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  1023
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1024
												EMMFAudioControllerGetSinkBitRate, 
sl@0
  1025
												KNullDesC8,
sl@0
  1026
												KNullDesC8,
sl@0
  1027
												configPackage);
sl@0
  1028
	if (!error)
sl@0
  1029
		aRate = configPackage().iSampleRate;
sl@0
  1030
	return error;
sl@0
  1031
	}
sl@0
  1032
sl@0
  1033
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkNumChannels(TUint& aNumChannels) const
sl@0
  1034
	{
sl@0
  1035
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  1036
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1037
												EMMFAudioControllerGetSinkNumChannels, 
sl@0
  1038
												KNullDesC8,
sl@0
  1039
												KNullDesC8,
sl@0
  1040
												configPackage);
sl@0
  1041
	if (!error)
sl@0
  1042
		aNumChannels = configPackage().iChannels;
sl@0
  1043
	return error;
sl@0
  1044
	}
sl@0
  1045
sl@0
  1046
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkFormat(TUid& aFormat) const
sl@0
  1047
	{
sl@0
  1048
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  1049
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1050
												EMMFAudioControllerGetSinkFormat, 
sl@0
  1051
												KNullDesC8,
sl@0
  1052
												KNullDesC8,
sl@0
  1053
												configPackage);
sl@0
  1054
	if (!error)
sl@0
  1055
		aFormat = configPackage().iFormatUid;
sl@0
  1056
	return error;
sl@0
  1057
	}
sl@0
  1058
sl@0
  1059
EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkDataType(TFourCC& aDataType) const
sl@0
  1060
	{
sl@0
  1061
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  1062
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1063
												EMMFAudioControllerGetSinkDataType, 
sl@0
  1064
												KNullDesC8,
sl@0
  1065
												KNullDesC8,
sl@0
  1066
												configPackage);
sl@0
  1067
	if (!error)
sl@0
  1068
		aDataType = configPackage().iSinkDataTypeCode;
sl@0
  1069
	return error;
sl@0
  1070
	}
sl@0
  1071
sl@0
  1072
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates) const
sl@0
  1073
	{
sl@0
  1074
	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceSampleRates);
sl@0
  1075
	}
sl@0
  1076
sl@0
  1077
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates) const
sl@0
  1078
	{
sl@0
  1079
	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceBitRates);
sl@0
  1080
	}
sl@0
  1081
sl@0
  1082
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels) const
sl@0
  1083
	{
sl@0
  1084
	DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSourceNumChannels);
sl@0
  1085
	}
sl@0
  1086
sl@0
  1087
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
sl@0
  1088
	{
sl@0
  1089
	DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSourceDataTypes);
sl@0
  1090
	}
sl@0
  1091
sl@0
  1092
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates) const
sl@0
  1093
	{
sl@0
  1094
	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkSampleRates);
sl@0
  1095
	}
sl@0
  1096
sl@0
  1097
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates) const
sl@0
  1098
	{
sl@0
  1099
	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkBitRates);
sl@0
  1100
	}
sl@0
  1101
sl@0
  1102
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels) const
sl@0
  1103
	{
sl@0
  1104
	DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSinkNumChannels);
sl@0
  1105
	}
sl@0
  1106
sl@0
  1107
EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
sl@0
  1108
	{
sl@0
  1109
	DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSinkDataTypes);
sl@0
  1110
	}
sl@0
  1111
sl@0
  1112
sl@0
  1113
sl@0
  1114
void RMMFAudioControllerCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFAudioControllerMessages aIpc) const
sl@0
  1115
	{
sl@0
  1116
	aArray.Reset();
sl@0
  1117
sl@0
  1118
	TPckgBuf<TInt> numberOfElementsPckg;
sl@0
  1119
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1120
													 aIpc, 
sl@0
  1121
													 KNullDesC8,
sl@0
  1122
													 KNullDesC8,
sl@0
  1123
													 numberOfElementsPckg));
sl@0
  1124
sl@0
  1125
	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
sl@0
  1126
	TPtr8 ptr = buf->Des();
sl@0
  1127
sl@0
  1128
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1129
													 EMMFAudioControllerCopyArrayData, 
sl@0
  1130
													 KNullDesC8,
sl@0
  1131
													 KNullDesC8,
sl@0
  1132
													 ptr));
sl@0
  1133
	RDesReadStream stream(ptr);
sl@0
  1134
	CleanupClosePushL(stream);
sl@0
  1135
sl@0
  1136
	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0
  1137
		{
sl@0
  1138
		User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
sl@0
  1139
		}
sl@0
  1140
sl@0
  1141
	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0
  1142
	}
sl@0
  1143
sl@0
  1144
void RMMFAudioControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray, TMMFAudioControllerMessages aIpc) const
sl@0
  1145
	{
sl@0
  1146
	aArray.Reset();
sl@0
  1147
sl@0
  1148
	TPckgBuf<TInt> numberOfElementsPckg;
sl@0
  1149
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1150
													 aIpc, 
sl@0
  1151
													 KNullDesC8,
sl@0
  1152
													 KNullDesC8,
sl@0
  1153
													 numberOfElementsPckg));
sl@0
  1154
sl@0
  1155
	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
sl@0
  1156
	TPtr8 ptr = buf->Des();
sl@0
  1157
sl@0
  1158
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1159
													 EMMFAudioControllerCopyArrayData, 
sl@0
  1160
													 KNullDesC8,
sl@0
  1161
													 KNullDesC8,
sl@0
  1162
													 ptr));
sl@0
  1163
	RDesReadStream stream(ptr);
sl@0
  1164
	CleanupClosePushL(stream);
sl@0
  1165
sl@0
  1166
	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0
  1167
		{
sl@0
  1168
		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
sl@0
  1169
		}
sl@0
  1170
sl@0
  1171
	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0
  1172
	}
sl@0
  1173
sl@0
  1174
sl@0
  1175
sl@0
  1176
sl@0
  1177
sl@0
  1178
sl@0
  1179
sl@0
  1180
sl@0
  1181
sl@0
  1182
sl@0
  1183
sl@0
  1184
sl@0
  1185
sl@0
  1186
sl@0
  1187
EXPORT_C CMMFAudioControllerCustomCommandParser* CMMFAudioControllerCustomCommandParser::NewL(MMMFAudioControllerCustomCommandImplementor& aImplementor)
sl@0
  1188
	{
sl@0
  1189
	return new(ELeave) CMMFAudioControllerCustomCommandParser(aImplementor);
sl@0
  1190
	}
sl@0
  1191
sl@0
  1192
CMMFAudioControllerCustomCommandParser::CMMFAudioControllerCustomCommandParser(MMMFAudioControllerCustomCommandImplementor& aImplementor) :
sl@0
  1193
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioController),
sl@0
  1194
	iImplementor(aImplementor)
sl@0
  1195
	{
sl@0
  1196
	}
sl@0
  1197
sl@0
  1198
EXPORT_C CMMFAudioControllerCustomCommandParser::~CMMFAudioControllerCustomCommandParser()
sl@0
  1199
	{
sl@0
  1200
	delete iDataCopyBuffer;
sl@0
  1201
	}
sl@0
  1202
sl@0
  1203
void CMMFAudioControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  1204
	{
sl@0
  1205
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioController)
sl@0
  1206
		{
sl@0
  1207
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  1208
		if (error)
sl@0
  1209
			aMessage.Complete(error);
sl@0
  1210
		}
sl@0
  1211
	else
sl@0
  1212
		{
sl@0
  1213
		aMessage.Complete(KErrNotSupported);
sl@0
  1214
		}
sl@0
  1215
	}
sl@0
  1216
sl@0
  1217
sl@0
  1218
void CMMFAudioControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  1219
	{
sl@0
  1220
	TBool complete = ETrue;
sl@0
  1221
	switch (aMessage.Function())
sl@0
  1222
		{
sl@0
  1223
	case EMMFAudioControllerSetSourceSampleRate:
sl@0
  1224
		complete = DoSetSourceSampleRateL(aMessage);
sl@0
  1225
		break;
sl@0
  1226
	case EMMFAudioControllerSetSourceBitRate:
sl@0
  1227
		complete = DoSetSourceBitRateL(aMessage);
sl@0
  1228
		break;
sl@0
  1229
	case EMMFAudioControllerSetSourceNumChannels:
sl@0
  1230
		complete = DoSetSourceNumChannelsL(aMessage);
sl@0
  1231
		break;
sl@0
  1232
	case EMMFAudioControllerSetSourceFormat:
sl@0
  1233
		complete = DoSetSourceFormatL(aMessage);
sl@0
  1234
		break;
sl@0
  1235
	case EMMFAudioControllerSetSourceDataType:
sl@0
  1236
		complete = DoSetSourceDataTypeL(aMessage);
sl@0
  1237
		break;
sl@0
  1238
	case EMMFAudioControllerSetSinkSampleRate:
sl@0
  1239
		complete = DoSetSinkSampleRateL(aMessage);
sl@0
  1240
		break;
sl@0
  1241
	case EMMFAudioControllerSetSinkBitRate:
sl@0
  1242
		complete = DoSetSinkBitRateL(aMessage);
sl@0
  1243
		break;
sl@0
  1244
	case EMMFAudioControllerSetSinkNumChannels:
sl@0
  1245
		complete = DoSetSinkNumChannelsL(aMessage);
sl@0
  1246
		break;
sl@0
  1247
	case EMMFAudioControllerSetSinkFormat:
sl@0
  1248
		complete = DoSetSinkFormatL(aMessage);
sl@0
  1249
		break;
sl@0
  1250
	case EMMFAudioControllerSetSinkDataType:
sl@0
  1251
		complete = DoSetSinkDataTypeL(aMessage);
sl@0
  1252
		break;
sl@0
  1253
	case EMMFAudioControllerSetCodec:
sl@0
  1254
		complete = DoSetCodecL(aMessage);
sl@0
  1255
		break;
sl@0
  1256
	case EMMFAudioControllerGetSourceSampleRate:
sl@0
  1257
		complete = DoGetSourceSampleRateL(aMessage);
sl@0
  1258
		break;
sl@0
  1259
	case EMMFAudioControllerGetSourceBitRate:
sl@0
  1260
		complete = DoGetSourceBitRateL(aMessage);
sl@0
  1261
		break;
sl@0
  1262
	case EMMFAudioControllerGetSourceNumChannels:
sl@0
  1263
		complete = DoGetSourceNumChannelsL(aMessage);
sl@0
  1264
		break;
sl@0
  1265
	case EMMFAudioControllerGetSourceFormat:
sl@0
  1266
		complete = DoGetSourceFormatL(aMessage);
sl@0
  1267
		break;
sl@0
  1268
	case EMMFAudioControllerGetSourceDataType:
sl@0
  1269
		complete = DoGetSourceDataTypeL(aMessage);
sl@0
  1270
		break;
sl@0
  1271
	case EMMFAudioControllerGetSinkSampleRate:
sl@0
  1272
		complete = DoGetSinkSampleRateL(aMessage);
sl@0
  1273
		break;
sl@0
  1274
	case EMMFAudioControllerGetSinkBitRate:
sl@0
  1275
		complete = DoGetSinkBitRateL(aMessage);
sl@0
  1276
		break;
sl@0
  1277
	case EMMFAudioControllerGetSinkNumChannels:
sl@0
  1278
		complete = DoGetSinkNumChannelsL(aMessage);
sl@0
  1279
		break;
sl@0
  1280
	case EMMFAudioControllerGetSinkFormat:
sl@0
  1281
		complete = DoGetSinkFormatL(aMessage);
sl@0
  1282
		break;
sl@0
  1283
	case EMMFAudioControllerGetSinkDataType:
sl@0
  1284
		complete = DoGetSinkDataTypeL(aMessage);
sl@0
  1285
		break;
sl@0
  1286
	case EMMFAudioControllerGetSupportedSourceSampleRates:
sl@0
  1287
		complete = DoGetSupportedSourceSampleRatesL(aMessage);
sl@0
  1288
		break;
sl@0
  1289
	case EMMFAudioControllerGetSupportedSourceBitRates:
sl@0
  1290
		complete = DoGetSupportedSourceBitRatesL(aMessage);
sl@0
  1291
		break;
sl@0
  1292
	case EMMFAudioControllerGetSupportedSourceNumChannels:
sl@0
  1293
		complete = DoGetSupportedSourceNumChannelsL(aMessage);
sl@0
  1294
		break;
sl@0
  1295
	case EMMFAudioControllerGetSupportedSourceDataTypes:
sl@0
  1296
		complete = DoGetSupportedSourceDataTypesL(aMessage);
sl@0
  1297
		break;
sl@0
  1298
	case EMMFAudioControllerGetSupportedSinkSampleRates:
sl@0
  1299
		complete = DoGetSupportedSinkSampleRatesL(aMessage);
sl@0
  1300
		break;
sl@0
  1301
	case EMMFAudioControllerGetSupportedSinkBitRates:
sl@0
  1302
		complete = DoGetSupportedSinkBitRatesL(aMessage);
sl@0
  1303
		break;
sl@0
  1304
	case EMMFAudioControllerGetSupportedSinkNumChannels:
sl@0
  1305
		complete = DoGetSupportedSinkNumChannelsL(aMessage);
sl@0
  1306
		break;
sl@0
  1307
	case EMMFAudioControllerGetSupportedSinkDataTypes:
sl@0
  1308
		complete = DoGetSupportedSinkDataTypesL(aMessage);
sl@0
  1309
		break;
sl@0
  1310
	case EMMFAudioControllerCopyArrayData:
sl@0
  1311
		complete = DoCopyArrayDataL(aMessage);
sl@0
  1312
		break;
sl@0
  1313
	default:
sl@0
  1314
		User::Leave(KErrNotSupported);
sl@0
  1315
		break;
sl@0
  1316
		}
sl@0
  1317
	if (complete)
sl@0
  1318
		aMessage.Complete(KErrNone);
sl@0
  1319
	}
sl@0
  1320
sl@0
  1321
TBool CMMFAudioControllerCustomCommandParser::DoSetSourceSampleRateL(TMMFMessage& aMessage)
sl@0
  1322
	{
sl@0
  1323
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1324
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1325
	iImplementor.MacSetSourceSampleRateL(pckg().iSampleRate);
sl@0
  1326
	return ETrue;
sl@0
  1327
	}
sl@0
  1328
sl@0
  1329
TBool CMMFAudioControllerCustomCommandParser::DoSetSourceNumChannelsL(TMMFMessage& aMessage)
sl@0
  1330
	{
sl@0
  1331
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1332
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1333
	iImplementor.MacSetSourceNumChannelsL(pckg().iChannels);
sl@0
  1334
	return ETrue;
sl@0
  1335
	}
sl@0
  1336
sl@0
  1337
TBool CMMFAudioControllerCustomCommandParser::DoSetSourceFormatL(TMMFMessage& aMessage)
sl@0
  1338
	{
sl@0
  1339
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1340
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1341
	iImplementor.MacSetSourceFormatL(pckg().iFormatUid);
sl@0
  1342
	return ETrue;
sl@0
  1343
	}
sl@0
  1344
sl@0
  1345
TBool CMMFAudioControllerCustomCommandParser::DoSetSinkSampleRateL(TMMFMessage& aMessage)
sl@0
  1346
	{
sl@0
  1347
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1348
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1349
	iImplementor.MacSetSinkSampleRateL(pckg().iSampleRate);
sl@0
  1350
	return ETrue;
sl@0
  1351
	}
sl@0
  1352
sl@0
  1353
TBool CMMFAudioControllerCustomCommandParser::DoSetSinkNumChannelsL(TMMFMessage& aMessage)
sl@0
  1354
	{
sl@0
  1355
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1356
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1357
	iImplementor.MacSetSinkNumChannelsL(pckg().iChannels);
sl@0
  1358
	return ETrue;
sl@0
  1359
	}
sl@0
  1360
sl@0
  1361
TBool CMMFAudioControllerCustomCommandParser::DoSetSinkFormatL(TMMFMessage& aMessage)
sl@0
  1362
	{
sl@0
  1363
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1364
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1365
	iImplementor.MacSetSinkFormatL(pckg().iFormatUid);
sl@0
  1366
	return ETrue;
sl@0
  1367
	}
sl@0
  1368
sl@0
  1369
TBool CMMFAudioControllerCustomCommandParser::DoSetCodecL(TMMFMessage& aMessage)
sl@0
  1370
	{
sl@0
  1371
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1372
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1373
	iImplementor.MacSetCodecL(pckg().iSourceDataTypeCode, pckg().iSinkDataTypeCode);
sl@0
  1374
	return ETrue;
sl@0
  1375
	}
sl@0
  1376
sl@0
  1377
sl@0
  1378
TBool CMMFAudioControllerCustomCommandParser::DoSetSourceBitRateL(TMMFMessage& aMessage)
sl@0
  1379
	{
sl@0
  1380
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1381
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1382
	iImplementor.MacSetSourceBitRateL(pckg().iSampleRate);
sl@0
  1383
	return ETrue;
sl@0
  1384
	}
sl@0
  1385
sl@0
  1386
TBool CMMFAudioControllerCustomCommandParser::DoSetSourceDataTypeL(TMMFMessage& aMessage)
sl@0
  1387
	{
sl@0
  1388
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1389
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1390
	iImplementor.MacSetSourceDataTypeL(pckg().iSourceDataTypeCode);
sl@0
  1391
	return ETrue;
sl@0
  1392
	}
sl@0
  1393
sl@0
  1394
TBool CMMFAudioControllerCustomCommandParser::DoSetSinkBitRateL(TMMFMessage& aMessage)
sl@0
  1395
	{
sl@0
  1396
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1397
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1398
	iImplementor.MacSetSinkBitRateL(pckg().iSampleRate);
sl@0
  1399
	return ETrue;
sl@0
  1400
	}
sl@0
  1401
sl@0
  1402
TBool CMMFAudioControllerCustomCommandParser::DoSetSinkDataTypeL(TMMFMessage& aMessage)
sl@0
  1403
	{
sl@0
  1404
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1405
	aMessage.ReadData1FromClientL(pckg);
sl@0
  1406
	iImplementor.MacSetSinkDataTypeL(pckg().iSinkDataTypeCode);
sl@0
  1407
	return ETrue;
sl@0
  1408
	}
sl@0
  1409
sl@0
  1410
TBool CMMFAudioControllerCustomCommandParser::DoGetSourceSampleRateL(TMMFMessage& aMessage)
sl@0
  1411
	{
sl@0
  1412
	TUint rate = 0;
sl@0
  1413
	iImplementor.MacGetSourceSampleRateL(rate);
sl@0
  1414
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1415
	pckg().iSampleRate = rate;
sl@0
  1416
	aMessage.WriteDataToClientL(pckg);
sl@0
  1417
	return ETrue;
sl@0
  1418
	}
sl@0
  1419
sl@0
  1420
TBool CMMFAudioControllerCustomCommandParser::DoGetSourceBitRateL(TMMFMessage& aMessage)
sl@0
  1421
	{
sl@0
  1422
	TUint rate = 0;
sl@0
  1423
	iImplementor.MacGetSourceBitRateL(rate);
sl@0
  1424
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1425
	pckg().iSampleRate = rate;
sl@0
  1426
	aMessage.WriteDataToClientL(pckg);
sl@0
  1427
	return ETrue;
sl@0
  1428
	}
sl@0
  1429
sl@0
  1430
TBool CMMFAudioControllerCustomCommandParser::DoGetSourceNumChannelsL(TMMFMessage& aMessage)
sl@0
  1431
	{
sl@0
  1432
	TUint channels = 0;
sl@0
  1433
	iImplementor.MacGetSourceNumChannelsL(channels);
sl@0
  1434
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1435
	pckg().iChannels = channels;
sl@0
  1436
	aMessage.WriteDataToClientL(pckg);
sl@0
  1437
	return ETrue;
sl@0
  1438
	}
sl@0
  1439
sl@0
  1440
TBool CMMFAudioControllerCustomCommandParser::DoGetSourceFormatL(TMMFMessage& aMessage)
sl@0
  1441
	{
sl@0
  1442
	TUid format;
sl@0
  1443
	iImplementor.MacGetSourceFormatL(format);
sl@0
  1444
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1445
	pckg().iFormatUid = format;
sl@0
  1446
	aMessage.WriteDataToClientL(pckg);
sl@0
  1447
	return ETrue;
sl@0
  1448
	}
sl@0
  1449
sl@0
  1450
TBool CMMFAudioControllerCustomCommandParser::DoGetSourceDataTypeL(TMMFMessage& aMessage)
sl@0
  1451
	{
sl@0
  1452
	TFourCC fourCC;
sl@0
  1453
	iImplementor.MacGetSourceDataTypeL(fourCC);
sl@0
  1454
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1455
	pckg().iSourceDataTypeCode = fourCC;
sl@0
  1456
	aMessage.WriteDataToClientL(pckg);
sl@0
  1457
	return ETrue;
sl@0
  1458
	}
sl@0
  1459
sl@0
  1460
TBool CMMFAudioControllerCustomCommandParser::DoGetSinkSampleRateL(TMMFMessage& aMessage)
sl@0
  1461
	{
sl@0
  1462
	TUint rate = 0;
sl@0
  1463
	iImplementor.MacGetSinkSampleRateL(rate);
sl@0
  1464
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1465
	pckg().iSampleRate = rate;
sl@0
  1466
	aMessage.WriteDataToClientL(pckg);
sl@0
  1467
	return ETrue;
sl@0
  1468
	}
sl@0
  1469
sl@0
  1470
TBool CMMFAudioControllerCustomCommandParser::DoGetSinkBitRateL(TMMFMessage& aMessage)
sl@0
  1471
	{
sl@0
  1472
	TUint rate = 0;
sl@0
  1473
	iImplementor.MacGetSinkBitRateL(rate);
sl@0
  1474
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1475
	pckg().iSampleRate = rate;
sl@0
  1476
	aMessage.WriteDataToClientL(pckg);
sl@0
  1477
	return ETrue;
sl@0
  1478
	}
sl@0
  1479
sl@0
  1480
TBool CMMFAudioControllerCustomCommandParser::DoGetSinkNumChannelsL(TMMFMessage& aMessage)
sl@0
  1481
	{
sl@0
  1482
	TUint channels = 0;
sl@0
  1483
	iImplementor.MacGetSinkNumChannelsL(channels);
sl@0
  1484
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1485
	pckg().iChannels = channels;
sl@0
  1486
	aMessage.WriteDataToClientL(pckg);
sl@0
  1487
	return ETrue;
sl@0
  1488
	}
sl@0
  1489
sl@0
  1490
TBool CMMFAudioControllerCustomCommandParser::DoGetSinkFormatL(TMMFMessage& aMessage)
sl@0
  1491
	{
sl@0
  1492
	TUid format;
sl@0
  1493
	iImplementor.MacGetSinkFormatL(format);
sl@0
  1494
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1495
	pckg().iFormatUid = format;
sl@0
  1496
	aMessage.WriteDataToClientL(pckg);
sl@0
  1497
	return ETrue;
sl@0
  1498
	}
sl@0
  1499
sl@0
  1500
TBool CMMFAudioControllerCustomCommandParser::DoGetSinkDataTypeL(TMMFMessage& aMessage)
sl@0
  1501
	{
sl@0
  1502
	TFourCC fourCC;
sl@0
  1503
	iImplementor.MacGetSinkDataTypeL(fourCC);
sl@0
  1504
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  1505
	pckg().iSinkDataTypeCode = fourCC;
sl@0
  1506
	aMessage.WriteDataToClientL(pckg);
sl@0
  1507
	return ETrue;
sl@0
  1508
	}
sl@0
  1509
sl@0
  1510
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceSampleRatesL(TMMFMessage& aMessage)
sl@0
  1511
	{
sl@0
  1512
	RArray<TUint> rates;
sl@0
  1513
	CleanupClosePushL(rates);
sl@0
  1514
	iImplementor.MacGetSupportedSourceSampleRatesL(rates);
sl@0
  1515
sl@0
  1516
	DoCreateBufFromUintArrayL(rates);
sl@0
  1517
sl@0
  1518
	TPckgBuf<TInt> pckg;
sl@0
  1519
	pckg() = rates.Count();
sl@0
  1520
	aMessage.WriteDataToClientL(pckg);
sl@0
  1521
sl@0
  1522
	CleanupStack::PopAndDestroy();//rates
sl@0
  1523
	return ETrue;
sl@0
  1524
	}
sl@0
  1525
sl@0
  1526
void CMMFAudioControllerCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
sl@0
  1527
	{
sl@0
  1528
	delete iDataCopyBuffer;
sl@0
  1529
	iDataCopyBuffer = NULL;
sl@0
  1530
sl@0
  1531
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  1532
	RBufWriteStream stream;
sl@0
  1533
	stream.Open(*iDataCopyBuffer);
sl@0
  1534
	CleanupClosePushL(stream);
sl@0
  1535
	for (TInt i=0;i<aArray.Count();i++)
sl@0
  1536
		stream.WriteUint32L(aArray[i]);
sl@0
  1537
	CleanupStack::PopAndDestroy();//stream
sl@0
  1538
	}
sl@0
  1539
sl@0
  1540
void CMMFAudioControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
sl@0
  1541
	{
sl@0
  1542
	delete iDataCopyBuffer;
sl@0
  1543
	iDataCopyBuffer = NULL;
sl@0
  1544
sl@0
  1545
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  1546
	RBufWriteStream stream;
sl@0
  1547
	stream.Open(*iDataCopyBuffer);
sl@0
  1548
	CleanupClosePushL(stream);
sl@0
  1549
	for (TInt i=0;i<aArray.Count();i++)
sl@0
  1550
		{
sl@0
  1551
		stream.WriteInt32L(aArray[i].FourCC());
sl@0
  1552
		}
sl@0
  1553
	CleanupStack::PopAndDestroy();//stream
sl@0
  1554
	}
sl@0
  1555
sl@0
  1556
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceBitRatesL(TMMFMessage& aMessage)
sl@0
  1557
	{
sl@0
  1558
	RArray<TUint> rates;
sl@0
  1559
	CleanupClosePushL(rates);
sl@0
  1560
	iImplementor.MacGetSupportedSourceBitRatesL(rates);
sl@0
  1561
sl@0
  1562
	DoCreateBufFromUintArrayL(rates);
sl@0
  1563
sl@0
  1564
	TPckgBuf<TInt> pckg;
sl@0
  1565
	pckg() = rates.Count();
sl@0
  1566
	aMessage.WriteDataToClientL(pckg);
sl@0
  1567
sl@0
  1568
	CleanupStack::PopAndDestroy();//rates
sl@0
  1569
	return ETrue;
sl@0
  1570
	}
sl@0
  1571
sl@0
  1572
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceNumChannelsL(TMMFMessage& aMessage)
sl@0
  1573
	{
sl@0
  1574
	RArray<TUint> array;
sl@0
  1575
	CleanupClosePushL(array);
sl@0
  1576
	iImplementor.MacGetSupportedSourceNumChannelsL(array);
sl@0
  1577
sl@0
  1578
	DoCreateBufFromUintArrayL(array);
sl@0
  1579
sl@0
  1580
	TPckgBuf<TInt> pckg;
sl@0
  1581
	pckg() = array.Count();
sl@0
  1582
	aMessage.WriteDataToClientL(pckg);
sl@0
  1583
sl@0
  1584
	CleanupStack::PopAndDestroy();//array
sl@0
  1585
	return ETrue;
sl@0
  1586
	}
sl@0
  1587
sl@0
  1588
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceDataTypesL(TMMFMessage& aMessage)
sl@0
  1589
	{
sl@0
  1590
	RArray<TFourCC> array;
sl@0
  1591
	CleanupClosePushL(array);
sl@0
  1592
	iImplementor.MacGetSupportedSourceDataTypesL(array);
sl@0
  1593
sl@0
  1594
	DoCreateBufFromFourCCArrayL(array);
sl@0
  1595
sl@0
  1596
	TPckgBuf<TInt> pckg;
sl@0
  1597
	pckg() = array.Count();
sl@0
  1598
	aMessage.WriteDataToClientL(pckg);
sl@0
  1599
sl@0
  1600
	CleanupStack::PopAndDestroy();//array
sl@0
  1601
	return ETrue;
sl@0
  1602
	}
sl@0
  1603
sl@0
  1604
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkSampleRatesL(TMMFMessage& aMessage)
sl@0
  1605
	{
sl@0
  1606
	RArray<TUint> array;
sl@0
  1607
	CleanupClosePushL(array);
sl@0
  1608
	iImplementor.MacGetSupportedSinkSampleRatesL(array);
sl@0
  1609
sl@0
  1610
	DoCreateBufFromUintArrayL(array);
sl@0
  1611
sl@0
  1612
	TPckgBuf<TInt> pckg;
sl@0
  1613
	pckg() = array.Count();
sl@0
  1614
	aMessage.WriteDataToClientL(pckg);
sl@0
  1615
sl@0
  1616
	CleanupStack::PopAndDestroy();//array
sl@0
  1617
	return ETrue;
sl@0
  1618
	}
sl@0
  1619
sl@0
  1620
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkBitRatesL(TMMFMessage& aMessage)
sl@0
  1621
	{
sl@0
  1622
	RArray<TUint> array;
sl@0
  1623
	CleanupClosePushL(array);
sl@0
  1624
	iImplementor.MacGetSupportedSinkBitRatesL(array);
sl@0
  1625
sl@0
  1626
	DoCreateBufFromUintArrayL(array);
sl@0
  1627
sl@0
  1628
	TPckgBuf<TInt> pckg;
sl@0
  1629
	pckg() = array.Count();
sl@0
  1630
	aMessage.WriteDataToClientL(pckg);
sl@0
  1631
sl@0
  1632
	CleanupStack::PopAndDestroy();//array
sl@0
  1633
	return ETrue;
sl@0
  1634
	}
sl@0
  1635
sl@0
  1636
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkNumChannelsL(TMMFMessage& aMessage)
sl@0
  1637
	{
sl@0
  1638
	RArray<TUint> array;
sl@0
  1639
	CleanupClosePushL(array);
sl@0
  1640
	iImplementor.MacGetSupportedSinkNumChannelsL(array);
sl@0
  1641
sl@0
  1642
	DoCreateBufFromUintArrayL(array);
sl@0
  1643
sl@0
  1644
	TPckgBuf<TInt> pckg;
sl@0
  1645
	pckg() = array.Count();
sl@0
  1646
	aMessage.WriteDataToClientL(pckg);
sl@0
  1647
sl@0
  1648
	CleanupStack::PopAndDestroy();//array
sl@0
  1649
	return ETrue;
sl@0
  1650
	}
sl@0
  1651
sl@0
  1652
TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkDataTypesL(TMMFMessage& aMessage)
sl@0
  1653
	{
sl@0
  1654
	RArray<TFourCC> array;
sl@0
  1655
	CleanupClosePushL(array);
sl@0
  1656
	iImplementor.MacGetSupportedSinkDataTypesL(array);
sl@0
  1657
sl@0
  1658
	DoCreateBufFromFourCCArrayL(array);
sl@0
  1659
sl@0
  1660
	TPckgBuf<TInt> pckg;
sl@0
  1661
	pckg() = array.Count();
sl@0
  1662
	aMessage.WriteDataToClientL(pckg);
sl@0
  1663
sl@0
  1664
	CleanupStack::PopAndDestroy();//array
sl@0
  1665
	return ETrue;
sl@0
  1666
	}
sl@0
  1667
sl@0
  1668
TBool CMMFAudioControllerCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0
  1669
	{
sl@0
  1670
	if (!iDataCopyBuffer)
sl@0
  1671
		User::Leave(KErrNotReady);
sl@0
  1672
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
  1673
	return ETrue;
sl@0
  1674
	}
sl@0
  1675
sl@0
  1676
sl@0
  1677
sl@0
  1678
sl@0
  1679
TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyCDesC8ArrayDataL(TMMFMessage& aMessage)
sl@0
  1680
	{
sl@0
  1681
	if (!iDataCopyBuffer)
sl@0
  1682
		User::Leave(KErrNotReady);
sl@0
  1683
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
  1684
	return ETrue;
sl@0
  1685
	}
sl@0
  1686
sl@0
  1687
sl@0
  1688
sl@0
  1689
sl@0
  1690
sl@0
  1691
sl@0
  1692
sl@0
  1693
sl@0
  1694
sl@0
  1695
sl@0
  1696
sl@0
  1697
sl@0
  1698
sl@0
  1699
sl@0
  1700
sl@0
  1701
sl@0
  1702
sl@0
  1703
sl@0
  1704
sl@0
  1705
sl@0
  1706
sl@0
  1707
sl@0
  1708
sl@0
  1709
sl@0
  1710
EXPORT_C RMMFVideoControllerCustomCommands::RMMFVideoControllerCustomCommands(RMMFController& aController) :
sl@0
  1711
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoController)
sl@0
  1712
	{
sl@0
  1713
	}
sl@0
  1714
sl@0
  1715
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetFrameRate(TReal32& aFramesPerSecond) const
sl@0
  1716
	{
sl@0
  1717
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1718
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1719
												EMMFVideoControllerGetFrameRate, 
sl@0
  1720
												KNullDesC8,
sl@0
  1721
												KNullDesC8,
sl@0
  1722
												configPackage);
sl@0
  1723
	if (!error)
sl@0
  1724
		aFramesPerSecond = configPackage().iFramesPerSecond;
sl@0
  1725
	return error;
sl@0
  1726
	}
sl@0
  1727
sl@0
  1728
EXPORT_C TInt RMMFVideoControllerCustomCommands::SetFrameRate(TReal32 aFramesPerSecond) const
sl@0
  1729
	{
sl@0
  1730
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1731
	configPackage().iFramesPerSecond = aFramesPerSecond;
sl@0
  1732
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1733
												EMMFVideoControllerSetFrameRate, 
sl@0
  1734
												configPackage,
sl@0
  1735
												KNullDesC8);
sl@0
  1736
	}
sl@0
  1737
sl@0
  1738
sl@0
  1739
EXPORT_C void RMMFVideoPlayControllerCustomCommands::GetFrame(CFbsBitmap& aBitmap,TRequestStatus& aStatus)
sl@0
  1740
	{
sl@0
  1741
	TInt handle = aBitmap.Handle();
sl@0
  1742
	
sl@0
  1743
	iConfigPackage().iFrameBitmapServerHandle = handle;
sl@0
  1744
	iController.CustomCommandAsync(iDestinationPckg, 
sl@0
  1745
										 EMMFVideoPlayControllerGetFrame, 
sl@0
  1746
										 iConfigPackage,
sl@0
  1747
										 KNullDesC8,
sl@0
  1748
										 aStatus);
sl@0
  1749
	}
sl@0
  1750
sl@0
  1751
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::UpdateDisplayRegion(const TRegion& aRegion) const
sl@0
  1752
	{
sl@0
  1753
	TPckgBuf<TInt> numberOfRectsPckg;
sl@0
  1754
	numberOfRectsPckg() = aRegion.Count();
sl@0
  1755
	const TRect* rects = aRegion.RectangleList();
sl@0
  1756
	TPtrC8 rectMemory(REINTERPRET_CAST(TUint8*,(void*) rects), numberOfRectsPckg() * sizeof(TRect));
sl@0
  1757
sl@0
  1758
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1759
										 EMMFVideoPlayControllerUpdateDisplayRegion, 
sl@0
  1760
										 numberOfRectsPckg,
sl@0
  1761
										 rectMemory);
sl@0
  1762
	}
sl@0
  1763
sl@0
  1764
sl@0
  1765
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::DirectScreenAccessEvent(const TMMFDSAEvent aDSAEvent) const
sl@0
  1766
	{
sl@0
  1767
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1768
	configPackage().iDSAEvent = (TInt)aDSAEvent;
sl@0
  1769
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1770
												EMMFVideoPlayControllerDSAEvent, 
sl@0
  1771
												configPackage,
sl@0
  1772
												KNullDesC8);
sl@0
  1773
	}
sl@0
  1774
	
sl@0
  1775
	
sl@0
  1776
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Play(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
sl@0
  1777
	{
sl@0
  1778
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1779
	configPackage().iStartPosition = aStart;
sl@0
  1780
	configPackage().iEndPosition = aEnd;
sl@0
  1781
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1782
												EMMFVideoPlayControllerPlay, 
sl@0
  1783
												configPackage,
sl@0
  1784
												KNullDesC8);
sl@0
  1785
	}
sl@0
  1786
	
sl@0
  1787
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::RefreshFrame() const
sl@0
  1788
	{
sl@0
  1789
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1790
												EMMFVideoPlayControllerRefreshFrame, 
sl@0
  1791
												KNullDesC8,
sl@0
  1792
												KNullDesC8);
sl@0
  1793
	}
sl@0
  1794
	
sl@0
  1795
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
sl@0
  1796
	{
sl@0
  1797
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1798
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1799
												EMMFVideoPlayControllerGetLoadingProgress, 
sl@0
  1800
												KNullDesC8,
sl@0
  1801
												KNullDesC8,
sl@0
  1802
												configPackage);
sl@0
  1803
	if (!error)
sl@0
  1804
		aPercentageComplete = configPackage().iLoadingCompletePercentage;
sl@0
  1805
	return error;
sl@0
  1806
	}
sl@0
  1807
sl@0
  1808
sl@0
  1809
sl@0
  1810
sl@0
  1811
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoFrameSize(TSize& aVideoFrameSize) const
sl@0
  1812
	{
sl@0
  1813
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1814
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1815
												EMMFVideoControllerGetVideoFrameSize, 
sl@0
  1816
												KNullDesC8,
sl@0
  1817
												KNullDesC8,
sl@0
  1818
												configPackage);
sl@0
  1819
	if (!error)
sl@0
  1820
		aVideoFrameSize = configPackage().iVideoFrameSize;
sl@0
  1821
	return error;
sl@0
  1822
	}
sl@0
  1823
sl@0
  1824
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioBitRate(TInt& aBitRate) const
sl@0
  1825
	{
sl@0
  1826
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1827
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1828
												EMMFVideoControllerGetAudioBitRate, 
sl@0
  1829
												KNullDesC8,
sl@0
  1830
												KNullDesC8,
sl@0
  1831
												configPackage);
sl@0
  1832
	if (!error)
sl@0
  1833
		aBitRate = configPackage().iAudioBitRate;
sl@0
  1834
	return error;
sl@0
  1835
	}
sl@0
  1836
sl@0
  1837
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoBitRate(TInt& aBitRate) const
sl@0
  1838
	{
sl@0
  1839
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1840
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1841
												EMMFVideoControllerGetVideoBitRate, 
sl@0
  1842
												KNullDesC8,
sl@0
  1843
												KNullDesC8,
sl@0
  1844
												configPackage);
sl@0
  1845
	if (!error)
sl@0
  1846
		aBitRate = configPackage().iVideoBitRate;
sl@0
  1847
	return error;
sl@0
  1848
	}
sl@0
  1849
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioCodec(TFourCC& aCodec) const
sl@0
  1850
	{
sl@0
  1851
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1852
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1853
												EMMFVideoControllerGetAudioCodec, 
sl@0
  1854
												KNullDesC8,
sl@0
  1855
												KNullDesC8,
sl@0
  1856
												configPackage);
sl@0
  1857
	if (!error)
sl@0
  1858
		aCodec = configPackage().iAudioCodec;
sl@0
  1859
	return error;
sl@0
  1860
	}
sl@0
  1861
sl@0
  1862
sl@0
  1863
EXPORT_C void Reserved1( void )
sl@0
  1864
	{
sl@0
  1865
	// dummy reserved function to replace GetVideoCodec() which was removed.
sl@0
  1866
	// this should never be called so generate a panic
sl@0
  1867
	Panic( ENoGetVideoCodec );
sl@0
  1868
	}
sl@0
  1869
sl@0
  1870
EXPORT_C void Reserved2( void )
sl@0
  1871
	{
sl@0
  1872
	// dummy reserved function to replace GetSupportedSourceVideoTypes() which was removed.
sl@0
  1873
	// this should never be called so generate a panic
sl@0
  1874
	Panic( ENoGetSourceVideoTypes );
sl@0
  1875
	}
sl@0
  1876
sl@0
  1877
EXPORT_C void Reserved3( void )
sl@0
  1878
	{
sl@0
  1879
	// dummy reserved function to replace GetSupportedSourceAudioTypes() which was removed.
sl@0
  1880
	// this should never be called so generate a panic
sl@0
  1881
	Panic( ENoGetSourceAudioTypes );
sl@0
  1882
	}
sl@0
  1883
sl@0
  1884
sl@0
  1885
EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoMimeType(TDes8& aMimeType) const
sl@0
  1886
	{
sl@0
  1887
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1888
										 EMMFVideoControllerGetVideoMimeType, 
sl@0
  1889
										 KNullDesC8,										 
sl@0
  1890
										 KNullDesC8,
sl@0
  1891
										 aMimeType);
sl@0
  1892
	return err;
sl@0
  1893
	}
sl@0
  1894
sl@0
  1895
sl@0
  1896
void RMMFVideoRecordControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray) const
sl@0
  1897
	{
sl@0
  1898
	aArray.Reset();
sl@0
  1899
sl@0
  1900
	TPckgBuf<TInt> numberOfElementsPckg;
sl@0
  1901
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1902
													 EMMFVideoRecordControllerGetSupportedSinkAudioTypes, 
sl@0
  1903
													 KNullDesC8,
sl@0
  1904
													 KNullDesC8,
sl@0
  1905
													 numberOfElementsPckg));
sl@0
  1906
sl@0
  1907
	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
sl@0
  1908
	TPtr8 ptr = buf->Des();
sl@0
  1909
sl@0
  1910
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1911
													 EMMFVideoRecordControllerCopyFourCCArrayData, 
sl@0
  1912
													 KNullDesC8,
sl@0
  1913
													 KNullDesC8,
sl@0
  1914
													 ptr));
sl@0
  1915
	RDesReadStream stream(ptr);
sl@0
  1916
	CleanupClosePushL(stream);
sl@0
  1917
sl@0
  1918
	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0
  1919
		{
sl@0
  1920
		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
sl@0
  1921
		}
sl@0
  1922
sl@0
  1923
	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0
  1924
	}
sl@0
  1925
sl@0
  1926
sl@0
  1927
void RMMFVideoRecordControllerCustomCommands::DoGetCDesC8ArrayL(CDesC8Array& aArray, TMMFVideoRecordControllerMessages aIpc) const
sl@0
  1928
	{
sl@0
  1929
	aArray.Reset();
sl@0
  1930
sl@0
  1931
	TPckgBuf<TMimeTypeBufferInfo> bufferInfoPckg;
sl@0
  1932
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1933
													 aIpc, 
sl@0
  1934
													 KNullDesC8,
sl@0
  1935
													 KNullDesC8,
sl@0
  1936
													 bufferInfoPckg));
sl@0
  1937
sl@0
  1938
	// allocate a buffer of size dictated by server side
sl@0
  1939
	HBufC8* buf = HBufC8::NewLC(bufferInfoPckg().bufferLen);
sl@0
  1940
	TPtr8 ptr = buf->Des();
sl@0
  1941
sl@0
  1942
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1943
													 EMMFVideoRecordControllerCopyDescriptorArrayData, 
sl@0
  1944
													 KNullDesC8,
sl@0
  1945
													 KNullDesC8,
sl@0
  1946
													 ptr));
sl@0
  1947
	RDesReadStream stream(ptr);
sl@0
  1948
	CleanupClosePushL(stream);
sl@0
  1949
sl@0
  1950
	TInt32 len;
sl@0
  1951
sl@0
  1952
	for (TInt i=0; i < bufferInfoPckg().count; i++)
sl@0
  1953
		{
sl@0
  1954
		User::LeaveIfError(len = stream.ReadInt32L());
sl@0
  1955
sl@0
  1956
		HBufC8* tempDesc = HBufC8::NewLC(len);
sl@0
  1957
		TPtr8 tempPtr = tempDesc->Des();
sl@0
  1958
sl@0
  1959
		stream.ReadL(tempPtr, len);
sl@0
  1960
		aArray.AppendL(tempPtr);
sl@0
  1961
sl@0
  1962
		CleanupStack::PopAndDestroy(tempDesc);
sl@0
  1963
		}
sl@0
  1964
sl@0
  1965
	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0
  1966
sl@0
  1967
	}
sl@0
  1968
sl@0
  1969
sl@0
  1970
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetDisplayWindow(const TRect& aWindowRect,
sl@0
  1971
																	  const TRect& aClipRect) const
sl@0
  1972
	{
sl@0
  1973
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1974
	configPackage().iWindowRect = aWindowRect;
sl@0
  1975
 	configPackage().iClipRect = aClipRect;
sl@0
  1976
sl@0
  1977
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1978
										 EMMFVideoPlayControllerSetDisplayWindow, 
sl@0
  1979
										 configPackage,
sl@0
  1980
										 KNullDesC8);
sl@0
  1981
	}
sl@0
  1982
sl@0
  1983
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
sl@0
  1984
	{
sl@0
  1985
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  1986
 	
sl@0
  1987
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  1988
										 EMMFVideoPlayControllerGetAudioEnabled, 
sl@0
  1989
										 KNullDesC8,
sl@0
  1990
										 KNullDesC8,
sl@0
  1991
										 configPackage);
sl@0
  1992
sl@0
  1993
	if (!err)
sl@0
  1994
		aEnabled = configPackage().iAudioEnabled;
sl@0
  1995
	return err;
sl@0
  1996
	}
sl@0
  1997
sl@0
  1998
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Prepare()
sl@0
  1999
	{
sl@0
  2000
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
  2001
										EMMFVideoPlayControllerPrepare,
sl@0
  2002
										KNullDesC8,
sl@0
  2003
										KNullDesC8);
sl@0
  2004
	}
sl@0
  2005
sl@0
  2006
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetRotation(TVideoRotation aRotation) const
sl@0
  2007
	{
sl@0
  2008
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2009
	configPackage().iVideoRotation = aRotation;
sl@0
  2010
	
sl@0
  2011
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
  2012
										EMMFVideoPlayControllerSetRotation,
sl@0
  2013
										configPackage,
sl@0
  2014
										KNullDesC8);
sl@0
  2015
	}
sl@0
  2016
sl@0
  2017
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetRotation(TVideoRotation& aRotation) const
sl@0
  2018
	{
sl@0
  2019
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2020
 	
sl@0
  2021
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2022
										 EMMFVideoPlayControllerGetRotation, 
sl@0
  2023
										 KNullDesC8,
sl@0
  2024
										 KNullDesC8,
sl@0
  2025
										 configPackage);
sl@0
  2026
sl@0
  2027
	if (!err)
sl@0
  2028
		aRotation = configPackage().iVideoRotation;
sl@0
  2029
	return err;
sl@0
  2030
	}
sl@0
  2031
sl@0
  2032
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetScaleFactor(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering) const
sl@0
  2033
	{
sl@0
  2034
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2035
	configPackage().iWidthScalePercentage = aWidthPercentage;
sl@0
  2036
	configPackage().iHeightScalePercentage = aHeightPercentage;
sl@0
  2037
	configPackage().iAntiAliasFiltering = aAntiAliasFiltering;
sl@0
  2038
	
sl@0
  2039
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
  2040
										EMMFVideoPlayControllerSetScaleFactor,
sl@0
  2041
										configPackage,
sl@0
  2042
										KNullDesC8);
sl@0
  2043
	}
sl@0
  2044
sl@0
  2045
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetScaleFactor(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
sl@0
  2046
	{
sl@0
  2047
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2048
 	
sl@0
  2049
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2050
										 EMMFVideoPlayControllerGetScaleFactor, 
sl@0
  2051
										 KNullDesC8,
sl@0
  2052
										 KNullDesC8,
sl@0
  2053
										 configPackage);
sl@0
  2054
sl@0
  2055
	if (!err)
sl@0
  2056
		{
sl@0
  2057
		aWidthPercentage = configPackage().iWidthScalePercentage;
sl@0
  2058
		aHeightPercentage = configPackage().iHeightScalePercentage;
sl@0
  2059
		aAntiAliasFiltering = configPackage().iAntiAliasFiltering;
sl@0
  2060
		}
sl@0
  2061
	return err;
sl@0
  2062
	}
sl@0
  2063
sl@0
  2064
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetCropRegion(const TRect& aCropRegion) const
sl@0
  2065
	{
sl@0
  2066
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2067
	configPackage().iCropRectangle = aCropRegion;
sl@0
  2068
	
sl@0
  2069
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
  2070
										EMMFVideoPlayControllerSetCropRegion,
sl@0
  2071
										configPackage,
sl@0
  2072
										KNullDesC8);
sl@0
  2073
	}
sl@0
  2074
sl@0
  2075
EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetCropRegion(TRect& aCropRegion) const
sl@0
  2076
	{
sl@0
  2077
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2078
 	
sl@0
  2079
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2080
										 EMMFVideoPlayControllerGetCropRegion, 
sl@0
  2081
										 KNullDesC8,
sl@0
  2082
										 KNullDesC8,
sl@0
  2083
										 configPackage);
sl@0
  2084
sl@0
  2085
	if (!err)
sl@0
  2086
		{
sl@0
  2087
		aCropRegion = configPackage().iCropRectangle;
sl@0
  2088
		}
sl@0
  2089
	return err;
sl@0
  2090
	}
sl@0
  2091
sl@0
  2092
EXPORT_C RMMFVideoRecordControllerCustomCommands::RMMFVideoRecordControllerCustomCommands(RMMFController& aController) :
sl@0
  2093
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecordController)
sl@0
  2094
	{
sl@0
  2095
	}
sl@0
  2096
sl@0
  2097
sl@0
  2098
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFormat(TUid aFormatUid) const
sl@0
  2099
	{
sl@0
  2100
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2101
	configPackage().iFormatUid = aFormatUid;
sl@0
  2102
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2103
										 EMMFVideoRecordControllerSetVideoFormat, 
sl@0
  2104
										 configPackage,
sl@0
  2105
										 KNullDesC8);
sl@0
  2106
	}
sl@0
  2107
sl@0
  2108
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoCodec(const TDesC8& aVideoCodec) const
sl@0
  2109
	{
sl@0
  2110
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2111
										 EMMFVideoRecordControllerSetVideoCodec, 
sl@0
  2112
										 aVideoCodec,
sl@0
  2113
										 KNullDesC8);
sl@0
  2114
	}
sl@0
  2115
sl@0
  2116
sl@0
  2117
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioCodec(TFourCC aAudioCodec) const
sl@0
  2118
	{
sl@0
  2119
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2120
	configPackage().iAudioCodec = aAudioCodec;
sl@0
  2121
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2122
										 EMMFVideoRecordControllerSetAudioCodec, 
sl@0
  2123
										 configPackage,
sl@0
  2124
										 KNullDesC8);
sl@0
  2125
	}
sl@0
  2126
sl@0
  2127
sl@0
  2128
EXPORT_C void RMMFVideoRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry) const
sl@0
  2129
	{
sl@0
  2130
	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0
  2131
	CleanupStack::PushL(buf);
sl@0
  2132
	RBufWriteStream s;
sl@0
  2133
	s.Open(*buf);
sl@0
  2134
	CleanupClosePushL(s);
sl@0
  2135
	aNewEntry.ExternalizeL(s);
sl@0
  2136
	TPtr8 bufData = buf->Ptr(0);
sl@0
  2137
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0
  2138
													 EMMFVideoRecordControllerAddMetaDataEntry,
sl@0
  2139
													 bufData,
sl@0
  2140
													 KNullDesC8));
sl@0
  2141
	CleanupStack::PopAndDestroy(2);//s, buf
sl@0
  2142
	}
sl@0
  2143
sl@0
  2144
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex) const
sl@0
  2145
	{
sl@0
  2146
	TPckgBuf<TInt> pckg(aIndex);
sl@0
  2147
	return iController.CustomCommandSync(iDestinationPckg,
sl@0
  2148
										 EMMFVideoRecordControllerRemoveMetaDataEntry,
sl@0
  2149
										 pckg,
sl@0
  2150
										 KNullDesC8);
sl@0
  2151
	}
sl@0
  2152
sl@0
  2153
EXPORT_C void RMMFVideoRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry) const
sl@0
  2154
	{
sl@0
  2155
	TPckgBuf<TInt> indexPckg(aIndex);
sl@0
  2156
	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0
  2157
	CleanupStack::PushL(buf);
sl@0
  2158
	RBufWriteStream s;
sl@0
  2159
	s.Open(*buf);
sl@0
  2160
	CleanupClosePushL(s);
sl@0
  2161
	aNewEntry.ExternalizeL(s);
sl@0
  2162
	TPtr8 bufData = buf->Ptr(0);
sl@0
  2163
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0
  2164
													 EMMFVideoRecordControllerReplaceMetaDataEntry,
sl@0
  2165
													 bufData,
sl@0
  2166
													 indexPckg));
sl@0
  2167
	CleanupStack::PopAndDestroy(2);//s, buf
sl@0
  2168
	}
sl@0
  2169
sl@0
  2170
sl@0
  2171
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
sl@0
  2172
	{
sl@0
  2173
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2174
	configPackage().iMaxFileSize = aMaxSize;
sl@0
  2175
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2176
										 EMMFVideoRecordControllerSetMaxFileSize, 
sl@0
  2177
										 configPackage,
sl@0
  2178
										 KNullDesC8);
sl@0
  2179
	}
sl@0
  2180
sl@0
  2181
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoBitRate(TInt aRate) const
sl@0
  2182
	{
sl@0
  2183
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2184
 	configPackage().iVideoBitRate = aRate;
sl@0
  2185
sl@0
  2186
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2187
										 EMMFVideoRecordControllerSetVideoBitRate, 
sl@0
  2188
										 configPackage,
sl@0
  2189
										 KNullDesC8);
sl@0
  2190
sl@0
  2191
	}
sl@0
  2192
sl@0
  2193
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioBitRate(TInt aRate) const
sl@0
  2194
	{
sl@0
  2195
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2196
 	configPackage().iAudioBitRate = aRate;
sl@0
  2197
sl@0
  2198
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2199
										 EMMFVideoRecordControllerSetAudioBitRate, 
sl@0
  2200
										 configPackage,
sl@0
  2201
										 KNullDesC8);
sl@0
  2202
	}
sl@0
  2203
sl@0
  2204
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFrameSize(TSize aSize) const
sl@0
  2205
	{
sl@0
  2206
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2207
 	configPackage().iVideoFrameSize = aSize;
sl@0
  2208
sl@0
  2209
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2210
										 EMMFVideoRecordControllerSetVideoFrameSize, 
sl@0
  2211
										 configPackage,
sl@0
  2212
										 KNullDesC8);
sl@0
  2213
	}
sl@0
  2214
sl@0
  2215
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioEnabled(TBool aEnabled) const
sl@0
  2216
	{
sl@0
  2217
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2218
 	configPackage().iAudioEnabled = aEnabled;
sl@0
  2219
sl@0
  2220
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2221
										 EMMFVideoRecordControllerSetAudioEnabled, 
sl@0
  2222
										 configPackage,
sl@0
  2223
										 KNullDesC8);
sl@0
  2224
	}
sl@0
  2225
sl@0
  2226
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::Prepare() const
sl@0
  2227
	{
sl@0
  2228
sl@0
  2229
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2230
										 EMMFVideoRecordControllerPrepare, 
sl@0
  2231
										 KNullDesC8,
sl@0
  2232
										 KNullDesC8);
sl@0
  2233
	}
sl@0
  2234
sl@0
  2235
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetCameraHandle(TInt aCameraHandle) const
sl@0
  2236
	{
sl@0
  2237
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2238
 	configPackage().iCameraHandle = aCameraHandle;
sl@0
  2239
sl@0
  2240
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2241
										 EMMFVideoRecordControllerSetCameraHandle, 
sl@0
  2242
										 configPackage,
sl@0
  2243
										 KNullDesC8);
sl@0
  2244
	}
sl@0
  2245
sl@0
  2246
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
sl@0
  2247
	{
sl@0
  2248
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2249
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2250
												EMMFVideoRecordControllerGetRecordTimeAvailable, 
sl@0
  2251
												KNullDesC8,
sl@0
  2252
												KNullDesC8,
sl@0
  2253
												configPackage);
sl@0
  2254
	if (!error)
sl@0
  2255
		aTime = configPackage().iRecordTimeAvailable;
sl@0
  2256
	return error;
sl@0
  2257
	}
sl@0
  2258
sl@0
  2259
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkVideoTypes(CDesC8Array& aSupportedDataTypes) const
sl@0
  2260
	{
sl@0
  2261
	TInt err;
sl@0
  2262
	TRAP(err, DoGetCDesC8ArrayL(aSupportedDataTypes, EMMFVideoRecordControllerGetSupportedSinkVideoTypes));
sl@0
  2263
	return err;
sl@0
  2264
	}
sl@0
  2265
sl@0
  2266
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkAudioTypes(RArray<TFourCC>& aSupportedDataTypes) const
sl@0
  2267
	{
sl@0
  2268
	TInt err;
sl@0
  2269
	TRAP(err, DoGetFourCCArrayL(aSupportedDataTypes));
sl@0
  2270
	return err;
sl@0
  2271
	}
sl@0
  2272
sl@0
  2273
sl@0
  2274
// New method as part of INC23777.
sl@0
  2275
EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
sl@0
  2276
	{
sl@0
  2277
	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0
  2278
 	
sl@0
  2279
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  2280
										 EMMFVideoRecordControllerGetAudioEnabled, 
sl@0
  2281
										 KNullDesC8,
sl@0
  2282
										 KNullDesC8,
sl@0
  2283
										 configPackage);
sl@0
  2284
sl@0
  2285
	if (!err)
sl@0
  2286
		aEnabled = configPackage().iAudioEnabled;
sl@0
  2287
	return err;
sl@0
  2288
	}
sl@0
  2289
sl@0
  2290
EXPORT_C CMMFVideoControllerCustomCommandParser* CMMFVideoControllerCustomCommandParser::NewL(MMMFVideoControllerCustomCommandImplementor& aImplementor)
sl@0
  2291
	{
sl@0
  2292
	return new(ELeave) CMMFVideoControllerCustomCommandParser(aImplementor);
sl@0
  2293
	}
sl@0
  2294
sl@0
  2295
EXPORT_C CMMFVideoControllerCustomCommandParser::~CMMFVideoControllerCustomCommandParser()
sl@0
  2296
	{
sl@0
  2297
	}
sl@0
  2298
sl@0
  2299
CMMFVideoControllerCustomCommandParser::CMMFVideoControllerCustomCommandParser(MMMFVideoControllerCustomCommandImplementor& aImplementor) :
sl@0
  2300
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoController),
sl@0
  2301
	iImplementor(aImplementor)
sl@0
  2302
	{
sl@0
  2303
	}
sl@0
  2304
sl@0
  2305
void CMMFVideoControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  2306
	{
sl@0
  2307
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoController)
sl@0
  2308
		{
sl@0
  2309
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  2310
		if (error)
sl@0
  2311
			aMessage.Complete(error);
sl@0
  2312
		}
sl@0
  2313
	else
sl@0
  2314
		{
sl@0
  2315
		aMessage.Complete(KErrNotSupported);
sl@0
  2316
		}
sl@0
  2317
	}
sl@0
  2318
sl@0
  2319
void CMMFVideoControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  2320
	{
sl@0
  2321
	TBool complete = ETrue;
sl@0
  2322
	switch (aMessage.Function())
sl@0
  2323
		{
sl@0
  2324
	case EMMFVideoControllerGetAudioBitRate:
sl@0
  2325
		complete = DoGetAudioBitRateL(aMessage);
sl@0
  2326
		break;
sl@0
  2327
	case EMMFVideoControllerGetVideoBitRate:
sl@0
  2328
		complete = DoGetVideoBitRateL(aMessage);
sl@0
  2329
		break;
sl@0
  2330
	case EMMFVideoControllerGetAudioCodec:
sl@0
  2331
		complete = DoGetAudioCodecL(aMessage);
sl@0
  2332
		break;
sl@0
  2333
	case EMMFVideoControllerGetVideoFrameSize:
sl@0
  2334
		complete = DoGetVideoFrameSizeL(aMessage);
sl@0
  2335
		break;
sl@0
  2336
	case EMMFVideoControllerSetFrameRate:
sl@0
  2337
		complete = DoSetFrameRateL(aMessage);
sl@0
  2338
		break;	
sl@0
  2339
	case EMMFVideoControllerGetFrameRate:
sl@0
  2340
		complete = DoGetFrameRateL(aMessage);
sl@0
  2341
		break;
sl@0
  2342
	case EMMFVideoControllerGetVideoMimeType:
sl@0
  2343
		complete = DoGetVideoMimeTypeL(aMessage);
sl@0
  2344
		break;
sl@0
  2345
	default:
sl@0
  2346
		User::Leave(KErrNotSupported);
sl@0
  2347
		break;
sl@0
  2348
		}
sl@0
  2349
	if (complete)
sl@0
  2350
		aMessage.Complete(KErrNone);
sl@0
  2351
	}
sl@0
  2352
sl@0
  2353
TBool CMMFVideoControllerCustomCommandParser::DoGetVideoFrameSizeL(TMMFMessage& aMessage)
sl@0
  2354
	{
sl@0
  2355
	TSize size;
sl@0
  2356
	iImplementor.MvcGetVideoFrameSizeL(size);
sl@0
  2357
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2358
	pckg().iVideoFrameSize = size;
sl@0
  2359
	aMessage.WriteDataToClientL(pckg);
sl@0
  2360
	return ETrue;
sl@0
  2361
	}
sl@0
  2362
sl@0
  2363
TBool CMMFVideoControllerCustomCommandParser::DoGetAudioCodecL(TMMFMessage& aMessage)
sl@0
  2364
	{
sl@0
  2365
	TFourCC audioCodec;
sl@0
  2366
	iImplementor.MvcGetAudioCodecL(audioCodec);
sl@0
  2367
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2368
	pckg().iAudioCodec = audioCodec;
sl@0
  2369
	aMessage.WriteDataToClientL(pckg);
sl@0
  2370
	return ETrue;
sl@0
  2371
	}
sl@0
  2372
sl@0
  2373
TBool CMMFVideoControllerCustomCommandParser::DoGetVideoBitRateL(TMMFMessage& aMessage)
sl@0
  2374
	{
sl@0
  2375
	TInt videoBitRate;
sl@0
  2376
	iImplementor.MvcGetVideoBitRateL(videoBitRate);
sl@0
  2377
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2378
	pckg().iVideoBitRate = videoBitRate;
sl@0
  2379
	aMessage.WriteDataToClientL(pckg);
sl@0
  2380
	return ETrue;
sl@0
  2381
	}
sl@0
  2382
sl@0
  2383
TBool CMMFVideoControllerCustomCommandParser::DoGetAudioBitRateL(TMMFMessage& aMessage)
sl@0
  2384
	{
sl@0
  2385
	TInt audioBitRate;
sl@0
  2386
	iImplementor.MvcGetAudioBitRateL(audioBitRate);
sl@0
  2387
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2388
	pckg().iAudioBitRate = audioBitRate;
sl@0
  2389
	aMessage.WriteDataToClientL(pckg);
sl@0
  2390
	return ETrue;
sl@0
  2391
	}
sl@0
  2392
sl@0
  2393
TBool CMMFVideoControllerCustomCommandParser::DoSetFrameRateL(TMMFMessage& aMessage)
sl@0
  2394
	{
sl@0
  2395
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2396
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2397
	iImplementor.MvcSetFrameRateL(pckg().iFramesPerSecond);
sl@0
  2398
	return ETrue;
sl@0
  2399
	}
sl@0
  2400
sl@0
  2401
TBool CMMFVideoControllerCustomCommandParser::DoGetFrameRateL(TMMFMessage& aMessage)
sl@0
  2402
	{
sl@0
  2403
	TReal32 frameRate = 0;
sl@0
  2404
	iImplementor.MvcGetFrameRateL(frameRate);
sl@0
  2405
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2406
	pckg().iFramesPerSecond = frameRate;
sl@0
  2407
	aMessage.WriteDataToClientL(pckg);
sl@0
  2408
	return ETrue;
sl@0
  2409
	}
sl@0
  2410
sl@0
  2411
TBool CMMFVideoControllerCustomCommandParser::DoGetVideoMimeTypeL(TMMFMessage& aMessage)
sl@0
  2412
	{
sl@0
  2413
	TBuf8<KMaxMimeTypeLength> mimeType;
sl@0
  2414
	iImplementor.MvcGetVideoMimeTypeL(mimeType);
sl@0
  2415
	
sl@0
  2416
	aMessage.WriteDataToClientL(mimeType);
sl@0
  2417
	return ETrue;
sl@0
  2418
	}
sl@0
  2419
sl@0
  2420
sl@0
  2421
TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkAudioTypesL(TMMFMessage& aMessage)
sl@0
  2422
	{
sl@0
  2423
	RArray<TFourCC> array;
sl@0
  2424
	CleanupClosePushL(array);
sl@0
  2425
	iImplementor.MvrcGetSupportedSinkAudioTypesL(array);
sl@0
  2426
sl@0
  2427
	DoCreateBufFromFourCCArrayL(array);
sl@0
  2428
sl@0
  2429
	TPckgBuf<TInt> pckg;
sl@0
  2430
	pckg() = array.Count();
sl@0
  2431
	aMessage.WriteDataToClientL(pckg);
sl@0
  2432
sl@0
  2433
	CleanupStack::PopAndDestroy();//array
sl@0
  2434
	return ETrue;
sl@0
  2435
	}
sl@0
  2436
sl@0
  2437
sl@0
  2438
TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkVideoTypesL(TMMFMessage& aMessage)
sl@0
  2439
	{
sl@0
  2440
	CDesC8ArrayFlat* array = new (ELeave) CDesC8ArrayFlat(KBufMimeTypeGranularity);
sl@0
  2441
	CleanupStack::PushL(array);
sl@0
  2442
sl@0
  2443
	iImplementor.MvrcGetSupportedSinkVideoTypesL(*array);
sl@0
  2444
sl@0
  2445
	TInt32 len = DoCreateBufFromCDesC8ArrayL(*array);
sl@0
  2446
sl@0
  2447
	TPckgBuf<TMimeTypeBufferInfo> pckg;
sl@0
  2448
	pckg().count = array->Count();
sl@0
  2449
	pckg().bufferLen = len;
sl@0
  2450
	
sl@0
  2451
	aMessage.WriteDataToClientL(pckg);
sl@0
  2452
sl@0
  2453
	CleanupStack::PopAndDestroy();//array
sl@0
  2454
	return ETrue;
sl@0
  2455
	}
sl@0
  2456
sl@0
  2457
void CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
sl@0
  2458
	{
sl@0
  2459
	delete iDataCopyBuffer;
sl@0
  2460
	iDataCopyBuffer = NULL;
sl@0
  2461
sl@0
  2462
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  2463
	RBufWriteStream stream;
sl@0
  2464
	stream.Open(*iDataCopyBuffer);
sl@0
  2465
	CleanupClosePushL(stream);
sl@0
  2466
	for (TInt i=0;i<aArray.Count();i++)
sl@0
  2467
		{
sl@0
  2468
		stream.WriteInt32L(aArray[i].FourCC());
sl@0
  2469
		}
sl@0
  2470
	CleanupStack::PopAndDestroy();//stream
sl@0
  2471
	}
sl@0
  2472
sl@0
  2473
TInt32 CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromCDesC8ArrayL(CDesC8Array& aArray)
sl@0
  2474
	{
sl@0
  2475
	TInt32 bufferLen = 0;
sl@0
  2476
	TInt32 len = 0;
sl@0
  2477
sl@0
  2478
	delete iDataCopyBuffer;
sl@0
  2479
	iDataCopyBuffer = NULL;
sl@0
  2480
sl@0
  2481
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  2482
	RBufWriteStream stream;
sl@0
  2483
	stream.Open(*iDataCopyBuffer);
sl@0
  2484
	CleanupClosePushL(stream);
sl@0
  2485
	for (TInt i = 0; i < aArray.Count(); i++)
sl@0
  2486
		{
sl@0
  2487
		len = aArray[i].Length();
sl@0
  2488
		stream.WriteInt32L(len);
sl@0
  2489
		stream.WriteL(aArray[i]);
sl@0
  2490
sl@0
  2491
		bufferLen += (len + sizeof(TInt32));;	// get a cumulative total buffer size
sl@0
  2492
		}
sl@0
  2493
	CleanupStack::PopAndDestroy();//stream
sl@0
  2494
sl@0
  2495
	return bufferLen;
sl@0
  2496
	}
sl@0
  2497
sl@0
  2498
sl@0
  2499
// --------------------------------------------------------------------------------
sl@0
  2500
EXPORT_C RMMFVideoPlayControllerCustomCommands::RMMFVideoPlayControllerCustomCommands(RMMFController& aController) :
sl@0
  2501
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayController)
sl@0
  2502
	{
sl@0
  2503
	}
sl@0
  2504
sl@0
  2505
EXPORT_C CMMFVideoPlayControllerCustomCommandParser* CMMFVideoPlayControllerCustomCommandParser::NewL(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor)
sl@0
  2506
	{
sl@0
  2507
	return new(ELeave) CMMFVideoPlayControllerCustomCommandParser(aImplementor);
sl@0
  2508
	}
sl@0
  2509
sl@0
  2510
EXPORT_C CMMFVideoPlayControllerCustomCommandParser::~CMMFVideoPlayControllerCustomCommandParser()
sl@0
  2511
	{
sl@0
  2512
	delete iVideoFrameMessage;
sl@0
  2513
	}
sl@0
  2514
sl@0
  2515
CMMFVideoPlayControllerCustomCommandParser::CMMFVideoPlayControllerCustomCommandParser(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor) :
sl@0
  2516
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayController),
sl@0
  2517
	iImplementor(aImplementor)
sl@0
  2518
	{
sl@0
  2519
	}
sl@0
  2520
sl@0
  2521
void CMMFVideoPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  2522
	{
sl@0
  2523
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayController)
sl@0
  2524
		{
sl@0
  2525
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  2526
		if (error)
sl@0
  2527
			aMessage.Complete(error);
sl@0
  2528
		}
sl@0
  2529
	else
sl@0
  2530
		{
sl@0
  2531
		aMessage.Complete(KErrNotSupported);
sl@0
  2532
		}
sl@0
  2533
	}
sl@0
  2534
sl@0
  2535
void CMMFVideoPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  2536
	{
sl@0
  2537
	TBool complete = ETrue;
sl@0
  2538
	switch (aMessage.Function())
sl@0
  2539
		{
sl@0
  2540
	case EMMFVideoPlayControllerGetFrame:
sl@0
  2541
		complete = DoGetFrameL(aMessage);
sl@0
  2542
		break;
sl@0
  2543
	case EMMFVideoPlayControllerSetDisplayWindow:
sl@0
  2544
		complete = DoSetDisplayWindowL(aMessage);
sl@0
  2545
		break;
sl@0
  2546
	case EMMFVideoPlayControllerGetAudioEnabled:
sl@0
  2547
		complete = DoGetAudioEnabledL(aMessage);
sl@0
  2548
		break;
sl@0
  2549
	case EMMFVideoPlayControllerUpdateDisplayRegion:
sl@0
  2550
		complete = DoUpdateDisplayRegionL(aMessage);
sl@0
  2551
		break;
sl@0
  2552
	case EMMFVideoPlayControllerDSAEvent:
sl@0
  2553
		complete = DoDirectScreenAccessEventL(aMessage);
sl@0
  2554
		break;
sl@0
  2555
	case EMMFVideoPlayControllerPlay:
sl@0
  2556
		complete = DoPlayL(aMessage);
sl@0
  2557
		break;
sl@0
  2558
	case EMMFVideoPlayControllerRefreshFrame:
sl@0
  2559
		complete = DoRefreshFrameL(aMessage);
sl@0
  2560
		break;
sl@0
  2561
	case EMMFVideoPlayControllerGetLoadingProgress:
sl@0
  2562
		complete = DoGetLoadingProgressL(aMessage);
sl@0
  2563
		break;
sl@0
  2564
	case EMMFVideoPlayControllerPrepare:
sl@0
  2565
		complete = DoPrepareL(aMessage);
sl@0
  2566
		break;
sl@0
  2567
	case EMMFVideoPlayControllerSetRotation:
sl@0
  2568
		complete = DoSetRotationL(aMessage);
sl@0
  2569
		break;
sl@0
  2570
	case EMMFVideoPlayControllerGetRotation:
sl@0
  2571
		complete = DoGetRotationL(aMessage);
sl@0
  2572
		break;
sl@0
  2573
	case EMMFVideoPlayControllerSetScaleFactor:
sl@0
  2574
		complete = DoSetScaleFactorL(aMessage);
sl@0
  2575
		break;
sl@0
  2576
	case EMMFVideoPlayControllerGetScaleFactor:
sl@0
  2577
		complete = DoGetScaleFactorL(aMessage);
sl@0
  2578
		break;
sl@0
  2579
	case EMMFVideoPlayControllerSetCropRegion:
sl@0
  2580
		complete = DoSetCropRegionL(aMessage);
sl@0
  2581
		break;
sl@0
  2582
	case EMMFVideoPlayControllerGetCropRegion:
sl@0
  2583
		complete = DoGetCropRegionL(aMessage);
sl@0
  2584
		break;
sl@0
  2585
sl@0
  2586
	default:
sl@0
  2587
		User::Leave(KErrNotSupported);
sl@0
  2588
		break;
sl@0
  2589
		}
sl@0
  2590
	if (complete)
sl@0
  2591
		aMessage.Complete(KErrNone);
sl@0
  2592
	}
sl@0
  2593
sl@0
  2594
TBool CMMFVideoPlayControllerCustomCommandParser::DoUpdateDisplayRegionL(TMMFMessage& aMessage)
sl@0
  2595
	{
sl@0
  2596
	TPckgBuf<TInt> numberOfRectsPckg;
sl@0
  2597
	aMessage.ReadData1FromClientL(numberOfRectsPckg);
sl@0
  2598
	TUint rectSize = numberOfRectsPckg() * sizeof(TRect);
sl@0
  2599
	TUint8* rectMemory = STATIC_CAST(TUint8*, User::AllocLC(rectSize));
sl@0
  2600
	TPtr8 rectMemoryPtr(rectMemory,rectSize);
sl@0
  2601
	aMessage.ReadData2FromClientL(rectMemoryPtr);
sl@0
  2602
	TRect* rects = REINTERPRET_CAST(TRect*, rectMemory);
sl@0
  2603
	RRegion region(numberOfRectsPckg(), rects);
sl@0
  2604
	CleanupStack::Pop(rectMemory); // rectMemory now owned by region
sl@0
  2605
	CleanupClosePushL(region);
sl@0
  2606
	iImplementor.MvpcUpdateDisplayRegionL(region);
sl@0
  2607
	CleanupStack::PopAndDestroy();//region
sl@0
  2608
sl@0
  2609
	return ETrue;
sl@0
  2610
	}
sl@0
  2611
sl@0
  2612
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
sl@0
  2613
	{
sl@0
  2614
	delete iVideoFrameMessage;
sl@0
  2615
	iVideoFrameMessage = NULL;
sl@0
  2616
sl@0
  2617
	iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
sl@0
  2618
	iImplementor.MvpcGetFrameL(*iVideoFrameMessage);
sl@0
  2619
	return EFalse;
sl@0
  2620
	}
sl@0
  2621
sl@0
  2622
TBool CMMFVideoPlayControllerCustomCommandParser::DoSetDisplayWindowL(TMMFMessage& aMessage)
sl@0
  2623
	{
sl@0
  2624
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2625
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2626
	iImplementor.MvpcSetDisplayWindowL(pckg().iWindowRect, pckg().iClipRect);
sl@0
  2627
	return ETrue;
sl@0
  2628
	}
sl@0
  2629
sl@0
  2630
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
sl@0
  2631
	{
sl@0
  2632
	TBool enabled;
sl@0
  2633
	iImplementor.MvpcGetAudioEnabledL(enabled);
sl@0
  2634
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2635
	pckg().iAudioEnabled = enabled;
sl@0
  2636
	aMessage.WriteDataToClientL(pckg);
sl@0
  2637
	return ETrue;
sl@0
  2638
	}
sl@0
  2639
sl@0
  2640
TBool CMMFVideoPlayControllerCustomCommandParser::DoDirectScreenAccessEventL(TMMFMessage& aMessage)
sl@0
  2641
	{
sl@0
  2642
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2643
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2644
	iImplementor.MvpcDirectScreenAccessEventL((TMMFDSAEvent)pckg().iDSAEvent);
sl@0
  2645
	return ETrue;
sl@0
  2646
	}
sl@0
  2647
	
sl@0
  2648
TBool CMMFVideoPlayControllerCustomCommandParser::DoPlayL(TMMFMessage& aMessage)
sl@0
  2649
	{
sl@0
  2650
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2651
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2652
	iImplementor.MvpcPlayL(pckg().iStartPosition, pckg().iEndPosition);
sl@0
  2653
	return ETrue;
sl@0
  2654
	}
sl@0
  2655
sl@0
  2656
TBool CMMFVideoPlayControllerCustomCommandParser::DoRefreshFrameL(TMMFMessage& /*aMessage*/)
sl@0
  2657
	{
sl@0
  2658
	iImplementor.MvpcRefreshFrameL();
sl@0
  2659
	return ETrue;
sl@0
  2660
	}
sl@0
  2661
	
sl@0
  2662
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
sl@0
  2663
	{
sl@0
  2664
	TInt progress;
sl@0
  2665
	iImplementor.MvpcGetLoadingProgressL(progress);
sl@0
  2666
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2667
	pckg().iLoadingCompletePercentage = progress;
sl@0
  2668
	aMessage.WriteDataToClientL(pckg);
sl@0
  2669
	return ETrue;
sl@0
  2670
	}
sl@0
  2671
sl@0
  2672
TBool CMMFVideoPlayControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
sl@0
  2673
	{
sl@0
  2674
	iImplementor.MvpcPrepare();
sl@0
  2675
	return ETrue;
sl@0
  2676
	}
sl@0
  2677
sl@0
  2678
TBool CMMFVideoPlayControllerCustomCommandParser::DoSetRotationL(TMMFMessage& aMessage)
sl@0
  2679
	{
sl@0
  2680
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2681
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2682
	iImplementor.MvpcSetRotationL(pckg().iVideoRotation);
sl@0
  2683
	return ETrue;
sl@0
  2684
	}
sl@0
  2685
sl@0
  2686
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetRotationL(TMMFMessage& aMessage)
sl@0
  2687
	{
sl@0
  2688
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2689
	iImplementor.MvpcGetRotationL(pckg().iVideoRotation);
sl@0
  2690
	aMessage.WriteDataToClientL(pckg);
sl@0
  2691
	return ETrue;
sl@0
  2692
	}
sl@0
  2693
sl@0
  2694
TBool CMMFVideoPlayControllerCustomCommandParser::DoSetScaleFactorL(TMMFMessage& aMessage)
sl@0
  2695
	{
sl@0
  2696
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2697
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2698
	iImplementor.MvpcSetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
sl@0
  2699
	return ETrue;
sl@0
  2700
	}
sl@0
  2701
sl@0
  2702
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetScaleFactorL(TMMFMessage& aMessage)
sl@0
  2703
	{
sl@0
  2704
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2705
	iImplementor.MvpcGetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
sl@0
  2706
	aMessage.WriteDataToClientL(pckg);
sl@0
  2707
	return ETrue;
sl@0
  2708
	}
sl@0
  2709
sl@0
  2710
TBool CMMFVideoPlayControllerCustomCommandParser::DoSetCropRegionL(TMMFMessage& aMessage)
sl@0
  2711
	{
sl@0
  2712
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2713
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2714
	iImplementor.MvpcSetCropRegionL(pckg().iCropRectangle);
sl@0
  2715
	return ETrue;
sl@0
  2716
	}
sl@0
  2717
sl@0
  2718
TBool CMMFVideoPlayControllerCustomCommandParser::DoGetCropRegionL(TMMFMessage& aMessage)
sl@0
  2719
	{
sl@0
  2720
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2721
	iImplementor.MvpcGetCropRegionL(pckg().iCropRectangle);
sl@0
  2722
	aMessage.WriteDataToClientL(pckg);
sl@0
  2723
	return ETrue;
sl@0
  2724
	}
sl@0
  2725
sl@0
  2726
// --------------------------------------------------------------------------------
sl@0
  2727
EXPORT_C CMMFVideoRecordControllerCustomCommandParser* CMMFVideoRecordControllerCustomCommandParser::NewL(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor)
sl@0
  2728
	{
sl@0
  2729
	return new(ELeave) CMMFVideoRecordControllerCustomCommandParser(aImplementor);
sl@0
  2730
	}
sl@0
  2731
sl@0
  2732
EXPORT_C CMMFVideoRecordControllerCustomCommandParser::~CMMFVideoRecordControllerCustomCommandParser()
sl@0
  2733
	{
sl@0
  2734
	delete iDataCopyBuffer;
sl@0
  2735
	}
sl@0
  2736
sl@0
  2737
CMMFVideoRecordControllerCustomCommandParser::CMMFVideoRecordControllerCustomCommandParser(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor) :
sl@0
  2738
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecordController),
sl@0
  2739
	iImplementor(aImplementor)
sl@0
  2740
	{
sl@0
  2741
	}
sl@0
  2742
sl@0
  2743
void CMMFVideoRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  2744
	{
sl@0
  2745
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecordController)
sl@0
  2746
		{
sl@0
  2747
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  2748
		if (error)
sl@0
  2749
			aMessage.Complete(error);
sl@0
  2750
		}
sl@0
  2751
	else
sl@0
  2752
		{
sl@0
  2753
		aMessage.Complete(KErrNotSupported);
sl@0
  2754
		}
sl@0
  2755
	}
sl@0
  2756
sl@0
  2757
void CMMFVideoRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  2758
	{
sl@0
  2759
	TBool complete = ETrue;
sl@0
  2760
	switch (aMessage.Function())
sl@0
  2761
		{
sl@0
  2762
	case EMMFVideoRecordControllerSetVideoFormat:
sl@0
  2763
		complete = DoSetVideoFormatL(aMessage);
sl@0
  2764
		break;
sl@0
  2765
	case EMMFVideoRecordControllerSetAudioBitRate:
sl@0
  2766
		complete = DoSetAudioBitRateL(aMessage);
sl@0
  2767
		break;
sl@0
  2768
	case EMMFVideoRecordControllerSetVideoBitRate:
sl@0
  2769
		complete = DoSetVideoBitRateL(aMessage);
sl@0
  2770
		break;
sl@0
  2771
	case EMMFVideoRecordControllerSetAudioCodec:
sl@0
  2772
		complete = DoSetAudioCodecL(aMessage);
sl@0
  2773
		break;
sl@0
  2774
	case EMMFVideoRecordControllerSetVideoCodec:
sl@0
  2775
		complete = DoSetVideoCodecL(aMessage);
sl@0
  2776
		break;
sl@0
  2777
	case EMMFVideoRecordControllerAddMetaDataEntry:
sl@0
  2778
		complete = DoAddMetaDataEntryL(aMessage);
sl@0
  2779
		break;
sl@0
  2780
	case EMMFVideoRecordControllerRemoveMetaDataEntry:
sl@0
  2781
		complete = DoRemoveMetaDataEntryL(aMessage);
sl@0
  2782
		break;
sl@0
  2783
	case EMMFVideoRecordControllerReplaceMetaDataEntry:
sl@0
  2784
		complete = DoReplaceMetaDataEntryL(aMessage);
sl@0
  2785
		break;
sl@0
  2786
	case EMMFVideoRecordControllerSetMaxFileSize:
sl@0
  2787
		complete = DoSetMaxFileSizeL(aMessage);
sl@0
  2788
		break;
sl@0
  2789
	case EMMFVideoRecordControllerSetVideoFrameSize:
sl@0
  2790
		complete = DoSetVideoFrameSizeL(aMessage);
sl@0
  2791
		break;
sl@0
  2792
	case EMMFVideoRecordControllerSetAudioEnabled:
sl@0
  2793
		complete = DoSetAudioEnabledL(aMessage);
sl@0
  2794
		break;
sl@0
  2795
	case EMMFVideoRecordControllerPrepare:
sl@0
  2796
		complete = DoPrepareL(aMessage);
sl@0
  2797
		break;
sl@0
  2798
	case EMMFVideoRecordControllerSetCameraHandle:
sl@0
  2799
		complete = DoSetCameraHandleL(aMessage);
sl@0
  2800
		break;
sl@0
  2801
	case EMMFVideoRecordControllerGetRecordTimeAvailable:
sl@0
  2802
		complete = DoGetRecordTimeAvailableL(aMessage);
sl@0
  2803
		break;
sl@0
  2804
	case EMMFVideoRecordControllerGetSupportedSinkAudioTypes:
sl@0
  2805
		complete = DoGetSupportedSinkAudioTypesL(aMessage);
sl@0
  2806
		break;
sl@0
  2807
	case EMMFVideoRecordControllerGetSupportedSinkVideoTypes:
sl@0
  2808
		complete = DoGetSupportedSinkVideoTypesL(aMessage);
sl@0
  2809
		break;
sl@0
  2810
	case EMMFVideoRecordControllerCopyDescriptorArrayData:
sl@0
  2811
		complete = DoCopyCDesC8ArrayDataL(aMessage);
sl@0
  2812
		break;
sl@0
  2813
	case EMMFVideoRecordControllerCopyFourCCArrayData:
sl@0
  2814
		complete = DoCopyFourCCArrayDataL(aMessage);
sl@0
  2815
		break;
sl@0
  2816
	case EMMFVideoRecordControllerGetAudioEnabled:  //INC23777
sl@0
  2817
		complete = DoGetAudioEnabledL(aMessage);
sl@0
  2818
		break;
sl@0
  2819
	default:
sl@0
  2820
		User::Leave(KErrNotSupported);
sl@0
  2821
		break;
sl@0
  2822
		}
sl@0
  2823
	if (complete)
sl@0
  2824
		aMessage.Complete(KErrNone);
sl@0
  2825
	}
sl@0
  2826
sl@0
  2827
sl@0
  2828
sl@0
  2829
sl@0
  2830
sl@0
  2831
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoBitRateL(TMMFMessage& aMessage)
sl@0
  2832
	{
sl@0
  2833
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2834
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2835
	iImplementor.MvrcSetVideoBitRateL(pckg().iVideoBitRate);
sl@0
  2836
	return ETrue;
sl@0
  2837
	}
sl@0
  2838
sl@0
  2839
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioBitRateL(TMMFMessage& aMessage)
sl@0
  2840
	{
sl@0
  2841
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2842
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2843
	iImplementor.MvrcSetAudioBitRateL(pckg().iAudioBitRate);
sl@0
  2844
	return ETrue;
sl@0
  2845
	}
sl@0
  2846
sl@0
  2847
sl@0
  2848
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoCodecL(TMMFMessage& aMessage)
sl@0
  2849
	{
sl@0
  2850
	TBuf8<KMaxMimeTypeLength> buf;
sl@0
  2851
	aMessage.ReadData1FromClientL(buf);
sl@0
  2852
	iImplementor.MvrcSetVideoCodecL(buf);
sl@0
  2853
	return ETrue;
sl@0
  2854
	}
sl@0
  2855
sl@0
  2856
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioCodecL(TMMFMessage& aMessage)
sl@0
  2857
	{
sl@0
  2858
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2859
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2860
	iImplementor.MvrcSetAudioCodecL(pckg().iAudioCodec);
sl@0
  2861
	return ETrue;
sl@0
  2862
	}
sl@0
  2863
sl@0
  2864
sl@0
  2865
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFormatL(TMMFMessage& aMessage)
sl@0
  2866
	{
sl@0
  2867
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2868
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2869
	iImplementor.MvrcSetVideoFormatL(pckg().iFormatUid);
sl@0
  2870
	return ETrue;
sl@0
  2871
	}
sl@0
  2872
sl@0
  2873
sl@0
  2874
sl@0
  2875
sl@0
  2876
TBool CMMFVideoRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
sl@0
  2877
	{
sl@0
  2878
	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0
  2879
	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0
  2880
	User::LeaveIfError(bufSize); 
sl@0
  2881
	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0
  2882
	TPtr8 ptr = buf->Des();
sl@0
  2883
	aMessage.ReadData1FromClientL(ptr);
sl@0
  2884
	RDesReadStream stream;
sl@0
  2885
	stream.Open(ptr);
sl@0
  2886
	CleanupClosePushL(stream);
sl@0
  2887
	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0
  2888
	CleanupStack::PushL(metaData);
sl@0
  2889
	metaData->InternalizeL(stream);
sl@0
  2890
	iImplementor.MvrcAddMetaDataEntryL(*metaData);
sl@0
  2891
	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0
  2892
	return ETrue;
sl@0
  2893
	}
sl@0
  2894
sl@0
  2895
TBool CMMFVideoRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
sl@0
  2896
	{
sl@0
  2897
	TPckgBuf<TInt> pckg;
sl@0
  2898
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2899
	iImplementor.MvrcRemoveMetaDataEntryL(pckg());
sl@0
  2900
	return ETrue;
sl@0
  2901
	}
sl@0
  2902
sl@0
  2903
TBool CMMFVideoRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
sl@0
  2904
	{
sl@0
  2905
	// Get new meta data
sl@0
  2906
	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0
  2907
	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0
  2908
	User::LeaveIfError(bufSize); 
sl@0
  2909
	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0
  2910
	TPtr8 ptr = buf->Des();
sl@0
  2911
	aMessage.ReadData1FromClientL(ptr);
sl@0
  2912
	RDesReadStream stream;
sl@0
  2913
	stream.Open(ptr);
sl@0
  2914
	CleanupClosePushL(stream);
sl@0
  2915
	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0
  2916
	CleanupStack::PushL(metaData);
sl@0
  2917
	metaData->InternalizeL(stream);
sl@0
  2918
sl@0
  2919
	// Get index to replace
sl@0
  2920
	TPckgBuf<TInt> indexPckg;
sl@0
  2921
	aMessage.ReadData2FromClientL(indexPckg);
sl@0
  2922
	
sl@0
  2923
	iImplementor.MvrcReplaceMetaDataEntryL(indexPckg(), *metaData);
sl@0
  2924
sl@0
  2925
	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0
  2926
	return ETrue;
sl@0
  2927
	}
sl@0
  2928
sl@0
  2929
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
sl@0
  2930
	{
sl@0
  2931
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2932
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2933
	iImplementor.MvrcSetMaxFileSizeL(pckg().iMaxFileSize);
sl@0
  2934
	return ETrue;
sl@0
  2935
	}
sl@0
  2936
sl@0
  2937
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFrameSizeL(TMMFMessage& aMessage)
sl@0
  2938
	{
sl@0
  2939
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2940
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2941
	iImplementor.MvrcSetVideoFrameSizeL(pckg().iVideoFrameSize);
sl@0
  2942
	return ETrue;
sl@0
  2943
	}
sl@0
  2944
sl@0
  2945
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
sl@0
  2946
	{
sl@0
  2947
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2948
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2949
	iImplementor.MvrcSetAudioEnabledL(pckg().iAudioEnabled);
sl@0
  2950
	return ETrue;
sl@0
  2951
	}
sl@0
  2952
sl@0
  2953
TBool CMMFVideoRecordControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
sl@0
  2954
	{
sl@0
  2955
	iImplementor.MvrcPrepareL();
sl@0
  2956
	return ETrue;
sl@0
  2957
	}
sl@0
  2958
sl@0
  2959
TBool CMMFVideoRecordControllerCustomCommandParser::DoSetCameraHandleL(TMMFMessage& aMessage)
sl@0
  2960
	{
sl@0
  2961
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2962
	aMessage.ReadData1FromClientL(pckg);
sl@0
  2963
	iImplementor.MvrcSetCameraHandleL(pckg().iCameraHandle);
sl@0
  2964
	return ETrue;
sl@0
  2965
	}
sl@0
  2966
sl@0
  2967
TBool CMMFVideoRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
sl@0
  2968
	{
sl@0
  2969
	TTimeIntervalMicroSeconds time;
sl@0
  2970
	iImplementor.MvrcGetRecordTimeAvailableL(time);
sl@0
  2971
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2972
	pckg().iRecordTimeAvailable = time;
sl@0
  2973
	aMessage.WriteDataToClientL(pckg);
sl@0
  2974
	return ETrue;
sl@0
  2975
	}
sl@0
  2976
sl@0
  2977
TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyFourCCArrayDataL(TMMFMessage& aMessage)
sl@0
  2978
	{
sl@0
  2979
	if (!iDataCopyBuffer)
sl@0
  2980
		User::Leave(KErrNotReady);
sl@0
  2981
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
  2982
	return ETrue;
sl@0
  2983
	}
sl@0
  2984
sl@0
  2985
//INC23777
sl@0
  2986
TBool CMMFVideoRecordControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
sl@0
  2987
	{
sl@0
  2988
	TBool enabled;
sl@0
  2989
	iImplementor.MvrcGetAudioEnabledL(enabled);
sl@0
  2990
	TPckgBuf<TMMFVideoConfig> pckg;
sl@0
  2991
	pckg().iAudioEnabled = enabled;
sl@0
  2992
	aMessage.WriteDataToClientL(pckg);
sl@0
  2993
	return ETrue;
sl@0
  2994
	}
sl@0
  2995
sl@0
  2996
//--------------------------------------------------------------------------------------
sl@0
  2997
EXPORT_C CMMFVideoDRMExtCustomCommandParser* CMMFVideoDRMExtCustomCommandParser::NewL(MMMFVideoDRMExtCustomCommandImplementor& aImplementor)
sl@0
  2998
	{
sl@0
  2999
	return new(ELeave) CMMFVideoDRMExtCustomCommandParser(aImplementor);
sl@0
  3000
	}
sl@0
  3001
sl@0
  3002
EXPORT_C CMMFVideoDRMExtCustomCommandParser::~CMMFVideoDRMExtCustomCommandParser()
sl@0
  3003
	{
sl@0
  3004
	delete iVideoFrameMessage;
sl@0
  3005
	}
sl@0
  3006
sl@0
  3007
CMMFVideoDRMExtCustomCommandParser::CMMFVideoDRMExtCustomCommandParser(MMMFVideoDRMExtCustomCommandImplementor& aImplementor) :
sl@0
  3008
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoDRMExt),
sl@0
  3009
	iImplementor(aImplementor)
sl@0
  3010
	{
sl@0
  3011
	}
sl@0
  3012
sl@0
  3013
void CMMFVideoDRMExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3014
	{
sl@0
  3015
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoDRMExt)
sl@0
  3016
		{
sl@0
  3017
		switch (aMessage.Function())
sl@0
  3018
			{
sl@0
  3019
		case EMMFVideoDRMExtGetFrame:
sl@0
  3020
			TRAPD(err, DoGetFrameL(aMessage));
sl@0
  3021
			if (err!=KErrNone) // asynchronous, so only complete message if error occurred
sl@0
  3022
				aMessage.Complete(err);
sl@0
  3023
			break;
sl@0
  3024
		default:
sl@0
  3025
			aMessage.Complete(KErrNotSupported);
sl@0
  3026
			break;
sl@0
  3027
			}
sl@0
  3028
		}
sl@0
  3029
	else
sl@0
  3030
		{
sl@0
  3031
		aMessage.Complete(KErrNotSupported);
sl@0
  3032
		}
sl@0
  3033
	}
sl@0
  3034
sl@0
  3035
void CMMFVideoDRMExtCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
sl@0
  3036
	{
sl@0
  3037
	delete iVideoFrameMessage;
sl@0
  3038
	iVideoFrameMessage = NULL;
sl@0
  3039
sl@0
  3040
	iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
sl@0
  3041
	TPckgBuf<ContentAccess::TIntent> intentPckg;
sl@0
  3042
	aMessage.ReadData2FromClientL(intentPckg);
sl@0
  3043
	iImplementor.MvdeGetFrameL(*iVideoFrameMessage, intentPckg());
sl@0
  3044
	}
sl@0
  3045
sl@0
  3046
EXPORT_C RMMFVideoDRMExtCustomCommands::RMMFVideoDRMExtCustomCommands(RMMFController& aController) :
sl@0
  3047
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoDRMExt)
sl@0
  3048
	{
sl@0
  3049
	}
sl@0
  3050
sl@0
  3051
EXPORT_C void RMMFVideoDRMExtCustomCommands::GetFrame(CFbsBitmap& aBitmap, ContentAccess::TIntent aIntent, TRequestStatus& aStatus)
sl@0
  3052
	{
sl@0
  3053
	iConfigPackage().iFrameBitmapServerHandle = aBitmap.Handle();
sl@0
  3054
	iIntentPackage() = aIntent;
sl@0
  3055
	iController.CustomCommandAsync(iDestinationPckg, 
sl@0
  3056
								   EMMFVideoDRMExtGetFrame, 
sl@0
  3057
								   iConfigPackage,
sl@0
  3058
								   iIntentPackage,
sl@0
  3059
								   aStatus);
sl@0
  3060
	}
sl@0
  3061
sl@0
  3062
//------------------------------------------------------------------------------
sl@0
  3063
EXPORT_C RMMFResourceNotificationCustomCommands::RMMFResourceNotificationCustomCommands(RMMFController& aController) : 
sl@0
  3064
RMMFCustomCommandsBase(aController,KMMFEventCategoryAudioResourceAvailable)
sl@0
  3065
	{
sl@0
  3066
	}
sl@0
  3067
sl@0
  3068
EXPORT_C TInt RMMFResourceNotificationCustomCommands::RegisterAsClient(TUid aEventType,const TDesC8& aNotificationRegistrationData)
sl@0
  3069
	{
sl@0
  3070
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  3071
	configPackage().iEventType = aEventType;
sl@0
  3072
	configPackage().iNotificationRegistrationData = aNotificationRegistrationData;
sl@0
  3073
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3074
										EMMFAudioResourceRegisterNotification, 
sl@0
  3075
										configPackage,
sl@0
  3076
										KNullDesC8);
sl@0
  3077
	}
sl@0
  3078
	
sl@0
  3079
EXPORT_C TInt RMMFResourceNotificationCustomCommands::CancelRegisterAsClient(TUid aEventType)
sl@0
  3080
	{
sl@0
  3081
 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  3082
 	configPackage().iEventType = aEventType;
sl@0
  3083
 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3084
										EMMFAudioResourceCancelRegisterNotification, 
sl@0
  3085
										configPackage,
sl@0
  3086
										KNullDesC8);
sl@0
  3087
sl@0
  3088
	}
sl@0
  3089
sl@0
  3090
EXPORT_C TInt RMMFResourceNotificationCustomCommands::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
sl@0
  3091
	{	
sl@0
  3092
	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0
  3093
 	configPackage().iEventType = aEventType;
sl@0
  3094
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3095
										EMMFAudioResourceGetNotificationData, 
sl@0
  3096
										configPackage,
sl@0
  3097
										KNullDesC8,
sl@0
  3098
										aNotificationData);
sl@0
  3099
	}
sl@0
  3100
sl@0
  3101
EXPORT_C TInt RMMFResourceNotificationCustomCommands::WillResumePlay()
sl@0
  3102
	{	
sl@0
  3103
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3104
										EMMFAudioResourceWillResumePlay, 
sl@0
  3105
										KNullDesC8,
sl@0
  3106
										KNullDesC8);	 
sl@0
  3107
	}
sl@0
  3108
sl@0
  3109
EXPORT_C CMMFResourceNotificationCustomCommandParser* CMMFResourceNotificationCustomCommandParser::NewL(MMMFResourceNotificationCustomCommandImplementor& aImplementor)
sl@0
  3110
	{
sl@0
  3111
	return new(ELeave) CMMFResourceNotificationCustomCommandParser(aImplementor);
sl@0
  3112
	}
sl@0
  3113
sl@0
  3114
EXPORT_C CMMFResourceNotificationCustomCommandParser::~CMMFResourceNotificationCustomCommandParser()
sl@0
  3115
	{
sl@0
  3116
	}
sl@0
  3117
sl@0
  3118
CMMFResourceNotificationCustomCommandParser::CMMFResourceNotificationCustomCommandParser( MMMFResourceNotificationCustomCommandImplementor& aImplementor) :
sl@0
  3119
	CMMFCustomCommandParserBase(KMMFEventCategoryAudioResourceAvailable),
sl@0
  3120
	iImplementor(aImplementor)
sl@0
  3121
	{
sl@0
  3122
	}
sl@0
  3123
sl@0
  3124
void CMMFResourceNotificationCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3125
	{
sl@0
  3126
	if (aMessage.Destination().InterfaceId() == KMMFEventCategoryAudioResourceAvailable)
sl@0
  3127
		{
sl@0
  3128
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  3129
		if (error)
sl@0
  3130
			{
sl@0
  3131
			aMessage.Complete(error);	
sl@0
  3132
			}
sl@0
  3133
		}
sl@0
  3134
	else
sl@0
  3135
		{
sl@0
  3136
		aMessage.Complete(KErrNotSupported);
sl@0
  3137
		}
sl@0
  3138
	}
sl@0
  3139
sl@0
  3140
void CMMFResourceNotificationCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  3141
	{
sl@0
  3142
	TBool complete = ETrue;
sl@0
  3143
	switch (aMessage.Function())
sl@0
  3144
		{
sl@0
  3145
	case EMMFAudioResourceRegisterNotification:
sl@0
  3146
		complete = DoRegisterAsClientL(aMessage);
sl@0
  3147
		break;
sl@0
  3148
	case EMMFAudioResourceCancelRegisterNotification:
sl@0
  3149
		complete = DoCancelRegisterAsClientL(aMessage);
sl@0
  3150
		break;
sl@0
  3151
	case EMMFAudioResourceGetNotificationData:
sl@0
  3152
		complete = DoGetResourceNotificationDataL(aMessage);
sl@0
  3153
		break;
sl@0
  3154
	case EMMFAudioResourceWillResumePlay:
sl@0
  3155
		complete = DoWillResumePlayL(aMessage);
sl@0
  3156
		break;
sl@0
  3157
	default:
sl@0
  3158
		User::Leave(KErrNotSupported);
sl@0
  3159
		break;
sl@0
  3160
		}
sl@0
  3161
	if (complete)
sl@0
  3162
		{
sl@0
  3163
		aMessage.Complete(KErrNone);	
sl@0
  3164
		}
sl@0
  3165
	}
sl@0
  3166
sl@0
  3167
EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoRegisterAsClientL(TMMFMessage& aMessage)
sl@0
  3168
	{
sl@0
  3169
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  3170
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3171
	iImplementor.MarnRegisterAsClientL(pckg().iEventType, pckg().iNotificationRegistrationData);
sl@0
  3172
	return ETrue;
sl@0
  3173
	}
sl@0
  3174
	
sl@0
  3175
EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoCancelRegisterAsClientL(TMMFMessage& aMessage)
sl@0
  3176
	{
sl@0
  3177
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  3178
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3179
	iImplementor.MarnCancelRegisterAsClientL(pckg().iEventType);
sl@0
  3180
	return ETrue;
sl@0
  3181
	}
sl@0
  3182
	
sl@0
  3183
EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoGetResourceNotificationDataL(TMMFMessage& aMessage)
sl@0
  3184
	{
sl@0
  3185
	TPckgBuf<TMMFAudioConfig> pckg;
sl@0
  3186
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3187
	iImplementor.MarnGetResourceNotificationDataL(pckg().iEventType, pckg().iNotificationData);
sl@0
  3188
	TPtrC8 tmp(pckg().iNotificationData);
sl@0
  3189
	aMessage.WriteDataToClientL(pckg().iNotificationData);
sl@0
  3190
	return ETrue;
sl@0
  3191
	}
sl@0
  3192
sl@0
  3193
EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoWillResumePlayL(TMMFMessage& aMessage)
sl@0
  3194
	{
sl@0
  3195
	iImplementor.MarnWillResumePlayL();
sl@0
  3196
	aMessage.Complete(KErrNone);
sl@0
  3197
	return EFalse;
sl@0
  3198
	}
sl@0
  3199
sl@0
  3200
EXPORT_C RMMFVideoSetInitScreenCustomCommands::RMMFVideoSetInitScreenCustomCommands(RMMFController& aController) :
sl@0
  3201
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoSetInitScreen)
sl@0
  3202
	{
sl@0
  3203
	}
sl@0
  3204
sl@0
  3205
EXPORT_C TInt RMMFVideoSetInitScreenCustomCommands::SetInitScreenNumber(TInt aScreenNumber)
sl@0
  3206
	{
sl@0
  3207
	TPckgBuf<TInt> configPackage;
sl@0
  3208
	configPackage() = aScreenNumber;
sl@0
  3209
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3210
										 EMMFVideoSetInitScreenNumber,
sl@0
  3211
										 configPackage,
sl@0
  3212
										 KNullDesC8);
sl@0
  3213
	}
sl@0
  3214
		
sl@0
  3215
EXPORT_C CMMFVideoSetInitScreenCustomCommandParser* CMMFVideoSetInitScreenCustomCommandParser::NewL(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor)
sl@0
  3216
	{
sl@0
  3217
	return new(ELeave) CMMFVideoSetInitScreenCustomCommandParser(aImplementor);
sl@0
  3218
	}
sl@0
  3219
sl@0
  3220
EXPORT_C CMMFVideoSetInitScreenCustomCommandParser::~CMMFVideoSetInitScreenCustomCommandParser()
sl@0
  3221
	{
sl@0
  3222
	}
sl@0
  3223
sl@0
  3224
CMMFVideoSetInitScreenCustomCommandParser::CMMFVideoSetInitScreenCustomCommandParser(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor) :
sl@0
  3225
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoSetInitScreen),
sl@0
  3226
	iImplementor(aImplementor)
sl@0
  3227
	{
sl@0
  3228
	}
sl@0
  3229
sl@0
  3230
void CMMFVideoSetInitScreenCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3231
	{
sl@0
  3232
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoSetInitScreen)
sl@0
  3233
		{
sl@0
  3234
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  3235
		if (error)
sl@0
  3236
			{
sl@0
  3237
			aMessage.Complete(error);	
sl@0
  3238
			}
sl@0
  3239
		}
sl@0
  3240
	else
sl@0
  3241
		{
sl@0
  3242
		aMessage.Complete(KErrNotSupported);
sl@0
  3243
		}
sl@0
  3244
	}
sl@0
  3245
	
sl@0
  3246
void CMMFVideoSetInitScreenCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  3247
	{
sl@0
  3248
	TBool complete = ETrue;
sl@0
  3249
	switch (aMessage.Function())
sl@0
  3250
		{
sl@0
  3251
	case EMMFVideoSetInitScreenNumber:
sl@0
  3252
		complete = DoSetInitScreenNumberL(aMessage);
sl@0
  3253
		break;
sl@0
  3254
	default:
sl@0
  3255
		User::Leave(KErrNotSupported);
sl@0
  3256
		break;
sl@0
  3257
		}
sl@0
  3258
	if (complete)
sl@0
  3259
		{
sl@0
  3260
		aMessage.Complete(KErrNone);	
sl@0
  3261
		}
sl@0
  3262
	}
sl@0
  3263
sl@0
  3264
TBool CMMFVideoSetInitScreenCustomCommandParser::DoSetInitScreenNumberL(TMMFMessage& aMessage)
sl@0
  3265
	{
sl@0
  3266
	TPckgBuf<TInt> pckg;
sl@0
  3267
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3268
	iImplementor.MvsdSetInitScreenNumber(pckg());
sl@0
  3269
	return ETrue;
sl@0
  3270
	}
sl@0
  3271
sl@0
  3272
_LIT(KMMFStandardCustomCommandsPanicCategory, "MMFStandardCustomCommands");
sl@0
  3273
GLDEF_C void Panic(TMmfSCCPanic aError)
sl@0
  3274
	{
sl@0
  3275
	User::Panic(KMMFStandardCustomCommandsPanicCategory, aError);
sl@0
  3276
	}
sl@0
  3277
sl@0
  3278
sl@0
  3279
EXPORT_C RMMFVideoPixelAspectRatioCustomCommands::RMMFVideoPixelAspectRatioCustomCommands(RMMFController& aController) :
sl@0
  3280
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPixelAspectRatio)
sl@0
  3281
	{
sl@0
  3282
	}
sl@0
  3283
sl@0
  3284
EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::SetPixelAspectRatio(const TVideoAspectRatio& aAspectRatio)
sl@0
  3285
	{
sl@0
  3286
	TPckgBuf<TVideoAspectRatio> configPackage;
sl@0
  3287
	configPackage() = aAspectRatio;
sl@0
  3288
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3289
										 EMMFVideoSetPixelAspectRatio,
sl@0
  3290
										 configPackage,
sl@0
  3291
										 KNullDesC8);
sl@0
  3292
	}
sl@0
  3293
sl@0
  3294
EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::GetPixelAspectRatio(TVideoAspectRatio& aAspectRatio) const
sl@0
  3295
	{
sl@0
  3296
	TPckgBuf<TVideoAspectRatio> configPackage;
sl@0
  3297
 	
sl@0
  3298
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3299
										 EMMFVideoGetPixelAspectRatio, 
sl@0
  3300
										 KNullDesC8,
sl@0
  3301
										 KNullDesC8,
sl@0
  3302
										 configPackage);
sl@0
  3303
sl@0
  3304
	if (!err)
sl@0
  3305
		{
sl@0
  3306
		aAspectRatio = configPackage();
sl@0
  3307
		}		
sl@0
  3308
	return err;
sl@0
  3309
	}
sl@0
  3310
sl@0
  3311
EXPORT_C void RMMFVideoPixelAspectRatioCustomCommands::GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const
sl@0
  3312
	{
sl@0
  3313
	DoGetVideoPixelAspectRatioArrayL(aAspectRatios, EMMFVideoGetSupportedPixelAspectRatios);
sl@0
  3314
	}
sl@0
  3315
sl@0
  3316
void RMMFVideoPixelAspectRatioCustomCommands::DoGetVideoPixelAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray, TMMFVideoPixelAspectRatioMessages aIpc) const
sl@0
  3317
	{
sl@0
  3318
	aArray.Reset();
sl@0
  3319
sl@0
  3320
	TPckgBuf<TInt> numberOfElementsPckg;
sl@0
  3321
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3322
													 aIpc, 
sl@0
  3323
													 KNullDesC8,
sl@0
  3324
													 KNullDesC8,
sl@0
  3325
													 numberOfElementsPckg));
sl@0
  3326
sl@0
  3327
	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TVideoAspectRatio));
sl@0
  3328
	TPtr8 ptr = buf->Des();
sl@0
  3329
sl@0
  3330
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0
  3331
													 EMMFVideoPixelAspectRatioCopyArrayData, 
sl@0
  3332
													 KNullDesC8,
sl@0
  3333
													 KNullDesC8,
sl@0
  3334
													 ptr));
sl@0
  3335
	RDesReadStream stream(ptr);
sl@0
  3336
	stream.Open(ptr);
sl@0
  3337
	CleanupClosePushL(stream);
sl@0
  3338
sl@0
  3339
	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0
  3340
		{
sl@0
  3341
		User::LeaveIfError(aArray.Append(TVideoAspectRatio(stream.ReadInt32L(), stream.ReadInt32L())));
sl@0
  3342
		}
sl@0
  3343
sl@0
  3344
	CleanupStack::PopAndDestroy(2, buf);//stream, buf
sl@0
  3345
	}
sl@0
  3346
		
sl@0
  3347
EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser* CMMFVideoPixelAspectRatioCustomCommandParser::NewL(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor)
sl@0
  3348
	{
sl@0
  3349
	return new(ELeave) CMMFVideoPixelAspectRatioCustomCommandParser(aImplementor);
sl@0
  3350
	}
sl@0
  3351
sl@0
  3352
EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser::~CMMFVideoPixelAspectRatioCustomCommandParser()
sl@0
  3353
	{
sl@0
  3354
	if(iDataCopyBuffer)
sl@0
  3355
		{
sl@0
  3356
		delete iDataCopyBuffer;
sl@0
  3357
		}	
sl@0
  3358
	}
sl@0
  3359
sl@0
  3360
CMMFVideoPixelAspectRatioCustomCommandParser::CMMFVideoPixelAspectRatioCustomCommandParser(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor) :
sl@0
  3361
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPixelAspectRatio),
sl@0
  3362
	iImplementor(aImplementor)
sl@0
  3363
	{
sl@0
  3364
	}
sl@0
  3365
sl@0
  3366
void CMMFVideoPixelAspectRatioCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3367
	{
sl@0
  3368
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPixelAspectRatio)
sl@0
  3369
		{
sl@0
  3370
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  3371
		if (error)
sl@0
  3372
			{
sl@0
  3373
			aMessage.Complete(error);	
sl@0
  3374
			}
sl@0
  3375
		}
sl@0
  3376
	else
sl@0
  3377
		{
sl@0
  3378
		aMessage.Complete(KErrNotSupported);
sl@0
  3379
		}
sl@0
  3380
	}
sl@0
  3381
	
sl@0
  3382
void CMMFVideoPixelAspectRatioCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  3383
	{
sl@0
  3384
	TBool complete = ETrue;
sl@0
  3385
	switch (aMessage.Function())
sl@0
  3386
		{
sl@0
  3387
	case EMMFVideoSetPixelAspectRatio:
sl@0
  3388
		complete = DoSetPixelAspectRatioL(aMessage);
sl@0
  3389
		break;
sl@0
  3390
	case EMMFVideoGetPixelAspectRatio:
sl@0
  3391
		complete = DoGetPixelAspectRatioL(aMessage);
sl@0
  3392
		break;
sl@0
  3393
	case EMMFVideoGetSupportedPixelAspectRatios:
sl@0
  3394
		complete = DoGetSupportedPixelAspectRatiosL(aMessage);
sl@0
  3395
		break;
sl@0
  3396
	case EMMFVideoPixelAspectRatioCopyArrayData:
sl@0
  3397
		complete = DoCopyArrayDataL(aMessage);
sl@0
  3398
		break;
sl@0
  3399
	default:
sl@0
  3400
		User::Leave(KErrNotSupported);
sl@0
  3401
		break;
sl@0
  3402
		}
sl@0
  3403
	if (complete)
sl@0
  3404
		{
sl@0
  3405
		aMessage.Complete(KErrNone);	
sl@0
  3406
		}
sl@0
  3407
	}
sl@0
  3408
sl@0
  3409
TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoSetPixelAspectRatioL(TMMFMessage& aMessage)
sl@0
  3410
	{
sl@0
  3411
	TPckgBuf<TVideoAspectRatio> pckg;
sl@0
  3412
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3413
	iImplementor.MvparSetPixelAspectRatioL(pckg());
sl@0
  3414
	return ETrue;
sl@0
  3415
	}
sl@0
  3416
sl@0
  3417
TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetPixelAspectRatioL(TMMFMessage& aMessage)
sl@0
  3418
	{
sl@0
  3419
	TVideoAspectRatio aspectRatio;
sl@0
  3420
	iImplementor.MvparGetPixelAspectRatioL(aspectRatio);
sl@0
  3421
	TPckgBuf<TVideoAspectRatio> pckg;
sl@0
  3422
	pckg() = aspectRatio;
sl@0
  3423
	aMessage.WriteDataToClientL(pckg);
sl@0
  3424
	return ETrue;
sl@0
  3425
	}
sl@0
  3426
sl@0
  3427
TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetSupportedPixelAspectRatiosL(TMMFMessage& aMessage)
sl@0
  3428
	{
sl@0
  3429
	RArray<TVideoAspectRatio> array;
sl@0
  3430
	CleanupClosePushL(array);
sl@0
  3431
	iImplementor.MvparGetSupportedPixelAspectRatiosL(array);
sl@0
  3432
sl@0
  3433
	DoCreateBufFromVideoAspectRatioArrayL(array);
sl@0
  3434
sl@0
  3435
	TPckgBuf<TInt> pckg;
sl@0
  3436
	pckg() = array.Count();
sl@0
  3437
	aMessage.WriteDataToClientL(pckg);
sl@0
  3438
sl@0
  3439
	CleanupStack::PopAndDestroy(&array);
sl@0
  3440
	return ETrue;
sl@0
  3441
	}
sl@0
  3442
sl@0
  3443
void CMMFVideoPixelAspectRatioCustomCommandParser::DoCreateBufFromVideoAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray)
sl@0
  3444
	{
sl@0
  3445
	delete iDataCopyBuffer;
sl@0
  3446
	iDataCopyBuffer = NULL;
sl@0
  3447
sl@0
  3448
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  3449
	RBufWriteStream stream;
sl@0
  3450
	stream.Open(*iDataCopyBuffer);
sl@0
  3451
	CleanupClosePushL(stream);
sl@0
  3452
	for (TInt i=0;i<aArray.Count();i++)
sl@0
  3453
		{
sl@0
  3454
		stream.WriteInt32L(aArray[i].iNumerator);
sl@0
  3455
		stream.WriteInt32L(aArray[i].iDenominator);
sl@0
  3456
		}
sl@0
  3457
	CleanupStack::PopAndDestroy(&stream);
sl@0
  3458
	}
sl@0
  3459
sl@0
  3460
TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0
  3461
	{
sl@0
  3462
	if (!iDataCopyBuffer)
sl@0
  3463
		{
sl@0
  3464
		User::Leave(KErrNotReady);
sl@0
  3465
		}		
sl@0
  3466
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
  3467
	return ETrue;
sl@0
  3468
	}
sl@0
  3469
sl@0
  3470
EXPORT_C RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands(RMMFController& aController) :
sl@0
  3471
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
sl@0
  3472
	{
sl@0
  3473
	}
sl@0
  3474
sl@0
  3475
EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioChannels(const TUint aNumChannels)
sl@0
  3476
	{
sl@0
  3477
	TPckgBuf<TUint> configPackage;
sl@0
  3478
	configPackage() = aNumChannels;
sl@0
  3479
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3480
										 EMMFVideoSetAudioChannels,
sl@0
  3481
										 configPackage,
sl@0
  3482
										 KNullDesC8);
sl@0
  3483
	}
sl@0
  3484
sl@0
  3485
EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioChannels(TUint& aAudioChannels) const
sl@0
  3486
	{
sl@0
  3487
	TPckgBuf<TUint> configPackage;
sl@0
  3488
 	
sl@0
  3489
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3490
										 EMMFVideoGetAudioChannels, 
sl@0
  3491
										 KNullDesC8,
sl@0
  3492
										 KNullDesC8,
sl@0
  3493
										 configPackage);
sl@0
  3494
sl@0
  3495
	if (!err)
sl@0
  3496
		{
sl@0
  3497
		aAudioChannels = configPackage();
sl@0
  3498
		}		
sl@0
  3499
	return err;
sl@0
  3500
	}
sl@0
  3501
sl@0
  3502
EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const
sl@0
  3503
	{
sl@0
  3504
	DoGetUintArrayL(aChannels, EMMFVideoGetSupportedAudioChannels);
sl@0
  3505
	}
sl@0
  3506
sl@0
  3507
EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioSampleRate(const TUint aSampleRate)
sl@0
  3508
	{
sl@0
  3509
	TPckgBuf<TUint> configPackage;
sl@0
  3510
	configPackage() = aSampleRate;
sl@0
  3511
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3512
										 EMMFVideoSetAudioSampleRate,
sl@0
  3513
										 configPackage,
sl@0
  3514
										 KNullDesC8);
sl@0
  3515
	}
sl@0
  3516
sl@0
  3517
EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioSampleRate(TUint& aSampleRate) const
sl@0
  3518
	{
sl@0
  3519
	TPckgBuf<TUint> configPackage;
sl@0
  3520
 	
sl@0
  3521
	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3522
										 EMMFVideoGetAudioSampleRate, 
sl@0
  3523
										 KNullDesC8,
sl@0
  3524
										 KNullDesC8,
sl@0
  3525
										 configPackage);
sl@0
  3526
sl@0
  3527
	if (!err)
sl@0
  3528
		{
sl@0
  3529
		aSampleRate = configPackage();
sl@0
  3530
		}		
sl@0
  3531
	return err;
sl@0
  3532
	}
sl@0
  3533
sl@0
  3534
EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioSampleRatesL(RArray<TUint>& aSampleRates) const
sl@0
  3535
	{
sl@0
  3536
	DoGetUintArrayL(aSampleRates, EMMFVideoGetSupportedAudioSampleRates);
sl@0
  3537
	}
sl@0
  3538
sl@0
  3539
void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFVideoAudioSamplingRateAndChannelConfigMessages aIpc) const
sl@0
  3540
	{
sl@0
  3541
	aArray.Reset();
sl@0
  3542
sl@0
  3543
	TPckgBuf<TInt> numberOfElementsPckg;
sl@0
  3544
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3545
													 aIpc, 
sl@0
  3546
													 KNullDesC8,
sl@0
  3547
													 KNullDesC8,
sl@0
  3548
													 numberOfElementsPckg));
sl@0
  3549
sl@0
  3550
	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
sl@0
  3551
	TPtr8 ptr = buf->Des();
sl@0
  3552
sl@0
  3553
	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3554
													 EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData, 
sl@0
  3555
													 KNullDesC8,
sl@0
  3556
													 KNullDesC8,
sl@0
  3557
													 ptr));
sl@0
  3558
	RDesReadStream stream(ptr);
sl@0
  3559
	stream.Open(ptr);
sl@0
  3560
	CleanupClosePushL(stream);
sl@0
  3561
sl@0
  3562
	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0
  3563
		{
sl@0
  3564
		User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
sl@0
  3565
		}
sl@0
  3566
sl@0
  3567
	CleanupStack::PopAndDestroy(2, buf);//stream, buf
sl@0
  3568
	}
sl@0
  3569
sl@0
  3570
		
sl@0
  3571
EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser* CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::NewL(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor)
sl@0
  3572
	{
sl@0
  3573
	return new(ELeave) CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(aImplementor);
sl@0
  3574
	}
sl@0
  3575
sl@0
  3576
EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::~CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser()
sl@0
  3577
	{
sl@0
  3578
	if(iDataCopyBuffer)
sl@0
  3579
		{
sl@0
  3580
		delete iDataCopyBuffer;
sl@0
  3581
		}	
sl@0
  3582
	}
sl@0
  3583
sl@0
  3584
CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor) :
sl@0
  3585
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig),
sl@0
  3586
	iImplementor(aImplementor)
sl@0
  3587
	{
sl@0
  3588
	}
sl@0
  3589
sl@0
  3590
void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3591
	{
sl@0
  3592
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
sl@0
  3593
		{
sl@0
  3594
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  3595
		if (error)
sl@0
  3596
			{
sl@0
  3597
			aMessage.Complete(error);	
sl@0
  3598
			}
sl@0
  3599
		}
sl@0
  3600
	else
sl@0
  3601
		{
sl@0
  3602
		aMessage.Complete(KErrNotSupported);
sl@0
  3603
		}
sl@0
  3604
	}
sl@0
  3605
	
sl@0
  3606
void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  3607
	{
sl@0
  3608
	TBool complete = ETrue;
sl@0
  3609
	switch (aMessage.Function())
sl@0
  3610
		{
sl@0
  3611
	case EMMFVideoSetAudioChannels:
sl@0
  3612
		complete = DoSetAudioChannelsL(aMessage);
sl@0
  3613
		break;
sl@0
  3614
	case EMMFVideoGetAudioChannels:
sl@0
  3615
		complete = DoGetAudioChannelsL(aMessage);
sl@0
  3616
		break;
sl@0
  3617
	case EMMFVideoGetSupportedAudioChannels:
sl@0
  3618
		complete = DoGetSupportedAudioChannelsL(aMessage);
sl@0
  3619
		break;
sl@0
  3620
	case EMMFVideoSetAudioSampleRate:
sl@0
  3621
		complete = DoSetAudioSampleRateL(aMessage);
sl@0
  3622
		break;
sl@0
  3623
	case EMMFVideoGetAudioSampleRate:
sl@0
  3624
		complete = DoGetAudioSampleRateL(aMessage);
sl@0
  3625
		break;
sl@0
  3626
	case EMMFVideoGetSupportedAudioSampleRates:
sl@0
  3627
		complete = DoGetSupportedAudioSampleRatesL(aMessage);
sl@0
  3628
		break;
sl@0
  3629
	case EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData:
sl@0
  3630
		complete = DoCopyArrayDataL(aMessage);
sl@0
  3631
		break;
sl@0
  3632
	default:
sl@0
  3633
		User::Leave(KErrNotSupported);
sl@0
  3634
		break;
sl@0
  3635
		}
sl@0
  3636
	if (complete)
sl@0
  3637
		{
sl@0
  3638
		aMessage.Complete(KErrNone);	
sl@0
  3639
		}
sl@0
  3640
	}
sl@0
  3641
sl@0
  3642
sl@0
  3643
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioChannelsL(TMMFMessage& aMessage)
sl@0
  3644
	{
sl@0
  3645
	TPckgBuf<TUint> pckg;
sl@0
  3646
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3647
	iImplementor.MvasrccSetAudioChannelsL(pckg());
sl@0
  3648
	return ETrue;
sl@0
  3649
	}
sl@0
  3650
	
sl@0
  3651
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioChannelsL(TMMFMessage& aMessage)
sl@0
  3652
	{
sl@0
  3653
	TUint channels = 0;
sl@0
  3654
	iImplementor.MvasrccGetAudioChannelsL(channels);
sl@0
  3655
	TPckgBuf<TUint> pckg;
sl@0
  3656
	pckg() = channels;
sl@0
  3657
	aMessage.WriteDataToClientL(pckg);
sl@0
  3658
	return ETrue;
sl@0
  3659
	}
sl@0
  3660
	
sl@0
  3661
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioChannelsL(TMMFMessage& aMessage)
sl@0
  3662
	{
sl@0
  3663
	RArray<TUint> audioChannels;
sl@0
  3664
	CleanupClosePushL(audioChannels);
sl@0
  3665
	iImplementor.MvasrccGetSupportedAudioChannelsL(audioChannels);
sl@0
  3666
sl@0
  3667
	DoCreateBufFromUintArrayL(audioChannels);
sl@0
  3668
sl@0
  3669
	TPckgBuf<TInt> pckg;
sl@0
  3670
	pckg() = audioChannels.Count();
sl@0
  3671
	aMessage.WriteDataToClientL(pckg);
sl@0
  3672
sl@0
  3673
	CleanupStack::PopAndDestroy(&audioChannels);
sl@0
  3674
	return ETrue;
sl@0
  3675
	}
sl@0
  3676
sl@0
  3677
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioSampleRateL(TMMFMessage& aMessage)
sl@0
  3678
	{
sl@0
  3679
	TPckgBuf<TUint> pckg;
sl@0
  3680
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3681
	iImplementor.MvasrccSetAudioSampleRateL(pckg());
sl@0
  3682
	return ETrue;
sl@0
  3683
	}
sl@0
  3684
sl@0
  3685
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioSampleRateL(TMMFMessage& aMessage)
sl@0
  3686
	{
sl@0
  3687
	TUint sampleRate = 0;
sl@0
  3688
	iImplementor.MvasrccGetAudioSampleRateL(sampleRate);
sl@0
  3689
	TPckgBuf<TUint> pckg;
sl@0
  3690
	pckg() = sampleRate;
sl@0
  3691
	aMessage.WriteDataToClientL(pckg);
sl@0
  3692
	return ETrue;
sl@0
  3693
	}
sl@0
  3694
sl@0
  3695
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioSampleRatesL(TMMFMessage& aMessage)
sl@0
  3696
	{
sl@0
  3697
	RArray<TUint> sampleRates;
sl@0
  3698
	CleanupClosePushL(sampleRates);
sl@0
  3699
	iImplementor.MvasrccGetSupportedAudioSampleRatesL(sampleRates);
sl@0
  3700
sl@0
  3701
	DoCreateBufFromUintArrayL(sampleRates);
sl@0
  3702
sl@0
  3703
	TPckgBuf<TInt> pckg;
sl@0
  3704
	pckg() = sampleRates.Count();
sl@0
  3705
	aMessage.WriteDataToClientL(pckg);
sl@0
  3706
sl@0
  3707
	CleanupStack::PopAndDestroy(&sampleRates);
sl@0
  3708
	return ETrue;
sl@0
  3709
	}
sl@0
  3710
sl@0
  3711
void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
sl@0
  3712
	{
sl@0
  3713
	delete iDataCopyBuffer;
sl@0
  3714
	iDataCopyBuffer = NULL;
sl@0
  3715
sl@0
  3716
	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0
  3717
	RBufWriteStream stream;
sl@0
  3718
	stream.Open(*iDataCopyBuffer);
sl@0
  3719
	CleanupClosePushL(stream);
sl@0
  3720
	for (TInt i=0;i<aArray.Count();i++)
sl@0
  3721
		{
sl@0
  3722
		stream.WriteUint32L(aArray[i]);
sl@0
  3723
		}		
sl@0
  3724
	CleanupStack::PopAndDestroy(&stream);
sl@0
  3725
	}
sl@0
  3726
sl@0
  3727
TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0
  3728
	{
sl@0
  3729
	if (!iDataCopyBuffer)
sl@0
  3730
		{
sl@0
  3731
		User::Leave(KErrNotReady);
sl@0
  3732
		}		
sl@0
  3733
	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0
  3734
	return ETrue;
sl@0
  3735
	}
sl@0
  3736
sl@0
  3737
sl@0
  3738
EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser* CMMFVideoPlayControllerExtCustomCommandParser::NewL(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor)
sl@0
  3739
	{
sl@0
  3740
	return new(ELeave) CMMFVideoPlayControllerExtCustomCommandParser(aImplementor);
sl@0
  3741
	}
sl@0
  3742
sl@0
  3743
EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser::~CMMFVideoPlayControllerExtCustomCommandParser()
sl@0
  3744
	{
sl@0
  3745
	}
sl@0
  3746
sl@0
  3747
CMMFVideoPlayControllerExtCustomCommandParser::CMMFVideoPlayControllerExtCustomCommandParser(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor) :
sl@0
  3748
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayExt),
sl@0
  3749
	iImplementor(aImplementor)	
sl@0
  3750
	{
sl@0
  3751
	}
sl@0
  3752
sl@0
  3753
void CMMFVideoPlayControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  3754
	{
sl@0
  3755
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayExt)
sl@0
  3756
		{
sl@0
  3757
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  3758
		if (error)
sl@0
  3759
			{
sl@0
  3760
			aMessage.Complete(error);	
sl@0
  3761
			}
sl@0
  3762
		}
sl@0
  3763
	else
sl@0
  3764
		{
sl@0
  3765
		aMessage.Complete(KErrNotSupported);
sl@0
  3766
		}
sl@0
  3767
	}
sl@0
  3768
sl@0
  3769
void CMMFVideoPlayControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  3770
	{
sl@0
  3771
	TBool complete = ETrue;
sl@0
  3772
sl@0
  3773
	switch (aMessage.Function())
sl@0
  3774
		{
sl@0
  3775
		case EMMFVideoPlayControllerSetPlayVelocity:
sl@0
  3776
			complete = DoSetPlayVelocityL(aMessage);
sl@0
  3777
			break;
sl@0
  3778
		case EMMFVideoPlayControllerPlayVelocity:
sl@0
  3779
			complete = DoPlayVelocityL(aMessage);
sl@0
  3780
			break;
sl@0
  3781
		case EMMFVideoPlayControllerStepFrame:
sl@0
  3782
			complete = DoStepFrameL(aMessage);
sl@0
  3783
			break;
sl@0
  3784
		case EMMFVideoPlayControllerGetPlayRateCapabilities:
sl@0
  3785
			complete = DoGetPlayRateCapabilitiesL(aMessage);
sl@0
  3786
			break;
sl@0
  3787
		case EMMFVideoPlayControllerSetVideoEnabled:
sl@0
  3788
			complete = DoSetVideoEnabledL(aMessage);
sl@0
  3789
			break;
sl@0
  3790
		case EMMFVideoPlayControllerVideoEnabled:
sl@0
  3791
			complete = DoVideoEnabledL(aMessage);
sl@0
  3792
			break;
sl@0
  3793
		case EMMFVideoPlayControllerSetAudioEnabled:
sl@0
  3794
			complete = DoSetAudioEnabledL(aMessage);
sl@0
  3795
			break;
sl@0
  3796
		case EMMFVideoPlayControllerSetAutoScale:
sl@0
  3797
			complete = DoSetAutoScaleL(aMessage);
sl@0
  3798
			break;
sl@0
  3799
		default:
sl@0
  3800
			User::Leave(KErrNotSupported);
sl@0
  3801
			break;
sl@0
  3802
		}
sl@0
  3803
	
sl@0
  3804
	if (complete)
sl@0
  3805
		{
sl@0
  3806
		aMessage.Complete(KErrNone);
sl@0
  3807
		}
sl@0
  3808
	}
sl@0
  3809
sl@0
  3810
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetPlayVelocityL(TMMFMessage& aMessage)
sl@0
  3811
	{
sl@0
  3812
	TPckgBuf<TInt> pckg;
sl@0
  3813
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3814
	iImplementor.MvpecSetPlayVelocityL(pckg());
sl@0
  3815
	
sl@0
  3816
	return ETrue;
sl@0
  3817
	}
sl@0
  3818
sl@0
  3819
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoPlayVelocityL(TMMFMessage& aMessage)
sl@0
  3820
	{
sl@0
  3821
	TPckgBuf<TInt> pckg;
sl@0
  3822
	
sl@0
  3823
	pckg() = iImplementor.MvpecPlayVelocityL();
sl@0
  3824
sl@0
  3825
	aMessage.WriteDataToClientL(pckg);
sl@0
  3826
	
sl@0
  3827
	return ETrue;
sl@0
  3828
	}
sl@0
  3829
sl@0
  3830
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoStepFrameL(TMMFMessage& aMessage)
sl@0
  3831
	{
sl@0
  3832
	TPckgBuf<TInt> pckg;
sl@0
  3833
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3834
	iImplementor.MvpecStepFrameL(pckg());
sl@0
  3835
sl@0
  3836
	return ETrue;
sl@0
  3837
	}
sl@0
  3838
sl@0
  3839
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoGetPlayRateCapabilitiesL(TMMFMessage& aMessage)
sl@0
  3840
	{
sl@0
  3841
	TPckgBuf<TVideoPlayRateCapabilities> pckg;
sl@0
  3842
	
sl@0
  3843
	iImplementor.MvpecGetPlayRateCapabilitiesL(pckg());
sl@0
  3844
sl@0
  3845
	aMessage.WriteDataToClientL(pckg);
sl@0
  3846
	
sl@0
  3847
	return ETrue;
sl@0
  3848
	}
sl@0
  3849
sl@0
  3850
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
sl@0
  3851
	{
sl@0
  3852
	TPckgBuf<TBool> pckg;
sl@0
  3853
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3854
	iImplementor.MvpecSetVideoEnabledL(pckg());
sl@0
  3855
	
sl@0
  3856
	return ETrue;	
sl@0
  3857
	}
sl@0
  3858
sl@0
  3859
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
sl@0
  3860
	{
sl@0
  3861
	TPckgBuf<TBool> pckg;	
sl@0
  3862
	
sl@0
  3863
	pckg() = iImplementor.MvpecVideoEnabledL();
sl@0
  3864
sl@0
  3865
	aMessage.WriteDataToClientL(pckg);
sl@0
  3866
	return ETrue;
sl@0
  3867
	}
sl@0
  3868
sl@0
  3869
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
sl@0
  3870
	{
sl@0
  3871
	TPckgBuf<TBool> pckg;
sl@0
  3872
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3873
	iImplementor.MvpecSetAudioEnabledL(pckg());
sl@0
  3874
	
sl@0
  3875
	return ETrue;
sl@0
  3876
	}
sl@0
  3877
sl@0
  3878
TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAutoScaleL(TMMFMessage& aMessage)
sl@0
  3879
	{
sl@0
  3880
	TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;
sl@0
  3881
	aMessage.ReadData1FromClientL(pckg);
sl@0
  3882
	iImplementor.MvpecSetAutoScaleL(pckg().iScaleType,pckg().iHorizPos , pckg().iVertPos );
sl@0
  3883
	
sl@0
  3884
	return ETrue;
sl@0
  3885
	}
sl@0
  3886
sl@0
  3887
EXPORT_C RMMFVideoPlayControllerExtCustomCommands::RMMFVideoPlayControllerExtCustomCommands(RMMFController& aController) :
sl@0
  3888
RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayExt)
sl@0
  3889
	{
sl@0
  3890
	}
sl@0
  3891
sl@0
  3892
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetPlayVelocity(TInt aVelocity)
sl@0
  3893
	{
sl@0
  3894
	TPckgBuf<TInt> pckg(aVelocity);	
sl@0
  3895
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3896
												EMMFVideoPlayControllerSetPlayVelocity, 
sl@0
  3897
												pckg,
sl@0
  3898
												KNullDesC8);
sl@0
  3899
	}
sl@0
  3900
sl@0
  3901
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::PlayVelocity(TInt &aVelocity) const
sl@0
  3902
	{
sl@0
  3903
	TPckgBuf<TInt> pckg;	
sl@0
  3904
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3905
												EMMFVideoPlayControllerPlayVelocity, 
sl@0
  3906
												KNullDesC8,
sl@0
  3907
												KNullDesC8,
sl@0
  3908
												pckg);
sl@0
  3909
	if (error == KErrNone)
sl@0
  3910
		{	
sl@0
  3911
		aVelocity = pckg();
sl@0
  3912
		}
sl@0
  3913
	return error;
sl@0
  3914
	}
sl@0
  3915
sl@0
  3916
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::StepFrame(TInt aStep)
sl@0
  3917
	{
sl@0
  3918
	TPckgBuf<TInt> pckg(aStep);	
sl@0
  3919
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3920
												EMMFVideoPlayControllerStepFrame, 
sl@0
  3921
												pckg,
sl@0
  3922
												KNullDesC8);
sl@0
  3923
	}
sl@0
  3924
sl@0
  3925
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::GetPlayRateCapabilities(TVideoPlayRateCapabilities& aCapabilities) const
sl@0
  3926
	{
sl@0
  3927
	TPckgBuf<TVideoPlayRateCapabilities> pckg;	
sl@0
  3928
	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3929
												EMMFVideoPlayControllerGetPlayRateCapabilities, 
sl@0
  3930
												KNullDesC8,
sl@0
  3931
												KNullDesC8,
sl@0
  3932
												pckg);
sl@0
  3933
	if (!error)
sl@0
  3934
		{
sl@0
  3935
		aCapabilities = pckg();
sl@0
  3936
		}
sl@0
  3937
	return error;
sl@0
  3938
	}
sl@0
  3939
sl@0
  3940
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetVideoEnabled(TBool aVideoEnabled)
sl@0
  3941
	{
sl@0
  3942
	TPckgBuf<TBool> pckg(aVideoEnabled);	
sl@0
  3943
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3944
												EMMFVideoPlayControllerSetVideoEnabled, 
sl@0
  3945
												pckg,
sl@0
  3946
												KNullDesC8);
sl@0
  3947
	}
sl@0
  3948
sl@0
  3949
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::VideoEnabled(TBool &aVideoEnabled) const
sl@0
  3950
	{
sl@0
  3951
	TPckgBuf<TBool> pckg;	
sl@0
  3952
	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3953
												EMMFVideoPlayControllerVideoEnabled, 
sl@0
  3954
												KNullDesC8,
sl@0
  3955
												KNullDesC8,
sl@0
  3956
												pckg);
sl@0
  3957
	if (error == KErrNone)
sl@0
  3958
		{
sl@0
  3959
		aVideoEnabled = pckg();
sl@0
  3960
		}
sl@0
  3961
	return error;
sl@0
  3962
	}
sl@0
  3963
sl@0
  3964
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAudioEnabled(TBool aAudioEnabled)
sl@0
  3965
	{
sl@0
  3966
	TPckgBuf<TBool> pckg(aAudioEnabled);	
sl@0
  3967
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3968
												EMMFVideoPlayControllerSetAudioEnabled, 
sl@0
  3969
												pckg,
sl@0
  3970
												KNullDesC8);
sl@0
  3971
	}
sl@0
  3972
sl@0
  3973
EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAutoScale(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
sl@0
  3974
	{
sl@0
  3975
	TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;	
sl@0
  3976
sl@0
  3977
	pckg().iScaleType = aScaleType;
sl@0
  3978
	pckg().iHorizPos = aHorizPos;
sl@0
  3979
	pckg().iVertPos = aVertPos;
sl@0
  3980
	
sl@0
  3981
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  3982
												EMMFVideoPlayControllerSetAutoScale, 
sl@0
  3983
												pckg,
sl@0
  3984
												KNullDesC8);
sl@0
  3985
	}
sl@0
  3986
sl@0
  3987
sl@0
  3988
EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser* CMMFVideoRecordControllerExtCustomCommandParser::NewL(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor)
sl@0
  3989
	{
sl@0
  3990
	return new(ELeave) CMMFVideoRecordControllerExtCustomCommandParser(aImplementor);
sl@0
  3991
	}
sl@0
  3992
sl@0
  3993
EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser::~CMMFVideoRecordControllerExtCustomCommandParser()
sl@0
  3994
	{
sl@0
  3995
	}
sl@0
  3996
sl@0
  3997
CMMFVideoRecordControllerExtCustomCommandParser::CMMFVideoRecordControllerExtCustomCommandParser(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor) :
sl@0
  3998
	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecorderExt),
sl@0
  3999
	iImplementor(aImplementor)	
sl@0
  4000
	{
sl@0
  4001
	}
sl@0
  4002
sl@0
  4003
void CMMFVideoRecordControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  4004
	{
sl@0
  4005
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecorderExt)
sl@0
  4006
		{
sl@0
  4007
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  4008
		if (error)
sl@0
  4009
			{
sl@0
  4010
			aMessage.Complete(error);	
sl@0
  4011
			}
sl@0
  4012
		}
sl@0
  4013
	else
sl@0
  4014
		{
sl@0
  4015
		aMessage.Complete(KErrNotSupported);
sl@0
  4016
		}
sl@0
  4017
	}
sl@0
  4018
sl@0
  4019
void CMMFVideoRecordControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  4020
	{
sl@0
  4021
	TBool complete = ETrue;
sl@0
  4022
	switch (aMessage.Function())
sl@0
  4023
		{
sl@0
  4024
	case EMMFVideoRecordControllerSetVideoEnabled:
sl@0
  4025
		complete = DoSetVideoEnabledL(aMessage);
sl@0
  4026
		break;
sl@0
  4027
	case EMMFVideoRecordControllerVideoEnabled:
sl@0
  4028
		complete = DoVideoEnabledL(aMessage);
sl@0
  4029
		break;
sl@0
  4030
	case EMMFVideoRecordControllerSetVideoQuality:
sl@0
  4031
		complete = DoSetVideoQualityL(aMessage);
sl@0
  4032
		break;
sl@0
  4033
	case EMMFVideoRecordControllerVideoQuality:
sl@0
  4034
		complete = DoVideoQualityL(aMessage);
sl@0
  4035
		break;
sl@0
  4036
	case EMMFVideoRecordControllerSetVideoFrameRateFixed:
sl@0
  4037
		complete = DoSetVideoFrameRateFixedL(aMessage);
sl@0
  4038
		break;
sl@0
  4039
	case EMMFVideoRecordControllerVideoFrameRateFixed:
sl@0
  4040
		complete = DoVideoFrameRateFixedL(aMessage);
sl@0
  4041
		break;
sl@0
  4042
	default:
sl@0
  4043
		User::Leave(KErrNotSupported);
sl@0
  4044
		break;
sl@0
  4045
		}
sl@0
  4046
	if (complete)
sl@0
  4047
		{
sl@0
  4048
		aMessage.Complete(KErrNone);
sl@0
  4049
		}
sl@0
  4050
	}
sl@0
  4051
sl@0
  4052
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
sl@0
  4053
	{
sl@0
  4054
	TPckgBuf<TBool> pckg;
sl@0
  4055
	aMessage.ReadData1FromClientL(pckg);
sl@0
  4056
	iImplementor.MvrecSetVideoEnabledL(pckg());
sl@0
  4057
	
sl@0
  4058
	return ETrue;
sl@0
  4059
	}
sl@0
  4060
	
sl@0
  4061
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
sl@0
  4062
	{
sl@0
  4063
	TPckgBuf<TInt> pckg;	
sl@0
  4064
	
sl@0
  4065
	pckg() = iImplementor.MvrecVideoEnabledL();
sl@0
  4066
	
sl@0
  4067
	aMessage.WriteDataToClientL(pckg);
sl@0
  4068
	
sl@0
  4069
	return ETrue;
sl@0
  4070
	}
sl@0
  4071
	
sl@0
  4072
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoQualityL(TMMFMessage& aMessage)
sl@0
  4073
	{
sl@0
  4074
	TPckgBuf<TInt> pckg;
sl@0
  4075
	aMessage.ReadData1FromClientL(pckg);
sl@0
  4076
	iImplementor.MvrecSetVideoQualityL(pckg());
sl@0
  4077
	
sl@0
  4078
	return ETrue;
sl@0
  4079
	}
sl@0
  4080
	
sl@0
  4081
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoQualityL(TMMFMessage& aMessage)
sl@0
  4082
	{
sl@0
  4083
	TPckgBuf<TInt> pckg;
sl@0
  4084
	
sl@0
  4085
	pckg() = iImplementor.MvrecVideoQualityL();
sl@0
  4086
	
sl@0
  4087
	aMessage.WriteDataToClientL(pckg);
sl@0
  4088
	
sl@0
  4089
	return ETrue;
sl@0
  4090
	}
sl@0
  4091
	
sl@0
  4092
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoFrameRateFixedL(TMMFMessage& aMessage)
sl@0
  4093
	{
sl@0
  4094
	TPckgBuf<TBool> pckg;
sl@0
  4095
	aMessage.ReadData1FromClientL(pckg);
sl@0
  4096
	iImplementor.MvrecSetVideoFrameRateFixedL(pckg());
sl@0
  4097
	
sl@0
  4098
	return ETrue;	
sl@0
  4099
	}
sl@0
  4100
	
sl@0
  4101
TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoFrameRateFixedL(TMMFMessage& aMessage)
sl@0
  4102
	{
sl@0
  4103
	TPckgBuf<TBool> pckg;	
sl@0
  4104
	
sl@0
  4105
	pckg() = iImplementor.MvrecVideoFrameRateFixedL();
sl@0
  4106
	
sl@0
  4107
	aMessage.WriteDataToClientL(pckg);
sl@0
  4108
	return ETrue;
sl@0
  4109
	}
sl@0
  4110
sl@0
  4111
sl@0
  4112
EXPORT_C RMMFVideoRecordControllerExtCustomCommands::RMMFVideoRecordControllerExtCustomCommands(RMMFController& aController) :
sl@0
  4113
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecorderExt)
sl@0
  4114
	{
sl@0
  4115
	}
sl@0
  4116
sl@0
  4117
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoEnabled(TBool aEnabled)
sl@0
  4118
	{
sl@0
  4119
	TPckgBuf<TBool> pckg(aEnabled);	
sl@0
  4120
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4121
												EMMFVideoRecordControllerSetVideoEnabled, 
sl@0
  4122
												pckg,
sl@0
  4123
												KNullDesC8);
sl@0
  4124
	}
sl@0
  4125
sl@0
  4126
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoEnabled(TBool &aEnabled) const
sl@0
  4127
	{
sl@0
  4128
	TPckgBuf<TBool> pckg(EFalse);	
sl@0
  4129
	TInt error;
sl@0
  4130
sl@0
  4131
	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4132
												EMMFVideoRecordControllerVideoEnabled, 
sl@0
  4133
												KNullDesC8,
sl@0
  4134
												KNullDesC8,
sl@0
  4135
												pckg);
sl@0
  4136
	if (error == KErrNone)
sl@0
  4137
		{
sl@0
  4138
		aEnabled = pckg();
sl@0
  4139
		}
sl@0
  4140
	return error;
sl@0
  4141
	}
sl@0
  4142
sl@0
  4143
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoQuality(TInt aQuality)
sl@0
  4144
	{
sl@0
  4145
	TPckgBuf<TInt> pckg(aQuality);	
sl@0
  4146
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4147
												EMMFVideoRecordControllerSetVideoQuality, 
sl@0
  4148
												pckg,
sl@0
  4149
												KNullDesC8);
sl@0
  4150
	}
sl@0
  4151
sl@0
  4152
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoQuality(TInt &aQuality) const
sl@0
  4153
	{
sl@0
  4154
	TPckgBuf<TInt> pckg;	
sl@0
  4155
	TInt error;
sl@0
  4156
sl@0
  4157
	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4158
												EMMFVideoRecordControllerVideoQuality, 
sl@0
  4159
												KNullDesC8,
sl@0
  4160
												KNullDesC8,
sl@0
  4161
												pckg);
sl@0
  4162
	if (error == KErrNone)
sl@0
  4163
		{
sl@0
  4164
		aQuality = pckg();
sl@0
  4165
		}
sl@0
  4166
	return error;
sl@0
  4167
	}
sl@0
  4168
sl@0
  4169
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoFrameRateFixed(TBool aFixedFrameRate)
sl@0
  4170
	{
sl@0
  4171
	TPckgBuf<TBool> pckg(aFixedFrameRate);	
sl@0
  4172
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4173
												EMMFVideoRecordControllerSetVideoFrameRateFixed, 
sl@0
  4174
												pckg,
sl@0
  4175
												KNullDesC8);
sl@0
  4176
	}
sl@0
  4177
sl@0
  4178
EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoFrameRateFixed(TBool &aFixedFrameRate) const
sl@0
  4179
	{
sl@0
  4180
	TPckgBuf<TBool> pckg;	
sl@0
  4181
	TInt error;
sl@0
  4182
sl@0
  4183
	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4184
												EMMFVideoRecordControllerVideoFrameRateFixed, 
sl@0
  4185
												KNullDesC8,
sl@0
  4186
												KNullDesC8,
sl@0
  4187
												pckg);
sl@0
  4188
	if (error == KErrNone)
sl@0
  4189
		{
sl@0
  4190
		aFixedFrameRate = pckg();
sl@0
  4191
		}
sl@0
  4192
	return error;
sl@0
  4193
	}
sl@0
  4194
sl@0
  4195
EXPORT_C TMMFAudioSetRepeatsConfig::TMMFAudioSetRepeatsConfig()
sl@0
  4196
	:iRepeatNumberOfTimes(0), iTrailingSilence(0), iReserved1(0)
sl@0
  4197
	{
sl@0
  4198
	}
sl@0
  4199
	
sl@0
  4200
EXPORT_C RMMFAudioPlayControllerSetRepeatsCustomCommands::RMMFAudioPlayControllerSetRepeatsCustomCommands(RMMFController& aController) :
sl@0
  4201
	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlaySetRepeatsController)
sl@0
  4202
	{
sl@0
  4203
	}
sl@0
  4204
	
sl@0
  4205
EXPORT_C TInt RMMFAudioPlayControllerSetRepeatsCustomCommands::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
sl@0
  4206
	{
sl@0
  4207
	TPckgBuf<TMMFAudioSetRepeatsConfig> configPackage;
sl@0
  4208
	configPackage().iRepeatNumberOfTimes = aRepeatNumberOfTimes;
sl@0
  4209
	configPackage().iTrailingSilence = aTrailingSilence;
sl@0
  4210
	
sl@0
  4211
	return iController.CustomCommandSync(iDestinationPckg, 
sl@0
  4212
										 EMMFAudioPlayControllerSetRepeats, 
sl@0
  4213
										 configPackage,
sl@0
  4214
										 KNullDesC8);
sl@0
  4215
	}
sl@0
  4216
	
sl@0
  4217
EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser* CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor)
sl@0
  4218
	{
sl@0
  4219
	return new(ELeave) CMMFAudioPlayControllerSetRepeatsCustomCommandParser(aImplementor);
sl@0
  4220
	}
sl@0
  4221
sl@0
  4222
CMMFAudioPlayControllerSetRepeatsCustomCommandParser::CMMFAudioPlayControllerSetRepeatsCustomCommandParser(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor) :
sl@0
  4223
	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlaySetRepeatsController),	iImplementor(aImplementor)
sl@0
  4224
	{
sl@0
  4225
	}
sl@0
  4226
sl@0
  4227
EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser::~CMMFAudioPlayControllerSetRepeatsCustomCommandParser()
sl@0
  4228
	{
sl@0
  4229
	}
sl@0
  4230
sl@0
  4231
void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0
  4232
	{
sl@0
  4233
	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlaySetRepeatsController)
sl@0
  4234
		{
sl@0
  4235
		TRAPD(error, DoHandleRequestL(aMessage));
sl@0
  4236
		if (error)
sl@0
  4237
			{
sl@0
  4238
			aMessage.Complete(error);
sl@0
  4239
			}
sl@0
  4240
		}
sl@0
  4241
	else
sl@0
  4242
		{
sl@0
  4243
		aMessage.Complete(KErrNotSupported);
sl@0
  4244
		}
sl@0
  4245
	}
sl@0
  4246
sl@0
  4247
void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0
  4248
	{
sl@0
  4249
	TBool complete = ETrue;
sl@0
  4250
	switch (aMessage.Function())
sl@0
  4251
		{
sl@0
  4252
	case EMMFAudioPlayControllerSetRepeats:
sl@0
  4253
		complete = DoSetRepeatsL(aMessage);
sl@0
  4254
		break;
sl@0
  4255
	default:
sl@0
  4256
		User::Leave(KErrNotSupported);
sl@0
  4257
		break;
sl@0
  4258
		}
sl@0
  4259
	if (complete)
sl@0
  4260
		{
sl@0
  4261
		aMessage.Complete(KErrNone);
sl@0
  4262
		}
sl@0
  4263
	}
sl@0
  4264
sl@0
  4265
TBool CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoSetRepeatsL(TMMFMessage& aMessage)
sl@0
  4266
	{
sl@0
  4267
	TPckgBuf<TMMFAudioSetRepeatsConfig> pckg;
sl@0
  4268
	aMessage.ReadData1FromClientL(pckg);
sl@0
  4269
	User::LeaveIfError(iImplementor.MapcSetRepeats(pckg().iRepeatNumberOfTimes, pckg().iTrailingSilence));
sl@0
  4270
	return ETrue;
sl@0
  4271
	}