multimediacommsengine/mmceshared/src/mcecomcncodec.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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 
       
    20 
       
    21 #include "mcecncodec.h"
       
    22 #include "mcecomcncodec.h"
       
    23 
       
    24 #ifdef MCE_COMMON_SERVER_SIDE
       
    25 
       
    26 #include "mcecomaudiostream.h"
       
    27 
       
    28 #endif//MCE_COMMON_SERVER_SIDE
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // CMceComCnCodec::NewL
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CMceComCnCodec* CMceComCnCodec::NewL( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
    37     {
       
    38     CMceComCnCodec* self = NewLC( aSdpName );
       
    39     CleanupStack::Pop( self );
       
    40     return self;
       
    41     
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CMceComCnCodec::NewLC
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CMceComCnCodec* CMceComCnCodec::NewLC( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
    49     {
       
    50     CMceComCnCodec* self = new (ELeave) CMceComCnCodec();
       
    51     CleanupStack::PushL( self );
       
    52     self->ConstructL( aSdpName );
       
    53     return self;
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CMceComCnCodec::~CMceComCnCodec
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CMceComCnCodec::~CMceComCnCodec()
       
    62     {
       
    63     }
       
    64     
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CMceComCnCodec::CMceComCnCodec
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CMceComCnCodec::CMceComCnCodec()
       
    71  : CMceComAudioCodec()
       
    72     {
       
    73     iState = CMceCodec::EDisabled; // NOTE: Cn is in disabled state by default
       
    74     
       
    75     iFourCC = 0;
       
    76     iEnableVAD = EFalse;
       
    77     iSamplingFreq  = KMceCnSamplingFreq;
       
    78     iPTime = KMceCnDefaultPtime;
       
    79     iMaxPTime = KMceCnDefaultMaxPtime;
       
    80     iPayloadType = KMceDefaultCnPayloadType;
       
    81     
       
    82     // valid default codec mode is needed for MCC codec interaction
       
    83     const TUint KCnCodecMode = 1;
       
    84     iCodecMode = KCnCodecMode;
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CMceComCnCodec::SendSupported
       
    89 // -----------------------------------------------------------------------------
       
    90 //
       
    91 TBool CMceComCnCodec::SendSupported()
       
    92     {
       
    93     return EFalse;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMceComCnCodec::ConstructL
       
    98 // -----------------------------------------------------------------------------
       
    99 //
       
   100 CMceComAudioCodec* CMceComCnCodec::CloneL()
       
   101     {
       
   102     CMceComCnCodec* copy = new (ELeave) CMceComCnCodec();
       
   103     CleanupStack::PushL( copy );
       
   104     copy->ConstructL( *this );
       
   105     CleanupStack::Pop( copy );
       
   106     return copy;
       
   107     
       
   108     }
       
   109 
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CMceComCnCodec::ConstructL
       
   113 // -----------------------------------------------------------------------------
       
   114 //
       
   115 void CMceComCnCodec::ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName )
       
   116     {
       
   117     CMceComAudioCodec::ConstructL( aSdpName );
       
   118     }
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CMceComCnCodec::ConstructL
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void CMceComCnCodec::ConstructL( CMceComCnCodec& aCodec )
       
   126     {
       
   127     CMceComAudioCodec::ConstructL( aCodec );
       
   128     }
       
   129 
       
   130 #ifdef MCE_COMMON_SERVER_SIDE
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CMceComCnCodec::DoDecodeAudioL
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CMceComCnCodec::DoDecodeAudioL( 
       
   137     TInt aCodecIndex,
       
   138     RPointerArray<CMceSrvStream>& /*aStreams*/,
       
   139     CMceComAudioStream& aAudio,
       
   140     CMceMediaManager& /*aManager*/ )
       
   141     {
       
   142     // Special handling for comfort noise codecs, cn settings affect
       
   143     // to other codecs.
       
   144     //
       
   145     const TInt codecCount = aAudio.CodecCount();
       
   146     
       
   147     for ( TInt i = 0 ; i < codecCount ; ++i )
       
   148         {
       
   149         aAudio.CodecL( i )->iComfortNoiseEnabled = ETrue;
       
   150         
       
   151         // As cn cannot be used for streaming, select some other codec
       
   152         // for sending. 
       
   153         UpdateSendCodec( aCodecIndex, aAudio, *aAudio.CodecL( i ) );
       
   154         }
       
   155     }
       
   156     
       
   157 #endif
       
   158 
       
   159 
       
   160 // End of File
       
   161