|
1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: DRM PlayUtility |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <DrmAudioSamplePlayer.h> |
|
23 #include "DRMPlayClientServer.h" |
|
24 #include "mmfclientdrmaudioplayer.h" |
|
25 #include <mmf/common/mmfcontrollerpluginresolver.h> |
|
26 #include <mmf/common/mmfbase.h> |
|
27 #include <mmf/common/mmfdrmcustomcommands.h> |
|
28 #include "drmaudioplayeradaptation.h" |
|
29 |
|
30 // This is the UID defined by custom interface builder |
|
31 const TUid KUidCustomInterfaceBuilderImpl = {0x10207A8E}; |
|
32 |
|
33 #ifdef _DEBUG |
|
34 #define DEP_PRN0(str) RDebug::Print(str) |
|
35 #define DEP_PRN1(str, v1) RDebug::Print(str, v1) |
|
36 #define DEP_PRN2(str, v1, v2) RDebug::Print(str, v1, v2) |
|
37 #else |
|
38 #define DEP_PRN0(str) |
|
39 #define DEP_PRN1(str, v1) |
|
40 #define DEP_PRN2(str, v1, v2) |
|
41 #endif // _DEBUG |
|
42 |
|
43 |
|
44 // ============================= LOCAL FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CDrmPlayerUtility::NewL |
|
48 // Constructs and initialises a new instance of the audio player utility. |
|
49 // (other items were commented in a header). |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewL( |
|
53 MDrmAudioPlayerCallback& aCallback, |
|
54 TInt aPriority, |
|
55 TMdaPriorityPreference aPref) |
|
56 { |
|
57 CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility(); |
|
58 CleanupStack::PushL(self); |
|
59 self->iProperties = CDrmAudioPlayerAdaptation::NewL( aCallback, aPriority, aPref ); |
|
60 CleanupStack::Pop(self); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CDrmPlayerUtility::NewFilePlayerL |
|
66 // Constructs and initialises a new instance of the audio player utility for |
|
67 // playing sampled audio data from a file. The audio data must be in a supported |
|
68 // format (e.g. WAV and AU). |
|
69 // (other items were commented in a header). |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewFilePlayerL( |
|
73 const TDesC& aFileName, |
|
74 MDrmAudioPlayerCallback& aCallback, |
|
75 TInt aPriority, |
|
76 TMdaPriorityPreference aPref) |
|
77 { |
|
78 CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility(); |
|
79 CleanupStack::PushL(self); |
|
80 self->iProperties = CDrmAudioPlayerAdaptation::NewFilePlayerL(aFileName, aCallback, aPriority, aPref); |
|
81 CleanupStack::Pop(self); |
|
82 return self; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CDrmPlayerUtility::NewDesPlayerL |
|
87 // Constructs and initialises a new instance of the audio player utility for |
|
88 // playing sampled audio data from a descriptor. The audio data must be in a |
|
89 // supported format (e.g. WAV and AU). |
|
90 // (other items were commented in a header). |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewDesPlayerL( |
|
94 const TDesC8& aData, |
|
95 MDrmAudioPlayerCallback& aCallback, |
|
96 TInt aPriority, |
|
97 TMdaPriorityPreference aPref) |
|
98 { |
|
99 CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility(); |
|
100 CleanupStack::PushL(self); |
|
101 self->iProperties = CDrmAudioPlayerAdaptation::NewDesPlayerL( aData, aCallback, aPriority, aPref ); |
|
102 CleanupStack::Pop(self); |
|
103 return self; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CDrmPlayerUtility::NewDesPlayerReadOnlyL |
|
108 // Constructs and initialises a new instance of the audio player utility for |
|
109 // playing sampled audio data from a read only descriptor. The audio data must |
|
110 // be in a supported format (e.g. WAV and AU). |
|
111 // (other items were commented in a header). |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C CDrmPlayerUtility* CDrmPlayerUtility::NewDesPlayerReadOnlyL( |
|
115 const TDesC8& aData, |
|
116 MDrmAudioPlayerCallback& aCallback, |
|
117 TInt aPriority, |
|
118 TMdaPriorityPreference aPref) |
|
119 { |
|
120 CDrmPlayerUtility* self = new(ELeave) CDrmPlayerUtility(); |
|
121 CleanupStack::PushL(self); |
|
122 self->iProperties = CDrmAudioPlayerAdaptation::NewDesPlayerReadOnlyL(aData, aCallback, aPriority, aPref); |
|
123 CleanupStack::Pop(self); |
|
124 return self; |
|
125 } |
|
126 |
|
127 // Destructor |
|
128 EXPORT_C CDrmPlayerUtility::~CDrmPlayerUtility() |
|
129 { |
|
130 delete iProperties; |
|
131 } |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CDrmPlayerUtility::Play |
|
135 // Begins playback of the initialised audio sample at the current volume and |
|
136 // priority levels. When playing of the audio sample is complete, successfully |
|
137 // or otherwise, the callback function MMdaAudioPlayerCallback::MapcPlayComplete() |
|
138 // is called. |
|
139 // (other items were commented in a header). |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 EXPORT_C void CDrmPlayerUtility::Play() |
|
143 { |
|
144 iProperties->Play(); |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CDrmPlayerUtility::Stop |
|
149 // Stops playback of the audio sample as soon as possible. If the audio sample |
|
150 // is playing, playback is stopped as soon as possible. If playback is already |
|
151 // complete, nothing further happens as a result of calling this function. The |
|
152 // callback function MMdaAudioPlayerCallback::MapcPlayComplete() is not called. |
|
153 // (other items were commented in a header). |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 EXPORT_C void CDrmPlayerUtility::Stop() |
|
157 { |
|
158 iProperties->Stop(); |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CDrmPlayerUtility::Pause |
|
163 // Pauses the playback of the audio clip. |
|
164 // (other items were commented in a header). |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 EXPORT_C TInt CDrmPlayerUtility::Pause() |
|
168 { |
|
169 return iProperties->Pause(); |
|
170 } |
|
171 |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CDrmPlayerUtility::SetVolume |
|
175 // Changes the current playback volume to a specified value. The volume can be |
|
176 // changed before or during playback and is effective immediately. |
|
177 // (other items were commented in a header). |
|
178 // ----------------------------------------------------------------------------- |
|
179 // |
|
180 EXPORT_C void CDrmPlayerUtility::SetVolume( |
|
181 TInt aVolume) |
|
182 { |
|
183 iProperties->SetVolume(aVolume); |
|
184 } |
|
185 |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CDrmPlayerUtility::SetRepeats |
|
189 // Sets the number of times the audio sample is to be repeated during the playback |
|
190 // operation. A period of silence can follow each playing of the sample. The |
|
191 // audio sample can be repeated indefinitely. |
|
192 // (other items were commented in a header). |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 EXPORT_C void CDrmPlayerUtility::SetRepeats( |
|
196 TInt aRepeatNumberOfTimes, |
|
197 const TTimeIntervalMicroSeconds& aTrailingSilence) |
|
198 { |
|
199 iProperties->SetRepeats(aRepeatNumberOfTimes,aTrailingSilence); |
|
200 } |
|
201 |
|
202 // ----------------------------------------------------------------------------- |
|
203 // CDrmPlayerUtility::SetVolumeRamp |
|
204 // Defines the period over which the volume level is to rise smoothly from nothing |
|
205 // to the normal volume level. |
|
206 // (other items were commented in a header). |
|
207 // ----------------------------------------------------------------------------- |
|
208 // |
|
209 EXPORT_C void CDrmPlayerUtility::SetVolumeRamp( |
|
210 const TTimeIntervalMicroSeconds& aRampDuration) |
|
211 { |
|
212 iProperties->SetVolumeRamp(aRampDuration); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CDrmPlayerUtility::Duration |
|
217 // Returns the duration of the audio sample. The function raises a |
|
218 // CMdaAudioPlayerUtility 1 panic if the audio player utility is not initialised. |
|
219 // (other items were commented in a header). |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 EXPORT_C const TTimeIntervalMicroSeconds& CDrmPlayerUtility::Duration() |
|
223 { |
|
224 return iProperties->Duration(); |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CDrmPlayerUtility::MaxVolume |
|
229 // Returns an integer representing the maximum volume. This is the maximum value |
|
230 // which can be passed to CMdaAudioPlayerUtility::SetVolume(). |
|
231 // (other items were commented in a header). |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C TInt CDrmPlayerUtility::MaxVolume() |
|
235 { |
|
236 return iProperties->MaxVolume(); |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // CDrmPlayerUtility::OpenFileL |
|
241 // Opens an audio clip from a file. The audio data must be in a supported |
|
242 // format (for example, WAV or AU). This function leaves with KErrInUse if there |
|
243 // is a previous open statement awaiting notification of completion. |
|
244 // (other items were commented in a header). |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 EXPORT_C void CDrmPlayerUtility::OpenFileL( |
|
248 const TDesC &aFileName) |
|
249 { |
|
250 iProperties->OpenFileL(aFileName); |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CDrmPlayerUtility::OpenFileL |
|
255 // Opens an audio clip from a file. The audio data must be in a supported |
|
256 // format (for example, WAV or AU). This function leaves with KErrInUse if there |
|
257 // is a previous open statement awaiting notification of completion. |
|
258 // (other items were commented in a header). |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 EXPORT_C void CDrmPlayerUtility::OpenFileL( |
|
262 const RFile& aFile) |
|
263 { |
|
264 iProperties->OpenFileL(aFile); |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CDrmPlayerUtility::OpenFileL |
|
269 // Opens an audio clip from a file. The audio data must be in a supported |
|
270 // format (for example, WAV or AU). This function leaves with KErrInUse if there |
|
271 // is a previous open statement awaiting notification of completion. |
|
272 // (other items were commented in a header). |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 EXPORT_C void CDrmPlayerUtility::OpenFileL( |
|
276 #ifdef SYMBIAN_CAF_V2 |
|
277 const TMMSource& aSource |
|
278 #else |
|
279 const TMMSource& /*aSource*/ |
|
280 #endif |
|
281 ) |
|
282 { |
|
283 #ifdef SYMBIAN_CAF_V2 |
|
284 iProperties->OpenFileL(aSource); |
|
285 #else |
|
286 User::Leave(KErrNotSupported); |
|
287 #endif |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // CDrmPlayerUtility::OpenDesL |
|
292 // Opens an audio clip from a descriptor. The audio data must be in a supported |
|
293 // format (for example, WAV or AU). |
|
294 // (other items were commented in a header). |
|
295 // ----------------------------------------------------------------------------- |
|
296 // |
|
297 EXPORT_C void CDrmPlayerUtility::OpenDesL( |
|
298 const TDesC8& aDescriptor) |
|
299 { |
|
300 iProperties->OpenDesL(aDescriptor); |
|
301 } |
|
302 |
|
303 // ----------------------------------------------------------------------------- |
|
304 // CDrmPlayerUtility::OpenUrlL |
|
305 // Opens an audio clip from a URL. The audio data must be in a supported format |
|
306 // (for example, WAV or AU). |
|
307 // (other items were commented in a header). |
|
308 // ----------------------------------------------------------------------------- |
|
309 // |
|
310 EXPORT_C void CDrmPlayerUtility::OpenUrlL( |
|
311 const TDesC& aUrl, |
|
312 TInt aIapId, |
|
313 const TDesC8& aMimeType) |
|
314 { |
|
315 iProperties->OpenUrlL(aUrl,aIapId,aMimeType); |
|
316 } |
|
317 |
|
318 // ----------------------------------------------------------------------------- |
|
319 // CDrmPlayerUtility::Close |
|
320 // Closes the current audio clip (allowing another clip to be opened). |
|
321 // (other items were commented in a header). |
|
322 // ----------------------------------------------------------------------------- |
|
323 // |
|
324 EXPORT_C void CDrmPlayerUtility::Close() |
|
325 { |
|
326 iProperties->Close(); |
|
327 } |
|
328 |
|
329 // ----------------------------------------------------------------------------- |
|
330 // CDrmPlayerUtility::GetPosition |
|
331 // Returns the current playback position in microseconds from the start |
|
332 // of the clip. |
|
333 // (other items were commented in a header). |
|
334 // ----------------------------------------------------------------------------- |
|
335 // |
|
336 EXPORT_C TInt CDrmPlayerUtility::GetPosition( |
|
337 TTimeIntervalMicroSeconds& aPosition) |
|
338 { |
|
339 return iProperties->GetPosition(aPosition); |
|
340 } |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // CDrmPlayerUtility::SetPosition |
|
344 // Sets the current playback position in microseconds from the start of the clip. |
|
345 // (other items were commented in a header). |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 EXPORT_C void CDrmPlayerUtility::SetPosition( |
|
349 const TTimeIntervalMicroSeconds& aPosition) |
|
350 { |
|
351 iProperties->SetPosition(aPosition); |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CDrmPlayerUtility::SetPriority |
|
356 // Sets the priority for playback. This is used to arbitrate between multiple |
|
357 // objects trying to access a single sound device. |
|
358 // (other items were commented in a header). |
|
359 // ----------------------------------------------------------------------------- |
|
360 // |
|
361 EXPORT_C TInt CDrmPlayerUtility::SetPriority( |
|
362 TInt aPriority, |
|
363 TMdaPriorityPreference aPref) |
|
364 { |
|
365 return iProperties->SetPriority(aPriority,aPref); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CDrmPlayerUtility::GetVolume |
|
370 // Returns the current playback volume. |
|
371 // (other items were commented in a header). |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 EXPORT_C TInt CDrmPlayerUtility::GetVolume( |
|
375 TInt& aVolume) |
|
376 { |
|
377 return iProperties->GetVolume(aVolume); |
|
378 } |
|
379 |
|
380 // ----------------------------------------------------------------------------- |
|
381 // CDrmPlayerUtility::GetNumberOfMetaDataEntries |
|
382 // Returns the number of meta data entries in the current audio clip. |
|
383 // (other items were commented in a header). |
|
384 // ----------------------------------------------------------------------------- |
|
385 // |
|
386 EXPORT_C TInt CDrmPlayerUtility::GetNumberOfMetaDataEntries( |
|
387 TInt& aNumEntries) |
|
388 { |
|
389 return iProperties->GetNumberOfMetaDataEntries(aNumEntries); |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // CDrmPlayerUtility::GetMetaDataEntryL |
|
394 // Returns the requested meta data entry. |
|
395 // (other items were commented in a header). |
|
396 // ----------------------------------------------------------------------------- |
|
397 // |
|
398 EXPORT_C CMMFMetaDataEntry* CDrmPlayerUtility::GetMetaDataEntryL( |
|
399 TInt aMetaDataIndex) |
|
400 { |
|
401 return iProperties->GetMetaDataEntryL(aMetaDataIndex); |
|
402 } |
|
403 |
|
404 // ----------------------------------------------------------------------------- |
|
405 // CDrmPlayerUtility::SetPlayWindow |
|
406 // Sets the current playback window. |
|
407 // (other items were commented in a header). |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 EXPORT_C TInt CDrmPlayerUtility::SetPlayWindow( |
|
411 const TTimeIntervalMicroSeconds& aStart, |
|
412 const TTimeIntervalMicroSeconds& aEnd) |
|
413 { |
|
414 return iProperties->SetPlayWindow(aStart,aEnd); |
|
415 } |
|
416 |
|
417 // ----------------------------------------------------------------------------- |
|
418 // CDrmPlayerUtility::ClearPlayWindow |
|
419 // Clears the current playback window. |
|
420 // (other items were commented in a header). |
|
421 // ----------------------------------------------------------------------------- |
|
422 // |
|
423 EXPORT_C TInt CDrmPlayerUtility::ClearPlayWindow() |
|
424 { |
|
425 return iProperties->ClearPlayWindow(); |
|
426 } |
|
427 |
|
428 // ----------------------------------------------------------------------------- |
|
429 // CDrmPlayerUtility::SetBalance |
|
430 // Sets the current playback balance. |
|
431 // (other items were commented in a header). |
|
432 // ----------------------------------------------------------------------------- |
|
433 // |
|
434 EXPORT_C TInt CDrmPlayerUtility::SetBalance( |
|
435 TInt aBalance) |
|
436 { |
|
437 return iProperties->SetBalance(aBalance); |
|
438 } |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // CDrmPlayerUtility::GetBalance |
|
442 // Returns the current playback balance. |
|
443 // (other items were commented in a header). |
|
444 // ----------------------------------------------------------------------------- |
|
445 // |
|
446 EXPORT_C TInt CDrmPlayerUtility::GetBalance( |
|
447 TInt& aBalance) |
|
448 { |
|
449 return iProperties->GetBalance(aBalance); |
|
450 } |
|
451 |
|
452 // ----------------------------------------------------------------------------- |
|
453 // CDrmPlayerUtility::GetBitRate |
|
454 // Returns the bit rate of the audio clip |
|
455 // (other items were commented in a header). |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 EXPORT_C TInt CDrmPlayerUtility::GetBitRate( |
|
459 TUint& aBitRate) |
|
460 { |
|
461 return iProperties->GetBitRate(aBitRate); |
|
462 } |
|
463 |
|
464 // ----------------------------------------------------------------------------- |
|
465 // CDrmPlayerUtility::RegisterForAudioLoadingNotification |
|
466 // Registers callback object to receive notifications of audio loading/rebuffering. |
|
467 // (other items were commented in a header). |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 EXPORT_C void CDrmPlayerUtility::RegisterForAudioLoadingNotification( |
|
471 MAudioLoadingObserver& aCallback) |
|
472 { |
|
473 iProperties->RegisterForAudioLoadingNotification(aCallback); |
|
474 } |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // CDrmPlayerUtility::GetAudioLoadingProgressL |
|
478 // Returns the current progress of audio loading |
|
479 // (other items were commented in a header). |
|
480 // ----------------------------------------------------------------------------- |
|
481 // |
|
482 EXPORT_C void CDrmPlayerUtility::GetAudioLoadingProgressL( |
|
483 TInt& aPercentageProgress) |
|
484 { |
|
485 iProperties->GetAudioLoadingProgressL(aPercentageProgress); |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CDrmPlayerUtility::ControllerImplementationInformationL |
|
490 // Returns the controller implementation information associated with the current controller. |
|
491 // (other items were commented in a header). |
|
492 // ----------------------------------------------------------------------------- |
|
493 // |
|
494 EXPORT_C const CMMFControllerImplementationInformation& CDrmPlayerUtility::ControllerImplementationInformationL() |
|
495 { |
|
496 return iProperties->ControllerImplementationInformationL(); |
|
497 } |
|
498 |
|
499 // ----------------------------------------------------------------------------- |
|
500 // CDrmPlayerUtility::CustomCommandSync |
|
501 // Sends a synchronous custom command to the controller. |
|
502 // (other items were commented in a header). |
|
503 // ----------------------------------------------------------------------------- |
|
504 // |
|
505 EXPORT_C TInt CDrmPlayerUtility::CustomCommandSync( |
|
506 const TMMFMessageDestinationPckg& aDestination, |
|
507 TInt aFunction, |
|
508 const TDesC8& aDataTo1, |
|
509 const TDesC8& aDataTo2, |
|
510 TDes8& aDataFrom) |
|
511 { |
|
512 TInt status( KErrAccessDenied ); |
|
513 status = iProperties->CustomCommandSync(aDestination,aFunction,aDataTo1,aDataTo2,aDataFrom); |
|
514 |
|
515 return status; |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CDrmPlayerUtility::CustomCommandSync |
|
520 // Sends a synchronous custom command to the controller. |
|
521 // (other items were commented in a header). |
|
522 // ----------------------------------------------------------------------------- |
|
523 // |
|
524 EXPORT_C TInt CDrmPlayerUtility::CustomCommandSync( |
|
525 const TMMFMessageDestinationPckg& aDestination, |
|
526 TInt aFunction, |
|
527 const TDesC8& aDataTo1, |
|
528 const TDesC8& aDataTo2) |
|
529 { |
|
530 |
|
531 TInt status( KErrAccessDenied ); |
|
532 status = iProperties->CustomCommandSync(aDestination,aFunction,aDataTo1,aDataTo2); |
|
533 return status; |
|
534 |
|
535 } |
|
536 |
|
537 // ----------------------------------------------------------------------------- |
|
538 // CDrmPlayerUtility::CustomCommandAsync |
|
539 // Sends an asynchronous custom command to the controller |
|
540 // (other items were commented in a header). |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C void CDrmPlayerUtility::CustomCommandAsync( |
|
544 const TMMFMessageDestinationPckg& aDestination, |
|
545 TInt aFunction, |
|
546 const TDesC8& aDataTo1, |
|
547 const TDesC8& aDataTo2, |
|
548 TDes8& aDataFrom, |
|
549 TRequestStatus& aStatus) |
|
550 { |
|
551 |
|
552 iProperties->CustomCommandAsync(aDestination,aFunction,aDataTo1,aDataTo2,aDataFrom,aStatus); |
|
553 |
|
554 } |
|
555 |
|
556 // ----------------------------------------------------------------------------- |
|
557 // CDrmPlayerUtility::CustomCommandAsync |
|
558 // Sends an asynchronous custom command to the controller |
|
559 // (other items were commented in a header). |
|
560 // ----------------------------------------------------------------------------- |
|
561 // |
|
562 EXPORT_C void CDrmPlayerUtility::CustomCommandAsync( |
|
563 const TMMFMessageDestinationPckg& aDestination, |
|
564 TInt aFunction, |
|
565 const TDesC8& aDataTo1, |
|
566 const TDesC8& aDataTo2, |
|
567 TRequestStatus& aStatus) |
|
568 { |
|
569 |
|
570 iProperties->CustomCommandAsync(aDestination,aFunction,aDataTo1,aDataTo2,aStatus); |
|
571 |
|
572 } |
|
573 //========================================================================================================================= |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CMMFDrmAudioPlayerUtility::NewL |
|
580 // |
|
581 // (other items were commented in a header). |
|
582 // ----------------------------------------------------------------------------- |
|
583 // |
|
584 CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewL( |
|
585 MDrmAudioPlayerCallback& aCallback, |
|
586 TInt aPriority, |
|
587 TMdaPriorityPreference aPref) |
|
588 { |
|
589 CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard); |
|
590 CleanupStack::PushL(self); |
|
591 self->ConstructL(aPriority, aPref); |
|
592 CleanupStack::Pop(self); |
|
593 return self; |
|
594 } |
|
595 |
|
596 // ----------------------------------------------------------------------------- |
|
597 // CMMFDrmAudioPlayerUtility::NewFilePlayerL |
|
598 // |
|
599 // (other items were commented in a header). |
|
600 // ----------------------------------------------------------------------------- |
|
601 // |
|
602 CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewFilePlayerL( |
|
603 const TDesC& aFileName, |
|
604 MDrmAudioPlayerCallback& aCallback, |
|
605 TInt aPriority, |
|
606 TMdaPriorityPreference aPref) |
|
607 { |
|
608 CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard); |
|
609 CleanupStack::PushL(self); |
|
610 self->ConstructL(aFileName,aPriority,aPref); |
|
611 CleanupStack::Pop(self); |
|
612 return self; |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CMMFDrmAudioPlayerUtility::NewDesPlayerL |
|
617 // |
|
618 // (other items were commented in a header). |
|
619 // ----------------------------------------------------------------------------- |
|
620 // |
|
621 CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewDesPlayerL( |
|
622 const TDesC8& aData, |
|
623 MDrmAudioPlayerCallback& aCallback, |
|
624 TInt aPriority, |
|
625 TMdaPriorityPreference aPref) |
|
626 { |
|
627 CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard); |
|
628 CleanupStack::PushL(self); |
|
629 self->ConstructL(aData,aPriority,aPref); |
|
630 CleanupStack::Pop(self); |
|
631 return self; |
|
632 } |
|
633 |
|
634 // ----------------------------------------------------------------------------- |
|
635 // CMMFDrmAudioPlayerUtility::NewDesPlayerReadOnlyL |
|
636 // |
|
637 // (other items were commented in a header). |
|
638 // ----------------------------------------------------------------------------- |
|
639 // |
|
640 CMMFDrmAudioPlayerUtility* CMMFDrmAudioPlayerUtility::NewDesPlayerReadOnlyL( |
|
641 const TDesC8& aData, |
|
642 MDrmAudioPlayerCallback& aCallback, |
|
643 TInt aPriority, |
|
644 TMdaPriorityPreference aPref) |
|
645 { |
|
646 CMMFDrmAudioPlayerUtility* self = new(ELeave) CMMFDrmAudioPlayerUtility(aCallback,EPriorityStandard); |
|
647 CleanupStack::PushL(self); |
|
648 self->ConstructReadOnlyL(aData,aPriority,aPref); |
|
649 CleanupStack::Pop(self); |
|
650 return self; |
|
651 } |
|
652 |
|
653 |
|
654 // Destructor |
|
655 CMMFDrmAudioPlayerUtility::~CMMFDrmAudioPlayerUtility() |
|
656 { |
|
657 Stop(); |
|
658 Cancel(); |
|
659 delete iDrm; |
|
660 delete iMetaDataBuffer; |
|
661 if(iDrmSession) |
|
662 { |
|
663 iDrmSession->Disconnect(); |
|
664 iDrmSession->Close(); |
|
665 delete iDrmSession; |
|
666 iDrmSession = NULL; |
|
667 } |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------------------------- |
|
671 // CMMFDrmAudioPlayerUtility::CMMFDrmAudioPlayerUtility |
|
672 // |
|
673 // (other items were commented in a header). |
|
674 // ----------------------------------------------------------------------------- |
|
675 // |
|
676 CMMFDrmAudioPlayerUtility::CMMFDrmAudioPlayerUtility( |
|
677 MDrmAudioPlayerCallback& aCallback, |
|
678 TInt aActivePriority) |
|
679 : CActive(aActivePriority), |
|
680 iCallback(aCallback) |
|
681 { |
|
682 } |
|
683 |
|
684 // ----------------------------------------------------------------------------- |
|
685 // CMMFDrmAudioPlayerUtility::ConstructL |
|
686 // |
|
687 // (other items were commented in a header). |
|
688 // ----------------------------------------------------------------------------- |
|
689 // |
|
690 void CMMFDrmAudioPlayerUtility::ConstructL( |
|
691 TInt aPriority, |
|
692 TMdaPriorityPreference aPref) |
|
693 { |
|
694 ConnectL(); |
|
695 TDataStruct theStruct; |
|
696 |
|
697 theStruct.iPriority = aPriority; |
|
698 theStruct.iPref = aPref; |
|
699 |
|
700 TDataStructPckgBuf pckg(theStruct); |
|
701 iState = EInitializing; |
|
702 iDrmSession->Send(EDRMPlayServNewPlayerL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct)); |
|
703 } |
|
704 |
|
705 // ----------------------------------------------------------------------------- |
|
706 // CMMFDrmAudioPlayerUtility::ConstructL |
|
707 // |
|
708 // (other items were commented in a header). |
|
709 // ----------------------------------------------------------------------------- |
|
710 // |
|
711 void CMMFDrmAudioPlayerUtility::ConstructL( |
|
712 const TDesC& aFileName, |
|
713 TInt aPriority, |
|
714 TMdaPriorityPreference aPref) |
|
715 { |
|
716 ConnectL(); |
|
717 |
|
718 iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref)); |
|
719 TDataStructPckgBuf pckgBuf; |
|
720 TDataStruct &theStruct = pckgBuf(); |
|
721 |
|
722 |
|
723 |
|
724 theStruct.iPriority = aPriority; |
|
725 theStruct.iPref = aPref; |
|
726 iFileName = aFileName; |
|
727 |
|
728 iState = EInitializing; |
|
729 if (!IsActive()) |
|
730 { |
|
731 iDrmSession->Send(EDRMPlayServNewFilePlayerL,TIpcArgs(&iAsyncCallback,&pckgBuf,&iErrorDurationStruct,&iFileName),iStatus); |
|
732 SetActive(); |
|
733 } |
|
734 else |
|
735 { |
|
736 User::Leave(KErrNotReady); |
|
737 } |
|
738 } |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // CMMFDrmAudioPlayerUtility::ConstructL |
|
742 // |
|
743 // (other items were commented in a header). |
|
744 // ----------------------------------------------------------------------------- |
|
745 // |
|
746 void CMMFDrmAudioPlayerUtility::ConstructL( |
|
747 const TDesC8& aData, |
|
748 TInt aPriority, |
|
749 TMdaPriorityPreference aPref) |
|
750 { |
|
751 ConnectL(); |
|
752 TDataStruct theStruct; |
|
753 |
|
754 theStruct.iData = aData; |
|
755 iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref)); |
|
756 |
|
757 TDataStructPckgBuf pckg(theStruct); |
|
758 |
|
759 iState = EInitializing; |
|
760 if (!IsActive()) |
|
761 { |
|
762 iDrmSession->Send(EDRMPlayServNewDesPlayerL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus); |
|
763 SetActive(); |
|
764 } |
|
765 else |
|
766 { |
|
767 User::Leave(KErrNotReady); |
|
768 } |
|
769 } |
|
770 |
|
771 // ----------------------------------------------------------------------------- |
|
772 // CMMFDrmAudioPlayerUtility::ConstructReadOnlyL |
|
773 // |
|
774 // (other items were commented in a header). |
|
775 // ----------------------------------------------------------------------------- |
|
776 // |
|
777 void CMMFDrmAudioPlayerUtility::ConstructReadOnlyL( |
|
778 const TDesC8& aData, |
|
779 TInt aPriority, |
|
780 TMdaPriorityPreference aPref) |
|
781 { |
|
782 ConnectL(); |
|
783 TDataStruct theStruct; |
|
784 |
|
785 theStruct.iData = aData; |
|
786 iDrmSession->Send(EDRMPlayServSetPriorityPreference,TIpcArgs(aPriority,aPref)); |
|
787 |
|
788 TDataStructPckgBuf pckg(theStruct); |
|
789 |
|
790 iState = EInitializing; |
|
791 if (!IsActive()) |
|
792 { |
|
793 iDrmSession->Send(EDRMPlayServNewDesPlayerReadOnlyL,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus); |
|
794 SetActive(); |
|
795 } |
|
796 else |
|
797 { |
|
798 User::Leave(KErrNotReady); |
|
799 } |
|
800 } |
|
801 |
|
802 // ----------------------------------------------------------------------------- |
|
803 // CMMFDrmAudioPlayerUtility::ConnectL |
|
804 // |
|
805 // (other items were commented in a header). |
|
806 // ----------------------------------------------------------------------------- |
|
807 // |
|
808 void CMMFDrmAudioPlayerUtility::ConnectL() |
|
809 { |
|
810 CActiveScheduler::Add(this); |
|
811 iDrmSession = new(ELeave) RDrmSession(); |
|
812 User::LeaveIfError( iDrmSession->Connect() ); |
|
813 } |
|
814 |
|
815 // ----------------------------------------------------------------------------- |
|
816 // CMMFDrmAudioPlayerUtility::OpenFileL |
|
817 // |
|
818 // (other items were commented in a header). |
|
819 // ----------------------------------------------------------------------------- |
|
820 // |
|
821 void CMMFDrmAudioPlayerUtility::OpenFileL( |
|
822 const TDesC& aFileName) |
|
823 { |
|
824 iState = EInitializing; |
|
825 if (!IsActive()) |
|
826 { |
|
827 iDrmSession->Send(EDRMPlayServOpenFile,TIpcArgs(&iAsyncCallback,&aFileName,&iErrorDurationStruct),iStatus); |
|
828 SetActive(); |
|
829 } |
|
830 else |
|
831 { |
|
832 User::Leave(KErrNotReady); |
|
833 } |
|
834 } |
|
835 |
|
836 // ----------------------------------------------------------------------------- |
|
837 // CMMFDrmAudioPlayerUtility::OpenFileL |
|
838 // |
|
839 // (other items were commented in a header). |
|
840 // ----------------------------------------------------------------------------- |
|
841 // |
|
842 void CMMFDrmAudioPlayerUtility::OpenFileL( |
|
843 const RFile& aFile) |
|
844 { |
|
845 TIpcArgs ipcArgs; |
|
846 aFile.TransferToServer(ipcArgs, 1, 3); |
|
847 ipcArgs.Set(0,&iAsyncCallback); |
|
848 ipcArgs.Set(2,&iErrorDurationStruct); |
|
849 iState = EInitializing; |
|
850 if (!IsActive()) |
|
851 { |
|
852 iDrmSession->Send(EDRMPlayServOpenFileByHandle,ipcArgs,iStatus); |
|
853 SetActive(); |
|
854 } |
|
855 else |
|
856 { |
|
857 User::Leave(KErrNotReady); |
|
858 } |
|
859 } |
|
860 |
|
861 // ----------------------------------------------------------------------------- |
|
862 // CMMFDrmAudioPlayerUtility::OpenFileL |
|
863 // |
|
864 // (other items were commented in a header). |
|
865 // ----------------------------------------------------------------------------- |
|
866 // |
|
867 #ifdef SYMBIAN_CAF_V2 |
|
868 void CMMFDrmAudioPlayerUtility::OpenFileL(const TMMSource& aSource) |
|
869 { |
|
870 if (aSource.SourceType()==KUidMMFileHandleSource) |
|
871 { |
|
872 #ifdef SYMBIAN_SECURITY_CAF_RFILE_HANDLE |
|
873 RFile& fileHandle = static_cast<const TMMFileHandleSource&>(aSource).Handle(); |
|
874 OpenFileL(fileHandle); |
|
875 #else |
|
876 User::Leave(KErrNotSupported); |
|
877 #endif |
|
878 } |
|
879 if (aSource.SourceType()==KUidMMFileSource) |
|
880 { |
|
881 const TDesC& fileName = static_cast<const TMMFileSource&>(aSource).Name(); |
|
882 OpenFileL(fileName); |
|
883 } |
|
884 } |
|
885 #endif |
|
886 |
|
887 |
|
888 // ----------------------------------------------------------------------------- |
|
889 // CMMFDrmAudioPlayerUtility::OpenDesL |
|
890 // |
|
891 // (other items were commented in a header). |
|
892 // ----------------------------------------------------------------------------- |
|
893 // |
|
894 void CMMFDrmAudioPlayerUtility::OpenDesL( |
|
895 const TDesC8& aDescriptor) |
|
896 { |
|
897 iStatus = EInitializing; |
|
898 if (!IsActive()) |
|
899 { |
|
900 iDrmSession->Send(EDRMPlayServOpenDes,TIpcArgs(&iAsyncCallback,&aDescriptor,&iErrorDurationStruct),iStatus); |
|
901 SetActive(); |
|
902 } |
|
903 else |
|
904 { |
|
905 User::Leave(KErrNotReady); |
|
906 } |
|
907 } |
|
908 |
|
909 // ----------------------------------------------------------------------------- |
|
910 // CMMFDrmAudioPlayerUtility::OpenUrlL |
|
911 // |
|
912 // (other items were commented in a header). |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 void CMMFDrmAudioPlayerUtility::OpenUrlL( |
|
916 const TDesC& aUrl, |
|
917 const TInt aIapId, |
|
918 const TDesC8& aMimeType) |
|
919 { |
|
920 TUrlStruct theStruct; |
|
921 |
|
922 theStruct.iUrl = aUrl; |
|
923 theStruct.iIapId = aIapId; |
|
924 theStruct.iMimeType = aMimeType; |
|
925 |
|
926 TUrlStructPckgBuf pckg(theStruct); |
|
927 iStatus = EInitializing; |
|
928 if (!IsActive()) |
|
929 { |
|
930 iDrmSession->Send(EDRMPlayServOpenUrl,TIpcArgs(&iAsyncCallback,&pckg,&iErrorDurationStruct),iStatus); |
|
931 SetActive(); |
|
932 } |
|
933 else |
|
934 { |
|
935 User::Leave(KErrNotReady); |
|
936 } |
|
937 } |
|
938 |
|
939 // ----------------------------------------------------------------------------- |
|
940 // CMMFDrmAudioPlayerUtility::Play |
|
941 // |
|
942 // (other items were commented in a header). |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 void CMMFDrmAudioPlayerUtility::Play() |
|
946 { |
|
947 if (iState != EPlaying) |
|
948 { |
|
949 iState = EPlaying; |
|
950 if (!IsActive()) |
|
951 { |
|
952 SetActive(); |
|
953 iDrmSession->Send(EDRMPlayServPlay,TIpcArgs(&iAsyncCallback,0,&iErrorDurationStruct),iStatus); |
|
954 } |
|
955 } |
|
956 } |
|
957 |
|
958 // ----------------------------------------------------------------------------- |
|
959 // CMMFDrmAudioPlayerUtility::Stop |
|
960 // |
|
961 // (other items were commented in a header). |
|
962 // ----------------------------------------------------------------------------- |
|
963 // |
|
964 void CMMFDrmAudioPlayerUtility::Stop() |
|
965 { |
|
966 iDrmSession->Send(EDRMPlayServStop); |
|
967 if (IsActive()) |
|
968 { |
|
969 Cancel(); |
|
970 } |
|
971 |
|
972 iState = EIdle; |
|
973 } |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CMMFDrmAudioPlayerUtility::Pause |
|
977 // |
|
978 // (other items were commented in a header). |
|
979 // ----------------------------------------------------------------------------- |
|
980 // |
|
981 TInt CMMFDrmAudioPlayerUtility::Pause() |
|
982 { |
|
983 iDrmSession->Send(EDRMPlayServPause); |
|
984 iState = EPaused; |
|
985 return KErrNone; |
|
986 } |
|
987 |
|
988 // ----------------------------------------------------------------------------- |
|
989 // CMMFDrmAudioPlayerUtility::Close |
|
990 // |
|
991 // (other items were commented in a header). |
|
992 // ----------------------------------------------------------------------------- |
|
993 // |
|
994 void CMMFDrmAudioPlayerUtility::Close() |
|
995 { |
|
996 if (IsActive()) |
|
997 { |
|
998 Cancel(); |
|
999 } |
|
1000 iDrmSession->Send(EDRMPlayServClose); |
|
1001 } |
|
1002 |
|
1003 // ----------------------------------------------------------------------------- |
|
1004 // CMMFDrmAudioPlayerUtility::SetVolume |
|
1005 // |
|
1006 // (other items were commented in a header). |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // |
|
1009 void CMMFDrmAudioPlayerUtility::SetVolume( |
|
1010 TInt aVolume) |
|
1011 { |
|
1012 iDrmSession->Send(EDRMPlayServSetVolume,TIpcArgs(aVolume)); |
|
1013 } |
|
1014 |
|
1015 // ----------------------------------------------------------------------------- |
|
1016 // CMMFDrmAudioPlayerUtility::SetRepeats |
|
1017 // |
|
1018 // (other items were commented in a header). |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // |
|
1021 void CMMFDrmAudioPlayerUtility::SetRepeats( |
|
1022 TInt aRepeatNumberOfTimes, |
|
1023 const TTimeIntervalMicroSeconds& aTrailingSilence) |
|
1024 { |
|
1025 |
|
1026 TPckgTTimeIntervalMicroSeconds trailingSilencePckg(aTrailingSilence); |
|
1027 iDrmSession->Send(EDRMPlayServSetRepeats,TIpcArgs(aRepeatNumberOfTimes,&trailingSilencePckg)); |
|
1028 } |
|
1029 |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // CMMFDrmAudioPlayerUtility::SetVolumeRamp |
|
1032 // |
|
1033 // (other items were commented in a header). |
|
1034 // ----------------------------------------------------------------------------- |
|
1035 // |
|
1036 void CMMFDrmAudioPlayerUtility::SetVolumeRamp( |
|
1037 const TTimeIntervalMicroSeconds& aRampDuration) |
|
1038 { |
|
1039 |
|
1040 TPckgTTimeIntervalMicroSeconds volumeRampPckg(aRampDuration); |
|
1041 iDrmSession->Send(EDRMPlayServSetVolumeRamp,TIpcArgs(&volumeRampPckg)); |
|
1042 } |
|
1043 |
|
1044 // ----------------------------------------------------------------------------- |
|
1045 // CMMFDrmAudioPlayerUtility::SetPriority |
|
1046 // |
|
1047 // (other items were commented in a header). |
|
1048 // ----------------------------------------------------------------------------- |
|
1049 // |
|
1050 TInt CMMFDrmAudioPlayerUtility::SetPriority( |
|
1051 TInt aPriority, |
|
1052 TMdaPriorityPreference aPref) |
|
1053 { |
|
1054 return iDrmSession->Send(EDRMPlayServSetPriority,TIpcArgs(aPriority,aPref)); |
|
1055 } |
|
1056 |
|
1057 // ----------------------------------------------------------------------------- |
|
1058 // CMMFDrmAudioPlayerUtility::Duration |
|
1059 // |
|
1060 // (other items were commented in a header). |
|
1061 // ----------------------------------------------------------------------------- |
|
1062 // |
|
1063 const TTimeIntervalMicroSeconds& CMMFDrmAudioPlayerUtility::Duration() |
|
1064 { |
|
1065 TPckgBufTTimeIntervalMicroSeconds pckg; |
|
1066 iDrmSession->Send(EDRMPlayServDuration,TIpcArgs(&pckg)); |
|
1067 return pckg(); |
|
1068 } |
|
1069 |
|
1070 |
|
1071 // ----------------------------------------------------------------------------- |
|
1072 // CMMFDrmAudioPlayerUtility::MaxVolume |
|
1073 // |
|
1074 // (other items were commented in a header). |
|
1075 // ----------------------------------------------------------------------------- |
|
1076 // |
|
1077 TInt CMMFDrmAudioPlayerUtility::MaxVolume() |
|
1078 { |
|
1079 return iDrmSession->Send(EDRMPlayServMaxVolume); |
|
1080 } |
|
1081 |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // CMMFDrmAudioPlayerUtility::GetPosition |
|
1084 // |
|
1085 // (other items were commented in a header). |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 // |
|
1088 TInt CMMFDrmAudioPlayerUtility::GetPosition( |
|
1089 TTimeIntervalMicroSeconds& aPosition) |
|
1090 { |
|
1091 TPckgTTimeIntervalMicroSeconds thePositionPckg(aPosition); |
|
1092 TInt ret = iDrmSession->Send(EDRMPlayServGetPosition,TIpcArgs(&thePositionPckg)); |
|
1093 aPosition = thePositionPckg(); |
|
1094 return ret; |
|
1095 } |
|
1096 |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // CMMFDrmAudioPlayerUtility::SetPosition |
|
1099 // |
|
1100 // (other items were commented in a header). |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 // |
|
1103 void CMMFDrmAudioPlayerUtility::SetPosition( |
|
1104 const TTimeIntervalMicroSeconds& aPosition) |
|
1105 { |
|
1106 TSetPositionStruct sendPckg; |
|
1107 sendPckg.iPosition = aPosition; |
|
1108 |
|
1109 TSetPositionStructBuf pckg(sendPckg); |
|
1110 iDrmSession->Send(EDRMPlayServSetPosition,TIpcArgs(&pckg)); |
|
1111 } |
|
1112 |
|
1113 // ----------------------------------------------------------------------------- |
|
1114 // CMMFDrmAudioPlayerUtility::GetVolume |
|
1115 // |
|
1116 // (other items were commented in a header). |
|
1117 // ----------------------------------------------------------------------------- |
|
1118 // |
|
1119 TInt CMMFDrmAudioPlayerUtility::GetVolume(TInt& aVolume) |
|
1120 { |
|
1121 TInt theReturnValue; |
|
1122 TPckgBufTInt theVolume; |
|
1123 theReturnValue = iDrmSession->Send(EDRMPlayServGetVolume,TIpcArgs(&theVolume)); |
|
1124 aVolume = theVolume(); |
|
1125 return theReturnValue; |
|
1126 } |
|
1127 |
|
1128 // ----------------------------------------------------------------------------- |
|
1129 // CMMFDrmAudioPlayerUtility::GetNumberOfMetaDataEntries |
|
1130 // |
|
1131 // (other items were commented in a header). |
|
1132 // ----------------------------------------------------------------------------- |
|
1133 // |
|
1134 TInt CMMFDrmAudioPlayerUtility::GetNumberOfMetaDataEntries( |
|
1135 TInt& aNumEntries) |
|
1136 { |
|
1137 TPckgBufTInt theNumEntries; |
|
1138 TInt retValue = iDrmSession->Send(EDRMPlayServGetNumberOfMetaDataEntries,TIpcArgs(&theNumEntries)); |
|
1139 aNumEntries = theNumEntries(); |
|
1140 return retValue; |
|
1141 } |
|
1142 |
|
1143 // ----------------------------------------------------------------------------- |
|
1144 // CMMFDrmAudioPlayerUtility::GetMetaDataEntryL |
|
1145 // |
|
1146 // (other items were commented in a header). |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // |
|
1149 CMMFMetaDataEntry* CMMFDrmAudioPlayerUtility::GetMetaDataEntryL( |
|
1150 TInt aMetaDataIndex) |
|
1151 { |
|
1152 TBuf8<100> data; |
|
1153 iDrmSession->Send(EDRMPlayServGetMetaDataEntry,TIpcArgs(aMetaDataIndex,&data)); |
|
1154 delete iMetaDataBuffer; |
|
1155 iMetaDataBuffer = NULL; |
|
1156 iMetaDataBuffer = CBufFlat::NewL(32); |
|
1157 HBufC8* theData = data.Alloc(); |
|
1158 iMetaDataBuffer->InsertL(0,theData->Des()); |
|
1159 RBufReadStream s; |
|
1160 s.Open(*iMetaDataBuffer); |
|
1161 CleanupClosePushL(s); |
|
1162 CMMFMetaDataEntry* theMetaDataEntry = CMMFMetaDataEntry::NewL(); |
|
1163 theMetaDataEntry->InternalizeL(s); |
|
1164 CleanupStack::PopAndDestroy();//s |
|
1165 return theMetaDataEntry; |
|
1166 } |
|
1167 |
|
1168 // ----------------------------------------------------------------------------- |
|
1169 // CMMFDrmAudioPlayerUtility::SetPlayWindow |
|
1170 // |
|
1171 // (other items were commented in a header). |
|
1172 // ----------------------------------------------------------------------------- |
|
1173 // |
|
1174 TInt CMMFDrmAudioPlayerUtility::SetPlayWindow( |
|
1175 const TTimeIntervalMicroSeconds& aPlayStart, |
|
1176 const TTimeIntervalMicroSeconds& aPlayEnd) |
|
1177 { |
|
1178 TPlayWindowStruct sendPckg; |
|
1179 sendPckg.iPlayStart = aPlayStart; |
|
1180 sendPckg.iPlayEnd = aPlayEnd; |
|
1181 |
|
1182 TPlayWindowStructBuf pckg(sendPckg); |
|
1183 |
|
1184 return iDrmSession->Send(EDRMPlayServSetPlayWindow,TIpcArgs(&pckg)); |
|
1185 } |
|
1186 |
|
1187 // ----------------------------------------------------------------------------- |
|
1188 // CMMFDrmAudioPlayerUtility::ClearPlayWindow |
|
1189 // |
|
1190 // (other items were commented in a header). |
|
1191 // ----------------------------------------------------------------------------- |
|
1192 // |
|
1193 TInt CMMFDrmAudioPlayerUtility::ClearPlayWindow() |
|
1194 { |
|
1195 return iDrmSession->Send(EDRMPlayServClearPlayWindow); |
|
1196 } |
|
1197 |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 // CMMFDrmAudioPlayerUtility::SetBalance |
|
1200 // |
|
1201 // (other items were commented in a header). |
|
1202 // ----------------------------------------------------------------------------- |
|
1203 // |
|
1204 TInt CMMFDrmAudioPlayerUtility::SetBalance( |
|
1205 TInt aBalance) |
|
1206 { |
|
1207 return iDrmSession->Send(EDRMPlayServSetBalance,TIpcArgs(aBalance)); |
|
1208 } |
|
1209 |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // CMMFDrmAudioPlayerUtility::GetBitRate |
|
1212 // |
|
1213 // (other items were commented in a header). |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 // |
|
1216 TInt CMMFDrmAudioPlayerUtility::GetBitRate( |
|
1217 TUint& aBitRate) |
|
1218 { |
|
1219 TPckgBufTUint pckg; |
|
1220 TInt retValue = iDrmSession->Send(EDRMPlayServGetBitRate,TIpcArgs(&pckg)); |
|
1221 aBitRate = pckg(); |
|
1222 return retValue; |
|
1223 } |
|
1224 |
|
1225 // ----------------------------------------------------------------------------- |
|
1226 // CMMFDrmAudioPlayerUtility::ControllerImplementationInformationL |
|
1227 // |
|
1228 // (other items were commented in a header). |
|
1229 // ----------------------------------------------------------------------------- |
|
1230 // |
|
1231 const CMMFControllerImplementationInformation& CMMFDrmAudioPlayerUtility::ControllerImplementationInformationL() |
|
1232 { |
|
1233 TUid theUid; |
|
1234 iDrmSession->Send(EDRMPlayServControllerImplementationInformation,TIpcArgs(&theUid)); |
|
1235 iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(theUid); |
|
1236 return *iControllerImplementationInformation; |
|
1237 } |
|
1238 |
|
1239 // ----------------------------------------------------------------------------- |
|
1240 // CMMFDrmAudioPlayerUtility::GetAudioLoadingProgressL |
|
1241 // |
|
1242 // (other items were commented in a header). |
|
1243 // ----------------------------------------------------------------------------- |
|
1244 // |
|
1245 void CMMFDrmAudioPlayerUtility::GetAudioLoadingProgressL( |
|
1246 TInt& aPercentageProgress) |
|
1247 { |
|
1248 TPckgBufTInt pckg; |
|
1249 iDrmSession->Send(EDRMPlayServGetAudioLoadingProgress,TIpcArgs(&pckg)); |
|
1250 aPercentageProgress = pckg(); |
|
1251 } |
|
1252 |
|
1253 // ----------------------------------------------------------------------------- |
|
1254 // CMMFDrmAudioPlayerUtility::CustomCommandSync |
|
1255 // |
|
1256 // (other items were commented in a header). |
|
1257 // ----------------------------------------------------------------------------- |
|
1258 // |
|
1259 TInt CMMFDrmAudioPlayerUtility::CustomCommandSync( |
|
1260 const TMMFMessageDestinationPckg& aDestination, |
|
1261 TInt aFunction, |
|
1262 const TDesC8& aDataTo1, |
|
1263 const TDesC8& aDataTo2, |
|
1264 TDes8& aDataFrom) |
|
1265 { |
|
1266 TInt theReturnValue(KErrPermissionDenied); |
|
1267 |
|
1268 TPckgCustomCommand thePckg; |
|
1269 thePckg().iDestination = aDestination; |
|
1270 thePckg().iFunction = aFunction; |
|
1271 /* |
|
1272 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]RetDesLen[%d]"), |
|
1273 thePckg().iDestination().InterfaceId(), |
|
1274 thePckg().iDestination().DestinationHandle(), |
|
1275 thePckg().iFunction, |
|
1276 aDataFrom.Length()); |
|
1277 */ |
|
1278 // Only Pass 'Allowed CustomCommand |
|
1279 if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) ) |
|
1280 { |
|
1281 theReturnValue = iDrmSession->Send( EDRMPlayServCustomCommandSyncWithReturn, |
|
1282 TIpcArgs(&thePckg, &aDataTo1, &aDataTo2, &aDataFrom)); |
|
1283 } |
|
1284 return theReturnValue; |
|
1285 } |
|
1286 |
|
1287 // ----------------------------------------------------------------------------- |
|
1288 // CMMFDrmAudioPlayerUtility::CustomCommandSync |
|
1289 // |
|
1290 // (other items were commented in a header). |
|
1291 // ----------------------------------------------------------------------------- |
|
1292 // |
|
1293 TInt CMMFDrmAudioPlayerUtility::CustomCommandSync( |
|
1294 const TMMFMessageDestinationPckg& aDestination, |
|
1295 TInt aFunction, |
|
1296 const TDesC8& aDataTo1, |
|
1297 const TDesC8& aDataTo2) |
|
1298 { |
|
1299 TInt theReturnValue(KErrPermissionDenied); |
|
1300 |
|
1301 TPckgCustomCommand thePckg; |
|
1302 thePckg().iDestination = aDestination; |
|
1303 thePckg().iFunction = aFunction; |
|
1304 /* |
|
1305 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandSync:IFId[%x]DestHndl[%x]Fn[%d]"), |
|
1306 thePckg().iDestination().InterfaceId(), |
|
1307 thePckg().iDestination().DestinationHandle(), |
|
1308 thePckg().iFunction); |
|
1309 */ |
|
1310 // Only Pass 'Allowed CustomCommand |
|
1311 if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) ) |
|
1312 { |
|
1313 theReturnValue = iDrmSession->Send( EDRMPlayServCustomCommandSyncWithoutReturn, |
|
1314 TIpcArgs(&thePckg, &aDataTo1, &aDataTo2)); |
|
1315 } |
|
1316 return theReturnValue; |
|
1317 } |
|
1318 |
|
1319 // ----------------------------------------------------------------------------- |
|
1320 // CMMFDrmAudioPlayerUtility::CustomCommandAsync |
|
1321 // |
|
1322 // (other items were commented in a header). |
|
1323 // ----------------------------------------------------------------------------- |
|
1324 // |
|
1325 void CMMFDrmAudioPlayerUtility::CustomCommandAsync( |
|
1326 const TMMFMessageDestinationPckg& aDestination, |
|
1327 TInt aFunction, |
|
1328 const TDesC8& aDataTo1, |
|
1329 const TDesC8& aDataTo2, |
|
1330 TDes8& aDataFrom, |
|
1331 TRequestStatus& aStatus ) |
|
1332 { |
|
1333 TPckgCustomCommand thePckg; |
|
1334 thePckg().iDestination = aDestination; |
|
1335 thePckg().iFunction = aFunction; |
|
1336 TInt status(KErrPermissionDenied); |
|
1337 /* |
|
1338 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]RetDesLen[Len:%d:MaxLen:%d]"), |
|
1339 thePckg().iDestination().InterfaceId(), |
|
1340 thePckg().iDestination().DestinationHandle(), |
|
1341 thePckg().iFunction, |
|
1342 aDataTo1.Length(), |
|
1343 aDataTo2.Length(), |
|
1344 aDataFrom.Length(), |
|
1345 aDataFrom.MaxLength() ); |
|
1346 */ |
|
1347 // Only Pass 'Allowed CustomCommand |
|
1348 if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) ) |
|
1349 { |
|
1350 // Send in two steps, data in first step and async request in second step |
|
1351 // othewise thePckg will become invalid when tried to read from server |
|
1352 status = iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithReturnStep1, |
|
1353 TIpcArgs(&thePckg, &aDataTo1, &aDataTo2) ); |
|
1354 if ( status == KErrNone ) |
|
1355 { |
|
1356 // Pass descriptor place holder to get data back in the async call |
|
1357 iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithReturnStep2, |
|
1358 TIpcArgs(&aDataFrom), |
|
1359 aStatus ); |
|
1360 } |
|
1361 #ifdef _DEBUG |
|
1362 else |
|
1363 { |
|
1364 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]RetDesLen[Len:%d:MaxLen:%d]DRM Proxy CustCmdAsyncWRet Step1[%d]"), |
|
1365 thePckg().iDestination().InterfaceId(), |
|
1366 thePckg().iDestination().DestinationHandle(), |
|
1367 thePckg().iFunction, |
|
1368 aDataTo1.Length(), |
|
1369 aDataTo2.Length(), |
|
1370 aDataFrom.Length(), |
|
1371 aDataFrom.MaxLength(), |
|
1372 status ); |
|
1373 } |
|
1374 #endif // _DEBUG |
|
1375 } |
|
1376 if ( status != KErrNone ) |
|
1377 { |
|
1378 TRequestStatus* s = &aStatus; |
|
1379 User::RequestComplete( s , status ); |
|
1380 } |
|
1381 } |
|
1382 |
|
1383 // ----------------------------------------------------------------------------- |
|
1384 // CMMFDrmAudioPlayerUtility::CustomCommandAsync |
|
1385 // |
|
1386 // (other items were commented in a header). |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CMMFDrmAudioPlayerUtility::CustomCommandAsync( |
|
1390 const TMMFMessageDestinationPckg& aDestination, |
|
1391 TInt aFunction, |
|
1392 const TDesC8& aDataTo1, |
|
1393 const TDesC8& aDataTo2, |
|
1394 TRequestStatus& aStatus) |
|
1395 { |
|
1396 TPckgCustomCommand thePckg; |
|
1397 thePckg().iDestination = aDestination; |
|
1398 thePckg().iFunction = aFunction; |
|
1399 |
|
1400 TInt status(KErrPermissionDenied); |
|
1401 /* |
|
1402 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]"), |
|
1403 thePckg().iDestination().InterfaceId(), |
|
1404 thePckg().iDestination().DestinationHandle(), |
|
1405 thePckg().iFunction, |
|
1406 aDataTo1.Length(), |
|
1407 aDataTo2.Length() ); |
|
1408 */ |
|
1409 // Only Pass 'Allowed CustomCommand |
|
1410 if ( IsValidCustomCommandDestination(aDestination().InterfaceId(), aDataTo1) ) |
|
1411 { |
|
1412 // Send in two steps, data in first step and async request in second step |
|
1413 // othewise thePckg will become invalid when tried to read from server |
|
1414 status = iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithoutReturnStep1, |
|
1415 TIpcArgs(&thePckg, &aDataTo1, &aDataTo2) ); |
|
1416 if ( status == KErrNone ) |
|
1417 { |
|
1418 iDrmSession->Send( EDRMPlayServCustomCommandAsyncWithoutReturnStep2, |
|
1419 TIpcArgs(), |
|
1420 aStatus ); |
|
1421 } |
|
1422 #ifdef _DEBUG |
|
1423 else |
|
1424 { |
|
1425 RDebug::Print(_L("CMMFDrmAudioPlayerUtility::CustomCommandAsync:IFId[%x]DestHndl[%x]Fn[%d]Data1[Len:%d]Data2Len[Len:%d]DRM Proxy CustCmdAsyncWoRet Step1[%d]"), |
|
1426 thePckg().iDestination().InterfaceId(), |
|
1427 thePckg().iDestination().DestinationHandle(), |
|
1428 thePckg().iFunction, |
|
1429 aDataTo1.Length(), |
|
1430 aDataTo2.Length(), |
|
1431 status ); |
|
1432 } |
|
1433 #endif // _DEBUG |
|
1434 } |
|
1435 if ( status != KErrNone ) |
|
1436 { |
|
1437 TRequestStatus* s = &aStatus; |
|
1438 User::RequestComplete( s , status ); |
|
1439 } |
|
1440 } |
|
1441 |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // CMMFDrmAudioPlayerUtility::GetBalance |
|
1444 // |
|
1445 // (other items were commented in a header). |
|
1446 // ----------------------------------------------------------------------------- |
|
1447 // |
|
1448 TInt CMMFDrmAudioPlayerUtility::GetBalance( |
|
1449 TInt& aBalance) |
|
1450 { |
|
1451 TPckgBufTInt theBalance; |
|
1452 |
|
1453 TInt retValue = iDrmSession->Send(EDRMPlayServGetBalance,TIpcArgs(&theBalance)); |
|
1454 aBalance = theBalance(); |
|
1455 return retValue; |
|
1456 } |
|
1457 |
|
1458 // ----------------------------------------------------------------------------- |
|
1459 // CMMFDrmAudioPlayerUtility::RegisterForAudioLoadingNotification |
|
1460 // |
|
1461 // (other items were commented in a header). |
|
1462 // ----------------------------------------------------------------------------- |
|
1463 // |
|
1464 void CMMFDrmAudioPlayerUtility::RegisterForAudioLoadingNotification( |
|
1465 MAudioLoadingObserver& aLoadingObserver) |
|
1466 { |
|
1467 iAsyncCallback() = ELoadingStarted; |
|
1468 iLoadingObserver = &aLoadingObserver; |
|
1469 iDrmSession->Send(EDRMPlayServRegisterForAudioLoadingNotification,TIpcArgs(&iAsyncCallback)); |
|
1470 } |
|
1471 |
|
1472 |
|
1473 // ----------------------------------------------------------------------------- |
|
1474 // CMMFDrmAudioPlayerUtility::DoCancel |
|
1475 // |
|
1476 // (other items were commented in a header). |
|
1477 // ----------------------------------------------------------------------------- |
|
1478 // |
|
1479 void CMMFDrmAudioPlayerUtility::DoCancel() |
|
1480 { |
|
1481 } |
|
1482 |
|
1483 // ----------------------------------------------------------------------------- |
|
1484 // CMMFDrmAudioPlayerUtility::RunL |
|
1485 // |
|
1486 // (other items were commented in a header). |
|
1487 // ----------------------------------------------------------------------------- |
|
1488 // |
|
1489 void CMMFDrmAudioPlayerUtility::RunL() |
|
1490 { |
|
1491 DEP_PRN1(_L("CMMFDrmAudioPlayerUtility::RunL:iStatus[%d]"), iStatus.Int()); |
|
1492 |
|
1493 if (iState == EPaused) |
|
1494 { |
|
1495 return; |
|
1496 } |
|
1497 if ( iStatus.Int() == KErrCancel ) |
|
1498 return; |
|
1499 switch (iAsyncCallback()) |
|
1500 { |
|
1501 case EInitComplete: |
|
1502 if (iState != EIdle) |
|
1503 { |
|
1504 DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - InitComplete")); |
|
1505 iState = EIdle; |
|
1506 iCallback.MdapcInitComplete(iErrorDurationStruct().iError, iErrorDurationStruct().iDuration); |
|
1507 } |
|
1508 break; |
|
1509 |
|
1510 case EPlayComplete: |
|
1511 DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - PlayComplete")); |
|
1512 iState = EIdle; |
|
1513 iCallback.MdapcPlayComplete(iErrorDurationStruct().iError); |
|
1514 break; |
|
1515 |
|
1516 case ELoadingStarted: |
|
1517 DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - MaloLoadingStarted")); |
|
1518 |
|
1519 iDrmSession->Send(EDRMPlayServRegisterForAudioLoadingNotification,TIpcArgs(&iAsyncCallback),iStatus); |
|
1520 SetActive(); |
|
1521 iLoadingObserver->MaloLoadingStarted(); |
|
1522 break; |
|
1523 |
|
1524 case ELoadingComplete: |
|
1525 DEP_PRN0(_L("CMMFDrmAudioPlayerUtility::RunL - MaloLoadingComplete")); |
|
1526 |
|
1527 iAsyncCallback() = ELoadingStarted; |
|
1528 iLoadingObserver->MaloLoadingComplete(); |
|
1529 break; |
|
1530 |
|
1531 default: |
|
1532 break; |
|
1533 } |
|
1534 } |
|
1535 |
|
1536 TBool CMMFDrmAudioPlayerUtility::IsValidCustomCommandDestination(TUid aDestinationUid, const TDesC8& aParam) |
|
1537 { |
|
1538 TBool retValue(ETrue); |
|
1539 if (aDestinationUid == KUidInterfaceMMFDRMControl) |
|
1540 { |
|
1541 retValue = EFalse; |
|
1542 } |
|
1543 else if ( aDestinationUid == KUidCustomInterfaceBuilderImpl ) |
|
1544 { |
|
1545 TRAPD(err, retValue = CheckCustomInterfaceBuilderImplL(aParam)); |
|
1546 if((err != KErrNone) || (retValue == EFalse)) |
|
1547 retValue = EFalse; |
|
1548 } |
|
1549 return retValue; |
|
1550 } |
|
1551 |
|
1552 TBool CMMFDrmAudioPlayerUtility::CheckCustomInterfaceBuilderImplL(const TDesC8& aParam) |
|
1553 { |
|
1554 TBool retValue(ETrue); |
|
1555 RDesReadStream stream(aParam); |
|
1556 CleanupClosePushL(stream); |
|
1557 TUid paramUid; |
|
1558 paramUid.iUid = stream.ReadInt32L(); |
|
1559 CleanupStack::PopAndDestroy(&stream); |
|
1560 if ( paramUid == KUidAudioOutput ) |
|
1561 { |
|
1562 retValue = EFalse; |
|
1563 } |
|
1564 return retValue; |
|
1565 } |
|
1566 |
|
1567 // End of file |