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
qffmpegsurfacecapturegrabber_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 QFFMPEGSURFACECAPTUREGRABBER_P_H
5#define QFFMPEGSURFACECAPTUREGRABBER_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 "qvideoframe.h"
19#include "private/qplatformsurfacecapture_p.h"
20
21#include <memory>
22#include <optional>
23
25
26class QThread;
27
28static constexpr qreal DefaultScreenCaptureFrameRate = 60.;
29
30// Mac screens often support 120 frames per sec; it looks, this is not
31// needed for the capturing now since it just affects CPI without valuable
32// advantages. In the future, the frame rate should be customized by
33// user's API.
34static constexpr qreal MaxScreenCaptureFrameRate = 60.;
35static constexpr qreal MinScreenCaptureFrameRate = 1.;
36
38{
40public:
45
47
49
50 void start();
51 void stop();
52
53 template<typename Object, typename Method>
59
63
64protected:
65 void updateError(QPlatformSurfaceCapture::Error error, const QString &description = {});
66
67 virtual QVideoFrame grabFrame() = 0;
68
70
71 qreal frameRate() const;
72
74
75 virtual void initializeGrabbingContext();
76 virtual void finalizeGrabbingContext();
77
79
80private:
81 struct GrabbingContext;
82 class GrabbingThread;
83
84 std::unique_ptr<GrabbingContext> m_context;
85 qreal m_rate = 0;
86 std::optional<QPlatformSurfaceCapture::Error> m_prevError;
87 std::unique_ptr<QThread> m_thread;
88};
89
91
92#endif // QFFMPEGSURFACECAPTUREGRABBER_P_H
Definition main.cpp:8
void errorUpdated(QPlatformSurfaceCapture::Error error, const QString &description)
virtual QVideoFrame grabFrame()=0
void addFrameCallback(Object &object, Method method)
void frameGrabbed(const QVideoFrame &)
~QFFmpegSurfaceCaptureGrabber() override
QFFmpegSurfaceCaptureGrabber(ThreadPolicy threadPolicy=CreateGrabbingThread)
void updateError(QPlatformSurfaceCapture::Error error, const QString &description={})
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
Combined button and popup list for selecting options.
@ DirectConnection
DBusConnection const char DBusError * error
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char * method
static constexpr qreal MinScreenCaptureFrameRate
static constexpr qreal MaxScreenCaptureFrameRate
static constexpr qreal DefaultScreenCaptureFrameRate
GLuint GLenum * rate
#define Q_OBJECT
#define signals
double qreal
Definition qtypes.h:187