Add CMdaAudioPlayerUtility support to the mediaclientaudio.dll stub.
authormarkw <markw@symbian.org>
Wed, 17 Nov 2010 15:47:05 +0000
changeset 129 4a58d534bdaa
parent 128 8338c5c25b5b
child 130 40dccd6dd558
Add CMdaAudioPlayerUtility support to the mediaclientaudio.dll stub. Remove mmfclientutility files as not needed.
breakdeps/MediaClientAudio.mmp
breakdeps/mmfclientaudioplayer.cpp
breakdeps/mmfclientaudioplayer.h
breakdeps/mmfclientutility.cpp
breakdeps/mmfclientutility.h
eabi/MediaClientAudio.def
--- a/breakdeps/MediaClientAudio.mmp	Fri Nov 12 12:01:15 2010 +0000
+++ b/breakdeps/MediaClientAudio.mmp	Wed Nov 17 15:47:05 2010 +0000
@@ -37,9 +37,10 @@
 // Real source			/sf/os/mm/mmlibs/mmfw/src/Client/Audio/mmfclienttoneplayer.cpp 
 SOURCEPATH		.
 source			mmfclienttoneplayer.cpp 
-//source			mmfclientaudioplayer.cpp 
+source			mmfclientaudioplayer.cpp 
  	
-library			euser.lib 
+library			euser.lib
+library			ecom.lib
 
 #ifdef EABI
 DEFFILE MediaClientAudio.def
--- a/breakdeps/mmfclientaudioplayer.cpp	Fri Nov 12 12:01:15 2010 +0000
+++ b/breakdeps/mmfclientaudioplayer.cpp	Wed Nov 17 15:47:05 2010 +0000
@@ -17,10 +17,10 @@
 #include <utf.h>
 #include <mmf/common/mmfpaniccodes.h>
 #include "mmfclientaudioplayer.h"
-#include "mmfclientutility.h"
+//#include "mmfclientutility.h"
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
-#include <mmf/common/mmfdurationinfocustomcommandsenums.h>
+//#include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
+//#include <mmf/common/mmfdurationinfocustomcommandsenums.h>
 #endif
 
 using namespace ContentAccess;
@@ -440,8 +440,9 @@
 	{
 	ASSERT(iProperties);
 	RFile& file = const_cast<RFile&>(aFile);
-	TMMFileHandleSource tfs(file, KDefaultContentObject, EPlay);
-	iProperties->OpenFileL(tfs);
+	//TMMFileHandleSource tfs(file, KDefaultContentObject, EPlay);
+	TMMFileHandleSource * tfs;
+	iProperties->OpenFileL(*tfs);
 	}
 
 /**
@@ -1019,8 +1020,9 @@
 	CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
 	CleanupStack::PushL(self);
 	self->ConstructL();
-	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
-	self->OpenFileL(filesource);
+	//TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
+	TMMFileSource * filesource;
+	self->OpenFileL(*filesource);
 	CleanupStack::Pop(self);
 	return self;
 	}
@@ -1047,29 +1049,30 @@
 
 void CMMFMdaAudioPlayerUtility::UseSharedHeap()
 	{
-	iFindAndOpenController->UseSharedHeap();
+	//iFindAndOpenController->UseSharedHeap();
 	}
 
 // CMMFMdaAudioPlayerUtility
 CMMFMdaAudioPlayerUtility::~CMMFMdaAudioPlayerUtility()
 	{
 	
-	delete iControllerImplementationInformation;
+	//delete iControllerImplementationInformation;
 	delete iAsyncCallBack;
-	delete iRepeatTrailingSilenceTimer;
-	delete iFindAndOpenController;
-	delete iControllerEventMonitor;
-	iMediaIds.Close();
-	iController.Close();
+	//delete iRepeatTrailingSilenceTimer;
+	//delete iFindAndOpenController;
+	//delete iControllerEventMonitor;
+	//iMediaIds.Close();
+	//iController.Close();
 	}
 
 CMMFMdaAudioPlayerUtility::CMMFMdaAudioPlayerUtility(MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref) :
-	iCallback(aCallback),
-	iAudioPlayDeviceCommands(iController),
-	iAudioPlayControllerCommands(iController),
-	iNotificationRegistrationCommands(iController),
-	iDRMCustomCommands(iController),
-	iAudioPlayControllerSetRepeatsCommands(iController)
+    CTimer(EPriorityHigh),
+	iCallback(aCallback)
+//	iAudioPlayDeviceCommands(iController),
+//	iAudioPlayControllerCommands(iController),
+//	iNotificationRegistrationCommands(iController)
+//	iDRMCustomCommands(iController)
+//	iAudioPlayControllerSetRepeatsCommands(iController)
 	{
 	iState = EStopped;
 	iPrioritySettings.iPriority = aPriority;
@@ -1082,15 +1085,17 @@
 
 void CMMFMdaAudioPlayerUtility::ConstructL()
 	{
-	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
-	iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this);
+	//iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
+	//iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this);
 	iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback);
-	User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
-	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
-	iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
-	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
+	//User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
+	//iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
+	//iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
+	//iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
+	iAsyncCallBack->InitComplete(KErrNone, 500000);
 	}
 
+#if 0
 void CMMFMdaAudioPlayerUtility::MfaocComplete(		
 		TInt& aError, 
 		RMMFController* /*aController*/,
@@ -1130,7 +1135,7 @@
 	
 	iAsyncCallBack->InitComplete(aError, iDuration);
 	}
-
+#endif
 /**
 	Open an audio clip from a file
 	@param "const TFileSource& aFileSource" "the file to open"
@@ -1139,8 +1144,9 @@
 */
 void CMMFMdaAudioPlayerUtility::OpenFileL(const TDesC& aFileName)
 	{
-	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
-	OpenFileL(filesource);
+	//TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
+	TMMFileSource * filesource;
+	OpenFileL(*filesource);
 	}
 	
 /**
@@ -1153,8 +1159,9 @@
 void CMMFMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
 	{
 	RFile& file = const_cast<RFile&>(aFile);
-	TMMFileHandleSource filesource(file, KDefaultContentObject, EPlay);
-	OpenFileL(filesource);
+	//TMMFileHandleSource filesource(file, KDefaultContentObject, EPlay);
+	TMMFileHandleSource * filesource;
+	OpenFileL(*filesource);
 	}
 
 void CMMFMdaAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
@@ -1163,7 +1170,7 @@
 	// that a previous request to Open...(...) has completed.
 	if (iAsyncCallBack->IsActive())
 		User::Leave(KErrNotReady);
-	
+#if 0	
 	if (aSource.SourceType()==KUidMMFileHandleSource)
 		{
 		RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle();
@@ -1181,6 +1188,7 @@
 		}
 
 	iFindAndOpenController->OpenByFileSource(aSource);
+#endif
 	}
 
 /**
@@ -1195,12 +1203,13 @@
 	// that a previous request to Open...(...) has completed.
 	if (iAsyncCallBack->IsActive())
 		User::Leave(KErrInUse);
-
+#if 0
 	iFindAndOpenController->ConfigureSourceSink(
 		CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource,
 													CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)),
 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
 	iFindAndOpenController->OpenByDescriptor(aDescriptor);
+#endif
 	}
 
 /**
@@ -1215,7 +1224,7 @@
 	// that a previous request to Open...(...) has completed.
 	if (iAsyncCallBack->IsActive())
 		User::Leave(KErrInUse);
-
+#if 0
 	CBufFlat* urlCfgBuffer = NULL;
 	CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
 	
@@ -1224,6 +1233,7 @@
 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
 	iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
 	delete urlCfgBuffer;
+#endif
 	}
 
 /**
@@ -1252,7 +1262,7 @@
 		iAsyncCallBack->PlayComplete(KErrNotReady);
 		return;
 		}
-
+#if 0
 	// cancel the repeat timer in case the client has called Play()
 	// without waiting for the previous play to complete
 	iRepeatTrailingSilenceTimer->Cancel();	
@@ -1272,12 +1282,13 @@
 			//we revert back to playerutility's loop play implementation in that case
 			}
 		}
-
+#endif
 	DoPlay();
 	}
 
 void CMMFMdaAudioPlayerUtility::DoPlay()
 	{
+#if 0
 #if defined(__AUDIO_PROFILING)
 	RDebug::ProfileStart(4);
 #endif  // defined(__AUDIO_PROFILING)
@@ -1345,6 +1356,9 @@
 			iAsyncCallBack->PlayComplete(err);
 			}
 		}
+#endif
+	iState = EPlaying;
+	After(500000);
 	}
 
 /**
@@ -1373,9 +1387,9 @@
 		{
 		// cancel the repeat timer in case the client has called Stop()
 		// during the trailing silence period
-		iRepeatTrailingSilenceTimer->Cancel();	
+		//iRepeatTrailingSilenceTimer->Cancel();	
 
-		iController.Stop();
+		//iController.Stop();
 		iPosition = iPlayStart;	
 		iState = EStopped;	
 		}
@@ -1391,6 +1405,7 @@
 TInt CMMFMdaAudioPlayerUtility::Pause()
 	{
 	TInt err = KErrNone;
+#if 0
 	if(iRepeatTrailingSilenceTimer->IsActive())
 		{
 		iRepeatTrailingSilenceTimer->Cancel();
@@ -1405,6 +1420,8 @@
 			err = iController.GetPosition(iPosition);
 		iState = EPaused;
 		}
+#endif
+	iState = EPaused;
 	return err;
 	}
 
@@ -1418,6 +1435,7 @@
 	{
 	// Reset the audio player state.
 	Stop();
+#if 0
 	iControllerEventMonitor->Cancel();
 	iController.Close();
 	if (iFindAndOpenController)	
@@ -1428,9 +1446,21 @@
 		iControllerImplementationInformation = NULL;
 		}
 	iControllerUid = KNullUid;
+#endif
 	}
 
-
+void CMMFMdaAudioPlayerUtility::RunL()
+	{
+	switch(iState)
+		{
+		case EPlaying:
+			iAsyncCallBack->PlayComplete(KErrNone);
+			break;
+		default:
+			// do nothing
+			break;
+		}
+	}
 /**
 Changes the current playback volume to a specified value.
 
@@ -1451,6 +1481,8 @@
 */
 TInt CMMFMdaAudioPlayerUtility::SetVolume(TInt aVolume)
 	{
+	TInt err = KErrNone;
+#if 0
 	TInt err = iAudioPlayDeviceCommands.SetVolume(aVolume);
 	if (err == KErrArgument)
 		{
@@ -1465,7 +1497,7 @@
 			}
 		err = iAudioPlayDeviceCommands.SetVolume(aVolume);			
 		}
-
+#endif
 	return err;
 	}
 
@@ -1492,6 +1524,7 @@
 */
 void CMMFMdaAudioPlayerUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
 	{
+#if 0
 	TInt err = iAudioPlayControllerSetRepeatsCommands.SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
 	
 	if(err!=KErrNone)
@@ -1499,6 +1532,7 @@
 		iNumberOfTimesToRepeat = aRepeatNumberOfTimes;
 		iTrailingSilence = aTrailingSilence;
 		}
+#endif
 	}
 
 /**
@@ -1517,16 +1551,19 @@
 */
 void CMMFMdaAudioPlayerUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
 	{
-	iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration);
+	//iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration);
 	}
 
 TInt CMMFMdaAudioPlayerUtility::SetPriority(TInt aPriority, TInt aPref)
 	{
+	return KErrNone;
+#if 0
 	iPrioritySettings.iPref = aPref;
 	iPrioritySettings.iPriority = aPriority;
 	iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
 
 	return iController.SetPrioritySettings(iPrioritySettings);
+#endif
 	}
 
 /**
@@ -1538,11 +1575,14 @@
 */
 const TTimeIntervalMicroSeconds& CMMFMdaAudioPlayerUtility::Duration()
 	{
+#if 0
 	TInt err = iController.GetDuration(iDuration);
 	if (err)
 		{
 		iDuration = 0;
 		}
+#endif
+	iDuration = 500000;
 	return iDuration;
 	}
 	
@@ -1557,6 +1597,7 @@
 */	
 TMMFDurationInfo CMMFMdaAudioPlayerUtility::Duration(TTimeIntervalMicroSeconds& aDuration)
 {	
+#if 0
 	TPckgBuf<TMMFDurationInfo> pckg;
 	TMMFDurationInfo result = EMMFDurationInfoValid;
 	
@@ -1588,6 +1629,8 @@
 	// This is the intended behaviour regardless of what value err has
 	aDuration = Duration();
 	return result;
+#endif
+	return EMMFDurationInfoValid;
 }	
 	
 /**
@@ -1604,15 +1647,18 @@
 */
 TInt CMMFMdaAudioPlayerUtility::MaxVolume()
 	{
-	TInt maxVolume = 0;
+	TInt maxVolume = 100;
+#if 0
 #ifdef _DEBUG
 	TInt error = 
 #endif
 		iAudioPlayDeviceCommands.GetMaxVolume(maxVolume);
 	__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
+#endif
 	return maxVolume;
 	}
 
+#if 0
 void CMMFMdaAudioPlayerUtility::HandleEvent(const TMMFEvent& aEvent)
 	{
 	// handle loading started/complete messages first, as the later code does not explicitly check the event type
@@ -1703,9 +1749,11 @@
 	// else we have an unexpected event that cannot be dealt with by the client.
 	// We will simply ignore this.
 	}
+#endif
 
 void CMMFMdaAudioPlayerUtility::PlaySilence()
 	{
+#if 0
 	// iRepeatTrailingSilenceTimer->After() takes a TTimeIntervalMicroSeconds32
 	// so for longer periods of silence call it repeatedly with KMaxTInt lengths
 	TTimeIntervalMicroSeconds32 silence;
@@ -1720,8 +1768,10 @@
 		iTrailingSilenceLeftToPlay = 0;
 		}
 	iRepeatTrailingSilenceTimer->After(silence);
+#endif
 	}
 
+#if 0
 void CMMFMdaAudioPlayerUtility::RepeatTrailingSilenceTimerComplete()
 	{
 	if (iTrailingSilenceLeftToPlay.Int64() > 0)
@@ -1735,6 +1785,7 @@
 		DoPlay();
 		}
 	}
+#endif
 
 /**
  *
@@ -1750,7 +1801,8 @@
 	{
 	TInt error = KErrNone;
 	if (iState==EPlaying)
-		error = iController.GetPosition(iPosition);
+		aPosition = 250000;
+//		error = iController.GetPosition(iPosition);
 	aPosition = iPosition;
 	return error;
 	}
@@ -1769,6 +1821,7 @@
  */
 void CMMFMdaAudioPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
 	{
+#if 0
 	// Clip the position if aPosition is greater than the duration
 	// or if aPosition is negative.
 	const TTimeIntervalMicroSeconds maxPosition(Duration());
@@ -1789,6 +1842,7 @@
 //		{
 //		Stop();	// We call stop so that DevSound's internal buffers are reset
 //		}
+#endif
 	}
 
 /**
@@ -1803,8 +1857,12 @@
 */
 TInt CMMFMdaAudioPlayerUtility::GetVolume(TInt& aVolume)
 	{
+#if 0
 	TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume);
 	return error;
