Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
testvideosink_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
TESTVIDEOSINK_H
5
#
define
TESTVIDEOSINK_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
<
qvideosink
.
h
>
19
#
include
<
qvideoframe
.
h
>
20
#
include
<
qelapsedtimer
.
h
>
21
#
include
<
qimage
.
h
>
22
#
include
<
chrono
>
23
#
include
<
vector
>
24
25
QT_BEGIN_NAMESPACE
26
27
/*
28
This is a simple video surface which records all presented frames.
29
*/
30
class
TestVideoSink :
public
QVideoSink
31
{
32
Q_OBJECT
33
public
:
34
explicit
TestVideoSink(
bool
storeFrames =
false
);
35
36
QVideoFrame waitForFrame();
37
38
void
setStoreFrames(
bool
storeFrames =
true
) { m_storeFrames = storeFrames; }
39
40
void
setStoreImagesEnabled(
bool
storeImages =
true
);
41
const
std::vector<QImage> &images()
const
{
return
m_images; }
42
43
std::chrono::milliseconds durationBetweenFrames(qsizetype frameCount);
44
45
private
Q_SLOTS:
46
void
addVideoFrame(
const
QVideoFrame &frame);
47
void
storeImage(
const
QVideoFrame &frame);
48
49
Q_SIGNALS:
50
void
videoFrameChangedSync(
const
QVideoFrame &frame);
51
52
public
:
53
QList<QVideoFrame> m_frameList;
54
int
m_totalFrames = 0;
// used instead of the list when frames are not stored
55
QElapsedTimer m_elapsedTimer;
56
using
TimePoint = std::chrono::time_point<std::chrono::high_resolution_clock>;
57
std::vector<TimePoint> m_frameTimes;
58
59
private
:
60
bool
m_storeFrames;
61
std::vector<QImage> m_images;
62
};
63
64
QT_END_NAMESPACE
65
66
#
endif
// TESTVIDEOSINK_H
QElapsedTimer
\inmodule QtCore
Definition
qelapsedtimer.h:16
QImage
\inmodule QtGui
Definition
qimage.h:38
QSignalSpy
\inmodule QtTest
Definition
qsignalspy.h:22
QSignalSpy::wait
bool wait(int timeout)
Definition
qsignalspy.h:47
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtmultimedia
src
multimediatestlib
testvideosink_p.h
Generated on
for Qt by
1.18.0