epoc32/include/mmf/server/mmfdatapath2.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalTechnology 
       
    19 */
       
    20 
       
    21 #ifndef MMFDATAPATH2_H
       
    22 #define MMFDATAPATH2_H
       
    23 
       
    24 #include <mmf/common/mmfcontroller.h>
       
    25 #include <mmf/server/mmfdatasource.h>
       
    26 #include <mmf/server/mmfdatasink.h>
       
    27 #include <mmf/server/mmfcodec.h>
       
    28 #include <mmf/server/mmfbuffer.h>
       
    29 #include <mmf/common/mmfutilities.h>
       
    30 #include <mmf/server/mmfformat.h>
       
    31 #include <mmf/server/mmfsubthreadbase.h>
       
    32 #include <mmf/server/mmfdatapath.h>
       
    33 
       
    34 /**
       
    35 
       
    36 This class is an extended version of CMMFDataPath. CMMFDataPath is extended to implement the loop play 
       
    37 functionality in the controller. This class overrides some of the virual functions of CMMFDataPath in order to
       
    38 implement the loop play functionality. All the controller plugins that require loop play functionality should
       
    39 use CMMFDataPath2 in place of CMMFDataPath.
       
    40 
       
    41 @see CMMFDataPath
       
    42 */
       
    43 class CMMFDataPath2 : public CMMFDataPath
       
    44 	{
       
    45 public:
       
    46 	//CMMFDataPath2 constructor if codec Uid is not already known by CMMFController
       
    47 	//and there is no data path ambiguity - ie only one data path is possible
       
    48 	IMPORT_C static CMMFDataPath2* NewL(MAsyncEventHandler& aEventHandler); 
       
    49 
       
    50 	//CMMFDataPath2 constructor if codec Uid is not already known by CMMFController
       
    51 	//and there is ambiguity ie more than one possible data path TMediaId used to select path 
       
    52 	IMPORT_C static CMMFDataPath2* NewL(TMediaId aMediaId, MAsyncEventHandler& aEventHandler); 
       
    53 
       
    54 	//CMMFDataPath2 constructor if codec Uid is already known by CMMFController
       
    55 	//and there is no data path ambiguity - ie only one data path is possible
       
    56 	IMPORT_C static CMMFDataPath2* NewL(TUid aCodecUid, MAsyncEventHandler& aEventHandler); 
       
    57 
       
    58 	//CMMFDataPath2 constructor if codec Uid is already known by CMMFController
       
    59 	//and there is ambiguity ie more than one possible data path TMediaId used to select path 
       
    60 	IMPORT_C static CMMFDataPath2* NewL(TUid aCodecUid, TMediaId aMediaId, MAsyncEventHandler& aEventHandler);
       
    61 
       
    62 	virtual ~CMMFDataPath2();
       
    63 	virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by the CMMFDataPath's MDataSource when it has filled the buffer
       
    64 	
       
    65 	virtual void PrimeL();
       
    66 	virtual void PlayL();
       
    67 	virtual void Pause();
       
    68 	virtual void Stop();
       
    69 	virtual void SetPositionL(const TTimeIntervalMicroSeconds& aPosition);
       
    70 	virtual TTimeIntervalMicroSeconds Position() const;
       
    71 	// Called when source and sink needs to be de-referenced
       
    72 	virtual void ResetL();
       
    73 	void RunL();
       
    74 	// Set Repeats.
       
    75 	IMPORT_C void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
       
    76 	IMPORT_C void SetDrmProperties(MDataSource* iDrmSource, TBool *aDisableAutoIntent);
       
    77 	IMPORT_C void RetainRepeatInfo();
       
    78 	IMPORT_C void PreEmptionPause();
       
    79 	
       
    80 protected:
       
    81 	CMMFDataPath2(TMediaId aMediaId, MAsyncEventHandler& aEventHandler);
       
    82 	void ConstructL(TUid aCodecUid = KNullUid);
       
    83 	void FillSourceBufferL();
       
    84 	void DoFillSourceBufferL();
       
    85 	TTimeIntervalMicroSeconds CalculateAudioOutputPosition() const;
       
    86 	//called when trailing silence playback is complete
       
    87 	static TInt RepeatTrailingSilenceTimerComplete(TAny* aDataPath);
       
    88 	TInt DoRepeatTrailingSilenceTimerCompleteL();
       
    89 	void PlaySilence();
       
    90 	void DoStopL();
       
    91 	void DoPauseL();
       
    92 	void DoCancel();
       
    93 	TTimeIntervalMicroSeconds OutputPosition() const;
       
    94 	void DoPreEmptionPauseL();
       
    95 	
       
    96 	
       
    97 protected:
       
    98 	/**
       
    99     The number of times to repeat the audio sample. 
       
   100     */
       
   101     TInt iNumberOfTimesToRepeat;
       
   102     
       
   103     /**
       
   104     The number of times played. 
       
   105     */
       
   106     TInt iNumberOfTimesPlayed;
       
   107 	/**
       
   108     The time interval of the trailing silence in microseconds.
       
   109 	*/
       
   110 	TTimeIntervalMicroSeconds iTrailingSilence;
       
   111 
       
   112 	/**
       
   113     The time interval of the trailing silence left to play in microseconds.
       
   114 	*/
       
   115 	TTimeIntervalMicroSeconds iTrailingSilenceLeftToPlay;
       
   116 	
       
   117 	/**
       
   118     The time left for the play to be completed in a particular repeat
       
   119 	*/
       
   120 	TTimeIntervalMicroSeconds iTimeLeftToPlayComplete;
       
   121 
       
   122 	/**
       
   123 	Timer used for trailing silences when repeating
       
   124 	*/
       
   125 	CPeriodic* iRepeatTrailingSilenceTimer;
       
   126 	//This variable stores the devsound time played when the play is repositioned
       
   127 	TTimeIntervalMicroSeconds iDevSoundRepositionTime;
       
   128 	//states when the silence period between repeats needs to be verified
       
   129 	TBool iVerifyPlayComplete;
       
   130 	
       
   131 	//For Drm implementation during repeats
       
   132 	MDataSource* iDrmSource;
       
   133 	TBool* iDisableAutoIntent;
       
   134 	TBool iRetainRepeatInfo;
       
   135 	TBool iGetTimePlayedSupported;
       
   136 	TBool iIsResumeSupported;
       
   137 	TBool iIsUsingResumeSupport;
       
   138 	}; 
       
   139 
       
   140 #endif