mmlibs/mmfw/src/server/BaseClasses/mmfdatapath2.cpp
changeset 58 b6dbf97aba93
parent 0 40261b775718
equal deleted inserted replaced
57:1cbb0d5bf7f2 58:b6dbf97aba93
   488 	//if we are converting. For conversion we look at the data we have read. This is then passed onto 
   488 	//if we are converting. For conversion we look at the data we have read. This is then passed onto 
   489 	//the source
   489 	//the source
   490 	if (!iSourceBuffer->BufferSize() || iSourceBuffer->LastBuffer() ||
   490 	if (!iSourceBuffer->BufferSize() || iSourceBuffer->LastBuffer() ||
   491 		(((iState == EConverting) || (iState == EPlaying)) && (iPlayWindowEndPosition < iCachedSourceDuration) && ( InputPosition() >= iPlayWindowEndPosition ))) 
   491 		(((iState == EConverting) || (iState == EPlaying)) && (iPlayWindowEndPosition < iCachedSourceDuration) && ( InputPosition() >= iPlayWindowEndPosition ))) 
   492 		{
   492 		{
   493 		iNumberOfTimesPlayed++;
   493 		//When it resumes in silence , position of the buffer is in end so we need to skip the increament.
       
   494 		if(!iPauseCalledInsilence) 
       
   495 		{    
       
   496 			iNumberOfTimesPlayed++;
       
   497 		}else
       
   498 		{
       
   499 			iPauseCalledInsilence=EFalse;
       
   500 		}
   494 		if ((iNumberOfTimesPlayed <= iNumberOfTimesToRepeat) || iNumberOfTimesToRepeat == KMdaRepeatForever)
   501 		if ((iNumberOfTimesPlayed <= iNumberOfTimesToRepeat) || iNumberOfTimesToRepeat == KMdaRepeatForever)
   495 			{
   502 			{
   496 			iSourceBuffer->SetLastBuffer(EFalse);
   503 			iSourceBuffer->SetLastBuffer(EFalse);
   497 			//this will trigger the trailing silence timer next time a buffer is requested.
   504 			//this will trigger the trailing silence timer next time a buffer is requested.
   498 			iTrailingSilenceLeftToPlay = iTrailingSilence;
   505 			iTrailingSilenceLeftToPlay = iTrailingSilence;
   897 			iDataSink->SinkPauseL();
   904 			iDataSink->SinkPauseL();
   898 			// When true pause is supported only the datapath's position 
   905 			// When true pause is supported only the datapath's position 
   899 			// should be updated, MDataSource position should be changed
   906 			// should be updated, MDataSource position should be changed
   900 			iStartPosition = Position();
   907 			iStartPosition = Position();
   901 			iIsUsingResumeSupport = ETrue;
   908 			iIsUsingResumeSupport = ETrue;
       
   909 			if(iRepeatTrailingSilenceTimer->IsActive())
       
   910 			{   
       
   911 				iPauseCalledInsilence=ETrue;
       
   912 			}   
   902 			// If we wait for the sink to complete play, then we do not proceed with supplying the buffers to the sink
   913 			// If we wait for the sink to complete play, then we do not proceed with supplying the buffers to the sink
   903 			// In this case we need to reset the buffers so that InitializeSinkL won't attempt bringing in new ones
   914 			// In this case we need to reset the buffers so that InitializeSinkL won't attempt bringing in new ones
   904 			if (iTransferState == EWaitSink)
   915 			if (iTransferState == EWaitSink)
   905 				{
   916 				{
   906 				ResetRefBuffers();
   917 				ResetRefBuffers();
   962 		CMMFAudioOutput* audioOutput = STATIC_CAST(CMMFAudioOutput*,iDataSink);
   973 		CMMFAudioOutput* audioOutput = STATIC_CAST(CMMFAudioOutput*,iDataSink);
   963 		CMMFDevSound& devSound = audioOutput->SoundDevice();
   974 		CMMFDevSound& devSound = audioOutput->SoundDevice();
   964 		iGetTimePlayedSupported = devSound.IsGetTimePlayedSupported();
   975 		iGetTimePlayedSupported = devSound.IsGetTimePlayedSupported();
   965 		iIsResumeSupported = devSound.IsResumeSupported();
   976 		iIsResumeSupported = devSound.IsResumeSupported();
   966 		iIsUsingResumeSupport = EFalse;
   977 		iIsUsingResumeSupport = EFalse;
       
   978 		iPauseCalledInsilence = EFalse;
   967 		}
   979 		}
   968 	}
   980 	}
   969 
   981 
   970 /**
   982 /**
   971 Starts an active scheduler 'play' loop.
   983 Starts an active scheduler 'play' loop.
   988 		{
  1000 		{
   989 		//can only play from the primed state
  1001 		//can only play from the primed state
   990 
  1002 
   991 		if(iPauseCalled) //sink and source will have been stopped, and we will not have been re-primed
  1003 		if(iPauseCalled) //sink and source will have been stopped, and we will not have been re-primed
   992 			{
  1004 			{
   993 			iDataSink->SinkPrimeL(); //propagate change down to sink
  1005 			//When pause is called silence,we need to send the buffer while resume so icansendbuffer should enabled
       
  1006 			if(!iPauseCalledInsilence)
       
  1007 			{
       
  1008 				iDataSink->SinkPrimeL(); //propagate change down to sink
       
  1009 			}
   994 			iPauseCalled = EFalse;
  1010 			iPauseCalled = EFalse;
   995 			}
  1011 			}
   996 
  1012 
   997 		iCurrentSourceFrameNumber = 0; //reset to beginning
  1013 		iCurrentSourceFrameNumber = 0; //reset to beginning
   998 		iCurrentSinkFrameNumber = 0; //reset to beginning
  1014 		iCurrentSinkFrameNumber = 0; //reset to beginning