1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Remote plugins: added new meta data for #1074

This commit is contained in:
f4exb 2021-12-23 16:27:19 +01:00
parent d482471a59
commit 247ae2679d
15 changed files with 67 additions and 11 deletions

View File

@ -96,6 +96,8 @@ void RemoteSink::start()
{
qDebug("RemoteSink::start: m_basebandSampleRate: %d", m_basebandSampleRate);
m_basebandSink->reset();
m_basebandSink->setDeviceIndex(m_deviceAPI->getDeviceSetIndex());
m_basebandSink->setChannelIndex(getIndexInDeviceSet());
m_basebandSink->startWork();
m_thread.start();

View File

@ -70,6 +70,8 @@ public:
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
int getChannelSampleRate() const;
void setBasebandSampleRate(int sampleRate);
void setDeviceIndex(uint32_t deviceIndex) { m_sink.setDeviceIndex(deviceIndex); }
void setChannelIndex(uint32_t channelIndex) { m_sink.setChannelIndex(channelIndex); }
private:
bool m_running;

View File

@ -68,6 +68,12 @@ void RemoteSinkSender::started()
void RemoteSinkSender::stopWork()
{
qDebug("RemoteSinkSender::stopWork");
QObject::disconnect(
&m_fifo,
&RemoteSinkFifo::dataBlockServed,
this,
&RemoteSinkSender::handleData
);
}
void RemoteSinkSender::finished()

View File

@ -38,6 +38,8 @@ void RemoteSinkSettings::resetToDefaults()
{
m_nbFECBlocks = 0;
m_nbTxBytes = 2;
m_deviceCenterFrequency = 0;
m_deviceSampleRate = 48000;
m_dataAddress = "127.0.0.1";
m_dataPort = 9090;
m_rgbColor = QColor(140, 4, 4).rgb();
@ -71,6 +73,8 @@ QByteArray RemoteSinkSettings::serialize() const
s.writeU32(13, m_filterChainHash);
s.writeS32(14, m_streamIndex);
s.writeBlob(15, m_rollupState);
s.writeU64(16, m_deviceCenterFrequency);
s.writeU32(17, m_deviceSampleRate);
return s.final();
}
@ -129,6 +133,8 @@ bool RemoteSinkSettings::deserialize(const QByteArray& data)
d.readU32(13, &m_filterChainHash, 0);
d.readS32(14, &m_streamIndex, 0);
d.readBlob(15, &m_rollupState);
d.readU64(16, &m_deviceCenterFrequency, 0);
d.readU32(17, &m_deviceSampleRate, 48000);
return true;
}

View File

