summaryrefslogtreecommitdiffstats
path: root/src/DabMux.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-28 11:54:32 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-28 11:54:32 +0200
commita1921a1a967b65c99a830141e9faaecd77b0f317 (patch)
tree193c00c382f1389f61a01870c937802e7e49212c /src/DabMux.cpp
parent9aee86aace7d6c504b410c972d0ab5065f7f7b94 (diff)
downloaddabmux-a1921a1a967b65c99a830141e9faaecd77b0f317.tar.gz
dabmux-a1921a1a967b65c99a830141e9faaecd77b0f317.tar.bz2
dabmux-a1921a1a967b65c99a830141e9faaecd77b0f317.zip
Add new zeromq config format
This gives the choice for the transmission of the metadata, and the enabling of the TAI downloader is also triggered appropriately
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r--src/DabMux.cpp54
1 files changed, 49 insertions, 5 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 5d109fa..c0f5ad0 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -275,6 +275,7 @@ int main(int argc, char *argv[])
/******************** READ OUTPUT PARAMETERS ***************/
set<string> all_output_names;
+ bool output_require_tai_clock = false;
ptree pt_outputs = pt.get_child("outputs");
for (auto ptree_pair : pt_outputs) {
string outputuid = ptree_pair.first;
@@ -333,6 +334,46 @@ int main(int argc, char *argv[])
throw runtime_error("EDI output not compiled in");
#endif
}
+ else if (outputuid == "zeromq") {
+#if defined(HAVE_OUTPUT_ZEROMQ)
+ ptree pt_zeromq = pt_outputs.get_child("zeromq");
+ shared_ptr<DabOutput> output;
+
+ string endpoint = pt_zeromq.get<string>("endpoint");
+ bool allow_metadata = pt_zeromq.get<bool>("allowmetadata");
+ output_require_tai_clock |= allow_metadata;
+
+ size_t proto_pos = endpoint.find("://");
+ if (proto_pos == std::string::npos) {
+ stringstream ss;
+ ss << "zeromq output endpoint '" << endpoint << "' has incorrect format!";
+ throw runtime_error(ss.str());
+ }
+
+ string proto = endpoint.substr(0, proto_pos);
+ string location = endpoint.substr(proto_pos + 3);
+
+ output = make_shared<DabOutputZMQ>(proto, allow_metadata);
+
+ if (not output) {
+ etiLog.level(error) <<
+ "Unable to init zeromq output " <<
+ endpoint;
+ return -1;
+ }
+
+ if (output->Open(location) == -1) {
+ etiLog.level(error) <<
+ "Unable to open zeromq output " <<
+ endpoint;
+ return -1;
+ }
+
+ outputs.push_back(output);
+#else
+ throw runtime_error("ZeroMQ output not compiled in");
+#endif
+ }
else {
string uri = pt_outputs.get<string>(outputuid);
@@ -374,14 +415,17 @@ int main(int argc, char *argv[])
output = make_shared<DabOutputSimul>();
#endif // defined(HAVE_OUTPUT_SIMUL)
#if defined(HAVE_OUTPUT_ZEROMQ)
+ /* The legacy configuration setting will not enable metadata,
+ * to keep backward compatibility
+ */
} else if (proto == "zmq+tcp") {
- output = make_shared<DabOutputZMQ>("tcp");
+ output = make_shared<DabOutputZMQ>("tcp", false);
} else if (proto == "zmq+ipc") {
- output = make_shared<DabOutputZMQ>("ipc");
+ output = make_shared<DabOutputZMQ>("ipc", false);
} else if (proto == "zmq+pgm") {
- output = make_shared<DabOutputZMQ>("pgm");
+ output = make_shared<DabOutputZMQ>("pgm", false);
} else if (proto == "zmq+epgm") {
- output = make_shared<DabOutputZMQ>("epgm");
+ output = make_shared<DabOutputZMQ>("epgm", false);
#endif // defined(HAVE_OUTPUT_ZEROMQ)
} else {
etiLog.level(error) << "Output protocol unknown: " << proto;
@@ -413,7 +457,7 @@ int main(int argc, char *argv[])
throw MuxInitException();
}
- mux.prepare();
+ mux.prepare(output_require_tai_clock);
mux.print_info();
etiLog.log(info, "--- Output list ---");