os/mm/devsoundextensions/mmfcustominterfaces/EAacPlusDecoderIntfc/EAacPlusDecoderIntfcMsgHdlr/src/EAacPlusDecoderIntfcMsgHdlr.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsoundextensions/mmfcustominterfaces/EAacPlusDecoderIntfc/EAacPlusDecoderIntfcMsgHdlr/src/EAacPlusDecoderIntfcMsgHdlr.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,152 @@
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: Message handler for eAAC+ decoder configuration interface.
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +// INCLUDE FILES
1.24 +#include "EAacPlusDecoderIntfcMsgs.h"
1.25 +#include "EAacPlusDecoderIntfcMsgHdlr.h"
1.26 +
1.27 +// EXTERNAL DATA STRUCTURES
1.28 +
1.29 +// EXTERNAL FUNCTION PROTOTYPES
1.30 +
1.31 +// CONSTANTS
1.32 +
1.33 +// MACROS
1.34 +
1.35 +// LOCAL CONSTANTS AND MACROS
1.36 +
1.37 +// MODULE DATA STRUCTURES
1.38 +
1.39 +// LOCAL FUNCTION PROTOTYPES
1.40 +
1.41 +// FORWARD DECLARATIONS
1.42 +
1.43 +// ============================= LOCAL FUNCTIONS ===============================
1.44 +
1.45 +// ============================ MEMBER FUNCTIONS ===============================
1.46 +
1.47 +/**
1.48 + * CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr
1.49 + * C++ default constructor can NOT contain any code, that might leave.
1.50 + */
1.51 +CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr(
1.52 + CEAacPlusDecoderIntfc* aAacDecoderConfigCI) :
1.53 + CMMFObject(KUidEAacPlusDecoderIntfc)
1.54 + {
1.55 + iAacDecoderConfigCI = aAacDecoderConfigCI;
1.56 + }
1.57 +
1.58 +/**
1.59 + * CEAacPlusDecoderIntfcMsgHdlr::ConstructL
1.60 + * Symbian 2nd phase constructor can leave.
1.61 + */
1.62 +void CEAacPlusDecoderIntfcMsgHdlr::ConstructL()
1.63 + {
1.64 + }
1.65 +
1.66 +/**
1.67 + * CEAacPlusDecoderIntfcMsgHdlr::NewL
1.68 + * Two-phased constructor.
1.69 + */
1.70 +EXPORT_C CEAacPlusDecoderIntfcMsgHdlr* CEAacPlusDecoderIntfcMsgHdlr::NewL(
1.71 + TAny* aAacDecoderConfigCI)
1.72 + {
1.73 + CEAacPlusDecoderIntfc* aacDecoderConfigCI =
1.74 + (CEAacPlusDecoderIntfc*)aAacDecoderConfigCI;
1.75 + CEAacPlusDecoderIntfcMsgHdlr* self =
1.76 + new (ELeave) CEAacPlusDecoderIntfcMsgHdlr(aacDecoderConfigCI);
1.77 + CleanupStack::PushL( self );
1.78 + self->ConstructL();
1.79 + CleanupStack::Pop( self );
1.80 +
1.81 + return self;
1.82 + }
1.83 +
1.84 +/**
1.85 + * Destructor
1.86 + */
1.87 +EXPORT_C CEAacPlusDecoderIntfcMsgHdlr::~CEAacPlusDecoderIntfcMsgHdlr()
1.88 + {
1.89 + delete iAacDecoderConfigCI;
1.90 + }
1.91 +
1.92 +/**
1.93 + * CEAacPlusDecoderIntfcMsgHdlr::HandleRequest
1.94 + * Handles the messages from the proxy.
1.95 + * Calls a subfunction which determines what custom interface to call.
1.96 + * A subfunction is used to contain multiple leaving functions for a single
1.97 + * trap.
1.98 + * (other items were commented in a header).
1.99 + */
1.100 +EXPORT_C void CEAacPlusDecoderIntfcMsgHdlr::HandleRequest(
1.101 + TMMFMessage& aMessage)
1.102 + {
1.103 + ASSERT(aMessage.Destination().InterfaceId() == KUidEAacPlusDecoderIntfc);
1.104 +
1.105 + TRAPD(error, DoHandleRequestL(aMessage));
1.106 + if(error)
1.107 + {
1.108 + aMessage.Complete(error);
1.109 + }
1.110 + }
1.111 +
1.112 +/**
1.113 + * CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL
1.114 + * Determines which custom interface to call.
1.115 + * (other items were commented in a header).
1.116 + */
1.117 +void CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
1.118 + {
1.119 + switch(aMessage.Function())
1.120 + {
1.121 + case EEaacpdimApplyConfig:
1.122 + {
1.123 + DoApplyConfigL(aMessage);
1.124 + break;
1.125 + }
1.126 + default:
1.127 + {
1.128 + aMessage.Complete(KErrNotSupported);
1.129 + }
1.130 + }
1.131 + }
1.132 +
1.133 +/**
1.134 + * CEAacPlusDecoderIntfcMsgHdlr::DoApplyConfigL
1.135 + * Handles the message from the proxy and calls the custom interface method
1.136 + * to commit configuration settings to the decoder.
1.137 + * (other items were commented in a header).
1.138 + */
1.139 +void CEAacPlusDecoderIntfcMsgHdlr::DoApplyConfigL(TMMFMessage& aMessage)
1.140 + {
1.141 + TPckgBuf<TEAacPlusDecoderConfig> pckgBuf;
1.142 + aMessage.ReadData1FromClientL(pckgBuf);
1.143 +
1.144 + iAacDecoderConfigCI->SetAudioObjectType(pckgBuf().iAudioObjectType);
1.145 + iAacDecoderConfigCI->SetInputSamplingFrequency(
1.146 + pckgBuf().iInputSamplingFrequency);
1.147 + iAacDecoderConfigCI->SetNumOfChannels(pckgBuf().iNumOfChannels);
1.148 + iAacDecoderConfigCI->SetSbr(pckgBuf().iSbrEnabled);
1.149 + iAacDecoderConfigCI->SetDownSampledMode(pckgBuf().iDsmEnabled);
1.150 +
1.151 + TInt status = iAacDecoderConfigCI->ApplyConfig();
1.152 + aMessage.Complete(status);
1.153 + }
1.154 +
1.155 +// End of File