41 ~QSurfaceCaptureGrabber() override;
46 template<
typename Object,
typename Method>
47 void addFrameCallback(Object *object, Method method)
49 connect(
this, &QSurfaceCaptureGrabber::frameGrabbed, object, method,
50 Qt::DirectConnection);
53 void setFrameRate(std::optional<qreal>);
54 qreal frameRate()
const;
57 void frameGrabbed(
const QVideoFrame&);
58 void errorUpdated(QPlatformSurfaceCapture::Error error,
const QString &description);
61 QSurfaceCaptureGrabber(ThreadPolicy threadPolicy = CreateGrabbingThread);
63 void updateError(QPlatformSurfaceCapture::Error error,
const QString &description = {});
65 virtual QVideoFrame grabFrame() = 0;
67 void updateTimerInterval();
69 virtual void initializeGrabbingContext();
70 virtual void finalizeGrabbingContext();
72 bool isGrabbingContextInitialized()
const;
74 void injectContextToGrabbingThread(QObject *context);
77 class GrabbingProfiler;
78 struct GrabbingContext;
81 std::unique_ptr<GrabbingContext> m_context;
82 std::optional<QPlatformSurfaceCapture::Error> m_prevError;
83 std::unique_ptr<QThread> m_thread;
85 qreal m_rate{ DefaultScreenCaptureFrameRate };