sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #include <mmf/common/mmfaudio.h>
sl@0: #include "mmfstandardcustomcommands.h"
sl@0: #include "MMFVideoFrameMessage.h"
sl@0: #include "MMFSCCPanicCodes.h"
sl@0: #include <badesca.h>
sl@0: 
sl@0: #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0: #include <mmf/common/mmfstandardcustomcommandsenums.h>
sl@0: #include <mmf/common/mmfstandardcustomcommandsimpl.h>
sl@0: #include <mmf/common/mmfvideoenums.h>
sl@0: #endif
sl@0: 
sl@0: 
sl@0: const TInt KBufExpandSize8 = 8;//two TInts!
sl@0: const TInt KBufExpandSize32 = 32;
sl@0: 
sl@0: const TInt KBufMimeTypeGranularity = 4;
sl@0: const TInt KMaxMimeTypeLength = 256;
sl@0: 
sl@0: class TMimeTypeBufferInfo 
sl@0: 	{
sl@0: public:
sl@0: 	TInt32 count;
sl@0: 	TInt32 bufferLen;
sl@0: 	};
sl@0: 
sl@0: EXPORT_C RMMFAudioPlayDeviceCustomCommands::RMMFAudioPlayDeviceCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayDevice)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolume(TInt aVolume) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iVolume = aVolume;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayDeviceSetVolume, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetMaxVolume(TInt& aMaxVolume) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioPlayDeviceGetMaxVolume, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aMaxVolume = configPackage().iMaxVolume;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetVolume(TInt& aVolume) const 
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioPlayDeviceGetVolume, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aVolume = configPackage().iVolume;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iRampDuration = aRampDuration;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayDeviceSetVolumeRamp, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::SetBalance(TInt aBalance) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iBalance = aBalance;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayDeviceSetBalance, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayDeviceCustomCommands::GetBalance(TInt& aBalance) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioPlayDeviceGetBalance, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aBalance = configPackage().iBalance;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioPlayDeviceCustomCommandParser* CMMFAudioPlayDeviceCustomCommandParser::NewL(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioPlayDeviceCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioPlayDeviceCustomCommandParser::~CMMFAudioPlayDeviceCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFAudioPlayDeviceCustomCommandParser::CMMFAudioPlayDeviceCustomCommandParser(MMMFAudioPlayDeviceCustomCommandImplementor& aImplementor) : 
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayDevice),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: 
sl@0: void CMMFAudioPlayDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayDevice)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioPlayDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioPlayDeviceSetVolume:
sl@0: 		complete = DoSetVolumeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayDeviceGetMaxVolume:
sl@0: 		complete = DoGetMaxVolumeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayDeviceGetVolume:
sl@0: 		complete = DoGetVolumeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayDeviceSetVolumeRamp:
sl@0: 		complete = DoSetVolumeRampL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayDeviceSetBalance:
sl@0: 		complete = DoSetBalanceL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayDeviceGetBalance:
sl@0: 		complete = DoGetBalanceL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MapdSetVolumeL(pckg().iVolume);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetMaxVolumeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt maxVol = 0;
sl@0: 	iImplementor.MapdGetMaxVolumeL(maxVol);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iMaxVolume = maxVol;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetVolumeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt vol = 0;
sl@0: 	iImplementor.MapdGetVolumeL(vol);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iVolume = vol;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetVolumeRampL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MapdSetVolumeRampL(pckg().iRampDuration);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MapdSetBalanceL(pckg().iBalance);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt bal = 0;
sl@0: 	iImplementor.MapdGetBalanceL(bal);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iBalance = bal;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFAudioRecordDeviceCustomCommands::RMMFAudioRecordDeviceCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordDevice)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetGain(TInt aGain) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iGain = aGain;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordDeviceSetGain, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetMaxGain(TInt& aMaxGain) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordDeviceGetMaxGain, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 	if (!error)
sl@0: 		aMaxGain = configPackage().iMaxGain;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetGain(TInt& aGain) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordDeviceGetGain, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 	if (!error)
sl@0: 		aGain = configPackage().iGain;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::SetBalance(TInt aBalance) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iBalance = aBalance;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordDeviceSetBalance, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordDeviceCustomCommands::GetBalance(TInt& aBalance) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioRecordDeviceGetBalance, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aBalance = configPackage().iBalance;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioRecordDeviceCustomCommandParser* CMMFAudioRecordDeviceCustomCommandParser::NewL(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) 
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioRecordDeviceCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: CMMFAudioRecordDeviceCustomCommandParser::CMMFAudioRecordDeviceCustomCommandParser(MMMFAudioRecordDeviceCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordDevice),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioRecordDeviceCustomCommandParser::~CMMFAudioRecordDeviceCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioRecordDeviceCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordDevice)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioRecordDeviceCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioRecordDeviceSetGain:
sl@0: 		complete = DoSetGainL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordDeviceGetMaxGain:
sl@0: 		complete = DoGetMaxGainL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordDeviceGetGain:
sl@0: 		complete = DoGetGainL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordDeviceSetBalance:
sl@0: 		complete = DoSetBalanceL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordDeviceGetBalance:
sl@0: 		complete = DoGetBalanceL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetGainL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MardSetGainL(pckg().iGain);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetMaxGainL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt maxGain = 0;
sl@0: 	iImplementor.MardGetMaxGainL(maxGain);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iMaxGain = maxGain;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetGainL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt gain = 0;
sl@0: 	iImplementor.MardGetGainL(gain);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iGain = gain;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordDeviceCustomCommandParser::DoSetBalanceL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MardSetBalanceL(pckg().iBalance);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordDeviceCustomCommandParser::DoGetBalanceL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt balance = 0;
sl@0: 	iImplementor.MardGetBalanceL(balance);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iBalance = balance;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFAudioPlayControllerCustomCommands::RMMFAudioPlayControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlayController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::SetPlaybackWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iStartPosition = aStart;
sl@0: 	configPackage().iEndPosition = aEnd;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayControllerSetPlaybackWindow, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::DeletePlaybackWindow()
sl@0: 	{
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayControllerDeletePlaybackWindow, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TInt RMMFAudioPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioPlayControllerGetLoadingProgress, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aPercentageComplete = configPackage().iLoadingCompletePercentage;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C CMMFAudioPlayControllerCustomCommandParser* CMMFAudioPlayControllerCustomCommandParser::NewL(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioPlayControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: CMMFAudioPlayControllerCustomCommandParser::CMMFAudioPlayControllerCustomCommandParser(MMMFAudioPlayControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlayController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioPlayControllerCustomCommandParser::~CMMFAudioPlayControllerCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlayController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioPlayControllerSetPlaybackWindow:
sl@0: 		complete = DoSetPlaybackWindowL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayControllerDeletePlaybackWindow:
sl@0: 		complete = DoDeletePlaybackWindowL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioPlayControllerGetLoadingProgress:
sl@0: 		complete = DoGetLoadingProgressL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayControllerCustomCommandParser::DoSetPlaybackWindowL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MapcSetPlaybackWindowL(pckg().iStartPosition, pckg().iEndPosition);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayControllerCustomCommandParser::DoDeletePlaybackWindowL(TMMFMessage& /*aMessage*/)
sl@0: 	{
sl@0: 	iImplementor.MapcDeletePlaybackWindowL();
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt progress;
sl@0: 	iImplementor.MapcGetLoadingProgressL(progress);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iLoadingCompletePercentage = progress;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFAudioRecordControllerCustomCommands::RMMFAudioRecordControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioRecordController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioRecordControllerGetRecordTimeAvailable, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aTime = configPackage().iRecordTimeAvailable;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxDuration(const TTimeIntervalMicroSeconds& aMaxDuration) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iMaxDuration = aMaxDuration;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordControllerSetMaxDuration, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iMaxFileSize = aMaxSize;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordControllerSetMaxFileSize, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::Crop(TBool aToEnd)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iCropToEnd = aToEnd;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioRecordControllerCrop, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry)
sl@0: 	{
sl@0: 	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0: 	CleanupStack::PushL(buf);
sl@0: 	RBufWriteStream s;
sl@0: 	s.Open(*buf);
sl@0: 	CleanupClosePushL(s);
sl@0: 	aNewEntry.ExternalizeL(s);
sl@0: 	TPtr8 bufData = buf->Ptr(0);
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0: 													 EMMFAudioRecordControllerAddMetaDataEntry,
sl@0: 													 bufData,
sl@0: 													 KNullDesC8));
sl@0: 	CleanupStack::PopAndDestroy(2);//s, buf
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg(aIndex);
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										 EMMFAudioRecordControllerRemoveMetaDataEntry,
sl@0: 										 pckg,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> indexPckg(aIndex);
sl@0: 	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0: 	CleanupStack::PushL(buf);
sl@0: 	RBufWriteStream s;
sl@0: 	s.Open(*buf);
sl@0: 	CleanupClosePushL(s);
sl@0: 	aNewEntry.ExternalizeL(s);
sl@0: 	TPtr8 bufData = buf->Ptr(0);
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0: 													 EMMFAudioRecordControllerReplaceMetaDataEntry,
sl@0: 													 bufData,
sl@0: 													 indexPckg));
sl@0: 	CleanupStack::PopAndDestroy(2);//s, buf
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioRecordControllerCustomCommandParser* CMMFAudioRecordControllerCustomCommandParser::NewL(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioRecordControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: CMMFAudioRecordControllerCustomCommandParser::CMMFAudioRecordControllerCustomCommandParser(MMMFAudioRecordControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioRecordController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioRecordControllerCustomCommandParser::~CMMFAudioRecordControllerCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioRecordController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioRecordControllerGetRecordTimeAvailable:
sl@0: 		complete = DoGetRecordTimeAvailableL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerSetMaxDuration:
sl@0: 		complete = DoSetMaxDurationL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerSetMaxFileSize:
sl@0: 		complete = DoSetMaxFileSizeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerCrop:
sl@0: 		complete = DoCropL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerAddMetaDataEntry:
sl@0: 		complete = DoAddMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerRemoveMetaDataEntry:
sl@0: 		complete = DoRemoveMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioRecordControllerReplaceMetaDataEntry:
sl@0: 		complete = DoReplaceMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TTimeIntervalMicroSeconds time;
sl@0: 	iImplementor.MarcGetRecordTimeAvailableL(time);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iRecordTimeAvailable = time;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxDurationL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarcSetMaxDurationL(pckg().iMaxDuration);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarcSetMaxFileSizeL(pckg().iMaxFileSize);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoCropL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarcCropL(pckg().iCropToEnd);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0: 	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0: 	User::LeaveIfError(bufSize); 
sl@0: 	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 	aMessage.ReadData1FromClientL(ptr);
sl@0: 	RDesReadStream stream;
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0: 	CleanupStack::PushL(metaData);
sl@0: 	metaData->InternalizeL(stream);
sl@0: 	iImplementor.MarcAddMetaDataEntryL(*metaData);
sl@0: 	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarcRemoveMetaDataEntryL(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	// Get new meta data
sl@0: 	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0: 	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0: 	User::LeaveIfError(bufSize); 
sl@0: 	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 	aMessage.ReadData1FromClientL(ptr);
sl@0: 	RDesReadStream stream;
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0: 	CleanupStack::PushL(metaData);
sl@0: 	metaData->InternalizeL(stream);
sl@0: 
sl@0: 	
sl@0: 	// Get index to replace
sl@0: 	TPckgBuf<TInt> indexPckg;
sl@0: 	aMessage.ReadData2FromClientL(indexPckg);
sl@0: 	
sl@0: 	iImplementor.MarcReplaceMetaDataEntryL(indexPckg(), *metaData);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFAudioControllerCustomCommands::RMMFAudioControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceSampleRate(TUint aSampleRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSampleRate = aSampleRate;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSourceSampleRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceNumChannels(TUint aNumChannels) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iChannels = aNumChannels;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSourceNumChannels, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceFormat(TUid aFormatUid) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iFormatUid = aFormatUid;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSourceFormat, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkSampleRate(TUint aSampleRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSampleRate = aSampleRate;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSinkSampleRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkNumChannels(TUint aNumChannels) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iChannels = aNumChannels;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSinkNumChannels, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkFormat(TUid aFormatUid) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iFormatUid = aFormatUid;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSinkFormat, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetCodec(TFourCC aSourceDataType, TFourCC aSinkDataType) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSourceDataTypeCode = aSourceDataType;
sl@0: 	configPackage().iSinkDataTypeCode = aSinkDataType;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetCodec, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceBitRate(TUint aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSampleRate = aRate;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSourceBitRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSourceDataType(TFourCC aDataType) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSourceDataTypeCode = aDataType;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSourceDataType, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkBitRate(TUint aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSampleRate = aRate;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSinkBitRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::SetSinkDataType(TFourCC aDataType) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iSinkDataTypeCode = aDataType;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioControllerSetSinkDataType, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceSampleRate(TUint& aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSourceSampleRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aRate = configPackage().iSampleRate;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceBitRate(TUint& aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSourceBitRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aRate = configPackage().iSampleRate;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceNumChannels(TUint& aNumChannels) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSourceNumChannels, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aNumChannels = configPackage().iChannels;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceFormat(TUid& aFormat) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSourceFormat, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aFormat = configPackage().iFormatUid;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSourceDataType(TFourCC& aDataType) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSourceDataType, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aDataType = configPackage().iSourceDataTypeCode;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkSampleRate(TUint& aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSinkSampleRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aRate = configPackage().iSampleRate;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkBitRate(TUint& aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSinkBitRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aRate = configPackage().iSampleRate;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkNumChannels(TUint& aNumChannels) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSinkNumChannels, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aNumChannels = configPackage().iChannels;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkFormat(TUid& aFormat) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSinkFormat, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aFormat = configPackage().iFormatUid;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFAudioControllerCustomCommands::GetSinkDataType(TFourCC& aDataType) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFAudioControllerGetSinkDataType, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aDataType = configPackage().iSinkDataTypeCode;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceSampleRatesL(RArray<TUint>& aSupportedRates) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceSampleRates);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceBitRatesL(RArray<TUint>& aSupportedRates) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSourceBitRates);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceNumChannelsL(RArray<TUint>& aSupportedChannels) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSourceNumChannels);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSourceDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
sl@0: 	{
sl@0: 	DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSourceDataTypes);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkSampleRatesL(RArray<TUint>& aSupportedRates) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkSampleRates);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkBitRatesL(RArray<TUint>& aSupportedRates) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedRates, EMMFAudioControllerGetSupportedSinkBitRates);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkNumChannelsL(RArray<TUint>& aSupportedChannels) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSupportedChannels, EMMFAudioControllerGetSupportedSinkNumChannels);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFAudioControllerCustomCommands::GetSupportedSinkDataTypesL(RArray<TFourCC>& aSupportedDataTypes) const
sl@0: 	{
sl@0: 	DoGetFourCCArrayL(aSupportedDataTypes, EMMFAudioControllerGetSupportedSinkDataTypes);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: void RMMFAudioControllerCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFAudioControllerMessages aIpc) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TInt> numberOfElementsPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 aIpc, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 numberOfElementsPckg));
sl@0: 
sl@0: 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFAudioControllerCopyArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0: 	}
sl@0: 
sl@0: void RMMFAudioControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray, TMMFAudioControllerMessages aIpc) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TInt> numberOfElementsPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 aIpc, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 numberOfElementsPckg));
sl@0: 
sl@0: 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFAudioControllerCopyArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C CMMFAudioControllerCustomCommandParser* CMMFAudioControllerCustomCommandParser::NewL(MMMFAudioControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: CMMFAudioControllerCustomCommandParser::CMMFAudioControllerCustomCommandParser(MMMFAudioControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioControllerCustomCommandParser::~CMMFAudioControllerCustomCommandParser()
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: 
sl@0: void CMMFAudioControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioControllerSetSourceSampleRate:
sl@0: 		complete = DoSetSourceSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSourceBitRate:
sl@0: 		complete = DoSetSourceBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSourceNumChannels:
sl@0: 		complete = DoSetSourceNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSourceFormat:
sl@0: 		complete = DoSetSourceFormatL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSourceDataType:
sl@0: 		complete = DoSetSourceDataTypeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSinkSampleRate:
sl@0: 		complete = DoSetSinkSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSinkBitRate:
sl@0: 		complete = DoSetSinkBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSinkNumChannels:
sl@0: 		complete = DoSetSinkNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSinkFormat:
sl@0: 		complete = DoSetSinkFormatL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetSinkDataType:
sl@0: 		complete = DoSetSinkDataTypeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerSetCodec:
sl@0: 		complete = DoSetCodecL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSourceSampleRate:
sl@0: 		complete = DoGetSourceSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSourceBitRate:
sl@0: 		complete = DoGetSourceBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSourceNumChannels:
sl@0: 		complete = DoGetSourceNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSourceFormat:
sl@0: 		complete = DoGetSourceFormatL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSourceDataType:
sl@0: 		complete = DoGetSourceDataTypeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSinkSampleRate:
sl@0: 		complete = DoGetSinkSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSinkBitRate:
sl@0: 		complete = DoGetSinkBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSinkNumChannels:
sl@0: 		complete = DoGetSinkNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSinkFormat:
sl@0: 		complete = DoGetSinkFormatL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSinkDataType:
sl@0: 		complete = DoGetSinkDataTypeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSourceSampleRates:
sl@0: 		complete = DoGetSupportedSourceSampleRatesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSourceBitRates:
sl@0: 		complete = DoGetSupportedSourceBitRatesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSourceNumChannels:
sl@0: 		complete = DoGetSupportedSourceNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSourceDataTypes:
sl@0: 		complete = DoGetSupportedSourceDataTypesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSinkSampleRates:
sl@0: 		complete = DoGetSupportedSinkSampleRatesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSinkBitRates:
sl@0: 		complete = DoGetSupportedSinkBitRatesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSinkNumChannels:
sl@0: 		complete = DoGetSupportedSinkNumChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerGetSupportedSinkDataTypes:
sl@0: 		complete = DoGetSupportedSinkDataTypesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioControllerCopyArrayData:
sl@0: 		complete = DoCopyArrayDataL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSourceSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSourceSampleRateL(pckg().iSampleRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSourceNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSourceNumChannelsL(pckg().iChannels);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSourceFormatL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSourceFormatL(pckg().iFormatUid);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSinkSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSinkSampleRateL(pckg().iSampleRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSinkNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSinkNumChannelsL(pckg().iChannels);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSinkFormatL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSinkFormatL(pckg().iFormatUid);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetCodecL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetCodecL(pckg().iSourceDataTypeCode, pckg().iSinkDataTypeCode);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSourceBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSourceBitRateL(pckg().iSampleRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSourceDataTypeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSourceDataTypeL(pckg().iSourceDataTypeCode);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSinkBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSinkBitRateL(pckg().iSampleRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoSetSinkDataTypeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MacSetSinkDataTypeL(pckg().iSinkDataTypeCode);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSourceSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint rate = 0;
sl@0: 	iImplementor.MacGetSourceSampleRateL(rate);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSampleRate = rate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSourceBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint rate = 0;
sl@0: 	iImplementor.MacGetSourceBitRateL(rate);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSampleRate = rate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSourceNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint channels = 0;
sl@0: 	iImplementor.MacGetSourceNumChannelsL(channels);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iChannels = channels;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSourceFormatL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUid format;
sl@0: 	iImplementor.MacGetSourceFormatL(format);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iFormatUid = format;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSourceDataTypeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TFourCC fourCC;
sl@0: 	iImplementor.MacGetSourceDataTypeL(fourCC);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSourceDataTypeCode = fourCC;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSinkSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint rate = 0;
sl@0: 	iImplementor.MacGetSinkSampleRateL(rate);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSampleRate = rate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSinkBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint rate = 0;
sl@0: 	iImplementor.MacGetSinkBitRateL(rate);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSampleRate = rate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSinkNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint channels = 0;
sl@0: 	iImplementor.MacGetSinkNumChannelsL(channels);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iChannels = channels;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSinkFormatL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUid format;
sl@0: 	iImplementor.MacGetSinkFormatL(format);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iFormatUid = format;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSinkDataTypeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TFourCC fourCC;
sl@0: 	iImplementor.MacGetSinkDataTypeL(fourCC);
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	pckg().iSinkDataTypeCode = fourCC;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceSampleRatesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> rates;
sl@0: 	CleanupClosePushL(rates);
sl@0: 	iImplementor.MacGetSupportedSourceSampleRatesL(rates);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(rates);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = rates.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//rates
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioControllerCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i=0;i<aArray.Count();i++)
sl@0: 		stream.WriteUint32L(aArray[i]);
sl@0: 	CleanupStack::PopAndDestroy();//stream
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i=0;i<aArray.Count();i++)
sl@0: 		{
sl@0: 		stream.WriteInt32L(aArray[i].FourCC());
sl@0: 		}
sl@0: 	CleanupStack::PopAndDestroy();//stream
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceBitRatesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> rates;
sl@0: 	CleanupClosePushL(rates);
sl@0: 	iImplementor.MacGetSupportedSourceBitRatesL(rates);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(rates);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = rates.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//rates
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSourceNumChannelsL(array);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSourceDataTypesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TFourCC> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSourceDataTypesL(array);
sl@0: 
sl@0: 	DoCreateBufFromFourCCArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkSampleRatesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSinkSampleRatesL(array);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkBitRatesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSinkBitRatesL(array);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkNumChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSinkNumChannelsL(array);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoGetSupportedSinkDataTypesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TFourCC> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MacGetSupportedSinkDataTypesL(array);
sl@0: 
sl@0: 	DoCreateBufFromFourCCArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioControllerCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (!iDataCopyBuffer)
sl@0: 		User::Leave(KErrNotReady);
sl@0: 	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyCDesC8ArrayDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (!iDataCopyBuffer)
sl@0: 		User::Leave(KErrNotReady);
sl@0: 	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFVideoControllerCustomCommands::RMMFVideoControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetFrameRate(TReal32& aFramesPerSecond) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerGetFrameRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aFramesPerSecond = configPackage().iFramesPerSecond;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::SetFrameRate(TReal32 aFramesPerSecond) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iFramesPerSecond = aFramesPerSecond;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerSetFrameRate, 
sl@0: 												configPackage,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C void RMMFVideoPlayControllerCustomCommands::GetFrame(CFbsBitmap& aBitmap,TRequestStatus& aStatus)
sl@0: 	{
sl@0: 	TInt handle = aBitmap.Handle();
sl@0: 	
sl@0: 	iConfigPackage().iFrameBitmapServerHandle = handle;
sl@0: 	iController.CustomCommandAsync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerGetFrame, 
sl@0: 										 iConfigPackage,
sl@0: 										 KNullDesC8,
sl@0: 										 aStatus);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::UpdateDisplayRegion(const TRegion& aRegion) const
sl@0: 	{
sl@0: 	TPckgBuf<TInt> numberOfRectsPckg;
sl@0: 	numberOfRectsPckg() = aRegion.Count();
sl@0: 	const TRect* rects = aRegion.RectangleList();
sl@0: 	TPtrC8 rectMemory(REINTERPRET_CAST(TUint8*,(void*) rects), numberOfRectsPckg() * sizeof(TRect));
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerUpdateDisplayRegion, 
sl@0: 										 numberOfRectsPckg,
sl@0: 										 rectMemory);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::DirectScreenAccessEvent(const TMMFDSAEvent aDSAEvent) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iDSAEvent = (TInt)aDSAEvent;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerDSAEvent, 
sl@0: 												configPackage,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: 	
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Play(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iStartPosition = aStart;
sl@0: 	configPackage().iEndPosition = aEnd;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerPlay, 
sl@0: 												configPackage,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::RefreshFrame() const
sl@0: 	{
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerRefreshFrame, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetLoadingProgress(TInt& aPercentageComplete) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerGetLoadingProgress, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aPercentageComplete = configPackage().iLoadingCompletePercentage;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoFrameSize(TSize& aVideoFrameSize) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerGetVideoFrameSize, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aVideoFrameSize = configPackage().iVideoFrameSize;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioBitRate(TInt& aBitRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerGetAudioBitRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aBitRate = configPackage().iAudioBitRate;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoBitRate(TInt& aBitRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerGetVideoBitRate, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aBitRate = configPackage().iVideoBitRate;
sl@0: 	return error;
sl@0: 	}
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetAudioCodec(TFourCC& aCodec) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoControllerGetAudioCodec, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aCodec = configPackage().iAudioCodec;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C void Reserved1( void )
sl@0: 	{
sl@0: 	// dummy reserved function to replace GetVideoCodec() which was removed.
sl@0: 	// this should never be called so generate a panic
sl@0: 	Panic( ENoGetVideoCodec );
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void Reserved2( void )
sl@0: 	{
sl@0: 	// dummy reserved function to replace GetSupportedSourceVideoTypes() which was removed.
sl@0: 	// this should never be called so generate a panic
sl@0: 	Panic( ENoGetSourceVideoTypes );
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void Reserved3( void )
sl@0: 	{
sl@0: 	// dummy reserved function to replace GetSupportedSourceAudioTypes() which was removed.
sl@0: 	// this should never be called so generate a panic
sl@0: 	Panic( ENoGetSourceAudioTypes );
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoControllerCustomCommands::GetVideoMimeType(TDes8& aMimeType) const
sl@0: 	{
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoControllerGetVideoMimeType, 
sl@0: 										 KNullDesC8,										 
sl@0: 										 KNullDesC8,
sl@0: 										 aMimeType);
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: void RMMFVideoRecordControllerCustomCommands::DoGetFourCCArrayL(RArray<TFourCC>& aArray) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TInt> numberOfElementsPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFVideoRecordControllerGetSupportedSinkAudioTypes, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 numberOfElementsPckg));
sl@0: 
sl@0: 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC));
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFVideoRecordControllerCopyFourCCArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(aArray.Append(stream.ReadInt32L()));
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0: 	}
sl@0: 
sl@0: 
sl@0: void RMMFVideoRecordControllerCustomCommands::DoGetCDesC8ArrayL(CDesC8Array& aArray, TMMFVideoRecordControllerMessages aIpc) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TMimeTypeBufferInfo> bufferInfoPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 aIpc, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 bufferInfoPckg));
sl@0: 
sl@0: 	// allocate a buffer of size dictated by server side
sl@0: 	HBufC8* buf = HBufC8::NewLC(bufferInfoPckg().bufferLen);
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFVideoRecordControllerCopyDescriptorArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	TInt32 len;
sl@0: 
sl@0: 	for (TInt i=0; i < bufferInfoPckg().count; i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(len = stream.ReadInt32L());
sl@0: 
sl@0: 		HBufC8* tempDesc = HBufC8::NewLC(len);
sl@0: 		TPtr8 tempPtr = tempDesc->Des();
sl@0: 
sl@0: 		stream.ReadL(tempPtr, len);
sl@0: 		aArray.AppendL(tempPtr);
sl@0: 
sl@0: 		CleanupStack::PopAndDestroy(tempDesc);
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2);//stream, buf
sl@0: 
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetDisplayWindow(const TRect& aWindowRect,
sl@0: 																	  const TRect& aClipRect) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iWindowRect = aWindowRect;
sl@0:  	configPackage().iClipRect = aClipRect;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerSetDisplayWindow, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerGetAudioEnabled, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		aEnabled = configPackage().iAudioEnabled;
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::Prepare()
sl@0: 	{
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										EMMFVideoPlayControllerPrepare,
sl@0: 										KNullDesC8,
sl@0: 										KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetRotation(TVideoRotation aRotation) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iVideoRotation = aRotation;
sl@0: 	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										EMMFVideoPlayControllerSetRotation,
sl@0: 										configPackage,
sl@0: 										KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetRotation(TVideoRotation& aRotation) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerGetRotation, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		aRotation = configPackage().iVideoRotation;
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetScaleFactor(TReal32 aWidthPercentage, TReal32 aHeightPercentage, TBool aAntiAliasFiltering) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iWidthScalePercentage = aWidthPercentage;
sl@0: 	configPackage().iHeightScalePercentage = aHeightPercentage;
sl@0: 	configPackage().iAntiAliasFiltering = aAntiAliasFiltering;
sl@0: 	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										EMMFVideoPlayControllerSetScaleFactor,
sl@0: 										configPackage,
sl@0: 										KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetScaleFactor(TReal32& aWidthPercentage, TReal32& aHeightPercentage, TBool& aAntiAliasFiltering) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerGetScaleFactor, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		{
sl@0: 		aWidthPercentage = configPackage().iWidthScalePercentage;
sl@0: 		aHeightPercentage = configPackage().iHeightScalePercentage;
sl@0: 		aAntiAliasFiltering = configPackage().iAntiAliasFiltering;
sl@0: 		}
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::SetCropRegion(const TRect& aCropRegion) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iCropRectangle = aCropRegion;
sl@0: 	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										EMMFVideoPlayControllerSetCropRegion,
sl@0: 										configPackage,
sl@0: 										KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerCustomCommands::GetCropRegion(TRect& aCropRegion) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoPlayControllerGetCropRegion, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		{
sl@0: 		aCropRegion = configPackage().iCropRectangle;
sl@0: 		}
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C RMMFVideoRecordControllerCustomCommands::RMMFVideoRecordControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecordController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFormat(TUid aFormatUid) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iFormatUid = aFormatUid;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetVideoFormat, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoCodec(const TDesC8& aVideoCodec) const
sl@0: 	{
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetVideoCodec, 
sl@0: 										 aVideoCodec,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioCodec(TFourCC aAudioCodec) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iAudioCodec = aAudioCodec;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetAudioCodec, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C void RMMFVideoRecordControllerCustomCommands::AddMetaDataEntryL(const CMMFMetaDataEntry& aNewEntry) const
sl@0: 	{
sl@0: 	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0: 	CleanupStack::PushL(buf);
sl@0: 	RBufWriteStream s;
sl@0: 	s.Open(*buf);
sl@0: 	CleanupClosePushL(s);
sl@0: 	aNewEntry.ExternalizeL(s);
sl@0: 	TPtr8 bufData = buf->Ptr(0);
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0: 													 EMMFVideoRecordControllerAddMetaDataEntry,
sl@0: 													 bufData,
sl@0: 													 KNullDesC8));
sl@0: 	CleanupStack::PopAndDestroy(2);//s, buf
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::RemoveMetaDataEntry(TInt aIndex) const
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg(aIndex);
sl@0: 	return iController.CustomCommandSync(iDestinationPckg,
sl@0: 										 EMMFVideoRecordControllerRemoveMetaDataEntry,
sl@0: 										 pckg,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFVideoRecordControllerCustomCommands::ReplaceMetaDataEntryL(TInt aIndex, const CMMFMetaDataEntry& aNewEntry) const
sl@0: 	{
sl@0: 	TPckgBuf<TInt> indexPckg(aIndex);
sl@0: 	CBufFlat* buf = CBufFlat::NewL(KBufExpandSize32);
sl@0: 	CleanupStack::PushL(buf);
sl@0: 	RBufWriteStream s;
sl@0: 	s.Open(*buf);
sl@0: 	CleanupClosePushL(s);
sl@0: 	aNewEntry.ExternalizeL(s);
sl@0: 	TPtr8 bufData = buf->Ptr(0);
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0: 													 EMMFVideoRecordControllerReplaceMetaDataEntry,
sl@0: 													 bufData,
sl@0: 													 indexPckg));
sl@0: 	CleanupStack::PopAndDestroy(2);//s, buf
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetMaxFileSize(TInt aMaxSize) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	configPackage().iMaxFileSize = aMaxSize;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetMaxFileSize, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoBitRate(TInt aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	configPackage().iVideoBitRate = aRate;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetVideoBitRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioBitRate(TInt aRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	configPackage().iAudioBitRate = aRate;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetAudioBitRate, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetVideoFrameSize(TSize aSize) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	configPackage().iVideoFrameSize = aSize;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetVideoFrameSize, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetAudioEnabled(TBool aEnabled) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	configPackage().iAudioEnabled = aEnabled;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetAudioEnabled, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::Prepare() const
sl@0: 	{
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerPrepare, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::SetCameraHandle(TInt aCameraHandle) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	configPackage().iCameraHandle = aCameraHandle;
sl@0: 
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerSetCameraHandle, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetRecordTimeAvailable(TTimeIntervalMicroSeconds& aTime) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerGetRecordTimeAvailable, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												configPackage);
sl@0: 	if (!error)
sl@0: 		aTime = configPackage().iRecordTimeAvailable;
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkVideoTypes(CDesC8Array& aSupportedDataTypes) const
sl@0: 	{
sl@0: 	TInt err;
sl@0: 	TRAP(err, DoGetCDesC8ArrayL(aSupportedDataTypes, EMMFVideoRecordControllerGetSupportedSinkVideoTypes));
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetSupportedSinkAudioTypes(RArray<TFourCC>& aSupportedDataTypes) const
sl@0: 	{
sl@0: 	TInt err;
sl@0: 	TRAP(err, DoGetFourCCArrayL(aSupportedDataTypes));
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: // New method as part of INC23777.
sl@0: EXPORT_C TInt RMMFVideoRecordControllerCustomCommands::GetAudioEnabled(TBool& aEnabled) const
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoRecordControllerGetAudioEnabled, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		aEnabled = configPackage().iAudioEnabled;
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoControllerCustomCommandParser* CMMFVideoControllerCustomCommandParser::NewL(MMMFVideoControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoControllerCustomCommandParser::~CMMFVideoControllerCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFVideoControllerCustomCommandParser::CMMFVideoControllerCustomCommandParser(MMMFVideoControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoControllerGetAudioBitRate:
sl@0: 		complete = DoGetAudioBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoControllerGetVideoBitRate:
sl@0: 		complete = DoGetVideoBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoControllerGetAudioCodec:
sl@0: 		complete = DoGetAudioCodecL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoControllerGetVideoFrameSize:
sl@0: 		complete = DoGetVideoFrameSizeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoControllerSetFrameRate:
sl@0: 		complete = DoSetFrameRateL(aMessage);
sl@0: 		break;	
sl@0: 	case EMMFVideoControllerGetFrameRate:
sl@0: 		complete = DoGetFrameRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoControllerGetVideoMimeType:
sl@0: 		complete = DoGetVideoMimeTypeL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetVideoFrameSizeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TSize size;
sl@0: 	iImplementor.MvcGetVideoFrameSizeL(size);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iVideoFrameSize = size;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetAudioCodecL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TFourCC audioCodec;
sl@0: 	iImplementor.MvcGetAudioCodecL(audioCodec);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iAudioCodec = audioCodec;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetVideoBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt videoBitRate;
sl@0: 	iImplementor.MvcGetVideoBitRateL(videoBitRate);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iVideoBitRate = videoBitRate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetAudioBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt audioBitRate;
sl@0: 	iImplementor.MvcGetAudioBitRateL(audioBitRate);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iAudioBitRate = audioBitRate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoSetFrameRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvcSetFrameRateL(pckg().iFramesPerSecond);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetFrameRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TReal32 frameRate = 0;
sl@0: 	iImplementor.MvcGetFrameRateL(frameRate);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iFramesPerSecond = frameRate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoControllerCustomCommandParser::DoGetVideoMimeTypeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBuf8<KMaxMimeTypeLength> mimeType;
sl@0: 	iImplementor.MvcGetVideoMimeTypeL(mimeType);
sl@0: 	
sl@0: 	aMessage.WriteDataToClientL(mimeType);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkAudioTypesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TFourCC> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MvrcGetSupportedSinkAudioTypesL(array);
sl@0: 
sl@0: 	DoCreateBufFromFourCCArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoGetSupportedSinkVideoTypesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	CDesC8ArrayFlat* array = new (ELeave) CDesC8ArrayFlat(KBufMimeTypeGranularity);
sl@0: 	CleanupStack::PushL(array);
sl@0: 
sl@0: 	iImplementor.MvrcGetSupportedSinkVideoTypesL(*array);
sl@0: 
sl@0: 	TInt32 len = DoCreateBufFromCDesC8ArrayL(*array);
sl@0: 
sl@0: 	TPckgBuf<TMimeTypeBufferInfo> pckg;
sl@0: 	pckg().count = array->Count();
sl@0: 	pckg().bufferLen = len;
sl@0: 	
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy();//array
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromFourCCArrayL(RArray<TFourCC>& aArray)
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i=0;i<aArray.Count();i++)
sl@0: 		{
sl@0: 		stream.WriteInt32L(aArray[i].FourCC());
sl@0: 		}
sl@0: 	CleanupStack::PopAndDestroy();//stream
sl@0: 	}
sl@0: 
sl@0: TInt32 CMMFVideoRecordControllerCustomCommandParser::DoCreateBufFromCDesC8ArrayL(CDesC8Array& aArray)
sl@0: 	{
sl@0: 	TInt32 bufferLen = 0;
sl@0: 	TInt32 len = 0;
sl@0: 
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i = 0; i < aArray.Count(); i++)
sl@0: 		{
sl@0: 		len = aArray[i].Length();
sl@0: 		stream.WriteInt32L(len);
sl@0: 		stream.WriteL(aArray[i]);
sl@0: 
sl@0: 		bufferLen += (len + sizeof(TInt32));;	// get a cumulative total buffer size
sl@0: 		}
sl@0: 	CleanupStack::PopAndDestroy();//stream
sl@0: 
sl@0: 	return bufferLen;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: // --------------------------------------------------------------------------------
sl@0: EXPORT_C RMMFVideoPlayControllerCustomCommands::RMMFVideoPlayControllerCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayController)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoPlayControllerCustomCommandParser* CMMFVideoPlayControllerCustomCommandParser::NewL(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoPlayControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoPlayControllerCustomCommandParser::~CMMFVideoPlayControllerCustomCommandParser()
sl@0: 	{
sl@0: 	delete iVideoFrameMessage;
sl@0: 	}
sl@0: 
sl@0: CMMFVideoPlayControllerCustomCommandParser::CMMFVideoPlayControllerCustomCommandParser(MMMFVideoPlayControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPlayControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPlayControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoPlayControllerGetFrame:
sl@0: 		complete = DoGetFrameL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerSetDisplayWindow:
sl@0: 		complete = DoSetDisplayWindowL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerGetAudioEnabled:
sl@0: 		complete = DoGetAudioEnabledL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerUpdateDisplayRegion:
sl@0: 		complete = DoUpdateDisplayRegionL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerDSAEvent:
sl@0: 		complete = DoDirectScreenAccessEventL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerPlay:
sl@0: 		complete = DoPlayL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerRefreshFrame:
sl@0: 		complete = DoRefreshFrameL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerGetLoadingProgress:
sl@0: 		complete = DoGetLoadingProgressL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerPrepare:
sl@0: 		complete = DoPrepareL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerSetRotation:
sl@0: 		complete = DoSetRotationL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerGetRotation:
sl@0: 		complete = DoGetRotationL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerSetScaleFactor:
sl@0: 		complete = DoSetScaleFactorL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerGetScaleFactor:
sl@0: 		complete = DoGetScaleFactorL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerSetCropRegion:
sl@0: 		complete = DoSetCropRegionL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPlayControllerGetCropRegion:
sl@0: 		complete = DoGetCropRegionL(aMessage);
sl@0: 		break;
sl@0: 
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoUpdateDisplayRegionL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> numberOfRectsPckg;
sl@0: 	aMessage.ReadData1FromClientL(numberOfRectsPckg);
sl@0: 	TUint rectSize = numberOfRectsPckg() * sizeof(TRect);
sl@0: 	TUint8* rectMemory = STATIC_CAST(TUint8*, User::AllocLC(rectSize));
sl@0: 	TPtr8 rectMemoryPtr(rectMemory,rectSize);
sl@0: 	aMessage.ReadData2FromClientL(rectMemoryPtr);
sl@0: 	TRect* rects = REINTERPRET_CAST(TRect*, rectMemory);
sl@0: 	RRegion region(numberOfRectsPckg(), rects);
sl@0: 	CleanupStack::Pop(rectMemory); // rectMemory now owned by region
sl@0: 	CleanupClosePushL(region);
sl@0: 	iImplementor.MvpcUpdateDisplayRegionL(region);
sl@0: 	CleanupStack::PopAndDestroy();//region
sl@0: 
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	delete iVideoFrameMessage;
sl@0: 	iVideoFrameMessage = NULL;
sl@0: 
sl@0: 	iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
sl@0: 	iImplementor.MvpcGetFrameL(*iVideoFrameMessage);
sl@0: 	return EFalse;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoSetDisplayWindowL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcSetDisplayWindowL(pckg().iWindowRect, pckg().iClipRect);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool enabled;
sl@0: 	iImplementor.MvpcGetAudioEnabledL(enabled);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iAudioEnabled = enabled;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoDirectScreenAccessEventL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcDirectScreenAccessEventL((TMMFDSAEvent)pckg().iDSAEvent);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoPlayL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcPlayL(pckg().iStartPosition, pckg().iEndPosition);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoRefreshFrameL(TMMFMessage& /*aMessage*/)
sl@0: 	{
sl@0: 	iImplementor.MvpcRefreshFrameL();
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetLoadingProgressL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt progress;
sl@0: 	iImplementor.MvpcGetLoadingProgressL(progress);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iLoadingCompletePercentage = progress;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
sl@0: 	{
sl@0: 	iImplementor.MvpcPrepare();
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoSetRotationL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcSetRotationL(pckg().iVideoRotation);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetRotationL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	iImplementor.MvpcGetRotationL(pckg().iVideoRotation);
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoSetScaleFactorL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcSetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetScaleFactorL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	iImplementor.MvpcGetScaleFactorL(pckg().iWidthScalePercentage, pckg().iHeightScalePercentage, pckg().iAntiAliasFiltering);
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoSetCropRegionL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpcSetCropRegionL(pckg().iCropRectangle);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerCustomCommandParser::DoGetCropRegionL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	iImplementor.MvpcGetCropRegionL(pckg().iCropRectangle);
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: // --------------------------------------------------------------------------------
sl@0: EXPORT_C CMMFVideoRecordControllerCustomCommandParser* CMMFVideoRecordControllerCustomCommandParser::NewL(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoRecordControllerCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoRecordControllerCustomCommandParser::~CMMFVideoRecordControllerCustomCommandParser()
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	}
sl@0: 
sl@0: CMMFVideoRecordControllerCustomCommandParser::CMMFVideoRecordControllerCustomCommandParser(MMMFVideoRecordControllerCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecordController),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoRecordControllerCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecordController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			aMessage.Complete(error);
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoRecordControllerCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoRecordControllerSetVideoFormat:
sl@0: 		complete = DoSetVideoFormatL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetAudioBitRate:
sl@0: 		complete = DoSetAudioBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetVideoBitRate:
sl@0: 		complete = DoSetVideoBitRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetAudioCodec:
sl@0: 		complete = DoSetAudioCodecL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetVideoCodec:
sl@0: 		complete = DoSetVideoCodecL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerAddMetaDataEntry:
sl@0: 		complete = DoAddMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerRemoveMetaDataEntry:
sl@0: 		complete = DoRemoveMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerReplaceMetaDataEntry:
sl@0: 		complete = DoReplaceMetaDataEntryL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetMaxFileSize:
sl@0: 		complete = DoSetMaxFileSizeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetVideoFrameSize:
sl@0: 		complete = DoSetVideoFrameSizeL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetAudioEnabled:
sl@0: 		complete = DoSetAudioEnabledL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerPrepare:
sl@0: 		complete = DoPrepareL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetCameraHandle:
sl@0: 		complete = DoSetCameraHandleL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerGetRecordTimeAvailable:
sl@0: 		complete = DoGetRecordTimeAvailableL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerGetSupportedSinkAudioTypes:
sl@0: 		complete = DoGetSupportedSinkAudioTypesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerGetSupportedSinkVideoTypes:
sl@0: 		complete = DoGetSupportedSinkVideoTypesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerCopyDescriptorArrayData:
sl@0: 		complete = DoCopyCDesC8ArrayDataL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerCopyFourCCArrayData:
sl@0: 		complete = DoCopyFourCCArrayDataL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerGetAudioEnabled:  //INC23777
sl@0: 		complete = DoGetAudioEnabledL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetVideoBitRateL(pckg().iVideoBitRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioBitRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetAudioBitRateL(pckg().iAudioBitRate);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoCodecL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBuf8<KMaxMimeTypeLength> buf;
sl@0: 	aMessage.ReadData1FromClientL(buf);
sl@0: 	iImplementor.MvrcSetVideoCodecL(buf);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioCodecL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetAudioCodecL(pckg().iAudioCodec);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFormatL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetVideoFormatL(pckg().iFormatUid);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoAddMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0: 	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0: 	User::LeaveIfError(bufSize); 
sl@0: 	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 	aMessage.ReadData1FromClientL(ptr);
sl@0: 	RDesReadStream stream;
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0: 	CleanupStack::PushL(metaData);
sl@0: 	metaData->InternalizeL(stream);
sl@0: 	iImplementor.MvrcAddMetaDataEntryL(*metaData);
sl@0: 	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoRemoveMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcRemoveMetaDataEntryL(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoReplaceMetaDataEntryL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	// Get new meta data
sl@0: 	TInt bufSize = aMessage.SizeOfData1FromClient();
sl@0: 	// Leaving here in order to prevent a panic in the NewLC if the value is negative
sl@0: 	User::LeaveIfError(bufSize); 
sl@0: 	HBufC8* buf = HBufC8::NewLC(bufSize);
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 	aMessage.ReadData1FromClientL(ptr);
sl@0: 	RDesReadStream stream;
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	CMMFMetaDataEntry* metaData = CMMFMetaDataEntry::NewL();
sl@0: 	CleanupStack::PushL(metaData);
sl@0: 	metaData->InternalizeL(stream);
sl@0: 
sl@0: 	// Get index to replace
sl@0: 	TPckgBuf<TInt> indexPckg;
sl@0: 	aMessage.ReadData2FromClientL(indexPckg);
sl@0: 	
sl@0: 	iImplementor.MvrcReplaceMetaDataEntryL(indexPckg(), *metaData);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(3);//metaData, stream, buf
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetMaxFileSizeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetMaxFileSizeL(pckg().iMaxFileSize);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetVideoFrameSizeL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetVideoFrameSizeL(pckg().iVideoFrameSize);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetAudioEnabledL(pckg().iAudioEnabled);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoPrepareL(TMMFMessage& /*aMessage*/)
sl@0: 	{
sl@0: 	iImplementor.MvrcPrepareL();
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoSetCameraHandleL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrcSetCameraHandleL(pckg().iCameraHandle);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoGetRecordTimeAvailableL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TTimeIntervalMicroSeconds time;
sl@0: 	iImplementor.MvrcGetRecordTimeAvailableL(time);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iRecordTimeAvailable = time;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoCopyFourCCArrayDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (!iDataCopyBuffer)
sl@0: 		User::Leave(KErrNotReady);
sl@0: 	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: //INC23777
sl@0: TBool CMMFVideoRecordControllerCustomCommandParser::DoGetAudioEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool enabled;
sl@0: 	iImplementor.MvrcGetAudioEnabledL(enabled);
sl@0: 	TPckgBuf<TMMFVideoConfig> pckg;
sl@0: 	pckg().iAudioEnabled = enabled;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: //--------------------------------------------------------------------------------------
sl@0: EXPORT_C CMMFVideoDRMExtCustomCommandParser* CMMFVideoDRMExtCustomCommandParser::NewL(MMMFVideoDRMExtCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoDRMExtCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoDRMExtCustomCommandParser::~CMMFVideoDRMExtCustomCommandParser()
sl@0: 	{
sl@0: 	delete iVideoFrameMessage;
sl@0: 	}
sl@0: 
sl@0: CMMFVideoDRMExtCustomCommandParser::CMMFVideoDRMExtCustomCommandParser(MMMFVideoDRMExtCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoDRMExt),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoDRMExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoDRMExt)
sl@0: 		{
sl@0: 		switch (aMessage.Function())
sl@0: 			{
sl@0: 		case EMMFVideoDRMExtGetFrame:
sl@0: 			TRAPD(err, DoGetFrameL(aMessage));
sl@0: 			if (err!=KErrNone) // asynchronous, so only complete message if error occurred
sl@0: 				aMessage.Complete(err);
sl@0: 			break;
sl@0: 		default:
sl@0: 			aMessage.Complete(KErrNotSupported);
sl@0: 			break;
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoDRMExtCustomCommandParser::DoGetFrameL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	delete iVideoFrameMessage;
sl@0: 	iVideoFrameMessage = NULL;
sl@0: 
sl@0: 	iVideoFrameMessage = CMMFVideoFrameMessage::NewL(aMessage);
sl@0: 	TPckgBuf<ContentAccess::TIntent> intentPckg;
sl@0: 	aMessage.ReadData2FromClientL(intentPckg);
sl@0: 	iImplementor.MvdeGetFrameL(*iVideoFrameMessage, intentPckg());
sl@0: 	}
sl@0: 
sl@0: EXPORT_C RMMFVideoDRMExtCustomCommands::RMMFVideoDRMExtCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoDRMExt)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFVideoDRMExtCustomCommands::GetFrame(CFbsBitmap& aBitmap, ContentAccess::TIntent aIntent, TRequestStatus& aStatus)
sl@0: 	{
sl@0: 	iConfigPackage().iFrameBitmapServerHandle = aBitmap.Handle();
sl@0: 	iIntentPackage() = aIntent;
sl@0: 	iController.CustomCommandAsync(iDestinationPckg, 
sl@0: 								   EMMFVideoDRMExtGetFrame, 
sl@0: 								   iConfigPackage,
sl@0: 								   iIntentPackage,
sl@0: 								   aStatus);
sl@0: 	}
sl@0: 
sl@0: //------------------------------------------------------------------------------
sl@0: EXPORT_C RMMFResourceNotificationCustomCommands::RMMFResourceNotificationCustomCommands(RMMFController& aController) : 
sl@0: RMMFCustomCommandsBase(aController,KMMFEventCategoryAudioResourceAvailable)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFResourceNotificationCustomCommands::RegisterAsClient(TUid aEventType,const TDesC8& aNotificationRegistrationData)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0: 	configPackage().iEventType = aEventType;
sl@0: 	configPackage().iNotificationRegistrationData = aNotificationRegistrationData;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										EMMFAudioResourceRegisterNotification, 
sl@0: 										configPackage,
sl@0: 										KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TInt RMMFResourceNotificationCustomCommands::CancelRegisterAsClient(TUid aEventType)
sl@0: 	{
sl@0:  	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0:  	configPackage().iEventType = aEventType;
sl@0:  	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										EMMFAudioResourceCancelRegisterNotification, 
sl@0: 										configPackage,
sl@0: 										KNullDesC8);
sl@0: 
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFResourceNotificationCustomCommands::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData)
sl@0: 	{	
sl@0: 	TPckgBuf<TMMFAudioConfig> configPackage;
sl@0:  	configPackage().iEventType = aEventType;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										EMMFAudioResourceGetNotificationData, 
sl@0: 										configPackage,
sl@0: 										KNullDesC8,
sl@0: 										aNotificationData);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFResourceNotificationCustomCommands::WillResumePlay()
sl@0: 	{	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										EMMFAudioResourceWillResumePlay, 
sl@0: 										KNullDesC8,
sl@0: 										KNullDesC8);	 
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFResourceNotificationCustomCommandParser* CMMFResourceNotificationCustomCommandParser::NewL(MMMFResourceNotificationCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFResourceNotificationCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFResourceNotificationCustomCommandParser::~CMMFResourceNotificationCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFResourceNotificationCustomCommandParser::CMMFResourceNotificationCustomCommandParser( MMMFResourceNotificationCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KMMFEventCategoryAudioResourceAvailable),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFResourceNotificationCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KMMFEventCategoryAudioResourceAvailable)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFResourceNotificationCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioResourceRegisterNotification:
sl@0: 		complete = DoRegisterAsClientL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioResourceCancelRegisterNotification:
sl@0: 		complete = DoCancelRegisterAsClientL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioResourceGetNotificationData:
sl@0: 		complete = DoGetResourceNotificationDataL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFAudioResourceWillResumePlay:
sl@0: 		complete = DoWillResumePlayL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);	
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoRegisterAsClientL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarnRegisterAsClientL(pckg().iEventType, pckg().iNotificationRegistrationData);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoCancelRegisterAsClientL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarnCancelRegisterAsClientL(pckg().iEventType);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoGetResourceNotificationDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MarnGetResourceNotificationDataL(pckg().iEventType, pckg().iNotificationData);
sl@0: 	TPtrC8 tmp(pckg().iNotificationData);
sl@0: 	aMessage.WriteDataToClientL(pckg().iNotificationData);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TBool CMMFResourceNotificationCustomCommandParser::DoWillResumePlayL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	iImplementor.MarnWillResumePlayL();
sl@0: 	aMessage.Complete(KErrNone);
sl@0: 	return EFalse;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C RMMFVideoSetInitScreenCustomCommands::RMMFVideoSetInitScreenCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoSetInitScreen)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoSetInitScreenCustomCommands::SetInitScreenNumber(TInt aScreenNumber)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> configPackage;
sl@0: 	configPackage() = aScreenNumber;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoSetInitScreenNumber,
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 		
sl@0: EXPORT_C CMMFVideoSetInitScreenCustomCommandParser* CMMFVideoSetInitScreenCustomCommandParser::NewL(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoSetInitScreenCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoSetInitScreenCustomCommandParser::~CMMFVideoSetInitScreenCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFVideoSetInitScreenCustomCommandParser::CMMFVideoSetInitScreenCustomCommandParser(MMMFVideoSetInitScreenCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoSetInitScreen),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoSetInitScreenCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoSetInitScreen)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 	
sl@0: void CMMFVideoSetInitScreenCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoSetInitScreenNumber:
sl@0: 		complete = DoSetInitScreenNumberL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);	
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoSetInitScreenCustomCommandParser::DoSetInitScreenNumberL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvsdSetInitScreenNumber(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: _LIT(KMMFStandardCustomCommandsPanicCategory, "MMFStandardCustomCommands");
sl@0: GLDEF_C void Panic(TMmfSCCPanic aError)
sl@0: 	{
sl@0: 	User::Panic(KMMFStandardCustomCommandsPanicCategory, aError);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFVideoPixelAspectRatioCustomCommands::RMMFVideoPixelAspectRatioCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPixelAspectRatio)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::SetPixelAspectRatio(const TVideoAspectRatio& aAspectRatio)
sl@0: 	{
sl@0: 	TPckgBuf<TVideoAspectRatio> configPackage;
sl@0: 	configPackage() = aAspectRatio;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoSetPixelAspectRatio,
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPixelAspectRatioCustomCommands::GetPixelAspectRatio(TVideoAspectRatio& aAspectRatio) const
sl@0: 	{
sl@0: 	TPckgBuf<TVideoAspectRatio> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoGetPixelAspectRatio, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		{
sl@0: 		aAspectRatio = configPackage();
sl@0: 		}		
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFVideoPixelAspectRatioCustomCommands::GetSupportedPixelAspectRatiosL(RArray<TVideoAspectRatio>& aAspectRatios) const
sl@0: 	{
sl@0: 	DoGetVideoPixelAspectRatioArrayL(aAspectRatios, EMMFVideoGetSupportedPixelAspectRatios);
sl@0: 	}
sl@0: 
sl@0: void RMMFVideoPixelAspectRatioCustomCommands::DoGetVideoPixelAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray, TMMFVideoPixelAspectRatioMessages aIpc) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TInt> numberOfElementsPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 aIpc, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 numberOfElementsPckg));
sl@0: 
sl@0: 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TVideoAspectRatio));
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg,
sl@0: 													 EMMFVideoPixelAspectRatioCopyArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(aArray.Append(TVideoAspectRatio(stream.ReadInt32L(), stream.ReadInt32L())));
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2, buf);//stream, buf
sl@0: 	}
sl@0: 		
sl@0: EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser* CMMFVideoPixelAspectRatioCustomCommandParser::NewL(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoPixelAspectRatioCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoPixelAspectRatioCustomCommandParser::~CMMFVideoPixelAspectRatioCustomCommandParser()
sl@0: 	{
sl@0: 	if(iDataCopyBuffer)
sl@0: 		{
sl@0: 		delete iDataCopyBuffer;
sl@0: 		}	
sl@0: 	}
sl@0: 
sl@0: CMMFVideoPixelAspectRatioCustomCommandParser::CMMFVideoPixelAspectRatioCustomCommandParser(MMMFVideoPixelAspectRatioCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPixelAspectRatio),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPixelAspectRatioCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPixelAspectRatio)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 	
sl@0: void CMMFVideoPixelAspectRatioCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoSetPixelAspectRatio:
sl@0: 		complete = DoSetPixelAspectRatioL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetPixelAspectRatio:
sl@0: 		complete = DoGetPixelAspectRatioL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetSupportedPixelAspectRatios:
sl@0: 		complete = DoGetSupportedPixelAspectRatiosL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoPixelAspectRatioCopyArrayData:
sl@0: 		complete = DoCopyArrayDataL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);	
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoSetPixelAspectRatioL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TVideoAspectRatio> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvparSetPixelAspectRatioL(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetPixelAspectRatioL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TVideoAspectRatio aspectRatio;
sl@0: 	iImplementor.MvparGetPixelAspectRatioL(aspectRatio);
sl@0: 	TPckgBuf<TVideoAspectRatio> pckg;
sl@0: 	pckg() = aspectRatio;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoGetSupportedPixelAspectRatiosL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TVideoAspectRatio> array;
sl@0: 	CleanupClosePushL(array);
sl@0: 	iImplementor.MvparGetSupportedPixelAspectRatiosL(array);
sl@0: 
sl@0: 	DoCreateBufFromVideoAspectRatioArrayL(array);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = array.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(&array);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPixelAspectRatioCustomCommandParser::DoCreateBufFromVideoAspectRatioArrayL(RArray<TVideoAspectRatio>& aArray)
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i=0;i<aArray.Count();i++)
sl@0: 		{
sl@0: 		stream.WriteInt32L(aArray[i].iNumerator);
sl@0: 		stream.WriteInt32L(aArray[i].iDenominator);
sl@0: 		}
sl@0: 	CleanupStack::PopAndDestroy(&stream);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPixelAspectRatioCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (!iDataCopyBuffer)
sl@0: 		{
sl@0: 		User::Leave(KErrNotReady);
sl@0: 		}		
sl@0: 	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioChannels(const TUint aNumChannels)
sl@0: 	{
sl@0: 	TPckgBuf<TUint> configPackage;
sl@0: 	configPackage() = aNumChannels;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoSetAudioChannels,
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioChannels(TUint& aAudioChannels) const
sl@0: 	{
sl@0: 	TPckgBuf<TUint> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoGetAudioChannels, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		{
sl@0: 		aAudioChannels = configPackage();
sl@0: 		}		
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioChannelsL(RArray<TUint>& aChannels) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aChannels, EMMFVideoGetSupportedAudioChannels);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::SetAudioSampleRate(const TUint aSampleRate)
sl@0: 	{
sl@0: 	TPckgBuf<TUint> configPackage;
sl@0: 	configPackage() = aSampleRate;
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoSetAudioSampleRate,
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetAudioSampleRate(TUint& aSampleRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TUint> configPackage;
sl@0:  	
sl@0: 	TInt err = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFVideoGetAudioSampleRate, 
sl@0: 										 KNullDesC8,
sl@0: 										 KNullDesC8,
sl@0: 										 configPackage);
sl@0: 
sl@0: 	if (!err)
sl@0: 		{
sl@0: 		aSampleRate = configPackage();
sl@0: 		}		
sl@0: 	return err;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::GetSupportedAudioSampleRatesL(RArray<TUint>& aSampleRates) const
sl@0: 	{
sl@0: 	DoGetUintArrayL(aSampleRates, EMMFVideoGetSupportedAudioSampleRates);
sl@0: 	}
sl@0: 
sl@0: void RMMFVideoAudioSamplingRateAndChannelConfigCustomCommands::DoGetUintArrayL(RArray<TUint>& aArray, TMMFVideoAudioSamplingRateAndChannelConfigMessages aIpc) const
sl@0: 	{
sl@0: 	aArray.Reset();
sl@0: 
sl@0: 	TPckgBuf<TInt> numberOfElementsPckg;
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 aIpc, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 numberOfElementsPckg));
sl@0: 
sl@0: 	HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TUint));
sl@0: 	TPtr8 ptr = buf->Des();
sl@0: 
sl@0: 	User::LeaveIfError(iController.CustomCommandSync(iDestinationPckg, 
sl@0: 													 EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData, 
sl@0: 													 KNullDesC8,
sl@0: 													 KNullDesC8,
sl@0: 													 ptr));
sl@0: 	RDesReadStream stream(ptr);
sl@0: 	stream.Open(ptr);
sl@0: 	CleanupClosePushL(stream);
sl@0: 
sl@0: 	for (TInt i=0; i<numberOfElementsPckg(); i++)
sl@0: 		{
sl@0: 		User::LeaveIfError(aArray.Append(stream.ReadUint32L()));
sl@0: 		}
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(2, buf);//stream, buf
sl@0: 	}
sl@0: 
sl@0: 		
sl@0: EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser* CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::NewL(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::~CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser()
sl@0: 	{
sl@0: 	if(iDataCopyBuffer)
sl@0: 		{
sl@0: 		delete iDataCopyBuffer;
sl@0: 		}	
sl@0: 	}
sl@0: 
sl@0: CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser(MMMFVideoAudioSamplingRateAndChannelConfigCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig),
sl@0: 	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoAudioSamplingRateAndChannelConfig)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 	
sl@0: void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoSetAudioChannels:
sl@0: 		complete = DoSetAudioChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetAudioChannels:
sl@0: 		complete = DoGetAudioChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetSupportedAudioChannels:
sl@0: 		complete = DoGetSupportedAudioChannelsL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoSetAudioSampleRate:
sl@0: 		complete = DoSetAudioSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetAudioSampleRate:
sl@0: 		complete = DoGetAudioSampleRateL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoGetSupportedAudioSampleRates:
sl@0: 		complete = DoGetSupportedAudioSampleRatesL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoAudioSamplingRateAndChannelConfigCopyArrayData:
sl@0: 		complete = DoCopyArrayDataL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);	
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: 
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TUint> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvasrccSetAudioChannelsL(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint channels = 0;
sl@0: 	iImplementor.MvasrccGetAudioChannelsL(channels);
sl@0: 	TPckgBuf<TUint> pckg;
sl@0: 	pckg() = channels;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioChannelsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> audioChannels;
sl@0: 	CleanupClosePushL(audioChannels);
sl@0: 	iImplementor.MvasrccGetSupportedAudioChannelsL(audioChannels);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(audioChannels);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = audioChannels.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(&audioChannels);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoSetAudioSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TUint> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvasrccSetAudioSampleRateL(pckg());
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetAudioSampleRateL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TUint sampleRate = 0;
sl@0: 	iImplementor.MvasrccGetAudioSampleRateL(sampleRate);
sl@0: 	TPckgBuf<TUint> pckg;
sl@0: 	pckg() = sampleRate;
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoGetSupportedAudioSampleRatesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	RArray<TUint> sampleRates;
sl@0: 	CleanupClosePushL(sampleRates);
sl@0: 	iImplementor.MvasrccGetSupportedAudioSampleRatesL(sampleRates);
sl@0: 
sl@0: 	DoCreateBufFromUintArrayL(sampleRates);
sl@0: 
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	pckg() = sampleRates.Count();
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 
sl@0: 	CleanupStack::PopAndDestroy(&sampleRates);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCreateBufFromUintArrayL(RArray<TUint>& aArray)
sl@0: 	{
sl@0: 	delete iDataCopyBuffer;
sl@0: 	iDataCopyBuffer = NULL;
sl@0: 
sl@0: 	iDataCopyBuffer = CBufFlat::NewL(KBufExpandSize8);
sl@0: 	RBufWriteStream stream;
sl@0: 	stream.Open(*iDataCopyBuffer);
sl@0: 	CleanupClosePushL(stream);
sl@0: 	for (TInt i=0;i<aArray.Count();i++)
sl@0: 		{
sl@0: 		stream.WriteUint32L(aArray[i]);
sl@0: 		}		
sl@0: 	CleanupStack::PopAndDestroy(&stream);
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoAudioSamplingRateAndChannelConfigCustomCommandParser::DoCopyArrayDataL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (!iDataCopyBuffer)
sl@0: 		{
sl@0: 		User::Leave(KErrNotReady);
sl@0: 		}		
sl@0: 	aMessage.WriteDataToClientL(iDataCopyBuffer->Ptr(0));
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser* CMMFVideoPlayControllerExtCustomCommandParser::NewL(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoPlayControllerExtCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoPlayControllerExtCustomCommandParser::~CMMFVideoPlayControllerExtCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFVideoPlayControllerExtCustomCommandParser::CMMFVideoPlayControllerExtCustomCommandParser(MMMFVideoPlayControllerExtCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoPlayExt),
sl@0: 	iImplementor(aImplementor)	
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPlayControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoPlayExt)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoPlayControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 		case EMMFVideoPlayControllerSetPlayVelocity:
sl@0: 			complete = DoSetPlayVelocityL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerPlayVelocity:
sl@0: 			complete = DoPlayVelocityL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerStepFrame:
sl@0: 			complete = DoStepFrameL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerGetPlayRateCapabilities:
sl@0: 			complete = DoGetPlayRateCapabilitiesL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerSetVideoEnabled:
sl@0: 			complete = DoSetVideoEnabledL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerVideoEnabled:
sl@0: 			complete = DoVideoEnabledL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerSetAudioEnabled:
sl@0: 			complete = DoSetAudioEnabledL(aMessage);
sl@0: 			break;
sl@0: 		case EMMFVideoPlayControllerSetAutoScale:
sl@0: 			complete = DoSetAutoScaleL(aMessage);
sl@0: 			break;
sl@0: 		default:
sl@0: 			User::Leave(KErrNotSupported);
sl@0: 			break;
sl@0: 		}
sl@0: 	
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetPlayVelocityL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpecSetPlayVelocityL(pckg());
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoPlayVelocityL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	
sl@0: 	pckg() = iImplementor.MvpecPlayVelocityL();
sl@0: 
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoStepFrameL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpecStepFrameL(pckg());
sl@0: 
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoGetPlayRateCapabilitiesL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TVideoPlayRateCapabilities> pckg;
sl@0: 	
sl@0: 	iImplementor.MvpecGetPlayRateCapabilitiesL(pckg());
sl@0: 
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpecSetVideoEnabledL(pckg());
sl@0: 	
sl@0: 	return ETrue;	
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;	
sl@0: 	
sl@0: 	pckg() = iImplementor.MvpecVideoEnabledL();
sl@0: 
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAudioEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpecSetAudioEnabledL(pckg());
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoPlayControllerExtCustomCommandParser::DoSetAutoScaleL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvpecSetAutoScaleL(pckg().iScaleType,pckg().iHorizPos , pckg().iVertPos );
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C RMMFVideoPlayControllerExtCustomCommands::RMMFVideoPlayControllerExtCustomCommands(RMMFController& aController) :
sl@0: RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoPlayExt)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetPlayVelocity(TInt aVelocity)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg(aVelocity);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerSetPlayVelocity, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::PlayVelocity(TInt &aVelocity) const
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;	
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerPlayVelocity, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (error == KErrNone)
sl@0: 		{	
sl@0: 		aVelocity = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::StepFrame(TInt aStep)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg(aStep);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerStepFrame, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::GetPlayRateCapabilities(TVideoPlayRateCapabilities& aCapabilities) const
sl@0: 	{
sl@0: 	TPckgBuf<TVideoPlayRateCapabilities> pckg;	
sl@0: 	TInt error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerGetPlayRateCapabilities, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (!error)
sl@0: 		{
sl@0: 		aCapabilities = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetVideoEnabled(TBool aVideoEnabled)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg(aVideoEnabled);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerSetVideoEnabled, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::VideoEnabled(TBool &aVideoEnabled) const
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;	
sl@0: 	TInt error =  iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerVideoEnabled, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (error == KErrNone)
sl@0: 		{
sl@0: 		aVideoEnabled = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAudioEnabled(TBool aAudioEnabled)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg(aAudioEnabled);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerSetAudioEnabled, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoPlayControllerExtCustomCommands::SetAutoScale(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFVideoPlayAutoScaleParams> pckg;	
sl@0: 
sl@0: 	pckg().iScaleType = aScaleType;
sl@0: 	pckg().iHorizPos = aHorizPos;
sl@0: 	pckg().iVertPos = aVertPos;
sl@0: 	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoPlayControllerSetAutoScale, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser* CMMFVideoRecordControllerExtCustomCommandParser::NewL(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFVideoRecordControllerExtCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFVideoRecordControllerExtCustomCommandParser::~CMMFVideoRecordControllerExtCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: CMMFVideoRecordControllerExtCustomCommandParser::CMMFVideoRecordControllerExtCustomCommandParser(MMMFVideoRecordControllerExtCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFVideoRecorderExt),
sl@0: 	iImplementor(aImplementor)	
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoRecordControllerExtCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFVideoRecorderExt)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);	
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFVideoRecordControllerExtCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFVideoRecordControllerSetVideoEnabled:
sl@0: 		complete = DoSetVideoEnabledL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerVideoEnabled:
sl@0: 		complete = DoVideoEnabledL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetVideoQuality:
sl@0: 		complete = DoSetVideoQualityL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerVideoQuality:
sl@0: 		complete = DoVideoQualityL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerSetVideoFrameRateFixed:
sl@0: 		complete = DoSetVideoFrameRateFixedL(aMessage);
sl@0: 		break;
sl@0: 	case EMMFVideoRecordControllerVideoFrameRateFixed:
sl@0: 		complete = DoVideoFrameRateFixedL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrecSetVideoEnabledL(pckg());
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoEnabledL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;	
sl@0: 	
sl@0: 	pckg() = iImplementor.MvrecVideoEnabledL();
sl@0: 	
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoQualityL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrecSetVideoQualityL(pckg());
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoQualityL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;
sl@0: 	
sl@0: 	pckg() = iImplementor.MvrecVideoQualityL();
sl@0: 	
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoSetVideoFrameRateFixedL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	iImplementor.MvrecSetVideoFrameRateFixedL(pckg());
sl@0: 	
sl@0: 	return ETrue;	
sl@0: 	}
sl@0: 	
sl@0: TBool CMMFVideoRecordControllerExtCustomCommandParser::DoVideoFrameRateFixedL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;	
sl@0: 	
sl@0: 	pckg() = iImplementor.MvrecVideoFrameRateFixedL();
sl@0: 	
sl@0: 	aMessage.WriteDataToClientL(pckg);
sl@0: 	return ETrue;
sl@0: 	}
sl@0: 
sl@0: 
sl@0: EXPORT_C RMMFVideoRecordControllerExtCustomCommands::RMMFVideoRecordControllerExtCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFVideoRecorderExt)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoEnabled(TBool aEnabled)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg(aEnabled);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerSetVideoEnabled, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoEnabled(TBool &aEnabled) const
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg(EFalse);	
sl@0: 	TInt error;
sl@0: 
sl@0: 	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerVideoEnabled, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (error == KErrNone)
sl@0: 		{
sl@0: 		aEnabled = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoQuality(TInt aQuality)
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg(aQuality);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerSetVideoQuality, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoQuality(TInt &aQuality) const
sl@0: 	{
sl@0: 	TPckgBuf<TInt> pckg;	
sl@0: 	TInt error;
sl@0: 
sl@0: 	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerVideoQuality, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (error == KErrNone)
sl@0: 		{
sl@0: 		aQuality = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::SetVideoFrameRateFixed(TBool aFixedFrameRate)
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg(aFixedFrameRate);	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerSetVideoFrameRateFixed, 
sl@0: 												pckg,
sl@0: 												KNullDesC8);
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TInt RMMFVideoRecordControllerExtCustomCommands::VideoFrameRateFixed(TBool &aFixedFrameRate) const
sl@0: 	{
sl@0: 	TPckgBuf<TBool> pckg;	
sl@0: 	TInt error;
sl@0: 
sl@0: 	error = iController.CustomCommandSync(iDestinationPckg, 
sl@0: 												EMMFVideoRecordControllerVideoFrameRateFixed, 
sl@0: 												KNullDesC8,
sl@0: 												KNullDesC8,
sl@0: 												pckg);
sl@0: 	if (error == KErrNone)
sl@0: 		{
sl@0: 		aFixedFrameRate = pckg();
sl@0: 		}
sl@0: 	return error;
sl@0: 	}
sl@0: 
sl@0: EXPORT_C TMMFAudioSetRepeatsConfig::TMMFAudioSetRepeatsConfig()
sl@0: 	:iRepeatNumberOfTimes(0), iTrailingSilence(0), iReserved1(0)
sl@0: 	{
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C RMMFAudioPlayControllerSetRepeatsCustomCommands::RMMFAudioPlayControllerSetRepeatsCustomCommands(RMMFController& aController) :
sl@0: 	RMMFCustomCommandsBase(aController, KUidInterfaceMMFAudioPlaySetRepeatsController)
sl@0: 	{
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C TInt RMMFAudioPlayControllerSetRepeatsCustomCommands::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioSetRepeatsConfig> configPackage;
sl@0: 	configPackage().iRepeatNumberOfTimes = aRepeatNumberOfTimes;
sl@0: 	configPackage().iTrailingSilence = aTrailingSilence;
sl@0: 	
sl@0: 	return iController.CustomCommandSync(iDestinationPckg, 
sl@0: 										 EMMFAudioPlayControllerSetRepeats, 
sl@0: 										 configPackage,
sl@0: 										 KNullDesC8);
sl@0: 	}
sl@0: 	
sl@0: EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser* CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor)
sl@0: 	{
sl@0: 	return new(ELeave) CMMFAudioPlayControllerSetRepeatsCustomCommandParser(aImplementor);
sl@0: 	}
sl@0: 
sl@0: CMMFAudioPlayControllerSetRepeatsCustomCommandParser::CMMFAudioPlayControllerSetRepeatsCustomCommandParser(MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor& aImplementor) :
sl@0: 	CMMFCustomCommandParserBase(KUidInterfaceMMFAudioPlaySetRepeatsController),	iImplementor(aImplementor)
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: EXPORT_C CMMFAudioPlayControllerSetRepeatsCustomCommandParser::~CMMFAudioPlayControllerSetRepeatsCustomCommandParser()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::HandleRequest(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	if (aMessage.Destination().InterfaceId() == KUidInterfaceMMFAudioPlaySetRepeatsController)
sl@0: 		{
sl@0: 		TRAPD(error, DoHandleRequestL(aMessage));
sl@0: 		if (error)
sl@0: 			{
sl@0: 			aMessage.Complete(error);
sl@0: 			}
sl@0: 		}
sl@0: 	else
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNotSupported);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: void CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoHandleRequestL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TBool complete = ETrue;
sl@0: 	switch (aMessage.Function())
sl@0: 		{
sl@0: 	case EMMFAudioPlayControllerSetRepeats:
sl@0: 		complete = DoSetRepeatsL(aMessage);
sl@0: 		break;
sl@0: 	default:
sl@0: 		User::Leave(KErrNotSupported);
sl@0: 		break;
sl@0: 		}
sl@0: 	if (complete)
sl@0: 		{
sl@0: 		aMessage.Complete(KErrNone);
sl@0: 		}
sl@0: 	}
sl@0: 
sl@0: TBool CMMFAudioPlayControllerSetRepeatsCustomCommandParser::DoSetRepeatsL(TMMFMessage& aMessage)
sl@0: 	{
sl@0: 	TPckgBuf<TMMFAudioSetRepeatsConfig> pckg;
sl@0: 	aMessage.ReadData1FromClientL(pckg);
sl@0: 	User::LeaveIfError(iImplementor.MapcSetRepeats(pckg().iRepeatNumberOfTimes, pckg().iTrailingSilence));
sl@0: 	return ETrue;
sl@0: 	}