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
qavfcamerarotationtracker_p.h
Go to the documentation of this file.
1// Copyright (C) 2025 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#ifndef QAVFCAMERAROTATIONTRACKER_P_H
5#define QAVFCAMERAROTATIONTRACKER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18
19#include <QtCore/qtclasshelpermacros.h>
20#include <QtCore/qtconfigmacros.h>
21#include <QtCore/qdarwinhelpers.h>
22
23#include <os/availability.h>
24
25#include <AVFoundation/AVCaptureDevice.h>
26
27QT_BEGIN_NAMESPACE
28
29namespace QFFmpeg {
30
31// Gives us rotational information for an AVCaptureDevice
33{
34public:
36 explicit AvfCameraRotationTracker(AVCaptureDevice* avCaptureDevice);
40
41 void swap(AvfCameraRotationTracker &other);
42
43 // Guaranteed to return rotation in clockwise 90 degree increments.
44 [[nodiscard]] int rotationDegrees() const;
45
46 [[nodiscard]] AVCaptureDevice* avCaptureDevice() const { return m_avCaptureDevice; }
47
48private:
49 void clear();
50
51 AVCaptureDevice* m_avCaptureDevice = nullptr;
52
53 // If running iOS 17+ or macOS 14+, we use AVCaptureDeviceRotationCoordinator
54 // to get the camera rotation directly from the camera-device.
55 API_AVAILABLE(macos(14.0), ios(17.0))
57
58#ifdef Q_OS_IOS
59 // If running iOS 16 or older, we use the UIDeviceOrientation
60 // and the AVCaptureCameraPosition to apply rotation metadata
61 // to the cameras frames.
62 //
63 // TODO: New bug reports implies this approach is not sufficient for iOS 16.
65#endif
66};
67
68} // namespace QFFmpeg
69
70QT_END_NAMESPACE
71
72#endif // QAVFCAMERAROTATIONTRACKER_P_H
void swap(AvfCameraRotationTracker &other)
AvfCameraRotationTracker(AvfCameraRotationTracker &&) noexcept
AvfCameraRotationTracker(AVCaptureDevice *avCaptureDevice)
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType