camerauis/cameraxui/cxengine/tsrc/unit/unittest_cxequalitypresetssymbian/imagingconfigmanager.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 23 61bc0f252b2b
child 25 2c87b2808fd7
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
     1 /*
       
     2 * Copyright (c) 2009-2010 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:  Fake implementation for the unittest_cxequalitypresetssymbian
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "imagingconfigmanager.h"
       
    20 
       
    21 
       
    22 const int KNumberOfQualityLevels = 5;
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // Constructor of CImagingConfigManager
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CImagingConfigManager::CImagingConfigManager()
       
    29 {
       
    30     iVideoQualitySets = new CArrayFixFlat< TVideoQualitySet >( 1 );
       
    31     iImageQualitySets = new CArrayFixFlat< TImageQualitySet >( 1 );
       
    32 
       
    33     // init
       
    34     for( TInt i = 0 ; i < KNumberOfQualityLevels ; i++ )
       
    35         {
       
    36         TVideoQualitySet videoset;
       
    37         initVideoQualitySet(videoset);
       
    38         iVideoQualitySets->AppendL(videoset);
       
    39 
       
    40         TImageQualitySet imageset;
       
    41         initImageQualitySet(imageset);
       
    42         iImageQualitySets->AppendL(imageset);
       
    43         }
       
    44 
       
    45 }
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // Destructor of CImagingConfigManager
       
    49 // ---------------------------------------------------------------------------
       
    50 //
       
    51 CImagingConfigManager::~CImagingConfigManager()
       
    52 {
       
    53 }
       
    54 
       
    55 
       
    56 
       
    57 
       
    58 // CImagingConfigManager::NewL
       
    59 CImagingConfigManager* CImagingConfigManager::NewL()
       
    60 {
       
    61     return new CImagingConfigManager();
       
    62 }
       
    63 
       
    64 // returns no of video quality levels
       
    65 TInt CImagingConfigManager::NumberOfVideoQualityLevels() const
       
    66 {
       
    67     return iVideoQualitySets->Count();
       
    68 }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // Get an array of video quality levels that are in use with the current
       
    72 // product with given Camera/Display ID. If the ID is zero, then all levels
       
    73 // dispite of the ID value are returned.
       
    74 // ---------------------------------------------------------------------------
       
    75 //
       
    76 TInt CImagingConfigManager::GetVideoQualityLevelsL(
       
    77                                         CArrayFixFlat<TUint>& aLevels,
       
    78                                         TUint /*aCameraDisplayID*/ )
       
    79     {
       
    80     aLevels.Reset();
       
    81     aLevels.SetReserveL( iVideoQualitySets->Count() );
       
    82     for( TInt i = 0 ; i < NumberOfVideoQualityLevels() ; i++ )
       
    83         {
       
    84          aLevels.AppendL(
       
    85                 iVideoQualitySets->At( i ).iVideoQualitySetLevel);
       
    86         }
       
    87     return KErrNone;
       
    88     }
       
    89 
       
    90 // CImagingConfigManager::GetVideoQualitySet
       
    91 TInt CImagingConfigManager::GetVideoQualitySet( TVideoQualitySet& aSet,
       
    92                                                 TInt /*aLevel*/,
       
    93                                                 TUint /*aCameraDisplayID*/ )
       
    94     {
       
    95     initVideoQualitySet(aSet);
       
    96     return KErrNone;
       
    97     }
       
    98 
       
    99 // Get all settings for Camcorder
       
   100 TInt CImagingConfigManager::GetCamcorderMMFPluginSettings(TCamcorderMMFPluginSettings& aSet) const
       
   101     {
       
   102     aSet.iCMRAvgVideoBitRateScaler = 0.9;
       
   103     return KErrNone;
       
   104     }
       
   105 
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // Get number of defined image quality levels. This is always at least
       
   109 // KNumberOfNominalLevels but can be higher
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 TInt CImagingConfigManager::NumberOfImageQualityLevels() const
       
   113     {
       
   114     return iImageQualitySets->Count();
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // Get an array of image quality levels that are in use with the current
       
   119 // product with given Camera/Display ID. If the ID is zero, then all levels
       
   120 // dispite of the ID value are returned.
       
   121 // ---------------------------------------------------------------------------
       
   122 //
       
   123 TInt CImagingConfigManager::GetImageQualityLevelsL(
       
   124                                         CArrayFixFlat<TUint>& aLevels,
       
   125                                         TUint /*aCameraDisplayID*/ )
       
   126     {
       
   127     aLevels.Reset();
       
   128     for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ )
       
   129         {
       
   130         aLevels.AppendL(
       
   131                 iImageQualitySets->At( i ).iImageQualitySetLevel );
       
   132         }
       
   133     return KErrNone;
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // Get image quality set associated with the given level and Camera/Display ID
       
   138 // if it is nonzero. If the ID is zero, smallest matching ID set is returned.
       
   139 // If there is no set associated with given intermediate
       
   140 // level, then set from a nearest level is returned (dividable by
       
   141 // KBasicQualityGranularity).
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 TInt CImagingConfigManager::GetImageQualitySet( TImageQualitySet& aSet,
       
   145                                                 TInt /*aLevel*/,
       
   146                                                 TUint /*aCameraDisplayID*/ )
       
   147 {
       
   148     initImageQualitySet(aSet);
       
   149     return KErrNone;
       
   150 }
       
   151 
       
   152 
       
   153 void CImagingConfigManager::initImageQualitySet(TImageQualitySet& aSet)
       
   154 {
       
   155     for( TUint i = 0 ; i < KMaxStringLength ; i++ )
       
   156         {
       
   157         aSet.iImageFileMimeType[ i ] = NULL;
       
   158         aSet.iImageFileExtension[ i ] = NULL;
       
   159         }
       
   160     aSet.iImageQualitySetLevel = 100;
       
   161     aSet.iImageWidth = 0;
       
   162     aSet.iImageHeight = 0;
       
   163     aSet.iImageEncoderUID.iUid = 0;
       
   164     aSet.iCompressionQuality = 0;
       
   165     aSet.iEstimatedSize = 0;
       
   166     aSet.iCameraDisplayId = 0;
       
   167     aSet.iCamcorderVisible = 100;
       
   168 
       
   169 }
       
   170 
       
   171 void CImagingConfigManager::initVideoQualitySet(TVideoQualitySet& aSet)
       
   172 {
       
   173     for( TUint i = 0 ; i < KMaxStringLength ; i++ )
       
   174         {
       
   175         aSet.iVideoFileMimeType[ i ] = NULL;
       
   176         aSet.iVideoCodecMimeType[ i ] = NULL;
       
   177         aSet.iPreferredSupplier[ i ] = NULL;
       
   178         }
       
   179     aSet.iVideoQualitySetLevel = 100;
       
   180     aSet.iVideoWidth = 0;
       
   181     aSet.iVideoHeight = 0;
       
   182     aSet.iVideoFrameRate = 0.0;
       
   183     aSet.iVideoBitRate = 0;
       
   184     aSet.iVideoEncoderUID.iUid = 0;
       
   185     aSet.iRandomAccessRate = 0;
       
   186     aSet.iVideoPixelAspectRatioNum = 0;
       
   187     aSet.iVideoPixelAspectRatioDenom = 0;
       
   188     aSet.iAudioFourCCType = 0;
       
   189     aSet.iAudioBitRate = 0;
       
   190     aSet.iAudioSamplingRate = 0;
       
   191     aSet.iAudioChannels = 0;
       
   192     aSet.iAudioEncoderUID.iUid = 0;
       
   193     aSet.iAVSyncStartDelay = 0;
       
   194     aSet.iAVSyncResumeDelay = 0;
       
   195     aSet.iCameraDisplayId = 0;
       
   196     aSet.iCamcorderVisible = 100;
       
   197 
       
   198 }