diff --git a/plugins/samplesource/v4l/v4linput.cpp b/plugins/samplesource/v4l/v4linput.cpp index 21c1da948..c9e83f217 100644 --- a/plugins/samplesource/v4l/v4linput.cpp +++ b/plugins/samplesource/v4l/v4linput.cpp @@ -70,16 +70,6 @@ V4LInput::V4LInput(MessageQueue* msgQueueToGUI) : { } -bool V4LThread::Init() -{ - OpenSource("/dev/swradio0"); - if (fd < 0) { - qCritical("could not open SDR"); - return false; - } - return true; -} - V4LInput::~V4LInput() { stopInput(); diff --git a/plugins/samplesource/v4l/v4lsource.cpp b/plugins/samplesource/v4l/v4lsource.cpp index 9c480502e..0ccd1a725 100644 --- a/plugins/samplesource/v4l/v4lsource.cpp +++ b/plugins/samplesource/v4l/v4lsource.cpp @@ -119,6 +119,7 @@ V4LThread::OpenSource(const char *filename) xioctl(fd, VIDIOC_QBUF, &buf); } + set_sample_rate((double)SAMPLERATE); // start streaming type = V4L2_BUF_TYPE_SDR_CAPTURE; xioctl(fd, VIDIOC_STREAMON, &type); diff --git a/plugins/samplesource/v4l/v4lthread.cpp b/plugins/samplesource/v4l/v4lthread.cpp index 287d6ed00..65ef49d96 100644 --- a/plugins/samplesource/v4l/v4lthread.cpp +++ b/plugins/samplesource/v4l/v4lthread.cpp @@ -26,6 +26,7 @@ V4LThread::V4LThread(SampleFifo* sampleFifo, QObject* parent) : m_convertBuffer(BLOCKSIZE), m_sampleFifo(sampleFifo) { + start(); } V4LThread::~V4LThread() @@ -35,12 +36,14 @@ V4LThread::~V4LThread() void V4LThread::stopWork() { m_running = false; + wait(); } void V4LThread::run() { m_running = true; - if (! Init() ) + OpenSource("/dev/swradio0"); + if (fd < 0) return; while(m_running) { diff --git a/plugins/samplesource/v4l/v4lthread.h b/plugins/samplesource/v4l/v4lthread.h index f51a455ba..d3c21995d 100644 --- a/plugins/samplesource/v4l/v4lthread.h +++ b/plugins/samplesource/v4l/v4lthread.h @@ -34,7 +34,6 @@ public: V4LThread(SampleFifo* sampleFifo, QObject* parent = NULL); ~V4LThread(); - bool Init(); void stopWork(); void OpenSource(const char *filename); void CloseSource();