os/mm/devsoundextensions/mmfcustominterfaces/WmaDecoderIntfc/WmaDecoderIntfcProxy/src/WmaDecoderIntfcProxy.cpp
First public contribution.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Interface proxy for WMA Decoder CI.
21 #include <CustomCommandUtility.h>
22 #include <CustomInterfaceUtility.h>
23 #include "WmaDecoderIntfcMsgs.h"
24 #include "WmaDecoderIntfcProxy.h"
26 // EXTERNAL DATA STRUCTURES
28 // EXTERNAL FUNCTION PROTOTYPES
34 // LOCAL CONSTANTS AND MACROS
36 // MODULE DATA STRUCTURES
38 // LOCAL FUNCTION PROTOTYPES
40 // FORWARD DECLARATIONS
42 // ============================= LOCAL FUNCTIONS ===============================
44 // ============================= MEMBER FUNCTIONS ==============================
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)
60 //------------------------------------------------------------------------------
61 // CWmaDecoderIntfcProxy::ConstructL
62 // Symbian 2nd phase constructor can leave.
63 //------------------------------------------------------------------------------
64 void CWmaDecoderIntfcProxy::ConstructL()
66 iToolOutPut32Bit = EFalse;
67 iToolDownMixToStereo = ETrue;
68 iToolLostDataConcealment = EFalse;
69 iParametersSameAsAdaptation = EFalse;
72 //------------------------------------------------------------------------------
73 // CWmaDecoderIntfcProxy::NewL
74 // Two-phased constructor.
75 //------------------------------------------------------------------------------
76 EXPORT_C CWmaDecoderIntfcProxy* CWmaDecoderIntfcProxy::NewL(
77 TMMFMessageDestinationPckg aMessageHandler,
78 MCustomCommand& aCustomCommand,
79 CCustomInterfaceUtility* aCustomInterfaceUtility)
81 CWmaDecoderIntfcProxy* self = new(ELeave) CWmaDecoderIntfcProxy(
84 aCustomInterfaceUtility);
85 CleanupStack::PushL( self );
87 CleanupStack::Pop( self );
91 //------------------------------------------------------------------------------
93 //------------------------------------------------------------------------------
94 EXPORT_C CWmaDecoderIntfcProxy::~CWmaDecoderIntfcProxy()
96 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
97 delete iCustomInterfaceUtility;
99 iSupportedFormats.Close();
100 iSupportedTools.Close();
101 iControllableTools.Close();
102 iCurrentSupportedFormats.Close();
103 iCurrentSupportedTools.Close();
104 iCurrentControllableTools.Close();
108 // From CWmaDecoderIntfc
109 //------------------------------------------------------------------------------
110 // Configures format.
111 //------------------------------------------------------------------------------
112 EXPORT_C void CWmaDecoderIntfcProxy::SetFormat(TFormat aFormat)
117 //------------------------------------------------------------------------------
118 // Configures decoder's bits per sample.
119 //------------------------------------------------------------------------------
120 EXPORT_C void CWmaDecoderIntfcProxy::SetBitsPerSampleIn(TUint aBitsPerSample)
122 iBitsPerSample = aBitsPerSample;
125 //------------------------------------------------------------------------------
126 // Configures decoder's number of channels.
127 //------------------------------------------------------------------------------
128 EXPORT_C void CWmaDecoderIntfcProxy::SetNumChannelsIn (TUint aNumChannelsIn)
130 iNumChannelsIn = aNumChannelsIn;
133 //------------------------------------------------------------------------------
134 // Configures decoder's sample rate.
135 //------------------------------------------------------------------------------
136 EXPORT_C void CWmaDecoderIntfcProxy::SetSamplesPerSec (TUint aSamplesPerSec)
138 iSamplesPerSec = aSamplesPerSec;
141 //------------------------------------------------------------------------------
142 // Configures decoder's average bytes per second.
143 //------------------------------------------------------------------------------
144 EXPORT_C void CWmaDecoderIntfcProxy::SetAvgBytesPerSec (TUint aAvgBytesPerSec)
146 iAvgBytesPerSec = aAvgBytesPerSec;
149 //------------------------------------------------------------------------------
150 // Configures decoder's block align.
151 //------------------------------------------------------------------------------
152 EXPORT_C void CWmaDecoderIntfcProxy::SetBlockAlign (TUint aBlockAlign)
154 iBlockAlign = aBlockAlign;
157 //------------------------------------------------------------------------------
158 // Configures decoder's Encode Options.
159 //------------------------------------------------------------------------------
160 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions (TUint aEncodeOptions)
162 iEncodeOptions = aEncodeOptions;
165 //------------------------------------------------------------------------------
166 // Configures decoder's Encode Options1.
167 //------------------------------------------------------------------------------
168 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions1 (TUint aEncodeOptions1)
170 iEncodeOptions1 = aEncodeOptions1;
173 //------------------------------------------------------------------------------
174 // Configures decoder's Encode Options2.
175 //------------------------------------------------------------------------------
176 EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions2 (TUint aEncodeOptions2)
178 iEncodeOptions2 = aEncodeOptions2;
181 //------------------------------------------------------------------------------
182 //Configures decoder's Channel Mask.
183 //------------------------------------------------------------------------------
184 EXPORT_C void CWmaDecoderIntfcProxy::SetChannelMaskIn (TUint aChannelMask)
186 iChannelMask = aChannelMask;
189 //------------------------------------------------------------------------------
190 // Returns decoder's current configured format.
191 //------------------------------------------------------------------------------
192 EXPORT_C TInt CWmaDecoderIntfcProxy::GetFormat (TFormat& aFormat)
194 TInt status = KErrNone;
196 if (!iParametersSameAsAdaptation)
198 status = GetAllMessage();
200 if (status == KErrNone)
202 aFormat = iCurrentFormat;
203 status = iCurrentFormatStatus;
205 if (!ValidGetStatus(status))
207 status = KErrGeneral;
212 //------------------------------------------------------------------------------
213 // Returns configured bits per sample .
214 //------------------------------------------------------------------------------
215 EXPORT_C TInt CWmaDecoderIntfcProxy::GetBitsPerSampleIn(TUint& aBitsPerSample)
217 TInt status = KErrNone;
219 if (!iParametersSameAsAdaptation)
221 status = GetAllMessage();
223 if (status == KErrNone)
225 aBitsPerSample = iCurrentBitsPerSample;
226 status = iCurrentBitsPerSampleStatus;
228 if (!ValidGetStatus(status))
230 status = KErrGeneral;
236 //------------------------------------------------------------------------------
237 // Returns configured number of channels.
238 //------------------------------------------------------------------------------
239 EXPORT_C TInt CWmaDecoderIntfcProxy::GetNumOfChannelsIn (TUint& aNumOfChannels)
241 TInt status = KErrNone;
243 if (!iParametersSameAsAdaptation)
245 status = GetAllMessage();
247 if (status == KErrNone)
249 aNumOfChannels = iCurrentNumChannelsIn;
250 status = iCurrentNumChannelsInStatus;
252 if (!ValidGetStatus(status))
254 status = KErrGeneral;
260 //------------------------------------------------------------------------------
261 // Returns configured sample rate.
262 //------------------------------------------------------------------------------
263 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSamplesPerSec (TUint& aSamplesPerSec)
265 TInt status = KErrNone;
267 if (!iParametersSameAsAdaptation)
269 status = GetAllMessage();
271 if (status == KErrNone)
273 aSamplesPerSec = iCurrentSamplesPerSec;
274 status = iCurrentSamplesPerSecStatus;
276 if (!ValidGetStatus(status))
278 status = KErrGeneral;
283 //------------------------------------------------------------------------------
284 // Returns configured average bytes per second.
285 //------------------------------------------------------------------------------
286 EXPORT_C TInt CWmaDecoderIntfcProxy::GetAvgBytesPerSec (TUint& aAvgBytesPerSec)
288 TInt status = KErrNone;
290 if (!iParametersSameAsAdaptation)
292 status = GetAllMessage();
294 if (status == KErrNone)
296 aAvgBytesPerSec = iCurrentAvgBytesPerSec;
297 status = iCurrentAvgBytesPerSecStatus;
299 if (!ValidGetStatus(status))
301 status = KErrGeneral;
306 //------------------------------------------------------------------------------
307 // Returns configured block align.
308 //------------------------------------------------------------------------------
309 EXPORT_C TInt CWmaDecoderIntfcProxy::GetBlockAlign (TUint& aBlockAlign)
311 TInt status = KErrNone;
313 if (!iParametersSameAsAdaptation)
315 status = GetAllMessage();
317 if (status == KErrNone)
319 aBlockAlign = iCurrentBlockAlign;
320 status = iCurrentBlockAlignStatus;
322 if (!ValidGetStatus(status))
324 status = KErrGeneral;
330 //------------------------------------------------------------------------------
331 // Returns configured encode options.
332 //------------------------------------------------------------------------------
333 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions (TUint& aEncodeOpts)
335 TInt status = KErrNone;
337 if (!iParametersSameAsAdaptation)
339 status = GetAllMessage();
341 if (status == KErrNone)
343 aEncodeOpts = iCurrentEncodeOptions;
344 status = iCurrentEncodeOptionsStatus;
346 if (!ValidGetStatus(status))
348 status = KErrGeneral;
353 //------------------------------------------------------------------------------
354 // Returns configured advanced encode options.
355 //------------------------------------------------------------------------------
356 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions1 (TUint& EncodeOpts1)
358 TInt status = KErrNone;
360 if (!iParametersSameAsAdaptation)
362 status = GetAllMessage();
364 if (status == KErrNone)
366 EncodeOpts1 = iCurrentEncodeOptions1;
367 status = iCurrentEncodeOptions1Status;
369 if (!ValidGetStatus(status) &&
370 status != KErrNotSupported)
372 status = KErrGeneral;
377 //------------------------------------------------------------------------------
378 // Returns configured advanced encode options.
379 //------------------------------------------------------------------------------
380 EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions2 (TUint& EncodeOpts2)
382 TInt status = KErrNone;
384 if (!iParametersSameAsAdaptation)
386 status = GetAllMessage();
388 if (status == KErrNone)
390 EncodeOpts2 = iCurrentEncodeOptions2;
391 status = iCurrentEncodeOptions2Status;
393 if (!ValidGetStatus(status) &&
394 status != KErrNotSupported)
396 status = KErrGeneral;
401 //------------------------------------------------------------------------------
402 // Returns configured channel mask.
403 //------------------------------------------------------------------------------
404 EXPORT_C TInt CWmaDecoderIntfcProxy::GetChannelMaskIn (TUint& aChannelMask)
406 TInt status = KErrNone;
408 if (!iParametersSameAsAdaptation)
410 status = GetAllMessage();
412 if (status == KErrNone)
414 aChannelMask = iCurrentChannelMask;
415 status = iCurrentChannelMaskStatus;
417 if (!ValidGetStatus(status) &&
418 status != KErrNotSupported)
420 status = KErrGeneral;
426 //------------------------------------------------------------------------------
427 // Returns supported formats.
428 //------------------------------------------------------------------------------
429 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedFormats(RArray<TFormat>& aSupportedFormats)
432 TInt status = KErrNone;
433 TRAPD(err, status = GetSupportedFormatsL(aSupportedFormats))
436 if (err != KErrNone && err != KErrNotFound)
438 status = KErrGeneral;
444 //------------------------------------------------------------------------------
445 // Returns supported tools.
446 //------------------------------------------------------------------------------
447 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedTools(RArray<TTool>& aSupportedTools)
449 TInt status = KErrNone;
450 TRAPD(err, status = GetSupportedToolsL(aSupportedTools))
453 if (err != KErrNone && err != KErrNotFound)
455 status = KErrGeneral;
462 //------------------------------------------------------------------------------
463 // Returns supported max number of channels.
464 //------------------------------------------------------------------------------
465 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxChannelsIn(TUint& aSupportedMaxChannelsIn)
467 TInt status = KErrNone;
469 TPckgBuf<TUint> pckgBuf;
470 status = iCustomCommand.CustomCommandSync(
472 EWmaGetSupportedMaxChannels,
477 aSupportedMaxChannelsIn = pckgBuf();
478 if (status != KErrNone && status != KErrNotFound)
480 status = KErrGeneral;
485 //------------------------------------------------------------------------------
486 // Returns supported max bit rate.
487 //------------------------------------------------------------------------------
488 EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxBitrate(TUint& aSupportedMaxBitrate)
490 TInt status = KErrNone;
492 TPckgBuf<TUint> pckgBuf;
493 status = iCustomCommand.CustomCommandSync(
495 EWmaGetSupportedMaxBitrate,
500 aSupportedMaxBitrate = pckgBuf();
503 if (status != KErrNone && status != KErrNotFound)
505 status = KErrGeneral;
511 //------------------------------------------------------------------------------
512 // Get Supported Max Sample Rate
513 //------------------------------------------------------------------------------
514 TInt CWmaDecoderIntfcProxy::GetSupportedMaxSampleRate(TUint& aSupportedMaxSampleRate)
516 TInt status = KErrNone;
518 TPckgBuf<TUint> pckgBuf;
519 status = iCustomCommand.CustomCommandSync(
521 EWmaGetSupportedMaxSampleRate,
526 aSupportedMaxSampleRate = pckgBuf();
527 if (status != KErrNone && status != KErrNotFound)
529 status = KErrGeneral;
535 //------------------------------------------------------------------------------
536 // Returns controllable tools.
537 //------------------------------------------------------------------------------
538 EXPORT_C TInt CWmaDecoderIntfcProxy::GetControllableTools(RArray<TTool>& aControllableTools)
540 TInt status = KErrNone;
541 TRAPD(err, status = GetControllableToolsL(aControllableTools))
544 if (err != KErrNone && err != KErrNotFound)
546 status = KErrGeneral;
553 //------------------------------------------------------------------------------
555 //------------------------------------------------------------------------------
556 EXPORT_C void CWmaDecoderIntfcProxy::EnableTool(TTool aTool)
560 case EToolOutput32Bit:
561 iToolOutPut32Bit = ETrue;
563 case EDownMixToStereo:
564 iToolDownMixToStereo = ETrue;
566 case ELostDataConcealment:
567 iToolLostDataConcealment = ETrue;
575 //------------------------------------------------------------------------------
577 //------------------------------------------------------------------------------
578 EXPORT_C void CWmaDecoderIntfcProxy::DisableTool(TTool aTool)
582 case EToolOutput32Bit:
583 iToolOutPut32Bit = EFalse;
585 case EDownMixToStereo:
586 iToolDownMixToStereo = EFalse;
588 case ELostDataConcealment:
589 iToolLostDataConcealment = EFalse;
597 //------------------------------------------------------------------------------
598 // Returns tool state.
599 //------------------------------------------------------------------------------
600 EXPORT_C TInt CWmaDecoderIntfcProxy::GetTool(TTool aTool, TBool& aEnabled)
602 TInt status = KErrNone;
604 if (!iParametersSameAsAdaptation)
606 status = GetAllMessage();
610 case EToolOutput32Bit:
611 if (iCurrentToolOutPut32Bit)
619 status = iCurrentToolOutPut32BitStatus;
622 case EDownMixToStereo:
623 if (iCurrentToolDownMixToStereo)
631 status = iCurrentToolDownMixToStereoStatus;
634 case ELostDataConcealment:
635 if (iCurrentToolLostDataConcealment)
643 status = iCurrentToolLostDataConcealmentStatus;
649 if (!ValidGetStatus(status) &&
650 status != KErrNotSupported)
652 status = KErrGeneral;
660 //------------------------------------------------------------------------------
661 // Applies configuration settings to the decoder.
662 //------------------------------------------------------------------------------
663 EXPORT_C TInt CWmaDecoderIntfcProxy::ApplyConfig()
665 TInt status = KErrNone;
668 TWmaDecoderConfig configParams;
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;
685 TPckgBuf<TWmaDecoderConfig> pckgBuf(configParams);
686 status = iCustomCommand.CustomCommandSync(iMessageHandler,
690 if (status == KErrNone)
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;
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;
720 iParametersSameAsAdaptation = ETrue;
724 iParametersSameAsAdaptation = EFalse;
730 //------------------------------------------------------------------------------
731 // Receive all configure paramemters
732 //------------------------------------------------------------------------------
733 TInt CWmaDecoderIntfcProxy::GetAllMessage()
735 TPckgBuf<TAllParams> pckg;
736 TInt status = iCustomCommand.CustomCommandSync(
741 if (status == KErrNone)
743 iCurrentFormat = pckg().iCurrentFormat;
744 iCurrentFormatStatus = pckg().iCurrentFormatStatus;
746 iCurrentBitsPerSample = pckg().iCurrentBitsPerSample;
747 iCurrentBitsPerSampleStatus =pckg().iCurrentBitsPerSampleStatus;
749 iCurrentNumChannelsIn = pckg().iCurrentNumChannelsIn;
750 iCurrentNumChannelsInStatus = pckg().iCurrentNumChannelsInStatus;
752 iCurrentSamplesPerSec = pckg().iCurrentSamplesPerSec ;
753 iCurrentSamplesPerSecStatus = pckg().iCurrentSamplesPerSecStatus;
755 iCurrentAvgBytesPerSec = pckg().iCurrentAvgBytesPerSec;
756 iCurrentAvgBytesPerSecStatus = pckg().iCurrentAvgBytesPerSecStatus;
758 iCurrentBlockAlign = pckg().iCurrentBlockAlign;
759 iCurrentBlockAlignStatus = pckg().iCurrentBlockAlignStatus;
761 iCurrentEncodeOptions = pckg().iCurrentEncodeOptions;
762 iCurrentEncodeOptionsStatus = pckg().iCurrentEncodeOptionsStatus ;
764 iCurrentEncodeOptions1 = pckg().iCurrentEncodeOptions1;
765 iCurrentEncodeOptions1Status = pckg().iCurrentEncodeOptions1Status;
767 iCurrentEncodeOptions2 = pckg().iCurrentEncodeOptions2;
768 iCurrentEncodeOptions2Status = pckg().iCurrentEncodeOptions2Status;
770 iCurrentChannelMask = pckg().iCurrentChannelMask ;
771 iCurrentChannelMaskStatus = pckg().iCurrentChannelMaskStatus;
773 iCurrentToolOutPut32Bit = pckg().iCurrentToolOutPut32Bit;
774 iCurrentToolOutPut32BitStatus = pckg().iCurrentToolOutPut32BitStatus;
776 iCurrentToolDownMixToStereo = pckg().iCurrentToolDownMixToStereo;
777 iCurrentToolDownMixToStereoStatus = pckg().iCurrentToolDownMixToStereoStatus;
779 iCurrentToolLostDataConcealment = pckg().iCurrentToolLostDataConcealment;
780 iCurrentToolLostDataConcealmentStatus = pckg().iCurrentToolLostDataConcealmentStatus ;
781 iParametersSameAsAdaptation = ETrue;
786 //------------------------------------------------------------------------------
787 // check return status
788 //------------------------------------------------------------------------------
789 TBool CWmaDecoderIntfcProxy::ValidGetStatus(TInt aStatus)
791 if (aStatus != KErrNone && aStatus != KErrCompletion &&
792 aStatus != KErrUnknown && aStatus != KErrArgument &&
793 aStatus != KErrNotReady && aStatus != KErrNotFound &&
794 aStatus != KErrGeneral)
805 //------------------------------------------------------------------------------
806 // GetSupportedFormatsL
807 //------------------------------------------------------------------------------
808 TInt CWmaDecoderIntfcProxy::GetSupportedFormatsL(RArray<TFormat>& aSupportedFormats)
810 TInt status = KErrNone;
812 aSupportedFormats.Reset();
814 TPckgBuf<TUint> supportedFormatsPkg;
815 status = iCustomCommand.CustomCommandSync(
817 EWmaGetNumOfSupportedFormats,
820 supportedFormatsPkg);
821 HBufC8* buf = HBufC8::NewLC(supportedFormatsPkg()*sizeof(TUint));
822 // buf is left on cleanup
823 TPtr8 ptr = buf->Des();
824 iCustomCommand.CustomCommandSync(
826 EWmaGetSupportedFormats,
830 RDesReadStream stream(ptr);
831 CleanupClosePushL(stream); // stream on cleanup
832 for (TInt i=0; i<supportedFormatsPkg(); i++)
834 aSupportedFormats.AppendL(static_cast<TFormat>(stream.ReadUint32L()));
836 CleanupStack::PopAndDestroy(&stream);
837 CleanupStack::PopAndDestroy(buf);
838 if (status != KErrNone && status != KErrNotFound)
840 status = KErrGeneral;
846 //------------------------------------------------------------------------------
847 // GetSupportedToolsL
848 //------------------------------------------------------------------------------
849 TInt CWmaDecoderIntfcProxy::GetSupportedToolsL(RArray<TTool>& aSupportedTools)
852 TInt status = KErrNone;
853 aSupportedTools.Reset();
855 TPckgBuf<TUint> supportedToolsPkg;
856 status = iCustomCommand.CustomCommandSync(
858 EWmaGetNumOfSupportedTools,
863 HBufC8* buf = HBufC8::NewLC(supportedToolsPkg()*sizeof(TUint));
864 // buf is left on cleanup
865 TPtr8 ptr = buf->Des();
867 iCustomCommand.CustomCommandSync(
869 EWmaGetSupportedTools,
873 RDesReadStream stream(ptr);
874 CleanupClosePushL(stream); // stream on cleanup
875 for (TInt i=0; i<supportedToolsPkg(); i++)
877 aSupportedTools.AppendL(static_cast<TTool>(stream.ReadUint32L()));
879 CleanupStack::PopAndDestroy(&stream);
880 CleanupStack::PopAndDestroy(buf);
883 if (status != KErrNone && status != KErrNotFound)
885 status = KErrGeneral;
891 //------------------------------------------------------------------------------
892 // GetControllableToolsL
893 //------------------------------------------------------------------------------
894 TInt CWmaDecoderIntfcProxy::GetControllableToolsL(RArray<TTool>& aControllableTools)
896 TInt status = KErrNone;
897 aControllableTools.Reset();
899 TPckgBuf<TUint> numPckg;
900 status = iCustomCommand.CustomCommandSync(
902 EWmaGetNumOfControllableTools,
907 HBufC8* buf = HBufC8::NewLC(numPckg()*sizeof(TUint));
908 // buf is left on cleanup
909 TPtr8 ptr = buf->Des();
911 iCustomCommand.CustomCommandSync(
913 EWmaGetControllableTools,
917 RDesReadStream stream(ptr);
918 CleanupClosePushL(stream); // stream on cleanup
919 for (TInt i=0; i < numPckg(); i++)
921 aControllableTools.AppendL(static_cast<TTool>(stream.ReadUint32L()));
923 CleanupStack::PopAndDestroy(&stream);
924 CleanupStack::PopAndDestroy(buf);
925 if (status != KErrNone && status != KErrNotFound)
927 status = KErrGeneral;