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.mm
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#include <QtFFmpegMediaPluginImpl/private/qavfcamerarotationtracker_p.h>
5
6#include <QtCore/qassert.h>
7
8#include <AVFoundation/AVFoundation.h>
9
10#include <cmath>
11
12QT_BEGIN_NAMESPACE
13
14namespace QFFmpeg {
15
29
37
42
50
52{
55
56 if (@available(macOS 14.0, *)) {
59 }
60 }
61}
62
64{
65 if (m_avCaptureDevice == nullptr)
66 return 0;
67
68 if (@available(macOS 14.0, *)) {
69 // This code assumes that AVCaptureDeviceRotationCoordinator
70 // .videoRotationAngleForHorizonLevelCapture returns degrees that are divisible by 90.
71 // This has been the case during testing.
72 //
73 // TODO: Some rotations are not valid for preview on some devices (such as
74 // iPhones not being allowed to have an upside-down window). This usage of the
75 // rotation coordinator will still return it as a valid preview rotation, and
76 // might cause bugs on iPhone previews.
77 if (m_avRotationCoordinator != nullptr)
78 return std::lround(
80 }
81
82 return 0;
83}
84
85} // namespace QFFmpeg end
86
87QT_END_NAMESPACE
std::conditional_t< QT_FFMPEG_AVIO_WRITE_CONST, const uint8_t *, uint8_t * > AvioWriteBufferType