SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
datvdemod.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 F4HKW //
3 // for F4EXB / SDRAngel //
4 // using LeanSDR Framework (C) 2016 F4DAV //
5 // //
6 // This program is free software; you can redistribute it and/or modify //
7 // it under the terms of the GNU General Public License as published by //
8 // the Free Software Foundation as version 3 of the License, or //
9 // (at your option) any later version. //
10 // //
11 // This program is distributed in the hope that it will be useful, //
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14 // GNU General Public License V3 for more details. //
15 // //
16 // You should have received a copy of the GNU General Public License //
17 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
19 
20 #include "datvdemod.h"
21 
22 #include "leansdr/dvbs2.h"
23 
24 #include <QTime>
25 #include <QDebug>
26 #include <stdio.h>
27 #include <complex.h>
28 #include "audio/audiooutput.h"
29 #include "dsp/dspengine.h"
30 
31 #include "dsp/downchannelizer.h"
33 #include "device/deviceapi.h"
34 
35 const QString DATVDemod::m_channelIdURI = "sdrangel.channel.demoddatv";
36 const QString DATVDemod::m_channelId = "DATVDemod";
37 
41 
43  ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
44  m_blnNeedConfigUpdate(false),
45  m_deviceAPI(deviceAPI),
46  m_objRegisteredTVScreen(0),
47  m_objRegisteredVideoRender(0),
48  m_objVideoStream(nullptr),
49  m_udpStream(leansdr::tspacket::SIZE),
50  m_objRenderThread(nullptr),
51  m_audioFifo(48000),
52  m_blnRenderingVideo(false),
53  m_blnStartStopVideo(false),
54  m_cstlnSetByModcod(false),
55  m_modcodModulation(-1),
56  m_modcodCodeRate(-1),
57  m_enmModulation(DATVDemodSettings::BPSK /*DATV_FM1*/),
58  m_sampleRate(1024000),
59  m_objSettingsMutex(QMutex::NonRecursive)
60 {
61  setObjectName("DATVDemod");
62 
63  DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(&m_audioFifo, getInputMessageQueue());
64  //m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate();
65 
66  //*************** DATV PARAMETERS ***************
67  m_blnInitialized=false;
68  CleanUpDATVFramework(false);
69 
70  m_objVideoStream = new DATVideostream();
71 
72  m_objRFFilter = new fftfilt(-256000.0 / 1024000.0, 256000.0 / 1024000.0, rfFilterFftLength);
73 
74  m_channelizer = new DownChannelizer(this);
75  m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this);
76  m_deviceAPI->addChannelSink(m_threadedChannelizer);
77  m_deviceAPI->addChannelSinkAPI(this);
78 }
79 
81 {
82  m_blnInitialized=false;
83 
84  if(m_objVideoStream!=nullptr)
85  {
86  //Immediately exit from DATVideoStream if waiting for data before killing thread
88  }
89 
91 
92  if(m_objRenderThread!=nullptr)
93  {
94  if(m_objRenderThread->isRunning())
95  {
97  m_objRenderThread->quit();
98  }
99 
100  m_objRenderThread->wait(2000);
101  }
102 
103  CleanUpDATVFramework(true);
104 
107  delete m_threadedChannelizer;
108  delete m_channelizer;
109  delete m_objRFFilter;
110 }
111 
113 {
114  m_objRegisteredTVScreen = objScreen;
115  return true;
116 }
117 
119 {
120  m_objRegisteredVideoRender = objScreen;
123  return m_objVideoStream;
124 }
125 
127 {
130  } else {
131  return false;
132  }
133 }
134 
136 {
139  } else {
140  return false;
141  }
142 }
143 
145 {
148  } else {
149  return false;
150  }
151 }
152 
154 {
157  } else {
158  return false;
159  }
160 }
161 
162 bool DATVDemod::PlayVideo(bool blnStartStop)
163 {
164 
165  if (m_objVideoStream == nullptr) {
166  return false;
167  }
168 
169  if (m_objRegisteredVideoRender == nullptr) {
170  return false;
171  }
172 
173  if (m_objRenderThread == nullptr) {
174  return false;
175  }
176 
177  if (m_blnStartStopVideo && !blnStartStop) {
178  return true;
179  }
180 
181  if (blnStartStop == true) {
182  m_blnStartStopVideo = true;
183  }
184 
185  if (m_objRenderThread->isRunning())
186  {
187  if (blnStartStop == true) {
189  }
190 
191  return true;
192  }
193 
194  if (m_objVideoStream->bytesAvailable() > 0)
195  {
198  m_objVideoStream->ThreadTimeOut = 5000; //5000 ms
199  m_objRenderThread->start();
200  }
201 
202  return true;
203 }
204 
205 void DATVDemod::CleanUpDATVFramework(bool blnRelease)
206 {
207  if (blnRelease == true)
208  {
209  if (m_objScheduler != nullptr)
210  {
212  delete m_objScheduler;
213  }
214 
215  // NOTCH FILTER
216 
217  if (r_auto_notch != nullptr) {
218  delete r_auto_notch;
219  }
220  if (p_autonotched != nullptr) {
221  delete p_autonotched;
222  }
223 
224  // FREQUENCY CORRECTION : DEROTATOR
225  if (p_derot != nullptr) {
226  delete p_derot;
227  }
228  if (r_derot != nullptr) {
229  delete r_derot;
230  }
231 
232  // CNR ESTIMATION
233  if (p_cnr != nullptr) {
234  delete p_cnr;
235  }
236  if (r_cnr != nullptr) {
237  delete r_cnr;
238  }
239 
240  //FILTERING
241  if (r_resample != nullptr) {
242  delete r_resample;
243  }
244  if (p_resampled != nullptr) {
245  delete p_resampled;
246  }
247  if (coeffs != nullptr) {
248  delete coeffs;
249  }
250 
251  // OUTPUT PREPROCESSED DATA
252  if (sampler != nullptr) {
253  delete sampler;
254  }
255  if (coeffs_sampler != nullptr) {
256  delete coeffs_sampler;
257  }
258  if (p_symbols != nullptr) {
259  delete p_symbols;
260  }
261  if (p_freq != nullptr) {
262  delete p_freq;
263  }
264  if (p_ss != nullptr) {
265  delete p_ss;
266  }
267  if (p_mer != nullptr) {
268  delete p_mer;
269  }
270  if (p_sampled != nullptr) {
271  delete p_sampled;
272  }
273 
274  //DECIMATION
275  if (p_decimated != nullptr) {
276  delete p_decimated;
277  }
278  if (p_decim != nullptr) {
279  delete p_decim;
280  }
281  if (r_ppout != nullptr) {
282  delete r_ppout;
283  }
284 
285  //GENERIC CONSTELLATION RECEIVER
286  if (m_objDemodulator != nullptr) {
287  delete m_objDemodulator;
288  }
289 
290  //DECONVOLUTION AND SYNCHRONIZATION
291  if (p_bytes != nullptr) {
292  delete p_bytes;
293  }
294  if (r_deconv != nullptr) {
295  delete r_deconv;
296  }
297  if (r != nullptr) {
298  delete r;
299  }
300  if (p_descrambled != nullptr) {
301  delete p_descrambled;
302  }
303  if (p_frames != nullptr) {
304  delete p_frames;
305  }
306  if (r_etr192_descrambler != nullptr) {
307  delete r_etr192_descrambler;
308  }
309  if (r_sync != nullptr) {
310  delete r_sync;
311  }
312  if (p_mpegbytes != nullptr) {
313  delete p_mpegbytes;
314  }
315  if (p_lock != nullptr) {
316  delete p_lock;
317  }
318  if (p_locktime != nullptr) {
319  delete p_locktime;
320  }
321  if (r_sync_mpeg != nullptr) {
322  delete r_sync_mpeg;
323  }
324 
325  // DEINTERLEAVING
326  if (p_rspackets != nullptr) {
327  delete p_rspackets;
328  }
329  if (r_deinter != nullptr) {
330  delete r_deinter;
331  }
332  if (p_vbitcount != nullptr) {
333  delete p_vbitcount;
334  }
335  if (p_verrcount != nullptr) {
336  delete p_verrcount;
337  }
338  if (p_rtspackets != nullptr) {
339  delete p_rtspackets;
340  }
341  if (r_rsdec != nullptr) {
342  delete r_rsdec;
343  }
344 
345  //BER ESTIMATION
346  if (p_vber != nullptr) {
347  delete p_vber;
348  }
349  if (r_vber != nullptr) {
350  delete r_vber;
351  }
352 
353  // DERANDOMIZATION
354  if (p_tspackets != nullptr) {
355  delete p_tspackets;
356  }
357  if (r_derand != nullptr) {
358  delete r_derand;
359  }
360 
361  //OUTPUT : To remove
362  if (r_stdout != nullptr) {
363  delete r_stdout;
364  }
365  if (r_videoplayer != nullptr) {
366  delete r_videoplayer;
367  }
368 
369  //CONSTELLATION
370  if (r_scope_symbols != nullptr) {
371  delete r_scope_symbols;
372  }
373 
374  // INPUT
375  //if(p_rawiq!=nullptr) delete p_rawiq;
376  //if(p_rawiq_writer!=nullptr) delete p_rawiq_writer;
377  //if(p_preprocessed!=nullptr) delete p_preprocessed;
378 
379  //DVB-S2
380 
381  if(p_slots_dvbs2 != nullptr)
382  {
384  }
385 
386  if(p_cstln != nullptr)
387  {
388  delete p_cstln;
389  }
390 
391  if(p_cstln_pls != nullptr)
392  {
393  delete p_cstln_pls;
394  }
395 
396  if(p_framelock != nullptr)
397  {
398  delete p_framelock;
399  }
400 
401  if(m_objDemodulatorDVBS2 != nullptr)
402  {
404  }
405 
406  if(p_fecframes != nullptr)
407  {
409  }
410 
411  if(p_bbframes != nullptr)
412  {
414  }
415 
416  if(p_s2_deinterleaver != nullptr)
417  {
419  }
420 
421  if(r_fecdec != nullptr)
422  {
424  }
425 
426  if(p_deframer != nullptr)
427  {
429  }
430 
431  if(r_scope_symbols_dvbs2 != nullptr)
432  {
433  delete r_scope_symbols_dvbs2;
434  }
435  }
436 
437  m_objScheduler=nullptr;
438 
439  // INPUT
440 
441  p_rawiq = nullptr;
442  p_rawiq_writer = nullptr;
443 
444  p_preprocessed = nullptr;
445 
446  // NOTCH FILTER
447  r_auto_notch = nullptr;
448  p_autonotched = nullptr;
449 
450  // FREQUENCY CORRECTION : DEROTATOR
451  p_derot = nullptr;
452  r_derot=nullptr;
453 
454  // CNR ESTIMATION
455  p_cnr = nullptr;
456  r_cnr = nullptr;
457 
458  //FILTERING
459  r_resample = nullptr;
460  p_resampled = nullptr;
461  coeffs = nullptr;
462  ncoeffs=0;
463 
464  // OUTPUT PREPROCESSED DATA
465  sampler = nullptr;
466  coeffs_sampler=nullptr;
467  ncoeffs_sampler=0;
468 
469  p_symbols = nullptr;
470  p_freq = nullptr;
471  p_ss = nullptr;
472  p_mer = nullptr;
473  p_sampled = nullptr;
474 
475  //DECIMATION
476  p_decimated = nullptr;
477  p_decim = nullptr;
478  r_ppout = nullptr;
479 
480  //GENERIC CONSTELLATION RECEIVER
481  m_objDemodulator = nullptr;
482 
483  //DECONVOLUTION AND SYNCHRONIZATION
484  p_bytes=nullptr;
485  r_deconv=nullptr;
486  r = nullptr;
487 
488  p_descrambled = nullptr;
489  p_frames = nullptr;
490  r_etr192_descrambler = nullptr;
491  r_sync = nullptr;
492 
493  p_mpegbytes = nullptr;
494  p_lock = nullptr;
495  p_locktime = nullptr;
496  r_sync_mpeg = nullptr;
497 
498 
499  // DEINTERLEAVING
500  p_rspackets = nullptr;
501  r_deinter = nullptr;
502 
503  p_vbitcount = nullptr;
504  p_verrcount = nullptr;
505  p_rtspackets = nullptr;
506  r_rsdec = nullptr;
507 
508 
509  //BER ESTIMATION
510  p_vber = nullptr;
511  r_vber = nullptr;
512 
513 
514  // DERANDOMIZATION
515  p_tspackets = nullptr;
516  r_derand = nullptr;
517 
518 
519  //OUTPUT : To remove void *
520  r_stdout = nullptr;
521  r_videoplayer = nullptr;
522 
523 
524  //CONSTELLATION
525  r_scope_symbols = nullptr;
526 
527  //DVB-S2
528  p_slots_dvbs2 = nullptr;
529  p_cstln = nullptr;
530  p_cstln_pls = nullptr;
531  p_framelock = nullptr;
532  m_objDemodulatorDVBS2 = nullptr;
533  p_fecframes = nullptr;
534  p_bbframes = nullptr;
535  p_s2_deinterleaver = nullptr;
536  r_fecdec = nullptr;
537  p_deframer = nullptr;
538  r_scope_symbols_dvbs2 = nullptr;
539 }
540 
542 {
543  m_blnDVBInitialized = false;
544  m_lngReadIQ = 0;
545  CleanUpDATVFramework(false);
546 
547  qDebug() << "DATVDemod::InitDATVFramework:"
548  << " Standard: " << m_settings.m_standard
549  << " Symbol Rate: " << m_settings.m_symbolRate
550  << " Modulation: " << m_settings.m_modulation
551  << " Notch Filters: " << m_settings.m_notchFilters
552  << " Allow Drift: " << m_settings.m_allowDrift
553  << " Fast Lock: " << m_settings.m_fastLock
554  << " Filter: " << m_settings.m_filter
555  << " HARD METRIC: " << m_settings.m_hardMetric
556  << " RollOff: " << m_settings.m_rollOff
557  << " Viterbi: " << m_settings.m_viterbi
558  << " Excursion: " << m_settings.m_excursion
559  << " Sample rate: " << m_sampleRate;
560 
562 
564  m_objCfg.Fs = (float) m_sampleRate;
567 
570  m_objCfg.rrc_rej = (float) m_settings.m_excursion; //dB
571  m_objCfg.rrc_steps = 0; //auto
572 
573  switch(m_settings.m_modulation)
574  {
577  break;
580  break;
583  break;
586  break;
589  break;
592  break;
595  break;
598  break;
601  break;
602  default:
604  break;
605  }
606 
612 
613  // Min buffer size for baseband data
614  // scopes: 1024
615  // ss_estimator: 1024
616  // anf: 4096
617  // cstln_receiver: reads in chunks of 128+1
619 
620  // Min buffer size for IQ symbols
621  // cstln_receiver: writes in chunks of 128/omega symbols (margin 128)
622  // deconv_sync: reads at least 64+32
623  // A larger buffer improves performance significantly.
625 
626  // Min buffer size for unsynchronized bytes
627  // deconv_sync: writes 32 bytes
628  // mpeg_sync: reads up to 204*scan_syncs = 1632 bytes
629  BUF_BYTES = 2048 * m_objCfg.buf_factor;
630 
631  // Min buffer size for synchronized (but interleaved) bytes
632  // mpeg_sync: writes 1 rspacket
633  // deinterleaver: reads 17*11*12+204 = 2448 bytes
635 
636  // Min buffer size for packets: 1
638 
639  // Min buffer size for misc measurements: 1
641 
643 
645 
646  //***************
650 
651  // NOTCH FILTER
652 
653  if (m_objCfg.anf>0)
654  {
657  p_preprocessed = p_autonotched;
658  }
659 
660 
661  // FREQUENCY CORRECTION
662 
663  //******** -> if ( m_objCfg.Fderot>0 )
664 
665  // CNR ESTIMATION
666 
668 
669  if (m_objCfg.cnr == true)
670  {
672  r_cnr->decimation = decimation(m_objCfg.Fs, 1); // 1 Hz
673  }
674 
675  // FILTERING
676 
677  int decim = 1;
678 
679  //******** -> if ( m_objCfg.resample )
680 
681 
682  // DECIMATION
683  // (Unless already done in resampler)
684 
685  //******** -> if ( !m_objCfg.resample && m_objCfg.decim>1 )
686 
687  //Resampling FS
688 
689 
690  // Generic constellation receiver
691 
697 
698  switch (m_objCfg.sampler)
699  {
702  break;
705  break;
707  {
708  if (m_objCfg.rrc_steps == 0)
709  {
710  // At least 64 discrete sampling points between symbols
711  m_objCfg.rrc_steps = std::max(1, (int)(64*m_objCfg.Fm / m_objCfg.Fs));
712  }
713 
714  float Frrc = m_objCfg.Fs * m_objCfg.rrc_steps; // Sample freq of the RRC filter
715  float transition = (m_objCfg.Fm/2) * m_objCfg.rolloff;
716  int order = m_objCfg.rrc_rej * Frrc / (22*transition);
719  break;
720  }
721  default:
722  qCritical("DATVDemod::InitDATVFramework: Interpolator not implemented");
723  return;
724  }
725 
728  sampler,
730  *p_symbols,
731  p_freq,
732  p_ss,
733  p_mer,
734  p_sampled);
735 
737  {
740  {
741  qWarning("DATVDemod::InitDATVFramework: non-standard constellation for DVB-S");
742  }
743  }
744 
746  {
747  // For DVB-S2 testing only.
748  // Constellation should be determined from PL signalling.
749  qDebug("DATVDemod::InitDATVFramework: DVB-S2: Testing symbol sampler only.");
750  }
751 
752  m_objDemodulator->cstln = make_dvbs_constellation(m_objCfg.constellation, m_objCfg.fec);
753 
754  if (m_objCfg.hard_metric) {
756  }
757 
759 
760  //******** if ( m_objCfg.Ftune )
761  //{
762  // m_objDemodulator->set_freq(m_objCfg.Ftune/m_objCfg.Fs);
763  //}
764 
765  if (m_objCfg.allow_drift) {
767  }
768 
769  //******** -> if ( m_objCfg.viterbi )
770  if (m_objCfg.viterbi) {
772  }
773 
775 
776  // TRACKING FILTERS
777 
778  if (r_cnr)
779  {
781  r_cnr->tap_multiplier = 1.0 / decim;
782  }
783 
784  //constellation
785 
787  {
788  qDebug("DATVDemod::InitDATVFramework: Register DVBSTVSCREEN");
789 
795  }
796 
797  // DECONVOLUTION AND SYNCHRONIZATION
798 
800 
801  r_deconv = nullptr;
802 
803  //******** -> if ( m_objCfg.viterbi )
804 
805  if (m_objCfg.viterbi)
806  {
809  }
810 
811  //To uncomment -> Linking Problem : undefined symbol: _ZN7leansdr21viterbi_dec_interfaceIhhiiE6updateEPiS2_
812  r = new leansdr::viterbi_sync(m_objScheduler, (*p_symbols), (*p_bytes), m_objDemodulator->cstln, m_objCfg.fec);
813 
814  if (m_objCfg.fastlock) {
815  r->resync_period = 1;
816  }
817  }
818  else
819  {
820  r_deconv = make_deconvol_sync_simple(m_objScheduler, (*p_symbols), (*p_bytes), m_objCfg.fec);
821  r_deconv->fastlock = m_objCfg.fastlock;
822  }
823 
824  //******* -> if ( m_objCfg.hdlc )
825 
829 
831  r_sync_mpeg->fastlock = m_objCfg.fastlock;
832 
833  // DEINTERLEAVING
834 
837 
838  // REED-SOLOMON
839 
844 
845  // BER ESTIMATION
846 
847  /*
848  p_vber = new pipebuf<float> (m_objScheduler, "VBER", BUF_SLOW);
849  r_vber = new rate_estimator<float> (m_objScheduler, *p_verrcount, *p_vbitcount, *p_vber);
850  r_vber->sample_size = m_objCfg.Fm/2; // About twice per second, depending on CR
851  // Require resolution better than 2E-5
852  if ( r_vber->sample_size < 50000 )
853  {
854  r_vber->sample_size = 50000;
855  }
856  */
857 
858  // DERANDOMIZATION
860  r_derand = new leansdr::derandomizer(m_objScheduler, *p_rtspackets, *p_tspackets);
861 
862  // OUTPUT
864 
865  m_blnDVBInitialized = true;
866 }
867 
868 //************ DVB-S2 Decoder ************
870 {
872 
873  m_blnDVBInitialized = false;
874  m_lngReadIQ = 0;
875  CleanUpDATVFramework(false);
876 
877  qDebug() << "DATVDemod::InitDATVS2Framework:"
878  << " Standard: " << m_settings.m_standard
879  << " Symbol Rate: " << m_settings.m_symbolRate
880  << " Modulation: " << m_settings.m_modulation
881  << " Notch Filters: " << m_settings.m_notchFilters
882  << " Allow Drift: " << m_settings.m_allowDrift
883  << " Fast Lock: " << m_settings.m_fastLock
884  << " Filter: " << m_settings.m_filter
885  << " HARD METRIC: " << m_settings.m_hardMetric
886  << " RollOff: " << m_settings.m_rollOff
887  << " Viterbi: " << m_settings.m_viterbi
888  << " Excursion: " << m_settings.m_excursion
889  << " Sample rate: " << m_sampleRate ;
890 
891 
892 
894 
896  m_objCfg.Fs = (float) m_sampleRate;
899 
902  m_objCfg.rrc_rej = (float) m_settings.m_excursion; //dB
903  m_objCfg.rrc_steps = 0; //auto
904 
905  switch(m_settings.m_modulation)
906  {
909  break;
912  break;
915  break;
918  break;
921  break;
924  break;
927  break;
930  break;
933  break;
934  default:
936  break;
937  }
938 
944 
945  // Min buffer size for baseband data
946  S2_MAX_SYMBOLS = (90*(1+360)+36*((360-1)/16));
947 
949  // Min buffer size for IQ symbols
950  // cstln_receiver: writes in chunks of 128/omega symbols (margin 128)
951  // deconv_sync: reads at least 64+32
952  // A larger buffer improves performance significantly.
954 
955 
956  // Min buffer size for misc measurements: 1
958 
959  // dvbs2 : Min buffer size for slots: 4 for deinterleaver
961 
963 
964  // Min buffer size for TS packets: Up to 39 per BBFRAME
965  BUF_S2PACKETS = (leansdr::fec_info::KBCH_MAX/188/8+1) * m_objCfg.buf_factor;
966 
968 
970 
971  //***************
975 
976  // NOTCH FILTER
977 
978  if (m_objCfg.anf>0)
979  {
982  p_preprocessed = p_autonotched;
983  }
984 
985  // FREQUENCY CORRECTION
986 
987  //******** -> if ( m_objCfg.Fderot>0 )
988 
989  // CNR ESTIMATION
999  // FILTERING
1000 
1001  int decim = 1;
1002 
1003  //******** -> if ( m_objCfg.resample )
1004 
1005 
1006  // DECIMATION
1007  // (Unless already done in resampler)
1008 
1009  //******** -> if ( !m_objCfg.resample && m_objCfg.decim>1 )
1010 
1011  //Resampling FS
1012 
1013 
1014  // Generic constellation receiver
1015 
1019 
1020  switch (m_objCfg.sampler)
1021  {
1024  break;
1027  break;
1029  {
1030  if (m_objCfg.rrc_steps == 0)
1031  {
1032  // At least 64 discrete sampling points between symbols
1033  m_objCfg.rrc_steps = std::max(1, (int)(64*m_objCfg.Fm / m_objCfg.Fs));
1034  }
1035 
1036  float Frrc = m_objCfg.Fs * m_objCfg.rrc_steps; // Sample freq of the RRC filter
1037  float transition = (m_objCfg.Fm/2) * m_objCfg.rolloff;
1038  int order = m_objCfg.rrc_rej * Frrc / (22*transition);
1041  break;
1042  }
1043  default:
1044  qCritical("DATVDemod::InitDATVS2Framework: Interpolator not implemented");
1045  return;
1046  }
1047 
1049 
1053 
1056  sampler,
1057  *p_preprocessed,
1059  /* p_freq */ nullptr,
1060  /* p_ss */ nullptr,
1061  /* p_mer */ nullptr,
1062  p_cstln,
1063  /* p_cstln_pls */ nullptr,
1064  /*p_iqsymbols*/ nullptr,
1065  /* p_framelock */nullptr);
1066 
1067  objDemodulatorDVBS2 = (leansdr::s2_frame_receiver<leansdr::f32, leansdr::llr_ss> *) m_objDemodulatorDVBS2;
1068 
1069 
1070  objDemodulatorDVBS2->omega = m_objCfg.Fs/m_objCfg.Fm;
1071 //objDemodulatorDVBS2->mu=1;
1072 
1073 
1074  m_objCfg.Ftune=0.0f;
1075  objDemodulatorDVBS2->Ftune = m_objCfg.Ftune / m_objCfg.Fm;
1076 
1077 /*
1078  demod.strongpls = cfg.strongpls;
1079 */
1080 
1081  objDemodulatorDVBS2->Fm = m_objCfg.Fm;
1082  objDemodulatorDVBS2->meas_decimation = decimation(m_objCfg.Fs, m_objCfg.Finfo);
1083 
1084  objDemodulatorDVBS2->strongpls = false;
1085 
1086 
1087  objDemodulatorDVBS2->cstln = make_dvbs2_constellation(m_objCfg.constellation, m_objCfg.fec);
1088  m_cstlnSetByModcod = false;
1089 
1090  //constellation
1091 
1093  {
1094  qDebug("DATVDemod::InitDATVS2Framework: Register DVBS 2 TVSCREEN");
1095 
1097  r_scope_symbols_dvbs2 = new leansdr::datvdvbs2constellation<leansdr::f32>(m_objScheduler, *p_cstln /* *p_sampled */ /* *p_cstln */, -128,128, nullptr, m_objRegisteredTVScreen);
1099  r_scope_symbols_dvbs2->cstln = (leansdr::cstln_base**) &objDemodulatorDVBS2->cstln;
1101  }
1102 
1103  // Bit-flipping mode.
1104  // Deinterleave into hard bits.
1105 
1107 
1109 
1114  );
1115 
1118 
1122  p_vbitcount,
1123  p_verrcount
1124  );
1126 
1127  fecdec->bitflips=0;
1128 
1129  /*
1130  fecdec->bitflips = cfg.ldpc_bf; //int TODO
1131  if ( ! cfg.ldpc_bf )
1132  fprintf(stderr, "Warning: No LDPC error correction selected.\n")
1133  */
1134 
1135  // Deframe BB frames to TS packets
1139 
1140  p_deframer = new leansdr::s2_deframer(m_objScheduler,*(leansdr::pipebuf<leansdr::bbframe> *) p_bbframes, *p_tspackets, p_lock, p_locktime);
1141 
1142 /*
1143  if ( cfg.fd_gse >= 0 ) deframer.fd_gse = cfg.fd_gse;
1144 */
1145  //**********************************************
1146 
1147  // OUTPUT
1149 
1150  m_blnDVBInitialized = true;
1151 }
1152 
1153 
1154 void DATVDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
1155 {
1156  (void) firstOfBurst;
1157  float fltI;
1158  float fltQ;
1159  leansdr::cf32 objIQ;
1160  //Complex objC;
1161  fftfilt::cmplx *objRF;
1162  int intRFOut;
1163  double magSq;
1164 
1165  int lngWritable=0;
1166 
1167  //********** Bis repetita : Let's rock and roll buddy ! **********
1168 
1169 #ifdef EXTENDED_DIRECT_SAMPLE
1170 
1171  qint16 * ptrBuffer;
1172  qint32 intLen;
1173 
1174  //********** Reading direct samples **********
1175 
1176  SampleVector::const_iterator it = begin;
1177  intLen = it->intLen;
1178  ptrBuffer = it->ptrBuffer;
1179  ptrBufferToRelease = ptrBuffer;
1180  ++it;
1181 
1182  for(qint32 intInd=0; intInd<intLen-1; intInd +=2)
1183  {
1184 
1185  fltI= ((qint32) (*ptrBuffer)) << 4;
1186  ptrBuffer ++;
1187  fltQ= ((qint32) (*ptrBuffer)) << 4;
1188  ptrBuffer ++;
1189 
1190 #else
1191 
1192  for (SampleVector::const_iterator it = begin; it != end; ++it /* ++it **/)
1193  {
1194  fltI = it->real();
1195  fltQ = it->imag();
1196 #endif
1197 
1198 
1199  //********** demodulation **********
1200 
1201 
1203  {
1204  qDebug("DATVDemod::feed: Settings applied. Standard : %d...", m_settings.m_standard);
1205  m_objSettingsMutex.lock();
1206  m_blnNeedConfigUpdate=false;
1207 
1209  {
1210  printf("SWITCHING TO DVBS-2\r\n");
1212  }
1213  else
1214  {
1215  printf("SWITCHING TO DVBS\r\n");
1217  }
1218 
1219  m_objSettingsMutex.unlock();
1220  }
1221 
1222 
1223  //********** iq stream ****************
1224 
1225  Complex objC(fltI,fltQ);
1226 
1227  objC *= m_objNCO.nextIQ();
1228 
1229  intRFOut = m_objRFFilter->runFilt(objC, &objRF); // filter RF before demod
1230 
1231  for (int intI = 0 ; intI < intRFOut; intI++)
1232  {
1233  objIQ.re = objRF->real();
1234  objIQ.im = objRF->imag();
1235  magSq = objIQ.re*objIQ.re + objIQ.im*objIQ.im;
1236  m_objMagSqAverage(magSq);
1237 
1238  objRF ++;
1239 
1241  && (p_rawiq_writer!=nullptr)
1242  && (m_objScheduler!=nullptr))
1243  {
1244  p_rawiq_writer->write(objIQ);
1245  m_lngReadIQ++;
1246 
1247  lngWritable = p_rawiq_writer->writable();
1248 
1249  //Leave +1 by safety
1250  //if(((m_lngReadIQ+1)>=lngWritable) || (m_lngReadIQ>=768))
1251  if((m_lngReadIQ+1)>=lngWritable)
1252  {
1253  m_objScheduler->step();
1254 
1255  m_lngReadIQ=0;
1256  //delete p_rawiq_writer;
1257  //p_rawiq_writer = new leansdr::pipewriter<leansdr::cf32>(*p_rawiq);
1258  }
1259  }
1260 
1261  }
1262  } // Samples for loop
1263 
1264  // DVBS2: Track change of constellation via MODCOD
1266  {
1268 
1269  if (objDemodulatorDVBS2->cstln->m_setByModcod && !m_cstlnSetByModcod)
1270  {
1271  qDebug("DATVDemod::feed: change by MODCOD detected");
1272 
1273  if (r_scope_symbols_dvbs2) {
1275  }
1276 
1277  if (getMessageQueueToGUI())
1278  {
1280  getModulationFromLeanDVBCode(objDemodulatorDVBS2->cstln->m_typeCode),
1281  getCodeRateFromLeanDVBCode(objDemodulatorDVBS2->cstln->m_rateCode)
1282  );
1283 
1284  getMessageQueueToGUI()->push(msg);
1285  }
1286  }
1287 
1288  m_cstlnSetByModcod = objDemodulatorDVBS2->cstln->m_setByModcod;
1289  m_modcodModulation = objDemodulatorDVBS2->m_modcodType;
1290  m_modcodCodeRate = objDemodulatorDVBS2->m_modcodRate;
1291  }
1292 }
1293 
1295 {
1296  m_audioFifo.clear();
1297 }
1298 
1300 {
1301 }
1302 
1304 {
1306  {
1308 
1309  qDebug() << "DATVDemod::handleMessage: MsgChannelizerNotification:"
1310  << " m_intSampleRate: " << objNotif.getSampleRate()
1311  << " m_intFrequencyOffset: " << objNotif.getFrequencyOffset();
1312 
1314  applyChannelSettings(m_sampleRate /*objNotif.getSampleRate()*/, m_inputFrequencyOffset);
1315 
1316  return true;
1317  }
1318  else if (MsgConfigureChannelizer::match(cmd))
1319  {
1321 
1323  m_channelizer->getInputSampleRate(), // do not change sample rate
1324  cfg.getCenterFrequency());
1325 
1326  qDebug() << "DATVDemod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getInputSampleRate()
1327  << " centerFrequency: " << cfg.getCenterFrequency();
1328 
1330  applyChannelSettings(m_sampleRate /*objNotif.getSampleRate()*/, m_inputFrequencyOffset);
1331 
1332  return true;
1333  }
1334  else if (MsgConfigureDATVDemod::match(cmd))
1335  {
1337  qDebug() << "DATVDemod::handleMessage: MsgConfigureDATVDemod";
1338  applySettings(objCfg.getSettings(), objCfg.getForce());
1339 
1340  return true;
1341  }
1342  else if(DSPSignalNotification::match(cmd))
1343  {
1345  qDebug("DATVDemod::handleMessage: DSPSignalNotification: sent sample rate: %d", m_sampleRate);
1346  applyChannelSettings(m_sampleRate /*objNotif.getSampleRate()*/, m_inputFrequencyOffset);
1347 
1348  return true;
1349  }
1350  else
1351  {
1352  return false;
1353  }
1354 }
1355 
1356 void DATVDemod::applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force)
1357 {
1358  qDebug() << "DATVDemod::applyChannelSettings:"
1359  << " inputSampleRate: " << inputSampleRate
1360  << " inputFrequencyOffset: " << inputFrequencyOffset;
1361 
1362  bool callApplySettings = false;
1363 
1364  if ((m_settings.m_centerFrequency != inputFrequencyOffset) ||
1365  (m_sampleRate != inputSampleRate) || force)
1366  {
1367  m_objNCO.setFreq(-(float) inputFrequencyOffset, (float) inputSampleRate);
1368  qDebug("DATVDemod::applyChannelSettings: NCO: IF: %d <> TF: %d ISR: %d",
1369  inputFrequencyOffset, m_settings.m_centerFrequency, inputSampleRate);
1370  callApplySettings = true;
1371  }
1372 
1373  if ((m_sampleRate != inputSampleRate) || force)
1374  {
1375  //Bandpass filter shaping
1376  Real fltLowCut = -((float) m_settings.m_rfBandwidth / 2.0) / (float) inputSampleRate;
1377  Real fltHiCut = ((float) m_settings.m_rfBandwidth / 2.0) / (float) inputSampleRate;
1378  m_objRFFilter->create_filter(fltLowCut, fltHiCut);
1379  }
1380 
1381  m_sampleRate = inputSampleRate;
1382  m_settings.m_centerFrequency = inputFrequencyOffset;
1383 
1384  if (callApplySettings) {
1385  applySettings(m_settings, true);
1386  }
1387 }
1388 
1389 void DATVDemod::applySettings(const DATVDemodSettings& settings, bool force)
1390 {
1391  QString msg = tr("DATVDemod::applySettings: force: %1").arg(force);
1392  settings.debug(msg);
1393 
1394  qDebug("DATVDemod::applySettings: m_sampleRate: %d", m_sampleRate);
1395 
1396  if (m_sampleRate == 0) {
1397  return;
1398  }
1399 
1400  if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
1401  {
1403  int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_audioDeviceName);
1404  audioDeviceManager->addAudioSink(&m_audioFifo, getInputMessageQueue(), audioDeviceIndex); // removes from current if necessary
1405  // uint32_t audioSampleRate = audioDeviceManager->getOutputSampleRate(audioDeviceIndex);
1406 
1407  // if (m_audioSampleRate != audioSampleRate) {
1408  // applyAudioSampleRate(audioSampleRate);
1409  // }
1410  }
1411 
1412  if ((settings.m_audioVolume) != (m_settings.m_audioVolume) || force)
1413  {
1416  }
1417  }
1418 
1419  if ((settings.m_audioMute) != (m_settings.m_audioMute) || force)
1420  {
1423  }
1424  }
1425 
1426  if ((settings.m_videoMute) != (m_settings.m_videoMute) || force)
1427  {
1430  }
1431  }
1432 
1433  if ((m_settings.m_rfBandwidth != settings.m_rfBandwidth)
1434  || force)
1435  {
1436 
1437  //Bandpass filter shaping
1438  Real fltLowCut = -((float) settings.m_rfBandwidth / 2.0) / (float) m_sampleRate;
1439  Real fltHiCut = ((float) settings.m_rfBandwidth / 2.0) / (float) m_sampleRate;
1440  m_objRFFilter->create_filter(fltLowCut, fltHiCut);
1441  }
1442 
1444  || force)
1445  {
1446  m_objNCO.setFreq(-(float) settings.m_centerFrequency, (float) m_sampleRate);
1447  }
1448 
1449  if ((m_settings.m_udpTS != settings.m_udpTS) || force) {
1450  m_udpStream.setActive(settings.m_udpTS);
1451  }
1452 
1453  if ((m_settings.m_udpTSAddress != settings.m_udpTSAddress) || force) {
1455  }
1456 
1457  if ((m_settings.m_udpTSPort != settings.m_udpTSPort) || force) {
1458  m_udpStream.setPort(settings.m_udpTSPort);
1459  }
1460 
1461  if (m_settings.isDifferent(settings) || force)
1462  {
1463  m_blnNeedConfigUpdate = true;
1464  }
1465 
1466  m_settings = settings;
1467 }
1468 
1470 {
1471  return m_sampleRate;
1472 }
1473 
1475 {
1476  if (leanDVBCodeRate == leansdr::code_rate::FEC12) {
1478  } else if (leanDVBCodeRate == leansdr::code_rate::FEC13) {
1480  } else if (leanDVBCodeRate == leansdr::code_rate::FEC14) {
1482  } else if (leanDVBCodeRate == leansdr::code_rate::FEC23) {
1484  } else if (leanDVBCodeRate == leansdr::code_rate::FEC25) {
1486  } else if (leanDVBCodeRate == leansdr::code_rate::FEC34) {
1488  } else if (leanDVBCodeRate == leansdr::code_rate::FEC35) {
1490  } else if (leanDVBCodeRate == leansdr::code_rate::FEC45) {
1492  } else if (leanDVBCodeRate == leansdr::code_rate::FEC46) {
1494  } else if (leanDVBCodeRate == leansdr::code_rate::FEC56) {
1496  } else if (leanDVBCodeRate == leansdr::code_rate::FEC78) {
1498  } else if (leanDVBCodeRate == leansdr::code_rate::FEC89) {
1500  } else if (leanDVBCodeRate == leansdr::code_rate::FEC910) {
1502  } else {
1503  return DATVDemodSettings::DATVCodeRate::RATE_UNSET;
1504  }
1505 }
1506 
1508 {
1509  if (leanDVBModulation == leansdr::cstln_base::predef::APSK16) {
1510  return DATVDemodSettings::DATVModulation::APSK16;
1511  } else if (leanDVBModulation == leansdr::cstln_base::predef::APSK32) {
1512  return DATVDemodSettings::DATVModulation::APSK32;
1513  } else if (leanDVBModulation == leansdr::cstln_base::predef::APSK64E) {
1514  return DATVDemodSettings::DATVModulation::APSK64E;
1515  } else if (leanDVBModulation == leansdr::cstln_base::predef::BPSK) {
1516  return DATVDemodSettings::DATVModulation::BPSK;
1517  } else if (leanDVBModulation == leansdr::cstln_base::predef::PSK8) {
1518  return DATVDemodSettings::DATVModulation::PSK8;
1519  } else if (leanDVBModulation == leansdr::cstln_base::predef::QAM16) {
1520  return DATVDemodSettings::DATVModulation::QAM16;
1521  } else if (leanDVBModulation == leansdr::cstln_base::predef::QAM64) {
1522  return DATVDemodSettings::DATVModulation::QAM64;
1523  } else if (leanDVBModulation == leansdr::cstln_base::predef::QAM256) {
1524  return DATVDemodSettings::DATVModulation::QAM256;
1525  } else if (leanDVBModulation == leansdr::cstln_base::predef::QPSK) {
1526  return DATVDemodSettings::DATVModulation::QPSK;
1527  } else {
1528  return DATVDemodSettings::DATVModulation::MOD_UNSET;
1529  }
1530 }
1531 
1533 {
1534  if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC12) {
1535  return (int) leansdr::code_rate::FEC12;
1536  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC13) {
1537  return (int) leansdr::code_rate::FEC13;
1538  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC14) {
1539  return (int) leansdr::code_rate::FEC14;
1540  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC23) {
1541  return (int) leansdr::code_rate::FEC23;
1542  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC25) {
1543  return (int) leansdr::code_rate::FEC25;
1544  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC34) {
1545  return (int) leansdr::code_rate::FEC34;
1546  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC35) {
1547  return (int) leansdr::code_rate::FEC35;
1548  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC45) {
1549  return (int) leansdr::code_rate::FEC45;
1550  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC46) {
1551  return (int) leansdr::code_rate::FEC46;
1552  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC56) {
1553  return (int) leansdr::code_rate::FEC56;
1554  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC78) {
1555  return (int) leansdr::code_rate::FEC78;
1556  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC89) {
1557  return (int) leansdr::code_rate::FEC89;
1558  } else if (datvCodeRate == DATVDemodSettings::DATVCodeRate::FEC910) {
1559  return (int) leansdr::code_rate::FEC910;
1560  } else {
1561  return -1;
1562  }
1563 }
1564 
1566 {
1567  if (datvModulation == DATVDemodSettings::DATVModulation::APSK16) {
1568  return (int) leansdr::cstln_base::predef::APSK16;
1569  } else if (datvModulation == DATVDemodSettings::DATVModulation::APSK32) {
1570  return (int) leansdr::cstln_base::predef::APSK32;
1571  } else if (datvModulation == DATVDemodSettings::DATVModulation::APSK64E) {
1572  return (int) leansdr::cstln_base::predef::APSK64E;
1573  } else if (datvModulation == DATVDemodSettings::DATVModulation::BPSK) {
1574  return (int) leansdr::cstln_base::predef::BPSK;
1575  } else if (datvModulation == DATVDemodSettings::DATVModulation::PSK8) {
1576  return (int) leansdr::cstln_base::predef::PSK8;
1577  } else if (datvModulation == DATVDemodSettings::DATVModulation::QAM16) {
1578  return (int) leansdr::cstln_base::predef::QAM16;
1579  } else if (datvModulation == DATVDemodSettings::DATVModulation::QAM64) {
1580  return (int) leansdr::cstln_base::predef::QAM64;
1581  } else if (datvModulation == DATVDemodSettings::DATVModulation::QAM256) {
1582  return (int) leansdr::cstln_base::predef::QAM256;
1583  } else if (datvModulation == DATVDemodSettings::DATVModulation::QPSK) {
1584  return (int) leansdr::cstln_base::predef::QPSK;
1585  } else {
1586  return -1;
1587  }
1588 }
leansdr::pipebuf< leansdr::u8 > * p_bytes
Definition: datvdemod.h:357
leansdr::pipebuf< leansdr::f32 > * p_ss
Definition: datvdemod.h:330
leansdr::code_rate fec
Definition: datvdemod.h:81
bool isDifferent(const DATVDemodSettings &other)
int buf_factor
Definition: datvdemod.h:73
leansdr::pipebuf< int > * p_lock
Definition: datvdemod.h:367
bool videoDecodeOK()
Definition: datvdemod.cpp:153
leansdr::rs_decoder< leansdr::u8, 0 > * r_rsdec
Definition: datvdemod.h:380
void addAudioSink(AudioFifo *audioFifo, MessageQueue *sampleSinkMessageQueue, int outputDeviceIndex=-1)
Add the audio sink.
void * p_deframer
Definition: datvdemod.h:344
leansdr::pipebuf< leansdr::u32 > * p_locktime
Definition: datvdemod.h:368
bool videoActive()
Definition: datvdemod.cpp:135
cstln_lut< eucl_ss, 256 > ** cstln
void * p_fecframes
Definition: datvdemod.h:340
leansdr::pipebuf< leansdr::u8 > * p_mpegbytes
Definition: datvdemod.h:366
bool viterbi
Definition: datvdemod.h:85
leansdr::pipebuf< leansdr::tspacket > * p_rtspackets
Definition: datvdemod.h:379
bool m_cstlnSetByModcod
Definition: datvdemod.h:420
cstln_lut< SOFTSYMB, 256 > * cstln
Definition: sdr.h:1040
leansdr::pipebuf< int > * p_vbitcount
Definition: datvdemod.h:377
Complex nextIQ()
Return next complex sample.
Definition: nco.cpp:61
void configure(MessageQueue *messageQueue, int sampleRate, int centerFrequency)
leansdr::pipebuf< leansdr::rspacket< leansdr::u8 > > * p_rspackets
Definition: datvdemod.h:373
void push(Message *message, bool emitSignal=true)
Push message onto queue.
leansdr::rotator< leansdr::f32 > * r_derot
Definition: datvdemod.h:311
unsigned long BUF_PACKETS
Definition: datvdemod.h:280
void removeChannelSinkAPI(ChannelAPI *channelAPI, int streamIndex=0)
Definition: deviceapi.cpp:163
void * m_objDemodulatorDVBS2
Definition: datvdemod.h:339
deconvol_sync_simple * make_deconvol_sync_simple(scheduler *sch, pipebuf< eucl_ss > &_in, pipebuf< u8 > &_out, enum code_rate rate)
Definition: dvb.cpp:6
leansdr::datvdvbs2constellation< leansdr::f32 > * r_scope_symbols_dvbs2
Definition: datvdemod.h:397
void applyChannelSettings(int inputSampleRate, int inputFrequencyOffset, bool force=false)
Definition: datvdemod.cpp:1356
leansdr::pipebuf< leansdr::f32 > * p_cnr
Definition: datvdemod.h:314
leansdr::pipewriter< leansdr::cf32 > * p_rawiq_writer
Definition: datvdemod.h:302
int decimation(float Fin, float Fout)
Definition: datvdemod.h:66
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
leansdr::pipebuf< leansdr::u8 > * p_descrambled
Definition: datvdemod.h:360
unsigned long BUF_MPEGBYTES
Definition: datvdemod.h:279
DATVModulation m_modulation
leansdr::pipebuf< leansdr::f32 > * p_freq
Definition: datvdemod.h:329
leansdr::pipebuf< leansdr::eucl_ss > * p_symbols
Definition: datvdemod.h:328
leansdr::datvvideoplayer< leansdr::tspacket > * r_videoplayer
Definition: datvdemod.h:393
bool allow_drift
Definition: datvdemod.h:83
DATVideostream * SetVideoRender(DATVideoRender *objScreen)
Definition: datvdemod.cpp:118
leansdr::decimator< leansdr::cf32 > * p_decim
Definition: datvdemod.h:348
void clear()
Definition: audiofifo.cpp:156
void setPort(quint16 port)
Definition: datvudpstream.h:37
bool m_blnNeedConfigUpdate
Definition: datvdemod.h:296
int getOutputDeviceIndex(const QString &deviceName) const
int ncoeffs_sampler
Definition: datvdemod.h:326
unsigned long BUF_SLOW
Definition: datvdemod.h:281
static const QString m_channelIdURI
Definition: datvdemod.h:197
unsigned long BUF_FRAMES
Definition: datvdemod.h:286
int runFilt(const cmplx &in, cmplx **out)
Definition: fftfilt.cpp:260
float Ftune
Definition: datvdemod.h:82
float rrc_rej
Definition: datvdemod.h:90
void removeAudioSink(AudioFifo *audioFifo)
Remove the audio sink.
static const int MAX_SLOTS_PER_FRAME
Definition: dvbs2.h:222
leansdr::pipebuf< leansdr::cf32 > * p_autonotched
Definition: datvdemod.h:307
leansdr::cnr_fft< leansdr::f32 > * r_cnr
Definition: datvdemod.h:315
static const QString m_channelId
Definition: datvdemod.h:198
bool setAddress(const QString &address)
Definition: datvudpstream.h:36
int GetSampleRate()
Definition: datvdemod.cpp:1469
leansdr::mpeg_sync< leansdr::u8, 0 > * r_sync_mpeg
Definition: datvdemod.h:369
static int getLeanDVBModulationFromDATV(DATVDemodSettings::DATVModulation datvModulation)
Definition: datvdemod.cpp:1565
DATVDemodSettings::dvb_sampler sampler
Definition: datvdemod.h:71
bool m_blnDVBInitialized
Definition: datvdemod.h:295
int ncoeffs
Definition: datvdemod.h:321
unsigned long meas_decimation
Definition: sdr.h:1041
void debug(const QString &msg) const
int getVideoStreamIndex() const
bool audioActive()
Definition: datvdemod.cpp:126
DATVideoRender * m_objRegisteredVideoRender
Definition: datvdemod.h:406
bool cnr
Definition: datvdemod.h:77
leansdr::viterbi_sync * r
Definition: datvdemod.h:359
bool m_blnInitialized
Definition: datvdemod.h:417
leansdr::etr192_descrambler * r_etr192_descrambler
Definition: datvdemod.h:363
leansdr::deinterleaver< leansdr::u8 > * r_deinter
Definition: datvdemod.h:374
bool getAudioDecodeOK() const
int rrc_steps
Definition: datvdemod.h:89
static DATVDemodSettings::DATVModulation getModulationFromLeanDVBCode(int leanDVBModulation)
Definition: datvdemod.cpp:1507
void resizeTVScreen(int intCols, int intRows)
Definition: tvscreen.cpp:86
std::complex< float > cmplx
Definition: fftfilt.h:21
const DATVDemodSettings & getSettings() const
Definition: datvdemod.h:224
void applySettings(const DATVDemodSettings &settings, bool force=false)
Definition: datvdemod.cpp:1389
virtual void start()
Definition: datvdemod.cpp:1294
leansdr::pipebuf< int > * p_framelock
Definition: datvdemod.h:338
leansdr::auto_notch< leansdr::f32 > * r_auto_notch
Definition: datvdemod.h:306
code_rate
Definition: dvb.h:41
leansdr::pipebuf< leansdr::cf32 > * p_rawiq
Definition: datvdemod.h:301
leansdr::deconvol_sync_simple * r_deconv
Definition: datvdemod.h:358
unsigned long BUF_SYMBOLS
Definition: datvdemod.h:277
bool audioDecodeOK()
Definition: datvdemod.cpp:144
float rolloff
Definition: datvdemod.h:91
DeviceAPI * m_deviceAPI
Definition: datvdemod.h:399
void set_allow_drift(bool d)
Definition: sdr.h:1097
virtual bool handleMessage(const Message &cmd)
Processing of a message. Returns true if message has actually been processed.
Definition: datvdemod.cpp:1303
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
Definition: message.h:52
void create_filter(float f1, float f2)
Definition: fftfilt.cpp:107
virtual void stop()
Definition: datvdemod.cpp:1299
void InitDATVS2Framework()
Definition: datvdemod.cpp:869
leansdr::file_writer< leansdr::cf32 > * r_ppout
Definition: datvdemod.h:351
static DSPEngine * instance()
Definition: dspengine.cpp:51
cstln_lut< SOFTSYMB, 256 > * cstln
Definition: dvbs2.h:1153
int m_modcodCodeRate
Definition: datvdemod.h:422
unsigned long S2_MAX_SYMBOLS
Definition: datvdemod.h:288
DATVUDPStream m_udpStream
Definition: datvdemod.h:408
long m_lngReadIQ
Definition: datvdemod.h:272
leansdr::pipebuf< leansdr::cf32 > * p_cstln
Definition: datvdemod.h:336
leansdr::datvconstellation< leansdr::f32 > * r_scope_symbols
Definition: datvdemod.h:396
static DATVDemodSettings::DATVCodeRate getCodeRateFromLeanDVBCode(int leanDVBCodeRate)
Definition: datvdemod.cpp:1474
QMutex m_objSettingsMutex
Definition: datvdemod.h:432
void * p_s2_deinterleaver
Definition: datvdemod.h:342
unsigned long BUF_BASEBAND
Definition: datvdemod.h:276
void setAudioMute(bool audioMute)
unsigned long m_lngExpectedReadIQ
Definition: datvdemod.h:271
unsigned long BUF_BYTES
Definition: datvdemod.h:278
leansdr::pipebuf< float > * p_vber
Definition: datvdemod.h:383
leansdr::rate_estimator< float > * r_vber
Definition: datvdemod.h:384
void * r_fecdec
Definition: datvdemod.h:343
leansdr::pipebuf< int > * p_verrcount
Definition: datvdemod.h:378
static bool match(const Message *message)
Definition: message.cpp:45
virtual void feed(const SampleVector::const_iterator &begin, const SampleVector::const_iterator &end, bool po)
Definition: datvdemod.cpp:1154
int getInputSampleRate() const
void setFreq(Real freq, Real sampleRate)
Definition: nco.cpp:49
NCO m_objNCO
Definition: datvdemod.h:415
static MsgReportModcodCstlnChange * create(const DATVDemodSettings::DATVModulation &modulation, const DATVDemodSettings::DATVCodeRate &codeRate)
Definition: datvdemod.h:250
leansdr::scheduler * m_objScheduler
Definition: datvdemod.h:292
void removeChannelSink(ThreadedBasebandSampleSink *sink, int streamIndex=0)
Remove a channel sink (Rx)
Definition: deviceapi.cpp:127
DATVideostream * m_objVideoStream
Definition: datvdemod.h:407
bool m_blnStartStopVideo
Definition: datvdemod.h:419
void set_omega(float _omega, float tol=10e-6)
Definition: sdr.h:1082
leansdr::cstln_lut< leansdr::eucl_ss, 256 >::predef constellation
Definition: datvdemod.h:80
MessageQueue * getMessageQueueToGUI()
void * p_slots_dvbs2
Definition: datvdemod.h:335
leansdr::pipebuf< leansdr::cf32 > * p_resampled
Definition: datvdemod.h:319
DATVideoRenderThread * m_objRenderThread
Definition: datvdemod.h:409
unsigned long BUF_SLOTS
Definition: datvdemod.h:285
MovingAverageUtil< double, double, 32 > m_objMagSqAverage
Definition: datvdemod.h:430
leansdr::hdlc_sync * r_sync
Definition: datvdemod.h:364
leansdr::pipebuf< leansdr::u8 > * p_frames
Definition: datvdemod.h:361
void setAudioVolume(int audioVolume)
static int getLeanDVBCodeRateFromDATV(DATVDemodSettings::DATVCodeRate datvCodeRate)
Definition: datvdemod.cpp:1532
struct config m_objCfg
Definition: datvdemod.h:293
AudioDeviceManager * getAudioDeviceManager()
Definition: dspengine.h:55
DownChannelizer * m_channelizer
Definition: datvdemod.h:402
bool SetTVScreen(TVScreen *objScreen)
Definition: datvdemod.cpp:112
float * freq_tap
Definition: sdr.h:1730
virtual qint64 bytesAvailable() const
fftfilt * m_objRFFilter
Definition: datvdemod.h:414
DATVDemodSettings::dvb_version standard
Definition: datvdemod.h:70
leansdr::pipebuf< leansdr::cf32 > * p_preprocessed
Definition: datvdemod.h:303
leansdr::pipebuf< leansdr::tspacket > * p_tspackets
Definition: datvdemod.h:387
bool PlayVideo(bool blnStartStop)
Definition: datvdemod.cpp:162
bool hard_metric
Definition: datvdemod.h:86
leansdr::pipebuf< leansdr::cf32 > * p_cstln_pls
Definition: datvdemod.h:337
unsigned long BUF_S2PACKETS
Definition: datvdemod.h:287
void CleanUpDATVFramework(bool blnRelease)
Definition: datvdemod.cpp:205
leansdr::file_writer< leansdr::tspacket > * r_stdout
Definition: datvdemod.h:392
float Finfo
Definition: datvdemod.h:94
int root_raised_cosine(int order, float Fs, float rolloff, T **coeffs)
Definition: filtergen.h:91
float Fm
Definition: datvdemod.h:79
float * coeffs
Definition: datvdemod.h:320
void setAudioFIFO(AudioFifo *fifo)
leansdr::sampler_interface< leansdr::f32 > * sampler
Definition: datvdemod.h:324
ThreadedBasebandSampleSink * m_threadedChannelizer
Definition: datvdemod.h:401
int anf
Definition: datvdemod.h:76
int m_sampleRate
Definition: datvdemod.h:428
void setActive(bool active)
Definition: datvudpstream.h:35
bool getVideoDecodeOK() const
DATVDemodSettings m_settings
Definition: datvdemod.h:427
leansdr::derandomizer * r_derand
Definition: datvdemod.h:388
bool fastlock
Definition: datvdemod.h:84
void setVideoMute(bool videoMute)
TVScreen * m_objRegisteredTVScreen
Definition: datvdemod.h:405
leansdr::pipebuf< leansdr::f32 > * p_mer
Definition: datvdemod.h:331
void harden()
Definition: sdr.h:870
leansdr::fir_filter< leansdr::cf32, float > * r_resample
Definition: datvdemod.h:318
leansdr::pipebuf< leansdr::cf32 > * p_decimated
Definition: datvdemod.h:347
void setStreamAndRenderer(DATVideoRender *renderer, DATVideostream *stream)
std::complex< Real > Complex
Definition: dsptypes.h:43
int m_modcodModulation
Definition: datvdemod.h:421
#define rfFilterFftLength
Definition: datvdemod.h:27
float Real
Definition: dsptypes.h:42
dvb_version m_standard
leansdr::cstln_receiver< leansdr::f32, leansdr::eucl_ss > * m_objDemodulator
Definition: datvdemod.h:354
AudioFifo m_audioFifo
Definition: datvdemod.h:412
leansdr::pipebuf< leansdr::cf32 > * p_sampled
Definition: datvdemod.h:332
float * coeffs_sampler
Definition: datvdemod.h:325
T max(const T &x, const T &y)
Definition: framework.h:446
leansdr::pipebuf< leansdr::cf32 > * p_derot
Definition: datvdemod.h:310
void * p_bbframes
Definition: datvdemod.h:341
int m_inputFrequencyOffset
Definition: datvdemod.h:429
void InitDATVFramework()
Definition: datvdemod.cpp:541
float Fs
Definition: datvdemod.h:74
int getAudioStreamIndex() const
float tap_multiplier
Definition: sdr.h:1730
int decimation
Definition: sdr.h:1731