Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qvideotexturehelper_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 QVIDEOTEXTUREHELPER_H
5#define QVIDEOTEXTUREHELPER_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 <qvideoframeformat.h>
19#include <rhi/qrhi.h>
20
21#include <QtGui/qtextlayout.h>
22
24
25class QVideoFrame;
26class QTextLayout;
28
29namespace QVideoTextureHelper
30{
31
33{
34 static constexpr int maxPlanes = 3;
35 struct SizeScale {
36 int x;
37 int y;
38 };
39 using BytesRequired = int(*)(int stride, int height);
40
41 inline int strideForWidth(int width) const { return (width*strideFactor + 15) & ~15; }
42 inline int bytesForSize(QSize s) const { return bytesRequired(strideForWidth(s.width()), s.height()); }
43 int widthForPlane(int width, int plane) const
44 {
45 if (plane > nplanes) return 0;
46 return (width + sizeScale[plane].x - 1)/sizeScale[plane].x;
47 }
48 int heightForPlane(int height, int plane) const
49 {
50 if (plane > nplanes) return 0;
51 return (height + sizeScale[plane].y - 1)/sizeScale[plane].y;
52 }
53
59};
60
62
63Q_MULTIMEDIA_EXPORT QString vertexShaderFileName(const QVideoFrameFormat &format);
65Q_MULTIMEDIA_EXPORT void updateUniformData(QByteArray *dst, const QVideoFrameFormat &format, const QVideoFrame &frame,
66 const QMatrix4x4 &transform, float opacity, float maxNits = 100);
67Q_MULTIMEDIA_EXPORT std::unique_ptr<QVideoFrameTextures> createTextures(QVideoFrame &frame, QRhi *rhi, QRhiResourceUpdateBatch *rub, std::unique_ptr<QVideoFrameTextures> &&oldTextures);
68
70 float transformMatrix[4][4];
71 float colorMatrix[4][4];
72 float opacity;
73 float width;
75 float maxLum;
76};
77
78struct Q_MULTIMEDIA_EXPORT SubtitleLayout
79{
83
84 bool update(const QSize &frameSize, QString text);
85 void draw(QPainter *painter, const QPointF &translate) const;
86 QImage toImage() const;
87};
88
89}
90
92
93#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtGui
Definition qimage.h:37
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition qmatrix4x4.h:25
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtGui
Definition qrhi.h:1731
Format
Describes the swapchain format.
Definition qrhi.h:1561
Format
Specifies the texture format.
Definition qrhi.h:914
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\reentrant
Definition qtextlayout.h:70
The QVideoFrameFormat class specifies the stream format of a video presentation surface.
PixelFormat
Enumerates video data types.
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
QString text
Combined button and popup list for selecting options.
QString vertexShaderFileName(const QVideoFrameFormat &format)
QString fragmentShaderFileName(const QVideoFrameFormat &format, QRhiSwapChain::Format surfaceFormat)
const TextureDescription * textureDescription(QVideoFrameFormat::PixelFormat format)
std::unique_ptr< QVideoFrameTextures > createTextures(QVideoFrame &frame, QRhi *rhi, QRhiResourceUpdateBatch *rub, std::unique_ptr< QVideoFrameTextures > &&oldTextures)
void updateUniformData(QByteArray *dst, const QVideoFrameFormat &format, const QVideoFrame &frame, const QMatrix4x4 &transform, float opacity, float maxNits)
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
const void GLsizei GLsizei stride
GLint GLsizei width
GLenum GLenum dst
GLint GLsizei GLsizei GLenum format
GLint y
GLuint GLenum GLenum transform
GLdouble s
[6]
Definition qopenglext.h:235
static constexpr QSize frameSize(const T &frame)
static bool translate(xcb_connection_t *connection, xcb_window_t child, xcb_window_t parent, int *x, int *y)
myFilter draw(painter, QPoint(0, 0), originalPixmap)
QPainter painter(this)
[7]
QFrame frame
[0]
QRhiTexture::Format textureFormat[maxPlanes]
int widthForPlane(int width, int plane) const
int heightForPlane(int height, int plane) const
int(*)(int stride, int height) BytesRequired