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.
remoteoutputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2017 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_REMOTEOUTPUTTHREAD_H
19 #define INCLUDE_REMOTEOUTPUTTHREAD_H
20 
21 #include <iostream>
22 #include <fstream>
23 #include <cstdlib>
24 #include <stdint.h>
25 
26 #include <QThread>
27 #include <QMutex>
28 #include <QWaitCondition>
29 #include <QTimer>
30 #include <QElapsedTimer>
31 
32 #include "dsp/inthalfbandfilter.h"
33 #include "dsp/interpolators.h"
34 
35 #include "udpsinkfec.h"
36 
37 #define REMOTEOUTPUT_THROTTLE_MS 50
38 
39 class SampleSourceFifo;
40 struct timeval;
41 
42 class RemoteOutputThread : public QThread {
43  Q_OBJECT
44 
45 public:
46  RemoteOutputThread(SampleSourceFifo* sampleFifo, QObject* parent = 0);
48 
49  void startWork();
50  void stopWork();
51 
52  void setSamplerate(int samplerate);
53  void setNbBlocksFEC(uint32_t nbBlocksFEC) { m_udpSinkFEC.setNbBlocksFEC(nbBlocksFEC); };
54  void setTxDelay(float txDelay) { m_udpSinkFEC.setTxDelay(txDelay); };
55  void setDataAddress(const QString& address, uint16_t port) { m_udpSinkFEC.setRemoteAddress(address, port); }
56 
57  bool isRunning() const { return m_running; }
58 
59  uint32_t getSamplesCount(uint64_t& ts_usecs) const;
60  void setSamplesCount(int samplesCount) { m_samplesCount = samplesCount; }
61  void setChunkCorrection(int chunkCorrection) { m_chunkCorrection = chunkCorrection; }
62 
63  void connectTimer(const QTimer& timer);
64 
65 private:
67  QWaitCondition m_startWaiter;
68  volatile bool m_running;
69 
74 
78  QElapsedTimer m_elapsedTimer;
80 
82 
83  void run();
84 
85 private slots:
86  void tick();
87 };
88 
89 #endif // INCLUDE_REMOTEOUTPUTTHREAD_H
void setSamplesCount(int samplesCount)
void setTxDelay(float txDelayRatio)
Definition: udpsinkfec.cpp:74
uint32_t getSamplesCount(uint64_t &ts_usecs) const
void setRemoteAddress(const QString &address, uint16_t port)
Definition: udpsinkfec.cpp:101
void setSamplerate(int samplerate)
void setTxDelay(float txDelay)
void setChunkCorrection(int chunkCorrection)
unsigned int uint32_t
Definition: rtptypes_win.h:46
volatile bool m_running
void setNbBlocksFEC(uint32_t nbBlocksFEC)
unsigned short uint16_t
Definition: rtptypes_win.h:44
SampleSourceFifo * m_sampleFifo
QWaitCondition m_startWaiter
void setNbBlocksFEC(uint32_t nbBlocksFEC)
Definition: udpsinkfec.cpp:87
QElapsedTimer m_elapsedTimer
RemoteOutputThread(SampleSourceFifo *sampleFifo, QObject *parent=0)
void setDataAddress(const QString &address, uint16_t port)
void connectTimer(const QTimer &timer)
unsigned __int64 uint64_t
Definition: rtptypes_win.h:48