mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-03-04 06:20:06 -05:00
SigMF File Input: refactored FileInputThread to FileInputWorker object moved to thread. This is the equivalent of what was done for FileInput
This commit is contained in:
parent
d4de16df74
commit
c6ed2f2675
@ -3,7 +3,7 @@ project(sigmffileinput)
|
||||
set(sigmffileinput_SOURCES
|
||||
sigmffileinput.cpp
|
||||
sigmffileinputplugin.cpp
|
||||
sigmffileinputthread.cpp
|
||||
sigmffileinputworker.cpp
|
||||
sigmffileinputsettings.cpp
|
||||
sigmffileinputwebapiadapter.cpp
|
||||
)
|
||||
@ -11,7 +11,7 @@ set(sigmffileinput_SOURCES
|
||||
set(sigmffileinput_HEADERS
|
||||
sigmffileinput.h
|
||||
sigmffileinputplugin.h
|
||||
sigmffileinputthread.h
|
||||
sigmffileinputworker.h
|
||||
sigmffileinputsettings.h
|
||||
sigmffileinputwebapiadapter.h
|
||||
)
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include "util/sha512.h"
|
||||
|
||||
#include "sigmffileinput.h"
|
||||
#include "sigmffileinputthread.h"
|
||||
#include "sigmffileinputworker.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInput::MsgConfigureSigMFFileInput, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInput::MsgConfigureTrackWork, Message)
|
||||
@ -69,7 +69,7 @@ SigMFFileInput::SigMFFileInput(DeviceAPI *deviceAPI) :
|
||||
m_crcAvailable(false),
|
||||
m_crcOK(false),
|
||||
m_recordLengthOK(false),
|
||||
m_fileInputThread(nullptr),
|
||||
m_fileInputWorker(nullptr),
|
||||
m_deviceDescription(),
|
||||
m_sampleRate(48000),
|
||||
m_sampleBytes(1),
|
||||
@ -455,11 +455,12 @@ bool SigMFFileInput::start()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fileInputThread = new SigMFFileInputThread(&m_dataStream, &m_sampleFifo, m_masterTimer, &m_inputMessageQueue);
|
||||
m_fileInputThread->setMetaInformation(&m_metaInfo, &m_captures);
|
||||
m_fileInputThread->setAccelerationFactor(m_settings.m_accelerationFactor);
|
||||
m_fileInputThread->setTrackIndex(0);
|
||||
m_fileInputThread->startWork();
|
||||
m_fileInputWorker = new SigMFFileInputWorker(&m_dataStream, &m_sampleFifo, m_masterTimer, &m_inputMessageQueue);
|
||||
startWorker();
|
||||
m_fileInputWorker->setMetaInformation(&m_metaInfo, &m_captures);
|
||||
m_fileInputWorker->setAccelerationFactor(m_settings.m_accelerationFactor);
|
||||
m_fileInputWorker->setTrackIndex(0);
|
||||
m_fileInputWorker->moveToThread(&m_fileInputWorkerThread);
|
||||
m_deviceDescription = "SigMFFileInput";
|
||||
|
||||
mutexLocker.unlock();
|
||||
@ -478,11 +479,11 @@ void SigMFFileInput::stop()
|
||||
qDebug() << "SigMFFileInput::stop";
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
m_fileInputThread->stopWork();
|
||||
delete m_fileInputThread;
|
||||
m_fileInputThread = nullptr;
|
||||
stopWorker();
|
||||
delete m_fileInputWorker;
|
||||
m_fileInputWorker = nullptr;
|
||||
}
|
||||
|
||||
m_deviceDescription.clear();
|
||||
@ -493,6 +494,19 @@ void SigMFFileInput::stop()
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInput::startWorker()
|
||||
{
|
||||
m_fileInputWorker->startWork();
|
||||
m_fileInputWorkerThread.start();
|
||||
}
|
||||
|
||||
void SigMFFileInput::stopWorker()
|
||||
{
|
||||
m_fileInputWorker->stopWork();
|
||||
m_fileInputWorkerThread.quit();
|
||||
m_fileInputWorkerThread.wait();
|
||||
}
|
||||
|
||||
QByteArray SigMFFileInput::serialize() const
|
||||
{
|
||||
return m_settings.serialize();
|
||||
@ -571,23 +585,23 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
qDebug("SigMFFileInput::handleMessage MsgConfigureTrackIndex: m_currentTrackIndex: %d", m_currentTrackIndex);
|
||||
seekTrackMillis(0);
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
bool working = m_fileInputThread->isRunning();
|
||||
bool working = m_fileInputWorker->isRunning();
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
|
||||
m_fileInputThread->setTrackIndex(m_currentTrackIndex);
|
||||
m_fileInputThread->setTotalSamples(
|
||||
m_fileInputWorker->setTrackIndex(m_currentTrackIndex);
|
||||
m_fileInputWorker->setTotalSamples(
|
||||
m_trackMode ?
|
||||
m_captures[m_currentTrackIndex].m_sampleStart + m_captures[m_currentTrackIndex].m_length :
|
||||
m_metaInfo.m_totalSamples
|
||||
);
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->startWork();
|
||||
startWorker();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -597,17 +611,17 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
bool working = conf.isWorking();
|
||||
m_trackMode = true;
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
if (working)
|
||||
{
|
||||
m_fileInputThread->setTotalSamples(
|
||||
m_fileInputWorker->setTotalSamples(
|
||||
m_captures[m_currentTrackIndex].m_sampleStart + m_captures[m_currentTrackIndex].m_length);
|
||||
m_fileInputThread->startWork();
|
||||
startWorker();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,19 +633,19 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
int seekMillis = conf.getMillis();
|
||||
seekTrackMillis(seekMillis);
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
bool working = m_fileInputThread->isRunning();
|
||||
bool working = m_fileInputWorker->isRunning();
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
|
||||
m_fileInputThread->setSamplesCount(
|
||||
m_fileInputWorker->setSamplesCount(
|
||||
m_captures[m_currentTrackIndex].m_sampleStart + ((m_captures[m_currentTrackIndex].m_length*seekMillis)/1000UL));
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->startWork();
|
||||
startWorker();
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,19 +659,19 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
uint64_t sampleCount = (m_metaInfo.m_totalSamples*seekMillis)/1000UL;
|
||||
m_currentTrackIndex = getTrackIndex(sampleCount);
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
bool working = m_fileInputThread->isRunning();
|
||||
bool working = m_fileInputWorker->isRunning();
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
|
||||
m_fileInputThread->setTrackIndex(m_currentTrackIndex);
|
||||
m_fileInputThread->setSamplesCount(sampleCount);
|
||||
m_fileInputWorker->setTrackIndex(m_currentTrackIndex);
|
||||
m_fileInputWorker->setSamplesCount(sampleCount);
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->startWork();
|
||||
startWorker();
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,16 +683,16 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
bool working = conf.isWorking();
|
||||
m_trackMode = false;
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
if (working)
|
||||
{
|
||||
m_fileInputThread->setTotalSamples(m_metaInfo.m_totalSamples);
|
||||
m_fileInputThread->startWork();
|
||||
m_fileInputWorker->setTotalSamples(m_metaInfo.m_totalSamples);
|
||||
startWorker();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,11 +700,11 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
}
|
||||
else if (MsgConfigureFileInputStreamTiming::match(message))
|
||||
{
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
quint64 totalSamplesCount = m_fileInputThread->getSamplesCount();
|
||||
quint64 totalSamplesCount = m_fileInputWorker->getSamplesCount();
|
||||
quint64 trackSamplesCount = totalSamplesCount - m_captures[m_currentTrackIndex].m_sampleStart;
|
||||
MsgReportFileInputStreamTiming *report = MsgReportFileInputStreamTiming::create(
|
||||
totalSamplesCount,
|
||||
@ -726,13 +740,13 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (SigMFFileInputThread::MsgReportEOF::match(message)) // End Of File or end of track
|
||||
else if (SigMFFileInputWorker::MsgReportEOF::match(message)) // End Of File or end of track
|
||||
{
|
||||
qDebug() << "FileInput::handleMessage: MsgReportEOF";
|
||||
bool working = m_fileInputThread->isRunning();
|
||||
bool working = m_fileInputWorker->isRunning();
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->stopWork();
|
||||
stopWorker();
|
||||
}
|
||||
|
||||
if (m_trackMode)
|
||||
@ -740,7 +754,7 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_trackLoop)
|
||||
{
|
||||
seekFileStream(m_captures[m_currentTrackIndex].m_sampleStart);
|
||||
m_fileInputThread->setTrackIndex(m_currentTrackIndex);
|
||||
m_fileInputWorker->setTrackIndex(m_currentTrackIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -748,19 +762,19 @@ bool SigMFFileInput::handleMessage(const Message& message)
|
||||
if (m_settings.m_fullLoop)
|
||||
{
|
||||
seekFileStream(0);
|
||||
m_fileInputThread->setTrackIndex(0);
|
||||
m_fileInputWorker->setTrackIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (working) {
|
||||
m_fileInputThread->startWork();
|
||||
startWorker();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (SigMFFileInputThread::MsgReportTrackChange::match(message))
|
||||
else if (SigMFFileInputWorker::MsgReportTrackChange::match(message))
|
||||
{
|
||||
SigMFFileInputThread::MsgReportTrackChange& report = (SigMFFileInputThread::MsgReportTrackChange&) message;
|
||||
SigMFFileInputWorker::MsgReportTrackChange& report = (SigMFFileInputWorker::MsgReportTrackChange&) message;
|
||||
m_currentTrackIndex = report.getTrackIndex();
|
||||
qDebug("SigMFFileInput::handleMessage MsgReportTrackChange: m_currentTrackIndex: %d", m_currentTrackIndex);
|
||||
int sampleRate = m_captures.at(m_currentTrackIndex).m_sampleRate;
|
||||
@ -795,14 +809,15 @@ bool SigMFFileInput::applySettings(const SigMFFileInputSettings& settings, bool
|
||||
{
|
||||
reverseAPIKeys.append("accelerationFactor");
|
||||
|
||||
if (m_fileInputThread)
|
||||
if (m_fileInputWorker)
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
if (!m_sampleFifo.setSize(m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample))) {
|
||||
qCritical("SigMFFileInput::applySettings: could not reallocate sample FIFO size to %lu",
|
||||
m_settings.m_accelerationFactor * m_sampleRate * sizeof(Sample));
|
||||
}
|
||||
m_fileInputThread->setAccelerationFactor(settings.m_accelerationFactor); // Fast Forward: 1 corresponds to live. 1/2 is half speed, 2 is double speed
|
||||
|
||||
m_fileInputWorker->setAccelerationFactor(settings.m_accelerationFactor); // Fast Forward: 1 corresponds to live. 1/2 is half speed, 2 is double speed
|
||||
}
|
||||
}
|
||||
|
||||
@ -1069,8 +1084,8 @@ void SigMFFileInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
|
||||
|
||||
uint64_t totalSamplesCount = 0;
|
||||
|
||||
if (m_fileInputThread) {
|
||||
totalSamplesCount = m_fileInputThread->getSamplesCount();
|
||||
if (m_fileInputWorker) {
|
||||
totalSamplesCount = m_fileInputWorker->getSamplesCount();
|
||||
}
|
||||
|
||||
unsigned int sampleRate = m_captures[m_currentTrackIndex].m_sampleRate;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <QTimer>
|
||||
#include <QThread>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
#include "dsp/sigmf_forward.h"
|
||||
@ -35,7 +36,7 @@
|
||||
|
||||
class QNetworkAccessManager;
|
||||
class QNetworkReply;
|
||||
class SigMFFileInputThread;
|
||||
class SigMFFileInputWorker;
|
||||
class DeviceAPI;
|
||||
|
||||
class SigMFFileInput : public DeviceSampleSource {
|
||||
@ -456,7 +457,8 @@ private:
|
||||
bool m_crcOK;
|
||||
bool m_recordLengthOK;
|
||||
QString m_recordSummary;
|
||||
SigMFFileInputThread* m_fileInputThread;
|
||||
SigMFFileInputWorker* m_fileInputWorker;
|
||||
QThread m_fileInputWorkerThread;
|
||||
QString m_deviceDescription;
|
||||
int m_sampleRate;
|
||||
unsigned int m_sampleBytes;
|
||||
@ -467,6 +469,8 @@ private:
|
||||
QNetworkAccessManager *m_networkManager;
|
||||
QNetworkRequest m_networkRequest;
|
||||
|
||||
void startWorker();
|
||||
void stopWorker();
|
||||
bool openFileStreams(const QString& fileName);
|
||||
void extractMeta(
|
||||
sigmf::SigMF<sigmf::Global<core::DescrT, sdrangel::DescrT>,
|
||||
|
||||
@ -27,17 +27,17 @@
|
||||
#include "sigmffiledata.h"
|
||||
#include "sigmffileconvert.h"
|
||||
#include "sigmffileinputsettings.h"
|
||||
#include "sigmffileinputthread.h"
|
||||
#include "sigmffileinputworker.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInputThread::MsgReportEOF, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInputThread::MsgReportTrackChange, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInputWorker::MsgReportEOF, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SigMFFileInputWorker::MsgReportTrackChange, Message)
|
||||
|
||||
SigMFFileInputThread::SigMFFileInputThread(std::ifstream *samplesStream,
|
||||
SigMFFileInputWorker::SigMFFileInputWorker(std::ifstream *samplesStream,
|
||||
SampleSinkFifo* sampleFifo,
|
||||
const QTimer& timer,
|
||||
MessageQueue *fileInputMessageQueue,
|
||||
QObject* parent) :
|
||||
QThread(parent),
|
||||
QObject(parent),
|
||||
m_running(false),
|
||||
m_currentTrackIndex(0),
|
||||
m_ifstream(samplesStream),
|
||||
@ -60,7 +60,7 @@ SigMFFileInputThread::SigMFFileInputThread(std::ifstream *samplesStream,
|
||||
assert(m_ifstream != 0);
|
||||
}
|
||||
|
||||
SigMFFileInputThread::~SigMFFileInputThread()
|
||||
SigMFFileInputWorker::~SigMFFileInputWorker()
|
||||
{
|
||||
if (m_running) {
|
||||
stopWork();
|
||||
@ -75,39 +75,31 @@ SigMFFileInputThread::~SigMFFileInputThread()
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::startWork()
|
||||
void SigMFFileInputWorker::startWork()
|
||||
{
|
||||
qDebug() << "SigMFFileInputThread::startWork: ";
|
||||
qDebug() << "SigMFFileInputWorker::startWork: ";
|
||||
|
||||
if (m_ifstream->is_open())
|
||||
{
|
||||
qDebug() << "SigMFFileInputThread::startWork: file stream open, starting...";
|
||||
m_startWaitMutex.lock();
|
||||
qDebug() << "SigMFFileInputWorker::startWork: file stream open, starting...";
|
||||
m_elapsedTimer.start();
|
||||
start();
|
||||
|
||||
while(!m_running) {
|
||||
m_startWaiter.wait(&m_startWaitMutex, 100);
|
||||
}
|
||||
|
||||
m_startWaitMutex.unlock();
|
||||
connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
|
||||
m_running = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "SigMFFileInputThread::startWork: file stream closed, not starting.";
|
||||
qDebug() << "SigMFFileInputWorker::startWork: file stream closed, not starting.";
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::stopWork()
|
||||
void SigMFFileInputWorker::stopWork()
|
||||
{
|
||||
qDebug() << "SigMFFileInputThread::stopWork";
|
||||
qDebug() << "SigMFFileInputWorker::stopWork";
|
||||
disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
|
||||
m_running = false;
|
||||
wait();
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setMetaInformation(const SigMFFileMetaInfo *metaInfo, const QList<SigMFFileCapture> *captures)
|
||||
void SigMFFileInputWorker::setMetaInformation(const SigMFFileMetaInfo *metaInfo, const QList<SigMFFileCapture> *captures)
|
||||
{
|
||||
m_metaInfo = metaInfo;
|
||||
m_captures = captures;
|
||||
@ -117,7 +109,7 @@ void SigMFFileInputThread::setMetaInformation(const SigMFFileMetaInfo *metaInfo,
|
||||
setSampleRate();
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setTrackIndex(int trackIndex)
|
||||
void SigMFFileInputWorker::setTrackIndex(int trackIndex)
|
||||
{
|
||||
m_currentTrackIndex = trackIndex;
|
||||
m_samplesCount = m_captures->at(m_currentTrackIndex).m_sampleStart;
|
||||
@ -133,13 +125,13 @@ void SigMFFileInputThread::setTrackIndex(int trackIndex)
|
||||
m_fileInputMessageQueue->push(message);
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setAccelerationFactor(int accelerationFactor)
|
||||
void SigMFFileInputWorker::setAccelerationFactor(int accelerationFactor)
|
||||
{
|
||||
m_accelerationFactor = accelerationFactor;
|
||||
setSampleRate();
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setSampleRate()
|
||||
void SigMFFileInputWorker::setSampleRate()
|
||||
{
|
||||
bool running = m_running;
|
||||
|
||||
@ -157,7 +149,7 @@ void SigMFFileInputThread::setSampleRate()
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setBuffers(std::size_t chunksize)
|
||||
void SigMFFileInputWorker::setBuffers(std::size_t chunksize)
|
||||
{
|
||||
if (chunksize > m_bufsize)
|
||||
{
|
||||
@ -195,20 +187,7 @@ void SigMFFileInputThread::setBuffers(std::size_t chunksize)
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::run()
|
||||
{
|
||||
m_running = true;
|
||||
m_startWaiter.wakeAll();
|
||||
|
||||
while(m_running) // actual work is in the tick() function
|
||||
{
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::tick()
|
||||
void SigMFFileInputWorker::tick()
|
||||
{
|
||||
if (m_running)
|
||||
{
|
||||
@ -260,7 +239,7 @@ void SigMFFileInputThread::tick()
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::setConverter()
|
||||
void SigMFFileInputWorker::setConverter()
|
||||
{
|
||||
if (m_metaInfo->m_dataType.m_floatingPoint) // float
|
||||
{
|
||||
@ -448,11 +427,11 @@ void SigMFFileInputThread::setConverter()
|
||||
}
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::writeToSampleFifo(const quint8* buf, qint32 nbBytes)
|
||||
void SigMFFileInputWorker::writeToSampleFifo(const quint8* buf, qint32 nbBytes)
|
||||
{
|
||||
if (!m_sigMFConverter)
|
||||
{
|
||||
qDebug("SigMFFileInputThread::writeToSampleFifo: no converter - probably sample format is not supported");
|
||||
qDebug("SigMFFileInputWorker::writeToSampleFifo: no converter - probably sample format is not supported");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -475,7 +454,7 @@ void SigMFFileInputThread::writeToSampleFifo(const quint8* buf, qint32 nbBytes)
|
||||
m_sampleFifo->write(m_convertBuf, nbSamples*sizeof(Sample));
|
||||
}
|
||||
|
||||
void SigMFFileInputThread::writeToSampleFifoBAK(const quint8* buf, qint32 nbBytes)
|
||||
void SigMFFileInputWorker::writeToSampleFifoBAK(const quint8* buf, qint32 nbBytes)
|
||||
{
|
||||
if (m_metaInfo->m_dataType.m_floatingPoint) // FP assumes 32 bit floats (float) always
|
||||
{
|
||||
@ -15,12 +15,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_SIGMFFILEINPUTTHREAD_H
|
||||
#define INCLUDE_SIGMFFILEINPUTTHREAD_H
|
||||
#ifndef INCLUDE_SIGMFFILEINPUTWORK_H
|
||||
#define INCLUDE_SIGMFFILEINPUTWORK_H
|
||||
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QElapsedTimer>
|
||||
#include <iostream>
|
||||
@ -38,7 +36,7 @@ class SigMFFileCapture;
|
||||
class SigMFFileMetaInfo;
|
||||
class SigMFConverterInterface;
|
||||
|
||||
class SigMFFileInputThread : public QThread {
|
||||
class SigMFFileInputWorker : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -73,12 +71,12 @@ public:
|
||||
{ }
|
||||
};
|
||||
|
||||
SigMFFileInputThread(std::ifstream *samplesStream,
|
||||
SigMFFileInputWorker(std::ifstream *samplesStream,
|
||||
SampleSinkFifo* sampleFifo,
|
||||
const QTimer& timer,
|
||||
MessageQueue *fileInputMessageQueue,
|
||||
QObject* parent = NULL);
|
||||
~SigMFFileInputThread();
|
||||
~SigMFFileInputWorker();
|
||||
|
||||
void startWork();
|
||||
void stopWork();
|
||||
@ -92,8 +90,6 @@ public:
|
||||
void setTrackIndex(int trackIndex);
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
QWaitCondition m_startWaiter;
|
||||
volatile bool m_running;
|
||||
|
||||
const SigMFFileMetaInfo *m_metaInfo;
|
||||
@ -131,4 +127,4 @@ private slots:
|
||||
void tick();
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SIGMFFILEINPUTTHREAD_H
|
||||
#endif // INCLUDE_SIGMFFILEINPUTWORK_H
|
||||
Loading…
x
Reference in New Issue
Block a user