diff options
| author | Samuel Hunt <sam@maxxwave.co.uk> | 2026-01-08 16:13:19 +0000 |
|---|---|---|
| committer | Samuel Hunt <sam@maxxwave.co.uk> | 2026-01-08 16:13:19 +0000 |
| commit | b084bd07570cd031cbba4cc0617418883d82a9c7 (patch) | |
| tree | 4d27d6b4cf64aa03bf8b822280cb1208325f0ba3 /src/DabMultiplexer.cpp | |
| parent | 18398455642cf265995aa2988f1f3f610c6baf03 (diff) | |
| download | dabmux-b084bd07570cd031cbba4cc0617418883d82a9c7.tar.gz dabmux-b084bd07570cd031cbba4cc0617418883d82a9c7.tar.bz2 dabmux-b084bd07570cd031cbba4cc0617418883d82a9c7.zip | |
Priority based FIC scheduler capable of >40 services
Diffstat (limited to 'src/DabMultiplexer.cpp')
| -rw-r--r-- | src/DabMultiplexer.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 7a8ac97..32ed2b3 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -158,8 +158,7 @@ DabMultiplexer::DabMultiplexer(DabMultiplexerConfig& config) : m_config(config), m_time(), ensemble(std::make_shared<dabEnsemble>()), - m_clock_tai(split_pipe_separated_string(m_config.pt.get("general.tai_clock_bulletins", ""))), - fig_carousel(ensemble, [&]() { return m_time.get_milliseconds_seconds(); }) + m_clock_tai(split_pipe_separated_string(m_config.pt.get("general.tai_clock_bulletins", ""))) { RC_ADD_PARAMETER(frames, "Show number of frames generated [read-only]"); RC_ADD_PARAMETER(tist_offset, "Configured tist-offset"); @@ -185,6 +184,20 @@ void DabMultiplexer::prepare(bool require_tai_clock) { parse_ptree(m_config.pt, ensemble); + /* Create the appropriate FIG carousel based on config. + * This must happen after parse_ptree() which sets ensemble->fic_scheduler + */ + m_scheduler_type = ensemble->fic_scheduler; + auto time_func = [&]() { return m_time.get_milliseconds_seconds(); }; + + if (m_scheduler_type == FIC::FIGSchedulerType::Priority) { + etiLog.level(info) << "Using priority-based FIG scheduler"; + m_fig_carousel_priority.reset(new FIC::FIGCarouselPriority(ensemble, time_func)); + } else { + etiLog.level(info) << "Using classic FIG scheduler"; + m_fig_carousel_classic.reset(new FIC::FIGCarousel(ensemble, time_func)); + } + rcs.enrol(this); rcs.enrol(ensemble.get()); @@ -489,6 +502,17 @@ void DabMultiplexer::reload_linkagesets() } } +/* Helper method for FIG carousel write_fibs - abstracts the scheduler type */ +size_t DabMultiplexer::fig_carousel_write_fibs(uint8_t* buf, uint64_t current_frame, bool fib3_present) +{ + if (m_fig_carousel_priority) { + return m_fig_carousel_priority->write_fibs(buf, current_frame, fib3_present); + } else if (m_fig_carousel_classic) { + return m_fig_carousel_classic->write_fibs(buf, current_frame, fib3_present); + } + return 0; +} + /* Each call creates one ETI frame */ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs) { @@ -709,9 +733,9 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs edi_tagDETI.fic_data = &etiFrame[index]; edi_tagDETI.fic_length = FICL * 4; - // Insert all FIBs + // Insert all FIBs using the selected scheduler const bool fib3_present = (ensemble->transmission_mode == TransmissionMode_e::TM_III); - index += fig_carousel.write_fibs(&etiFrame[index], currentFrame, fib3_present); + index += fig_carousel_write_fibs(&etiFrame[index], currentFrame, fib3_present); /********************************************************************** ****** Input Data Reading ******************************************* |
