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