sl@0
|
1 |
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include <bautils.h>
|
sl@0
|
17 |
#include <utf.h>
|
sl@0
|
18 |
#include <mmf/common/mmfpaniccodes.h>
|
sl@0
|
19 |
#include "mmfclientaudioplayer.h"
|
sl@0
|
20 |
#include "mmfclientutility.h"
|
sl@0
|
21 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
22 |
#include <mmf/common/mmfdurationinfocustomcommandsimpl.h>
|
sl@0
|
23 |
#include <mmf/common/mmfdurationinfocustomcommandsenums.h>
|
sl@0
|
24 |
#endif
|
sl@0
|
25 |
|
sl@0
|
26 |
using namespace ContentAccess;
|
sl@0
|
27 |
|
sl@0
|
28 |
// declared in the recorder module
|
sl@0
|
29 |
void Panic(TInt aPanicCode);
|
sl@0
|
30 |
|
sl@0
|
31 |
/**
|
sl@0
|
32 |
Constructs and initialises a new instance of the audio player utility.
|
sl@0
|
33 |
|
sl@0
|
34 |
The function leaves if the audio player utility object cannot be created.
|
sl@0
|
35 |
|
sl@0
|
36 |
No callback notification is made upon completion of NewL().
|
sl@0
|
37 |
|
sl@0
|
38 |
@param aCallback
|
sl@0
|
39 |
The audio player observer interface.
|
sl@0
|
40 |
@param aPriority
|
sl@0
|
41 |
The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
|
sl@0
|
42 |
EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
|
sl@0
|
43 |
@param aPref
|
sl@0
|
44 |
The Priority Preference - an additional audio policy parameter. The suggested default is
|
sl@0
|
45 |
EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
|
sl@0
|
46 |
values may be supported by given phones and/or platforms, but should not be depended upon by
|
sl@0
|
47 |
portable code.
|
sl@0
|
48 |
|
sl@0
|
49 |
@return A pointer to the new audio player utility object.
|
sl@0
|
50 |
|
sl@0
|
51 |
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
|
sl@0
|
52 |
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
|
sl@0
|
53 |
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
|
sl@0
|
54 |
Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
|
sl@0
|
55 |
vary between different phones. Portable applications are advised not to assume any specific behaviour.
|
sl@0
|
56 |
*/
|
sl@0
|
57 |
EXPORT_C CMdaAudioPlayerUtility* CMdaAudioPlayerUtility::NewL(MMdaAudioPlayerCallback& aCallback,
|
sl@0
|
58 |
TInt aPriority,
|
sl@0
|
59 |
TInt aPref)
|
sl@0
|
60 |
{
|
sl@0
|
61 |
CMdaAudioPlayerUtility* self = new(ELeave) CMdaAudioPlayerUtility();
|
sl@0
|
62 |
CleanupStack::PushL(self);
|
sl@0
|
63 |
self->iProperties = CMMFMdaAudioPlayerUtility::NewL(aCallback, aPriority, aPref);
|
sl@0
|
64 |
CleanupStack::Pop(self);
|
sl@0
|
65 |
return self;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
/**
|
sl@0
|
69 |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data
|
sl@0
|
70 |
from a file. The audio data must be in a supported format (e.g. WAV and AU).
|
sl@0
|
71 |
|
sl@0
|
72 |
The function leaves if the audio player utility object cannot be created.
|
sl@0
|
73 |
|
sl@0
|
74 |
When initialisation of the audio player utility is complete, successfully or otherwise, the callback
|
sl@0
|
75 |
function MMdaAudioPlayerCallback::MapcInitComplete() is called.
|
sl@0
|
76 |
|
sl@0
|
77 |
@param aFileName
|
sl@0
|
78 |
The full path name of the file containing the audio data.
|
sl@0
|
79 |
@param aCallback
|
sl@0
|
80 |
The audio player observer interface.
|
sl@0
|
81 |
@param aPriority
|
sl@0
|
82 |
The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
|
sl@0
|
83 |
EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
|
sl@0
|
84 |
@param aPref
|
sl@0
|
85 |
The Priority Preference - an additional audio policy parameter. The suggested default is
|
sl@0
|
86 |
EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
|
sl@0
|
87 |
values may be supported by given phones and/or platforms, but should not be depended upon by
|
sl@0
|
88 |
portable code.
|
sl@0
|
89 |
@param aServer
|
sl@0
|
90 |
Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.
|
sl@0
|
91 |
|
sl@0
|
92 |
@return A pointer to the new audio player utility object.
|
sl@0
|
93 |
|
sl@0
|
94 |
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
|
sl@0
|
95 |
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
|
sl@0
|
96 |
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
|
sl@0
|
97 |
Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
|
sl@0
|
98 |
vary between different phones. Portable applications are advised not to assume any specific behaviour.
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
EXPORT_C CMdaAudioPlayerUtility* CMdaAudioPlayerUtility::NewFilePlayerL(const TDesC& aFileName,
|
sl@0
|
101 |
MMdaAudioPlayerCallback& aCallback,
|
sl@0
|
102 |
TInt aPriority,
|
sl@0
|
103 |
TInt aPref,
|
sl@0
|
104 |
CMdaServer* /*aServer*/)
|
sl@0
|
105 |
{
|
sl@0
|
106 |
CMdaAudioPlayerUtility* self = new(ELeave) CMdaAudioPlayerUtility();
|
sl@0
|
107 |
CleanupStack::PushL(self);
|
sl@0
|
108 |
self->iProperties = CMMFMdaAudioPlayerUtility::NewFilePlayerL(aFileName, aCallback, aPriority, aPref);
|
sl@0
|
109 |
CleanupStack::Pop(self);
|
sl@0
|
110 |
return self;
|
sl@0
|
111 |
}
|
sl@0
|
112 |
|
sl@0
|
113 |
/**
|
sl@0
|
114 |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data
|
sl@0
|
115 |
from a descriptor.
|
sl@0
|
116 |
|
sl@0
|
117 |
The audio data must be in a supported format (e.g. WAV and AU).
|
sl@0
|
118 |
|
sl@0
|
119 |
The function leaves if the audio player utility object cannot be created. When initialisation of the
|
sl@0
|
120 |
audio player utility is complete, successfully or otherwise, the callback function
|
sl@0
|
121 |
MMdaAudioPlayerCallback::MapcInitComplete() is called.
|
sl@0
|
122 |
|
sl@0
|
123 |
@param aData
|
sl@0
|
124 |
A descriptor containing the audio data. This descriptor must remain in existence for the
|
sl@0
|
125 |
lifetime of this audio player utility object.
|
sl@0
|
126 |
@param aCallback
|
sl@0
|
127 |
The audio player observer interface.
|
sl@0
|
128 |
@param aPriority
|
sl@0
|
129 |
The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
|
sl@0
|
130 |
EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
|
sl@0
|
131 |
@param aPref
|
sl@0
|
132 |
The Priority Preference - an additional audio policy parameter. The suggested default is
|
sl@0
|
133 |
EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
|
sl@0
|
134 |
values may be supported by given phones and/or platforms, but should not be depended upon by
|
sl@0
|
135 |
portable code.
|
sl@0
|
136 |
@param aServer
|
sl@0
|
137 |
Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.
|
sl@0
|
138 |
|
sl@0
|
139 |
@return A pointer to the new audio player utility object.
|
sl@0
|
140 |
|
sl@0
|
141 |
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
|
sl@0
|
142 |
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
|
sl@0
|
143 |
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
|
sl@0
|
144 |
Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
|
sl@0
|
145 |
vary between different phones. Portable applications are advised not to assume any specific behaviour.
|
sl@0
|
146 |
*/
|
sl@0
|
147 |
EXPORT_C CMdaAudioPlayerUtility* CMdaAudioPlayerUtility::NewDesPlayerL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
CMdaAudioPlayerUtility* self = new(ELeave) CMdaAudioPlayerUtility();
|
sl@0
|
150 |
CleanupStack::PushL(self);
|
sl@0
|
151 |
self->iProperties = CMMFMdaAudioPlayerUtility::NewDesPlayerL(aData, aCallback, aPriority, aPref);
|
sl@0
|
152 |
CleanupStack::Pop(self);
|
sl@0
|
153 |
return self;
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
/**
|
sl@0
|
157 |
Constructs and initialises a new instance of the audio player utility for playing sampled audio data
|
sl@0
|
158 |
from a read only descriptor.
|
sl@0
|
159 |
|
sl@0
|
160 |
The audio data must be in a supported format (e.g. WAV and AU).
|
sl@0
|
161 |
|
sl@0
|
162 |
The function leaves if the audio player utility object cannot be created. When initialisation of
|
sl@0
|
163 |
the audio player utility is complete, successfully or otherwise, the callback function
|
sl@0
|
164 |
MMdaAudioPlayerCallback::MapcInitComplete() is called.
|
sl@0
|
165 |
|
sl@0
|
166 |
@param aData
|
sl@0
|
167 |
A read only descriptor containing the audio data. This descriptor must remain in existence
|
sl@0
|
168 |
for the lifetime of this audio player utility object.
|
sl@0
|
169 |
@param aCallback
|
sl@0
|
170 |
The audio player observer interface.
|
sl@0
|
171 |
@param aPriority
|
sl@0
|
172 |
The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
|
sl@0
|
173 |
EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
|
sl@0
|
174 |
@param aPref
|
sl@0
|
175 |
The Priority Preference - an additional audio policy parameter. The suggested default is
|
sl@0
|
176 |
EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
|
sl@0
|
177 |
values may be supported by given phones and/or platforms, but should not be depended upon by
|
sl@0
|
178 |
portable code.
|
sl@0
|
179 |
@param aServer
|
sl@0
|
180 |
Not used in 7.0s. This parameter is provided for binary compatibility with previous versions.
|
sl@0
|
181 |
|
sl@0
|
182 |
@return A pointer to a new audio player utility.
|
sl@0
|
183 |
|
sl@0
|
184 |
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
|
sl@0
|
185 |
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
|
sl@0
|
186 |
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
|
sl@0
|
187 |
Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
|
sl@0
|
188 |
vary between different phones. Portable applications are advised not to assume any specific behaviour.
|
sl@0
|
189 |
*/
|
sl@0
|
190 |
EXPORT_C CMdaAudioPlayerUtility* CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
CMdaAudioPlayerUtility* self = new(ELeave) CMdaAudioPlayerUtility();
|
sl@0
|
193 |
CleanupStack::PushL(self);
|
sl@0
|
194 |
self->iProperties = CMMFMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(aData, aCallback, aPriority, aPref);
|
sl@0
|
195 |
CleanupStack::Pop(self);
|
sl@0
|
196 |
return self;
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
CMdaAudioPlayerUtility::CMdaAudioPlayerUtility()
|
sl@0
|
200 |
{
|
sl@0
|
201 |
}
|
sl@0
|
202 |
|
sl@0
|
203 |
/**
|
sl@0
|
204 |
Destructor.
|
sl@0
|
205 |
|
sl@0
|
206 |
Frees all resources owned by the object prior to its destruction.
|
sl@0
|
207 |
*/
|
sl@0
|
208 |
CMdaAudioPlayerUtility::~CMdaAudioPlayerUtility()
|
sl@0
|
209 |
{
|
sl@0
|
210 |
delete iProperties;
|
sl@0
|
211 |
}
|
sl@0
|
212 |
|
sl@0
|
213 |
/**
|
sl@0
|
214 |
Ensures that any subsequent calls to OpenXYZ() will create controllers that
|
sl@0
|
215 |
share a heap.
|
sl@0
|
216 |
|
sl@0
|
217 |
The default behaviour is that for each player utility a controller with its own heap
|
sl@0
|
218 |
is created. Each heap uses a chunk, so using this function avoids situations where
|
sl@0
|
219 |
the number of chunks per process is limited.
|
sl@0
|
220 |
The default behaviour is generally to be preferred, and should give lower overall
|
sl@0
|
221 |
memory usage. However, if many controllers are to be created for a particular thread,
|
sl@0
|
222 |
then this function should be used to prevent running out of heaps or chunks.
|
sl@0
|
223 |
|
sl@0
|
224 |
@since 9.1
|
sl@0
|
225 |
*/
|
sl@0
|
226 |
EXPORT_C void CMdaAudioPlayerUtility::UseSharedHeap()
|
sl@0
|
227 |
{
|
sl@0
|
228 |
ASSERT(iProperties);
|
sl@0
|
229 |
iProperties->UseSharedHeap();
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
// 5.0 functions
|
sl@0
|
233 |
|
sl@0
|
234 |
/**
|
sl@0
|
235 |
Begins playback of audio sample data at the current playback position using the current volume,
|
sl@0
|
236 |
gain and priority settings.
|
sl@0
|
237 |
|
sl@0
|
238 |
When playing of the audio sample is complete, successfully or
|
sl@0
|
239 |
otherwise, the callback function
|
sl@0
|
240 |
MMdaAudioPlayerCallback::MapcPlayComplete() is
|
sl@0
|
241 |
called.
|
sl@0
|
242 |
|
sl@0
|
243 |
If this function is called whilst already playing then
|
sl@0
|
244 |
MMdaAudioPlayerCallback::MapcPlayComplete will return with the
|
sl@0
|
245 |
error code KErrNotReady.
|
sl@0
|
246 |
|
sl@0
|
247 |
@since 5.0
|
sl@0
|
248 |
*/
|
sl@0
|
249 |
void CMdaAudioPlayerUtility::Play()
|
sl@0
|
250 |
{
|
sl@0
|
251 |
ASSERT(iProperties);
|
sl@0
|
252 |
iProperties->Play();
|
sl@0
|
253 |
}
|
sl@0
|
254 |
|
sl@0
|
255 |
/**
|
sl@0
|
256 |
Stops playback of the audio sample as soon as possible.
|
sl@0
|
257 |
|
sl@0
|
258 |
If the audio sample is playing, playback is stopped as soon as
|
sl@0
|
259 |
possible. If playback is already complete, nothing further happens as
|
sl@0
|
260 |
a result of calling this function. The callback function
|
sl@0
|
261 |
MMdaAudioPlayerCallback::MapcPlayComplete() is not
|
sl@0
|
262 |
called.
|
sl@0
|
263 |
|
sl@0
|
264 |
@since 5.0
|
sl@0
|
265 |
*/
|
sl@0
|
266 |
void CMdaAudioPlayerUtility::Stop()
|
sl@0
|
267 |
{
|
sl@0
|
268 |
ASSERT(iProperties);
|
sl@0
|
269 |
iProperties->Stop();
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
|
sl@0
|
273 |
/**
|
sl@0
|
274 |
Changes the current playback volume to a specified value.
|
sl@0
|
275 |
|
sl@0
|
276 |
The volume can be changed before or during playback and is effective
|
sl@0
|
277 |
immediately. The volume can be set to any value between zero (mute) and
|
sl@0
|
278 |
the maximum permissible volume (determined using MaxVolume()).
|
sl@0
|
279 |
|
sl@0
|
280 |
@param aVolume
|
sl@0
|
281 |
The volume setting. This can be any value from zero to
|
sl@0
|
282 |
the value returned by a call to
|
sl@0
|
283 |
CMdaAudioPlayerUtility::MaxVolume().
|
sl@0
|
284 |
Setting a zero value mutes the sound. Setting the maximum
|
sl@0
|
285 |
value results in the loudest possible sound. Values less
|
sl@0
|
286 |
than zero would be set to zero and the values greater than
|
sl@0
|
287 |
the maximum permitted volume would be set to the maximum volume.
|
sl@0
|
288 |
@return An error code indicating if the function call was successful. KErrNone on success,
|
sl@0
|
289 |
otherwise another of the system-wide error codes.
|
sl@0
|
290 |
@panic EMMFMediaClientBadArgument is raised when the audio player utility is not initialised.
|
sl@0
|
291 |
|
sl@0
|
292 |
@since 5.0
|
sl@0
|
293 |
*/
|
sl@0
|
294 |
TInt CMdaAudioPlayerUtility::SetVolume(TInt aVolume)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
ASSERT(iProperties);
|
sl@0
|
297 |
return iProperties->SetVolume(aVolume);
|
sl@0
|
298 |
}
|
sl@0
|
299 |
|
sl@0
|
300 |
/**
|
sl@0
|
301 |
Sets the number of times the audio sample is to be repeated during the
|
sl@0
|
302 |
playback operation.
|
sl@0
|
303 |
|
sl@0
|
304 |
A period of silence can follow each playing of the sample. The audio
|
sl@0
|
305 |
sample can be repeated indefinitely.
|
sl@0
|
306 |
|
sl@0
|
307 |
@param aRepeatNumberOfTimes
|
sl@0
|
308 |
The number of times the audio sample, together with
|
sl@0
|
309 |
the trailing silence, is to be repeated. If this is
|
sl@0
|
310 |
set to KMdaRepeatForever, then the audio
|
sl@0
|
311 |
sample, together with the trailing silence, is
|
sl@0
|
312 |
repeated indefinitely or until Stop() is
|
sl@0
|
313 |
called. If this is set to zero, then the audio sample
|
sl@0
|
314 |
is not repeated.
|
sl@0
|
315 |
@param aTrailingSilence
|
sl@0
|
316 |
The time interval of the trailing silence in microseconds.
|
sl@0
|
317 |
|
sl@0
|
318 |
@since 5.0
|
sl@0
|
319 |
*/
|
sl@0
|
320 |
void CMdaAudioPlayerUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
ASSERT(iProperties);
|
sl@0
|
323 |
iProperties->SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
/**
|
sl@0
|
327 |
Defines the period over which the volume level is to rise smoothly
|
sl@0
|
328 |
from nothing to the normal volume level.
|
sl@0
|
329 |
|
sl@0
|
330 |
@param aRampDuration
|
sl@0
|
331 |
The period over which the volume is to rise. A zero
|
sl@0
|
332 |
value causes the audio sample to be played at the
|
sl@0
|
333 |
normal level for the full duration of the playback. A
|
sl@0
|
334 |
value which is longer than the duration of the audio
|
sl@0
|
335 |
sample means that the sample never reaches its normal
|
sl@0
|
336 |
volume level.
|
sl@0
|
337 |
|
sl@0
|
338 |
@since 5.0
|
sl@0
|
339 |
*/
|
sl@0
|
340 |
void CMdaAudioPlayerUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
341 |
{
|
sl@0
|
342 |
ASSERT(iProperties);
|
sl@0
|
343 |
iProperties->SetVolumeRamp(aRampDuration);
|
sl@0
|
344 |
}
|
sl@0
|
345 |
|
sl@0
|
346 |
/**
|
sl@0
|
347 |
Returns the duration of the audio sample in microseconds.
|
sl@0
|
348 |
|
sl@0
|
349 |
@return The duration of the sample in microseconds.
|
sl@0
|
350 |
|
sl@0
|
351 |
@since 5.0
|
sl@0
|
352 |
*/
|
sl@0
|
353 |
const TTimeIntervalMicroSeconds& CMdaAudioPlayerUtility::Duration()
|
sl@0
|
354 |
{
|
sl@0
|
355 |
ASSERT(iProperties);
|
sl@0
|
356 |
return iProperties->Duration();
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
/**
|
sl@0
|
360 |
Returns the duration of the audio sample in microseconds, and the duration state.
|
sl@0
|
361 |
|
sl@0
|
362 |
@param aDuration
|
sl@0
|
363 |
The duration of the sample in microseconds.
|
sl@0
|
364 |
@return The duration state
|
sl@0
|
365 |
|
sl@0
|
366 |
@since 9.1
|
sl@0
|
367 |
*/
|
sl@0
|
368 |
EXPORT_C TMMFDurationInfo CMdaAudioPlayerUtility::Duration(TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
ASSERT(iProperties);
|
sl@0
|
371 |
return iProperties->Duration(aDuration);
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
/**
|
sl@0
|
375 |
Returns an integer representing the maximum volume.
|
sl@0
|
376 |
|
sl@0
|
377 |
This is the maximum value which can be passed to
|
sl@0
|
378 |
CMdaAudioPlayerUtility::SetVolume(). This value is platform
|
sl@0
|
379 |
independent, but is always greater than or equal to one.
|
sl@0
|
380 |
|
sl@0
|
381 |
@return The maximum volume setting.
|
sl@0
|
382 |
@panic EMMFMediaClientPanicServerCommunicationProblem is raised when the audio player utility is not initialised.
|
sl@0
|
383 |
|
sl@0
|
384 |
@since 5.0
|
sl@0
|
385 |
*/
|
sl@0
|
386 |
TInt CMdaAudioPlayerUtility::MaxVolume()
|
sl@0
|
387 |
{
|
sl@0
|
388 |
ASSERT(iProperties);
|
sl@0
|
389 |
return iProperties->MaxVolume();
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
// 7.0s functions
|
sl@0
|
393 |
|
sl@0
|
394 |
/**
|
sl@0
|
395 |
Opens an audio clip from a file.
|
sl@0
|
396 |
|
sl@0
|
397 |
The audio data must be in a supported format (for example, WAV or AU).
|
sl@0
|
398 |
|
sl@0
|
399 |
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
|
sl@0
|
400 |
|
sl@0
|
401 |
@param aFileName
|
sl@0
|
402 |
The file to open.
|
sl@0
|
403 |
@leave KErrNotReady
|
sl@0
|
404 |
If a previous open statement is awaiting notification of completion.
|
sl@0
|
405 |
opening the file
|
sl@0
|
406 |
@since 7.0s
|
sl@0
|
407 |
*/
|
sl@0
|
408 |
EXPORT_C void CMdaAudioPlayerUtility::OpenFileL(const TDesC& aFileName)
|
sl@0
|
409 |
{
|
sl@0
|
410 |
ASSERT(iProperties);
|
sl@0
|
411 |
iProperties->OpenFileL(aFileName);
|
sl@0
|
412 |
}
|
sl@0
|
413 |
|
sl@0
|
414 |
/**
|
sl@0
|
415 |
Opens an audio clip from a file.
|
sl@0
|
416 |
|
sl@0
|
417 |
The audio data must be in a supported format (for example, WAV or AU).
|
sl@0
|
418 |
|
sl@0
|
419 |
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
|
sl@0
|
420 |
|
sl@0
|
421 |
Note: it is generally advisable that the RFile is shared through the call RFs::ShareProtected().
|
sl@0
|
422 |
This allows the adaptation to pass it to another process, if that is required. This is particularly
|
sl@0
|
423 |
true of playing DRM encrypted files.
|
sl@0
|
424 |
|
sl@0
|
425 |
@param aFile
|
sl@0
|
426 |
The open shared session file handle to use
|
sl@0
|
427 |
@leave KErrBadHandle
|
sl@0
|
428 |
If the file handle is not shared through the call RFs::ShareProtected(), and the adaptation needs it to be.
|
sl@0
|
429 |
@leave KErrNotReady
|
sl@0
|
430 |
If a previous open statement is awaiting notification of completion.
|
sl@0
|
431 |
opening the file
|
sl@0
|
432 |
*/
|
sl@0
|
433 |
EXPORT_C void CMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
|
sl@0
|
434 |
{
|
sl@0
|
435 |
ASSERT(iProperties);
|
sl@0
|
436 |
RFile& file = const_cast<RFile&>(aFile);
|
sl@0
|
437 |
TMMFileHandleSource tfs(file, KDefaultContentObject, EPlay);
|
sl@0
|
438 |
iProperties->OpenFileL(tfs);
|
sl@0
|
439 |
}
|
sl@0
|
440 |
|
sl@0
|
441 |
/**
|
sl@0
|
442 |
Opens an audio clip from a file.
|
sl@0
|
443 |
|
sl@0
|
444 |
The audio data must be in a supported format (for example, WAV or AU).
|
sl@0
|
445 |
|
sl@0
|
446 |
This function leaves with KErrNotReady if there is a previous open statement awaiting notification of completion.
|
sl@0
|
447 |
|
sl@0
|
448 |
@param aSource
|
sl@0
|
449 |
The file to open or an open file handle to use
|
sl@0
|
450 |
@leave KErrNotReady
|
sl@0
|
451 |
If a previous open statement is awaiting notification of completion.
|
sl@0
|
452 |
opening the file
|
sl@0
|
453 |
*/
|
sl@0
|
454 |
EXPORT_C void CMdaAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
ASSERT(iProperties);
|
sl@0
|
457 |
iProperties->OpenFileL(aSource);
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
/**
|
sl@0
|
461 |
Opens an audio clip from a descriptor.
|
sl@0
|
462 |
|
sl@0
|
463 |
The audio data must be in a supported format (for example, WAV or AU).
|
sl@0
|
464 |
|
sl@0
|
465 |
@param aDescriptor
|
sl@0
|
466 |
A descriptor containing the audio clip.
|
sl@0
|
467 |
@leave KErrInUse
|
sl@0
|
468 |
If a previous open statement is awaiting notification of completion.
|
sl@0
|
469 |
|
sl@0
|
470 |
@since 7.0s
|
sl@0
|
471 |
*/
|
sl@0
|
472 |
EXPORT_C void CMdaAudioPlayerUtility::OpenDesL(const TDesC8& aDescriptor)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
ASSERT(iProperties);
|
sl@0
|
475 |
iProperties->OpenDesL(aDescriptor);
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
/**
|
sl@0
|
479 |
Opens an audio clip from a URL.
|
sl@0
|
480 |
|
sl@0
|
481 |
The audio data must be in a supported format (for example, WAV or AU).
|
sl@0
|
482 |
|
sl@0
|
483 |
@param aUrl
|
sl@0
|
484 |
The URL to open.
|
sl@0
|
485 |
@param aIapId
|
sl@0
|
486 |
Internet access point(IAP) ID to use. KUseDefaultIap selects the default IAP.
|
sl@0
|
487 |
@param aMimeType
|
sl@0
|
488 |
MIME type of the URL source.
|
sl@0
|
489 |
|
sl@0
|
490 |
@leave KErrInUse
|
sl@0
|
491 |
If a previous open statement is awaiting notification of completion.
|
sl@0
|
492 |
|
sl@0
|
493 |
@since 7.0s
|
sl@0
|
494 |
*/
|
sl@0
|
495 |
EXPORT_C void CMdaAudioPlayerUtility::OpenUrlL(const TDesC& aUrl, const TInt aIapId /*=KUseDefaultIap*/, const TDesC8& aMimeType /*=KNullDesC8*/)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
ASSERT(iProperties);
|
sl@0
|
498 |
iProperties->OpenUrlL(aUrl, aIapId, aMimeType);
|
sl@0
|
499 |
}
|
sl@0
|
500 |
|
sl@0
|
501 |
/**
|
sl@0
|
502 |
Pauses the playback of the audio clip.
|
sl@0
|
503 |
|
sl@0
|
504 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
505 |
another of the system-wide error codes.
|
sl@0
|
506 |
|
sl@0
|
507 |
@since 7.0s
|
sl@0
|
508 |
*/
|
sl@0
|
509 |
EXPORT_C TInt CMdaAudioPlayerUtility::Pause()
|
sl@0
|
510 |
{
|
sl@0
|
511 |
ASSERT(iProperties);
|
sl@0
|
512 |
return iProperties->Pause();
|
sl@0
|
513 |
}
|
sl@0
|
514 |
|
sl@0
|
515 |
/**
|
sl@0
|
516 |
Closes the current audio clip (allowing another clip to be opened).
|
sl@0
|
517 |
|
sl@0
|
518 |
@since 7.0s
|
sl@0
|
519 |
*/
|
sl@0
|
520 |
EXPORT_C void CMdaAudioPlayerUtility::Close()
|
sl@0
|
521 |
{
|
sl@0
|
522 |
ASSERT(iProperties);
|
sl@0
|
523 |
iProperties->Close();
|
sl@0
|
524 |
}
|
sl@0
|
525 |
|
sl@0
|
526 |
/**
|
sl@0
|
527 |
Returns the current playback position in microseconds from the start of the clip.
|
sl@0
|
528 |
|
sl@0
|
529 |
@param aPosition
|
sl@0
|
530 |
The current time position in microseconds from the start of the clip to the current
|
sl@0
|
531 |
play position.
|
sl@0
|
532 |
|
sl@0
|
533 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
534 |
another of the system-wide error codes.
|
sl@0
|
535 |
|
sl@0
|
536 |
@since 7.0s
|
sl@0
|
537 |
*/
|
sl@0
|
538 |
EXPORT_C TInt CMdaAudioPlayerUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
539 |
{
|
sl@0
|
540 |
ASSERT(iProperties);
|
sl@0
|
541 |
return iProperties->GetPosition(aPosition);
|
sl@0
|
542 |
}
|
sl@0
|
543 |
|
sl@0
|
544 |
/**
|
sl@0
|
545 |
Sets the current playback position in microseconds from the start of the clip.
|
sl@0
|
546 |
|
sl@0
|
547 |
@param aPosition
|
sl@0
|
548 |
The position to move to in microseconds from the start of the clip.
|
sl@0
|
549 |
|
sl@0
|
550 |
@since 7.0s
|
sl@0
|
551 |
*/
|
sl@0
|
552 |
EXPORT_C void CMdaAudioPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
553 |
{
|
sl@0
|
554 |
ASSERT(iProperties);
|
sl@0
|
555 |
iProperties->SetPosition(aPosition);
|
sl@0
|
556 |
}
|
sl@0
|
557 |
|
sl@0
|
558 |
/**
|
sl@0
|
559 |
Sets the priority for playback. This is used to arbitrate between multiple
|
sl@0
|
560 |
objects trying to access a single sound device.
|
sl@0
|
561 |
|
sl@0
|
562 |
@param aPriority
|
sl@0
|
563 |
The Priority Value.
|
sl@0
|
564 |
@param aPref
|
sl@0
|
565 |
The Priority Preference.
|
sl@0
|
566 |
|
sl@0
|
567 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
568 |
another of the system-wide error codes.
|
sl@0
|
569 |
|
sl@0
|
570 |
@since 7.0s
|
sl@0
|
571 |
|
sl@0
|
572 |
@see CMdaAudioPlayerUtility::NewL()
|
sl@0
|
573 |
|
sl@0
|
574 |
*/
|
sl@0
|
575 |
EXPORT_C TInt CMdaAudioPlayerUtility::SetPriority(TInt aPriority, TInt aPref)
|
sl@0
|
576 |
{
|
sl@0
|
577 |
ASSERT(iProperties);
|
sl@0
|
578 |
return iProperties->SetPriority(aPriority, aPref);
|
sl@0
|
579 |
}
|
sl@0
|
580 |
|
sl@0
|
581 |
/**
|
sl@0
|
582 |
Returns the current playback volume.
|
sl@0
|
583 |
|
sl@0
|
584 |
@param aVolume
|
sl@0
|
585 |
A value between 0 and the maximum volume settings returned by MaxVolume().
|
sl@0
|
586 |
|
sl@0
|
587 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
588 |
another of the system-wide error codes.
|
sl@0
|
589 |
|
sl@0
|
590 |
@since 7.0s
|
sl@0
|
591 |
*/
|
sl@0
|
592 |
EXPORT_C TInt CMdaAudioPlayerUtility::GetVolume(TInt& aVolume)
|
sl@0
|
593 |
{
|
sl@0
|
594 |
ASSERT(iProperties);
|
sl@0
|
595 |
return iProperties->GetVolume(aVolume);
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
/**
|
sl@0
|
599 |
Returns the number of meta data entries in the current audio clip.
|
sl@0
|
600 |
|
sl@0
|
601 |
@param aNumEntries
|
sl@0
|
602 |
The number of meta data entries in the header of the current clip.
|
sl@0
|
603 |
|
sl@0
|
604 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
605 |
another of the system-wide error codes.
|
sl@0
|
606 |
|
sl@0
|
607 |
@since 7.0s
|
sl@0
|
608 |
*/
|
sl@0
|
609 |
EXPORT_C TInt CMdaAudioPlayerUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
ASSERT(iProperties);
|
sl@0
|
612 |
return iProperties->GetNumberOfMetaDataEntries(aNumEntries);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
|
sl@0
|
615 |
/**
|
sl@0
|
616 |
Returns the requested meta data entry.
|
sl@0
|
617 |
|
sl@0
|
618 |
@param aMetaDataIndex
|
sl@0
|
619 |
The index number of the meta data to retrieve.
|
sl@0
|
620 |
|
sl@0
|
621 |
@return The requested meta data entry.
|
sl@0
|
622 |
@leave KErrNotFound
|
sl@0
|
623 |
The meta data entry does not exist.
|
sl@0
|
624 |
@leave KErrNotImplemented
|
sl@0
|
625 |
The controller does not support meta data information for this format.
|
sl@0
|
626 |
|
sl@0
|
627 |
@since 7.0s
|
sl@0
|
628 |
*/
|
sl@0
|
629 |
EXPORT_C CMMFMetaDataEntry* CMdaAudioPlayerUtility::GetMetaDataEntryL(TInt aMetaDataIndex)
|
sl@0
|
630 |
{
|
sl@0
|
631 |
ASSERT(iProperties);
|
sl@0
|
632 |
return iProperties->GetMetaDataEntryL(aMetaDataIndex);
|
sl@0
|
633 |
}
|
sl@0
|
634 |
|
sl@0
|
635 |
/**
|
sl@0
|
636 |
Defines a window on the audio sample data.
|
sl@0
|
637 |
|
sl@0
|
638 |
The window is defined in terms of a start and end position.
|
sl@0
|
639 |
When the current playback position reaches the window end position, or Stop() is called, the
|
sl@0
|
640 |
current playback position is set to the window start position and playback stops.
|
sl@0
|
641 |
|
sl@0
|
642 |
The current playback position is not affected by a call to SetPlayWindow() unless it is outside
|
sl@0
|
643 |
the new playback window, in which case it is set to the window start or end position depending
|
sl@0
|
644 |
on which one is closer.
|
sl@0
|
645 |
|
sl@0
|
646 |
The window persists until ClearPlayWindow() is called.
|
sl@0
|
647 |
Loading new audio sample data without adjusting or clearing the window will result in
|
sl@0
|
648 |
playback errors if the window is outside the new data.
|
sl@0
|
649 |
|
sl@0
|
650 |
@param aStart
|
sl@0
|
651 |
The position defining the start of the window, measured in microseconds. If this value is less
|
sl@0
|
652 |
than zero, it is set to zero. If this value is greater than aEnd, then it is swapped with aEnd.
|
sl@0
|
653 |
@param aEnd
|
sl@0
|
654 |
The position defining the end of the window, measured in microseconds. If this value is greater
|
sl@0
|
655 |
than the value returned by Duration(), it is set to the value of Duration(). If this value is
|
sl@0
|
656 |
less than aStart, then it is swapped with aStart.
|
sl@0
|
657 |
|
sl@0
|
658 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
659 |
another of the system-wide error codes.
|
sl@0
|
660 |
|
sl@0
|
661 |
@since 7.0s
|
sl@0
|
662 |
*/
|
sl@0
|
663 |
EXPORT_C TInt CMdaAudioPlayerUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aStart,
|
sl@0
|
664 |
const TTimeIntervalMicroSeconds& aEnd)
|
sl@0
|
665 |
{
|
sl@0
|
666 |
ASSERT(iProperties);
|
sl@0
|
667 |
return iProperties->SetPlayWindow(aStart, aEnd);
|
sl@0
|
668 |
}
|
sl@0
|
669 |
|
sl@0
|
670 |
/**
|
sl@0
|
671 |
Clears the current playback window.
|
sl@0
|
672 |
|
sl@0
|
673 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
674 |
another of the system-wide error codes.
|
sl@0
|
675 |
|
sl@0
|
676 |
@since 7.0s
|
sl@0
|
677 |
*/
|
sl@0
|
678 |
EXPORT_C TInt CMdaAudioPlayerUtility::ClearPlayWindow()
|
sl@0
|
679 |
{
|
sl@0
|
680 |
ASSERT(iProperties);
|
sl@0
|
681 |
return iProperties->ClearPlayWindow();
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
/**
|
sl@0
|
685 |
Sets the current playback balance.
|
sl@0
|
686 |
|
sl@0
|
687 |
@param aBalance
|
sl@0
|
688 |
A value between KMMFBalanceMaxLeft
|
sl@0
|
689 |
and KMMFBalanceMaxRight. The default value is
|
sl@0
|
690 |
KMMFBalanceCenter.
|
sl@0
|
691 |
|
sl@0
|
692 |
@return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
693 |
another of the system-wide error codes.
|
sl@0
|
694 |
|
sl@0
|
695 |
@since 7.0s
|
sl@0
|
696 |
*/
|
sl@0
|
697 |
EXPORT_C TInt CMdaAudioPlayerUtility::SetBalance(TInt aBalance /*= KMMFBalanceCenter*/)
|
sl@0
|
698 |
{
|
sl@0
|
699 |
ASSERT(iProperties);
|
sl@0
|
700 |
return iProperties->SetBalance(aBalance);
|
sl@0
|
701 |
}
|
sl@0
|
702 |
|
sl@0
|
703 |
/**
|
sl@0
|
704 |
* Returns The current playback balance. This function may not return the same value
|
sl@0
|
705 |
* as passed to SetBalance depending on the internal implementation in
|
sl@0
|
706 |
* the underlying components.
|
sl@0
|
707 |
*
|
sl@0
|
708 |
* @param aBalance
|
sl@0
|
709 |
* A value between KMMFBalanceMaxLeft
|
sl@0
|
710 |
* and KMMFBalanceMaxRight.
|
sl@0
|
711 |
*
|
sl@0
|
712 |
* @return An error code indicating if the function call was successful. KErrNone on success, otherwise
|
sl@0
|
713 |
* another of the system-wide error codes.
|
sl@0
|
714 |
*
|
sl@0
|
715 |
* @since 7.0s
|
sl@0
|
716 |
*/
|
sl@0
|
717 |
EXPORT_C TInt CMdaAudioPlayerUtility::GetBalance(TInt& aBalance)
|
sl@0
|
718 |
{
|
sl@0
|
719 |
ASSERT(iProperties);
|
sl@0
|
720 |
return iProperties->GetBalance(aBalance);
|
sl@0
|
721 |
}
|
sl@0
|
722 |
|
sl@0
|
723 |
/**
|
sl@0
|
724 |
Returns the controller implementation information associated with the current controller.
|
sl@0
|
725 |
|
sl@0
|
726 |
@return The controller implementation structure
|
sl@0
|
727 |
|
sl@0
|
728 |
@since 7.0s
|
sl@0
|
729 |
*/
|
sl@0
|
730 |
EXPORT_C const CMMFControllerImplementationInformation& CMdaAudioPlayerUtility::ControllerImplementationInformationL()
|
sl@0
|
731 |
{
|
sl@0
|
732 |
ASSERT(iProperties);
|
sl@0
|
733 |
return iProperties->ControllerImplementationInformationL();
|
sl@0
|
734 |
}
|
sl@0
|
735 |
|
sl@0
|
736 |
/**
|
sl@0
|
737 |
Registers callback object to receive notifications of audio loading/rebuffering.
|
sl@0
|
738 |
|
sl@0
|
739 |
@param aCallback
|
sl@0
|
740 |
The object to receive audio loading notifications.
|
sl@0
|
741 |
|
sl@0
|
742 |
@since 7.0s
|
sl@0
|
743 |
*/
|
sl@0
|
744 |
EXPORT_C void CMdaAudioPlayerUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback)
|
sl@0
|
745 |
{
|
sl@0
|
746 |
ASSERT(iProperties);
|
sl@0
|
747 |
iProperties->RegisterForAudioLoadingNotification(aCallback);
|
sl@0
|
748 |
}
|
sl@0
|
749 |
|
sl@0
|
750 |
/**
|
sl@0
|
751 |
Returns the current progress of audio loading.
|
sl@0
|
752 |
|
sl@0
|
753 |
@param aPercentageProgress
|
sl@0
|
754 |
The percentage of the audio clip loaded.
|
sl@0
|
755 |
|
sl@0
|
756 |
@since 7.0s
|
sl@0
|
757 |
*/
|
sl@0
|
758 |
EXPORT_C void CMdaAudioPlayerUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress)
|
sl@0
|
759 |
{
|
sl@0
|
760 |
ASSERT(iProperties);
|
sl@0
|
761 |
iProperties->GetAudioLoadingProgressL(aPercentageProgress);
|
sl@0
|
762 |
}
|
sl@0
|
763 |
|
sl@0
|
764 |
/**
|
sl@0
|
765 |
Sends a synchronous custom command to the controller.
|
sl@0
|
766 |
|
sl@0
|
767 |
@param aDestination
|
sl@0
|
768 |
The destination of the message, consisting of the UID of
|
sl@0
|
769 |
the interface of this message.
|
sl@0
|
770 |
@param aFunction
|
sl@0
|
771 |
The function number to indicate which function is to be called
|
sl@0
|
772 |
on the interface defined in the aDestination parameter.
|
sl@0
|
773 |
@param aDataTo1
|
sl@0
|
774 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
775 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
776 |
interface being called. Can be KNullDesC8.
|
sl@0
|
777 |
@param aDataTo2
|
sl@0
|
778 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
779 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
780 |
interface being called. Can be KNullDesC8.
|
sl@0
|
781 |
@param aDataFrom
|
sl@0
|
782 |
A reference to an area of memory to which the controller framework will
|
sl@0
|
783 |
write any data to be passed back to the client. Can't be KNullDesC8.
|
sl@0
|
784 |
|
sl@0
|
785 |
@return The result of the request. Exact range of values is dependent on the interface.
|
sl@0
|
786 |
|
sl@0
|
787 |
@since 7.0s
|
sl@0
|
788 |
*/
|
sl@0
|
789 |
EXPORT_C TInt CMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
|
sl@0
|
790 |
{
|
sl@0
|
791 |
ASSERT(iProperties);
|
sl@0
|
792 |
return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
|
sl@0
|
793 |
}
|
sl@0
|
794 |
|
sl@0
|
795 |
/**
|
sl@0
|
796 |
Sends a synchronous custom command to the controller.
|
sl@0
|
797 |
|
sl@0
|
798 |
@param aDestination
|
sl@0
|
799 |
The destination of the message, consisting of the UID of
|
sl@0
|
800 |
the interface of this message.
|
sl@0
|
801 |
@param aFunction
|
sl@0
|
802 |
The function number to indicate which function is to be called
|
sl@0
|
803 |
on the interface defined in the aDestination parameter.
|
sl@0
|
804 |
@param aDataTo1
|
sl@0
|
805 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
806 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
807 |
interface being called. Can be KNullDesC8.
|
sl@0
|
808 |
@param aDataTo2
|
sl@0
|
809 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
810 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
811 |
interface being called. Can be KNullDesC8.
|
sl@0
|
812 |
|
sl@0
|
813 |
@return The result of the request. Exact range of values is dependent on the interface.
|
sl@0
|
814 |
|
sl@0
|
815 |
@since 7.0s
|
sl@0
|
816 |
*/
|
sl@0
|
817 |
EXPORT_C TInt CMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
|
sl@0
|
818 |
{
|
sl@0
|
819 |
ASSERT(iProperties);
|
sl@0
|
820 |
return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
|
sl@0
|
821 |
}
|
sl@0
|
822 |
|
sl@0
|
823 |
/**
|
sl@0
|
824 |
Sends an asynchronous custom command to the controller.
|
sl@0
|
825 |
|
sl@0
|
826 |
Note:
|
sl@0
|
827 |
This method will return immediately. The RunL of the active object owning the
|
sl@0
|
828 |
aStatus parameter will be called when the command is completed by the
|
sl@0
|
829 |
controller framework.
|
sl@0
|
830 |
|
sl@0
|
831 |
@param aDestination
|
sl@0
|
832 |
The destination of the message, consisting of the uid of
|
sl@0
|
833 |
the interface of this message.
|
sl@0
|
834 |
@param aFunction
|
sl@0
|
835 |
The function number to indicate which function is to be called
|
sl@0
|
836 |
on the interface defined in the aDestination parameter.
|
sl@0
|
837 |
@param aDataTo1
|
sl@0
|
838 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
839 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
840 |
interface being called. Can be KNullDesC8.
|
sl@0
|
841 |
@param aDataTo2
|
sl@0
|
842 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
843 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
844 |
interface being called. Can be KNullDesC8.
|
sl@0
|
845 |
@param aDataFrom
|
sl@0
|
846 |
A reference to an area of memory to which the controller framework will
|
sl@0
|
847 |
write any data to be passed back to the client. Can't be KNullDesC8."
|
sl@0
|
848 |
@param aStatus
|
sl@0
|
849 |
The TRequestStatus of an active object. This will contain the
|
sl@0
|
850 |
result of the request on completion. The exact range of
|
sl@0
|
851 |
result values is dependent on the interface.
|
sl@0
|
852 |
|
sl@0
|
853 |
@since 7.0s
|
sl@0
|
854 |
*/
|
sl@0
|
855 |
EXPORT_C void CMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
|
sl@0
|
856 |
{
|
sl@0
|
857 |
ASSERT(iProperties);
|
sl@0
|
858 |
iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
|
sl@0
|
859 |
}
|
sl@0
|
860 |
|
sl@0
|
861 |
/**
|
sl@0
|
862 |
Sends an asynchronous custom command to the controller.
|
sl@0
|
863 |
|
sl@0
|
864 |
Note:
|
sl@0
|
865 |
This method will return immediately. The RunL of the active object owning the
|
sl@0
|
866 |
aStatus parameter will be called when the command is completed by the
|
sl@0
|
867 |
controller framework.
|
sl@0
|
868 |
|
sl@0
|
869 |
@param aDestination
|
sl@0
|
870 |
The destination of the message, consisting of the uid of
|
sl@0
|
871 |
the interface of this message.
|
sl@0
|
872 |
@param aFunction
|
sl@0
|
873 |
The function number to indicate which function is to be called
|
sl@0
|
874 |
on the interface defined in the aDestination parameter.
|
sl@0
|
875 |
@param aDataTo1
|
sl@0
|
876 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
877 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
878 |
interface being called. Can be KNullDesC8.
|
sl@0
|
879 |
@param aDataTo2
|
sl@0
|
880 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
881 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
882 |
interface being called. Can be KNullDesC8.
|
sl@0
|
883 |
@param aStatus
|
sl@0
|
884 |
The TRequestStatus of an active object. This will contain the
|
sl@0
|
885 |
result of the request on completion. The exact range of
|
sl@0
|
886 |
result values is dependent on the interface.
|
sl@0
|
887 |
|
sl@0
|
888 |
@since 7.0s
|
sl@0
|
889 |
*/
|
sl@0
|
890 |
EXPORT_C void CMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
|
sl@0
|
891 |
{
|
sl@0
|
892 |
ASSERT(iProperties);
|
sl@0
|
893 |
iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
|
sl@0
|
894 |
}
|
sl@0
|
895 |
|
sl@0
|
896 |
/**
|
sl@0
|
897 |
Returns the bit rate of the audio clip.
|
sl@0
|
898 |
|
sl@0
|
899 |
@param aBitRate
|
sl@0
|
900 |
The bit rate of the audio clip
|
sl@0
|
901 |
|
sl@0
|
902 |
@return An error code indicating if the function call was successful. KErrNone on success,
|
sl@0
|
903 |
otherwise another of the system-wide error codes.
|
sl@0
|
904 |
|
sl@0
|
905 |
@since 7.0s
|
sl@0
|
906 |
*/
|
sl@0
|
907 |
EXPORT_C TInt CMdaAudioPlayerUtility::GetBitRate(TUint& aBitRate)
|
sl@0
|
908 |
{
|
sl@0
|
909 |
ASSERT(iProperties);
|
sl@0
|
910 |
return iProperties->GetBitRate(aBitRate);
|
sl@0
|
911 |
}
|
sl@0
|
912 |
|
sl@0
|
913 |
/**
|
sl@0
|
914 |
Gets a controller's DRM custom command implementation.
|
sl@0
|
915 |
|
sl@0
|
916 |
@return A pointer to a controller's DRM custom command implementation, or NULL if the
|
sl@0
|
917 |
controller does not support it.
|
sl@0
|
918 |
*/
|
sl@0
|
919 |
EXPORT_C MMMFDRMCustomCommand* CMdaAudioPlayerUtility::GetDRMCustomCommand()
|
sl@0
|
920 |
{
|
sl@0
|
921 |
ASSERT(iProperties);
|
sl@0
|
922 |
return iProperties->GetDRMCustomCommand();
|
sl@0
|
923 |
}
|
sl@0
|
924 |
|
sl@0
|
925 |
/**
|
sl@0
|
926 |
Registers the Event for Notification when resource is avaliable.
|
sl@0
|
927 |
|
sl@0
|
928 |
@param aCallback
|
sl@0
|
929 |
The audio outputstream observer interface..
|
sl@0
|
930 |
|
sl@0
|
931 |
@param aNotificationEventUid
|
sl@0
|
932 |
The Event for which the client is registered.
|
sl@0
|
933 |
|
sl@0
|
934 |
@param aNotificationRegistrationData
|
sl@0
|
935 |
Notification registration specific data.
|
sl@0
|
936 |
|
sl@0
|
937 |
@return An error code indicating if the registration was successful. KErrNone on success,
|
sl@0
|
938 |
otherwise another of the system-wide error codes.
|
sl@0
|
939 |
*/
|
sl@0
|
940 |
EXPORT_C TInt CMdaAudioPlayerUtility::RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,TUid aNotificationEventUid,const TDesC8& aNotificationRegistrationData)
|
sl@0
|
941 |
{
|
sl@0
|
942 |
ASSERT(iProperties);
|
sl@0
|
943 |
return iProperties->RegisterAudioResourceNotification(aCallback,aNotificationEventUid,aNotificationRegistrationData);
|
sl@0
|
944 |
}
|
sl@0
|
945 |
|
sl@0
|
946 |
/**
|
sl@0
|
947 |
Cancels the registered notification event.
|
sl@0
|
948 |
|
sl@0
|
949 |
@param aNotificationEventUid
|
sl@0
|
950 |
The Event to notify the client.
|
sl@0
|
951 |
|
sl@0
|
952 |
@return An error code indicating if the registration was successful. KErrNone on success,
|
sl@0
|
953 |
otherwise another of the system-wide error codes.
|
sl@0
|
954 |
*/
|
sl@0
|
955 |
EXPORT_C TInt CMdaAudioPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventUid)
|
sl@0
|
956 |
{
|
sl@0
|
957 |
ASSERT(iProperties);
|
sl@0
|
958 |
return iProperties->CancelRegisterAudioResourceNotification(aNotificationEventUid);
|
sl@0
|
959 |
}
|
sl@0
|
960 |
|
sl@0
|
961 |
/**
|
sl@0
|
962 |
Waits for the client to resume the play even after the default timer expires.
|
sl@0
|
963 |
|
sl@0
|
964 |
@return An error code indicating if the registration was successful. KErrNone on success,
|
sl@0
|
965 |
otherwise another of the system-wide error codes.
|
sl@0
|
966 |
*/
|
sl@0
|
967 |
EXPORT_C TInt CMdaAudioPlayerUtility::WillResumePlay()
|
sl@0
|
968 |
{
|
sl@0
|
969 |
ASSERT(iProperties);
|
sl@0
|
970 |
return iProperties->WillResumePlay();
|
sl@0
|
971 |
}
|
sl@0
|
972 |
|
sl@0
|
973 |
|
sl@0
|
974 |
/**
|
sl@0
|
975 |
Set the priority of the controller's sub thread.
|
sl@0
|
976 |
|
sl@0
|
977 |
This can be used to increase the responsiveness of the audio plugin to minimise
|
sl@0
|
978 |
any lag in processing. This function should be used with care as it may have knock-on
|
sl@0
|
979 |
effects elsewhere in the system.
|
sl@0
|
980 |
|
sl@0
|
981 |
@param aPriority
|
sl@0
|
982 |
The TThreadPriority that the thread should run under. The default is EPriorityNormal.
|
sl@0
|
983 |
@return TInt
|
sl@0
|
984 |
A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a
|
sl@0
|
985 |
valid handle.
|
sl@0
|
986 |
*/
|
sl@0
|
987 |
EXPORT_C TInt CMdaAudioPlayerUtility::SetThreadPriority(const TThreadPriority& aPriority) const
|
sl@0
|
988 |
{
|
sl@0
|
989 |
ASSERT(iProperties);
|
sl@0
|
990 |
return iProperties->SetThreadPriority(aPriority);
|
sl@0
|
991 |
}
|
sl@0
|
992 |
|
sl@0
|
993 |
|
sl@0
|
994 |
|
sl@0
|
995 |
|
sl@0
|
996 |
CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewL(MMdaAudioPlayerCallback& aCallback,
|
sl@0
|
997 |
TInt aPriority,
|
sl@0
|
998 |
TInt aPref)
|
sl@0
|
999 |
{
|
sl@0
|
1000 |
CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
|
sl@0
|
1001 |
CleanupStack::PushL(self);
|
sl@0
|
1002 |
self->ConstructL();
|
sl@0
|
1003 |
CleanupStack::Pop(self);
|
sl@0
|
1004 |
return self;
|
sl@0
|
1005 |
}
|
sl@0
|
1006 |
|
sl@0
|
1007 |
CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewFilePlayerL(const TDesC& aFileName,
|
sl@0
|
1008 |
MMdaAudioPlayerCallback& aCallback,
|
sl@0
|
1009 |
TInt aPriority,
|
sl@0
|
1010 |
TInt aPref,
|
sl@0
|
1011 |
CMdaServer* /*aServer*/)
|
sl@0
|
1012 |
{
|
sl@0
|
1013 |
CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
|
sl@0
|
1014 |
CleanupStack::PushL(self);
|
sl@0
|
1015 |
self->ConstructL();
|
sl@0
|
1016 |
TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
|
sl@0
|
1017 |
self->OpenFileL(filesource);
|
sl@0
|
1018 |
CleanupStack::Pop(self);
|
sl@0
|
1019 |
return self;
|
sl@0
|
1020 |
}
|
sl@0
|
1021 |
|
sl@0
|
1022 |
CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewDesPlayerL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
|
sl@0
|
1023 |
{
|
sl@0
|
1024 |
CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
|
sl@0
|
1025 |
CleanupStack::PushL(self);
|
sl@0
|
1026 |
self->ConstructL();
|
sl@0
|
1027 |
self->OpenDesL(aData);
|
sl@0
|
1028 |
CleanupStack::Pop(self);
|
sl@0
|
1029 |
return self;
|
sl@0
|
1030 |
}
|
sl@0
|
1031 |
|
sl@0
|
1032 |
CMMFMdaAudioPlayerUtility* CMMFMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(const TDesC8& aData, MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref, CMdaServer* /*aServer*/)
|
sl@0
|
1033 |
{
|
sl@0
|
1034 |
CMMFMdaAudioPlayerUtility* self = new(ELeave) CMMFMdaAudioPlayerUtility(aCallback, aPriority, aPref);
|
sl@0
|
1035 |
CleanupStack::PushL(self);
|
sl@0
|
1036 |
self->ConstructL();
|
sl@0
|
1037 |
self->OpenDesL(aData);
|
sl@0
|
1038 |
CleanupStack::Pop(self);
|
sl@0
|
1039 |
return self;
|
sl@0
|
1040 |
}
|
sl@0
|
1041 |
|
sl@0
|
1042 |
void CMMFMdaAudioPlayerUtility::UseSharedHeap()
|
sl@0
|
1043 |
{
|
sl@0
|
1044 |
iFindAndOpenController->UseSharedHeap();
|
sl@0
|
1045 |
}
|
sl@0
|
1046 |
|
sl@0
|
1047 |
// CMMFMdaAudioPlayerUtility
|
sl@0
|
1048 |
CMMFMdaAudioPlayerUtility::~CMMFMdaAudioPlayerUtility()
|
sl@0
|
1049 |
{
|
sl@0
|
1050 |
|
sl@0
|
1051 |
delete iControllerImplementationInformation;
|
sl@0
|
1052 |
delete iAsyncCallBack;
|
sl@0
|
1053 |
delete iRepeatTrailingSilenceTimer;
|
sl@0
|
1054 |
delete iFindAndOpenController;
|
sl@0
|
1055 |
delete iControllerEventMonitor;
|
sl@0
|
1056 |
iMediaIds.Close();
|
sl@0
|
1057 |
iController.Close();
|
sl@0
|
1058 |
}
|
sl@0
|
1059 |
|
sl@0
|
1060 |
CMMFMdaAudioPlayerUtility::CMMFMdaAudioPlayerUtility(MMdaAudioPlayerCallback& aCallback, TInt aPriority, TInt aPref) :
|
sl@0
|
1061 |
iCallback(aCallback),
|
sl@0
|
1062 |
iAudioPlayDeviceCommands(iController),
|
sl@0
|
1063 |
iAudioPlayControllerCommands(iController),
|
sl@0
|
1064 |
iNotificationRegistrationCommands(iController),
|
sl@0
|
1065 |
iDRMCustomCommands(iController),
|
sl@0
|
1066 |
iAudioPlayControllerSetRepeatsCommands(iController)
|
sl@0
|
1067 |
{
|
sl@0
|
1068 |
iState = EStopped;
|
sl@0
|
1069 |
iPrioritySettings.iPriority = aPriority;
|
sl@0
|
1070 |
iPrioritySettings.iPref = aPref;
|
sl@0
|
1071 |
iPlayStart = TTimeIntervalMicroSeconds(0);
|
sl@0
|
1072 |
iPlayEnd = TTimeIntervalMicroSeconds(0);
|
sl@0
|
1073 |
iPlayWindowSet = ENone;
|
sl@0
|
1074 |
iEventHolder = KNullUid;
|
sl@0
|
1075 |
}
|
sl@0
|
1076 |
|
sl@0
|
1077 |
void CMMFMdaAudioPlayerUtility::ConstructL()
|
sl@0
|
1078 |
{
|
sl@0
|
1079 |
iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
|
sl@0
|
1080 |
iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this);
|
sl@0
|
1081 |
iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback);
|
sl@0
|
1082 |
User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
|
sl@0
|
1083 |
iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
|
sl@0
|
1084 |
iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
|
sl@0
|
1085 |
iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback);
|
sl@0
|
1086 |
}
|
sl@0
|
1087 |
|
sl@0
|
1088 |
void CMMFMdaAudioPlayerUtility::MfaocComplete(
|
sl@0
|
1089 |
TInt& aError,
|
sl@0
|
1090 |
RMMFController* /*aController*/,
|
sl@0
|
1091 |
TUid aControllerUid,
|
sl@0
|
1092 |
TMMFMessageDestination* /*aSourceHandle*/,
|
sl@0
|
1093 |
TMMFMessageDestination* /*aSinkHandle*/)
|
sl@0
|
1094 |
{
|
sl@0
|
1095 |
if (aError == KErrNone)
|
sl@0
|
1096 |
{
|
sl@0
|
1097 |
iControllerUid = aControllerUid;
|
sl@0
|
1098 |
|
sl@0
|
1099 |
// Get the clip duration
|
sl@0
|
1100 |
iDuration = TTimeIntervalMicroSeconds(0);
|
sl@0
|
1101 |
aError = iController.GetDuration(iDuration);
|
sl@0
|
1102 |
|
sl@0
|
1103 |
// If an error occurred during GetDuration, may try for next controller, if present.
|
sl@0
|
1104 |
if (aError != KErrNone)
|
sl@0
|
1105 |
{
|
sl@0
|
1106 |
iControllerEventMonitor->Cancel();
|
sl@0
|
1107 |
|
sl@0
|
1108 |
if (iFindAndOpenController)
|
sl@0
|
1109 |
{
|
sl@0
|
1110 |
if(iFindAndOpenController-> ControllerIndex() < (iFindAndOpenController->ControllerCount())-1)
|
sl@0
|
1111 |
{
|
sl@0
|
1112 |
return; //actually tries to load next controllers, if there are other controllers selected in the controller list
|
sl@0
|
1113 |
}
|
sl@0
|
1114 |
}
|
sl@0
|
1115 |
|
sl@0
|
1116 |
iController.Close(); // otherwise close the controller
|
sl@0
|
1117 |
}
|
sl@0
|
1118 |
|
sl@0
|
1119 |
if (iFindAndOpenController)
|
sl@0
|
1120 |
{
|
sl@0
|
1121 |
iFindAndOpenController->Close();
|
sl@0
|
1122 |
}
|
sl@0
|
1123 |
}
|
sl@0
|
1124 |
|
sl@0
|
1125 |
iAsyncCallBack->InitComplete(aError, iDuration);
|
sl@0
|
1126 |
}
|
sl@0
|
1127 |
|
sl@0
|
1128 |
/**
|
sl@0
|
1129 |
Open an audio clip from a file
|
sl@0
|
1130 |
@param "const TFileSource& aFileSource" "the file to open"
|
sl@0
|
1131 |
@leave "" "Leaves on an error opening the file
|
sl@0
|
1132 |
@since version 5.0
|
sl@0
|
1133 |
*/
|
sl@0
|
1134 |
void CMMFMdaAudioPlayerUtility::OpenFileL(const TDesC& aFileName)
|
sl@0
|
1135 |
{
|
sl@0
|
1136 |
TMMFileSource filesource(aFileName, KDefaultContentObject, EPlay);
|
sl@0
|
1137 |
OpenFileL(filesource);
|
sl@0
|
1138 |
}
|
sl@0
|
1139 |
|
sl@0
|
1140 |
/**
|
sl@0
|
1141 |
Open an audio clip from a file
|
sl@0
|
1142 |
@param "const RFile& aFile" "the shared session file handle to open"
|
sl@0
|
1143 |
@leave "" "KErrBadHandle if the file handle is not shared through the call RFs::ShareProtected(), and the underlying CAF layer needs it to be.
|
sl@0
|
1144 |
@leave "" "Leaves on an error opening the file
|
sl@0
|
1145 |
@since version 5.0
|
sl@0
|
1146 |
*/
|
sl@0
|
1147 |
void CMMFMdaAudioPlayerUtility::OpenFileL(const RFile& aFile)
|
sl@0
|
1148 |
{
|
sl@0
|
1149 |
RFile& file = const_cast<RFile&>(aFile);
|
sl@0
|
1150 |
TMMFileHandleSource filesource(file, KDefaultContentObject, EPlay);
|
sl@0
|
1151 |
OpenFileL(filesource);
|
sl@0
|
1152 |
}
|
sl@0
|
1153 |
|
sl@0
|
1154 |
void CMMFMdaAudioPlayerUtility::OpenFileL(const TMMSource& aSource)
|
sl@0
|
1155 |
{
|
sl@0
|
1156 |
// If iAsyncCallBack is already active, we're still in the process of notifying the client
|
sl@0
|
1157 |
// that a previous request to Open...(...) has completed.
|
sl@0
|
1158 |
if (iAsyncCallBack->IsActive())
|
sl@0
|
1159 |
User::Leave(KErrNotReady);
|
sl@0
|
1160 |
|
sl@0
|
1161 |
if (aSource.SourceType()==KUidMMFileHandleSource)
|
sl@0
|
1162 |
{
|
sl@0
|
1163 |
RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle();
|
sl@0
|
1164 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1165 |
TMMFileHandleSource(fileHandle, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
|
sl@0
|
1166 |
CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
|
sl@0
|
1167 |
|
sl@0
|
1168 |
}
|
sl@0
|
1169 |
if (aSource.SourceType()==KUidMMFileSource)
|
sl@0
|
1170 |
{
|
sl@0
|
1171 |
const TDesC& fileName = static_cast<const TMMFileSource&>(aSource).Name();
|
sl@0
|
1172 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1173 |
TMMFileSource(fileName, aSource.UniqueId(), aSource.Intent(), aSource.IsUIEnabled()),
|
sl@0
|
1174 |
CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
|
sl@0
|
1175 |
}
|
sl@0
|
1176 |
|
sl@0
|
1177 |
iFindAndOpenController->OpenByFileSource(aSource);
|
sl@0
|
1178 |
}
|
sl@0
|
1179 |
|
sl@0
|
1180 |
/**
|
sl@0
|
1181 |
Open an audio clip from a descriptor
|
sl@0
|
1182 |
@param "const TDesC8& aDescriptor" "the descriptor containing the clip"
|
sl@0
|
1183 |
@leave "" "Leaves on an error opening the descriptor"
|
sl@0
|
1184 |
@since version 5.0
|
sl@0
|
1185 |
*/
|
sl@0
|
1186 |
void CMMFMdaAudioPlayerUtility::OpenDesL(const TDesC8& aDescriptor)
|
sl@0
|
1187 |
{
|
sl@0
|
1188 |
// If iAsyncCallBack is already active, we're still in the process of notifying the client
|
sl@0
|
1189 |
// that a previous request to Open...(...) has completed.
|
sl@0
|
1190 |
if (iAsyncCallBack->IsActive())
|
sl@0
|
1191 |
User::Leave(KErrInUse);
|
sl@0
|
1192 |
|
sl@0
|
1193 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1194 |
CMMFFindAndOpenController::TSourceSink(KUidMmfDescriptorSource,
|
sl@0
|
1195 |
CMMFFindAndOpenController::GetConfigDescriptor(aDescriptor)),
|
sl@0
|
1196 |
CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
|
sl@0
|
1197 |
iFindAndOpenController->OpenByDescriptor(aDescriptor);
|
sl@0
|
1198 |
}
|
sl@0
|
1199 |
|
sl@0
|
1200 |
/**
|
sl@0
|
1201 |
Open an audio clip from a Url
|
sl@0
|
1202 |
@param "const TDesC& aUrl" "the url reference to the clip"
|
sl@0
|
1203 |
@leave "" "Leaves on an error opening the url"
|
sl@0
|
1204 |
@since version 7.0s
|
sl@0
|
1205 |
*/
|
sl@0
|
1206 |
void CMMFMdaAudioPlayerUtility::OpenUrlL(const TDesC& aUrl, const TInt aIapId, const TDesC8& aMimeType)
|
sl@0
|
1207 |
{
|
sl@0
|
1208 |
// If iAsyncCallBack is already active, we're still in the process of notifying the client
|
sl@0
|
1209 |
// that a previous request to Open...(...) has completed.
|
sl@0
|
1210 |
if (iAsyncCallBack->IsActive())
|
sl@0
|
1211 |
User::Leave(KErrInUse);
|
sl@0
|
1212 |
|
sl@0
|
1213 |
CBufFlat* urlCfgBuffer = NULL;
|
sl@0
|
1214 |
CMMFFindAndOpenController::GetConfigUrlL(urlCfgBuffer, aUrl, aIapId);
|
sl@0
|
1215 |
|
sl@0
|
1216 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1217 |
CMMFFindAndOpenController::TSourceSink(KUidMmfUrlSource, urlCfgBuffer->Ptr(0)),
|
sl@0
|
1218 |
CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput));
|
sl@0
|
1219 |
iFindAndOpenController->OpenByUrl(aUrl, aIapId, aMimeType);
|
sl@0
|
1220 |
delete urlCfgBuffer;
|
sl@0
|
1221 |
}
|
sl@0
|
1222 |
|
sl@0
|
1223 |
/**
|
sl@0
|
1224 |
Begins playback of the initialised audio sample at the current volume
|
sl@0
|
1225 |
and priority levels.
|
sl@0
|
1226 |
|
sl@0
|
1227 |
When playing of the audio sample is complete, successfully or
|
sl@0
|
1228 |
otherwise, the callback function
|
sl@0
|
1229 |
MMdaAudioPlayerCallback::MapcPlayComplete() is
|
sl@0
|
1230 |
called.
|
sl@0
|
1231 |
|
sl@0
|
1232 |
If this function is called whilst already playing then
|
sl@0
|
1233 |
MMdaAudioPlayerCallback::MapcPlayComplete will return with the
|
sl@0
|
1234 |
error code KErrNotReady.
|
sl@0
|
1235 |
|
sl@0
|
1236 |
@since 5.0
|
sl@0
|
1237 |
*/
|
sl@0
|
1238 |
void CMMFMdaAudioPlayerUtility::Play()
|
sl@0
|
1239 |
{
|
sl@0
|
1240 |
// if we're already playing, call the client's callback with KErrNotReady.
|
sl@0
|
1241 |
// This is what the controller would do if we allowed the Play()
|
sl@0
|
1242 |
// to propagate down. Need to do it here too (for consistency)
|
sl@0
|
1243 |
// in case we're in a trailing silence period.
|
sl@0
|
1244 |
if (iState == EPlaying)
|
sl@0
|
1245 |
{
|
sl@0
|
1246 |
iAsyncCallBack->PlayComplete(KErrNotReady);
|
sl@0
|
1247 |
return;
|
sl@0
|
1248 |
}
|
sl@0
|
1249 |
|
sl@0
|
1250 |
// cancel the repeat timer in case the client has called Play()
|
sl@0
|
1251 |
// without waiting for the previous play to complete
|
sl@0
|
1252 |
iRepeatTrailingSilenceTimer->Cancel();
|
sl@0
|
1253 |
// Reset played count
|
sl@0
|
1254 |
if(iState != EPaused)
|
sl@0
|
1255 |
{
|
sl@0
|
1256 |
iNumberOfTimesPlayed = 0;
|
sl@0
|
1257 |
if(iNumberOfTimesToRepeat>0 || iNumberOfTimesToRepeat == KMdaRepeatForever)
|
sl@0
|
1258 |
{
|
sl@0
|
1259 |
TInt err = iAudioPlayControllerSetRepeatsCommands.SetRepeats(iNumberOfTimesToRepeat, iTrailingSilence);
|
sl@0
|
1260 |
if(err==KErrNone)
|
sl@0
|
1261 |
{
|
sl@0
|
1262 |
iNumberOfTimesToRepeat = 0;
|
sl@0
|
1263 |
iTrailingSilence = 0;
|
sl@0
|
1264 |
}
|
sl@0
|
1265 |
//Controller not supporting setrepeats custom command is not a real error
|
sl@0
|
1266 |
//we revert back to playerutility's loop play implementation in that case
|
sl@0
|
1267 |
}
|
sl@0
|
1268 |
}
|
sl@0
|
1269 |
|
sl@0
|
1270 |
DoPlay();
|
sl@0
|
1271 |
}
|
sl@0
|
1272 |
|
sl@0
|
1273 |
void CMMFMdaAudioPlayerUtility::DoPlay()
|
sl@0
|
1274 |
{
|
sl@0
|
1275 |
#if defined(__AUDIO_PROFILING)
|
sl@0
|
1276 |
RDebug::ProfileStart(4);
|
sl@0
|
1277 |
#endif // defined(__AUDIO_PROFILING)
|
sl@0
|
1278 |
TInt err = KErrNone;
|
sl@0
|
1279 |
if (iState != EPaused || iRepeatCancelled)
|
sl@0
|
1280 |
{
|
sl@0
|
1281 |
err = iController.Prime();
|
sl@0
|
1282 |
iRepeatCancelled = EFalse;
|
sl@0
|
1283 |
|
sl@0
|
1284 |
#if defined(__AUDIO_PROFILING)
|
sl@0
|
1285 |
RDebug::ProfileEnd(4);
|
sl@0
|
1286 |
#endif // defined(__AUDIO_PROFILING)
|
sl@0
|
1287 |
|
sl@0
|
1288 |
// make sure we don't set the position outside the play window -
|
sl@0
|
1289 |
// but allow it to remain unchanged if it's within the window
|
sl@0
|
1290 |
if (iPlayWindowSet == ESet &&
|
sl@0
|
1291 |
(iPosition < iPlayStart || iPosition >= iPlayEnd))
|
sl@0
|
1292 |
iPosition = iPlayStart;
|
sl@0
|
1293 |
|
sl@0
|
1294 |
if (err==KErrNone)
|
sl@0
|
1295 |
err = iController.SetPosition(iPosition);
|
sl@0
|
1296 |
}
|
sl@0
|
1297 |
|
sl@0
|
1298 |
if (err==KErrNone)
|
sl@0
|
1299 |
{
|
sl@0
|
1300 |
if (iPlayWindowSet == ESet)
|
sl@0
|
1301 |
err = iAudioPlayControllerCommands.SetPlaybackWindow(iPlayStart, iPlayEnd);
|
sl@0
|
1302 |
else if (iPlayWindowSet == EClear)
|
sl@0
|
1303 |
{
|
sl@0
|
1304 |
err = iAudioPlayControllerCommands.DeletePlaybackWindow();
|
sl@0
|
1305 |
iPlayWindowSet = ENone; // assume window will stay cleared
|
sl@0
|
1306 |
}
|
sl@0
|
1307 |
}
|
sl@0
|
1308 |
|
sl@0
|
1309 |
if (err==KErrNone)
|
sl@0
|
1310 |
{
|
sl@0
|
1311 |
#if defined(__AUDIO_PROFILING)
|
sl@0
|
1312 |
RDebug::ProfileStart(5);
|
sl@0
|
1313 |
#endif // defined(__AUDIO_PROFILING)
|
sl@0
|
1314 |
|
sl@0
|
1315 |
err = iController.Play();
|
sl@0
|
1316 |
|
sl@0
|
1317 |
#if defined(__AUDIO_PROFILING)
|
sl@0
|
1318 |
RDebug::ProfileEnd(5);
|
sl@0
|
1319 |
#endif // defined(__AUDIO_PROFILING)
|
sl@0
|
1320 |
}
|
sl@0
|
1321 |
|
sl@0
|
1322 |
if (err!=KErrNone)
|
sl@0
|
1323 |
iAsyncCallBack->PlayComplete(err);
|
sl@0
|
1324 |
else
|
sl@0
|
1325 |
iState = EPlaying;
|
sl@0
|
1326 |
|
sl@0
|
1327 |
if(iEventHolder != KNullUid)
|
sl@0
|
1328 |
{
|
sl@0
|
1329 |
err = iNotificationRegistrationCommands.RegisterAsClient(iEventHolder,iNotificationDataHolder);
|
sl@0
|
1330 |
iEventHolder = KNullUid;
|
sl@0
|
1331 |
iNotificationDataHolder = KNullDesC8;
|
sl@0
|
1332 |
if(err == KErrNotSupported)
|
sl@0
|
1333 |
{
|
sl@0
|
1334 |
return;
|
sl@0
|
1335 |
}
|
sl@0
|
1336 |
if(err != KErrNone)
|
sl@0
|
1337 |
{
|
sl@0
|
1338 |
iController.Stop();
|
sl@0
|
1339 |
iAsyncCallBack->PlayComplete(err);
|
sl@0
|
1340 |
}
|
sl@0
|
1341 |
}
|
sl@0
|
1342 |
}
|
sl@0
|
1343 |
|
sl@0
|
1344 |
/**
|
sl@0
|
1345 |
Stops playback of the audio sample as soon as possible.
|
sl@0
|
1346 |
|
sl@0
|
1347 |
If the audio sample is playing, playback is stopped as soon as
|
sl@0
|
1348 |
possible. If playback is already complete, nothing further happens as
|
sl@0
|
1349 |
a result of calling this function. The callback function
|
sl@0
|
1350 |
MMdaAudioPlayerCallback::MapcPlayComplete() is not
|
sl@0
|
1351 |
called.
|
sl@0
|
1352 |
|
sl@0
|
1353 |
@since 5.0
|
sl@0
|
1354 |
*/
|
sl@0
|
1355 |
void CMMFMdaAudioPlayerUtility::Stop()
|
sl@0
|
1356 |
{
|
sl@0
|
1357 |
|
sl@0
|
1358 |
if (iState==EStopped)
|
sl@0
|
1359 |
{
|
sl@0
|
1360 |
// resetting the position to the start.
|
sl@0
|
1361 |
//if any position change in stoped state
|
sl@0
|
1362 |
iPosition = iPlayStart;
|
sl@0
|
1363 |
return;
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
|
sl@0
|
1366 |
if (iState==EPlaying || iState==EPaused)
|
sl@0
|
1367 |
{
|
sl@0
|
1368 |
// cancel the repeat timer in case the client has called Stop()
|
sl@0
|
1369 |
// during the trailing silence period
|
sl@0
|
1370 |
iRepeatTrailingSilenceTimer->Cancel();
|
sl@0
|
1371 |
|
sl@0
|
1372 |
iController.Stop();
|
sl@0
|
1373 |
iPosition = iPlayStart;
|
sl@0
|
1374 |
iState = EStopped;
|
sl@0
|
1375 |
}
|
sl@0
|
1376 |
|
sl@0
|
1377 |
}
|
sl@0
|
1378 |
|
sl@0
|
1379 |
/**
|
sl@0
|
1380 |
*
|
sl@0
|
1381 |
* Pauses playback of the audio clip
|
sl@0
|
1382 |
* @return One of the system-wide error codes
|
sl@0
|
1383 |
* @since 7.0s
|
sl@0
|
1384 |
*/
|
sl@0
|
1385 |
TInt CMMFMdaAudioPlayerUtility::Pause()
|
sl@0
|
1386 |
{
|
sl@0
|
1387 |
TInt err = KErrNone;
|
sl@0
|
1388 |
if(iRepeatTrailingSilenceTimer->IsActive())
|
sl@0
|
1389 |
{
|
sl@0
|
1390 |
iRepeatTrailingSilenceTimer->Cancel();
|
sl@0
|
1391 |
iRepeatCancelled = ETrue;
|
sl@0
|
1392 |
iState = EPaused;
|
sl@0
|
1393 |
return KErrNone;
|
sl@0
|
1394 |
}
|
sl@0
|
1395 |
if (iState==EPlaying)
|
sl@0
|
1396 |
{
|
sl@0
|
1397 |
err = iController.Pause();
|
sl@0
|
1398 |
if (!err || err==KErrNotReady)
|
sl@0
|
1399 |
err = iController.GetPosition(iPosition);
|
sl@0
|
1400 |
iState = EPaused;
|
sl@0
|
1401 |
}
|
sl@0
|
1402 |
return err;
|
sl@0
|
1403 |
}
|
sl@0
|
1404 |
|
sl@0
|
1405 |
/**
|
sl@0
|
1406 |
*
|
sl@0
|
1407 |
* Closes the current audio clip (allowing another clip to be opened)
|
sl@0
|
1408 |
*
|
sl@0
|
1409 |
* @since 7.0s
|
sl@0
|
1410 |
*/
|
sl@0
|
1411 |
void CMMFMdaAudioPlayerUtility::Close()
|
sl@0
|
1412 |
{
|
sl@0
|
1413 |
// Reset the audio player state.
|
sl@0
|
1414 |
Stop();
|
sl@0
|
1415 |
iControllerEventMonitor->Cancel();
|
sl@0
|
1416 |
iController.Close();
|
sl@0
|
1417 |
if (iFindAndOpenController)
|
sl@0
|
1418 |
iFindAndOpenController->Close();
|
sl@0
|
1419 |
if(iControllerImplementationInformation)
|
sl@0
|
1420 |
{
|
sl@0
|
1421 |
delete iControllerImplementationInformation;
|
sl@0
|
1422 |
iControllerImplementationInformation = NULL;
|
sl@0
|
1423 |
}
|
sl@0
|
1424 |
iControllerUid = KNullUid;
|
sl@0
|
1425 |
}
|
sl@0
|
1426 |
|
sl@0
|
1427 |
|
sl@0
|
1428 |
/**
|
sl@0
|
1429 |
Changes the current playback volume to a specified value.
|
sl@0
|
1430 |
|
sl@0
|
1431 |
The volume can be changed before or during playback and is effective
|
sl@0
|
1432 |
immediately.
|
sl@0
|
1433 |
|
sl@0
|
1434 |
@param aVolume
|
sl@0
|
1435 |
The volume setting. This can be any value from zero to
|
sl@0
|
1436 |
the value returned by a call to
|
sl@0
|
1437 |
CMdaAudioPlayerUtility::MaxVolume().
|
sl@0
|
1438 |
Setting a zero value mutes the sound. Setting the
|
sl@0
|
1439 |
maximum value results in the loudest possible sound.
|
sl@0
|
1440 |
@return An error code indicating if the function call was successful. KErrNone on success,
|
sl@0
|
1441 |
otherwise another of the system-wide error codes.
|
sl@0
|
1442 |
@panic EMMFMediaClientBadArgument is raised when the audio player utility is not initialised.
|
sl@0
|
1443 |
|
sl@0
|
1444 |
@since 5.0
|
sl@0
|
1445 |
*/
|
sl@0
|
1446 |
TInt CMMFMdaAudioPlayerUtility::SetVolume(TInt aVolume)
|
sl@0
|
1447 |
{
|
sl@0
|
1448 |
TInt err = iAudioPlayDeviceCommands.SetVolume(aVolume);
|
sl@0
|
1449 |
if (err == KErrArgument)
|
sl@0
|
1450 |
{
|
sl@0
|
1451 |
TInt maxVolume = MaxVolume();
|
sl@0
|
1452 |
if (aVolume < 0)
|
sl@0
|
1453 |
{
|
sl@0
|
1454 |
aVolume = 0;
|
sl@0
|
1455 |
}
|
sl@0
|
1456 |
else if (aVolume > maxVolume)
|
sl@0
|
1457 |
{
|
sl@0
|
1458 |
aVolume = maxVolume;
|
sl@0
|
1459 |
}
|
sl@0
|
1460 |
err = iAudioPlayDeviceCommands.SetVolume(aVolume);
|
sl@0
|
1461 |
}
|
sl@0
|
1462 |
|
sl@0
|
1463 |
return err;
|
sl@0
|
1464 |
}
|
sl@0
|
1465 |
|
sl@0
|
1466 |
/**
|
sl@0
|
1467 |
Sets the number of times the audio sample is to be repeated during the
|
sl@0
|
1468 |
playback operation.
|
sl@0
|
1469 |
|
sl@0
|
1470 |
A period of silence can follow each playing of the sample. The audio
|
sl@0
|
1471 |
sample can be repeated indefinitely.
|
sl@0
|
1472 |
|
sl@0
|
1473 |
@param aRepeatNumberOfTimes
|
sl@0
|
1474 |
The number of times the audio sample, together with
|
sl@0
|
1475 |
the trailing silence, is to be repeated. If this is
|
sl@0
|
1476 |
set to KMdaRepeatForever, then the audio
|
sl@0
|
1477 |
sample, together with the trailing silence, is
|
sl@0
|
1478 |
repeated indefinitely or until Stop() is
|
sl@0
|
1479 |
called. If this is set to zero, then the audio sample
|
sl@0
|
1480 |
is not repeated. The behaviour is undefined for
|
sl@0
|
1481 |
negative values (other than KMdaRepeatForever).
|
sl@0
|
1482 |
@param aTrailingSilence
|
sl@0
|
1483 |
The time interval of the training silence.
|
sl@0
|
1484 |
Negative values will produce a panic USER 87.
|
sl@0
|
1485 |
@since 5.0
|
sl@0
|
1486 |
*/
|
sl@0
|
1487 |
void CMMFMdaAudioPlayerUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
|
sl@0
|
1488 |
{
|
sl@0
|
1489 |
TInt err = iAudioPlayControllerSetRepeatsCommands.SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
|
sl@0
|
1490 |
|
sl@0
|
1491 |
if(err!=KErrNone)
|
sl@0
|
1492 |
{
|
sl@0
|
1493 |
iNumberOfTimesToRepeat = aRepeatNumberOfTimes;
|
sl@0
|
1494 |
iTrailingSilence = aTrailingSilence;
|
sl@0
|
1495 |
}
|
sl@0
|
1496 |
}
|
sl@0
|
1497 |
|
sl@0
|
1498 |
/**
|
sl@0
|
1499 |
Defines the period over which the volume level is to rise smoothly
|
sl@0
|
1500 |
from nothing to the normal volume level.
|
sl@0
|
1501 |
|
sl@0
|
1502 |
@param aRampDuration
|
sl@0
|
1503 |
The period over which the volume is to rise. A zero
|
sl@0
|
1504 |
value causes the audio sample to be played at the
|
sl@0
|
1505 |
normal level for the full duration of the playback. A
|
sl@0
|
1506 |
value which is longer than the duration of the audio
|
sl@0
|
1507 |
sample means that the sample never reaches its normal
|
sl@0
|
1508 |
volume level.
|
sl@0
|
1509 |
|
sl@0
|
1510 |
@since 5.0
|
sl@0
|
1511 |
*/
|
sl@0
|
1512 |
void CMMFMdaAudioPlayerUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
1513 |
{
|
sl@0
|
1514 |
iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration);
|
sl@0
|
1515 |
}
|
sl@0
|
1516 |
|
sl@0
|
1517 |
TInt CMMFMdaAudioPlayerUtility::SetPriority(TInt aPriority, TInt aPref)
|
sl@0
|
1518 |
{
|
sl@0
|
1519 |
iPrioritySettings.iPref = aPref;
|
sl@0
|
1520 |
iPrioritySettings.iPriority = aPriority;
|
sl@0
|
1521 |
iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
|
sl@0
|
1522 |
|
sl@0
|
1523 |
return iController.SetPrioritySettings(iPrioritySettings);
|
sl@0
|
1524 |
}
|
sl@0
|
1525 |
|
sl@0
|
1526 |
/**
|
sl@0
|
1527 |
Returns the duration of the audio sample.
|
sl@0
|
1528 |
|
sl@0
|
1529 |
@return The duration in microseconds.
|
sl@0
|
1530 |
|
sl@0
|
1531 |
@since 5.0
|
sl@0
|
1532 |
*/
|
sl@0
|
1533 |
const TTimeIntervalMicroSeconds& CMMFMdaAudioPlayerUtility::Duration()
|
sl@0
|
1534 |
{
|
sl@0
|
1535 |
TInt err = iController.GetDuration(iDuration);
|
sl@0
|
1536 |
if (err)
|
sl@0
|
1537 |
{
|
sl@0
|
1538 |
iDuration = 0;
|
sl@0
|
1539 |
}
|
sl@0
|
1540 |
return iDuration;
|
sl@0
|
1541 |
}
|
sl@0
|
1542 |
|
sl@0
|
1543 |
/**
|
sl@0
|
1544 |
Returns the duration of the audio sample in microseconds, and the duration state.
|
sl@0
|
1545 |
|
sl@0
|
1546 |
@param aDuration
|
sl@0
|
1547 |
The duration of the sample in microseconds.
|
sl@0
|
1548 |
@return The duration state
|
sl@0
|
1549 |
|
sl@0
|
1550 |
@since 9.1
|
sl@0
|
1551 |
*/
|
sl@0
|
1552 |
TMMFDurationInfo CMMFMdaAudioPlayerUtility::Duration(TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
1553 |
{
|
sl@0
|
1554 |
TPckgBuf<TMMFDurationInfo> pckg;
|
sl@0
|
1555 |
TMMFDurationInfo result = EMMFDurationInfoValid;
|
sl@0
|
1556 |
|
sl@0
|
1557 |
TMMFMessageDestinationPckg iDestinationPckg(TMMFMessageDestination(KUidInterfaceMMFDurationInfoControl, KMMFObjectHandleController));
|
sl@0
|
1558 |
|
sl@0
|
1559 |
TInt err = iController.CustomCommandSync(iDestinationPckg,
|
sl@0
|
1560 |
EMMFGetDurationInfo,
|
sl@0
|
1561 |
KNullDesC8,
|
sl@0
|
1562 |
KNullDesC8,
|
sl@0
|
1563 |
pckg );
|
sl@0
|
1564 |
|
sl@0
|
1565 |
switch ( err )
|
sl@0
|
1566 |
{
|
sl@0
|
1567 |
case KErrNone:
|
sl@0
|
1568 |
result = pckg();
|
sl@0
|
1569 |
break;
|
sl@0
|
1570 |
|
sl@0
|
1571 |
case KErrNotSupported:
|
sl@0
|
1572 |
// Custom command not implemented return EMMFDurationInfoValid as the default value
|
sl@0
|
1573 |
break;
|
sl@0
|
1574 |
|
sl@0
|
1575 |
default:
|
sl@0
|
1576 |
// Unknown error
|
sl@0
|
1577 |
result = EMMFDurationInfoUnknown;
|
sl@0
|
1578 |
break;
|
sl@0
|
1579 |
}
|
sl@0
|
1580 |
|
sl@0
|
1581 |
// Get the duration information to return in aDuration
|
sl@0
|
1582 |
// This is the intended behaviour regardless of what value err has
|
sl@0
|
1583 |
aDuration = Duration();
|
sl@0
|
1584 |
return result;
|
sl@0
|
1585 |
}
|
sl@0
|
1586 |
|
sl@0
|
1587 |
/**
|
sl@0
|
1588 |
Returns an integer representing the maximum volume.
|
sl@0
|
1589 |
|
sl@0
|
1590 |
This is the maximum value which can be passed to
|
sl@0
|
1591 |
CMdaAudioPlayerUtility::SetVolume().
|
sl@0
|
1592 |
|
sl@0
|
1593 |
@return The maximum volume. This value is platform dependent but is always greater than or equal
|
sl@0
|
1594 |
to one.
|
sl@0
|
1595 |
@panic EMMFMediaClientPanicServerCommunicationProblem is raised when the audio player utility is not initialised.
|
sl@0
|
1596 |
|
sl@0
|
1597 |
@since 5.0
|
sl@0
|
1598 |
*/
|
sl@0
|
1599 |
TInt CMMFMdaAudioPlayerUtility::MaxVolume()
|
sl@0
|
1600 |
{
|
sl@0
|
1601 |
TInt maxVolume = 0;
|
sl@0
|
1602 |
#ifdef _DEBUG
|
sl@0
|
1603 |
TInt error =
|
sl@0
|
1604 |
#endif
|
sl@0
|
1605 |
iAudioPlayDeviceCommands.GetMaxVolume(maxVolume);
|
sl@0
|
1606 |
__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
|
sl@0
|
1607 |
return maxVolume;
|
sl@0
|
1608 |
}
|
sl@0
|
1609 |
|
sl@0
|
1610 |
void CMMFMdaAudioPlayerUtility::HandleEvent(const TMMFEvent& aEvent)
|
sl@0
|
1611 |
{
|
sl@0
|
1612 |
// handle loading started/complete messages first, as the later code does not explicitly check the event type
|
sl@0
|
1613 |
if (aEvent.iEventType == KMMFEventCategoryAudioLoadingStarted)
|
sl@0
|
1614 |
{
|
sl@0
|
1615 |
if (iLoadingObserver)
|
sl@0
|
1616 |
{
|
sl@0
|
1617 |
iLoadingObserver->MaloLoadingStarted();
|
sl@0
|
1618 |
}
|
sl@0
|
1619 |
}
|
sl@0
|
1620 |
else if (aEvent.iEventType == KMMFEventCategoryAudioLoadingComplete)
|
sl@0
|
1621 |
{
|
sl@0
|
1622 |
if (iLoadingObserver)
|
sl@0
|
1623 |
{
|
sl@0
|
1624 |
iLoadingObserver->MaloLoadingComplete();
|
sl@0
|
1625 |
}
|
sl@0
|
1626 |
}
|
sl@0
|
1627 |
else if (aEvent.iEventType == KMMFEventCategoryAudioResourceAvailable)
|
sl@0
|
1628 |
{
|
sl@0
|
1629 |
if (iAudioResourceNotificationCallBack != NULL)
|
sl@0
|
1630 |
{
|
sl@0
|
1631 |
TBuf8<TMMFAudioConfig::KNotificationDataBufferSize> notificationData;
|
sl@0
|
1632 |
if (KErrNone != iNotificationRegistrationCommands.GetResourceNotificationData(aEvent.iEventType, notificationData))
|
sl@0
|
1633 |
{
|
sl@0
|
1634 |
notificationData.SetLength(0);
|
sl@0
|
1635 |
}
|
sl@0
|
1636 |
iAudioResourceNotificationCallBack->MarncResourceAvailable(aEvent.iEventType, notificationData);
|
sl@0
|
1637 |
}
|
sl@0
|
1638 |
}
|
sl@0
|
1639 |
else if (aEvent.iEventType == KMMFEventCategoryPlaybackComplete)
|
sl@0
|
1640 |
{
|
sl@0
|
1641 |
TInt oldState = iState;
|
sl@0
|
1642 |
//DevCR KEVN-7T5EHA: In case of pre-emption, we need to get the position from Controller, if that fails we reset the position to keep the original behaviour.
|
sl@0
|
1643 |
if(aEvent.iErrorCode == KErrInUse ||aEvent.iErrorCode == KErrDied ||aEvent.iErrorCode == KErrAccessDenied )
|
sl@0
|
1644 |
{
|
sl@0
|
1645 |
TInt err= iController.GetPosition(iPosition);
|
sl@0
|
1646 |
if(err != KErrNone)
|
sl@0
|
1647 |
{
|
sl@0
|
1648 |
iPosition = iPlayStart;
|
sl@0
|
1649 |
}
|
sl@0
|
1650 |
}
|
sl@0
|
1651 |
else
|
sl@0
|
1652 |
{
|
sl@0
|
1653 |
iPosition = iPlayStart;
|
sl@0
|
1654 |
}
|
sl@0
|
1655 |
if (aEvent.iErrorCode == KErrNone)
|
sl@0
|
1656 |
{
|
sl@0
|
1657 |
//If we weren't playing, ignore the event.
|
sl@0
|
1658 |
if (oldState == EPlaying)
|
sl@0
|
1659 |
{
|
sl@0
|
1660 |
//we finished playing the clip so repeat if required
|
sl@0
|
1661 |
iNumberOfTimesPlayed++;
|
sl@0
|
1662 |
if ((iNumberOfTimesPlayed > iNumberOfTimesToRepeat) && (iNumberOfTimesToRepeat != KMdaRepeatForever))
|
sl@0
|
1663 |
{
|
sl@0
|
1664 |
//we've repeated enough times now
|
sl@0
|
1665 |
iNumberOfTimesPlayed = 0;
|
sl@0
|
1666 |
iState = EStopped;
|
sl@0
|
1667 |
iCallback.MapcPlayComplete(KErrNone);
|
sl@0
|
1668 |
}
|
sl@0
|
1669 |
else
|
sl@0
|
1670 |
{
|
sl@0
|
1671 |
// We need to play silence, then repeat the clip
|
sl@0
|
1672 |
iTrailingSilenceLeftToPlay = iTrailingSilence;
|
sl@0
|
1673 |
PlaySilence();
|
sl@0
|
1674 |
}
|
sl@0
|
1675 |
}
|
sl@0
|
1676 |
}
|
sl@0
|
1677 |
else
|
sl@0
|
1678 |
{ //aEvent.iErrorCode != KErrNone
|
sl@0
|
1679 |
//if we weren't playing, don't advise Client.
|
sl@0
|
1680 |
iState = EStopped;
|
sl@0
|
1681 |
if (oldState == EPlaying)
|
sl@0
|
1682 |
{
|
sl@0
|
1683 |
iCallback.MapcPlayComplete(aEvent.iErrorCode);
|
sl@0
|
1684 |
}
|
sl@0
|
1685 |
}
|
sl@0
|
1686 |
}
|
sl@0
|
1687 |
else if(aEvent.iEventType == KMMFErrorCategoryControllerGeneralError)
|
sl@0
|
1688 |
{
|
sl@0
|
1689 |
TInt oldState = iState;
|
sl@0
|
1690 |
iPosition = iPlayStart;
|
sl@0
|
1691 |
iState = EStopped;
|
sl@0
|
1692 |
if (oldState == EPlaying)
|
sl@0
|
1693 |
{
|
sl@0
|
1694 |
iCallback.MapcPlayComplete(aEvent.iErrorCode);
|
sl@0
|
1695 |
}
|
sl@0
|
1696 |
}
|
sl@0
|
1697 |
// else we have an unexpected event that cannot be dealt with by the client.
|
sl@0
|
1698 |
// We will simply ignore this.
|
sl@0
|
1699 |
}
|
sl@0
|
1700 |
|
sl@0
|
1701 |
void CMMFMdaAudioPlayerUtility::PlaySilence()
|
sl@0
|
1702 |
{
|
sl@0
|
1703 |
// iRepeatTrailingSilenceTimer->After() takes a TTimeIntervalMicroSeconds32
|
sl@0
|
1704 |
// so for longer periods of silence call it repeatedly with KMaxTInt lengths
|
sl@0
|
1705 |
TTimeIntervalMicroSeconds32 silence;
|
sl@0
|
1706 |
if (iTrailingSilenceLeftToPlay.Int64() > KMaxTInt)
|
sl@0
|
1707 |
{
|
sl@0
|
1708 |
silence = KMaxTInt;
|
sl@0
|
1709 |
iTrailingSilenceLeftToPlay = iTrailingSilenceLeftToPlay.Int64() - KMaxTInt;
|
sl@0
|
1710 |
}
|
sl@0
|
1711 |
else
|
sl@0
|
1712 |
{
|
sl@0
|
1713 |
silence = I64INT(iTrailingSilenceLeftToPlay.Int64());
|
sl@0
|
1714 |
iTrailingSilenceLeftToPlay = 0;
|
sl@0
|
1715 |
}
|
sl@0
|
1716 |
iRepeatTrailingSilenceTimer->After(silence);
|
sl@0
|
1717 |
}
|
sl@0
|
1718 |
|
sl@0
|
1719 |
void CMMFMdaAudioPlayerUtility::RepeatTrailingSilenceTimerComplete()
|
sl@0
|
1720 |
{
|
sl@0
|
1721 |
if (iTrailingSilenceLeftToPlay.Int64() > 0)
|
sl@0
|
1722 |
{
|
sl@0
|
1723 |
PlaySilence();
|
sl@0
|
1724 |
}
|
sl@0
|
1725 |
else
|
sl@0
|
1726 |
{
|
sl@0
|
1727 |
// reset the position for subsequent plays
|
sl@0
|
1728 |
iPosition = iPlayStart;
|
sl@0
|
1729 |
DoPlay();
|
sl@0
|
1730 |
}
|
sl@0
|
1731 |
}
|
sl@0
|
1732 |
|
sl@0
|
1733 |
/**
|
sl@0
|
1734 |
*
|
sl@0
|
1735 |
* Returns the current playback position in microseconds
|
sl@0
|
1736 |
*
|
sl@0
|
1737 |
* @param "TTimeIntervalMicroSeconds& aPosition"
|
sl@0
|
1738 |
* The current time position in microseconds from the start of the file
|
sl@0
|
1739 |
* @return "TInt" One of the global error codes
|
sl@0
|
1740 |
*
|
sl@0
|
1741 |
* @since 7.0s
|
sl@0
|
1742 |
*/
|
sl@0
|
1743 |
TInt CMMFMdaAudioPlayerUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
1744 |
{
|
sl@0
|
1745 |
TInt error = KErrNone;
|
sl@0
|
1746 |
if (iState==EPlaying)
|
sl@0
|
1747 |
error = iController.GetPosition(iPosition);
|
sl@0
|
1748 |
aPosition = iPosition;
|
sl@0
|
1749 |
return error;
|
sl@0
|
1750 |
}
|
sl@0
|
1751 |
|
sl@0
|
1752 |
/**
|
sl@0
|
1753 |
*
|
sl@0
|
1754 |
* Set the current playback position in microseconds from the start of the file
|
sl@0
|
1755 |
*
|
sl@0
|
1756 |
* @param "TTimeIntervalMicroSeconds& aPosition"
|
sl@0
|
1757 |
* The position to move to in microseconds from the start of the file.
|
sl@0
|
1758 |
* If aPosition is negative, the position is set to the start of the file.
|
sl@0
|
1759 |
* If aPosition is greater than the file duration, the position is set to the
|
sl@0
|
1760 |
* end of the file.
|
sl@0
|
1761 |
*
|
sl@0
|
1762 |
* @since 7.0s
|
sl@0
|
1763 |
*/
|
sl@0
|
1764 |
void CMMFMdaAudioPlayerUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
1765 |
{
|
sl@0
|
1766 |
// Clip the position if aPosition is greater than the duration
|
sl@0
|
1767 |
// or if aPosition is negative.
|
sl@0
|
1768 |
const TTimeIntervalMicroSeconds maxPosition(Duration());
|
sl@0
|
1769 |
const TTimeIntervalMicroSeconds minPosition(0);
|
sl@0
|
1770 |
|
sl@0
|
1771 |
if (aPosition > maxPosition)
|
sl@0
|
1772 |
iPosition = maxPosition;
|
sl@0
|
1773 |
else if (aPosition < minPosition)
|
sl@0
|
1774 |
iPosition = minPosition;
|
sl@0
|
1775 |
else
|
sl@0
|
1776 |
iPosition = aPosition;
|
sl@0
|
1777 |
|
sl@0
|
1778 |
if (iState==EPlaying || iState==EPaused)
|
sl@0
|
1779 |
{
|
sl@0
|
1780 |
iController.SetPosition(iPosition);
|
sl@0
|
1781 |
}
|
sl@0
|
1782 |
// else if (iState == EPaused)
|
sl@0
|
1783 |
// {
|
sl@0
|
1784 |
// Stop(); // We call stop so that DevSound's internal buffers are reset
|
sl@0
|
1785 |
// }
|
sl@0
|
1786 |
}
|
sl@0
|
1787 |
|
sl@0
|
1788 |
/**
|
sl@0
|
1789 |
Returns the current playback volume
|
sl@0
|
1790 |
|
sl@0
|
1791 |
@param aVolume
|
sl@0
|
1792 |
A volume value between 0 and the value returned by MaxVolume().
|
sl@0
|
1793 |
|
sl@0
|
1794 |
@return One of the global error codes.
|
sl@0
|
1795 |
|
sl@0
|
1796 |
@since 7.0s
|
sl@0
|
1797 |
*/
|
sl@0
|
1798 |
TInt CMMFMdaAudioPlayerUtility::GetVolume(TInt& aVolume)
|
sl@0
|
1799 |
{
|
sl@0
|
1800 |
TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume);
|
sl@0
|
1801 |
return error;
|
sl@0
|
1802 |
}
|
sl@0
|
1803 |
|
sl@0
|
1804 |
/**
|
sl@0
|
1805 |
*
|
sl@0
|
1806 |
* Returns the number of meta data entries in the current clip
|
sl@0
|
1807 |
*
|
sl@0
|
1808 |
* @param "TInt& aNumEntries"
|
sl@0
|
1809 |
* The number of meta data entries in the header of the current clip
|
sl@0
|
1810 |
* @return "TInt" One of the global error codes
|
sl@0
|
1811 |
*
|
sl@0
|
1812 |
* @since 7.0s
|
sl@0
|
1813 |
*/
|
sl@0
|
1814 |
TInt CMMFMdaAudioPlayerUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries)
|
sl@0
|
1815 |
{
|
sl@0
|
1816 |
TInt error = iController.GetNumberOfMetaDataEntries(aNumEntries);
|
sl@0
|
1817 |
return error;
|
sl@0
|
1818 |
}
|
sl@0
|
1819 |
|
sl@0
|
1820 |
/**
|
sl@0
|
1821 |
*
|
sl@0
|
1822 |
* Returns the requested meta data entry
|
sl@0
|
1823 |
*
|
sl@0
|
1824 |
* @param "TInt aMetaDataIndex"
|
sl@0
|
1825 |
* The index number of the meta data to retrieve
|
sl@0
|
1826 |
* @return "CMMFMetaDataEntry*" The meta data entry to return
|
sl@0
|
1827 |
* @leave Leaves with KErrNotFound if the meta data entry does not exist or
|
sl@0
|
1828 |
* KErrNotImplemented if the controller does not support meta data
|
sl@0
|
1829 |
* information for this format. Other errors indicate more general system
|
sl@0
|
1830 |
* failure.
|
sl@0
|
1831 |
*
|
sl@0
|
1832 |
* @since 7.0s
|
sl@0
|
1833 |
*/
|
sl@0
|
1834 |
CMMFMetaDataEntry* CMMFMdaAudioPlayerUtility::GetMetaDataEntryL(TInt aMetaDataIndex)
|
sl@0
|
1835 |
{
|
sl@0
|
1836 |
return iController.GetMetaDataEntryL(aMetaDataIndex);
|
sl@0
|
1837 |
}
|
sl@0
|
1838 |
|
sl@0
|
1839 |
/**
|
sl@0
|
1840 |
*
|
sl@0
|
1841 |
* Set the current playback window
|
sl@0
|
1842 |
*
|
sl@0
|
1843 |
* @param "const TTimeIntervalMicroSeconds& aStart"
|
sl@0
|
1844 |
* Start time of playback window relative to start of file
|
sl@0
|
1845 |
* @param "const TTimeIntervalMicroSeconds& aEnd"
|
sl@0
|
1846 |
* End time of playback window relative to start of file
|
sl@0
|
1847 |
*
|
sl@0
|
1848 |
* @return "TInt" One of the global error codes
|
sl@0
|
1849 |
*
|
sl@0
|
1850 |
* @since 7.0s
|
sl@0
|
1851 |
*/
|
sl@0
|
1852 |
TInt CMMFMdaAudioPlayerUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aPlayStart,
|
sl@0
|
1853 |
const TTimeIntervalMicroSeconds& aPlayEnd)
|
sl@0
|
1854 |
{
|
sl@0
|
1855 |
TInt error = KErrNone;
|
sl@0
|
1856 |
|
sl@0
|
1857 |
if (aPlayStart >= TTimeIntervalMicroSeconds(0) &&
|
sl@0
|
1858 |
aPlayStart < iDuration &&
|
sl@0
|
1859 |
aPlayStart < aPlayEnd &&
|
sl@0
|
1860 |
aPlayEnd <= iDuration )
|
sl@0
|
1861 |
{
|
sl@0
|
1862 |
iPlayStart = aPlayStart;
|
sl@0
|
1863 |
iPlayEnd = aPlayEnd;
|
sl@0
|
1864 |
iPlayWindowSet = ESet;
|
sl@0
|
1865 |
|
sl@0
|
1866 |
if (iState==EPlaying)
|
sl@0
|
1867 |
error = iAudioPlayControllerCommands.SetPlaybackWindow(aPlayStart, aPlayEnd);
|
sl@0
|
1868 |
}
|
sl@0
|
1869 |
else
|
sl@0
|
1870 |
error = KErrArgument;
|
sl@0
|
1871 |
|
sl@0
|
1872 |
return error;
|
sl@0
|
1873 |
}
|
sl@0
|
1874 |
|
sl@0
|
1875 |
/**
|
sl@0
|
1876 |
*
|
sl@0
|
1877 |
* Clear the current playback window
|
sl@0
|
1878 |
*
|
sl@0
|
1879 |
* @return "TInt" One of the global error codes
|
sl@0
|
1880 |
*
|
sl@0
|
1881 |
* @since 7.0s
|
sl@0
|
1882 |
*/
|
sl@0
|
1883 |
TInt CMMFMdaAudioPlayerUtility::ClearPlayWindow()
|
sl@0
|
1884 |
{
|
sl@0
|
1885 |
// clear play window start - very important because this is assigned
|
sl@0
|
1886 |
// to iPosition when we stop & is used to set the position on the next Play()
|
sl@0
|
1887 |
iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0);
|
sl@0
|
1888 |
|
sl@0
|
1889 |
iPlayWindowSet = EClear;
|
sl@0
|
1890 |
TInt err = KErrNone;
|
sl@0
|
1891 |
if (iState==EPlaying)
|
sl@0
|
1892 |
err = iAudioPlayControllerCommands.DeletePlaybackWindow();
|
sl@0
|
1893 |
return err;
|
sl@0
|
1894 |
}
|
sl@0
|
1895 |
|
sl@0
|
1896 |
/**
|
sl@0
|
1897 |
Sets the current playback balance
|
sl@0
|
1898 |
|
sl@0
|
1899 |
@param aBalance
|
sl@0
|
1900 |
A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight. The default value is
|
sl@0
|
1901 |
KMMFBalanceCenter.
|
sl@0
|
1902 |
|
sl@0
|
1903 |
@return One of the global error codes.
|
sl@0
|
1904 |
|
sl@0
|
1905 |
@since 7.0s
|
sl@0
|
1906 |
*/
|
sl@0
|
1907 |
TInt CMMFMdaAudioPlayerUtility::SetBalance(TInt aBalance)
|
sl@0
|
1908 |
{
|
sl@0
|
1909 |
TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance);
|
sl@0
|
1910 |
return err;
|
sl@0
|
1911 |
}
|
sl@0
|
1912 |
|
sl@0
|
1913 |
/**
|
sl@0
|
1914 |
Returns the bit rate of the audio clip.
|
sl@0
|
1915 |
|
sl@0
|
1916 |
@param aBitRate
|
sl@0
|
1917 |
Bit rate of the audio clip.
|
sl@0
|
1918 |
|
sl@0
|
1919 |
@return One of the global error codes.
|
sl@0
|
1920 |
|
sl@0
|
1921 |
@since 7.0s
|
sl@0
|
1922 |
*/
|
sl@0
|
1923 |
TInt CMMFMdaAudioPlayerUtility::GetBitRate(TUint& aBitRate)
|
sl@0
|
1924 |
{
|
sl@0
|
1925 |
RMMFAudioControllerCustomCommands controller(iController);
|
sl@0
|
1926 |
TInt err = controller.GetSourceBitRate(aBitRate);
|
sl@0
|
1927 |
return err;
|
sl@0
|
1928 |
}
|
sl@0
|
1929 |
|
sl@0
|
1930 |
const CMMFControllerImplementationInformation& CMMFMdaAudioPlayerUtility::ControllerImplementationInformationL()
|
sl@0
|
1931 |
{
|
sl@0
|
1932 |
if (!iControllerImplementationInformation)
|
sl@0
|
1933 |
{
|
sl@0
|
1934 |
if (iControllerUid==KNullUid)
|
sl@0
|
1935 |
User::Leave(KErrNotReady);
|
sl@0
|
1936 |
iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid);
|
sl@0
|
1937 |
}
|
sl@0
|
1938 |
return *iControllerImplementationInformation;
|
sl@0
|
1939 |
}
|
sl@0
|
1940 |
|
sl@0
|
1941 |
void CMMFMdaAudioPlayerUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress)
|
sl@0
|
1942 |
{
|
sl@0
|
1943 |
User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress));
|
sl@0
|
1944 |
}
|
sl@0
|
1945 |
|
sl@0
|
1946 |
TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
|
sl@0
|
1947 |
{
|
sl@0
|
1948 |
return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
|
sl@0
|
1949 |
}
|
sl@0
|
1950 |
|
sl@0
|
1951 |
TInt CMMFMdaAudioPlayerUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
|
sl@0
|
1952 |
{
|
sl@0
|
1953 |
return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
|
sl@0
|
1954 |
}
|
sl@0
|
1955 |
|
sl@0
|
1956 |
void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
|
sl@0
|
1957 |
{
|
sl@0
|
1958 |
iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
|
sl@0
|
1959 |
}
|
sl@0
|
1960 |
|
sl@0
|
1961 |
void CMMFMdaAudioPlayerUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
|
sl@0
|
1962 |
{
|
sl@0
|
1963 |
iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
|
sl@0
|
1964 |
}
|
sl@0
|
1965 |
|
sl@0
|
1966 |
/**
|
sl@0
|
1967 |
Returns the current playback balance
|
sl@0
|
1968 |
|
sl@0
|
1969 |
@param aBalance
|
sl@0
|
1970 |
A value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight
|
sl@0
|
1971 |
|
sl@0
|
1972 |
@return One of the global error codes.
|
sl@0
|
1973 |
|
sl@0
|
1974 |
@since 7.0s
|
sl@0
|
1975 |
*/
|
sl@0
|
1976 |
TInt CMMFMdaAudioPlayerUtility::GetBalance(TInt& aBalance)
|
sl@0
|
1977 |
{
|
sl@0
|
1978 |
TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance);
|
sl@0
|
1979 |
return err;
|
sl@0
|
1980 |
}
|
sl@0
|
1981 |
|
sl@0
|
1982 |
MMMFDRMCustomCommand* CMMFMdaAudioPlayerUtility::GetDRMCustomCommand()
|
sl@0
|
1983 |
{
|
sl@0
|
1984 |
// XXX: check controller supports MMMFDRMCustomCommandImplementor
|
sl@0
|
1985 |
if (iDRMCustomCommands.IsSupported())
|
sl@0
|
1986 |
{
|
sl@0
|
1987 |
return static_cast<MMMFDRMCustomCommand*>(&iDRMCustomCommands);
|
sl@0
|
1988 |
}
|
sl@0
|
1989 |
else
|
sl@0
|
1990 |
{
|
sl@0
|
1991 |
return NULL;
|
sl@0
|
1992 |
}
|
sl@0
|
1993 |
}
|
sl@0
|
1994 |
|
sl@0
|
1995 |
void CMMFMdaAudioPlayerUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver)
|
sl@0
|
1996 |
{
|
sl@0
|
1997 |
iLoadingObserver = &aLoadingObserver;
|
sl@0
|
1998 |
}
|
sl@0
|
1999 |
|
sl@0
|
2000 |
TInt CMMFMdaAudioPlayerUtility::RegisterAudioResourceNotification(MMMFAudioResourceNotificationCallback& aCallback,
|
sl@0
|
2001 |
TUid aNotificationEventUid,
|
sl@0
|
2002 |
const TDesC8& aNotificationRegistrationData)
|
sl@0
|
2003 |
{
|
sl@0
|
2004 |
iAudioResourceNotificationCallBack = &aCallback;
|
sl@0
|
2005 |
TInt err = iNotificationRegistrationCommands.RegisterAsClient(aNotificationEventUid, aNotificationRegistrationData);
|
sl@0
|
2006 |
if(err == KErrNotReady)
|
sl@0
|
2007 |
{
|
sl@0
|
2008 |
iEventHolder = aNotificationEventUid;
|
sl@0
|
2009 |
iNotificationDataHolder = aNotificationRegistrationData;
|
sl@0
|
2010 |
return KErrNone;
|
sl@0
|
2011 |
}
|
sl@0
|
2012 |
iNotificationDataHolder = KNullDesC8;
|
sl@0
|
2013 |
iEventHolder = KNullUid;
|
sl@0
|
2014 |
return err;
|
sl@0
|
2015 |
}
|
sl@0
|
2016 |
|
sl@0
|
2017 |
TInt CMMFMdaAudioPlayerUtility::CancelRegisterAudioResourceNotification(TUid aNotificationEventId)
|
sl@0
|
2018 |
{
|
sl@0
|
2019 |
TInt err = iNotificationRegistrationCommands.CancelRegisterAsClient(aNotificationEventId);
|
sl@0
|
2020 |
if(err == KErrNotReady)
|
sl@0
|
2021 |
{
|
sl@0
|
2022 |
if(aNotificationEventId != KMMFEventCategoryAudioResourceAvailable)
|
sl@0
|
2023 |
{
|
sl@0
|
2024 |
return KErrNotSupported;
|
sl@0
|
2025 |
}
|
sl@0
|
2026 |
if(iEventHolder == KNullUid)
|
sl@0
|
2027 |
{
|
sl@0
|
2028 |
return KErrCancel;
|
sl@0
|
2029 |
}
|
sl@0
|
2030 |
iEventHolder = KNullUid;
|
sl@0
|
2031 |
iNotificationDataHolder = KNullDesC8;
|
sl@0
|
2032 |
return KErrNone;
|
sl@0
|
2033 |
}
|
sl@0
|
2034 |
return err;
|
sl@0
|
2035 |
}
|
sl@0
|
2036 |
|
sl@0
|
2037 |
TInt CMMFMdaAudioPlayerUtility::WillResumePlay()
|
sl@0
|
2038 |
{
|
sl@0
|
2039 |
return iNotificationRegistrationCommands.WillResumePlay();
|
sl@0
|
2040 |
}
|
sl@0
|
2041 |
|
sl@0
|
2042 |
TInt CMMFMdaAudioPlayerUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
|
sl@0
|
2043 |
{
|
sl@0
|
2044 |
return iController.SetThreadPriority(aThreadPriority);
|
sl@0
|
2045 |
}
|
sl@0
|
2046 |
|
sl@0
|
2047 |
CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs)
|
sl@0
|
2048 |
{
|
sl@0
|
2049 |
CRepeatTrailingSilenceTimer* s = new(ELeave) CRepeatTrailingSilenceTimer(aObs);
|
sl@0
|
2050 |
CleanupStack::PushL(s);
|
sl@0
|
2051 |
s->ConstructL();
|
sl@0
|
2052 |
CleanupStack::Pop();
|
sl@0
|
2053 |
return s;
|
sl@0
|
2054 |
}
|
sl@0
|
2055 |
|
sl@0
|
2056 |
void CRepeatTrailingSilenceTimer::RunL()
|
sl@0
|
2057 |
{
|
sl@0
|
2058 |
iObs.RepeatTrailingSilenceTimerComplete();
|
sl@0
|
2059 |
}
|
sl@0
|
2060 |
|
sl@0
|
2061 |
CRepeatTrailingSilenceTimer::CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs) :
|
sl@0
|
2062 |
CTimer(EPriorityHigh),
|
sl@0
|
2063 |
iObs(aObs)
|
sl@0
|
2064 |
{
|
sl@0
|
2065 |
CActiveScheduler::Add(this);
|
sl@0
|
2066 |
}
|
sl@0
|
2067 |
|
sl@0
|
2068 |
|
sl@0
|
2069 |
|
sl@0
|
2070 |
CMMFMdaAudioPlayerCallBack* CMMFMdaAudioPlayerCallBack::NewL(MMdaAudioPlayerCallback& aCallback)
|
sl@0
|
2071 |
{
|
sl@0
|
2072 |
return new(ELeave) CMMFMdaAudioPlayerCallBack(aCallback);
|
sl@0
|
2073 |
}
|
sl@0
|
2074 |
|
sl@0
|
2075 |
CMMFMdaAudioPlayerCallBack::CMMFMdaAudioPlayerCallBack(MMdaAudioPlayerCallback& aCallback) :
|
sl@0
|
2076 |
CActive(CActive::EPriorityHigh), iCallback(aCallback)
|
sl@0
|
2077 |
{
|
sl@0
|
2078 |
CActiveScheduler::Add(this);
|
sl@0
|
2079 |
}
|
sl@0
|
2080 |
|
sl@0
|
2081 |
CMMFMdaAudioPlayerCallBack::~CMMFMdaAudioPlayerCallBack()
|
sl@0
|
2082 |
{
|
sl@0
|
2083 |
Cancel();
|
sl@0
|
2084 |
}
|
sl@0
|
2085 |
|
sl@0
|
2086 |
void CMMFMdaAudioPlayerCallBack::InitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
2087 |
{
|
sl@0
|
2088 |
iError = aError;
|
sl@0
|
2089 |
iDuration = aDuration;
|
sl@0
|
2090 |
iState = ECallbackInitComplete;
|
sl@0
|
2091 |
if (!IsActive())
|
sl@0
|
2092 |
{
|
sl@0
|
2093 |
TRequestStatus* s = &iStatus;
|
sl@0
|
2094 |
SetActive();
|
sl@0
|
2095 |
User::RequestComplete(s, KErrNone);
|
sl@0
|
2096 |
}
|
sl@0
|
2097 |
}
|
sl@0
|
2098 |
|
sl@0
|
2099 |
void CMMFMdaAudioPlayerCallBack::PlayComplete(TInt aError)
|
sl@0
|
2100 |
{
|
sl@0
|
2101 |
iError = aError;
|
sl@0
|
2102 |
iState = ECallbackPlayComplete;
|
sl@0
|
2103 |
if (!IsActive())
|
sl@0
|
2104 |
{
|
sl@0
|
2105 |
TRequestStatus* s = &iStatus;
|
sl@0
|
2106 |
SetActive();
|
sl@0
|
2107 |
User::RequestComplete(s, KErrNone);
|
sl@0
|
2108 |
}
|
sl@0
|
2109 |
}
|
sl@0
|
2110 |
|
sl@0
|
2111 |
void CMMFMdaAudioPlayerCallBack::RunL()
|
sl@0
|
2112 |
{
|
sl@0
|
2113 |
switch (iState)
|
sl@0
|
2114 |
{
|
sl@0
|
2115 |
case ECallbackInitComplete:
|
sl@0
|
2116 |
iCallback.MapcInitComplete(iError, iDuration);
|
sl@0
|
2117 |
break;
|
sl@0
|
2118 |
case ECallbackPlayComplete:
|
sl@0
|
2119 |
iCallback.MapcPlayComplete(iError);
|
sl@0
|
2120 |
break;
|
sl@0
|
2121 |
}
|
sl@0
|
2122 |
}
|
sl@0
|
2123 |
|
sl@0
|
2124 |
void CMMFMdaAudioPlayerCallBack::DoCancel()
|
sl@0
|
2125 |
{
|
sl@0
|
2126 |
// Nothing to cancel
|
sl@0
|
2127 |
}
|