multimediacommscontroller/mmccinterface/src/mmcccodecinformationfactory.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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 "mmcccodecinformationfactory.h"
       
    24 #include "mmcccodecinformation.h"
       
    25 #include "mmcccodecamr.h"
       
    26 #include "mmcccodecg711.h"
       
    27 #include "mmcccodecg729.h"
       
    28 #include "mmcccodecilbc.h"
       
    29 #include "mmcccodech263.h"
       
    30 #include "mmcccodecavc.h"
       
    31 #include "mmcccodecred.h"
       
    32 #include "mmcccodecdtmf.h"
       
    33 #include "mmcccodeccn.h"
       
    34 #include "mmcccodecamrwb.h"
       
    35 
       
    36 
       
    37 // ============================= LOCAL FUNCTIONS ===============================
       
    38 
       
    39 
       
    40 // ============================ MEMBER FUNCTIONS ===============================
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CMccCodecInformationFactory::CMccCodecInformationFactory
       
    44 // C++ default constructor can NOT contain any code, that
       
    45 // might leave.
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CMccCodecInformationFactory::CMccCodecInformationFactory()
       
    49     {
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CMccCodecInformationFactory::NewL
       
    54 // Two-phased constructor.
       
    55 // -----------------------------------------------------------------------------
       
    56 //
       
    57 EXPORT_C CMccCodecInformationFactory* CMccCodecInformationFactory::NewL()
       
    58     {
       
    59     CMccCodecInformationFactory* self = new( ELeave ) CMccCodecInformationFactory;
       
    60     
       
    61     // Nothing else to do, so return
       
    62     return self;
       
    63     }
       
    64 
       
    65     
       
    66 // Destructor
       
    67 CMccCodecInformationFactory::~CMccCodecInformationFactory()
       
    68     {
       
    69     }
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // CMccCodecInformationFactory::CreateCodecInformationL
       
    73 // Factory method for codec information instance creation.
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C CMccCodecInformation* CMccCodecInformationFactory::CreateCodecInformationL(
       
    77     const TDesC8& aSdpName )
       
    78     {
       
    79     CMccCodecInformation* codec = NULL;
       
    80 
       
    81     if ( !aSdpName.CompareF( KAMRSdpName ))
       
    82         {
       
    83         codec = CMccCodecAMR::NewL();
       
    84         CleanupStack::PushL( codec );
       
    85         }
       
    86     else if ( !aSdpName.CompareF( KAMRWbSdpName ))
       
    87         {
       
    88         codec = CMccCodecAmrWb::NewL();
       
    89         CleanupStack::PushL( codec );
       
    90         }
       
    91     else if ( !aSdpName.CompareF( KPCMUSdpName ) ||
       
    92               !aSdpName.CompareF( KPCMASdpName ))
       
    93         {
       
    94         codec = CMCCCodecG711::NewL();
       
    95         CleanupStack::PushL( codec );
       
    96         codec->SetSdpName( aSdpName );
       
    97         }
       
    98     else if ( !aSdpName.CompareF( KILBCSdpName ))
       
    99         {
       
   100         codec = CMCCCodecILBC::NewL();
       
   101         CleanupStack::PushL( codec );
       
   102         }
       
   103     else if ( !aSdpName.CompareF( KG729SdpName ))
       
   104         {
       
   105         codec = CMCCCodecG729::NewL();
       
   106         CleanupStack::PushL( codec );
       
   107         }
       
   108     else if ( !aSdpName.CompareF( KH263SdpName ) ||
       
   109               !aSdpName.CompareF( KH2632000SdpName ))
       
   110         {
       
   111         codec = CMccCodecH263::NewL();
       
   112         CleanupStack::PushL( codec );
       
   113         }
       
   114     else if ( !aSdpName.CompareF( KH2631998SdpName ))
       
   115         {
       
   116         codec = CMccCodecH263::NewL();
       
   117         CleanupStack::PushL( codec );
       
   118         codec->SetSdpName( KH2631998SdpName );
       
   119         }
       
   120     else if ( !aSdpName.CompareF( KAVCSdpName ))
       
   121         {
       
   122         codec = CMccCodecAVC::NewL();
       
   123         CleanupStack::PushL( codec );
       
   124         }
       
   125     else if ( !aSdpName.CompareF( KRedSdpName ))
       
   126         {
       
   127         codec = CMccCodecRed::NewL();
       
   128         CleanupStack::PushL( codec );
       
   129         }
       
   130     else if( !aSdpName.CompareF( KTelephoneEvent ) ) 
       
   131         {
       
   132         codec = CMccCodecDTMF::NewL();
       
   133         CleanupStack::PushL( codec );
       
   134         }
       
   135     else if( !aSdpName.CompareF( KCnSdpName ) ) 
       
   136         {
       
   137         codec = CMccCodecCn::NewL();
       
   138         CleanupStack::PushL( codec );
       
   139         }
       
   140     else
       
   141         {
       
   142         User::Leave( KErrNotSupported );
       
   143         }
       
   144     CleanupStack::Pop( codec );
       
   145     return codec;
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CMccCodecInformationFactory::CreateCodecInformationL
       
   150 // Factory method for codec information instance creation.
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 EXPORT_C CMccCodecInformation* CMccCodecInformationFactory::CreateCodecInformationL(
       
   154     TFourCC aFourCC )
       
   155     {
       
   156     CMccCodecInformation* codec = NULL;
       
   157 
       
   158     if ( aFourCC == KMccFourCCIdAMRNB )
       
   159         {
       
   160         codec = CMccCodecAMR::NewL();
       
   161         }
       
   162     else if ( aFourCC == KMccFourCCIdAMRWB )
       
   163         {
       
   164         codec = CMccCodecAmrWb::NewL();
       
   165         }
       
   166     else if ( aFourCC == KMccFourCCIdH263 )
       
   167         {
       
   168         codec = CMccCodecH263::NewL();
       
   169         }
       
   170     else if( aFourCC == KMccFourCCIdDTMF ) 
       
   171         {
       
   172         codec = CMccCodecDTMF::NewL();
       
   173         }
       
   174     else if ( aFourCC == KMccFourCCIdAVC )
       
   175         {
       
   176         codec = CMccCodecAVC::NewL();
       
   177         }        
       
   178     else if ( aFourCC == KMccFourCCIdG711 )
       
   179         {
       
   180         codec = CMCCCodecG711::NewL();
       
   181         }        
       
   182     else if ( aFourCC == KMccFourCCIdILBC )
       
   183         {
       
   184         codec = CMCCCodecILBC::NewL();
       
   185         }              
       
   186     else if ( aFourCC == KMccFourCCIdG729 )
       
   187         {
       
   188         codec = CMCCCodecG729::NewL();
       
   189         }
       
   190     else if ( aFourCC == KMccFourCCIdRed )
       
   191         {
       
   192         codec = CMccCodecRed::NewL();
       
   193         }
       
   194     else if ( aFourCC == KMccFourCCIdCN )
       
   195         {
       
   196         codec = CMccCodecCn::NewL();
       
   197         }
       
   198     else
       
   199         {
       
   200         User::Leave( KErrNotSupported );
       
   201         }
       
   202         
       
   203     return codec;
       
   204     }
       
   205     
       
   206 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   207 
       
   208 
       
   209 //  End of File