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
qqnxcamera.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#include "qqnxcamera_p.h"
6#include "qqnxvideosink_p.h"
7
8#include <qcameradevice.h>
9#include <qmediadevices.h>
10
11#include <private/qmediastoragelocation_p.h>
12
13QDebug &operator<<(QDebug &d, const QQnxCamera::VideoFormat &f)
14{
15 d << "VideoFormat - width=" << f.width
16 << "height=" << f.height
17 << "rotation=" << f.rotation
18 << "frameRate=" << f.frameRate
19 << "frameType=" << f.frameType;
20
21 return d;
22}
23
24static QString statusToString(camera_devstatus_t status)
25{
26 switch (status) {
27 case CAMERA_STATUS_DISCONNECTED:
28 return QStringLiteral("No user is connected to the camera");
29 case CAMERA_STATUS_POWERDOWN:
30 return QStringLiteral("Power down");
31 case CAMERA_STATUS_VIDEOVF:
32 return QStringLiteral("The video viewfinder has started");
33 case CAMERA_STATUS_CAPTURE_ABORTED:
34 return QStringLiteral("The capture of a still image failed and was aborted");
35 case CAMERA_STATUS_FILESIZE_WARNING:
36 return QStringLiteral("Time-remaining threshold has been exceeded");
37 case CAMERA_STATUS_FOCUS_CHANGE:
38 return QStringLiteral("The focus has changed on the camera");
39 case CAMERA_STATUS_RESOURCENOTAVAIL:
40 return QStringLiteral("The camera is about to free resources");
41 case CAMERA_STATUS_VIEWFINDER_ERROR:
42 return QStringLiteral(" An unexpected error was encountered while the "
43 "viewfinder was active");
44 case CAMERA_STATUS_MM_ERROR:
45 return QStringLiteral("The recording has stopped due to a memory error or multimedia "
46 "framework error");
47 case CAMERA_STATUS_FILESIZE_ERROR:
48 return QStringLiteral("A file has exceeded the maximum size.");
49 case CAMERA_STATUS_NOSPACE_ERROR:
50 return QStringLiteral("Not enough disk space");
51 case CAMERA_STATUS_BUFFER_UNDERFLOW:
52 return QStringLiteral("The viewfinder is out of buffers");
53 default:
54 break;
55 }
56
57 return {};
58}
59
61
62QQnxCamera::QQnxCamera(camera_unit_t unit, QObject *parent)
63 : QObject(parent)
64 , m_cameraUnit(unit)
65{
66 if (!m_handle.open(m_cameraUnit, CAMERA_MODE_RW))
67 qWarning("QQnxCamera: Failed to open camera (0x%x)", m_handle.lastError());
68
69 if (camera_set_vf_mode(m_handle.get(), CAMERA_VFMODE_VIDEO) != CAMERA_EOK) {
70 qWarning("QQnxCamera: unable to configure viewfinder mode");
71 return;
72 }
73
74 if (camera_set_vf_property(m_handle.get(), CAMERA_IMGPROP_CREATEWINDOW, 0,
75 CAMERA_IMGPROP_RENDERTOWINDOW, 0) != CAMERA_EOK) {
76 qWarning("QQnxCamera: failed to set camera properties");
77 return;
78 }
79
80 updateZoomLimits();
81 updateSupportedWhiteBalanceValues();
82
83 m_valid = true;
84}
85
90
91camera_unit_t QQnxCamera::unit() const
92{
93 return m_cameraUnit;
94}
95
97{
98 char name[CAMERA_LOCATION_NAMELEN];
99
100 if (camera_get_location_property(m_cameraUnit,
101 CAMERA_LOCATION_NAME, &name, CAMERA_LOCATION_END) != CAMERA_EOK) {
102 qWarning("QQnxCamera: unable to obtain camera name");
103 return {};
104 }
105
106 return QString::fromUtf8(name);
107}
108
110{
111 return m_valid;
112}
113
115{
116 return m_handle.isOpen() && m_viewfinderActive;
117}
118
120{
121 if (isActive())
122 return;
123
124 if (camera_start_viewfinder(m_handle.get(), viewfinderCallback,
125 statusCallback, this) != CAMERA_EOK) {
126 qWarning("QQnxCamera: unable to start viewfinder");
127 return;
128 }
129
130 m_viewfinderActive = true;
131}
132
134{
135 if (!isActive())
136 return;
137
138 if (m_recordingVideo)
140
141 if (camera_stop_viewfinder(m_handle.get()) != CAMERA_EOK)
142 qWarning("QQnxCamera: Failed to stop camera");
143
144 m_viewfinderActive = false;
145}
146
147bool QQnxCamera::setCameraFormat(uint32_t width, uint32_t height, double frameRate)
148{
149 if (!m_handle.isOpen())
150 return false;
151
152 const camera_error_t error = camera_set_vf_property(m_handle.get(),
153 CAMERA_IMGPROP_WIDTH, width,
154 CAMERA_IMGPROP_HEIGHT, height,
155 CAMERA_IMGPROP_FRAMERATE, frameRate);
156
157 if (error != CAMERA_EOK) {
158 qWarning("QQnxCamera: failed to set camera format");
159 return false;
160 }
161
162 return true;
163}
164
165bool QQnxCamera::isFocusModeSupported(camera_focusmode_t mode) const
166{
167 return supportedFocusModes().contains(mode);
168}
169
170bool QQnxCamera::setFocusMode(camera_focusmode_t mode)
171{
172 if (!isActive())
173 return false;
174
175 const camera_error_t result = camera_set_focus_mode(m_handle.get(), mode);
176
177 if (result != CAMERA_EOK) {
178 qWarning("QQnxCamera: Unable to set focus mode (0x%x)", result);
179 return false;
180 }
181
183
184 return true;
185}
186
187camera_focusmode_t QQnxCamera::focusMode() const
188{
189 if (!isActive())
190 return CAMERA_FOCUSMODE_OFF;
191
192 camera_focusmode_t mode;
193
194 const camera_error_t result = camera_get_focus_mode(m_handle.get(), &mode);
195
196 if (result != CAMERA_EOK) {
197 qWarning("QQnxCamera: Unable to set focus mode (0x%x)", result);
198 return CAMERA_FOCUSMODE_OFF;
199 }
200
201 return mode;
202}
203
204QQnxCamera::VideoFormat QQnxCamera::vfFormat() const
205{
206 VideoFormat f = {};
207
208 if (camera_get_vf_property(m_handle.get(),
209 CAMERA_IMGPROP_WIDTH, &f.width,
210 CAMERA_IMGPROP_HEIGHT, &f.height,
211 CAMERA_IMGPROP_ROTATION, &f.rotation,
212 CAMERA_IMGPROP_FRAMERATE, &f.frameRate,
213 CAMERA_IMGPROP_FORMAT, &f.frameType) != CAMERA_EOK) {
214 qWarning("QQnxCamera: Failed to query video finder frameType");
215 }
216
217 return f;
218}
219
220void QQnxCamera::setVfFormat(const VideoFormat &f)
221{
222 const bool active = isActive();
223
224 if (active)
225 stop();
226
227 if (camera_set_vf_property(m_handle.get(),
228 CAMERA_IMGPROP_WIDTH, f.width,
229 CAMERA_IMGPROP_HEIGHT, f.height,
230 CAMERA_IMGPROP_ROTATION, f.rotation,
231 CAMERA_IMGPROP_FRAMERATE, f.frameRate,
232 CAMERA_IMGPROP_FORMAT, f.frameType) != CAMERA_EOK) {
233 qWarning("QQnxCamera: Failed to set video finder frameType");
234 }
235
236 if (active)
237 start();
238}
239
240QQnxCamera::VideoFormat QQnxCamera::recordingFormat() const
241{
242 VideoFormat f = {};
243
244 if (camera_get_video_property(m_handle.get(),
245 CAMERA_IMGPROP_WIDTH, &f.width,
246 CAMERA_IMGPROP_HEIGHT, &f.height,
247 CAMERA_IMGPROP_ROTATION, &f.rotation,
248 CAMERA_IMGPROP_FRAMERATE, &f.frameRate,
249 CAMERA_IMGPROP_FORMAT, &f.frameType) != CAMERA_EOK) {
250 qWarning("QQnxCamera: Failed to query recording frameType");
251 }
252
253 return f;
254}
255
256void QQnxCamera::setRecordingFormat(const VideoFormat &f)
257{
258 if (camera_set_video_property(m_handle.get(),
259 CAMERA_IMGPROP_WIDTH, f.width,
260 CAMERA_IMGPROP_HEIGHT, f.height,
261 CAMERA_IMGPROP_ROTATION, f.rotation,
262 CAMERA_IMGPROP_FRAMERATE, f.frameRate,
263 CAMERA_IMGPROP_FORMAT, f.frameType) != CAMERA_EOK) {
264 qWarning("QQnxCamera: Failed to set recording frameType");
265 }
266}
267
269{
270 const QSize vfSize = viewFinderSize();
271
272 if (vfSize.isEmpty())
273 return;
274
275 const auto toUint32 = [](double value) {
276 return static_cast<uint32_t>(std::max(0.0, value));
277 };
278
279 // define a 40x40 pixel focus region around the custom focus point
280 constexpr int pixelSize = 40;
281
282 const auto left = toUint32(point.x() * vfSize.width() - pixelSize / 2);
283 const auto top = toUint32(point.y() * vfSize.height() - pixelSize / 2);
284
285 camera_region_t focusRegion {
286 .left = left,
287 .top = top,
288 .width = pixelSize,
289 .height = pixelSize,
290 .extra = 0
291 };
292
293 if (camera_set_focus_regions(m_handle.get(), 1, &focusRegion) != CAMERA_EOK) {
294 qWarning("QQnxCamera: Unable to set focus region");
295 return;
296 }
297
298 if (setFocusMode(focusMode()))
300}
301
303{
304 if (!isActive()) {
305 qWarning("QQnxCamera: Failed to set focus distance - view finder not active");
306 return;
307 }
308
309 if (!isFocusModeSupported(CAMERA_FOCUSMODE_MANUAL)) {
310 qWarning("QQnxCamera: Failed to set focus distance - manual focus mode not supported");
311 return;
312 }
313
314 if (camera_set_manual_focus_step(m_handle.get(), step) != CAMERA_EOK)
315 qWarning("QQnxCamera: Failed to set focus distance");
316}
317
319{
320 return focusStep().step;
321}
322
324{
325 return focusStep().maxStep;
326}
327
328QQnxCamera::FocusStep QQnxCamera::focusStep() const
329{
330 constexpr FocusStep invalidStep { -1, -1 };
331
332 if (!isActive()) {
333 qWarning("QQnxCamera: Failed to query max focus distance - view finder not active");
334 return invalidStep;
335 }
336
337 if (!isFocusModeSupported(CAMERA_FOCUSMODE_MANUAL)) {
338 qWarning("QQnxCamera: Failed to query max focus distance - "
339 "manual focus mode not supported");
340 return invalidStep;
341 }
342
343 FocusStep focusStep;
344
345 if (camera_get_manual_focus_step(m_handle.get(),
346 &focusStep.maxStep, &focusStep.step) != CAMERA_EOK) {
347 qWarning("QQnxCamera: Unable to query camera focus step");
348 return invalidStep;
349 }
350
351 return focusStep;
352}
353
354
356{
357 // get the size of the viewfinder
358 int width = 0;
359 int height = 0;
360
361 if (camera_get_vf_property(m_handle.get(),
362 CAMERA_IMGPROP_WIDTH, width,
363 CAMERA_IMGPROP_HEIGHT, height) != CAMERA_EOK) {
364 qWarning("QQnxCamera: failed to query view finder size");
365 return {};
366 }
367
368 return { width, height };
369}
370
372{
373 return m_minZoom;
374}
375
377{
378 return m_maxZoom;
379}
380
382{
383 return m_smoothZoom;
384}
385
386double QQnxCamera::zoomRatio(uint32_t zoomLevel) const
387{
388 double ratio;
389
390 if (camera_get_zoom_ratio_from_zoom_level(m_handle.get(), zoomLevel, &ratio) != CAMERA_EOK) {
391 qWarning("QQnxCamera: failed to query zoom ratio from zoom level");
392 return 0.0;
393 }
394
395 return ratio;
396}
397
398bool QQnxCamera::setZoomFactor(uint32_t factor)
399{
400 if (camera_set_vf_property(m_handle.get(), CAMERA_IMGPROP_ZOOMFACTOR, factor) != CAMERA_EOK) {
401 qWarning("QQnxCamera: failed to set zoom factor");
402 return false;
403 }
404
405 return true;
406}
407
409{
410 if (!isActive())
411 return;
412
413 if (camera_set_ev_offset(m_handle.get(), ev) != CAMERA_EOK)
414 qWarning("QQnxCamera: Failed to set up exposure compensation");
415}
416
418{
419 if (!isActive())
420 return 0;
421
422 uint32_t isoValue;
423
424 if (camera_get_manual_iso(m_handle.get(), &isoValue) != CAMERA_EOK) {
425 qWarning("QQnxCamera: Failed to query ISO value");
426 return 0;
427 }
428
429 return isoValue;
430}
431
433{
434 if (!isActive())
435 return;
436
437 if (camera_set_manual_iso(m_handle.get(), value) != CAMERA_EOK)
438 qWarning("QQnxCamera: Failed to set ISO value");
439}
440
442{
443 if (!isActive())
444 return;
445
446 if (camera_set_manual_shutter_speed(m_handle.get(), seconds) != CAMERA_EOK)
447 qWarning("QQnxCamera: Failed to set exposure time");
448}
449
451{
452 if (!isActive())
453 return 0.0;
454
455 double shutterSpeed;
456
457 if (camera_get_manual_shutter_speed(m_handle.get(), &shutterSpeed) != CAMERA_EOK) {
458 qWarning("QQnxCamera: Failed to get exposure time");
459 return 0.0;
460 }
461
462 return shutterSpeed;
463}
464
465bool QQnxCamera::hasFeature(camera_feature_t feature) const
466{
467 return camera_has_feature(m_handle.get(), feature);
468}
469
470void QQnxCamera::setWhiteBalanceMode(camera_whitebalancemode_t mode)
471{
472 if (!isActive())
473 return;
474
475 if (camera_set_whitebalance_mode(m_handle.get(), mode) != CAMERA_EOK)
476 qWarning("QQnxCamera: failed to set whitebalance mode");
477}
478
479camera_whitebalancemode_t QQnxCamera::whiteBalanceMode() const
480{
481 if (!isActive())
482 return CAMERA_WHITEBALANCEMODE_OFF;
483
484 camera_whitebalancemode_t mode;
485
486 if (camera_get_whitebalance_mode(m_handle.get(), &mode) != CAMERA_EOK) {
487 qWarning("QQnxCamera: failed to get white balance mode");
488 return CAMERA_WHITEBALANCEMODE_OFF;
489 }
490
491 return mode;
492}
493
495{
496 if (!isActive())
497 return;
498
499 if (camera_set_manual_white_balance(m_handle.get(), value) != CAMERA_EOK)
500 qWarning("QQnxCamera: failed to set manual white balance");
501}
502
504{
505 if (!isActive())
506 return 0;
507
508 uint32_t value;
509
510 if (camera_get_manual_white_balance(m_handle.get(), &value) != CAMERA_EOK) {
511 qWarning("QQnxCamera: failed to get manual white balance");
512 return 0;
513 }
514
515 return value;
516}
517
519{
520 // when preview is video, we must ensure that the recording properties
521 // match the view finder properties
522 if (hasFeature(CAMERA_FEATURE_PREVIEWISVIDEO)) {
523 VideoFormat newFormat = vfFormat();
524
525 const QList<camera_frametype_t> recordingTypes = supportedRecordingFrameTypes();
526
527 // find a suitable matching frame type in case the current view finder
528 // frametype is not supported
529 if (newFormat.frameType != recordingFormat().frameType
530 && !recordingTypes.contains(newFormat.frameType)) {
531
532 bool found = false;
533
534 for (const camera_frametype_t type : supportedVfFrameTypes()) {
535 if (recordingTypes.contains(type)) {
536 newFormat.frameType = type;
537 found = true;
538 break;
539 }
540 }
541
542 if (found) {
543 m_originalVfFormat = vfFormat();
544
545 // reconfigure and restart the view finder
546 setVfFormat(newFormat);
547 } else {
548 qWarning("QQnxCamera: failed to find suitable frame type for recording - aborting");
549 return false;
550 }
551 }
552
553 setRecordingFormat(newFormat);
554 }
555
556 if (camera_start_video(m_handle.get(), qPrintable(filename),
557 nullptr, nullptr, nullptr) == CAMERA_EOK) {
558 m_recordingVideo = true;
559 } else {
560 qWarning("QQnxCamera: failed to start video encoding");
561 }
562
563 return m_recordingVideo;
564}
565
567{
568 m_recordingVideo = false;
569
570 if (camera_stop_video(m_handle.get()) != CAMERA_EOK)
571 qWarning("QQnxCamera: error when stopping video recording");
572
573 // restore original vf format
574 if (m_originalVfFormat) {
575 setVfFormat(*m_originalVfFormat);
576 m_originalVfFormat.reset();
577 }
578}
579
580bool QQnxCamera::isVideoEncodingSupported() const
581{
582 if (!isActive())
583 return false;
584
585 return camera_has_feature(m_handle.get(), CAMERA_FEATURE_VIDEO);
586}
587
588camera_handle_t QQnxCamera::handle() const
589{
590 return m_handle.get();
591}
592
593void QQnxCamera::updateZoomLimits()
594{
595 bool smooth;
596
597 if (camera_get_zoom_limits(m_handle.get(), &m_minZoom, &m_maxZoom, &smooth) != CAMERA_EOK) {
598 qWarning("QQnxCamera: failed to update zoom limits - using default values");
599 m_minZoom = m_maxZoom = 0;
600 }
601}
602
603void QQnxCamera::updateSupportedWhiteBalanceValues()
604{
605 uint32_t numSupported = 0;
606
607 const camera_error_t result = camera_get_supported_manual_white_balance_values(
608 m_handle.get(), 0, &numSupported, nullptr, &m_continuousWhiteBalanceValues);
609
610 if (result != CAMERA_EOK) {
611 if (result == CAMERA_EOPNOTSUPP)
612 qWarning("QQnxCamera: white balance not supported");
613 else
614 qWarning("QQnxCamera: unable to query manual white balance value count");
615
616 m_supportedWhiteBalanceValues.clear();
617
618 return;
619 }
620
621 m_supportedWhiteBalanceValues.resize(numSupported);
622
623 if (camera_get_supported_manual_white_balance_values(m_handle.get(),
624 m_supportedWhiteBalanceValues.size(),
625 &numSupported,
626 m_supportedWhiteBalanceValues.data(),
627 &m_continuousWhiteBalanceValues) != CAMERA_EOK) {
628 qWarning("QQnxCamera: unable to query manual white balance values");
629
630 m_supportedWhiteBalanceValues.clear();
631 }
632}
633
634QList<camera_vfmode_t> QQnxCamera::supportedVfModes() const
635{
636 return queryValues(camera_get_supported_vf_modes);
637}
638
639QList<camera_res_t> QQnxCamera::supportedVfResolutions() const
640{
641 return queryValues(camera_get_supported_vf_resolutions);
642}
643
644QList<camera_frametype_t> QQnxCamera::supportedVfFrameTypes() const
645{
646 return queryValues(camera_get_supported_vf_frame_types);
647}
648
649QList<camera_focusmode_t> QQnxCamera::supportedFocusModes() const
650{
651 return queryValues(camera_get_focus_modes);
652}
653
654QList<double> QQnxCamera::specifiedVfFrameRates(camera_frametype_t frameType,
655 camera_res_t resolution) const
656{
657 uint32_t numSupported = 0;
658
659 if (camera_get_specified_vf_framerates(m_handle.get(), frameType, resolution,
660 0, &numSupported, nullptr, nullptr) != CAMERA_EOK) {
661 qWarning("QQnxCamera: unable to query specified framerates count");
662 return {};
663 }
664
665 QList<double> values(numSupported);
666
667 if (camera_get_specified_vf_framerates(m_handle.get(), frameType, resolution,
668 values.size(), &numSupported, values.data(), nullptr) != CAMERA_EOK) {
669 qWarning("QQnxCamera: unable to query specified framerates values");
670 return {};
671 }
672
673 return values;
674}
675
676QList<camera_frametype_t> QQnxCamera::supportedRecordingFrameTypes() const
677{
678 return queryValues(camera_get_video_frame_types);
679}
680
682{
683 return m_supportedWhiteBalanceValues;
684}
685
687{
688 return m_continuousWhiteBalanceValues;
689}
690
691QList<camera_unit_t> QQnxCamera::supportedUnits()
692{
693 unsigned int numSupported = 0;
694
695 if (camera_get_supported_cameras(0, &numSupported, nullptr) != CAMERA_EOK) {
696 qWarning("QQnxCamera: failed to query supported camera unit count");
697 return {};
698 }
699
700 QList<camera_unit_t> cameraUnits(numSupported);
701
702 if (camera_get_supported_cameras(cameraUnits.size(), &numSupported,
703 cameraUnits.data()) != CAMERA_EOK) {
704 qWarning("QQnxCamera: failed to enumerate supported camera units");
705 return {};
706 }
707
708 return cameraUnits;
709}
710
711template <typename T, typename U>
712QList<T> QQnxCamera::queryValues(QueryFuncPtr<T,U> func) const
713{
714 static_assert(std::is_integral_v<U>, "Parameter U must be of integral type");
715
716 U numSupported = 0;
717
718 if (func(m_handle.get(), 0, &numSupported, nullptr) != CAMERA_EOK) {
719 qWarning("QQnxCamera: unable to query camera value count");
720 return {};
721 }
722
723 QList<T> values(numSupported);
724
725 if (func(m_handle.get(), values.size(), &numSupported, values.data()) != CAMERA_EOK) {
726 qWarning("QQnxCamera: unable to query camera values");
727 return {};
728 }
729
730 return values;
731}
732
733void QQnxCamera::handleVfBuffer(camera_buffer_t *buffer)
734{
735 // process the frame on this thread before locking the mutex
736 auto frame = std::make_unique<QQnxCameraFrameBuffer>(buffer);
737
738 // skip a frame if mutex is busy
739 if (m_currentFrameMutex.tryLock()) {
740 m_currentFrame = std::move(frame);
741 m_currentFrameMutex.unlock();
742
744 }
745}
746
747void QQnxCamera::handleVfStatus(camera_devstatus_t status, uint16_t extraData)
748{
749 QMetaObject::invokeMethod(this, "handleStatusChange", Qt::QueuedConnection,
750 Q_ARG(camera_devstatus_t, status),
751 Q_ARG(uint16_t, extraData));
752}
753
754void QQnxCamera::handleStatusChange(camera_devstatus_t status, uint16_t extraData)
755{
756 Q_UNUSED(extraData);
757
758 switch (status) {
759 case CAMERA_STATUS_BUFFER_UNDERFLOW:
760 case CAMERA_STATUS_CAPTURECOMPLETE:
761 case CAMERA_STATUS_CAPTURE_ABORTED:
762 case CAMERA_STATUS_CONNECTED:
763 case CAMERA_STATUS_DISCONNECTED:
764 case CAMERA_STATUS_FILESIZE_ERROR:
765 case CAMERA_STATUS_FILESIZE_LIMIT_WARNING:
766 case CAMERA_STATUS_FILESIZE_WARNING:
767 case CAMERA_STATUS_FLASH_LEVEL_CHANGE:
768 case CAMERA_STATUS_FOCUS_CHANGE:
769 case CAMERA_STATUS_FRAME_DROPPED:
770 case CAMERA_STATUS_LOWLIGHT:
771 case CAMERA_STATUS_MM_ERROR:
772 case CAMERA_STATUS_NOSPACE_ERROR:
773 case CAMERA_STATUS_PHOTOVF:
774 case CAMERA_STATUS_POWERDOWN:
775 case CAMERA_STATUS_POWERUP:
776 case CAMERA_STATUS_RESOURCENOTAVAIL:
777 case CAMERA_STATUS_UNKNOWN:
778 case CAMERA_STATUS_VIDEOLIGHT_CHANGE:
779 case CAMERA_STATUS_VIDEOLIGHT_LEVEL_CHANGE:
780 case CAMERA_STATUS_VIDEOVF:
781 case CAMERA_STATUS_VIDEO_PAUSE:
782 case CAMERA_STATUS_VIDEO_RESUME:
783 case CAMERA_STATUS_VIEWFINDER_ACTIVE:
784 case CAMERA_STATUS_VIEWFINDER_ERROR:
785 case CAMERA_STATUS_VIEWFINDER_FREEZE:
786 case CAMERA_STATUS_VIEWFINDER_SUSPEND:
787 case CAMERA_STATUS_VIEWFINDER_UNFREEZE:
788 case CAMERA_STATUS_VIEWFINDER_UNSUSPEND:
789 qDebug() << "QQnxCamera:" << ::statusToString(status);
790 break;
791 }
792}
793
794std::unique_ptr<QQnxCameraFrameBuffer> QQnxCamera::takeCurrentFrame()
795{
796 QMutexLocker l(&m_currentFrameMutex);
797
798 return std::move(m_currentFrame);
799}
800
801void QQnxCamera::viewfinderCallback(camera_handle_t handle, camera_buffer_t *buffer, void *arg)
802{
804
805 auto *camera = static_cast<QQnxCamera*>(arg);
806 camera->handleVfBuffer(buffer);
807}
808
809void QQnxCamera::statusCallback(camera_handle_t handle, camera_devstatus_t status,
810 uint16_t extraData, void *arg)
811{
813
814 auto *camera = static_cast<QQnxCamera*>(arg);
815 camera->handleVfStatus(status, extraData);
816}
817
819
820#include "moc_qqnxcamera_p.cpp"
\inmodule QtCore
qsizetype size() const noexcept
Definition qlist.h:397
pointer data()
Definition qlist.h:431
void resize(qsizetype size)
Definition qlist.h:403
void clear()
Definition qlist.h:434
\inmodule QtCore
Definition qmutex.h:313
bool tryLock(int timeout=0) noexcept
Attempts to lock the mutex.
Definition qmutex.h:287
void unlock() noexcept
Unlocks the mutex.
Definition qmutex.h:289
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
bool open(camera_unit_t unit, uint32_t mode)
camera_handle_t get() const
camera_error_t lastError() const
QList< camera_vfmode_t > supportedVfModes() const
void setManualIsoSensitivity(uint32_t value)
void setCustomFocusPoint(const QPointF &point)
bool setCameraFormat(uint32_t width, uint32_t height, double frameRate)
camera_whitebalancemode_t whiteBalanceMode() const
void setEvOffset(float ev)
int maxFocusStep() const
std::unique_ptr< QQnxCameraFrameBuffer > takeCurrentFrame()
camera_handle_t handle() const
QQnxCamera(camera_unit_t unit, QObject *parent=nullptr)
QList< camera_frametype_t > supportedRecordingFrameTypes() const
void focusModeChanged(camera_focusmode_t mode)
QList< uint32_t > supportedWhiteBalanceValues() const
double zoomRatio(uint32_t zoomLevel) const
bool setZoomFactor(uint32_t factor)
bool isFocusModeSupported(camera_focusmode_t mode) const
void stopVideoRecording()
uint32_t manualIsoSensitivity() const
double manualExposureTime() const
QList< camera_focusmode_t > supportedFocusModes() const
void frameAvailable()
uint32_t maximumZoomLevel() const
QList< double > specifiedVfFrameRates(camera_frametype_t frameType, camera_res_t resolution) const
bool startVideoRecording(const QString &filename)
bool isValid() const
bool hasFeature(camera_feature_t feature) const
QList< camera_frametype_t > supportedVfFrameTypes() const
void setManualFocusStep(int step)
QSize viewFinderSize() const
bool isActive() const
bool isSmoothZoom() const
void setWhiteBalanceMode(camera_whitebalancemode_t mode)
QList< camera_res_t > supportedVfResolutions() const
void customFocusPointChanged(const QPointF &point)
uint32_t minimumZoomLevel() const
bool hasContinuousWhiteBalanceValues() const
camera_focusmode_t focusMode() const
void setManualWhiteBalance(uint32_t value)
uint32_t manualWhiteBalance() const
void setManualExposureTime(double seconds)
bool setFocusMode(camera_focusmode_t mode)
int manualFocusStep() const
camera_unit_t unit() const
QString name() const
static QList< camera_unit_t > supportedUnits()
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
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.
@ QueuedConnection
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qDebug
[1]
Definition qlogging.h:164
#define qWarning
Definition qlogging.h:166
#define Q_ARG(Type, data)
Definition qobjectdefs.h:63
GLenum GLsizei GLsizei GLint * values
[15]
GLuint64 GLenum void * handle
GLenum mode
GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble GLdouble top
GLfloat GLfloat f
GLenum GLuint buffer
GLint GLsizei width
GLint left
GLenum type
GLuint name
GLenum func
Definition qopenglext.h:663
GLuint64EXT * result
[6]
static QString statusToString(camera_devstatus_t status)
QDebug & operator<<(QDebug &d, const QQnxCamera::VideoFormat &f)
SSL_CTX int void * arg
#define qPrintable(string)
Definition qstring.h:1531
#define QStringLiteral(str)
#define Q_EMIT
#define Q_UNUSED(x)
QFrame frame
[0]
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(nullptr), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
\threadsafe This is an overloaded member function, provided for convenience. It differs from the abov...