1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

All device plugins: make sure start and stop are effective once only. PArt of #2159

This commit is contained in:
f4exb
2024-08-21 05:27:01 +02:00
committed by Edouard Griffiths
parent 1b37a4f504
commit 585d806ef8
40 changed files with 454 additions and 243 deletions
@@ -61,6 +61,7 @@ MESSAGE_CLASS_DEFINITION(SigMFFileInput::MsgReportTotalSamplesCheck, Message)
SigMFFileInput::SigMFFileInput(DeviceAPI *deviceAPI) :
m_deviceAPI(deviceAPI),
m_running(false),
m_settings(),
m_trackMode(false),
m_currentTrackIndex(0),
@@ -446,13 +447,18 @@ void SigMFFileInput::init()
bool SigMFFileInput::start()
{
QMutexLocker mutexLocker(&m_mutex);
if (m_running) {
return true;
}
if (!m_dataStream.is_open())
{
qWarning("SigMFFileInput::start: file not open. not starting");
return false;
}
QMutexLocker mutexLocker(&m_mutex);
qDebug() << "SigMFFileInput::start";
if (m_dataStream.tellg() != (std::streampos) 0) {
@@ -472,6 +478,7 @@ bool SigMFFileInput::start()
m_fileInputWorker->setTrackIndex(0);
m_fileInputWorker->moveToThread(&m_fileInputWorkerThread);
m_deviceDescription = "SigMFFileInput";
m_running = true;
mutexLocker.unlock();
qDebug("SigMFFileInput::startInput: started");
@@ -486,9 +493,15 @@ bool SigMFFileInput::start()
void SigMFFileInput::stop()
{
qDebug() << "SigMFFileInput::stop";
QMutexLocker mutexLocker(&m_mutex);
if (!m_running) {
return;
}
qDebug() << "SigMFFileInput::stop";
m_running = false;
if (m_fileInputWorker)
{
stopWorker();