39 static QMutex lock(QMutex::NonRecursive);
40 static QMutexLocker locker(&lock);
41 static QMap<QString,TorcCameraThread*> threads;
45 if (threads.contains(Type))
49 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Mismatch between thread and type for '%1'").arg(Type));
55 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Removing camera thread - no longer in use '%1'").arg(Type));
62 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Unknown camera thread type '%1'").arg(Type));
68 if (threads.contains(Type))
70 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Sharing existing camera thread '%1'").arg(Type));
71 thread = threads.value(Type);
75 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Creating shared camera thread '%1'").arg(Type));
77 threads.insert(Type, thread);
87 TorcCameraThread::TorcCameraThread(
const QString &Type,
const TorcCameraParams &Params)
92 m_cameraLock(QReadWriteLock::Recursive)
108 QWriteLocker locker(&m_cameraLock);
126 QWriteLocker locker(&m_cameraLock);
138 bool TorcCameraThread::DownRef(
void)
159 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Camera thread starting"));
161 QWriteLocker locker(&m_cameraLock);
197 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Camera thread stopping"));
202 QReadLocker locker(&m_cameraLock);
210 QReadLocker locker(&m_cameraLock);
void Finish(void) override
void TakeStills(uint Count)
void Start(void) override
static TorcCameraDevice * GetCamera(const QString &Type, const TorcCameraParams &Params)
virtual bool Stop(void)=0
void ParamsChanged(TorcCameraParams &Params)
Notify the output that the camera parameters have changed.
void CameraErrored(bool Errored) override
QByteArray GetSegment(int Segment)
QByteArray GetInitSegment(void)
void InitSegmentReady(void)
The 'init' segment is ready and available.
void SetErrored(bool Errored)
void SegmentRemoved(int Segment)
void WritingStarted(void)
virtual void TakeStills(uint Count)
Tell the camera to take Count number of still images.
void WritingStopped(void)
The camera is no longer recording any video.
void StreamVideo(bool Video)
virtual void StreamVideo(bool Video)=0
void StillReady(const QString &File)
void StreamVideo(bool Video)
virtual bool Start(void)=0
void SetVideoParent(TorcCameraVideoOutput *Parent)
Connect camera signals for video streaming to the stream output device.
TorcQThread(const QString &Name)
QByteArray GetInitSegment(void)
void ParamsChanged(TorcCameraParams &Params)
void StillReady(const QString &File)
void InitSegmentReady(void)
void WritingStarted(void)
void StillReady(const QString &File)
QByteArray GetSegment(int Segment)
static bool m_eventLoopEnding
void SegmentReady(int Segment)
void WritingStarted(void)
The camera has started to record video.
void ParametersChanged(TorcCameraParams &Params)
#define LOG(_MASK_, _LEVEL_, _STRING_)
void CameraErrored(bool Errored) override
void WritingStopped(void)
void InitSegmentReady(void)
void WritingStopped(void)
void TakeStills(uint Count)
void SegmentReady(int Segment)
static void CreateOrDestroy(TorcCameraThread *&Thread, const QString &Type, const TorcCameraParams &Params=TorcCameraParams())
Create and release shared camera threads/devices.
void SegmentRemoved(int Segment)
void SetStillsParent(TorcCameraStillsOutput *Parent)
Connect camera signals for stills capture.