1 /* |
|
2 * Copyright (c) 2007-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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAM_CAMERACONTROLLER_H |
|
20 #define CAM_CAMERACONTROLLER_H |
|
21 |
|
22 |
|
23 // =========================================================================== |
|
24 // Included headers |
|
25 #include "camcameracontrollerflags.hrh" |
|
26 |
|
27 #include <e32base.h> |
|
28 #include <ecam.h> |
|
29 #ifdef CAMERAAPP_CAE_FOR_VIDEO |
|
30 #include <CaeEngine.h> |
|
31 #endif |
|
32 |
|
33 #include "camimageencoder.h" |
|
34 #include "camcameraevents.h" |
|
35 #include "camcamerarequests.h" |
|
36 #include "camcameracontrollertypes.h" |
|
37 #include "camcameracontrollersettings.h" |
|
38 #include "mcamcameraobserver.h" // MCamCameraObservable, MCamCameraObserver |
|
39 |
|
40 // =========================================================================== |
|
41 // Forward declarations |
|
42 |
|
43 class MCameraBuffer; |
|
44 class MCamSettingProvider; |
|
45 class CIdle; |
|
46 class CFbsBitmap; |
|
47 |
|
48 class CCamSnapshotProvider; |
|
49 class CCamCameraControllerActive; |
|
50 class CCamAppController; |
|
51 |
|
52 #ifdef CAMERAAPP_CAPI_EMULATOR |
|
53 class CCamCamera; |
|
54 #define CAMERA CCamCamera |
|
55 #else |
|
56 #define CAMERA CCamera |
|
57 #endif // CAMERAAPP_CAPI_EMULATOR |
|
58 |
|
59 #ifdef FORCE_DUMMY_ENGINE |
|
60 class CCameraappDummyEngine; |
|
61 #endif // FORCE_DUMMY_ENGINE |
|
62 |
|
63 class MCameraOrientation; |
|
64 class MCameraFaceTracking; |
|
65 class MCameraUIOrientationOverride; |
|
66 class MCameraUseCaseHint; |
|
67 |
|
68 |
|
69 #ifdef CAMERAAPP_PERFORMANCE_CONTROLLER |
|
70 class CCamPerformanceLogger; |
|
71 #endif |
|
72 #ifdef CAMERAAPP_FLASH_SIMULATOR |
|
73 class CCamFlashSimulator; |
|
74 #endif |
|
75 |
|
76 #ifdef CAMERAAPP_CAE_ERR_SIMULATION |
|
77 class CCamTimer; |
|
78 #endif // CAMERAAPP_CAE_ERR_SIMULATION |
|
79 |
|
80 // =========================================================================== |
|
81 // Class declarations |
|
82 |
|
83 |
|
84 /** |
|
85 * Camera controller class. |
|
86 * |
|
87 * If using MCameraObserver to receive callbacks from (old) Camera API, |
|
88 * still use (new) MCameraObserver2 to receive thumbnails events. |
|
89 */ |
|
90 class CCamCameraController : public CBase, |
|
91 public MCamCameraObservable, |
|
92 #ifdef CAMERAAPP_CAE_FOR_VIDEO |
|
93 public MCamAppEngineObserver, |
|
94 #endif |
|
95 #if !defined( CAMERAAPP_CAPI_V2 ) |
|
96 public MCameraObserver, |
|
97 #endif |
|
98 public MCameraObserver2, |
|
99 public MCamImageEncoderObserver |
|
100 { |
|
101 // ======================================================= |
|
102 // Friends |
|
103 private: |
|
104 |
|
105 friend class CCamCameraControllerActive; |
|
106 |
|
107 // ======================================================= |
|
108 // Methods |
|
109 |
|
110 // ------------------------------------------------------- |
|
111 // Public constructors and destructor |
|
112 public: |
|
113 |
|
114 static CCamCameraController* NewL( MCamSettingProvider& aProvider, |
|
115 CCamAppController& aAppController, |
|
116 TInt aCameraIndex = 0 ); |
|
117 virtual ~CCamCameraController(); |
|
118 |
|
119 // ------------------------------------------------------- |
|
120 // From MCamCameraObservable |
|
121 public: |
|
122 virtual void AttachObserverL( const MCamCameraObserver* aObserver, |
|
123 const TUint& aInterest ); |
|
124 virtual void DetachObserver ( const MCamCameraObserver* aObserver ); |
|
125 |
|
126 // ------------------------------------------------------- |
|
127 // From MCameraObserver2 |
|
128 public: |
|
129 virtual void HandleEvent( const TECAMEvent& aEvent ); |
|
130 virtual void ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError ); |
|
131 virtual void ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError ); |
|
132 virtual void VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError ); |
|
133 |
|
134 #ifndef CAMERAAPP_CAPI_V2 |
|
135 // ------------------------------------------------------- |
|
136 // From MCameraObserver |
|
137 public: |
|
138 virtual void ReserveComplete( TInt aError ); |
|
139 virtual void PowerOnComplete( TInt aError ); |
|
140 virtual void ViewFinderFrameReady( CFbsBitmap& aFrame ); |
|
141 virtual void ImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError ); |
|
142 virtual void FrameBufferReady( MFrameBuffer* aFrameBuffer, TInt aError ); |
|
143 #endif // CAMERAAPP_CAPI_V2 |
|
144 |
|
145 #ifdef CAMERAAPP_CAE_FOR_VIDEO |
|
146 // ------------------------------------------------------- |
|
147 // From MCamAppEngineObserver |
|
148 public: |
|
149 virtual void McaeoInitComplete( TInt aError ); |
|
150 virtual void McaeoStillPrepareComplete( TInt aError ); |
|
151 virtual void McaeoVideoPrepareComplete( TInt aError ); |
|
152 virtual void McaeoViewFinderFrameReady( CFbsBitmap& aFrame, TInt aError ); |
|
153 virtual void McaeoSnapImageReady( const CFbsBitmap& aBitmap, TInt aError ); |
|
154 virtual void McaeoStillImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError ); |
|
155 virtual void McaeoVideoRecordingOn( TInt aError ); |
|
156 virtual void McaeoVideoRecordingPaused( TInt aError ); |
|
157 virtual void McaeoVideoRecordingComplete( TInt aError ); |
|
158 virtual void McaeoVideoRecordingTimes( |
|
159 TTimeIntervalMicroSeconds aTimeElapsed, |
|
160 TTimeIntervalMicroSeconds aTimeRemaining, |
|
161 TInt aError ); |
|
162 virtual void McaeoVideoRecordingStopped(); |
|
163 #endif // CAMERAAPP_CAE_FOR_VIDEO |
|
164 |
|
165 // ------------------------------------------------------- |
|
166 // From MCamImageEncoderObserver |
|
167 public: |
|
168 |
|
169 virtual void ImageEncoded( TInt aStatus, HBufC8* aData ); |
|
170 |
|
171 // ------------------------------------------------------- |
|
172 // New methods |
|
173 public: |
|
174 |
|
175 /** |
|
176 * Issue a request for one operation. |
|
177 * Operation will be started synchronously. |
|
178 * Observers will receive notification when the operation is ready. |
|
179 */ |
|
180 void RequestL( const TCamCameraRequestId& aRequestId ); |
|
181 |
|
182 /** |
|
183 * |
|
184 */ |
|
185 void DirectRequestL( const TCamCameraRequestId& aRequestId ); |
|
186 |
|
187 /** |
|
188 * Issue a sequence of operation requests. |
|
189 * This method will return immediately and the requests will be |
|
190 * processed in the background by callbacks. |
|
191 */ |
|
192 void RequestSequenceL( const RCamRequestArray& aSequence ); |
|
193 |
|
194 /** |
|
195 * Request one or more settings to be set to camera. |
|
196 * The settings to be processed are queried from Setting Provider. |
|
197 * Also the values are queried from there. |
|
198 * Settings are processed asynchronously and ECamCameraEventSettingsDone |
|
199 * event is sent when the process is complete. |
|
200 */ |
|
201 void RequestSettingsChangeL(); |
|
202 |
|
203 /** |
|
204 * Request one setting to be set synchronously to camera. |
|
205 * @param aSettingId Id of the setting to change. Value to set |
|
206 * is asked from Setting Provider. |
|
207 * @see TCamCameraSettingId |
|
208 */ |
|
209 void DirectSettingsChangeL( |
|
210 const NCamCameraController::TCamCameraSettingId& aSettingId ); |
|
211 |
|
212 /** |
|
213 * Cancel outstanding request sequence. |
|
214 * Operations that have been already performed will not be rolled back. |
|
215 * Observers have received notifications of such operations. |
|
216 * If the sequence is not completed already (observers have not received |
|
217 * ECamEngineEventSequenceEnd notification), once the sequence is cancelled, |
|
218 * observers will receive ECamEngineEventSequenceEnd notification with |
|
219 * status KErrCancel. |
|
220 */ |
|
221 void CancelSequence(); |
|
222 |
|
223 void SwitchCameraL( TInt aCameraIndex ); |
|
224 |
|
225 void CompleteSwitchCameraL(); |
|
226 |
|
227 void SetOrientationModeL( TInt aOrientation ); |
|
228 |
|
229 /** |
|
230 * Set viewfinder window for direct screen viewfinder. The handle must remain |
|
231 * valid as long as viewfinder is running. |
|
232 * @since S60 v5.0 |
|
233 * @param aWindow Handle to viewfinder window. Must remain valid while |
|
234 * viewfinder is running. Ownership not transferred. |
|
235 */ |
|
236 void SetViewfinderWindowHandle( RWindowBase* aWindow ); |
|
237 |
|
238 /** |
|
239 * Notify that the viewfinder window is about to be deleted. Viewfinder |
|
240 * will be stopped if this window handle is currently used for the |
|
241 * viewfinder. |
|
242 * @since S60 v5.0 |
|
243 * @param aWindow Handle to viewfinder window. Ownership not transferred. |
|
244 */ |
|
245 void ViewfinderWindowDeleted( RWindowBase* aWindow ); |
|
246 |
|
247 // ------------------------------------------------------- |
|
248 // Info getters |
|
249 public: |
|
250 |
|
251 static TInt CamerasAvailable(); |
|
252 |
|
253 TInt CameraHandle(); // Calls CCamera::Handle which is not const |
|
254 |
|
255 const TCameraInfo& CameraInfo() const; |
|
256 const TCamControllerInfo& ControllerInfo() const; |
|
257 |
|
258 TUint State() const; |
|
259 TCamViewfinderMode ViewfinderMode() const; |
|
260 TCamCameraTriState ViewfinderState() const; |
|
261 TCamCameraTriState SnapshotState() const; |
|
262 TCamCameraReadyState FlashState() const; |
|
263 |
|
264 /** |
|
265 * Method to retrieve the Remaining recording time from |
|
266 * CCaeEngine, this information is used in AppUi and |
|
267 * AppController to handle or continue with Video Rec operation |
|
268 */ |
|
269 TTimeIntervalMicroSeconds RemainingVideoRecordingTime(); |
|
270 |
|
271 void GetCameraSettingValueL( |
|
272 const NCamCameraController::TCamCameraSettingId& aSettingId, |
|
273 TAny* aSettingData ); |
|
274 |
|
275 /** |
|
276 * Checks whether setting value given by setting provider matches |
|
277 * the value currently set for iCamera. |
|
278 * @param aSettingId Setting id |
|
279 * @return upToDate |
|
280 */ |
|
281 TBool SettingValueUpToDateL( |
|
282 const NCamCameraController::TCamCameraSettingId& aSettingId ); |
|
283 |
|
284 // ------------------------------------------------------- |
|
285 // Private methods |
|
286 private: |
|
287 |
|
288 TInt ProcessNextRequestL(); |
|
289 |
|
290 TInt ProcessOneRequestL( const TCamCameraRequestId& aRequestId ); |
|
291 |
|
292 TInt ProcessSettingL( |
|
293 const NCamCameraController::TCamCameraSettingId& aSettingId ); |
|
294 |
|
295 // Helper methods used to divide ProcessOneRequestL to smaller portions. |
|
296 TInt ProcessControlStartupRequestL( const TCamCameraRequestId& aRequestId ); |
|
297 TInt ProcessControlShutdownRequest( const TCamCameraRequestId& aRequestId ); // non-leaving |
|
298 |
|
299 TInt ProcessVfRequestL( const TCamCameraRequestId& aRequestId ); |
|
300 void InitViewfinderL( const TCamViewfinderMode& aMode ); |
|
301 void ProcessVfStartRequestL(); |
|
302 void ProcessVfStopRequestL(); |
|
303 void ProcessVfStopEcamRequest(); |
|
304 void ProcessVfRelaseRequest(); // non-leaving |
|
305 |
|
306 TInt ProcessSnapshotRequestL( const TCamCameraRequestId& aRequestId ); |
|
307 void ProcessSsStopRequest(); // non-leaving |
|
308 void ProcessSsReleaseRequest(); // non-leaving |
|
309 void InitSnapshotL(); |
|
310 |
|
311 TInt ProcessImageRequestL( const TCamCameraRequestId& aRequestId ); |
|
312 TInt ProcessImageShutdownRequest( const TCamCameraRequestId& aRequestId ); |
|
313 |
|
314 TInt ProcessVideoRequestL( const TCamCameraRequestId& aRequestId ); |
|
315 |
|
316 void ProcessAutofocusRequestL( const TCamCameraRequestId& aRequestId ); |
|
317 |
|
318 void ProcessCaptureLimitSettingL(); |
|
319 |
|
320 void EndSequence( TInt aStatus ); |
|
321 void ClearRequestQueue(); |
|
322 void ClearSettingQueue(); |
|
323 |
|
324 // ------------------------------------------------------- |
|
325 // Event handlers |
|
326 |
|
327 void HandlePowerOnEvent( TInt aStatus ); |
|
328 void HandleReserveGainEvent( TInt aStatus ); |
|
329 void HandleReserveLostEvent( TInt aStatus ); |
|
330 void HandleViewfinderEvent( MCameraBuffer* aBitmap, TInt aStatus ); |
|
331 void HandleImageCaptureEvent( MCameraBuffer* aBitmap, TInt aStatus ); |
|
332 void HandleImageCaptureEventL( MCameraBuffer*& aCameraBuffer ); |
|
333 void HandleSnapshotEvent( TInt aStatus ); |
|
334 void HandleSnapshotEventL( TBool aIgnore = EFalse ); |
|
335 |
|
336 void HandleVideoEvent( const TCamCameraEventId& aEventId, |
|
337 TInt aStatus ); |
|
338 |
|
339 void HandleVideoTimeEvent( TInt aStatus, |
|
340 TTimeIntervalMicroSeconds aTimeElapsed, |
|
341 TTimeIntervalMicroSeconds aTimeRemaining ); |
|
342 |
|
343 void HandleAutoFocusEvent( TInt aStatus, |
|
344 const TUid& aEventUid ); |
|
345 |
|
346 void HandleFlashStatusEvent( TInt aStatus, |
|
347 const TCamCameraEventId& aEventId ); |
|
348 |
|
349 void HandleCallbackEvent( |
|
350 TInt aStatus, |
|
351 const TCamCameraEventId& aEventId, |
|
352 const TCamCameraEventClassId& aEventClass, |
|
353 TAny* aEventData = NULL ); |
|
354 |
|
355 // ------------------------------------------------------- |
|
356 // Helper methods |
|
357 |
|
358 void ReleaseCurrentCamera(); |
|
359 void ReleaseCustomInterfaces(); |
|
360 |
|
361 TBool HasCallback( const TCamCameraRequestId& aType ); |
|
362 |
|
363 TBool CurrentSettingHasCallback(); |
|
364 |
|
365 /** |
|
366 * Sets viewfinder window ordinal position so that the window is visible. |
|
367 * Window needs to visible when viewfinder is started. In addition, |
|
368 * ordinal position can be set as a parameter, if original position needs to |
|
369 * be returned back. |
|
370 * @since S60 5.0 |
|
371 * @param aOrdinalPosition,viewfinder window ordinal position to set |
|
372 * @return TInt, DSA viewfinder window ordinal position or KErrUnknown |
|
373 */ |
|
374 TInt SetVfWindowOrdinal( TInt aOrdinalPosition = KErrUnknown ); |
|
375 |
|
376 |
|
377 // ------------------------------------------------------- |
|
378 // Notification of observers |
|
379 |
|
380 void NotifyObservers( TInt aStatus, |
|
381 TCamCameraEventId aEventId, |
|
382 TCamCameraEventClassId aEventClass, |
|
383 TAny* aEventData = NULL ); |
|
384 |
|
385 |
|
386 |
|
387 // ------------------------------------------------------- |
|
388 // Getters for info on current camera |
|
389 |
|
390 TInt GetResolutionIndexL( CCamera::TFormat& aFormat, |
|
391 const TSize& aSize ); |
|
392 #ifdef CAMERAAPP_CAPI_V2_ADV |
|
393 /** |
|
394 * Get info related to advanced settings. |
|
395 */ |
|
396 void GetAdvancedSettingsInfoL(); |
|
397 |
|
398 /** |
|
399 * Get closest supported EV compensation step to the given value. |
|
400 * @aEvProposedStep The step for which the closest supported one |
|
401 * is asked. |
|
402 * @return Closest supported step to the given proposed step. |
|
403 * Always 0 if no supported EV steps available. |
|
404 */ |
|
405 TInt ResolveEvStep( TInt aEvProposedStep ) const; |
|
406 |
|
407 /** |
|
408 * Helper method to check whether the given value is supported, |
|
409 * based on the value array and value info. |
|
410 * Depending on aValueInfo content, the aValueList may represent |
|
411 * the supported values in completely different ways. This |
|
412 * method is used to help determining if single value is supported |
|
413 * or not. |
|
414 * @param aValue The value to be checked if it's supported. |
|
415 * @param aValueList Array describing the supported values. Actual meaning |
|
416 * depends on aValueInfo value. |
|
417 * @param aValueInfo Enumeration value describing the meaning of values in |
|
418 * aValueList array. |
|
419 * @see TValueInfo |
|
420 */ |
|
421 static TBool IsSupportedValue( const TInt& aValue, |
|
422 const RArray<TInt>& aValueList, |
|
423 const TValueInfo& aValueInfo ); |
|
424 |
|
425 #endif // CAMERAAPP_CAPI_V2_ADV |
|
426 |
|
427 /** |
|
428 * Resolve the snapshot format to be used based on supported formats |
|
429 * and the given preferred format. |
|
430 * |
|
431 * @aPreferredFormat Format to be preferably used, if available. |
|
432 * @leave KErrNotSupported No acceptable formats are supported. |
|
433 * @leave KErrNotReady Snapshot provider not available. |
|
434 * @return Best supported snapshot format. |
|
435 */ |
|
436 CCamera::TFormat ResolveSnapshotFormatL( CCamera::TFormat aPreferredFormat ) const; |
|
437 |
|
438 |
|
439 // ------------------------------------------------------- |
|
440 // Conversion methods between requests, events and event classes |
|
441 |
|
442 static TCamCameraEventId Request2Event( const TCamCameraRequestId& aType ); |
|
443 |
|
444 static TCamCameraEventClassId EventClass( const TCamCameraEventId& aEventId ); |
|
445 |
|
446 // Comparison function for searching for a matching resolution in |
|
447 // an RArray<TSize> |
|
448 static TBool CompareSize( const TSize& aA, const TSize& aB ); |
|
449 |
|
450 // ------------------------------------------------------- |
|
451 // Camera / engine construction |
|
452 |
|
453 CCaeEngine* NewCaeEngineL( TInt aCameraIndex ); |
|
454 |
|
455 CAMERA* NewCameraL( TInt aCameraIndex ); |
|
456 |
|
457 CAMERA* NewDuplicateCameraL( TInt aCameraHandle ); |
|
458 |
|
459 // ------------------------------------------------------- |
|
460 // Private constructors |
|
461 private: |
|
462 |
|
463 void ConstructL( TInt aCameraIndex ); |
|
464 |
|
465 CCamCameraController( MCamSettingProvider& aProvider, |
|
466 CCamAppController& aAppController ); |
|
467 |
|
468 // ------------------------------------------------------- |
|
469 // Prints for debug builds |
|
470 #ifdef _DEBUG |
|
471 private: |
|
472 |
|
473 void PrintCameraInfo() const; |
|
474 |
|
475 #ifdef CAMERAAPP_CAPI_V2_ADV |
|
476 void PrintAdvancedSettingInfo() const; |
|
477 #endif // CAMERAAPP_CAPI_V2_ADV |
|
478 |
|
479 void PrintSnapshotInfo() const; |
|
480 |
|
481 #endif // _DEBUG |
|
482 |
|
483 |
|
484 void SetFaceTrackingL(); |
|
485 |
|
486 /** |
|
487 * Inform CAPI about the UseCase (still or video) |
|
488 * before calling Reserve. |
|
489 * |
|
490 */ |
|
491 void HintUseCaseL(); |
|
492 |
|
493 // ======================================================= |
|
494 // Data |
|
495 private: |
|
496 |
|
497 // ------------------------------------------------------- |
|
498 // Request queue and related |
|
499 TInt iSequenceIndex; |
|
500 RCamRequestArray iSequenceArray; |
|
501 |
|
502 TInt iReserveTryAgainCount; |
|
503 |
|
504 // ------------------------------------------------------- |
|
505 // Settings queue and related |
|
506 TInt iSettingIndex; |
|
507 RArray<NCamCameraController::TCamCameraSettingId> iSettingArray; |
|
508 |
|
509 MCamSettingProvider& iSettingProvider; /** Entity providing settings. */ |
|
510 |
|
511 // ------------------------------------------------------- |
|
512 // Active object thriving our asynchronous processes. |
|
513 |
|
514 CCamCameraControllerActive* iActive; /** Own. */ |
|
515 |
|
516 // ------------------------------------------------------- |
|
517 // Observers and their interests |
|
518 |
|
519 RPointerArray<MCamCameraObserver> iObservers; /** Array of observers. Observers not own. */ |
|
520 RArray <TUint> iObserverInterests; /** Array of observer interests */ |
|
521 |
|
522 |
|
523 // ------------------------------------------------------- |
|
524 // Info containers |
|
525 TCameraInfo iCameraInfo; /** Camera details */ |
|
526 TCamControllerInfo iInfo; /** Our own details */ |
|
527 |
|
528 TCamCameraResolutionSupport iResolutionSupport; /** Supported resolutions info */ |
|
529 #ifdef CAMERAAPP_CAPI_V2_ADV |
|
530 TCamAdvancedSettingInfo iAdvancedSettingInfo; /** Info related to advanced settings */ |
|
531 #endif |
|
532 |
|
533 TBool iAlternateFormatInUse; /** Encode jpeg from bitmap internally */ |
|
534 |
|
535 // ------------------------------------------------------- |
|
536 // ECam |
|
537 CAMERA* iCamera; /** Onboard camera instance. Own. */ |
|
538 TBool iReleasedByUi; /** Flag to distinguish own and external */ |
|
539 /** camera release. */ |
|
540 |
|
541 #ifdef CAMERAAPP_CAPI_V2 |
|
542 #ifdef CAMERAAPP_CAPI_V2_DVF |
|
543 CCamera::CCameraDirectViewFinder* iDirectViewfinder; /** Direct viewfinder. Own. */ |
|
544 #endif |
|
545 #ifdef CAMERAAPP_CAPI_V2_OL |
|
546 CCamera::CCameraOverlay* iOverlayProvider; /** Overlay provider. Own. */ |
|
547 #endif |
|
548 #ifdef CAMERAAPP_CAPI_V2_ADV |
|
549 CCamera::CCameraAdvancedSettings* iAdvancedSettings; /** Advanced settings instance. Own. */ |
|
550 #endif |
|
551 #ifdef CAMERAAPP_CAPI_V2_HG |
|
552 CCamera::CCameraHistogram* iHistogramProvider; /** Histogram provider. Own. */ |
|
553 #endif |
|
554 #ifdef CAMERAAPP_CAPI_V2_IP |
|
555 CCamera::CCameraImageProcessing* iImageProcessor; /** Image processor. Own. */ |
|
556 #endif |
|
557 #endif |
|
558 |
|
559 CCamSnapshotProvider* iSnapshotProvider; |
|
560 |
|
561 CCamImageEncoder* iEncoder; |
|
562 |
|
563 MCameraOrientation* iCustomInterfaceOrientation; /** Not own. */ |
|
564 |
|
565 MCameraFaceTracking* iCustomInterfaceFaceTracking; /** Not own. */ |
|
566 |
|
567 MCameraUIOrientationOverride* iCustomInterfaceUIOrientationOverride; /** Not own. */ |
|
568 |
|
569 MCameraUseCaseHint* iCustomInterfaceUseCaseHint; /** Not own. */ |
|
570 |
|
571 // ------------------------------------------------------- |
|
572 // CAE |
|
573 #ifdef CAMERAAPP_CAE_FOR_VIDEO |
|
574 |
|
575 CCaeEngine* iCaeEngine; /** Camera app engine for video. Own. */ |
|
576 TCamVideoRecordingTimes iVideoTimes; |
|
577 TBool iAsyncVideoStopModeSupported; |
|
578 |
|
579 #ifdef CAMERAAPP_CAE_FIX |
|
580 /** |
|
581 * Workaround for changing between video (CCaeEngine) and image (CCamera) modes |
|
582 * Without the support for camera handle sharing in CAE. |
|
583 */ |
|
584 |
|
585 TBool iCaeInUse; |
|
586 |
|
587 TInt ProceedModeSwitch(); |
|
588 TInt DoProceedModeSwitchL(); |
|
589 |
|
590 enum TCamModeChange |
|
591 { |
|
592 ECamModeChangeInactive, |
|
593 ECamModeChangeVideo2Image, |
|
594 ECamModeChangeImage2Video |
|
595 }; |
|
596 enum TCamModeChangePhase |
|
597 { |
|
598 ECamModeChangePhaseIdle, |
|
599 ECamModeChangePhase0, |
|
600 ECamModeChangePhase1, |
|
601 ECamModeChangePhase2, |
|
602 ECamModeChangePhase3, |
|
603 ECamModeChangePhase4 |
|
604 }; |
|
605 |
|
606 TCamModeChange iModeChange; |
|
607 TInt iModeChangePhase; // TCamModeChangePhase |
|
608 TInt iModeChangeStatus; |
|
609 #endif // CAMERAAPP_CAE_FIX |
|
610 #endif |
|
611 |
|
612 // This bool is used to determine whether current event is the first or second one. |
|
613 TBool iFirstAfEventReceived; |
|
614 |
|
615 // This bool is used to determine whether AF operation is started |
|
616 TBool iAfInProgress; |
|
617 |
|
618 // This bool is used to determine whether HyperFocal needs to be set |
|
619 TBool iAfHyperfocalPending; |
|
620 |
|
621 // ------------------------------------------------------- |
|
622 // Flash simulation |
|
623 #ifdef CAMERAAPP_FLASH_SIMULATOR |
|
624 CCamFlashSimulator* iFlashSimulator; |
|
625 #endif |
|
626 |
|
627 // ------------------------------------------------------- |
|
628 // CAE error simulation |
|
629 #ifdef CAMERAAPP_CAE_ERR_SIMULATION |
|
630 // Timer for delaying callbacks to simulate difficult/erroneous situations |
|
631 CCamTimer* iCallbackTimer; |
|
632 |
|
633 TCamCameraEventId iSimEventId; |
|
634 TInt iSimStatus; |
|
635 |
|
636 static TInt DelayedCaeCallback( TAny* aController ); |
|
637 |
|
638 void CallAppropriateCallback( const TCamCameraEventId aEventId = ECamCameraEventNone, |
|
639 TInt aStatus = 0 ); |
|
640 |
|
641 #endif // CAMERAAPP_CAE_ERR_SIMULATION |
|
642 |
|
643 // ------------------------------------------------------- |
|
644 |
|
645 // ------------------------------------------------------- |
|
646 // Performance logging related |
|
647 #ifdef CAMERAAPP_PERFORMANCE_CONTROLLER |
|
648 public: |
|
649 const CCamPerformanceLogger* PerformanceLogger() const; |
|
650 |
|
651 private: |
|
652 CCamPerformanceLogger* iPerformanceLogger; |
|
653 TBool iFirstVfFrameReceived; |
|
654 #endif // CAMERAAPP_PERFORMANCE_CONTROLLER |
|
655 // ------------------------------------------------------- |
|
656 |
|
657 public: |
|
658 void SetBurstImagesRemaining( TInt aBurstImagesRemaining ); |
|
659 TBool AsyncVideoStopModeSupported(); |
|
660 |
|
661 |
|
662 /** |
|
663 * Used to recover lost resources. |
|
664 * |
|
665 * @param aSelf pointer to CCamCameraController object |
|
666 * @return N/A |
|
667 */ |
|
668 static TInt IdleCallback( TAny* aSelf ); |
|
669 |
|
670 /** |
|
671 * Helper method for IdleCallback |
|
672 */ |
|
673 void DoIveRecovery(); |
|
674 |
|
675 /** |
|
676 * Indicates resource recovery state. |
|
677 * @return TBool, ETrue if resource recovering is initated |
|
678 */ |
|
679 TBool IsWaitingIveResources(); |
|
680 |
|
681 private: |
|
682 TInt iBurstImagesRemaining; |
|
683 |
|
684 // not own |
|
685 RWindowBase* iViewfinderWindow; |
|
686 CIdle* iIdle; |
|
687 |
|
688 // Counts how many times lost resources are tried to recover |
|
689 // (KIveRecoveryCountMax). |
|
690 TInt iIveRecoveryCount; |
|
691 TBool iIveRecoveryOngoing; |
|
692 // ETrue if cancelling command sequence is in progress, |
|
693 // due to lost resources, before recovering. |
|
694 TBool iIveCancel; |
|
695 // ETrue when first recovery command has got callback. |
|
696 TBool iIveSequenceActive; |
|
697 |
|
698 CCamAppController& iAppController; |
|
699 TInt iCurrentCameraIndex; |
|
700 |
|
701 }; |
|
702 |
|
703 #endif // CAM_CAMERACONTROLLER_H |
|
704 |
|
705 // end of file |
|