os/mm/devsoundextensions/mmfcustominterfaces/AacDecoderConfig/AacDecoderConfigMsgHdlr/src/AacDecoderConfigMsgHdlr.cpp
First public contribution.
2 * Copyright (c) 2002-2004 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 AAC decoder configuration interface
21 #include "AacDecoderConfigMsgHdlr.h"
22 #include "AacDecoderConfigMsgs.h"
23 #include <AacDecoderConfig.h>
25 // EXTERNAL DATA STRUCTURES
27 // EXTERNAL FUNCTION PROTOTYPES
33 // LOCAL CONSTANTS AND MACROS
35 // MODULE DATA STRUCTURES
37 // LOCAL FUNCTION PROTOTYPES
39 // FORWARD DECLARATIONS
41 // ============================= LOCAL FUNCTIONS ===============================
43 // ============================ MEMBER FUNCTIONS ===============================
45 // -----------------------------------------------------------------------------
46 // CAacDecoderConfigMsgHdlr::CAacDecoderConfigMsgHdlr
47 // C++ default constructor can NOT contain any code, that
49 // -----------------------------------------------------------------------------
51 CAacDecoderConfigMsgHdlr::CAacDecoderConfigMsgHdlr(
52 CAacDecoderConfig* aAacDecoderConfigCI) :
53 CMMFObject(KUidAacDecoderConfig)
55 iAacDecoderConfigCI = aAacDecoderConfigCI;
58 // -----------------------------------------------------------------------------
59 // CAacDecoderConfigMsgHdlr::ConstructL
60 // Symbian 2nd phase constructor can leave.
61 // -----------------------------------------------------------------------------
63 void CAacDecoderConfigMsgHdlr::ConstructL()
67 // -----------------------------------------------------------------------------
68 // CAacDecoderConfigMsgHdlr::NewL
69 // Two-phased constructor.
70 // -----------------------------------------------------------------------------
72 EXPORT_C CAacDecoderConfigMsgHdlr* CAacDecoderConfigMsgHdlr::NewL(
73 TAny* aAacDecoderConfigCI)
75 CAacDecoderConfig* aacDecoderConfigCI =
76 (CAacDecoderConfig*)aAacDecoderConfigCI;
77 CAacDecoderConfigMsgHdlr* self =
78 new (ELeave) CAacDecoderConfigMsgHdlr(aacDecoderConfigCI);
79 CleanupStack::PushL( self );
81 CleanupStack::Pop( self );
87 EXPORT_C CAacDecoderConfigMsgHdlr::~CAacDecoderConfigMsgHdlr()
89 delete iAacDecoderConfigCI;
92 // ---------------------------------------------------------
93 // CAacDecoderConfigMsgHdlr::HandleRequest
94 // Handles the messages from the proxy.
95 // Calls a subfunction which determines which custom interface to call.
96 // A subfunction is used to contain multiple leaving functions for a single
98 // (other items were commented in a header).
99 // ---------------------------------------------------------
101 EXPORT_C void CAacDecoderConfigMsgHdlr::HandleRequest(TMMFMessage& aMessage)
103 ASSERT(aMessage.Destination().InterfaceId() == KUidAacDecoderConfig);
104 TRAPD(error,DoHandleRequestL(aMessage));
107 aMessage.Complete(error);
111 // ---------------------------------------------------------
112 // CAacDecoderConfigMsgHdlr::DoHandleRequestL
113 // Determines which custom interface to call.
114 // (other items were commented in a header).
115 // ---------------------------------------------------------
117 void CAacDecoderConfigMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
119 switch(aMessage.Function())
123 DoSetAudioConfigL(aMessage);
128 aMessage.Complete(KErrNotSupported);
133 // ---------------------------------------------------------
134 // CAacDecoderConfigMsgHdlr::DoSetAudioConfigL
135 // Handles the message from the proxy and calls the custom interface method.
136 // (other items were commented in a header).
137 // ---------------------------------------------------------
139 void CAacDecoderConfigMsgHdlr::DoSetAudioConfigL(TMMFMessage& aMessage)
141 TPckgBuf<TAudioConfig> pckg;
142 aMessage.ReadData1FromClientL(pckg);
143 TInt status = iAacDecoderConfigCI->SetAudioConfig(pckg());
144 aMessage.Complete(status);