Qt 6.x
The Qt SDK
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
4#include <qcameradevice.h>
5
11
12#if QT_CONFIG(linux_v4l)
13#include <linux/videodev2.h>
14#include <private/qcore_unix_p.h>
15#endif
16
17#include <QtCore/qdebug.h>
18
20
22{
23 QGstElement videotestsrc("videotestsrc");
24 if (!videotestsrc)
25 return errorMessageCannotFindElement("videotestsrc");
26
27 QGstElement capsFilter("capsfilter", "videoCapsFilter");
28 if (!capsFilter)
29 return errorMessageCannotFindElement("capsfilter");
30
31 QGstElement videoconvert("videoconvert", "videoConvert");
32 if (!videoconvert)
33 return errorMessageCannotFindElement("videoconvert");
34
35 QGstElement videoscale("videoscale", "videoScale");
36 if (!videoscale)
37 return errorMessageCannotFindElement("videoscale");
38
39 return new QGstreamerCamera(videotestsrc, capsFilter, videoconvert, videoscale, camera);
40}
41
42QGstreamerCamera::QGstreamerCamera(QGstElement videotestsrc, QGstElement capsFilter,
43 QGstElement videoconvert, QGstElement videoscale,
46 gstCamera(std::move(videotestsrc)),
47 gstCapsFilter(std::move(capsFilter)),
48 gstVideoConvert(std::move(videoconvert)),
49 gstVideoScale(std::move(videoscale))
50{
51 gstDecode = QGstElement("identity");
52 gstCameraBin = QGstBin("camerabin");
53 gstCameraBin.add(gstCamera, gstCapsFilter, gstDecode, gstVideoConvert, gstVideoScale);
54 gstCamera.link(gstCapsFilter, gstDecode, gstVideoConvert, gstVideoScale);
55 gstCameraBin.addGhostPad(gstVideoScale, "src");
56}
57
59{
60#if QT_CONFIG(linux_v4l)
61 if (v4l2FileDescriptor >= 0)
62 qt_safe_close(v4l2FileDescriptor);
63 v4l2FileDescriptor = -1;
64#endif
65 gstCameraBin.setStateSync(GST_STATE_NULL);
66}
67
69{
70 return m_active;
71}
72
74{
75 if (m_active == active)
76 return;
77 if (m_cameraDevice.isNull() && active)
78 return;
79
80 m_active = active;
81
82 emit activeChanged(active);
83}
84
86{
87 if (m_cameraDevice == camera)
88 return;
89
90 m_cameraDevice = camera;
91
92 QGstElement gstNewCamera;
93 if (camera.isNull()) {
94 gstNewCamera = QGstElement("videotestsrc");
95 } else {
96 auto *integration = static_cast<QGstreamerIntegration *>(QGstreamerIntegration::instance());
97 auto *device = integration->videoDevice(camera.id());
98 gstNewCamera = gst_device_create_element(device, "camerasrc");
99 if (QGstStructure properties = gst_device_get_properties(device); !properties.isNull()) {
100 if (properties.name() == "v4l2deviceprovider")
101 m_v4l2Device = QString::fromUtf8(properties["device.path"].toString());
102 properties.free();
103 }
104 }
105
107 auto caps = QGstCaps::fromCameraFormat(f);
108 auto gstNewDecode = QGstElement(f.pixelFormat() == QVideoFrameFormat::Format_Jpeg ? "jpegdec" : "identity");
109
110 gstCamera.unlink(gstCapsFilter);
111 gstCapsFilter.unlink(gstDecode);
112 gstDecode.unlink(gstVideoConvert);
113
114 gstCameraBin.remove(gstCamera);
115 gstCameraBin.remove(gstDecode);
116
117 gstCamera.setStateSync(GST_STATE_NULL);
118 gstDecode.setStateSync(GST_STATE_NULL);
119
120 gstCapsFilter.set("caps", caps);
121
122 gstCameraBin.add(gstNewCamera, gstNewDecode);
123
124 gstNewDecode.link(gstVideoConvert);
125 gstCapsFilter.link(gstNewDecode);
126
127 if (!gstNewCamera.link(gstCapsFilter))
128 qWarning() << "linking camera failed" << gstCamera.name() << caps.toString();
129
130 // Start sending frames once pipeline is linked
131 // FIXME: put camera to READY state before linking to decoder as in the NULL state it does not know its true caps
132 gstCapsFilter.syncStateWithParent();
133 gstNewDecode.syncStateWithParent();
134 gstNewCamera.syncStateWithParent();
135
136 gstCamera = gstNewCamera;
137 gstDecode = gstNewDecode;
138
139 updateCameraProperties();
140}
141
143{
144 if (!format.isNull() && !m_cameraDevice.videoFormats().contains(format))
145 return false;
146
148 if (f.isNull())
149 f = findBestCameraFormat(m_cameraDevice);
150
151 auto caps = QGstCaps::fromCameraFormat(f);
152
153 auto newGstDecode = QGstElement(f.pixelFormat() == QVideoFrameFormat::Format_Jpeg ? "jpegdec" : "identity");
154 gstCameraBin.add(newGstDecode);
155 newGstDecode.syncStateWithParent();
156
157 gstCamera.staticPad("src").doInIdleProbe([&](){
158 gstCamera.unlink(gstCapsFilter);
159 gstCapsFilter.unlink(gstDecode);
160 gstDecode.unlink(gstVideoConvert);
161
162 gstCapsFilter.set("caps", caps);
163
164 newGstDecode.link(gstVideoConvert);
165 gstCapsFilter.link(newGstDecode);
166 if (!gstCamera.link(gstCapsFilter))
167 qWarning() << "linking filtered camera to decoder failed" << gstCamera.name() << caps.toString();
168 });
169
170 gstCameraBin.remove(gstDecode);
171 gstDecode.setStateSync(GST_STATE_NULL);
172
173 gstDecode = newGstDecode;
174
175 return true;
176}
177
178void QGstreamerCamera::updateCameraProperties()
179{
180#if QT_CONFIG(linux_v4l)
181 if (isV4L2Camera()) {
182 initV4L2Controls();
183 return;
184 }
185#endif
186#if QT_CONFIG(gstreamer_photography)
187 if (auto *p = photography())
188 gst_photography_set_white_balance_mode(p, GST_PHOTOGRAPHY_WB_MODE_AUTO);
192#endif
193
194}
195
196#if QT_CONFIG(gstreamer_photography)
197GstPhotography *QGstreamerCamera::photography() const
198{
199 if (!gstCamera.isNull() && GST_IS_PHOTOGRAPHY(gstCamera.element()))
200 return GST_PHOTOGRAPHY(gstCamera.element());
201 return nullptr;
202}
203#endif
204
206{
207 if (mode == focusMode())
208 return;
209
210#if QT_CONFIG(gstreamer_photography)
211 auto p = photography();
212 if (p) {
213 GstPhotographyFocusMode photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_CONTINUOUS_NORMAL;
214
215 switch (mode) {
217 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MACRO;
218 break;
220 // not quite, but hey :)
223 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_HYPERFOCAL;
224 break;
226 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_INFINITY;
227 break;
229 photographyMode = GST_PHOTOGRAPHY_FOCUS_MODE_MANUAL;
230 break;
231 default: // QCamera::FocusModeAuto:
232 break;
233 }
234
235 if (gst_photography_set_focus_mode(p, photographyMode))
237 }
238#endif
239}
240
242{
243#if QT_CONFIG(gstreamer_photography)
244 if (photography())
245 return true;
246#endif
248}
249
251{
252 Q_UNUSED(mode);
253
254#if QT_CONFIG(gstreamer_photography)
255 if (auto *p = photography()) {
256 GstPhotographyFlashMode flashMode;
257 gst_photography_get_flash_mode(p, &flashMode);
258
259 switch (mode) {
261 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO;
262 break;
264 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_OFF;
265 break;
266 case QCamera::FlashOn:
267 flashMode = GST_PHOTOGRAPHY_FLASH_MODE_ON;
268 break;
269 }
270
271 if (gst_photography_set_flash_mode(p, flashMode))
273 }
274#endif
275}
276
278{
279#if QT_CONFIG(gstreamer_photography)
280 if (photography())
281 return true;
282#endif
283
284 return mode == QCamera::FlashAuto;
285}
286
288{
289#if QT_CONFIG(gstreamer_photography)
290 if (photography())
291 return true;
292#endif
293
294 return false;
295}
296
298{
299 Q_UNUSED(mode);
300#if QT_CONFIG(linux_v4l)
301 if (isV4L2Camera() && v4l2AutoExposureSupported && v4l2ManualExposureSupported) {
303 return;
304 int value = QCamera::ExposureAuto ? V4L2_EXPOSURE_AUTO : V4L2_EXPOSURE_MANUAL;
305 setV4L2Parameter(V4L2_CID_EXPOSURE_AUTO, value);
307 return;
308 }
309#endif
310
311#if QT_CONFIG(gstreamer_photography)
312 auto *p = photography();
313 if (!p)
314 return;
315
316 GstPhotographySceneMode sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
317
318 switch (mode) {
320 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_MANUAL;
321 break;
323 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT;
324 break;
326 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT;
327 break;
329 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT;
330 break;
332 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
333 break;
335 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE;
336 break;
338 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SNOW;
339 break;
341 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BEACH;
342 break;
344 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_ACTION;
345 break;
347 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT;
348 break;
350 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_THEATRE;
351 break;
353 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SUNSET;
354 break;
356 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO;
357 break;
359 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS;
360 break;
362 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PARTY;
363 break;
365 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT;
366 break;
368 sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BARCODE;
369 break;
370 default:
371 return;
372 }
373
374 if (gst_photography_set_scene_mode(p, sceneMode))
376#endif
377}
378
380{
382 return true;
383#if QT_CONFIG(linux_v4l)
384 if (isV4L2Camera() && v4l2ManualExposureSupported && v4l2AutoExposureSupported)
386#endif
387#if QT_CONFIG(gstreamer_photography)
388 if (photography())
389 return true;
390#endif
391
392 return false;
393}
394
396{
397 Q_UNUSED(compensation);
398#if QT_CONFIG(linux_v4l)
399 if (isV4L2Camera() && (v4l2MinExposureAdjustment != 0 || v4l2MaxExposureAdjustment != 0)) {
400 int value = qBound(v4l2MinExposureAdjustment, (int)(compensation*1000), v4l2MaxExposureAdjustment);
401 setV4L2Parameter(V4L2_CID_AUTO_EXPOSURE_BIAS, value);
403 return;
404 }
405#endif
406
407#if QT_CONFIG(gstreamer_photography)
408 if (auto *p = photography()) {
409 if (gst_photography_set_ev_compensation(p, compensation))
410 exposureCompensationChanged(compensation);
411 }
412#endif
413}
414
416{
417 Q_UNUSED(iso);
418#if QT_CONFIG(linux_v4l)
419 if (isV4L2Camera()) {
421 return;
422 setV4L2Parameter(V4L2_CID_ISO_SENSITIVITY_AUTO, iso <= 0 ? V4L2_ISO_SENSITIVITY_AUTO : V4L2_ISO_SENSITIVITY_MANUAL);
423 if (iso > 0) {
424 iso = qBound(minIso(), iso, maxIso());
425 setV4L2Parameter(V4L2_CID_ISO_SENSITIVITY, iso);
426 }
427 return;
428 }
429#endif
430#if QT_CONFIG(gstreamer_photography)
431 if (auto *p = photography()) {
432 if (gst_photography_set_iso_speed(p, iso))
434 }
435#endif
436}
437
439{
440#if QT_CONFIG(linux_v4l)
441 if (isV4L2Camera()) {
443 return -1;
444 return getV4L2Parameter(V4L2_CID_ISO_SENSITIVITY);
445 }
446#endif
447#if QT_CONFIG(gstreamer_photography)
448 if (auto *p = photography()) {
449 guint speed = 0;
450 if (gst_photography_get_iso_speed(p, &speed))
451 return speed;
452 }
453#endif
454 return 100;
455}
456
458{
459 Q_UNUSED(secs);
460#if QT_CONFIG(linux_v4l)
461 if (isV4L2Camera() && v4l2ManualExposureSupported && v4l2AutoExposureSupported) {
462 int exposure = qBound(v4l2MinExposure, qRound(secs*10000.), v4l2MaxExposure);
463 setV4L2Parameter(V4L2_CID_EXPOSURE_ABSOLUTE, exposure);
464 exposureTimeChanged(exposure/10000.);
465 return;
466 }
467#endif
468
469#if QT_CONFIG(gstreamer_photography)
470 if (auto *p = photography()) {
471 if (gst_photography_set_exposure(p, guint(secs*1000000)))
473 }
474#endif
475}
476
478{
479#if QT_CONFIG(linux_v4l)
480 if (isV4L2Camera()) {
481 return getV4L2Parameter(V4L2_CID_EXPOSURE_ABSOLUTE)/10000.;
482 }
483#endif
484#if QT_CONFIG(gstreamer_photography)
485 if (auto *p = photography()) {
486 guint32 exposure = 0;
487 if (gst_photography_get_exposure(p, &exposure))
488 return exposure/1000000.;
489 }
490#endif
491 return -1;
492}
493
495{
497 return true;
498
499#if QT_CONFIG(linux_v4l)
500 if (isV4L2Camera()) {
501 if (v4l2AutoWhiteBalanceSupported && v4l2ColorTemperatureSupported)
502 return true;
503 }
504#endif
505#if QT_CONFIG(gstreamer_photography)
506 if (auto *p = photography()) {
507 Q_UNUSED(p);
508 switch (mode) {
516 return true;
518#if GST_CHECK_VERSION(1, 18, 0)
519 GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
520 if (iface->set_color_temperature && iface->get_color_temperature)
521 return true;
522#endif
523 break;
524 }
525 default:
526 break;
527 }
528 }
529#endif
530
532}
533
535{
537
538#if QT_CONFIG(linux_v4l)
539 if (isV4L2Camera()) {
540 int temperature = colorTemperatureForWhiteBalance(mode);
541 int t = setV4L2ColorTemperature(temperature);
542 if (t == 0)
545 return;
546 }
547#endif
548
549#if QT_CONFIG(gstreamer_photography)
550 if (auto *p = photography()) {
551 GstPhotographyWhiteBalanceMode gstMode = GST_PHOTOGRAPHY_WB_MODE_AUTO;
552 switch (mode) {
554 gstMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT;
555 break;
557 gstMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY;
558 break;
560 gstMode = GST_PHOTOGRAPHY_WB_MODE_SHADE;
561 break;
563 gstMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET;
564 break;
566 gstMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN;
567 break;
569 gstMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT;
570 break;
572 default:
573 break;
574 }
575 if (gst_photography_set_white_balance_mode(p, gstMode)) {
577 return;
578 }
579 }
580#endif
581}
582
584{
585 if (temperature == 0) {
587 return;
588 }
589
591
592#if QT_CONFIG(linux_v4l)
593 if (isV4L2Camera()) {
594 int t = setV4L2ColorTemperature(temperature);
595 if (t)
597 return;
598 }
599#endif
600
601#if QT_CONFIG(gstreamer_photography) && GST_CHECK_VERSION(1, 18, 0)
602 if (auto *p = photography()) {
603 GstPhotographyInterface *iface = GST_PHOTOGRAPHY_GET_INTERFACE(p);
604 Q_ASSERT(iface->set_color_temperature);
605 iface->set_color_temperature(p, temperature);
606 return;
607 }
608#endif
609}
610
611#if QT_CONFIG(linux_v4l)
612void QGstreamerCamera::initV4L2Controls()
613{
614 v4l2AutoWhiteBalanceSupported = false;
615 v4l2ColorTemperatureSupported = false;
616 QCamera::Features features;
617
618
619 const QString deviceName = v4l2Device();
620 Q_ASSERT(!deviceName.isEmpty());
621
622 v4l2FileDescriptor = qt_safe_open(deviceName.toLocal8Bit().constData(), O_RDONLY);
623 if (v4l2FileDescriptor == -1) {
624 qWarning() << "Unable to open the camera" << deviceName
625 << "for read to query the parameter info:" << qt_error_string(errno);
626 return;
627 }
628
629 struct v4l2_queryctrl queryControl;
630 ::memset(&queryControl, 0, sizeof(queryControl));
631 queryControl.id = V4L2_CID_AUTO_WHITE_BALANCE;
632
633 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
634 v4l2AutoWhiteBalanceSupported = true;
635 setV4L2Parameter(V4L2_CID_AUTO_WHITE_BALANCE, true);
636 }
637
638 ::memset(&queryControl, 0, sizeof(queryControl));
639 queryControl.id = V4L2_CID_WHITE_BALANCE_TEMPERATURE;
640 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
641 v4l2MinColorTemp = queryControl.minimum;
642 v4l2MaxColorTemp = queryControl.maximum;
643 v4l2ColorTemperatureSupported = true;
645 }
646
647 ::memset(&queryControl, 0, sizeof(queryControl));
648 queryControl.id = V4L2_CID_EXPOSURE_AUTO;
649 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
650 v4l2AutoExposureSupported = true;
651 }
652
653 ::memset(&queryControl, 0, sizeof(queryControl));
654 queryControl.id = V4L2_CID_EXPOSURE_ABSOLUTE;
655 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
656 v4l2ManualExposureSupported = true;
657 v4l2MinExposure = queryControl.minimum;
658 v4l2MaxExposure = queryControl.maximum;
660 }
661
662 ::memset(&queryControl, 0, sizeof(queryControl));
663 queryControl.id = V4L2_CID_AUTO_EXPOSURE_BIAS;
664 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
665 v4l2MinExposureAdjustment = queryControl.minimum;
666 v4l2MaxExposureAdjustment = queryControl.maximum;
668 }
669
670 ::memset(&queryControl, 0, sizeof(queryControl));
671 queryControl.id = V4L2_CID_ISO_SENSITIVITY_AUTO;
672 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
673 queryControl.id = V4L2_CID_ISO_SENSITIVITY;
674 if (::ioctl(v4l2FileDescriptor, VIDIOC_QUERYCTRL, &queryControl) == 0) {
676 minIsoChanged(queryControl.minimum);
677 maxIsoChanged(queryControl.minimum);
678 }
679 }
680
681 supportedFeaturesChanged(features);
682}
683
684int QGstreamerCamera::setV4L2ColorTemperature(int temperature)
685{
686 struct v4l2_control control;
687 ::memset(&control, 0, sizeof(control));
688
689 if (v4l2AutoWhiteBalanceSupported) {
690 setV4L2Parameter(V4L2_CID_AUTO_WHITE_BALANCE, temperature == 0 ? true : false);
691 } else if (temperature == 0) {
692 temperature = 5600;
693 }
694
695 if (temperature != 0 && v4l2ColorTemperatureSupported) {
696 temperature = qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp);
697 if (!setV4L2Parameter(V4L2_CID_WHITE_BALANCE_TEMPERATURE, qBound(v4l2MinColorTemp, temperature, v4l2MaxColorTemp)))
698 temperature = 0;
699 } else {
700 temperature = 0;
701 }
702
703 return temperature;
704}
705
706bool QGstreamerCamera::setV4L2Parameter(quint32 id, qint32 value)
707{
708 struct v4l2_control control{id, value};
709 if (::ioctl(v4l2FileDescriptor, VIDIOC_S_CTRL, &control) != 0) {
710 qWarning() << "Unable to set the V4L2 Parameter" << Qt::hex << id << "to" << value << qt_error_string(errno);
711 return false;
712 }
713 return true;
714}
715
716int QGstreamerCamera::getV4L2Parameter(quint32 id) const
717{
718 struct v4l2_control control{id, 0};
719 if (::ioctl(v4l2FileDescriptor, VIDIOC_G_CTRL, &control) != 0) {
720 qWarning() << "Unable to get the V4L2 Parameter" << Qt::hex << id << qt_error_string(errno);
721 return 0;
722 }
723 return control.value;
724}
725
726#endif
727
729
730#include "moc_qgstreamercamera_p.cpp"
IOBluetoothDevice * device
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
Definition qbytearray.h:122
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
void addGhostPad(const QGstElement &child, const char *name)
Definition qgst_p.h:566
void remove(const QGstElement &element)
Definition qgst_p.h:561
void add(const QGstElement &element)
Definition qgst_p.h:549
static QGstCaps fromCameraFormat(const QCameraFormat &format)
GstElement * element() const
Definition qgst_p.h:526
bool setStateSync(GstState state)
Definition qgst_p.h:463
bool syncStateWithParent()
Definition qgst_p.h:475
void unlink(const QGstElement &next)
Definition qgst_p.h:440
QGstPad staticPad(const char *name) const
Definition qgst_p.h:443
bool link(const QGstElement &next)
Definition qgst_p.h:429
bool isNull() const
Definition qgst_p.h:288
const char * name() const
Definition qgst_p.h:316
void set(const char *property, const char *str)
Definition qgst_p.h:290
void doInIdleProbe(std::function< void()> work)
Definition qgst_p.h:360
void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) override
bool isFocusModeSupported(QCamera::FocusMode mode) const override
bool isActive() const override
bool isV4L2Camera() const
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
QString v4l2Device() const
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 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)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:5857
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
QByteArray toLocal8Bit() const &
Definition qstring.h:567
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 int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
static int qt_safe_close(int fd)
static const QCssKnownValue properties[NumProperties - 1]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:281
QString errorMessageCannotFindElement(std::string_view element)
Definition qgst_p.h:590
Q_DECL_COLD_FUNCTION Q_CORE_EXPORT QString qt_error_string(int errorCode=-1)
#define qWarning
Definition qlogging.h:162
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
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:45
int qint32
Definition qtypes.h:44
char * toString(const MyType &t)
[31]
const char name[28]
bool contains(const AT &t) const noexcept
Definition qlist.h:44