os/mm/devsoundextensions/mmfcustominterfaces/WmaDecoderIntfc/WmaDecoderIntfcProxy/src/WmaDecoderIntfcProxy.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/mmfcustominterfaces/WmaDecoderIntfc/WmaDecoderIntfcProxy/src/WmaDecoderIntfcProxy.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,935 @@
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 WMA Decoder 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 "WmaDecoderIntfcMsgs.h"
1.27 +#include "WmaDecoderIntfcProxy.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 +// CWmaDecoderIntfcProxy::CWmaDecoderIntfcProxy
1.51 +// C++ default constructor can NOT contain any code, that might leave.
1.52 +//------------------------------------------------------------------------------
1.53 +CWmaDecoderIntfcProxy::CWmaDecoderIntfcProxy(
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 +// CWmaDecoderIntfcProxy::ConstructL
1.65 +// Symbian 2nd phase constructor can leave.
1.66 +//------------------------------------------------------------------------------
1.67 +void CWmaDecoderIntfcProxy::ConstructL()
1.68 + {
1.69 + iToolOutPut32Bit = EFalse;
1.70 + iToolDownMixToStereo = ETrue;
1.71 + iToolLostDataConcealment = EFalse;
1.72 + iParametersSameAsAdaptation = EFalse;
1.73 + }
1.74 +
1.75 +//------------------------------------------------------------------------------
1.76 +// CWmaDecoderIntfcProxy::NewL
1.77 +// Two-phased constructor.
1.78 +//------------------------------------------------------------------------------
1.79 +EXPORT_C CWmaDecoderIntfcProxy* CWmaDecoderIntfcProxy::NewL(
1.80 + TMMFMessageDestinationPckg aMessageHandler,
1.81 + MCustomCommand& aCustomCommand,
1.82 + CCustomInterfaceUtility* aCustomInterfaceUtility)
1.83 + {
1.84 + CWmaDecoderIntfcProxy* self = new(ELeave) CWmaDecoderIntfcProxy(
1.85 + aMessageHandler,
1.86 + aCustomCommand,
1.87 + aCustomInterfaceUtility);
1.88 + CleanupStack::PushL( self );
1.89 + self->ConstructL();
1.90 + CleanupStack::Pop( self );
1.91 + return self;
1.92 + }
1.93 +
1.94 +//------------------------------------------------------------------------------
1.95 +// Destructor
1.96 +//------------------------------------------------------------------------------
1.97 +EXPORT_C CWmaDecoderIntfcProxy::~CWmaDecoderIntfcProxy()
1.98 + {
1.99 + iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler);
1.100 + delete iCustomInterfaceUtility;
1.101 +/*
1.102 + iSupportedFormats.Close();
1.103 + iSupportedTools.Close();
1.104 + iControllableTools.Close();
1.105 + iCurrentSupportedFormats.Close();
1.106 + iCurrentSupportedTools.Close();
1.107 + iCurrentControllableTools.Close();
1.108 +*/
1.109 + }
1.110 +
1.111 +// From CWmaDecoderIntfc
1.112 +//------------------------------------------------------------------------------
1.113 +// Configures format.
1.114 +//------------------------------------------------------------------------------
1.115 +EXPORT_C void CWmaDecoderIntfcProxy::SetFormat(TFormat aFormat)
1.116 + {
1.117 + iFormat = aFormat;
1.118 + }
1.119 +
1.120 +//------------------------------------------------------------------------------
1.121 +// Configures decoder's bits per sample.
1.122 +//------------------------------------------------------------------------------
1.123 +EXPORT_C void CWmaDecoderIntfcProxy::SetBitsPerSampleIn(TUint aBitsPerSample)
1.124 + {
1.125 + iBitsPerSample = aBitsPerSample;
1.126 + }
1.127 +
1.128 +//------------------------------------------------------------------------------
1.129 +// Configures decoder's number of channels.
1.130 +//------------------------------------------------------------------------------
1.131 +EXPORT_C void CWmaDecoderIntfcProxy::SetNumChannelsIn (TUint aNumChannelsIn)
1.132 + {
1.133 + iNumChannelsIn = aNumChannelsIn;
1.134 + }
1.135 +
1.136 +//------------------------------------------------------------------------------
1.137 +// Configures decoder's sample rate.
1.138 +//------------------------------------------------------------------------------
1.139 +EXPORT_C void CWmaDecoderIntfcProxy::SetSamplesPerSec (TUint aSamplesPerSec)
1.140 + {
1.141 + iSamplesPerSec = aSamplesPerSec;
1.142 + }
1.143 +
1.144 +//------------------------------------------------------------------------------
1.145 +// Configures decoder's average bytes per second.
1.146 +//------------------------------------------------------------------------------
1.147 +EXPORT_C void CWmaDecoderIntfcProxy::SetAvgBytesPerSec (TUint aAvgBytesPerSec)
1.148 + {
1.149 + iAvgBytesPerSec = aAvgBytesPerSec;
1.150 + }
1.151 +
1.152 +//------------------------------------------------------------------------------
1.153 +// Configures decoder's block align.
1.154 +//------------------------------------------------------------------------------
1.155 +EXPORT_C void CWmaDecoderIntfcProxy::SetBlockAlign (TUint aBlockAlign)
1.156 + {
1.157 + iBlockAlign = aBlockAlign;
1.158 + }
1.159 +
1.160 +//------------------------------------------------------------------------------
1.161 +// Configures decoder's Encode Options.
1.162 +//------------------------------------------------------------------------------
1.163 +EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions (TUint aEncodeOptions)
1.164 + {
1.165 + iEncodeOptions = aEncodeOptions;
1.166 + }
1.167 +
1.168 +//------------------------------------------------------------------------------
1.169 +// Configures decoder's Encode Options1.
1.170 +//------------------------------------------------------------------------------
1.171 +EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions1 (TUint aEncodeOptions1)
1.172 + {
1.173 + iEncodeOptions1 = aEncodeOptions1;
1.174 + }
1.175 +
1.176 +//------------------------------------------------------------------------------
1.177 +// Configures decoder's Encode Options2.
1.178 +//------------------------------------------------------------------------------
1.179 +EXPORT_C void CWmaDecoderIntfcProxy::SetEncodeOptions2 (TUint aEncodeOptions2)
1.180 + {
1.181 + iEncodeOptions2 = aEncodeOptions2;
1.182 + }
1.183 +
1.184 +//------------------------------------------------------------------------------
1.185 +//Configures decoder's Channel Mask.
1.186 +//------------------------------------------------------------------------------
1.187 +EXPORT_C void CWmaDecoderIntfcProxy::SetChannelMaskIn (TUint aChannelMask)
1.188 + {
1.189 + iChannelMask = aChannelMask;
1.190 + }
1.191 +
1.192 +//------------------------------------------------------------------------------
1.193 +// Returns decoder's current configured format.
1.194 +//------------------------------------------------------------------------------
1.195 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetFormat (TFormat& aFormat)
1.196 + {
1.197 + TInt status = KErrNone;
1.198 +
1.199 + if (!iParametersSameAsAdaptation)
1.200 + {
1.201 + status = GetAllMessage();
1.202 + }
1.203 + if (status == KErrNone)
1.204 + {
1.205 + aFormat = iCurrentFormat;
1.206 + status = iCurrentFormatStatus;
1.207 + }
1.208 + if (!ValidGetStatus(status))
1.209 + {
1.210 + status = KErrGeneral;
1.211 + }
1.212 + return status;
1.213 + }
1.214 +
1.215 +//------------------------------------------------------------------------------
1.216 +// Returns configured bits per sample .
1.217 +//------------------------------------------------------------------------------
1.218 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetBitsPerSampleIn(TUint& aBitsPerSample)
1.219 + {
1.220 + TInt status = KErrNone;
1.221 +
1.222 + if (!iParametersSameAsAdaptation)
1.223 + {
1.224 + status = GetAllMessage();
1.225 + }
1.226 + if (status == KErrNone)
1.227 + {
1.228 + aBitsPerSample = iCurrentBitsPerSample;
1.229 + status = iCurrentBitsPerSampleStatus;
1.230 + }
1.231 + if (!ValidGetStatus(status))
1.232 + {
1.233 + status = KErrGeneral;
1.234 + }
1.235 +
1.236 + return status;
1.237 + }
1.238 +
1.239 +//------------------------------------------------------------------------------
1.240 +// Returns configured number of channels.
1.241 +//------------------------------------------------------------------------------
1.242 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetNumOfChannelsIn (TUint& aNumOfChannels)
1.243 + {
1.244 + TInt status = KErrNone;
1.245 +
1.246 + if (!iParametersSameAsAdaptation)
1.247 + {
1.248 + status = GetAllMessage();
1.249 + }
1.250 + if (status == KErrNone)
1.251 + {
1.252 + aNumOfChannels = iCurrentNumChannelsIn;
1.253 + status = iCurrentNumChannelsInStatus;
1.254 + }
1.255 + if (!ValidGetStatus(status))
1.256 + {
1.257 + status = KErrGeneral;
1.258 + }
1.259 +
1.260 + return status;
1.261 + }
1.262 +
1.263 +//------------------------------------------------------------------------------
1.264 +// Returns configured sample rate.
1.265 +//------------------------------------------------------------------------------
1.266 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetSamplesPerSec (TUint& aSamplesPerSec)
1.267 + {
1.268 + TInt status = KErrNone;
1.269 +
1.270 + if (!iParametersSameAsAdaptation)
1.271 + {
1.272 + status = GetAllMessage();
1.273 + }
1.274 + if (status == KErrNone)
1.275 + {
1.276 + aSamplesPerSec = iCurrentSamplesPerSec;
1.277 + status = iCurrentSamplesPerSecStatus;
1.278 + }
1.279 + if (!ValidGetStatus(status))
1.280 + {
1.281 + status = KErrGeneral;
1.282 + }
1.283 + return status;
1.284 + }
1.285 +
1.286 +//------------------------------------------------------------------------------
1.287 +// Returns configured average bytes per second.
1.288 +//------------------------------------------------------------------------------
1.289 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetAvgBytesPerSec (TUint& aAvgBytesPerSec)
1.290 + {
1.291 + TInt status = KErrNone;
1.292 +
1.293 + if (!iParametersSameAsAdaptation)
1.294 + {
1.295 + status = GetAllMessage();
1.296 + }
1.297 + if (status == KErrNone)
1.298 + {
1.299 + aAvgBytesPerSec = iCurrentAvgBytesPerSec;
1.300 + status = iCurrentAvgBytesPerSecStatus;
1.301 + }
1.302 + if (!ValidGetStatus(status))
1.303 + {
1.304 + status = KErrGeneral;
1.305 + }
1.306 + return status;
1.307 + }
1.308 +
1.309 +//------------------------------------------------------------------------------
1.310 +// Returns configured block align.
1.311 +//------------------------------------------------------------------------------
1.312 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetBlockAlign (TUint& aBlockAlign)
1.313 + {
1.314 + TInt status = KErrNone;
1.315 +
1.316 + if (!iParametersSameAsAdaptation)
1.317 + {
1.318 + status = GetAllMessage();
1.319 + }
1.320 + if (status == KErrNone)
1.321 + {
1.322 + aBlockAlign = iCurrentBlockAlign;
1.323 + status = iCurrentBlockAlignStatus;
1.324 + }
1.325 + if (!ValidGetStatus(status))
1.326 + {
1.327 + status = KErrGeneral;
1.328 + }
1.329 +
1.330 + return status;
1.331 + }
1.332 +
1.333 +//------------------------------------------------------------------------------
1.334 +// Returns configured encode options.
1.335 +//------------------------------------------------------------------------------
1.336 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions (TUint& aEncodeOpts)
1.337 + {
1.338 + TInt status = KErrNone;
1.339 +
1.340 + if (!iParametersSameAsAdaptation)
1.341 + {
1.342 + status = GetAllMessage();
1.343 + }
1.344 + if (status == KErrNone)
1.345 + {
1.346 + aEncodeOpts = iCurrentEncodeOptions;
1.347 + status = iCurrentEncodeOptionsStatus;
1.348 + }
1.349 + if (!ValidGetStatus(status))
1.350 + {
1.351 + status = KErrGeneral;
1.352 + }
1.353 + return status;
1.354 + }
1.355 +
1.356 +//------------------------------------------------------------------------------
1.357 +// Returns configured advanced encode options.
1.358 +//------------------------------------------------------------------------------
1.359 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions1 (TUint& EncodeOpts1)
1.360 + {
1.361 + TInt status = KErrNone;
1.362 +
1.363 + if (!iParametersSameAsAdaptation)
1.364 + {
1.365 + status = GetAllMessage();
1.366 + }
1.367 + if (status == KErrNone)
1.368 + {
1.369 + EncodeOpts1 = iCurrentEncodeOptions1;
1.370 + status = iCurrentEncodeOptions1Status;
1.371 + }
1.372 + if (!ValidGetStatus(status) &&
1.373 + status != KErrNotSupported)
1.374 + {
1.375 + status = KErrGeneral;
1.376 + }
1.377 + return status;
1.378 + }
1.379 +
1.380 +//------------------------------------------------------------------------------
1.381 +// Returns configured advanced encode options.
1.382 +//------------------------------------------------------------------------------
1.383 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetEncodeOptions2 (TUint& EncodeOpts2)
1.384 + {
1.385 + TInt status = KErrNone;
1.386 +
1.387 + if (!iParametersSameAsAdaptation)
1.388 + {
1.389 + status = GetAllMessage();
1.390 + }
1.391 + if (status == KErrNone)
1.392 + {
1.393 + EncodeOpts2 = iCurrentEncodeOptions2;
1.394 + status = iCurrentEncodeOptions2Status;
1.395 + }
1.396 + if (!ValidGetStatus(status) &&
1.397 + status != KErrNotSupported)
1.398 + {
1.399 + status = KErrGeneral;
1.400 + }
1.401 + return status;
1.402 + }
1.403 +
1.404 +//------------------------------------------------------------------------------
1.405 +// Returns configured channel mask.
1.406 +//------------------------------------------------------------------------------
1.407 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetChannelMaskIn (TUint& aChannelMask)
1.408 + {
1.409 + TInt status = KErrNone;
1.410 +
1.411 + if (!iParametersSameAsAdaptation)
1.412 + {
1.413 + status = GetAllMessage();
1.414 + }
1.415 + if (status == KErrNone)
1.416 + {
1.417 + aChannelMask = iCurrentChannelMask;
1.418 + status = iCurrentChannelMaskStatus;
1.419 + }
1.420 + if (!ValidGetStatus(status) &&
1.421 + status != KErrNotSupported)
1.422 + {
1.423 + status = KErrGeneral;
1.424 + }
1.425 +
1.426 + return status;
1.427 + }
1.428 +
1.429 +//------------------------------------------------------------------------------
1.430 +// Returns supported formats.
1.431 +//------------------------------------------------------------------------------
1.432 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedFormats(RArray<TFormat>& aSupportedFormats)
1.433 + {
1.434 +
1.435 + TInt status = KErrNone;
1.436 + TRAPD(err, status = GetSupportedFormatsL(aSupportedFormats))
1.437 + if (err != KErrNone)
1.438 + {
1.439 + if (err != KErrNone && err != KErrNotFound)
1.440 + {
1.441 + status = KErrGeneral;
1.442 + }
1.443 + }
1.444 + return status;
1.445 + }
1.446 +
1.447 +//------------------------------------------------------------------------------
1.448 +// Returns supported tools.
1.449 +//------------------------------------------------------------------------------
1.450 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedTools(RArray<TTool>& aSupportedTools)
1.451 + {
1.452 + TInt status = KErrNone;
1.453 + TRAPD(err, status = GetSupportedToolsL(aSupportedTools))
1.454 + if (err != KErrNone)
1.455 + {
1.456 + if (err != KErrNone && err != KErrNotFound)
1.457 + {
1.458 + status = KErrGeneral;
1.459 + }
1.460 + }
1.461 +
1.462 + return status;
1.463 + }
1.464 +
1.465 +//------------------------------------------------------------------------------
1.466 +// Returns supported max number of channels.
1.467 +//------------------------------------------------------------------------------
1.468 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxChannelsIn(TUint& aSupportedMaxChannelsIn)
1.469 + {
1.470 + TInt status = KErrNone;
1.471 +
1.472 + TPckgBuf<TUint> pckgBuf;
1.473 + status = iCustomCommand.CustomCommandSync(
1.474 + iMessageHandler,
1.475 + EWmaGetSupportedMaxChannels,
1.476 + KNullDesC8,
1.477 + KNullDesC8,
1.478 + pckgBuf);
1.479 +
1.480 + aSupportedMaxChannelsIn = pckgBuf();
1.481 + if (status != KErrNone && status != KErrNotFound)
1.482 + {
1.483 + status = KErrGeneral;
1.484 + }
1.485 + return status;
1.486 + }
1.487 +
1.488 +//------------------------------------------------------------------------------
1.489 +// Returns supported max bit rate.
1.490 +//------------------------------------------------------------------------------
1.491 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetSupportedMaxBitrate(TUint& aSupportedMaxBitrate)
1.492 + {
1.493 + TInt status = KErrNone;
1.494 +
1.495 + TPckgBuf<TUint> pckgBuf;
1.496 + status = iCustomCommand.CustomCommandSync(
1.497 + iMessageHandler,
1.498 + EWmaGetSupportedMaxBitrate,
1.499 + KNullDesC8,
1.500 + KNullDesC8,
1.501 + pckgBuf);
1.502 +
1.503 + aSupportedMaxBitrate = pckgBuf();
1.504 +
1.505 +
1.506 + if (status != KErrNone && status != KErrNotFound)
1.507 + {
1.508 + status = KErrGeneral;
1.509 + }
1.510 +
1.511 + return status;
1.512 + }
1.513 +
1.514 +//------------------------------------------------------------------------------
1.515 +// Get Supported Max Sample Rate
1.516 +//------------------------------------------------------------------------------
1.517 +TInt CWmaDecoderIntfcProxy::GetSupportedMaxSampleRate(TUint& aSupportedMaxSampleRate)
1.518 + {
1.519 + TInt status = KErrNone;
1.520 +
1.521 + TPckgBuf<TUint> pckgBuf;
1.522 + status = iCustomCommand.CustomCommandSync(
1.523 + iMessageHandler,
1.524 + EWmaGetSupportedMaxSampleRate,
1.525 + KNullDesC8,
1.526 + KNullDesC8,
1.527 + pckgBuf);
1.528 +
1.529 + aSupportedMaxSampleRate = pckgBuf();
1.530 + if (status != KErrNone && status != KErrNotFound)
1.531 + {
1.532 + status = KErrGeneral;
1.533 + }
1.534 +
1.535 + return status;
1.536 + }
1.537 +
1.538 +//------------------------------------------------------------------------------
1.539 +// Returns controllable tools.
1.540 +//------------------------------------------------------------------------------
1.541 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetControllableTools(RArray<TTool>& aControllableTools)
1.542 + {
1.543 + TInt status = KErrNone;
1.544 + TRAPD(err, status = GetControllableToolsL(aControllableTools))
1.545 + if (err != KErrNone)
1.546 + {
1.547 + if (err != KErrNone && err != KErrNotFound)
1.548 + {
1.549 + status = KErrGeneral;
1.550 + }
1.551 + }
1.552 +
1.553 + return status;
1.554 + }
1.555 +
1.556 +//------------------------------------------------------------------------------
1.557 +// Enable tool.
1.558 +//------------------------------------------------------------------------------
1.559 +EXPORT_C void CWmaDecoderIntfcProxy::EnableTool(TTool aTool)
1.560 + {
1.561 + switch (aTool)
1.562 + {
1.563 + case EToolOutput32Bit:
1.564 + iToolOutPut32Bit = ETrue;
1.565 + break;
1.566 + case EDownMixToStereo:
1.567 + iToolDownMixToStereo = ETrue;
1.568 + break;
1.569 + case ELostDataConcealment:
1.570 + iToolLostDataConcealment = ETrue;
1.571 + break;
1.572 + default:
1.573 + break;
1.574 + }
1.575 +
1.576 + }
1.577 +
1.578 +//------------------------------------------------------------------------------
1.579 +// disable tool.
1.580 +//------------------------------------------------------------------------------
1.581 +EXPORT_C void CWmaDecoderIntfcProxy::DisableTool(TTool aTool)
1.582 + {
1.583 + switch (aTool)
1.584 + {
1.585 + case EToolOutput32Bit:
1.586 + iToolOutPut32Bit = EFalse;
1.587 + break;
1.588 + case EDownMixToStereo:
1.589 + iToolDownMixToStereo = EFalse;
1.590 + break;
1.591 + case ELostDataConcealment:
1.592 + iToolLostDataConcealment = EFalse;
1.593 + break;
1.594 + default:
1.595 + break;
1.596 + }
1.597 + }
1.598 +
1.599 +
1.600 +//------------------------------------------------------------------------------
1.601 +// Returns tool state.
1.602 +//------------------------------------------------------------------------------
1.603 +EXPORT_C TInt CWmaDecoderIntfcProxy::GetTool(TTool aTool, TBool& aEnabled)
1.604 + {
1.605 + TInt status = KErrNone;
1.606 +
1.607 + if (!iParametersSameAsAdaptation)
1.608 + {
1.609 + status = GetAllMessage();
1.610 + }
1.611 + switch (aTool)
1.612 + {
1.613 + case EToolOutput32Bit:
1.614 + if (iCurrentToolOutPut32Bit)
1.615 + {
1.616 + aEnabled = ETrue;
1.617 + }
1.618 + else
1.619 + {
1.620 + aEnabled = EFalse;
1.621 + }
1.622 + status = iCurrentToolOutPut32BitStatus;
1.623 + break;
1.624 +
1.625 + case EDownMixToStereo:
1.626 + if (iCurrentToolDownMixToStereo)
1.627 + {
1.628 + aEnabled = ETrue;
1.629 + }
1.630 + else
1.631 + {
1.632 + aEnabled = EFalse;
1.633 + }
1.634 + status = iCurrentToolDownMixToStereoStatus;
1.635 + break;
1.636 +
1.637 + case ELostDataConcealment:
1.638 + if (iCurrentToolLostDataConcealment)
1.639 + {
1.640 + aEnabled = ETrue;
1.641 + }
1.642 + else
1.643 + {
1.644 + aEnabled = EFalse;
1.645 + }
1.646 + status = iCurrentToolLostDataConcealmentStatus;
1.647 + break;
1.648 + default:
1.649 + break;
1.650 + }
1.651 +
1.652 + if (!ValidGetStatus(status) &&
1.653 + status != KErrNotSupported)
1.654 + {
1.655 + status = KErrGeneral;
1.656 + }
1.657 +
1.658 + return status;
1.659 +
1.660 +
1.661 + }
1.662 +
1.663 +//------------------------------------------------------------------------------
1.664 +// Applies configuration settings to the decoder.
1.665 +//------------------------------------------------------------------------------
1.666 +EXPORT_C TInt CWmaDecoderIntfcProxy::ApplyConfig()
1.667 + {
1.668 + TInt status = KErrNone;
1.669 +
1.670 +
1.671 + TWmaDecoderConfig configParams;
1.672 +
1.673 + configParams.iFormat = iFormat;
1.674 + configParams.iBitsPerSample = iBitsPerSample;
1.675 + configParams.iNumChannelsIn = iNumChannelsIn;
1.676 + configParams.iSamplesPerSec = iSamplesPerSec;
1.677 + configParams.iAvgBytesPerSec = iAvgBytesPerSec;
1.678 + configParams.iBlockAlign = iBlockAlign;
1.679 + configParams.iEncodeOptions = iEncodeOptions;
1.680 + configParams.iEncodeOptions1 = iEncodeOptions1;
1.681 + configParams.iEncodeOptions2 = iEncodeOptions2;
1.682 + configParams.iChannelMask = iChannelMask;
1.683 + configParams.iToolOutPut32Bit = iToolOutPut32Bit;
1.684 + configParams.iToolDownMixToStereo = iToolDownMixToStereo;
1.685 + configParams.iToolLostDataConcealment = iToolLostDataConcealment;
1.686 +
1.687 +
1.688 + TPckgBuf<TWmaDecoderConfig> pckgBuf(configParams);
1.689 + status = iCustomCommand.CustomCommandSync(iMessageHandler,
1.690 + EWmaApplyConfig,
1.691 + pckgBuf,
1.692 + KNullDesC8);
1.693 + if (status == KErrNone)
1.694 + {
1.695 + iCurrentFormat = iFormat;
1.696 + iCurrentBitsPerSample = iBitsPerSample;
1.697 + iCurrentNumChannelsIn = iNumChannelsIn;
1.698 + iCurrentSamplesPerSec = iSamplesPerSec;
1.699 + iCurrentAvgBytesPerSec = iAvgBytesPerSec;
1.700 + iCurrentBlockAlign = iBlockAlign;
1.701 + iCurrentEncodeOptions = iEncodeOptions;
1.702 + iCurrentEncodeOptions1 = iEncodeOptions1;
1.703 + iCurrentEncodeOptions2 = iEncodeOptions2;
1.704 + iCurrentChannelMask = iChannelMask;
1.705 + iCurrentToolOutPut32Bit = iToolOutPut32Bit;
1.706 + iCurrentToolDownMixToStereo = iToolDownMixToStereo;
1.707 + iCurrentToolLostDataConcealment = iToolLostDataConcealment;
1.708 +
1.709 + iCurrentFormatStatus = status;
1.710 + iCurrentBitsPerSampleStatus = status;
1.711 + iCurrentNumChannelsInStatus = status ;
1.712 + iCurrentSamplesPerSecStatus = status;
1.713 + iCurrentAvgBytesPerSecStatus = status ;
1.714 + iCurrentBlockAlignStatus = status;
1.715 + iCurrentEncodeOptionsStatus = status;
1.716 + iCurrentEncodeOptions1Status = status;
1.717 + iCurrentEncodeOptions2Status = status;
1.718 + iCurrentChannelMaskStatus = status;
1.719 + iCurrentToolOutPut32BitStatus = status;
1.720 + iCurrentToolDownMixToStereoStatus = status;
1.721 + iCurrentToolLostDataConcealmentStatus = status;
1.722 +
1.723 + iParametersSameAsAdaptation = ETrue;
1.724 + }
1.725 + else
1.726 + {
1.727 + iParametersSameAsAdaptation = EFalse;
1.728 + }
1.729 + return status;
1.730 + }
1.731 +
1.732 +
1.733 +//------------------------------------------------------------------------------
1.734 +// Receive all configure paramemters
1.735 +//------------------------------------------------------------------------------
1.736 +TInt CWmaDecoderIntfcProxy::GetAllMessage()
1.737 + {
1.738 + TPckgBuf<TAllParams> pckg;
1.739 + TInt status = iCustomCommand.CustomCommandSync(
1.740 + iMessageHandler,
1.741 + EWmaGetAllMsg,
1.742 + KNullDesC8,
1.743 + KNullDesC8,pckg);
1.744 + if (status == KErrNone)
1.745 + {
1.746 + iCurrentFormat = pckg().iCurrentFormat;
1.747 + iCurrentFormatStatus = pckg().iCurrentFormatStatus;
1.748 +
1.749 + iCurrentBitsPerSample = pckg().iCurrentBitsPerSample;
1.750 + iCurrentBitsPerSampleStatus =pckg().iCurrentBitsPerSampleStatus;
1.751 +
1.752 + iCurrentNumChannelsIn = pckg().iCurrentNumChannelsIn;
1.753 + iCurrentNumChannelsInStatus = pckg().iCurrentNumChannelsInStatus;
1.754 +
1.755 + iCurrentSamplesPerSec = pckg().iCurrentSamplesPerSec ;
1.756 + iCurrentSamplesPerSecStatus = pckg().iCurrentSamplesPerSecStatus;
1.757 +
1.758 + iCurrentAvgBytesPerSec = pckg().iCurrentAvgBytesPerSec;
1.759 + iCurrentAvgBytesPerSecStatus = pckg().iCurrentAvgBytesPerSecStatus;
1.760 +
1.761 + iCurrentBlockAlign = pckg().iCurrentBlockAlign;
1.762 + iCurrentBlockAlignStatus = pckg().iCurrentBlockAlignStatus;
1.763 +
1.764 + iCurrentEncodeOptions = pckg().iCurrentEncodeOptions;
1.765 + iCurrentEncodeOptionsStatus = pckg().iCurrentEncodeOptionsStatus ;
1.766 +
1.767 + iCurrentEncodeOptions1 = pckg().iCurrentEncodeOptions1;
1.768 + iCurrentEncodeOptions1Status = pckg().iCurrentEncodeOptions1Status;
1.769 +
1.770 + iCurrentEncodeOptions2 = pckg().iCurrentEncodeOptions2;
1.771 + iCurrentEncodeOptions2Status = pckg().iCurrentEncodeOptions2Status;
1.772 +
1.773 + iCurrentChannelMask = pckg().iCurrentChannelMask ;
1.774 + iCurrentChannelMaskStatus = pckg().iCurrentChannelMaskStatus;
1.775 +
1.776 + iCurrentToolOutPut32Bit = pckg().iCurrentToolOutPut32Bit;
1.777 + iCurrentToolOutPut32BitStatus = pckg().iCurrentToolOutPut32BitStatus;
1.778 +
1.779 + iCurrentToolDownMixToStereo = pckg().iCurrentToolDownMixToStereo;
1.780 + iCurrentToolDownMixToStereoStatus = pckg().iCurrentToolDownMixToStereoStatus;
1.781 +
1.782 + iCurrentToolLostDataConcealment = pckg().iCurrentToolLostDataConcealment;
1.783 + iCurrentToolLostDataConcealmentStatus = pckg().iCurrentToolLostDataConcealmentStatus ;
1.784 + iParametersSameAsAdaptation = ETrue;
1.785 + }
1.786 + return status;
1.787 +}
1.788 +
1.789 +//------------------------------------------------------------------------------
1.790 +// check return status
1.791 +//------------------------------------------------------------------------------
1.792 +TBool CWmaDecoderIntfcProxy::ValidGetStatus(TInt aStatus)
1.793 + {
1.794 + if (aStatus != KErrNone && aStatus != KErrCompletion &&
1.795 + aStatus != KErrUnknown && aStatus != KErrArgument &&
1.796 + aStatus != KErrNotReady && aStatus != KErrNotFound &&
1.797 + aStatus != KErrGeneral)
1.798 + {
1.799 + return EFalse;
1.800 + }
1.801 + else
1.802 + {
1.803 + return ETrue;
1.804 + }
1.805 + }
1.806 +
1.807 +
1.808 +//------------------------------------------------------------------------------
1.809 +// GetSupportedFormatsL
1.810 +//------------------------------------------------------------------------------
1.811 +TInt CWmaDecoderIntfcProxy::GetSupportedFormatsL(RArray<TFormat>& aSupportedFormats)
1.812 + {
1.813 + TInt status = KErrNone;
1.814 +
1.815 + aSupportedFormats.Reset();
1.816 +
1.817 + TPckgBuf<TUint> supportedFormatsPkg;
1.818 + status = iCustomCommand.CustomCommandSync(
1.819 + iMessageHandler,
1.820 + EWmaGetNumOfSupportedFormats,
1.821 + KNullDesC8,
1.822 + KNullDesC8,
1.823 + supportedFormatsPkg);
1.824 + HBufC8* buf = HBufC8::NewLC(supportedFormatsPkg()*sizeof(TUint));
1.825 + // buf is left on cleanup
1.826 + TPtr8 ptr = buf->Des();
1.827 + iCustomCommand.CustomCommandSync(
1.828 + iMessageHandler,
1.829 + EWmaGetSupportedFormats,
1.830 + KNullDesC8,
1.831 + KNullDesC8,
1.832 + ptr);
1.833 + RDesReadStream stream(ptr);
1.834 + CleanupClosePushL(stream); // stream on cleanup
1.835 + for (TInt i=0; i<supportedFormatsPkg(); i++)
1.836 + {
1.837 + aSupportedFormats.AppendL(static_cast<TFormat>(stream.ReadUint32L()));
1.838 + }
1.839 + CleanupStack::PopAndDestroy(&stream);
1.840 + CleanupStack::PopAndDestroy(buf);
1.841 + if (status != KErrNone && status != KErrNotFound)
1.842 + {
1.843 + status = KErrGeneral;
1.844 + }
1.845 +
1.846 + return status;
1.847 + }
1.848 +
1.849 +//------------------------------------------------------------------------------
1.850 +// GetSupportedToolsL
1.851 +//------------------------------------------------------------------------------
1.852 +TInt CWmaDecoderIntfcProxy::GetSupportedToolsL(RArray<TTool>& aSupportedTools)
1.853 + {
1.854 +
1.855 + TInt status = KErrNone;
1.856 + aSupportedTools.Reset();
1.857 +
1.858 + TPckgBuf<TUint> supportedToolsPkg;
1.859 + status = iCustomCommand.CustomCommandSync(
1.860 + iMessageHandler,
1.861 + EWmaGetNumOfSupportedTools,
1.862 + KNullDesC8,
1.863 + KNullDesC8,
1.864 + supportedToolsPkg);
1.865 +
1.866 + HBufC8* buf = HBufC8::NewLC(supportedToolsPkg()*sizeof(TUint));
1.867 + // buf is left on cleanup
1.868 + TPtr8 ptr = buf->Des();
1.869 +
1.870 + iCustomCommand.CustomCommandSync(
1.871 + iMessageHandler,
1.872 + EWmaGetSupportedTools,
1.873 + KNullDesC8,
1.874 + KNullDesC8,
1.875 + ptr);
1.876 + RDesReadStream stream(ptr);
1.877 + CleanupClosePushL(stream); // stream on cleanup
1.878 + for (TInt i=0; i<supportedToolsPkg(); i++)
1.879 + {
1.880 + aSupportedTools.AppendL(static_cast<TTool>(stream.ReadUint32L()));
1.881 + }
1.882 + CleanupStack::PopAndDestroy(&stream);
1.883 + CleanupStack::PopAndDestroy(buf);
1.884 +
1.885 +
1.886 + if (status != KErrNone && status != KErrNotFound)
1.887 + {
1.888 + status = KErrGeneral;
1.889 + }
1.890 +
1.891 + return status;
1.892 + }
1.893 +
1.894 +//------------------------------------------------------------------------------
1.895 +// GetControllableToolsL
1.896 +//------------------------------------------------------------------------------
1.897 +TInt CWmaDecoderIntfcProxy::GetControllableToolsL(RArray<TTool>& aControllableTools)
1.898 + {
1.899 + TInt status = KErrNone;
1.900 + aControllableTools.Reset();
1.901 +
1.902 + TPckgBuf<TUint> numPckg;
1.903 + status = iCustomCommand.CustomCommandSync(
1.904 + iMessageHandler,
1.905 + EWmaGetNumOfControllableTools,
1.906 + KNullDesC8,
1.907 + KNullDesC8,
1.908 + numPckg);
1.909 +
1.910 + HBufC8* buf = HBufC8::NewLC(numPckg()*sizeof(TUint));
1.911 + // buf is left on cleanup
1.912 + TPtr8 ptr = buf->Des();
1.913 +
1.914 + iCustomCommand.CustomCommandSync(
1.915 + iMessageHandler,
1.916 + EWmaGetControllableTools,
1.917 + KNullDesC8,
1.918 + KNullDesC8,
1.919 + ptr);
1.920 + RDesReadStream stream(ptr);
1.921 + CleanupClosePushL(stream); // stream on cleanup
1.922 + for (TInt i=0; i < numPckg(); i++)
1.923 + {
1.924 + aControllableTools.AppendL(static_cast<TTool>(stream.ReadUint32L()));
1.925 + }
1.926 + CleanupStack::PopAndDestroy(&stream);
1.927 + CleanupStack::PopAndDestroy(buf);
1.928 + if (status != KErrNone && status != KErrNotFound)
1.929 + {
1.930 + status = KErrGeneral;
1.931 + }
1.932 +
1.933 + return status;
1.934 + }
1.935 +
1.936 +
1.937 +
1.938 +// End of File