os/mm/devsoundextensions/mmfcustominterfaces/SbcEncoderIntfc/SbcEncoderIntfcProxy/src/SbcEncoderIntfcProxy.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/mmfcustominterfaces/SbcEncoderIntfc/SbcEncoderIntfcProxy/src/SbcEncoderIntfcProxy.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,708 @@
1.4 +/*
1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description: Interface proxy for BT SBC Encoder configuration CI.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +// INCLUDE FILES
1.24 +#include <CustomCommandUtility.h>
1.25 +#include <CustomInterfaceUtility.h>
1.26 +#include "SbcEncoderIntfcMsgs.h"
1.27 +#include "SbcEncoderIntfcProxy.h"
1.28 +
1.29 +// EXTERNAL DATA STRUCTURES
1.30 +
1.31 +// EXTERNAL FUNCTION PROTOTYPES
1.32 +
1.33 +// CONSTANTS
1.34 +
1.35 +// MACROS
1.36 +
1.37 +// LOCAL CONSTANTS AND MACROS
1.38 +
1.39 +// MODULE DATA STRUCTURES
1.40 +
1.41 +// LOCAL FUNCTION PROTOTYPES
1.42 +
1.43 +// FORWARD DECLARATIONS
1.44 +
1.45 +// ============================= LOCAL FUNCTIONS ===============================
1.46 +
1.47 +// ============================= MEMBER FUNCTIONS ==============================
1.48 +
1.49 +/**
1.50 + * CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy
1.51 + * C++ default constructor can NOT contain any code, that might leave.
1.52 + */
1.53 +CSbcEncoderIntfcProxy::CSbcEncoderIntfcProxy(
1.54 + TMMFMessageDestinationPckg aMessageHandler,
1.55 + MCustomCommand& aCustomCommand,
1.56 + CCustomInterfaceUtility* aCustomInterfaceUtility) :
1.57 + iCustomCommand(aCustomCommand),
1.58 + iMessageHandler(aMessageHandler),
1.59 + iCustomInterfaceUtility(aCustomInterfaceUtility)
1.60 + {
1.61 + }
1.62 +
1.63 +/**
1.64 + * CSbcEncoderIntfcProxy::ConstructL
1.65 + * Symbian 2nd phase constructor can leave.
1.66 + */
1.67 +void CSbcEncoderIntfcProxy::ConstructL()
1.68 + {
1.69 + iHasBeenApplied = EFalse;
1.70 + }
1.71 +
1.72 +/**
1.73 + * CSbcEncoderIntfcProxy::NewL
1.74 + * Two-phased constructor.
1.75 + */
1.76 +EXPORT_C CSbcEncoderIntfcProxy* CSbcEncoderIntfcProxy::NewL(
1.77 + TMMFMessageDestinationPckg aMessageHandler,
1.78 + MCustomCommand& aCustomCommand,
1.79 + CCustomInterfaceUtility* aCustomInterfaceUtility)
1.80 + {
1.81 + CSbcEncoderIntfcProxy* self = new(ELeave) CSbcEncoderIntfcProxy(
1.82 + aMessageHandler,
1.83 + aCustomCommand,
1.84 + aCustomInterfaceUtility);
1.85 + CleanupStack::PushL( self );
1.86 + self->ConstructL();
1.87 + CleanupStack::Pop( self );
1.88 + return self;
1.89 + }
1.90 +
1.91 +/**
1.92 + * Destructor
1.93 + */
1.94 +EXPORT_C CSbcEncoderIntfcProxy::~CSbcEncoderIntfcProxy()
1.95 + {
1.96 + iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
1.97 + delete iCustomInterfaceUtility;
1.98 + }
1.99 +
1.100 +/**
1.101 + * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies
1.102 + * Returns an array of supported sampling frequencies.
1.103 + * Calls a subfunction, which sends the appropriate custom command
1.104 + * to its message handler. A subfunction is used to contain multiple
1.105 + * leaving functions in a single trap.
1.106 + * (other items were commented in a header).
1.107 + */
1.108 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedSamplingFrequencies(
1.109 + RArray<TUint>&
1.110 + aSupportedSamplingFrequencies)
1.111 + {
1.112 + TRAPD(status,
1.113 + GetSupportedSamplingFrequenciesL(aSupportedSamplingFrequencies));
1.114 + return status;
1.115 + }
1.116 +
1.117 +/**
1.118 + * CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL
1.119 + * Returns an array of supported sampling frequencies.
1.120 + * Sends the custom command for this function to its message handler. This
1.121 + * requires two commands. The first is a request for the number of supported
1.122 + * sampling frequencies. A buffer is allocated locally to hold this number of
1.123 + * frequencies that will be returned. A pointer to this buffer is sent with the
1.124 + * next command, which is a request for the frequencies. This buffer will be
1.125 + * filled with the frequency values. These values are then copied into the
1.126 + * array provided to this function and the local buffer is deleted.
1.127 + * (other items were commented in a header).
1.128 + */
1.129 +void CSbcEncoderIntfcProxy::GetSupportedSamplingFrequenciesL(
1.130 + RArray<TUint>& aSupportedSamplingFrequencies)
1.131 + {
1.132 + aSupportedSamplingFrequencies.Reset();
1.133 +
1.134 + TPckgBuf<TUint> pckgBuf;
1.135 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.136 + iMessageHandler,
1.137 + ESbceimGetNumOfSupportedSamplingFrequencies,
1.138 + KNullDesC8,
1.139 + KNullDesC8,
1.140 + pckgBuf));
1.141 +
1.142 + HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
1.143 + TPtr8 ptr = buf->Des();
1.144 +
1.145 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.146 + iMessageHandler,
1.147 + ESbceimGetSupportedSamplingFrequencies,
1.148 + KNullDesC8,
1.149 + KNullDesC8,
1.150 + ptr));
1.151 +
1.152 + PopulateArrayL(aSupportedSamplingFrequencies, ptr, pckgBuf());
1.153 + CleanupStack::PopAndDestroy(buf);
1.154 + }
1.155 +
1.156 +/**
1.157 + * CSbcEncoderIntfcProxy::GetSupportedChannelModes
1.158 + * Returns an array of supported channel modes.
1.159 + * Calls a subfunction which sends the appropriate custom command to its
1.160 + * message handler. A subfunction is used to contain multiple leaving
1.161 + * functions for a single trap.
1.162 + * (other items were commented in a header).
1.163 + */
1.164 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedChannelModes(
1.165 + RArray<TSbcChannelMode>&
1.166 + aSupportedChannelModes)
1.167 + {
1.168 + TRAPD(status, GetSupportedChannelModesL(aSupportedChannelModes));
1.169 + return status;
1.170 + }
1.171 +
1.172 +/**
1.173 + * CSbcEncoderIntfcProxy::GetSupportedChannelModesL
1.174 + * Returns an array of supported channel modes.
1.175 + * Sends the custom command for this function to its message handler. This
1.176 + * requires two commands. The first is a request for the number of supported
1.177 + * channel modes. A buffer is allocated locally to hold this number of channel
1.178 + * modes that will be returned. A pointer to this buffer is sent with the next
1.179 + * command, which is a request for the channel modes. This buffer will be
1.180 + * filled with the frequency values. These values are then copied into the array
1.181 + * provided to this function and the local buffer is deleted.
1.182 + * (other items were commented in a header).
1.183 + */
1.184 +void CSbcEncoderIntfcProxy::GetSupportedChannelModesL(
1.185 + RArray<TSbcChannelMode>& aSupportedChannelModes)
1.186 + {
1.187 + aSupportedChannelModes.Reset();
1.188 +
1.189 + TPckgBuf<TSbcChannelMode> pckgBuf;
1.190 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.191 + iMessageHandler,
1.192 + ESbceimGetNumOfSupportedChannelModes,
1.193 + KNullDesC8,
1.194 + KNullDesC8,
1.195 + pckgBuf));
1.196 +
1.197 + HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
1.198 + TPtr8 ptr = buf->Des();
1.199 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.200 + iMessageHandler,
1.201 + ESbceimGetSupportedChannelModes,
1.202 + KNullDesC8,
1.203 + KNullDesC8,
1.204 + ptr));
1.205 +
1.206 + RDesReadStream stream(ptr);
1.207 + CleanupClosePushL(stream);
1.208 +
1.209 + for (TInt i = 0; i < pckgBuf(); i++)
1.210 + {
1.211 + aSupportedChannelModes.AppendL(
1.212 + static_cast<TSbcChannelMode>(stream.ReadUint32L()));
1.213 + }
1.214 +
1.215 + CleanupStack::PopAndDestroy(&stream);
1.216 + CleanupStack::PopAndDestroy(buf);
1.217 + }
1.218 +
1.219 +/**
1.220 + * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks
1.221 + * Returns an array of supported blocks.
1.222 + * Calls a subfunction, which sends the appropriate custom command to its
1.223 + * message handler. A subfunction is used to contain multiple leaving functions
1.224 + * for a single trap.
1.225 + * (other items were commented in a header).
1.226 + */
1.227 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks(
1.228 + RArray<TUint>& aSupportedNumOfBlocks)
1.229 + {
1.230 + TRAPD(status, GetSupportedNumOfBlocksL(aSupportedNumOfBlocks));
1.231 + return status;
1.232 + }
1.233 +
1.234 +/**
1.235 + * CSbcEncoderIntfcProxy::GetSupportedNumOfBlocks
1.236 + * Returns an array of supported blocks.
1.237 + * Sends the custom command for this function to its message handler. This
1.238 + * requires two commands. The first is a request for the number of supported
1.239 + * blocks. A buffer is allocated locally to hold this number of blocks that
1.240 + * will be returned. A pointer to this buffer is then sent with the next
1.241 + * command, which is a request for the blocks. This buffer will be filled
1.242 + * with the block values. These values are then copied into the array provided
1.243 + * to this function and the local buffer is deleted.
1.244 + * (other items were commented in a header).
1.245 + */
1.246 +void CSbcEncoderIntfcProxy::GetSupportedNumOfBlocksL(
1.247 + RArray<TUint>& aSupportedNumOfBlocks)
1.248 + {
1.249 + aSupportedNumOfBlocks.Reset();
1.250 +
1.251 + TPckgBuf<TUint> pckgBuf;
1.252 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.253 + iMessageHandler,
1.254 + ESbceimGetNumOfSupportedBlocks,
1.255 + KNullDesC8,
1.256 + KNullDesC8,
1.257 + pckgBuf));
1.258 +
1.259 + HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
1.260 + TPtr8 ptr = buf->Des();
1.261 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.262 + iMessageHandler,
1.263 + ESbceimGetSupportedBlocks,
1.264 + KNullDesC8,
1.265 + KNullDesC8,
1.266 + ptr));
1.267 +
1.268 + PopulateArrayL(aSupportedNumOfBlocks, ptr, pckgBuf());
1.269 + CleanupStack::PopAndDestroy(buf);
1.270 + }
1.271 +
1.272 +/**
1.273 + * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands
1.274 + * Returns an array of supported subbands.
1.275 + * Calls a subfunction which sends the appropriate custom command to its
1.276 + * message handler. A subfunction is used to contain multiple leaving functions
1.277 + * for a single trap.
1.278 + * (other items were commented in a header).
1.279 + */
1.280 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedNumOfSubbands(
1.281 + RArray<TUint>& aSupportedNumOfSubbands)
1.282 + {
1.283 + TRAPD(status, GetSupportedNumOfSubbandsL(aSupportedNumOfSubbands));
1.284 + return status;
1.285 + }
1.286 +
1.287 +/**
1.288 + * CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL
1.289 + * Returns an array of supported subbands.
1.290 + * Sends the custom command for this function to its message handler. This
1.291 + * requires two commands. The first is a request for the number of supported
1.292 + * subbands. A buffer is allocated locally to hold this number of subbands that
1.293 + * will be returned. A pointer to this buffer is sent with the next command,
1.294 + * which is a request for the subbands. This buffer will be filled with the
1.295 + * subband values. These values are then copied into the array provided to this
1.296 + * function and the local buffer is deleted.
1.297 + * (other items were commented in a header).
1.298 + */
1.299 +void CSbcEncoderIntfcProxy::GetSupportedNumOfSubbandsL(
1.300 + RArray<TUint>& aSupportedNumOfSubbands)
1.301 + {
1.302 + aSupportedNumOfSubbands.Reset();
1.303 +
1.304 + TPckgBuf<TUint> pckgBuf;
1.305 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.306 + iMessageHandler,
1.307 + ESbceimGetNumOfSupportedNumOfSubbands,
1.308 + KNullDesC8,
1.309 + KNullDesC8,
1.310 + pckgBuf));
1.311 +
1.312 + HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
1.313 + TPtr8 ptr = buf->Des();
1.314 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.315 + iMessageHandler,
1.316 + ESbceimGetSupportedNumOfSubbands,
1.317 + KNullDesC8,
1.318 + KNullDesC8,
1.319 + ptr));
1.320 +
1.321 + PopulateArrayL(aSupportedNumOfSubbands, ptr, pckgBuf());
1.322 + CleanupStack::PopAndDestroy(buf);
1.323 + }
1.324 +
1.325 +/**
1.326 + * CSbcEncoderIntfcProxy::GetSupportedAllocationMethods
1.327 + * Returns an array of supported allocation methods.
1.328 + * Calls a subfunction which sends the appropriate custom command to its
1.329 + * message handler. A subfunction is used to contain multiple leaving
1.330 + * functions for a single trap.
1.331 + * (other items were commented in a header).
1.332 + */
1.333 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedAllocationMethods(
1.334 + RArray<TSbcAllocationMethod>&
1.335 + aSupportedAllocationMethods)
1.336 + {
1.337 + TRAPD(status, GetSupportedAllocationMethodsL(aSupportedAllocationMethods));
1.338 + return status;
1.339 + }
1.340 +
1.341 +/**
1.342 + * CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL
1.343 + * Returns an array of supported allocation methods.
1.344 + * Sends the custom command for this function to its message handler. This
1.345 + * requires two commands. The first is a request for the number of supported
1.346 + * allocation methods. A buffer is allocated locally to hold this number of
1.347 + * allocation methods that will be returned. A pointer to this buffer is sent
1.348 + * with the next command which is a request for the allocation methods. This
1.349 + * buffer will be filled with the allocation method values. These values are
1.350 + * then copied into the array provided to this function and the local buffer
1.351 + * is deleted.
1.352 + * (other items were commented in a header).
1.353 + */
1.354 +void CSbcEncoderIntfcProxy::GetSupportedAllocationMethodsL(
1.355 + RArray<TSbcAllocationMethod>&
1.356 + aSupportedAllocationMethods)
1.357 + {
1.358 + aSupportedAllocationMethods.Reset();
1.359 +
1.360 + TPckgBuf<TSbcAllocationMethod> pckgBuf;
1.361 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.362 + iMessageHandler,
1.363 + ESbceimGetNumOfSupportedAllocationMethods,
1.364 + KNullDesC8,
1.365 + KNullDesC8,
1.366 + pckgBuf));
1.367 +
1.368 + HBufC8* buf = HBufC8::NewLC(pckgBuf() * sizeof(TUint));
1.369 + TPtr8 ptr = buf->Des();
1.370 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.371 + iMessageHandler,
1.372 + ESbceimGetSupportedAllocationMethods,
1.373 + KNullDesC8,
1.374 + KNullDesC8,
1.375 + ptr));
1.376 +
1.377 + RDesReadStream stream(ptr);
1.378 + CleanupClosePushL(stream);
1.379 +
1.380 + for (TInt i = 0; i < pckgBuf(); i++)
1.381 + {
1.382 + aSupportedAllocationMethods.AppendL(
1.383 + static_cast<TSbcAllocationMethod>(stream.ReadUint32L()));
1.384 + }
1.385 +
1.386 + CleanupStack::PopAndDestroy(&stream);
1.387 + CleanupStack::PopAndDestroy(buf);
1.388 + }
1.389 +
1.390 +/**
1.391 + * CSbcEncoderIntfcProxy::GetSupportedBitpoolRange
1.392 + * Returns supported bitpool range.
1.393 + * Calls a subfunction which sends the appropriate custom command to its
1.394 + * message handler. A subfunction is used to contain multiple leaving
1.395 + * functions for a single trap.
1.396 + * (other items were commented in a header).
1.397 + */
1.398 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSupportedBitpoolRange(
1.399 + TUint& aMinSupportedBitpoolSize,
1.400 + TUint& aMaxSupportedBitpoolSize)
1.401 + {
1.402 + TRAPD(status, GetSupportedBitpoolRangeL(aMinSupportedBitpoolSize,
1.403 + aMaxSupportedBitpoolSize));
1.404 + return status;
1.405 + }
1.406 +
1.407 +/**
1.408 + * CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL
1.409 + * Returns an array of supported bitpool range.
1.410 + * Sends the custom command for this function to its message handler with TUint
1.411 + * type arguments that will be filled with the bitpool min and max values.
1.412 + * (other items were commented in a header).
1.413 + */
1.414 +void CSbcEncoderIntfcProxy::GetSupportedBitpoolRangeL(
1.415 + TUint& aMinSupportedBitpoolSize,
1.416 + TUint& aMaxSupportedBitpoolSize)
1.417 + {
1.418 + TSbcEncoderBitpoolRange bitPoolRange;
1.419 + bitPoolRange.iMinSupportedBitpoolSize = 0;
1.420 + bitPoolRange.iMaxSupportedBitpoolSize = 0;
1.421 +
1.422 + TPckgBuf<TSbcEncoderBitpoolRange> pckgBuf(bitPoolRange);
1.423 + User::LeaveIfError(iCustomCommand.CustomCommandSync(
1.424 + iMessageHandler,
1.425 + ESbceimGetSupportedBitpoolRange,
1.426 + KNullDesC8,
1.427 + KNullDesC8,
1.428 + pckgBuf));
1.429 +
1.430 + aMinSupportedBitpoolSize = pckgBuf().iMinSupportedBitpoolSize;
1.431 + aMaxSupportedBitpoolSize = pckgBuf().iMaxSupportedBitpoolSize;
1.432 + }
1.433 +
1.434 +/*
1.435 + * CSbcEncoderIntfcProxy::ApplyConfig
1.436 + * Commits encoder configuration settings configured by callas to Set() APIs.
1.437 + * Sends the custom command for this function to its message handler.
1.438 + * New settings will not take effect until ApplyConfig() is called.
1.439 + * (other items were commented in a header).
1.440 + */
1.441 +EXPORT_C TInt CSbcEncoderIntfcProxy::ApplyConfig()
1.442 + {
1.443 + TInt status = KErrNone;
1.444 +
1.445 + if (!iHasBeenApplied)
1.446 + {
1.447 + if (!iSbcEncConf.iSamplingFrequencySet ||
1.448 + !iSbcEncConf.iChannelModeSet ||
1.449 + !iSbcEncConf.iNumOfSubbandsSet ||
1.450 + !iSbcEncConf.iNumOfBlocksSet ||
1.451 + !iSbcEncConf.iAllocationMethodSet ||
1.452 + !iSbcEncConf.iBitpoolSizeSet)
1.453 + {
1.454 + status = KErrArgument;
1.455 + }
1.456 + }
1.457 +
1.458 + if (status == KErrNone)
1.459 + {
1.460 + TSbcEncoderConfig sbcEncoderConfig;
1.461 +
1.462 + sbcEncoderConfig.iSamplingFrequency = iSbcEncConf.iSamplingFrequency;
1.463 + sbcEncoderConfig.iChannelMode = iSbcEncConf.iChannelMode;
1.464 + sbcEncoderConfig.iNumOfSubbands = iSbcEncConf.iNumOfSubbands;
1.465 + sbcEncoderConfig.iNumOfBlocks = iSbcEncConf.iNumOfBlocks;
1.466 + sbcEncoderConfig.iAllocationMethod = iSbcEncConf.iAllocationMethod;
1.467 + sbcEncoderConfig.iBitpoolSize = iSbcEncConf.iBitpoolSize;
1.468 +
1.469 + TPckgBuf<TSbcEncoderConfig> pckgBuf(sbcEncoderConfig);
1.470 + status = iCustomCommand.CustomCommandSync(iMessageHandler,
1.471 + ESbceimApplyConfig,
1.472 + pckgBuf,
1.473 + KNullDesC8);
1.474 + if (status == KErrNone)
1.475 + {
1.476 + iSbcEncConfCurrent = iSbcEncConf;
1.477 + iHasBeenApplied = ETrue;
1.478 + }
1.479 + }
1.480 +
1.481 + return status;
1.482 + }
1.483 +
1.484 +/**
1.485 + * CSbcEncoderIntfcProxy::SetSamplingFrequency
1.486 + * Saves locally requested sampling frequency.
1.487 + * Change does not apply to the encoder until ApplyConfig() is called.
1.488 + * (other items were commented in a header).
1.489 + */
1.490 +EXPORT_C void CSbcEncoderIntfcProxy::SetSamplingFrequency(
1.491 + TUint aSamplingFrequency)
1.492 + {
1.493 + iSbcEncConf.iSamplingFrequency = aSamplingFrequency;
1.494 + iSbcEncConf.iSamplingFrequencySet = ETrue;
1.495 + }
1.496 +
1.497 +/**
1.498 + * CSbcEncoderIntfcProxy::GetSamplingFrequency
1.499 + * Returns current sampling frequency commited by call to ApplyConfig().
1.500 + * (other items were commented in a header).
1.501 + */
1.502 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetSamplingFrequency(
1.503 + TUint& aSamplingFrequency)
1.504 + {
1.505 + TInt status = KErrNone;
1.506 +
1.507 + if (iHasBeenApplied)
1.508 + {
1.509 + aSamplingFrequency = iSbcEncConfCurrent.iSamplingFrequency;
1.510 + }
1.511 + else
1.512 + {
1.513 + status = KErrArgument;
1.514 + }
1.515 +
1.516 + return status;
1.517 + }
1.518 +
1.519 +/**
1.520 + * CSbcEncoderIntfcProxy::SetChannelMode
1.521 + * Saves locally requested channel mode.
1.522 + * Change does not apply to the encoder until ApplyConfig() is called.
1.523 + * (other items were commented in a header).
1.524 + */
1.525 +EXPORT_C void CSbcEncoderIntfcProxy::SetChannelMode(
1.526 + TSbcChannelMode aChannelMode)
1.527 + {
1.528 + iSbcEncConf.iChannelMode = aChannelMode;
1.529 + iSbcEncConf.iChannelModeSet = ETrue;
1.530 + }
1.531 +
1.532 +/**
1.533 + * CSbcEncoderIntfcProxy::GetChannelMode
1.534 + * Returns current channel mode commited by call to ApplyConfig().
1.535 + * (other items were commented in a header).
1.536 + */
1.537 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetChannelMode(
1.538 + TSbcChannelMode& aChannelMode)
1.539 + {
1.540 + TInt status = KErrNone;
1.541 +
1.542 + if (iHasBeenApplied)
1.543 + {
1.544 + aChannelMode = iSbcEncConfCurrent.iChannelMode;
1.545 + }
1.546 + else
1.547 + {
1.548 + status = KErrArgument;
1.549 + }
1.550 +
1.551 + return status;
1.552 + }
1.553 +
1.554 +/**
1.555 + * CSbcEncoderIntfcProxy::SetNumOfSubbands
1.556 + * Saves locally requested number of subbands.
1.557 + * Change does not apply to the encoder until ApplyConfig() is called.
1.558 + * (other items were commented in a header).
1.559 + */
1.560 +EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfSubbands(TUint aNumOfSubbands)
1.561 + {
1.562 + iSbcEncConf.iNumOfSubbands = aNumOfSubbands;
1.563 + iSbcEncConf.iNumOfSubbandsSet = ETrue;
1.564 + }
1.565 +
1.566 +/**
1.567 + * CSbcEncoderIntfcProxy::GetNumOfSubbands
1.568 + * Returns current number of subbands commited by call to ApplyConfig().
1.569 + * (other items were commented in a header).
1.570 + */
1.571 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfSubbands(TUint& aNumOfSubbands)
1.572 + {
1.573 + TInt status = KErrNone;
1.574 +
1.575 + if (iHasBeenApplied)
1.576 + {
1.577 + aNumOfSubbands = iSbcEncConfCurrent.iNumOfSubbands;
1.578 + }
1.579 + else
1.580 + {
1.581 + status = KErrArgument;
1.582 + }
1.583 +
1.584 + return status;
1.585 + }
1.586 +
1.587 +/**
1.588 + * CSbcEncoderIntfcProxy::SetNumOfBlocks
1.589 + * Saves locally requested number of blocks.
1.590 + * Change does not apply to the encoder until ApplyConfig() is called.
1.591 + * (other items were commented in a header).
1.592 + */
1.593 +EXPORT_C void CSbcEncoderIntfcProxy::SetNumOfBlocks(TUint aNumOfBlocks)
1.594 + {
1.595 + iSbcEncConf.iNumOfBlocks = aNumOfBlocks;
1.596 + iSbcEncConf.iNumOfBlocksSet = ETrue;
1.597 + }
1.598 +
1.599 +/**
1.600 + * CSbcEncoderIntfcProxy::GetNumOfBlocks
1.601 + * Returns current number of blocks commited by call to ApplyConfig().
1.602 + * (other items were commented in a header).
1.603 + */
1.604 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetNumOfBlocks(TUint& aNumOfBlocks)
1.605 + {
1.606 + TInt status = KErrNone;
1.607 +
1.608 + if (iHasBeenApplied)
1.609 + {
1.610 + aNumOfBlocks = iSbcEncConfCurrent.iNumOfBlocks;
1.611 + }
1.612 + else
1.613 + {
1.614 + status = KErrArgument;
1.615 + }
1.616 +
1.617 + return status;
1.618 + }
1.619 +
1.620 +/**
1.621 + * CSbcEncoderIntfcProxy::SetAllocationMethod
1.622 + * Saves locally requested allocation method.
1.623 + * Change does not apply to the encoder until ApplyConfig() is called.
1.624 + * (other items were commented in a header).
1.625 + */
1.626 +EXPORT_C void CSbcEncoderIntfcProxy::SetAllocationMethod(
1.627 + TSbcAllocationMethod aAllocationMethod)
1.628 + {
1.629 + iSbcEncConf.iAllocationMethod = aAllocationMethod;
1.630 + iSbcEncConf.iAllocationMethodSet = ETrue;
1.631 + }
1.632 +
1.633 +/**
1.634 + * CSbcEncoderIntfcProxy::GetAllocationMethod
1.635 + * Returns current allocation method commited by call to ApplyConfig().
1.636 + * (other items were commented in a header).
1.637 + */
1.638 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetAllocationMethod(
1.639 + TSbcAllocationMethod& aAllocationMethod)
1.640 + {
1.641 + TInt status = KErrNone;
1.642 +
1.643 + if (iHasBeenApplied)
1.644 + {
1.645 + aAllocationMethod = iSbcEncConfCurrent.iAllocationMethod;
1.646 + }
1.647 + else
1.648 + {
1.649 + status = KErrArgument;
1.650 + }
1.651 +
1.652 + return status;
1.653 + }
1.654 +
1.655 +/**
1.656 + * CSbcEncoderIntfcProxy::SetBitpoolSize
1.657 + * Saves locally requested bitpool range.
1.658 + * Change does not apply to the encoder until ApplyConfig() is called.
1.659 + * (other items were commented in a header).
1.660 + */
1.661 +EXPORT_C void CSbcEncoderIntfcProxy::SetBitpoolSize(TUint aBitpoolSize)
1.662 + {
1.663 + iSbcEncConf.iBitpoolSize = aBitpoolSize;
1.664 + iSbcEncConf.iBitpoolSizeSet = ETrue;
1.665 + }
1.666 +
1.667 +/**
1.668 + * CSbcEncoderIntfcProxy::GetBitpoolSize
1.669 + * Returns current bitpool range commited by call to ApplyConfig().
1.670 + * (other items were commented in a header).
1.671 + */
1.672 +EXPORT_C TInt CSbcEncoderIntfcProxy::GetBitpoolSize(TUint& aBitpoolSize)
1.673 + {
1.674 + TInt status = KErrNone;
1.675 +
1.676 + if (iHasBeenApplied)
1.677 + {
1.678 + aBitpoolSize = iSbcEncConfCurrent.iBitpoolSize;
1.679 + }
1.680 + else
1.681 + {
1.682 + status = KErrArgument;
1.683 + }
1.684 +
1.685 + return status;
1.686 + }
1.687 +
1.688 +/**
1.689 + * CSbcEncoderIntfcProxy::PopulateArrayL
1.690 + * Utility method that reads stream from 8-bit descriptor, converts it
1.691 + * to TUint data items and then copies them to the aArray.
1.692 + * (other items were commented in a header).
1.693 + */
1.694 +void CSbcEncoderIntfcProxy::PopulateArrayL(RArray<TUint>& aArray,
1.695 + TPtr8 aPtr,
1.696 + TUint aCount)
1.697 + {
1.698 + RDesReadStream stream(aPtr);
1.699 + CleanupClosePushL(stream);
1.700 +
1.701 + for (TInt i = 0; i < aCount; i++)
1.702 + {
1.703 + aArray.AppendL(stream.ReadUint32L());
1.704 + }
1.705 +
1.706 + CleanupStack::PopAndDestroy(&stream);
1.707 + }
1.708 +
1.709 +// ========================== OTHER EXPORTED FUNCTIONS =========================
1.710 +
1.711 +// End of File