+#endif
+	aVolume = 50;
+	return KErrNone;
 	}
 
 /**
@@ -1819,8 +1877,12 @@
  */
 TInt CMMFMdaAudioPlayerUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries) 
 	{
+#if 0
 	TInt error = iController.GetNumberOfMetaDataEntries(aNumEntries);
 	return error;
+#endif
+	aNumEntries = 0;
+	return KErrNone;
 	}
 
 /**
@@ -1839,7 +1901,11 @@
  */
 CMMFMetaDataEntry* CMMFMdaAudioPlayerUtility::GetMetaDataEntryL(TInt aMetaDataIndex)
 	{
+#if 0
 	return iController.GetMetaDataEntryL(aMetaDataIndex);
+#endif
+	User::Leave(KErrNotSupported);
+	return NULL;
 	}
 
 /**
@@ -1859,7 +1925,7 @@
 											  const TTimeIntervalMicroSeconds& aPlayEnd)
 	{
 	TInt error = KErrNone;
-
+#if 0
 	if (aPlayStart >= TTimeIntervalMicroSeconds(0) &&
 		aPlayStart < iDuration &&
 			aPlayStart < aPlayEnd &&
@@ -1874,7 +1940,7 @@
 		}
 	else
 		error = KErrArgument;
-
+#endif
 	return error;
 	}
 	
@@ -1890,12 +1956,12 @@
 	{
 	// clear play window start - very important because this is assigned 
 	// to iPosition when we stop & is used to set the position on the next Play()
-	iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0);
+	//iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0);
 
-	iPlayWindowSet = EClear;
+	//iPlayWindowSet = EClear;
 	TInt err = KErrNone;
-	if (iState==EPlaying)
-		err = iAudioPlayControllerCommands.DeletePlaybackWindow();
+	//if (iState==EPlaying)
+		//err = iAudioPlayControllerCommands.DeletePlaybackWindow();
 	return err;
 	}
 
@@ -1912,8 +1978,9 @@
 */
 TInt CMMFMdaAudioPlayerUtility::SetBalance(TInt aBalance)
 	{
-	TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance);
-	return err;
+	//TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance);
+	//return err;
+	return KErrNone;
 	}
 
 /**
@@ -1928,13 +1995,15 @@
 */
 TInt CMMFMdaAudioPlayerUtility::GetBitRate(TUint& aBitRate)
 	{
-	RMMFAudioControllerCustomCommands controller(iController);
-	TInt err = controller.GetSourceBitRate(aBitRate);
-	return err;	
+	//RMMFAudioControllerCustomCommands controller(iController);
+	//TInt err = controller.GetSourceBitRate(aBitRate);
+	//return err;
+	return KErrNone;
 	}
 
 const CMMFControllerImplementationInformation& CMMFMdaAudioPlayerUtility::ControllerImplementationInformationL()
 	{
+#if 0
 	if (!iControllerImplementationInformation)
 		{
 		if (iControllerUid==KNullUid)
@@ -1942,31 +2011,37 @@
 		iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid);
 		}
 	return *iControllerImplementationInformation;
+#endif
+	User::Leave(KErrNotSupported);
+	return *iControllerImplementationInformation;
 	}
 	
 void CMMFMdaAudioPlayerUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress)
 	{
-	User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress));
+	//User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress));
+	User::Leave(KErrNotSupported);
 	}
 	
 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
 	{
-	return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
+	//return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
+	return KErrNotSupported;
 	}
 	
 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
 	{
-	return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
+	//return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
+	return KErrNotSupported;
 	}
 	
 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
 	{
-	iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
+	//iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
 	}
 	
 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
 	{
-	iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
+	//iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
 	}
 
 /**
@@ -1981,12 +2056,15 @@
 */
 TInt CMMFMdaAudioPlayerUtility::GetBalance(TInt& aBalance)
 	{
-	TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance);
-	return err;
+	//TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance);
+	//return err;
+	aBalance = KMMFBalanceMaxLeft;
+	return KErrNone;
 	}
 	
 MMMFDRMCustomCommand* CMMFMdaAudioPlayerUtility::GetDRMCustomCommand()
 	{
+#if 0
 	// TODO: check controller supports MMMFDRMCustomCommandImplementor
 	if (iDRMCustomCommands.IsSupported())
 		{
@@ -1996,6 +2074,8 @@
 		{
 		return NULL;
 		}
+#endif
+	return NULL;
 	}
 	
 void CMMFMdaAudioPlayerUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver)
@@ -2007,6 +2087,7 @@
 																	TUid aNotificationEventUid,
 																	const TDesC8& aNotificationRegistrationData)
 	{
+#if 0
 	iAudioResourceNotificationCallBack = &aCallback;
 	TInt err = iNotificationRegistrationCommands.RegisterAsClient(aNotificationEventUid, aNotificationRegistrationData);
 	if(err == KErrNotReady)
@@ -2018,10 +2099,13 @@
 	iNotificationDataHolder = KNullDesC8;
 	iEventHolder = KNullUid;
 	return err;
+#endif
+	return KErrNotSupported;
 	}
 
 TInt CMMFMdaAudioPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventId)
 	{
+#if 0
 	TInt err = iNotificationRegistrationCommands.CancelRegisterAsClient(aNotificationEventId);
 	if(err == KErrNotReady)
 		{
@@ -2038,16 +2122,20 @@
 		return KErrNone;
 		}
 	return err;
+#endif
+	return KErrNotSupported;
 	}
 	
 TInt CMMFMdaAudioPlayerUtility::WillResumePlay()
 	{
-	return iNotificationRegistrationCommands.WillResumePlay();
+	//return iNotificationRegistrationCommands.WillResumePlay();
+	return KErrNone;
 	}
 	
 TInt CMMFMdaAudioPlayerUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
 	{
-	return iController.SetThreadPriority(aThreadPriority);
+	//return iController.SetThreadPriority(aThreadPriority);
+	return KErrNone;
 	}
 	
 CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs)
--- a/breakdeps/mmfclientaudioplayer.h	Fri Nov 12 12:01:15 2010 +0000
+++ b/breakdeps/mmfclientaudioplayer.h	Wed Nov 17 15:47:05 2010 +0000
@@ -20,16 +20,16 @@
 #include <e32std.h>
 #include <e32base.h>
 #include <mdaaudiosampleplayer.h>
-#include <mmf/common/mmfcontroller.h>
+//#include <mmf/common/mmfcontroller.h>
 #include <mmf/server/mmffile.h>
 #include <mmf/server/mmfdes.h>
-#include <mmfcontrollerimplementationuids.hrh>
-#include <mmf/common/mmfstandardcustomcommands.h>
-#include <mmf/common/mmfdrmcustomcommands.h>
-#include "mmfclientutility.h"
-#include <mmf/common/mmfdurationinfocustomcommands.h>
+//#include <mmfcontrollerimplementationuids.hrh>
+//#include <mmf/common/mmfstandardcustomcommands.h>
+//#include <mmf/common/mmfdrmcustomcommands.h>
+//#include "mmfclientutility.h"
+//#include <mmf/common/mmfdurationinfocustomcommands.h>
 
-static const TUid KUidMmfAudioController = {KMmfUidControllerAudio}; 
+//static const TUid KUidMmfAudioController = {KMmfUidControllerAudio}; 
 
 /**
 Mixin class to allow notification that the timed silence has finished.
@@ -87,15 +87,17 @@
 Concrete implementation of the CMdaAudioPlayerUtility API.
 @see CMdaAudioPlayerUtility
 */
