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
27
28QT_BEGIN_NAMESPACE
29
30namespace QFFmpeg {
31
32// Gives us rotational information for an AVCaptureDevice
34{
35public:
37 explicit AvfCameraRotationTracker(AVCaptureDevice* avCaptureDevice);
41
42 void swap(AvfCameraRotationTracker &other);
43
44 // Guaranteed to return rotation in clockwise 90 degree increments.
45 [[nodiscard]] int rotationDegrees() const;
46
47 [[nodiscard]] AVCaptureDevice* avCaptureDevice() const { return m_avCaptureDevice; }
48
49private:
50 void clear();
51
52 AVCaptureDevice* m_avCaptureDevice = nullptr;
53
54 // If running iOS 17+ or macOS 14+, we use AVCaptureDeviceRotationCoordinator
55 // to get the camera rotation directly from the camera-device.
56 API_AVAILABLE(macos(14.0), ios(17.0))
58
59#ifdef Q_OS_IOS
60 // If running iOS 16 or older, we use the UIDeviceOrientation
61 // and the AVCaptureCameraPosition to apply rotation metadata
62 // to the cameras frames.
63 //
64 // TODO: New bug reports implies this approach is not sufficient for iOS 16.
66#endif
67};
68
69} // namespace QFFmpeg
70
71QT_END_NAMESPACE
72
73#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
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDevice)
Q_FORWARD_DECLARE_OBJC_CLASS(AVCaptureDeviceRotationCoordinator)