diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-07-03 08:05:36 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-07-03 08:05:36 +0200 |
commit | f99c4f75d7c1ffc18e3d04167e854af3d571f1b1 (patch) | |
tree | 8cf60c877a0fa1b9519895a66d6c013786e88d4a | |
parent | 191721eaecbc14fc65928c87dcccab9383d55200 (diff) | |
download | dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.tar.gz dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.tar.bz2 dabmux-f99c4f75d7c1ffc18e3d04167e854af3d571f1b1.zip |
Add dumb reconfigure to DabMultiplexer
-rw-r--r-- | src/DabMultiplexer.cpp | 27 | ||||
-rw-r--r-- | src/DabMultiplexer.h | 5 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 413e034..5c41d99 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -25,6 +25,7 @@ #include "DabMultiplexer.h" #include "ConfigParser.h" +#include <boost/make_shared.hpp> using namespace std; using namespace boost; @@ -88,7 +89,7 @@ DabMultiplexer::DabMultiplexer( { prepare_watermark(); - ensemble = boost::shared_ptr<dabEnsemble>(new dabEnsemble); + ensemble = boost::make_shared<dabEnsemble>(); } void DabMultiplexer::prepare_watermark() @@ -118,13 +119,16 @@ void DabMultiplexer::prepare_watermark() void DabMultiplexer::update_config(boost::property_tree::ptree pt) { - ensemble->services.clear(); - ensemble->components.clear(); - ensemble->subchannels.clear(); + ensemble_next = boost::make_shared<dabEnsemble>(); - m_pt = pt; + m_pt_next = pt; - prepare(); + reconfigure(); +} + +void DabMultiplexer::reconfigure() +{ + parse_ptree(m_pt_next, ensemble_next, m_rc, &edi_conf); } // Run a set of checks on the configuration @@ -195,16 +199,15 @@ void DabMultiplexer::prepare() void DabMultiplexer::prepare_subchannels() { set<unsigned char> ids; - vector<dabSubchannel*>::iterator subchannel; - for (subchannel = ensemble->subchannels.begin(); - subchannel != ensemble->subchannels.end(); - ++subchannel) { - if (ids.find((*subchannel)->id) != ids.end()) { + + for (auto subchannel : ensemble->subchannels) { + if (ids.find(subchannel->id) != ids.end()) { etiLog.log(error, "Subchannel %u is set more than once!\n", - (*subchannel)->id); + subchannel->id); throw MuxInitException(); } + ids.insert(subchannel->id); } } diff --git a/src/DabMultiplexer.h b/src/DabMultiplexer.h index e9843fc..9761ef9 100644 --- a/src/DabMultiplexer.h +++ b/src/DabMultiplexer.h @@ -82,6 +82,7 @@ class DabMultiplexer { void prepare_subchannels(void); void prepare_services_components(void); void prepare_data_inputs(void); + void reconfigure(void); boost::property_tree::ptree m_pt; boost::shared_ptr<BaseRemoteController> m_rc; @@ -118,6 +119,10 @@ class DabMultiplexer { std::vector<dabSubchannel*>::iterator subchannelFIG0_1; boost::shared_ptr<dabEnsemble> ensemble; + + // Multiplex reconfiguration requires two sets of configurations + boost::property_tree::ptree m_pt_next; + boost::shared_ptr<dabEnsemble> ensemble_next; }; // DAB Mode |