os/mm/devsoundextensions/mmfcustominterfaces/EAacPlusDecoderIntfc/EAacPlusDecoderIntfcMsgHdlr/src/EAacPlusDecoderIntfcMsgHdlr.cpp
Update contrib.
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Message handler for eAAC+ decoder configuration interface.
21 #include "EAacPlusDecoderIntfcMsgs.h"
22 #include "EAacPlusDecoderIntfcMsgHdlr.h"
24 // EXTERNAL DATA STRUCTURES
26 // EXTERNAL FUNCTION PROTOTYPES
32 // LOCAL CONSTANTS AND MACROS
34 // MODULE DATA STRUCTURES
36 // LOCAL FUNCTION PROTOTYPES
38 // FORWARD DECLARATIONS
40 // ============================= LOCAL FUNCTIONS ===============================
42 // ============================ MEMBER FUNCTIONS ===============================
45 * CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr
46 * C++ default constructor can NOT contain any code, that might leave.
48 CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr(
49 CEAacPlusDecoderIntfc* aAacDecoderConfigCI) :
50 CMMFObject(KUidEAacPlusDecoderIntfc)
52 iAacDecoderConfigCI = aAacDecoderConfigCI;
56 * CEAacPlusDecoderIntfcMsgHdlr::ConstructL
57 * Symbian 2nd phase constructor can leave.
59 void CEAacPlusDecoderIntfcMsgHdlr::ConstructL()
64 * CEAacPlusDecoderIntfcMsgHdlr::NewL
65 * Two-phased constructor.
67 EXPORT_C CEAacPlusDecoderIntfcMsgHdlr* CEAacPlusDecoderIntfcMsgHdlr::NewL(
68 TAny* aAacDecoderConfigCI)
70 CEAacPlusDecoderIntfc* aacDecoderConfigCI =
71 (CEAacPlusDecoderIntfc*)aAacDecoderConfigCI;
72 CEAacPlusDecoderIntfcMsgHdlr* self =
73 new (ELeave) CEAacPlusDecoderIntfcMsgHdlr(aacDecoderConfigCI);
74 CleanupStack::PushL( self );
76 CleanupStack::Pop( self );
84 EXPORT_C CEAacPlusDecoderIntfcMsgHdlr::~CEAacPlusDecoderIntfcMsgHdlr()
86 delete iAacDecoderConfigCI;
90 * CEAacPlusDecoderIntfcMsgHdlr::HandleRequest
91 * Handles the messages from the proxy.
92 * Calls a subfunction which determines what custom interface to call.
93 * A subfunction is used to contain multiple leaving functions for a single
95 * (other items were commented in a header).
97 EXPORT_C void CEAacPlusDecoderIntfcMsgHdlr::HandleRequest(
98 TMMFMessage& aMessage)
100 ASSERT(aMessage.Destination().InterfaceId() == KUidEAacPlusDecoderIntfc);
102 TRAPD(error, DoHandleRequestL(aMessage));
105 aMessage.Complete(error);
110 * CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL
111 * Determines which custom interface to call.
112 * (other items were commented in a header).
114 void CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
116 switch(aMessage.Function())
118 case EEaacpdimApplyConfig:
120 DoApplyConfigL(aMessage);
125 aMessage.Complete(KErrNotSupported);
131 * CEAacPlusDecoderIntfcMsgHdlr::DoApplyConfigL
132 * Handles the message from the proxy and calls the custom interface method
133 * to commit configuration settings to the decoder.
134 * (other items were commented in a header).
136 void CEAacPlusDecoderIntfcMsgHdlr::DoApplyConfigL(TMMFMessage& aMessage)
138 TPckgBuf<TEAacPlusDecoderConfig> pckgBuf;
139 aMessage.ReadData1FromClientL(pckgBuf);
141 iAacDecoderConfigCI->SetAudioObjectType(pckgBuf().iAudioObjectType);
142 iAacDecoderConfigCI->SetInputSamplingFrequency(
143 pckgBuf().iInputSamplingFrequency);
144 iAacDecoderConfigCI->SetNumOfChannels(pckgBuf().iNumOfChannels);
145 iAacDecoderConfigCI->SetSbr(pckgBuf().iSbrEnabled);
146 iAacDecoderConfigCI->SetDownSampledMode(pckgBuf().iDsmEnabled);
148 TInt status = iAacDecoderConfigCI->ApplyConfig();
149 aMessage.Complete(status);