diff --git a/plugins/channelrx/demoddatv/datvdemod.h b/plugins/channelrx/demoddatv/datvdemod.h index 4283ffcab..050fb0889 100644 --- a/plugins/channelrx/demoddatv/datvdemod.h +++ b/plugins/channelrx/demoddatv/datvdemod.h @@ -77,7 +77,8 @@ public: void setCNRLabel(QLabel *cnrLabel) { m_basebandSink->setCNRLabel(cnrLabel); } void setMERMeter(LevelMeterSignalDB *merMeter) { m_basebandSink->setMERMeter(merMeter); } void setCNRMeter(LevelMeterSignalDB *cnrMeter) { m_basebandSink->setCNRMeter(cnrMeter); } - DATVideostream *SetVideoRender(DATVideoRender *objScreen) { return m_basebandSink->SetVideoRender(objScreen); } + void SetVideoRender(DATVideoRender *objScreen) { m_basebandSink->SetVideoRender(objScreen); } + DATVideostream *getVideoStream() { return m_basebandSink->getVideoStream(); } bool audioActive() { return m_basebandSink->audioActive(); } bool audioDecodeOK() { return m_basebandSink->audioDecodeOK(); } bool videoActive() { return m_basebandSink->videoActive(); } diff --git a/plugins/channelrx/demoddatv/datvdemodbaseband.h b/plugins/channelrx/demoddatv/datvdemodbaseband.h index 24cacd4a8..063e88547 100644 --- a/plugins/channelrx/demoddatv/datvdemodbaseband.h +++ b/plugins/channelrx/demoddatv/datvdemodbaseband.h @@ -94,7 +94,8 @@ public: void setCNRMeter(LevelMeterSignalDB *cnrMeter) { m_sink.setCNRMeter(cnrMeter); } void setMessageQueueToGUI(MessageQueue *messageQueue) { m_sink.setMessageQueueToGUI(messageQueue); } void setBasebandSampleRate(int sampleRate); //!< To be used when supporting thread is stopped - DATVideostream *SetVideoRender(DATVideoRender *objScreen) { return m_sink.SetVideoRender(objScreen); } + void SetVideoRender(DATVideoRender *objScreen) { m_sink.SetVideoRender(objScreen); } + DATVideostream *getVideoStream() { return m_sink.getVideoStream(); } bool audioActive() { return m_sink.audioActive(); } bool audioDecodeOK() { return m_sink.audioDecodeOK(); } bool videoActive() { return m_sink.videoActive(); } diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp index fb36bf707..8942fbc6e 100644 --- a/plugins/channelrx/demoddatv/datvdemodgui.cpp +++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp @@ -210,8 +210,9 @@ DATVDemodGUI::DATVDemodGUI(PluginAPI* objPluginAPI, DeviceUISet *deviceUISet, Ba m_objDATVDemod->setCNRLabel(ui->cnrText); m_objDATVDemod->setMERMeter(ui->merMeter); m_objDATVDemod->setCNRMeter(ui->cnrMeter); + m_objDATVDemod->SetVideoRender(ui->screenTV_2); - connect(m_objDATVDemod->SetVideoRender(ui->screenTV_2), &DATVideostream::onDataPackets, this, &DATVDemodGUI::on_StreamDataAvailable); + connect(m_objDATVDemod->getVideoStream(), &DATVideostream::onDataPackets, this, &DATVDemodGUI::on_StreamDataAvailable); connect(ui->screenTV_2, &DATVideoRender::onMetaDataChanged, this, &DATVDemodGUI::on_StreamMetaDataChanged); m_intPreviousDecodedData=0; diff --git a/plugins/channelrx/demoddatv/datvdemodsink.cpp b/plugins/channelrx/demoddatv/datvdemodsink.cpp index 9dd3e9c12..72fff27c6 100644 --- a/plugins/channelrx/demoddatv/datvdemodsink.cpp +++ b/plugins/channelrx/demoddatv/datvdemodsink.cpp @@ -35,7 +35,7 @@ DATVDemodSink::DATVDemodSink() : m_blnNeedConfigUpdate(false), m_objRegisteredTVScreen(nullptr), m_objRegisteredVideoRender(nullptr), - m_objVideoStream(nullptr), + m_objVideoStream(new DATVideostream()), m_udpStream(leansdr::tspacket::SIZE), m_objRenderThread(nullptr), m_merLabel(nullptr), @@ -54,24 +54,24 @@ DATVDemodSink::DATVDemodSink() : //*************** DATV PARAMETERS *************** m_blnInitialized=false; ResetDATVFrameworkPointers(); - m_objVideoStream = new DATVideostream(); m_objRFFilter = new fftfilt(-256000.0 / 1024000.0, 256000.0 / 1024000.0, m_rfFilterFftLength); } DATVDemodSink::~DATVDemodSink() { - m_blnInitialized=false; + m_blnInitialized = false; - if (m_objVideoStream) - { - //Immediately exit from DATVideoStream if waiting for data before killing thread - m_objVideoStream->ThreadTimeOut = 0; - m_objVideoStream->deleteLater(); - } + //Immediately exit from DATVideoStream if waiting for data before killing thread + m_objVideoStream->ThreadTimeOut = 0; + m_objVideoStream->deleteLater(); stopVideo(); CleanUpDATVFramework(); + if (m_objRenderThread) { + delete m_objRenderThread; + } + delete m_objRFFilter; } @@ -110,12 +110,11 @@ void DATVDemodSink::setCNRMeter(LevelMeterSignalDB *cnrMeter) { m_cnrMeter = cnrMeter; } -DATVideostream *DATVDemodSink::SetVideoRender(DATVideoRender *objScreen) +void DATVDemodSink::SetVideoRender(DATVideoRender *objScreen) { m_objRegisteredVideoRender = objScreen; m_objRegisteredVideoRender->setAudioFIFO(&m_audioFifo); m_objRenderThread = new DATVideoRenderThread(m_objRegisteredVideoRender, m_objVideoStream); - return m_objVideoStream; } bool DATVDemodSink::audioActive() @@ -453,8 +452,8 @@ void DATVDemodSink::ResetDATVFrameworkPointers() // OUTPUT PREPROCESSED DATA sampler = nullptr; - coeffs_sampler=nullptr; - ncoeffs_sampler=0; + coeffs_sampler = nullptr; + ncoeffs_sampler = 0; p_symbols = nullptr; p_freq = nullptr; @@ -472,8 +471,8 @@ void DATVDemodSink::ResetDATVFrameworkPointers() m_objDemodulator = nullptr; //DECONVOLUTION AND SYNCHRONIZATION - p_bytes=nullptr; - r_deconv=nullptr; + p_bytes = nullptr; + r_deconv = nullptr; r = nullptr; p_descrambled = nullptr; @@ -1312,7 +1311,7 @@ void DATVDemodSink::feed(const SampleVector::const_iterator& begin, const Sample { m_objScheduler->step(); - m_lngReadIQ=0; + m_lngReadIQ = 0; delete p_rawiq_writer; p_rawiq_writer = new leansdr::pipewriter(*p_rawiq); } diff --git a/plugins/channelrx/demoddatv/datvdemodsink.h b/plugins/channelrx/demoddatv/datvdemodsink.h index ab7d29c43..36df3441c 100644 --- a/plugins/channelrx/demoddatv/datvdemodsink.h +++ b/plugins/channelrx/demoddatv/datvdemodsink.h @@ -63,7 +63,8 @@ public: void setCNRLabel(QLabel *cnrLabel); void setMERMeter(LevelMeterSignalDB *merMeter); void setCNRMeter(LevelMeterSignalDB *cnrMeter); - DATVideostream * SetVideoRender(DATVideoRender *objScreen); + void SetVideoRender(DATVideoRender *objScreen); + DATVideostream *getVideoStream() { return m_objVideoStream; } bool audioActive(); bool audioDecodeOK(); bool videoActive();