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