SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
plugins
samplesource
fileinput
fileinputthread.h
Go to the documentation of this file.
1
// Copyright (C) 2015-2019 Edouard Griffiths, F4EXB //
3
// //
4
// This program is free software; you can redistribute it and/or modify //
5
// it under the terms of the GNU General Public License as published by //
6
// the Free Software Foundation as version 3 of the License, or //
7
// (at your option) any later version. //
8
// //
9
// This program is distributed in the hope that it will be useful, //
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12
// GNU General Public License V3 for more details. //
13
// //
14
// You should have received a copy of the GNU General Public License //
15
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
17
18
#ifndef INCLUDE_FILEINPUTTHREAD_H
19
#define INCLUDE_FILEINPUTTHREAD_H
20
21
#include <QThread>
22
#include <QMutex>
23
#include <QWaitCondition>
24
#include <QTimer>
25
#include <QElapsedTimer>
26
#include <iostream>
27
#include <fstream>
28
#include <cstdlib>
29
30
#include "
dsp/inthalfbandfilter.h
"
31
#include "
util/message.h
"
32
33
#define FILESOURCE_THROTTLE_MS 50
34
35
class
SampleSinkFifo
;
36
class
MessageQueue
;
37
38
class
FileInputThread
:
public
QThread {
39
Q_OBJECT
40
41
public
:
42
class
MsgReportEOF
:
public
Message
{
43
MESSAGE_CLASS_DECLARATION
44
45
public
:
46
static
MsgReportEOF
*
create
() {
47
return
new
MsgReportEOF
();
48
}
49
50
private
:
51
MsgReportEOF
() :
52
Message
()
53
{ }
54
};
55
56
FileInputThread
(std::ifstream *samplesStream,
57
SampleSinkFifo
* sampleFifo,
58
const
QTimer& timer,
59
MessageQueue
*fileInputMessageQueue,
60
QObject* parent = NULL);
61
~FileInputThread
();
62
63
void
startWork
();
64
void
stopWork
();
65
void
setSampleRateAndSize
(
int
samplerate, quint32 samplesize);
66
void
setBuffers
(std::size_t chunksize);
67
bool
isRunning
()
const
{
return
m_running
; }
68
quint64
getSamplesCount
()
const
{
return
m_samplesCount
; }
69
void
setSamplesCount
(quint64 samplesCount) {
m_samplesCount
= samplesCount; }
70
71
private
:
72
QMutex
m_startWaitMutex
;
73
QWaitCondition
m_startWaiter
;
74
volatile
bool
m_running
;
75
76
std::ifstream*
m_ifstream
;
77
quint8 *
m_fileBuf
;
78
quint8 *
m_convertBuf
;
79
std::size_t
m_bufsize
;
80
qint64
m_chunksize
;
81
SampleSinkFifo
*
m_sampleFifo
;
82
quint64
m_samplesCount
;
83
const
QTimer&
m_timer
;
84
MessageQueue
*
m_fileInputMessageQueue
;
85
86
int
m_samplerate
;
87
quint64
m_samplesize
;
88
quint64
m_samplebytes
;
89
qint64
m_throttlems
;
90
QElapsedTimer
m_elapsedTimer
;
91
bool
m_throttleToggle
;
92
93
void
run
();
94
//void decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len);
95
void
writeToSampleFifo
(
const
quint8* buf, qint32 nbBytes);
96
97
private
slots:
98
void
tick
();
99
};
100
101
#endif // INCLUDE_FILEINPUTTHREAD_H
FileInputThread::m_bufsize
std::size_t m_bufsize
Definition:
fileinputthread.h:79
MessageQueue
Definition:
messagequeue.h:29
FileInputThread::tick
void tick()
Definition:
fileinputthread.cpp:175
FileInputThread::m_throttleToggle
bool m_throttleToggle
Definition:
fileinputthread.h:91
FileInputThread
Definition:
fileinputthread.h:38
Message
Definition:
message.h:25
FileInputThread::m_throttlems
qint64 m_throttlems
Definition:
fileinputthread.h:89
inthalfbandfilter.h
FileInputThread::m_running
volatile bool m_running
Definition:
fileinputthread.h:74
FileInputThread::MsgReportEOF
Definition:
fileinputthread.h:42
FileInputThread::m_startWaiter
QWaitCondition m_startWaiter
Definition:
fileinputthread.h:73
message.h
FileInputThread::m_samplesize
quint64 m_samplesize
File effective sample size in bits (I or Q). Ex: 16, 24.
Definition:
fileinputthread.h:87
FileInputThread::writeToSampleFifo
void writeToSampleFifo(const quint8 *buf, qint32 nbBytes)
Definition:
fileinputthread.cpp:206
FileInputThread::getSamplesCount
quint64 getSamplesCount() const
Definition:
fileinputthread.h:68
FileInputThread::run
void run()
Definition:
fileinputthread.cpp:162
FileInputThread::m_convertBuf
quint8 * m_convertBuf
Definition:
fileinputthread.h:78
MESSAGE_CLASS_DECLARATION
#define MESSAGE_CLASS_DECLARATION
Definition:
message.h:43
FileInputThread::m_timer
const QTimer & m_timer
Definition:
fileinputthread.h:83
FileInputThread::startWork
void startWork()
Definition:
fileinputthread.cpp:70
FileInputThread::m_samplebytes
quint64 m_samplebytes
Number of bytes used to store a I or Q sample. Ex: 2. 4.
Definition:
fileinputthread.h:88
FileInputThread::m_ifstream
std::ifstream * m_ifstream
Definition:
fileinputthread.h:76
FileInputThread::stopWork
void stopWork()
Definition:
fileinputthread.cpp:91
FileInputThread::m_fileInputMessageQueue
MessageQueue * m_fileInputMessageQueue
Definition:
fileinputthread.h:84
FileInputThread::m_samplesCount
quint64 m_samplesCount
Definition:
fileinputthread.h:82
FileInputThread::m_sampleFifo
SampleSinkFifo * m_sampleFifo
Definition:
fileinputthread.h:81
FileInputThread::~FileInputThread
~FileInputThread()
Definition:
fileinputthread.cpp:55
FileInputThread::isRunning
bool isRunning() const
Definition:
fileinputthread.h:67
FileInputThread::setSampleRateAndSize
void setSampleRateAndSize(int samplerate, quint32 samplesize)
Definition:
fileinputthread.cpp:99
FileInputThread::m_chunksize
qint64 m_chunksize
Definition:
fileinputthread.h:80
FileInputThread::setBuffers
void setBuffers(std::size_t chunksize)
Definition:
fileinputthread.cpp:124
FileInputThread::m_fileBuf
quint8 * m_fileBuf
Definition:
fileinputthread.h:77
FileInputThread::MsgReportEOF::create
static MsgReportEOF * create()
Definition:
fileinputthread.h:46
FileInputThread::m_elapsedTimer
QElapsedTimer m_elapsedTimer
Definition:
fileinputthread.h:90
FileInputThread::MsgReportEOF::MsgReportEOF
MsgReportEOF()
Definition:
fileinputthread.h:51
FileInputThread::m_startWaitMutex
QMutex m_startWaitMutex
Definition:
fileinputthread.h:72
SampleSinkFifo
Definition:
samplesinkfifo.h:28
FileInputThread::FileInputThread
FileInputThread(std::ifstream *samplesStream, SampleSinkFifo *sampleFifo, const QTimer &timer, MessageQueue *fileInputMessageQueue, QObject *parent=NULL)
Definition:
fileinputthread.cpp:30
FileInputThread::setSamplesCount
void setSamplesCount(quint64 samplesCount)
Definition:
fileinputthread.h:69
FileInputThread::m_samplerate
int m_samplerate
File I/Q stream original sample rate.
Definition:
fileinputthread.h:86
Generated on Fri Aug 2 2019 17:56:32 for SDRAngel by
1.8.13