diff --git a/plugins/channelrx/demodbfm/bfmdemod.cpp b/plugins/channelrx/demodbfm/bfmdemod.cpp index 17440c5b4..8e432c33a 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.cpp +++ b/plugins/channelrx/demodbfm/bfmdemod.cpp @@ -26,7 +26,6 @@ #include #include "dsp/threadedbasebandsamplesink.h" #include "device/devicesourceapi.h" -#include "audio/audionetsink.h" #include "rdsparser.h" #include "bfmdemod.h" @@ -85,8 +84,7 @@ BFMDemod::BFMDemod(DeviceSourceAPI *deviceAPI) : m_audioBufferFill = 0; DSPEngine::instance()->addAudioSink(&m_audioFifo); - m_audioNetSink = new AudioNetSink(this, true); // true = stereo - m_audioNetSink->setDestination(m_settings.m_udpAddress, m_settings.m_udpPort); + m_udpBufferAudio = new UDPSink(this, m_udpBlockSize, m_settings.m_udpPort); m_channelizer = new DownChannelizer(this); m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); @@ -105,7 +103,7 @@ BFMDemod::~BFMDemod() } DSPEngine::instance()->removeAudioSink(&m_audioFifo); - delete m_audioNetSink; + delete m_udpBufferAudio; m_deviceAPI->removeChannelAPI(this); m_deviceAPI->removeThreadedSink(m_threadedChannelizer); @@ -113,11 +111,6 @@ BFMDemod::~BFMDemod() delete m_channelizer; } -bool BFMDemod::isAudioNetSinkRTPCapable() const -{ - return m_audioNetSink && m_audioNetSink->isRTPCapable(); -} - void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst __attribute__((unused))) { Complex ci, cs, cr; @@ -243,17 +236,13 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto { m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume); - if (m_settings.m_copyAudioToUDP) { - m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]); - } + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]); } else { m_audioBuffer[m_audioBufferFill].l = (qint16)(deemph_l * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].r = (qint16)(deemph_r * (1<<12) * m_settings.m_volume); - if (m_settings.m_copyAudioToUDP) { - m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]); - } + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]); } } else @@ -263,9 +252,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto quint16 sample = (qint16)(deemph * (1<<12) * m_settings.m_volume); m_audioBuffer[m_audioBufferFill].l = sample; m_audioBuffer[m_audioBufferFill].r = sample; - if (m_settings.m_copyAudioToUDP) { - m_audioNetSink->write(m_audioBuffer[m_audioBufferFill]); - } + if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(m_audioBuffer[m_audioBufferFill]); } ++m_audioBufferFill; @@ -432,7 +419,6 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) << " m_showPilot: " << settings.m_showPilot << " m_rdsActive: " << settings.m_rdsActive << " m_copyAudioToUDP: " << settings.m_copyAudioToUDP - << " m_copyAudioUseRTP" << settings.m_copyAudioUseRTP << " m_udpAddress: " << settings.m_udpAddress << " m_udpPort: " << settings.m_udpPort << " force: " << force; @@ -497,27 +483,8 @@ void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force) if ((settings.m_udpAddress != m_settings.m_udpAddress) || (settings.m_udpPort != m_settings.m_udpPort) || force) { - m_audioNetSink->setDestination(settings.m_udpAddress, settings.m_udpPort); - } - - if ((settings.m_copyAudioUseRTP != m_settings.m_copyAudioUseRTP) || force) - { - if (settings.m_copyAudioUseRTP) - { - if (m_audioNetSink->selectType(AudioNetSink::SinkRTP)) { - qDebug("BFMDemod::applySettings: set audio sink to RTP mode"); - } else { - qWarning("BFMDemod::applySettings: RTP support for audio sink not available. Fall back too UDP"); - } - } - else - { - if (m_audioNetSink->selectType(AudioNetSink::SinkUDP)) { - qDebug("BFMDemod::applySettings: set audio sink to UDP mode"); - } else { - qWarning("BFMDemod::applySettings: failed to set audio sink to UDP mode"); - } - } + m_udpBufferAudio->setAddress(const_cast(settings.m_udpAddress)); + m_udpBufferAudio->setPort(settings.m_udpPort); } m_settings = settings; diff --git a/plugins/channelrx/demodbfm/bfmdemod.h b/plugins/channelrx/demodbfm/bfmdemod.h index ab4f2c78f..cf0a7ee33 100644 --- a/plugins/channelrx/demodbfm/bfmdemod.h +++ b/plugins/channelrx/demodbfm/bfmdemod.h @@ -33,6 +33,7 @@ #include "dsp/phasediscri.h" #include "audio/audiofifo.h" #include "util/message.h" +#include "util/udpsink.h" #include "rdsparser.h" #include "rdsdecoder.h" @@ -42,7 +43,6 @@ class DeviceSourceAPI; class ThreadedBasebandSampleSink; class DownChannelizer; -class AudioNetSink; class BFMDemod : public BasebandSampleSink, public ChannelSinkAPI { public: @@ -153,7 +153,6 @@ public: } RDSParser& getRDSParser() { return m_rdsParser; } - bool isAudioNetSinkRTPCapable() const; static const QString m_channelIdURI; static const QString m_channelId; @@ -222,7 +221,7 @@ private: static const int default_excursion = 750000; // +/- 75 kHz PhaseDiscriminators m_phaseDiscri; - AudioNetSink *m_audioNetSink; + UDPSink *m_udpBufferAudio; static const int m_udpBlockSize; diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.cpp b/plugins/channelrx/demodbfm/bfmdemodgui.cpp index 24c7179e3..ff1ebcd0b 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodgui.cpp @@ -207,12 +207,6 @@ void BFMDemodGUI::on_copyAudioToUDP_toggled(bool copy) applySettings(); } -void BFMDemodGUI::on_useRTP_toggled(bool checked) -{ - m_settings.m_copyAudioUseRTP = checked; - applySettings(); -} - void BFMDemodGUI::on_showPilot_clicked() { m_settings.m_showPilot = ui->showPilot->isChecked(); @@ -389,7 +383,6 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban ui->g00AltFrequenciesBox->setEnabled(false); ui->g14MappedFrequencies->setEnabled(false); ui->g14AltFrequencies->setEnabled(false); - ui->useRTP->setEnabled(m_bfmDemod->isAudioNetSinkRTPCapable()); rdsUpdateFixedFields(); rdsUpdate(true); @@ -463,10 +456,6 @@ void BFMDemodGUI::displaySettings() ui->rds->setChecked(m_settings.m_rdsActive); ui->copyAudioToUDP->setChecked(m_settings.m_copyAudioToUDP); - if (m_bfmDemod->isAudioNetSinkRTPCapable()) { - ui->useRTP->setChecked(m_settings.m_copyAudioUseRTP); - } - blockApplySettings(false); } diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.h b/plugins/channelrx/demodbfm/bfmdemodgui.h index 629a50ee0..a008bb22b 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.h +++ b/plugins/channelrx/demodbfm/bfmdemodgui.h @@ -109,7 +109,6 @@ private slots: void on_showPilot_clicked(); void on_rds_clicked(); void on_copyAudioToUDP_toggled(bool copy); - void on_useRTP_toggled(bool checked); void on_g14ProgServiceNames_currentIndexChanged(int index); void on_clearData_clicked(bool checked); void on_g00AltFrequenciesBox_activated(int index); diff --git a/plugins/channelrx/demodbfm/bfmdemodgui.ui b/plugins/channelrx/demodbfm/bfmdemodgui.ui index 92f9f8be8..7894e4185 100644 --- a/plugins/channelrx/demodbfm/bfmdemodgui.ui +++ b/plugins/channelrx/demodbfm/bfmdemodgui.ui @@ -321,19 +321,6 @@ - - - - Use RTP protocol for copy audio to UDP - - - R - - - true - - - diff --git a/plugins/channelrx/demodbfm/bfmdemodsettings.cpp b/plugins/channelrx/demodbfm/bfmdemodsettings.cpp index f5d0bdfbe..1c6d1cd13 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsettings.cpp +++ b/plugins/channelrx/demodbfm/bfmdemodsettings.cpp @@ -47,7 +47,6 @@ void BFMDemodSettings::resetToDefaults() m_showPilot = false; m_rdsActive = false; m_copyAudioToUDP = false; - m_copyAudioUseRTP = false; m_udpAddress = "127.0.0.1"; m_udpPort = 9999; m_rgbColor = QColor(80, 120, 228).rgb(); @@ -76,7 +75,6 @@ QByteArray BFMDemodSettings::serialize() const } s.writeString(12, m_title); - s.writeBool(13, m_copyAudioUseRTP); return s.final(); } @@ -125,7 +123,6 @@ bool BFMDemodSettings::deserialize(const QByteArray& data) } d.readString(12, &m_title, "Broadcast FM Demod"); - d.readBool(13, &m_copyAudioUseRTP, false); return true; } diff --git a/plugins/channelrx/demodbfm/bfmdemodsettings.h b/plugins/channelrx/demodbfm/bfmdemodsettings.h index 38e1678f9..b79f6e114 100644 --- a/plugins/channelrx/demodbfm/bfmdemodsettings.h +++ b/plugins/channelrx/demodbfm/bfmdemodsettings.h @@ -34,7 +34,6 @@ struct BFMDemodSettings bool m_showPilot; bool m_rdsActive; bool m_copyAudioToUDP; - bool m_copyAudioUseRTP; QString m_udpAddress; quint16 m_udpPort; quint32 m_rgbColor; diff --git a/plugins/channelrx/demodbfm/bfmplugin.cpp b/plugins/channelrx/demodbfm/bfmplugin.cpp index b32e815e9..1e0217d53 100644 --- a/plugins/channelrx/demodbfm/bfmplugin.cpp +++ b/plugins/channelrx/demodbfm/bfmplugin.cpp @@ -25,7 +25,7 @@ const PluginDescriptor BFMPlugin::m_pluginDescriptor = { QString("Broadcast FM Demodulator"), - QString("3.12.0"), + QString("3.10.1"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true,