multimediacommscontroller/mmccinterface/inc/mmcccodecavc.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006 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 
       
    22 #ifndef MMCCCODECAVC_H
       
    23 #define MMCCCODECAVC_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include "mmcccodecinformation.h"
       
    27 
       
    28 // CONSTANTS
       
    29 const TInt KAvcPTime( 50 );
       
    30 const TInt KAvcPayloadType( 98 );
       
    31 const TReal KAvcFramerate( 15 );
       
    32 const TUint KAvcFrameWidth( 176 );
       
    33 const TUint KAvcFrameHeight( 144 );
       
    34 
       
    35 const TInt KAvcFormatModeSingleNal( 0 );
       
    36 const TInt KAvcFormatModeNonInterleaved( 1 );
       
    37 const TInt KAvcFormatModeInterleaved( 2 );
       
    38 
       
    39 // Allowedbitrates bitfield combines avc profile-level-id information in
       
    40 // similar manner  as defined in RFC 3984. Most significant byte stores
       
    41 // profile-id value, seconds significant byte contains profile-iop value and
       
    42 // last two bytes contain profile-level information.
       
    43 //
       
    44 const TUint KMccAvcBitrateLevel1 = 0x0001;
       
    45 const TUint KMccAvcBitrateLevel1b = 0x0002;
       
    46 const TUint KMccAvcBitrateLevel1_1 = 0x0004;
       
    47 const TUint KMccAvcBitrateLevel1_2 = 0x0008;
       
    48 const TUint KMccAvcBitrateLevel1_3 = 0x0010;
       
    49 const TUint KMccAvcBitrateLevel2 = 0x0020;
       
    50 
       
    51 const TUint KMccAvcCodecProfileIopConstraintSet = 0x0100;
       
    52 const TUint KMccAvcCodecProfileIopConstraintSet1 = 0x0200;
       
    53 const TUint KMccAvcCodecProfileIopConstraintSet2 = 0x0400;
       
    54 
       
    55 const TUint KMccAvcCodecProfileIdBaseline = 0x1000;
       
    56 const TUint KMccAvcCodecProfileIdMain = 0x2000;
       
    57 const TUint KMccAvcCodecProfileIdExtended = 0x4000; 
       
    58 const TUint KMccAvcCodecProfileIdHigh = 0x8000; 
       
    59 
       
    60 const TUint KMccAllowedAvcBitrateAll = 0x00FF;
       
    61 
       
    62 // Allowed bitrates bitfield can contain additional information
       
    63 const TUint KMccAllowedAvcAdditionalInfo = 0xFF00;
       
    64 
       
    65 _LIT8( KMatchProfileLevelId, "*profile-level-id*");
       
    66 _LIT8( KTxtProfileLevelId, "profile-level-id=");
       
    67 _LIT8( KMatchSpropParameterSets, "*sprop-parameter-sets*");
       
    68 _LIT8( KTxtSpropParameterSets, "sprop-parameter-sets=");
       
    69 _LIT8( KMatchPacketizationMode, "*packetization-mode*");
       
    70 _LIT8( KTxtPacketizationMode, "packetization-mode=");
       
    71 
       
    72 const TInt KMccAvcCodecProfileIdBaselineVal = 0x42;
       
    73 
       
    74 const TInt KMccAvcCodecProfileIopConstraintSetVal = 4;
       
    75 const TInt KMccAvcCodecProfileIopConstraintSet1Val = 2;
       
    76 const TInt KMccAvcCodecProfileIopConstraintSet2Val = 1;
       
    77 
       
    78 const TInt KMccAvcCodecProfileLevel1Val = 0x0A;
       
    79 const TInt KMccAvcCodecProfileLevel1_1Val = 0x0B;
       
    80 const TInt KMccAvcCodecProfileLevel1_2Val = 0x0C;
       
    81 const TInt KMccAvcCodecProfileLevel1_3Val = 0x0D;
       
    82 const TInt KMccAvcCodecProfileLevel2Val = 0x14;
       
    83 
       
    84 // MACROS
       
    85 
       
    86 // DATA TYPES
       
    87 
       
    88 // FUNCTION PROTOTYPES
       
    89 
       
    90 // FORWARD DECLARATIONS
       
    91 
       
    92 // CLASS DECLARATION
       
    93 
       
    94 /**
       
    95 *  Container class for the codec information.
       
    96 *
       
    97 */
       
    98 NONSHARABLE_CLASS( CMccCodecAVC ) : public CMccCodecInformation
       
    99     {
       
   100     public:  // Constructors and destructor
       
   101         
       
   102         /**
       
   103         * Two-phased constructor.
       
   104         */
       
   105         static CMccCodecAVC* NewL();
       
   106         
       
   107         /**
       
   108         * Destructor.
       
   109         */
       
   110         virtual ~CMccCodecAVC();
       
   111 
       
   112     public: // New functions
       
   113 
       
   114     public: // Functions from base classes
       
   115 
       
   116     public: // From CMccCodecInformation
       
   117     
       
   118         /**
       
   119         * From CMccCodecInformation
       
   120         */
       
   121         TBool RequireSignalling( const CMccCodecInformation& aCandidate ) const;  
       
   122         
       
   123         /**
       
   124         * From CMccCodecInformation
       
   125         */
       
   126         CMccCodecInformation* CloneDefaultsL();
       
   127         
       
   128         /**
       
   129         * From CMccCodecInformation
       
   130         */
       
   131         CMccCodecInformation* CloneDetailedL();
       
   132         
       
   133         /**
       
   134         * From CMccCodecInformation. Enable / Disable Voice Activity Detection.
       
   135         * @since    Series 60 3.0
       
   136         * @param    aEnableVAD    Boolean indicating whether to enable
       
   137         *                         Voice Activity Detection
       
   138         * @return   KErrNotSupported if codec doesn't support VAD; otherwise KErrNone.
       
   139         */
       
   140         TInt EnableVAD( TBool aEnableVAD );
       
   141      
       
   142         /**
       
   143         * From CMccCodecInformation. Sets bitrate used with codec.
       
   144         * @since    Series 60 3.0
       
   145         * @param    aBitrate     New bitrate value
       
   146         * @return   KErrNotSupported if codec doesn't support bitrate
       
   147         *           value issued; otherwise KErrNone.
       
   148         */
       
   149         TInt SetBitrate( TUint aBitrate );
       
   150         
       
   151         /**
       
   152         * From CMccCodecInformation. Sets the sampling frequency.
       
   153         * @since    Series 60 3.0
       
   154         * @param    aSamplingFreq   Sampling frequency to be used
       
   155         * @return   KErrNotSupported if codec doesn't support sampling frequency issued;
       
   156         *           otherwise KErrNone.
       
   157         */
       
   158         TInt SetSamplingFreq( TUint32 aSamplingFreq );
       
   159 
       
   160         /**
       
   161         * From CMccCodecInformation. Sets the packet rate.
       
   162         * @since    Series 60 3.0
       
   163         * @param    aPacketrate        New packetrate
       
   164         * @return   KErrNotSupported if codec doesn't support packetrate value issued;
       
   165         *           otherwise KErrNone.
       
   166         */
       
   167         TInt SetPTime( TUint aPTime );
       
   168         
       
   169         /**
       
   170         * From CMccCodecInformation. Sets the packet rate.
       
   171         * @since    Series 60 3.0
       
   172         * @param    aPacketrate        New packetrate
       
   173         * @return   KErrNotSupported if codec doesn't support packetrate value issued;
       
   174         *           otherwise KErrNone.
       
   175         */
       
   176         TInt SetMaxPTime( TUint aMaxPTime );
       
   177 
       
   178         /**
       
   179         * From CMccCodecInformation. Sets the sdp name.
       
   180         * @since    Series 60 3.0
       
   181         * @param aRtpId - [input] RTP session ID
       
   182         * @return One of the standard system-wide error codes.
       
   183         */
       
   184         TInt SetSdpName( const TDesC8& aSdpName );
       
   185         
       
   186         /**
       
   187         * From CMccCodecInformation. Sets the payload type.
       
   188         * @since    Series 60 3.0
       
   189         * @param    aRtpId - [input] RTP session ID
       
   190         * @return   One of the standard system-wide error codes.
       
   191         */
       
   192         TInt SetPayloadType( TUint8 aPayloadType );
       
   193 
       
   194         /**
       
   195         * From CMccCodecInformation. Sets the codec mode.
       
   196         * @since    Series 60 3.0
       
   197         * @param    aMode    Codec mode
       
   198         * @return   KErrNotSupported if codec doesn't 
       
   199         *   support codec mode value issued; otherwise KErrNone.
       
   200         */
       
   201         TInt SetCodecMode( TCodecMode aCodecMode );
       
   202         
       
   203         /**
       
   204         * Sets the allowed bitrates for the codec.
       
   205         * @since Series 60 3.0
       
   206         * @param aBitrateMask bitrate mask.
       
   207         * @return KErrNotSupported if codec doesnt' support the bitrate mask
       
   208         *     value issued; otherwise KErrNone.
       
   209         */
       
   210         TInt SetAllowedBitrates( TUint aBitrateMask );
       
   211     
       
   212         /**
       
   213         * Set encoder/decoder configuration key
       
   214         * @param aConfigKey, config key as Base64 encoded
       
   215         */    
       
   216         void SetConfigKeyL( const TDesC8& aConfigKey );
       
   217         
       
   218         /**
       
   219     	* Sets preferred encoding device for uplink stream and preferred decoding
       
   220     	* device for downlink stream.
       
   221     	* @param aEncodingDecodingDevice
       
   222     	*/
       
   223     	void SetPreferredEncodingDecodingDevice( 
       
   224                                     TUid aEncodingDecodingDevice );
       
   225               
       
   226     
       
   227     /**
       
   228     *   FMTP functions
       
   229     */ 
       
   230     public: //Public FMTP functions
       
   231         
       
   232         /**
       
   233         * Get the fmtp string
       
   234         * @since Series 60 3.0
       
   235         * @return Fmtp.
       
   236         */
       
   237         TDesC8& GetFmtpL( ); 
       
   238         
       
   239         /**
       
   240         * Parses the fmtp attributes, and updates the internal values
       
   241         * except the iFmtpAttr attribute
       
   242         * @since Series 60 3.0
       
   243         * @param aFmtp Fmtp attribute
       
   244         * @return True if any param was updated
       
   245         */
       
   246         TBool ParseFmtpAttrL( const TDesC8& aFmtp );      
       
   247        
       
   248         /**
       
   249         * Creates the fmtp string from internal values
       
   250         * @since Series 60 3.0
       
   251         * @return void
       
   252         */
       
   253         void CreateFmtpAttrListL();
       
   254             
       
   255     protected:  // New functions
       
   256     
       
   257         TBool ParseFmtpSegmentL( const TDesC8& aSeg );
       
   258     
       
   259         TBool ParseFmtpProfileLevelIdL( const TDesC8& aProfileLevelId );
       
   260         
       
   261         TBool ParseFmtpSpropParameterSetsL( const TDesC8& aSpropParameterSets );
       
   262         
       
   263         TBool ParseFmtpPacketizationModeL( const TDesC8& aPacketizationMode );
       
   264         
       
   265         void SetProfileLevelIdL( TUint aProfileId, 
       
   266                                  TUint aProfileIop, 
       
   267                                  TUint aProfileLevel );
       
   268                                  
       
   269         void SetBitrateMask( TUint aBitrateMask, TBool aKeepAdditionalInfo = EFalse ); 
       
   270         
       
   271         void SetBitrateMaskAdditionalInfo( TUint aAdditionalInfo ); 
       
   272                                  
       
   273         TInt SetBitrateFromBitrateMask( TUint aBitrateMask );
       
   274         
       
   275         TInt ProfileLevelIdVals( TUint& aProfileId, 
       
   276                                  TUint& aProfileIop, 
       
   277                                  TUint& aProfileLevel );
       
   278 
       
   279         TBool CreateFmtpProfileLevelId( TDes8& aBuf );
       
   280         
       
   281         TBool CreateFmtpPacketizationMode( TDes8& aBuf );
       
   282         
       
   283         TBool CreateFmtpSpropParameterSets( TDes8& aBuf );
       
   284         
       
   285         TUint DefaultProfileIopVal();
       
   286         
       
   287         void SetLevelBasedBitrate( TUint aBitrate );
       
   288         
       
   289     protected:  // Functions from base classes
       
   290 
       
   291     private:
       
   292 
       
   293         /**
       
   294         * C++ default constructor.
       
   295         */
       
   296         CMccCodecAVC();
       
   297 
       
   298         /**
       
   299         * By default Symbian 2nd phase constructor is private.
       
   300         */
       
   301         void ConstructL();
       
   302 
       
   303     public:     // Data
       
   304     
       
   305     protected:  // Data
       
   306 
       
   307     private:    // Data
       
   308     
       
   309         TBool iProfileLevelIdParamExists;
       
   310         
       
   311         TBool iPacketizationModeParamExists;
       
   312     
       
   313         TBool iBitrateSet;
       
   314 
       
   315     public:     // Friend classes
       
   316 
       
   317     protected:  // Friend classes
       
   318     
       
   319     private:    // Friend classes
       
   320 
       
   321     #ifdef TEST_EUNIT
       
   322         friend class UT_CMccCodecAVC;
       
   323     #endif
       
   324     };
       
   325 
       
   326 #endif      // __MCC_CODEC_DTMF_H__   
       
   327             
       
   328 // End of File