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 <qcameracontrol.h> |
41 | #include "qmediacontrol_p.h" |
42 | |
43 | QT_BEGIN_NAMESPACE |
44 | |
45 | /*! |
46 | \class QCameraControl |
47 | |
48 | |
49 | |
50 | \brief The QCameraControl class is an abstract base class for |
51 | classes that control still cameras or video cameras. |
52 | |
53 | \inmodule QtMultimedia |
54 | |
55 | \ingroup multimedia_control |
56 | |
57 | This service is provided by a QMediaService object via |
58 | QMediaService::control(). It is used by QCamera. |
59 | |
60 | The interface name of QCameraControl is \c org.qt-project.qt.cameracontrol/5.0 as |
61 | defined in QCameraControl_iid. |
62 | |
63 | |
64 | |
65 | \sa QMediaService::requestControl(), QCamera |
66 | */ |
67 | |
68 | /*! |
69 | \macro QCameraControl_iid |
70 | |
71 | \c org.qt-project.qt.cameracontrol/5.0 |
72 | |
73 | Defines the interface name of the QCameraControl class. |
74 | |
75 | \relates QCameraControl |
76 | */ |
77 | |
78 | /*! |
79 | Constructs a camera control object with \a parent. |
80 | */ |
81 | |
82 | QCameraControl::QCameraControl(QObject *parent): |
83 | QMediaControl(*new QMediaControlPrivate, parent) |
84 | { |
85 | } |
86 | |
87 | /*! |
88 | Destruct the camera control object. |
89 | */ |
90 | |
91 | QCameraControl::~QCameraControl() |
92 | { |
93 | } |
94 | |
95 | /*! |
96 | \fn QCameraControl::state() const |
97 | |
98 | Returns the state of the camera service. |
99 | |
100 | \sa QCamera::state |
101 | */ |
102 | |
103 | /*! |
104 | \fn QCameraControl::setState(QCamera::State state) |
105 | |
106 | Sets the camera \a state. |
107 | |
108 | State changes are synchronous and indicate user intention, |
109 | while camera status is used as a feedback mechanism to inform application about backend status. |
110 | Status changes are reported asynchronously with QCameraControl::statusChanged() signal. |
111 | |
112 | \sa QCamera::State |
113 | */ |
114 | |
115 | /*! |
116 | \fn void QCameraControl::stateChanged(QCamera::State state) |
117 | |
118 | Signal emitted when the camera \a state changes. |
119 | |
120 | In most cases the state chage is caused by QCameraControl::setState(), |
121 | but if critical error has occurred the state changes to QCamera::UnloadedState. |
122 | */ |
123 | |
124 | /*! |
125 | \fn QCameraControl::status() const |
126 | |
127 | Returns the status of the camera service. |
128 | |
129 | \sa QCamera::state |
130 | */ |
131 | |
132 | /*! |
133 | \fn void QCameraControl::statusChanged(QCamera::Status status) |
134 | |
135 | Signal emitted when the camera \a status changes. |
136 | */ |
137 | |
138 | |
139 | /*! |
140 | \fn void QCameraControl::error(int error, const QString &errorString) |
141 | |
142 | Signal emitted when an error occurs with error code \a error and |
143 | a description of the error \a errorString. |
144 | */ |
145 | |
146 | /*! |
147 | \fn Camera::CaptureModes QCameraControl::captureMode() const = 0 |
148 | |
149 | Returns the current capture mode. |
150 | */ |
151 | |
152 | /*! |
153 | \fn void QCameraControl::setCaptureMode(QCamera::CaptureModes mode) = 0; |
154 | |
155 | Sets the current capture \a mode. |
156 | |
157 | The capture mode changes are synchronous and allowed in any camera state. |
158 | |
159 | If the capture mode is changed while camera is active, |
160 | it's recommended to change status to QCamera::LoadedStatus |
161 | and start activating the camera in the next event loop |
162 | with the status changed to QCamera::StartingStatus. |
163 | This allows the capture settings to be applied before camera is started. |
164 | Than change the status to QCamera::StartedStatus when the capture mode change is done. |
165 | */ |
166 | |
167 | /*! |
168 | \fn bool QCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const = 0; |
169 | |
170 | Returns true if the capture \a mode is suported. |
171 | */ |
172 | |
173 | /*! |
174 | \fn QCameraControl::captureModeChanged(QCamera::CaptureModes mode) |
175 | |
176 | Signal emitted when the camera capture \a mode changes. |
177 | */ |
178 | |
179 | /*! |
180 | \fn bool QCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const |
181 | |
182 | Returns true if backend can effectively apply changing camera properties of \a changeType type |
183 | while the camera state is QCamera::Active and camera status matches \a status parameter. |
184 | |
185 | If backend doesn't support applying this change in the active state, it will be stopped |
186 | before the settings are changed and restarted after. |
187 | Otherwise the backend should apply the change in the current state, |
188 | with the camera status indicating the progress, if necessary. |
189 | */ |
190 | |
191 | /*! |
192 | \enum QCameraControl::PropertyChangeType |
193 | |
194 | \value CaptureMode Indicates the capture mode is changed. |
195 | \value ImageEncodingSettings Image encoder settings are changed, including resolution. |
196 | \value VideoEncodingSettings |
197 | Video encoder settings are changed, including audio, video and container settings. |
198 | \value Viewfinder Viewfinder is changed. |
199 | \value ViewfinderSettings Viewfinder settings are changed. |
200 | */ |
201 | |
202 | #include "moc_qcameracontrol.cpp" |
203 | QT_END_NAMESPACE |
204 | |