ipappsrv_plat/multimedia_comms_api/inc/mceg711codec.h
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 #ifndef CMCEG711CODEC_H
       
    22 #define CMCEG711CODEC_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <mceaudiocodec.h>
       
    26 #include <mcedefs.h>
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // G.711 Codec bitrate
       
    31 const TUint KMceG711Bitrate64 = 64000; 
       
    32 
       
    33 const TUint KMceAllowedG711Bitrate64K = 0x0001;
       
    34 const TUint KMceAllowedG711BitrateAllowAll = 0x00FF;
       
    35 
       
    36 
       
    37 // G.711 Codec static payload type
       
    38 const TUint KMcePCMUPayloadType = 0;
       
    39 const TUint KMcePCMAPayloadType = 8; // Default
       
    40 
       
    41 // G.711 Default code mode is KMceG711PCMA
       
    42 
       
    43 // G.711 Codec modes
       
    44 enum TG711CodecMode
       
    45     {
       
    46     KMceG711PCMU = 2,
       
    47     KMceG711PCMA
       
    48     };
       
    49     
       
    50 // G.711 PTime and MaxPTime
       
    51 const TUint KMceG711DefaultPtime =  20;     
       
    52 const TUint KMceG711DefaultMaxPtime = 200;
       
    53     
       
    54 const TUint KMceG711SamplingFreq = 8000;
       
    55 
       
    56 
       
    57 // CLASS DECLARATION
       
    58 
       
    59 /**
       
    60 * Class for the G711 codec information.
       
    61 *
       
    62 * It checks the validity of inserted values for G711.
       
    63 * 
       
    64 *  @lib mceclient.lib
       
    65 */
       
    66 class CMceG711Codec : public CMceAudioCodec
       
    67     {
       
    68 	public:  // Constructors and destructor
       
    69 	    
       
    70 	    /**
       
    71 	    * Destructor.
       
    72 	    */
       
    73 	    IMPORT_C ~CMceG711Codec();
       
    74 	        
       
    75 	public: // From base class
       
    76 
       
    77 	    /**
       
    78 	    * Enable / Disable Voice Activity Detection.
       
    79 	    * @param aEnableVAD, Boolean indicating whether to enable Voice Activity Detection
       
    80 	    * @return KErrNotSupported if codec doesn't support VAD; otherwise KErrNone.
       
    81 	    */
       
    82 	    IMPORT_C TInt EnableVAD(TBool aEnableVAD);
       
    83         
       
    84         /**
       
    85 	    * Sets bitrate used with codec for encoding.
       
    86 	    * @param aBitrate, bitrate value for encoding
       
    87 	    * @return KErrNotSupported if codec doesn't support bitrate value issued; otherwise KErrNone.
       
    88 	    */
       
    89 	    IMPORT_C TInt SetBitrate(TUint aBitrate);
       
    90 	    
       
    91 	    /**
       
    92 	    * Sets bitrates allowed with codec.
       
    93 	    * @param aBitrates, allowed bitrate values 
       
    94 	    * @return KErrNotSupported if codec doesn't support bitrate value issued; otherwise KErrNone.
       
    95 	    */
       
    96 	    IMPORT_C TInt SetAllowedBitrates(TUint aBitrates);
       
    97 	        
       
    98 	    /**
       
    99 	    * Sets the sampling frequency.
       
   100 	    * @param aSamplingFreq, Sampling frequency to be used
       
   101 	    * @return KErrNotSupported if codec doesn't support sampling frequency issued; otherwise KErrNone.
       
   102 	    */
       
   103 	    IMPORT_C TInt SetSamplingFreq(TUint aSamplingFreq);
       
   104 
       
   105 	    /**
       
   106 	    * Sets the packetization rate. 
       
   107 	    * @param aPTime, Packetization rate, must be multiple of audio frame size.
       
   108 	    * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone.
       
   109 	    */
       
   110 	    IMPORT_C TInt SetPTime(TUint aPTime);
       
   111 	    
       
   112 	    /**
       
   113 	    * Sets the maximum packetization rate.
       
   114 	    * @param aMaxPTime, maximum allowed packetization rate, must be multiple of audio frame size.
       
   115 	    * @return KErrNotSupported if codec doesn't support packetrate value issued; otherwise KErrNone.
       
   116 	    */
       
   117 	    IMPORT_C TInt SetMaxPTime(TUint aMaxPTime);
       
   118 	    
       
   119 	    /**
       
   120 	    * Sets the payload type identifier.
       
   121 	    * @param aPayloadType payload type identifier.
       
   122 	    * @return One of the standard system-wide error codes.
       
   123 	    */
       
   124 	    IMPORT_C TInt SetPayloadType(TUint8 aPayloadType);
       
   125 
       
   126 	    /**
       
   127 	    * Sets the codec mode.
       
   128 	    * @param aCodecMode	Codec mode (PCMU / PCMA )
       
   129 	    * @return KErrNotSupported if codec doesnt' support codec mode value issued; otherwise KErrNone.
       
   130 	    */
       
   131 	    IMPORT_C TInt SetCodecMode(TUint aCodecMode);
       
   132 	    
       
   133 	    /**
       
   134 	    * Enable / Disable Comfort noise codec existence.
       
   135 	    * @param aComfortNoise    Boolean indicating whether to enable CN codec existence
       
   136 	    * @return KErrNotSupported if codec doesnt' support codec mode value issued; otherwise KErrNone.
       
   137 	    */
       
   138 	    //IMPORT_C TInt EnableCN(const TBool aComfortNoise);
       
   139 	    
       
   140 	    /**
       
   141 	    * Clones codec, ownership is transferred.
       
   142 	    * @return cloned codec
       
   143 	    */
       
   144 	    IMPORT_C CMceAudioCodec* CloneL() const;
       
   145 
       
   146 	public: 
       
   147 
       
   148 	    /**
       
   149 	    * Two-phased constructor.
       
   150 	    * @param aSdpName sdp name
       
   151 	    */
       
   152 	    static CMceG711Codec* NewL( TBuf8<KMceMaxSdpNameLength> aSdpName);
       
   153 
       
   154 	    /**
       
   155 	    * Two-phased constructor.
       
   156 	    * @param aSdpName sdp name
       
   157 	    */
       
   158 	    static CMceG711Codec* NewLC(TBuf8<KMceMaxSdpNameLength> aSdpName);
       
   159 
       
   160 	    	    
       
   161 	private:
       
   162 
       
   163 	    /**
       
   164 	    * C++ default constructor.
       
   165 	    */
       
   166 	    CMceG711Codec();
       
   167 
       
   168 	    /**
       
   169 	    * By default Symbian 2nd phase constructor is private.
       
   170 	    */
       
   171 	    void ConstructL( TBuf8<KMceMaxSdpNameLength> aSdpName);
       
   172 
       
   173 	    /**
       
   174 	    * Sets the sdp name.
       
   175 	    * @param aSdpName the sdp name
       
   176 	    */
       
   177 	    void SetSdpNameL( const TDesC8& aSdpName );
       
   178 
       
   179 		//for testing
       
   180 
       
   181 	    MCE_UNIT_TEST_DEFS	    
       
   182     };
       
   183 
       
   184 
       
   185 #endif      
       
   186 
       
   187 // End of File