camerauis/cameraxui/cxengine/src/cxequalitypresetssymbian.cpp
changeset 45 24fd82631616
parent 43 0e652f8f1fbd
equal deleted inserted replaced
43:0e652f8f1fbd 45:24fd82631616
     1 /*
     1 /*
     2 * Copyright (c) 2009, Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 */
    18 */
    19 
    19 
    20 #include <algorithm>
    20 #include <algorithm>
    21 #include <e32std.h> // For Symbian types used in mmsenginedomaincrkeys.h
    21 #include <e32std.h> // For Symbian types used in mmsenginedomaincrkeys.h
    22 #include <MmsEngineDomainCRKeys.h>
    22 #include <MmsEngineDomainCRKeys.h>
       
    23 #include <imagingconfigmanager.h>
    23 
    24 
    24 #include "cxutils.h"
    25 #include "cxutils.h"
    25 #include "cxenamespace.h"
    26 #include "cxenamespace.h"
    26 #include "cxesettings.h"
    27 #include "cxesettings.h"
    27 #include "cxequalitydetails.h"
    28 #include "cxequalitydetails.h"
   220 /*!
   221 /*!
   221 * Creates a new image preset based on TImageQualitySet values from ICM.
   222 * Creates a new image preset based on TImageQualitySet values from ICM.
   222 @ param set contains the ICM configuration data
   223 @ param set contains the ICM configuration data
   223 @ returns CxeImageQuality struct
   224 @ returns CxeImageQuality struct
   224 */
   225 */
   225 CxeImageDetails CxeQualityPresetsSymbian::createImagePreset(TImageQualitySet set)
   226 CxeImageDetails CxeQualityPresetsSymbian::createImagePreset(const TImageQualitySet &set)
   226 {
   227 {
   227     CxeImageDetails newPreset;
   228     CxeImageDetails newPreset;
   228     // set setting values from quality set
   229     // set setting values from quality set
   229     newPreset.mWidth = set.iImageWidth;
   230     newPreset.mWidth = set.iImageWidth;
   230     newPreset.mHeight = set.iImageHeight;
   231     newPreset.mHeight = set.iImageHeight;
   242 
   243 
   243 
   244 
   244 /*!
   245 /*!
   245 * Creates a new video preset based on TVideoQualitySet values from ICM.
   246 * Creates a new video preset based on TVideoQualitySet values from ICM.
   246 */
   247 */
   247 CxeVideoDetails CxeQualityPresetsSymbian::createVideoPreset(TVideoQualitySet set)
   248 CxeVideoDetails CxeQualityPresetsSymbian::createVideoPreset(const TVideoQualitySet &set)
   248 {
   249 {
   249     CX_DEBUG_ENTER_FUNCTION();
   250     CX_DEBUG_ENTER_FUNCTION();
   250     CxeVideoDetails newPreset;
   251     CxeVideoDetails newPreset;
   251     // set setting values from quality set
   252     // set setting values from quality set
   252     newPreset.mWidth = set.iVideoWidth;
   253     newPreset.mWidth = set.iVideoWidth;
   382     if (scaler == 0) {
   383     if (scaler == 0) {
   383         // video bit rate scaler is 0, use the constant value
   384         // video bit rate scaler is 0, use the constant value
   384         scaler = VIDEO_AVG_BITRATE_SCALER;
   385         scaler = VIDEO_AVG_BITRATE_SCALER;
   385     }
   386     }
   386 
   387 
   387     int muteSetting = 0; // audio enabled
   388     bool muteSetting = mSettings.get<bool>(CxeSettingIds::VIDEO_MUTE_SETTING, false); // false = audio enabled
   388     mSettings.get(CxeSettingIds::VIDEO_MUTE_SETTING, muteSetting);
       
   389 
   389 
   390     int avgVideoBitRate = (details.mVideoBitRate * scaler);
   390     int avgVideoBitRate = (details.mVideoBitRate * scaler);
   391     int avgAudioBitRate = (muteSetting == 1) ? 0 : details.mAudioBitRate;
   391     int avgAudioBitRate = muteSetting ? 0 : details.mAudioBitRate;
   392 
   392 
   393     quint32 averageBitRate = (quint32)((avgVideoBitRate + avgAudioBitRate) * VIDEO_METADATA_COEFF);
   393     quint32 averageBitRate = (quint32)((avgVideoBitRate + avgAudioBitRate) * VIDEO_METADATA_COEFF);
   394     quint32 averageByteRate = averageBitRate / 8;
   394     quint32 averageByteRate = averageBitRate / 8;
   395 
   395 
   396     // 0 <= Remaining time <= KCamCMaxClipDurationInSecs
   396     // 0 <= Remaining time <= KCamCMaxClipDurationInSecs
   435 
   435 
   436 /*!
   436 /*!
   437 * Helper method to enable debug prints.
   437 * Helper method to enable debug prints.
   438 @ param  Video quality preset values are printed out for debugging
   438 @ param  Video quality preset values are printed out for debugging
   439 */
   439 */
   440 void CxeQualityPresetsSymbian::debugPrints(CxeVideoDetails preset)
   440 void CxeQualityPresetsSymbian::debugPrints(const CxeVideoDetails &preset)
   441 {
   441 {
   442     CX_DEBUG(("Video quality details"));
   442     CX_DEBUG(("Video quality details"));
   443     CX_DEBUG(("Video resolution (%d,%d)", preset.mWidth, preset.mHeight));
   443     CX_DEBUG(("Video resolution (%d,%d)", preset.mWidth, preset.mHeight));
   444     CX_DEBUG(("Audio bitrate = %d)", preset.mAudioBitRate));
   444     CX_DEBUG(("Audio bitrate = %d)", preset.mAudioBitRate));
   445     CX_DEBUG(("Video bitrate = %d)", preset.mVideoBitRate));
   445     CX_DEBUG(("Video bitrate = %d)", preset.mVideoBitRate));
   460 
   460 
   461 /*!
   461 /*!
   462 * Helper method to enable debug prints.
   462 * Helper method to enable debug prints.
   463 @ param  Image quality preset values are printed out for debugging
   463 @ param  Image quality preset values are printed out for debugging
   464 */
   464 */
   465 void CxeQualityPresetsSymbian::debugPrints(CxeImageDetails newPreset)
   465 void CxeQualityPresetsSymbian::debugPrints(const CxeImageDetails &newPreset)
   466 {
   466 {
   467     CX_DEBUG(("Image quality details"));
   467     CX_DEBUG(("Image quality details"));
   468     CX_DEBUG(("Image resolution (%d,%d)", newPreset.mWidth, newPreset.mHeight));
   468     CX_DEBUG(("Image resolution (%d,%d)", newPreset.mWidth, newPreset.mHeight));
   469     CX_DEBUG(("Estimated size in bytes = %d)", newPreset.mEstimatedSize));
   469     CX_DEBUG(("Estimated size in bytes = %d)", newPreset.mEstimatedSize));
   470     CX_DEBUG(("Megapixels: %s", newPreset.mMpxCount.toAscii().data()));
   470     CX_DEBUG(("Megapixels: %s", newPreset.mMpxCount.toAscii().data()));