aboutsummaryrefslogtreecommitdiffstats
path: root/src/ParserConfigfile.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-11 11:55:43 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-11 11:55:43 +0200
commitfa36e03255eb668195f043d39307f3dc2fa5e809 (patch)
treecc5e69cc8fe5cc50b4bbda52b4ba2d7caf033942 /src/ParserConfigfile.cpp
parente3e7925934074d61835aa09a642f09bc6cd16d1d (diff)
downloaddabmux-fa36e03255eb668195f043d39307f3dc2fa5e809.tar.gz
dabmux-fa36e03255eb668195f043d39307f3dc2fa5e809.tar.bz2
dabmux-fa36e03255eb668195f043d39307f3dc2fa5e809.zip
Add zmq buffer options to config file
Diffstat (limited to 'src/ParserConfigfile.cpp')
-rw-r--r--src/ParserConfigfile.cpp102
1 files changed, 66 insertions, 36 deletions
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp
index f781b78..6b261e5 100644
--- a/src/ParserConfigfile.cpp
+++ b/src/ParserConfigfile.cpp
@@ -585,28 +585,43 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
#endif // defined(HAVE_INPUT_FILE)
#if defined(HAVE_INPUT_ZEROMQ)
}
- else if (strcmp(subchan->inputProto, "tcp") == 0) {
+ else if ((strcmp(subchan->inputProto, "tcp") == 0) ||
+ (strcmp(subchan->inputProto, "epmg") == 0) ||
+ (strcmp(subchan->inputProto, "ipc") == 0) ) {
input_is_old_style = false;
- DabInputZmqMPEG* inzmq = new DabInputZmqMPEG(subchanuid);
- inzmq->enrol_at(*rc);
- subchan->input = inzmq;
- subchan->inputName = full_inputName;
- }
- else if (strcmp(subchan->inputProto, "epmg") == 0) {
- etiLog.level(warn) << "Using untested epmg:// zeromq input";
- input_is_old_style = false;
- DabInputZmqMPEG* inzmq = new DabInputZmqMPEG(subchanuid);
- inzmq->enrol_at(*rc);
- subchan->input = inzmq;
- subchan->inputName = full_inputName;
- }
- else if (strcmp(subchan->inputProto, "ipc") == 0) {
- etiLog.level(warn) << "Using untested ipc:// zeromq input";
- input_is_old_style = false;
- DabInputZmqMPEG* inzmq = new DabInputZmqMPEG(subchanuid);
+
+ int buffer_size;
+ int prebuffering;
+ try {
+ buffer_size = pt.get<int>("zmq-buffer");
+ }
+ catch (ptree_error &e) {
+ stringstream ss;
+ ss << "ZMQ Subchannel with uid " << subchanuid <<
+ " has no zmq-buffer defined!";
+ throw runtime_error(ss.str());
+ }
+ try {
+ prebuffering = pt.get<int>("zmq-prebuffering");
+ }
+ catch (ptree_error &e) {
+ stringstream ss;
+ ss << "ZMQ Subchannel with uid " << subchanuid <<
+ " has no zmq-buffer defined!";
+ throw runtime_error(ss.str());
+ }
+ DabInputZmqMPEG* inzmq =
+ new DabInputZmqMPEG(subchanuid, buffer_size, prebuffering);
inzmq->enrol_at(*rc);
subchan->input = inzmq;
subchan->inputName = full_inputName;
+
+ if (strcmp(subchan->inputProto, "epmg") == 0) {
+ etiLog.level(warn) << "Using untested epmg:// zeromq input";
+ }
+ else if (strcmp(subchan->inputProto, "ipc") == 0) {
+ etiLog.level(warn) << "Using untested ipc:// zeromq input";
+ }
#endif // defined(HAVE_INPUT_ZEROMQ)
} else {
stringstream ss;
@@ -643,28 +658,43 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
#endif // defined(HAVE_INPUT_FILE)
#if defined(HAVE_INPUT_ZEROMQ)
}
- else if (strcmp(subchan->inputProto, "tcp") == 0) {
+ else if ((strcmp(subchan->inputProto, "tcp") == 0) ||
+ (strcmp(subchan->inputProto, "epmg") == 0) ||
+ (strcmp(subchan->inputProto, "ipc") == 0) ) {
input_is_old_style = false;
- DabInputZmqAAC* inzmq = new DabInputZmqAAC(subchanuid);
- inzmq->enrol_at(*rc);
- subchan->input = inzmq;
- subchan->inputName = full_inputName;
- }
- else if (strcmp(subchan->inputProto, "epmg") == 0) {
- etiLog.level(warn) << "Using untested epmg:// zeromq input";
- input_is_old_style = false;
- DabInputZmqAAC* inzmq = new DabInputZmqAAC(subchanuid);
- inzmq->enrol_at(*rc);
- subchan->input = inzmq;
- subchan->inputName = full_inputName;
- }
- else if (strcmp(subchan->inputProto, "ipc") == 0) {
- etiLog.level(warn) << "Using untested ipc:// zeromq input";
- input_is_old_style = false;
- DabInputZmqAAC* inzmq = new DabInputZmqAAC(subchanuid);
+
+ int buffer_size;
+ int prebuffering;
+ try {
+ buffer_size = pt.get<int>("zmq-buffer");
+ }
+ catch (ptree_error &e) {
+ stringstream ss;
+ ss << "ZMQ Subchannel with uid " << subchanuid <<
+ " has no zmq-buffer defined!";
+ throw runtime_error(ss.str());
+ }
+ try {
+ prebuffering = pt.get<int>("zmq-prebuffering");
+ }
+ catch (ptree_error &e) {
+ stringstream ss;
+ ss << "ZMQ Subchannel with uid " << subchanuid <<
+ " has no zmq-buffer defined!";
+ throw runtime_error(ss.str());
+ }
+ DabInputZmqAAC* inzmq =
+ new DabInputZmqAAC(subchanuid, buffer_size, prebuffering);
inzmq->enrol_at(*rc);
subchan->input = inzmq;
subchan->inputName = full_inputName;
+
+ if (strcmp(subchan->inputProto, "epmg") == 0) {
+ etiLog.level(warn) << "Using untested epmg:// zeromq input";
+ }
+ else if (strcmp(subchan->inputProto, "ipc") == 0) {
+ etiLog.level(warn) << "Using untested ipc:// zeromq input";
+ }
#endif // defined(HAVE_INPUT_ZEROMQ)
} else {
stringstream ss;