|
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 BT SBC Encoder configuration CI. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <CustomCommandUtility.h> |
|
22 #include <CustomInterfaceUtility.h> |
|
23 #include "SbcEncoderIntfcMsgs.h" |
|
24 #include "SbcEncoderIntfcProxy.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 * CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy |
|
48 * C++ default constructor can NOT contain any code, that might leave. |
|
49 */ |
|
50 CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy( |
|
51 TMMFMessageDestinationPckg aMessageHandler, |
|
52 MCustomCommand& aCustomCommand, |
|
53 CCustomInterfaceUtility* aCustomInterfaceUtility) : |
|
54 iCustomCommand(aCustomCommand), |
|
55 iMessageHandler(aMessageHandler), |
|
56 iCustomInterfaceUtility(aCustomInterfaceUtility) |
|
57 { |
|
58 } |
|
59 |
|
60 /** |
|
61 * CSbcEncoderIntfcProxy::ConstructL |
|
62 * Symbian 2nd phase constructor can leave. |
|
63 */ |
|
64 void CSbcEncoderIntfcProxy::ConstructL() |
|
65 { |
|
66 iHasBeenApplied = EFalse; |
|
67 } |
|
68 |
|
69 /** |
|
70 * CSbcEncoderIntfcProxy::NewL |
|
71 * Two-phased constructor. |
|
72 */ |
|
73 EXPORT_C CSbcEncoderIntfcProxy* CSbcEncoderIntfcProxy::NewL( |
|
74 TMMFMessageDestinationPckg aMessageHandler, |
|
75 MCustomCommand& aCustomCommand, |
|
76 CCustomInterfaceUtility* aCustomInterfaceUtility) |
|
77 { |
|
78 CSbcEncoderIntfcProxy* self = new(ELeave) CSbcEncoderIntfcProxy( |
|
79 aMessageHandler, |
|
80 aCustomCommand, |
|
81 aCustomInterfaceUtility); |
|
82 CleanupStack::PushL( self ); |
|
83 self->ConstructL(); |
|
84 CleanupStack::Pop( self ); |
|
85 return self; |
|
86 } |
|
87 |
|
88 /** |
|
89 * Destructor |
|
90 */ |
|
91 EXPORT_C CSbcEncoderIntfcProxy::~CSbcEncoderIntfcProxy() |
|
92 { |
|
93 iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); |
|
94 delete iCustomInterfaceUtility; |
|
95 } |
|
96 |
|
97 /** |
|
98 * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies |
|
99 * Returns an array of supported sampling frequencies. |
|
100 * Calls a subfunction, which sends the appropriate custom command |
|
101 * to its message handler. A subfunction is used to contain multiple |
|
102 * leaving functions in a single trap. |
|
103 * (other items were commented in a header). |
|
104 */ |
|
105 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies( |
|
106 RArray<TUint>& |
|
107 aSupportedSamplingFrequencies) |
|
108 { |
|
109 TRAPD(status, |
|
110 GetSupportedSamplingFrequenciesL(aSupportedSamplingFrequencies)); |
|
111 return status; |
|
112 } |
|
113 |
|
114 /** |
|
115 * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL |
|
116 * Returns an array of supported sampling frequencies. |
|
117 * Sends the custom command for this function to its message handler. This |
|
118 * requires two commands. The first is a request for the number of supported |
|
119 * sampling frequencies. A buffer is allocated locally to hold this number of |
|
120 * frequencies that will be returned. A pointer to this buffer is sent with the |
|
121 * next command, which is a request for the frequencies. This buffer will be |
|
122 * filled with the frequency values. These values are then copied into the |
|
123 * array provided to this function and the local buffer is deleted. |
|
124 * (other items were commented in a header). |
|
125 */ |
|
126 void CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL( |
|
127 RArray<TUint>& aSupportedSamplingFrequencies) |
|
128 { |
|
129 aSupportedSamplingFrequencies.Reset(); |
|
130 |
|
131 TPckgBuf<TUint> pckgBuf; |
|
132 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
133 iMessageHandler, |
|
134 ESbceimGetNumOfSupportedSamplingFrequencies, |
|
135 KNullDesC8, |
|
136 KNullDesC8, |
|
137 pckgBuf)); |
|
138 |
|
139 HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); |
|
140 TPtr8 ptr = buf->Des(); |
|
141 |
|
142 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
143 iMessageHandler, |
|
144 ESbceimGetSupportedSamplingFrequencies, |
|
145 KNullDesC8, |
|
146 KNullDesC8, |
|
147 ptr)); |
|
148 |
|
149 PopulateArrayL(aSupportedSamplingFrequencies, ptr, pckgBuf()); |
|
150 CleanupStack::PopAndDestroy(buf); |
|
151 } |
|
152 |
|
153 /** |
|
154 * CSbcEncoderIntfcProxy::GetSupportedChannelModes |
|
155 * Returns an array of supported channel modes. |
|
156 * Calls a subfunction which sends the appropriate custom command to its |
|
157 * message handler. A subfunction is used to contain multiple leaving |
|
158 * functions for a single trap. |
|
159 * (other items were commented in a header). |
|
160 */ |
|
161 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedChannelModes( |
|
162 RArray<TSbcChannelMode>& |
|
163 aSupportedChannelModes) |
|
164 { |
|
165 TRAPD(status, GetSupportedChannelModesL(aSupportedChannelModes)); |
|
166 return status; |
|
167 } |
|
168 |
|
169 /** |
|
170 * CSbcEncoderIntfcProxy::GetSupportedChannelModesL |
|
171 * Returns an array of supported channel modes. |
|
172 * Sends the custom command for this function to its message handler. This |
|
173 * requires two commands. The first is a request for the number of supported |
|
174 * channel modes. A buffer is allocated locally to hold this number of channel |
|
175 * modes that will be returned. A pointer to this buffer is sent with the next |
|
176 * command, which is a request for the channel modes. This buffer will be |
|
177 * filled with the frequency values. These values are then copied into the array |
|
178 * provided to this function and the local buffer is deleted. |
|
179 * (other items were commented in a header). |
|
180 */ |
|
181 void CSbcEncoderIntfcProxy::GetSupportedChannelModesL( |
|
182 RArray<TSbcChannelMode>& aSupportedChannelModes) |
|
183 { |
|
184 aSupportedChannelModes.Reset(); |
|
185 |
|
186 TPckgBuf<TSbcChannelMode> pckgBuf; |
|
187 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
188 iMessageHandler, |
|
189 ESbceimGetNumOfSupportedChannelModes, |
|
190 KNullDesC8, |
|
191 KNullDesC8, |
|
192 pckgBuf)); |
|
193 |
|
194 HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); |
|
195 TPtr8 ptr = buf->Des(); |
|
196 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
197 iMessageHandler, |
|
198 ESbceimGetSupportedChannelModes, |
|
199 KNullDesC8, |
|
200 KNullDesC8, |
|
201 ptr)); |
|
202 |
|
203 RDesReadStream stream(ptr); |
|
204 CleanupClosePushL(stream); |
|
205 |
|
206 for (TInt i = 0; i < pckgBuf(); i++) |
|
207 { |
|
208 aSupportedChannelModes.Append( |
|
209 static_cast<TSbcChannelMode>(stream.ReadUint32L())); |
|
210 } |
|
211 |
|
212 CleanupStack::PopAndDestroy(&stream); |
|
213 CleanupStack::PopAndDestroy(buf); |
|
214 } |
|
215 |
|
216 /** |
|
217 * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks |
|
218 * Returns an array of supported blocks. |
|
219 * Calls a subfunction, which sends the appropriate custom command to its |
|
220 * message handler. A subfunction is used to contain multiple leaving functions |
|
221 * for a single trap. |
|
222 * (other items were commented in a header). |
|
223 */ |
|
224 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks( |
|
225 RArray<TUint>& aSupportedNumOfBlocks) |
|
226 { |
|
227 TRAPD(status, GetSupportedNumOfBlocksL(aSupportedNumOfBlocks)); |
|
228 return status; |
|
229 } |
|
230 |
|
231 /** |
|
232 * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks |
|
233 * Returns an array of supported blocks. |
|
234 * Sends the custom command for this function to its message handler. This |
|
235 * requires two commands. The first is a request for the number of supported |
|
236 * blocks. A buffer is allocated locally to hold this number of blocks that |
|
237 * will be returned. A pointer to this buffer is then sent with the next |
|
238 * command, which is a request for the blocks. This buffer will be filled |
|
239 * with the block values. These values are then copied into the array provided |
|
240 * to this function and the local buffer is deleted. |
|
241 * (other items were commented in a header). |
|
242 */ |
|
243 void CSbcEncoderIntfcProxy::GetSupportedNumOfBlocksL( |
|
244 RArray<TUint>& aSupportedNumOfBlocks) |
|
245 { |
|
246 aSupportedNumOfBlocks.Reset(); |
|
247 |
|
248 TPckgBuf<TUint> pckgBuf; |
|
249 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
250 iMessageHandler, |
|
251 ESbceimGetNumOfSupportedBlocks, |
|
252 KNullDesC8, |
|
253 KNullDesC8, |
|
254 pckgBuf)); |
|
255 |
|
256 HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); |
|
257 TPtr8 ptr = buf->Des(); |
|
258 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
259 iMessageHandler, |
|
260 ESbceimGetSupportedBlocks, |
|
261 KNullDesC8, |
|
262 KNullDesC8, |
|
263 ptr)); |
|
264 |
|
265 PopulateArrayL(aSupportedNumOfBlocks, ptr, pckgBuf()); |
|
266 CleanupStack::PopAndDestroy(buf); |
|
267 } |
|
268 |
|
269 /** |
|
270 * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands |
|
271 * Returns an array of supported subbands. |
|
272 * Calls a subfunction which sends the appropriate custom command to its |
|
273 * message handler. A subfunction is used to contain multiple leaving functions |
|
274 * for a single trap. |
|
275 * (other items were commented in a header). |
|
276 */ |
|
277 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands( |
|
278 RArray<TUint>& aSupportedNumOfSubbands) |
|
279 { |
|
280 TRAPD(status, GetSupportedNumOfSubbandsL(aSupportedNumOfSubbands)); |
|
281 return status; |
|
282 } |
|
283 |
|
284 /** |
|
285 * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL |
|
286 * Returns an array of supported subbands. |
|
287 * Sends the custom command for this function to its message handler. This |
|
288 * requires two commands. The first is a request for the number of supported |
|
289 * subbands. A buffer is allocated locally to hold this number of subbands that |
|
290 * will be returned. A pointer to this buffer is sent with the next command, |
|
291 * which is a request for the subbands. This buffer will be filled with the |
|
292 * subband values. These values are then copied into the array provided to this |
|
293 * function and the local buffer is deleted. |
|
294 * (other items were commented in a header). |
|
295 */ |
|
296 void CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL( |
|
297 RArray<TUint>& aSupportedNumOfSubbands) |
|
298 { |
|
299 aSupportedNumOfSubbands.Reset(); |
|
300 |
|
301 TPckgBuf<TUint> pckgBuf; |
|
302 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
303 iMessageHandler, |
|
304 ESbceimGetNumOfSupportedNumOfSubbands, |
|
305 KNullDesC8, |
|
306 KNullDesC8, |
|
307 pckgBuf)); |
|
308 |
|
309 HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); |
|
310 TPtr8 ptr = buf->Des(); |
|
311 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
312 iMessageHandler, |
|
313 ESbceimGetSupportedNumOfSubbands, |
|
314 KNullDesC8, |
|
315 KNullDesC8, |
|
316 ptr)); |
|
317 |
|
318 PopulateArrayL(aSupportedNumOfSubbands, ptr, pckgBuf()); |
|
319 CleanupStack::PopAndDestroy(buf); |
|
320 } |
|
321 |
|
322 /** |
|
323 * CSbcEncoderIntfcProxy::GetSupportedAllocationMethods |
|
324 * Returns an array of supported allocation methods. |
|
325 * Calls a subfunction which sends the appropriate custom command to its |
|
326 * message handler. A subfunction is used to contain multiple leaving |
|
327 * functions for a single trap. |
|
328 * (other items were commented in a header). |
|
329 */ |
|
330 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedAllocationMethods( |
|
331 RArray<TSbcAllocationMethod>& |
|
332 aSupportedAllocationMethods) |
|
333 { |
|
334 TRAPD(status, GetSupportedAllocationMethodsL(aSupportedAllocationMethods)); |
|
335 return status; |
|
336 } |
|
337 |
|
338 /** |
|
339 * CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL |
|
340 * Returns an array of supported allocation methods. |
|
341 * Sends the custom command for this function to its message handler. This |
|
342 * requires two commands. The first is a request for the number of supported |
|
343 * allocation methods. A buffer is allocated locally to hold this number of |
|
344 * allocation methods that will be returned. A pointer to this buffer is sent |
|
345 * with the next command which is a request for the allocation methods. This |
|
346 * buffer will be filled with the allocation method values. These values are |
|
347 * then copied into the array provided to this function and the local buffer |
|
348 * is deleted. |
|
349 * (other items were commented in a header). |
|
350 */ |
|
351 void CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL( |
|
352 RArray<TSbcAllocationMethod>& |
|
353 aSupportedAllocationMethods) |
|
354 { |
|
355 aSupportedAllocationMethods.Reset(); |
|
356 |
|
357 TPckgBuf<TSbcAllocationMethod> pckgBuf; |
|
358 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
359 iMessageHandler, |
|
360 ESbceimGetNumOfSupportedAllocationMethods, |
|
361 KNullDesC8, |
|
362 KNullDesC8, |
|
363 pckgBuf)); |
|
364 |
|
365 HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint)); |
|
366 TPtr8 ptr = buf->Des(); |
|
367 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
368 iMessageHandler, |
|
369 ESbceimGetSupportedAllocationMethods, |
|
370 KNullDesC8, |
|
371 KNullDesC8, |
|
372 ptr)); |
|
373 |
|
374 RDesReadStream stream(ptr); |
|
375 CleanupClosePushL(stream); |
|
376 |
|
377 for (TInt i = 0; i < pckgBuf(); i++) |
|
378 { |
|
379 aSupportedAllocationMethods.Append( |
|
380 static_cast<TSbcAllocationMethod>(stream.ReadUint32L())); |
|
381 } |
|
382 |
|
383 CleanupStack::PopAndDestroy(&stream); |
|
384 CleanupStack::PopAndDestroy(buf); |
|
385 } |
|
386 |
|
387 /** |
|
388 * CSbcEncoderIntfcProxy::GetSupportedBitpoolRange |
|
389 * Returns supported bitpool range. |
|
390 * Calls a subfunction which sends the appropriate custom command to its |
|
391 * message handler. A subfunction is used to contain multiple leaving |
|
392 * functions for a single trap. |
|
393 * (other items were commented in a header). |
|
394 */ |
|
395 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedBitpoolRange( |
|
396 TUint& aMinSupportedBitpoolSize, |
|
397 TUint& aMaxSupportedBitpoolSize) |
|
398 { |
|
399 TRAPD(status, GetSupportedBitpoolRangeL(aMinSupportedBitpoolSize, |
|
400 aMaxSupportedBitpoolSize)); |
|
401 return status; |
|
402 } |
|
403 |
|
404 /** |
|
405 * CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL |
|
406 * Returns an array of supported bitpool range. |
|
407 * Sends the custom command for this function to its message handler with TUint |
|
408 * type arguments that will be filled with the bitpool min and max values. |
|
409 * (other items were commented in a header). |
|
410 */ |
|
411 void CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL( |
|
412 TUint& aMinSupportedBitpoolSize, |
|
413 TUint& aMaxSupportedBitpoolSize) |
|
414 { |
|
415 TSbcEncoderBitpoolRange bitPoolRange; |
|
416 bitPoolRange.iMinSupportedBitpoolSize = 0; |
|
417 bitPoolRange.iMaxSupportedBitpoolSize = 0; |
|
418 |
|
419 TPckgBuf<TSbcEncoderBitpoolRange> pckgBuf(bitPoolRange); |
|
420 User::LeaveIfError(iCustomCommand.CustomCommandSync( |
|
421 iMessageHandler, |
|
422 ESbceimGetSupportedBitpoolRange, |
|
423 KNullDesC8, |
|
424 KNullDesC8, |
|
425 pckgBuf)); |
|
426 |
|
427 aMinSupportedBitpoolSize = pckgBuf().iMinSupportedBitpoolSize; |
|
428 aMaxSupportedBitpoolSize = pckgBuf().iMaxSupportedBitpoolSize; |
|
429 } |
|
430 |
|
431 /* |
|
432 * CSbcEncoderIntfcProxy::ApplyConfig |
|
433 * Commits encoder configuration settings configured by callas to Set() APIs. |
|
434 * Sends the custom command for this function to its message handler. |
|
435 * New settings will not take effect until ApplyConfig() is called. |
|
436 * (other items were commented in a header). |
|
437 */ |
|
438 EXPORT_C TInt CSbcEncoderIntfcProxy::ApplyConfig() |
|
439 { |
|
440 TInt status = KErrNone; |
|
441 |
|
442 if (!iHasBeenApplied) |
|
443 { |
|
444 if (!iSbcEncConf.iSamplingFrequencySet || |
|
445 !iSbcEncConf.iChannelModeSet || |
|
446 !iSbcEncConf.iNumOfSubbandsSet || |
|
447 !iSbcEncConf.iNumOfBlocksSet || |
|
448 !iSbcEncConf.iAllocationMethodSet || |
|
449 !iSbcEncConf.iBitpoolSizeSet) |
|
450 { |
|
451 status = KErrArgument; |
|
452 } |
|
453 } |
|
454 |
|
455 if (status == KErrNone) |
|
456 { |
|
457 TSbcEncoderConfig sbcEncoderConfig; |
|
458 |
|
459 sbcEncoderConfig.iSamplingFrequency = iSbcEncConf.iSamplingFrequency; |
|
460 sbcEncoderConfig.iChannelMode = iSbcEncConf.iChannelMode; |
|
461 sbcEncoderConfig.iNumOfSubbands = iSbcEncConf.iNumOfSubbands; |
|
462 sbcEncoderConfig.iNumOfBlocks = iSbcEncConf.iNumOfBlocks; |
|
463 sbcEncoderConfig.iAllocationMethod = iSbcEncConf.iAllocationMethod; |
|
464 sbcEncoderConfig.iBitpoolSize = iSbcEncConf.iBitpoolSize; |
|
465 |
|
466 TPckgBuf<TSbcEncoderConfig> pckgBuf(sbcEncoderConfig); |
|
467 status = iCustomCommand.CustomCommandSync(iMessageHandler, |
|
468 ESbceimApplyConfig, |
|
469 pckgBuf, |
|
470 KNullDesC8); |
|
471 if (status == KErrNone) |
|
472 { |
|
473 iSbcEncConfCurrent = iSbcEncConf; |
|
474 iHasBeenApplied = ETrue; |
|
475 } |
|
476 } |
|
477 |
|
478 return status; |
|
479 } |
|
480 |
|
481 /** |
|
482 * CSbcEncoderIntfcProxy::SetSamplingFrequency |
|
483 * Saves locally requested sampling frequency. |
|
484 * Change does not apply to the encoder until ApplyConfig() is called. |
|
485 * (other items were commented in a header). |
|
486 */ |
|
487 EXPORT_C void CSbcEncoderIntfcProxy::SetSamplingFrequency( |
|
488 TUint aSamplingFrequency) |
|
489 { |
|
490 iSbcEncConf.iSamplingFrequency = aSamplingFrequency; |
|
491 iSbcEncConf.iSamplingFrequencySet = ETrue; |
|
492 } |
|
493 |
|
494 /** |
|
495 * CSbcEncoderIntfcProxy::GetSamplingFrequency |
|
496 * Returns current sampling frequency commited by call to ApplyConfig(). |
|
497 * (other items were commented in a header). |
|
498 */ |
|
499 EXPORT_C TInt CSbcEncoderIntfcProxy::GetSamplingFrequency( |
|
500 TUint& aSamplingFrequency) |
|
501 { |
|
502 TInt status = KErrNone; |
|
503 |
|
504 if (iHasBeenApplied) |
|
505 { |
|
506 aSamplingFrequency = iSbcEncConfCurrent.iSamplingFrequency; |
|
507 } |
|
508 else |
|
509 { |
|
510 status = KErrArgument; |
|
511 } |
|
512 |
|
513 return status; |
|
514 } |
|
515 |
|
516 /** |
|
517 * CSbcEncoderIntfcProxy::SetChannelMode |
|
518 * Saves locally requested channel mode. |
|
519 * Change does not apply to the encoder until ApplyConfig() is called. |
|
520 * (other items were commented in a header). |
|
521 */ |
|
522 EXPORT_C void CSbcEncoderIntfcProxy::SetChannelMode( |
|
523 TSbcChannelMode aChannelMode) |
|
524 { |
|
525 iSbcEncConf.iChannelMode = aChannelMode; |
|
526 iSbcEncConf.iChannelModeSet = ETrue; |
|
527 } |
|
528 |
|
529 /** |
|
530 * CSbcEncoderIntfcProxy::GetChannelMode |
|
531 * Returns current channel mode commited by call to ApplyConfig(). |
|
532 * (other items were commented in a header). |
|
533 */ |
|
534 EXPORT_C TInt CSbcEncoderIntfcProxy::GetChannelMode( |
|
535 TSbcChannelMode& aChannelMode) |
|
536 { |
|
537 TInt status = KErrNone; |
|
538 |
|
539 if (iHasBeenApplied) |
|
540 { |
|
541 aChannelMode = iSbcEncConfCurrent.iChannelMode; |
|
542 } |
|
543 else |
|
544 { |
|
545 status = KErrArgument; |
|
546 } |
|
547 |
|
548 return status; |
|
549 } |
|
550 |
|
551 /** |
|
552 * CSbcEncoderIntfcProxy::SetNumOfSubbands |
|
553 * Saves locally requested number of subbands. |
|
554 * Change does not apply to the encoder until ApplyConfig() is called. |
|
555 * (other items were commented in a header). |
|
556 */ |
|
557 EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfSubbands(TUint aNumOfSubbands) |
|
558 { |
|
559 iSbcEncConf.iNumOfSubbands = aNumOfSubbands; |
|
560 iSbcEncConf.iNumOfSubbandsSet = ETrue; |
|
561 } |
|
562 |
|
563 /** |
|
564 * CSbcEncoderIntfcProxy::GetNumOfSubbands |
|
565 * Returns current number of subbands commited by call to ApplyConfig(). |
|
566 * (other items were commented in a header). |
|
567 */ |
|
568 EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfSubbands(TUint& aNumOfSubbands) |
|
569 { |
|
570 TInt status = KErrNone; |
|
571 |
|
572 if (iHasBeenApplied) |
|
573 { |
|
574 aNumOfSubbands = iSbcEncConfCurrent.iNumOfSubbands; |
|
575 } |
|
576 else |
|
577 { |
|
578 status = KErrArgument; |
|
579 } |
|
580 |
|
581 return status; |
|
582 } |
|
583 |
|
584 /** |
|
585 * CSbcEncoderIntfcProxy::SetNumOfBlocks |
|
586 * Saves locally requested number of blocks. |
|
587 * Change does not apply to the encoder until ApplyConfig() is called. |
|
588 * (other items were commented in a header). |
|
589 */ |
|
590 EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfBlocks(TUint aNumOfBlocks) |
|
591 { |
|
592 iSbcEncConf.iNumOfBlocks = aNumOfBlocks; |
|
593 iSbcEncConf.iNumOfBlocksSet = ETrue; |
|
594 } |
|
595 |
|
596 /** |
|
597 * CSbcEncoderIntfcProxy::GetNumOfBlocks |
|
598 * Returns current number of blocks commited by call to ApplyConfig(). |
|
599 * (other items were commented in a header). |
|
600 */ |
|
601 EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfBlocks(TUint& aNumOfBlocks) |
|
602 { |
|
603 TInt status = KErrNone; |
|
604 |
|
605 if (iHasBeenApplied) |
|
606 { |
|
607 aNumOfBlocks = iSbcEncConfCurrent.iNumOfBlocks; |
|
608 } |
|
609 else |
|
610 { |
|
611 status = KErrArgument; |
|
612 } |
|
613 |
|
614 return status; |
|
615 } |
|
616 |
|
617 /** |
|
618 * CSbcEncoderIntfcProxy::SetAllocationMethod |
|
619 * Saves locally requested allocation method. |
|
620 * Change does not apply to the encoder until ApplyConfig() is called. |
|
621 * (other items were commented in a header). |
|
622 */ |
|
623 EXPORT_C void CSbcEncoderIntfcProxy::SetAllocationMethod( |
|
624 TSbcAllocationMethod aAllocationMethod) |
|
625 { |
|
626 iSbcEncConf.iAllocationMethod = aAllocationMethod; |
|
627 iSbcEncConf.iAllocationMethodSet = ETrue; |
|
628 } |
|
629 |
|
630 /** |
|
631 * CSbcEncoderIntfcProxy::GetAllocationMethod |
|
632 * Returns current allocation method commited by call to ApplyConfig(). |
|
633 * (other items were commented in a header). |
|
634 */ |
|
635 EXPORT_C TInt CSbcEncoderIntfcProxy::GetAllocationMethod( |
|
636 TSbcAllocationMethod& aAllocationMethod) |
|
637 { |
|
638 TInt status = KErrNone; |
|
639 |
|
640 if (iHasBeenApplied) |
|
641 { |
|
642 aAllocationMethod = iSbcEncConfCurrent.iAllocationMethod; |
|
643 } |
|
644 else |
|
645 { |
|
646 status = KErrArgument; |
|
647 } |
|
648 |
|
649 return status; |
|
650 } |
|
651 |
|
652 /** |
|
653 * CSbcEncoderIntfcProxy::SetBitpoolSize |
|
654 * Saves locally requested bitpool range. |
|
655 * Change does not apply to the encoder until ApplyConfig() is called. |
|
656 * (other items were commented in a header). |
|
657 */ |
|
658 EXPORT_C void CSbcEncoderIntfcProxy::SetBitpoolSize(TUint aBitpoolSize) |
|
659 { |
|
660 iSbcEncConf.iBitpoolSize = aBitpoolSize; |
|
661 iSbcEncConf.iBitpoolSizeSet = ETrue; |
|
662 } |
|
663 |
|
664 /** |
|
665 * CSbcEncoderIntfcProxy::GetBitpoolSize |
|
666 * Returns current bitpool range commited by call to ApplyConfig(). |
|
667 * (other items were commented in a header). |
|
668 */ |
|
669 EXPORT_C TInt CSbcEncoderIntfcProxy::GetBitpoolSize(TUint& aBitpoolSize) |
|
670 { |
|
671 TInt status = KErrNone; |
|
672 |
|
673 if (iHasBeenApplied) |
|
674 { |
|
675 aBitpoolSize = iSbcEncConfCurrent.iBitpoolSize; |
|
676 } |
|
677 else |
|
678 { |
|
679 status = KErrArgument; |
|
680 } |
|
681 |
|
682 return status; |
|
683 } |
|
684 |
|
685 /** |
|
686 * CSbcEncoderIntfcProxy::PopulateArrayL |
|
687 * Utility method that reads stream from 8-bit descriptor, converts it |
|
688 * to TUint data items and then copies them to the aArray. |
|
689 * (other items were commented in a header). |
|
690 */ |
|
691 void CSbcEncoderIntfcProxy::PopulateArrayL(RArray<TUint>& aArray, |
|
692 TPtr8 aPtr, |
|
693 TUint aCount) |
|
694 { |
|
695 RDesReadStream stream(aPtr); |
|
696 CleanupClosePushL(stream); |
|
697 |
|
698 for (TInt i = 0; i < aCount; i++) |
|
699 { |
|
700 aArray.Append(stream.ReadUint32L()); |
|
701 } |
|
702 |
|
703 CleanupStack::PopAndDestroy(&stream); |
|
704 } |
|
705 |
|
706 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
707 |
|
708 // End of File |