os/mm/devsoundextensions/mmfcustominterfaces/G729DecoderIntfc/G729DecoderIntfcMsgHdlr/src/G729DecoderIntfcMsgHdlr.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2002-2004 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 G729 decoder interface
    15 *
    16 */
    17 
    18 
    19 
    20 // INCLUDE FILES
    21 #include    "G729DecoderIntfcMsgHdlr.h"
    22 #include    "G729DecoderIntfcMsgs.h"
    23 #include    <G729DecoderIntfc.h>
    24 
    25 // EXTERNAL DATA STRUCTURES
    26 
    27 // EXTERNAL FUNCTION PROTOTYPES  
    28 
    29 // CONSTANTS
    30 
    31 // MACROS
    32 
    33 // LOCAL CONSTANTS AND MACROS
    34 
    35 // MODULE DATA STRUCTURES
    36 
    37 // LOCAL FUNCTION PROTOTYPES
    38 
    39 // FORWARD DECLARATIONS
    40 
    41 // ============================= LOCAL FUNCTIONS ===============================
    42 
    43 // ============================ MEMBER FUNCTIONS ===============================
    44 
    45 // -----------------------------------------------------------------------------
    46 // CG729DecoderIntfcMsgHdlr::CG729DecoderIntfcMsgHdlr
    47 // C++ default constructor can NOT contain any code, that
    48 // might leave.
    49 // -----------------------------------------------------------------------------
    50 //
    51 CG729DecoderIntfcMsgHdlr::CG729DecoderIntfcMsgHdlr(
    52                              CG729DecoderIntfc* aG729DecoderIntfcCI) :
    53 	CMMFObject(KUidG729DecoderIntfc)
    54     {
    55     iG729DecoderIntfcCI = aG729DecoderIntfcCI;
    56     }
    57 
    58 // -----------------------------------------------------------------------------
    59 // CG729DecoderIntfcMsgHdlr::ConstructL
    60 // Symbian 2nd phase constructor can leave.
    61 // -----------------------------------------------------------------------------
    62 //
    63 void CG729DecoderIntfcMsgHdlr::ConstructL()
    64     {
    65     }
    66 
    67 // -----------------------------------------------------------------------------
    68 // CG729DecoderIntfcMsgHdlr::NewL
    69 // Two-phased constructor.
    70 // -----------------------------------------------------------------------------
    71 //
    72 EXPORT_C CG729DecoderIntfcMsgHdlr* CG729DecoderIntfcMsgHdlr::NewL(
    73                                                 TAny*  aG729DecoderIntfcCI)
    74     {
    75     CG729DecoderIntfc* errorConcealmentIntfcCI = 
    76                               (CG729DecoderIntfc*)aG729DecoderIntfcCI;
    77     CG729DecoderIntfcMsgHdlr* self = 
    78             new (ELeave) CG729DecoderIntfcMsgHdlr(errorConcealmentIntfcCI);
    79     CleanupStack::PushL( self );
    80     self->ConstructL();
    81     CleanupStack::Pop( self );
    82 
    83     return self;
    84     }
    85 
    86 // Destructor
    87 EXPORT_C CG729DecoderIntfcMsgHdlr::~CG729DecoderIntfcMsgHdlr()
    88 	{
    89 	delete iG729DecoderIntfcCI;
    90 	}
    91 
    92 // ---------------------------------------------------------
    93 // CG729DecoderIntfcMsgHdlr::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
    97 // trap.
    98 // (other items were commented in a header).
    99 // ---------------------------------------------------------
   100 //
   101 EXPORT_C void CG729DecoderIntfcMsgHdlr::HandleRequest(
   102                                                        TMMFMessage& aMessage)
   103 	{
   104 	ASSERT(aMessage.Destination().InterfaceId() == KUidG729DecoderIntfc);
   105 	TRAPD(error,DoHandleRequestL(aMessage));
   106 	if(error)
   107 		{
   108 		aMessage.Complete(error);
   109 		}
   110 	}
   111 
   112 // ---------------------------------------------------------
   113 // CG729DecoderIntfcMsgHdlr::DoHandleRequestL
   114 // Determines which custom interface to call.
   115 // (other items were commented in a header).
   116 // ---------------------------------------------------------
   117 //
   118 void CG729DecoderIntfcMsgHdlr::DoHandleRequestL(TMMFMessage& aMessage)
   119 	{
   120 	switch(aMessage.Function())
   121 		{
   122 		case EG729dimBadLsfNextBuffer:
   123 			{
   124     		DoBadLsfNextBufferL(aMessage);
   125 			break;
   126 			}
   127 		default:
   128 			{
   129 			aMessage.Complete(KErrNotSupported);
   130 			}
   131 		}
   132 	}
   133 
   134 // ---------------------------------------------------------
   135 // CG729DecoderIntfcMsgHdlr::DoBadLsfNextBufferL
   136 // Handles the message from the proxy and calls the custom interface method.
   137 // The data passed from the proxy is read from the message and passed to
   138 // the custom interface.
   139 // (other items were commented in a header).
   140 // ---------------------------------------------------------
   141 //
   142 void CG729DecoderIntfcMsgHdlr::DoBadLsfNextBufferL(TMMFMessage& aMessage)
   143     {
   144 	TInt status = iG729DecoderIntfcCI->BadLsfNextBuffer();
   145     aMessage.Complete(status);
   146     }
   147     
   148 
   149 
   150 // End of File