diff options
author | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-09-13 22:42:47 +0200 |
---|---|---|
committer | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-09-13 22:42:47 +0200 |
commit | 47c823ac611c54ae8ce3af2da40f9db0ec9b9195 (patch) | |
tree | 669e233651e50ef3ce84df314cde9e7c0f3a7bf3 /src/TimestampDecoder.h | |
parent | 95db3fa1e516aefa239f0dbe06bcda674e57b6a1 (diff) | |
download | dabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.tar.gz dabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.tar.bz2 dabmod-47c823ac611c54ae8ce3af2da40f9db0ec9b9195.zip |
crc-dabmod: much cleaner logging implementation
Diffstat (limited to 'src/TimestampDecoder.h')
-rw-r--r-- | src/TimestampDecoder.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index f55813f..dcc162e 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -26,10 +26,12 @@ #define TIMESTAMP_DECODER_H #include <queue> +#include <string> #include <time.h> #include <math.h> #include <stdio.h> #include "Eti.h" +#include "Log.h" struct modulator_offset_config { @@ -38,7 +40,7 @@ struct modulator_offset_config /* These two fields are used when the modulator is run with a fixed offset */ bool use_offset_file; - const char* offset_filename; + std::string offset_filename; /* These two fields are used when the modulator reads the offset from a file */ unsigned delay_calculation_pipeline_stages; @@ -103,8 +105,10 @@ struct frame_timestamp class TimestampDecoder { public: - TimestampDecoder(struct modulator_offset_config& config): - modconfig(config) + TimestampDecoder( + struct modulator_offset_config& config, + Logger& logger): + myLogger(logger), modconfig(config) { inhibit_second_update = 0; time_pps = 0.0; @@ -113,6 +117,12 @@ class TimestampDecoder full_timestamp_received_mnsc = false; gmtime_r(0, &temp_time); offset_changed = false; + + myLogger.level(info) << "Setting up timestamp decoder with " << + (modconfig.use_offset_fixed ? "fixed" : + (modconfig.use_offset_file ? "dynamic" : "none")) << + " offset"; + }; /* Calculate the timestamp for the current frame. */ @@ -126,6 +136,9 @@ class TimestampDecoder bool updateModulatorOffset(); protected: + /* Main program logger */ + Logger& myLogger; + /* Push a new MNSC field into the decoder */ void pushMNSCData(int framephase, uint16_t mnsc); |