| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qmediarecordercontrol.h" |
| 41 | |
| 42 | QT_BEGIN_NAMESPACE |
| 43 | |
| 44 | |
| 45 | /*! |
| 46 | \class QMediaRecorderControl |
| 47 | \obsolete |
| 48 | \inmodule QtMultimedia |
| 49 | |
| 50 | |
| 51 | \ingroup multimedia_control |
| 52 | |
| 53 | \brief The QMediaRecorderControl class provides access to the recording |
| 54 | functionality of a QMediaService. |
| 55 | |
| 56 | Generally you will use the QMediaRecorder class in application code - this |
| 57 | class is mostly used when implementing a new QMediaService or if there is |
| 58 | access to specific low level functionality not otherwise present in QMediaRecorder. |
| 59 | |
| 60 | If a QMediaService can record media it will implement QMediaRecorderControl. |
| 61 | This control provides a means to set the \l {outputLocation()}{output location}, |
| 62 | and record, pause and stop recording via the \l setState() method. It also |
| 63 | provides feedback on the \l {duration()}{duration} of the recording. |
| 64 | |
| 65 | The interface name of QMediaRecorderControl is \c org.qt-project.qt.mediarecordercontrol/5.0 as |
| 66 | defined in QMediaRecorderControl_iid. |
| 67 | |
| 68 | \sa QMediaService::requestControl(), QMediaRecorder |
| 69 | |
| 70 | */ |
| 71 | |
| 72 | /*! |
| 73 | \macro QMediaRecorderControl_iid |
| 74 | |
| 75 | \c org.qt-project.qt.mediarecordercontrol/5.0 |
| 76 | |
| 77 | Defines the interface name of the QMediaRecorderControl class. |
| 78 | |
| 79 | \relates QMediaRecorderControl |
| 80 | */ |
| 81 | |
| 82 | /*! |
| 83 | Constructs a media recorder control with the given \a parent. |
| 84 | */ |
| 85 | |
| 86 | QMediaRecorderControl::QMediaRecorderControl(QObject* parent) |
| 87 | : QMediaControl(parent) |
| 88 | { |
| 89 | } |
| 90 | |
| 91 | /*! |
| 92 | Destroys a media recorder control. |
| 93 | */ |
| 94 | |
| 95 | QMediaRecorderControl::~QMediaRecorderControl() |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | /*! |
| 100 | \fn QUrl QMediaRecorderControl::outputLocation() const |
| 101 | |
| 102 | Returns the current output location being used. |
| 103 | */ |
| 104 | |
| 105 | /*! |
| 106 | \fn bool QMediaRecorderControl::setOutputLocation(const QUrl &location) |
| 107 | |
| 108 | Sets the output \a location and returns if this operation is successful. |
| 109 | If file at the output location already exists, it should be overwritten. |
| 110 | |
| 111 | The \a location can be relative or empty; |
| 112 | in this case the service should use the system specific place and file naming scheme. |
| 113 | |
| 114 | After recording has started, the backend should report the actual file location |
| 115 | with actualLocationChanged() signal. |
| 116 | */ |
| 117 | |
| 118 | /*! |
| 119 | \fn QMediaRecorder::State QMediaRecorderControl::state() const |
| 120 | |
| 121 | Return the current recording state. |
| 122 | */ |
| 123 | |
| 124 | /*! |
| 125 | \fn QMediaRecorder::Status QMediaRecorderControl::status() const |
| 126 | |
| 127 | Return the current recording status. |
| 128 | */ |
| 129 | |
| 130 | /*! |
| 131 | \fn qint64 QMediaRecorderControl::duration() const |
| 132 | |
| 133 | Return the current duration in milliseconds. |
| 134 | */ |
| 135 | |
| 136 | /*! |
| 137 | \fn void QMediaRecorderControl::setState(QMediaRecorder::State state) |
| 138 | |
| 139 | Set the media recorder \a state. |
| 140 | */ |
| 141 | |
| 142 | /*! |
| 143 | \fn void QMediaRecorderControl::applySettings() |
| 144 | |
| 145 | Commits the encoder settings and performs pre-initialization to reduce delays when recording |
| 146 | is started. |
| 147 | */ |
| 148 | |
| 149 | /*! |
| 150 | \fn bool QMediaRecorderControl::isMuted() const |
| 151 | |
| 152 | Returns true if the recorder is muted, and false if it is not. |
| 153 | */ |
| 154 | |
| 155 | /*! |
| 156 | \fn void QMediaRecorderControl::setMuted(bool muted) |
| 157 | |
| 158 | Sets the \a muted state of a media recorder. |
| 159 | */ |
| 160 | |
| 161 | /*! |
| 162 | \fn qreal QMediaRecorderControl::volume() const |
| 163 | |
| 164 | Returns the audio volume of a media recorder control. |
| 165 | */ |
| 166 | |
| 167 | /*! |
| 168 | \fn void QMediaRecorderControl::setVolume(qreal volume) |
| 169 | |
| 170 | Sets the audio \a volume of a media recorder control. |
| 171 | |
| 172 | The volume is scaled linearly, ranging from \c 0 (silence) to \c 100 (full volume). |
| 173 | */ |
| 174 | |
| 175 | /*! |
| 176 | \fn void QMediaRecorderControl::stateChanged(QMediaRecorder::State state) |
| 177 | |
| 178 | Signals that the \a state of a media recorder has changed. |
| 179 | */ |
| 180 | |
| 181 | /*! |
| 182 | \fn void QMediaRecorderControl::statusChanged(QMediaRecorder::Status status) |
| 183 | |
| 184 | Signals that the \a status of a media recorder has changed. |
| 185 | */ |
| 186 | |
| 187 | |
| 188 | /*! |
| 189 | \fn void QMediaRecorderControl::durationChanged(qint64 duration) |
| 190 | |
| 191 | Signals that the \a duration of the recorded media has changed. |
| 192 | |
| 193 | This only emitted when there is a discontinuous change in the duration such as being reset to 0. |
| 194 | */ |
| 195 | |
| 196 | /*! |
| 197 | \fn void QMediaRecorderControl::mutedChanged(bool muted) |
| 198 | |
| 199 | Signals that the \a muted state of a media recorder has changed. |
| 200 | */ |
| 201 | |
| 202 | /*! |
| 203 | \fn void QMediaRecorderControl::volumeChanged(qreal gain) |
| 204 | |
| 205 | Signals that the audio \a gain value has changed. |
| 206 | */ |
| 207 | |
| 208 | /*! |
| 209 | \fn void QMediaRecorderControl::actualLocationChanged(const QUrl &location) |
| 210 | |
| 211 | Signals that the actual media \a location has changed. |
| 212 | This signal should be emitted at start of recording. |
| 213 | */ |
| 214 | |
| 215 | /*! |
| 216 | \fn void QMediaRecorderControl::error(int error, const QString &errorString) |
| 217 | |
| 218 | Signals that an \a error has occurred. The \a errorString describes the error. |
| 219 | */ |
| 220 | |
| 221 | QT_END_NAMESPACE |
| 222 | |
| 223 | #include "moc_qmediarecordercontrol.cpp" |
| 224 | |