From a1921a1a967b65c99a830141e9faaecd77b0f317 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 28 Jul 2017 11:54:32 +0200 Subject: 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 --- src/DabMux.cpp | 54 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 5 deletions(-) (limited to 'src/DabMux.cpp') 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 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; @@ -331,6 +332,46 @@ int main(int argc, char *argv[]) mux.set_edi_config(edi_conf); #else 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 output; + + string endpoint = pt_zeromq.get("endpoint"); + bool allow_metadata = pt_zeromq.get("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(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 { @@ -374,14 +415,17 @@ int main(int argc, char *argv[]) output = make_shared(); #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("tcp"); + output = make_shared("tcp", false); } else if (proto == "zmq+ipc") { - output = make_shared("ipc"); + output = make_shared("ipc", false); } else if (proto == "zmq+pgm") { - output = make_shared("pgm"); + output = make_shared("pgm", false); } else if (proto == "zmq+epgm") { - output = make_shared("epgm"); + output = make_shared("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 ---"); -- cgit v1.2.3