SDRdaemon: UDP channel sink (1)

pull/228/head
f4exb 2018-08-21 01:36:39 +02:00
rodzic 4697b13e60
commit dff02e944d
3 zmienionych plików z 30 dodań i 14 usunięć

Wyświetl plik

@ -24,6 +24,7 @@
#include "dsp/threadedbasebandsamplesink.h"
#include "dsp/downchannelizer.h"
#include "device/devicesourceapi.h"
#include "channel/sdrdaemonchannelsinkthread.h"
#include "sdrdaemonchannelsink.h"
const QString SDRDaemonChannelSink::m_channelIdURI = "sdrangel.channel.sdrdaemonsink";
@ -32,7 +33,11 @@ const QString SDRDaemonChannelSink::m_channelId = "SDRDaemonChannelSink";
SDRDaemonChannelSink::SDRDaemonChannelSink(DeviceSourceAPI *deviceAPI) :
ChannelSinkAPI(m_channelIdURI),
m_deviceAPI(deviceAPI),
m_running(false)
m_running(false),
m_sinkThread(0),
m_txBlockIndex(0),
m_frameCount(0),
m_sampleIndex(0)
{
setObjectName(m_channelId);
@ -40,6 +45,8 @@ SDRDaemonChannelSink::SDRDaemonChannelSink(DeviceSourceAPI *deviceAPI) :
m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
m_deviceAPI->addThreadedSink(m_threadedChannelizer);
m_deviceAPI->addChannelAPI(this);
m_cm256p = m_cm256.isInitialized() ? &m_cm256 : 0;
}
SDRDaemonChannelSink::~SDRDaemonChannelSink()
@ -58,6 +65,8 @@ void SDRDaemonChannelSink::feed(const SampleVector::const_iterator& begin, const
void SDRDaemonChannelSink::start()
{
qDebug("SDRDaemonChannelSink::start");
if (m_running) { stop(); }
m_sinkThread = new SDRDaemonChannelSinkThread(&m_dataQueue, m_cm256p);
m_running = true;
}

Wyświetl plik

@ -23,12 +23,16 @@
#ifndef SDRDAEMON_CHANNEL_SDRDAEMONCHANNELSINK_H_
#define SDRDAEMON_CHANNEL_SDRDAEMONCHANNELSINK_H_
#include "cm256.h"
#include "dsp/basebandsamplesink.h"
#include "channel/channelsinkapi.h"
#include "channel/sdrdaemondataqueue.h"
class DeviceSourceAPI;
class ThreadedBasebandSampleSink;
class DownChannelizer;
class SDRDaemonChannelSinkThread;
class SDRDaemonChannelSink : public BasebandSampleSink, public ChannelSinkAPI {
Q_OBJECT
@ -56,8 +60,16 @@ private:
DeviceSourceAPI *m_deviceAPI;
ThreadedBasebandSampleSink* m_threadedChannelizer;
DownChannelizer* m_channelizer;
bool m_running;
SDRDaemonDataQueue m_dataQueue;
SDRDaemonChannelSinkThread *m_sinkThread;
CM256 m_cm256;
CM256 *m_cm256p;
int m_txBlockIndex; //!< Current index in blocks to transmit in the Tx row
uint16_t m_frameCount; //!< transmission frame count
int m_sampleIndex; //!< Current sample index in protected block data
};
#endif /* SDRDAEMON_CHANNEL_SDRDAEMONCHANNELSINK_H_ */

Wyświetl plik

@ -36,18 +36,13 @@ struct SDRDaemonMetaDataFEC
{
uint32_t m_centerFrequency; //!< 4 center frequency in kHz
uint32_t m_sampleRate; //!< 8 sample rate in Hz
uint8_t m_bigEndian; //!< 9 1 if encoded as big endian, 0 for little endian
uint8_t m_reserved1; //!< 10 reserved
uint8_t m_reserved2; //!< 11 reserved
uint8_t m_reserved3; //!< 12 reserved
uint8_t m_sampleBytes; //!< 13 number of bytes per sample (2 or 3)
uint8_t m_sampleBits; //!< 14 number of effective bits per sample (8 t0 24)
uint8_t m_nbOriginalBlocks; //!< 15 number of blocks with original (protected) data
uint8_t m_nbFECBlocks; //!< 16 number of blocks carrying FEC
uint32_t m_tv_sec; //!< 20 seconds of timestamp at start time of super-frame processing
uint32_t m_tv_usec; //!< 24 microseconds of timestamp at start time of super-frame processing
uint32_t m_crc32; //!< 28 CRC32 of the above
// 32 bytes
uint8_t m_sampleBytes; //!< 9 number of bytes per sample (2 or 3)
uint8_t m_sampleBits; //!< 10 number of effective bits per sample (8 t0 24)
uint8_t m_nbOriginalBlocks; //!< 11 number of blocks with original (protected) data
uint8_t m_nbFECBlocks; //!< 12 number of blocks carrying FEC
uint32_t m_tv_sec; //!< 16 seconds of timestamp at start time of super-frame processing
uint32_t m_tv_usec; //!< 20 microseconds of timestamp at start time of super-frame processing
uint32_t m_crc32; //!< 24 CRC32 of the above
bool operator==(const SDRDaemonMetaDataFEC& rhs)
{