0
|
1 |
// Copyright (c) 1999-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 |
#ifndef __MDAAUDIOSAMPLEPLAYER_H
|
|
17 |
#define __MDAAUDIOSAMPLEPLAYER_H
|
|
18 |
|
|
19 |
#include <e32std.h>
|
|
20 |
#include <f32file.h>
|
|
21 |
#include <mmf/common/mmfaudio.h>
|
|
22 |
#include <mmf/common/mmfbase.h>
|
|
23 |
#include <mmf/common/mmfcontrollerframeworkbase.h>
|
|
24 |
#include <mmf/common/mmfstandardcustomcommands.h>
|
|
25 |
#include <mmf/common/mmfdrmcustomcommands.h>
|
|
26 |
#include <mmfclntutility.h>
|
|
27 |
#include <mmf/common/mmfdurationinfocustomcommands.h>
|
|
28 |
|
|
29 |
class CMdaServer;
|
|
30 |
|
|
31 |
/**
|
|
32 |
@publishedAll
|
|
33 |
@released
|
|
34 |
|
|
35 |
An interface to a set of audio player callback functions.
|
|
36 |
|
|
37 |
The class is a mixin and is intended to be inherited by the client
|
|
38 |
class which is observing the audio playing operation. The functions
|
|
39 |
encapsulated by this class are called when specific events occur in
|
|
40 |
the process of initialising and playing an audio sample. A reference to
|
|
41 |
this object is passed as a parameter when constructing an audio player
|
|
42 |
utility object.
|
|
43 |
|
|
44 |
@since 5.0
|
|
45 |
*/
|
|
46 |
class MMdaAudioPlayerCallback
|
|
47 |
{
|
|
48 |
public:
|
|
49 |
|
|
50 |
/**
|
|
51 |
Defines required client behaviour when an attempt to open and
|
|
52 |
initialise an audio sample has completed, successfully or otherwise.
|
|
53 |
|
|
54 |
@param aError
|
|
55 |
The status of the audio sample after initialisation.
|
|
56 |
The following values have the same specific meaning
|
|
57 |
across all EPOC platforms: KErrNone the
|
|
58 |
sample is ready to play. KErrNotSupported
|
|
59 |
the audio format or particular encoding type is not
|
|
60 |
recognised or not supported. KErrNotFound
|
|
61 |
the audio sample cannot be found.
|
|
62 |
KErrNoMemory there is insufficient memory
|
|
63 |
to play this audio sample. Other values are possible
|
|
64 |
indicating a problem opening the audio sample. These
|
|
65 |
values are dependent on the EPOC platform.
|
|
66 |
@param aDuration
|
|
67 |
The duration of the audio sample.
|
|
68 |
*/
|
|
69 |
virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) = 0;
|
|
70 |
|
|
71 |
/**
|
|
72 |
Defines required client behaviour when an attempt to playback an audio
|
|
73 |
sample has completed, successfully or otherwise.
|
|
74 |
|
|
75 |
@param aError
|
|
76 |
The status of playback. The following values have the
|
|
77 |
same specific meaning across all EPOC platforms:
|
|
78 |
KErrNone playing of the audio sample is
|
|
79 |
complete. KErrCorrupt the sample data is
|
|
80 |
corrupt. KErrInUse the sound device is in
|
|
81 |
use by another higher priority client. This can happen
|
|
82 |
during playback. KErrNoMemory there is
|
|
83 |
insufficient memory to play this audio sample Other
|
|
84 |
values are possible indicating a problem opening the
|
|
85 |
audio sample. These values are dependent on the EPOC
|
|
86 |
platform.
|
|
87 |
*/
|
|
88 |
virtual void MapcPlayComplete(TInt aError) = 0;
|
|
89 |
};
|
|
90 |
|
|
91 |
|
|
92 |
class CMMFMdaAudioPlayerUtility;
|
|
93 |
|
|
94 |
/**
|
|
95 |
@publishedAll
|
|
96 |
@released
|
|
97 |
|
|
98 |
Plays sampled audio data.
|
|
99 |
|
|
100 |
The class offers a simple interface to open, play and obtain
|
|
101 |
information from, sampled audio data. The audio data can be supplied
|
|
102 |
either in a file (file-based), as a descriptor
|
|
103 |
(descriptor-based) or as a URL reference (since version 7.0s).
|
|
104 |
|
|
105 |
While this class is abstract, the three static functions construct, initialise
|
|
106 |
and return pointers to instances of concrete classes derived from this
|
|
107 |
abstract class.
|
|
108 |
|
|
109 |
@since 5.0
|
|
110 |
*/
|
|
111 |
class CMdaAudioPlayerUtility : public CBase,
|
|
112 |
public MMMFClientUtility
|
|
113 |
{
|
|
114 |
public:
|
|
115 |
IMPORT_C static CMdaAudioPlayerUtility* NewFilePlayerL(const TDesC& aFileName,
|
|
116 |
MMdaAudioPlayerCallback& aCallback,
|
|
117 |
TInt aPriority = EMdaPriorityNormal,
|
|
118 |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
|
|
119 |
CMdaServer* aServer = NULL);
|
|
120 |
IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerL(const TDesC8& aData,
|
|
121 |
MMdaAudioPlayerCallback& aCallback,
|
|
122 |
TInt aPriority = EMdaPriorityNormal,
|
|
123 |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
|
|
124 |
CMdaServer* aServer = NULL);
|
|
125 |
IMPORT_C static CMdaAudioPlayerUtility* NewDesPlayerReadOnlyL(const TDesC8& aData,
|
|
126 |
MMdaAudioPlayerCallback& aCallback,
|
|
127 |
TInt aPriority = EMdaPriorityNormal,
|
|
128 |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality,
|
|
129 |
CMdaServer* aServer = NULL);
|
|
130 |
|
|
131 |
// new export from version 7.0
|
|
132 |
IMPORT_C static CMdaAudioPlayerUtility* NewL(MMdaAudioPlayerCallback& aCallback,
|
|
133 |
TInt aPriority = EMdaPriorityNormal,
|
|
134 |
TInt aPref = EMdaPriorityPreferenceTimeAndQuality);
|
|
135 |
|
|
136 |
IMPORT_C void UseSharedHeap();
|
|
137 |
|
|
138 |
~CMdaAudioPlayerUtility();
|
|
139 |
|
|
140 |
virtual void Play();
|
|
141 |
|
|
142 |
virtual void Stop();
|
|
143 |
|
|
144 |
virtual TInt SetVolume(TInt aVolume);
|
|
145 |
|
|
146 |
virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence);
|
|
147 |
|
|
148 |
virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
|
|
149 |
|
|
150 |
virtual const TTimeIntervalMicroSeconds& Duration();
|
|
151 |
IMPORT_C TMMFDurationInfo Duration(TTimeIntervalMicroSeconds& aDuration);
|
|
152 |
|
|
153 |
virtual TInt MaxVolume();
|
|
154 |
|
|
155 |
IMPORT_C void OpenFileL(const TDesC& aFileName);
|
|
156 |
IMPORT_C void OpenFileL(const RFile& aFile);
|
|
157 |
|
|
158 |
IMPORT_C void OpenFileL(const TMMSource& aSource);
|
|
159 |
|
|
160 |
IMPORT_C void OpenDesL(const TDesC8& aDescriptor);
|
|
161 |
|
|
162 |
IMPORT_C void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType=KNullDesC8);
|
|
163 |
|
|
164 |
IMPORT_C TInt Pause();
|
|
165 |
|
|
166 |
IMPORT_C void Close();
|
|
167 |
|
|
168 |
IMPORT_C TInt GetPosition(TTimeIntervalMicroSeconds& aPosition);
|
|
169 |
|
|
170 |
IMPORT_C void SetPosition(const TTimeIntervalMicroSeconds& aPosition);
|
|
171 |
|
|
172 |
IMPORT_C TInt SetPriority(TInt aPriority, TInt aPref);
|
|
173 |
|
|
174 |
IMPORT_C TInt GetVolume(TInt& aVolume);
|
|
175 |
|
|
176 |
IMPORT_C TInt GetNumberOfMetaDataEntries(TInt& aNumEntries);
|
|
177 |
|
|
178 |
IMPORT_C CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex);
|
|
179 |
|
|
180 |
IMPORT_C TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
|
|
181 |
const TTimeIntervalMicroSeconds& aEnd);
|
|
182 |
|
|
183 |
IMPORT_C TInt ClearPlayWindow();
|
|
184 |
|
|
185 |
IMPORT_C TInt SetBalance(TInt aBalance = KMMFBalanceCenter);
|
|
186 |
|
|
187 |
IMPORT_C TInt GetBalance(TInt& aBalance);
|
|
188 |
|
|
189 |
IMPORT_C void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback);
|
|
190 |
|
|
191 |
IMPORT_C void GetAudioLoadingProgressL(TInt& aPercentageComplete);
|
|
192 |
|
|
193 |
IMPORT_C const CMMFControllerImplementationInformation& ControllerImplementationInformationL();
|
|
194 |
|
|
195 |
IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
|
|
196 |
|
|
197 |
IMPORT_C TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
|
|
198 |
|
|
199 |
IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
|
|
200 |
|
|
201 |
IMPORT_C void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
|
|
202 |
|
|
203 |
IMPORT_C TInt GetBitRate(TUint& aBitRate);
|
|
204 |
|
|
205 |
IMPORT_C MMMFDRMCustomCommand* GetDRMCustomCommand();
|
|
206 |
|
|
207 |
IMPORT_C TInt RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,TUid aNotificationEventUid,const TDesC8& aNotificationRegistrationData = KNullDesC8);
|
|
208 |
|
|
209 |
IMPORT_C TInt CancelRegisterAudioResourceNotification(TUid aNotificationEventId);
|
|
210 |
|
|
211 |
IMPORT_C TInt WillResumePlay();
|
|
212 |
|
|
213 |
IMPORT_C TInt SetThreadPriority(const TThreadPriority& aThreadPriority) const;
|
|
214 |
|
|
215 |
private:
|
|
216 |
CMdaAudioPlayerUtility();
|
|
217 |
|
|
218 |
protected:
|
|
219 |
/**
|
|
220 |
This member is internal and not intended for use.
|
|
221 |
*/
|
|
222 |
CMMFMdaAudioPlayerUtility* iProperties;
|
|
223 |
};
|
|
224 |
|
|
225 |
|
|
226 |
#endif
|