mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
DATV modulator: API enhancements and GUI cosmetic fixes
This commit is contained in:
parent
ed4a1532d4
commit
9f42957585
@ -498,7 +498,22 @@ void DATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
|
||||
void DATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
response.getDatvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
||||
response.getDatvModReport()->setChannelSampleRate(m_basebandSource->getChannelSampleRate());
|
||||
int tsBitrate = 0, tsSize = 0, channelSampleRate = 0, dataRate = 0;
|
||||
int64_t udpBytes = 0;
|
||||
|
||||
if (m_basebandSource)
|
||||
{
|
||||
channelSampleRate = m_basebandSource->getChannelSampleRate();
|
||||
m_basebandSource->geTsFileInfos(tsBitrate, tsSize);
|
||||
udpBytes = m_basebandSource->getUdpByteCount();
|
||||
dataRate = m_basebandSource->getDataRate();
|
||||
}
|
||||
|
||||
response.getDatvModReport()->setChannelSampleRate(channelSampleRate);
|
||||
response.getDatvModReport()->setDataRate(dataRate);
|
||||
response.getDatvModReport()->setTsFileBitrate(tsBitrate);
|
||||
response.getDatvModReport()->setTsFileLength(tsSize);
|
||||
response.getDatvModReport()->setUdpByteCount(udpBytes);
|
||||
}
|
||||
|
||||
void DATVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const DATVModSettings& settings, bool force)
|
||||
|
@ -45,8 +45,10 @@ public:
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
void setMessageQueueToGUI(MessageQueue *messageQueue) { m_source.setMessageQueueToGUI(messageQueue); }
|
||||
double getMagSq() const { return m_source.getMagSq(); }
|
||||
void geTsFileInfos(int& mpegTSBitrate, int& mpegTSSize) const { m_source.geTsFileInfos(mpegTSBitrate, mpegTSSize); }
|
||||
int64_t getUdpByteCount() const { return m_source.getUdpByteCount(); }
|
||||
int getDataRate() const { return m_source.getDataRate(); }
|
||||
int getChannelSampleRate() const;
|
||||
|
||||
int getEffectiveSampleRate() const { return m_source.getEffectiveSampleRate(); }
|
||||
|
||||
signals:
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>463</width>
|
||||
<width>543</width>
|
||||
<height>235</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -39,7 +39,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>451</width>
|
||||
<width>541</width>
|
||||
<height>221</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -363,13 +363,6 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fecLabel">
|
||||
<property name="text">
|
||||
@ -379,6 +372,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fec">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Forward error correction code rate</string>
|
||||
</property>
|
||||
@ -409,15 +408,14 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="modulationLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Modulation</string>
|
||||
</property>
|
||||
@ -425,6 +423,12 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="modulation">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Modulation type</string>
|
||||
</property>
|
||||
@ -440,15 +444,14 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="rollOffLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>45</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Roll off</string>
|
||||
</property>
|
||||
@ -458,7 +461,7 @@
|
||||
<widget class="QComboBox" name="rollOff">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -77,7 +77,7 @@ int DATVModSource::getTSBitrate(const QString& filename)
|
||||
}
|
||||
|
||||
// Get data bitrate (i.e. excluding FEC overhead)
|
||||
int DATVModSource::getDVBSDataBitrate(const DATVModSettings& settings)
|
||||
int DATVModSource::getDVBSDataBitrate(const DATVModSettings& settings) const
|
||||
{
|
||||
float fecFactor;
|
||||
float plFactor;
|
||||
@ -216,6 +216,8 @@ void DATVModSource::checkBitrates()
|
||||
}
|
||||
|
||||
DATVModSource::DATVModSource() :
|
||||
m_mpegTSBitrate(0),
|
||||
m_mpegTSSize(0),
|
||||
m_sampleIdx(0),
|
||||
m_frameIdx(0),
|
||||
m_frameCount(0),
|
||||
@ -226,6 +228,7 @@ DATVModSource::DATVModSource() :
|
||||
m_samplesPerSymbol(1),
|
||||
m_udpSocket(nullptr),
|
||||
m_udpByteCount(0),
|
||||
m_udpAbsByteCount(0),
|
||||
m_udpBufferIdx(0),
|
||||
m_udpBufferCount(0),
|
||||
m_udpMaxBufferUtilization(0),
|
||||
@ -372,6 +375,7 @@ void DATVModSource::modulateSample()
|
||||
}
|
||||
|
||||
m_udpByteCount += ba.size();
|
||||
m_udpAbsByteCount += ba.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -579,10 +583,12 @@ void DATVModSource::reportUDPBitrate()
|
||||
boost::chrono::duration<double> sec = boost::chrono::steady_clock::now() - m_udpTimingStart;
|
||||
double seconds = sec.count();
|
||||
int bitrate = seconds > 0.0 ? m_udpByteCount * 8 / seconds : 0;
|
||||
if (getMessageQueueToGUI())
|
||||
getMessageQueueToGUI()->push(DATVModReport::MsgReportUDPBitrate::create(bitrate));
|
||||
m_udpTimingStart = boost::chrono::steady_clock::now();
|
||||
m_udpByteCount = 0;
|
||||
|
||||
if (getMessageQueueToGUI()) {
|
||||
getMessageQueueToGUI()->push(DATVModReport::MsgReportUDPBitrate::create(bitrate));
|
||||
}
|
||||
}
|
||||
|
||||
void DATVModSource::updateUDPBufferUtilization()
|
||||
@ -602,8 +608,13 @@ void DATVModSource::reportUDPBufferUtilization()
|
||||
{
|
||||
// Report maximum utilization since last call
|
||||
updateUDPBufferUtilization();
|
||||
|
||||
if (getMessageQueueToGUI())
|
||||
getMessageQueueToGUI()->push(DATVModReport::MsgReportUDPBufferUtilization::create(m_udpMaxBufferUtilization / (float)DATVModSettings::m_udpBufferSize * 100.0));
|
||||
{
|
||||
getMessageQueueToGUI()->push(DATVModReport::MsgReportUDPBufferUtilization::create(
|
||||
m_udpMaxBufferUtilization / (float)DATVModSettings::m_udpBufferSize * 100.0));
|
||||
}
|
||||
|
||||
m_udpMaxBufferUtilization = 0;
|
||||
}
|
||||
|
||||
@ -635,8 +646,9 @@ void DATVModSource::applyChannelSettings(int channelSampleRate, int channelFrequ
|
||||
if (getMessageQueueToGUI())
|
||||
{
|
||||
getMessageQueueToGUI()->push(DATVModReport::MsgReportRates::create(
|
||||
channelSampleRate, m_sampleRate,
|
||||
getDVBSDataBitrate(m_settings)));
|
||||
channelSampleRate,
|
||||
m_sampleRate,
|
||||
getDVBSDataBitrate(m_settings)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -713,6 +725,7 @@ void DATVModSource::applySettings(const DATVModSettings& settings, bool force)
|
||||
m_udpSocket->setSocketOption(QAbstractSocket::ReceiveBufferSizeSocketOption, DATVModSettings::m_udpBufferSize);
|
||||
m_udpTimingStart = boost::chrono::steady_clock::now();
|
||||
m_udpByteCount = 0;
|
||||
m_udpAbsByteCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,12 @@ public:
|
||||
peakLevel = m_peakLevelOut;
|
||||
numSamples = m_levelNbSamples;
|
||||
}
|
||||
void geTsFileInfos(int& mpegTSBitrate, int& mpegTSSize) const {
|
||||
mpegTSBitrate = m_mpegTSBitrate;
|
||||
mpegTSSize = (int) m_mpegTSSize;
|
||||
}
|
||||
int64_t getUdpByteCount() const { return m_udpAbsByteCount; }
|
||||
int getDataRate() const { return getDVBSDataBitrate(m_settings); }
|
||||
|
||||
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
|
||||
void applySettings(const DATVModSettings& settings, bool force = false);
|
||||
@ -96,6 +102,7 @@ private:
|
||||
|
||||
QUdpSocket *m_udpSocket; //!< UDP socket to receive MPEG transport stream via
|
||||
int m_udpByteCount; //!< Count of bytes received via UDP for bitrate calculation
|
||||
int64_t m_udpAbsByteCount; //!< Count of bytes received via UDP since the begining
|
||||
boost::chrono::steady_clock::time_point m_udpTimingStart; //!< When we last started counting UDP bytes
|
||||
uint8_t m_udpBuffer[188*10];
|
||||
int m_udpBufferIdx; //!< TS frame index into buffer
|
||||
@ -131,7 +138,7 @@ private:
|
||||
void modulateSample();
|
||||
|
||||
int getTSBitrate(const QString& filename);
|
||||
int getDVBSDataBitrate(const DATVModSettings& settings);
|
||||
int getDVBSDataBitrate(const DATVModSettings& settings) const;
|
||||
void checkBitrates();
|
||||
void updateUDPBufferUtilization();
|
||||
|
||||
|
@ -3892,6 +3892,19 @@ margin-bottom: 20px;
|
||||
},
|
||||
"channelSampleRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"dataRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"tsFileBitrate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"tsFileLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"udpByteCount" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
}
|
||||
},
|
||||
"description" : "DATVMod"
|
||||
@ -51005,7 +51018,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2021-10-12T21:36:57.091+02:00
|
||||
Generated 2021-10-19T22:10:34.002+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,3 +68,12 @@ DATVModReport:
|
||||
format: float
|
||||
channelSampleRate:
|
||||
type: integer
|
||||
dataRate:
|
||||
type: integer
|
||||
tsFileBitrate:
|
||||
type: integer
|
||||
tsFileLength:
|
||||
type: integer
|
||||
udpByteCount:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -68,3 +68,12 @@ DATVModReport:
|
||||
format: float
|
||||
channelSampleRate:
|
||||
type: integer
|
||||
dataRate:
|
||||
type: integer
|
||||
tsFileBitrate:
|
||||
type: integer
|
||||
tsFileLength:
|
||||
type: integer
|
||||
udpByteCount:
|
||||
type: integer
|
||||
format: int64
|
||||
|
@ -3892,6 +3892,19 @@ margin-bottom: 20px;
|
||||
},
|
||||
"channelSampleRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"dataRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"tsFileBitrate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"tsFileLength" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"udpByteCount" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
}
|
||||
},
|
||||
"description" : "DATVMod"
|
||||
@ -51005,7 +51018,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2021-10-12T21:36:57.091+02:00
|
||||
Generated 2021-10-19T22:10:34.002+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -32,6 +32,14 @@ SWGDATVModReport::SWGDATVModReport() {
|
||||
m_channel_power_db_isSet = false;
|
||||
channel_sample_rate = 0;
|
||||
m_channel_sample_rate_isSet = false;
|
||||
data_rate = 0;
|
||||
m_data_rate_isSet = false;
|
||||
ts_file_bitrate = 0;
|
||||
m_ts_file_bitrate_isSet = false;
|
||||
ts_file_length = 0;
|
||||
m_ts_file_length_isSet = false;
|
||||
udp_byte_count = 0L;
|
||||
m_udp_byte_count_isSet = false;
|
||||
}
|
||||
|
||||
SWGDATVModReport::~SWGDATVModReport() {
|
||||
@ -44,12 +52,24 @@ SWGDATVModReport::init() {
|
||||
m_channel_power_db_isSet = false;
|
||||
channel_sample_rate = 0;
|
||||
m_channel_sample_rate_isSet = false;
|
||||
data_rate = 0;
|
||||
m_data_rate_isSet = false;
|
||||
ts_file_bitrate = 0;
|
||||
m_ts_file_bitrate_isSet = false;
|
||||
ts_file_length = 0;
|
||||
m_ts_file_length_isSet = false;
|
||||
udp_byte_count = 0L;
|
||||
m_udp_byte_count_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
SWGDATVModReport::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGDATVModReport*
|
||||
@ -67,6 +87,14 @@ SWGDATVModReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&data_rate, pJson["dataRate"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&ts_file_bitrate, pJson["tsFileBitrate"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&ts_file_length, pJson["tsFileLength"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&udp_byte_count, pJson["udpByteCount"], "qint64", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -89,6 +117,18 @@ SWGDATVModReport::asJsonObject() {
|
||||
if(m_channel_sample_rate_isSet){
|
||||
obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
|
||||
}
|
||||
if(m_data_rate_isSet){
|
||||
obj->insert("dataRate", QJsonValue(data_rate));
|
||||
}
|
||||
if(m_ts_file_bitrate_isSet){
|
||||
obj->insert("tsFileBitrate", QJsonValue(ts_file_bitrate));
|
||||
}
|
||||
if(m_ts_file_length_isSet){
|
||||
obj->insert("tsFileLength", QJsonValue(ts_file_length));
|
||||
}
|
||||
if(m_udp_byte_count_isSet){
|
||||
obj->insert("udpByteCount", QJsonValue(udp_byte_count));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -113,6 +153,46 @@ SWGDATVModReport::setChannelSampleRate(qint32 channel_sample_rate) {
|
||||
this->m_channel_sample_rate_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGDATVModReport::getDataRate() {
|
||||
return data_rate;
|
||||
}
|
||||
void
|
||||
SWGDATVModReport::setDataRate(qint32 data_rate) {
|
||||
this->data_rate = data_rate;
|
||||
this->m_data_rate_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGDATVModReport::getTsFileBitrate() {
|
||||
return ts_file_bitrate;
|
||||
}
|
||||
void
|
||||
SWGDATVModReport::setTsFileBitrate(qint32 ts_file_bitrate) {
|
||||
this->ts_file_bitrate = ts_file_bitrate;
|
||||
this->m_ts_file_bitrate_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGDATVModReport::getTsFileLength() {
|
||||
return ts_file_length;
|
||||
}
|
||||
void
|
||||
SWGDATVModReport::setTsFileLength(qint32 ts_file_length) {
|
||||
this->ts_file_length = ts_file_length;
|
||||
this->m_ts_file_length_isSet = true;
|
||||
}
|
||||
|
||||
qint64
|
||||
SWGDATVModReport::getUdpByteCount() {
|
||||
return udp_byte_count;
|
||||
}
|
||||
void
|
||||
SWGDATVModReport::setUdpByteCount(qint64 udp_byte_count) {
|
||||
this->udp_byte_count = udp_byte_count;
|
||||
this->m_udp_byte_count_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGDATVModReport::isSet(){
|
||||
@ -124,6 +204,18 @@ SWGDATVModReport::isSet(){
|
||||
if(m_channel_sample_rate_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_data_rate_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_ts_file_bitrate_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_ts_file_length_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
if(m_udp_byte_count_isSet){
|
||||
isObjectUpdated = true; break;
|
||||
}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -47,6 +47,18 @@ public:
|
||||
qint32 getChannelSampleRate();
|
||||
void setChannelSampleRate(qint32 channel_sample_rate);
|
||||
|
||||
qint32 getDataRate();
|
||||
void setDataRate(qint32 data_rate);
|
||||
|
||||
qint32 getTsFileBitrate();
|
||||
void setTsFileBitrate(qint32 ts_file_bitrate);
|
||||
|
||||
qint32 getTsFileLength();
|
||||
void setTsFileLength(qint32 ts_file_length);
|
||||
|
||||
qint64 getUdpByteCount();
|
||||
void setUdpByteCount(qint64 udp_byte_count);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -57,6 +69,18 @@ private:
|
||||
qint32 channel_sample_rate;
|
||||
bool m_channel_sample_rate_isSet;
|
||||
|
||||
qint32 data_rate;
|
||||
bool m_data_rate_isSet;
|
||||
|
||||
qint32 ts_file_bitrate;
|
||||
bool m_ts_file_bitrate_isSet;
|
||||
|
||||
qint32 ts_file_length;
|
||||
bool m_ts_file_length_isSet;
|
||||
|
||||
qint64 udp_byte_count;
|
||||
bool m_udp_byte_count_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user