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