breakdeps/mmfclientaudioplayer.cpp
changeset 129 4a58d534bdaa
parent 128 8338c5c25b5b
equal deleted inserted replaced
128:8338c5c25b5b 129:4a58d534bdaa
    15 
    15 
    16 #include <bautils.h>
    16 #include <bautils.h>
    17 #include <utf.h>
    17 #include <utf.h>
    18 #include <mmf/common/mmfpaniccodes.h>
    18 #include <mmf/common/mmfpaniccodes.h>
    19 #include "mmfclientaudioplayer.h"
    19 #include "mmfclientaudioplayer.h"
    20 #include "mmfclientutility.h"
    20 //#include "mmfclientutility.h"
    21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    21 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    22 #include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
    22 //#include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
    23 #include <mmf/common/mmfdurationinfocustomcommandsenums.h>
    23 //#include <mmf/common/mmfdurationinfocustomcommandsenums.h>
    24 #endif
    24 #endif
    25 
    25 
    26 using namespace ContentAccess;
    26 using namespace ContentAccess;
    27 
    27 
    28 // declared in the recorder module
    28 // declared in the recorder module
   438 */
   438 */
   439 EXPORT_C void CMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
   439 EXPORT_C void CMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
   440 	{
   440 	{
   441 	ASSERT(iProperties);
   441 	ASSERT(iProperties);
   442 	RFile& file = const_cast<RFile&>(aFile);
   442 	RFile& file = const_cast<RFile&>(aFile);
   443 	TMMFileHandleSource tfs(file, KDefaultContentObject, EPlay);
   443 	//TMMFileHandleSource tfs(file, KDefaultContentObject, EPlay);
   444 	iProperties->OpenFileL(tfs);
   444 	TMMFileHandleSource * tfs;
       
   445 	iProperties->OpenFileL(*tfs);
   445 	}
   446 	}
   446 
   447 
   447 /**
   448 /**
   448 Opens an audio clip from a file.
   449 Opens an audio clip from a file.
   449 
   450 
  1017 																		CMdaServer* /*aServer*/)
  1018 																		CMdaServer* /*aServer*/)
  1018 	{
  1019 	{
  1019 	CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
  1020 	CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
  1020 	CleanupStack::PushL(self);
  1021 	CleanupStack::PushL(self);
  1021 	self->ConstructL();
  1022 	self->ConstructL();
  1022 	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
  1023 	//TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
  1023 	self->OpenFileL(filesource);
  1024 	TMMFileSource * filesource;
       
  1025 	self->OpenFileL(*filesource);
  1024 	CleanupStack::Pop(self);
  1026 	CleanupStack::Pop(self);
  1025 	return self;
  1027 	return self;
  1026 	}
  1028 	}
  1027 
  1029 
  1028 CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewDesPlayerL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
  1030 CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewDesPlayerL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
  1045 	return self;
  1047 	return self;
  1046 	}
  1048 	}
  1047 
  1049 
  1048 void CMMFMdaAudioPlayerUtility::UseSharedHeap()
  1050 void CMMFMdaAudioPlayerUtility::UseSharedHeap()
  1049 	{
  1051 	{
  1050 	iFindAndOpenController->UseSharedHeap();
  1052 	//iFindAndOpenController->UseSharedHeap();
  1051 	}
  1053 	}
  1052 
  1054 
  1053 // CMMFMdaAudioPlayerUtility
  1055 // CMMFMdaAudioPlayerUtility
  1054 CMMFMdaAudioPlayerUtility::~CMMFMdaAudioPlayerUtility()
  1056 CMMFMdaAudioPlayerUtility::~CMMFMdaAudioPlayerUtility()
  1055 	{
  1057 	{
  1056 	
  1058 	
  1057 	delete iControllerImplementationInformation;
  1059 	//delete iControllerImplementationInformation;
  1058 	delete iAsyncCallBack;
  1060 	delete iAsyncCallBack;
  1059 	delete iRepeatTrailingSilenceTimer;
  1061 	//delete iRepeatTrailingSilenceTimer;
  1060 	delete iFindAndOpenController;
  1062 	//delete iFindAndOpenController;
  1061 	delete iControllerEventMonitor;
  1063 	//delete iControllerEventMonitor;
  1062 	iMediaIds.Close();
  1064 	//iMediaIds.Close();
  1063 	iController.Close();
  1065 	//iController.Close();
  1064 	}
  1066 	}
  1065 
  1067 
  1066 CMMFMdaAudioPlayerUtility::CMMFMdaAudioPlayerUtility(MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref) :
  1068 CMMFMdaAudioPlayerUtility::CMMFMdaAudioPlayerUtility(MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref) :
  1067 	iCallback(aCallback),
  1069     CTimer(EPriorityHigh),
  1068 	iAudioPlayDeviceCommands(iController),
  1070 	iCallback(aCallback)
  1069 	iAudioPlayControllerCommands(iController),
  1071 //	iAudioPlayDeviceCommands(iController),
  1070 	iNotificationRegistrationCommands(iController),
  1072 //	iAudioPlayControllerCommands(iController),
  1071 	iDRMCustomCommands(iController),
  1073 //	iNotificationRegistrationCommands(iController)
  1072 	iAudioPlayControllerSetRepeatsCommands(iController)
  1074 //	iDRMCustomCommands(iController)
       
  1075 //	iAudioPlayControllerSetRepeatsCommands(iController)
  1073 	{
  1076 	{
  1074 	iState = EStopped;
  1077 	iState = EStopped;
  1075 	iPrioritySettings.iPriority = aPriority;
  1078 	iPrioritySettings.iPriority = aPriority;
  1076 	iPrioritySettings.iPref = aPref;
  1079 	iPrioritySettings.iPref = aPref;
  1077 	iPlayStart = TTimeIntervalMicroSeconds(0);
  1080 	iPlayStart = TTimeIntervalMicroSeconds(0);
  1080 	iEventHolder = KNullUid;
  1083 	iEventHolder = KNullUid;
  1081 	}
  1084 	}
  1082 
  1085 
  1083 void CMMFMdaAudioPlayerUtility::ConstructL()
  1086 void CMMFMdaAudioPlayerUtility::ConstructL()
  1084 	{
  1087 	{
  1085 	iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
  1088 	//iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
  1086 	iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this);
  1089 	//iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this);
  1087 	iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback);
  1090 	iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback);
  1088 	User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
  1091 	//User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
  1089 	iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
  1092 	//iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
  1090 	iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
  1093 	//iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
  1091 	iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
  1094 	//iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
  1092 	}
  1095 	iAsyncCallBack->InitComplete(KErrNone, 500000);
  1093 
  1096 	}
       
  1097 
       
  1098 #if 0
  1094 void CMMFMdaAudioPlayerUtility::MfaocComplete(		
  1099 void CMMFMdaAudioPlayerUtility::MfaocComplete(		
  1095 		TInt& aError, 
  1100 		TInt& aError, 
  1096 		RMMFController* /*aController*/,
  1101 		RMMFController* /*aController*/,
  1097 		TUid aControllerUid, 
  1102 		TUid aControllerUid, 
  1098 		TMMFMessageDestination* /*aSourceHandle*/, 
  1103 		TMMFMessageDestination* /*aSourceHandle*/, 
  1128 			}
  1133 			}
  1129 		}
  1134 		}
  1130 	
  1135 	
  1131 	iAsyncCallBack->InitComplete(aError, iDuration);
  1136 	iAsyncCallBack->InitComplete(aError, iDuration);
  1132 	}
  1137 	}
  1133 
  1138 #endif
  1134 /**
  1139 /**
  1135 	Open an audio clip from a file
  1140 	Open an audio clip from a file
  1136 	@param "const TFileSource& aFileSource" "the file to open"
  1141 	@param "const TFileSource& aFileSource" "the file to open"
  1137 	@leave "" "Leaves on an error opening the file
  1142 	@leave "" "Leaves on an error opening the file
  1138 	@since version 5.0
  1143 	@since version 5.0
  1139 */
  1144 */
  1140 void CMMFMdaAudioPlayerUtility::OpenFileL(const TDesC& aFileName)
  1145 void CMMFMdaAudioPlayerUtility::OpenFileL(const TDesC& aFileName)
  1141 	{
  1146 	{
  1142 	TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
  1147 	//TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
  1143 	OpenFileL(filesource);
  1148 	TMMFileSource * filesource;
       
  1149 	OpenFileL(*filesource);
  1144 	}
  1150 	}
  1145 	
  1151 	
  1146 /**
  1152 /**
  1147 	Open an audio clip from a file
  1153 	Open an audio clip from a file
  1148 	@param "const RFile& aFile" "the shared session file handle to open"
  1154 	@param "const RFile& aFile" "the shared session file handle to open"
  1151 	@since version 5.0
  1157 	@since version 5.0
  1152 */
  1158 */
  1153 void CMMFMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
  1159 void CMMFMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
  1154 	{
  1160 	{
  1155 	RFile& file = const_cast<RFile&>(aFile);
  1161 	RFile& file = const_cast<RFile&>(aFile);
  1156 	TMMFileHandleSource filesource(file, KDefaultContentObject, EPlay);
  1162 	//TMMFileHandleSource filesource(file, KDefaultContentObject, EPlay);
  1157 	OpenFileL(filesource);
  1163 	TMMFileHandleSource * filesource;
       
  1164 	OpenFileL(*filesource);
  1158 	}
  1165 	}
  1159 
  1166 
  1160 void CMMFMdaAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
  1167 void CMMFMdaAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
  1161 	{
  1168 	{
  1162 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1169 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1163 	// that a previous request to Open...(...) has completed.
  1170 	// that a previous request to Open...(...) has completed.
  1164 	if (iAsyncCallBack->IsActive())
  1171 	if (iAsyncCallBack->IsActive())
  1165 		User::Leave(KErrNotReady);
  1172 		User::Leave(KErrNotReady);
  1166 	
  1173 #if 0	
  1167 	if (aSource.SourceType()==KUidMMFileHandleSource)
  1174 	if (aSource.SourceType()==KUidMMFileHandleSource)
  1168 		{
  1175 		{
  1169 		RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle();
  1176 		RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle();
  1170 		iFindAndOpenController->ConfigureSourceSink(
  1177 		iFindAndOpenController->ConfigureSourceSink(
  1171 			TMMFileHandleSource(fileHandle, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
  1178 			TMMFileHandleSource(fileHandle, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
  1179 			TMMFileSource(fileName, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
  1186 			TMMFileSource(fileName, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
  1180 			CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1187 			CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1181 		}
  1188 		}
  1182 
  1189 
  1183 	iFindAndOpenController->OpenByFileSource(aSource);
  1190 	iFindAndOpenController->OpenByFileSource(aSource);
       
  1191 #endif
  1184 	}
  1192 	}
  1185 
  1193 
  1186 /**
  1194 /**
  1187 	Open an audio clip from a descriptor
  1195 	Open an audio clip from a descriptor
  1188 	@param "const TDesC8& aDescriptor" "the descriptor containing the clip"
  1196 	@param "const TDesC8& aDescriptor" "the descriptor containing the clip"
  1193 	{
  1201 	{
  1194 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1202 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1195 	// that a previous request to Open...(...) has completed.
  1203 	// that a previous request to Open...(...) has completed.
  1196 	if (iAsyncCallBack->IsActive())
  1204 	if (iAsyncCallBack->IsActive())
  1197 		User::Leave(KErrInUse);
  1205 		User::Leave(KErrInUse);
  1198 
  1206 #if 0
  1199 	iFindAndOpenController->ConfigureSourceSink(
  1207 	iFindAndOpenController->ConfigureSourceSink(
  1200 		CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource,
  1208 		CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource,
  1201 													CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)),
  1209 													CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)),
  1202 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1210 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1203 	iFindAndOpenController->OpenByDescriptor(aDescriptor);
  1211 	iFindAndOpenController->OpenByDescriptor(aDescriptor);
       
  1212 #endif
  1204 	}
  1213 	}
  1205 
  1214 
  1206 /**
  1215 /**
  1207 	Open an audio clip from a Url
  1216 	Open an audio clip from a Url
  1208 	@param "const TDesC& aUrl" "the url reference to the clip"
  1217 	@param "const TDesC& aUrl" "the url reference to the clip"
  1213 	{
  1222 	{
  1214 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1223 	// If iAsyncCallBack is already active, we're still in the process of notifying the client
  1215 	// that a previous request to Open...(...) has completed.
  1224 	// that a previous request to Open...(...) has completed.
  1216 	if (iAsyncCallBack->IsActive())
  1225 	if (iAsyncCallBack->IsActive())
  1217 		User::Leave(KErrInUse);
  1226 		User::Leave(KErrInUse);
  1218 
  1227 #if 0
  1219 	CBufFlat* urlCfgBuffer = NULL;
  1228 	CBufFlat* urlCfgBuffer = NULL;
  1220 	CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
  1229 	CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
  1221 	
  1230 	
  1222 	iFindAndOpenController->ConfigureSourceSink(
  1231 	iFindAndOpenController->ConfigureSourceSink(
  1223 		CMMFFindAndOpenController::TSourceSink(KUidMmfUrlSource, urlCfgBuffer->Ptr(0)), 
  1232 		CMMFFindAndOpenController::TSourceSink(KUidMmfUrlSource, urlCfgBuffer->Ptr(0)), 
  1224 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1233 		CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
  1225 	iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
  1234 	iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
  1226 	delete urlCfgBuffer;
  1235 	delete urlCfgBuffer;
       
  1236 #endif
  1227 	}
  1237 	}
  1228 
  1238 
  1229 /**
  1239 /**
  1230 Begins playback of the initialised audio sample at the current volume
  1240 Begins playback of the initialised audio sample at the current volume
  1231 and priority levels.
  1241 and priority levels.
  1250     if (iState == EPlaying)
  1260     if (iState == EPlaying)
  1251 		{
  1261 		{
  1252 		iAsyncCallBack->PlayComplete(KErrNotReady);
  1262 		iAsyncCallBack->PlayComplete(KErrNotReady);
  1253 		return;
  1263 		return;
  1254 		}
  1264 		}
  1255 
  1265 #if 0
  1256 	// cancel the repeat timer in case the client has called Play()
  1266 	// cancel the repeat timer in case the client has called Play()
  1257 	// without waiting for the previous play to complete
  1267 	// without waiting for the previous play to complete
  1258 	iRepeatTrailingSilenceTimer->Cancel();	
  1268 	iRepeatTrailingSilenceTimer->Cancel();	
  1259 	// Reset played count
  1269 	// Reset played count
  1260 	if(iState != EPaused)
  1270 	if(iState != EPaused)
  1270 				}
  1280 				}
  1271 			//Controller not supporting setrepeats custom command is not a real error
  1281 			//Controller not supporting setrepeats custom command is not a real error
  1272 			//we revert back to playerutility's loop play implementation in that case
  1282 			//we revert back to playerutility's loop play implementation in that case
  1273 			}
  1283 			}
  1274 		}
  1284 		}
  1275 
  1285 #endif
  1276 	DoPlay();
  1286 	DoPlay();
  1277 	}
  1287 	}
  1278 
  1288 
  1279 void CMMFMdaAudioPlayerUtility::DoPlay()
  1289 void CMMFMdaAudioPlayerUtility::DoPlay()
  1280 	{
  1290 	{
       
  1291 #if 0
  1281 #if defined(__AUDIO_PROFILING)
  1292 #if defined(__AUDIO_PROFILING)
  1282 	RDebug::ProfileStart(4);
  1293 	RDebug::ProfileStart(4);
  1283 #endif  // defined(__AUDIO_PROFILING)
  1294 #endif  // defined(__AUDIO_PROFILING)
  1284     TInt err = KErrNone;
  1295     TInt err = KErrNone;
  1285     if (iState != EPaused || iRepeatCancelled)
  1296     if (iState != EPaused || iRepeatCancelled)
  1343 			{
  1354 			{
  1344 			iController.Stop();
  1355 			iController.Stop();
  1345 			iAsyncCallBack->PlayComplete(err);
  1356 			iAsyncCallBack->PlayComplete(err);
  1346 			}
  1357 			}
  1347 		}
  1358 		}
       
  1359 #endif
       
  1360 	iState = EPlaying;
       
  1361 	After(500000);
  1348 	}
  1362 	}
  1349 
  1363 
  1350 /**
  1364 /**
  1351 Stops playback of the audio sample as soon as possible.
  1365 Stops playback of the audio sample as soon as possible.
  1352 
  1366 
  1371 	
  1385 	
  1372 	if (iState==EPlaying || iState==EPaused)
  1386 	if (iState==EPlaying || iState==EPaused)
  1373 		{
  1387 		{
  1374 		// cancel the repeat timer in case the client has called Stop()
  1388 		// cancel the repeat timer in case the client has called Stop()
  1375 		// during the trailing silence period
  1389 		// during the trailing silence period
  1376 		iRepeatTrailingSilenceTimer->Cancel();	
  1390 		//iRepeatTrailingSilenceTimer->Cancel();	
  1377 
  1391 
  1378 		iController.Stop();
  1392 		//iController.Stop();
  1379 		iPosition = iPlayStart;	
  1393 		iPosition = iPlayStart;	
  1380 		iState = EStopped;	
  1394 		iState = EStopped;	
  1381 		}
  1395 		}
  1382 
  1396 
  1383 	}
  1397 	}
  1389  * @since	7.0s
  1403  * @since	7.0s
  1390  */
  1404  */
  1391 TInt CMMFMdaAudioPlayerUtility::Pause()
  1405 TInt CMMFMdaAudioPlayerUtility::Pause()
  1392 	{
  1406 	{
  1393 	TInt err = KErrNone;
  1407 	TInt err = KErrNone;
       
  1408 #if 0
  1394 	if(iRepeatTrailingSilenceTimer->IsActive())
  1409 	if(iRepeatTrailingSilenceTimer->IsActive())
  1395 		{
  1410 		{
  1396 		iRepeatTrailingSilenceTimer->Cancel();
  1411 		iRepeatTrailingSilenceTimer->Cancel();
  1397 		iRepeatCancelled = ETrue;
  1412 		iRepeatCancelled = ETrue;
  1398 		iState = EPaused;	
  1413 		iState = EPaused;	
  1403 		err = iController.Pause();
  1418 		err = iController.Pause();
  1404 		if (!err || err==KErrNotReady)
  1419 		if (!err || err==KErrNotReady)
  1405 			err = iController.GetPosition(iPosition);
  1420 			err = iController.GetPosition(iPosition);
  1406 		iState = EPaused;
  1421 		iState = EPaused;
  1407 		}
  1422 		}
       
  1423 #endif
       
  1424 	iState = EPaused;
  1408 	return err;
  1425 	return err;
  1409 	}
  1426 	}
  1410 
  1427 
  1411 /**
  1428 /**
  1412  *
  1429  *
  1416  */
  1433  */
  1417 void CMMFMdaAudioPlayerUtility::Close()
  1434 void CMMFMdaAudioPlayerUtility::Close()
  1418 	{
  1435 	{
  1419 	// Reset the audio player state.
  1436 	// Reset the audio player state.
  1420 	Stop();
  1437 	Stop();
       
  1438 #if 0
  1421 	iControllerEventMonitor->Cancel();
  1439 	iControllerEventMonitor->Cancel();
  1422 	iController.Close();
  1440 	iController.Close();
  1423 	if (iFindAndOpenController)	
  1441 	if (iFindAndOpenController)	
  1424 		iFindAndOpenController->Close();
  1442 		iFindAndOpenController->Close();
  1425 	if(iControllerImplementationInformation)
  1443 	if(iControllerImplementationInformation)
  1426 		{
  1444 		{
  1427 		delete iControllerImplementationInformation;
  1445 		delete iControllerImplementationInformation;
  1428 		iControllerImplementationInformation = NULL;
  1446 		iControllerImplementationInformation = NULL;
  1429 		}
  1447 		}
  1430 	iControllerUid = KNullUid;
  1448 	iControllerUid = KNullUid;
  1431 	}
  1449 #endif
  1432 
  1450 	}
  1433 
  1451 
       
  1452 void CMMFMdaAudioPlayerUtility::RunL()
       
  1453 	{
       
  1454 	switch(iState)
       
  1455 		{
       
  1456 		case EPlaying:
       
  1457 			iAsyncCallBack->PlayComplete(KErrNone);
       
  1458 			break;
       
  1459 		default:
       
  1460 			// do nothing
       
  1461 			break;
       
  1462 		}
       
  1463 	}
  1434 /**
  1464 /**
  1435 Changes the current playback volume to a specified value.
  1465 Changes the current playback volume to a specified value.
  1436 
  1466 
  1437 The volume can be changed before or during playback and is effective
  1467 The volume can be changed before or during playback and is effective
  1438 immediately.
  1468 immediately.
  1449 
  1479 
  1450 @since  5.0
  1480 @since  5.0
  1451 */
  1481 */
  1452 TInt CMMFMdaAudioPlayerUtility::SetVolume(TInt aVolume)
  1482 TInt CMMFMdaAudioPlayerUtility::SetVolume(TInt aVolume)
  1453 	{
  1483 	{
       
  1484 	TInt err = KErrNone;
       
  1485 #if 0
  1454 	TInt err = iAudioPlayDeviceCommands.SetVolume(aVolume);
  1486 	TInt err = iAudioPlayDeviceCommands.SetVolume(aVolume);
  1455 	if (err == KErrArgument)
  1487 	if (err == KErrArgument)
  1456 		{
  1488 		{
  1457 		TInt maxVolume = MaxVolume();
  1489 		TInt maxVolume = MaxVolume();
  1458 		if (aVolume < 0)
  1490 		if (aVolume < 0)
  1463 			{
  1495 			{
  1464 			aVolume = maxVolume;
  1496 			aVolume = maxVolume;
  1465 			}
  1497 			}
  1466 		err = iAudioPlayDeviceCommands.SetVolume(aVolume);			
  1498 		err = iAudioPlayDeviceCommands.SetVolume(aVolume);			
  1467 		}
  1499 		}
  1468 
  1500 #endif
  1469 	return err;
  1501 	return err;
  1470 	}
  1502 	}
  1471 
  1503 
  1472 /**
  1504 /**
  1473 Sets the number of times the audio sample is to be repeated during the
  1505 Sets the number of times the audio sample is to be repeated during the
  1490 		Negative values will produce a panic USER 87.
  1522 		Negative values will produce a panic USER 87.
  1491 @since	5.0
  1523 @since	5.0
  1492 */
  1524 */
  1493 void CMMFMdaAudioPlayerUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
  1525 void CMMFMdaAudioPlayerUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
  1494 	{
  1526 	{
       
  1527 #if 0
  1495 	TInt err = iAudioPlayControllerSetRepeatsCommands.SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
  1528 	TInt err = iAudioPlayControllerSetRepeatsCommands.SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
  1496 	
  1529 	
  1497 	if(err!=KErrNone)
  1530 	if(err!=KErrNone)
  1498 		{
  1531 		{
  1499 		iNumberOfTimesToRepeat = aRepeatNumberOfTimes;
  1532 		iNumberOfTimesToRepeat = aRepeatNumberOfTimes;
  1500 		iTrailingSilence = aTrailingSilence;
  1533 		iTrailingSilence = aTrailingSilence;
  1501 		}
  1534 		}
       
  1535 #endif
  1502 	}
  1536 	}
  1503 
  1537 
  1504 /**
  1538 /**
  1505 Defines the period over which the volume level is to rise smoothly
  1539 Defines the period over which the volume level is to rise smoothly
  1506 from nothing to the normal volume level.
  1540 from nothing to the normal volume level.
  1515 
  1549 
  1516 @since  5.0
  1550 @since  5.0
  1517 */
  1551 */
  1518 void CMMFMdaAudioPlayerUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
  1552 void CMMFMdaAudioPlayerUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
  1519 	{
  1553 	{
  1520 	iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration);
  1554 	//iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration);
  1521 	}
  1555 	}
  1522 
  1556 
  1523 TInt CMMFMdaAudioPlayerUtility::SetPriority(TInt aPriority, TInt aPref)
  1557 TInt CMMFMdaAudioPlayerUtility::SetPriority(TInt aPriority, TInt aPref)
  1524 	{
  1558 	{
       
  1559 	return KErrNone;
       
  1560 #if 0
  1525 	iPrioritySettings.iPref = aPref;
  1561 	iPrioritySettings.iPref = aPref;
  1526 	iPrioritySettings.iPriority = aPriority;
  1562 	iPrioritySettings.iPriority = aPriority;
  1527 	iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
  1563 	iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
  1528 
  1564 
  1529 	return iController.SetPrioritySettings(iPrioritySettings);
  1565 	return iController.SetPrioritySettings(iPrioritySettings);
       
  1566 #endif
  1530 	}
  1567 	}
  1531 
  1568 
  1532 /**
  1569 /**
  1533 Returns the duration of the audio sample.
  1570 Returns the duration of the audio sample.
  1534 
  1571 
  1536 
  1573 
  1537 @since  5.0
  1574 @since  5.0
  1538 */
  1575 */
  1539 const TTimeIntervalMicroSeconds& CMMFMdaAudioPlayerUtility::Duration()
  1576 const TTimeIntervalMicroSeconds& CMMFMdaAudioPlayerUtility::Duration()
  1540 	{
  1577 	{
       
  1578 #if 0
  1541 	TInt err = iController.GetDuration(iDuration);
  1579 	TInt err = iController.GetDuration(iDuration);
  1542 	if (err)
  1580 	if (err)
  1543 		{
  1581 		{
  1544 		iDuration = 0;
  1582 		iDuration = 0;
  1545 		}
  1583 		}
       
  1584 #endif
       
  1585 	iDuration = 500000;
  1546 	return iDuration;
  1586 	return iDuration;
  1547 	}
  1587 	}
  1548 	
  1588 	
  1549 /**
  1589 /**
  1550 Returns the duration of the audio sample in microseconds, and the duration state.
  1590 Returns the duration of the audio sample in microseconds, and the duration state.
  1555 
  1595 
  1556 @since	9.1
  1596 @since	9.1
  1557 */	
  1597 */	
  1558 TMMFDurationInfo CMMFMdaAudioPlayerUtility::Duration(TTimeIntervalMicroSeconds& aDuration)
  1598 TMMFDurationInfo CMMFMdaAudioPlayerUtility::Duration(TTimeIntervalMicroSeconds& aDuration)
  1559 {	
  1599 {	
       
  1600 #if 0
  1560 	TPckgBuf<TMMFDurationInfo> pckg;
  1601 	TPckgBuf<TMMFDurationInfo> pckg;
  1561 	TMMFDurationInfo result = EMMFDurationInfoValid;
  1602 	TMMFDurationInfo result = EMMFDurationInfoValid;
  1562 	
  1603 	
  1563 	TMMFMessageDestinationPckg iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFDurationInfoControl, KMMFObjectHandleController));
  1604 	TMMFMessageDestinationPckg iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFDurationInfoControl, KMMFObjectHandleController));
  1564 	
  1605 	
  1586 
  1627 
  1587 	// Get the duration information to return in aDuration
  1628 	// Get the duration information to return in aDuration
  1588 	// This is the intended behaviour regardless of what value err has
  1629 	// This is the intended behaviour regardless of what value err has
  1589 	aDuration = Duration();
  1630 	aDuration = Duration();
  1590 	return result;
  1631 	return result;
       
  1632 #endif
       
  1633 	return EMMFDurationInfoValid;
  1591 }	
  1634 }	
  1592 	
  1635 	
  1593 /**
  1636 /**
  1594 Returns an integer representing the maximum volume.
  1637 Returns an integer representing the maximum volume.
  1595 
  1638 
  1602 
  1645 
  1603 @since  5.0
  1646 @since  5.0
  1604 */
  1647 */
  1605 TInt CMMFMdaAudioPlayerUtility::MaxVolume()
  1648 TInt CMMFMdaAudioPlayerUtility::MaxVolume()
  1606 	{
  1649 	{
  1607 	TInt maxVolume = 0;
  1650 	TInt maxVolume = 100;
       
  1651 #if 0
  1608 #ifdef _DEBUG
  1652 #ifdef _DEBUG
  1609 	TInt error = 
  1653 	TInt error = 
  1610 #endif
  1654 #endif
  1611 		iAudioPlayDeviceCommands.GetMaxVolume(maxVolume);
  1655 		iAudioPlayDeviceCommands.GetMaxVolume(maxVolume);
  1612 	__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
  1656 	__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
       
  1657 #endif
  1613 	return maxVolume;
  1658 	return maxVolume;
  1614 	}
  1659 	}
  1615 
  1660 
       
  1661 #if 0
  1616 void CMMFMdaAudioPlayerUtility::HandleEvent(const TMMFEvent& aEvent)
  1662 void CMMFMdaAudioPlayerUtility::HandleEvent(const TMMFEvent& aEvent)
  1617 	{
  1663 	{
  1618 	// handle loading started/complete messages first, as the later code does not explicitly check the event type
  1664 	// handle loading started/complete messages first, as the later code does not explicitly check the event type
  1619 	if (aEvent.iEventType == KMMFEventCategoryAudioLoadingStarted)
  1665 	if (aEvent.iEventType == KMMFEventCategoryAudioLoadingStarted)
  1620 		{
  1666 		{
  1701 			}
  1747 			}
  1702 		}
  1748 		}
  1703 	// else we have an unexpected event that cannot be dealt with by the client.
  1749 	// else we have an unexpected event that cannot be dealt with by the client.
  1704 	// We will simply ignore this.
  1750 	// We will simply ignore this.
  1705 	}
  1751 	}
       
  1752 #endif
  1706 
  1753 
  1707 void CMMFMdaAudioPlayerUtility::PlaySilence()
  1754 void CMMFMdaAudioPlayerUtility::PlaySilence()
  1708 	{
  1755 	{
       
  1756 #if 0
  1709 	// iRepeatTrailingSilenceTimer->After() takes a TTimeIntervalMicroSeconds32
  1757 	// iRepeatTrailingSilenceTimer->After() takes a TTimeIntervalMicroSeconds32
  1710 	// so for longer periods of silence call it repeatedly with KMaxTInt lengths
  1758 	// so for longer periods of silence call it repeatedly with KMaxTInt lengths
  1711 	TTimeIntervalMicroSeconds32 silence;
  1759 	TTimeIntervalMicroSeconds32 silence;
  1712 	if (iTrailingSilenceLeftToPlay.Int64() > KMaxTInt)
  1760 	if (iTrailingSilenceLeftToPlay.Int64() > KMaxTInt)
  1713 		{
  1761 		{
  1718 		{
  1766 		{
  1719 		silence = I64INT(iTrailingSilenceLeftToPlay.Int64());
  1767 		silence = I64INT(iTrailingSilenceLeftToPlay.Int64());
  1720 		iTrailingSilenceLeftToPlay = 0;
  1768 		iTrailingSilenceLeftToPlay = 0;
  1721 		}
  1769 		}
  1722 	iRepeatTrailingSilenceTimer->After(silence);
  1770 	iRepeatTrailingSilenceTimer->After(silence);
  1723 	}
  1771 #endif
  1724 
  1772 	}
       
  1773 
       
  1774 #if 0
  1725 void CMMFMdaAudioPlayerUtility::RepeatTrailingSilenceTimerComplete()
  1775 void CMMFMdaAudioPlayerUtility::RepeatTrailingSilenceTimerComplete()
  1726 	{
  1776 	{
  1727 	if (iTrailingSilenceLeftToPlay.Int64() > 0)
  1777 	if (iTrailingSilenceLeftToPlay.Int64() > 0)
  1728 		{
  1778 		{
  1729 		PlaySilence();
  1779 		PlaySilence();
  1733 		// reset the position for subsequent plays
  1783 		// reset the position for subsequent plays
  1734 		iPosition = iPlayStart;
  1784 		iPosition = iPlayStart;
  1735 		DoPlay();
  1785 		DoPlay();
  1736 		}
  1786 		}
  1737 	}
  1787 	}
       
  1788 #endif
  1738 
  1789 
  1739 /**
  1790 /**
  1740  *
  1791  *
  1741  * Returns the current playback position in microseconds
  1792  * Returns the current playback position in microseconds
  1742  *
  1793  *
  1748  */
  1799  */
  1749 TInt CMMFMdaAudioPlayerUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition)
  1800 TInt CMMFMdaAudioPlayerUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition)
  1750 	{
  1801 	{
  1751 	TInt error = KErrNone;
  1802 	TInt error = KErrNone;
  1752 	if (iState==EPlaying)
  1803 	if (iState==EPlaying)
  1753 		error = iController.GetPosition(iPosition);
  1804 		aPosition = 250000;
       
  1805 //		error = iController.GetPosition(iPosition);
  1754 	aPosition = iPosition;
  1806 	aPosition = iPosition;
  1755 	return error;
  1807 	return error;
  1756 	}
  1808 	}
  1757 
  1809 
  1758 /**
  1810 /**
  1767  *
  1819  *
  1768  * @since	7.0s
  1820  * @since	7.0s
  1769  */
  1821  */
  1770 void CMMFMdaAudioPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
  1822 void CMMFMdaAudioPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
  1771 	{
  1823 	{
       
  1824 #if 0
  1772 	// Clip the position if aPosition is greater than the duration
  1825 	// Clip the position if aPosition is greater than the duration
  1773 	// or if aPosition is negative.
  1826 	// or if aPosition is negative.
  1774 	const TTimeIntervalMicroSeconds maxPosition(Duration());
  1827 	const TTimeIntervalMicroSeconds maxPosition(Duration());
  1775 	const TTimeIntervalMicroSeconds minPosition(0);
  1828 	const TTimeIntervalMicroSeconds minPosition(0);
  1776 
  1829 
  1787 		}
  1840 		}
  1788 //	else if (iState == EPaused)
  1841 //	else if (iState == EPaused)
  1789 //		{
  1842 //		{
  1790 //		Stop();	// We call stop so that DevSound's internal buffers are reset
  1843 //		Stop();	// We call stop so that DevSound's internal buffers are reset
  1791 //		}
  1844 //		}
       
  1845 #endif
  1792 	}
  1846 	}
  1793 
  1847 
  1794 /**
  1848 /**
  1795 Returns the current playback volume
  1849 Returns the current playback volume
  1796 
  1850 
  1801 
  1855 
  1802 @since  7.0s
  1856 @since  7.0s
  1803 */
  1857 */
  1804 TInt CMMFMdaAudioPlayerUtility::GetVolume(TInt& aVolume)
  1858 TInt CMMFMdaAudioPlayerUtility::GetVolume(TInt& aVolume)
  1805 	{
  1859 	{
       
  1860 #if 0
  1806 	TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume);
  1861 	TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume);
  1807 	return error;
  1862 	return error;
       
  1863 #endif
       
  1864 	aVolume = 50;
       
  1865 	return KErrNone;
  1808 	}
  1866 	}
  1809 
  1867 
  1810 /**
  1868 /**
  1811  *
  1869  *
  1812  * Returns the number of meta data entries in the current clip
  1870  * Returns the number of meta data entries in the current clip
  1817  *
  1875  *
  1818  * @since	7.0s
  1876  * @since	7.0s
  1819  */
  1877  */
  1820 TInt CMMFMdaAudioPlayerUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries) 
  1878 TInt CMMFMdaAudioPlayerUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries) 
  1821 	{
  1879 	{
       
  1880 #if 0
  1822 	TInt error = iController.GetNumberOfMetaDataEntries(aNumEntries);
  1881 	TInt error = iController.GetNumberOfMetaDataEntries(aNumEntries);
  1823 	return error;
  1882 	return error;
       
  1883 #endif
       
  1884 	aNumEntries = 0;
       
  1885 	return KErrNone;
  1824 	}
  1886 	}
  1825 
  1887 
  1826 /**
  1888 /**
  1827  *
  1889  *
  1828  * Returns the requested meta data entry
  1890  * Returns the requested meta data entry
  1837  *
  1899  *
  1838  * @since	7.0s
  1900  * @since	7.0s
  1839  */
  1901  */
  1840 CMMFMetaDataEntry* CMMFMdaAudioPlayerUtility::GetMetaDataEntryL(TInt aMetaDataIndex)
  1902 CMMFMetaDataEntry* CMMFMdaAudioPlayerUtility::GetMetaDataEntryL(TInt aMetaDataIndex)
  1841 	{
  1903 	{
       
  1904 #if 0
  1842 	return iController.GetMetaDataEntryL(aMetaDataIndex);
  1905 	return iController.GetMetaDataEntryL(aMetaDataIndex);
       
  1906 #endif
       
  1907 	User::Leave(KErrNotSupported);
       
  1908 	return NULL;
  1843 	}
  1909 	}
  1844 
  1910 
  1845 /**
  1911 /**
  1846  *
  1912  *
  1847  * Set the current playback window
  1913  * Set the current playback window
  1857  */
  1923  */
  1858 TInt CMMFMdaAudioPlayerUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aPlayStart,
  1924 TInt CMMFMdaAudioPlayerUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aPlayStart,
  1859 											  const TTimeIntervalMicroSeconds& aPlayEnd)
  1925 											  const TTimeIntervalMicroSeconds& aPlayEnd)
  1860 	{
  1926 	{
  1861 	TInt error = KErrNone;
  1927 	TInt error = KErrNone;
  1862 
  1928 #if 0
  1863 	if (aPlayStart >= TTimeIntervalMicroSeconds(0) &&
  1929 	if (aPlayStart >= TTimeIntervalMicroSeconds(0) &&
  1864 		aPlayStart < iDuration &&
  1930 		aPlayStart < iDuration &&
  1865 			aPlayStart < aPlayEnd &&
  1931 			aPlayStart < aPlayEnd &&
  1866 			aPlayEnd <= iDuration )
  1932 			aPlayEnd <= iDuration )
  1867 		{
  1933 		{
  1872 		if (iState==EPlaying)
  1938 		if (iState==EPlaying)
  1873 			error = iAudioPlayControllerCommands.SetPlaybackWindow(aPlayStart, aPlayEnd);
  1939 			error = iAudioPlayControllerCommands.SetPlaybackWindow(aPlayStart, aPlayEnd);
  1874 		}
  1940 		}
  1875 	else
  1941 	else
  1876 		error = KErrArgument;
  1942 		error = KErrArgument;
  1877 
  1943 #endif
  1878 	return error;
  1944 	return error;
  1879 	}
  1945 	}
  1880 	
  1946 	
  1881 /**
  1947 /**
  1882  *
  1948  *
  1888  */
  1954  */
  1889 TInt CMMFMdaAudioPlayerUtility::ClearPlayWindow()
  1955 TInt CMMFMdaAudioPlayerUtility::ClearPlayWindow()
  1890 	{
  1956 	{
  1891 	// clear play window start - very important because this is assigned 
  1957 	// clear play window start - very important because this is assigned 
  1892 	// to iPosition when we stop & is used to set the position on the next Play()
  1958 	// to iPosition when we stop & is used to set the position on the next Play()
  1893 	iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0);
  1959 	//iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0);
  1894 
  1960 
  1895 	iPlayWindowSet = EClear;
  1961 	//iPlayWindowSet = EClear;
  1896 	TInt err = KErrNone;
  1962 	TInt err = KErrNone;
  1897 	if (iState==EPlaying)
  1963 	//if (iState==EPlaying)
  1898 		err = iAudioPlayControllerCommands.DeletePlaybackWindow();
  1964 		//err = iAudioPlayControllerCommands.DeletePlaybackWindow();
  1899 	return err;
  1965 	return err;
  1900 	}
  1966 	}
  1901 
  1967 
  1902 /**
  1968 /**
  1903 Sets the current playback balance
  1969 Sets the current playback balance
  1910 
  1976 
  1911 @since  7.0s
  1977 @since  7.0s
  1912 */
  1978 */
  1913 TInt CMMFMdaAudioPlayerUtility::SetBalance(TInt aBalance)
  1979 TInt CMMFMdaAudioPlayerUtility::SetBalance(TInt aBalance)
  1914 	{
  1980 	{
  1915 	TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance);
  1981 	//TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance);
  1916 	return err;
  1982 	//return err;
       
  1983 	return KErrNone;
  1917 	}
  1984 	}
  1918 
  1985 
  1919 /**
  1986 /**
  1920 Returns the bit rate of the audio clip.
  1987 Returns the bit rate of the audio clip.
  1921 
  1988 
  1926 
  1993 
  1927 @since  7.0s
  1994 @since  7.0s
  1928 */
  1995 */
  1929 TInt CMMFMdaAudioPlayerUtility::GetBitRate(TUint& aBitRate)
  1996 TInt CMMFMdaAudioPlayerUtility::GetBitRate(TUint& aBitRate)
  1930 	{
  1997 	{
  1931 	RMMFAudioControllerCustomCommands controller(iController);
  1998 	//RMMFAudioControllerCustomCommands controller(iController);
  1932 	TInt err = controller.GetSourceBitRate(aBitRate);
  1999 	//TInt err = controller.GetSourceBitRate(aBitRate);
  1933 	return err;	
  2000 	//return err;
       
  2001 	return KErrNone;
  1934 	}
  2002 	}
  1935 
  2003 
  1936 const CMMFControllerImplementationInformation& CMMFMdaAudioPlayerUtility::ControllerImplementationInformationL()
  2004 const CMMFControllerImplementationInformation& CMMFMdaAudioPlayerUtility::ControllerImplementationInformationL()
  1937 	{
  2005 	{
       
  2006 #if 0
  1938 	if (!iControllerImplementationInformation)
  2007 	if (!iControllerImplementationInformation)
  1939 		{
  2008 		{
  1940 		if (iControllerUid==KNullUid)
  2009 		if (iControllerUid==KNullUid)
  1941 			User::Leave(KErrNotReady);
  2010 			User::Leave(KErrNotReady);
  1942 		iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid);
  2011 		iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid);
  1943 		}
  2012 		}
  1944 	return *iControllerImplementationInformation;
  2013 	return *iControllerImplementationInformation;
       
  2014 #endif
       
  2015 	User::Leave(KErrNotSupported);
       
  2016 	return *iControllerImplementationInformation;
  1945 	}
  2017 	}
  1946 	
  2018 	
  1947 void CMMFMdaAudioPlayerUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress)
  2019 void CMMFMdaAudioPlayerUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress)
  1948 	{
  2020 	{
  1949 	User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress));
  2021 	//User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress));
       
  2022 	User::Leave(KErrNotSupported);
  1950 	}
  2023 	}
  1951 	
  2024 	
  1952 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
  2025 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
  1953 	{
  2026 	{
  1954 	return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
  2027 	//return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
       
  2028 	return KErrNotSupported;
  1955 	}
  2029 	}
  1956 	
  2030 	
  1957 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
  2031 TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
  1958 	{
  2032 	{
  1959 	return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
  2033 	//return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
       
  2034 	return KErrNotSupported;
  1960 	}
  2035 	}
  1961 	
  2036 	
  1962 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
  2037 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
  1963 	{
  2038 	{
  1964 	iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
  2039 	//iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
  1965 	}
  2040 	}
  1966 	
  2041 	
  1967 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
  2042 void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
  1968 	{
  2043 	{
  1969 	iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
  2044 	//iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
  1970 	}
  2045 	}
  1971 
  2046 
  1972 /**
  2047 /**
  1973 Returns the current playback balance
  2048 Returns the current playback balance
  1974 
  2049 
  1979 
  2054 
  1980 @since  7.0s
  2055 @since  7.0s
  1981 */
  2056 */
  1982 TInt CMMFMdaAudioPlayerUtility::GetBalance(TInt& aBalance)
  2057 TInt CMMFMdaAudioPlayerUtility::GetBalance(TInt& aBalance)
  1983 	{
  2058 	{
  1984 	TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance);
  2059 	//TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance);
  1985 	return err;
  2060 	//return err;
       
  2061 	aBalance = KMMFBalanceMaxLeft;
       
  2062 	return KErrNone;
  1986 	}
  2063 	}
  1987 	
  2064 	
  1988 MMMFDRMCustomCommand* CMMFMdaAudioPlayerUtility::GetDRMCustomCommand()
  2065 MMMFDRMCustomCommand* CMMFMdaAudioPlayerUtility::GetDRMCustomCommand()
  1989 	{
  2066 	{
       
  2067 #if 0
  1990 	// TODO: check controller supports MMMFDRMCustomCommandImplementor
  2068 	// TODO: check controller supports MMMFDRMCustomCommandImplementor
  1991 	if (iDRMCustomCommands.IsSupported())
  2069 	if (iDRMCustomCommands.IsSupported())
  1992 		{
  2070 		{
  1993 		return static_cast<MMMFDRMCustomCommand*>(&iDRMCustomCommands);
  2071 		return static_cast<MMMFDRMCustomCommand*>(&iDRMCustomCommands);
  1994 		}
  2072 		}
  1995 	else
  2073 	else
  1996 		{
  2074 		{
  1997 		return NULL;
  2075 		return NULL;
  1998 		}
  2076 		}
       
  2077 #endif
       
  2078 	return NULL;
  1999 	}
  2079 	}
  2000 	
  2080 	
  2001 void CMMFMdaAudioPlayerUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver)
  2081 void CMMFMdaAudioPlayerUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver)
  2002 	{
  2082 	{
  2003 	iLoadingObserver = &aLoadingObserver;
  2083 	iLoadingObserver = &aLoadingObserver;
  2005 
  2085 
  2006 TInt CMMFMdaAudioPlayerUtility::RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,
  2086 TInt CMMFMdaAudioPlayerUtility::RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,
  2007 																	TUid aNotificationEventUid,
  2087 																	TUid aNotificationEventUid,
  2008 																	const TDesC8& aNotificationRegistrationData)
  2088 																	const TDesC8& aNotificationRegistrationData)
  2009 	{
  2089 	{
       
  2090 #if 0
  2010 	iAudioResourceNotificationCallBack = &aCallback;
  2091 	iAudioResourceNotificationCallBack = &aCallback;
  2011 	TInt err = iNotificationRegistrationCommands.RegisterAsClient(aNotificationEventUid, aNotificationRegistrationData);
  2092 	TInt err = iNotificationRegistrationCommands.RegisterAsClient(aNotificationEventUid, aNotificationRegistrationData);
  2012 	if(err == KErrNotReady)
  2093 	if(err == KErrNotReady)
  2013 		{
  2094 		{
  2014 		iEventHolder = 	aNotificationEventUid;
  2095 		iEventHolder = 	aNotificationEventUid;
  2016 		return KErrNone;
  2097 		return KErrNone;
  2017 		}
  2098 		}
  2018 	iNotificationDataHolder = KNullDesC8;
  2099 	iNotificationDataHolder = KNullDesC8;
  2019 	iEventHolder = KNullUid;
  2100 	iEventHolder = KNullUid;
  2020 	return err;
  2101 	return err;
       
  2102 #endif
       
  2103 	return KErrNotSupported;
  2021 	}
  2104 	}
  2022 
  2105 
  2023 TInt CMMFMdaAudioPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventId)
  2106 TInt CMMFMdaAudioPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventId)
  2024 	{
  2107 	{
       
  2108 #if 0
  2025 	TInt err = iNotificationRegistrationCommands.CancelRegisterAsClient(aNotificationEventId);
  2109 	TInt err = iNotificationRegistrationCommands.CancelRegisterAsClient(aNotificationEventId);
  2026 	if(err == KErrNotReady)
  2110 	if(err == KErrNotReady)
  2027 		{
  2111 		{
  2028 		if(aNotificationEventId != KMMFEventCategoryAudioResourceAvailable)	
  2112 		if(aNotificationEventId != KMMFEventCategoryAudioResourceAvailable)	
  2029 			{
  2113 			{
  2036 		iEventHolder = KNullUid;
  2120 		iEventHolder = KNullUid;
  2037 		iNotificationDataHolder = KNullDesC8;
  2121 		iNotificationDataHolder = KNullDesC8;
  2038 		return KErrNone;
  2122 		return KErrNone;
  2039 		}
  2123 		}
  2040 	return err;
  2124 	return err;
       
  2125 #endif
       
  2126 	return KErrNotSupported;
  2041 	}
  2127 	}
  2042 	
  2128 	
  2043 TInt CMMFMdaAudioPlayerUtility::WillResumePlay()
  2129 TInt CMMFMdaAudioPlayerUtility::WillResumePlay()
  2044 	{
  2130 	{
  2045 	return iNotificationRegistrationCommands.WillResumePlay();
  2131 	//return iNotificationRegistrationCommands.WillResumePlay();
       
  2132 	return KErrNone;
  2046 	}
  2133 	}
  2047 	
  2134 	
  2048 TInt CMMFMdaAudioPlayerUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
  2135 TInt CMMFMdaAudioPlayerUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
  2049 	{
  2136 	{
  2050 	return iController.SetThreadPriority(aThreadPriority);
  2137 	//return iController.SetThreadPriority(aThreadPriority);
       
  2138 	return KErrNone;
  2051 	}
  2139 	}
  2052 	
  2140 	
  2053 CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs)
  2141 CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs)
  2054 	{
  2142 	{
  2055 	CRepeatTrailingSilenceTimer* s = new(ELeave) CRepeatTrailingSilenceTimer(aObs);
  2143 	CRepeatTrailingSilenceTimer* s = new(ELeave) CRepeatTrailingSilenceTimer(aObs);