mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp
changeset 12 5a06f39ad45b
parent 0 71ca22bcf22a
child 14 80975da52420
equal deleted inserted replaced
0:71ca22bcf22a 12:5a06f39ad45b
   682 
   682 
   683     iRequestState = EPaused;
   683     iRequestState = EPaused;
   684     TRAP(err, DoPauseL(ETrue)); // this is a preemption pause
   684     TRAP(err, DoPauseL(ETrue)); // this is a preemption pause
   685 	// In case of pre-emption we should only Pause ... but not Stop.
   685 	// In case of pre-emption we should only Pause ... but not Stop.
   686     SendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, aError));
   686     SendEventToClient(TMMFEvent(KMMFEventCategoryPlaybackComplete, aError));
       
   687     SendEventToClient(TMMFEvent(KStreamControlEventStateChangedPaused, aError));
   687     }
   688     }
   688 
   689 
   689 // -----------------------------------------------------------------------------
   690 // -----------------------------------------------------------------------------
   690 // CAdvancedAudioPlayController::HandleGeneralEvent
   691 // CAdvancedAudioPlayController::HandleGeneralEvent
   691 // -----------------------------------------------------------------------------
   692 // -----------------------------------------------------------------------------
   781 //
   782 //
   782 EXPORT_C void CAdvancedAudioPlayController::AddDataSourceL(
   783 EXPORT_C void CAdvancedAudioPlayController::AddDataSourceL(
   783     MDataSource& aSource)
   784     MDataSource& aSource)
   784     {
   785     {
   785     DP1(_L("CAdvancedAudioPlayController::AddDataSourceL this[%x]"), this);
   786     DP1(_L("CAdvancedAudioPlayController::AddDataSourceL this[%x]"), this);
       
   787     DP2(_L("CAdvancedAudioController::AddDataSourceL iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);    
   786     iSourceUnreadable = EFalse;
   788     iSourceUnreadable = EFalse;
   787     iEnablePrimedStateChangedEvent = EFalse;
   789     iEnablePrimedStateChangedEvent = EFalse;
   788     // source type is intended to not be needed by controllers
   790     // source type is intended to not be needed by controllers
   789     // but metadata functions still use it
   791     // but metadata functions still use it
   790     iSourceType = aSource.DataSourceType();
   792     iSourceType = aSource.DataSourceType();
   796         }
   798         }
   797     if (iDataSourceAdapter)
   799     if (iDataSourceAdapter)
   798 		{
   800 		{
   799         User::Leave(KErrAlreadyExists);
   801         User::Leave(KErrAlreadyExists);
   800         }
   802         }
   801     if (iSharedBufferMaxNum <= 2)
       
   802         {
       
   803         iSharedBufferMaxNum = 3;
       
   804         }
       
   805 
       
   806 
   803 
   807 	// set iReadHeader here in case prime is not called before set position is used.
   804 	// set iReadHeader here in case prime is not called before set position is used.
   808     // reset before adding data source
   805     // reset before adding data source
   809     DP0(_L("CAdvancedAudioPlayController::AddDataSourceL reseting iSharedBufferCnt iReadHeader iInitPosition position vars"));
   806     DP0(_L("CAdvancedAudioPlayController::AddDataSourceL reseting iSharedBufferCnt iReadHeader iInitPosition position vars"));
   810     iSharedBufferCnt = 0;
   807     iSharedBufferCnt = 0;
   841         iAudioUtility->SetObserver(*this);
   838         iAudioUtility->SetObserver(*this);
   842         }
   839         }
   843 
   840 
   844     // we need to block this until duration is calculated if using mmfplayutility
   841     // we need to block this until duration is calculated if using mmfplayutility
   845     iBlockDuration = EFalse;
   842     iBlockDuration = EFalse;
       
   843 // ou1cimx1#205863
       
   844     if (!iDataSourceAdapter->IsLocalPlayback()) 
       
   845     	{
       
   846 	    DP0(_L("CAdvancedAudioPlayController::AddDataSourceL not file source"));        
       
   847 	    if (iSharedBufferMaxNum <= 2)
       
   848 	        {
       
   849 	        	iSharedBufferMaxNum = 3;
       
   850 	        }
       
   851 		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
       
   852 	    DP2(_L("CAdvancedAudioPlayController::AddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
       
   853     	}
   846     
   854     
   847     if ((!iEventsEnabled) && (!iDataSourceAdapter->OnlyHeaderPresent()))
   855     if ((!iEventsEnabled) && (!iDataSourceAdapter->OnlyHeaderPresent()))
   848         {
   856         {
   849         // recorder inserts just the header into the file before recording
   857         // recorder inserts just the header into the file before recording
   850         // we don't want to prime in this case
   858         // we don't want to prime in this case
  2238 	
  2246 	
  2239     // Read the default codec configuration parameters from resource file
  2247     // Read the default codec configuration parameters from resource file
  2240 	RArray<TInt>& codecConfigData = const_cast<RArray<TInt>&>(iAudioResource->CodecConfigParametersL());
  2248 	RArray<TInt>& codecConfigData = const_cast<RArray<TInt>&>(iAudioResource->CodecConfigParametersL());
  2241 	// Override default values with values found from header, if available
  2249 	// Override default values with values found from header, if available
  2242 	GetCodecConfigData(codecConfigData);
  2250 	GetCodecConfigData(codecConfigData);
  2243 	iAudioOutput->ConfigureL(iSampleRate, iSinkNumChannels, iDataType, codecConfigData);
  2251         if (!iAudioOutput)
  2244     DP0(_L("CAdvancedAudioPlayController::DoInitializeSinkL, output configured"));
  2252 	   {		
  2245 	iAudioOutput->PrimeL();
  2253 		User::Leave(KErrNotReady);
  2246     DP0(_L("CAdvancedAudioPlayController::DoInitializeSinkL, output primed"));
  2254            }  
  2247 			    
  2255         else
       
  2256            {
       
  2257 	       iAudioOutput->ConfigureL(iSampleRate, iSinkNumChannels, iDataType, codecConfigData);
       
  2258                DP0(_L("CAdvancedAudioPlayController::DoInitializeSinkL, output configured"));
       
  2259   	       iAudioOutput->PrimeL();
       
  2260                DP0(_L("CAdvancedAudioPlayController::DoInitializeSinkL, output primed"));
       
  2261 	   }		    
  2248 	// we would use this code when we have a NULL sink
  2262 	// we would use this code when we have a NULL sink
  2249 /*	if (iDuration > 0)
  2263 /*	if (iDuration > 0)
  2250 		{
  2264 		{
  2251 		DP0(_L("CAdvancedAudioPlayController::BufferFilledL, unblocking duration"));
  2265 		DP0(_L("CAdvancedAudioPlayController::BufferFilledL, unblocking duration"));
  2252 		iBlockDuration = EFalse;
  2266 		iBlockDuration = EFalse;