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
25QT_BEGIN_NAMESPACE
26
27class QRhiSwapChain;
28class QVideoFrame;
29class QVideoFrameFormat;
30
31struct Fraction {
32 int numerator;
33 int denominator;
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, rotation: qToUnderlying(e: 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(const QVideoFrame &frame,
66 int additionalRotaton = 0);
67
68Q_MULTIMEDIA_EXPORT QtVideo::Rotation
69qVideoRotationFromDegrees(int clockwiseDegrees);
70
71/* The function get mirroring and rotation from the specified QTransform.
72 *
73 * Matrix translation is not taken into consideration.
74 * Matrix negative scaling is interpreted as mirroring.
75 * Absolute X and Y scale values are not taken into consideration as
76 * QVideoFrame and QVideoFrameFormat don't support scaling transformations.
77 *
78 * Sheared matrixes are not supported,
79 * as shearing can make the transformation ambiguous
80 * (the same matrix can be reached by different angle,scaleX,scaleY,shearV,shearH).
81 *
82 * If the given matrix is invalid, or the scale sign is ambiguous,
83 * the function returns an empty optional value.
84 */
85Q_MULTIMEDIA_EXPORT VideoTransformationOpt qVideoTransformationFromMatrix(const QTransform &matrix);
86
87QT_END_NAMESPACE
88
89#endif // QMULTIMEDIAUTILS_P_H
90
91

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtmultimedia/src/multimedia/qmultimediautils_p.h