camerauis/cameraxui/cxengine/inc/cxevideocapturecontrolsymbian.h
changeset 19 d9aefe59d544
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef CXEVIDEOCAPTURECONTROLSYMBIAN_H_
       
    18 #define CXEVIDEOCAPTURECONTROLSYMBIAN_H_
       
    19 
       
    20 #include <QTime>
       
    21 #include <QPixmap>
       
    22 #include <QString>
       
    23 #include <driveinfo.h>
       
    24 #include <videorecorder.h>
       
    25 #include <ecam/camerasnapshot.h>
       
    26 
       
    27 #include "cxesettings.h"
       
    28 #include "cxequalitypresets.h"
       
    29 #include "cxequalitypresetssymbian.h"
       
    30 #include "cxestillimagesymbian.h"
       
    31 #include "cxevideocapturecontrol.h"
       
    32 #include "cxestatemachine.h"
       
    33 #include "cxenamespace.h"
       
    34 
       
    35 
       
    36 // constants
       
    37 const TInt KOneSecond = 1000000;
       
    38 
       
    39 //CamCControllerCustomCommands.h.
       
    40 
       
    41 // Controller UId, can be used by the client to identify the controller, e.g. if the custom command can be used
       
    42 const TUid KCamCControllerImplementationUid = {0x101F8503};
       
    43 const int KMaintainAspectRatio = false;
       
    44 // TMMFEvent UIDs for Async stop
       
    45 const TUid KCamCControllerCCVideoRecordStopped = {0x2000E546};
       
    46 const TUid KCamCControllerCCVideoFileComposed = {0x2000E547};
       
    47 
       
    48 // Custom command for setting a new filename without closing & reopening the controller
       
    49 enum TCamCControllerCustomCommands
       
    50     {
       
    51     ECamCControllerCCNewFilename = 0,
       
    52     ECamCControllerCCVideoStopAsync
       
    53     };
       
    54 
       
    55 
       
    56 // forward declarations
       
    57 class CxeSettings;
       
    58 class CxeCameraDevice;
       
    59 class CxeQualityPresets;
       
    60 class CxeFilenameGenerator;
       
    61 class CxeViewfinderControl;
       
    62 class CxeStillImageSymbian;
       
    63 class CxeSoundPlayerSymbian;
       
    64 class CxeCameraDeviceControl;
       
    65 class CxeVideoRecorderUtility;
       
    66 
       
    67 
       
    68 class CxeVideoCaptureControlSymbian : public CxeVideoCaptureControl,
       
    69                                       public CxeStateMachine,
       
    70                                       public MVideoRecorderUtilityObserver
       
    71 {
       
    72     Q_OBJECT
       
    73 
       
    74 public:  // constructors
       
    75 
       
    76     CxeVideoCaptureControlSymbian( CxeCameraDevice &cameraDevice,
       
    77                                    CxeViewfinderControl &viewfinderControl,
       
    78                                    CxeCameraDeviceControl &cameraDeviceControl,
       
    79                                    CxeFilenameGenerator &nameGenerator,
       
    80                                    CxeSettings &settings,
       
    81                                    CxeQualityPresets &qualityPresets);
       
    82 
       
    83     virtual ~CxeVideoCaptureControlSymbian();
       
    84 
       
    85 public:  // functions from CxeVideoCaptureControl
       
    86     CxeVideoCaptureControl::State state() const;
       
    87     void record();
       
    88     void pause();
       
    89     void stop();
       
    90     void remainingTime(int &time);
       
    91     bool elapsedTime(int &time);
       
    92     void reset();
       
    93     QString filename() const;
       
    94     QPixmap snapshot() const;
       
    95     QList<CxeVideoDetails> supportedVideoQualities();
       
    96 
       
    97 public:  // public member functions, not in client API
       
    98     void handleSnapshotEvent(CxeError::Id error);
       
    99 
       
   100 public: // functions from MVideoRecorderUtilityObserver
       
   101     void MvruoOpenComplete(TInt aError);
       
   102     void MvruoPrepareComplete(TInt aError);
       
   103     void MvruoRecordComplete(TInt aError);
       
   104     void MvruoEvent(const TMMFEvent& aEvent);
       
   105 
       
   106 signals:
       
   107     void videoPrepareComplete(CxeError::Id error);
       
   108     void prepareZoomForVideo();
       
   109 
       
   110 protected: // from CxeStateMachine
       
   111     void handleStateChanged(int newStateId, CxeError::Id error);
       
   112 
       
   113 public slots:
       
   114     //! Notification for when camera device is ready and we're entering video mode
       
   115     void init();
       
   116     //! Notification for when we're exiting video mode
       
   117     void deinit();
       
   118     //! Notification that videocapture sound has been played
       
   119     void handleSoundPlayed();
       
   120 
       
   121 protected slots:
       
   122     // notifications when ECam reference is changed
       
   123     void prepareForCameraDelete();
       
   124     void handleCameraAllocated(CxeError::Id error);
       
   125     void prepareForRelease();
       
   126     // ECam events
       
   127     void handleCameraEvent(int eventUid, int error);
       
   128     // settings call back
       
   129     void handleSettingValueChanged(const QString& settingId,QVariant newValue);
       
   130 
       
   131 private: // helper methods
       
   132     CxeError::Id findVideoController(const TDesC8& aMimeType, const TDesC&  aPreferredSupplier);
       
   133     void releaseResources();
       
   134     void initializeStates();
       
   135     CxeError::Id getVideoQualityDetails(CxeVideoDetails &videoInfo);
       
   136     int prepareVideoSnapshot();
       
   137     void initVideoRecorder();
       
   138     void open();
       
   139 	void prepare();
       
   140     TSize getSnapshotSize() const;
       
   141     virtual void createVideoRecorder();
       
   142     void calculateRemainingTime(CxeVideoDetails videoDetails, int &time);
       
   143     TFourCC audioType(const QString& str);
       
   144     void updateRemainingRecordingTimeCounter();
       
   145 
       
   146 protected: // protected data
       
   147     //! Video Recorder
       
   148     CxeVideoRecorderUtility *mVideoRecorder;
       
   149 
       
   150 private: // private data
       
   151 
       
   152     //! Video Recorder controller UID.
       
   153     TUid mVideoControllerUid;
       
   154     //! Video Recorder format UID.
       
   155     TUid mVideoFormatUid;
       
   156     CxeCameraDevice &mCameraDevice;
       
   157     CxeCameraDeviceControl &mCameraDeviceControl;
       
   158     CxeViewfinderControl &mViewfinderControl;
       
   159     CxeFilenameGenerator &mFilenameGenerator;
       
   160     CxeSettings &mSettings;
       
   161     CxeQualityPresets &mQualityPresets;
       
   162     //! Snapshot image.
       
   163     QPixmap mSnapshot;
       
   164     //! Soundplayers, own
       
   165     CxeSoundPlayerSymbian *mVideoStartSoundPlayer;
       
   166     CxeSoundPlayerSymbian *mVideoStopSoundPlayer;
       
   167     //! New file name generated for the video prepare.
       
   168     QString mNewFileName;
       
   169     //! Current video file name
       
   170     QString mCurrentFilename;
       
   171     //video resolutions supported by ICM
       
   172     QList<CxeVideoDetails> mIcmSupportedVideoResolutions;
       
   173     //current video quality details in use
       
   174     CxeVideoDetails mCurrentVideoDetails;
       
   175 };
       
   176 
       
   177 #endif /* CXEVIDEOCAPTURECONTROLSYMBIAN_H_ */