-class CMMFMdaAudioPlayerUtility;
+/*class CMMFMdaAudioPlayerUtility;
 NONSHARABLE_CLASS( CMMFMdaAudioPlayerUtility ): public CBase, 
 								  				public MMMFControllerEventMonitorObserver,
 								  				public MRepeatTrailingSilenceTimerObs,
 								  				public MMMFFindAndOpenControllerObserver
+*/
+class CMMFMdaAudioPlayerUtility;
+NONSHARABLE_CLASS( CMMFMdaAudioPlayerUtility ): public CTimer 
 	{
 friend class CMdaAudioPlayerUtility;
 // friends for Unit testing only
-friend class CTestStepUnitMMFAudClient;
 
 public:
 	enum TMMFAudioPlayerState
@@ -181,20 +183,7 @@
 	TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;
 	
 	TMMFDurationInfo Duration(TTimeIntervalMicroSeconds& aDuration);
-	
-	// from MMMFControllerEventMonitorObserver
-	virtual void HandleEvent(const TMMFEvent& aEvent);
-	// from MRepeatTrailingSilenceTimerObs
-	virtual void RepeatTrailingSilenceTimerComplete();
-
-	// from MMMFFindAndOpenControllerObserver 
-	virtual void MfaocComplete(
-		TInt& aError, 
-		RMMFController* aController, 
-		TUid aControllerUid, 
-		TMMFMessageDestination* aSourceHandle, 
-		TMMFMessageDestination* aSinkHandle);
-
+	void RunL();
 protected:
 	CMMFMdaAudioPlayerUtility(MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref);
 	void ConstructL();
@@ -216,7 +205,7 @@
 	CMMFMdaAudioPlayerCallBack* iAsyncCallBack;
 	MAudioLoadingObserver* iLoadingObserver;
 	MMMFAudioResourceNotificationCallback* iAudioResourceNotificationCallBack;
-	RMMFController iController;
+	//RMMFController iController;
 	CMMFControllerEventMonitor* iControllerEventMonitor;
 	TMMFAudioPlayerState iState;
 	TTimeIntervalMicroSeconds iDuration; // Needed because of api "Duration()" that returns a reference
@@ -229,15 +218,15 @@
 	CRepeatTrailingSilenceTimer* iRepeatTrailingSilenceTimer;
 
 	// Source and sink handle info
-	TMMFMessageDestination iSourceHandle;
-	TMMFMessageDestination iSinkHandle;
+	//TMMFMessageDestination iSourceHandle;
+	//TMMFMessageDestination iSinkHandle;
 
 	// Custom command handlers
-	RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands;
-	RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCommands;
-	RMMFResourceNotificationCustomCommands iNotificationRegistrationCommands;
-	RMMFDRMCustomCommands iDRMCustomCommands;
-	RMMFAudioPlayControllerSetRepeatsCustomCommands iAudioPlayControllerSetRepeatsCommands;
+	//RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands;
+	//RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCommands;
+	//RMMFResourceNotificationCustomCommands iNotificationRegistrationCommands;
+	//RMMFDRMCustomCommands iDRMCustomCommands;
+	//RMMFAudioPlayControllerSetRepeatsCustomCommands iAudioPlayControllerSetRepeatsCommands;
 	
 	// Current playback time so we can resume from where we were stopped
 	TTimeIntervalMicroSeconds iPosition;
@@ -252,7 +241,7 @@
 	TUid iControllerUid;
 
 	// utility class to find and open a suitable controller asynchronously
-	CMMFFindAndOpenController* iFindAndOpenController;
+	//CMMFFindAndOpenController* iFindAndOpenController;
 	TUid iEventHolder;
 	TBuf8<256> iNotificationDataHolder;
 	TBool iRepeatCancelled;
--- a/breakdeps/mmfclientutility.cpp	Fri Nov 12 12:01:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2531 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Audio, MIDI and Video client utility functions.
-// 
-//
-
-#include <e32std.h>
-#include <f32file.h>
-#include <bautils.h>
-#include <mmf/server/mmfdrmpluginserverproxy.h>
-#include <caf/content.h>
-#include <caf/data.h>
-using namespace ContentAccess;
-
-#include "mmfclientutility.h"
-#include <mmf/common/mmfpaniccodes.h>
-
-const TInt KMaxMimeLength = 256;
-const TInt KMaxHeaderSize = 256;
-const TInt KExpandSize = 100;
-
-#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
-	const TInt KDefaultScreenNo = 0;
-#endif
-
-void CUPanic(TInt aCUPanicCode)
-	{
-	_LIT(KMMFMediaClientUtilityPaanicCategory, "MMFClientUtility");
-	User::Panic(KMMFMediaClientUtilityPaanicCategory, aCUPanicCode);
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C TUid CMMFClientUtility::ConvertMdaFormatUidToECOMWrite(TUid aMdaFormatUid)
-	{
-	TUid ECOMUid = KNullUid;
-	if (aMdaFormatUid == KUidMdaClipFormatWav)	
-		ECOMUid = TUid::Uid(KMmfUidFormatWAVWrite);
-	else if (aMdaFormatUid == KUidMdaClipFormatAu)	
-		ECOMUid = TUid::Uid(KMmfUidFormatAUWrite);
-	else if (aMdaFormatUid == KUidMdaClipFormatRawAudio)	
-		ECOMUid = TUid::Uid(KMmfUidFormatRAWWrite);
-	else if (aMdaFormatUid == KUidMdaClipFormatRawAmr)	
-		ECOMUid = TUid::Uid(KAdvancedUidFormatAMRWrite);
-
-	return ECOMUid;
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C TUid CMMFClientUtility::ConvertMdaFormatUidToECOMRead(TUid aMdaFormatUid)
-	{
-	TUid ECOMUid = KNullUid;
-	if (aMdaFormatUid == KUidMdaClipFormatWav)	
-		ECOMUid = TUid::Uid(KMmfUidFormatWAVRead);
-	else if (aMdaFormatUid == KUidMdaClipFormatAu)	
-		ECOMUid = TUid::Uid(KMmfUidFormatAURead);
-	else if (aMdaFormatUid == KUidMdaClipFormatRawAudio)	
-		ECOMUid = TUid::Uid(KMmfUidFormatRAWRead);
-	else if (aMdaFormatUid == KUidMdaClipFormatRawAmr)	
-		ECOMUid = TUid::Uid(KAdvancedUidFormatAMRRead);
-
-	return ECOMUid;
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C TInt CMMFClientUtility::GetFileHeaderData(const TDesC& aFileName, TDes8& aHeaderData, TInt aMaxLength)
-	{
-	RFs fsSession;
-	RFile file;
-	TInt error = KErrNone;
-
-	if ((error = fsSession.Connect()) == KErrNone)
-		{
-		if ((error = file.Open(fsSession, aFileName, EFileShareReadersOrWriters)) == KErrNone)
-			{
-			TInt size = 0;
-
-			if ((error = file.Size(size)) == KErrNone)
-				{
-				if (size > 0)
-					{
-					if (size > aMaxLength) 
-						size = aMaxLength;
-
-					error = file.Read(aHeaderData, size);
-					}
-				}
-			file.Close();
-			}
-		fsSession.Close();
-		}
-
-	return error;
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C TFourCC CMMFClientUtility::ConvertMdaCodecToFourCC(TMdaPackage& aCodec)
-	{
-	TFourCC dataType = KMMFFourCCCodeNULL;	
-	switch (aCodec.Uid().iUid)
-		{
-		case KUidMdaWavPcmCodecDefine: 
-			{
-			TMdaPcmWavCodec* pcmWavCodec = (TMdaPcmWavCodec*)&aCodec;
-			if (pcmWavCodec->iBits == TMdaPcmWavCodec::E8BitPcm)
-				dataType = KMMFFourCCCodePCMU8; //8 bit PCM
-			else 
-				dataType = KMMFFourCCCodePCM16; //16 bit PCM
-			break;
-			}
-		case KUidMdaAu8PcmCodecDefine:
-			dataType = KMMFFourCCCodePCM8;
-			break;
-		case KUidMdaAuCodecDefine:
-		case KUidMdaAu16PcmCodecDefine:
-			dataType = KMMFFourCCCodePCM16B;
-			break;
-
-		case KUidMdaAuMulawCodecDefine:
-		case KUidMdaWavMulawCodecDefine:
-		case KUidMdaRawAudioMulawCodecDefine:  //uLAW
-			dataType = KMMFFourCCCodeMuLAW;
-			break;
-		case KUidMdaAuAlawCodecDefine:
-		case KUidMdaWavAlawCodecDefine:
-		case KUidMdaRawAudioAlawCodecDefine:	 //ALAW
-			dataType = KMMFFourCCCodeALAW;
-			break;
-		case KUidMdaRawAudioS8PcmCodecDefine:	 //  P8
-			dataType = KMMFFourCCCodePCM8;
-			break;
-		case KUidMdaRawAudioU8PcmCodecDefine:	  // PU8
-			dataType = KMMFFourCCCodePCMU8;
-			break;
-		case KUidMdaRawAudioSL16PcmCodecDefine: // P16
-			dataType = KMMFFourCCCodePCM16;
-			break;
-		case KUidMdaRawAudioSB16PcmCodecDefine: //P16B
-			dataType = KMMFFourCCCodePCM16B;
-			break;
-		case KUidMdaRawAudioUL16PcmCodecDefine: //PU16
-			dataType = KMMFFourCCCodePCMU16;
-			break;
-		case KUidMdaRawAudioUB16PcmCodecDefine: //PU6B
-			dataType = KMMFFourCCCodePCMU16B; 
-			break;
-		case KUidMdaGsmWavCodecDefine: //GSM6 
-			dataType = KMMFFourCCCodeGSM610;
-			break;
-		case KUidMdaWavImaAdpcmCodecDefine:
-			dataType = KMMFFourCCCodeIMAD;
-			break;
-		case KUidMdaRawAmrCodecDefine:
-			dataType = KMMFFourCCCodeAMR;
-			break;
-		default:	// Not a Uid we recognise
-			dataType = KMMFFourCCCodeNULL;
-			break;
-		}
-	return dataType;
-	}
-
-
-CMMFUtilityFileInfo* CMMFUtilityFileInfo::NewL(TMMSource& aSource, TBool aSecureDRMMode)
-	{
-	CMMFUtilityFileInfo* self = CMMFUtilityFileInfo::NewLC(aSource, aSecureDRMMode);
-	CleanupStack::Pop(self);
-	return self;
-	}
-
-
-CMMFUtilityFileInfo* CMMFUtilityFileInfo::NewLC(TMMSource& aSource, TBool aSecureDRMMode)
-	{
-	CMMFUtilityFileInfo* self = new (ELeave) CMMFUtilityFileInfo;
-	CleanupStack::PushL(self);
-	self->ConstructL(aSource, aSecureDRMMode);
-	return self;
-	}
-
-
-void CMMFUtilityFileInfo::ConstructL(const TMMSource& aSource, TBool aSecureDRMMode)
-	{
-	if (!aSecureDRMMode)
-		{
-		if (aSource.SourceType()==KUidMMFileSource)
-			{
-			const TMMFileSource& fileSource = static_cast<const TMMFileSource&>(aSource);
-			iData = CData::NewL(TVirtualPathPtr(fileSource.Name(), fileSource.UniqueId()),
-								EContentShareReadWrite);
-			}
-
-		if (aSource.SourceType()==KUidMMFileHandleSource)
-			{
-			const TMMFileHandleSource& fileHandleSource = static_cast<const TMMFileHandleSource&>(aSource);
-			iData = CData::NewL(fileHandleSource.Handle(), fileHandleSource.UniqueId());
-			}
-		
-		TInt err = iData->SetProperty(EAgentPropertyAgentUI, aSource.IsUIEnabled());		
-		if (err != KErrNone && err != KErrCANotSupported)
-			{
-			// KErrCANotSupported isn't a problem for us so eat the error code.
-			User::Leave(err);
-			}
-
-		err = iData->EvaluateIntent(aSource.Intent());
-		User::LeaveIfError(err);
-		}
-	else
-		{
-		// Use RMMFDRMPluginServerProxy as medium
-		iDrmPluginServer = new (ELeave) RMMFDRMPluginServerProxy;
-		User::LeaveIfError(iDrmPluginServer->Open());
-		
-		CBufFlat* dataBuffer = CBufFlat::NewL(KExpandSize);
-		CleanupStack::PushL(dataBuffer);
-		RBufWriteStream stream;
-		stream.Open(*dataBuffer);
-		CleanupClosePushL(stream);
-		
-		stream.WriteInt32L(aSource.UniqueId().Length());
-		stream.WriteL(aSource.UniqueId());
-		stream.WriteInt32L(aSource.IsUIEnabled());
-		TPckgBuf<ContentAccess::TIntent> intentPckg(aSource.Intent());
-		stream.WriteL(intentPckg);
-		stream.CommitL();
-	
-		CleanupStack::PopAndDestroy(&stream);
-		if (aSource.SourceType()==KUidMMFileSource)
-			{
-			const TMMFileSource& fileSource = static_cast<const TMMFileSource&>(aSource);
-			iDrmPluginServer->OpenDataContentL(fileSource.Name(), dataBuffer->Ptr(0));
-			}
-		if (aSource.SourceType()==KUidMMFileHandleSource)
-			{
-			const TMMFileHandleSource& fileHandleSource = static_cast<const TMMFileHandleSource&>(aSource);
-			iDrmPluginServer->OpenDataContentL(fileHandleSource.Handle(), dataBuffer->Ptr(0));
-			}
-		CleanupStack::PopAndDestroy(dataBuffer);
-		}
-	}
-
-TInt CMMFUtilityFileInfo::EvaluateIntent(TIntent aIntent)
-	{
-	if (iData)
-		{
-		return iData->EvaluateIntent(aIntent);
-		}
-	else
-		{
-		ASSERT(iDrmPluginServer);
-		return iDrmPluginServer->EvaluateDataContentIntent(aIntent);
-		}
-	}
-/**
- * @internalComponent
- */
-TBool CMMFUtilityFileInfo::GetFileMimeTypeL(TDes8& aMimeType)
-	{
-	if (iData)
-		{
-		return iData->GetMimeTypeL(aMimeType);
-		}
-	else
-		{
-		ASSERT(iDrmPluginServer);
-		return iDrmPluginServer->GetDataContentMimeTypeL(aMimeType);
-		}
-	}
-
-/**
- * @internalComponent
- */
-void CMMFUtilityFileInfo::GetFileHeaderDataL(TDes8& aHeaderData, TInt aMaxLength)
-	{
-	if (iData)
-		{
-		TInt size = 0;
-		iData->DataSizeL(size);
-		if (size > 0)
-			{
-			if (size > aMaxLength) 
-				size = aMaxLength;
-			TInt pos = 0;
-			User::LeaveIfError(iData->Seek(ESeekStart, pos));
-			User::LeaveIfError(iData->Read(aHeaderData, size));
-			}
-		}
-	else
-		{
-		ASSERT(iDrmPluginServer);
-		iDrmPluginServer->GetDataContentFileHeaderL(aHeaderData, aMaxLength);
-		}
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C HBufC8* CMMFClientUtility::GetFileExtensionL(const TDesC& aFileName)
-	{
-	TParse fileName;
-	fileName.Set(aFileName,NULL,NULL);
-	HBufC8* fileSuffix = NULL;
-	if(fileName.ExtPresent())
-		{
-		TPtrC fileSuffixPtr(fileName.Ext());
-		fileSuffix = HBufC8::NewL(fileSuffixPtr.Length());
-		fileSuffix->Des().Copy(fileSuffixPtr);
-		}
-	else
-		{
-		fileSuffix = KNullDesC8().AllocL();
-		}
-	return fileSuffix;
-	}
-
-
-/**
- * @internalComponent
- */
-CMMFUtilityFileInfo::~CMMFUtilityFileInfo()
-	{
-	if (iData)
-		{
-		delete iData;
-		}
-	if (iDrmPluginServer)
-		{
-		iDrmPluginServer->Close();
-		delete iDrmPluginServer;
-		}
-	}
-
-/*
- * @internalComponent
- *
- * Returns an integer rating indicating how well the supplied format matches
- * the header data and file extension supplied.
- * 3 brownie points awarded for data & suffix match.
- * 2 brownie points awarded for data match alone.
- * 1 brownie point awarded for suffix match alone.
- */
-TInt CMMFClientUtility::GetBestMatchL(const CMMFFormatImplementationInformation* format, const TDesC8& aHeaderData, const TDesC8& aFileExtension)
-	{
-	TInt browniePoints = 0;
-
-	if (aHeaderData.Length() > 0) // Non empty file
-		{
-		if (aFileExtension.Length() > 0) // With a file extension
-			{
-			if (format->SupportsHeaderDataL(aHeaderData) && 
-				format->SupportsFileExtension(aFileExtension))
-				{
-				browniePoints = 3;
-				}
-			else if (format->SupportsHeaderDataL(aHeaderData))
-				{
-				browniePoints = 2;
-				}
-			else
-				{
-				// See if this format has any 'empty' match data or no match data, indicating 
-				// that this format will match extension alone even if data present.
-				// (A format may have more than one match data string.)
-				const CDesC8Array& supportedHeaderData = format->SupportedHeaderData();
-
-				if (supportedHeaderData.Count() == 0)
-					{
-					// No header data indicated.
-					if (format->SupportsFileExtension(aFileExtension))
-						{
-							browniePoints = 1;
-						}
-					}
-				else
-					{
-					for (register TInt i = 0; i < supportedHeaderData.Count(); i++)
-						{
-						if ((supportedHeaderData[i].Length() == 0) && 
-							format->SupportsFileExtension(aFileExtension))
-							{
-							browniePoints = 1;
-							}
-						}
-					}
-				}
-			}
-		else
-			{
-			// No file suffix, so must match header data alone.
-			if (format->SupportsHeaderDataL(aHeaderData))
-				{
-				browniePoints = 2;
-				}
-			}
-		}
-	else // Empty File
-		{
-		// We have no choice but to match extension, if there is one.
-		if ((aFileExtension.Length() > 0) && format->SupportsFileExtension(aFileExtension))
-			{
-			browniePoints = 1;
-			}
-		}
-
-	return browniePoints;
-}
-
-/**
- * @internalComponent
- *
- * This function parses all the play & record formats in the given list of controllers,
- * looking for controllers & formats that best match the requirements. 
- * Play controllers will be returned before record controllers, and
- * in cases of equal priority between formats, ECom order will be maintained.
- *
- * @param	"aControllers"	
- *			A reference to a user supplied list of controllers retrieved from ECom.
- *			This list may be have been filtered for audio/video/play/record.
- * @param	"aHeaderDataPlayback"
- *			A descriptor reference containing the file's header data.
- *          for matching against a controller's play formats. May be KNullDesC8
- * @param	"aFileExtensionPlayback"
- *			A descriptor reference containing the filename's extension.
- *          for matching against a controller's play formats. May be KNullDesC8
- * @param	"aHeaderDataRecord"
- *			A descriptor reference containing the file's header data.
- *          for matching against a controller's record formats. May be KNullDesC8
- * @param	"aFileExtensionRecord"
- *			A descriptor reference containing the filename's extension.
- *          for matching against a controller's record formats. May be KNullDesC8
- * @param	"aPrioritisedControllers"
- *			A reference to a user supplied list through which the list of
- *			prioritised controllers will be returned.
- * @since	7.0s
- */
-void CMMFClientUtility::PrioritiseControllersL(
-	const RMMFControllerImplInfoArray& aControllers, 
-	const TDesC8& aHeaderDataPlayback, 
-	const TDesC8& aFileExtensionPlayback, 
-	const TDesC8& aHeaderDataRecord, 
-	const TDesC8& aFileExtensionRecord, 
-	RMMFControllerImplInfoArray& prioritisedControllers)
-	{
-	RMMFControllerImplInfoArray fullMatchControllers; // data AND suffix
-	CleanupClosePushL(fullMatchControllers);
-	RMMFControllerImplInfoArray partMatchControllers; // data OR suffix
-	CleanupClosePushL(partMatchControllers);
-
-	TBool checkingPlaybackFormats = EFalse;
-	TBool checkingRecordFormats = EFalse;
-
-	if (aHeaderDataPlayback != KNullDesC8 || aFileExtensionPlayback != KNullDesC8)
-		checkingPlaybackFormats = ETrue;
-	if (aHeaderDataRecord != KNullDesC8 || aFileExtensionRecord != KNullDesC8)
-		checkingRecordFormats = ETrue;
-
-	// Examine each format for each controller. We only want to know at this stage
-	// if the controller has suitable formats, so as soon as we know it has, we can
-	// add it to out list, ranked by how well it matched.
-	for (register TInt i = 0; i < aControllers.Count(); i++)
-		{
-		const CMMFControllerImplementationInformation* controller = aControllers[i];
-		TInt savedBrowniePointsPlayback = 0;
-		TInt savedBrowniePointsRecord = 0;
-
-		if (checkingPlaybackFormats)
-			{
-			for (register TInt p = 0; p < controller->PlayFormats().Count(); p++)
-				{
-				const CMMFFormatImplementationInformation* format = controller->PlayFormats()[p];
-
-				TInt browniePoints = GetBestMatchL(format, aHeaderDataPlayback, aFileExtensionPlayback);
-
-				if (browniePoints >= savedBrowniePointsPlayback)
-					savedBrowniePointsPlayback = browniePoints;
-				}
-			}
-
-		if (checkingRecordFormats)
-			{
-			for (register TInt r = 0; r < controller->RecordFormats().Count(); r++)
-				{
-				const CMMFFormatImplementationInformation* format = controller->RecordFormats()[r];
-
-				TInt browniePoints = GetBestMatchL(format, aHeaderDataRecord, aFileExtensionRecord);
-
-				if (browniePoints >= savedBrowniePointsRecord)
-					savedBrowniePointsRecord = browniePoints;
-				}
-			}
-
-		TInt savedBrowniePoints = 0;
-		// if we're checking both playback & record formats
-		// make sure we've found both
-		if (checkingPlaybackFormats && checkingRecordFormats)
-			{
-			savedBrowniePoints = Min(savedBrowniePointsPlayback, savedBrowniePointsRecord);
-			}
-		else if (checkingPlaybackFormats)
-			{
-			savedBrowniePoints = savedBrowniePointsPlayback;
-			}
-		else if (checkingRecordFormats)
-			{
-			savedBrowniePoints = savedBrowniePointsRecord;
-			}
-
-		// Checked all formats for this controller, now count our brownie points.
-		switch (savedBrowniePoints)
-			{
-			case 3:
-				User::LeaveIfError(fullMatchControllers.Append(controller));
-				break;
-			case 2:
-				User::LeaveIfError(partMatchControllers.Insert(controller, 0));
-				break;
-			case 1:
-				User::LeaveIfError(partMatchControllers.Append(controller));
-				break;
-			default:
-				break;
-			}
-		}
-
-	// The better the controller matches, the earlier it will be in the final list.
-	for (register TInt x = 0; x < fullMatchControllers.Count(); x++)
-		{
-		if (prioritisedControllers.Find(fullMatchControllers[x]) == KErrNotFound)
-			{
-			User::LeaveIfError(prioritisedControllers.Append(fullMatchControllers[x]));
-			}
-		}
-
-	for (register TInt y = 0; y < partMatchControllers.Count(); y++)
-		{
-		if (prioritisedControllers.Find(partMatchControllers[y]) == KErrNotFound)
-			{
-			User::LeaveIfError(prioritisedControllers.Append(partMatchControllers[y]));
-			}
-		}
-
-	CleanupStack::PopAndDestroy(2, &fullMatchControllers); // fullMatchControllers, partMatchControllers
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C CMMFMdaObjectStateChangeObserverCallback* CMMFMdaObjectStateChangeObserverCallback::NewL(MMdaObjectStateChangeObserver& aCallback)
-	{
-	return new(ELeave) CMMFMdaObjectStateChangeObserverCallback(aCallback);
-	}
-
-/**
- * @internalComponent
- */
-CMMFMdaObjectStateChangeObserverCallback::~CMMFMdaObjectStateChangeObserverCallback()
-	{
-	Cancel();
-	}
-
-/**
- * @internalComponent
- */
-EXPORT_C void CMMFMdaObjectStateChangeObserverCallback::CallBack(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
-	{
-	iObject = aObject;
-	iPreviousState = aPreviousState;
-	iCurrentState = aCurrentState;
-	iErrorCode = aErrorCode;
-	if (!IsActive())
-		{
-		TRequestStatus* s = &iStatus;
-		SetActive();
-		User::RequestComplete(s, KErrNone);
-		}
-	}
-
-CMMFMdaObjectStateChangeObserverCallback::CMMFMdaObjectStateChangeObserverCallback(MMdaObjectStateChangeObserver& aCallback) :
-	CActive(CActive::EPriorityHigh),
-	iCallback(aCallback)
-	{
-	CActiveScheduler::Add(this);
-	}
-
-void CMMFMdaObjectStateChangeObserverCallback::RunL()
-	{
-	iCallback.MoscoStateChangeEvent(iObject, iPreviousState, iCurrentState, iErrorCode);
-	}
-
-void CMMFMdaObjectStateChangeObserverCallback::DoCancel()
-	{
-	//nothing to cancel
-	}
-
-
-//****************************************
-// CMMFFindAndOpenController
-//****************************************
-
-/**
- * Factory function to create a CMMFFindAndOpenController class
- *
- * @internalComponent
- */
-EXPORT_C CMMFFindAndOpenController* CMMFFindAndOpenController::NewL(MMMFFindAndOpenControllerObserver& aObserver)
-	{
-	CMMFFindAndOpenController* self = new(ELeave) CMMFFindAndOpenController(aObserver);
-	CleanupStack::PushL(self);
-	self->ConstructL();
-	CleanupStack::Pop(self);
-	return self;
-	}
-
-CMMFFindAndOpenController::~CMMFFindAndOpenController()
-	{
-	Cancel();
-
-	// delete temporary variables
-	Close();
-
-	// this should cancel the AO
-	delete iAddDataSourceSinkAsync;
-
-	delete iPrimaryConfig;
-	delete iSecondaryConfig;
-	}
-
-/**
- * Function to free up memory after a successful open has completed
- * Useful to allow a alloc testing to work.
- * Must not be called if ReOpen() is to be called
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::Close()
-	{
-
-	Cancel();
-	
-	if(iAddDataSourceSinkAsync)
-		{
-		iAddDataSourceSinkAsync->Cancel();
-		}
-		
-	if (iPrimaryConfig)
-		iPrimaryConfig->Close();
-	if (iSecondaryConfig)
-		iSecondaryConfig->Close();
-
-	iPrioritisedControllers.Close();
-	iControllers.ResetAndDestroy();
-	iControllers.Close();
-	
-	iFileName.SetLength(0);
-	iFileNameSecondary.SetLength(0);
-
-	delete iUrl;
-	iUrl = NULL;
-	
-	delete iMimeType;
-	iMimeType = NULL;
-	
-	delete iUniqueId;
-	iUniqueId = NULL;
-
-	if (iOwnFileHandle)
-		{
-		iFileHandle.Close();
-		iOwnFileHandle = EFalse;	
-		}
-	}
-/**
- * Function to free up memory of which is not required in ReOpen()
- * after a successful open has completed
- * Useful to allow a alloc testing to work.
- *
- * @internalComponent
- */
-
-EXPORT_C void CMMFFindAndOpenController::CloseConfig()
-	{
-	Cancel();
-	if(iAddDataSourceSinkAsync)
-		{
-		iAddDataSourceSinkAsync->Cancel();
-		}
-	
-	if (iSecondaryConfig)
-		{
-		iSecondaryConfig->Close();
-		}
-	
-	iPrioritisedControllers.Close();
-	iControllers.ResetAndDestroy();
-	iControllers.Close();
-	
-	iFileName.SetLength(0);
-	iFileNameSecondary.SetLength(0);
-
-	delete iUrl;
-	iUrl = NULL;
-	
-	delete iMimeType;
-	iMimeType = NULL;
-	
-	delete iUniqueId;
-	iUniqueId = NULL;
-
-	if (iOwnFileHandle)
-		{
-		iFileHandle.Close();
-		iOwnFileHandle = EFalse;		
-		}
-	}
-
-CMMFFindAndOpenController::CMMFFindAndOpenController(MMMFFindAndOpenControllerObserver& aObserver) :
-	CActive(EPriorityStandard), 
-	iObserver(aObserver),
-	iDescriptor(NULL, 0)
-	{
-	CActiveScheduler::Add(this);
-	}
-
-void CMMFFindAndOpenController::ConstructL()
-	{
-	iAddDataSourceSinkAsync = CMMFAddDataSourceSinkAsync::NewL(*this);
-	iPrimaryConfig = new (ELeave)  CConfig();
-	iSecondaryConfig =  new (ELeave) CConfig;
-	iCurrentConfig =  iPrimaryConfig;
-	
-	RProcess thisProcess;
-	iHasDrmCapability = thisProcess.HasCapability(ECapabilityDRM, KSuppressPlatSecDiagnostic);
-	thisProcess.Close();
-	}
-
-void CMMFFindAndOpenController::RunL()
-	{
-	Process();
-	}
-
-void CMMFFindAndOpenController::DoCancel()
-	{
-	iAddDataSourceSinkAsync->Cancel();
-	}
-
-/**
- * Defines the media ID & priority to be used when opening a controller
- * Normally called once only after class has been constructed
- *
- * @param	aMediaId
- *			the media ID to use when searching for a controller
- *			e.g. KUidMediaTypeAudio 
- * @param	aPrioritySettings
- *			the priority settings to use when opening a controller
- * @param	aMediaIdMatchType
- *			Defines the type of media id match to be performed on the plugins 
- *			returned from the ECOM registry.
- * @leave	can leave with KErrNoMemory
-
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::Configure(
-	TUid aMediaId, 
-	TMMFPrioritySettings aPrioritySettings,
-	CMMFPluginSelectionParameters::TMediaIdMatchType aMediaIdMatchType)
-	{
-	iPrioritySettings = aPrioritySettings;
-
-	iMediaIdMatchType = aMediaIdMatchType;
-
-	iMediaId = aMediaId;
-	}
-
-void CMMFFindAndOpenController::ConfigureController(
-	CConfig& config,
-	RMMFController& aController, 
-	CMMFControllerEventMonitor& aEventMonitor,
-	TControllerMode aControllerMode)
-	{
-	config.iController = &aController;
-	config.iEventMonitor = &aEventMonitor;
-	config.iControllerMode = aControllerMode;
-	}
-
-/**
- * Configures the primary controller
- *
- * @param	aController
- *			a reference to the client controller object to use
- * @param	aEventMonitor
- *			a reference to an event monitor object for receiving 
- *			events from the controller
- * @param	aControllerMode
- *			indicates whether this controller is to be used for recording
- *          or playback
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::ConfigureController(
-	RMMFController& aController, 
-	CMMFControllerEventMonitor& aEventMonitor,
-	TControllerMode aControllerMode)
-	{
-	ConfigureController(
-		*iPrimaryConfig,
-		aController, 
-		aEventMonitor,
-		aControllerMode);
-	}
-
-/**
- * Configures the secondary controller
- *
- * This is only needed for the audio recorder utility which opens
- * one controller for playback and another for recording
- *
- * @param	aController
- *			a reference to the client controller object to use
- * @param	aEventMonitor
- *			a reference to an event monitor object for receiving 
- *			events from the controller
- * @param	aControllerMode
- *			indicates whether this controller is to be used for recording
- *          or playback or converting
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::ConfigureSecondaryController(
-	RMMFController& aController, 
-	CMMFControllerEventMonitor& aEventMonitor,
-	TControllerMode aControllerMode)
-	{
-	ConfigureController(
-		*iSecondaryConfig,
-		aController, 
-		aEventMonitor,
-		aControllerMode);
-	}
-
-/**
- * Makes any controllers that are opened subsequently share a single heap.
- * 
- * The default behaviour is that each controller is created with its own heap.
- * Each heap uses a chunk, so using this function avoids situations where the number
- * of chunks per process is limited.
- * The default behaviour is generally to be preferred, and should give lower overall
- * memory usage. However, if many controllers are to be created for a particular thread,
- * then this function should be used to prevent running out of heaps or chunks.
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::UseSharedHeap()
-	{
-	iUseSharedHeap = ETrue;
-	}
-
-void CMMFFindAndOpenController::Init()
-	{
-	// This should be called prior to opening, so reset the error
-	iError = KErrNone;
-	iSourceSinkConfigured = EFalse;
-	iControllerCount = 0;
-	}
-
-void CMMFFindAndOpenController::ConfigureSourceSink(
-	CConfig& config,
-	TSourceSink aSource, 
-	TSourceSink aSink)
-	{
-	TInt err;
-	TRAP(err, config.iSource = CreateSourceSinkL(aSource));
-	if (err != KErrNone)
-		{
-		iError = err;
-		return;
-		}
-		
-	TRAP(err, config.iSink = CreateSourceSinkL(aSink));
-	if (err != KErrNone)
-		{
-		iError = err;
-		return;
-		}
-	}
-	
-
-void CMMFFindAndOpenController::ConfigureSourceSink(
-	CConfig& config,
-	const TMMSource& aSource, 
-	TSourceSink aSink)
-	{
-	TInt err;
-	TRAP(err, config.iSource = CreateSourceSinkL(aSource));
-	if (err != KErrNone)
-		{
-		iError = err;
-		return;
-		}
-		
-	TRAP(err, config.iSink = CreateSourceSinkL(aSink));
-	if (err != KErrNone)
-		{
-		iError = err;
-		return;
-		}
-	}
-
-
-	
-/**
- * Configure the primary controller's source and sink
- * The descriptors passed to this function are copied so they do not need to be persistent.
- * To simplify the API, any errors that occur are reported back asynchronously following
- * a subsequent call to OpenByXXX()
- *
- * @param	aSourceUid
- *			the UID of the data source
- * @param	aSourceData
- *			a reference to a descriptor used to configure the source
- * @param	aSinkUid
- *			the UID of the data sink
- * @param	aSinkData
- *			a reference to a descriptor used to configure the sink
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::ConfigureSourceSink(
-	TSourceSink aSource,
-	TSourceSink aSink)
-	{
-
-	CConfig* config = NULL;
-	
-	Init();
-	config = iPrimaryConfig;
-
-
-	// must have already called ConfigureController()
-	__ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState));
-
-	ConfigureSourceSink(
-		*config,
-		aSource, 
-		aSink);
-	iCurrentConfig = config;
-
-	iSourceSinkConfigured = ETrue;
-	}
-	
-	
-/**
- * Configure the primary controller's source and sink
- * The descriptors passed to this function are copied so they do not need to be persistent.
- * To simplify the API, any errors that occur are reported back asynchronously following
- * a subsequent call to OpenByXXX()
- *
- * @param	aSourceUid
- *			the UID of the data source
- * @param	aSourceData
- *			a reference to a descriptor used to configure the source
- * @param	aSinkUid
- *			the UID of the data sink
- * @param	aSinkData
- *			a reference to a descriptor used to configure the sink
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::ConfigureSecondarySourceSink(
-	TSourceSink aSource,
-	TSourceSink aSink)
-	{
-	if (iError != KErrNone)
-		{
-		// if there was an error configuring the primary source/sink, do not try the secondary one
-		// Don't return the error, since the stored error will be returned by the OpenBy... method
-		return;
-		}
-
-	CConfig* config = NULL;
-	
-	config = iSecondaryConfig;
-
-	// must have already configured the primary controller
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-	config = iSecondaryConfig;
-			
-	// must have already called ConfigureController()
-	__ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState));
-
-	ConfigureSourceSink(
-		*config,
-		aSource, 
-		aSink);
-	iCurrentConfig = config;
-
-	iSourceSinkConfigured = ETrue;
-	}
-	
-
-	
-EXPORT_C void CMMFFindAndOpenController::ConfigureSourceSink(
-	const TMMSource& aSource,
-	TSourceSink aSink)
-	{
-	Init();
-	CConfig* config = iPrimaryConfig;
-			
-	// must have already called ConfigureController()
-	__ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState));
-
-	ConfigureSourceSink(
-		*config,
-		aSource, 
-		aSink);
-	iCurrentConfig = config;
-
-	iSourceSinkConfigured = ETrue;
-	}
-
-	
-	
-/**
- * Opens a controller using the supplied controller UID
- * and adds the source & sink
- * Completion is indicated asynchonously by a call to MfaocComplete()
- * 
- * @param	aControllerUid
- *			the UID of the primary controller
- * @param	aControllerUid
- *			the UID of the secondary controller
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::OpenByControllerUid(
-		TUid aControllerUid,
-		TUid aSecondaryControllerUid)
-	{
-	// must have already called ConfigureSourceSink()
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-
-	// Have there been any errors so far ?
-	if (iError != KErrNone)
-		{
-	    SchedSendError();
-		return;
-		}
-
-	if (iCurrentConfig == iPrimaryConfig)
-		{
-		// only do this for the playback controller
-		TRAP(iError, iCurrentConfig->iSource->EvaluateIntentL())
-		
-		if (iError != KErrNone && 
-			!(iCurrentConfig->iControllerMode == EPlayback && iError == KErrPermissionDenied && !iHasDrmCapability))
-			{
-			// KErrPermissionDenied error and no DRM capability are not problems in Playback mode
-			// proper action will be performed when controller is loaded
-	    	SchedSendError();
-			return;
-			}
-		}
-
-	iPrimaryConfig->iControllerUid = aControllerUid;
-	if (iCurrentConfig == iSecondaryConfig)
-		{
-		if (aSecondaryControllerUid == KNullUid)
-			iSecondaryConfig->iControllerUid = aControllerUid;
-		else
-			iSecondaryConfig->iControllerUid = aSecondaryControllerUid;
-		}
-		
-	iMode = EOpenByControllerUid;
-	iControllerImplInfo = NULL;
-	iState = EOpenController;
-	KickState();
-	}
-
-/**
- * Opens a controller using the supplied file name
- * and adds the source & sink
- * A copy is made of the filename or file handle so that it need not be persistent
- * Completion is indicated asynchonously by a call to MfaocComplete()
- * 
- * @param	aSource
- *			a reference to a TFileSource object to be used when searching
- *          for a controller
- * @param	aFileNameSecondary
- *			a reference to the seconday filename to be used when searching
- *          for a controller. This need only be supplied when converting 
- *			between two files.
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::OpenByFileSource(const TMMSource& aSource, const TDesC& aFileNameSecondary)
-	{
-	// must have already called ConfigureSourceSink()
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-
-	TInt err;
-	// Have there been any errors so far ?
-	if (iError != KErrNone)
-		{
-		SchedSendError();
-		return;
-		}
-		
-	if (iOwnFileHandle)
-		{
-		// in case of error
-		iFileHandle.Close();
-		iOwnFileHandle = EFalse;
-		}
-		
-	iEnableUi = aSource.IsUIEnabled();
-	if (aSource.SourceType()==KUidMMFileSource)
-		{
-		const TMMFileSource& fileSource = static_cast<const TMMFileSource&>(aSource);
-		iFileName = fileSource.Name();
-		iUseFileHandle = EFalse;
-		}
-
-	if (aSource.SourceType()==KUidMMFileHandleSource)
-		{
-		const TMMFileHandleSource& fileHandleSource = static_cast<const TMMFileHandleSource&>(aSource);
-		ASSERT(iFileHandle.SubSessionHandle()==0); // closed just above
-		err = iFileHandle.Duplicate(fileHandleSource.Handle());
-		if (err != KErrNone)
-			{
-			SchedSendError(err);
-			return;
-			}
-		iFileHandle.Name(iFileName); //ignore error return since we'll just do without the filename if not available
-		iUseFileHandle = ETrue;
-		iOwnFileHandle = ETrue; // because we dup'd it
-		}
-		
-	TRAP(err, iUniqueId = aSource.UniqueId().AllocL());
-	iIntent = aSource.Intent();
-	if (err != KErrNone)
-		{
-		SchedSendError(err);
-		return;
-		}
-
-		
-	// take a copy of the secondary file name
-	iFileNameSecondary = aFileNameSecondary;
-
-	iMode = EOpenByFileName;
-	iState = EBuildControllerList;
-	KickState();
-	}
-	
-/**
- * Opens a controller using the supplied format UID
- * and adds the source & sink
- * Completion is indicated asynchonously by a call to MfaocComplete()
- * 
- * @param	aFormatUid
- *			the UID of a format that must be supported by the controller
- * @param	aFormatUidSecondary
- *			the UID of a secondary format that must be supported by the controller
- *			This need only be supplied when converting between two differnet formats.
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::OpenByFormatUid(TUid aFormatUid, TUid aFormatUidSecondary)
-	{
-	// must have already called ConfigureSourceSink()
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-
-	// Have there been any errors so far ?
-	if (iError != KErrNone)
-		{
-		SchedSendError();
-		return;
-		}
-
-	iFormatUid = aFormatUid;
-	iFormatUidSecondary = aFormatUidSecondary;
-
-	iMode = EOpenByFormatUid;
-	iState = EBuildControllerList;
-	KickState();
-	}
-
-/**
- * Opens a controller using the supplied descriptor 
- * and adds the source & sink
- * Completion is indicated asynchonously by a call to MfaocComplete()
- * 
- * @param	aDescriptor
- *			a reference to the descriptor to be used when searching
- *          for a controller
- *
- * @internalComponent
- */
-EXPORT_C void  CMMFFindAndOpenController::OpenByDescriptor(const TDesC8& aDescriptor)
-	{
-	// must have already called ConfigureSourceSink()
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-
-	// Have there been any errors so far ?
-	if (iError != KErrNone)
-		{
-		SchedSendError();
-		return;
-		}
-
-	// take a copy of the descriptor
-	TUint8* desBufferPtr = const_cast<TUint8*> (aDescriptor.Ptr());
-	iDescriptor.Set( desBufferPtr,aDescriptor.Length(),aDescriptor.Length());
-	
-	iMode = EOpenByDescriptor;
-	iState = EBuildControllerList;
-	KickState();
-	}
-
-/**
- * Opens a controller using the supplied URL
- * and adds the source & sink
- * Completion is indicated asynchonously by a call to MfaocComplete()
- * 
- * @param	aUrl
- *			a reference to the URL to be used when searching for a controller
- * @param	aIapId
- *          the IAP ID to be used when searching for a controller
- * @param	aMimeType
- *          the MIME type of the data to be used when searching for a controller
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::OpenByUrl(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType)
-	{
-	// must have already called ConfigureSourceSink()
-	__ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState));
-
-	// Have there been any errors so far ?
-	if (iError != KErrNone)
-		{
-		SchedSendError();
-		return;
-		}
-
-	// take a copy of the Url
-	delete iUrl;
-	iUrl = NULL;
-	iUrl = aUrl.Alloc();
-	if (iUrl == NULL)
-		{
-		SchedSendError(KErrNoMemory);
-		return;
-		}
-
-	// take a copy of the IapId
-	iIapId = aIapId;
-	
-	// take a copy of the mime type
-	delete iMimeType;
-	iMimeType = NULL;
-	iMimeType = aMimeType.Alloc();
-	if (iMimeType == NULL)
-		{
-		SchedSendError(KErrNoMemory);
-		return;
-		}
-
-	iMode = EOpenByUrl;
-	iState = EBuildControllerList;
-	KickState();
-	}
-
-/**
- * Static function to return a TMMFFileConfig object
- * suitable for passing to ConfigureSourceSink()
- * 
- * @param	aFileName
- *          the filename to use
- *
- * @internalComponent
- */
-EXPORT_C TMMFFileConfig CMMFFindAndOpenController::GetConfigFile(const TDesC& aFileName)
-	{
-	TMMFFileConfig sourceSinkData;
-	sourceSinkData().iPath = aFileName;
-	return sourceSinkData;
-	}
-
-/**
- * Static function to return a TMMFDescriptorConfig object
- * suitable for passing to ConfigureSourceSink()
- * 
- * @param	aFileName
- *          the filename to use
- *
- * @internalComponent
- */
-EXPORT_C TMMFDescriptorConfig CMMFFindAndOpenController::GetConfigDescriptor(const TDesC8& aDescriptor)
-	{
-	TMMFDescriptorConfig sourceSinkData;
-	sourceSinkData().iDes = (TAny*)&aDescriptor;
-	sourceSinkData().iDesThreadId = RThread().Id();
-	return sourceSinkData;
-	}
-
-/**
- * Static function to create a CBufFlat object
- * suitable for passing to ConfigureSourceSink()
- * 
- * @param	aUrlCfgBuffer
- *          the reference to a caller-supplied pointer used to create
- *			a CBufFlat object. The caller is responsible for deletion.
- * @param	aUrl
- *			a reference to the URL to be used
- * @param	aIapId
- *          the IAP ID to be used
- * @return	can return KErrNone or KErrNoMemory
- *
- * @internalComponent
- */
-
-EXPORT_C void CMMFFindAndOpenController::GetConfigUrlL(CBufFlat*& aUrlCfgBuffer, const TDesC& aUrl, TInt aIapId)
-	{
-	delete aUrlCfgBuffer;
-	aUrlCfgBuffer = NULL;
-	
-	CMMFUrlParams* urlCfg = CMMFUrlParams::NewL(aUrl,aIapId);
-	CleanupStack::PushL(urlCfg);
-	aUrlCfgBuffer = urlCfg->ExternalizeToCBufFlatLC();
-	CleanupStack::Pop(aUrlCfgBuffer);
-	CleanupStack::PopAndDestroy(urlCfg);
-	}
-/**
- * ReOpens the previously opened primary controller
- *
- * @internalComponent
- */
-EXPORT_C void CMMFFindAndOpenController::ReOpen()
-	{
-	// should already have a valid controller uid so just open it
-	iControllerImplInfo = NULL;
-	iState = EOpenController;
-	KickState();
-	}
-
-void CMMFFindAndOpenController::OpenPrimaryController(void)
-	{
-	iCurrentConfig = iPrimaryConfig;
-	switch(iMode)
-		{
-		case EOpenByFileName:
-		case EOpenByFormatUid:
-		case EOpenByDescriptor:
-		case EOpenByUrl:
-			iState = EBuildControllerList;
-			break;
-		case EOpenByControllerUid:
-			iControllerImplInfo = NULL;
-			iState = EOpenController;
-			break;
-		}
-	KickState();
-	}
-
-void CMMFFindAndOpenController::KickState()
-	{
-	TRequestStatus* status = &iStatus;
-	User::RequestComplete(status, KErrNone);
-	SetActive();
-	}
-
-void CMMFFindAndOpenController::CloseController()
-	{
-	if (iCurrentConfig->iEventMonitor)
-		iCurrentConfig->iEventMonitor->Cancel();
-	iCurrentConfig->iController->Close(); 
-	}
-
-void CMMFFindAndOpenController::Process()
-	{
-	switch(iState)
-		{
-		case EBuildControllerList:
-			switch(iMode)
-				{
-				case EOpenByFileName:
-					TRAP(iError, BuildControllerListFileNameL());
-					break;
-				case EOpenByDescriptor:
-					TRAP(iError, BuildControllerListDescriptorL());
-					break;
-				case EOpenByUrl:
-					TRAP(iError, BuildControllerListUrlL());
-					break;
-				case EOpenByFormatUid:
-					TRAP(iError, BuildControllerListFormatL());
-					break;
-				default:
-					CUPanic(EMMFMediaClientUtilityBadState);
-				}
-			
-			if (iError != KErrNone)
-				{
-				iState = EIdle;
-				SendError();
-				break;
-				}
-
-			// try the first controller
-			iControllerIndex = -1;
-			TryNextController();
-			break;
-
-		case EOpenController:
-			{
-			// Make sure any existing controller is closed.
-			CloseController();
-			
-			TBool isSecureDrmProcess = EFalse;// need to keep it false as UseSecureDRMProcess may return error
-			// Loading controller in new threading model is enabled only in playback mode
-			TUid sourceUid = iCurrentConfig->iSource->SourceSinkUid();
-			TBool localPlaybackMode = iCurrentConfig->iControllerMode == EPlayback && 
-										(sourceUid == KUidMmfFileSource || sourceUid == KUidMmfDescriptorSource);
-            if(localPlaybackMode)
-                {
-                TRAPD(err,UseSecureDRMProcessL(isSecureDrmProcess));
-                if(err == KErrPermissionDenied)
-                	{
-                	isSecureDrmProcess = ETrue;
-                	}
-                else if(err != KErrNone)
-                    {
-                    iError = err;
-                    SendError(err);
-                    return;
-                    }
-                }
-			// Open the controller 
-			if (iControllerImplInfo)
-				{
-				if(isSecureDrmProcess && localPlaybackMode)
-					{
-					iError = iCurrentConfig->iController->OpenInSecureDRMProcess(*iControllerImplInfo, iPrioritySettings, iUseSharedHeap);
-					iUsingSecureDrmProcess = ETrue;
-					}
-				else
-					{
-					iError = iCurrentConfig->iController->Open(*iControllerImplInfo, iPrioritySettings, iUseSharedHeap);
-					iUsingSecureDrmProcess = EFalse;;
-					}
-				}
-			else
-				{
-				if(isSecureDrmProcess && localPlaybackMode)
-					{
-					iError = iCurrentConfig->iController->OpenInSecureDRMProcess(iCurrentConfig->iControllerUid, iPrioritySettings, iUseSharedHeap);
-					iUsingSecureDrmProcess = ETrue;
-	
-					}
-				else
-					{
-					iError = iCurrentConfig->iController->Open(iCurrentConfig->iControllerUid, iPrioritySettings, iUseSharedHeap);
-					iUsingSecureDrmProcess = EFalse;
-					}
-				}
-			//in case of error, including KErrNomemory try next controller
-			if (iError)
-				{
-				TryNextController();
-				}
-			else
-				{	
-			#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
-			#ifndef SYMBIAN_BUILD_GCE
-				if(iCurrentConfig->iControllerMode == EPlayback && iMediaId == KUidMediaTypeVideo)
-					{
-					iError = iVideoSetInitScreenCustomCommands->SetInitScreenNumber(iScreenNumber);
-					if(iError)
-						{
-						if (iError == KErrNotSupported && iScreenNumber == KDefaultScreenNo)
-							{
-							iError = KErrNone;
-							}
-						else
-							{
-							iState = EIdle;
-							SendError();
-							break;
-							}	
-						}
-					}
-			#endif // SYMBIAN_BUILD_GCE
-			#endif // SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
-				iCurrentConfig->iEventMonitor->Start();
-
-				if (iCurrentConfig == iSecondaryConfig)
-					{
-					iState = EAddSource;
-					KickState();
-					}
-				else
-					{
-					iState = EAddSink;
-					KickState();
-					}
-				}
-			}
-			break;
-
-		case EAddSource:
-			{
-			iState = EWaitingForSource;
-			const CMMSourceSink* source = iCurrentConfig->iSource;
-			// CMMSourceSink has the ability to transform the data it stored into a data stream
-			// which can be passed to CMMFAddDataSourceSinkAsync for further processing.
-			// CMMFileSourceSink, which is a specialized CMMSourceSink, stores info about a file
-			// source/sink. The info about the file can be a file path or a file handle.
-			// When it holds a file handle and turns info into data stream, the file handle is
-			// stored as a pointer in the stream. However, at this point, it cannot guarantee that
-			// the streamed info is always extracted within the same process. If the pointer is 
-			// dereferenced in other process, a panic will raise in the system. Therefore, a file
-			// handle, rather than pointer, is used when necessary.
-			if (iUsingSecureDrmProcess && source->CarryingFileHandle())
-				{
-				iAddDataSourceSinkAsync->AddFileHandleDataSource(*iCurrentConfig->iController,
-																 static_cast<const CMMFileSourceSink*>(source)->FileHandle(),
-																 source->SourceSinkData());
-				}
-			else
-				{
-				iAddDataSourceSinkAsync->AddDataSource(*iCurrentConfig->iController, 
-													   source->SourceSinkUid(), 
-													   source->SourceSinkData());
-				}
-			}
-			break;
-
-		case EAddSink:
-			{
-			iState = EWaitingForSink;
-			const CMMSourceSink* sink = iCurrentConfig->iSink;
-			// CMMSourceSink has the ability to transform the data it stored into a data stream
-			// which can be passed to CMMFAddDataSourceSinkAsync for further processing.
-			// CMMFileSourceSink, which is a specialized CMMSourceSink, stores info about a file
-			// source/sink. The info about the file can be a file path or a file handle.
-			// When it holds a file handle and turns info into data stream, the file handle is
-			// stored as a pointer in the stream. However, at this point, it cannot guarantee that
-			// the streamed info is always extracted within the same process. If the pointer is 
-			// dereferenced in other process, a panic will raise in the system. Therefore, a file
-			// handle, rather than pointer, is used when necessary.
-			const TDesC8& sinkData = sink->SourceSinkData();
-			if (iUsingSecureDrmProcess && sink->CarryingFileHandle())
-				{
-				iAddDataSourceSinkAsync->AddFileHandleDataSink(*iCurrentConfig->iController,
-															   static_cast<const CMMFileSourceSink*>(sink)->FileHandle(),
-															   sinkData);
-				}
-			else
-				{
-				iAddDataSourceSinkAsync->AddDataSink(*iCurrentConfig->iController, 
-													 sink->SourceSinkUid(), 
-													 sinkData);
-				}
-			}
-			break;
-		
-		case EWaitingForSource:
-			break;
-
-		case EWaitingForSink:
-			break;
-
-		case ESendError:
-			SendError();
-			iState = EIdle;
-			break;
-
-		case EIdle:
-		default:
-			break;
-		}
-	}
-
-void CMMFFindAndOpenController::TryNextController()
-	{
-	// If an error occurred close the controller.
-	if (iError != KErrNone)
-		{
-		CloseController();
-		}
-	
-	iStopTryLoadController = EFalse;
-	
-	if (iMode == EOpenByControllerUid || ++iControllerIndex >= iControllerCount)
-		{
-		//Raise a flag to stop trying to load the controllers
-		iStopTryLoadController = ETrue;
-		
-		// KErrNotSupported is the default error, but will only be used if no other error 
-		// has been discovered (the first error found is used by default)
-		// However, KErrBadHandle seems to mean that we tried to use the DRM server without
-		// RFs::ShareProtected() having been called, so force usage of KErrNotSupported so
-		// client does not see changed 
-		TBool forceErrorUse = EFalse;
-		if (iError==KErrBadHandle)
-			{
-			forceErrorUse = ETrue;
-			}
-		SendError(KErrNotSupported, forceErrorUse);		
-			
-		return;
-		}
-
-	if (iMode == EOpenByFileName || iMode == EOpenByFormatUid)
-		{
-		iControllerImplInfo = iPrioritisedControllers[iControllerIndex];
-		}
-	else	//if (iMode == EOpenByDescriptor || iMode == EOpenByUrl)
-		{
-		iControllerImplInfo = iControllers[iControllerIndex];
-		}
-
-	iCurrentConfig->iControllerUid = iControllerImplInfo->Uid();
-	iState = EOpenController;
-	KickState();
-	}
-
-void CMMFFindAndOpenController::MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle)
-	{
-	iError = aError;
-
-	// take the first available exit if we're out of memory
-	// or we've been cancelled
-	if (iError == KErrNoMemory || iError == KErrCancel)
-		{
-		SendError();
-		return;
-		}
-
-	// failed to add source or sink - try the next controller
-	if (aError != KErrNone)
-		{
-		TryNextController();
-		return;
-		}
-
-	if (iState == EWaitingForSource)
-		{
-		#ifdef SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
-		#ifdef SYMBIAN_BUILD_GCE
-		// If surfaces are required try to use them.  If this fails then fall back to using
-		// direct screen access.
-		if(iCurrentConfig->iControllerMode == EPlayback && iMediaId == KUidMediaTypeVideo)
-			{
-			// UseSurfaces call has to be done after adding data sink and adding data source.
-			iSurfaceSupported = iVideoPlaySurfaceSupportCustomCommands->UseSurfaces();
-			
-			if (iSurfaceSupported == KErrNotSupported)
-				{
-				if (iUseVPU2)
-					{
-					if (ControllerIndex() < ControllerCount() - 1)
-						{
-						// Until end of the list of controllers,
-						// try the next one for surface support
-						TryNextController(); // this will also kick-state
-						return;
-						}
-					else
-						{
-						iError = iSurfaceSupported;
-						}
-					}
-				else 
-					{
-					// No surface enabled controller found 
-					// not required to do only surface, 
-					// use the last one that matched.
-					iError = iVideoSetInitScreenCustomCommands->SetInitScreenNumber(iScreenNumber);
-					if (iError == KErrNotSupported && iScreenNumber == KDefaultScreenNo)
-						{
-						iError = KErrNone;
-						}
-					}
-				}
-			else
-				{
-				iError = iSurfaceSupported;
-				}
-			}
-		#endif // SYMBIAN_BUILD_GCE
-		#endif // SYMBIAN_ENABLE_MMF_MULTISCREEN_SUPPORT
-			
-		iSourceHandle = aHandle;
-		if (iCurrentConfig == iSecondaryConfig)
-			{
-			iState = EAddSink;
-			}
-		else	// completed ok !
-			{
-			iState = EIdle;
-			SendError(KErrNone, ETrue);
-			return;
-			}
-		}
-	else if (iState == EWaitingForSink)
-		{
-		iSinkHandle = aHandle;
-		if (iCurrentConfig == iSecondaryConfig)	// completed ok !
-			{
-			iState = EIdle;
-			iError = KErrNone;
-			SendError();
-			return;
-			}
-		else
-			{
-			iState = EAddSource;
-			}
-		}
-
-	KickState();
-	}
-
-void CMMFFindAndOpenController::SendError(TInt aError, TBool aOverrideError)
-	{
-	if (iError == KErrNone || aOverrideError)
-		{
-		iError = aError;		
-		}
-
-	iObserver.MfaocComplete(iError, iCurrentConfig->iController, iCurrentConfig->iControllerUid, &iSourceHandle, &iSinkHandle);
-
-	// if we've just attempted to open the Secondary controller, 
-	// try to open the Primary controller
-	if (iCurrentConfig == iSecondaryConfig)
-		{
-		if (iError == KErrNone)
-			OpenPrimaryController();
-		}
-
-	// if we failed to open, may as well free up some memory
-	// if open succeeded we need to preserve state in case of a re-open
-	if (iError != KErrNone)
-		{
-		if(iControllerIndex >= iControllerCount-1)
-			{
-			Close();
-			}
-		else //if there are other controllers selected in the controller list, try them
-			{
-			Cancel();
-			if(iAddDataSourceSinkAsync)
-				{
-				iAddDataSourceSinkAsync->Cancel();
-				}
-
- 			TryNextController();
-			}
-		}
-	}
-
-void CMMFFindAndOpenController::SchedSendError(TInt aError)
-	{
-	if (aError != KErrNone)
-		iError = aError;
-	iState = ESendError;
-	KickState();
-	}
-
-void CMMFFindAndOpenController::BuildControllerListFileNameL()
-	{
-	// Retrieve a list of possible controllers from ECOM
-	// If we don't have a match, leave with unsupported
-
-	iControllers.ResetAndDestroy();
-	iPrioritisedControllers.Reset();
-
-	TControllerMode mode = iCurrentConfig->iControllerMode;
-
-	// if we're playing, try to get the MIME type from the Content Access
-	// Framework (CAF) & use that to select a controller - if that fails, 
-	// try to select a controller based on the header data/file extension
-	
-	CMMFUtilityFileInfo* fileInfo = NULL;
-
-	TInt error;
-	
-	//If the current CMMSourceSink is a CMMFileSourceSink
-	// Using the previous version we'd get KErrCANoPermission when calling EvaluateIntent in the
-	// CMMFUtilityFileInfo ConstructL as the intent == EUnknown, so now pass the intent as a parameter
-	// to TMMFileHandleSource and....
-	TBool isSecureDrmProcess = EFalse;
-	//need to do this only in local playback mode
-	//UseSecureDRMProcess() function in called only in case of local play / record
-	// so we'll just chk for playback mode
-	if(mode == EPlayback)
-	    {
-	    TRAP(error, UseSecureDRMProcessL(isSecureDrmProcess));
-	    if(error == KErrPermissionDenied)
-	    	{
-	    	isSecureDrmProcess = ETrue;
-	    	}
-	    else
-	    	{
-	    	User::LeaveIfError(error);
-	    	}
-	    }
-    TRAP(error, fileInfo = CreateFileInfoL(isSecureDrmProcess));
-    
-	if (fileInfo != NULL)
-		{
-		CleanupDeletePushL(fileInfo);
-		}
-	
-	if (error != KErrNone)
-		{
-		// if playback mode, leave for any error
-		// if record mode, allow KErrNotFound
-		if (mode == EPlayback || (mode != EPlayback && error != KErrNotFound))
-			{
-			User::Leave(error);
-			}
-		}
-
-	CMMFControllerPluginSelectionParameters* cSelect = NULL;
-	if (isSecureDrmProcess)
-		{
-		cSelect = CMMFControllerSecureDrmPluginSelectionParameters::NewLC();
-		}
-	else
-		{
-		cSelect = CMMFControllerPluginSelectionParameters::NewLC();
-		}
-	RArray<TUid> mediaIds;
-	CleanupClosePushL(mediaIds);
-	User::LeaveIfError(mediaIds.Append(iMediaId));
-
-	cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType);
-
-	if (mode == EPlayback)
-		{
-		ASSERT(fileInfo!=NULL);
-		TBuf8<KMaxMimeLength> mimeType;
-		TBool mimeTypeKnown = fileInfo->GetFileMimeTypeL(mimeType);
-		if (mimeTypeKnown)
-			{
-			CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
-			fSelect->SetMatchToMimeTypeL(mimeType);
-			cSelect->SetRequiredPlayFormatSupportL(*fSelect);
-			cSelect->ListImplementationsL(iControllers);
-			CleanupStack::PopAndDestroy(fSelect);
-			}
-
-
-		// copy to the iPrioritisedControllers array - this is a NOOP if the 
-		// MIME type is not known since iControllers will be empty
-		ASSERT(mimeTypeKnown || iControllers.Count() == 0);
-		for (TInt controllerIndex=0; controllerIndex < iControllers.Count(); controllerIndex++)
-			User::LeaveIfError(iPrioritisedControllers.Append(iControllers[controllerIndex]));
-
-		iControllerCount = iPrioritisedControllers.Count();
-		if (iControllerCount > 0)
-			{
-			// Clean up
-			// cSelect, mediaIds, 
-			CleanupStack::PopAndDestroy(2, cSelect);
-			if (fileInfo != NULL)
-				{
-				CleanupStack::PopAndDestroy(fileInfo);
-				}
-			return;
-			}
-		}
-
-	// Retrieve header data first. If file doesn't exist, its ok.
-	HBufC8* headerData = HBufC8::NewLC(KMaxHeaderSize);
-	TPtr8 headerDataPtr = headerData->Des();
-	if (fileInfo)
-		{
-		fileInfo->GetFileHeaderDataL(headerDataPtr, KMaxHeaderSize);
-		}
-
-	// Get the filename's suffix
-	HBufC8* fileSuffix = CMMFClientUtility::GetFileExtensionL(iFileName);
-
-	CleanupStack::PushL(fileSuffix);
-	TPtr8 fileSuffixPtr = fileSuffix->Des();
-
-	// Get the secondary filename's header data (for convert)
-	HBufC8* headerDataSecondary = HBufC8::NewLC(KMaxHeaderSize);
-	TPtr8 headerDataPtrSecondary = headerDataSecondary->Des();
-	if (iFileNameSecondary.Length() > 0 && fileInfo)
-		{
-		fileInfo->GetFileHeaderDataL(headerDataPtrSecondary, KMaxHeaderSize);
-		}
-
-	// Get the secondary filename's suffix
-	HBufC8* fileSuffixSecondary = CMMFClientUtility::GetFileExtensionL(iFileNameSecondary);
-	CleanupStack::PushL(fileSuffixSecondary);
-	TPtr8 fileSuffixPtrSecondary = fileSuffixSecondary->Des();
-
-
-	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
-
-	if (mode == EPlayback || mode == EConvert)
-		cSelect->SetRequiredPlayFormatSupportL(*fSelect);
-	if (mode == ERecord || mode == EConvert)
-		cSelect->SetRequiredRecordFormatSupportL(*fSelect);
-	
-	cSelect->ListImplementationsL(iControllers);
-	
-	if (iControllers.Count()==0)
-		User::Leave(KErrNotSupported);
-
-	if (mode == ERecord)
-		{
-		CMMFClientUtility::PrioritiseControllersL(
-			iControllers, 
-			headerDataPtrSecondary, 
-			fileSuffixPtrSecondary, 
-			headerDataPtr, 
-			fileSuffixPtr, 
-			iPrioritisedControllers);
-		}
-	else
-		{
-		CMMFClientUtility::PrioritiseControllersL(
-			iControllers, 
-			headerDataPtr, 
-			fileSuffixPtr, 
-			headerDataPtrSecondary, 
-			fileSuffixPtrSecondary, 
-			iPrioritisedControllers);
-		}
-	
-	iControllerCount = iPrioritisedControllers.Count();
-	if (iControllerCount == 0)
-		User::Leave(KErrNotSupported);
-	
-	// Clean up
-	// cSelect, mediaIds, 
-	// headerData, fileSuffix, headerDataSecondary, fileSuffixSecondary, 
-	// fSelect
-	CleanupStack::PopAndDestroy(7, cSelect);
-	if (fileInfo != NULL)
-		{
-		CleanupStack::PopAndDestroy(fileInfo);
-		}
-	}
-
-void CMMFFindAndOpenController::BuildControllerListDescriptorL()
-	{
-	// Retrieve a list of possible controllers from ECOM
-	// If we don't have a match, leave with unsupported
-
-	iControllers.ResetAndDestroy();
-
-	CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
-	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
-
-	
-	RArray<TUid> mediaIds;
-	CleanupClosePushL(mediaIds);
-	User::LeaveIfError(mediaIds.Append(iMediaId));
-
-	cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType);
-	
-	TPtrC8 header = iDescriptor.Left(KMaxHeaderSize);
-	fSelect->SetMatchToHeaderDataL(header);
-	
-	
-	TControllerMode mode = iCurrentConfig->iControllerMode;
-	if (mode == EPlayback || mode == EConvert)
-		cSelect->SetRequiredPlayFormatSupportL(*fSelect);
-	if (mode == ERecord || mode == EConvert)
-		cSelect->SetRequiredRecordFormatSupportL(*fSelect);
-
-	cSelect->ListImplementationsL(iControllers);
-
-	iControllerCount = iControllers.Count();
-	if (iControllerCount == 0)
-		User::Leave(KErrNotSupported);
-
-	// Clean up
-	// cSelect, fSelect, mediaIds
-	CleanupStack::PopAndDestroy(3, cSelect);
-	}
-
-void CMMFFindAndOpenController::BuildControllerListUrlL()
-	{
-	// Retrieve a list of possible controllers from ECOM
-	// If we don't have a match, leave with unsupported
-
-	iControllers.ResetAndDestroy();
-
-	CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
-	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
-
-	RArray<TUid> mediaIds;
-	CleanupClosePushL(mediaIds);
-	User::LeaveIfError(mediaIds.Append(iMediaId));
-
-	cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType);
-	
-
- 	if (*iMimeType != KNullDesC8)
-		{
-		fSelect->SetMatchToMimeTypeL(*iMimeType);//We match to mime type
-		}
-	else
-		{
-		fSelect->SetMatchToUriSupportL(*iUrl);
-		}
-	
-	TControllerMode mode = iCurrentConfig->iControllerMode;
-	if (mode == EPlayback || mode == EConvert)
-		cSelect->SetRequiredPlayFormatSupportL(*fSelect);
-	if (mode == ERecord || mode == EConvert)
-		cSelect->SetRequiredRecordFormatSupportL(*fSelect);
-
-	cSelect->ListImplementationsL(iControllers);
-
-	iControllerCount = iControllers.Count();
-	if (iControllerCount == 0)
-		User::Leave(KErrNotSupported);
-
-	// Clean up
-	// cSelect, fSelect, mediaIds
-	CleanupStack::PopAndDestroy(3, cSelect);
-	}
-
-void CMMFFindAndOpenController::BuildControllerListFormatL()
-	{
-	// Retrieve a list of possible controllers from ECOM
-	// If we don't have a match, leave with unsupported
-
-	iControllers.ResetAndDestroy();
-	iPrioritisedControllers.Reset();
-
-	CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
-
-	// Select the media IDs to allow
-	RArray<TUid> mediaIds;
-	CleanupClosePushL(mediaIds);
-	User::LeaveIfError(mediaIds.Append(iMediaId));
-
-	cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType);
-
-	CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC();
-
-	TControllerMode mode = iCurrentConfig->iControllerMode;
-	if (mode == EPlayback || mode == EConvert)
-		cSelect->SetRequiredPlayFormatSupportL(*fSelect);
-	if (mode == ERecord || mode == EConvert)
-		cSelect->SetRequiredRecordFormatSupportL(*fSelect);
-
-	//Obtain a list of the controllers
-	cSelect->ListImplementationsL(iControllers);
-
-	CleanupStack::PopAndDestroy(3, cSelect); // cSelect, mediaIds, fSelect
-
-	iControllerCount = iControllers.Count();
-	if (iControllerCount == 0)
-		User::Leave(KErrNotSupported);
-
-	TUid formatUidPrimary;
-	TUid formatUidSecondary;
-	if (mode == ERecord)
-		{
-		formatUidSecondary = iFormatUid;
-		formatUidPrimary = iFormatUidSecondary;
-		}
-	else
-		{
-		formatUidPrimary = iFormatUid;
-		formatUidSecondary = iFormatUidSecondary;
-		}
-	
-	for (TInt controllerIndex=0; controllerIndex < iControllers.Count(); controllerIndex++)
-		{
-		const RMMFFormatImplInfoArray& recFormatInfo = iControllers[controllerIndex]->RecordFormats();
-		const RMMFFormatImplInfoArray& playFormatInfo = iControllers[controllerIndex]->PlayFormats();
-
-		TBool playFormatMatched = EFalse;
-		TBool recordFormatMatched = EFalse;
-
-		if (formatUidPrimary == KNullUid)
-			{
-			playFormatMatched = ETrue;
-			}
-		else
-			{
-			for(TInt playFormatIndex =0; playFormatIndex < playFormatInfo.Count(); playFormatIndex++)
-				{
-				if(playFormatInfo[playFormatIndex]->Uid() == formatUidPrimary)
-					{
-					playFormatMatched = ETrue;
-					break;
-					}
-				}
-			}
-
-		if (formatUidSecondary == KNullUid)
-			{
-			recordFormatMatched = ETrue;
-			}
-		else
-			{
-			for (TInt recFormatIndex =0; recFormatIndex < recFormatInfo.Count(); recFormatIndex++)
-				{
-				if (recFormatInfo[recFormatIndex]->Uid() == formatUidSecondary)
-					{
-					recordFormatMatched = ETrue;
-					break;
-					}
-				}
-			}
-
-		if (playFormatMatched && recordFormatMatched)
-			User::LeaveIfError(iPrioritisedControllers.Append(iControllers[controllerIndex]));
-		}
-
-	iControllerCount = iPrioritisedControllers.Count();
-	if (iControllerCount == 0)
-		User::Leave(KErrNotSupported);
-	}
-	
-CMMSourceSink* CMMFFindAndOpenController::CreateSourceSinkL(const TSourceSink& aParams) 
-	{
-	if (aParams.iUseFileHandle)
-		{
-		return CMMFileSourceSink::NewL(aParams.iUid, aParams.iFileHandle);
-		}
-	return CMMSourceSink::NewL(aParams.iUid, aParams.iConfigData);
-	}
-
-
-CMMSourceSink* CMMFFindAndOpenController::CreateSourceSinkL(const TMMSource& aSource) 
-	{	
-	if (!(aSource.SourceType()==KUidMMFileSource || 
-		aSource.SourceType()==KUidMMFileHandleSource))
-		User::Leave(KErrNotSupported);
-
-	return CMMFileSourceSink::NewL(KUidMmfFileSource, aSource);
-	}
-
-CMMFUtilityFileInfo* CMMFFindAndOpenController::CreateFileInfoL(TBool aSecureDRMMode)
-	{
-	CMMFUtilityFileInfo* fileInfo = NULL;
-	if (iUseFileHandle) 
-		{
-		if (iUniqueId != NULL)
-			{
-			TMMFileHandleSource fileHandleSource(iFileHandle, (*iUniqueId), iIntent,iEnableUi);
-			fileInfo = CMMFUtilityFileInfo::NewL(fileHandleSource, aSecureDRMMode);
-			}
-		else
-			{
-			TMMFileHandleSource fileHandleSource(iFileHandle);
-			fileInfo = CMMFUtilityFileInfo::NewL(fileHandleSource, aSecureDRMMode);
-			}
-		}
-	else
-		{
-		if (iUniqueId != NULL)
-			{
-			TMMFileSource fileSource(iFileName, (*iUniqueId), iIntent,iEnableUi);	
-			fileInfo = CMMFUtilityFileInfo::NewL(fileSource, aSecureDRMMode);
-			}
-		else
-			{
-			TMMFileSource fileSource(iFileName);	
-			fileInfo = CMMFUtilityFileInfo::NewL(fileSource, aSecureDRMMode);
-			}
-		}
-	return fileInfo;
-	}
-	
-EXPORT_C CMMFFindAndOpenController::TSourceSink::TSourceSink(TUid aUid, const TDesC8& aConfigData)	
-	: iConfigData(aConfigData)
-	{
-	iUid = aUid;
-
-	iUseFileHandle = EFalse;
-	}
-	
-EXPORT_C CMMFFindAndOpenController::TSourceSink::TSourceSink(TUid aUid, const RFile& aFile)	
-	: iConfigData(KNullDesC8)
-	{
-	iUid = aUid;
-
-	iFileHandle = aFile;
-	iUseFileHandle = ETrue;
-	}
-	
-EXPORT_C void CMMFFindAndOpenController::SetInitScreenNumber(TInt aScreenNumber, RMMFVideoSetInitScreenCustomCommands* aVideoSetInitScreenCustomCommands)
-	{	
-	iScreenNumber = aScreenNumber;
-	iVideoSetInitScreenCustomCommands = aVideoSetInitScreenCustomCommands;
-	}
-		
-CMMFFindAndOpenController::CConfig::CConfig()
-	{
-	}
-	
-void CMMFFindAndOpenController::CConfig::Close()
-	{
-	delete iSource;
-	iSource = NULL;
-	delete iSink;
-	iSink = NULL;
-	}
-CMMFFindAndOpenController::CConfig::~CConfig()
-	{
-	Close();
-	}
-
-void CMMFFindAndOpenController::UseSecureDRMProcessL(TBool& aIsSecureDrmProcess)
-    {
-    if(iHasDrmCapability)//if client has DRM capability, we never use Secure DRM Process
-        {
-        aIsSecureDrmProcess = EFalse;
-        return;
-        }       
-    TBool isDataProtected = EFalse;
-    ContentAccess::CContent* content = NULL;
-    TControllerMode mode = iCurrentConfig->iControllerMode;
-
-    //setting aUseSecureDrmProcess to false(default value)
-    aIsSecureDrmProcess = EFalse;
-
-    //need to proceed only in case of local playback mode
-    TUid sourceUid = iCurrentConfig->iSource->SourceSinkUid();
-    TBool localPlaybackMode = ( mode == EPlayback && 
-                                (sourceUid == KUidMmfFileSource || sourceUid == KUidMmfDescriptorSource) );
-    if(!localPlaybackMode)
-        {
-        return;
-        }
-
-    if (iUseFileHandle && iOwnFileHandle) 
-        {
-        content = ContentAccess::CContent::NewLC(iFileHandle);
-        }
-    else if(iFileName.Length())  //need to check if file name exist
-        {
-        content = ContentAccess::CContent::NewLC(iFileName);
-        }
-    else
-        {//in case of descriptor source content object will not be created
-        return;
-        }
-    TInt value = 0;
-    TInt error = KErrNone;
-    if(iUniqueId != NULL)
-    	{
-    	error = content->GetAttribute(EIsProtected, value, *iUniqueId );
-    	}
-    else
-    	{
-    	error = content->GetAttribute(EIsProtected, value);
-    	}
-    if( (error == KErrNone && value) || error == KErrPermissionDenied )
-        {//2nd condition can be true if GetAttribute checks for DRM cap and return error if not found
-        isDataProtected = ETrue;
-        }
-    else if( error != KErrNone && error != KErrPermissionDenied)
-        {//leaving as GetAttribute of CAF caused an error.
-        User::Leave(error);
-        }
-
-    CleanupStack::PopAndDestroy(content);
-    if(isDataProtected && !iHasDrmCapability && mode == EPlayback)
-        {//only when the Data is protected and client does not have the DRM capability, we need secure DRM process
-        aIsSecureDrmProcess = ETrue;
-        }
-    }
-
-EXPORT_C CMMSourceSink* CMMSourceSink::NewLC(TUid aUid, const TDesC8& aDescriptor)
-	{
-	CMMSourceSink* self = new (ELeave) CMMSourceSink(aUid);	
-	CleanupStack::PushL(self);
-	self->ConstructL(aDescriptor);
-	return self;
-	}
-
-EXPORT_C CMMSourceSink* CMMSourceSink::NewL(TUid aUid, const TDesC8& aDescriptor)
-	{
-	CMMSourceSink* sourcesink = CMMSourceSink::NewLC(aUid, aDescriptor);
-	CleanupStack::Pop(sourcesink);
-	return sourcesink;
-	}
-
-CMMSourceSink::CMMSourceSink(TUid aUid)
-	: iUid(aUid)
-	{
-	}
-	
-CMMSourceSink::~CMMSourceSink()
-	{
-	delete iBuf;
-	}
-	
-void CMMSourceSink::ConstructL(const TDesC8& aDescriptor)
-	{
-	iBuf = aDescriptor.AllocL();
-	}
-	
-TUid CMMSourceSink::SourceSinkUid() const
-	{
-	return iUid;
-	}
-	
-const TDesC8& CMMSourceSink::SourceSinkData() const
-	{
-	return *iBuf;
-	}
-	
-TBool CMMSourceSink::CarryingFileHandle() const
-	{
-	return EFalse;
-	}
-
-EXPORT_C CMMFileSourceSink* CMMFileSourceSink::NewLC(TUid aUid, const RFile& aFile)
-	{
-	CMMFileSourceSink* self = new (ELeave) CMMFileSourceSink(aUid);	
-	CleanupStack::PushL(self);
-	self->ConstructL(aFile);
-	return self;
-	}
-
-EXPORT_C CMMFileSourceSink* CMMFileSourceSink::NewL(TUid aUid, const RFile& aFile)
-	{
-	CMMFileSourceSink* sourcesink = CMMFileSourceSink::NewLC(aUid, aFile);
-	CleanupStack::Pop(sourcesink);
-	return sourcesink;
-	}
-	
-CMMFileSourceSink::CMMFileSourceSink(TUid aUid)
-	: CMMSourceSink(aUid)
-	{
-	}
-
-void CMMFileSourceSink::ConstructL(const RFile& aFile)
-	{
-	User::LeaveIfError(iHandle.Duplicate(aFile));
-	iUsingFileHandle = ETrue;
-	iFileName = HBufC::NewMaxL(KMaxFileName);
-	TPtr fileNamePtr = iFileName->Des();
-	iHandle.Name(fileNamePtr);
-	DoCreateFileHandleSourceConfigDataL();
-	}
-
-void CMMFileSourceSink::DoCreateFileHandleSourceConfigDataL()
-	{
-	CBufFlat* buf = CBufFlat::NewL(KExpandSize);
-	CleanupStack::PushL(buf);
-	RBufWriteStream stream;
-	stream.Open(*buf);
-	CleanupClosePushL(stream);
-	
-	TPckgBuf<RFile*> fileptr(&iHandle);
-	stream.WriteInt32L(KMMFileHandleSourceUid.iUid);
-	stream.WriteL(fileptr);
-	
-	TInt length = 0;
-	if (iUniqueId != NULL)
-		length = iUniqueId->Length();
-	stream.WriteInt32L(length);
-	if (length>0)
-		stream.WriteL(*iUniqueId);
-	
-	stream.WriteInt32L(iEnableUI);
-	
-	stream.CommitL();
-	CleanupStack::PopAndDestroy(&stream);		
-	iSourceSinkData = buf->Ptr(0).AllocL();
-	
-	CleanupStack::PopAndDestroy(buf); 
-	}
-	
-const TDesC8& CMMFileSourceSink::SourceSinkData() const
-	{
-	ASSERT(iSourceSinkData);
-	return *iSourceSinkData;
-	}
-
-CMMFileSourceSink::~CMMFileSourceSink()
-	{
-	iHandle.Close(); // delete whatever
-	delete iFileName;
-	delete iSourceSinkData;
-	delete iUniqueId;
-	}
-
-EXPORT_C CMMFileSourceSink* CMMFileSourceSink::NewLC(TUid aUid, const TMMSource& aSource)
-	{
-	CMMFileSourceSink* self = new (ELeave) CMMFileSourceSink(aUid);	
-	CleanupStack::PushL(self);
-	self->ConstructL(aSource);
-	return self;
-	}
-
-EXPORT_C CMMFileSourceSink* CMMFileSourceSink::NewL(TUid aUid, const TMMSource& aSource)
-	{
-	CMMFileSourceSink* sourcesink = CMMFileSourceSink::NewLC(aUid, aSource);
-	CleanupStack::Pop(sourcesink);
-	return sourcesink;
-	}
-	
-void CMMFileSourceSink::ConstructL(const TMMSource& aSource)
-	{
-	iUniqueId = aSource.UniqueId().AllocL();
-	iIntent = aSource.Intent();
-	iEnableUI = aSource.IsUIEnabled();
-	
-	if (aSource.SourceType() == KUidMMFileSource)
-		{
-		const TMMFileSource& fileSource = static_cast<const TMMFileSource&>(aSource);
-		iFileName = fileSource.Name().AllocL();
-		
-		DoCreateFileSourceConfigDataL();
-		}
-	else if (aSource.SourceType() == KUidMMFileHandleSource)
-		{
-		const TMMFileHandleSource& fileHandleSource = static_cast<const TMMFileHandleSource&>(aSource);
-		iHandle.Close(); // in case already open
-		User::LeaveIfError(iHandle.Duplicate(fileHandleSource.Handle()));
-		iUsingFileHandle = ETrue;
-		iFileName = HBufC::NewMaxL(KMaxFileName);
-		TPtr fileNamePtr = iFileName->Des();
-		iHandle.Name(fileNamePtr);
-		
-		DoCreateFileHandleSourceConfigDataL();
-		}
-	else
-		{
-		User::Leave(KErrNotSupported);
-		}
-	}
-	
-void CMMSourceSink::EvaluateIntentL()
-	{
-	}
-	
-void CMMFileSourceSink::EvaluateIntentL()
-	{
-	if (iUsingFileHandle)
-		{
-   		ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(iHandle);
-   		Content->OpenContentLC(iIntent, *iUniqueId);
-   		CleanupStack::PopAndDestroy(2, Content);	
-		}
-	else	
-		{
-		ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(*iFileName);
-   		Content->OpenContentLC(iIntent, *iUniqueId);
-   		CleanupStack::PopAndDestroy(2, Content);
-		}
-	}
-
-
-	
-EXPORT_C void CMMFileSourceSink::EvaluateIntentL(ContentAccess::TIntent aIntent)
-	{
-	if (iUsingFileHandle)
-		{
-   		ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(iHandle);
-   		Content->OpenContentLC(aIntent, *iUniqueId);
-   		CleanupStack::PopAndDestroy(2, Content);	
-		}
-	else	
-		{
-		ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(*iFileName);
-   		Content->OpenContentLC(aIntent, *iUniqueId);
-   		CleanupStack::PopAndDestroy(2, Content);
-		}
-	}
-
-void CMMFileSourceSink::DoCreateFileSourceConfigDataL()
-	{
-	CBufFlat* buf = CBufFlat::NewL(KExpandSize);
-	CleanupStack::PushL(buf);
-	RBufWriteStream stream;
-	stream.Open(*buf);
-	CleanupClosePushL(stream);
-	
-	stream.WriteInt32L(KMMFileSourceUid.iUid);
-	stream.WriteInt32L(iFileName->Length());
-	stream.WriteL(*iFileName);
-	TInt length = 0;
-	if (iUniqueId != NULL)
-		length = iUniqueId->Length();
-	stream.WriteInt32L(length);
-	if (length>0)
-		stream.WriteL(*iUniqueId);
-	
-	stream.WriteInt32L(iEnableUI);
-	
-	stream.CommitL();
-	CleanupStack::PopAndDestroy(&stream);
-	iSourceSinkData = buf->Ptr(0).AllocL();
-		
-	CleanupStack::PopAndDestroy(buf); 
-	}	
-	
-TBool CMMFileSourceSink::CarryingFileHandle() const
-	{
-	return iUsingFileHandle;
-	}
-
-
--- a/breakdeps/mmfclientutility.h	Fri Nov 12 12:01:15 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,510 +0,0 @@
-// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// Client utility functions
-// 
-//
-
-#ifndef __MMF_CLIENT_UTILITY_H__
-#define __MMF_CLIENT_UTILITY_H__
-
-#include <mda/common/audio.h>
-#include <mda/common/gsmaudio.h>
-#include <mda/client/utility.h>
-#include <mmf/common/mmffourcc.h>
-#include <mmfformatimplementationuids.hrh>
-#include "mmf/common/mmfcontrollerpluginresolver.h"
-#include <mmf/server/mmffile.h>
-#include <mmf/server/mmfdes.h>
-#include "mmf/common/mmfcontroller.h"
-
-#include <f32file.h>
-#include <caf/content.h>
-#include <caf/data.h>
-#include <mmf/common/mmfstandardcustomcommands.h>
-#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
-#include <mmf/common/mmfstandardcustomcommandsenums.h>
-#include <mmf/common/mmfstandardcustomcommandsimpl.h>
-#endif
-#ifdef SYMBIAN_BUILD_GCE
-#include <mmf/common/mmfvideosurfacecustomcommands.h>
-#endif
-
-class CMMSourceSink; // declared here.
-
-NONSHARABLE_CLASS( CMMSourceSink ): public CBase
-	{
-public:
-	IMPORT_C static CMMSourceSink* NewL(TUid aUid, const TDesC8& aDescriptor);
-	IMPORT_C static CMMSourceSink* NewLC(TUid aUid, const TDesC8& aDescriptor);
-
-	virtual ~CMMSourceSink();
-	virtual TUid SourceSinkUid() const;
-	virtual const TDesC8& SourceSinkData() const;
-	
-	virtual TBool CarryingFileHandle() const;
-	
-	virtual void EvaluateIntentL();
-protected:
-	CMMSourceSink(TUid aUid);	
-	
-	
-private:
-	void ConstructL(const TDesC8& aDescriptor);
-	
-	const TUid iUid;
-	HBufC8* iBuf;
-	};
-
-	
-
-
-class CMMFileSourceSink; // declared here.	
-	
-NONSHARABLE_CLASS( CMMFileSourceSink ): public CMMSourceSink
-	{
-public:
-	IMPORT_C static CMMFileSourceSink* NewL(TUid aUid, const RFile& aFile);
-	IMPORT_C static CMMFileSourceSink* NewLC(TUid aUid, const RFile& aFile);
-
-	IMPORT_C static CMMFileSourceSink* NewL(TUid aUid, const TMMSource& aMMSource);			
-	IMPORT_C static CMMFileSourceSink* NewLC(TUid aUid, const TMMSource& aMMSource);
-
-	const TDesC& UniqueId() const {return *iUniqueId;}
-
-	virtual ~CMMFileSourceSink();
-	
-	const TDesC& FileName() const {return *iFileName;}
-	const TDesC8& SourceSinkData() const;
-		
-	IMPORT_C void EvaluateIntentL(ContentAccess::TIntent aIntent);
-	virtual void EvaluateIntentL();
-	
-	TBool CarryingFileHandle() const;
-		
-	TBool UsingFileHandle() const {return iUsingFileHandle;};
-	const RFile& FileHandle() const {return iHandle;};
-protected:
-	CMMFileSourceSink(TUid aUid);
-	
-private:
-	void ConstructL(const TMMSource& aSource);
-	void DoCreateFileSourceConfigDataL();
-	void ConstructL(const RFile& aFile);
-	void DoCreateFileHandleSourceConfigDataL();
-	
-	TBool iUsingFileHandle;
-	RFile iHandle;
-	HBufC* iFileName;
-	HBufC8* iSourceSinkData;
-	HBufC* iUniqueId;
-	ContentAccess::TIntent iIntent;
-
-	TBool	iEnableUI;
-	};
-	
-
-
-class CMMFMdaObjectStateChangeObserverCallback; // declared here.
-/**
-Active object utility class to allow the callback to be called asynchronously.
-This should help prevent re-entrant code in clients of the mediaframework.
-*/
-NONSHARABLE_CLASS( CMMFMdaObjectStateChangeObserverCallback ): public CActive
-	{
-public:
-	IMPORT_C static CMMFMdaObjectStateChangeObserverCallback* NewL(MMdaObjectStateChangeObserver& aCallback);
-	virtual ~CMMFMdaObjectStateChangeObserverCallback();
-	IMPORT_C void CallBack(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode);
-private:
-	CMMFMdaObjectStateChangeObserverCallback(MMdaObjectStateChangeObserver& aCallback);
-	void RunL();
-	void DoCancel();
-private:
-	MMdaObjectStateChangeObserver& iCallback;
-	CBase* iObject;
-	TInt iPreviousState;
-	TInt iCurrentState;
-	TInt iErrorCode;
-	};
-
-class CMMFClientUtility; // declared here.
-
-NONSHARABLE_CLASS( CMMFClientUtility )
-	{
-public:
-	IMPORT_C static TUid ConvertMdaFormatUidToECOMWrite(TUid aMdaFormatUid); 
-	IMPORT_C static TUid ConvertMdaFormatUidToECOMRead(TUid aMdaFormatUid); 
-	IMPORT_C static TFourCC ConvertMdaCodecToFourCC(TMdaPackage& aCodec);
-	IMPORT_C static TInt GetFileHeaderData(const TDesC& aFileName, TDes8& aHeaderData, TInt aMaxLength);
-	IMPORT_C static HBufC8* GetFileExtensionL(const TDesC& aFileName);
-	static void PrioritiseControllersL(
-		const RMMFControllerImplInfoArray& aControllers, 
-		const TDesC8& aHeaderDataPlayback, 
-		const TDesC8& aFileExtensionPlayback, 
-		const TDesC8& aHeaderDataRecord, 
-		const TDesC8& aFileExtensionRecord, 
-		RMMFControllerImplInfoArray& aPrioritisedControllers);
-	static TInt GetBestMatchL(const CMMFFormatImplementationInformation* format, const TDesC8& aHeaderData, const TDesC8& aFileExtension);
-
-private:
-	CMMFClientUtility();
-	};
-
-class CMMFUtilityFileInfo; // declared here.
-class RMMFDRMPluginServerProxy;
-
-NONSHARABLE_CLASS( CMMFUtilityFileInfo ): public CBase
-	{
-public:
-
-	static CMMFUtilityFileInfo* NewL(TMMSource& aSource, TBool aSecureDRMMode = EFalse);
-	static CMMFUtilityFileInfo* NewLC(TMMSource& aSource, TBool aSecureDRMMode = EFalse);
-
-	~CMMFUtilityFileInfo();
-	
-	TBool GetFileMimeTypeL(TDes8& aMimeType);
-	void  GetFileHeaderDataL(TDes8& aHeaderData, TInt aMaxLength);
-	TInt EvaluateIntent(ContentAccess::TIntent aIntent);
-
-private:
-	CMMFUtilityFileInfo();
-
-	void ConstructL(const TMMSource& aSource, TBool aSecureDRMMode);
-
-private:
-	ContentAccess::CData* iData;
-	RMMFDRMPluginServerProxy* iDrmPluginServer;
-	};
-
-inline CMMFUtilityFileInfo::CMMFUtilityFileInfo()
-	{
-	};
-
-/**
- * Mixin class that the user of the class CMMFFindAndOpenController must derive from.
- * @internalComponent
- */
-class MMMFFindAndOpenControllerObserver
-	{
-public:
-	/**
-	 * Callback function to indicate the success or failure
-	 * of an attempt to find and open a suitable controller and 
-	 * to add a source and sink.
-	 * @see CMMFFindAndOpenController
-	 * 
-	 * @param aError 
-	 *        Indicates whether a controller has been opened sucessfully
-	 *        This is passed by reference, mainly for the audio recorder utility 
-	 *        which opens two controllers: if the secondary controller (which is
-	 *        always opened first) fails to open, then the audio recorder utility
-	 *        may choose to set aError = KErrNone in the MfaocComplete() callback 
-	 *        to indicate to CFindAndOpenControler() that it should continue 
-	 *        to open the primary controller, even though opening the secondary failed.
-	 * @param aController
-	 *        A pointer to the controller that has been opened or has failed to open
-	 *        This is mainly for the audio recorder utility to indicate  
-	 *        which controller (primary or secondary) has been opened.
-	 * @param aControllerUid
-	 *        the UID of the controller that has been opened
-	 * @param aSourceHandle
-	 *        a pointer to the source handle
-	 * @internalComponent
-	 *        a pointer to the sink handle
-	 */
-	virtual void MfaocComplete(
-		TInt& aError, 
-		RMMFController* aController, 
-		TUid aControllerUid = KNullUid, 
-		TMMFMessageDestination* aSourceHandle = NULL, 
-		TMMFMessageDestination* aSinkHandle = NULL) = 0;
-	};
-
-
-class CMMFFindAndOpenController; // declared here.
-/**
- * Utility class used by the MMF client API classes.
- * Finds and opens a suitable controller and adds a source and a sink 
- * asynchronously. Completion is indicated asynchronously 
- * using the MMMFFindAndOpenControllerObserver mixin class.
- *
- * @internalComponent
- */
-NONSHARABLE_CLASS( CMMFFindAndOpenController ): public CActive, public MMMFAddDataSourceSinkAsyncObserver
-	{
-public:
-	enum TControllerMode
-		{
-		EPlayback,
-		ERecord,
-		EConvert
-		};
-		
-	enum TControllerNumber
-		{
-		EPrimaryController,
-		ESecondaryController
-		};
-
-	class TSourceSink
-		{
-	public:
-		IMPORT_C TSourceSink(TUid aUid, const TDesC8& aData = KNullDesC8);
-		IMPORT_C TSourceSink(TUid aUid, const RFile& aFile);
-		
-		TUid iUid;
-		const TDesC8& iConfigData;
-		TBool iUseFileHandle;
-		RFile iFileHandle;
-		};
-
-
-
-
-public:
-	IMPORT_C static CMMFFindAndOpenController* NewL(MMMFFindAndOpenControllerObserver& aObserver);
-	virtual ~CMMFFindAndOpenController();
-	
-	// from CActive
-	virtual void DoCancel();
-	virtual void RunL();
-
-	// from MMMFAddDataSourceSinkAsyncObserver
-	virtual void MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle);
-	
-	IMPORT_C void Configure(
-		TUid aMediaId, 
-		TMMFPrioritySettings aPrioritySettings,
-		CMMFPluginSelectionParameters::TMediaIdMatchType aMediaIdMatchType = CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds);
-	
-	IMPORT_C void ConfigureController(RMMFController& aController, CMMFControllerEventMonitor& aEventMonitor, TControllerMode aControllerMode = EPlayback);
-	IMPORT_C void ConfigureSecondaryController(RMMFController& aController, CMMFControllerEventMonitor& aEventMonitor, TControllerMode aControllerMode = EPlayback);
-	
-	IMPORT_C void UseSharedHeap();
-	
-	IMPORT_C void ConfigureSourceSink(
-		TSourceSink aSource,
-		TSourceSink aSink);
-	IMPORT_C void ConfigureSecondarySourceSink(
-		TSourceSink aSource,
-		TSourceSink aSink);
-	
-	IMPORT_C void ConfigureSourceSink(
-		const TMMSource& aSource, 
-		TSourceSink aSink);
-	
-	IMPORT_C void OpenByFileSource(const TMMSource& aFileSource, const TDesC& aFileNameSecondary = KNullDesC);	
-
-	IMPORT_C void OpenByFormatUid(TUid aFormatUid, TUid aFormatUidSecondary = KNullUid);
-	IMPORT_C void OpenByDescriptor(const TDesC8& aDescriptor);
-	IMPORT_C void OpenByUrl(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType);
-	IMPORT_C void OpenByControllerUid(TUid aControllerUid, TUid aSecondaryControllerUid = KNullUid);
-	IMPORT_C void ReOpen();
-	IMPORT_C void Close();
-
-	IMPORT_C static TMMFFileConfig GetConfigFile(const TDesC& aFileName);
-	IMPORT_C static TMMFDescriptorConfig GetConfigDescriptor(const TDesC8& aDescriptor);
-	IMPORT_C void CloseConfig();
-	IMPORT_C static void GetConfigUrlL(CBufFlat*& aUrlCfgBuffer, const TDesC& aUrl, TInt aIapId);
-	
-	/** made public to check for further selected controllers in the queue */
-	inline TInt ControllerIndex() const;
-	inline TInt ControllerCount() const; 
-	
-	/** made public to stop checking for further selected controllers in the queue */
-	inline TBool StopTryLoadController() const;
-	IMPORT_C void SetInitScreenNumber(TInt aScreenNumber, RMMFVideoSetInitScreenCustomCommands* aVideoSetInitScreenCustomCommands);
-#ifdef SYMBIAN_BUILD_GCE
-	inline void SetSurfaceMode(TBool aUseSurface, RMMFVideoPlaySurfaceSupportCustomCommands* aVideoPlaySurfaceSupportCustomCommands);
-	inline TInt SurfaceSupported();
-#endif
-	
-private:
-	class CConfig: public CBase
-		{
-	public:
-		CConfig();
-		~CConfig();
-		void Close();
-	public:
-		RMMFController* iController;				// not owned
-		CMMFControllerEventMonitor* iEventMonitor;	// not owned
-		
-		/** indicates whether this controller is being used for 
-		playback, recording or converting */
-		TControllerMode iControllerMode;
-		
-		CMMSourceSink* iSource;
-		CMMSourceSink* iSink;
-		TUid iControllerUid;
-		};
-
-	CMMFFindAndOpenController(MMMFFindAndOpenControllerObserver& aObserver);
-	void ConstructL();
-
-	void Init();
-
-	void ConfigureSourceSink(
-		CConfig& config,
-		TSourceSink aSource, 
-		TSourceSink aSink);
-		
-	void ConfigureSourceSink(
-		CConfig& config,
-		const TMMSource& aSource, 
-		TSourceSink aSink);
-
-
-	void ConfigureController(
-		CConfig& config,
-		RMMFController& aController, 
-		CMMFControllerEventMonitor& aEventMonitor,
-		TControllerMode aControllerMode);
-
-	void CloseController();
-
-	void OpenPrimaryController(void);
-
-	void KickState();
-	void Process();
-	void SendError(TInt aError = KErrNone, TBool aForcedError = EFalse);
-	void SchedSendError(TInt aError = KErrNone);
-	void BuildControllerListFileNameL();
-	void BuildControllerListDescriptorL();
-	void BuildControllerListUrlL();
-	void BuildControllerListFormatL();
-	void TryNextController();
-	
-	CMMSourceSink* CreateSourceSinkL(const TSourceSink& aParams);
-	CMMSourceSink* CreateSourceSinkL(const TMMSource& aSource);
-
-	CMMFUtilityFileInfo* CreateFileInfoL(TBool aSecureDRMMode = EFalse);
-	void UseSecureDRMProcessL(TBool& aIsSecureDrmProcess);
-private:
-	/** primary controller details */
-	CConfig* iPrimaryConfig;
-	/** secondary controller details */
-	CConfig* iSecondaryConfig;
-	/** points to either iPrimaryConfig or iSecondaryConfig */
-	CConfig* iCurrentConfig;	// not owned
-
-	enum TMode
-		{
-		EOpenByControllerUid,
-		EOpenByFileName,
-		EOpenByDescriptor,
-		EOpenByUrl,
-		EOpenByFormatUid
-		};
-	TMode iMode;
-
-	/** indicates what state the state machine is in */
-	enum TState
-		{
-		EIdle,
-		EBuildControllerList,
-		EOpenController,
-		EAddSource,
-		EAddSink,
-		EWaitingForSource,
-		EWaitingForSink,
-		ESendError
-		};
-	TState iState;
-
-	MMMFFindAndOpenControllerObserver& iObserver;
-	CMMFAddDataSourceSinkAsync* iAddDataSourceSinkAsync;
-
-	TInt iControllerIndex;
-	TInt iControllerCount; 
-
-	TFileName iFileNameSecondary;	// for converting
-
-	TFileName iFileName;
-	TBool iUseFileHandle;
-	TBool iOwnFileHandle;
-	HBufC* iUniqueId; 
-	RFile iFileHandle;
-	ContentAccess::TIntent iIntent;
-
-	HBufC* iUrl;
-	HBufC8* iMimeType;
-	TPtr8 iDescriptor;
-	TInt iIapId;
-	TUid iFormatUid;
-	TUid iFormatUidSecondary;	// for converting
-
-	TUid iMediaId;
-	TMMFPrioritySettings iPrioritySettings;
-	CMMFPluginSelectionParameters::TMediaIdMatchType iMediaIdMatchType;
-
-	RMMFControllerImplInfoArray iControllers;
-	RMMFControllerImplInfoArray iPrioritisedControllers;
-
-	// if this is non-null, then it points to an element in
-	// either iControllers or iPrioritisedControllers
-	CMMFControllerImplementationInformation* iControllerImplInfo;	// not owned
-
-	TControllerMode iControllerMode;
-	TBool iSourceSinkConfigured;
-	TInt iError;
-
-	TMMFMessageDestination iSourceHandle;
-	TMMFMessageDestination iSinkHandle;
-	TBool iEnableUi;
-	
-	TBool iUseSharedHeap; // should new controllers use shared heaps?
-	TBool iStopTryLoadController; //stop to try loading the selected conrollers from the list
-	RMMFVideoSetInitScreenCustomCommands* iVideoSetInitScreenCustomCommands;
-	TInt iScreenNumber;
-	TBool iHasDrmCapability;
-	TBool iUsingSecureDrmProcess;	
-
-#ifdef SYMBIAN_BUILD_GCE
-	RMMFVideoPlaySurfaceSupportCustomCommands* iVideoPlaySurfaceSupportCustomCommands;
-	TBool iUseVPU2;
-	TInt iSurfaceSupported;
-#endif	
-	};
-	
-inline TInt CMMFFindAndOpenController::ControllerIndex() const
-	{
-	return iControllerIndex;
-	}
-	
-inline TInt CMMFFindAndOpenController::ControllerCount() const
-	{
-	return iControllerCount;
-	}
-	
-inline TBool CMMFFindAndOpenController::StopTryLoadController() const
-	{
-	return iStopTryLoadController;
-	}
-
-#ifdef SYMBIAN_BUILD_GCE
-inline void CMMFFindAndOpenController::SetSurfaceMode(TBool aUseVPU2, RMMFVideoPlaySurfaceSupportCustomCommands* aVideoPlaySurfaceSupportCustomCommands)
-	{
-	iUseVPU2 = aUseVPU2;
-	iSurfaceSupported = KErrNone;
-	iVideoPlaySurfaceSupportCustomCommands = aVideoPlaySurfaceSupportCustomCommands;
-	}
-	
-inline TInt CMMFFindAndOpenController::SurfaceSupported()
-	{
-	return iSurfaceSupported;
-	}
-#endif	// SYMBIAN_BUILD_GCE
-
-#endif // __MMF_CLIENT_UTILITY_H__
--- a/eabi/MediaClientAudio.def	Fri Nov 12 12:01:15 2010 +0000
+++ b/eabi/MediaClientAudio.def	Wed Nov 17 15:47:05 2010 +0000
@@ -12,12 +12,12 @@
 	_ZN22CMdaAudioPlayerUtility10GetBalanceERi @ 11 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility10GetBitRateERj @ 12 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility10SetBalanceEi @ 13 NONAME ABSENT
-	_ZN22CMdaAudioPlayerUtility11GetPositionER25TTimeIntervalMicroSeconds @ 14 NONAME ABSENT ; # Stem
-	_ZN22CMdaAudioPlayerUtility11SetPositionERK25TTimeIntervalMicroSeconds @ 15 NONAME ABSENT ; # Stem
+	_ZN22CMdaAudioPlayerUtility11GetPositionER25TTimeIntervalMicroSeconds @ 14 NONAME ; # Stem
+	_ZN22CMdaAudioPlayerUtility11SetPositionERK25TTimeIntervalMicroSeconds @ 15 NONAME ; # Stem
 	_ZN22CMdaAudioPlayerUtility11SetPriorityEii @ 16 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility13NewDesPlayerLERK6TDesC8R23MMdaAudioPlayerCallbackiiP10CMdaServer @ 17 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility13SetPlayWindowERK25TTimeIntervalMicroSecondsS2_ @ 18 NONAME ABSENT
-	_ZN22CMdaAudioPlayerUtility14NewFilePlayerLERK7TDesC16R23MMdaAudioPlayerCallbackiiP10CMdaServer @ 19 NONAME ABSENT ; # Stem
+	_ZN22CMdaAudioPlayerUtility14NewFilePlayerLERK7TDesC16R23MMdaAudioPlayerCallbackiiP10CMdaServer @ 19 NONAME ; # Stem
 	_ZN22CMdaAudioPlayerUtility14WillResumePlayEv @ 20 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility15ClearPlayWindowEv @ 21 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility17CustomCommandSyncERK8TPckgBufI22TMMFMessageDestinationEiRK6TDesC8S7_ @ 22 NONAME ABSENT
@@ -33,14 +33,14 @@
 	_ZN22CMdaAudioPlayerUtility35RegisterForAudioLoadingNotificationER21MAudioLoadingObserver @ 32 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility36ControllerImplementationInformationLEv @ 33 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility39CancelRegisterAudioResourceNotificationE4TUid @ 34 NONAME ABSENT
-	_ZN22CMdaAudioPlayerUtility4NewLER23MMdaAudioPlayerCallbackii @ 35 NONAME ABSENT ; # Stem
-	_ZN22CMdaAudioPlayerUtility5CloseEv @ 36 NONAME ABSENT ; # Stem
-	_ZN22CMdaAudioPlayerUtility5PauseEv @ 37 NONAME ABSENT ; # Stem
+	_ZN22CMdaAudioPlayerUtility4NewLER23MMdaAudioPlayerCallbackii @ 35 NONAME ; # Stem
+	_ZN22CMdaAudioPlayerUtility5CloseEv @ 36 NONAME ; # Stem
+	_ZN22CMdaAudioPlayerUtility5PauseEv @ 37 NONAME ; # Stem
 	_ZN22CMdaAudioPlayerUtility8OpenDesLERK6TDesC8 @ 38 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility8OpenUrlLERK7TDesC16iRK6TDesC8 @ 39 NONAME ABSENT
 	_ZN22CMdaAudioPlayerUtility9GetVolumeERi @ 40 NONAME ABSENT
-	_ZN22CMdaAudioPlayerUtility9OpenFileLERK5RFile @ 41 NONAME ABSENT ; # Stem
-	_ZN22CMdaAudioPlayerUtility9OpenFileLERK7TDesC16 @ 42 NONAME ABSENT ; # Stem
+	_ZN22CMdaAudioPlayerUtility9OpenFileLERK5RFile @ 41 NONAME ; # Stem
+	_ZN22CMdaAudioPlayerUtility9OpenFileLERK7TDesC16 @ 42 NONAME ; # Stem
 	_ZN22CMdaAudioPlayerUtility9OpenFileLERK9TMMSource @ 43 NONAME ABSENT
 	_ZN23CMdaAudioConvertUtility13SourceFormatLEv @ 44 NONAME ABSENT
 	_ZN23CMdaAudioConvertUtility14SourceBitRateLEv @ 45 NONAME ABSENT