zoneminder/src/zm_decoder_thread.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
624 B
C++
Raw Normal View History

2021-03-16 03:08:59 +08:00
#include "zm_decoder_thread.h"
#include "zm_monitor.h"
#include "zm_signal.h"
DecoderThread::DecoderThread(Monitor *monitor) :
2021-03-16 03:08:59 +08:00
monitor_(monitor), terminate_(false) {
thread_ = std::thread(&DecoderThread::Run, this);
}
DecoderThread::~DecoderThread() {
Stop();
if (thread_.joinable()) thread_.join();
2021-03-16 03:08:59 +08:00
}
void DecoderThread::Start() {
if (thread_.joinable()) thread_.join();
terminate_ = false;
thread_ = std::thread(&DecoderThread::Run, this);
}
2021-03-16 03:08:59 +08:00
void DecoderThread::Run() {
Debug(2, "DecoderThread::Run() for %d", monitor_->Id());
while (!(terminate_ or zm_terminate)) {
monitor_->Decode();
2021-03-16 03:08:59 +08:00
}
}