sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description: Interface proxy for Enhanced AAC+ decoder configuration CI.
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
// INCLUDE FILES
|
sl@0
|
21 |
#include <CustomCommandUtility.h>
|
sl@0
|
22 |
#include <CustomInterfaceUtility.h>
|
sl@0
|
23 |
#include "EAacPlusDecoderIntfcMsgs.h"
|
sl@0
|
24 |
#include "EAacPlusDecoderIntfcProxy.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
// EXTERNAL DATA STRUCTURES
|
sl@0
|
27 |
|
sl@0
|
28 |
// EXTERNAL FUNCTION PROTOTYPES
|
sl@0
|
29 |
|
sl@0
|
30 |
// CONSTANTS
|
sl@0
|
31 |
const CEAacPlusDecoderIntfc::TAudioObjectType
|
sl@0
|
32 |
KAacAudioObjectTypeINVALID = CEAacPlusDecoderIntfc::ENull;
|
sl@0
|
33 |
const TInt KAacInputSampleRateINVALID = 0;
|
sl@0
|
34 |
const TInt KAacNumOfChannelsINVALID = 0;
|
sl@0
|
35 |
|
sl@0
|
36 |
// MACROS
|
sl@0
|
37 |
|
sl@0
|
38 |
// LOCAL CONSTANTS AND MACROS
|
sl@0
|
39 |
|
sl@0
|
40 |
// MODULE DATA STRUCTURES
|
sl@0
|
41 |
|
sl@0
|
42 |
// LOCAL FUNCTION PROTOTYPES
|
sl@0
|
43 |
|
sl@0
|
44 |
// FORWARD DECLARATIONS
|
sl@0
|
45 |
|
sl@0
|
46 |
// ============================= LOCAL FUNCTIONS ===============================
|
sl@0
|
47 |
|
sl@0
|
48 |
// ============================= MEMBER FUNCTIONS ==============================
|
sl@0
|
49 |
|
sl@0
|
50 |
/**
|
sl@0
|
51 |
* CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy
|
sl@0
|
52 |
* C++ default constructor can NOT contain any code, that
|
sl@0
|
53 |
* might leave.
|
sl@0
|
54 |
*/
|
sl@0
|
55 |
CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy(
|
sl@0
|
56 |
TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
57 |
MCustomCommand& aCustomCommand,
|
sl@0
|
58 |
CCustomInterfaceUtility* aCustomInterfaceUtility) :
|
sl@0
|
59 |
iCustomCommand(aCustomCommand),
|
sl@0
|
60 |
iMessageHandler(aMessageHandler),
|
sl@0
|
61 |
iCustomInterfaceUtility(aCustomInterfaceUtility)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
* CEAacPlusDecoderIntfcProxy::ConstructL
|
sl@0
|
67 |
* Symbian 2nd phase constructor can leave.
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
void CEAacPlusDecoderIntfcProxy::ConstructL()
|
sl@0
|
70 |
{
|
sl@0
|
71 |
iAudioObjectType = KAacAudioObjectTypeINVALID;
|
sl@0
|
72 |
iInputSamplingFrequency = KAacInputSampleRateINVALID;
|
sl@0
|
73 |
iNumOfChannels = KAacNumOfChannelsINVALID;
|
sl@0
|
74 |
iSbrEnabled = EFalse;
|
sl@0
|
75 |
iDsmEnabled = EFalse;
|
sl@0
|
76 |
iHasBeenApplied = EFalse;
|
sl@0
|
77 |
}
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
/**
|
sl@0
|
81 |
* CEAacPlusDecoderIntfcProxy::NewL
|
sl@0
|
82 |
* Two-phased constructor.
|
sl@0
|
83 |
*/
|
sl@0
|
84 |
EXPORT_C CEAacPlusDecoderIntfcProxy* CEAacPlusDecoderIntfcProxy::NewL(
|
sl@0
|
85 |
TMMFMessageDestinationPckg aMessageHandler,
|
sl@0
|
86 |
MCustomCommand& aCustomCommand,
|
sl@0
|
87 |
CCustomInterfaceUtility* aCustomInterfaceUtility)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
CEAacPlusDecoderIntfcProxy* self = new(ELeave) CEAacPlusDecoderIntfcProxy(
|
sl@0
|
90 |
aMessageHandler,
|
sl@0
|
91 |
aCustomCommand,
|
sl@0
|
92 |
aCustomInterfaceUtility);
|
sl@0
|
93 |
CleanupStack::PushL( self );
|
sl@0
|
94 |
self->ConstructL();
|
sl@0
|
95 |
CleanupStack::Pop( self );
|
sl@0
|
96 |
return self;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
/**
|
sl@0
|
100 |
* Destructor
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
EXPORT_C CEAacPlusDecoderIntfcProxy::~CEAacPlusDecoderIntfcProxy()
|
sl@0
|
103 |
{
|
sl@0
|
104 |
iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
|
sl@0
|
105 |
delete iCustomInterfaceUtility;
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
|
sl@0
|
109 |
// From CEAacPlusDecoderIntfc
|
sl@0
|
110 |
|
sl@0
|
111 |
/**
|
sl@0
|
112 |
* Configures decoder's profile defined by TAudioObjectType.
|
sl@0
|
113 |
* (other items defined in the header)
|
sl@0
|
114 |
*/
|
sl@0
|
115 |
EXPORT_C void CEAacPlusDecoderIntfcProxy::SetAudioObjectType(
|
sl@0
|
116 |
TAudioObjectType aAudioObjectType)
|
sl@0
|
117 |
{
|
sl@0
|
118 |
iAudioObjectType = aAudioObjectType;
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
* Configures decoder's input sampling frequency.
|
sl@0
|
123 |
* (other items defined in the header)
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
EXPORT_C void CEAacPlusDecoderIntfcProxy::SetInputSamplingFrequency(
|
sl@0
|
126 |
TUint aInputSamplingFrequency)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
iInputSamplingFrequency = aInputSamplingFrequency;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
* Configures decoder's channel settings.
|
sl@0
|
133 |
* (other items defined in the header)
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
EXPORT_C void CEAacPlusDecoderIntfcProxy::SetNumOfChannels(
|
sl@0
|
136 |
TUint aNumOfChannels)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
iNumOfChannels = aNumOfChannels;
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
* Configures decoder's SBR settings.
|
sl@0
|
143 |
* (other items defined in the header)
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
EXPORT_C void CEAacPlusDecoderIntfcProxy::SetSbr(TBool aSbrEnabled)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
iSbrEnabled = aSbrEnabled;
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
/**
|
sl@0
|
151 |
* Configures decoder's DSM settings.
|
sl@0
|
152 |
* (other items defined in the header)
|
sl@0
|
153 |
*/
|
sl@0
|
154 |
EXPORT_C void CEAacPlusDecoderIntfcProxy::SetDownSampledMode(TBool aDsmEnabled)
|
sl@0
|
155 |
{
|
sl@0
|
156 |
iDsmEnabled = aDsmEnabled;
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
/**
|
sl@0
|
160 |
* Returns decoder's AAC profile settings.
|
sl@0
|
161 |
* (other items defined in the header)
|
sl@0
|
162 |
*/
|
sl@0
|
163 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetAudioObjectType(
|
sl@0
|
164 |
TAudioObjectType& aAudioObjectType)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
TInt status = KErrNone;
|
sl@0
|
167 |
|
sl@0
|
168 |
if (iHasBeenApplied)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
aAudioObjectType = iCurrentAudioObjectType;
|
sl@0
|
171 |
}
|
sl@0
|
172 |
else
|
sl@0
|
173 |
{
|
sl@0
|
174 |
status = KErrArgument;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
return status;
|
sl@0
|
178 |
}
|
sl@0
|
179 |
|
sl@0
|
180 |
/**
|
sl@0
|
181 |
* Returns decoder's input sampling frequency settings.
|
sl@0
|
182 |
* (other items defined in the header)
|
sl@0
|
183 |
*/
|
sl@0
|
184 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetInputSamplingFrequency(
|
sl@0
|
185 |
TUint& aInputSamplingFrequency)
|
sl@0
|
186 |
{
|
sl@0
|
187 |
TInt status = KErrNone;
|
sl@0
|
188 |
|
sl@0
|
189 |
if (iHasBeenApplied)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
aInputSamplingFrequency = iCurrentInputSamplingFrequency;
|
sl@0
|
192 |
}
|
sl@0
|
193 |
else
|
sl@0
|
194 |
{
|
sl@0
|
195 |
status = KErrArgument;
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
return status;
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
/**
|
sl@0
|
202 |
* Returns decoder's channel settings.
|
sl@0
|
203 |
* (other items defined in the header)
|
sl@0
|
204 |
*/
|
sl@0
|
205 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetNumOfChannels(
|
sl@0
|
206 |
TUint& aNumOfChannels)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
TInt status = KErrNone;
|
sl@0
|
209 |
|
sl@0
|
210 |
if (iHasBeenApplied)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
aNumOfChannels = iCurrentNumOfChannels;
|
sl@0
|
213 |
}
|
sl@0
|
214 |
else
|
sl@0
|
215 |
{
|
sl@0
|
216 |
status = KErrArgument;
|
sl@0
|
217 |
}
|
sl@0
|
218 |
|
sl@0
|
219 |
return status;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
/**
|
sl@0
|
223 |
* Returns decoder's SBR settings.
|
sl@0
|
224 |
* (other items defined in the header)
|
sl@0
|
225 |
*/
|
sl@0
|
226 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetSbr(TBool& aSbrEnabled)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
TInt status = KErrNone;
|
sl@0
|
229 |
|
sl@0
|
230 |
if (iHasBeenApplied)
|
sl@0
|
231 |
{
|
sl@0
|
232 |
aSbrEnabled = iCurrentSbrEnabled;
|
sl@0
|
233 |
}
|
sl@0
|
234 |
else
|
sl@0
|
235 |
{
|
sl@0
|
236 |
status = KErrArgument;
|
sl@0
|
237 |
}
|
sl@0
|
238 |
|
sl@0
|
239 |
return status;
|
sl@0
|
240 |
}
|
sl@0
|
241 |
|
sl@0
|
242 |
/**
|
sl@0
|
243 |
* Returns decoder's DSM settings.
|
sl@0
|
244 |
* (other items defined in the header)
|
sl@0
|
245 |
*/
|
sl@0
|
246 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetDownSampledMode(TBool& aDsmEnabled)
|
sl@0
|
247 |
{
|
sl@0
|
248 |
TInt status = KErrNone;
|
sl@0
|
249 |
|
sl@0
|
250 |
if (iHasBeenApplied)
|
sl@0
|
251 |
{
|
sl@0
|
252 |
aDsmEnabled = iCurrentDsmEnabled;
|
sl@0
|
253 |
}
|
sl@0
|
254 |
else
|
sl@0
|
255 |
{
|
sl@0
|
256 |
status = KErrArgument;
|
sl@0
|
257 |
}
|
sl@0
|
258 |
|
sl@0
|
259 |
return status;
|
sl@0
|
260 |
}
|
sl@0
|
261 |
|
sl@0
|
262 |
/**
|
sl@0
|
263 |
* Applies configuration settings to the decoder.
|
sl@0
|
264 |
* (other items defined in the header)
|
sl@0
|
265 |
*/
|
sl@0
|
266 |
EXPORT_C TInt CEAacPlusDecoderIntfcProxy::ApplyConfig()
|
sl@0
|
267 |
{
|
sl@0
|
268 |
TInt status = KErrNone;
|
sl@0
|
269 |
|
sl@0
|
270 |
if (!iHasBeenApplied)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
// Make sure Set() methods for these params were called at least once
|
sl@0
|
273 |
if (iAudioObjectType == KAacAudioObjectTypeINVALID ||
|
sl@0
|
274 |
iInputSamplingFrequency == KAacInputSampleRateINVALID ||
|
sl@0
|
275 |
iNumOfChannels == KAacNumOfChannelsINVALID)
|
sl@0
|
276 |
{
|
sl@0
|
277 |
status = KErrArgument;
|
sl@0
|
278 |
}
|
sl@0
|
279 |
}
|
sl@0
|
280 |
|
sl@0
|
281 |
if (status == KErrNone)
|
sl@0
|
282 |
{
|
sl@0
|
283 |
TEAacPlusDecoderConfig configParams;
|
sl@0
|
284 |
|
sl@0
|
285 |
configParams.iAudioObjectType = iAudioObjectType;
|
sl@0
|
286 |
configParams.iInputSamplingFrequency = iInputSamplingFrequency;
|
sl@0
|
287 |
configParams.iNumOfChannels = iNumOfChannels;
|
sl@0
|
288 |
configParams.iSbrEnabled = iSbrEnabled;
|
sl@0
|
289 |
configParams.iDsmEnabled = iDsmEnabled;
|
sl@0
|
290 |
|
sl@0
|
291 |
TPckgBuf<TEAacPlusDecoderConfig> pckgBuf(configParams);
|
sl@0
|
292 |
TInt status = iCustomCommand.CustomCommandSync(iMessageHandler,
|
sl@0
|
293 |
EEaacpdimApplyConfig,
|
sl@0
|
294 |
pckgBuf,
|
sl@0
|
295 |
KNullDesC8);
|
sl@0
|
296 |
if (status == KErrNone)
|
sl@0
|
297 |
{
|
sl@0
|
298 |
iCurrentAudioObjectType = iAudioObjectType;
|
sl@0
|
299 |
iCurrentInputSamplingFrequency = iInputSamplingFrequency;
|
sl@0
|
300 |
iCurrentNumOfChannels = iNumOfChannels;
|
sl@0
|
301 |
iCurrentSbrEnabled = iSbrEnabled;
|
sl@0
|
302 |
iCurrentDsmEnabled = iDsmEnabled;
|
sl@0
|
303 |
iHasBeenApplied = ETrue;
|
sl@0
|
304 |
}
|
sl@0
|
305 |
}
|
sl@0
|
306 |
|
sl@0
|
307 |
return status;
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
// End of File
|