diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2020-04-11 01:05:51 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-13 15:55:41 +0200 |
commit | e52e4b1eb1a6d8e769b41d3f45f105f39b67b14c (patch) | |
tree | 7e7b62274d12819d966ce8534584f7e667b2de98 /gr-dtv/lib/atsc | |
parent | 95178211eb87d6bf40d51210cf501e6e840863fe (diff) |
dtv: replace stderr logging by calls to GR's logging facilties
This is but a first step; a lot of code in gr-dtv is very much libc in
C++, thus we'll have a lot of printf's to deal with in the future.
Diffstat (limited to 'gr-dtv/lib/atsc')
-rw-r--r-- | gr-dtv/lib/atsc/atsc_fs_checker_impl.cc | 13 | ||||
-rw-r--r-- | gr-dtv/lib/atsc/atsc_fs_checker_impl.h | 3 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gr-dtv/lib/atsc/atsc_fs_checker_impl.cc b/gr-dtv/lib/atsc/atsc_fs_checker_impl.cc index 838b60cb73..2295bd783c 100644 --- a/gr-dtv/lib/atsc/atsc_fs_checker_impl.cc +++ b/gr-dtv/lib/atsc/atsc_fs_checker_impl.cc @@ -18,6 +18,7 @@ #include "atsc_types.h" #include "gnuradio/dtv/atsc_consts.h" #include <gnuradio/io_signature.h> +#include <string> #define ATSC_SEGMENTS_PER_DATA_FIELD 313 @@ -37,6 +38,7 @@ atsc_fs_checker_impl::atsc_fs_checker_impl() io_signature::make(1, 1, sizeof(atsc_soft_data_segment)), io_signature::make(1, 1, sizeof(atsc_soft_data_segment))) { + gr::configure_default_loggers(d_logger, d_debug_logger, "dtv_atsc_fs_checker"); reset(); } @@ -69,7 +71,8 @@ int atsc_fs_checker_impl::general_work(int noutput_items, for (int j = 0; j < LENGTH_511 && errors < PN511_ERROR_LIMIT; j++) errors += (in[i].data[j + OFFSET_511] >= 0) ^ atsc_pn511[j]; - // std::cout << errors << std::endl; + GR_LOG_DEBUG(d_debug_logger, + std::string("second PN63 error count = ") + std::to_string(errors)); if (errors < PN511_ERROR_LIMIT) { // 511 pattern is good. // determine if this is field 1 or field 2 @@ -79,17 +82,17 @@ int atsc_fs_checker_impl::general_work(int noutput_items, // we should have either field 1 (== PN63) or field 2 (== ~PN63) if (errors <= PN63_ERROR_LIMIT) { - // std::cout << "Found FIELD_SYNC_1" << std::endl; + GR_LOG_DEBUG(d_debug_logger, "Found FIELD_SYNC_1") d_field_num = 1; // We are in field number 1 now d_segment_num = -1; // This is the first segment } else if (errors >= (LENGTH_2ND_63 - PN63_ERROR_LIMIT)) { - // std::cout << "Found FIELD_SYNC_2" << std::endl; + GR_LOG_DEBUG(d_debug_logger, "Found FIELD_SYNC_2") d_field_num = 2; // We are in field number 2 now d_segment_num = -1; // This is the first segment } else { // should be extremely rare. - std::cerr << "!!! atsc_fs_checker: PN63 error count = " << errors - << std::endl; + GR_LOG_WARN(d_logger, + std::string("PN63 error count = ") + std::to_string(errors)); } } diff --git a/gr-dtv/lib/atsc/atsc_fs_checker_impl.h b/gr-dtv/lib/atsc/atsc_fs_checker_impl.h index 34899990a3..30f2a892a1 100644 --- a/gr-dtv/lib/atsc/atsc_fs_checker_impl.h +++ b/gr-dtv/lib/atsc/atsc_fs_checker_impl.h @@ -13,6 +13,7 @@ #include "atsc_syminfo_impl.h" #include <gnuradio/dtv/atsc_fs_checker.h> +#include <gnuradio/logger.h> namespace gr { namespace dtv { @@ -27,6 +28,8 @@ private: unsigned char d_bit_sr[SRSIZE]; // binary decision shift register int d_field_num; int d_segment_num; + gr::logger_ptr d_logger; + gr::logger_ptr d_debug_logger; static constexpr int OFFSET_511 = 4; // offset to second PN 63 pattern static constexpr int LENGTH_511 = 511; // length of PN 63 pattern |