multimediacommsengine/tsrc/mccstub/src/MmccCodecH263.cpp
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 // INCLUDE FILES
       
    23 #include <delimitedpathsegment8.h>
       
    24 
       
    25 #include "mmcccodech263.h"
       
    26 #include "mccuids.hrh"
       
    27 #include "mmccinterfacelogs.h"
       
    28 
       
    29 // EXTERNAL DATA STRUCTURES
       
    30 
       
    31 // EXTERNAL FUNCTION PROTOTYPES  
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KMaxFmtpAttrLength( 50 );
       
    35 const TInt KH263DefaultFrameSize( 3000 );
       
    36 const TInt KH263DefaultMaxBitrate( 64000 );
       
    37 const TInt KH263DefaultBitrate( 64000 );
       
    38 const TInt KH263DefaultAllowedBitrate( 1 );
       
    39 const TInt KH263DefaultFreq( 90000 );
       
    40 
       
    41 const TUint KMccAllowedH263Bitrate1 = 0x0001;
       
    42 const TUint KMccAllowedH263Bitrate2 = 0x0002;
       
    43 const TUint KMccAllowedH263BitrateAll = 0x0003;
       
    44 
       
    45 const TInt  KH263Bitrate64( 64000 );
       
    46 const TInt  KH263Bitrate128( 128000 );
       
    47 
       
    48 
       
    49 // MACROS
       
    50 
       
    51 // LOCAL CONSTANTS AND MACROS
       
    52 
       
    53 // MODULE DATA STRUCTURES
       
    54 
       
    55 // LOCAL FUNCTION PROTOTYPES
       
    56 
       
    57 // FORWARD DECLARATIONS
       
    58 
       
    59 // ============================= LOCAL FUNCTIONS ===============================
       
    60 
       
    61 // ============================ MEMBER FUNCTIONS ===============================
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CMccCodecH263::CMccCodecH263
       
    65 // C++ default constructor can NOT contain any code, that
       
    66 // might leave.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CMccCodecH263::CMccCodecH263() : CMccCodecInformation()
       
    70     {
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CMccCodecH263::ConstructL
       
    75 // Symbian 2nd phase constructor can leave.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 void CMccCodecH263::ConstructL()
       
    79     {
       
    80     iSdpName.Copy( KH2632000SdpName );
       
    81 
       
    82     iType = KUidMediaTypeVideo; 
       
    83     iFmtpAttr = HBufC8::NewL( KMaxFmtpAttrLength );
       
    84     iFourCC = KMccFourCCIdH263;
       
    85     iSamplingFreq = KH263DefaultFreq;
       
    86 
       
    87     iPayloadFormatEncoder = KImplUidH263PayloadFormatEncode;
       
    88     iPayloadFormatDecoder = 0;
       
    89     
       
    90     SetCodecMode( KH263FormatModeNew );
       
    91     SetPTime( KH263PTime );
       
    92     SetPayloadType( KH263PayloadType );
       
    93     SetFramerate( KH263Framerate );
       
    94 	SetLevelBasedBitrate( KH263DefaultBitrate );
       
    95     SetMaxBitrate( KH263DefaultMaxBitrate );
       
    96     SetAllowedBitrates( KH263DefaultAllowedBitrate );
       
    97     SetFrameHeight( KH263FrameHeight );
       
    98     SetFrameWidth( KH263FrameWidth );
       
    99     iFrameSize = KH263DefaultFrameSize;
       
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CMccCodecH263::NewL
       
   104 // Two-phased constructor.
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 CMccCodecH263* CMccCodecH263::NewL()
       
   108     {
       
   109     CMccCodecH263* self = new( ELeave ) CMccCodecH263;
       
   110     
       
   111     CleanupStack::PushL( self );
       
   112     self->ConstructL();
       
   113     CleanupStack::Pop( self );
       
   114 
       
   115     return self;
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CMccCodecH263::~CMccCodecH263
       
   120 // 
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 CMccCodecH263::~CMccCodecH263()
       
   124     {
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CMccCodecH263::RequireSignalling
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 TBool CMccCodecH263::RequireSignalling(
       
   132     const CMccCodecInformation& aCandidate ) const      
       
   133     {
       
   134     return CMccCodecInformation::RequireSignalling( aCandidate );
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CMccCodecH263::SetBitrate
       
   139 // Sets the bitrate used with AMR codec.
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 TInt CMccCodecH263::SetBitrate( TUint aBitrate )
       
   143 	{
       
   144     if ( aBitrate <= KH263Bitrate128 )
       
   145     	{
       
   146     	iBitrate = aBitrate;
       
   147     	iBitrateSet = ETrue;
       
   148     	return KErrNone;
       
   149     	}
       
   150     else
       
   151     	{
       
   152     	return KErrNotSupported;
       
   153     	}
       
   154 	}
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // CMccCodecH263::SetSamplingFreq
       
   158 // Sets the sampling frequency. 
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 TInt CMccCodecH263::SetSamplingFreq( TUint32 /*aSamplingFreq*/ )
       
   162     {
       
   163     return KErrNone;
       
   164     }
       
   165     
       
   166 // -----------------------------------------------------------------------------
       
   167 // CMccCodecH263::SetSdpName
       
   168 // Sets the SDP name
       
   169 // -----------------------------------------------------------------------------
       
   170 //
       
   171 TInt CMccCodecH263::SetSdpName( const TDesC8& aSdpName )
       
   172     {
       
   173     if ( !aSdpName.CompareF( KH263SdpName ) || 
       
   174          !aSdpName.CompareF( KH2632000SdpName ))
       
   175         {
       
   176         iSdpName.Copy( KH2632000SdpName );
       
   177         if ( iCodecMode != KH263FormatModeNew )
       
   178             {
       
   179             SetCodecMode( KH263FormatModeNew );    
       
   180             }
       
   181         }
       
   182     else if( !aSdpName.CompareF( KH2631998SdpName ))
       
   183         {
       
   184         iSdpName.Copy( KH2631998SdpName );
       
   185         if ( iCodecMode != KH263FormatModeOld )
       
   186             {
       
   187             SetCodecMode( KH263FormatModeOld );    
       
   188             }
       
   189         }
       
   190     else 
       
   191         {
       
   192         return KErrNotSupported;
       
   193         }
       
   194     
       
   195     return KErrNone;
       
   196     }
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // CMccCodecH263::PayloadType
       
   200 // Sets the payload type
       
   201 // -----------------------------------------------------------------------------
       
   202 //
       
   203 TInt CMccCodecH263::SetPayloadType( TUint8 aPayloadType )
       
   204     {
       
   205     if ( aPayloadType < KMinDynamicPT ||
       
   206          aPayloadType > KMaxPayloadType ) 
       
   207         {
       
   208         return KErrNotSupported;
       
   209         }
       
   210     else 
       
   211         {
       
   212         iPayloadType = aPayloadType;
       
   213         }
       
   214               
       
   215     return KErrNone;
       
   216     }
       
   217     
       
   218 // -----------------------------------------------------------------------------
       
   219 // CMccCodecH263::SetCodecMode
       
   220 // Sets the codec mode.
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 TInt CMccCodecH263::SetCodecMode( TCodecMode aCodecMode )
       
   224     {
       
   225     iCodecMode = aCodecMode;
       
   226     if ( iCodecMode == KH263FormatModeNew &&
       
   227          iSdpName.CompareF( KH2632000SdpName ))
       
   228         {
       
   229         SetSdpName( KH2632000SdpName );    
       
   230         }
       
   231     if ( iCodecMode == KH263FormatModeOld &&
       
   232 	     iSdpName.CompareF( KH2631998SdpName ))
       
   233         {
       
   234         SetSdpName( KH2631998SdpName );    
       
   235         
       
   236         // Ensure that default dynamic pt is not the same for two different
       
   237         // codec modes
       
   238         if ( iPayloadType == KH263PayloadType )
       
   239             {
       
   240             SetPayloadType( KH2631998PayloadType );
       
   241             }
       
   242         }
       
   243     
       
   244     return KErrNone;
       
   245     }
       
   246  
       
   247 // -----------------------------------------------------------------------------
       
   248 // CMccCodecH263::EnableVAD
       
   249 // Enable / Disable VAD
       
   250 // -----------------------------------------------------------------------------
       
   251 //
       
   252 TInt CMccCodecH263::EnableVAD( TBool /*aEnableVAD*/ ) 
       
   253     {
       
   254     return KErrNotSupported;
       
   255     }
       
   256     
       
   257 // -----------------------------------------------------------------------------
       
   258 // CMccCodecH263::SetPTime
       
   259 // Set PTime
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 TInt CMccCodecH263::SetPTime( TUint aPTime )
       
   263     {
       
   264     if ( aPTime && ( aPTime <= 200 ) && (( aPTime % 10 )  == 0 ))
       
   265         {
       
   266         iPTime = aPTime;
       
   267         return KErrNone;    
       
   268         }
       
   269     else
       
   270         {
       
   271         return KErrNotSupported;
       
   272         }
       
   273     }
       
   274     
       
   275 // -----------------------------------------------------------------------------
       
   276 // CMccCodecH263::SetMaxPTime
       
   277 // Set Max PTime
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 TInt CMccCodecH263::SetMaxPTime( TUint aMaxPTime )
       
   281     {
       
   282     if ( aMaxPTime && ( aMaxPTime <= 200 ) && (( aMaxPTime % 10 )  == 0 ))
       
   283         {
       
   284         iMaxPTime = aMaxPTime;
       
   285         return KErrNone;    
       
   286         }
       
   287     else
       
   288         {
       
   289         return KErrNotSupported;
       
   290         }
       
   291     }
       
   292 
       
   293 // -----------------------------------------------------------------------------
       
   294 // CMccCodecH263:SetConfigKeyL
       
   295 // -----------------------------------------------------------------------------
       
   296 // 
       
   297 void CMccCodecH263::SetConfigKeyL( const TDesC8& /*aConfigKey*/ )
       
   298     {
       
   299     // NOP
       
   300     }
       
   301     
       
   302 // CMccCodecH263::SetAllowedBitrates
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 TInt CMccCodecH263::SetAllowedBitrates( TUint aBitrateMask )
       
   306     {
       
   307     //Confirm that the bitrate mask is valid
       
   308     //I.e. after all the valid bitrates are set to zero the value should be zero
       
   309     if ( (aBitrateMask >> 8 ) > 0 )
       
   310         {
       
   311         return KErrArgument;
       
   312         }
       
   313     else
       
   314         {
       
   315         /*
       
   316         In the future the allowed bitrates will be fetched from the codec
       
   317         I.e. the KMccAllowedH263BitrateAll will be changed to the bitrates
       
   318         supported by the codec
       
   319         */
       
   320         iBitrateMask = KMccAllowedH263BitrateAll;
       
   321         iBitrateMask &= aBitrateMask;
       
   322         
       
   323         SetMaxBitrateFromBitrateMask( iBitrateMask );
       
   324         }
       
   325     return KErrNone;
       
   326     }
       
   327 
       
   328 // -----------------------------------------------------------------------------
       
   329 // CMccCodecH263::CloneDefaultsL
       
   330 // Make a default setting clone from this codec
       
   331 // -----------------------------------------------------------------------------
       
   332 //
       
   333 CMccCodecInformation* CMccCodecH263::CloneDefaultsL()
       
   334     {
       
   335     CMccCodecInformation* codec = CMccCodecH263::NewL();
       
   336     CleanupStack::PushL( codec );
       
   337     
       
   338     if ( 0 == this->SdpName().CompareF( KH2632000SdpName ) )
       
   339         {
       
   340         User::LeaveIfError( codec->SetCodecMode( KH263FormatModeNew ) );
       
   341         }
       
   342     else
       
   343         {
       
   344         User::LeaveIfError( codec->SetCodecMode( KH263FormatModeOld ) );
       
   345         }
       
   346     
       
   347     CleanupStack::Pop( codec );
       
   348     return codec;
       
   349     }
       
   350 
       
   351 // -----------------------------------------------------------------------------
       
   352 // CMccCodecH263::CloneDetailedL
       
   353 // Make a detailed clone from this codec
       
   354 // -----------------------------------------------------------------------------
       
   355 //
       
   356 CMccCodecInformation* CMccCodecH263::CloneDetailedL()
       
   357     {
       
   358     CMccCodecH263* newCodec = CMccCodecH263::NewL();
       
   359     CleanupStack::PushL( newCodec );       
       
   360     newCodec->SetBitrate( this->Bitrate() );
       
   361     newCodec->SetCodecMode( this->CodecMode() );
       
   362     newCodec->SetMaxPTime( this->MaxPTime() );
       
   363     newCodec->SetPayloadType( this->PayloadType() );
       
   364     newCodec->SetPTime( this->PTime() );
       
   365     newCodec->SetSamplingFreq( this->SamplingFreq() );
       
   366     newCodec->SetSdpName( this->SdpName() );
       
   367     CleanupStack::Pop( newCodec );   
       
   368     return newCodec;
       
   369     }
       
   370         
       
   371 // -----------------------------------------------------------------------------
       
   372 // CMccCodecH263::GetFmtpL
       
   373 // Gets the fmtp attribute
       
   374 // -----------------------------------------------------------------------------
       
   375 //
       
   376 TDesC8& CMccCodecH263::GetFmtpL()
       
   377     {
       
   378     __INTERFACE( "CMccCodecH263::GetFmtpL" )      
       
   379     if ( iFmtpAttr )
       
   380         {
       
   381         delete iFmtpAttr;
       
   382         iFmtpAttr = NULL;
       
   383         }
       
   384 
       
   385     TInt level = KH263Level10;
       
   386     
       
   387     if ( iMaxBitrate > KH263Level10Bitrate && 
       
   388          iMaxBitrate <= KH263Level45Bitrate )  
       
   389         {
       
   390         __INTERFACE( "CMccCodecH263::GetFmtpL, level set 45" )        
       
   391         level = KH263Level45;     
       
   392         }
       
   393         
       
   394     iFmtpAttr = HBufC8::NewL( KMaxFmtpAttrLength );
       
   395     iFmtpAttr->Des().Format( KH263FmtpLine, level );                
       
   396     
       
   397     __INTERFACE( "CMccCodecH263::GetFmtpL, exit" )      
       
   398     return *iFmtpAttr;    
       
   399     }
       
   400 
       
   401 // -----------------------------------------------------------------------------
       
   402 // CMccCodecH263::SetFmtpAttrL
       
   403 // Gets the fmtp attribute
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 void CMccCodecH263::SetFmtpAttrL( const TDesC8& aFmtp, TBool /*parseFmtp*/ )
       
   407     {
       
   408     __INTERFACE( "CMccCodecH263::SetFmtpAttrL" )      
       
   409     if ( iFmtpAttr )
       
   410         {
       
   411         delete iFmtpAttr;
       
   412         iFmtpAttr = NULL;
       
   413         }
       
   414 
       
   415     iFmtpAttr = HBufC8::NewL( aFmtp.Length() );
       
   416     iFmtpAttr->Des().Copy( aFmtp );
       
   417            
       
   418     ParseFmtpAttrL( *iFmtpAttr );          
       
   419     __INTERFACE( "CMccCodecH263::SetFmtpAttrL, exit" )      
       
   420     }        
       
   421 
       
   422  // -----------------------------------------------------------------------------
       
   423 // CMccCodecH263::ParseFmtpAttrL
       
   424 // Parse the fmtp string, but doesn't update the iFmtpAttr
       
   425 // -----------------------------------------------------------------------------
       
   426 //
       
   427 TBool CMccCodecH263::ParseFmtpAttrL( const TDesC8& aFmtp )
       
   428     {
       
   429     __INTERFACE( "CMccCodecH263::ParseFmtpAttrL" )      
       
   430     const TUint8* pointerC = aFmtp.Ptr();
       
   431     TUint8* pointer        = const_cast<TUint8*>( pointerC );
       
   432     TPtr8 descriptor( pointer, aFmtp.Length(), aFmtp.Length() );
       
   433     descriptor.Trim();
       
   434     
       
   435     TDelimitedPathSegmentParser8 parser;
       
   436     parser.Parse( aFmtp );
       
   437     TPtrC8 segment;
       
   438     TBool updated( EFalse );
       
   439     
       
   440     while ( parser.GetNext( segment ) != KErrNotFound )
       
   441         {
       
   442         if ( ParseFmtpSegmentL( segment ) )
       
   443             {
       
   444             updated = ETrue;
       
   445             }
       
   446         }
       
   447     
       
   448     __INTERFACE( "CMccCodecH263::ParseFmtpAttrL, exit" )      
       
   449     return updated;
       
   450     }
       
   451     
       
   452 // -----------------------------------------------------------------------------
       
   453 // CMccCodecH263::ParseFmtpSegmentL
       
   454 // Parse and updates the matched param
       
   455 // -----------------------------------------------------------------------------
       
   456 //    
       
   457 TBool CMccCodecH263::ParseFmtpSegmentL( const TDesC8& aSeg )
       
   458     {
       
   459     __INTERFACE( "CMccCodecH263::ParseFmtpSegmentL" )      
       
   460     TBool success( ETrue );
       
   461     _LIT8( KEqualSign, "=" );
       
   462     
       
   463     // Check for first '=' sign 
       
   464     TInt index = aSeg.Find( KEqualSign );
       
   465     
       
   466     if ( index > 0 )
       
   467         {
       
   468         // Check if match profile
       
   469         if ( aSeg.Left( index).Match( KH263Profile ) != KErrNotFound )
       
   470             {
       
   471             success = ParseProfileL( aSeg.Right( aSeg.Length() - ( index + 1 ) ) );
       
   472             }
       
   473         
       
   474         // Check if match level
       
   475         else 
       
   476             {
       
   477             if ( aSeg.Left( index).Match( KH263Level ) != KErrNotFound )
       
   478                 {
       
   479                 success = ParseLevelL( aSeg.Right( aSeg.Length() - ( index + 1 ) ) );
       
   480                 }
       
   481             }
       
   482         }  
       
   483     __INTERFACE( "CMccCodecH263::ParseFmtpSegmentL, exit" )      
       
   484     return success;
       
   485     }
       
   486     
       
   487 // -----------------------------------------------------------------------------
       
   488 // CMccCodecH263::ParseProfile
       
   489 // -----------------------------------------------------------------------------
       
   490 //    
       
   491 TBool CMccCodecH263::ParseProfileL( const TDesC8& aFmtp )
       
   492     {
       
   493     __INTERFACE( "CMccCodecH263::ParseProfileL, exit" )      
       
   494     TBool success( ETrue );
       
   495     
       
   496     TLex8 myLex( aFmtp );
       
   497     TInt value;
       
   498     TInt err = myLex.Val( value );
       
   499     
       
   500     if ( err == KErrNone )
       
   501         {
       
   502         switch ( value )
       
   503             {
       
   504             case 0:
       
   505                 __INTERFACE( "CMccCodecH263::ParseProfileL, profile 0" )      
       
   506                 break;
       
   507             default:
       
   508                 __INTERFACE( "CMccCodecH263::ParseProfileL, unsupported profile" )      
       
   509                 success = EFalse;
       
   510                 break;
       
   511             }
       
   512         } 
       
   513     else
       
   514         {
       
   515         success = EFalse;
       
   516         }
       
   517  
       
   518     if ( !success )
       
   519         {
       
   520         __INTERFACE( "CMccCodecH263::ParseProfileL, leaving with KErrArgument" )              
       
   521         User::Leave( KErrArgument );
       
   522         }
       
   523 
       
   524     __INTERFACE( "CMccCodecH263::ParseProfileL, exit" )
       
   525     
       
   526     return ETrue;
       
   527     }
       
   528 
       
   529 // -----------------------------------------------------------------------------
       
   530 // CMccCodecH263::ParseProfile
       
   531 // -----------------------------------------------------------------------------
       
   532 //    
       
   533 TBool CMccCodecH263::ParseLevelL( const TDesC8& aFmtp )
       
   534     {
       
   535     __INTERFACE( "CMccCodecH263::ParseLevelL" )      
       
   536     TBool success( ETrue );
       
   537  
       
   538     TLex8 myLex( aFmtp );
       
   539     TInt value;
       
   540     TInt err = myLex.Val( value );
       
   541     
       
   542     if ( err == KErrNone )
       
   543         {
       
   544         switch ( value )
       
   545             {
       
   546             case KH263Level10:
       
   547                 __INTERFACE( "CMccCodecH263::ParseLevelL, level 10" )      
       
   548                 SetMaxBitrate( KH263Level10Bitrate );
       
   549                 SetLevelBasedBitrate( KH263Level10Bitrate );
       
   550                 SetFramerate ( KH263Level10Framerate );
       
   551                 break;
       
   552             case KH263Level45:
       
   553                 __INTERFACE( "CMccCodecH263::ParseLevelL, level 45" )      
       
   554                 SetMaxBitrate( KH263Level45Bitrate );
       
   555                 SetLevelBasedBitrate( KH263Level45Bitrate );
       
   556                 SetFramerate ( KH263Level45Framerate );
       
   557                 break;
       
   558             default:
       
   559                 __INTERFACE( "CMccCodecH263::ParseLevelL, unsupported level" )      
       
   560                 success = EFalse;
       
   561                 break;
       
   562             }
       
   563         } 
       
   564     else
       
   565         {
       
   566         success = EFalse;
       
   567         }
       
   568  
       
   569     if ( !success )
       
   570         {
       
   571         __INTERFACE( "CMccCodecH263::ParseLevelL, leaving with KErrArgument" )      
       
   572         User::Leave( KErrArgument );
       
   573         }
       
   574 
       
   575     __INTERFACE( "CMccCodecH263::ParseLevelL, exit" )      
       
   576     return success;
       
   577     }
       
   578                 
       
   579 // -----------------------------------------------------------------------------
       
   580 // CMccCodecH263::SetMaxBitrateFromBitrateMask
       
   581 // -----------------------------------------------------------------------------
       
   582 //        
       
   583 void CMccCodecH263::SetMaxBitrateFromBitrateMask( TUint aBitrateMask )
       
   584     {
       
   585     if( aBitrateMask & KMccAllowedH263Bitrate1 )
       
   586         {
       
   587         SetMaxBitrate( KH263Bitrate64 );
       
   588         }
       
   589     else if( aBitrateMask & KMccAllowedH263Bitrate2 )
       
   590         {
       
   591         SetMaxBitrate( KH263Bitrate128 );
       
   592         }
       
   593     else if( aBitrateMask & KMccAllowedH263BitrateAll )
       
   594         {
       
   595         SetMaxBitrate( KH263Bitrate128 );
       
   596         }
       
   597     }
       
   598     
       
   599 // -----------------------------------------------------------------------------
       
   600 // CMccCodecH263::SetMaxBitrate
       
   601 // -----------------------------------------------------------------------------
       
   602 //  
       
   603 TInt CMccCodecH263::SetMaxBitrate( TUint aMaxBitrate )
       
   604     {
       
   605     TBool isValid( ETrue );
       
   606        
       
   607     switch ( aMaxBitrate )
       
   608     	{
       
   609     	case KH263Bitrate64:    	    
       
   610     		break;
       
   611     	case KH263Bitrate128:
       
   612     		break;
       
   613     	default:
       
   614     		isValid = EFalse;
       
   615     		break;
       
   616     	}
       
   617     if ( isValid )
       
   618     	{
       
   619     	iMaxBitrate = aMaxBitrate;
       
   620         SetBitrateMaskFromMaxBitrate( aMaxBitrate );
       
   621     	return KErrNone;
       
   622     	}
       
   623     else
       
   624     	{
       
   625     	return KErrNotSupported;
       
   626     	}
       
   627     }
       
   628 
       
   629 // -----------------------------------------------------------------------------
       
   630 // CMccCodecH263::SetBitrateMaskFromMaxBitrate
       
   631 // -----------------------------------------------------------------------------
       
   632 //      
       
   633 void CMccCodecH263::SetBitrateMaskFromMaxBitrate( TUint aMaxBitrate )
       
   634      {
       
   635      switch ( aMaxBitrate )
       
   636     	{
       
   637     	case KH263Bitrate64:
       
   638     	    iBitrateMask = KMccAllowedH263Bitrate1;   	    
       
   639     		break;
       
   640     	case KH263Bitrate128:
       
   641     	    iBitrateMask = KMccAllowedH263BitrateAll;
       
   642     		break;
       
   643     	default:
       
   644     		break;
       
   645     	}
       
   646      }
       
   647 
       
   648 // -----------------------------------------------------------------------------
       
   649 // CMccCodecH263::SetLevelBasedBitrate
       
   650 // -----------------------------------------------------------------------------
       
   651 //      
       
   652 void CMccCodecH263::SetLevelBasedBitrate( TUint aBitrate )
       
   653     {
       
   654     // Set level based bitrate only if bitrate value has not been set
       
   655     if ( !iBitrateSet )
       
   656         {
       
   657         iBitrate = aBitrate;
       
   658         }
       
   659     }
       
   660     
       
   661 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   662 
       
   663 //  End of File