sl@0: /* sl@0: * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Interface proxy for Enhanced AAC+ decoder configuration CI. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: // INCLUDE FILES sl@0: #include sl@0: #include sl@0: #include "EAacPlusDecoderIntfcMsgs.h" sl@0: #include "EAacPlusDecoderIntfcProxy.h" sl@0: sl@0: // EXTERNAL DATA STRUCTURES sl@0: sl@0: // EXTERNAL FUNCTION PROTOTYPES sl@0: sl@0: // CONSTANTS sl@0: const CEAacPlusDecoderIntfc::TAudioObjectType sl@0: KAacAudioObjectTypeINVALID = CEAacPlusDecoderIntfc::ENull; sl@0: const TInt KAacInputSampleRateINVALID = 0; sl@0: const TInt KAacNumOfChannelsINVALID = 0; sl@0: sl@0: // MACROS sl@0: sl@0: // LOCAL CONSTANTS AND MACROS sl@0: sl@0: // MODULE DATA STRUCTURES sl@0: sl@0: // LOCAL FUNCTION PROTOTYPES sl@0: sl@0: // FORWARD DECLARATIONS sl@0: sl@0: // ============================= LOCAL FUNCTIONS =============================== sl@0: sl@0: // ============================= MEMBER FUNCTIONS ============================== sl@0: sl@0: /** sl@0: * CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy sl@0: * C++ default constructor can NOT contain any code, that sl@0: * might leave. sl@0: */ sl@0: CEAacPlusDecoderIntfcProxy::CEAacPlusDecoderIntfcProxy( sl@0: TMMFMessageDestinationPckg aMessageHandler, sl@0: MCustomCommand& aCustomCommand, sl@0: CCustomInterfaceUtility* aCustomInterfaceUtility) : sl@0: iCustomCommand(aCustomCommand), sl@0: iMessageHandler(aMessageHandler), sl@0: iCustomInterfaceUtility(aCustomInterfaceUtility) sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * CEAacPlusDecoderIntfcProxy::ConstructL sl@0: * Symbian 2nd phase constructor can leave. sl@0: */ sl@0: void CEAacPlusDecoderIntfcProxy::ConstructL() sl@0: { sl@0: iAudioObjectType = KAacAudioObjectTypeINVALID; sl@0: iInputSamplingFrequency = KAacInputSampleRateINVALID; sl@0: iNumOfChannels = KAacNumOfChannelsINVALID; sl@0: iSbrEnabled = EFalse; sl@0: iDsmEnabled = EFalse; sl@0: iHasBeenApplied = EFalse; sl@0: } sl@0: sl@0: sl@0: /** sl@0: * CEAacPlusDecoderIntfcProxy::NewL sl@0: * Two-phased constructor. sl@0: */ sl@0: EXPORT_C CEAacPlusDecoderIntfcProxy* CEAacPlusDecoderIntfcProxy::NewL( sl@0: TMMFMessageDestinationPckg aMessageHandler, sl@0: MCustomCommand& aCustomCommand, sl@0: CCustomInterfaceUtility* aCustomInterfaceUtility) sl@0: { sl@0: CEAacPlusDecoderIntfcProxy* self = new(ELeave) CEAacPlusDecoderIntfcProxy( sl@0: aMessageHandler, sl@0: aCustomCommand, sl@0: aCustomInterfaceUtility); sl@0: CleanupStack::PushL( self ); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop( self ); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: * Destructor sl@0: */ sl@0: EXPORT_C CEAacPlusDecoderIntfcProxy::~CEAacPlusDecoderIntfcProxy() sl@0: { sl@0: iCustomInterfaceUtility->RemoveCustomInterface(iMessageHandler); sl@0: delete iCustomInterfaceUtility; sl@0: } sl@0: sl@0: sl@0: // From CEAacPlusDecoderIntfc sl@0: sl@0: /** sl@0: * Configures decoder's profile defined by TAudioObjectType. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C void CEAacPlusDecoderIntfcProxy::SetAudioObjectType( sl@0: TAudioObjectType aAudioObjectType) sl@0: { sl@0: iAudioObjectType = aAudioObjectType; sl@0: } sl@0: sl@0: /** sl@0: * Configures decoder's input sampling frequency. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C void CEAacPlusDecoderIntfcProxy::SetInputSamplingFrequency( sl@0: TUint aInputSamplingFrequency) sl@0: { sl@0: iInputSamplingFrequency = aInputSamplingFrequency; sl@0: } sl@0: sl@0: /** sl@0: * Configures decoder's channel settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C void CEAacPlusDecoderIntfcProxy::SetNumOfChannels( sl@0: TUint aNumOfChannels) sl@0: { sl@0: iNumOfChannels = aNumOfChannels; sl@0: } sl@0: sl@0: /** sl@0: * Configures decoder's SBR settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C void CEAacPlusDecoderIntfcProxy::SetSbr(TBool aSbrEnabled) sl@0: { sl@0: iSbrEnabled = aSbrEnabled; sl@0: } sl@0: sl@0: /** sl@0: * Configures decoder's DSM settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C void CEAacPlusDecoderIntfcProxy::SetDownSampledMode(TBool aDsmEnabled) sl@0: { sl@0: iDsmEnabled = aDsmEnabled; sl@0: } sl@0: sl@0: /** sl@0: * Returns decoder's AAC profile settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetAudioObjectType( sl@0: TAudioObjectType& aAudioObjectType) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aAudioObjectType = iCurrentAudioObjectType; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * Returns decoder's input sampling frequency settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetInputSamplingFrequency( sl@0: TUint& aInputSamplingFrequency) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aInputSamplingFrequency = iCurrentInputSamplingFrequency; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * Returns decoder's channel settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetNumOfChannels( sl@0: TUint& aNumOfChannels) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aNumOfChannels = iCurrentNumOfChannels; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * Returns decoder's SBR settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetSbr(TBool& aSbrEnabled) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aSbrEnabled = iCurrentSbrEnabled; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * Returns decoder's DSM settings. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::GetDownSampledMode(TBool& aDsmEnabled) sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (iHasBeenApplied) sl@0: { sl@0: aDsmEnabled = iCurrentDsmEnabled; sl@0: } sl@0: else sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: /** sl@0: * Applies configuration settings to the decoder. sl@0: * (other items defined in the header) sl@0: */ sl@0: EXPORT_C TInt CEAacPlusDecoderIntfcProxy::ApplyConfig() sl@0: { sl@0: TInt status = KErrNone; sl@0: sl@0: if (!iHasBeenApplied) sl@0: { sl@0: // Make sure Set() methods for these params were called at least once sl@0: if (iAudioObjectType == KAacAudioObjectTypeINVALID || sl@0: iInputSamplingFrequency == KAacInputSampleRateINVALID || sl@0: iNumOfChannels == KAacNumOfChannelsINVALID) sl@0: { sl@0: status = KErrArgument; sl@0: } sl@0: } sl@0: sl@0: if (status == KErrNone) sl@0: { sl@0: TEAacPlusDecoderConfig configParams; sl@0: sl@0: configParams.iAudioObjectType = iAudioObjectType; sl@0: configParams.iInputSamplingFrequency = iInputSamplingFrequency; sl@0: configParams.iNumOfChannels = iNumOfChannels; sl@0: configParams.iSbrEnabled = iSbrEnabled; sl@0: configParams.iDsmEnabled = iDsmEnabled; sl@0: sl@0: TPckgBuf pckgBuf(configParams); sl@0: TInt status = iCustomCommand.CustomCommandSync(iMessageHandler, sl@0: EEaacpdimApplyConfig, sl@0: pckgBuf, sl@0: KNullDesC8); sl@0: if (status == KErrNone) sl@0: { sl@0: iCurrentAudioObjectType = iAudioObjectType; sl@0: iCurrentInputSamplingFrequency = iInputSamplingFrequency; sl@0: iCurrentNumOfChannels = iNumOfChannels; sl@0: iCurrentSbrEnabled = iSbrEnabled; sl@0: iCurrentDsmEnabled = iDsmEnabled; sl@0: iHasBeenApplied = ETrue; sl@0: } sl@0: } sl@0: sl@0: return status; sl@0: } sl@0: sl@0: // End of File