richcallsettingsengine/rcse2/src/crcseaudiocodecentry.cpp
changeset 0 a4daefaec16c
child 20 65a3ef1d5bd0
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  Audio codec entry, which is stored to db
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	<featmgr.h>
       
    22 
       
    23 #include    "crcseaudiocodecentry.h"
       
    24 #include    "rcseconstants.h"
       
    25 #include    "rcsepanic.h"
       
    26 #include    "rcsedefaults.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CRCSEAudioCodecEntry::NewL
       
    32 // Two-phased constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 EXPORT_C CRCSEAudioCodecEntry* CRCSEAudioCodecEntry::NewL()
       
    36     {
       
    37     CRCSEAudioCodecEntry* self = NewLC();
       
    38     CleanupStack::Pop( self );
       
    39     return self;
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // CRCSEAudioCodecEntry::NewLC
       
    44 // Two-phased constructor.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C CRCSEAudioCodecEntry* CRCSEAudioCodecEntry::NewLC()
       
    48     {
       
    49     CRCSEAudioCodecEntry* self = new (ELeave) CRCSEAudioCodecEntry();
       
    50     CleanupStack::PushL( self );
       
    51     self->ConstructL();
       
    52     self->ResetDefaultCodecValues();
       
    53     return self;
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CRCSEAudioCodecEntry::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CRCSEAudioCodecEntry::ConstructL()
       
    62     {
       
    63     // Check VoIP support from feature manager
       
    64     FeatureManager::InitializeLibL();
       
    65     TBool support = FeatureManager::FeatureSupported( KFeatureIdCommonVoip );
       
    66     FeatureManager::UnInitializeLib();
       
    67     if (!support)
       
    68         {
       
    69         User::Leave(KErrNotSupported);
       
    70         }
       
    71     }
       
    72  
       
    73 // -----------------------------------------------------------------------------
       
    74 // CRCSEAudioCodecEntry::CRCSEAudioCodecEntry
       
    75 // C++ default constructor can NOT contain any code, that
       
    76 // might leave.
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 CRCSEAudioCodecEntry::CRCSEAudioCodecEntry()
       
    80     {
       
    81     }
       
    82     
       
    83 // Destructor
       
    84 EXPORT_C CRCSEAudioCodecEntry::~CRCSEAudioCodecEntry()
       
    85     {
       
    86     iChannels.Reset();
       
    87     iChannels.Close(); 
       
    88     
       
    89     iModeSet.Reset();
       
    90     iModeSet.Close();      
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CRCSEAudioCodecEntry::SetDefaultCodecValueSet
       
    95 // Sets default parameter values separately for each codec.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 EXPORT_C void CRCSEAudioCodecEntry::SetDefaultCodecValueSet( TPtrC aCodecType )
       
    99     {
       
   100     
       
   101     if ( aCodecType == KAudioCodecAMR )
       
   102         {
       
   103         iCodecId                  = 0;
       
   104         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   105         iMediaSubTypeName         = KAudioCodecAMR;
       
   106         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   107         iOctetAlign               = EOff;
       
   108         iModeSet.Reset();
       
   109         iModeChangePeriod         = KNotSet;
       
   110         iModeChangeNeighbor       = EOn;
       
   111         iPtime                    = 20;
       
   112         iMaxptime                 = KRCSEDefaultMaxptime;
       
   113         iCrc                      = EOONotSet;
       
   114         iRobustSorting            = EOONotSet;
       
   115         iInterLeaving             = KNotSet;
       
   116         iChannels.Append(1);
       
   117         iVAD                      = EOff;
       
   118         iDTX                      = EOff;
       
   119         iSamplingRate             = KNotSet;
       
   120         iAnnexb                   = EOONotSet;
       
   121         iModeChangeCapability     = KNotSet;
       
   122         iMaxRed                   = KNotSet;
       
   123         }
       
   124     else if ( aCodecType == KAudioCodeciLBC )
       
   125         {
       
   126         iCodecId                  = 0;
       
   127         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   128         iMediaSubTypeName         = KAudioCodeciLBC;
       
   129         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   130         iOctetAlign               = EOONotSet;
       
   131         iModeSet.Reset();
       
   132         iModeSet.Append(30);
       
   133         iModeChangePeriod         = KNotSet;
       
   134         iModeChangeNeighbor       = EOONotSet;
       
   135         iPtime                    = 30;
       
   136         iMaxptime                 = 180;
       
   137         iCrc                      = EOONotSet;
       
   138         iRobustSorting            = EOONotSet;
       
   139         iInterLeaving             = KNotSet;
       
   140         iChannels.Reset();
       
   141         iVAD                      = EOff;
       
   142         iDTX                      = EOff;
       
   143         iSamplingRate             = KNotSet;
       
   144         iAnnexb                   = EOONotSet;    
       
   145         iModeChangeCapability     = KNotSet;
       
   146         iMaxRed                   = KNotSet;
       
   147         }
       
   148     else if (aCodecType == KAudioCodecVMRWB)
       
   149         {
       
   150         iCodecId                  = 0;
       
   151         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   152         iMediaSubTypeName         = KAudioCodecVMRWB;
       
   153         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   154         iOctetAlign               = EOff;
       
   155         iModeSet.Reset();
       
   156         iModeChangePeriod         = KNotSet;
       
   157         iModeChangeNeighbor       = EOONotSet;
       
   158         iPtime                    = KNotSet;
       
   159         iMaxptime                 = KRCSEDefaultMaxptime;
       
   160         iCrc                      = EOONotSet;
       
   161         iRobustSorting            = EOONotSet;
       
   162         iInterLeaving             = KNotSet;
       
   163         iChannels.Reset();
       
   164         iVAD                      = EOONotSet;
       
   165         iDTX                      = EOff;
       
   166         iSamplingRate             = KNotSet;
       
   167         iAnnexb                   = EOONotSet;        
       
   168         iModeChangeCapability     = KNotSet;
       
   169         iMaxRed                   = KNotSet;
       
   170         }
       
   171     else if (aCodecType == KAudioCodecPCMA)
       
   172         {
       
   173         iCodecId                  = 0;
       
   174         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   175         iMediaSubTypeName         = KAudioCodecPCMA;
       
   176         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   177         iOctetAlign               = EOn;
       
   178         iModeSet.Reset();
       
   179         iModeChangePeriod         = KNotSet;
       
   180         iModeChangeNeighbor       = EOONotSet;
       
   181         iPtime                    = 20;
       
   182         iMaxptime                 = KRCSEDefaultMaxptime;
       
   183         iCrc                      = EOONotSet;
       
   184         iRobustSorting            = EOONotSet;
       
   185         iInterLeaving             = KNotSet;
       
   186         iChannels.Reset();
       
   187         iVAD                      = EOff;
       
   188         iDTX                      = EOff;
       
   189         iSamplingRate             = KNotSet;
       
   190         iAnnexb                   = EOONotSet;    
       
   191         iModeChangeCapability     = KNotSet;
       
   192         iMaxRed                   = KNotSet;
       
   193         }
       
   194     else if (aCodecType == KAudioCodecPCMU)
       
   195         {
       
   196         iCodecId                  = 0;
       
   197         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   198         iMediaSubTypeName         = KAudioCodecPCMU;
       
   199         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   200         iOctetAlign               = EOn;
       
   201         iModeSet.Reset();
       
   202         iModeChangePeriod         = KNotSet;
       
   203         iModeChangeNeighbor       = EOONotSet;
       
   204         iPtime                    = 20;
       
   205         iMaxptime                 = KRCSEDefaultMaxptime;
       
   206         iCrc                      = EOONotSet;
       
   207         iRobustSorting            = EOONotSet;
       
   208         iInterLeaving             = KNotSet;
       
   209         iChannels.Reset();
       
   210         iVAD                      = EOff;
       
   211         iDTX                      = EOff;
       
   212         iSamplingRate             = KNotSet;
       
   213         iAnnexb                   = EOONotSet;
       
   214         iModeChangeCapability     = KNotSet;
       
   215         iMaxRed                   = KNotSet;
       
   216         }
       
   217     else if (aCodecType == KAudioCodecCN)
       
   218         {
       
   219         iCodecId                  = 0;
       
   220         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   221         iMediaSubTypeName         = KAudioCodecCN;
       
   222         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   223         iOctetAlign               = EOONotSet;
       
   224         iModeSet.Reset();
       
   225         iModeChangePeriod         = KNotSet;
       
   226         iModeChangeNeighbor       = EOONotSet;
       
   227         iPtime                    = KNotSet;
       
   228         iMaxptime                 = KNotSet;
       
   229         iCrc                      = EOONotSet;
       
   230         iRobustSorting            = EOONotSet;
       
   231         iInterLeaving             = KNotSet;
       
   232         iChannels.Reset();
       
   233         iVAD                      = EOff;
       
   234         iDTX                      = EOONotSet;
       
   235         iSamplingRate             = 8000;
       
   236         iAnnexb                   = EOONotSet;
       
   237         iModeChangeCapability     = KNotSet;
       
   238         iMaxRed                   = KNotSet;
       
   239         }
       
   240     else if (aCodecType == KAudioCodecG729)
       
   241         {
       
   242         iCodecId                  = 0;
       
   243         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   244         iMediaSubTypeName         = KAudioCodecG729;
       
   245         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   246         iOctetAlign               = EOONotSet;
       
   247         iModeSet.Reset();
       
   248         iModeChangePeriod         = KNotSet;
       
   249         iModeChangeNeighbor       = EOONotSet;
       
   250         iPtime                    = KNotSet;
       
   251         iMaxptime                 = KRCSEDefaultMaxptime;
       
   252         iCrc                      = EOONotSet;
       
   253         iRobustSorting            = EOONotSet;
       
   254         iInterLeaving             = KNotSet;
       
   255         iChannels.Reset();
       
   256         iVAD                      = EOff;
       
   257         iDTX                      = EOff;
       
   258         iSamplingRate             = KNotSet;
       
   259         iAnnexb                   = EOONotSet;
       
   260         iModeChangeCapability     = KNotSet;
       
   261         iMaxRed                   = KNotSet;
       
   262         }
       
   263     else if (aCodecType == KAudioCodecAMRWB)
       
   264         {
       
   265         iCodecId                  = 0;
       
   266         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   267         iMediaSubTypeName         = KAudioCodecAMRWB;
       
   268         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   269         iOctetAlign               = EOff;
       
   270         iModeSet.Reset();
       
   271         iModeChangePeriod         = 2;
       
   272         iModeChangeNeighbor       = EOn;
       
   273         iPtime                    = 20;
       
   274         iMaxptime                 = KRCSEDefaultMaxptime;
       
   275         iCrc                      = EOONotSet;
       
   276         iRobustSorting            = EOONotSet;
       
   277         iInterLeaving             = KNotSet;
       
   278         iChannels.Append(1);
       
   279         iVAD                      = EOff;
       
   280         iDTX                      = EOff;
       
   281         iSamplingRate             = KNotSet;
       
   282         iAnnexb                   = EOONotSet;
       
   283         iModeChangeCapability     = KNotSet;
       
   284         iMaxRed                   = KNotSet;
       
   285         }
       
   286     else if (aCodecType == KAudioCodecEVRC)
       
   287         {
       
   288         iCodecId                  = 0;
       
   289         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   290         iMediaSubTypeName         = KAudioCodecEVRC;
       
   291         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   292         iOctetAlign               = EOONotSet;
       
   293         iModeSet.Reset();
       
   294         iModeChangePeriod         = KNotSet;
       
   295         iModeChangeNeighbor       = EOONotSet;
       
   296         iPtime                    = KNotSet;
       
   297         iMaxptime                 = KRCSEDefaultMaxptime;
       
   298         iCrc                      = EOONotSet;
       
   299         iRobustSorting            = EOONotSet;
       
   300         iInterLeaving             = 5;
       
   301         iChannels.Reset();
       
   302         iVAD                      = EOff;
       
   303         iDTX                      = EOONotSet;
       
   304         iSamplingRate             = KNotSet;
       
   305         iAnnexb                   = EOONotSet;
       
   306         iModeChangeCapability     = KNotSet;
       
   307         iMaxRed                   = KNotSet;
       
   308         }
       
   309     else if (aCodecType == KAudioCodecEVRC0)
       
   310         {
       
   311         iCodecId                  = 0;
       
   312         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   313         iMediaSubTypeName         = KAudioCodecEVRC0;
       
   314         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   315         iOctetAlign               = EOONotSet;
       
   316         iModeSet.Reset();
       
   317         iModeChangePeriod         = KNotSet;
       
   318         iModeChangeNeighbor       = EOONotSet;
       
   319         iPtime                    = KNotSet;
       
   320         iMaxptime                 = KNotSet;
       
   321         iCrc                      = EOONotSet;
       
   322         iRobustSorting            = EOONotSet;
       
   323         iInterLeaving             = KNotSet;
       
   324         iChannels.Reset();
       
   325         iVAD                      = EOff;
       
   326         iDTX                      = EOONotSet;
       
   327         iSamplingRate             = KNotSet;
       
   328         iAnnexb                   = EOONotSet;
       
   329         iModeChangeCapability     = KNotSet;
       
   330         iMaxRed                   = KNotSet;
       
   331         }
       
   332     else if (aCodecType == KAudioCodecSMV)
       
   333         {
       
   334         iCodecId                  = 0;
       
   335         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   336         iMediaSubTypeName         = KAudioCodecSMV;
       
   337         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   338         iOctetAlign               = EOONotSet;
       
   339         iModeSet.Reset();
       
   340         iModeChangePeriod         = KNotSet;
       
   341         iModeChangeNeighbor       = EOONotSet;
       
   342         iPtime                    = KNotSet;
       
   343         iMaxptime                 = KRCSEDefaultMaxptime;
       
   344         iCrc                      = EOONotSet;
       
   345         iRobustSorting            = EOONotSet;
       
   346         iInterLeaving             = 5;
       
   347         iChannels.Reset();
       
   348         iVAD                      = EOff;
       
   349         iDTX                      = EOONotSet;
       
   350         iSamplingRate             = KNotSet;
       
   351         iAnnexb                   = EOONotSet;
       
   352         iModeChangeCapability     = KNotSet;
       
   353         iMaxRed                   = KNotSet;
       
   354         }
       
   355     else if (aCodecType == KAudioCodecSMV0)
       
   356         {
       
   357         iCodecId                  = 0;
       
   358         iMediaTypeName            = KRCSEDefaultMediaTypeName;
       
   359         iMediaSubTypeName         = KAudioCodecSMV0;
       
   360         iJitterBufferSize         = KRCSEDefaultJitterBufferSize;
       
   361         iOctetAlign               = EOONotSet;
       
   362         iModeSet.Reset();
       
   363         iModeChangePeriod         = KNotSet;
       
   364         iModeChangeNeighbor       = EOONotSet;
       
   365         iPtime                    = KNotSet;
       
   366         iMaxptime                 = KNotSet;
       
   367         iCrc                      = EOONotSet;
       
   368         iRobustSorting            = EOONotSet;
       
   369         iInterLeaving             = KNotSet;
       
   370         iChannels.Reset();
       
   371         iVAD                      = EOff;
       
   372         iDTX                      = EOONotSet;
       
   373         iSamplingRate             = 8000;
       
   374         iAnnexb                   = EOONotSet;
       
   375         iModeChangeCapability     = KNotSet;
       
   376         iMaxRed                   = KNotSet;
       
   377         }
       
   378     else
       
   379         {
       
   380         iOctetAlign               = KRCSEDefaultOctetAlign;
       
   381         iModeSet.Reset();
       
   382         iModeChangePeriod         = 0;
       
   383         iModeChangeNeighbor       = KRCSEDefaultModeChangeNeighbor;
       
   384         iPtime                    = 0;
       
   385         iMaxptime                 = 0;
       
   386         iCrc                      = KRCSEDefaultCRC;
       
   387         iRobustSorting            = KRCSEDefaultRobustSorting;
       
   388         iInterLeaving             = 0;
       
   389         iChannels.Reset();
       
   390         iVAD                      = KRCSEDefaultVAD;
       
   391         iDTX                      = KRCSEDefaultDTX;
       
   392         iSamplingRate             = KNotSet;
       
   393         iAnnexb                   = EOONotSet;    
       
   394         iModeChangeCapability     = KNotSet;
       
   395         iMaxRed                   = KNotSet;
       
   396         }    
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // CRCSEAudioCodecEntry::ResetDefaultCodecValues
       
   401 // Resets codec entry to default settings.
       
   402 // -----------------------------------------------------------------------------
       
   403 //
       
   404 void CRCSEAudioCodecEntry::ResetDefaultCodecValues()
       
   405     {
       
   406     iModeSet.Reset();
       
   407     iChannels.Reset();
       
   408     // These parameters default values are same regardless used codec.
       
   409     iCodecId                 = 0;
       
   410     iMediaTypeName           = KRCSEDefaultMediaTypeName;
       
   411     iMediaSubTypeName        = KRCSEDefaultMediaSubtypeName;
       
   412     iJitterBufferSize        = KRCSEDefaultJitterBufferSize;
       
   413     
       
   414     // These parameters default values change with used codec, here there are set to KNotSet.
       
   415     iOctetAlign              = KRCSEDefaultOctetAlign;
       
   416     iModeChangePeriod        = 0;
       
   417     iModeChangeNeighbor      = KRCSEDefaultModeChangeNeighbor;
       
   418     iPtime                   = 0;
       
   419     iMaxptime                = 0;
       
   420     iCrc                     = KRCSEDefaultCRC;
       
   421     iRobustSorting           = KRCSEDefaultRobustSorting;
       
   422     iInterLeaving            = 0;
       
   423     iVAD                     = KRCSEDefaultVAD;
       
   424     iDTX                     = KRCSEDefaultDTX;
       
   425     iSamplingRate            = 0;
       
   426     iAnnexb                  = KRCSEDefaultAnnexb;
       
   427     iModeChangeCapability    = KRCSEDefaultModeChangeCapability;
       
   428     iMaxRed                  = KRCSEDefaultMaxRed;
       
   429     }
       
   430 
       
   431 //  End of File