aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DabMultiplexer.cpp27
-rw-r--r--src/DabMultiplexer.h5
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