os/mm/devsoundextensions/drmaudioplayer/DRMPlayUtility/src/mmfclientdrmaudioplayer.h
First public contribution.
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: DRM Client AudioPlay Utility
20 #ifndef __MMFCLIENTAUDIOPLAY_H__
21 #define __MMFCLIENTAUDIOPLAY_H__
25 #include <mdaaudiosampleplayer.h>
26 #include <mmf/common/mmfcontroller.h>
27 #include <mmf/server/mmffile.h>
28 #include <mmf/server/mmfdes.h>
29 #include <mmfcontrollerimplementationuids.hrh>
30 #include <mmf/common/mmfstandardcustomcommands.h>
32 //#include "MmfClientUtility.h"
34 static const TUid KUidMmfAudioController = {KMmfUidControllerAudio};
37 Mixin class to allow notification that the timed silence has finished.
39 class MRepeatTrailingSilenceTimerObs
42 virtual void RepeatTrailingSilenceTimerComplete() = 0;
46 CTimer-based active object that waits the requested time before notifying its observer.
48 class CRepeatTrailingSilenceTimer : public CTimer
51 static CRepeatTrailingSilenceTimer* NewL(MRepeatTrailingSilenceTimerObs& aObs);
54 CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs);
56 MRepeatTrailingSilenceTimerObs& iObs;
62 Concrete implementation of the CDRMPlayerUtility API.
63 @see CDRMPlayerUtility
65 class CMMFDrmAudioPlayerUtility : public CActive
67 enum TDRMUtilityState {
74 friend class CDrmPlayerUtility;
77 static CMMFDrmAudioPlayerUtility* NewFilePlayerL(const TDesC& aFileName,
78 MDrmAudioPlayerCallback& aCallback,
79 TInt aPriority = EMdaPriorityNormal,
80 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
81 static CMMFDrmAudioPlayerUtility* NewDesPlayerL(const TDesC8& aData,
82 MDrmAudioPlayerCallback& aCallback,
83 TInt aPriority = EMdaPriorityNormal,
84 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
85 static CMMFDrmAudioPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData,
86 MDrmAudioPlayerCallback& aCallback,
87 TInt aPriority = EMdaPriorityNormal,
88 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
90 static CMMFDrmAudioPlayerUtility* NewL(MDrmAudioPlayerCallback& aCallback,
91 TInt aPriority = EMdaPriorityNormal,
92 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
94 ~CMMFDrmAudioPlayerUtility();
97 void SetVolume(TInt aVolume);
98 void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
99 void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
100 const TTimeIntervalMicroSeconds& Duration();
102 void OpenFileL(const TDesC& aFileName);
103 void OpenFileL(const RFile& aFile);
104 void OpenFileL(const TMMSource& aSource);
105 void OpenDesL(const TDesC8& aDescriptor);
106 void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
108 // API Additions since version 7.0
111 TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
112 void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
114 TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
115 TInt GetVolume(TInt& aVolume);
116 TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
117 CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
118 TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
119 const TTimeIntervalMicroSeconds& aEnd);
120 TInt ClearPlayWindow();
121 TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
122 TInt GetBalance(TInt& aBalance);
123 TInt GetBitRate(TUint& aBitRate);
125 void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver);
127 void GetAudioLoadingProgressL(TInt& aPercentageProgress);
128 const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
130 TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
131 TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
132 void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
133 void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
137 CMMFDrmAudioPlayerUtility(MDrmAudioPlayerCallback& aCallback, TInt aActivePriority);
143 void ConstructL(TInt aPriority = EMdaPriorityNormal,
144 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
146 void ConstructL(const TDesC& aFileName,
147 TInt aPriority = EMdaPriorityNormal,
148 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
150 void ConstructL(const TDesC8& aData,
151 TInt aPriority = EMdaPriorityNormal,
152 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
154 void ConstructReadOnlyL(const TDesC8& aData,
155 TInt aPriority = EMdaPriorityNormal,
156 TMdaPriorityPreference aPref = EMdaPriorityPreferenceTimeAndQuality);
160 //Returns True if Destination CustomCommand needs to be blocked
161 TBool IsValidCustomCommandDestination(TUid aDestinationUid, const TDesC8& aParam);
162 TBool CheckCustomInterfaceBuilderImplL(const TDesC8& aParam);
164 // last play window command
165 enum TPlayWindowCommand
172 MDrmAudioPlayerCallback& iCallback;
173 TDRMUtilityState iState;
174 TTimeIntervalMicroSeconds iDuration; // Needed because of api "Duration()" that returns a reference
177 CMMFControllerImplementationInformation* iControllerImplementationInformation;
179 RDrmSession* iDrmSession;
182 CBufFlat* iMetaDataBuffer;
183 MAudioLoadingObserver* iLoadingObserver;
184 TAsyncCallbackStatePckgBuf iAsyncCallback;
185 TErrorDurationStructPckgBuf iErrorDurationStruct;
186 TRequestStatus* iRequestStatus;
188 TDRMCustomCommand iCustomCommand;
189 TPckgCustomCommand iCustomCommandPckg;
191 struct TCustomCommands
193 const TMMFMessageDestinationPckg* iDestination;
195 const TDesC8* iDataTo1;
196 const TDesC8* iDataTo2;
197 const TDes8* iDataFrom;
199 TCustomCommands(const TMMFMessageDestinationPckg& aDestination, TInt aFunction,const TDesC8& aDataTo1,const TDesC8& aDataTo2,TDes8& aDataFrom)
201 iDestination = &aDestination;
202 iFunction = aFunction;
203 iDataTo1 = &aDataTo1;
204 iDataTo2 = &aDataTo2;
205 iDataFrom = &aDataFrom;
208 struct TCustomCommandsAsync
210 const TMMFMessageDestinationPckg* iDestination;
212 const TDesC8* iDataTo1;
213 const TDesC8* iDataTo2;
215 TRequestStatus* iRequestStatus;
217 TCustomCommandsAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction,const TDesC8& aDataTo1,const TDesC8& aDataTo2, TDes8& aDataFrom,TRequestStatus& aStatus)
219 iDestination = &aDestination;
220 iFunction = aFunction;
221 iDataTo1 = &aDataTo1;
222 iDataTo2 = &aDataTo2;
223 iDataFrom = &aDataFrom;
224 iRequestStatus = &aStatus;
227 struct TCustomCommandsAsyncNoData
229 const TMMFMessageDestinationPckg* iDestination;
231 const TDesC8* iDataTo1;
232 const TDesC8* iDataTo2;
233 TRequestStatus* iRequestStatus;
235 TCustomCommandsAsyncNoData(const TMMFMessageDestinationPckg& aDestination, TInt aFunction,const TDesC8& aDataTo1,const TDesC8& aDataTo2,TRequestStatus& aStatus)
237 iDestination = &aDestination;
238 iFunction = aFunction;
239 iDataTo1 = &aDataTo1;
240 iDataTo2 = &aDataTo2;
241 iRequestStatus = &aStatus;
245 typedef TPckg<TCustomCommands> TPckgTCustomCommandStructure;