htiui/HtiServicePlugins/HtiCameraServicePlugin/engine/src/VideoRecordingQualityLevels.cpp
branchRCL_3
changeset 13 822c625f7adc
equal deleted inserted replaced
11:454d022d514b 13:822c625f7adc
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Engine video quality level and container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32std.h>
       
    20 #include <e32base.h> 
       
    21 
       
    22 
       
    23 #include "VideoRecordingQualityLevels.h"
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 const TInt KQualityLevelArrayGranularity = 3;
       
    28 
       
    29 CVideoRecordingQualityLevels::CVideoRecordingQualityLevels()
       
    30     {
       
    31     // TODO Auto-generated constructor stub
       
    32 
       
    33     }
       
    34 
       
    35 CVideoRecordingQualityLevels::~CVideoRecordingQualityLevels()
       
    36     {
       
    37     delete iQualityLevels;
       
    38     }
       
    39 
       
    40 void CVideoRecordingQualityLevels::ConstructL()
       
    41     {
       
    42 
       
    43     iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoRecordingQualityLevel>( KQualityLevelArrayGranularity );
       
    44 
       
    45     }
       
    46 
       
    47 CVideoRecordingQualityLevels* CVideoRecordingQualityLevels::NewL()
       
    48     {
       
    49 
       
    50     CVideoRecordingQualityLevels* self = new( ELeave ) CVideoRecordingQualityLevels;
       
    51 
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL();
       
    54     CleanupStack::Pop( self );
       
    55 
       
    56 
       
    57     return self;
       
    58     }
       
    59 
       
    60 TInt CVideoRecordingQualityLevels::InitDefaultsL()
       
    61     {
       
    62 
       
    63     // Delete all elements from the array and 
       
    64     // free the memory allocated to the array buffer.
       
    65     iQualityLevels->Reset();
       
    66 
       
    67     // Initialize hardcoded default quality levels.
       
    68 
       
    69     TSize size;
       
    70 
       
    71     CVideoRecordingQualityLevel* videoQualityLevel = new( ELeave ) CVideoRecordingQualityLevel;
       
    72     CleanupStack::PushL( videoQualityLevel );
       
    73     
       
    74     // Level 0:
       
    75     size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
       
    76     videoQualityLevel->iFrameSize    = size;
       
    77     videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
       
    78     videoQualityLevel->iBitRate      = 64000; // Bits per second. Basically HW dependent.
       
    79     videoQualityLevel->iAudioEnabled = EFalse;
       
    80     videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
       
    81     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
    82     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
    83     videoQualityLevel->iVideoType.Copy( KVideoType );
       
    84     videoQualityLevel->iAudioType.Copy( KAudioType );
       
    85     videoQualityLevel->iStorageRate = 78000;  // That many bits per second to store. Estimate only
       
    86 
       
    87     iQualityLevels->AppendL( *videoQualityLevel );
       
    88 
       
    89     // Level 1:
       
    90     size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
       
    91     videoQualityLevel->iFrameSize    = size;
       
    92     videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
       
    93     videoQualityLevel->iBitRate      = 60000; // Bits per second. Basically HW dependent.
       
    94     videoQualityLevel->iAudioEnabled = EFalse;
       
    95     videoQualityLevel->iAudioBitRate = 6700;  // Bits per second. Basically HW dependent.
       
    96     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
    97     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
    98     videoQualityLevel->iVideoType.Copy( KVideoType );
       
    99     videoQualityLevel->iAudioType.Copy( KAudioType );
       
   100     videoQualityLevel->iStorageRate = 68000;  // That many bits per second to store. Estimate only
       
   101 
       
   102     iQualityLevels->AppendL( *videoQualityLevel );
       
   103 
       
   104     // Level 2:
       
   105     size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
       
   106     videoQualityLevel->iFrameSize    = size;
       
   107     videoQualityLevel->iFrameRate    = 5.0;   // Frames per second. Basically HW dependent.
       
   108     videoQualityLevel->iBitRate      = 40000; // Bits per second. Basically HW dependent.
       
   109     videoQualityLevel->iAudioEnabled = EFalse;
       
   110     videoQualityLevel->iAudioBitRate = 5150;  // Bits per second. Basically HW dependent.
       
   111     videoQualityLevel->iMimeType.Copy( KVideoMimeType );
       
   112     videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
       
   113     videoQualityLevel->iVideoType.Copy( KVideoType );
       
   114     videoQualityLevel->iAudioType.Copy( KAudioType );
       
   115     videoQualityLevel->iStorageRate = 47000;  // That many bits per second to store. Estimate only
       
   116 
       
   117     iQualityLevels->AppendL( *videoQualityLevel );
       
   118 
       
   119     CleanupStack::PopAndDestroy( videoQualityLevel );
       
   120 
       
   121 
       
   122     return iQualityLevels->Count();
       
   123     }
       
   124 
       
   125 
       
   126 // -----------------------------------------------------------------------------
       
   127 // CCaeVideoQualityLevelsCont::Count
       
   128 // -----------------------------------------------------------------------------
       
   129 //
       
   130 TInt CVideoRecordingQualityLevels::Count() const
       
   131     {
       
   132     return iQualityLevels->Count();
       
   133     }
       
   134 
       
   135         
       
   136 // -----------------------------------------------------------------------------
       
   137 // CCaeVideoQualityLevelsCont::At
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 CVideoRecordingQualityLevel& CVideoRecordingQualityLevels::At( 
       
   141     TInt aIndex ) const
       
   142     {
       
   143     return iQualityLevels->At( aIndex );
       
   144     }