@ -33,6 +33,8 @@ struct RemoteSinkSettings
{
uint16_t m_nbFECBlocks;
uint32_t m_nbTxBytes;
quint64 m_deviceCenterFrequency;
uint32_t m_deviceSampleRate;
QString m_dataAddress;
uint16_t m_dataPort;
quint32 m_rgbColor;

View File

@ -131,6 +131,10 @@ void RemoteSinkSink::feed(const SampleVector::const_iterator& begin, const Sampl
metaData.m_sampleBits = getNbSampleBits();
metaData.m_nbOriginalBlocks = RemoteNbOrginalBlocks;
metaData.m_nbFECBlocks = m_nbBlocksFEC;
metaData.m_deviceCenterFrequency = m_deviceCenterFrequency;
metaData.m_basebandSampleRate = m_basebandSampleRate;
metaData.m_deviceIndex = m_deviceIndex % 256;
metaData.m_channelIndex = m_channelIndex % 256;
metaData.m_tv_sec = nowus / 1000000UL; // tv.tv_sec;
metaData.m_tv_usec = nowus % 1000000UL; // tv.tv_usec;
@ -160,6 +164,10 @@ void RemoteSinkSink::feed(const SampleVector::const_iterator& begin, const Sampl
<< ":" << (int) metaData.m_sampleBits
<< "|" << (int) metaData.m_nbOriginalBlocks
<< ":" << (int) metaData.m_nbFECBlocks
<< "|" << metaData.m_deviceCenterFrequency
<< ":" << metaData.m_basebandSampleRate
<< "|" << metaData.m_deviceIndex
<< ":" << metaData.m_channelIndex
<< "|" << metaData.m_tv_sec
<< ":" << metaData.m_tv_usec;

View File

@ -46,6 +46,8 @@ public:
void applySettings(const RemoteSinkSettings& settings, bool force = false);
void applyBasebandSampleRate(uint32_t sampleRate);
void setDeviceCenterFrequency(uint64_t frequency) { m_deviceCenterFrequency = frequency; }
void setDeviceIndex(uint32_t deviceIndex) { m_deviceIndex = deviceIndex; }
void setChannelIndex(uint32_t channelIndex) { m_channelIndex = channelIndex; }
private:
RemoteSinkSettings m_settings;
@ -63,6 +65,8 @@ private:
uint64_t m_deviceCenterFrequency;
int64_t m_frequencyOffset;
uint32_t m_basebandSampleRate;
uint32_t m_deviceIndex;
uint32_t m_channelIndex;
int m_nbBlocksFEC;
uint32_t m_nbTxBytes;
QString m_dataAddress;

View File

@ -218,6 +218,10 @@ void RemoteSourceSource::printMeta(const QString& header, RemoteMetaDataFEC *met
<< ":" << (int) metaData->m_sampleBits
<< ":" << (int) metaData->m_nbOriginalBlocks
<< ":" << (int) metaData->m_nbFECBlocks
<< "|" << metaData->m_deviceCenterFrequency
<< ":" << metaData->m_basebandSampleRate
<< "|" << metaData->m_deviceIndex
<< ":" << metaData->m_channelIndex
<< "|" << metaData->m_tv_sec
<< ":" << metaData->m_tv_usec
<< "|";

View File

@ -90,6 +90,7 @@ bool RemoteOutput::start()
m_remoteOutputWorker = new RemoteOutputWorker(&m_sampleSourceFifo);
m_remoteOutputWorker->moveToThread(&m_remoteOutputWorkerThread);
m_remoteOutputWorker->setDeviceIndex(m_deviceAPI->getDeviceSetIndex());
m_remoteOutputWorker->setDataAddress(m_settings.m_dataAddress, m_settings.m_dataPort);
m_remoteOutputWorker->setSamplerate(m_sampleRate);
m_remoteOutputWorker->setNbBlocksFEC(m_settings.m_nbFECBlocks);

View File

@ -41,8 +41,6 @@
#include "channel/remotedatablock.h"
#include "udpsinkfec.h"
RemoteOutputSinkGui::RemoteOutputSinkGui(DeviceUISet *deviceUISet, QWidget* parent) :
DeviceGUI(parent),
ui(new Ui::RemoteOutputGui),

View File

@ -47,6 +47,7 @@ public:
void startWork();
void stopWork();
void setDeviceIndex(uint32_t deviceIndex) { m_udpSinkFEC.setDeviceIndex(deviceIndex); }
void setSamplerate(int samplerate);
void setNbBlocksFEC(uint32_t nbBlocksFEC) { m_udpSinkFEC.setNbBlocksFEC(nbBlocksFEC); };
void setNbTxBytes(uint32_t nbTxBytes) { m_udpSinkFEC.setNbTxBytes(nbTxBytes); };

View File

@ -120,6 +120,10 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk
metaData.m_sampleBits = getNbSampleBits();
metaData.m_nbOriginalBlocks = RemoteNbOrginalBlocks;
metaData.m_nbFECBlocks = m_nbBlocksFEC;
metaData.m_deviceCenterFrequency = 0; // frequency not set by device
metaData.m_basebandSampleRate = m_sampleRate; // same as sample rate
metaData.m_deviceIndex = m_deviceIndex; // index of device set in the instance
metaData.m_channelIndex = 0; // irrelavant
metaData.m_tv_sec = nowus / 1000000UL; // tv.tv_sec;
metaData.m_tv_usec = nowus % 1000000UL; // tv.tv_usec;
@ -149,6 +153,10 @@ void UDPSinkFEC::write(const SampleVector::iterator& begin, uint32_t sampleChunk
<< ":" << (int) metaData.m_sampleBits
<< "|" << (int) metaData.m_nbOriginalBlocks
<< ":" << (int) metaData.m_nbFECBlocks
<< "|" << metaData.m_deviceCenterFrequency
<< ":" << metaData.m_basebandSampleRate
<< "|" << metaData.m_deviceIndex
<< ":" << metaData.m_channelIndex
<< "|" << metaData.m_tv_sec
<< ":" << metaData.m_tv_usec;

View File

@ -64,6 +64,7 @@ public:
return ret;
}
void setDeviceIndex(uint32_t deviceIndex) { m_deviceIndex = deviceIndex; }
/** Set sample rate given in S/s */
void setSampleRate(uint32_t sampleRate);
@ -94,6 +95,7 @@ private:
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
uint32_t m_deviceIndex; //!< Index of current device set
RemoteOutputSender *m_remoteOutputSender;
QThread *m_senderThread;

View File

@ -415,6 +415,10 @@ void RemoteInputBuffer::printMeta(const QString& header, RemoteMetaDataFEC *meta
<< ":" << (int) metaData->m_sampleBits
<< ":" << (int) metaData->m_nbOriginalBlocks
<< ":" << (int) metaData->m_nbFECBlocks
<< "|" << metaData->m_deviceCenterFrequency
<< ":" << metaData->m_basebandSampleRate
<< "|" << metaData->m_deviceIndex
<< ":" << metaData->m_channelIndex
<< "|" << metaData->m_tv_sec
<< ":" << metaData->m_tv_usec
<< "|";

View File

@ -38,16 +38,20 @@
#pragma pack(push, 1)
struct RemoteMetaDataFEC
{
uint64_t m_centerFrequency; //!< 8 center frequency in kHz
uint32_t m_sampleRate; //!< 12 sample rate in Hz
uint8_t m_sampleBytes; //!< 13 4 LSB: number of bytes per sample (2 or 4)
uint8_t m_sampleBits; //!< 14 number of effective bits per sample (deprecated)
uint8_t m_nbOriginalBlocks; //!< 15 number of blocks with original (protected) data
uint8_t m_nbFECBlocks; //!< 16 number of blocks carrying FEC
uint64_t m_centerFrequency; //!< 8 center frequency in kHz
uint32_t m_sampleRate; //!< 12 sample rate in Hz
uint8_t m_sampleBytes; //!< 13 4 LSB: number of bytes per sample (2 or 4)
uint8_t m_sampleBits; //!< 14 number of effective bits per sample (deprecated)
uint8_t m_nbOriginalBlocks; //!< 15 number of blocks with original (protected) data
uint8_t m_nbFECBlocks; //!< 16 number of blocks carrying FEC
uint64_t m_deviceCenterFrequency; //!< 24 device center frequency in Hz
uint32_t m_basebandSampleRate; //!< 28 basebabd sample rate in Hz
uint8_t m_deviceIndex; //!< 29 index of device set in instance
uint8_t m_channelIndex; //!< 30 index of channel in device set
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
uint32_t m_tv_sec; //!< 34 seconds of timestamp at start time of super-frame processing
uint32_t m_tv_usec; //!< 38 microseconds of timestamp at start time of super-frame processing
uint32_t m_crc32; //!< 42 CRC32 of the above
bool operator==(const RemoteMetaDataFEC& rhs)
{
@ -68,6 +72,10 @@ struct RemoteMetaDataFEC
m_sampleBits = 0;
m_nbOriginalBlocks = 0;
m_nbFECBlocks = 0;
m_deviceCenterFrequency = 0;
m_basebandSampleRate = 1;
m_deviceIndex = 0;
m_channelIndex = 0;
m_tv_sec = 0;
m_tv_usec = 0;
m_crc32 = 0;