os/mm/devsoundextensions/mmfcustominterfaces/EAacPlusDecoderIntfc/EAacPlusDecoderIntfcProxy/src/EAacPlusDecoderIntfcProxy.cpp
Update contrib.
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 Enhanced AAC+ decoder configuration CI.
21 #include <CustomCommandUtility.h>
22 #include <CustomInterfaceUtility.h>
23 #include "EAacPlusDecoderIntfcMsgs.h"
24 #include "EAacPlusDecoderIntfcProxy.h"
26 // EXTERNAL DATA STRUCTURES
28 // EXTERNAL FUNCTION PROTOTYPES
31 const CEAacPlusDecoderIntfc::TAudioObjectType
32 KAacAudioObjectTypeINVALID = CEAacPlusDecoderIntfc::ENull;
33 const TInt KAacInputSampleRateINVALID = 0;
34 const TInt KAacNumOfChannelsINVALID = 0;
38 // LOCAL CONSTANTS AND MACROS
40 // MODULE DATA STRUCTURES
42 // LOCAL FUNCTION PROTOTYPES
44 // FORWARD DECLARATIONS
46 // ============================= LOCAL FUNCTIONS ===============================
48 // ============================= MEMBER FUNCTIONS ==============================
51 * CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy
52 * C++ default constructor can NOT contain any code, that
55 CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy(
56 TMMFMessageDestinationPckg aMessageHandler,
57 MCustomCommand& aCustomCommand,
58 CCustomInterfaceUtility* aCustomInterfaceUtility) :
59 iCustomCommand(aCustomCommand),
60 iMessageHandler(aMessageHandler),
61 iCustomInterfaceUtility(aCustomInterfaceUtility)
66 * CEAacPlusDecoderIntfcProxy::ConstructL
67 * Symbian 2nd phase constructor can leave.
69 void CEAacPlusDecoderIntfcProxy::ConstructL()
71 iAudioObjectType = KAacAudioObjectTypeINVALID;
72 iInputSamplingFrequency = KAacInputSampleRateINVALID;
73 iNumOfChannels = KAacNumOfChannelsINVALID;
76 iHasBeenApplied = EFalse;
81 * CEAacPlusDecoderIntfcProxy::NewL
82 * Two-phased constructor.
84 EXPORT_C CEAacPlusDecoderIntfcProxy* CEAacPlusDecoderIntfcProxy::NewL(
85 TMMFMessageDestinationPckg aMessageHandler,
86 MCustomCommand& aCustomCommand,
87 CCustomInterfaceUtility* aCustomInterfaceUtility)
89 CEAacPlusDecoderIntfcProxy* self = new(ELeave) CEAacPlusDecoderIntfcProxy(
92 aCustomInterfaceUtility);
93 CleanupStack::PushL( self );
95 CleanupStack::Pop( self );
102 EXPORT_C CEAacPlusDecoderIntfcProxy::~CEAacPlusDecoderIntfcProxy()
104 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
105 delete iCustomInterfaceUtility;
109 // From CEAacPlusDecoderIntfc
112 * Configures decoder's profile defined by TAudioObjectType.
113 * (other items defined in the header)
115 EXPORT_C void CEAacPlusDecoderIntfcProxy::SetAudioObjectType(
116 TAudioObjectType aAudioObjectType)
118 iAudioObjectType = aAudioObjectType;
122 * Configures decoder's input sampling frequency.
123 * (other items defined in the header)
125 EXPORT_C void CEAacPlusDecoderIntfcProxy::SetInputSamplingFrequency(
126 TUint aInputSamplingFrequency)
128 iInputSamplingFrequency = aInputSamplingFrequency;
132 * Configures decoder's channel settings.
133 * (other items defined in the header)
135 EXPORT_C void CEAacPlusDecoderIntfcProxy::SetNumOfChannels(
136 TUint aNumOfChannels)
138 iNumOfChannels = aNumOfChannels;
142 * Configures decoder's SBR settings.
143 * (other items defined in the header)
145 EXPORT_C void CEAacPlusDecoderIntfcProxy::SetSbr(TBool aSbrEnabled)
147 iSbrEnabled = aSbrEnabled;
151 * Configures decoder's DSM settings.
152 * (other items defined in the header)
154 EXPORT_C void CEAacPlusDecoderIntfcProxy::SetDownSampledMode(TBool aDsmEnabled)
156 iDsmEnabled = aDsmEnabled;
160 * Returns decoder's AAC profile settings.
161 * (other items defined in the header)
163 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetAudioObjectType(
164 TAudioObjectType& aAudioObjectType)
166 TInt status = KErrNone;
170 aAudioObjectType = iCurrentAudioObjectType;
174 status = KErrArgument;
181 * Returns decoder's input sampling frequency settings.
182 * (other items defined in the header)
184 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetInputSamplingFrequency(
185 TUint& aInputSamplingFrequency)
187 TInt status = KErrNone;
191 aInputSamplingFrequency = iCurrentInputSamplingFrequency;
195 status = KErrArgument;
202 * Returns decoder's channel settings.
203 * (other items defined in the header)
205 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetNumOfChannels(
206 TUint& aNumOfChannels)
208 TInt status = KErrNone;
212 aNumOfChannels = iCurrentNumOfChannels;
216 status = KErrArgument;
223 * Returns decoder's SBR settings.
224 * (other items defined in the header)
226 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetSbr(TBool& aSbrEnabled)
228 TInt status = KErrNone;
232 aSbrEnabled = iCurrentSbrEnabled;
236 status = KErrArgument;
243 * Returns decoder's DSM settings.
244 * (other items defined in the header)
246 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetDownSampledMode(TBool& aDsmEnabled)
248 TInt status = KErrNone;
252 aDsmEnabled = iCurrentDsmEnabled;
256 status = KErrArgument;
263 * Applies configuration settings to the decoder.
264 * (other items defined in the header)
266 EXPORT_C TInt CEAacPlusDecoderIntfcProxy::ApplyConfig()
268 TInt status = KErrNone;
270 if (!iHasBeenApplied)
272 // Make sure Set() methods for these params were called at least once
273 if (iAudioObjectType == KAacAudioObjectTypeINVALID ||
274 iInputSamplingFrequency == KAacInputSampleRateINVALID ||
275 iNumOfChannels == KAacNumOfChannelsINVALID)
277 status = KErrArgument;
281 if (status == KErrNone)
283 TEAacPlusDecoderConfig configParams;
285 configParams.iAudioObjectType = iAudioObjectType;
286 configParams.iInputSamplingFrequency = iInputSamplingFrequency;
287 configParams.iNumOfChannels = iNumOfChannels;
288 configParams.iSbrEnabled = iSbrEnabled;
289 configParams.iDsmEnabled = iDsmEnabled;
291 TPckgBuf<TEAacPlusDecoderConfig> pckgBuf(configParams);
292 TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
293 EEaacpdimApplyConfig,
296 if (status == KErrNone)
298 iCurrentAudioObjectType = iAudioObjectType;
299 iCurrentInputSamplingFrequency = iInputSamplingFrequency;
300 iCurrentNumOfChannels = iNumOfChannels;
301 iCurrentSbrEnabled = iSbrEnabled;
302 iCurrentDsmEnabled = iDsmEnabled;
303 iHasBeenApplied = ETrue;