From cc4cac79ada4adf808bd09417942a995530c3a69 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Thu, 13 May 2021 18:30:11 +0200 Subject: Fix subchannel extraction --- src/dabplussnoop.hpp | 13 +++++++------ src/etianalyse.cpp | 29 ++++++++++++++++++----------- src/etianalyse.hpp | 2 +- 3 files changed, 26 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/dabplussnoop.hpp b/src/dabplussnoop.hpp index b2a2dd3..b62d94d 100644 --- a/src/dabplussnoop.hpp +++ b/src/dabplussnoop.hpp @@ -84,8 +84,7 @@ he_aac_super_frame(subchannel_index) class DabPlusSnoop { public: - void set_subchannel_index(unsigned subchannel_index) - { + void set_subchannel_index(unsigned subchannel_index) { m_subchannel_index = subchannel_index; } @@ -93,8 +92,7 @@ class DabPlusSnoop m_write_to_wav_file = enable; } - void set_index(int index) - { + void set_index(int index) { m_index = index; } @@ -148,12 +146,15 @@ class StreamSnoop dps.set_subchannel_index(subchannel_index); } - void set_index(int index) - { + void set_index(int index) { m_index = index; dps.set_index(index); } + int get_index() const { + return m_index; + } + void push(uint8_t* streamdata, size_t streamsize); audio_statistics_t get_audio_statistics(void) const; diff --git a/src/etianalyse.cpp b/src/etianalyse.cpp index d84a4f1..d477c0e 100644 --- a/src/etianalyse.cpp +++ b/src/etianalyse.cpp @@ -389,17 +389,17 @@ void ETI_Analyser::eti_analyse() printvalue("STL", 3, "Sub-channel Stream Length", to_string(stl[i])); printvalue("bitrate", 3, "kbit/s", to_string(stl[i]*8/3)); - if (config.statistics and config.streams_to_decode.count(i) == 0) { + if (config.statistics and config.streams_to_decode.count(scid) == 0) { config.streams_to_decode.emplace(std::piecewise_construct, - std::make_tuple(i), + std::make_tuple(scid), std::make_tuple(false)); // do not dump to file - config.streams_to_decode.at(i).subchid = scid; + config.streams_to_decode.at(scid).subchid = scid; } - if (config.streams_to_decode.count(i) > 0) { - config.streams_to_decode.at(i).set_subchannel_index(stl[i]/3); - config.streams_to_decode.at(i).set_index(i); - config.streams_to_decode.at(i).subchid = scid; + if (config.streams_to_decode.count(scid) > 0) { + config.streams_to_decode.at(scid).set_subchannel_index(stl[i]/3); + config.streams_to_decode.at(scid).set_index(i); + config.streams_to_decode.at(scid).subchid = scid; } } @@ -499,15 +499,22 @@ void ETI_Analyser::eti_analyse() printsequencestart(2); printvalue("Id", 3, "", to_string(i)); printvalue("Length", 3, "", to_string(stl[i]*8)); - printvalue("Selected for decoding", 3, "", - (config.streams_to_decode.count(i) > 0 ? "true" : "false")); + + int subch_ix = -1; + for (const auto& el : config.streams_to_decode) { + if (el.second.get_index() == i) { + subch_ix = el.first; + break; + } + } + printvalue("Selected for decoding", 3, "", (subch_ix == -1 ? "false" : "true")); if (get_verbosity() > 1) { printbuf("Data", 3, streamdata, stl[i]*8); } - if (config.streams_to_decode.count(i) > 0) { - config.streams_to_decode.at(i).push(streamdata, stl[i]*8); + if (subch_ix != -1) { + config.streams_to_decode.at(subch_ix).push(streamdata, stl[i]*8); } } diff --git a/src/etianalyse.hpp b/src/etianalyse.hpp index 692ec34..b03de82 100644 --- a/src/etianalyse.hpp +++ b/src/etianalyse.hpp @@ -48,7 +48,7 @@ struct eti_analyse_config_t { FILE* etifd = nullptr; FILE* ficfd = nullptr; bool ignore_error = false; - std::map streams_to_decode; + std::map streams_to_decode; std::list > figs_to_display; bool analyse_fic_carousel = false; bool analyse_fig_rates = false; -- cgit v1.2.3