54
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-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: Setting Provider class implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// ===========================================================================
|
|
20 |
// Includes
|
|
21 |
|
|
22 |
#include "camcameracontrollerflags.hrh"
|
|
23 |
#include <ecam.h>
|
|
24 |
#ifdef CAMERAAPP_CAPI_V2
|
|
25 |
#include <ecamadvsettings.h> // KECamFineResolutionFactor
|
|
26 |
#endif
|
|
27 |
|
|
28 |
#include <ECamOrientationCustomInterface2.h>
|
|
29 |
|
|
30 |
#include "camlogging.h"
|
|
31 |
#include "camcameracontroller.pan"
|
|
32 |
#include "CamSettingsInternal.hrh"
|
|
33 |
#include "camcameracontrollertypes.h"
|
|
34 |
#include "camsettingprovider.h"
|
|
35 |
#include "CamSettingsModel.h"
|
|
36 |
#include "camsettingconversion.h"
|
|
37 |
#include "CamAppController.h"
|
|
38 |
#include "campointerutility.inl"
|
|
39 |
#include "CameraUiConfigManager.h"
|
|
40 |
|
|
41 |
#include "CamAppUi.h"
|
|
42 |
#include "CamUtility.h"
|
|
43 |
#include "CamPSI.h"
|
|
44 |
|
|
45 |
#include "CamVideoQualityLevel.h"
|
|
46 |
|
|
47 |
|
|
48 |
// ===========================================================================
|
|
49 |
// Types
|
|
50 |
|
|
51 |
using namespace NCamCameraController;
|
|
52 |
|
|
53 |
#ifdef CAMERAAPP_CAPI_V2_ADV
|
|
54 |
typedef CCamera::CCameraAdvancedSettings CAS;
|
|
55 |
#endif
|
|
56 |
#ifdef CAMERAAPP_CAPI_V2_IP
|
|
57 |
typedef CCamera::CCameraImageProcessing CIP;
|
|
58 |
#endif
|
|
59 |
|
|
60 |
// ===========================================================================
|
|
61 |
// Local data
|
|
62 |
|
|
63 |
static const TInt KSettingArrayGranularity = 8;
|
|
64 |
|
|
65 |
static const TSize KViewfinderSize = TSize(320, 240);
|
|
66 |
static const TBool KSnapshotMaintainAspect = EFalse;
|
|
67 |
static const TInt KEngineMultiplier = 10;
|
|
68 |
|
|
69 |
// ===========================================================================
|
|
70 |
// Methods
|
|
71 |
|
|
72 |
// static
|
|
73 |
CCamSettingProvider*
|
|
74 |
CCamSettingProvider::NewL( CCamAppController& aController,
|
|
75 |
MCamSettingsModel* aSettingsModel )
|
|
76 |
{
|
|
77 |
CCamSettingProvider* self =
|
|
78 |
CCamSettingProvider::NewLC( aController, aSettingsModel );
|
|
79 |
CleanupStack::Pop( self );
|
|
80 |
return self;
|
|
81 |
}
|
|
82 |
|
|
83 |
// static
|
|
84 |
CCamSettingProvider*
|
|
85 |
CCamSettingProvider::NewLC( CCamAppController& aController,
|
|
86 |
MCamSettingsModel* aSettingsModel )
|
|
87 |
{
|
|
88 |
CCamSettingProvider* self =
|
|
89 |
new (ELeave) CCamSettingProvider( aController, aSettingsModel );
|
|
90 |
CleanupStack::PushL( self );
|
|
91 |
self->ConstructL();
|
|
92 |
return self;
|
|
93 |
}
|
|
94 |
|
|
95 |
// virtual
|
|
96 |
CCamSettingProvider::~CCamSettingProvider()
|
|
97 |
{
|
|
98 |
iPendingSettingChanges.Close();
|
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
// ===========================================================================
|
|
103 |
// From MCamSettingProvider
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// virtual ProvideCameraParamL
|
|
107 |
//
|
|
108 |
// ---------------------------------------------------------------------------
|
|
109 |
//
|
|
110 |
void
|
|
111 |
CCamSettingProvider::ProvideCameraParamL(
|
|
112 |
const NCamCameraController::TCamCameraParamId& aParamId,
|
|
113 |
TAny* aParamData )
|
|
114 |
{
|
|
115 |
__ASSERT_DEBUG( aParamData, Panic( ECamNullPointer ) );
|
|
116 |
switch( aParamId )
|
|
117 |
{
|
|
118 |
// -----------------------------------------------------
|
|
119 |
case ECameraParamImage:
|
|
120 |
{
|
|
121 |
TPckgBuf<TCamParamsImage>* ptr =
|
|
122 |
static_cast<TPckgBuf<TCamParamsImage>*>( aParamData );
|
|
123 |
CheckNonNullL( ptr, KErrNotFound );
|
|
124 |
TCamParamsImage& params( (*ptr)() );
|
|
125 |
CCamAppUiBase* appUi = static_cast<CCamAppUiBase*>( CEikonEnv::Static()->AppUi() );
|
|
126 |
|
|
127 |
// Both primary and secondary camera use Exif format
|
|
128 |
params.iFormat = CCamera::EFormatExif;
|
|
129 |
|
|
130 |
TCamPhotoSizeId PhotoSizeIndex = iSettingsModel->CurrentPhotoResolution();
|
|
131 |
TSize PhotoSize = iSettingsModel->ImageResolutionFromIndex( PhotoSizeIndex );
|
|
132 |
params.iSize = PhotoSize;
|
|
133 |
params.iQualityFactor = iSettingsModel->CurrentPhotoCompression();
|
|
134 |
break;
|
|
135 |
}
|
|
136 |
// -----------------------------------------------------
|
|
137 |
#ifdef CAMERAAPP_CAE_FOR_VIDEO
|
|
138 |
case ECameraParamVideoCae:
|
|
139 |
{
|
|
140 |
TPckgBuf<TCamParamsVideoCae>* ptr =
|
|
141 |
static_cast<TPckgBuf<TCamParamsVideoCae>*>( aParamData );
|
|
142 |
CheckNonNullL( ptr, KErrNotFound );
|
|
143 |
|
|
144 |
TCamParamsVideoCae& params( (*ptr)() );
|
|
145 |
|
|
146 |
|
|
147 |
TInt videoQuality = iSettingsModel->IntegerSettingValue( ECamSettingItemVideoQuality );
|
|
148 |
|
|
149 |
PRINT1( _L("Camera <> CCamSettingProvider::ProvideCameraParamL - video quality (index): %d"), videoQuality );
|
|
150 |
PRINT1( _L("Camera <> CCamSettingProvider::ProvideCameraParamL - quality count: %d"), iSettingsModel->VideoQualityArray().Count() );
|
|
151 |
|
|
152 |
CCamVideoQualityLevel& level = *( iSettingsModel->VideoQualityArray() )[videoQuality];
|
|
153 |
TInt res = level.VideoResolution();
|
|
154 |
PRINT1( _L("Camera <> CCamSettingProvider::ProvideCameraParamL - video resolution (index): %d"), res );
|
|
155 |
PRINT1( _L("Camera <> CCamSettingProvider::ProvideCameraParamL - resolution count: %d"), iSettingsModel->VideoResolutions().Count() );
|
|
156 |
|
|
157 |
// Video resolutions array in Setting Model is set up from
|
|
158 |
// R_CAM_VIDEO_RESOLUTION_ARRAY resource. New resolutions
|
|
159 |
// need to be added there also, in addition to configuration files.
|
|
160 |
TSize resolution = ( iSettingsModel->VideoResolutions() )[ res ];
|
|
161 |
params.iFrameSize = resolution;
|
|
162 |
params.iFrameRate = level.FrameRate();
|
|
163 |
params.iVideoBitRate = level.VideoBitRate();
|
|
164 |
params.iAudioBitRate = level.AudioBitRate();
|
|
165 |
params.iAudioOn = iSettingsModel->IntegerSettingValue( ECamSettingItemVideoAudioRec );
|
|
166 |
params.iMimeType.Set ( level.VideoMimeType() );
|
|
167 |
params.iSupplier.Set ( level.PreferredSupplier() );
|
|
168 |
params.iVideoType.Set( level.VideoFileType() );
|
|
169 |
params.iAudioType.Set( level.AudioType() );
|
|
170 |
|
|
171 |
TInt framerate = -1;
|
|
172 |
TCamSceneId videoscene = static_cast< TCamSceneId > (
|
|
173 |
iSettingsModel->IntegerSettingValue(ECamSettingItemDynamicVideoScene) );
|
|
174 |
|
|
175 |
framerate = iSettingsModel->SceneSettingValue(videoscene, ECamSettingItemSceneFramerate);
|
|
176 |
|
|
177 |
// Change the framerate if scene has defined it to be > 0
|
|
178 |
if ( framerate > 0 )
|
|
179 |
{
|
|
180 |
params.iFrameRate = framerate;
|
|
181 |
}
|
|
182 |
|
|
183 |
PRINT1( _L("Camera <> CCamSettingProvider::ProvideCameraParamL ECameraParamVideoCae framerate: %d"), framerate )
|
|
184 |
|
|
185 |
break;
|
|
186 |
}
|
|
187 |
#endif // CAMERAAPP_CAE_FOR_VIDEO
|
|
188 |
// -----------------------------------------------------
|
|
189 |
case ECameraParamVfMode:
|
|
190 |
{
|
|
191 |
CCamAppUi* appUi = static_cast<CCamAppUi*>( CEikonEnv::Static()->AppUi() );
|
|
192 |
TPckgBuf<TCamViewfinderMode>* ptr =
|
|
193 |
static_cast<TPckgBuf<TCamViewfinderMode>*>( aParamData );
|
|
194 |
CheckNonNullL( ptr, KErrNotFound );
|
|
195 |
TCamViewfinderMode& params( (*ptr)() );
|
|
196 |
TBool isPrimaryCamera = appUi->ActiveCamera() == ECamActiveCameraPrimary;
|
|
197 |
|
|
198 |
if ( iController.IsDirectScreenVFSupported( isPrimaryCamera ) )
|
|
199 |
{// primary camera or 2nd camera DSVF
|
|
200 |
PRINT( _L("Setting Provider <> provide ECameraParamVfMode == ECamViewfinderDirect") );
|
|
201 |
params = ECamViewfinderDirect;
|
|
202 |
}
|
|
203 |
else
|
|
204 |
{// primary camera or 2nd camera bitmap view finder
|
|
205 |
PRINT( _L("Setting Provider <> provide ECameraParamVfMode == ECamViewfinderBitmap") );
|
|
206 |
params = ECamViewfinderBitmap;
|
|
207 |
}
|
|
208 |
break;
|
|
209 |
}
|
|
210 |
// -----------------------------------------------------
|
|
211 |
case ECameraParamVfBitmap:
|
|
212 |
{
|
|
213 |
CCamAppUi* appUi = static_cast<CCamAppUi*>(
|
|
214 |
CEikonEnv::Static()->AppUi() );
|
|
215 |
PRINT2( _L("Setting Provider <> provide ECameraParamVfBitmap. CurrentMode: (%d) TargetMode: (%d)"), iController.CurrentMode(), appUi->TargetMode() );
|
|
216 |
TPckgBuf<TCamParamsVfBitmap>* ptr =
|
|
217 |
static_cast<TPckgBuf<TCamParamsVfBitmap>*>( aParamData );
|
|
218 |
CheckNonNullL( ptr, KErrNotFound );
|
|
219 |
TCamParamsVfBitmap& params( (*ptr)() );
|
|
220 |
|
|
221 |
TDisplayMode displayMode =
|
|
222 |
CEikonEnv::Static()->ScreenDevice()->DisplayMode();
|
|
223 |
CCamera::TFormat viewfinderFormat =
|
|
224 |
CCamSettingConversion::Map2CameraFormat( displayMode );
|
|
225 |
|
|
226 |
const TCamCameraMode cameraMode =
|
|
227 |
( appUi->TargetMode() != ECamControllerIdle)
|
|
228 |
? appUi->TargetMode()
|
|
229 |
: iController.CurrentMode();
|
|
230 |
const TInt resolution = (cameraMode == ECamControllerVideo)
|
|
231 |
? iController.GetCurrentVideoResolution()
|
|
232 |
: iController.GetCurrentImageResolution();
|
|
233 |
params.iRect = CamUtility::ViewfinderLayout( cameraMode, resolution );
|
|
234 |
|
|
235 |
params.iFormat = viewfinderFormat;
|
|
236 |
|
|
237 |
// Mirror viewfinder for secondary camera
|
|
238 |
params.iMirrorImage = ECamActiveCameraSecondary == appUi->ActiveCamera();
|
|
239 |
|
|
240 |
break;
|
|
241 |
}
|
|
242 |
// -----------------------------------------------------
|
|
243 |
case ECameraParamVfDirect:
|
|
244 |
{
|
|
245 |
// Not supported yet.
|
|
246 |
User::Leave( KErrNotSupported );
|
|
247 |
break;
|
|
248 |
}
|
|
249 |
// -----------------------------------------------------
|
|
250 |
case ECameraParamSnapshot:
|
|
251 |
{
|
|
252 |
TPckgBuf<TCamParamsSnapshot>* ptr =
|
|
253 |
static_cast<TPckgBuf<TCamParamsSnapshot>*>( aParamData );
|
|
254 |
CheckNonNullL( ptr, KErrNotFound );
|
|
255 |
TCamParamsSnapshot& params( (*ptr)() );
|
|
256 |
|
|
257 |
// Fetch the snapshot size
|
|
258 |
TDisplayMode displayMode = CEikonEnv::Static()->ScreenDevice()->DisplayMode();
|
|
259 |
TCamCameraMode cameraMode = iController.CurrentMode();
|
|
260 |
TInt resolution = (cameraMode == ECamControllerVideo)
|
|
261 |
? iController.GetCurrentVideoResolution()
|
|
262 |
: iController.GetCurrentImageResolution();
|
|
263 |
params.iSize = CamUtility::ViewfinderLayout( cameraMode, resolution ).Size();
|
|
264 |
params.iFormat = CCamSettingConversion::Map2CameraFormat(displayMode);
|
|
265 |
params.iMaintainAspect = KSnapshotMaintainAspect;
|
|
266 |
break;
|
|
267 |
}
|
|
268 |
// -----------------------------------------------------
|
|
269 |
default:
|
|
270 |
{
|
|
271 |
User::Leave( KErrNotSupported );
|
|
272 |
break;
|
|
273 |
}
|
|
274 |
// -----------------------------------------------------
|
|
275 |
}
|
|
276 |
}
|
|
277 |
|
|
278 |
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
// virtual ProvideCameraSettingL
|
|
281 |
//
|
|
282 |
// ---------------------------------------------------------------------------
|
|
283 |
//
|
|
284 |
void
|
|
285 |
CCamSettingProvider::ProvideCameraSettingL(
|
|
286 |
const NCamCameraController::TCamCameraSettingId& aSettingId,
|
|
287 |
TAny* aSettingData )
|
|
288 |
{
|
|
289 |
CheckNonNullL( aSettingData, KErrArgument );
|
|
290 |
|
|
291 |
TCamCameraMode mode( iController.CurrentMode() );
|
|
292 |
|
|
293 |
switch( aSettingId )
|
|
294 |
{
|
|
295 |
// -----------------------------------------------------
|
|
296 |
// Flash
|
|
297 |
case ECameraSettingFlash:
|
|
298 |
case ECameraUserSceneSettingFlash:
|
|
299 |
{
|
|
300 |
TCamFlashId flashId = static_cast<TCamFlashId> (iSettingsModel->
|
|
301 |
IntegerSettingValue( ECamSettingItemDynamicPhotoFlash ) );
|
|
302 |
if ( mode == ECamControllerVideo )
|
|
303 |
{
|
|
304 |
flashId = static_cast<TCamFlashId> (iSettingsModel->
|
|
305 |
IntegerSettingValue( ECamSettingItemDynamicVideoFlash ) );
|
|
306 |
}
|
|
307 |
CCamera::TFlash CamFlashId = CCamSettingConversion::Map2CameraFlash( flashId );
|
|
308 |
CCamera::TFlash* ptr = static_cast<CCamera::TFlash*>( aSettingData );
|
|
309 |
*ptr = CamFlashId;
|
|
310 |
break;
|
|
311 |
}
|
|
312 |
// -----------------------------------------------------
|
|
313 |
// Exposure (EV mode + EV compensation step)
|
|
314 |
case ECameraSettingExposure:
|
|
315 |
case ECameraUserSceneSettingExposure:
|
|
316 |
{
|
|
317 |
TPckgBuf<TCamSettingDataExposure>* ptr =
|
|
318 |
static_cast<TPckgBuf<TCamSettingDataExposure>*>( aSettingData );
|
|
319 |
TCamSettingDataExposure& evData( (*ptr)() );
|
|
320 |
|
|
321 |
TInt sceneItemId = ( ECamControllerVideo == mode )
|
|
322 |
? ECamSettingItemDynamicVideoScene
|
|
323 |
: ECamSettingItemDynamicPhotoScene;
|
|
324 |
|
|
325 |
TInt sceneId = iSettingsModel->IntegerSettingValue( sceneItemId );
|
|
326 |
|
|
327 |
TCamSceneAEMode evMode =
|
|
328 |
static_cast<TCamSceneAEMode>(
|
|
329 |
iSettingsModel->SceneSettingValue( sceneId, ECamSettingItemSceneAEMode ) );
|
|
330 |
|
|
331 |
evData.iExposureMode = CCamSettingConversion::Map2CameraExposureMode( evMode );
|
|
332 |
PRINT1( _L("Camera <> provide EV mode: %016b"), evData.iExposureMode );
|
|
333 |
#ifdef CAMERAAPP_CAPI_V2
|
|
334 |
TInt evKey;
|
|
335 |
if ( ECameraUserSceneSettingExposure != aSettingId )
|
|
336 |
{
|
|
337 |
evKey = ( ECamControllerVideo == mode )
|
|
338 |
? ECamSettingItemDynamicVideoExposure
|
|
339 |
: ECamSettingItemDynamicPhotoExposure;
|
|
340 |
}
|
|
341 |
else
|
|
342 |
{
|
|
343 |
evKey = ECamSettingItemUserSceneExposure;
|
|
344 |
}
|
|
345 |
|
|
346 |
TInt evValue = iSettingsModel->IntegerSettingValue( evKey );
|
|
347 |
if( iEvStepAsUiValue != 0 )
|
|
348 |
evData.iExposureStep = (evValue * KECamFineResolutionFactor) / iEvStepAsUiValue;
|
|
349 |
else
|
|
350 |
evData.iExposureStep = 0;
|
|
351 |
PRINT1( _L("Camera <> provide EV compensation: %d"), evData.iExposureStep );
|
|
352 |
#else
|
|
353 |
evData.iExposureStep = 0;
|
|
354 |
#endif
|
|
355 |
break;
|
|
356 |
}
|
|
357 |
// -----------------------------------------------------
|
|
358 |
// Light sensitivity (ISO value)
|
|
359 |
case ECameraSettingLightSensitivity:
|
|
360 |
case ECameraUserSceneSettingLightSensitivity:
|
|
361 |
{
|
|
362 |
TInt* ptr = static_cast<TInt*>( aSettingData );
|
|
363 |
TInt isoKey;
|
|
364 |
|
|
365 |
if ( ECameraUserSceneSettingLightSensitivity != aSettingId )
|
|
366 |
{
|
|
367 |
isoKey = ( ECamControllerVideo == mode )
|
|
368 |
? ECamSettingItemDynamicVideoLightSensitivity
|
|
369 |
: ECamSettingItemDynamicPhotoLightSensitivity;
|
|
370 |
}
|
|
371 |
else
|
|
372 |
{
|
|
373 |
isoKey = ECamSettingItemUserSceneLightSensitivity;
|
|
374 |
}
|
|
375 |
// TCamLightSensitivityId type value returned
|
|
376 |
TCamLightSensitivityId isoId =
|
|
377 |
static_cast<TCamLightSensitivityId>( iSettingsModel->IntegerSettingValue( isoKey ) );
|
|
378 |
|
|
379 |
*ptr = CamUtility::MapLightSensitivity2IsoValueL( isoId, iSupportedISORates );
|
|
380 |
PRINT1( _L("Camera <> provide ISO rate: %d"), *ptr );
|
|
381 |
break;
|
|
382 |
}
|
|
383 |
// -----------------------------------------------------
|
|
384 |
// White balance
|
|
385 |
case ECameraSettingWhiteBalance:
|
|
386 |
case ECameraUserSceneSettingWhiteBalance:
|
|
387 |
{
|
|
388 |
TPckgBuf<TCamSettingDataWhiteBalance>* ptr =
|
|
389 |
static_cast<TPckgBuf<TCamSettingDataWhiteBalance>*>( aSettingData );
|
|
390 |
TInt key;
|
|
391 |
|
|
392 |
if ( ECameraUserSceneSettingWhiteBalance != aSettingId )
|
|
393 |
{
|
|
394 |
key = ( ECamControllerVideo == mode )
|
|
395 |
? ECamSettingItemDynamicVideoWhiteBalance
|
|
396 |
: ECamSettingItemDynamicPhotoWhiteBalance;
|
|
397 |
}
|
|
398 |
else
|
|
399 |
{
|
|
400 |
key = ECamSettingItemUserSceneWhitebalance;
|
|
401 |
}
|
|
402 |
|
|
403 |
TCamSettingDataWhiteBalance& wbData( (*ptr)() );
|
|
404 |
|
|
405 |
TCamWhiteBalanceId WB = static_cast<TCamWhiteBalanceId>(iSettingsModel->IntegerSettingValue( key ));
|
|
406 |
CCamera::TWhiteBalance CamWB = CCamSettingConversion::Map2CameraWb( WB );
|
|
407 |
|
|
408 |
wbData.iWhiteBalanceMode = CamWB;
|
|
409 |
break;
|
|
410 |
}
|
|
411 |
#ifdef CAMERAAPP_CAPI_V2_IP
|
|
412 |
// -----------------------------------------------------
|
|
413 |
// Colour effect (colour filter: sepia/b&w/vivid/..)
|
|
414 |
case ECameraSettingColourEffect:
|
|
415 |
case ECameraUserSceneSettingColourEffect:
|
|
416 |
{
|
|
417 |
CIP::TEffect* ptr = static_cast<CIP::TEffect*>( aSettingData );
|
|
418 |
|
|
419 |
TInt key;
|
|
420 |
|
|
421 |
if ( ECameraUserSceneSettingColourEffect != aSettingId )
|
|
422 |
{
|
|
423 |
key = ( ECamControllerVideo == mode )
|
|
424 |
? ECamSettingItemDynamicVideoColourFilter
|
|
425 |
: ECamSettingItemDynamicPhotoColourFilter;
|
|
426 |
}
|
|
427 |
else
|
|
428 |
{
|
|
429 |
key = ECamSettingItemUserSceneColourFilter;
|
|
430 |
}
|
|
431 |
|
|
432 |
TCamColourFilterId uiValue =
|
|
433 |
static_cast<TCamColourFilterId>( iSettingsModel->IntegerSettingValue( key ) );
|
|
434 |
|
|
435 |
CIP::TEffect effect = CCamSettingConversion::Map2CameraEffect( uiValue );
|
|
436 |
|
|
437 |
PRINT1( _L("Camera <> provide colour effect: 0x%08x"), effect );
|
|
438 |
*ptr = effect;
|
|
439 |
break;
|
|
440 |
}
|
|
441 |
// -----------------------------------------------------
|
|
442 |
// Sharpness
|
|
443 |
case ECameraSettingSharpness:
|
|
444 |
case ECameraUserSceneSettingSharpness:
|
|
445 |
{
|
|
446 |
TInt* ptr = static_cast<TInt*>( aSettingData );
|
|
447 |
|
|
448 |
TInt key;
|
|
449 |
|
|
450 |
if ( ECameraUserSceneSettingSharpness != aSettingId )
|
|
451 |
{
|
|
452 |
key = ECamSettingItemDynamicPhotoImageSharpness;
|
|
453 |
}
|
|
454 |
else
|
|
455 |
{
|
|
456 |
key = ECamSettingItemUserSceneImageSharpness;
|
|
457 |
}
|
|
458 |
TCamImageSharpnessId uiValue =
|
|
459 |
static_cast<TCamImageSharpnessId>(
|
|
460 |
iSettingsModel->IntegerSettingValue( key ) );
|
|
461 |
|
|
462 |
TInt sharpness = CamUtility::MapSharpnessId2SharpnessValueL( uiValue );
|
|
463 |
PRINT1( _L("Camera <> provide sharpness: %d"), sharpness );
|
|
464 |
*ptr = sharpness;
|
|
465 |
|
|
466 |
break;
|
|
467 |
}
|
|
468 |
#endif // CAMERAAPP_CAPI_V2_IP
|
|
469 |
// -----------------------------------------------------
|
|
470 |
// Brightness
|
|
471 |
case ECameraSettingBrightness:
|
|
472 |
case ECameraUserSceneSettingBrightness:
|
|
473 |
{
|
|
474 |
CCamera::TBrightness* ptr =
|
|
475 |
static_cast<CCamera::TBrightness*>( aSettingData );
|
|
476 |
|
|
477 |
TInt key;
|
|
478 |
|
|
479 |
if ( ECameraUserSceneSettingBrightness != aSettingId )
|
|
480 |
{
|
|
481 |
key = ( ECamControllerVideo == mode )
|
|
482 |
? ECamSettingItemDynamicVideoBrightness
|
|
483 |
: ECamSettingItemDynamicPhotoBrightness;
|
|
484 |
}
|
|
485 |
else
|
|
486 |
{
|
|
487 |
key = ECamSettingItemUserSceneBrightness;
|
|
488 |
}
|
|
489 |
|
|
490 |
TInt SettingsBrightness = iSettingsModel->IntegerSettingValue( key );
|
|
491 |
CCamera::TBrightness CamBrightness = CCamera::TBrightness( KEngineMultiplier * SettingsBrightness );
|
|
492 |
|
|
493 |
PRINT1( _L("Camera <> provide brightness: %d"), CamBrightness );
|
|
494 |
*ptr = CamBrightness;
|
|
495 |
break;
|
|
496 |
}
|
|
497 |
// -----------------------------------------------------
|
|
498 |
// Contrast
|
|
499 |
case ECameraSettingContrast:
|
|
500 |
case ECameraUserSceneSettingContrast:
|
|
501 |
{
|
|
502 |
CCamera::TContrast* ptr = static_cast<CCamera::TContrast*>( aSettingData );
|
|
503 |
TInt key;
|
|
504 |
|
|
505 |
if ( ECameraUserSceneSettingContrast != aSettingId )
|
|
506 |
{
|
|
507 |
key = ( ECamControllerVideo == mode )
|
|
508 |
? ECamSettingItemDynamicVideoContrast
|
|
509 |
: ECamSettingItemDynamicPhotoContrast;
|
|
510 |
}
|
|
511 |
else
|
|
512 |
{
|
|
513 |
key = ECamSettingItemUserSceneContrast;
|
|
514 |
}
|
|
515 |
|
|
516 |
TInt SettingsContrast = iSettingsModel->IntegerSettingValue( key );
|
|
517 |
CCamera::TContrast CamContrast = CCamera::TContrast( KEngineMultiplier * SettingsContrast );
|
|
518 |
PRINT1( _L("Camera <> provide contrast: %d"), CamContrast );
|
|
519 |
*ptr = CamContrast;
|
|
520 |
break;
|
|
521 |
}
|
|
522 |
// -----------------------------------------------------
|
|
523 |
// Digital zoom
|
|
524 |
case ECameraSettingDigitalZoom:
|
|
525 |
{
|
|
526 |
TInt* ptr = static_cast<TInt*>( aSettingData );
|
|
527 |
CheckNonNullL( ptr, KErrArgument );
|
|
528 |
*ptr = iController.ZoomValue();
|
|
529 |
break;
|
|
530 |
}
|
|
531 |
// -----------------------------------------------------
|
|
532 |
// Optical zoom
|
|
533 |
case ECameraSettingOpticalZoom:
|
|
534 |
{
|
|
535 |
User::Leave( KErrNotSupported );
|
|
536 |
//iSettingsModel->IntegerSettingValue( ECamSettingItemPhotoOpticalZoom );
|
|
537 |
break;
|
|
538 |
}
|
|
539 |
#ifdef CAMERAAPP_CAPI_V2_ADV
|
|
540 |
case ECameraSettingFocusRange:
|
|
541 |
{
|
|
542 |
// User::Leave( KErrNotSupported );
|
|
543 |
CAS::TFocusRange* ptr = static_cast<CAS::TFocusRange*>( aSettingData );
|
|
544 |
|
|
545 |
// Get current scene, from which the focus range value should be obtained
|
|
546 |
TInt currentScene = iSettingsModel->IntegerSettingValue( ECamSettingItemDynamicPhotoScene );
|
|
547 |
if ( currentScene == ECamSceneUser )
|
|
548 |
{
|
|
549 |
// In case of user scene, use the base scene instead
|
|
550 |
currentScene = iSettingsModel->IntegerSettingValue( ECamSettingItemUserSceneBasedOnScene );
|
|
551 |
}
|
|
552 |
PRINT1( _L("Camera <> current scene: %d"), currentScene );
|
|
553 |
|
|
554 |
// Get the autofocus mode in camera internal format
|
|
555 |
TInt afMode = iSettingsModel->SceneSettingValue( currentScene, ECamSettingItemSceneAFMode );
|
|
556 |
|
|
557 |
PRINT1( _L("Camera <> Autofocusmode for current scene: %d"), afMode );
|
|
558 |
|
|
559 |
TCamSettingsOnOff facetrack =
|
|
560 |
static_cast<TCamSettingsOnOff>(
|
|
561 |
iSettingsModel->IntegerSettingValue( ECamSettingItemFaceTracking ) );
|
|
562 |
if ( iController.UiConfigManagerPtr() && iController.UiConfigManagerPtr()->IsFaceTrackingSupported() &&
|
|
563 |
( ECamSettOn == facetrack ) )
|
|
564 |
{
|
|
565 |
// Use CCamera::CCameraAdvancedSettings::EFocusRangeAuto if in facetracking mode.
|
|
566 |
*ptr = CCamera::CCameraAdvancedSettings::EFocusRangeAuto;
|
|
567 |
}
|
|
568 |
else
|
|
569 |
{
|
|
570 |
// Convert it to TFocusRange
|
|
571 |
*ptr = CCamSettingConversion::Map2CameraAutofocus( static_cast<TCamSceneAFMode>( afMode ) );
|
|
572 |
PRINT1( _L("Camera <> Autofocusmode mapped for CCamera: %d"), *ptr );
|
|
573 |
}
|
|
574 |
//CheckNonNullL( ptr, KErrNotFound );
|
|
575 |
//*ptr = KFocusRange;//iSettingsModel->IntegerSettingValue( ECamSettingItemDynamicPhotoFocusRange );
|
|
576 |
break;
|
|
577 |
}
|
|
578 |
// -----------------------------------------------------
|
|
579 |
case ECameraSettingCaptureLimit:
|
|
580 |
{
|
|
581 |
TInt* ptr = static_cast<TInt*>( aSettingData );
|
|
582 |
*ptr = iController.CaptureLimitSetting();
|
|
583 |
|
|
584 |
PRINT1( _L("Camera <> provide capture limit: %d"), *ptr );
|
|
585 |
break;
|
|
586 |
}
|
|
587 |
// -----------------------------------------------------
|
|
588 |
// Stabilization setting (for video)
|
|
589 |
case ECameraSettingStabilization:
|
|
590 |
{
|
|
591 |
TCamSettingDataStabilization& stabilization =
|
|
592 |
( *static_cast<TPckgBuf<TCamSettingDataStabilization>*>( aSettingData ) )();
|
|
593 |
|
|
594 |
TCamSettingsOnOff settingOn =
|
|
595 |
static_cast<TCamSettingsOnOff>( iSettingsModel->IntegerSettingValue( ECamSettingItemVideoStab ) );
|
|
596 |
|
|
597 |
// These could be made product specific..
|
|
598 |
if( ECamSettOn == settingOn )
|
|
599 |
{
|
|
600 |
PRINT( _L("Camera <> Stabilization is set ON") );
|
|
601 |
stabilization.iMode = CAS::EStabilizationModeAuto;
|
|
602 |
stabilization.iEffect = CAS::EStabilizationAuto;
|
|
603 |
stabilization.iComplexity = CAS::EStabilizationComplexityAuto;
|
|
604 |
}
|
|
605 |
else
|
|
606 |
{
|
|
607 |
PRINT( _L("Camera <> Stabilization is set OFF") );
|
|
608 |
stabilization.iMode = CAS::EStabilizationModeOff;
|
|
609 |
stabilization.iEffect = CAS::EStabilizationOff;
|
|
610 |
stabilization.iComplexity = CAS::EStabilizationComplexityAuto;
|
|
611 |
}
|
|
612 |
break;
|
|
613 |
}
|
|
614 |
#endif // CAMERAAPP_CAPI_V2_ADV
|
|
615 |
// -----------------------------------------------------
|
|
616 |
// Device orientation setting
|
|
617 |
case ECameraSettingOrientation:
|
|
618 |
{
|
|
619 |
MCameraOrientation::TOrientation* ptr =
|
|
620 |
static_cast<MCameraOrientation::TOrientation*>( aSettingData );
|
|
621 |
|
|
622 |
TCamImageOrientation orientationSetting =
|
|
623 |
static_cast<TCamImageOrientation>( iController.ImageOrientation() );
|
|
624 |
PRINT1( _L("Camera <> Got image orientation from ui: [%s]"), KCamOrientationNames[orientationSetting] );
|
|
625 |
|
|
626 |
*ptr = CCamSettingConversion::Map2CameraOrientation( orientationSetting );
|
|
627 |
PRINT1( _L("Camera <> provide camera orientation: 0x%02X"), *ptr );
|
|
628 |
break;
|
|
629 |
}
|
|
630 |
// -----------------------------------------------------
|
|
631 |
// Video audio mute setting
|
|
632 |
case ECameraSettingAudioMute:
|
|
633 |
{
|
|
634 |
TCamSettingsOnOff mute =
|
|
635 |
static_cast<TCamSettingsOnOff>(
|
|
636 |
iSettingsModel->IntegerSettingValue( ECamSettingItemVideoAudioRec ) );
|
|
637 |
|
|
638 |
TBool* ptr = static_cast<TBool*>( aSettingData );
|
|
639 |
*ptr = (ECamSettOn == mute);
|
|
640 |
PRINT1( _L("Camera <> provide mute on: %d"), *ptr );
|
|
641 |
break;
|
|
642 |
}
|
|
643 |
// -----------------------------------------------------
|
|
644 |
// Continuous autofocus setting
|
|
645 |
case ECameraSettingContAF:
|
|
646 |
{
|
|
647 |
TCamSettingsOnOff caf = static_cast<TCamSettingsOnOff>(
|
|
648 |
iSettingsModel->IntegerSettingValue( ECamSettingItemContinuousAutofocus ) );
|
|
649 |
|
|
650 |
TBool* ptr = static_cast<TBool*>( aSettingData );
|
|
651 |
*ptr = (ECamSettOn == caf);
|
|
652 |
PRINT1( _L("Camera <> provide continuous autofocus on: %d"), *ptr );
|
|
653 |
break;
|
|
654 |
}
|
|
655 |
// -----------------------------------------------------
|
|
656 |
// facetracking setting
|
|
657 |
case ECameraSettingFacetracking:
|
|
658 |
{
|
|
659 |
TCamSettingsOnOff facetrack =
|
|
660 |
static_cast<TCamSettingsOnOff>(
|
|
661 |
iSettingsModel->IntegerSettingValue( ECamSettingItemFaceTracking ) );
|
|
662 |
TBool* ptr = static_cast<TBool*>( aSettingData );
|
|
663 |
*ptr = (ECamSettOn == facetrack);
|
|
664 |
PRINT1( _L("Camera <> provide facetracking on: %d"), *ptr );
|
|
665 |
break;
|
|
666 |
}
|
|
667 |
// -----------------------------------------------------
|
|
668 |
// Video max size in bytes
|
|
669 |
case ECameraSettingFileMaxSize:
|
|
670 |
{
|
|
671 |
TCamVideoClipLength setting =
|
|
672 |
static_cast<TCamVideoClipLength>(
|
|
673 |
iSettingsModel->IntegerSettingValue( ECamSettingItemVideoClipLength ) );
|
|
674 |
|
|
675 |
TInt* ptr = static_cast<TInt*>( aSettingData );
|
|
676 |
|
|
677 |
*ptr = ( ECamVideoClipShort == setting )
|
|
678 |
? CamUtility::MaxMmsSizeInBytesL()
|
|
679 |
: 0; // 0 means not limited
|
|
680 |
|
|
681 |
PRINT1( _L("Camera <> provide max file size: %d"), *ptr );
|
|
682 |
break;
|
|
683 |
}
|
|
684 |
// -----------------------------------------------------
|
|
685 |
// Video filename
|
|
686 |
case ECameraSettingFileName:
|
|
687 |
{
|
|
688 |
TPtr* ptr = static_cast<TPtr*>( aSettingData );
|
|
689 |
//*ptr = iController.CurrentFullFileName();
|
|
690 |
*ptr = iController.CurrentVideoFileName();
|
|
691 |
break;
|
|
692 |
}
|
|
693 |
// -----------------------------------------------------
|
|
694 |
default:
|
|
695 |
{
|
|
696 |
#ifndef CAMERAAPP_EMULATOR_BUILD
|
|
697 |
User::Leave( KErrNotSupported );
|
|
698 |
#endif // not CAMERAAPP_EMULATOR_BUILD
|
|
699 |
break;
|
|
700 |
}
|
|
701 |
// -----------------------------------------------------
|
|
702 |
}
|
|
703 |
}
|
|
704 |
|
|
705 |
// ---------------------------------------------------------------------------
|
|
706 |
//
|
|
707 |
// ---------------------------------------------------------------------------
|
|
708 |
//
|
|
709 |
void
|
|
710 |
CCamSettingProvider::ProvidePendingSettingChangesL(
|
|
711 |
RArray<NCamCameraController::TCamCameraSettingId>& aSettingIds )
|
|
712 |
{
|
|
713 |
PRINT( _L("Camera => CCamSettingProvider::ProvidePendingSettingChangesL") );
|
|
714 |
aSettingIds.Reset();
|
|
715 |
aSettingIds.ReserveL( iPendingSettingChanges.Count() );
|
|
716 |
for( TInt i = 0; i < iPendingSettingChanges.Count(); i++ )
|
|
717 |
{
|
|
718 |
aSettingIds.AppendL( iPendingSettingChanges[i] );
|
|
719 |
}
|
|
720 |
PRINT1( _L("Camera <> %d settings changed"), aSettingIds.Count() );
|
|
721 |
|
|
722 |
// These have been asked and delivered now.
|
|
723 |
// Update: Reset only when asked. Enables retries.
|
|
724 |
// iPendingSettingChanges.Reset();
|
|
725 |
PRINT( _L("Camera <= CCamSettingProvider::ProvidePendingSettingChangesL") );
|
|
726 |
}
|
|
727 |
|
|
728 |
|
|
729 |
// ---------------------------------------------------------------------------
|
|
730 |
// PendingSettingChangeCount
|
|
731 |
// ---------------------------------------------------------------------------
|
|
732 |
//
|
|
733 |
TInt
|
|
734 |
CCamSettingProvider::PendingSettingChangeCount() const
|
|
735 |
{
|
|
736 |
return iPendingSettingChanges.Count();
|
|
737 |
}
|
|
738 |
|
|
739 |
|
|
740 |
// ===========================================================================
|
|
741 |
// New methods
|
|
742 |
|
|
743 |
// ---------------------------------------------------------------------------
|
|
744 |
// Reset
|
|
745 |
// ---------------------------------------------------------------------------
|
|
746 |
//
|
|
747 |
void
|
|
748 |
CCamSettingProvider::Reset()
|
|
749 |
{
|
|
750 |
PRINT( _L("Camera =><= CCamSettingProvider::Reset") );
|
|
751 |
iPendingSettingChanges.Reset();
|
|
752 |
}
|
|
753 |
|
|
754 |
// ---------------------------------------------------------------------------
|
|
755 |
// AddPendingSettingChangesL
|
|
756 |
// ---------------------------------------------------------------------------
|
|
757 |
//
|
|
758 |
void
|
|
759 |
CCamSettingProvider
|
|
760 |
::AddPendingSettingChangesL( const RArray<TCamSettingItemIds>& aUiSettingIds )
|
|
761 |
{
|
|
762 |
iPendingSettingChanges.ReserveL( aUiSettingIds.Count()
|
|
763 |
+ iPendingSettingChanges.Count() );
|
|
764 |
|
|
765 |
for( TInt i = 0; i < aUiSettingIds.Count(); i++ )
|
|
766 |
{
|
|
767 |
AddPendingSettingChangeL( aUiSettingIds[i] );
|
|
768 |
}
|
|
769 |
}
|
|
770 |
|
|
771 |
// ---------------------------------------------------------------------------
|
|
772 |
// AddPendingSettingChangeL
|
|
773 |
// ---------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
void
|
|
776 |
CCamSettingProvider
|
|
777 |
::AddPendingSettingChangeL( TCamSettingItemIds aUiSettingId )
|
|
778 |
{
|
|
779 |
PRINT1( _L("Camera => CCamSettingProvider::AddPendingSettingChangeL [%s]"),
|
|
780 |
KCamSettingItemNames[aUiSettingId] );
|
|
781 |
|
|
782 |
TCamCameraSettingId cameraId =
|
|
783 |
CCamSettingConversion::Map2CameraControllerSettingId( aUiSettingId );
|
|
784 |
|
|
785 |
if( ECameraSettingNone != cameraId )
|
|
786 |
{
|
|
787 |
// Add each setting only once
|
|
788 |
if( KErrNotFound == iPendingSettingChanges.Find( cameraId ) )
|
|
789 |
{
|
|
790 |
PRINT1( _L("Camera <> Add pending setting [%s]"), KCameraSettingNames[cameraId] );
|
|
791 |
iPendingSettingChanges.AppendL( cameraId );
|
|
792 |
}
|
|
793 |
}
|
|
794 |
else
|
|
795 |
{
|
|
796 |
User::Leave( KErrNotSupported );
|
|
797 |
}
|
|
798 |
PRINT( _L("Camera <= CCamSettingProvider::AddPendingSettingChangeL") );
|
|
799 |
}
|
|
800 |
|
|
801 |
// ---------------------------------------------------------------------------
|
|
802 |
// SetSupportedISORatesL
|
|
803 |
//
|
|
804 |
// ---------------------------------------------------------------------------
|
|
805 |
//
|
|
806 |
void
|
|
807 |
CCamSettingProvider::SetSupportedISORatesL( const RArray<TInt>& aSupportedIsoRates )
|
|
808 |
{
|
|
809 |
iSupportedISORates = aSupportedIsoRates;
|
|
810 |
if ( iSupportedISORates.Count() != 0 )
|
|
811 |
{
|
|
812 |
iValidISORates = ETrue;
|
|
813 |
}
|
|
814 |
}
|
|
815 |
|
|
816 |
// ===========================================================================
|
|
817 |
// private
|
|
818 |
|
|
819 |
void
|
|
820 |
CCamSettingProvider::ConstructL()
|
|
821 |
{
|
|
822 |
PRINT( _L("Camera => CCamSettingProvider::ConstructL") );
|
|
823 |
// Get EV steps range.
|
|
824 |
iEvStepAsUiValue = iController.EvRange().iStepsPerUnit;
|
|
825 |
PRINT( _L("Camera <= CCamSettingProvider::ConstructL") );
|
|
826 |
}
|
|
827 |
|
|
828 |
|
|
829 |
CCamSettingProvider::CCamSettingProvider( CCamAppController& aController,
|
|
830 |
MCamSettingsModel* aSettingsModel )
|
|
831 |
: iSettingsModel( aSettingsModel ),
|
|
832 |
iController ( aController ),
|
|
833 |
iPendingSettingChanges( KSettingArrayGranularity )
|
|
834 |
{
|
|
835 |
}
|
|
836 |
|
|
837 |
|