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
qmultimediautils_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QMULTIMEDIAUTILS_P_H
5#define QMULTIMEDIAUTILS_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#include <QtMultimedia/qtmultimediaglobal.h>
19#include <QtMultimedia/private/qmaybe_p.h>
20#include <QtMultimedia/private/qvideotransformation_p.h>
21#include <QtCore/qsize.h>
22#include <QtCore/qurl.h>
23#include <QtGui/rhi/qrhi.h>
24
26
27class QRhiSwapChain;
28class QVideoFrame;
29class QVideoFrameFormat;
30
31struct Fraction {
34};
35
36Q_MULTIMEDIA_EXPORT Fraction qRealToFraction(qreal value);
37
38Q_MULTIMEDIA_EXPORT QSize qCalculateFrameSize(QSize resolution, Fraction pixelAspectRatio);
39
40// TODO: after adding pixel aspect ratio to QVideoFrameFormat, the function should
41// consider PAR as well as rotation
42Q_MULTIMEDIA_EXPORT QSize qRotatedFrameSize(QSize size, int rotation);
43
44inline QSize qRotatedFrameSize(QSize size, QtVideo::Rotation rotation)
45{
46 return qRotatedFrameSize(size, qToUnderlying(rotation));
47}
48
49Q_MULTIMEDIA_EXPORT QSize qRotatedFramePresentationSize(const QVideoFrame &frame);
50
51Q_MULTIMEDIA_EXPORT QUrl qMediaFromUserInput(QUrl fileName);
52
53Q_MULTIMEDIA_EXPORT bool qIsAutoHdrEnabled();
54
55Q_MULTIMEDIA_EXPORT QRhiSwapChain::Format
56qGetRequiredSwapChainFormat(const QVideoFrameFormat &format);
57
58Q_MULTIMEDIA_EXPORT bool
59qShouldUpdateSwapChainFormat(QRhiSwapChain *swapChain,
60 QRhiSwapChain::Format requiredSwapChainFormat);
61
62Q_MULTIMEDIA_EXPORT VideoTransformation
63qNormalizedSurfaceTransformation(const QVideoFrameFormat &format);
64
65Q_MULTIMEDIA_EXPORT VideoTransformation qNormalizedFrameTransformation(
66 const QVideoFrame &frame, VideoTransformation videoOutputTransformation = {});
67
68Q_MULTIMEDIA_EXPORT QtVideo::Rotation
69qVideoRotationFromDegrees(int clockwiseDegrees);
70
72 int videoOutputRotation)
73{
74 return qNormalizedFrameTransformation(
75 frame, VideoTransformation{ qVideoRotationFromDegrees(videoOutputRotation) });
76}
77
78/* The function get mirroring and rotation from the specified QTransform.
79 *
80 * Matrix translation is not taken into consideration.
81 * Matrix negative scaling is interpreted as mirroring.
82 * Absolute X and Y scale values are not taken into consideration as
83 * QVideoFrame and QVideoFrameFormat don't support scaling transformations.
84 *
85 * Sheared matrixes are not supported,
86 * as shearing can make the transformation ambiguous
87 * (the same matrix can be reached by different angle,scaleX,scaleY,shearV,shearH).
88 *
89 * If the given matrix is invalid, or the scale sign is ambiguous,
90 * the function returns an empty optional value.
91 */
92Q_MULTIMEDIA_EXPORT VideoTransformationOpt qVideoTransformationFromMatrix(const QTransform &matrix);
93
94QT_END_NAMESPACE
95
96#endif // QMULTIMEDIAUTILS_P_H
\inmodule QtCore
Definition qsize.h:26
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
VideoTransformation qNormalizedFrameTransformation(const QVideoFrame &frame, int videoOutputRotation)
Q_MULTIMEDIA_EXPORT bool qIsAutoHdrEnabled()
QSize qRotatedFrameSize(QSize size, QtVideo::Rotation rotation)
Q_MULTIMEDIA_EXPORT bool qShouldUpdateSwapChainFormat(QRhiSwapChain *swapChain, QRhiSwapChain::Format requiredSwapChainFormat)