os/mm/devsoundextensions/mmfcustominterfaces/EAacPlusDecoderIntfc/EAacPlusDecoderIntfcMsgHdlr/src/EAacPlusDecoderIntfcMsgHdlr.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:   Message handler for eAAC+ decoder configuration interface.
    15 *
    16 */
    17 
    18 
    19 
    20 // INCLUDE FILES
    21 #include    "EAacPlusDecoderIntfcMsgs.h"
    22 #include    "EAacPlusDecoderIntfcMsgHdlr.h"
    23 
    24 // EXTERNAL DATA STRUCTURES
    25 
    26 // EXTERNAL FUNCTION PROTOTYPES
    27 
    28 // CONSTANTS
    29 
    30 // MACROS
    31 
    32 // LOCAL CONSTANTS AND MACROS
    33 
    34 // MODULE DATA STRUCTURES
    35 
    36 // LOCAL FUNCTION PROTOTYPES
    37 
    38 // FORWARD DECLARATIONS
    39 
    40 // ============================= LOCAL FUNCTIONS ===============================
    41 
    42 // ============================ MEMBER FUNCTIONS ===============================
    43 
    44 /**
    45  * CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr
    46  * C++ default constructor can NOT contain any code, that might leave.
    47  */
    48 CEAacPlusDecoderIntfcMsgHdlr::CEAacPlusDecoderIntfcMsgHdlr(
    49                               CEAacPlusDecoderIntfc* aAacDecoderConfigCI) :
    50 	CMMFObject(KUidEAacPlusDecoderIntfc)
    51     {
    52     iAacDecoderConfigCI = aAacDecoderConfigCI;
    53     }
    54 
    55 /**
    56  * CEAacPlusDecoderIntfcMsgHdlr::ConstructL
    57  * Symbian 2nd phase constructor can leave.
    58  */
    59 void CEAacPlusDecoderIntfcMsgHdlr::ConstructL()
    60     {
    61     }
    62 
    63 /**
    64  * CEAacPlusDecoderIntfcMsgHdlr::NewL
    65  * Two-phased constructor.
    66  */
    67 EXPORT_C CEAacPlusDecoderIntfcMsgHdlr* CEAacPlusDecoderIntfcMsgHdlr::NewL(
    68                                        TAny* aAacDecoderConfigCI)
    69     {
    70     CEAacPlusDecoderIntfc* aacDecoderConfigCI =
    71                 (CEAacPlusDecoderIntfc*)aAacDecoderConfigCI;
    72     CEAacPlusDecoderIntfcMsgHdlr* self =
    73                 new (ELeave) CEAacPlusDecoderIntfcMsgHdlr(aacDecoderConfigCI);
    74     CleanupStack::PushL( self );
    75     self->ConstructL();
    76     CleanupStack::Pop( self );
    77 
    78     return self;
    79     }
    80 
    81 /**
    82  * Destructor
    83  */
    84 EXPORT_C CEAacPlusDecoderIntfcMsgHdlr::~CEAacPlusDecoderIntfcMsgHdlr()
    85 	{
    86 	delete iAacDecoderConfigCI;
    87 	}
    88 
    89 /**
    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
    94  * trap.
    95  * (other items were commented in a header).
    96  */
    97 EXPORT_C void CEAacPlusDecoderIntfcMsgHdlr::HandleRequest(
    98                                             TMMFMessage& aMessage)
    99 	{
   100 	ASSERT(aMessage.Destination().InterfaceId() == KUidEAacPlusDecoderIntfc);
   101 
   102 	TRAPD(error, DoHandleRequestL(aMessage));
   103 	if(error)
   104 		{
   105 		aMessage.Complete(error);
   106 		}
   107 	}
   108 
   109 /**
   110  * CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL
   111  * Determines which custom interface to call.
   112  * (other items were commented in a header).
   113  */
   114 void CEAacPlusDecoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
   115 	{
   116 	switch(aMessage.Function())
   117 		{
   118 		case EEaacpdimApplyConfig:
   119 			{
   120     		DoApplyConfigL(aMessage);
   121 			break;
   122 			}
   123 		default:
   124 			{
   125 			aMessage.Complete(KErrNotSupported);
   126 			}
   127 		}
   128 	}
   129 
   130 /**
   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).
   135  */
   136 void CEAacPlusDecoderIntfcMsgHdlr::DoApplyConfigL(TMMFMessage& aMessage)
   137     {
   138 	TPckgBuf<TEAacPlusDecoderConfig> pckgBuf;
   139 	aMessage.ReadData1FromClientL(pckgBuf);
   140 
   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);
   147 
   148 	TInt status = iAacDecoderConfigCI->ApplyConfig();
   149     aMessage.Complete(status);
   150     }
   151 
   152 // End of File