14#ifndef STREAMS_WEBCAM_CAPTURE_H
15#define STREAMS_WEBCAM_CAPTURE_H
19#include <QMediaCaptureSession>
bool startCapture(int width=640, int height=480)
Start capturing from the default camera.
Definition webcam_capture.cpp:38
std::unique_ptr< QCamera > m_camera
The camera device.
Definition webcam_capture.h:89
bool getLatestFrame(uint8_t *dest, int width, int height)
Copy the latest webcam frame into the destination buffer as RGB24, scaled to the requested dimensions...
Definition webcam_capture.cpp:110
bool m_active
Whether capture is active.
Definition webcam_capture.h:99
static WebcamCapture * instance()
Get the singleton instance (created on first call).
Definition webcam_capture.cpp:32
WebcamCapture()
Private constructor (singleton).
Definition webcam_capture.cpp:21
std::unique_ptr< QMediaCaptureSession > m_session
The capture session.
Definition webcam_capture.h:91
std::mutex m_mutex
Mutex protecting m_latestFrame.
Definition webcam_capture.h:97
std::unique_ptr< QVideoSink > m_sink
The video sink.
Definition webcam_capture.h:93
void stopCapture()
Stop capturing.
Definition webcam_capture.cpp:70
bool isActive() const
Check if the camera is actively capturing.
Definition webcam_capture.cpp:137
void onVideoFrameChanged(const QVideoFrame &frame)
Receive a new video frame from the camera.
Definition webcam_capture.cpp:88
QImage m_latestFrame
Latest captured frame as RGB888 QImage.
Definition webcam_capture.h:95