qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
26 #include <QReadWriteLock>
32 struct AVCodecContext;
void setupDefault()
Setup default device.
void unsubscribe() override
Stop emitting frameAvailable signals, and free associated resources if necessary.
static CameraSource * instance
AVCodecContext * cctx
Codec context of the camera's selected video stream.
An abstract source of video frames.
QString deviceName
Short name of the device for CameraDevice's open(QString)
This class is a wrapper to share a camera's captured video frames.
void openDevice()
Opens the video device and starts streaming.
VideoMode mode
What mode we tried to open the device in, all zeros means default mode.
AVCodecContext * cctxOrig
Codec context of the camera's selected video stream.
void setupDevice(const QString &deviceName, const VideoMode &mode)
Change the device and mode.
int videoStreamIndex
A camera can have multiple streams, this is the one we're decoding.
CameraDevice * device
Non-owning pointer to an open CameraDevice, or nullptr. Not atomic, synced with memfences when become...
void stream()
Blocking. Decodes video stream and emits new frames.
QReadWriteLock deviceMutex
static void destroyInstance()
QFuture< void > streamFuture
Future of the streaming thread.
static CameraSource & getInstance()
Returns the singleton instance.
Describes a video mode supported by a device.
void closeDevice()
Closes the video device and stops streaming.
QReadWriteLock streamMutex
void subscribe() override
If subscribe sucessfully opens the source, it will start emitting frameAvailable signals.
std::atomic_int subscriptions
Remember how many times we subscribed for RAII.