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