mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/src/mceamrcodec.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mceamrcodec.h"
       
    20 
       
    21 // ============================ MEMBER FUNCTIONS ===============================
       
    22 
       
    23 // -----------------------------------------------------------------------------
       
    24 // CMceAmrCodec::~CMceAmrCodec
       
    25 // -----------------------------------------------------------------------------
       
    26 //
       
    27 EXPORT_C CMceAmrCodec::~CMceAmrCodec()
       
    28     {
       
    29     }
       
    30     
       
    31 // -----------------------------------------------------------------------------
       
    32 // CMceAmrCodec::CloneL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CMceAudioCodec* CMceAmrCodec::CloneL() const
       
    36     {
       
    37     CMceAmrCodec* clone = CMceAmrCodec::NewLC( iSdpName );
       
    38     
       
    39     if ( iFmtpAttr )
       
    40 	    {
       
    41         clone->iFmtpAttr = iFmtpAttr->AllocL();
       
    42         }
       
    43     clone->iEnableVAD = iEnableVAD;
       
    44 	clone->iSamplingFreq = iSamplingFreq;
       
    45 	clone->iPTime = iPTime;
       
    46 	clone->iMaxPTime = iMaxPTime;
       
    47 	clone->iBitrate = iBitrate;
       
    48 	clone->iAllowedBitrates = iAllowedBitrates;
       
    49 	clone->iPayloadType = iPayloadType;
       
    50 	clone->iCodecMode = iCodecMode;
       
    51 	clone->iFourCC = iFourCC;
       
    52 	clone->iFrameSize = iFrameSize;
       
    53 	
       
    54 	CleanupStack::Pop( clone );
       
    55 	
       
    56 	return clone;
       
    57     }
       
    58     
       
    59 // -----------------------------------------------------------------------------
       
    60 // CMceAmrCodec::EnableVAD
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C TInt CMceAmrCodec::EnableVAD( TBool aEnableVAD )
       
    64     {
       
    65     iEnableVAD = aEnableVAD;
       
    66     return KErrNone;
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CMceAmrCodec::SetBitrate
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 EXPORT_C TInt CMceAmrCodec::SetBitrate(TUint aBitrate)
       
    74     {
       
    75     iBitrate = aBitrate;
       
    76     return KErrNone;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CMceAmrCodec::SetAllowedBitrates
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 EXPORT_C TInt CMceAmrCodec::SetAllowedBitrates(TUint aBitrates)
       
    84     {
       
    85     iAllowedBitrates = aBitrates;
       
    86     return KErrNone;
       
    87     }
       
    88     
       
    89 // -----------------------------------------------------------------------------
       
    90 // CMceAmrCodec::SetSamplingFreq
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 EXPORT_C TInt CMceAmrCodec::SetSamplingFreq(TUint aSamplingFreq)
       
    94     {
       
    95     iSamplingFreq = aSamplingFreq;
       
    96     return KErrNone;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CMceAmrCodec::SetPTime
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 EXPORT_C TInt CMceAmrCodec::SetPTime(TUint aPTime)
       
   104     {
       
   105     iPTime = aPTime;
       
   106     return KErrNone;
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // CMceAmrCodec::SetMaxPTime
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 EXPORT_C TInt CMceAmrCodec::SetMaxPTime(TUint aMaxPTime)
       
   114     {
       
   115     iMaxPTime = aMaxPTime;
       
   116     return KErrNone;
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CMceAmrCodec::SetPayloadType
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 EXPORT_C TInt CMceAmrCodec::SetPayloadType(TUint8 aPayloadType)
       
   124     {
       
   125     iPayloadType = aPayloadType;
       
   126     return KErrNone;
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CMceAmrCodec::SetCodecMode
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 EXPORT_C TInt CMceAmrCodec::SetCodecMode(TUint aCodecMode)
       
   134     {
       
   135     iCodecMode = aCodecMode;
       
   136     return KErrNone;
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // CMceAmrCodec::NewL
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 CMceAmrCodec* CMceAmrCodec::NewL( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
   144     {
       
   145     CMceAmrCodec* self = NewLC( aSdpName );
       
   146     CleanupStack::Pop( self );
       
   147     return self;
       
   148     
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CMceAmrCodec::NewL
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 CMceAmrCodec* CMceAmrCodec::NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
   156     {
       
   157     CMceAmrCodec* self = new (ELeave) CMceAmrCodec();
       
   158     CleanupStack::PushL( self );
       
   159     self->ConstructL( aSdpName );
       
   160     return self;
       
   161     
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CMceAmrCodec::CMceAmrCodec
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 CMceAmrCodec::CMceAmrCodec()
       
   169  : CMceAudioCodec()
       
   170     {
       
   171     }
       
   172 
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CMceAmrCodec::ConstructL
       
   176 // -----------------------------------------------------------------------------
       
   177 //
       
   178 void CMceAmrCodec::ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
   179     {
       
   180     iSdpName = aSdpName;
       
   181     }
       
   182 
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // CMceAmrCodec::SetSdpNameL
       
   186 // -----------------------------------------------------------------------------
       
   187 //
       
   188 void CMceAmrCodec::SetSdpNameL( const TDesC8& aSdpName )
       
   189     {
       
   190     __ASSERT_ALWAYS( aSdpName.Length() <= KMceMaxSdpNameLength, 
       
   191                      User::Leave( KErrArgument ) );
       
   192     iSdpName.Copy( aSdpName );
       
   193     }
       
   194