camappengine/Engine/Inc/CaeEngineImp.h
branchRCL_3
changeset 20 e3cdd00b5ae3
parent 19 18fa9327a158
child 21 27fe719c32e6
equal deleted inserted replaced
19:18fa9327a158 20:e3cdd00b5ae3
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Camera Application Engine implementation class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CAEENGINEIMP_H
       
    21 #define CAEENGINEIMP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <ecam.h>
       
    25 #include <videorecorder.h>
       
    26 #include "CamCControllerCustomCommands.h"
       
    27 #include "CaeEngine.h"
       
    28 #include "CaeEngineExtInterface.h"
       
    29 #include "CaeCommon.h"
       
    30 #include "CaeStillEncoder.h"
       
    31 #include "CaeStillDecoder.h"
       
    32 #include "CaeCallbackActive.h"              // For making method calls from callbacks.
       
    33 #include "CaeDbgUtilities.h"                // For debugging.
       
    34 
       
    35 #include <e32std.h>
       
    36 
       
    37 // CONSTANTS
       
    38 const TInt KVideoTimesIntervalDefault = 1000000; // Default time interval for Video Recording times call-back.
       
    39 
       
    40 const TInt KVideoTimesDelay = 100000; // Delay in starting to generate video times, in microseconds.
       
    41 
       
    42 const TInt KCameraPriority = -1; // Relative priority (-100...100) of camera HW
       
    43 
       
    44 const TUid KUidBurstModeVFOptimization = {0x4A758866}; // Custom command interface UID used by some products
       
    45 
       
    46 // FORWARD DECLARATIONS
       
    47 class CVideoRecorderUtility;
       
    48 class RWsSession;
       
    49 class CWsScreenDevice;
       
    50 class RWindowBase;
       
    51 class CFbsBitmap;
       
    52 class CCaeStillQualityLevelsCont;
       
    53 class CCaeVideoQualityLevelsCont;
       
    54 class CCaeVideoTimes;
       
    55 class CCaeStillBurst;
       
    56 class CCaeStillStatesActive;
       
    57 
       
    58 
       
    59 // CLASS DECLARATIONS
       
    60 
       
    61 /**
       
    62 * Camera application engine implementation class.
       
    63 */
       
    64 
       
    65 NONSHARABLE_CLASS( CCaeEngineImp ): public CCaeEngine, 
       
    66                                     public MCameraObserver,
       
    67                                     public MExtensionCallbackInterface,
       
    68 					                public MCaeExtEngineInfoCallbackInterface,
       
    69                                     public MVideoRecorderUtilityObserver,
       
    70                                     public MCameraObserver2
       
    71     {
       
    72 
       
    73 
       
    74     public: // Construction and destruction
       
    75 
       
    76         static CCaeEngineImp* NewL();
       
    77 
       
    78         virtual ~CCaeEngineImp();
       
    79 
       
    80     
       
    81     public: // General methods / CCaeEngine.h
       
    82 
       
    83         void SetCamAppEngineObserver( 
       
    84             MCamAppEngineObserver& aObserver );
       
    85 
       
    86         void GetInfo( 
       
    87             TCamAppEngineInfo& aInfo ) const;
       
    88 
       
    89         void InitL( 
       
    90             TBool aCreateSnapImage = ETrue );
       
    91 
       
    92         void InitL( 
       
    93             TUid  aSdUidStillQltyLevels, 
       
    94             TBool aCreateSnapImage = ETrue );
       
    95 
       
    96         void InitVideoRecorderL();
       
    97         
       
    98         void InitVideoRecorderL( 
       
    99             TUid aSdUidVideoQltyLevels );
       
   100 
       
   101         void Reserve();
       
   102 
       
   103         void Release();
       
   104 
       
   105         void PowerOn();
       
   106 
       
   107         void PowerOff();
       
   108 
       
   109     
       
   110     public: // Camera settings / CCaeEngine.h
       
   111 
       
   112         void SetZoomModeL( 
       
   113             TZoomMode aZoomMode = EZoomModeDigital );
       
   114 
       
   115         TZoomMode ZoomMode() const;
       
   116 
       
   117         void SetZoomValueL( 
       
   118             TInt aZoomValue = 0 );
       
   119 
       
   120         TInt ZoomValue() const;
       
   121 
       
   122         void SetBrightnessL( 
       
   123             TInt aBrightness = 0 );
       
   124 
       
   125         TInt Brightness() const;
       
   126 
       
   127         void SetContrastL( 
       
   128             TInt aContrast = 0 );
       
   129 
       
   130         TInt Contrast() const;
       
   131 
       
   132         void SetExposureModeL( 
       
   133             CCamera::TExposure aExposureMode = CCamera::EExposureAuto );
       
   134 
       
   135         CCamera::TExposure ExposureMode() const;
       
   136 
       
   137         void SetWhiteBalanceModeL( 
       
   138             CCamera::TWhiteBalance aWhiteBalanceMode = CCamera::EWBAuto );
       
   139 
       
   140         CCamera::TWhiteBalance WhiteBalanceMode() const;
       
   141 
       
   142         void SetFlashModeL( 
       
   143             CCamera::TFlash aFlashMode = CCamera::EFlashNone );
       
   144 
       
   145         CCamera::TFlash FlashMode() const;
       
   146 
       
   147         void ResetToDefaultsL();
       
   148     
       
   149     
       
   150     public: // View Finder / CCaeEngine.h
       
   151 
       
   152         void SetViewFinderMirrorL( 
       
   153             TBool aMirror );
       
   154 
       
   155         TBool ViewFinderMirror() const;
       
   156 
       
   157         void StartViewFinderBitmapsL( 
       
   158             TSize& aVfFrameSize );
       
   159 
       
   160         void StartViewFinderBitmapsL( 
       
   161             TSize& aVfFrameSize, 
       
   162             TRect& aCropRect );
       
   163         
       
   164         void StartViewFinderDirectL( 
       
   165             RWsSession&      aWs, 
       
   166             CWsScreenDevice& aScreenDevice, 
       
   167             RWindowBase&     aWindow, 
       
   168             TRect&           aScreenRect );
       
   169 
       
   170         void StartViewFinderDirectL( 
       
   171             RWsSession&      aWs, 
       
   172             CWsScreenDevice& aScreenDevice, 
       
   173             RWindowBase&     aWindow, 
       
   174             TRect&           aScreenRect, 
       
   175             TRect&           aCropRect );
       
   176         
       
   177         void StopViewFinder();
       
   178 
       
   179         TBool IsViewFinding() const;
       
   180 
       
   181         void GetViewFinderSize( 
       
   182             TSize& aVfFrameSize );
       
   183 
       
   184     
       
   185     public: // Still image capturing / CCaeEngine.h
       
   186 
       
   187         void PrepareStillCaptureL( 
       
   188             TInt aStillQualityIndex );
       
   189         
       
   190         void PrepareStillCaptureL( 
       
   191             TInt         aStillQualityIndex, 
       
   192             const TRect& aCropRect );
       
   193 
       
   194         void PrepareStillCaptureL( 
       
   195             const TSize&     aSize, 
       
   196             CCamera::TFormat aFormat,
       
   197             TInt             aCompressionQuality );
       
   198 
       
   199         void PrepareStillCaptureL( 
       
   200             const TSize&     aSize, 
       
   201             CCamera::TFormat aFormat, 
       
   202             TInt             aCompressionQuality, 
       
   203             const TRect&     aCropRect );
       
   204 
       
   205         TInt StillQualityIndex() const;
       
   206 
       
   207         void GetStillFrameSize( 
       
   208             TInt   aStillQualityIndex, 
       
   209             TSize& aSize ) const;
       
   210 
       
   211         TInt EstimatedStillSizeInBytes( 
       
   212             TInt aStillQualityIndex ) const;
       
   213 
       
   214         void CaptureStill(); 
       
   215         
       
   216         void CancelCaptureStill();
       
   217 
       
   218     
       
   219     public: // Video recording / CCaeEngine.h
       
   220     
       
   221         void SetVideoRecordingFileNameL( 
       
   222             const TDesC& aVideoClipFileName );
       
   223 
       
   224         void PrepareVideoRecordingL( 
       
   225             TInt aVideoQualityIndex );
       
   226 
       
   227         void PrepareVideoRecordingL( 
       
   228             const TSize&  aFrameSize, 
       
   229             TReal32       aFrameRate, 
       
   230             TInt          aBitRate, 
       
   231             TBool         aAudioEnabled,
       
   232             const TDesC8& aMimeType, 
       
   233             const TDesC&  aPreferredSupplier, 
       
   234             const TDesC8& aVideoType = KNullDesC8, 
       
   235             const TDesC8& aAudioType = KNullDesC8 );
       
   236 
       
   237         void CloseVideoRecording();
       
   238 
       
   239         TInt VideoQualityIndex() const;
       
   240 
       
   241         void GetVideoFrameSize( 
       
   242             TInt   aVideoQualityIndex, 
       
   243             TSize& aSize ) const;
       
   244 
       
   245         TReal32 VideoFrameRate( 
       
   246             TInt aVideoQualityIndex ) const;
       
   247 
       
   248         TInt EstimatedVideoRecordingBitRateL( 
       
   249             TInt aVideoQualityIndex ) const;
       
   250 
       
   251         void SetVideoClipMaxSizeL( 
       
   252             TInt aMaxClipSizeInBytes = 0 );
       
   253 
       
   254         TInt VideoClipMaxSize() const;
       
   255 
       
   256         void SetVideoAudioL( 
       
   257             TBool aAudioEnabled );
       
   258 
       
   259         TBool VideoAudio() const;
       
   260 
       
   261         void SetVideoTimesIntervalL( 
       
   262             TTimeIntervalMicroSeconds aInterval );
       
   263 
       
   264         TTimeIntervalMicroSeconds VideoTimesInterval() const;
       
   265 
       
   266         void StartVideoRecording();
       
   267 
       
   268         void StopVideoRecording();
       
   269 
       
   270         void PauseVideoRecording();
       
   271 
       
   272         void ResumeVideoRecording();
       
   273 
       
   274         TTimeIntervalMicroSeconds RemainingVideoRecordingTime() const;
       
   275 
       
   276         TBool IsVideoRecording() const;
       
   277 
       
   278     public: // New overloading method for preparing video recording / CCaeEngine.h
       
   279     
       
   280         void PrepareVideoRecordingL( 
       
   281             const TSize&  aFrameSize, 
       
   282             TReal32       aFrameRate, 
       
   283             TInt          aBitRate, 
       
   284             TBool         aAudioEnabled,
       
   285             TInt          aAudioBitRate, 
       
   286             const TDesC8& aMimeType, 
       
   287             const TDesC&  aPreferredSupplier, 
       
   288             const TDesC8& aVideoType, 
       
   289             const TDesC8& aAudioType );
       
   290 
       
   291     public: // Still image burst capturing interface methods / CCaeEngine.h
       
   292 
       
   293         void SetCaeStillBurstObserver( 
       
   294             MCaeStillBurstObserver& aObserver );
       
   295 
       
   296         TInt SetStillCaptureImageCountL( 
       
   297             TInt aImageCount );
       
   298 
       
   299         TInt StillCaptureImageCount() const;
       
   300 
       
   301         void SetStillBurstCaptureIntervalL( 
       
   302             TTimeIntervalMicroSeconds aInterval );
       
   303 
       
   304         TTimeIntervalMicroSeconds StillBurstCaptureInterval() const;
       
   305 
       
   306         void StopStillBurstCapture();
       
   307 
       
   308         void PrepareStillCaptureL( 
       
   309             TInt         aStillQualityIndex, 
       
   310             TSize&       aSnapSize );
       
   311 
       
   312         void PrepareStillCaptureL( 
       
   313             const TSize&     aSize, 
       
   314             CCamera::TFormat aFormat,  
       
   315             TInt             aCompressionQuality, 
       
   316             const TRect&     aCropRect,
       
   317             TSize&           aSnapSize );
       
   318 
       
   319         void SetEvCompensationL( 
       
   320             TInt aEvIndex = 0 );
       
   321 
       
   322         TInt EvCompensation() const;
       
   323         
       
   324     public: // Method for switching snap-image creation on/off. / CCaeEngine.h
       
   325     
       
   326         void SetSnapImageCreation( 
       
   327             TBool aCreateSnapImage = ETrue );
       
   328 
       
   329     public: // New methods since 2.6 and 2.8 / CCaeEngine.h
       
   330 
       
   331     	static CCaeEngineImp* NewL(
       
   332     	    TInt aCameraIndex, TInt aDisplayIndex );
       
   333 
       
   334     	void EnumerateStillCaptureSizes(
       
   335     	    TSize& aSize,
       
   336     	    TInt aSizeIndex,
       
   337     	    CCamera::TFormat aFormat ) const;
       
   338 
       
   339     	void SetJpegQuality(
       
   340     	    TInt aQuality );
       
   341 
       
   342     	TInt JpegQuality() const;
       
   343 
       
   344         TAny* CustomInterface(
       
   345 			TUid aInterface );
       
   346 
       
   347         void SetSnapImageSizeL(
       
   348             TSize& aSize );
       
   349 
       
   350         void SetSnapImageColorMode(
       
   351             TDisplayMode aMode );
       
   352 
       
   353         void GetOrderL( 
       
   354 			RCaeOrderedFeatureList& aOrderedFeatureList );
       
   355 
       
   356         void SetOrderL( 
       
   357 			const RCaeOrderedFeatureList& aOrderedFeatureList );
       
   358 
       
   359         void SetSnapImageSourceL(
       
   360             TSnapImageSource aSnapImageSource );
       
   361 
       
   362         void SetImageCodecsL( 
       
   363         	TUid aDecoderUid, TUid aEncoderUid );
       
   364 
       
   365         TInt EnumerateVideoFrameSizeL(const TSize& aSize);
       
   366         
       
   367         TInt CCameraHandle() const;
       
   368         	
       
   369         void SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage );
       
   370 
       
   371         void ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame );
       
   372 
       
   373         void ProcessExtSnapImageL( CFbsBitmap& aSnapImage );
       
   374 
       
   375         void ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage );
       
   376         
       
   377         void ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage );
       
   378         
       
   379         void ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage );
       
   380 
       
   381         void ProcessExtCancel();
       
   382 
       
   383         void SkippedExtensionListL( RCaeOrderedFeatureList& aDisabledExtensions );
       
   384 
       
   385         void SetSkippedExtensionList( RCaeOrderedFeatureList& aDisabledExtensions );
       
   386 
       
   387         void EnableVideoRecording();
       
   388         
       
   389         void DisableVideoRecording();
       
   390 
       
   391         TInt SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled );
       
   392 
       
   393     public: // New public methods
       
   394 
       
   395         /**
       
   396         * Checks if still image burst capture should be completed.
       
   397         * @since 2.6
       
   398         * @return Boolean indicating if the burst should be completed.
       
   399         */
       
   400         TBool CheckForStillBurstCompletion();
       
   401         
       
   402     private: // From Camera Observer / ECam.h
       
   403 
       
   404         void ReserveComplete( 
       
   405             TInt aError );
       
   406 
       
   407         void PowerOnComplete( 
       
   408             TInt aError );
       
   409 
       
   410         void ViewFinderFrameReady( 
       
   411             CFbsBitmap& aFrame );
       
   412 
       
   413         void ImageReady( 
       
   414             CFbsBitmap* aBitmap, 
       
   415             HBufC8*     aData, 
       
   416             TInt        aError );
       
   417 
       
   418         void FrameBufferReady( 
       
   419             MFrameBuffer* /*aFrameBuffer*/, 
       
   420             TInt          /*aError*/ ) {}; // Empty default because not in use.
       
   421    
       
   422     private: // From Video Recorder Utility Observer / VideoRecorder.h
       
   423 
       
   424         void MvruoOpenComplete( 
       
   425             TInt aError );
       
   426 
       
   427         void MvruoPrepareComplete( 
       
   428             TInt aError );
       
   429 
       
   430         void MvruoRecordComplete( 
       
   431             TInt aError );
       
   432 
       
   433         void MvruoEvent( 
       
   434             const TMMFEvent& aEvent );
       
   435 
       
   436     
       
   437     private: // Private member methods
       
   438 
       
   439         /**
       
   440         * C++ constructor.
       
   441         */
       
   442         CCaeEngineImp();
       
   443 
       
   444         /**
       
   445         * Symbian OS 2nd phase constructor that can leave.
       
   446         * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
       
   447         * specifying the camera device to use.
       
   448         * @param aDisplayIndex Display index specifying the display to use.
       
   449         * @return void
       
   450         */
       
   451         void ConstructL( TInt aCameraIndex, TInt aDisplayIndex );
       
   452 
       
   453         /**
       
   454         * Finds all extension dlls and populates the extension arrays.
       
   455         * @since 2.8
       
   456         * @return void
       
   457         */
       
   458 		void PopulateExtensionArrayL();
       
   459 
       
   460     //// General and settings related private methods. ////
       
   461 
       
   462         /**
       
   463         * Initializes the info class ("structure").
       
   464         * @since 2.1
       
   465         * @param aCamera Camera object.
       
   466         * @return void
       
   467         */
       
   468         void InitializeInfo( 
       
   469             const CCamera& aCamera );
       
   470 
       
   471         /**
       
   472         * Checks that power is on. If not, then leaves.
       
   473         * @since 2.1
       
   474         * @return void
       
   475         */
       
   476         void CheckPowerL();
       
   477 
       
   478         /**
       
   479         * Cancels view finder, still capturing, and video recording.
       
   480         * @since 2.1
       
   481         * @return void
       
   482         */
       
   483         void CancelAllActivities();
       
   484 
       
   485         /**
       
   486         * Re-sets settings to the previous values (before releasing camera).
       
   487         * @since 2.1
       
   488         * @return void
       
   489         */
       
   490         void ResetToPreviousSettingsL();
       
   491 
       
   492     //// Video recording related private methods. ////
       
   493 
       
   494         /**
       
   495         * Cancels video recording.
       
   496         * @since 2.1
       
   497         * @return void
       
   498         */
       
   499         void CancelVideoRecording();
       
   500 
       
   501         /**
       
   502         * Prepares video recording settings.
       
   503         * @since 2.1
       
   504         * @return void
       
   505         */
       
   506         void PrepareVideoSettingsL();
       
   507 
       
   508         /**
       
   509         * Changes video clip file name.
       
   510         * @since 2.1
       
   511         * @return void
       
   512         */
       
   513         void ChangeVideoFileNameL();
       
   514 
       
   515         /**
       
   516         * Finds video type and format UIDs using ECOM.
       
   517         * @since 2.1
       
   518         * @param aMimeType MIME type.
       
   519         * @param aPreferredSupplier Preferred supplier of video encoder.
       
   520         * @return void
       
   521         */
       
   522         void FindVideoUidsL(
       
   523             const TDesC8& aMimeType, 
       
   524             const TDesC&  aPreferredSupplier );
       
   525 
       
   526         /**
       
   527         * Convert audio type from TDesC8 to TFourCC.
       
   528         * @since 2.1
       
   529         * @param aAudioType Audio type.
       
   530         * @return Audio type TFourCC code
       
   531         */
       
   532         TFourCC ConvertAndSetVideoAudioTypeL(
       
   533             const TDesC8& aAudioType );
       
   534 
       
   535         /**
       
   536         * Generates video recording times via
       
   537         * MCamAppEngineObserver::McaeoVideoRecordingTimes implemented by client.
       
   538         * @since 2.1
       
   539         * @param aEngineImp Camera Application Engine implementation object (this) 
       
   540         * @return ETrue
       
   541         */
       
   542         static TInt VideoRecordingTimesCallback( 
       
   543             TAny* aEngineImp );
       
   544 
       
   545     //// Still image burst capturing related private methods. ////
       
   546 
       
   547         /**
       
   548         * Gets option flag for still burst support.
       
   549         * @since 2.1
       
   550         * @return Option flag for still burst support
       
   551         */
       
   552         TCamAppEngineInfo::TOptions StillBurstSupport();
       
   553 
       
   554         /**
       
   555         * Compares two extension interface array items.
       
   556         * @since 2.8
       
   557         * @param aFirst First item
       
   558         * @param aSecond Second item
       
   559         * @return TInt Result of the comparison
       
   560         */
       
   561         static TBool MatchEqualImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
       
   562 
       
   563         /**
       
   564         * Compares two extension interface array items.
       
   565         * @since 2.8
       
   566         * @param aFirst First item
       
   567         * @param aSecond Second item
       
   568         * @return TInt Result of the comparison
       
   569         */
       
   570         static TBool MatchEqualImplPtr( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
       
   571 
       
   572         /**
       
   573         * Compares two extension interface array items.
       
   574         * @since 2.8
       
   575         * @param aFirst First item
       
   576         * @param aSecond Second item
       
   577         * @return TInt Result of the comparison
       
   578         */
       
   579         static TBool MatchSmallerInitialPriorityAndImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
       
   580 
       
   581         /**
       
   582         * Compares two extension interface array items.
       
   583         * @since 2.8
       
   584         * @param aFirst First item
       
   585         * @param aSecond Second item
       
   586         * @return TInt Result of the comparison
       
   587         */
       
   588         static TBool Match( const TCaeOrderedFeatureListItem& aFirst, const TCaeOrderedFeatureListItem& aSecond );
       
   589 
       
   590         /**
       
   591         * Updates item order in the internal array or checks aOrderedFeatureArray validity.
       
   592         * @since 2.8
       
   593         * @param aOrderedFeatureArray Feature array sorted by the wanted calling order in an interface.
       
   594         * @param iUpdate Whether to update the internal raays or just to check validity of aOrderedFeatureArray.
       
   595         * @return void.
       
   596         */
       
   597 		void DoSetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList, TBool iUpdate );
       
   598 
       
   599 	private: // From MCaeEngineExtensionInterface
       
   600 
       
   601 		TBool IsInterfaceSupported( TUid aInterfaceUid );
       
   602 
       
   603 		TInt AddExtensionInterface( TUid aInterfaceUid, TUid aExtensionUid, TAny* aImplementationPtr, TInt aInitialPriority = 0 );
       
   604 
       
   605 		TInt RemoveExtensionInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
       
   606 
       
   607 		TInt AddCustomInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
       
   608 
       
   609 		TAny* GetCallbackInterface( TUid aInterfaceUid );
       
   610 
       
   611         void RegisterFlags( TUint32 aFlags );
       
   612 
       
   613         void DeregisterFlags( TUint32 aFlags );
       
   614 
       
   615 	private: // From MCaeExtEngineInfoCallbackInterface
       
   616 
       
   617 		TSize McaeExtStillImageSize();
       
   618 
       
   619 		TSize McaeExtSnapImageSize();
       
   620 
       
   621 		TSize McaeExtViewFinderSize();
       
   622 
       
   623 		void McaeExtCheckPowerL();
       
   624 
       
   625 		TInt McaeExtDisplayIndex();
       
   626 
       
   627     private: // From Camera Observer2 / ECam.h
       
   628 
       
   629         void HandleEvent(const TECAMEvent& aEvent);
       
   630 
       
   631         void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
       
   632 
       
   633         void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
       
   634     
       
   635         void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
       
   636 
       
   637     private: // Data
       
   638     
       
   639     //// Pointers. ////
       
   640 
       
   641         // Camera API implementation object.
       
   642         CCamera* iCamera;
       
   643 
       
   644         // State machine for still capturing.
       
   645         CCaeStillStatesActive* iStillStatesActive; 
       
   646 
       
   647 		// All CAE Extension modules
       
   648 		RPointerArray<MExtension> iExtension;
       
   649 
       
   650 		// All extension interface implementations.
       
   651 		RArray<TCaeExtensionInterfaceImplListItem> iExtInterfaceImplementationLists;
       
   652 
       
   653 		// All custom interface implementations.
       
   654 		RArray<TCaeCustomInterfaceImplItem> iExtCustomInterfaceImplementations;
       
   655 
       
   656         // Video Recorder API implementation object.
       
   657         CVideoRecorderUtility* iVideoRecorder;
       
   658 
       
   659         // Camera Application Engine observer.
       
   660         MCamAppEngineObserver* iCaeObserver;
       
   661 
       
   662         // Camera Application Engine info object.
       
   663         TCamAppEngineInfo* iInfo;
       
   664 
       
   665         // Still image capturing quality levels container.
       
   666         CCaeStillQualityLevelsCont* iStillQualityLevelsCont;
       
   667 
       
   668         // Video recording quality levels container.
       
   669         CCaeVideoQualityLevelsCont* iVideoQualityLevelsCont;
       
   670 
       
   671         // Active object for calling Camera Application Engine methods 
       
   672         // indirectly from callbacks.
       
   673         CCaeCallbackActive* iCallbackActive;
       
   674 
       
   675         // Video recording frame size.
       
   676         // This is ptr because video recorder is not necessarily initialized.
       
   677         TSize* iVideoFrameSize;
       
   678 
       
   679         // Video recording frame size (to be prepared).
       
   680         // This is ptr because video recorder is not necessarily initialized.
       
   681         TSize* iVideoFrameSizePrep;
       
   682 
       
   683         // Video recording times generator.
       
   684         CCaeVideoTimes *iVideoTimes;
       
   685 
       
   686         // Video recording times callback.
       
   687         TCallBack* iVideoTimesCallback;
       
   688 
       
   689         // Video clip file name.
       
   690         HBufC* iVideoClipFileName;
       
   691         
       
   692         // Video Recorder video type.
       
   693         HBufC8* iVideoType;
       
   694 
       
   695     //// Booleans (mostly reporting state). ////
       
   696 
       
   697         // Boolean indicating if camera module is reserved for the engine.
       
   698         TBool iReserved;
       
   699 
       
   700         // Boolean indicating if camera module power is on.
       
   701         TBool iPowerOn;
       
   702 
       
   703         // Boolean indicating if video recording is initialized.
       
   704         TBool iVideoInitialized;
       
   705 
       
   706         // Boolean indicating if still image capture is prepared.
       
   707         TBool iStillPrepared;
       
   708 
       
   709         // Boolean indicating if video recording is opened.
       
   710         TBool iVideoOpened;
       
   711 
       
   712         // Boolean indicating if video recording is prepared.
       
   713         TBool iVideoPrepared;
       
   714 
       
   715         // Boolean indicating if view finder is currently running.
       
   716         TBool iViewFinderRunning;
       
   717 
       
   718         // Boolean indicating if video recording is currently running.
       
   719         TBool iVideoRecordingRunning;
       
   720 
       
   721         // Boolean indicating if video recording is currently paused.
       
   722         TBool iVideoRecordingPaused;
       
   723 
       
   724         // Boolean indicating if the engine should reset its basic settings 
       
   725         // to the previous ones when re-reserving.
       
   726         TBool iResetToPreviousSettings;
       
   727 
       
   728     //// Camera module settings related variables. ////
       
   729 
       
   730         // Current zoom mode.
       
   731         TZoomMode iZoomMode;
       
   732 
       
   733         // Current zoom value.
       
   734         TInt iZoomValue;
       
   735 
       
   736         // Current brightness value.
       
   737         TInt iBrightness;
       
   738 
       
   739         // Current contrast value.
       
   740         TInt iContrast;
       
   741 
       
   742         // Camera exposure mode.
       
   743         CCamera::TExposure iExposureMode;
       
   744 
       
   745         // Camera white balance mode.
       
   746         CCamera::TWhiteBalance iWhiteBalanceMode;
       
   747 
       
   748         // Camera flash mode.
       
   749         CCamera::TFlash iFlashMode;
       
   750 
       
   751     //// View finder related variables. ////
       
   752 
       
   753         // View finder size when viewfinder has been started.
       
   754         TSize iTrueViewFinderSize;
       
   755 
       
   756     //// Still capturing related variables. ////
       
   757 
       
   758         // Still image capture quality level index currently prepared.
       
   759         TInt iStillQualityIndex; 
       
   760 
       
   761         // Display index
       
   762         TInt iDisplayIndex;
       
   763 
       
   764       //// Video recording related variables. ////
       
   765 
       
   766         // Video recording quality level index currently prepared.
       
   767         TInt iVideoQualityIndex;
       
   768 
       
   769         // Handle to the camera used.
       
   770         TInt iCameraHandle;
       
   771 
       
   772         // Video Recorder controller UID.
       
   773         TUid iVideoControllerUid;
       
   774 
       
   775         // Video Recorder format UID.
       
   776         TUid iVideoFormatUid;
       
   777 
       
   778         // Video Recorder audio type.
       
   779         TFourCC iVideoAudioType;
       
   780 
       
   781         // Interval for calling McaeoVideoRecordingTimes.
       
   782         TTimeIntervalMicroSeconds32 iVideoTimesInterval;
       
   783 
       
   784 		// Previous valid elapsed time value
       
   785     	TTimeIntervalMicroSeconds iPrevTimeElapsed;
       
   786     	
       
   787 		// Previous valid remaining time value
       
   788     	TTimeIntervalMicroSeconds iPrevTimeRemaining;
       
   789     	
       
   790     //// Video recording parameters prepared. ////
       
   791         
       
   792         // Video recording frame rate.
       
   793         TReal32 iVideoFrameRate;
       
   794 
       
   795         // Video recording bit rate.
       
   796         TInt iVideoBitRate;
       
   797 
       
   798         // Boolean indicating if audio is enabled with video recording.
       
   799         TBool iVideoAudioEnabled;
       
   800 
       
   801         // Video recording audio bit rate.
       
   802         TInt iVideoAudioBitRate;
       
   803 
       
   804         // Video recording maximum clip size in bytes.
       
   805         TInt iMaxClipSizeInBytes;
       
   806 
       
   807     //// Video recording parameters to be prepared. ////
       
   808 
       
   809         // Video recording frame rate (to be prepared).
       
   810         TReal32 iVideoFrameRatePrep;
       
   811 
       
   812         // Video recording bit rate (to be prepared).
       
   813         TInt iVideoBitRatePrep;
       
   814 
       
   815         // Boolean indicating if audio is enabled with video recording (to be prepared).
       
   816         TBool iVideoAudioEnabledPrep;
       
   817 
       
   818         // Video recording audio bit rate (to be prepared).
       
   819         TInt iVideoAudioBitRatePrep;
       
   820 
       
   821         // Video recording maximum clip size in bytes (to be prepared).
       
   822         TInt iMaxClipSizeInBytesPrep;
       
   823 
       
   824         // Boolean indicating if parameters are/were prepared in video recording preparation..
       
   825         TBool iPrepPars;
       
   826 
       
   827         // Boolean indicating if video audio bit rate should be prepared.
       
   828         TBool iPrepareVideoAudioBitRate;
       
   829         
       
   830         // Boolean indicating if video stopping should be asynchronously or synchronously (default).
       
   831         TBool iAsyncVideoStopEnabled;
       
   832     };
       
   833 
       
   834 
       
   835 #endif // CAEENGINEIMP_H