|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QMEDIARECORDER_H |
|
43 #define QMEDIARECORDER_H |
|
44 |
|
45 #include <qmediaobject.h> |
|
46 #include <qmediaserviceprovider.h> |
|
47 #include <qmediaencodersettings.h> |
|
48 #include <qmediabindableinterface.h> |
|
49 |
|
50 #include <QtCore/qpair.h> |
|
51 |
|
52 QT_BEGIN_NAMESPACE |
|
53 class QUrl; |
|
54 class QSize; |
|
55 class QAudioFormat; |
|
56 QT_END_NAMESPACE |
|
57 |
|
58 QT_BEGIN_NAMESPACE |
|
59 |
|
60 class QMediaRecorderService; |
|
61 class QAudioEncoderSettings; |
|
62 class QVideoEncoderSettings; |
|
63 |
|
64 class QMediaRecorderPrivate; |
|
65 class Q_MULTIMEDIA_EXPORT QMediaRecorder : public QObject, public QMediaBindableInterface |
|
66 { |
|
67 Q_OBJECT |
|
68 Q_INTERFACES(QMediaBindableInterface) |
|
69 Q_ENUMS(State) |
|
70 Q_ENUMS(Error) |
|
71 Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged) |
|
72 Q_PROPERTY(QUrl outputLocation READ outputLocation WRITE setOutputLocation) |
|
73 Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) |
|
74 Q_PROPERTY(bool metaDataAvailable READ isMetaDataAvailable NOTIFY metaDataAvailableChanged) |
|
75 Q_PROPERTY(bool metaDataWritable READ isMetaDataWritable NOTIFY metaDataWritableChanged) |
|
76 public: |
|
77 |
|
78 enum State |
|
79 { |
|
80 StoppedState, |
|
81 RecordingState, |
|
82 PausedState |
|
83 }; |
|
84 |
|
85 enum Error |
|
86 { |
|
87 NoError, |
|
88 ResourceError, |
|
89 FormatError |
|
90 }; |
|
91 |
|
92 QMediaRecorder(QMediaObject *mediaObject, QObject *parent = 0); |
|
93 ~QMediaRecorder(); |
|
94 |
|
95 QMediaObject *mediaObject() const; |
|
96 |
|
97 bool isAvailable() const; |
|
98 QtMultimediaKit::AvailabilityError availabilityError() const; |
|
99 |
|
100 QUrl outputLocation() const; |
|
101 bool setOutputLocation(const QUrl &location); |
|
102 |
|
103 State state() const; |
|
104 |
|
105 Error error() const; |
|
106 QString errorString() const; |
|
107 |
|
108 qint64 duration() const; |
|
109 |
|
110 bool isMuted() const; |
|
111 |
|
112 QStringList supportedContainers() const; |
|
113 QString containerDescription(const QString &containerMimeType) const; |
|
114 |
|
115 QStringList supportedAudioCodecs() const; |
|
116 QString audioCodecDescription(const QString &codecName) const; |
|
117 |
|
118 QList<int> supportedAudioSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(), |
|
119 bool *continuous = 0) const; |
|
120 |
|
121 QStringList supportedVideoCodecs() const; |
|
122 QString videoCodecDescription(const QString &codecName) const; |
|
123 |
|
124 QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(), |
|
125 bool *continuous = 0) const; |
|
126 |
|
127 QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(), |
|
128 bool *continuous = 0) const; |
|
129 |
|
130 QAudioEncoderSettings audioSettings() const; |
|
131 QVideoEncoderSettings videoSettings() const; |
|
132 QString containerMimeType() const; |
|
133 |
|
134 void setEncodingSettings(const QAudioEncoderSettings &audioSettings, |
|
135 const QVideoEncoderSettings &videoSettings = QVideoEncoderSettings(), |
|
136 const QString &containerMimeType = QString()); |
|
137 |
|
138 |
|
139 bool isMetaDataAvailable() const; |
|
140 bool isMetaDataWritable() const; |
|
141 |
|
142 QVariant metaData(QtMultimediaKit::MetaData key) const; |
|
143 void setMetaData(QtMultimediaKit::MetaData key, const QVariant &value); |
|
144 QList<QtMultimediaKit::MetaData> availableMetaData() const; |
|
145 |
|
146 QVariant extendedMetaData(const QString &key) const; |
|
147 void setExtendedMetaData(const QString &key, const QVariant &value); |
|
148 QStringList availableExtendedMetaData() const; |
|
149 |
|
150 public Q_SLOTS: |
|
151 void record(); |
|
152 void pause(); |
|
153 void stop(); |
|
154 void setMuted(bool muted); |
|
155 |
|
156 Q_SIGNALS: |
|
157 void stateChanged(QMediaRecorder::State state); |
|
158 void durationChanged(qint64 duration); |
|
159 void mutedChanged(bool muted); |
|
160 |
|
161 void error(QMediaRecorder::Error error); |
|
162 |
|
163 void metaDataAvailableChanged(bool available); |
|
164 void metaDataWritableChanged(bool writable); |
|
165 void metaDataChanged(); |
|
166 |
|
167 protected: |
|
168 bool setMediaObject(QMediaObject *object); |
|
169 |
|
170 private: |
|
171 QMediaRecorderPrivate *d_ptr; |
|
172 Q_DISABLE_COPY(QMediaRecorder) |
|
173 Q_DECLARE_PRIVATE(QMediaRecorder) |
|
174 Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QMediaRecorder::State)) |
|
175 Q_PRIVATE_SLOT(d_func(), void _q_error(int, const QString &)) |
|
176 Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed()) |
|
177 Q_PRIVATE_SLOT(d_func(), void _q_notify()) |
|
178 Q_PRIVATE_SLOT(d_func(), void _q_updateNotifyInterval(int)) |
|
179 }; |
|
180 |
|
181 QT_END_NAMESPACE |
|
182 |
|
183 Q_DECLARE_METATYPE(QMediaRecorder::State) |
|
184 Q_DECLARE_METATYPE(QMediaRecorder::Error) |
|
185 |
|
186 #endif // QMEDIARECORDER_H |