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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #ifndef MMFDATAPATH2_H
22 #define MMFDATAPATH2_H
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>
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.
43 class CMMFDataPath2 : public CMMFDataPath
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);
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);
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);
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);
62 virtual ~CMMFDataPath2();
63 virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by the CMMFDataPath's MDataSource when it has filled the buffer
65 virtual void PrimeL();
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();
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();
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();
93 TTimeIntervalMicroSeconds OutputPosition() const;
94 void DoPreEmptionPauseL();
99 The number of times to repeat the audio sample.
101 TInt iNumberOfTimesToRepeat;
104 The number of times played.
106 TInt iNumberOfTimesPlayed;
108 The time interval of the trailing silence in microseconds.
110 TTimeIntervalMicroSeconds iTrailingSilence;
113 The time interval of the trailing silence left to play in microseconds.
115 TTimeIntervalMicroSeconds iTrailingSilenceLeftToPlay;
118 The time left for the play to be completed in a particular repeat
120 TTimeIntervalMicroSeconds iTimeLeftToPlayComplete;
123 Timer used for trailing silences when repeating
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;
131 //For Drm implementation during repeats
132 MDataSource* iDrmSource;
133 TBool* iDisableAutoIntent;
134 TBool iRetainRepeatInfo;
135 TBool iGetTimePlayedSupported;
136 TBool iIsResumeSupported;
137 TBool iIsUsingResumeSupport;