mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Src/AdvancedAudioPlayController.cpp
branchRCL_3
changeset 17 3570217d8c21
parent 13 f5c5c82a163e
child 18 2eb3b066cc7d
equal deleted inserted replaced
13:f5c5c82a163e 17:3570217d8c21
   839         iAudioUtility->SetObserver(*this);
   839         iAudioUtility->SetObserver(*this);
   840         }
   840         }
   841 
   841 
   842     // we need to block this until duration is calculated if using mmfplayutility
   842     // we need to block this until duration is calculated if using mmfplayutility
   843     iBlockDuration = EFalse;
   843     iBlockDuration = EFalse;
   844 // ou1cimx1#205863
       
   845     if (!iDataSourceAdapter->IsLocalPlayback()) 
       
   846     	{
       
   847 	    DP0(_L("CAdvancedAudioPlayController::AddDataSourceL not file source"));        
       
   848 	    if (iSharedBufferMaxNum <= 2)
       
   849 	        {
       
   850 	        	iSharedBufferMaxNum = 3;
       
   851 	        }
       
   852 		 iSharedBufferMaxSize = iSharedBufferMaxSizeForNonSeekableSrc;
       
   853 	    DP2(_L("CAdvancedAudioPlayController::AddDataSourceL new iSharedBufferMaxNum[%d] iSharedBufferMaxSize[%d]"), iSharedBufferMaxNum, iSharedBufferMaxSize);
       
   854     	}
       
   855     
   844     
   856     if ((!iEventsEnabled) && (!iDataSourceAdapter->OnlyHeaderPresent()))
   845     if ((!iEventsEnabled) && (!iDataSourceAdapter->OnlyHeaderPresent()))
   857         {
   846         {
   858         // recorder inserts just the header into the file before recording
   847         // recorder inserts just the header into the file before recording
   859         // we don't want to prime in this case
   848         // we don't want to prime in this case
   995 EXPORT_C void CAdvancedAudioPlayController::RemoveDataSinkL(
   984 EXPORT_C void CAdvancedAudioPlayController::RemoveDataSinkL(
   996     MDataSink& aDataSink)
   985     MDataSink& aDataSink)
   997     {
   986     {
   998     DP0(_L("CAdvancedAudioPlayController::RemoveDataSinkL"));
   987     DP0(_L("CAdvancedAudioPlayController::RemoveDataSinkL"));
   999 
   988 
  1000     if (!iDataSink)
   989     if (iDataSink != &aDataSink)
       
   990 		{
       
   991         User::Leave(KErrArgument);
       
   992 		}
       
   993 
       
   994     if ((iState != EStopped) && (iState != EInitialized))
  1001 		{
   995 		{
  1002         User::Leave(KErrNotReady);
   996         User::Leave(KErrNotReady);
  1003 		}
   997 		}
  1004 
   998 		
  1005     if (iDataSink != &aDataSink)
   999    if (iDataSink)
  1006 		{
  1000    	{
  1007         User::Leave(KErrArgument);
  1001        iDataSink->SinkStopL();         // should always stop source before logoff
  1008 		}
  1002 	     iDataSink->SinkThreadLogoff();
  1009 
  1003 	  }
  1010     if ((iState != EStopped) && (iState != EInitialized))
       
  1011 		{
       
  1012         User::Leave(KErrNotReady);
       
  1013 		}
       
  1014 
       
  1015     iDataSink->SinkStopL();         // should always stop source before logoff
       
  1016 	iDataSink->SinkThreadLogoff();
       
  1017 
  1004 
  1018     // dereference Decoder from Utility before deleting AudioOutput (which took ownership of decoder)
  1005     // dereference Decoder from Utility before deleting AudioOutput (which took ownership of decoder)
  1019     if (iAudioUtility)
  1006     if (iAudioUtility)
  1020     	{
  1007     	{
  1021         iAudioUtility->DeReferenceDecoder();
  1008         iAudioUtility->DeReferenceDecoder();
  1022     	}
  1009     	}
  1023     
  1010     
  1024 	delete iAudioOutput;
  1011     delete iAudioOutput;
  1025 	iAudioOutput = NULL;
  1012 	  iAudioOutput = NULL;
  1026     iDataSink = NULL;
  1013     iDataSink = NULL;
  1027     iDecoderExists = EFalse;
  1014     iDecoderExists = EFalse;
  1028     }
  1015     }
  1029 
  1016 
  1030 // -----------------------------------------------------------------------------
  1017 // -----------------------------------------------------------------------------
  1034 EXPORT_C void CAdvancedAudioPlayController::ResetL()
  1021 EXPORT_C void CAdvancedAudioPlayController::ResetL()
  1035     {
  1022     {
  1036     DP0(_L("CAdvancedAudioPlayController::ResetL"));
  1023     DP0(_L("CAdvancedAudioPlayController::ResetL"));
  1037 
  1024 
  1038     RemoveDataSourceL(*iDataSource);
  1025     RemoveDataSourceL(*iDataSource);
  1039     RemoveDataSinkL(*iDataSink);
  1026     
       
  1027     if (iDataSink)
       
  1028     	{
       
  1029     		  DP0(_L("CAdvancedAudioPlayController::ResetL, calling RemoveDataSinkL"));
       
  1030           RemoveDataSinkL(*iDataSink);
       
  1031       }
  1040     }
  1032     }
  1041 
  1033 
  1042 // -----------------------------------------------------------------------------
  1034 // -----------------------------------------------------------------------------
  1043 // CAdvancedAudioPlayController::PrimeL
  1035 // CAdvancedAudioPlayController::PrimeL
  1044 // -----------------------------------------------------------------------------
  1036 // -----------------------------------------------------------------------------