camappengine/Engine/Src/CaeVideoQualityLevels.cpp
branchRCL_3
changeset 20 e3cdd00b5ae3
parent 19 18fa9327a158
child 21 27fe719c32e6
equal deleted inserted replaced
19:18fa9327a158 20:e3cdd00b5ae3
     1 /*
       
     2 * Copyright (c) 2002 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:  Camera Application Engine video quality level and container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "CaeVideoQualityLevels.h"
       
    23 
       
    24 #include "CaeEngineImp.h"       // For LOGTEXT
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KQualityLevelArrayGranularity = 3;
       
    28 
       
    29 
       
    30 
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont
       
    36 // Default constructor.
       
    37 // -----------------------------------------------------------------------------
       
    38 //
       
    39 CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont()
       
    40 : iQltyLevelCountSdKey( KCaeVideoQltyLevelCount )
       
    41     {
       
    42     }
       
    43 
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont
       
    47 // Destructor.
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont()
       
    51     {
       
    52     delete iQualityLevels;
       
    53     }
       
    54 
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CCaeVideoQualityLevelsCont::ConstructL
       
    58 // Symbian 2nd phase constructor can leave.
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 void CCaeVideoQualityLevelsCont::ConstructL()
       
    62     {
       
    63     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() entering" ) );
       
    64 
       
    65     iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoQualityLevel>( KQualityLevelArrayGranularity );
       
    66 
       
    67     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() returning" ) );
       
    68     }
       
    69 
       
    70 
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // CCaeVideoQualityLevelsCont::NewL
       
    74 // Two-phased constructor.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CCaeVideoQualityLevelsCont* CCaeVideoQualityLevelsCont::NewL()
       
    78     {
       
    79     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() entering" ) );
       
    80 
       
    81     CCaeVideoQualityLevelsCont* self = new( ELeave ) CCaeVideoQualityLevelsCont;
       
    82 
       
    83     CleanupStack::PushL( self );
       
    84     self->ConstructL();
       
    85     CleanupStack::Pop( self );
       
    86 
       
    87     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() returning" ) );
       
    88 
       
    89     return self;
       
    90     }
       
    91     
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CCaeVideoQualityLevelsCont::InitDefaultsL
       
    95 // Sets hardcoded default parameters for default video quality levels that 
       
    96 // are created.
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CCaeVideoQualityLevelsCont::InitDefaultsL()
       
   100     {
       
   101     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() entering" ) );
       
   102 
       
   103     // Delete all elements from the array and 
       
   104     // free the memory allocated to the array buffer.
       
   105     iQualityLevels->Reset();
       
   106 
       
   107     // Initialize hardcoded default quality levels.
       
   108 
       
   109     TSize size;
       
   110 
       
   111     CVideoQualityLevel* videoQualityLevel = new( ELeave ) CVideoQualityLevel;
       
   112     CleanupStack::PushL( videoQualityLevel );
       
   113     
       
   114     // Level 0:
       
   115     size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
       
   116     videoQualityLevel->iFrameSize    = size;
       
   117     videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
       
   118     videoQualityLevel->iBitRate      = 64000; // Bits per second. Basically HW dependent.
       
   119     videoQualityLevel->iAudioEnabled = EFalse;
       
   120     videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
       
   121     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
   122     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
   123     videoQualityLevel->iVideoType.Copy( KVideoType );
       
   124     videoQualityLevel->iAudioType.Copy( KAudioType );
       
   125     videoQualityLevel->iStorageRate = 78000;  // That many bits per second to store. Estimate only
       
   126     videoQualityLevel->iKey = KCaeVideoQltyLevel0;
       
   127 
       
   128     iQualityLevels->AppendL( *videoQualityLevel );
       
   129 
       
   130     // Level 1:
       
   131     size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
       
   132     videoQualityLevel->iFrameSize    = size;
       
   133     videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
       
   134     videoQualityLevel->iBitRate      = 60000; // Bits per second. Basically HW dependent.
       
   135     videoQualityLevel->iAudioEnabled = EFalse;
       
   136     videoQualityLevel->iAudioBitRate = 6700;  // Bits per second. Basically HW dependent.
       
   137     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
   138     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
   139     videoQualityLevel->iVideoType.Copy( KVideoType );
       
   140     videoQualityLevel->iAudioType.Copy( KAudioType );
       
   141     videoQualityLevel->iStorageRate = 68000;  // That many bits per second to store. Estimate only
       
   142     videoQualityLevel->iKey = KCaeVideoQltyLevel1;
       
   143 
       
   144     iQualityLevels->AppendL( *videoQualityLevel );
       
   145 
       
   146     // Level 2:
       
   147     size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
       
   148     videoQualityLevel->iFrameSize    = size;
       
   149     videoQualityLevel->iFrameRate    = 5.0;   // Frames per second. Basically HW dependent.
       
   150     videoQualityLevel->iBitRate      = 40000; // Bits per second. Basically HW dependent.
       
   151     videoQualityLevel->iAudioEnabled = EFalse;
       
   152     videoQualityLevel->iAudioBitRate = 5150;  // Bits per second. Basically HW dependent.
       
   153     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
   154     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
   155     videoQualityLevel->iVideoType.Copy( KVideoType );
       
   156     videoQualityLevel->iAudioType.Copy( KAudioType );
       
   157     videoQualityLevel->iStorageRate = 47000;  // That many bits per second to store. Estimate only
       
   158     videoQualityLevel->iKey = KCaeVideoQltyLevel2;
       
   159 
       
   160     iQualityLevels->AppendL( *videoQualityLevel );
       
   161 
       
   162     CleanupStack::PopAndDestroy( videoQualityLevel );
       
   163 
       
   164     LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() returning" ) );
       
   165 
       
   166     return iQualityLevels->Count();
       
   167     }
       
   168 
       
   169 
       
   170 // -----------------------------------------------------------------------------
       
   171 // CCaeVideoQualityLevelsCont::Count
       
   172 // -----------------------------------------------------------------------------
       
   173 //
       
   174 TInt CCaeVideoQualityLevelsCont::Count() const
       
   175     {
       
   176     return iQualityLevels->Count();
       
   177     }
       
   178 
       
   179         
       
   180 // -----------------------------------------------------------------------------
       
   181 // CCaeVideoQualityLevelsCont::At
       
   182 // -----------------------------------------------------------------------------
       
   183 //
       
   184 CVideoQualityLevel& CCaeVideoQualityLevelsCont::At( 
       
   185     TInt aIndex ) const
       
   186     {
       
   187     return iQualityLevels->At( aIndex );
       
   188     }
       
   189 
       
   190 
       
   191 // -----------------------------------------------------------------------------
       
   192 // CCaeVideoQualityLevelsCont::Key
       
   193 // -----------------------------------------------------------------------------
       
   194 //
       
   195 const TDes& CCaeVideoQualityLevelsCont::Key( 
       
   196     TInt aIndex ) const
       
   197     {
       
   198     return iQualityLevels->At( aIndex ).iKey;
       
   199     }
       
   200 
       
   201 
       
   202 // -----------------------------------------------------------------------------
       
   203 // CCaeVideoQualityLevelsCont::ResizeL
       
   204 // -----------------------------------------------------------------------------
       
   205 //
       
   206 void CCaeVideoQualityLevelsCont::ResizeL( 
       
   207     TInt aQualityLevelCount )
       
   208     {
       
   209     iQualityLevels->ResizeL( aQualityLevelCount );
       
   210     }
       
   211 
       
   212 
       
   213 // -----------------------------------------------------------------------------
       
   214 // CCaeVideoQualityLevelsCont::QltyLevelCountSdKey
       
   215 // -----------------------------------------------------------------------------
       
   216 //
       
   217 const TDesC& CCaeVideoQualityLevelsCont::QltyLevelCountSdKey() const
       
   218     {
       
   219     return iQltyLevelCountSdKey;
       
   220     }
       
   221 
       
   222 
       
   223 /////////////////////////////
       
   224 // CVideoQualityLevel methods 
       
   225 /////////////////////////////
       
   226 
       
   227 
       
   228 // -----------------------------------------------------------------------------
       
   229 // CVideoQualityLevel::CVideoQualityLevel
       
   230 // Default constructor.
       
   231 // -----------------------------------------------------------------------------
       
   232 //
       
   233 CVideoQualityLevel::CVideoQualityLevel()
       
   234 :CQualityLevel()
       
   235     {
       
   236     }
       
   237 
       
   238 
       
   239 // -----------------------------------------------------------------------------
       
   240 // CVideoQualityLevel::~CVideoQualityLevel
       
   241 // Destructor.
       
   242 // -----------------------------------------------------------------------------
       
   243 //
       
   244 CVideoQualityLevel::~CVideoQualityLevel()
       
   245     {
       
   246     }
       
   247 
       
   248 
       
   249 //  End of File