Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgstreamercamera.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5
6#include <QtMultimedia/qcameradevice.h>
7#include <QtMultimedia/qmediacapturesession.h>
8#include <QtCore/qdebug.h>
9
10#include <common/qgst_debug_p.h>
13
14#if QT_CONFIG(linux_v4l)
15#include <linux/videodev2.h>
16#include <private/qcore_unix_p.h>
17#endif
18
19
21
22QMaybe<QPlatformCamera *> QGstreamerCamera::create(QCamera *camera)
23{
24 QGstElement videotestsrc = QGstElement::createFromFactory("videotestsrc");
25 if (!videotestsrc)
26 return errorMessageCannotFindElement("videotestsrc");
27
28 QGstElement capsFilter = QGstElement::createFromFactory("capsfilter", "videoCapsFilter");
29 if (!capsFilter)
30 return errorMessageCannotFindElement("capsfilter");
31
32 QGstElement videoconvert = QGstElement::createFromFactory("videoconvert", "videoConvert");
33 if (!videoconvert)
34 return errorMessageCannotFindElement("videoconvert");
35
36 QGstElement videoscale = QGstElement::createFromFactory("videoscale", "videoScale");
37 if (!videoscale)
38 return errorMessageCannotFindElement("videoscale");
39
40 return new QGstreamerCamera(videotestsrc, capsFilter, videoconvert, videoscale, camera);
41}
42
43QGstreamerCamera::QGstreamerCamera(QGstElement videotestsrc, QGstElement capsFilter,
44 QGstElement videoconvert, QGstElement videoscale,
47 gstCamera(std::move(videotestsrc)),
48 gstCapsFilter(std::move(capsFilter)),
49 gstVideoConvert(std::move(videoconvert)),
50 gstVideoScale(std::move(videoscale))
51{
52 gstDecode = QGstElement::createFromFactory("identity");
53 gstCameraBin = QGstBin::create("camerabin");
54 gstCameraBin.add(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert, gstVideoScale);
55 qLinkGstElements(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert, gstVideoScale);
56 gstCameraBin.addGhostPad(gstVideoScale, "src");
57}
58
60{
61 gstCameraBin.setStateSync(GST_STATE_NULL);
62}
63
65{
66 return m_active;
67}
68
70{
71 if (m_active == active)
72 return;
73 if (m_cameraDevice.isNull() && active)
74 return;
75
76 m_active = active;
77
78 emit activeChanged(active);
79}
80
82{
83 using namespace Qt::Literals;
84
85 if (m_cameraDevice == camera)
86 return;
87
88 m_cameraDevice = camera;
89
90 QGstElement gstNewCamera;
91 if (camera.isNull()) {
92 gstNewCamera = QGstElement::createFromFactory("videotestsrc");
93 } else {
94 auto *integration = static_cast<QGstreamerIntegration *>(QGstreamerIntegration::instance());
95 GstDevice *device = integration->videoDevice(camera.id());
96
97 if (!device) {
99 u"Failed to create GstDevice for camera: "_s
100 + QString::fromUtf8(camera.id()));
101 return;
102 }
103
104 gstNewCamera = QGstElement::createFromDevice(device, "camerasrc");
105 if (QGstStructure properties = gst_device_get_properties(device); !properties.isNull()) {
106 if (properties.name() == "v4l2deviceprovider")
107 m_v4l2DevicePath = QString::fromUtf8(properties["device.path"].toString());
108 properties.free();
109 }
110 }
111
113 auto caps = QGstCaps::fromCameraFormat(f);
114 auto gstNewDecode = QGstElement::createFromFactory(
115 f.pixelFormat() == QVideoFrameFormat::Format_Jpeg ? "jpegdec" : "identity");
116
118 qUnlinkGstElements(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert);
119 gstCameraBin.stopAndRemoveElements(gstCamera, gstDecode);
120
121 gstCapsFilter.set("caps", caps);
122
123 gstCamera = std::move(gstNewCamera);
124 gstDecode = std::move(gstNewDecode);
125
126 gstCameraBin.add(gstCamera, gstDecode);
127 qLinkGstElements(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert);
128
129 gstCameraBin.syncChildrenState();
130 });
131
132 updateCameraProperties();
133}
134
136{
137 if (!format.isNull() && !m_cameraDevice.videoFormats().contains(format))
138 return false;
139
141 if (f.isNull())
142 f = findBestCameraFormat(m_cameraDevice);
143
144 auto caps = QGstCaps::fromCameraFormat(f);
145
146 auto newGstDecode = QGstElement::createFromFactory(
147 f.pixelFormat() == QVideoFrameFormat::Format_Jpeg ? "jpegdec" : "identity");
148
150 newGstDecode.syncStateWithParent();
151
152 qUnlinkGstElements(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert);
153 gstCameraBin.stopAndRemoveElements(gstDecode);
154
155 gstCapsFilter.set("caps", caps);
156
157 gstDecode = std::move(newGstDecode);
158
159 gstCameraBin.add(gstDecode);
160 qLinkGstElements(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert);
161 gstCameraBin.syncChildrenState();
162 });
163
164 return true;
165}
166
167void QGstreamerCamera::updateCameraProperties()
168{
169#if QT_CONFIG(linux_v4l)
170 if (isV4L2Camera()) {
171 initV4L2Controls();
172 return;
173 }
174#endif
175#if QT_CONFIG(gstreamer_photography)
176 if (auto *p = photography())
177 gst_photography_set_white_balance_mode(p, GST_PHOTOGRAPHY_WB_MODE_AUTO);
181#endif
182
183}
184
185#if QT_CONFIG(gstreamer_photography)
186GstPhotography *QGstreamerCamera::photography() const
187{
188 if (!gstCamera.isNull() && GST_IS_PHOTOGRAPHY(gstCamera.element()))
189 return GST_PHOTOGRAPHY(gstCamera.element());
190 return nullptr;
191}
192#endif
193
195{
196 if (mode == focusMode())
197 return;
198
199#if QT_CONFIG(gstreamer_photography)
200 auto p = photography();
201 if (p) {
202 GstPhotographyFocusMode photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL;
203
204 switch (mode) {
206 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MACRO;
207 break;
209 // not quite, but hey :)
212 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL;
213 break;
215 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY;
216 break;
218 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL;
219 break;
220 default: // QCamera::FocusModeAuto:
221 break;
222 }
223
224 if (gst_photography_set_focus_mode(p, photographyMode))
226 }
227#endif
228}
229
231{
232#if QT_CONFIG(gstreamer_photography)
233 if (photography())
234 return true;
235#endif
237}
238
240{
241 Q_UNUSED(mode);
242
243#if QT_CONFIG(gstreamer_photography)
244 if (auto *p = photography()) {
245 GstPhotographyFlashMode flashMode;
246 gst_photography_get_flash_mode(p, &flashMode);
247
248 switch (mode) {
250 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO;
251 break;
253 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_OFF;
254 break;
255 case QCamera::FlashOn:
256 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_ON;
257 break;
258 }
259
260 if (gst_photography_set_flash_mode(p, flashMode))
262 }
263#endif
264}
265
267{
268#if QT_CONFIG(gstreamer_photography)
269 if (photography())
270 return true;
271#endif
272
273 return mode == QCamera::FlashAuto;
274}
275
277{
278#if QT_CONFIG(gstreamer_photography)
279 if (photography())
280 return true;
281#endif
282
283 return false;
284}
285
287{
288 Q_UNUSED(mode);
289#if QT_CONFIG(linux_v4l)
290 if (isV4L2Camera() && v4l2AutoExposureSupported && v4l2ManualExposureSupported) {
292 return;
293 int value = QCamera::ExposureAuto ? V4L2_EXPOSURE_AUTO : V4L2_EXPOSURE_MANUAL;
294 setV4L2Parameter(V4L2_CID_EXPOSURE_AUTO, value);
296 return;
297 }
298#endif
299
300#if QT_CONFIG(gstreamer_photography)
301 auto *p = photography();
302 if (!p)
303 return;
304
305 GstPhotographySceneMode sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
306
307 switch (mode) {
309 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_MANUAL;
310 break;
312 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT;
313 break;
315 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT;
316 break;
318 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
319 break;
321 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
322 break;
324 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE;
325 break;
327 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SNOW;
328 break;
330 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BEACH;
331 break;
333 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_ACTION;
334 break;
336 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT;
337 break;
339 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_THEATRE;
340 break;
342 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SUNSET;
343 break;
345 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO;
346 break;
348 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS;
349 break;
351 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PARTY;
352 break;
354 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT;
355 break;
357 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BARCODE;
358 break;
359 default:
360 return;
361 }
362
363 if (gst_photography_set_scene_mode(p, sceneMode))
365#endif
366}
367
369{
371 return true;
372#if QT_CONFIG(linux_v4l)
373 if (isV4L2Camera() && v4l2ManualExposureSupported && v4l2AutoExposureSupported)
375#endif
376#if QT_CONFIG(gstreamer_photography)
377 if (photography())
378 return true;
379#endif
380
381 return false;
382}
383
385{
386 Q_UNUSED(compensation);
387#if QT_CONFIG(linux_v4l)
388 if (isV4L2Camera() && (v4l2MinExposureAdjustment != 0 || v4l2MaxExposureAdjustment != 0)) {
389 int value = qBound(v4l2MinExposureAdjustment, (int)(compensation*1000), v4l2MaxExposureAdjustment);
390 setV4L2Parameter(V4L2_CID_AUTO_EXPOSURE_BIAS, value);
392 return;
393 }
394#endif
395
396#if QT_CONFIG(gstreamer_photography)
397 if (auto *p = photography()) {
398 if (gst_photography_set_ev_compensation(p, compensation))
399 exposureCompensationChanged(compensation);
400 }
401#endif
402}
403
405{
406 Q_UNUSED(iso);
407#if QT_CONFIG(linux_v4l)
408 if (isV4L2Camera()) {
410 return;
411 setV4L2Parameter(V4L2_CID_ISO_SENSITIVITY_AUTO, iso <= 0 ? V4L2_ISO_SENSITIVITY_AUTO : V4L2_ISO_SENSITIVITY_MANUAL);
412 if (iso > 0) {
413 iso = qBound(minIso(), iso, maxIso());
414 setV4L2Parameter(V4L2_CID_ISO_SENSITIVITY, iso);
415 }
416 return;
417 }
418#endif
419#if QT_CONFIG(gstreamer_photography)
420 if (auto *p = photography()) {
421 if (gst_photography_set_iso_speed(p, iso))
423 }
424#endif
425}
426
428{
429#if QT_CONFIG(linux_v4l)
430 if (isV4L2Camera()) {
432 return -1;
433 return getV4L2Parameter(V4L2_CID_ISO_SENSITIVITY);
434 }
435#endif
436#if QT_CONFIG(gstreamer_photography)
437 if (auto *p = photography()) {
438 guint speed = 0;
439 if (gst_photography_get_iso_speed(p, &speed))
440 return speed;
441 }
442#endif
443 return 100;
444}
445
447{
448 Q_UNUSED(secs);
449#if QT_CONFIG(linux_v4l)
450 if (isV4L2Camera() && v4l2ManualExposureSupported && v4l2AutoExposureSupported) {
451 int exposure = qBound(v4l2MinExposure, qRound(secs*10000.), v4l2MaxExposure);
452 setV4L2Parameter(V4L2_CID_EXPOSURE_ABSOLUTE, exposure);
453 exposureTimeChanged(exposure/10000.);
454 return;
455 }
456#endif
457
458#if QT_CONFIG(gstreamer_photography)
459 if (auto *p = photography()) {
460 if (gst_photography_set_exposure(p, guint(secs*1000000)))
462 }
463#endif
464}
465
467{
468#if QT_CONFIG(linux_v4l)
469 if (isV4L2Camera()) {
470 return getV4L2Parameter(V4L2_CID_EXPOSURE_ABSOLUTE)/10000.;
471 }
472#endif
473#if QT_CONFIG(gstreamer_photography)
474 if (auto *p = photography()) {
475 guint32 exposure = 0;
476 if (gst_photography_get_exposure(p, &exposure))
477 return exposure/1000000.;
478 }
479#endif
480 return -1;
481}
482
484{
486 return true;
487
488#if QT_CONFIG(linux_v4l)
489 if (isV4L2Camera()) {
490 if (v4l2AutoWhiteBalanceSupported && v4l2ColorTemperatureSupported)
491 return true;
492 }
493#endif
494#if QT_CONFIG(gstreamer_photography)
495 if (auto *p = photography()) {
496 Q_UNUSED(p);
497 switch (mode) {
505 return true;
507#if GST_CHECK_VERSION(1, 18, 0)
508 GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
509 if (iface->set_color_temperature && iface->get_color_temperature)
510 return true;
511#endif
512 break;
513 }
514 default:
515 break;
516 }
517 }
518#endif
519
521}
522
524{
526
527#if QT_CONFIG(linux_v4l)
528 if (isV4L2Camera()) {
529 int temperature = colorTemperatureForWhiteBalance(mode);
530 int t = setV4L2ColorTemperature(temperature);
531 if (t == 0)
534 return;
535 }
536#endif
537
538#if QT_CONFIG(gstreamer_photography)
539 if (auto *p = photography()) {
540 GstPhotographyWhiteBalanceMode gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
541 switch (mode) {
543 gstMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT;
544 break;
546 gstMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY;
547 break;
549 gstMode = GST_PHOTOGRAPHY_WB_MODE_SHADE;
550 break;
552 gstMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET;
553 break;
555 gstMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN;
556 break;
558 gstMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT;
559 break;
561 default:
562 break;
563 }
564 if (gst_photography_set_white_balance_mode(p, gstMode)) {
566 return;
567 }
568 }
569#endif
570}
571
573{
574 if (temperature == 0) {
576 return;
577 }
578
580
581#if QT_CONFIG(linux_v4l)
582 if (isV4L2Camera()) {
583 int t = setV4L2ColorTemperature(temperature);
584 if (t)
586 return;
587 }
588#endif
589
590#if QT_CONFIG(gstreamer_photography) && GST_CHECK_VERSION(1, 18, 0)
591 if (auto *p = photography()) {
592 GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
593 Q_ASSERT(iface->set_color_temperature);
594 iface->set_color_temperature(p, temperature);
595 return;
596 }
597#endif
598}
599
600#if QT_CONFIG(linux_v4l)
601bool QGstreamerCamera::isV4L2Camera() const
602{
603 return !m_v4l2DevicePath.isEmpty();
604}
605
606void QGstreamerCamera::initV4L2Controls()
607{
608 v4l2AutoWhiteBalanceSupported = false;
609 v4l2ColorTemperatureSupported = false;
610 QCamera::Features features{};
611
612 Q_ASSERT(!m_v4l2DevicePath.isEmpty());
613
614
615 withV4L2DeviceFileDescriptor([&](int fd) {
616 struct v4l2_queryctrl queryControl = {};
617 queryControl.id = V4L2_CID_AUTO_WHITE_BALANCE;
618
619 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
620 v4l2AutoWhiteBalanceSupported = true;
621 setV4L2Parameter(V4L2_CID_AUTO_WHITE_BALANCE, true);
622 }
623
624 queryControl = {};
625 queryControl.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
626 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
627 v4l2MinColorTemp = queryControl.minimum;
628 v4l2MaxColorTemp = queryControl.maximum;
629 v4l2ColorTemperatureSupported = true;
631 }
632
633 queryControl = {};
634 queryControl.id = V4L2_CID_EXPOSURE_AUTO;
635 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
636 v4l2AutoExposureSupported = true;
637 }
638
639 queryControl = {};
640 queryControl.id = V4L2_CID_EXPOSURE_ABSOLUTE;
641 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
642 v4l2ManualExposureSupported = true;
643 v4l2MinExposure = queryControl.minimum;
644 v4l2MaxExposure = queryControl.maximum;
646 }
647
648 queryControl = {};
649 queryControl.id = V4L2_CID_AUTO_EXPOSURE_BIAS;
650 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
651 v4l2MinExposureAdjustment = queryControl.minimum;
652 v4l2MaxExposureAdjustment = queryControl.maximum;
654 }
655
656 queryControl = {};
657 queryControl.id = V4L2_CID_ISO_SENSITIVITY_AUTO;
658 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
659 queryControl.id = V4L2_CID_ISO_SENSITIVITY;
660 if (::ioctl(fd, VIDIOC_QUERYCTRL, &queryControl) == 0) {
662 minIsoChanged(queryControl.minimum);
663 maxIsoChanged(queryControl.minimum);
664 }
665 }
666 });
667
668 supportedFeaturesChanged(features);
669}
670
671int QGstreamerCamera::setV4L2ColorTemperature(int temperature)
672{
673 if (v4l2AutoWhiteBalanceSupported) {
674 setV4L2Parameter(V4L2_CID_AUTO_WHITE_BALANCE, temperature == 0 ? true : false);
675 } else if (temperature == 0) {
676 temperature = 5600;
677 }
678
679 if (temperature != 0 && v4l2ColorTemperatureSupported) {
680 temperature = qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp);
681 if (!setV4L2Parameter(V4L2_CID_WHITE_BALANCE_TEMPERATURE, qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp)))
682 temperature = 0;
683 } else {
684 temperature = 0;
685 }
686
687 return temperature;
688}
689
690bool QGstreamerCamera::setV4L2Parameter(quint32 id, qint32 value)
691{
692 return withV4L2DeviceFileDescriptor([&](int fd) {
693 v4l2_control control{ id, value };
694 if (::ioctl(fd, VIDIOC_S_CTRL, &control) != 0) {
695 qWarning() << "Unable to set the V4L2 Parameter" << Qt::hex << id << "to" << value
696 << qt_error_string(errno);
697 return false;
698 }
699 return true;
700 });
701}
702
703int QGstreamerCamera::getV4L2Parameter(quint32 id) const
704{
705 return withV4L2DeviceFileDescriptor([&](int fd) {
706 v4l2_control control{ id, 0 };
707 if (::ioctl(fd, VIDIOC_G_CTRL, &control) != 0) {
708 qWarning() << "Unable to get the V4L2 Parameter" << Qt::hex << id
709 << qt_error_string(errno);
710 return 0;
711 }
712 return control.value;
713 });
714}
715
716#endif
717
719
720#include "moc_qgstreamercamera_p.cpp"
IOBluetoothDevice * device
The QCameraDevice class provides general information about camera devices.
bool isNull() const
Returns true if this QCameraDevice is null or invalid.
QList< QCameraFormat > videoFormats
\qmlproperty CameraFormat QtMultimedia::cameraDevice::videoFormats
The QCameraFormat class describes a video format supported by a camera device. \inmodule QtMultimedia...
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
WhiteBalanceMode
\value WhiteBalanceAuto Auto white balance mode.
Definition qcamera.h:112
@ WhiteBalanceShade
Definition qcamera.h:117
@ WhiteBalanceCloudy
Definition qcamera.h:116
@ WhiteBalanceSunset
Definition qcamera.h:121
@ WhiteBalanceManual
Definition qcamera.h:114
@ WhiteBalanceSunlight
Definition qcamera.h:115
@ WhiteBalanceTungsten
Definition qcamera.h:118
@ WhiteBalanceFluorescent
Definition qcamera.h:119
@ WhiteBalanceAuto
Definition qcamera.h:113
FocusMode
\value FocusModeAuto Continuous auto focus mode.
Definition qcamera.h:67
@ FocusModeAutoNear
Definition qcamera.h:69
@ FocusModeInfinity
Definition qcamera.h:72
@ FocusModeAutoFar
Definition qcamera.h:70
@ FocusModeAuto
Definition qcamera.h:68
@ FocusModeManual
Definition qcamera.h:73
@ FocusModeHyperfocal
Definition qcamera.h:71
FlashMode
\value FlashOff Flash is Off.
Definition qcamera.h:77
@ FlashAuto
Definition qcamera.h:80
@ FlashOn
Definition qcamera.h:79
@ FlashOff
Definition qcamera.h:78
ExposureMode
\value ExposureAuto Automatic mode.
Definition qcamera.h:91
@ ExposureCandlelight
Definition qcamera.h:107
@ ExposureLandscape
Definition qcamera.h:100
@ ExposureManual
Definition qcamera.h:93
@ ExposureBeach
Definition qcamera.h:98
@ ExposureSunset
Definition qcamera.h:103
@ ExposurePortrait
Definition qcamera.h:94
@ ExposureNightPortrait
Definition qcamera.h:101
@ ExposureSports
Definition qcamera.h:96
@ ExposureTheatre
Definition qcamera.h:102
@ ExposureBarcode
Definition qcamera.h:108
@ ExposureAuto
Definition qcamera.h:92
@ ExposureFireworks
Definition qcamera.h:105
@ ExposureAction
Definition qcamera.h:99
@ ExposureParty
Definition qcamera.h:106
@ ExposureSnow
Definition qcamera.h:97
@ ExposureSteadyPhoto
Definition qcamera.h:104
@ ExposureNight
Definition qcamera.h:95
@ CameraError
Definition qcamera.h:63
std::enable_if_t<(std::is_base_of_v< QGstElement, Ts > &&...), void add)(const Ts &...ts)
Definition qgst_p.h:691
static QGstBin create(const char *name)
Definition qgst.cpp:1060
void addGhostPad(const QGstElement &child, const char *name)
Definition qgst.cpp:1118
static QGstCaps fromCameraFormat(const QCameraFormat &format)
Definition qgst.cpp:477
static QGstElement createFromDevice(const QGstDeviceHandle &, const char *name=nullptr)
Definition qgst.cpp:866
GstElement * element() const
Definition qgst.cpp:1018
bool setStateSync(GstState state, std::chrono::nanoseconds timeout=std::chrono::seconds(1))
Definition qgst.cpp:947
static QGstElement createFromFactory(const char *factory, const char *name=nullptr)
Definition qgst.cpp:835
QGstPipeline getPipeline() const
Definition qgst.cpp:1031
void modifyPipelineWhileNotRunning(Functor &&fn)
void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) override
bool isFocusModeSupported(QCamera::FocusMode mode) const override
bool isActive() const override
bool isFlashModeSupported(QCamera::FlashMode mode) const override
bool isExposureModeSupported(QCamera::ExposureMode mode) const override
bool setCameraFormat(const QCameraFormat &format) override
void setColorTemperature(int temperature) override
void setExposureMode(QCamera::ExposureMode) override
bool isFlashReady() const override
static QMaybe< QPlatformCamera * > create(QCamera *camera)
int isoSensitivity() const override
float exposureTime() const override
bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const override
void setFlashMode(QCamera::FlashMode mode) override
void setFocusMode(QCamera::FocusMode mode) override
void setActive(bool active) override
void setManualIsoSensitivity(int) override
void setCamera(const QCameraDevice &camera) override
void setManualExposureTime(float) override
void setExposureCompensation(float) override
static QGstreamerIntegration * instance()
QCameraFormat findBestCameraFormat(const QCameraDevice &camera) const
void isoSensitivityChanged(int iso)
void updateError(QCamera::Error error, const QString &errorString)
void maxIsoChanged(int iso)
QCamera::Features supportedFeatures() const
void focusModeChanged(QCamera::FocusMode mode)
void exposureCompensationChanged(float compensation)
void whiteBalanceModeChanged(QCamera::WhiteBalanceMode mode)
QCamera::FocusMode focusMode() const
QCamera::FlashMode flashMode() const
static int colorTemperatureForWhiteBalance(QCamera::WhiteBalanceMode mode)
void flashModeChanged(QCamera::FlashMode mode)
void colorTemperatureChanged(int temperature)
void minIsoChanged(int iso)
void exposureModeChanged(QCamera::ExposureMode mode)
void supportedFeaturesChanged(QCamera::Features)
void exposureTimeChanged(float speed)
void activeChanged(bool)
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
QCamera * camera
Definition camera.cpp:19
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
#define Q_FALLTHROUGH()
static const QCssKnownValue properties[NumProperties - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:327
std::enable_if_t<(std::is_base_of_v< QGstElement, Ts > &&...), void qLinkGstElements)(const Ts &...ts)
Definition qgst_p.h:644
QString errorMessageCannotFindElement(std::string_view element)
Definition qgst_p.h:817
Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode=-1)
#define qWarning
Definition qlogging.h:166
constexpr const T & qBound(const T &min, const T &val, const T &max)
Definition qminmax.h:44
GLenum mode
GLenum GLuint id
[7]
GLfloat GLfloat f
GLuint64 GLenum GLint fd
GLint GLsizei GLsizei GLenum format
GLdouble GLdouble t
Definition qopenglext.h:243
GLfloat GLfloat p
[1]
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define emit
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
int qint32
Definition qtypes.h:49
char * toString(const MyType &t)
[31]
bool contains(const AT &t) const noexcept
Definition qlist.h:45