camerauis/cameraxui/cxengine/tsrc/unit/system_include/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) 2006-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     return KErrNone;
       
   103     }
       
   104 
       
   105 
       
   106 // ---------------------------------------------------------------------------
       
   107 // Get number of defined image quality levels. This is always at least
       
   108 // KNumberOfNominalLevels but can be higher
       
   109 // ---------------------------------------------------------------------------
       
   110 //
       
   111 TInt CImagingConfigManager::NumberOfImageQualityLevels() const
       
   112     {
       
   113     return iImageQualitySets->Count();
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // Get an array of image quality levels that are in use with the current
       
   118 // product with given Camera/Display ID. If the ID is zero, then all levels
       
   119 // dispite of the ID value are returned.
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TInt CImagingConfigManager::GetImageQualityLevelsL(
       
   123                                         CArrayFixFlat<TUint>& aLevels,
       
   124                                         TUint /*aCameraDisplayID*/ )
       
   125     {
       
   126     aLevels.Reset();
       
   127     for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ )
       
   128         {
       
   129         aLevels.AppendL(
       
   130                 iImageQualitySets->At( i ).iImageQualitySetLevel );
       
   131         }
       
   132     return KErrNone;
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // Get image quality set associated with the given level and Camera/Display ID
       
   137 // if it is nonzero. If the ID is zero, smallest matching ID set is returned.
       
   138 // If there is no set associated with given intermediate
       
   139 // level, then set from a nearest level is returned (dividable by
       
   140 // KBasicQualityGranularity).
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 TInt CImagingConfigManager::GetImageQualitySet( TImageQualitySet& aSet,
       
   144                                                 TInt /*aLevel*/,
       
   145                                                 TUint /*aCameraDisplayID*/ )
       
   146 {
       
   147     initImageQualitySet(aSet);
       
   148     return KErrNone;
       
   149 }
       
   150 
       
   151 
       
   152 void CImagingConfigManager::initImageQualitySet(TImageQualitySet& aSet)
       
   153 {
       
   154     for( TUint i = 0 ; i < KMaxStringLength ; i++ )
       
   155         {
       
   156         aSet.iImageFileMimeType[ i ] = NULL;
       
   157         aSet.iImageFileExtension[ i ] = NULL;
       
   158         }
       
   159     aSet.iImageQualitySetLevel = 100;
       
   160     aSet.iImageWidth = 0;
       
   161     aSet.iImageHeight = 0;
       
   162     aSet.iImageEncoderUID.iUid = 0;
       
   163     aSet.iCompressionQuality = 0;
       
   164     aSet.iEstimatedSize = 0;
       
   165     aSet.iCameraDisplayId = 0;
       
   166     aSet.iCamcorderVisible = 100;
       
   167 
       
   168 }
       
   169 
       
   170 void CImagingConfigManager::initVideoQualitySet(TVideoQualitySet& aSet)
       
   171 {
       
   172     for( TUint i = 0 ; i < KMaxStringLength ; i++ )
       
   173         {
       
   174         aSet.iVideoFileMimeType[ i ] = NULL;
       
   175         aSet.iVideoCodecMimeType[ i ] = NULL;
       
   176         aSet.iPreferredSupplier[ i ] = NULL;
       
   177         }
       
   178     aSet.iVideoQualitySetLevel = 100;
       
   179     aSet.iVideoWidth = 640;
       
   180     aSet.iVideoHeight = 360;
       
   181     aSet.iVideoFrameRate = 0.0;
       
   182     aSet.iVideoBitRate = 100;
       
   183     aSet.iVideoEncoderUID.iUid = 0;
       
   184     aSet.iRandomAccessRate = 0;
       
   185     aSet.iVideoPixelAspectRatioNum = 0;
       
   186     aSet.iVideoPixelAspectRatioDenom = 0;
       
   187     aSet.iAudioFourCCType = 0;
       
   188     aSet.iAudioBitRate = 100;
       
   189     aSet.iAudioSamplingRate = 0;
       
   190     aSet.iAudioChannels = 0;
       
   191     aSet.iAudioEncoderUID.iUid = 0;
       
   192     aSet.iAVSyncStartDelay = 0;
       
   193     aSet.iAVSyncResumeDelay = 0;
       
   194     aSet.iCameraDisplayId = 0;
       
   195     aSet.iCamcorderVisible = 100;
       
   196 
       
   197 }