|
1 /* |
|
2 * Copyright (c) 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: Interface proxy for WMA Decoder CI. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <CustomCommandUtility.h> |
|
22 #include <CustomInterfaceUtility.h> |
|
23 #include "WmaDecoderIntfcMsgs.h" |
|
24 #include "WmaDecoderIntfcProxy.h" |
|
25 |
|
26 // EXTERNAL DATA STRUCTURES |
|
27 |
|
28 // EXTERNAL FUNCTION PROTOTYPES |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 |
|
36 // MODULE DATA STRUCTURES |
|
37 |
|
38 // LOCAL FUNCTION PROTOTYPES |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 |
|
42 // ============================= LOCAL FUNCTIONS =============================== |
|
43 |
|
44 // ============================= MEMBER FUNCTIONS ============================== |
|
45 |
|
46 //------------------------------------------------------------------------------ |
|
47 // CWmaDecoderIntfcProxy::CWmaDecoderIntfcProxy |
|
48 // C++ default constructor can NOT contain any code, that might leave. |
|
49 //------------------------------------------------------------------------------ |
|
50 CWmaDecoderIntfcProxy::CWmaDecoderIntfcProxy( |
|
51 TMMFMessageDestinationPckg aMessageHandler, |
|
52 MCustomCommand& aCustomCommand, |
|
53 CCustomInterfaceUtility* aCustomInterfaceUtility) : |
|
54 iCustomCommand(aCustomCommand), |
|
55 iMessageHandler(aMessageHandler), |
|
56 iCustomInterfaceUtility(aCustomInterfaceUtility) |
|
57 { |
|
58 } |
|
59 |
|
60 //------------------------------------------------------------------------------ |
|
61 // CWmaDecoderIntfcProxy::ConstructL |
|
62 // Symbian 2nd phase constructor can leave. |
|
63 //------------------------------------------------------------------------------ |
|
64 void CWmaDecoderIntfcProxy::ConstructL() |
|
65 { |
|
66 iToolOutPut32Bit = EFalse; |
|
67 iToolDownMixToStereo = ETrue; |
|
68 iToolLostDataConcealment = EFalse; |
|
69 iParametersSameAsAdaptation = EFalse; |
|
70 } |
|
71 |
|
72 //------------------------------------------------------------------------------ |
|
73 // CWmaDecoderIntfcProxy::NewL |
|
74 // Two-phased constructor. |
|
75 //------------------------------------------------------------------------------ |
|
76 EXPORT_C CWmaDecoderIntfcProxy* CWmaDecoderIntfcProxy::NewL( |
|
77 TMMFMessageDestinationPckg aMessageHandler, |
|
78 MCustomCommand& aCustomCommand, |
|
79 CCustomInterfaceUtility* aCustomInterfaceUtility) |
|
80 { |
|
81 CWmaDecoderIntfcProxy* self = new(ELeave) CWmaDecoderIntfcProxy( |
|
82 aMessageHandler, |
|
83 aCustomCommand, |
|
84 aCustomInterfaceUtility); |
|
85 CleanupStack::PushL( self ); |
|
86 self->ConstructL(); |
|
87 CleanupStack::Pop( self ); |
|
88 return self; |
|
89 } |
|
90 |
|
91 //------------------------------------------------------------------------------ |
|
92 // Destructor |
|
93 //------------------------------------------------------------------------------ |
|
94 EXPORT_C CWmaDecoderIntfcProxy::~CWmaDecoderIntfcProxy() |
|
95 { |
|
96 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); |
|
97 delete iCustomInterfaceUtility; |
|
98 /* |
|
99 iSupportedFormats.Close(); |
|
100 iSupportedTools.Close(); |
|
101 iControllableTools.Close(); |
|
102 iCurrentSupportedFormats.Close(); |
|
103 iCurrentSupportedTools.Close(); |
|
104 iCurrentControllableTools.Close(); |
|
105 */ |
|
106 } |
|
107 |
|
108 // From CWmaDecoderIntfc |
|
109 //------------------------------------------------------------------------------ |
|
110 // Configures format. |
|
111 //------------------------------------------------------------------------------ |
|
112 EXPORT_C void CWmaDecoderIntfcProxy::SetFormat(TFormat aFormat) |
|
113 { |
|
114 iFormat = aFormat; |
|
115 } |
|
116 |
|
117 //------------------------------------------------------------------------------ |
|
118 // Configures decoder's bits per sample. |
|
119 //------------------------------------------------------------------------------ |
|
120 EXPORT_C void CWmaDecoderIntfcProxy::SetBitsPerSampleIn(TUint aBitsPerSample) |
|
121 { |
|
122 iBitsPerSample = aBitsPerSample; |
|
123 } |
|
124 |
|
125 //------------------------------------------------------------------------------ |
|
126 // Configures decoder's number of channels. |
|
127 //------------------------------------------------------------------------------ |
|
128 EXPORT_C void CWmaDecoderIntfcProxy::SetNumChannelsIn (TUint aNumChannelsIn) |
|
129 { |
|
130 iNumChannelsIn = aNumChannelsIn; |
|
131 } |
|
132 |
|
133 //------------------------------------------------------------------------------ |
|
134 // Configures decoder's sample rate. |
|
135 //------------------------------------------------------------------------------ |
|
136 EXPORT_C void CWmaDecoderIntfcProxy::SetSamplesPerSec (TUint aSamplesPerSec) |
|
137 { |
|
138 iSamplesPerSec = aSamplesPerSec; |
|
139 } |
|
140 |
|
141 //------------------------------------------------------------------------------ |
|
142 // Configures decoder's average bytes per second. |
|
143 //------------------------------------------------------------------------------ |
|
144 EXPORT_C void CWmaDecoderIntfcProxy::SetAvgBytesPerSec (TUint aAvgBytesPerSec) |
|
145 { |
|
146 iAvgBytesPerSec = aAvgBytesPerSec; |
|
147 } |
|
148 |
|
149 //------------------------------------------------------------------------------ |
|
150 // Configures decoder's block align. |
|
151 //------------------------------------------------------------------------------ |
|
152 EXPORT_C void CWmaDecoderIntfcProxy::SetBlockAlign (TUint aBlockAlign) |
|
153 { |
|
154 iBlockAlign = aBlockAlign; |
|
155 } |
|
156 |
|
157 //------------------------------------------------------------------------------ |
|
158 // Configures decoder's Encode Options. |
|
159 //------------------------------------------------------------------------------ |
|
160 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions (TUint aEncodeOptions) |
|
161 { |
|
162 iEncodeOptions = aEncodeOptions; |
|
163 } |
|
164 |
|
165 //------------------------------------------------------------------------------ |
|
166 // Configures decoder's Encode Options1. |
|
167 //------------------------------------------------------------------------------ |
|
168 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions1 (TUint aEncodeOptions1) |
|
169 { |
|
170 iEncodeOptions1 = aEncodeOptions1; |
|
171 } |
|
172 |
|
173 //------------------------------------------------------------------------------ |
|
174 // Configures decoder's Encode Options2. |
|
175 //------------------------------------------------------------------------------ |
|
176 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions2 (TUint aEncodeOptions2) |
|
177 { |
|
178 iEncodeOptions2 = aEncodeOptions2; |
|
179 } |
|
180 |
|
181 //------------------------------------------------------------------------------ |
|
182 //Configures decoder's Channel Mask. |
|
183 //------------------------------------------------------------------------------ |
|
184 EXPORT_C void CWmaDecoderIntfcProxy::SetChannelMaskIn (TUint aChannelMask) |
|
185 { |
|
186 iChannelMask = aChannelMask; |
|
187 } |
|
188 |
|
189 //------------------------------------------------------------------------------ |
|
190 // Returns decoder's current configured format. |
|
191 //------------------------------------------------------------------------------ |
|
192 EXPORT_C TInt CWmaDecoderIntfcProxy::GetFormat (TFormat& aFormat) |
|
193 { |
|
194 TInt status = KErrNone; |
|
195 |
|
196 if (!iParametersSameAsAdaptation) |
|
197 { |
|
198 status = GetAllMessage(); |
|
199 } |
|
200 if (status == KErrNone) |
|
201 { |
|
202 aFormat = iCurrentFormat; |
|
203 status = iCurrentFormatStatus; |
|
204 } |
|
205 if (!ValidGetStatus(status)) |
|
206 { |
|
207 status = KErrGeneral; |
|
208 } |
|
209 return status; |
|
210 } |
|
211 |
|
212 //------------------------------------------------------------------------------ |
|
213 // Returns configured bits per sample . |
|
214 //------------------------------------------------------------------------------ |
|
215 EXPORT_C TInt CWmaDecoderIntfcProxy::GetBitsPerSampleIn(TUint& aBitsPerSample) |
|
216 { |
|
217 TInt status = KErrNone; |
|
218 |
|
219 if (!iParametersSameAsAdaptation) |
|
220 { |
|
221 status = GetAllMessage(); |
|
222 } |
|
223 if (status == KErrNone) |
|
224 { |
|
225 aBitsPerSample = iCurrentBitsPerSample; |
|
226 status = iCurrentBitsPerSampleStatus; |
|
227 } |
|
228 if (!ValidGetStatus(status)) |
|
229 { |
|
230 status = KErrGeneral; |
|
231 } |
|
232 |
|
233 return status; |
|
234 } |
|
235 |
|
236 //------------------------------------------------------------------------------ |
|
237 // Returns configured number of channels. |
|
238 //------------------------------------------------------------------------------ |
|
239 EXPORT_C TInt CWmaDecoderIntfcProxy::GetNumOfChannelsIn (TUint& aNumOfChannels) |
|
240 { |
|
241 TInt status = KErrNone; |
|
242 |
|
243 if (!iParametersSameAsAdaptation) |
|
244 { |
|
245 status = GetAllMessage(); |
|
246 } |
|
247 if (status == KErrNone) |
|
248 { |
|
249 aNumOfChannels = iCurrentNumChannelsIn; |
|
250 status = iCurrentNumChannelsInStatus; |
|
251 } |
|
252 if (!ValidGetStatus(status)) |
|
253 { |
|
254 status = KErrGeneral; |
|
255 } |
|
256 |
|
257 return status; |
|
258 } |
|
259 |
|
260 //------------------------------------------------------------------------------ |
|
261 // Returns configured sample rate. |
|
262 //------------------------------------------------------------------------------ |
|
263 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSamplesPerSec (TUint& aSamplesPerSec) |
|
264 { |
|
265 TInt status = KErrNone; |
|
266 |
|
267 if (!iParametersSameAsAdaptation) |
|
268 { |
|
269 status = GetAllMessage(); |
|
270 } |
|
271 if (status == KErrNone) |
|
272 { |
|
273 aSamplesPerSec = iCurrentSamplesPerSec; |
|
274 status = iCurrentSamplesPerSecStatus; |
|
275 } |
|
276 if (!ValidGetStatus(status)) |
|
277 { |
|
278 status = KErrGeneral; |
|
279 } |
|
280 return status; |
|
281 } |
|
282 |
|
283 //------------------------------------------------------------------------------ |
|
284 // Returns configured average bytes per second. |
|
285 //------------------------------------------------------------------------------ |
|
286 EXPORT_C TInt CWmaDecoderIntfcProxy::GetAvgBytesPerSec (TUint& aAvgBytesPerSec) |
|
287 { |
|
288 TInt status = KErrNone; |
|
289 |
|
290 if (!iParametersSameAsAdaptation) |
|
291 { |
|
292 status = GetAllMessage(); |
|
293 } |
|
294 if (status == KErrNone) |
|
295 { |
|
296 aAvgBytesPerSec = iCurrentAvgBytesPerSec; |
|
297 status = iCurrentAvgBytesPerSecStatus; |
|
298 } |
|
299 if (!ValidGetStatus(status)) |
|
300 { |
|
301 status = KErrGeneral; |
|
302 } |
|
303 return status; |
|
304 } |
|
305 |
|
306 //------------------------------------------------------------------------------ |
|
307 // Returns configured block align. |
|
308 //------------------------------------------------------------------------------ |
|
309 EXPORT_C TInt CWmaDecoderIntfcProxy::GetBlockAlign (TUint& aBlockAlign) |
|
310 { |
|
311 TInt status = KErrNone; |
|
312 |
|
313 if (!iParametersSameAsAdaptation) |
|
314 { |
|
315 status = GetAllMessage(); |
|
316 } |
|
317 if (status == KErrNone) |
|
318 { |
|
319 aBlockAlign = iCurrentBlockAlign; |
|
320 status = iCurrentBlockAlignStatus; |
|
321 } |
|
322 if (!ValidGetStatus(status)) |
|
323 { |
|
324 status = KErrGeneral; |
|
325 } |
|
326 |
|
327 return status; |
|
328 } |
|
329 |
|
330 //------------------------------------------------------------------------------ |
|
331 // Returns configured encode options. |
|
332 //------------------------------------------------------------------------------ |
|
333 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions (TUint& aEncodeOpts) |
|
334 { |
|
335 TInt status = KErrNone; |
|
336 |
|
337 if (!iParametersSameAsAdaptation) |
|
338 { |
|
339 status = GetAllMessage(); |
|
340 } |
|
341 if (status == KErrNone) |
|
342 { |
|
343 aEncodeOpts = iCurrentEncodeOptions; |
|
344 status = iCurrentEncodeOptionsStatus; |
|
345 } |
|
346 if (!ValidGetStatus(status)) |
|
347 { |
|
348 status = KErrGeneral; |
|
349 } |
|
350 return status; |
|
351 } |
|
352 |
|
353 //------------------------------------------------------------------------------ |
|
354 // Returns configured advanced encode options. |
|
355 //------------------------------------------------------------------------------ |
|
356 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions1 (TUint& EncodeOpts1) |
|
357 { |
|
358 TInt status = KErrNone; |
|
359 |
|
360 if (!iParametersSameAsAdaptation) |
|
361 { |
|
362 status = GetAllMessage(); |
|
363 } |
|
364 if (status == KErrNone) |
|
365 { |
|
366 EncodeOpts1 = iCurrentEncodeOptions1; |
|
367 status = iCurrentEncodeOptions1Status; |
|
368 } |
|
369 if (!ValidGetStatus(status) && |
|
370 status != KErrNotSupported) |
|
371 { |
|
372 status = KErrGeneral; |
|
373 } |
|
374 return status; |
|
375 } |
|
376 |
|
377 //------------------------------------------------------------------------------ |
|
378 // Returns configured advanced encode options. |
|
379 //------------------------------------------------------------------------------ |
|
380 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions2 (TUint& EncodeOpts2) |
|
381 { |
|
382 TInt status = KErrNone; |
|
383 |
|
384 if (!iParametersSameAsAdaptation) |
|
385 { |
|
386 status = GetAllMessage(); |
|
387 } |
|
388 if (status == KErrNone) |
|
389 { |
|
390 EncodeOpts2 = iCurrentEncodeOptions2; |
|
391 status = iCurrentEncodeOptions2Status; |
|
392 } |
|
393 if (!ValidGetStatus(status) && |
|
394 status != KErrNotSupported) |
|
395 { |
|
396 status = KErrGeneral; |
|
397 } |
|
398 return status; |
|
399 } |
|
400 |
|
401 //------------------------------------------------------------------------------ |
|
402 // Returns configured channel mask. |
|
403 //------------------------------------------------------------------------------ |
|
404 EXPORT_C TInt CWmaDecoderIntfcProxy::GetChannelMaskIn (TUint& aChannelMask) |
|
405 { |
|
406 TInt status = KErrNone; |
|
407 |
|
408 if (!iParametersSameAsAdaptation) |
|
409 { |
|
410 status = GetAllMessage(); |
|
411 } |
|
412 if (status == KErrNone) |
|
413 { |
|
414 aChannelMask = iCurrentChannelMask; |
|
415 status = iCurrentChannelMaskStatus; |
|
416 } |
|
417 if (!ValidGetStatus(status) && |
|
418 status != KErrNotSupported) |
|
419 { |
|
420 status = KErrGeneral; |
|
421 } |
|
422 |
|
423 return status; |
|
424 } |
|
425 |
|
426 //------------------------------------------------------------------------------ |
|
427 // Returns supported formats. |
|
428 //------------------------------------------------------------------------------ |
|
429 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedFormats(RArray<TFormat>& aSupportedFormats) |
|
430 { |
|
431 |
|
432 TInt status = KErrNone; |
|
433 TRAPD(err, status = GetSupportedFormatsL(aSupportedFormats)) |
|
434 if (err != KErrNone) |
|
435 { |
|
436 if (err != KErrNone && err != KErrNotFound) |
|
437 { |
|
438 status = KErrGeneral; |
|
439 } |
|
440 } |
|
441 return status; |
|
442 } |
|
443 |
|
444 //------------------------------------------------------------------------------ |
|
445 // Returns supported tools. |
|
446 //------------------------------------------------------------------------------ |
|
447 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedTools(RArray<TTool>& aSupportedTools) |
|
448 { |
|
449 TInt status = KErrNone; |
|
450 TRAPD(err, status = GetSupportedToolsL(aSupportedTools)) |
|
451 if (err != KErrNone) |
|
452 { |
|
453 if (err != KErrNone && err != KErrNotFound) |
|
454 { |
|
455 status = KErrGeneral; |
|
456 } |
|
457 } |
|
458 |
|
459 return status; |
|
460 } |
|
461 |
|
462 //------------------------------------------------------------------------------ |
|
463 // Returns supported max number of channels. |
|
464 //------------------------------------------------------------------------------ |
|
465 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxChannelsIn(TUint& aSupportedMaxChannelsIn) |
|
466 { |
|
467 TInt status = KErrNone; |
|
468 |
|
469 TPckgBuf<TUint> pckgBuf; |
|
470 status = iCustomCommand.CustomCommandSync( |
|
471 iMessageHandler, |
|
472 EWmaGetSupportedMaxChannels, |
|
473 KNullDesC8, |
|
474 KNullDesC8, |
|
475 pckgBuf); |
|
476 |
|
477 aSupportedMaxChannelsIn = pckgBuf(); |
|
478 if (status != KErrNone && status != KErrNotFound) |
|
479 { |
|
480 status = KErrGeneral; |
|
481 } |
|
482 return status; |
|
483 } |
|
484 |
|
485 //------------------------------------------------------------------------------ |
|
486 // Returns supported max bit rate. |
|
487 //------------------------------------------------------------------------------ |
|
488 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxBitrate(TUint& aSupportedMaxBitrate) |
|
489 { |
|
490 TInt status = KErrNone; |
|
491 |
|
492 TPckgBuf<TUint> pckgBuf; |
|
493 status = iCustomCommand.CustomCommandSync( |
|
494 iMessageHandler, |
|
495 EWmaGetSupportedMaxBitrate, |
|
496 KNullDesC8, |
|
497 KNullDesC8, |
|
498 pckgBuf); |
|
499 |
|
500 aSupportedMaxBitrate = pckgBuf(); |
|
501 |
|
502 |
|
503 if (status != KErrNone && status != KErrNotFound) |
|
504 { |
|
505 status = KErrGeneral; |
|
506 } |
|
507 |
|
508 return status; |
|
509 } |
|
510 |
|
511 //------------------------------------------------------------------------------ |
|
512 // Get Supported Max Sample Rate |
|
513 //------------------------------------------------------------------------------ |
|
514 TInt CWmaDecoderIntfcProxy::GetSupportedMaxSampleRate(TUint& aSupportedMaxSampleRate) |
|
515 { |
|
516 TInt status = KErrNone; |
|
517 |
|
518 TPckgBuf<TUint> pckgBuf; |
|
519 status = iCustomCommand.CustomCommandSync( |
|
520 iMessageHandler, |
|
521 EWmaGetSupportedMaxSampleRate, |
|
522 KNullDesC8, |
|
523 KNullDesC8, |
|
524 pckgBuf); |
|
525 |
|
526 aSupportedMaxSampleRate = pckgBuf(); |
|
527 if (status != KErrNone && status != KErrNotFound) |
|
528 { |
|
529 status = KErrGeneral; |
|
530 } |
|
531 |
|
532 return status; |
|
533 } |
|
534 |
|
535 //------------------------------------------------------------------------------ |
|
536 // Returns controllable tools. |
|
537 //------------------------------------------------------------------------------ |
|
538 EXPORT_C TInt CWmaDecoderIntfcProxy::GetControllableTools(RArray<TTool>& aControllableTools) |
|
539 { |
|
540 TInt status = KErrNone; |
|
541 TRAPD(err, status = GetControllableToolsL(aControllableTools)) |
|
542 if (err != KErrNone) |
|
543 { |
|
544 if (err != KErrNone && err != KErrNotFound) |
|
545 { |
|
546 status = KErrGeneral; |
|
547 } |
|
548 } |
|
549 |
|
550 return status; |
|
551 } |
|
552 |
|
553 //------------------------------------------------------------------------------ |
|
554 // Enable tool. |
|
555 //------------------------------------------------------------------------------ |
|
556 EXPORT_C void CWmaDecoderIntfcProxy::EnableTool(TTool aTool) |
|
557 { |
|
558 switch (aTool) |
|
559 { |
|
560 case EToolOutput32Bit: |
|
561 iToolOutPut32Bit = ETrue; |
|
562 break; |
|
563 case EDownMixToStereo: |
|
564 iToolDownMixToStereo = ETrue; |
|
565 break; |
|
566 case ELostDataConcealment: |
|
567 iToolLostDataConcealment = ETrue; |
|
568 break; |
|
569 default: |
|
570 break; |
|
571 } |
|
572 |
|
573 } |
|
574 |
|
575 //------------------------------------------------------------------------------ |
|
576 // disable tool. |
|
577 //------------------------------------------------------------------------------ |
|
578 EXPORT_C void CWmaDecoderIntfcProxy::DisableTool(TTool aTool) |
|
579 { |
|
580 switch (aTool) |
|
581 { |
|
582 case EToolOutput32Bit: |
|
583 iToolOutPut32Bit = EFalse; |
|
584 break; |
|
585 case EDownMixToStereo: |
|
586 iToolDownMixToStereo = EFalse; |
|
587 break; |
|
588 case ELostDataConcealment: |
|
589 iToolLostDataConcealment = EFalse; |
|
590 break; |
|
591 default: |
|
592 break; |
|
593 } |
|
594 } |
|
595 |
|
596 |
|
597 //------------------------------------------------------------------------------ |
|
598 // Returns tool state. |
|
599 //------------------------------------------------------------------------------ |
|
600 EXPORT_C TInt CWmaDecoderIntfcProxy::GetTool(TTool aTool, TBool& aEnabled) |
|
601 { |
|
602 TInt status = KErrNone; |
|
603 |
|
604 if (!iParametersSameAsAdaptation) |
|
605 { |
|
606 status = GetAllMessage(); |
|
607 } |
|
608 switch (aTool) |
|
609 { |
|
610 case EToolOutput32Bit: |
|
611 if (iCurrentToolOutPut32Bit) |
|
612 { |
|
613 aEnabled = ETrue; |
|
614 } |
|
615 else |
|
616 { |
|
617 aEnabled = EFalse; |
|
618 } |
|
619 status = iCurrentToolOutPut32BitStatus; |
|
620 break; |
|
621 |
|
622 case EDownMixToStereo: |
|
623 if (iCurrentToolDownMixToStereo) |
|
624 { |
|
625 aEnabled = ETrue; |
|
626 } |
|
627 else |
|
628 { |
|
629 aEnabled = EFalse; |
|
630 } |
|
631 status = iCurrentToolDownMixToStereoStatus; |
|
632 break; |
|
633 |
|
634 case ELostDataConcealment: |
|
635 if (iCurrentToolLostDataConcealment) |
|
636 { |
|
637 aEnabled = ETrue; |
|
638 } |
|
639 else |
|
640 { |
|
641 aEnabled = EFalse; |
|
642 } |
|
643 status = iCurrentToolLostDataConcealmentStatus; |
|
644 break; |
|
645 default: |
|
646 break; |
|
647 } |
|
648 |
|
649 if (!ValidGetStatus(status) && |
|
650 status != KErrNotSupported) |
|
651 { |
|
652 status = KErrGeneral; |
|
653 } |
|
654 |
|
655 return status; |
|
656 |
|
657 |
|
658 } |
|
659 |
|
660 //------------------------------------------------------------------------------ |
|
661 // Applies configuration settings to the decoder. |
|
662 //------------------------------------------------------------------------------ |
|
663 EXPORT_C TInt CWmaDecoderIntfcProxy::ApplyConfig() |
|
664 { |
|
665 TInt status = KErrNone; |
|
666 |
|
667 |
|
668 TWmaDecoderConfig configParams; |
|
669 |
|
670 configParams.iFormat = iFormat; |
|
671 configParams.iBitsPerSample = iBitsPerSample; |
|
672 configParams.iNumChannelsIn = iNumChannelsIn; |
|
673 configParams.iSamplesPerSec = iSamplesPerSec; |
|
674 configParams.iAvgBytesPerSec = iAvgBytesPerSec; |
|
675 configParams.iBlockAlign = iBlockAlign; |
|
676 configParams.iEncodeOptions = iEncodeOptions; |
|
677 configParams.iEncodeOptions1 = iEncodeOptions1; |
|
678 configParams.iEncodeOptions2 = iEncodeOptions2; |
|
679 configParams.iChannelMask = iChannelMask; |
|
680 configParams.iToolOutPut32Bit = iToolOutPut32Bit; |
|
681 configParams.iToolDownMixToStereo = iToolDownMixToStereo; |
|
682 configParams.iToolLostDataConcealment = iToolLostDataConcealment; |
|
683 |
|
684 |
|
685 TPckgBuf<TWmaDecoderConfig> pckgBuf(configParams); |
|
686 status = iCustomCommand.CustomCommandSync(iMessageHandler, |
|
687 EWmaApplyConfig, |
|
688 pckgBuf, |
|
689 KNullDesC8); |
|
690 if (status == KErrNone) |
|
691 { |
|
692 iCurrentFormat = iFormat; |
|
693 iCurrentBitsPerSample = iBitsPerSample; |
|
694 iCurrentNumChannelsIn = iNumChannelsIn; |
|
695 iCurrentSamplesPerSec = iSamplesPerSec; |
|
696 iCurrentAvgBytesPerSec = iAvgBytesPerSec; |
|
697 iCurrentBlockAlign = iBlockAlign; |
|
698 iCurrentEncodeOptions = iEncodeOptions; |
|
699 iCurrentEncodeOptions1 = iEncodeOptions1; |
|
700 iCurrentEncodeOptions2 = iEncodeOptions2; |
|
701 iCurrentChannelMask = iChannelMask; |
|
702 iCurrentToolOutPut32Bit = iToolOutPut32Bit; |
|
703 iCurrentToolDownMixToStereo = iToolDownMixToStereo; |
|
704 iCurrentToolLostDataConcealment = iToolLostDataConcealment; |
|
705 |
|
706 iCurrentFormatStatus = status; |
|
707 iCurrentBitsPerSampleStatus = status; |
|
708 iCurrentNumChannelsInStatus = status ; |
|
709 iCurrentSamplesPerSecStatus = status; |
|
710 iCurrentAvgBytesPerSecStatus = status ; |
|
711 iCurrentBlockAlignStatus = status; |
|
712 iCurrentEncodeOptionsStatus = status; |
|
713 iCurrentEncodeOptions1Status = status; |
|
714 iCurrentEncodeOptions2Status = status; |
|
715 iCurrentChannelMaskStatus = status; |
|
716 iCurrentToolOutPut32BitStatus = status; |
|
717 iCurrentToolDownMixToStereoStatus = status; |
|
718 iCurrentToolLostDataConcealmentStatus = status; |
|
719 |
|
720 iParametersSameAsAdaptation = ETrue; |
|
721 } |
|
722 else |
|
723 { |
|
724 iParametersSameAsAdaptation = EFalse; |
|
725 } |
|
726 return status; |
|
727 } |
|
728 |
|
729 |
|
730 //------------------------------------------------------------------------------ |
|
731 // Receive all configure paramemters |
|
732 //------------------------------------------------------------------------------ |
|
733 TInt CWmaDecoderIntfcProxy::GetAllMessage() |
|
734 { |
|
735 TPckgBuf<TAllParams> pckg; |
|
736 TInt status = iCustomCommand.CustomCommandSync( |
|
737 iMessageHandler, |
|
738 EWmaGetAllMsg, |
|
739 KNullDesC8, |
|
740 KNullDesC8,pckg); |
|
741 if (status == KErrNone) |
|
742 { |
|
743 iCurrentFormat = pckg().iCurrentFormat; |
|
744 iCurrentFormatStatus = pckg().iCurrentFormatStatus; |
|
745 |
|
746 iCurrentBitsPerSample = pckg().iCurrentBitsPerSample; |
|
747 iCurrentBitsPerSampleStatus =pckg().iCurrentBitsPerSampleStatus; |
|
748 |
|
749 iCurrentNumChannelsIn = pckg().iCurrentNumChannelsIn; |
|
750 iCurrentNumChannelsInStatus = pckg().iCurrentNumChannelsInStatus; |
|
751 |
|
752 iCurrentSamplesPerSec = pckg().iCurrentSamplesPerSec ; |
|
753 iCurrentSamplesPerSecStatus = pckg().iCurrentSamplesPerSecStatus; |
|
754 |
|
755 iCurrentAvgBytesPerSec = pckg().iCurrentAvgBytesPerSec; |
|
756 iCurrentAvgBytesPerSecStatus = pckg().iCurrentAvgBytesPerSecStatus; |
|
757 |
|
758 iCurrentBlockAlign = pckg().iCurrentBlockAlign; |
|
759 iCurrentBlockAlignStatus = pckg().iCurrentBlockAlignStatus; |
|
760 |
|
761 iCurrentEncodeOptions = pckg().iCurrentEncodeOptions; |
|
762 iCurrentEncodeOptionsStatus = pckg().iCurrentEncodeOptionsStatus ; |
|
763 |
|
764 iCurrentEncodeOptions1 = pckg().iCurrentEncodeOptions1; |
|
765 iCurrentEncodeOptions1Status = pckg().iCurrentEncodeOptions1Status; |
|
766 |
|
767 iCurrentEncodeOptions2 = pckg().iCurrentEncodeOptions2; |
|
768 iCurrentEncodeOptions2Status = pckg().iCurrentEncodeOptions2Status; |
|
769 |
|
770 iCurrentChannelMask = pckg().iCurrentChannelMask ; |
|
771 iCurrentChannelMaskStatus = pckg().iCurrentChannelMaskStatus; |
|
772 |
|
773 iCurrentToolOutPut32Bit = pckg().iCurrentToolOutPut32Bit; |
|
774 iCurrentToolOutPut32BitStatus = pckg().iCurrentToolOutPut32BitStatus; |
|
775 |
|
776 iCurrentToolDownMixToStereo = pckg().iCurrentToolDownMixToStereo; |
|
777 iCurrentToolDownMixToStereoStatus = pckg().iCurrentToolDownMixToStereoStatus; |
|
778 |
|
779 iCurrentToolLostDataConcealment = pckg().iCurrentToolLostDataConcealment; |
|
780 iCurrentToolLostDataConcealmentStatus = pckg().iCurrentToolLostDataConcealmentStatus ; |
|
781 iParametersSameAsAdaptation = ETrue; |
|
782 } |
|
783 return status; |
|
784 } |
|
785 |
|
786 //------------------------------------------------------------------------------ |
|
787 // check return status |
|
788 //------------------------------------------------------------------------------ |
|
789 TBool CWmaDecoderIntfcProxy::ValidGetStatus(TInt aStatus) |
|
790 { |
|
791 if (aStatus != KErrNone && aStatus != KErrCompletion && |
|
792 aStatus != KErrUnknown && aStatus != KErrArgument && |
|
793 aStatus != KErrNotReady && aStatus != KErrNotFound && |
|
794 aStatus != KErrGeneral) |
|
795 { |
|
796 return EFalse; |
|
797 } |
|
798 else |
|
799 { |
|
800 return ETrue; |
|
801 } |
|
802 } |
|
803 |
|
804 |
|
805 //------------------------------------------------------------------------------ |
|
806 // GetSupportedFormatsL |
|
807 //------------------------------------------------------------------------------ |
|
808 TInt CWmaDecoderIntfcProxy::GetSupportedFormatsL(RArray<TFormat>& aSupportedFormats) |
|
809 { |
|
810 TInt status = KErrNone; |
|
811 |
|
812 aSupportedFormats.Reset(); |
|
813 |
|
814 TPckgBuf<TUint> supportedFormatsPkg; |
|
815 status = iCustomCommand.CustomCommandSync( |
|
816 iMessageHandler, |
|
817 EWmaGetNumOfSupportedFormats, |
|
818 KNullDesC8, |
|
819 KNullDesC8, |
|
820 supportedFormatsPkg); |
|
821 HBufC8* buf = HBufC8::NewLC(supportedFormatsPkg()*sizeof(TUint)); |
|
822 // buf is left on cleanup |
|
823 TPtr8 ptr = buf->Des(); |
|
824 iCustomCommand.CustomCommandSync( |
|
825 iMessageHandler, |
|
826 EWmaGetSupportedFormats, |
|
827 KNullDesC8, |
|
828 KNullDesC8, |
|
829 ptr); |
|
830 RDesReadStream stream(ptr); |
|
831 CleanupClosePushL(stream); // stream on cleanup |
|
832 for (TInt i=0; i<supportedFormatsPkg(); i++) |
|
833 { |
|
834 aSupportedFormats.Append(static_cast<TFormat>(stream.ReadUint32L())); |
|
835 } |
|
836 CleanupStack::PopAndDestroy(&stream); |
|
837 CleanupStack::PopAndDestroy(buf); |
|
838 if (status != KErrNone && status != KErrNotFound) |
|
839 { |
|
840 status = KErrGeneral; |
|
841 } |
|
842 |
|
843 return status; |
|
844 } |
|
845 |
|
846 //------------------------------------------------------------------------------ |
|
847 // GetSupportedToolsL |
|
848 //------------------------------------------------------------------------------ |
|
849 TInt CWmaDecoderIntfcProxy::GetSupportedToolsL(RArray<TTool>& aSupportedTools) |
|
850 { |
|
851 |
|
852 TInt status = KErrNone; |
|
853 aSupportedTools.Reset(); |
|
854 |
|
855 TPckgBuf<TUint> supportedToolsPkg; |
|
856 status = iCustomCommand.CustomCommandSync( |
|
857 iMessageHandler, |
|
858 EWmaGetNumOfSupportedTools, |
|
859 KNullDesC8, |
|
860 KNullDesC8, |
|
861 supportedToolsPkg); |
|
862 |
|
863 HBufC8* buf = HBufC8::NewLC(supportedToolsPkg()*sizeof(TUint)); |
|
864 // buf is left on cleanup |
|
865 TPtr8 ptr = buf->Des(); |
|
866 |
|
867 iCustomCommand.CustomCommandSync( |
|
868 iMessageHandler, |
|
869 EWmaGetSupportedTools, |
|
870 KNullDesC8, |
|
871 KNullDesC8, |
|
872 ptr); |
|
873 RDesReadStream stream(ptr); |
|
874 CleanupClosePushL(stream); // stream on cleanup |
|
875 for (TInt i=0; i<supportedToolsPkg(); i++) |
|
876 { |
|
877 aSupportedTools.Append(static_cast<TTool>(stream.ReadUint32L())); |
|
878 } |
|
879 CleanupStack::PopAndDestroy(&stream); |
|
880 CleanupStack::PopAndDestroy(buf); |
|
881 |
|
882 |
|
883 if (status != KErrNone && status != KErrNotFound) |
|
884 { |
|
885 status = KErrGeneral; |
|
886 } |
|
887 |
|
888 return status; |
|
889 } |
|
890 |
|
891 //------------------------------------------------------------------------------ |
|
892 // GetControllableToolsL |
|
893 //------------------------------------------------------------------------------ |
|
894 TInt CWmaDecoderIntfcProxy::GetControllableToolsL(RArray<TTool>& aControllableTools) |
|
895 { |
|
896 TInt status = KErrNone; |
|
897 aControllableTools.Reset(); |
|
898 |
|
899 TPckgBuf<TUint> numPckg; |
|
900 status = iCustomCommand.CustomCommandSync( |
|
901 iMessageHandler, |
|
902 EWmaGetNumOfControllableTools, |
|
903 KNullDesC8, |
|
904 KNullDesC8, |
|
905 numPckg); |
|
906 |
|
907 HBufC8* buf = HBufC8::NewLC(numPckg()*sizeof(TUint)); |
|
908 // buf is left on cleanup |
|
909 TPtr8 ptr = buf->Des(); |
|
910 |
|
911 iCustomCommand.CustomCommandSync( |
|
912 iMessageHandler, |
|
913 EWmaGetControllableTools, |
|
914 KNullDesC8, |
|
915 KNullDesC8, |
|
916 ptr); |
|
917 RDesReadStream stream(ptr); |
|
918 CleanupClosePushL(stream); // stream on cleanup |
|
919 for (TInt i=0; i < numPckg(); i++) |
|
920 { |
|
921 aControllableTools.Append(static_cast<TTool>(stream.ReadUint32L())); |
|
922 } |
|
923 CleanupStack::PopAndDestroy(&stream); |
|
924 CleanupStack::PopAndDestroy(buf); |
|
925 if (status != KErrNone && status != KErrNotFound) |
|
926 { |
|
927 status = KErrGeneral; |
|
928 } |
|
929 |
|
930 return status; |
|
931 } |
|
932 |
|
933 |
|
934 |
|
935 // End of File |