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
framegenerator_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef FRAMEGENERATOR_H
5#define FRAMEGENERATOR_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 <QtCore/qobject.h>
19#include <QtMultimedia/qvideoframe.h>
20
21#include <array>
22#include <chrono>
23
24QT_BEGIN_NAMESPACE
25
26enum class ImagePattern
27{
28 SingleColor, // Image filled with a single color
29 ColoredSquares // Colored squares, [red, green; blue, yellow]
30};
31
32class VideoGenerator : public QObject
33{
35public:
37 void setFrameCount(int count);
38 void setSize(QSize size);
39 void setPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat);
40 void setFrameRate(double rate);
41 void setPeriod(std::chrono::microseconds period);
42 void setPresentationRotation(QtVideo::Rotation rotation);
43 void setPresentationMirrored(bool mirror);
44 void setEndTimeReporting(bool endTimeIsReported);
45 void setColors(std::array<QColor, 5> colors);
48
50 void done();
51 void frameCreated(const QVideoFrame &frame);
52
53public slots:
54 void nextFrame();
55
56private:
57 std::array<QColor, 5> m_colors{
60 };
61 ImagePattern m_pattern = ImagePattern::SingleColor;
62 QSize m_size{ 640, 480 };
63 QVideoFrameFormat::PixelFormat m_pixelFormat = QVideoFrameFormat::Format_BGRA8888;
64 std::optional<int> m_maxFrameCount;
65 int m_frameIndex = 0;
66 std::optional<double> m_frameRate;
67 std::optional<std::chrono::microseconds> m_period;
68 std::optional<QtVideo::Rotation> m_presentationRotation;
69 std::optional<bool> m_presentationMirrored;
70 bool m_emitEmptyFrameOnStop = false;
71 bool m_endTimeIsReported = true;
72};
73
74QT_END_NAMESPACE
75
76#endif
void setEndTimeReporting(bool endTimeIsReported)
QVideoFrame createFrame()
void setSize(QSize size)
void emitEmptyFrameOnStop()
void setPresentationMirrored(bool mirror)
void frameCreated(const QVideoFrame &frame)
void setColors(std::array< QColor, 5 > colors)
void setFrameCount(int count)
void setPeriod(std::chrono::microseconds period)
void setFrameRate(double rate)
void setPresentationRotation(QtVideo::Rotation rotation)
void setPixelFormat(QVideoFrameFormat::PixelFormat pixelFormat)
static void fillColoredSquares(QImage &image)
Combined button and popup list for selecting options.