blob: e997ff9546ab0f51085db5cfc7cf82e8931334a0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef WINDOW_CAPTURE_GRABBER_H
#define WINDOW_CAPTURE_GRABBER_H
#include <qvideosink.h>
#include <vector>
QT_USE_NAMESPACE
/*!
The FrameGrabber stores frames that arrive from the window capture,
and is used to inspect captured frames in the tests.
*/
class FrameGrabber : public QVideoSink
{
Q_OBJECT
public:
FrameGrabber();
const std::vector<QVideoFrame> &getFrames() const;
/*!
Wait for at least \a minCount frames that are no older than noOlderThanTime.
Returns empty if not enough frames arrived, or if grabber was stopped before global timeout
elapsed.
*/
std::vector<QVideoFrame> waitAndTakeFrames(size_t minCount, qint64 noOlderThanTime = 0);
bool isStopped() const;
public slots:
void stop();
private:
std::vector<QVideoFrame> m_frames;
bool m_stopped = false;
};
#endif
|