0
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: DRM Player
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __SOUND_PLAYER_H
|
|
19 |
#define __SOUND_PLAYER_H
|
|
20 |
|
|
21 |
#include <DrmAudioSamplePlayer.h>
|
|
22 |
#include <AudioPreference.h>
|
|
23 |
#include <StifTestModule.h>
|
|
24 |
#include "EventTarget.h"
|
|
25 |
#include "Parameters.h"
|
|
26 |
|
|
27 |
#include <e32std.h>
|
|
28 |
#include <e32base.h>
|
|
29 |
#include <StifLogger.h>
|
|
30 |
#include <mmfcontrollerpluginresolver.h>
|
|
31 |
#include "FileNameParameters.h"
|
|
32 |
#include "Des8Parameters.h"
|
|
33 |
#include "UrlParameters.h"
|
|
34 |
#include "ObjectCountDown.h"
|
|
35 |
|
|
36 |
const TUid KUidInterfaceMMFController = {KMmfUidPluginInterfaceController};
|
|
37 |
|
5
|
38 |
class CSimpleSoundPlayer: public CBase , public MEventTarget , public MDrmAudioPlayerCallback,public MAudioLoadingObserver
|
0
|
39 |
{
|
|
40 |
public:
|
|
41 |
static CSimpleSoundPlayer* NewUrlL(const TDesC &aDescriptor, TInt aIapId, const TDesC8 &aMime, CTestModuleIf &aConsole, CStifLogger &aLogger, TBool aImmediate=ETrue);
|
|
42 |
static CSimpleSoundPlayer* NewUrlLC(const TDesC &aDescriptor, TInt aIapId, const TDesC8 &aMime, CTestModuleIf &aConsole, CStifLogger &aLogger, TBool aImmediate=ETrue);
|
|
43 |
|
|
44 |
static CSimpleSoundPlayer* NewL(const TDesC8 &aDescriptor, CTestModuleIf &aConsole, CStifLogger &aLogger, TBool aImmediate=ETrue, TBool aDesReadOnly=EFalse);
|
|
45 |
static CSimpleSoundPlayer* NewLC(const TDesC8 &aDescriptor, CTestModuleIf &aConsole, CStifLogger &aLogger, TBool aImmediate=ETrue, TBool aDesReadOnly=EFalse);
|
|
46 |
|
|
47 |
static CSimpleSoundPlayer* NewL(const TFileName &aFile, CTestModuleIf &aConsole, CStifLogger &iLogger, TBool aImmediate=ETrue, TBool aFileType=EFalse);
|
|
48 |
static CSimpleSoundPlayer* NewLC(const TFileName &aFile, CTestModuleIf &aConsole, CStifLogger &iLogger, TBool aImmediate=ETrue, TBool aFileType=EFalse);
|
|
49 |
|
|
50 |
static CSimpleSoundPlayer* NewL(const RFile &aFile, CTestModuleIf &aConsole, CStifLogger &iLogger, TBool aImmediate=ETrue);
|
|
51 |
static CSimpleSoundPlayer* NewLC(const RFile &aFile, CTestModuleIf &aConsole, CStifLogger &iLogger, TBool aImmediate=ETrue);
|
|
52 |
~CSimpleSoundPlayer();
|
|
53 |
|
|
54 |
// from MMdaAudioPlayerCallback
|
|
55 |
// void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
|
|
56 |
// void MapcPlayComplete(TInt aError);
|
|
57 |
|
|
58 |
//MDrmAudioPlayerCallBack
|
|
59 |
virtual void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
|
|
60 |
virtual void MdapcPlayComplete(TInt aError);
|
|
61 |
|
|
62 |
void SetVolumeRamp(const TTimeIntervalMicroSeconds &aRampDuration);
|
|
63 |
void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds &aTrailingSilence);
|
|
64 |
void SetPosition(const TTimeIntervalMicroSeconds &aPosition);
|
|
65 |
TInt SetPlayWindow(const TTimeIntervalMicroSeconds &aStart, const TTimeIntervalMicroSeconds &aEnd);
|
|
66 |
TTimeIntervalMicroSeconds GetPlayDuration();
|
|
67 |
TTime GetPlayStartTime();
|
|
68 |
TTime GetPlayStopTime();
|
|
69 |
TInt GetBitRate(TUint &aBitRate);
|
|
70 |
TInt GetBalance(TInt &aBalance);
|
|
71 |
TInt SetBalance(TInt aBalance);
|
|
72 |
TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
|
|
73 |
TTimeIntervalMicroSeconds GetDuration();
|
|
74 |
TInt ClearPlayWindow();
|
|
75 |
TInt Play();
|
|
76 |
TInt OpenDesL(const TDesC8 &aSoundDes , const TBool &aImmediate=ETrue) ;
|
|
77 |
TInt GetPosition(TTimeIntervalMicroSeconds &aPosition);
|
|
78 |
|
|
79 |
void SetSupervisor(TObjectCountDown *aCounter) ;
|
|
80 |
void SetPlayCompleteTarget(MEventTarget *aTarget, CParameters *aParameters) ;
|
|
81 |
|
|
82 |
void SetVolume(TInt aNewVolume);
|
|
83 |
TInt GetVolume(TInt &aVolume);
|
|
84 |
TInt MaxVolume();
|
|
85 |
|
|
86 |
void RegisterForAudioLoadingNotification(MAudioLoadingObserver &aLoadingObserver);
|
|
87 |
void GetAudioLoadingProgressL(TInt &aPercentageProgress);
|
|
88 |
// CMMFControllerImplementationInformation *ControllerImplementationInformationL();
|
|
89 |
void ControllerImplementationInformationL();
|
|
90 |
|
|
91 |
TInt GetNumberOfMetaDataEntries(TInt &aNumEntries);
|
|
92 |
CMMFMetaDataEntry *GetMetaDataEntryL(TInt aMetaDataIndex);
|
|
93 |
TInt OpenL(const TFileName &aFileName , const TBool &aImmediate);
|
5
|
94 |
void CustomCommand();
|
|
95 |
//MAudioLoadingObserver
|
|
96 |
virtual void MaloLoadingStarted();
|
|
97 |
virtual void MaloLoadingComplete();
|
0
|
98 |
private:
|
|
99 |
TInt OpenUrlL(const TDesC &aUrl, TInt aIapId, const TDesC8 &aMime) ;
|
|
100 |
TInt Pause();
|
|
101 |
// TInt OpenL(const TFileName &aFileName , const TBool &aImmediate);
|
|
102 |
TInt OpenFileHandlerL(const TFileName &aFileName , const TBool &aImmediate);
|
|
103 |
TInt Stop(const TBool &aAlsoClose=ETrue);
|
|
104 |
|
|
105 |
CSimpleSoundPlayer(CTestModuleIf &aConsole, CStifLogger &iLogger, TBool aImmediate=ETrue, TBool aFileType=EFalse);
|
|
106 |
void ConstructUrlL(const TDesC &aDescriptor, TInt aIapId, const TDesC8 &aMime);
|
|
107 |
void ConstructL(const TDesC8 &aDescriptor);
|
|
108 |
void ConstructL(const TFileName &aFile);
|
|
109 |
void ConstructL(const RFile &aFile);
|
|
110 |
|
|
111 |
void Exit(TInt aExitCode);
|
|
112 |
|
|
113 |
private:
|
|
114 |
MEventTarget *iEventTarget;
|
|
115 |
CParameters *iParameters;
|
|
116 |
|
|
117 |
TObjectCountDown *iSupervisor;
|
|
118 |
CDrmPlayerUtility* iMdaPlayer;
|
|
119 |
CTestModuleIf &iConsole;
|
|
120 |
TBool iImmediate;
|
|
121 |
CStifLogger &iLogger;
|
|
122 |
|
|
123 |
TTime iLastPlayTime;
|
|
124 |
TTime iLastStopTime;
|
|
125 |
|
|
126 |
|
|
127 |
public:
|
|
128 |
static const TInt KPlayerActionPlay;
|
|
129 |
static const TInt KPlayerActionPause;
|
|
130 |
static const TInt KPlayerActionStopPlayFile;
|
|
131 |
static const TInt KPlayerActionReportPosition;
|
|
132 |
static const TInt KPlayerActionReportDuration;
|
|
133 |
static const TInt KplayerActionMaxVolume;
|
|
134 |
static const TInt KplayerActionSetVolume;
|
|
135 |
static const TInt KplayerActionSetBalance;
|
|
136 |
static const TInt KplayerActionGetBalance;
|
|
137 |
static const TInt KplayerActionGetBitRate;
|
|
138 |
static const TInt KplayerActionSetPriority;
|
|
139 |
static const TInt KplayerActionSetRepeats;
|
|
140 |
static const TInt KPlayerActionStopPlayDes;
|
|
141 |
static const TInt KPlayerActionReportVolume;
|
|
142 |
static const TInt KPlayerActionStopPlayUrl;
|
|
143 |
static const TInt KPlayerActionStopPlayFileHandler;
|
|
144 |
static const TInt KPlayerActionOpen;
|
|
145 |
static const TInt KPlayerActionOpenFileHandler;
|
|
146 |
static const TInt KPlayerActionGetMetaDataEntry;
|
|
147 |
static const TInt KPlayerActionGetNumberOfMetaDataEntries;
|
|
148 |
|
|
149 |
static const TInt KplayerActionGetAudioLoadingProgress;
|
|
150 |
static const TInt KplayerActionRegisterForAudioLoadingNotification;
|
|
151 |
static const TInt KplayerActionControllerImplementationInformation;
|
5
|
152 |
static const TInt KPlayerActionCustomCommand;
|
0
|
153 |
|
|
154 |
TInt ExecuteL(CParameters *aParams) ;
|
|
155 |
|
|
156 |
enum TState
|
|
157 |
{
|
|
158 |
ENotReady,
|
|
159 |
EReady,
|
|
160 |
EPlaying,
|
|
161 |
EPaused
|
|
162 |
};
|
|
163 |
|
|
164 |
RFs iFs;
|
|
165 |
RFile iFileHandler;
|
|
166 |
|
|
167 |
TInt iPlayerId;
|
|
168 |
TState iState;
|
|
169 |
TBool iSoundOpen;
|
|
170 |
/////TBool iAutoClose;
|
|
171 |
TInt iFinalError;
|
|
172 |
TTimeIntervalMicroSeconds iPosition;
|
|
173 |
TTimeIntervalMicroSeconds iStartPosition;
|
|
174 |
TTimeIntervalMicroSeconds iEndPosition;
|
|
175 |
TInt iBalance;
|
|
176 |
TBool iPlayVolume;
|
|
177 |
TBool iMetaInfo;
|
|
178 |
TBool iMetaInfoTest;
|
|
179 |
TBool iPlayWindow;
|
|
180 |
TBool iClearWindow;
|
|
181 |
TBool iSetBalance;
|
|
182 |
TBool iFsOpened;
|
|
183 |
TBool iFileType;
|
|
184 |
|
|
185 |
TBool iDontPlayAudioClip;
|
|
186 |
|
|
187 |
private:
|
|
188 |
TBool iIsLoopPlayEnabled;
|
|
189 |
};
|
|
190 |
|
|
191 |
#endif //__SOUND_PLAYER_H
|
|
192 |
|