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 <e32std.h>
|
sl@0
|
17 |
#include <mmf/common/mmffourcc.h>
|
sl@0
|
18 |
#include <mmf/common/mmfpaniccodes.h>
|
sl@0
|
19 |
#include <mmfformatimplementationuids.hrh>
|
sl@0
|
20 |
|
sl@0
|
21 |
#include "mmfclientaudioconverter.h"
|
sl@0
|
22 |
|
sl@0
|
23 |
// declared in the recorder module
|
sl@0
|
24 |
void Panic(TInt aPanicCode);
|
sl@0
|
25 |
|
sl@0
|
26 |
//CMdaAudioConvertUtility
|
sl@0
|
27 |
|
sl@0
|
28 |
|
sl@0
|
29 |
/**
|
sl@0
|
30 |
Returns the current utility state.
|
sl@0
|
31 |
|
sl@0
|
32 |
@return The state of the audio sample data. See CMdaAudioClipUtility::TState.
|
sl@0
|
33 |
|
sl@0
|
34 |
@since 5.0
|
sl@0
|
35 |
*/
|
sl@0
|
36 |
CMdaAudioClipUtility::TState CMdaAudioConvertUtility::State()
|
sl@0
|
37 |
{
|
sl@0
|
38 |
ASSERT(iProperties);
|
sl@0
|
39 |
return iProperties->State();
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
/**
|
sl@0
|
43 |
Closes the current audio clip.
|
sl@0
|
44 |
|
sl@0
|
45 |
@since 5.0
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
void CMdaAudioConvertUtility::Close()
|
sl@0
|
48 |
{
|
sl@0
|
49 |
ASSERT(iProperties);
|
sl@0
|
50 |
iProperties->Close();
|
sl@0
|
51 |
}
|
sl@0
|
52 |
|
sl@0
|
53 |
/**
|
sl@0
|
54 |
This function is mapped to ConvertL(). ConvertL() should be used instead.
|
sl@0
|
55 |
|
sl@0
|
56 |
@see ConvertL()
|
sl@0
|
57 |
|
sl@0
|
58 |
@since 5.0
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
void CMdaAudioConvertUtility::PlayL()
|
sl@0
|
61 |
{
|
sl@0
|
62 |
ASSERT(iProperties);
|
sl@0
|
63 |
iProperties->PlayL();
|
sl@0
|
64 |
}
|
sl@0
|
65 |
|
sl@0
|
66 |
/**
|
sl@0
|
67 |
This function is mapped to ConvertL. ConvertL() should be used instead.
|
sl@0
|
68 |
|
sl@0
|
69 |
@since 5.0
|
sl@0
|
70 |
*/
|
sl@0
|
71 |
void CMdaAudioConvertUtility::RecordL()
|
sl@0
|
72 |
{
|
sl@0
|
73 |
ASSERT(iProperties);
|
sl@0
|
74 |
iProperties->RecordL();
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
Stops the current operation (playback/recording/conversion).
|
sl@0
|
79 |
|
sl@0
|
80 |
When conversion has been stopped, successfully or otherwise, the client is notified by
|
sl@0
|
81 |
MMdaObjectStateChangeObserver::MoscoStateChangeEvent(). The callback is initiated by this function
|
sl@0
|
82 |
providing it with state change information and error codes.
|
sl@0
|
83 |
|
sl@0
|
84 |
@since 5.0
|
sl@0
|
85 |
*/
|
sl@0
|
86 |
void CMdaAudioConvertUtility::Stop()
|
sl@0
|
87 |
{
|
sl@0
|
88 |
ASSERT(iProperties);
|
sl@0
|
89 |
iProperties->Stop();
|
sl@0
|
90 |
}
|
sl@0
|
91 |
|
sl@0
|
92 |
/**
|
sl@0
|
93 |
Crops the current clip from the current position. The remainder of the clip is discarded.
|
sl@0
|
94 |
|
sl@0
|
95 |
The effects of the function cannot be undone. The function is synchronous and can leave if there is
|
sl@0
|
96 |
a problem. The leave code depends on the configuration.
|
sl@0
|
97 |
|
sl@0
|
98 |
@since 5.0
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
void CMdaAudioConvertUtility::CropL()
|
sl@0
|
101 |
{
|
sl@0
|
102 |
ASSERT(iProperties);
|
sl@0
|
103 |
iProperties->CropL(ETrue);
|
sl@0
|
104 |
}
|
sl@0
|
105 |
|
sl@0
|
106 |
/**
|
sl@0
|
107 |
Sets the current position in the audio clip.
|
sl@0
|
108 |
|
sl@0
|
109 |
A subsequent call to ConvertL() starts conversion from this new position.
|
sl@0
|
110 |
|
sl@0
|
111 |
@param aPosition
|
sl@0
|
112 |
The position in the audio clip, in microseconds.
|
sl@0
|
113 |
|
sl@0
|
114 |
@since 5.0
|
sl@0
|
115 |
*/
|
sl@0
|
116 |
void CMdaAudioConvertUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
ASSERT(iProperties);
|
sl@0
|
119 |
iProperties->SetPosition(aPosition);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
/**
|
sl@0
|
123 |
Returns the current position in the audio clip. The position is defined in terms of a time interval
|
sl@0
|
124 |
measured from the beginning of the audio sample data.
|
sl@0
|
125 |
|
sl@0
|
126 |
@return The current position in the audio clip, in microseconds.
|
sl@0
|
127 |
|
sl@0
|
128 |
@since 5.0
|
sl@0
|
129 |
*/
|
sl@0
|
130 |
const TTimeIntervalMicroSeconds& CMdaAudioConvertUtility::Position()
|
sl@0
|
131 |
{
|
sl@0
|
132 |
ASSERT(iProperties);
|
sl@0
|
133 |
return iProperties->Position();
|
sl@0
|
134 |
}
|
sl@0
|
135 |
|
sl@0
|
136 |
/**
|
sl@0
|
137 |
Returns the amount of recording time available to the current clip.
|
sl@0
|
138 |
|
sl@0
|
139 |
@return The recording time available measured in microseconds.
|
sl@0
|
140 |
|
sl@0
|
141 |
@since 5.0
|
sl@0
|
142 |
*/
|
sl@0
|
143 |
const TTimeIntervalMicroSeconds& CMdaAudioConvertUtility::RecordTimeAvailable()
|
sl@0
|
144 |
{
|
sl@0
|
145 |
ASSERT(iProperties);
|
sl@0
|
146 |
return iProperties->RecordTimeAvailable();
|
sl@0
|
147 |
}
|
sl@0
|
148 |
|
sl@0
|
149 |
/**
|
sl@0
|
150 |
Returns the duration of the audio clip.
|
sl@0
|
151 |
|
sl@0
|
152 |
@return The duration in microseconds.
|
sl@0
|
153 |
|
sl@0
|
154 |
@since 5.0
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
const TTimeIntervalMicroSeconds& CMdaAudioConvertUtility::Duration()
|
sl@0
|
157 |
{
|
sl@0
|
158 |
ASSERT(iProperties);
|
sl@0
|
159 |
return iProperties->Duration();
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
/**
|
sl@0
|
163 |
Sets a window for playback.
|
sl@0
|
164 |
|
sl@0
|
165 |
The window is defined in terms of a start and end time. A subsequent call to ConvertL() results
|
sl@0
|
166 |
in just the data within the window being converted.
|
sl@0
|
167 |
|
sl@0
|
168 |
@param aStart
|
sl@0
|
169 |
The position in the clip to start playback, in microseconds. This must be any value from zero
|
sl@0
|
170 |
to aEnd. If this value is less than zero or greater than aEnd, this function raises
|
sl@0
|
171 |
EMMFMediaClientPanicServerCommunicationProblem panic in debug version.
|
sl@0
|
172 |
@param aEnd
|
sl@0
|
173 |
The position in the clip to end playback, in microseconds. This must be any value from aStart
|
sl@0
|
174 |
to the value returned by Duration(). If this value is greater than the value returned by
|
sl@0
|
175 |
Duration() or less than aStart, this function raises EMMFMediaClientPanicServerCommunicationProblem panic in debug version.
|
sl@0
|
176 |
|
sl@0
|
177 |
@since 5.0
|
sl@0
|
178 |
*/
|
sl@0
|
179 |
void CMdaAudioConvertUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
ASSERT(iProperties);
|
sl@0
|
182 |
iProperties->SetPlayWindow(aStart, aEnd);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
/**
|
sl@0
|
186 |
Clears the playback window.
|
sl@0
|
187 |
|
sl@0
|
188 |
Playback returns to playing the entire clip. A subsequent call to ConvertL() results in the entire
|
sl@0
|
189 |
source audio being converted.
|
sl@0
|
190 |
|
sl@0
|
191 |
@since 5.0
|
sl@0
|
192 |
*/
|
sl@0
|
193 |
void CMdaAudioConvertUtility::ClearPlayWindow()
|
sl@0
|
194 |
{
|
sl@0
|
195 |
ASSERT(iProperties);
|
sl@0
|
196 |
iProperties->ClearPlayWindow();
|
sl@0
|
197 |
}
|
sl@0
|
198 |
|
sl@0
|
199 |
/**
|
sl@0
|
200 |
Sets the number of repetitions for playback. This is unsupported for CMdaConvertUtility as there is
|
sl@0
|
201 |
no playback facility. It is provided only for binary compatibility.
|
sl@0
|
202 |
|
sl@0
|
203 |
@param aRepeatNumberOfTimes
|
sl@0
|
204 |
The number of times to repeat the audio clip, after the first playback. If this is set to
|
sl@0
|
205 |
KMdaRepeatForever, then the audio sample, together with the trailing silence, is repeated
|
sl@0
|
206 |
indefinitely. If this is set to zero, then the audio sample is not repeated.
|
sl@0
|
207 |
@param aTrailingSilence
|
sl@0
|
208 |
A delay to wait before each repetition.
|
sl@0
|
209 |
|
sl@0
|
210 |
@since 5.0
|
sl@0
|
211 |
*/
|
sl@0
|
212 |
void CMdaAudioConvertUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)
|
sl@0
|
213 |
{
|
sl@0
|
214 |
ASSERT(iProperties);
|
sl@0
|
215 |
iProperties->SetRepeats(aRepeatNumberOfTimes, aTrailingSilence);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
/**
|
sl@0
|
219 |
Sets the maximum size of an audio clip.
|
sl@0
|
220 |
|
sl@0
|
221 |
This function is provided so that applications such as recorders and converters can limit the amount
|
sl@0
|
222 |
of file storage/memory that should be allocated.
|
sl@0
|
223 |
|
sl@0
|
224 |
@param aMaxWriteLength
|
sl@0
|
225 |
The maximum size of the audio clip, in bytes. If the default value is used, there is no
|
sl@0
|
226 |
maximum file size.
|
sl@0
|
227 |
|
sl@0
|
228 |
@since 7.0
|
sl@0
|
229 |
*/
|
sl@0
|
230 |
void CMdaAudioConvertUtility::SetMaxWriteLength(TInt aMaxWriteLength /* = KMdaClipLocationMaxWriteLengthNone*/)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
ASSERT(iProperties);
|
sl@0
|
233 |
iProperties->SetMaxWriteLength(aMaxWriteLength);
|
sl@0
|
234 |
}
|
sl@0
|
235 |
|
sl@0
|
236 |
/**
|
sl@0
|
237 |
Crops the audio clip from the start of the file to the current position. The audio data
|
sl@0
|
238 |
prior to the current position is discarded.
|
sl@0
|
239 |
|
sl@0
|
240 |
The effects of the function cannot be undone.
|
sl@0
|
241 |
|
sl@0
|
242 |
The function is synchronous and can leave if there is a problem. The leave code depends on the
|
sl@0
|
243 |
configuration.
|
sl@0
|
244 |
|
sl@0
|
245 |
@since 7.0s
|
sl@0
|
246 |
*/
|
sl@0
|
247 |
void CMdaAudioConvertUtility::CropFromBeginningL()
|
sl@0
|
248 |
{
|
sl@0
|
249 |
ASSERT(iProperties);
|
sl@0
|
250 |
iProperties->CropL(EFalse);
|
sl@0
|
251 |
}
|
sl@0
|
252 |
|
sl@0
|
253 |
/**
|
sl@0
|
254 |
Constructs and initialises a new instance of the audio converter for converting audio sample data
|
sl@0
|
255 |
from one format to another.
|
sl@0
|
256 |
|
sl@0
|
257 |
The function leaves if the audio converter object cannot be created.
|
sl@0
|
258 |
|
sl@0
|
259 |
@param aObserver
|
sl@0
|
260 |
The class to receive state change events from converter.
|
sl@0
|
261 |
@param aServer
|
sl@0
|
262 |
No longer used, should be NULL.
|
sl@0
|
263 |
@param aPriority
|
sl@0
|
264 |
The Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and
|
sl@0
|
265 |
EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
|
sl@0
|
266 |
@param aPref
|
sl@0
|
267 |
The Priority Preference - an additional audio policy parameter. The suggested default is
|
sl@0
|
268 |
EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional
|
sl@0
|
269 |
values may be supported by given phones and/or platforms, but should not be depended upon by
|
sl@0
|
270 |
portable code.
|
sl@0
|
271 |
|
sl@0
|
272 |
@return A pointer to a new instance of CMdaAudioConvertUtility.
|
sl@0
|
273 |
|
sl@0
|
274 |
@since 5.0
|
sl@0
|
275 |
|
sl@0
|
276 |
Note: The Priority Value and Priority Preference are used primarily when deciding what to do when
|
sl@0
|
277 |
several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference,
|
sl@0
|
278 |
the adaptation may consider other parameters such as the SecureId and Capabilities of the client process.
|
sl@0
|
279 |
Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may
|
sl@0
|
280 |
vary between different phones. Portable applications are advised not to assume any specific behaviour.
|
sl@0
|
281 |
*/
|
sl@0
|
282 |
EXPORT_C CMdaAudioConvertUtility* CMdaAudioConvertUtility::NewL(MMdaObjectStateChangeObserver& aObserver,
|
sl@0
|
283 |
CMdaServer* /*aServer*/,
|
sl@0
|
284 |
TInt aPriority,
|
sl@0
|
285 |
TInt aPref)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
CMdaAudioConvertUtility* self = new(ELeave) CMdaAudioConvertUtility();
|
sl@0
|
288 |
CleanupStack::PushL(self);
|
sl@0
|
289 |
self->iProperties = new(ELeave) CMMFMdaAudioConvertUtility(self, aObserver);
|
sl@0
|
290 |
self->iProperties->ConstructL(aPriority, aPref);
|
sl@0
|
291 |
CleanupStack::Pop(self);
|
sl@0
|
292 |
return self;
|
sl@0
|
293 |
}
|
sl@0
|
294 |
|
sl@0
|
295 |
/**
|
sl@0
|
296 |
Destructor.
|
sl@0
|
297 |
|
sl@0
|
298 |
Closes the audio clip and frees resources.
|
sl@0
|
299 |
|
sl@0
|
300 |
@since 5.0
|
sl@0
|
301 |
*/
|
sl@0
|
302 |
CMdaAudioConvertUtility::~CMdaAudioConvertUtility()
|
sl@0
|
303 |
{
|
sl@0
|
304 |
delete iProperties;
|
sl@0
|
305 |
}
|
sl@0
|
306 |
|
sl@0
|
307 |
/**
|
sl@0
|
308 |
Ensures that any subsequent calls to OpenXYZ() will create controllers that
|
sl@0
|
309 |
share a heap.
|
sl@0
|
310 |
|
sl@0
|
311 |
The default behaviour is that for each converter utility a controller with its own heap
|
sl@0
|
312 |
is created. Each heap uses a chunk, so using this function avoids situations where
|
sl@0
|
313 |
the number of chunks per process is limited.
|
sl@0
|
314 |
The default behaviour is generally to be preferred, and should give lower overall
|
sl@0
|
315 |
memory usage. However, if many controllers are to be created for a particular thread,
|
sl@0
|
316 |
then this function should be used to prevent running out of heaps or chunks.
|
sl@0
|
317 |
|
sl@0
|
318 |
@since 9.2
|
sl@0
|
319 |
*/
|
sl@0
|
320 |
EXPORT_C void CMdaAudioConvertUtility::UseSharedHeap()
|
sl@0
|
321 |
{
|
sl@0
|
322 |
ASSERT(iProperties);
|
sl@0
|
323 |
iProperties->UseSharedHeap();
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
/**
|
sl@0
|
327 |
Opens source and target files (both of which must already exist) so that audio sample data can be
|
sl@0
|
328 |
extracted from the source file, converted and appended to the target file.
|
sl@0
|
329 |
|
sl@0
|
330 |
When opening is complete, successfully or otherwise, the client is notified by
|
sl@0
|
331 |
MMdaObjectStateChangeObserver::MoscoStateChangeEvent(). The callback is initiated by this function
|
sl@0
|
332 |
providing it with state change information and error codes.
|
sl@0
|
333 |
|
sl@0
|
334 |
@param aPrimaryFile
|
sl@0
|
335 |
The full path and filename of a file containing audio sample data to be converted.
|
sl@0
|
336 |
@param aSecondaryFile
|
sl@0
|
337 |
The full path and filename of a file to which converted data is appended.
|
sl@0
|
338 |
|
sl@0
|
339 |
@since 5.0
|
sl@0
|
340 |
*/
|
sl@0
|
341 |
void CMdaAudioConvertUtility::OpenL(const TDesC& aPrimaryFile, const TDesC& aSecondaryFile)
|
sl@0
|
342 |
{
|
sl@0
|
343 |
ASSERT(iProperties);
|
sl@0
|
344 |
iProperties->OpenL(aPrimaryFile, aSecondaryFile);
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
/**
|
sl@0
|
348 |
Opens an existing audio file so that audio sample data can be extracted from it, converted and
|
sl@0
|
349 |
placed into the target audio object.
|
sl@0
|
350 |
|
sl@0
|
351 |
When opening is complete, successfully or otherwise, the client is notified by
|
sl@0
|
352 |
MMdaObjectStateChangeObserver::MoscoStateChangeEvent(). The callback is initiated by this function
|
sl@0
|
353 |
providing it with state change information and error codes.
|
sl@0
|
354 |
|
sl@0
|
355 |
@param aPrimaryFile
|
sl@0
|
356 |
The full path and filename of a file containing audio sample data to be converted.
|
sl@0
|
357 |
@param aLocation
|
sl@0
|
358 |
The target location for the audio data. This is normally a file (TMdaFileClipLocation) or a
|
sl@0
|
359 |
descriptor (TMdaDesClipLocation).
|
sl@0
|
360 |
@param aFormat
|
sl@0
|
361 |
The audio format for the target audio object.
|
sl@0
|
362 |
@param aArg1
|
sl@0
|
363 |
The codec to use for the target audio object.
|
sl@0
|
364 |
@param aArg2
|
sl@0
|
365 |
The audio settings for the target audio object.
|
sl@0
|
366 |
|
sl@0
|
367 |
@since 5.0
|
sl@0
|
368 |
*/
|
sl@0
|
369 |
void CMdaAudioConvertUtility::OpenL(const TDesC& aPrimaryFile, TMdaClipLocation* aLocation, TMdaClipFormat* aFormat,
|
sl@0
|
370 |
TMdaPackage* aArg1 /*= NULL*/, TMdaPackage* aArg2 /*= NULL*/)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
ASSERT(iProperties);
|
sl@0
|
373 |
iProperties->OpenL(aPrimaryFile, aLocation, aFormat, aArg1, aArg2);
|
sl@0
|
374 |
}
|
sl@0
|
375 |
|
sl@0
|
376 |
/**
|
sl@0
|
377 |
Opens an audio clip for conversion.
|
sl@0
|
378 |
|
sl@0
|
379 |
@param aPriLocation
|
sl@0
|
380 |
The source location for audio data. This is normally a file (TMdaFileClipLocation) or a
|
sl@0
|
381 |
descriptor (TMdaDesClipLocation).
|
sl@0
|
382 |
@param aSecLocation
|
sl@0
|
383 |
The target location for audio data. This is normally a file (TMdaFileClipLocation) or a
|
sl@0
|
384 |
descriptor (TMdaDesClipLocation).
|
sl@0
|
385 |
@param aPriFormat
|
sl@0
|
386 |
The audio format of the source audio object.
|
sl@0
|
387 |
@param aSecFormat
|
sl@0
|
388 |
The audio format for the target audio object.
|
sl@0
|
389 |
@param aPriArg1
|
sl@0
|
390 |
The codec used by the source audio object.
|
sl@0
|
391 |
@param aPriArg2
|
sl@0
|
392 |
The audio settings of the source audio object.
|
sl@0
|
393 |
@param aSecArg1
|
sl@0
|
394 |
The codec to be used for the target audio object.
|
sl@0
|
395 |
@param aSecArg2
|
sl@0
|
396 |
The audio settings for the target audio object.
|
sl@0
|
397 |
|
sl@0
|
398 |
@since 5.0
|
sl@0
|
399 |
*/
|
sl@0
|
400 |
void CMdaAudioConvertUtility::OpenL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation,
|
sl@0
|
401 |
TMdaClipFormat* aPriFormat, TMdaClipFormat* aSecFormat,
|
sl@0
|
402 |
TMdaPackage* aPriArg1 /*= NULL*/, TMdaPackage* aPriArg2 /*= NULL*/,
|
sl@0
|
403 |
TMdaPackage* aSecArg1 /*= NULL*/, TMdaPackage* aSecArg2 /*= NULL*/)
|
sl@0
|
404 |
{
|
sl@0
|
405 |
ASSERT(iProperties);
|
sl@0
|
406 |
iProperties->OpenL(aPriLocation, aSecLocation, aPriFormat, aSecFormat, aPriArg1, aPriArg2, aSecArg1, aSecArg2);
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
// New functions for 7.0s
|
sl@0
|
410 |
/**
|
sl@0
|
411 |
Opens source and target audio objects and specifies controller and audio format and codec
|
sl@0
|
412 |
information.
|
sl@0
|
413 |
|
sl@0
|
414 |
When opening is complete, successfully or otherwise, the client is notified by
|
sl@0
|
415 |
MMdaObjectStateChangeObserver::MoscoStateChangeEvent(). The callback is initiated by this function
|
sl@0
|
416 |
providing it with state change information and error codes.
|
sl@0
|
417 |
|
sl@0
|
418 |
@param aPriLocation
|
sl@0
|
419 |
The source location for audio data. This is normally a file (TMdaFileClipLocation) or a
|
sl@0
|
420 |
descriptor (TMdaDesClipLocation).
|
sl@0
|
421 |
@param aSecLocation
|
sl@0
|
422 |
The destination location for the converted audio data. This is normally a file
|
sl@0
|
423 |
(TMdaFileClipLocation) or a descriptor (TMdaDesClipLocation).
|
sl@0
|
424 |
@param aControllerUid
|
sl@0
|
425 |
The UID of the controller to used for conversion.
|
sl@0
|
426 |
@param aDestFormatUid
|
sl@0
|
427 |
The UID of the destination format.
|
sl@0
|
428 |
@param aDestDataType
|
sl@0
|
429 |
The audio codec to use for the destination data sink.
|
sl@0
|
430 |
|
sl@0
|
431 |
@since 7.0s
|
sl@0
|
432 |
*/
|
sl@0
|
433 |
EXPORT_C void CMdaAudioConvertUtility::OpenL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation, TUid aControllerUid,
|
sl@0
|
434 |
TUid aDestFormatUid, TFourCC aDestDataType)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
ASSERT(iProperties);
|
sl@0
|
437 |
iProperties->OpenL(aPriLocation, aSecLocation, aControllerUid, aDestFormatUid, aDestDataType);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
/**
|
sl@0
|
441 |
Returns a list of the supported data types for the conversion destination.
|
sl@0
|
442 |
|
sl@0
|
443 |
@param aSupportedDestinationDataTypes
|
sl@0
|
444 |
A list of four character codes, representing the supported data
|
sl@0
|
445 |
encodings for the conversion destination.
|
sl@0
|
446 |
|
sl@0
|
447 |
@since 7.0s
|
sl@0
|
448 |
*/
|
sl@0
|
449 |
EXPORT_C void CMdaAudioConvertUtility::GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDestinationDataTypes)
|
sl@0
|
450 |
{
|
sl@0
|
451 |
ASSERT(iProperties);
|
sl@0
|
452 |
iProperties->GetSupportedDestinationDataTypesL(aSupportedDestinationDataTypes);
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
/**
|
sl@0
|
456 |
Sets the data type of the destination audio clip.
|
sl@0
|
457 |
|
sl@0
|
458 |
@param aCodec
|
sl@0
|
459 |
The four character code, representing the encoding of the destination audio clip
|
sl@0
|
460 |
|
sl@0
|
461 |
@since 7.0s
|
sl@0
|
462 |
*/
|
sl@0
|
463 |
EXPORT_C void CMdaAudioConvertUtility::SetDestinationDataTypeL(TFourCC aCodec)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
ASSERT(iProperties);
|
sl@0
|
466 |
iProperties->SetDestinationDataTypeL(aCodec);
|
sl@0
|
467 |
}
|
sl@0
|
468 |
|
sl@0
|
469 |
/**
|
sl@0
|
470 |
Returns the data type of the destination audio clip.
|
sl@0
|
471 |
|
sl@0
|
472 |
@return The four character code, representing the encoding of the destination audio clip.
|
sl@0
|
473 |
|
sl@0
|
474 |
@since 7.0s
|
sl@0
|
475 |
*/
|
sl@0
|
476 |
EXPORT_C TFourCC CMdaAudioConvertUtility::DestinationDataTypeL()
|
sl@0
|
477 |
{
|
sl@0
|
478 |
ASSERT(iProperties);
|
sl@0
|
479 |
return iProperties->DestinationDataTypeL();
|
sl@0
|
480 |
}
|
sl@0
|
481 |
|
sl@0
|
482 |
/**
|
sl@0
|
483 |
Returns the data type of the source audio clip.
|
sl@0
|
484 |
|
sl@0
|
485 |
@return The four character code, representing the encoding of the source audio clip.
|
sl@0
|
486 |
|
sl@0
|
487 |
@since 7.0s
|
sl@0
|
488 |
*/
|
sl@0
|
489 |
EXPORT_C TFourCC CMdaAudioConvertUtility::SourceDataTypeL()
|
sl@0
|
490 |
{
|
sl@0
|
491 |
ASSERT(iProperties);
|
sl@0
|
492 |
return iProperties->SourceDataTypeL();
|
sl@0
|
493 |
}
|
sl@0
|
494 |
|
sl@0
|
495 |
/**
|
sl@0
|
496 |
Sets the bit rate of the destination audio clip.
|
sl@0
|
497 |
|
sl@0
|
498 |
The bit rate must be one of the supported bit rates of the audio target. Use
|
sl@0
|
499 |
GetSupportedConversionBitRatesL() to retrieve a list of supported bit rates.
|
sl@0
|
500 |
|
sl@0
|
501 |
@param aBitRate
|
sl@0
|
502 |
The destination bit rate in bits/second.
|
sl@0
|
503 |
|
sl@0
|
504 |
@since 7.0s
|
sl@0
|
505 |
*/
|
sl@0
|
506 |
EXPORT_C void CMdaAudioConvertUtility::SetDestinationBitRateL(TUint aBitRate)
|
sl@0
|
507 |
{
|
sl@0
|
508 |
ASSERT(iProperties);
|
sl@0
|
509 |
iProperties->SetDestinationBitRateL(aBitRate);
|
sl@0
|
510 |
}
|
sl@0
|
511 |
|
sl@0
|
512 |
/**
|
sl@0
|
513 |
Returns the bit rate of the destination audio clip.
|
sl@0
|
514 |
|
sl@0
|
515 |
@return The destination bit rate in bits/second.
|
sl@0
|
516 |
|
sl@0
|
517 |
@since 7.0s
|
sl@0
|
518 |
*/
|
sl@0
|
519 |
EXPORT_C TUint CMdaAudioConvertUtility::DestinationBitRateL()
|
sl@0
|
520 |
{
|
sl@0
|
521 |
ASSERT(iProperties);
|
sl@0
|
522 |
return iProperties->DestinationBitRateL();
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
/**
|
sl@0
|
526 |
Gets a list of the supported bit rates for the conversion destination.
|
sl@0
|
527 |
|
sl@0
|
528 |
@param aSupportedBitRates
|
sl@0
|
529 |
The list of bit rates supported for the conversion destination.
|
sl@0
|
530 |
|
sl@0
|
531 |
@since 7.0s
|
sl@0
|
532 |
*/
|
sl@0
|
533 |
EXPORT_C void CMdaAudioConvertUtility::GetSupportedConversionBitRatesL(RArray<TUint>& aSupportedBitRates)
|
sl@0
|
534 |
{
|
sl@0
|
535 |
ASSERT(iProperties);
|
sl@0
|
536 |
iProperties->GetSupportedConversionBitRatesL(aSupportedBitRates);
|
sl@0
|
537 |
}
|
sl@0
|
538 |
|
sl@0
|
539 |
/**
|
sl@0
|
540 |
Returns the bit rate of the source audio clip.
|
sl@0
|
541 |
|
sl@0
|
542 |
@return The source bit rate in bits/second.
|
sl@0
|
543 |
|
sl@0
|
544 |
@since 7.0s
|
sl@0
|
545 |
*/
|
sl@0
|
546 |
EXPORT_C TInt CMdaAudioConvertUtility::SourceBitRateL()
|
sl@0
|
547 |
{
|
sl@0
|
548 |
ASSERT(iProperties);
|
sl@0
|
549 |
return iProperties->SourceBitRateL();
|
sl@0
|
550 |
}
|
sl@0
|
551 |
|
sl@0
|
552 |
/**
|
sl@0
|
553 |
Sets the sample rate for the conversion destination.
|
sl@0
|
554 |
|
sl@0
|
555 |
The sample rate must be one of the supported sample rates of the audio target. Use
|
sl@0
|
556 |
GetSupportedConversionSampleRatesL() to retrieve a list of supported sample rates.
|
sl@0
|
557 |
This function should not be used if the audio clip already exists; that is, in the
|
sl@0
|
558 |
"Open and Append" scenario, when the function's behaviour is undefined.
|
sl@0
|
559 |
|
sl@0
|
560 |
@param aSampleRate
|
sl@0
|
561 |
The sample rate of the conversion destination in samples per second.
|
sl@0
|
562 |
|
sl@0
|
563 |
@since 7.0s
|
sl@0
|
564 |
*/
|
sl@0
|
565 |
EXPORT_C void CMdaAudioConvertUtility::SetDestinationSampleRateL(TUint aSampleRate)
|
sl@0
|
566 |
{
|
sl@0
|
567 |
ASSERT(iProperties);
|
sl@0
|
568 |
iProperties->SetDestinationSampleRateL(aSampleRate);
|
sl@0
|
569 |
}
|
sl@0
|
570 |
|
sl@0
|
571 |
/**
|
sl@0
|
572 |
Returns the sample rate of the conversion destination.
|
sl@0
|
573 |
|
sl@0
|
574 |
@return The sample rate of the conversion destination in samples per second.
|
sl@0
|
575 |
|
sl@0
|
576 |
@since 7.0s
|
sl@0
|
577 |
*/
|
sl@0
|
578 |
EXPORT_C TUint CMdaAudioConvertUtility::DestinationSampleRateL()
|
sl@0
|
579 |
{
|
sl@0
|
580 |
ASSERT(iProperties);
|
sl@0
|
581 |
return iProperties->DestinationSampleRateL();
|
sl@0
|
582 |
}
|
sl@0
|
583 |
|
sl@0
|
584 |
/**
|
sl@0
|
585 |
Gets a list of supported conversion sample rates. This is a list of the sample rates that
|
sl@0
|
586 |
the conversion destination can take.
|
sl@0
|
587 |
|
sl@0
|
588 |
@param aSupportedSampleRates
|
sl@0
|
589 |
A list of the sample rates that are supported for the conversion.
|
sl@0
|
590 |
|
sl@0
|
591 |
@since 7.0s
|
sl@0
|
592 |
*/
|
sl@0
|
593 |
EXPORT_C void CMdaAudioConvertUtility::GetSupportedConversionSampleRatesL(RArray<TUint>& aSupportedSampleRates)
|
sl@0
|
594 |
{
|
sl@0
|
595 |
ASSERT(iProperties);
|
sl@0
|
596 |
iProperties->GetSupportedConversionSampleRatesL(aSupportedSampleRates);
|
sl@0
|
597 |
}
|
sl@0
|
598 |
|
sl@0
|
599 |
/**
|
sl@0
|
600 |
Returns the sample rate of the source audio clip.
|
sl@0
|
601 |
|
sl@0
|
602 |
@return The source sample rate in samples/second.
|
sl@0
|
603 |
|
sl@0
|
604 |
@since 7.0s
|
sl@0
|
605 |
*/
|
sl@0
|
606 |
EXPORT_C TUint CMdaAudioConvertUtility::SourceSampleRateL()
|
sl@0
|
607 |
{
|
sl@0
|
608 |
ASSERT(iProperties);
|
sl@0
|
609 |
return iProperties->SourceSampleRateL();
|
sl@0
|
610 |
}
|
sl@0
|
611 |
|
sl@0
|
612 |
/**
|
sl@0
|
613 |
Sets the format of the destination audio clip.
|
sl@0
|
614 |
|
sl@0
|
615 |
The UID (aFormatUid) corresponds to the UID of the destination format to use.
|
sl@0
|
616 |
|
sl@0
|
617 |
@param aFormatUid
|
sl@0
|
618 |
The UID of the destination format.
|
sl@0
|
619 |
|
sl@0
|
620 |
@since 7.0s
|
sl@0
|
621 |
*/
|
sl@0
|
622 |
EXPORT_C void CMdaAudioConvertUtility::SetDestinationFormatL(TUid aFormatUid)
|
sl@0
|
623 |
{
|
sl@0
|
624 |
ASSERT(iProperties);
|
sl@0
|
625 |
iProperties->SetDestinationFormatL(aFormatUid);
|
sl@0
|
626 |
}
|
sl@0
|
627 |
|
sl@0
|
628 |
/**
|
sl@0
|
629 |
Returns the format of the destination audio clip.
|
sl@0
|
630 |
|
sl@0
|
631 |
@return The UID of the destination format.
|
sl@0
|
632 |
|
sl@0
|
633 |
@since 7.0s
|
sl@0
|
634 |
*/
|
sl@0
|
635 |
EXPORT_C TUid CMdaAudioConvertUtility::DestinationFormatL()
|
sl@0
|
636 |
{
|
sl@0
|
637 |
ASSERT(iProperties);
|
sl@0
|
638 |
return iProperties->DestinationFormatL();
|
sl@0
|
639 |
}
|
sl@0
|
640 |
|
sl@0
|
641 |
/**
|
sl@0
|
642 |
Returns the format of the source audio clip.
|
sl@0
|
643 |
|
sl@0
|
644 |
@return The UID of the source format.
|
sl@0
|
645 |
|
sl@0
|
646 |
@since 7.0s
|
sl@0
|
647 |
*/
|
sl@0
|
648 |
EXPORT_C TUid CMdaAudioConvertUtility::SourceFormatL()
|
sl@0
|
649 |
{
|
sl@0
|
650 |
ASSERT(iProperties);
|
sl@0
|
651 |
return iProperties->SourceFormatL();
|
sl@0
|
652 |
}
|
sl@0
|
653 |
|
sl@0
|
654 |
/**
|
sl@0
|
655 |
Sets the number of channels the destination audio clip contains.
|
sl@0
|
656 |
|
sl@0
|
657 |
The number of channels must be one of the values returned by
|
sl@0
|
658 |
GetSupportedConversionNumberOfChannelsL().
|
sl@0
|
659 |
|
sl@0
|
660 |
@param aNumberOfChannels
|
sl@0
|
661 |
The number of channels.
|
sl@0
|
662 |
|
sl@0
|
663 |
@since 7.0s
|
sl@0
|
664 |
*/
|
sl@0
|
665 |
EXPORT_C void CMdaAudioConvertUtility::SetDestinationNumberOfChannelsL(TUint aNumberOfChannels)
|
sl@0
|
666 |
{
|
sl@0
|
667 |
ASSERT(iProperties);
|
sl@0
|
668 |
iProperties->SetDestinationNumberOfChannelsL(aNumberOfChannels);
|
sl@0
|
669 |
}
|
sl@0
|
670 |
|
sl@0
|
671 |
/**
|
sl@0
|
672 |
Returns the number of channels the destination audio clip contains.
|
sl@0
|
673 |
|
sl@0
|
674 |
@return The number of channels.
|
sl@0
|
675 |
|
sl@0
|
676 |
@since 7.0s
|
sl@0
|
677 |
*/
|
sl@0
|
678 |
EXPORT_C TUint CMdaAudioConvertUtility::DestinationNumberOfChannelsL()
|
sl@0
|
679 |
{
|
sl@0
|
680 |
ASSERT(iProperties);
|
sl@0
|
681 |
return iProperties->DestinationNumberOfChannelsL();
|
sl@0
|
682 |
}
|
sl@0
|
683 |
|
sl@0
|
684 |
/**
|
sl@0
|
685 |
Returns a list of the supported number of channels for conversion.
|
sl@0
|
686 |
|
sl@0
|
687 |
For example, 1 for mono, 2 for stereo and so on.
|
sl@0
|
688 |
|
sl@0
|
689 |
@param aSupportedNumChannels
|
sl@0
|
690 |
A list of the number of channels supported for the conversion destination.
|
sl@0
|
691 |
|
sl@0
|
692 |
@since 7.0s
|
sl@0
|
693 |
*/
|
sl@0
|
694 |
EXPORT_C void CMdaAudioConvertUtility::GetSupportedConversionNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels)
|
sl@0
|
695 |
{
|
sl@0
|
696 |
ASSERT(iProperties);
|
sl@0
|
697 |
iProperties->GetSupportedConversionNumberOfChannelsL(aSupportedNumChannels);
|
sl@0
|
698 |
}
|
sl@0
|
699 |
|
sl@0
|
700 |
/**
|
sl@0
|
701 |
Returns the number of channels used by the conversion source.
|
sl@0
|
702 |
|
sl@0
|
703 |
@return The number of channels.
|
sl@0
|
704 |
|
sl@0
|
705 |
@since 7.0s
|
sl@0
|
706 |
*/
|
sl@0
|
707 |
EXPORT_C TUint CMdaAudioConvertUtility::SourceNumberOfChannelsL()
|
sl@0
|
708 |
{
|
sl@0
|
709 |
ASSERT(iProperties);
|
sl@0
|
710 |
return iProperties->SourceNumberOfChannelsL();
|
sl@0
|
711 |
}
|
sl@0
|
712 |
/**
|
sl@0
|
713 |
Performs the conversion from the source audio format to the destination.
|
sl@0
|
714 |
|
sl@0
|
715 |
When conversion is complete, successfully or otherwise, the client is notified by
|
sl@0
|
716 |
MMdaObjectStateChangeObserver::MoscoStateChangeEvent(). The callback is initiated by this function
|
sl@0
|
717 |
providing it with state change information and error codes.
|
sl@0
|
718 |
|
sl@0
|
719 |
@since 7.0s
|
sl@0
|
720 |
*/
|
sl@0
|
721 |
EXPORT_C void CMdaAudioConvertUtility::ConvertL()
|
sl@0
|
722 |
{
|
sl@0
|
723 |
ASSERT(iProperties);
|
sl@0
|
724 |
iProperties->ConvertL();
|
sl@0
|
725 |
}
|
sl@0
|
726 |
|
sl@0
|
727 |
/**
|
sl@0
|
728 |
Returns the controller implementation information associated with the current controller.
|
sl@0
|
729 |
|
sl@0
|
730 |
@return The controller implementation structure associated with the controller
|
sl@0
|
731 |
|
sl@0
|
732 |
@since 7.0s
|
sl@0
|
733 |
*/
|
sl@0
|
734 |
EXPORT_C const CMMFControllerImplementationInformation& CMdaAudioConvertUtility::ControllerImplementationInformationL()
|
sl@0
|
735 |
{
|
sl@0
|
736 |
ASSERT(iProperties);
|
sl@0
|
737 |
return iProperties->ControllerImplementationInformationL();
|
sl@0
|
738 |
}
|
sl@0
|
739 |
|
sl@0
|
740 |
/**
|
sl@0
|
741 |
Sends a synchronous custom command to the controller.
|
sl@0
|
742 |
|
sl@0
|
743 |
@param aDestination
|
sl@0
|
744 |
The destination of the message, consisting of the UID of the interface of this message.
|
sl@0
|
745 |
@param aFunction
|
sl@0
|
746 |
The function number to indicate which function is to be called
|
sl@0
|
747 |
on the interface defined in the aDestination parameter.
|
sl@0
|
748 |
@param aDataTo1
|
sl@0
|
749 |
A reference to the first chunk of data to be copied to the controller
|
sl@0
|
750 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
751 |
interface being called. Can be KNullDesC8.
|
sl@0
|
752 |
@param aDataTo2
|
sl@0
|
753 |
A reference to the second chunk of data to be copied to the controller
|
sl@0
|
754 |
framework. The exact contents of the data are dependent on the
|
sl@0
|
755 |
interface being called. Can be KNullDesC8.
|
sl@0
|
756 |
@param aDataFrom
|
sl@0
|
757 |
A reference to an area of memory to which the controller framework will
|
sl@0
|
758 |
write any data to be passed back to the client. Can't be KNullDesC8.
|
sl@0
|
759 |
|
sl@0
|
760 |
@return The result of the request. Exact range of values is dependent on the interface.
|
sl@0
|
761 |
|
sl@0
|
762 |
@since 7.0s
|
sl@0
|
763 |
*/
|
sl@0
|
764 |
EXPORT_C TInt CMdaAudioConvertUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
|
sl@0
|
765 |
{
|
sl@0
|
766 |
ASSERT(iProperties);
|
sl@0
|
767 |
return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
|
sl@0
|
768 |
}
|
sl@0
|
769 |
|
sl@0
|
770 |
/**
|
sl@0
|
771 |
Sends a synchronous custom command to the controller.
|
sl@0
|
772 |
|
sl@0
|
773 |
@param aDestination
|
sl@0
|
774 |
The destination of the message, consisting of the UID of the interface of this message.
|
sl@0
|
775 |
@param aFunction
|
sl@0
|
776 |
The function number to indicate which function is to be called on the interface defined in
|
sl@0
|
777 |
the aDestination parameter.
|
sl@0
|
778 |
@param aDataTo1
|
sl@0
|
779 |
A reference to the first chunk of data to be copied to the controllert framework. The exact
|
sl@0
|
780 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
781 |
@param aDataTo2
|
sl@0
|
782 |
A reference to the second chunk of data to be copied to the controller framework. The exact
|
sl@0
|
783 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
784 |
|
sl@0
|
785 |
@return The result of the request. The 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 CMdaAudioConvertUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
|
sl@0
|
790 |
{
|
sl@0
|
791 |
ASSERT(iProperties);
|
sl@0
|
792 |
return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
|
sl@0
|
793 |
}
|
sl@0
|
794 |
|
sl@0
|
795 |
/**
|
sl@0
|
796 |
Send a asynchronous custom command to the controller.
|
sl@0
|
797 |
|
sl@0
|
798 |
Note: This method will return immediately. The RunL of the active object owning the
|
sl@0
|
799 |
aStatus parameter will be called when the command is completed by the controller framework.
|
sl@0
|
800 |
|
sl@0
|
801 |
@param aDestination
|
sl@0
|
802 |
The destination of the message, consisting of the UID of the interface of this message.
|
sl@0
|
803 |
@param aFunction
|
sl@0
|
804 |
The function number to indicate which function is to be called on the interface defined in
|
sl@0
|
805 |
the aDestination parameter.
|
sl@0
|
806 |
@param aDataTo1
|
sl@0
|
807 |
A reference to the first chunk of data to be copied to the controller framework. The exact
|
sl@0
|
808 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
809 |
@param aDataTo2
|
sl@0
|
810 |
A reference to the second chunk of data to be copied to the controller framework. The exact
|
sl@0
|
811 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
812 |
@param aDataFrom
|
sl@0
|
813 |
A reference to an area of memory to which the controller framework will write any data to be
|
sl@0
|
814 |
passed back to the client. Can't be KNullDesC8.
|
sl@0
|
815 |
@param aStatus
|
sl@0
|
816 |
The TRequestStatus of an active object. This will contain the result of the request on
|
sl@0
|
817 |
completion. The exact range of result values is dependent on the interface.
|
sl@0
|
818 |
@since 7.0s
|
sl@0
|
819 |
*/
|
sl@0
|
820 |
EXPORT_C void CMdaAudioConvertUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
|
sl@0
|
821 |
{
|
sl@0
|
822 |
ASSERT(iProperties);
|
sl@0
|
823 |
iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
|
sl@0
|
824 |
}
|
sl@0
|
825 |
|
sl@0
|
826 |
/**
|
sl@0
|
827 |
Send a asynchronous custom command to the controller.
|
sl@0
|
828 |
|
sl@0
|
829 |
Note: This method will return immediately. The RunL of the active object owning the
|
sl@0
|
830 |
aStatus parameter will be called when the command is completed by the controller framework.
|
sl@0
|
831 |
|
sl@0
|
832 |
@param aDestination
|
sl@0
|
833 |
The destination of the message, consisting of the UID of the interface of this message.
|
sl@0
|
834 |
@param aFunction
|
sl@0
|
835 |
The function number to indicate which function is to be called on the interface defined in
|
sl@0
|
836 |
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 framework. The exact
|
sl@0
|
839 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
840 |
@param aDataTo2
|
sl@0
|
841 |
A reference to the second chunk of data to be copied to the controller framework. The exact
|
sl@0
|
842 |
contents of the data are dependent on the interface being called. Can be KNullDesC8.
|
sl@0
|
843 |
@param aStatus
|
sl@0
|
844 |
The TRequestStatus of an active object. This will contain the result of the request on
|
sl@0
|
845 |
completion. The exact range of result values is dependent on the interface.
|
sl@0
|
846 |
|
sl@0
|
847 |
@since 7.0s
|
sl@0
|
848 |
*/
|
sl@0
|
849 |
EXPORT_C void CMdaAudioConvertUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
|
sl@0
|
850 |
{
|
sl@0
|
851 |
ASSERT(iProperties);
|
sl@0
|
852 |
iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
|
sl@0
|
853 |
}
|
sl@0
|
854 |
|
sl@0
|
855 |
/**
|
sl@0
|
856 |
Set the priority of the controller's sub thread.
|
sl@0
|
857 |
|
sl@0
|
858 |
This can be used to increase the responsiveness of the audio plugin to minimise
|
sl@0
|
859 |
any lag in processing. This function should be used with care as it may have knock-on
|
sl@0
|
860 |
effects elsewhere in the system.
|
sl@0
|
861 |
|
sl@0
|
862 |
@param aPriority
|
sl@0
|
863 |
The TThreadPriority that the thread should run under. The default is EPriorityNormal.
|
sl@0
|
864 |
@return TInt
|
sl@0
|
865 |
A standard error code: KErrNone if successful, KErrNotReady if the thread does not have a
|
sl@0
|
866 |
valid handle.
|
sl@0
|
867 |
*/
|
sl@0
|
868 |
EXPORT_C TInt CMdaAudioConvertUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
|
sl@0
|
869 |
{
|
sl@0
|
870 |
ASSERT(iProperties);
|
sl@0
|
871 |
return iProperties->SetThreadPriority(aThreadPriority);
|
sl@0
|
872 |
}
|
sl@0
|
873 |
|
sl@0
|
874 |
|
sl@0
|
875 |
/******************************************************************************/
|
sl@0
|
876 |
|
sl@0
|
877 |
|
sl@0
|
878 |
CMMFMdaAudioConvertUtility::CMMFMdaAudioConvertUtility(CMdaAudioConvertUtility* aParent,
|
sl@0
|
879 |
MMdaObjectStateChangeObserver& aCallback) :
|
sl@0
|
880 |
iCallback(aCallback),
|
sl@0
|
881 |
iAudioControllerCustomCommands(iController),
|
sl@0
|
882 |
iAudioPlayControllerCustomCommands(iController),
|
sl@0
|
883 |
iAudioRecordControllerCustomCommands(iController),
|
sl@0
|
884 |
iParent(aParent),
|
sl@0
|
885 |
iHasCropped(EFalse),
|
sl@0
|
886 |
iCroppedDuration(0)
|
sl@0
|
887 |
{
|
sl@0
|
888 |
iConvertStart = TTimeIntervalMicroSeconds(0);
|
sl@0
|
889 |
iConvertEnd = TTimeIntervalMicroSeconds(0);
|
sl@0
|
890 |
iConvertWindowSet = EFalse;
|
sl@0
|
891 |
}
|
sl@0
|
892 |
|
sl@0
|
893 |
void CMMFMdaAudioConvertUtility::ConstructL(TInt /*aPriority*/, TInt /*aPref*/)
|
sl@0
|
894 |
{
|
sl@0
|
895 |
iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController);
|
sl@0
|
896 |
iAsyncCallback = CMMFMdaObjectStateChangeObserverCallback::NewL(iCallback);
|
sl@0
|
897 |
User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio));
|
sl@0
|
898 |
iFindAndOpenController = CMMFFindAndOpenController::NewL(*this);
|
sl@0
|
899 |
iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
|
sl@0
|
900 |
iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EConvert);
|
sl@0
|
901 |
}
|
sl@0
|
902 |
|
sl@0
|
903 |
CMMFMdaAudioConvertUtility::~CMMFMdaAudioConvertUtility()
|
sl@0
|
904 |
{
|
sl@0
|
905 |
delete iControllerImplementationInformation;
|
sl@0
|
906 |
delete iAsyncCallback;
|
sl@0
|
907 |
delete iFindAndOpenController;
|
sl@0
|
908 |
delete iControllerEventMonitor;
|
sl@0
|
909 |
iMediaIds.Close();
|
sl@0
|
910 |
iController.Close();
|
sl@0
|
911 |
}
|
sl@0
|
912 |
|
sl@0
|
913 |
void CMMFMdaAudioConvertUtility::UseSharedHeap()
|
sl@0
|
914 |
{
|
sl@0
|
915 |
iFindAndOpenController->UseSharedHeap();
|
sl@0
|
916 |
}
|
sl@0
|
917 |
|
sl@0
|
918 |
void CMMFMdaAudioConvertUtility::MfaocComplete(
|
sl@0
|
919 |
TInt& aError,
|
sl@0
|
920 |
RMMFController* /*aController*/,
|
sl@0
|
921 |
TUid aControllerUid,
|
sl@0
|
922 |
TMMFMessageDestination* /*aSourceHandle*/,
|
sl@0
|
923 |
TMMFMessageDestination* /*aSinkHandle*/)
|
sl@0
|
924 |
{
|
sl@0
|
925 |
TInt oldState = iState;
|
sl@0
|
926 |
|
sl@0
|
927 |
if (aError == KErrNone)
|
sl@0
|
928 |
{
|
sl@0
|
929 |
iControllerUid = aControllerUid;
|
sl@0
|
930 |
aError = ControllerOpen();
|
sl@0
|
931 |
if (iFindAndOpenController)
|
sl@0
|
932 |
{
|
sl@0
|
933 |
iFindAndOpenController->Close();
|
sl@0
|
934 |
}
|
sl@0
|
935 |
}
|
sl@0
|
936 |
|
sl@0
|
937 |
iAsyncCallback->CallBack(iParent, oldState, iState, aError);
|
sl@0
|
938 |
}
|
sl@0
|
939 |
|
sl@0
|
940 |
void CMMFMdaAudioConvertUtility::OpenL(TMdaClipLocation* aPriLocation,
|
sl@0
|
941 |
TMdaClipLocation* aSecLocation,
|
sl@0
|
942 |
TMdaClipFormat* aPriFormat,
|
sl@0
|
943 |
TMdaClipFormat* aSecFormat,
|
sl@0
|
944 |
TMdaPackage* aPriArg1 /*= NULL*/,
|
sl@0
|
945 |
TMdaPackage* aPriArg2 /*= NULL*/,
|
sl@0
|
946 |
TMdaPackage* aSecArg1 /*= NULL*/,
|
sl@0
|
947 |
TMdaPackage* aSecArg2 /*= NULL*/)
|
sl@0
|
948 |
{
|
sl@0
|
949 |
__ASSERT_ALWAYS((aPriLocation && aSecLocation && aPriFormat && aSecFormat), User::Leave(KErrArgument));
|
sl@0
|
950 |
|
sl@0
|
951 |
__ASSERT_ALWAYS((((aPriLocation->Uid() == KUidMdaFileResLoc) || (aPriLocation->Uid() == KUidMdaDesResLoc) || (aPriLocation->Uid() == KUidMdaUrlResLoc)) &&
|
sl@0
|
952 |
((aSecLocation->Uid() == KUidMdaFileResLoc) || (aSecLocation->Uid() == KUidMdaDesResLoc) || (aSecLocation->Uid() == KUidMdaUrlResLoc))),
|
sl@0
|
953 |
User::Leave(KErrNotSupported));
|
sl@0
|
954 |
|
sl@0
|
955 |
__ASSERT_ALWAYS(((aPriFormat->Uid() != KNullUid) && (aSecFormat->Uid() != KNullUid)), User::Leave(KErrNotSupported));
|
sl@0
|
956 |
|
sl@0
|
957 |
Reset();
|
sl@0
|
958 |
|
sl@0
|
959 |
//Do aPriArg2 & aSecArg2 contain the correct package type
|
sl@0
|
960 |
if(aPriArg2)
|
sl@0
|
961 |
{
|
sl@0
|
962 |
TMdaPackage* pckg = aPriArg2;
|
sl@0
|
963 |
if(pckg->Uid() != KUidMdaMediaTypeAudio)
|
sl@0
|
964 |
User::Leave(KErrNotSupported);
|
sl@0
|
965 |
|
sl@0
|
966 |
TMdaAudioDataSettings audioSettings = *(TMdaAudioDataSettings*)aPriArg2;
|
sl@0
|
967 |
iSourceSampleRate = audioSettings.iSampleRate;
|
sl@0
|
968 |
iSourceChannels = audioSettings.iChannels;
|
sl@0
|
969 |
}
|
sl@0
|
970 |
|
sl@0
|
971 |
if(aSecArg2)
|
sl@0
|
972 |
{
|
sl@0
|
973 |
TMdaPackage* pckg = aSecArg2;
|
sl@0
|
974 |
if(pckg->Uid() != KUidMdaMediaTypeAudio)
|
sl@0
|
975 |
User::Leave(KErrNotSupported);
|
sl@0
|
976 |
TMdaAudioDataSettings audioSettings = *(TMdaAudioDataSettings*)aSecArg2;
|
sl@0
|
977 |
iSinkSampleRate = audioSettings.iSampleRate;
|
sl@0
|
978 |
iSinkChannels = audioSettings.iChannels;
|
sl@0
|
979 |
}
|
sl@0
|
980 |
|
sl@0
|
981 |
|
sl@0
|
982 |
//Do aPriArg1 & aSecArg1 contain supported FourCC types
|
sl@0
|
983 |
iSourceDataType = KMMFFourCCCodeNULL;
|
sl@0
|
984 |
if (aPriArg1)
|
sl@0
|
985 |
{
|
sl@0
|
986 |
iSourceDataType = CMMFClientUtility::ConvertMdaCodecToFourCC(*aPriArg1);
|
sl@0
|
987 |
if(iSourceDataType == KMMFFourCCCodeNULL)
|
sl@0
|
988 |
User::Leave(KErrNotSupported);
|
sl@0
|
989 |
}
|
sl@0
|
990 |
|
sl@0
|
991 |
iSinkDataType = KMMFFourCCCodeNULL;
|
sl@0
|
992 |
if (aSecArg1)
|
sl@0
|
993 |
{
|
sl@0
|
994 |
iSinkDataType = CMMFClientUtility::ConvertMdaCodecToFourCC(*aSecArg1);
|
sl@0
|
995 |
if(iSinkDataType == KMMFFourCCCodeNULL)
|
sl@0
|
996 |
User::Leave(KErrNotSupported);
|
sl@0
|
997 |
}
|
sl@0
|
998 |
|
sl@0
|
999 |
|
sl@0
|
1000 |
|
sl@0
|
1001 |
TInt err = KErrNone;
|
sl@0
|
1002 |
|
sl@0
|
1003 |
iSourceFormatUid = CMMFClientUtility::ConvertMdaFormatUidToECOMRead(aPriFormat->Uid());
|
sl@0
|
1004 |
//If a new formatter plugin has been added, use the supplied read format implementation ID
|
sl@0
|
1005 |
if (iSourceFormatUid == KNullUid)
|
sl@0
|
1006 |
iSourceFormatUid = aPriFormat->Uid();
|
sl@0
|
1007 |
|
sl@0
|
1008 |
iSinkFormatUid = CMMFClientUtility::ConvertMdaFormatUidToECOMWrite(aSecFormat->Uid());
|
sl@0
|
1009 |
//If a new formatter plugin has been added, use the supplied write format implementation ID
|
sl@0
|
1010 |
if (iSinkFormatUid == KNullUid)
|
sl@0
|
1011 |
iSinkFormatUid = aSecFormat->Uid();
|
sl@0
|
1012 |
|
sl@0
|
1013 |
TRAP(err, ConfigureSourceSinkL(aPriLocation, aSecLocation));
|
sl@0
|
1014 |
|
sl@0
|
1015 |
if (!err)
|
sl@0
|
1016 |
iFindAndOpenController->OpenByFormatUid(iSourceFormatUid, iSinkFormatUid);
|
sl@0
|
1017 |
|
sl@0
|
1018 |
if (err)
|
sl@0
|
1019 |
{
|
sl@0
|
1020 |
TInt oldState = State();
|
sl@0
|
1021 |
iAsyncCallback->CallBack(iParent, oldState, oldState, err);
|
sl@0
|
1022 |
return;
|
sl@0
|
1023 |
}
|
sl@0
|
1024 |
}
|
sl@0
|
1025 |
|
sl@0
|
1026 |
|
sl@0
|
1027 |
|
sl@0
|
1028 |
|
sl@0
|
1029 |
void CMMFMdaAudioConvertUtility::OpenL(const TDesC& aPrimaryFile, const TDesC& aSecondaryFile)
|
sl@0
|
1030 |
{
|
sl@0
|
1031 |
Reset();
|
sl@0
|
1032 |
|
sl@0
|
1033 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1034 |
CMMFFindAndOpenController::TSourceSink(KUidMmfFileSource, CMMFFindAndOpenController::GetConfigFile(aPrimaryFile)),
|
sl@0
|
1035 |
CMMFFindAndOpenController::TSourceSink(KUidMmfFileSink, CMMFFindAndOpenController::GetConfigFile(aSecondaryFile)));
|
sl@0
|
1036 |
|
sl@0
|
1037 |
TMMFileSource tfs(aPrimaryFile);
|
sl@0
|
1038 |
iFindAndOpenController->OpenByFileSource(tfs, aSecondaryFile);
|
sl@0
|
1039 |
}
|
sl@0
|
1040 |
|
sl@0
|
1041 |
void CMMFMdaAudioConvertUtility::OpenL(const TDesC& aPrimaryFile,
|
sl@0
|
1042 |
TMdaClipLocation* aLocation, // Normally file or descriptor
|
sl@0
|
1043 |
TMdaClipFormat* aFormat, // Data format
|
sl@0
|
1044 |
TMdaPackage* aArg1, // Normally codec to use
|
sl@0
|
1045 |
TMdaPackage* aArg2) // Normally audio settings
|
sl@0
|
1046 |
{
|
sl@0
|
1047 |
__ASSERT_ALWAYS(aLocation && aFormat, User::Leave(KErrArgument));
|
sl@0
|
1048 |
|
sl@0
|
1049 |
Reset();
|
sl@0
|
1050 |
|
sl@0
|
1051 |
// convert from the old parameters
|
sl@0
|
1052 |
if (aFormat)
|
sl@0
|
1053 |
{
|
sl@0
|
1054 |
iSinkFormatUid = CMMFClientUtility::ConvertMdaFormatUidToECOMWrite(aFormat->Uid());
|
sl@0
|
1055 |
|
sl@0
|
1056 |
//If a new formatter plugin has been added, use the supplied format ID
|
sl@0
|
1057 |
if (iSinkFormatUid == KNullUid)
|
sl@0
|
1058 |
iSinkFormatUid = aFormat->Uid();
|
sl@0
|
1059 |
}
|
sl@0
|
1060 |
|
sl@0
|
1061 |
if (aArg1)
|
sl@0
|
1062 |
iSinkDataType = CMMFClientUtility::ConvertMdaCodecToFourCC(*aArg1);
|
sl@0
|
1063 |
|
sl@0
|
1064 |
if (aArg2)
|
sl@0
|
1065 |
{//have audio settings
|
sl@0
|
1066 |
TMdaAudioDataSettings audioSettings = *(TMdaAudioDataSettings*)aArg2; //shoud check arg2 are data settings
|
sl@0
|
1067 |
iSinkSampleRate = audioSettings.iSampleRate;
|
sl@0
|
1068 |
iSinkChannels = audioSettings.iChannels;
|
sl@0
|
1069 |
}
|
sl@0
|
1070 |
|
sl@0
|
1071 |
|
sl@0
|
1072 |
|
sl@0
|
1073 |
TMMFFileConfig sourceCfg;
|
sl@0
|
1074 |
sourceCfg().iPath = aPrimaryFile;
|
sl@0
|
1075 |
|
sl@0
|
1076 |
TMMFDescriptorConfig dstDesCfg;
|
sl@0
|
1077 |
TMMFFileConfig dstFileCfg;
|
sl@0
|
1078 |
CBufFlat* dstCfgBuffer = NULL;
|
sl@0
|
1079 |
CMMFUrlParams* dstURLCfg = NULL;
|
sl@0
|
1080 |
TUid dstUid = KNullUid;
|
sl@0
|
1081 |
TPtrC8 dstCfg(NULL, 0);
|
sl@0
|
1082 |
|
sl@0
|
1083 |
TInt err = KErrNone;
|
sl@0
|
1084 |
|
sl@0
|
1085 |
if (aLocation->Uid() == KUidMdaFileResLoc)
|
sl@0
|
1086 |
{//sink clip location is a file
|
sl@0
|
1087 |
TDesC& fileName = ((TMdaFileClipLocation*)aLocation)->iName;
|
sl@0
|
1088 |
dstFileCfg().iPath = fileName;
|
sl@0
|
1089 |
dstCfg.Set(dstFileCfg);
|
sl@0
|
1090 |
dstUid = KUidMmfFileSink;
|
sl@0
|
1091 |
}
|
sl@0
|
1092 |
else if (aLocation->Uid() == KUidMdaDesResLoc)
|
sl@0
|
1093 |
{//sink clip is a descriptor - pass down descriptor & thread id
|
sl@0
|
1094 |
TMdaDesClipLocation* desLoc = (TMdaDesClipLocation*)aLocation;
|
sl@0
|
1095 |
dstDesCfg().iDes = desLoc->iDes;
|
sl@0
|
1096 |
dstDesCfg().iDesThreadId = desLoc->iThreadId;
|
sl@0
|
1097 |
dstCfg.Set(dstDesCfg);
|
sl@0
|
1098 |
dstUid = KUidMmfDescriptorSink;
|
sl@0
|
1099 |
}
|
sl@0
|
1100 |
else if (aLocation->Uid() == KUidMdaUrlResLoc)
|
sl@0
|
1101 |
{
|
sl@0
|
1102 |
TMdaUrlClipLocation* desLoc = (TMdaUrlClipLocation*)aLocation;
|
sl@0
|
1103 |
dstURLCfg = CMMFUrlParams::NewLC(desLoc->iUrl, desLoc->iIapId);
|
sl@0
|
1104 |
dstCfgBuffer = dstURLCfg->ExternalizeToCBufFlatLC();
|
sl@0
|
1105 |
dstCfg.Set(dstCfgBuffer->Ptr(0));
|
sl@0
|
1106 |
dstUid = KUidMmfUrlSink;
|
sl@0
|
1107 |
}
|
sl@0
|
1108 |
else
|
sl@0
|
1109 |
err = KErrNotSupported;
|
sl@0
|
1110 |
|
sl@0
|
1111 |
if (!err)
|
sl@0
|
1112 |
{
|
sl@0
|
1113 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1114 |
CMMFFindAndOpenController::TSourceSink(KUidMmfFileSource, sourceCfg),
|
sl@0
|
1115 |
CMMFFindAndOpenController::TSourceSink(dstUid, dstCfg));
|
sl@0
|
1116 |
|
sl@0
|
1117 |
TMMFileSource tfs(aPrimaryFile);
|
sl@0
|
1118 |
iFindAndOpenController->OpenByFileSource(tfs);
|
sl@0
|
1119 |
}
|
sl@0
|
1120 |
|
sl@0
|
1121 |
|
sl@0
|
1122 |
|
sl@0
|
1123 |
if (dstCfgBuffer)
|
sl@0
|
1124 |
CleanupStack::PopAndDestroy(dstCfgBuffer);
|
sl@0
|
1125 |
if (dstURLCfg)
|
sl@0
|
1126 |
CleanupStack::PopAndDestroy(dstURLCfg);
|
sl@0
|
1127 |
|
sl@0
|
1128 |
|
sl@0
|
1129 |
if (err)
|
sl@0
|
1130 |
{
|
sl@0
|
1131 |
TInt oldState = State();
|
sl@0
|
1132 |
iAsyncCallback->CallBack(iParent, oldState, oldState, err);
|
sl@0
|
1133 |
return;
|
sl@0
|
1134 |
}
|
sl@0
|
1135 |
}
|
sl@0
|
1136 |
|
sl@0
|
1137 |
void CMMFMdaAudioConvertUtility::OpenL(TMdaClipLocation* aPriLocation,
|
sl@0
|
1138 |
TMdaClipLocation* aSecLocation,
|
sl@0
|
1139 |
TUid aControllerUid, // the controller to use
|
sl@0
|
1140 |
TUid aDestFormatUid,
|
sl@0
|
1141 |
TFourCC aDestDataType)
|
sl@0
|
1142 |
{
|
sl@0
|
1143 |
__ASSERT_ALWAYS(aPriLocation && aSecLocation, User::Leave(KErrArgument));
|
sl@0
|
1144 |
|
sl@0
|
1145 |
Reset();
|
sl@0
|
1146 |
|
sl@0
|
1147 |
|
sl@0
|
1148 |
// Configure the destination format and data type
|
sl@0
|
1149 |
if (aDestFormatUid != KNullUid)
|
sl@0
|
1150 |
iSinkFormatUid = aDestFormatUid;
|
sl@0
|
1151 |
|
sl@0
|
1152 |
if (aDestDataType != KMMFFourCCCodeNULL)
|
sl@0
|
1153 |
iSinkDataType = aDestDataType;
|
sl@0
|
1154 |
|
sl@0
|
1155 |
TRAPD(err, ConfigureSourceSinkL(aPriLocation, aSecLocation));
|
sl@0
|
1156 |
if (!err)
|
sl@0
|
1157 |
iFindAndOpenController->OpenByControllerUid(aControllerUid);
|
sl@0
|
1158 |
|
sl@0
|
1159 |
|
sl@0
|
1160 |
if (err)
|
sl@0
|
1161 |
{
|
sl@0
|
1162 |
TInt oldState = State();
|
sl@0
|
1163 |
iAsyncCallback->CallBack(iParent, oldState, oldState, err);
|
sl@0
|
1164 |
return;
|
sl@0
|
1165 |
}
|
sl@0
|
1166 |
}
|
sl@0
|
1167 |
|
sl@0
|
1168 |
|
sl@0
|
1169 |
void CMMFMdaAudioConvertUtility::HandleEvent(const TMMFEvent& aEvent)
|
sl@0
|
1170 |
{
|
sl@0
|
1171 |
//When converting, state is EPlaying, ERecording is never used
|
sl@0
|
1172 |
if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete || aEvent.iEventType==KMMFErrorCategoryControllerGeneralError)
|
sl@0
|
1173 |
{
|
sl@0
|
1174 |
TInt oldState = iState;
|
sl@0
|
1175 |
iState = CMdaAudioClipUtility::EOpen;
|
sl@0
|
1176 |
|
sl@0
|
1177 |
//if we weren't converting, don't advise Client.
|
sl@0
|
1178 |
if(oldState == CMdaAudioClipUtility::EPlaying)
|
sl@0
|
1179 |
iCallback.MoscoStateChangeEvent(iParent, CMdaAudioClipUtility::EPlaying, iState, aEvent.iErrorCode);
|
sl@0
|
1180 |
}
|
sl@0
|
1181 |
}
|
sl@0
|
1182 |
|
sl@0
|
1183 |
void CMMFMdaAudioConvertUtility::PlayL()
|
sl@0
|
1184 |
{
|
sl@0
|
1185 |
// N.B. ConvertL should be used in preference to PlayL
|
sl@0
|
1186 |
ConvertL();
|
sl@0
|
1187 |
}
|
sl@0
|
1188 |
|
sl@0
|
1189 |
void CMMFMdaAudioConvertUtility::RecordL()
|
sl@0
|
1190 |
{
|
sl@0
|
1191 |
// N.B. ConvertL should be used in preference to RecordL
|
sl@0
|
1192 |
ConvertL();
|
sl@0
|
1193 |
}
|
sl@0
|
1194 |
|
sl@0
|
1195 |
void CMMFMdaAudioConvertUtility::ConvertL()
|
sl@0
|
1196 |
{
|
sl@0
|
1197 |
if (iState == CMdaAudioClipUtility::EOpen)
|
sl@0
|
1198 |
{
|
sl@0
|
1199 |
TInt err;
|
sl@0
|
1200 |
err = iController.Prime();
|
sl@0
|
1201 |
if (err==KErrNone)
|
sl@0
|
1202 |
{
|
sl@0
|
1203 |
err=iController.SetPosition(iPosition);
|
sl@0
|
1204 |
if (!err && iConvertWindowSet)
|
sl@0
|
1205 |
err = iAudioPlayControllerCustomCommands.SetPlaybackWindow(iConvertStart, iConvertEnd);
|
sl@0
|
1206 |
if (err==KErrNone)
|
sl@0
|
1207 |
err = iController.Play();
|
sl@0
|
1208 |
}
|
sl@0
|
1209 |
|
sl@0
|
1210 |
TInt oldState = iState;
|
sl@0
|
1211 |
if (!err)
|
sl@0
|
1212 |
iState = CMdaAudioClipUtility::EPlaying;
|
sl@0
|
1213 |
|
sl@0
|
1214 |
iAsyncCallback->CallBack(iParent, oldState, iState, err);
|
sl@0
|
1215 |
}
|
sl@0
|
1216 |
else
|
sl@0
|
1217 |
iAsyncCallback->CallBack(iParent, iState, iState, KErrNotReady);
|
sl@0
|
1218 |
}
|
sl@0
|
1219 |
|
sl@0
|
1220 |
void CMMFMdaAudioConvertUtility::Stop()
|
sl@0
|
1221 |
{
|
sl@0
|
1222 |
TInt err = iController.Pause();
|
sl@0
|
1223 |
TInt oldState = iState;
|
sl@0
|
1224 |
if (!err)
|
sl@0
|
1225 |
iState = CMdaAudioClipUtility::EOpen;
|
sl@0
|
1226 |
iAsyncCallback->CallBack(iParent, oldState, iState, err);
|
sl@0
|
1227 |
}
|
sl@0
|
1228 |
|
sl@0
|
1229 |
void CMMFMdaAudioConvertUtility::CropL(TBool aCropToEnd)
|
sl@0
|
1230 |
{
|
sl@0
|
1231 |
// if we are busy converting, or we have not opened the file, return KErrNotReady
|
sl@0
|
1232 |
if (iState!=CMdaAudioClipUtility::EOpen)
|
sl@0
|
1233 |
User::Leave(KErrNotReady);
|
sl@0
|
1234 |
|
sl@0
|
1235 |
// check that cropping position is valid if clip has been cropped before
|
sl@0
|
1236 |
if (iHasCropped && iPosition > iCroppedDuration)
|
sl@0
|
1237 |
{
|
sl@0
|
1238 |
User::Leave(KErrArgument);
|
sl@0
|
1239 |
}
|
sl@0
|
1240 |
|
sl@0
|
1241 |
TInt err = iController.Prime();
|
sl@0
|
1242 |
if (!err)
|
sl@0
|
1243 |
{
|
sl@0
|
1244 |
|
sl@0
|
1245 |
if (!err)
|
sl@0
|
1246 |
err = iController.SetPosition(iPosition);
|
sl@0
|
1247 |
|
sl@0
|
1248 |
err = iAudioRecordControllerCustomCommands.Crop(aCropToEnd);
|
sl@0
|
1249 |
// try to stop controller regardless of whether any of the above commands failed
|
sl@0
|
1250 |
iController.Stop();
|
sl@0
|
1251 |
// save the duration of the cropped clip because
|
sl@0
|
1252 |
// Duration() returns length of the original clip only
|
sl@0
|
1253 |
// this is used to prevent a subsequent crop, beyond the end of the
|
sl@0
|
1254 |
// already cropped clip.
|
sl@0
|
1255 |
if (err == KErrNone)
|
sl@0
|
1256 |
{
|
sl@0
|
1257 |
iHasCropped = ETrue;
|
sl@0
|
1258 |
if (aCropToEnd)
|
sl@0
|
1259 |
iCroppedDuration = iPosition;
|
sl@0
|
1260 |
else
|
sl@0
|
1261 |
iCroppedDuration = TTimeIntervalMicroSeconds(iDuration.Int64() - iPosition.Int64());
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
}
|
sl@0
|
1264 |
User::LeaveIfError(err);
|
sl@0
|
1265 |
}
|
sl@0
|
1266 |
|
sl@0
|
1267 |
void CMMFMdaAudioConvertUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition)
|
sl@0
|
1268 |
{
|
sl@0
|
1269 |
iPosition = aPosition;
|
sl@0
|
1270 |
|
sl@0
|
1271 |
// Clip the position if aPosition is greater than the duration, or less then 0
|
sl@0
|
1272 |
const TTimeIntervalMicroSeconds duration = Duration();
|
sl@0
|
1273 |
if (iPosition > duration)
|
sl@0
|
1274 |
iPosition = duration;
|
sl@0
|
1275 |
else if (iPosition < TTimeIntervalMicroSeconds(0))
|
sl@0
|
1276 |
iPosition = 0;
|
sl@0
|
1277 |
|
sl@0
|
1278 |
if (iState==CMdaAudioClipUtility::EPlaying)
|
sl@0
|
1279 |
iController.SetPosition(iPosition);
|
sl@0
|
1280 |
}
|
sl@0
|
1281 |
|
sl@0
|
1282 |
const TTimeIntervalMicroSeconds& CMMFMdaAudioConvertUtility::Position()
|
sl@0
|
1283 |
{
|
sl@0
|
1284 |
if (iState==CMdaAudioClipUtility::EPlaying)
|
sl@0
|
1285 |
{
|
sl@0
|
1286 |
TInt err = iController.GetPosition(iPositionTemp);
|
sl@0
|
1287 |
if (err==KErrNone)
|
sl@0
|
1288 |
return iPositionTemp;
|
sl@0
|
1289 |
}
|
sl@0
|
1290 |
return iPosition;
|
sl@0
|
1291 |
}
|
sl@0
|
1292 |
|
sl@0
|
1293 |
const TTimeIntervalMicroSeconds& CMMFMdaAudioConvertUtility::RecordTimeAvailable()
|
sl@0
|
1294 |
{
|
sl@0
|
1295 |
#ifdef _DEBUG
|
sl@0
|
1296 |
TInt error =
|
sl@0
|
1297 |
#endif
|
sl@0
|
1298 |
iAudioRecordControllerCustomCommands.GetRecordTimeAvailable(iRecordTimeAvailable);
|
sl@0
|
1299 |
__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
|
sl@0
|
1300 |
return iRecordTimeAvailable;
|
sl@0
|
1301 |
}
|
sl@0
|
1302 |
|
sl@0
|
1303 |
const TTimeIntervalMicroSeconds& CMMFMdaAudioConvertUtility::Duration()
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
TInt err = iController.GetDuration(iDuration);
|
sl@0
|
1306 |
if (err)
|
sl@0
|
1307 |
iDuration = 0;
|
sl@0
|
1308 |
return iDuration;
|
sl@0
|
1309 |
}
|
sl@0
|
1310 |
|
sl@0
|
1311 |
void CMMFMdaAudioConvertUtility::SetMaxWriteLength(TInt aMaxWriteLength)
|
sl@0
|
1312 |
{
|
sl@0
|
1313 |
iAudioRecordControllerCustomCommands.SetMaxFileSize(aMaxWriteLength);
|
sl@0
|
1314 |
}
|
sl@0
|
1315 |
|
sl@0
|
1316 |
|
sl@0
|
1317 |
void CMMFMdaAudioConvertUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd)
|
sl@0
|
1318 |
{
|
sl@0
|
1319 |
if (aStart >= TTimeIntervalMicroSeconds(0) &&
|
sl@0
|
1320 |
aStart < iDuration &&
|
sl@0
|
1321 |
aStart <= aEnd &&
|
sl@0
|
1322 |
aEnd <= iDuration )
|
sl@0
|
1323 |
{
|
sl@0
|
1324 |
iConvertStart = aStart;
|
sl@0
|
1325 |
iConvertEnd = aEnd;
|
sl@0
|
1326 |
iConvertWindowSet = ETrue;
|
sl@0
|
1327 |
|
sl@0
|
1328 |
if (iState==CMdaAudioClipUtility::EPlaying)
|
sl@0
|
1329 |
{
|
sl@0
|
1330 |
#ifdef _DEBUG
|
sl@0
|
1331 |
TInt error =
|
sl@0
|
1332 |
#endif
|
sl@0
|
1333 |
iAudioPlayControllerCustomCommands.SetPlaybackWindow(aStart, aEnd);
|
sl@0
|
1334 |
__ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
|
sl@0
|
1335 |
}
|
sl@0
|
1336 |
}
|
sl@0
|
1337 |
else
|
sl@0
|
1338 |
{
|
sl@0
|
1339 |
__ASSERT_DEBUG(EFalse, Panic(EMMFMediaClientPanicServerCommunicationProblem));
|
sl@0
|
1340 |
}
|
sl@0
|
1341 |
}
|
sl@0
|
1342 |
|
sl@0
|
1343 |
void CMMFMdaAudioConvertUtility::ClearPlayWindow()
|
sl@0
|
1344 |
{
|
sl@0
|
1345 |
iConvertWindowSet = EFalse;
|
sl@0
|
1346 |
#ifdef _DEBUG
|
sl@0
|
1347 |
TInt err =
|
sl@0
|
1348 |
#endif //_DEBUG
|
sl@0
|
1349 |
iAudioPlayControllerCustomCommands.DeletePlaybackWindow();
|
sl@0
|
1350 |
__ASSERT_DEBUG(err==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem));
|
sl@0
|
1351 |
}
|
sl@0
|
1352 |
|
sl@0
|
1353 |
void CMMFMdaAudioConvertUtility::SetRepeats(TInt /*aRepeatNumberOfTimes*/, const TTimeIntervalMicroSeconds& /*aTrailingSilence*/)
|
sl@0
|
1354 |
{
|
sl@0
|
1355 |
// This doesn't really make sense for the converter.
|
sl@0
|
1356 |
}
|
sl@0
|
1357 |
|
sl@0
|
1358 |
void CMMFMdaAudioConvertUtility::SetPriority(TInt aPriority, TInt aPref)
|
sl@0
|
1359 |
{
|
sl@0
|
1360 |
iPrioritySettings.iPref = aPref;
|
sl@0
|
1361 |
iPrioritySettings.iPriority = aPriority;
|
sl@0
|
1362 |
iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings);
|
sl@0
|
1363 |
iController.SetPrioritySettings(iPrioritySettings);
|
sl@0
|
1364 |
}
|
sl@0
|
1365 |
|
sl@0
|
1366 |
|
sl@0
|
1367 |
void CMMFMdaAudioConvertUtility::Close()
|
sl@0
|
1368 |
{
|
sl@0
|
1369 |
iControllerEventMonitor->Cancel();
|
sl@0
|
1370 |
iController.Close();
|
sl@0
|
1371 |
|
sl@0
|
1372 |
if (iFindAndOpenController)
|
sl@0
|
1373 |
iFindAndOpenController->Close();
|
sl@0
|
1374 |
|
sl@0
|
1375 |
iHasCropped = EFalse;
|
sl@0
|
1376 |
iCroppedDuration = 0;
|
sl@0
|
1377 |
iState = CMdaAudioClipUtility::ENotReady;
|
sl@0
|
1378 |
if(iControllerImplementationInformation)
|
sl@0
|
1379 |
{
|
sl@0
|
1380 |
delete iControllerImplementationInformation;
|
sl@0
|
1381 |
iControllerImplementationInformation = NULL;
|
sl@0
|
1382 |
}
|
sl@0
|
1383 |
iControllerUid = KNullUid;
|
sl@0
|
1384 |
}
|
sl@0
|
1385 |
|
sl@0
|
1386 |
void CMMFMdaAudioConvertUtility::CropL(const TTimeIntervalMicroSeconds &aCropBegin,
|
sl@0
|
1387 |
const TTimeIntervalMicroSeconds &aCropEnd)
|
sl@0
|
1388 |
{
|
sl@0
|
1389 |
// if we are busy converting, or we have not opened the file, return KErrNotReady
|
sl@0
|
1390 |
if (iState!=CMdaAudioClipUtility::EOpen)
|
sl@0
|
1391 |
User::Leave(KErrNotReady);
|
sl@0
|
1392 |
|
sl@0
|
1393 |
// check that cropping positions are valid if clip has been cropped before
|
sl@0
|
1394 |
if (iHasCropped && aCropEnd > iCroppedDuration)
|
sl@0
|
1395 |
{
|
sl@0
|
1396 |
User::Leave(KErrArgument);
|
sl@0
|
1397 |
}
|
sl@0
|
1398 |
|
sl@0
|
1399 |
TInt err = iController.Prime();
|
sl@0
|
1400 |
if (!err)
|
sl@0
|
1401 |
{
|
sl@0
|
1402 |
err =iController.SetPosition(aCropEnd);
|
sl@0
|
1403 |
if (!err)
|
sl@0
|
1404 |
err = iAudioRecordControllerCustomCommands.Crop(ETrue);
|
sl@0
|
1405 |
if (!err)
|
sl@0
|
1406 |
{
|
sl@0
|
1407 |
//remember the cropping, store the cropped length
|
sl@0
|
1408 |
iHasCropped = ETrue;
|
sl@0
|
1409 |
iCroppedDuration = aCropEnd;
|
sl@0
|
1410 |
err = iController.SetPosition(aCropBegin);
|
sl@0
|
1411 |
}
|
sl@0
|
1412 |
if (!err)
|
sl@0
|
1413 |
err = iAudioRecordControllerCustomCommands.Crop(EFalse);
|
sl@0
|
1414 |
if (!err) // store the new cropped length
|
sl@0
|
1415 |
iCroppedDuration = TTimeIntervalMicroSeconds(aCropEnd.Int64() - aCropBegin.Int64());
|
sl@0
|
1416 |
|
sl@0
|
1417 |
// try to stop controller regardless of whether any of the above commands failed
|
sl@0
|
1418 |
iController.Stop();
|
sl@0
|
1419 |
}
|
sl@0
|
1420 |
User::LeaveIfError(err);
|
sl@0
|
1421 |
}
|
sl@0
|
1422 |
|
sl@0
|
1423 |
CMdaAudioClipUtility::TState CMMFMdaAudioConvertUtility::State()
|
sl@0
|
1424 |
{
|
sl@0
|
1425 |
return iState;
|
sl@0
|
1426 |
}
|
sl@0
|
1427 |
|
sl@0
|
1428 |
void CMMFMdaAudioConvertUtility::GetSupportedDestinationDataTypesL(RArray<TFourCC>& aSupportedDataTypes)
|
sl@0
|
1429 |
{
|
sl@0
|
1430 |
iAudioControllerCustomCommands.GetSupportedSinkDataTypesL(aSupportedDataTypes);
|
sl@0
|
1431 |
}
|
sl@0
|
1432 |
|
sl@0
|
1433 |
void CMMFMdaAudioConvertUtility::SetSourceDataTypeL(TFourCC aDataType)
|
sl@0
|
1434 |
{
|
sl@0
|
1435 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSourceDataType(aDataType));
|
sl@0
|
1436 |
}
|
sl@0
|
1437 |
|
sl@0
|
1438 |
void CMMFMdaAudioConvertUtility::SetDestinationDataTypeL(TFourCC aDataType)
|
sl@0
|
1439 |
{
|
sl@0
|
1440 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSinkDataType(aDataType));
|
sl@0
|
1441 |
}
|
sl@0
|
1442 |
|
sl@0
|
1443 |
TFourCC CMMFMdaAudioConvertUtility::DestinationDataTypeL()
|
sl@0
|
1444 |
{
|
sl@0
|
1445 |
TFourCC dataType;
|
sl@0
|
1446 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSinkDataType(dataType));
|
sl@0
|
1447 |
return dataType;
|
sl@0
|
1448 |
}
|
sl@0
|
1449 |
|
sl@0
|
1450 |
TFourCC CMMFMdaAudioConvertUtility::SourceDataTypeL()
|
sl@0
|
1451 |
{
|
sl@0
|
1452 |
TFourCC dataType;
|
sl@0
|
1453 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSourceDataType(dataType));
|
sl@0
|
1454 |
return dataType;
|
sl@0
|
1455 |
}
|
sl@0
|
1456 |
|
sl@0
|
1457 |
|
sl@0
|
1458 |
void CMMFMdaAudioConvertUtility::SetDestinationBitRateL(TUint aBitRate)
|
sl@0
|
1459 |
{
|
sl@0
|
1460 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSinkBitRate(aBitRate));
|
sl@0
|
1461 |
}
|
sl@0
|
1462 |
|
sl@0
|
1463 |
void CMMFMdaAudioConvertUtility::SetSourceSampleRateL(TUint aSampleRate)
|
sl@0
|
1464 |
{
|
sl@0
|
1465 |
User::LeaveIfError(iController.Stop());
|
sl@0
|
1466 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSourceSampleRate(aSampleRate));
|
sl@0
|
1467 |
}
|
sl@0
|
1468 |
|
sl@0
|
1469 |
void CMMFMdaAudioConvertUtility::SetDestinationSampleRateL(TUint aSampleRate)
|
sl@0
|
1470 |
{
|
sl@0
|
1471 |
User::LeaveIfError(iController.Stop());
|
sl@0
|
1472 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSinkSampleRate(aSampleRate));
|
sl@0
|
1473 |
}
|
sl@0
|
1474 |
|
sl@0
|
1475 |
void CMMFMdaAudioConvertUtility::SetSourceFormatL(TUid aRecordFormat)
|
sl@0
|
1476 |
{
|
sl@0
|
1477 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSourceFormat(aRecordFormat));
|
sl@0
|
1478 |
}
|
sl@0
|
1479 |
|
sl@0
|
1480 |
void CMMFMdaAudioConvertUtility::SetDestinationFormatL(TUid aRecordFormat)
|
sl@0
|
1481 |
{
|
sl@0
|
1482 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSinkFormat(aRecordFormat));
|
sl@0
|
1483 |
}
|
sl@0
|
1484 |
|
sl@0
|
1485 |
void CMMFMdaAudioConvertUtility::SetSourceNumberOfChannelsL(TUint aNumberOfChannels)
|
sl@0
|
1486 |
{
|
sl@0
|
1487 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSourceNumChannels(aNumberOfChannels));
|
sl@0
|
1488 |
}
|
sl@0
|
1489 |
|
sl@0
|
1490 |
void CMMFMdaAudioConvertUtility::SetDestinationNumberOfChannelsL(TUint aNumberOfChannels)
|
sl@0
|
1491 |
{
|
sl@0
|
1492 |
User::LeaveIfError(iAudioControllerCustomCommands.SetSinkNumChannels(aNumberOfChannels));
|
sl@0
|
1493 |
}
|
sl@0
|
1494 |
|
sl@0
|
1495 |
TUint CMMFMdaAudioConvertUtility::DestinationBitRateL()
|
sl@0
|
1496 |
{
|
sl@0
|
1497 |
TUint bitRate;
|
sl@0
|
1498 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSinkBitRate(bitRate));
|
sl@0
|
1499 |
return bitRate;
|
sl@0
|
1500 |
}
|
sl@0
|
1501 |
|
sl@0
|
1502 |
TUint CMMFMdaAudioConvertUtility::DestinationSampleRateL()
|
sl@0
|
1503 |
{
|
sl@0
|
1504 |
TUint sampleRate;
|
sl@0
|
1505 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSinkSampleRate(sampleRate));
|
sl@0
|
1506 |
return sampleRate;
|
sl@0
|
1507 |
}
|
sl@0
|
1508 |
|
sl@0
|
1509 |
TUid CMMFMdaAudioConvertUtility::DestinationFormatL()
|
sl@0
|
1510 |
{
|
sl@0
|
1511 |
TUid format;
|
sl@0
|
1512 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSinkFormat(format));
|
sl@0
|
1513 |
return format;
|
sl@0
|
1514 |
}
|
sl@0
|
1515 |
|
sl@0
|
1516 |
TUint CMMFMdaAudioConvertUtility::DestinationNumberOfChannelsL()
|
sl@0
|
1517 |
{
|
sl@0
|
1518 |
TUint numChannels;
|
sl@0
|
1519 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSinkNumChannels(numChannels));
|
sl@0
|
1520 |
return numChannels;
|
sl@0
|
1521 |
}
|
sl@0
|
1522 |
|
sl@0
|
1523 |
TUint CMMFMdaAudioConvertUtility::SourceBitRateL()
|
sl@0
|
1524 |
{
|
sl@0
|
1525 |
TUint bitRate;
|
sl@0
|
1526 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSourceBitRate(bitRate));
|
sl@0
|
1527 |
return bitRate;
|
sl@0
|
1528 |
}
|
sl@0
|
1529 |
|
sl@0
|
1530 |
TUint CMMFMdaAudioConvertUtility::SourceSampleRateL()
|
sl@0
|
1531 |
{
|
sl@0
|
1532 |
TUint sampleRate;
|
sl@0
|
1533 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSourceSampleRate(sampleRate));
|
sl@0
|
1534 |
return sampleRate;
|
sl@0
|
1535 |
}
|
sl@0
|
1536 |
|
sl@0
|
1537 |
TUid CMMFMdaAudioConvertUtility::SourceFormatL()
|
sl@0
|
1538 |
{
|
sl@0
|
1539 |
TUid format;
|
sl@0
|
1540 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSourceFormat(format));
|
sl@0
|
1541 |
return format;
|
sl@0
|
1542 |
}
|
sl@0
|
1543 |
|
sl@0
|
1544 |
TUint CMMFMdaAudioConvertUtility::SourceNumberOfChannelsL()
|
sl@0
|
1545 |
{
|
sl@0
|
1546 |
TUint numChannels;
|
sl@0
|
1547 |
User::LeaveIfError(iAudioControllerCustomCommands.GetSourceNumChannels(numChannels));
|
sl@0
|
1548 |
return numChannels;
|
sl@0
|
1549 |
}
|
sl@0
|
1550 |
|
sl@0
|
1551 |
|
sl@0
|
1552 |
void CMMFMdaAudioConvertUtility::GetSupportedConversionBitRatesL(RArray<TUint>& aSupportedBitRates)
|
sl@0
|
1553 |
{
|
sl@0
|
1554 |
iAudioControllerCustomCommands.GetSupportedSinkBitRatesL(aSupportedBitRates);
|
sl@0
|
1555 |
}
|
sl@0
|
1556 |
|
sl@0
|
1557 |
void CMMFMdaAudioConvertUtility::GetSupportedConversionSampleRatesL(RArray<TUint>& aSupportedSampleRates)
|
sl@0
|
1558 |
{
|
sl@0
|
1559 |
User::LeaveIfError(iController.Prime());
|
sl@0
|
1560 |
iAudioControllerCustomCommands.GetSupportedSinkSampleRatesL(aSupportedSampleRates);
|
sl@0
|
1561 |
User::LeaveIfError(iController.Stop());
|
sl@0
|
1562 |
}
|
sl@0
|
1563 |
|
sl@0
|
1564 |
void CMMFMdaAudioConvertUtility::GetSupportedConversionNumberOfChannelsL(RArray<TUint>& aSupportedNumChannels)
|
sl@0
|
1565 |
{
|
sl@0
|
1566 |
iAudioControllerCustomCommands.GetSupportedSinkNumChannelsL(aSupportedNumChannels);
|
sl@0
|
1567 |
}
|
sl@0
|
1568 |
|
sl@0
|
1569 |
CMdaAudioConvertUtility* CMMFMdaAudioConvertUtility::Parent() const
|
sl@0
|
1570 |
{
|
sl@0
|
1571 |
ASSERT(iParent);
|
sl@0
|
1572 |
return static_cast<CMdaAudioConvertUtility*>(iParent);
|
sl@0
|
1573 |
}
|
sl@0
|
1574 |
|
sl@0
|
1575 |
TInt CMMFMdaAudioConvertUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)
|
sl@0
|
1576 |
{
|
sl@0
|
1577 |
return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom);
|
sl@0
|
1578 |
}
|
sl@0
|
1579 |
|
sl@0
|
1580 |
TInt CMMFMdaAudioConvertUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)
|
sl@0
|
1581 |
{
|
sl@0
|
1582 |
return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2);
|
sl@0
|
1583 |
}
|
sl@0
|
1584 |
|
sl@0
|
1585 |
void CMMFMdaAudioConvertUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)
|
sl@0
|
1586 |
{
|
sl@0
|
1587 |
iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus);
|
sl@0
|
1588 |
}
|
sl@0
|
1589 |
|
sl@0
|
1590 |
void CMMFMdaAudioConvertUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)
|
sl@0
|
1591 |
{
|
sl@0
|
1592 |
iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus);
|
sl@0
|
1593 |
}
|
sl@0
|
1594 |
|
sl@0
|
1595 |
const CMMFControllerImplementationInformation& CMMFMdaAudioConvertUtility::ControllerImplementationInformationL()
|
sl@0
|
1596 |
{
|
sl@0
|
1597 |
if (!iControllerImplementationInformation)
|
sl@0
|
1598 |
{
|
sl@0
|
1599 |
if (iControllerUid==KNullUid)
|
sl@0
|
1600 |
User::Leave(KErrNotReady);
|
sl@0
|
1601 |
iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid);
|
sl@0
|
1602 |
}
|
sl@0
|
1603 |
return *iControllerImplementationInformation;
|
sl@0
|
1604 |
}
|
sl@0
|
1605 |
|
sl@0
|
1606 |
|
sl@0
|
1607 |
void CMMFMdaAudioConvertUtility::Reset()
|
sl@0
|
1608 |
{
|
sl@0
|
1609 |
// Make sure any existing controller is closed.
|
sl@0
|
1610 |
Close();
|
sl@0
|
1611 |
|
sl@0
|
1612 |
iSourceFormatUid = KNullUid;
|
sl@0
|
1613 |
iSinkFormatUid = KNullUid;
|
sl@0
|
1614 |
iSourceDataType = KMMFFourCCCodeNULL;
|
sl@0
|
1615 |
iSinkDataType = KMMFFourCCCodeNULL;
|
sl@0
|
1616 |
iSourceSampleRate = 0;
|
sl@0
|
1617 |
iSinkSampleRate = 0;
|
sl@0
|
1618 |
iSourceChannels = 0;
|
sl@0
|
1619 |
iSinkChannels = 0;
|
sl@0
|
1620 |
}
|
sl@0
|
1621 |
|
sl@0
|
1622 |
|
sl@0
|
1623 |
TInt CMMFMdaAudioConvertUtility::ControllerOpen()
|
sl@0
|
1624 |
{
|
sl@0
|
1625 |
TInt err = KErrNone;
|
sl@0
|
1626 |
|
sl@0
|
1627 |
if(iSourceFormatUid != KNullUid)
|
sl@0
|
1628 |
TRAP(err, SetSourceFormatL(iSourceFormatUid));
|
sl@0
|
1629 |
|
sl@0
|
1630 |
if(!err && iSinkFormatUid != KNullUid)
|
sl@0
|
1631 |
TRAP(err, SetDestinationFormatL(iSinkFormatUid));
|
sl@0
|
1632 |
|
sl@0
|
1633 |
if(!err && iSourceDataType != KMMFFourCCCodeNULL)
|
sl@0
|
1634 |
{
|
sl@0
|
1635 |
TRAP(err, SetSourceDataTypeL(iSourceDataType));
|
sl@0
|
1636 |
}
|
sl@0
|
1637 |
|
sl@0
|
1638 |
if(!err && iSinkDataType != KMMFFourCCCodeNULL)
|
sl@0
|
1639 |
{
|
sl@0
|
1640 |
TRAP(err, SetDestinationDataTypeL(iSinkDataType));
|
sl@0
|
1641 |
}
|
sl@0
|
1642 |
|
sl@0
|
1643 |
// set the audio data settings ie sample rate & channels
|
sl@0
|
1644 |
if (!err && iSourceSampleRate != 0)
|
sl@0
|
1645 |
{
|
sl@0
|
1646 |
TRAP(err, SetSourceSampleRateL(iSourceSampleRate));
|
sl@0
|
1647 |
}
|
sl@0
|
1648 |
|
sl@0
|
1649 |
if (!err && iSourceChannels != 0)
|
sl@0
|
1650 |
{
|
sl@0
|
1651 |
TRAP(err, SetSourceNumberOfChannelsL(iSourceChannels));
|
sl@0
|
1652 |
}
|
sl@0
|
1653 |
|
sl@0
|
1654 |
if (!err && iSinkSampleRate != 0)
|
sl@0
|
1655 |
{
|
sl@0
|
1656 |
TRAP(err, SetDestinationSampleRateL(iSinkSampleRate));
|
sl@0
|
1657 |
}
|
sl@0
|
1658 |
|
sl@0
|
1659 |
if (!err && iSinkChannels != 0)
|
sl@0
|
1660 |
{
|
sl@0
|
1661 |
TRAP(err, SetDestinationNumberOfChannelsL(iSinkChannels));
|
sl@0
|
1662 |
}
|
sl@0
|
1663 |
|
sl@0
|
1664 |
//get the clip duration
|
sl@0
|
1665 |
if (!err)
|
sl@0
|
1666 |
{
|
sl@0
|
1667 |
iDuration = TTimeIntervalMicroSeconds(0);
|
sl@0
|
1668 |
err = iController.GetDuration(iDuration);
|
sl@0
|
1669 |
}
|
sl@0
|
1670 |
|
sl@0
|
1671 |
if (err)
|
sl@0
|
1672 |
Close();
|
sl@0
|
1673 |
else
|
sl@0
|
1674 |
iState = CMdaAudioClipUtility::EOpen;
|
sl@0
|
1675 |
|
sl@0
|
1676 |
return err;
|
sl@0
|
1677 |
}
|
sl@0
|
1678 |
|
sl@0
|
1679 |
|
sl@0
|
1680 |
void CMMFMdaAudioConvertUtility::ConfigureSourceSinkL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation)
|
sl@0
|
1681 |
{
|
sl@0
|
1682 |
TMMFDescriptorConfig srcDesCfg;
|
sl@0
|
1683 |
TMMFFileConfig srcFileCfg;
|
sl@0
|
1684 |
CBufFlat* srcCfgBuffer = NULL;
|
sl@0
|
1685 |
CMMFUrlParams* srcURLCfg = NULL;
|
sl@0
|
1686 |
TPtrC8 sourceCfg;
|
sl@0
|
1687 |
TUid sourceUid = KNullUid;
|
sl@0
|
1688 |
|
sl@0
|
1689 |
TMMFDescriptorConfig dstDesCfg;
|
sl@0
|
1690 |
TMMFFileConfig dstFileCfg;
|
sl@0
|
1691 |
CBufFlat* dstCfgBuffer = NULL;
|
sl@0
|
1692 |
CMMFUrlParams* dstURLCfg = NULL;
|
sl@0
|
1693 |
TPtrC8 dstCfg;
|
sl@0
|
1694 |
TUid dstUid = KNullUid;
|
sl@0
|
1695 |
|
sl@0
|
1696 |
TInt err = KErrNone;
|
sl@0
|
1697 |
|
sl@0
|
1698 |
// setup the source config info
|
sl@0
|
1699 |
if (aPriLocation->Uid() == KUidMdaFileResLoc)
|
sl@0
|
1700 |
{//sink clip location is a file
|
sl@0
|
1701 |
TDesC& fileName = ((TMdaFileClipLocation*)aPriLocation)->iName;
|
sl@0
|
1702 |
srcFileCfg().iPath = fileName;
|
sl@0
|
1703 |
sourceCfg.Set(srcFileCfg);
|
sl@0
|
1704 |
sourceUid = KUidMmfFileSource;
|
sl@0
|
1705 |
}
|
sl@0
|
1706 |
else if (aPriLocation->Uid() == KUidMdaDesResLoc)
|
sl@0
|
1707 |
{//sink clip is a descriptor - pass down descriptor & thread id
|
sl@0
|
1708 |
TMdaDesClipLocation* srcLoc = (TMdaDesClipLocation*)aPriLocation;
|
sl@0
|
1709 |
srcDesCfg().iDes = srcLoc->iDes;
|
sl@0
|
1710 |
srcDesCfg().iDesThreadId = srcLoc->iThreadId;
|
sl@0
|
1711 |
sourceCfg.Set(srcDesCfg);
|
sl@0
|
1712 |
sourceUid = KUidMmfDescriptorSource;
|
sl@0
|
1713 |
}
|
sl@0
|
1714 |
else if (aPriLocation->Uid() == KUidMdaUrlResLoc)
|
sl@0
|
1715 |
{
|
sl@0
|
1716 |
TMdaUrlClipLocation* srcLoc = (TMdaUrlClipLocation*)aPriLocation;
|
sl@0
|
1717 |
srcURLCfg = CMMFUrlParams::NewLC(srcLoc->iUrl, srcLoc->iIapId);
|
sl@0
|
1718 |
srcCfgBuffer = srcURLCfg->ExternalizeToCBufFlatLC();
|
sl@0
|
1719 |
sourceCfg.Set(srcCfgBuffer->Ptr(0));
|
sl@0
|
1720 |
sourceUid = KUidMmfUrlSource;
|
sl@0
|
1721 |
}
|
sl@0
|
1722 |
else
|
sl@0
|
1723 |
{
|
sl@0
|
1724 |
err = KErrNotSupported;
|
sl@0
|
1725 |
}
|
sl@0
|
1726 |
|
sl@0
|
1727 |
if (!err)
|
sl@0
|
1728 |
{
|
sl@0
|
1729 |
if (aSecLocation->Uid() == KUidMdaFileResLoc)
|
sl@0
|
1730 |
{//sink clip location is a file
|
sl@0
|
1731 |
TDesC& fileName = ((TMdaFileClipLocation*)aSecLocation)->iName;
|
sl@0
|
1732 |
dstFileCfg().iPath = fileName;
|
sl@0
|
1733 |
dstCfg.Set(dstFileCfg);
|
sl@0
|
1734 |
dstUid = KUidMmfFileSink;
|
sl@0
|
1735 |
}
|
sl@0
|
1736 |
else if (aSecLocation->Uid() == KUidMdaDesResLoc)
|
sl@0
|
1737 |
{//sink clip is a descriptor - pass down descriptor & thread id
|
sl@0
|
1738 |
TMdaDesClipLocation* desLoc = (TMdaDesClipLocation*)aSecLocation;
|
sl@0
|
1739 |
dstDesCfg().iDes = desLoc->iDes;
|
sl@0
|
1740 |
dstDesCfg().iDesThreadId = desLoc->iThreadId;
|
sl@0
|
1741 |
dstCfg.Set(dstDesCfg);
|
sl@0
|
1742 |
dstUid = KUidMmfDescriptorSink;
|
sl@0
|
1743 |
}
|
sl@0
|
1744 |
else if (aSecLocation->Uid() == KUidMdaUrlResLoc)
|
sl@0
|
1745 |
{
|
sl@0
|
1746 |
TMdaUrlClipLocation* desLoc = (TMdaUrlClipLocation*)aSecLocation;
|
sl@0
|
1747 |
dstURLCfg = CMMFUrlParams::NewLC(desLoc->iUrl, desLoc->iIapId);
|
sl@0
|
1748 |
dstCfgBuffer = dstURLCfg->ExternalizeToCBufFlatLC();
|
sl@0
|
1749 |
dstCfg.Set(dstCfgBuffer->Ptr(0));
|
sl@0
|
1750 |
dstUid = KUidMmfUrlSink;
|
sl@0
|
1751 |
}
|
sl@0
|
1752 |
else
|
sl@0
|
1753 |
{
|
sl@0
|
1754 |
err = KErrNotSupported;
|
sl@0
|
1755 |
}
|
sl@0
|
1756 |
}
|
sl@0
|
1757 |
|
sl@0
|
1758 |
if (!err)
|
sl@0
|
1759 |
{
|
sl@0
|
1760 |
iFindAndOpenController->ConfigureSourceSink(
|
sl@0
|
1761 |
CMMFFindAndOpenController::TSourceSink(sourceUid, sourceCfg),
|
sl@0
|
1762 |
CMMFFindAndOpenController::TSourceSink(dstUid, dstCfg));
|
sl@0
|
1763 |
}
|
sl@0
|
1764 |
|
sl@0
|
1765 |
if (dstCfgBuffer)
|
sl@0
|
1766 |
CleanupStack::PopAndDestroy(2); //dstCfgBuffer, dstURLCfg
|
sl@0
|
1767 |
if (srcCfgBuffer)
|
sl@0
|
1768 |
CleanupStack::PopAndDestroy(2); //srcCfgBuffer, srcURLCfg
|
sl@0
|
1769 |
|
sl@0
|
1770 |
User::LeaveIfError(err);
|
sl@0
|
1771 |
}
|
sl@0
|
1772 |
|
sl@0
|
1773 |
|
sl@0
|
1774 |
TInt CMMFMdaAudioConvertUtility::SetThreadPriority(const TThreadPriority& aThreadPriority) const
|
sl@0
|
1775 |
{
|
sl@0
|
1776 |
return iController.SetThreadPriority(aThreadPriority);
|
sl@0
|
1777 |
}
|
sl@0
|
1778 |
|
sl@0
|
1779 |
|
sl@0
|
1780 |
|
sl@0
|
1781 |
|
sl@0
|
1782 |
|