1 /* |
|
2 * Copyright (c) 2009-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 #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 |
|
26 #include "cxesettings.h" |
|
27 #include "cxequalitypresets.h" |
|
28 #include "cxequalitypresetssymbian.h" |
|
29 #include "cxestillimagesymbian.h" |
|
30 #include "cxevideocapturecontrol.h" |
|
31 #include "cxestatemachine.h" |
|
32 #include "cxenamespace.h" |
|
33 |
|
34 |
|
35 // forward declarations |
|
36 class CxeSettings; |
|
37 class CxeCameraDevice; |
|
38 class CxeQualityPresets; |
|
39 class CxeFilenameGenerator; |
|
40 class CxeViewfinderControl; |
|
41 class CxeSnapshotControl; |
|
42 class CxeStillImageSymbian; |
|
43 class CxeSoundPlayerSymbian; |
|
44 class CxeCameraDeviceControl; |
|
45 class CxeVideoRecorderUtility; |
|
46 class CxeDiskMonitor; |
|
47 |
|
48 |
|
49 class CxeVideoCaptureControlSymbian : public CxeVideoCaptureControl, |
|
50 public CxeStateMachine, |
|
51 public MVideoRecorderUtilityObserver |
|
52 { |
|
53 Q_OBJECT |
|
54 |
|
55 public: // constructors |
|
56 |
|
57 CxeVideoCaptureControlSymbian(CxeCameraDevice &cameraDevice, |
|
58 CxeViewfinderControl &viewfinderControl, |
|
59 CxeSnapshotControl &snapshotControl, |
|
60 CxeCameraDeviceControl &cameraDeviceControl, |
|
61 CxeFilenameGenerator &nameGenerator, |
|
62 CxeSettings &settings, |
|
63 CxeQualityPresets &qualityPresets, |
|
64 CxeDiskMonitor &diskMonitor); |
|
65 |
|
66 virtual ~CxeVideoCaptureControlSymbian(); |
|
67 |
|
68 public: // functions from CxeVideoCaptureControl |
|
69 CxeVideoCaptureControl::State state() const; |
|
70 void record(); |
|
71 void pause(); |
|
72 void stop(); |
|
73 void remainingTime(int &time); |
|
74 bool elapsedTime(int &time); |
|
75 void reset(); |
|
76 QString filename() const; |
|
77 QPixmap snapshot() const; |
|
78 QList<CxeVideoDetails> supportedVideoQualities(); |
|
79 |
|
80 public: // functions from MVideoRecorderUtilityObserver |
|
81 void MvruoOpenComplete(TInt aError); |
|
82 void MvruoPrepareComplete(TInt aError); |
|
83 void MvruoRecordComplete(TInt aError); |
|
84 void MvruoEvent(const TMMFEvent& aEvent); |
|
85 |
|
86 signals: |
|
87 void videoPrepareComplete(CxeError::Id error); |
|
88 void prepareZoomForVideo(); |
|
89 |
|
90 protected: // from CxeStateMachine |
|
91 void handleStateChanged(int newStateId, CxeError::Id error); |
|
92 |
|
93 public slots: |
|
94 //! Notification for when camera device is ready and we're entering video mode |
|
95 void init(); |
|
96 //! Notification for when we're exiting video mode |
|
97 void deinit(); |
|
98 //! Notification that videocapture sound has been played |
|
99 void handleSoundPlayed(); |
|
100 //! Snapshot has been received from adaptiation. |
|
101 void handleSnapshotReady(CxeError::Id status, const QImage &snapshot); |
|
102 |
|
103 protected slots: |
|
104 // notifications when ECam reference is changed |
|
105 void prepareForCameraDelete(); |
|
106 void handleCameraAllocated(CxeError::Id error); |
|
107 void prepareForRelease(); |
|
108 // settings call back |
|
109 void handleSettingValueChanged(const QString &settingId, QVariant newValue); |
|
110 // scene mode change |
|
111 void handleSceneChanged(const QVariant &scene); |
|
112 // Disk space change |
|
113 void handleDiskSpaceChanged(); |
|
114 void hintUseCase(); |
|
115 |
|
116 private: // helper methods |
|
117 void releaseResources(); |
|
118 void initializeStates(); |
|
119 void updateVideoCaptureParameters(); |
|
120 void initVideoRecorder(); |
|
121 void open(); |
|
122 void prepare(); |
|
123 void prepareSnapshot(); |
|
124 virtual void createVideoRecorder(); |
|
125 int calculateRemainingTime(const CxeVideoDetails &videoDetails); |
|
126 void updateRemainingRecordingTimeCounter(); |
|
127 void generateFilename(); |
|
128 void handlePrepareFailed(); |
|
129 void handleComposeFailed(int error); |
|
130 void emulateNormalStopping(); |
|
131 |
|
132 protected: // protected data |
|
133 //! Video Recorder |
|
134 CxeVideoRecorderUtility *mVideoRecorder; |
|
135 |
|
136 private: // private data |
|
137 |
|
138 //! Video Recorder controller UID. |
|
139 TUid mVideoControllerUid; |
|
140 //! Video Recorder format UID. |
|
141 TUid mVideoFormatUid; |
|
142 CxeCameraDevice &mCameraDevice; |
|
143 CxeCameraDeviceControl &mCameraDeviceControl; |
|
144 CxeViewfinderControl &mViewfinderControl; |
|
145 CxeSnapshotControl &mSnapshotControl; |
|
146 CxeFilenameGenerator &mFilenameGenerator; |
|
147 CxeSettings &mSettings; |
|
148 CxeQualityPresets &mQualityPresets; |
|
149 CxeDiskMonitor &mDiskMonitor; |
|
150 //! Snapshot image. |
|
151 QPixmap mSnapshot; |
|
152 //! Soundplayers, own |
|
153 CxeSoundPlayerSymbian *mVideoStartSoundPlayer; |
|
154 CxeSoundPlayerSymbian *mVideoStopSoundPlayer; |
|
155 //! Current video file name |
|
156 QString mCurrentFilename; |
|
157 //video resolutions supported by ICM |
|
158 QList<CxeVideoDetails> mIcmSupportedVideoResolutions; |
|
159 //current video quality details in use |
|
160 CxeVideoDetails mCurrentVideoDetails; |
|
161 }; |
|
162 |
|
163 #endif /* CXEVIDEOCAPTURECONTROLSYMBIAN_H_ */ |
|