multimediacommscontroller/mmccinterface/src/mmcccodecmsrp.cpp
branchrcs
changeset 49 64c62431ac08
equal deleted inserted replaced
44:fb024d5e35fa 49:64c62431ac08
       
     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:    Factory class to create Codec information instances
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include "mmcccodecmsrp.h"
       
    24 #include "mccuids.hrh"
       
    25 #include "mmccinterfacelogs.h"
       
    26 
       
    27 
       
    28 // EXTERNAL DATA STRUCTURES
       
    29 
       
    30 // EXTERNAL FUNCTION PROTOTYPES  
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // MACROS
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 
       
    38 // MODULE DATA STRUCTURES
       
    39 
       
    40 // LOCAL FUNCTION PROTOTYPES
       
    41 
       
    42 // FORWARD DECLARATIONS
       
    43 
       
    44 // ============================= LOCAL FUNCTIONS ===============================
       
    45 
       
    46 // ============================ MEMBER FUNCTIONS ===============================
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CMccCodecMsrp::CMccCodecMsrp
       
    50 // C++ default constructor can NOT contain any code, that
       
    51 // might leave.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CMccCodecMsrp::CMccCodecMsrp() : CMccCodecInformation()
       
    55     {
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CMccCodecMsrp::ConstructL
       
    60 // Symbian 2nd phase constructor can leave.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 void CMccCodecMsrp::ConstructL()
       
    64     {
       
    65     iSdpName.Copy( KMSRPSdpName );
       
    66 	iType = KUidMediaTypeMessage;
       
    67 
       
    68     iHwFrameTime = 20;
       
    69     iFrameSize = 20;
       
    70     SetSamplingFreq( 1000 );
       
    71     SetBitrate( 64 );
       
    72     EnableVAD( EFalse );
       
    73     SetMaxPTime( 100 );
       
    74     SetPTime( 20 );
       
    75     iFourCC = KMccFourCCIdMSRP;
       
    76     iPayloadFormatEncoder = KImplUidMsrpPayloadFormatEncode;
       
    77     iPayloadFormatDecoder = KImplUidMsrpPayloadFormatDecode;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CMccCodecMsrp::NewL
       
    82 // Two-phased constructor.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 CMccCodecMsrp* CMccCodecMsrp::NewL()
       
    86     {
       
    87     CMccCodecMsrp* self = new( ELeave ) CMccCodecMsrp;
       
    88     
       
    89     CleanupStack::PushL( self );
       
    90     self->ConstructL();
       
    91     CleanupStack::Pop( self );
       
    92 
       
    93     return self;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CMccCodecMsrp::~CMccCodecMsrp
       
    98 // 
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 CMccCodecMsrp::~CMccCodecMsrp()
       
   102     {
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CMccCodecMsrp::RequireSignalling
       
   107 // -----------------------------------------------------------------------------
       
   108 //
       
   109 TBool CMccCodecMsrp::RequireSignalling(
       
   110     const CMccCodecInformation& aCandidate ) const      
       
   111     {
       
   112     __INTERFACE( "CMccCodecMsrp::RequireSignalling" )
       
   113     TBool ret = EFalse;
       
   114               
       
   115     if ( iPTime != aCandidate.PTime() )
       
   116         {
       
   117         __INTERFACE( "CMccCodecMsrp::RequireSignalling, PTime changed" )
       
   118         ret = ETrue;
       
   119         }
       
   120         
       
   121     if ( iMaxPTime != aCandidate.MaxPTime() )
       
   122         {
       
   123         __INTERFACE( "CMccCodecMsrp::RequireSignalling, MaxPTime changed" )
       
   124         ret = ETrue;
       
   125         }
       
   126         
       
   127     if ( iPayloadType != aCandidate.PayloadType() )
       
   128         {
       
   129         __INTERFACE( "CMccCodecMsrp::RequireSignalling, PayloadType changed" )
       
   130         ret = ETrue;
       
   131         }
       
   132 
       
   133     if ( iBitrateMask != aCandidate.AllowedBitrates() )
       
   134         {
       
   135         __INTERFACE( "CMccCodecMsrp::RequireSignalling, BitrateMask changed" )
       
   136         ret = ETrue;
       
   137         }
       
   138 
       
   139     if ( iCodecMode != aCandidate.CodecMode() )
       
   140         {
       
   141         __INTERFACE( "CMccCodecMsrp::RequireSignalling, CodecMode changed" )
       
   142         ret = ETrue;
       
   143         }
       
   144         
       
   145     if ( iSamplingFreq != aCandidate.SamplingFreq() )
       
   146         {
       
   147         __INTERFACE( "CMccCodecMsrp::RequireSignalling, SamplingFreq changed" )
       
   148         ret = ETrue;
       
   149         }     
       
   150         
       
   151     if ( iMaxBitrate != aCandidate.MaxBitrate() )
       
   152         {
       
   153         __INTERFACE( "CMccCodecMsrp::RequireSignalling, MaxBitrate changed" )
       
   154         ret = ETrue;
       
   155         }
       
   156              
       
   157     __INTERFACE_INT1( "CMccCodecMsrp::RequireSignalling, exit with", ret )
       
   158     return ret;          
       
   159     }
       
   160  
       
   161 // -----------------------------------------------------------------------------
       
   162 // CMccCodecMsrp::SetBitrate
       
   163 // Sets the bitrate used with AMR codec.
       
   164 // -----------------------------------------------------------------------------
       
   165 //
       
   166 TInt CMccCodecMsrp::SetBitrate( TUint aBitrate )
       
   167     {
       
   168     
       
   169     // Not supported
       
   170     iBitrate = aBitrate;
       
   171     return KErrNone;
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CMccCodecMsrp::SetSamplingFreq
       
   176 // Sets the sampling frequency. 
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 TInt CMccCodecMsrp::SetSamplingFreq( TUint32 aSamplingFreq )
       
   180     {
       
   181     // Not supported
       
   182     
       
   183     iSamplingFreq = aSamplingFreq;
       
   184     return KErrNone;
       
   185     }
       
   186     
       
   187 // -----------------------------------------------------------------------------
       
   188 // CMccCodecMsrp::SetSdpName
       
   189 // Sets the SDP name
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 TInt CMccCodecMsrp::SetSdpName( const TDesC8& aSdpName )
       
   193     {
       
   194     // Not supported
       
   195     iSdpName.Copy( aSdpName );
       
   196     
       
   197     return KErrNone;
       
   198     }
       
   199 
       
   200 // -----------------------------------------------------------------------------
       
   201 // CMccCodecMsrp::PayloadType
       
   202 // Sets the payload type
       
   203 // -----------------------------------------------------------------------------
       
   204 //
       
   205 TInt CMccCodecMsrp::SetPayloadType( TUint8 /*aPayloadType*/ )
       
   206     {
       
   207     // Not supported
       
   208     TUint8 aPayloadType = KPayloadType; // dummy value for messgae codec payload type aPayloadType;
       
   209     iPayloadType = aPayloadType;
       
   210     
       
   211     return KErrNone;
       
   212     }
       
   213     
       
   214 // -----------------------------------------------------------------------------
       
   215 // CMccCodecMsrp::SetCodecMode
       
   216 // Sets the codec mode.
       
   217 // -----------------------------------------------------------------------------
       
   218 //
       
   219 TInt CMccCodecMsrp::SetCodecMode( TCodecMode aCodecMode )
       
   220     {
       
   221     // Not supported
       
   222     iCodecMode = aCodecMode;
       
   223     return KErrNone;
       
   224     }
       
   225  
       
   226 // -----------------------------------------------------------------------------
       
   227 // CMccCodecMsrp::EnableVAD
       
   228 // Enable / Disable VAD
       
   229 // -----------------------------------------------------------------------------
       
   230 //
       
   231 TInt CMccCodecMsrp::EnableVAD( TBool /*aEnableVAD*/ ) 
       
   232     {
       
   233     // Not supported
       
   234     return KErrNone;
       
   235     }
       
   236     
       
   237 // -----------------------------------------------------------------------------
       
   238 // CMccCodecMsrp::SetPTime
       
   239 // Set PTime
       
   240 // -----------------------------------------------------------------------------
       
   241 //
       
   242 TInt CMccCodecMsrp::SetPTime( TUint /*aPTime*/ )
       
   243     {
       
   244     // Not supported
       
   245     return KErrNone;
       
   246     }
       
   247     
       
   248 // -----------------------------------------------------------------------------
       
   249 // CMccCodecMsrp::SetMaxPTime
       
   250 // Set Max PTime
       
   251 // -----------------------------------------------------------------------------
       
   252 //
       
   253 TInt CMccCodecMsrp::SetMaxPTime( TUint /*aMaxPTime*/ )
       
   254     {
       
   255     // Not supported
       
   256     return KErrNone;
       
   257     }
       
   258     
       
   259 // -----------------------------------------------------------------------------
       
   260 // CMccCodecMsrp::CloneDefaultsL
       
   261 // Make a default setting clone from this codec
       
   262 // -----------------------------------------------------------------------------
       
   263 //
       
   264 CMccCodecInformation* CMccCodecMsrp::CloneDefaultsL()
       
   265     {
       
   266     return CMccCodecMsrp::NewL();
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CMccCodecMsrp::CloneDetailedL
       
   271 // Make a detailed clone from this codec
       
   272 // -----------------------------------------------------------------------------
       
   273 //
       
   274 CMccCodecInformation* CMccCodecMsrp::CloneDetailedL()
       
   275     {
       
   276     CMccCodecMsrp* newCodec = CMccCodecMsrp::NewL();
       
   277     CleanupStack::PushL( newCodec );       
       
   278     newCodec->SetBitrate( this->Bitrate() );
       
   279     newCodec->SetCodecMode( this->CodecMode() );
       
   280     newCodec->SetMaxPTime( this->MaxPTime() );
       
   281     newCodec->SetPayloadType( this->PayloadType() );
       
   282     newCodec->SetPTime( this->PTime() );
       
   283     newCodec->SetSamplingFreq( this->SamplingFreq() );
       
   284     newCodec->SetSdpName( this->SdpName() );
       
   285     CleanupStack::Pop( newCodec );   
       
   286     return newCodec;
       
   287     }
       
   288         
       
   289 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   290 
       
   291 //  End of File