|
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 CXEVIDEOCAPTURECONTROL_H_ |
|
18 #define CXEVIDEOCAPTURECONTROL_H_ |
|
19 |
|
20 #include <QObject> |
|
21 #include <QMetaType> |
|
22 #include "cxeerror.h" |
|
23 #include "cxequalitydetails.h" |
|
24 |
|
25 class QPixmap; |
|
26 |
|
27 class CxeVideoCaptureControl : public QObject |
|
28 { |
|
29 Q_OBJECT |
|
30 public: |
|
31 // State Machine |
|
32 enum State { |
|
33 //! Not Initialized |
|
34 Idle = 0x01, |
|
35 |
|
36 //! Video Recorder Initialized, but not ready for recording |
|
37 Initialized = 0x02, |
|
38 |
|
39 //! Preparing for recording |
|
40 Preparing = 0x04, |
|
41 |
|
42 //! Ready to record |
|
43 Ready = 0x08, |
|
44 |
|
45 //! Recording |
|
46 Recording = 0x10, |
|
47 |
|
48 // Paused |
|
49 Paused = 0x20, |
|
50 |
|
51 // Stopping and finalizing output file |
|
52 Stopping = 0x40, |
|
53 |
|
54 // Playing capture sound before recording |
|
55 PlayingStartSound = 0x80 |
|
56 }; |
|
57 |
|
58 virtual State state() const = 0; |
|
59 virtual void record() = 0; |
|
60 virtual void pause() = 0; |
|
61 virtual void stop() = 0; |
|
62 virtual void remainingTime(int &time) = 0; |
|
63 virtual bool elapsedTime(int &time) = 0; |
|
64 |
|
65 /** |
|
66 * Releases the current video snapshot and resets the file name. |
|
67 */ |
|
68 virtual void reset() = 0; |
|
69 |
|
70 /** |
|
71 * Get the filename for the current/previous video clip. |
|
72 */ |
|
73 virtual QString filename() const = 0; |
|
74 |
|
75 /** |
|
76 * Get the video snapshot image. |
|
77 * |
|
78 * @return Snapshot pixmap. May be null pixmap if no snapshot is available. |
|
79 */ |
|
80 virtual QPixmap snapshot() const = 0; |
|
81 |
|
82 /* |
|
83 * Returns supported list of video qualities, sorted in descending order |
|
84 * i.e. the first element in the list has the highest video resolution first and so on |
|
85 */ |
|
86 virtual QList<CxeVideoDetails> supportedVideoQualities() = 0; |
|
87 |
|
88 public slots: |
|
89 virtual void init() = 0; |
|
90 virtual void deinit() = 0; |
|
91 |
|
92 signals: |
|
93 void videoComposed(CxeError::Id error, const QString &filename); |
|
94 void stateChanged(CxeVideoCaptureControl::State newState, CxeError::Id error); |
|
95 void snapshotReady(CxeError::Id error, const QImage &snapshot, const QString &filename); |
|
96 void remainingTimeChanged(); |
|
97 |
|
98 protected: |
|
99 CxeVideoCaptureControl() {} |
|
100 |
|
101 private: |
|
102 Q_DISABLE_COPY( CxeVideoCaptureControl ) |
|
103 }; |
|
104 |
|
105 Q_DECLARE_METATYPE(CxeVideoCaptureControl::State) |
|
106 |
|
107 #endif /* CXEVIDEOCAPTURECONTROL_H_ */ |