diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-19 22:32:27 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-01-19 22:32:27 +0100 |
commit | ca4fb30104c5f883794c40f2516636447ea5dd0f (patch) | |
tree | 052c4f300cb04908feac5812c5a9ef4b6f3571b7 /src/ParserConfigfile.cpp | |
parent | 6c482c8f1fdd74f6e7a8a9481b9f2211c559ebad (diff) | |
download | dabmux-ca4fb30104c5f883794c40f2516636447ea5dd0f.tar.gz dabmux-ca4fb30104c5f883794c40f2516636447ea5dd0f.tar.bz2 dabmux-ca4fb30104c5f883794c40f2516636447ea5dd0f.zip |
make DabInputZMQ a new-style input
Diffstat (limited to 'src/ParserConfigfile.cpp')
-rw-r--r-- | src/ParserConfigfile.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index 1ef2b28..14d9e6b 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -444,6 +444,11 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan, subchan->inputName = inputName; + /* The input is of the old_style type, + * with the struct of function pointers, + * and needs to be a DabInputCompatible + */ + bool input_is_old_style = true; dabInputOperations operations; dabProtection* protection = &subchan->protection; @@ -462,6 +467,10 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan, char* proto; + char* full_inputName = new char[256]; + full_inputName[255] = '\0'; + memcpy(full_inputName, inputName, 255); + proto = strstr(inputName, "://"); if (proto == NULL) { subchan->inputProto = "file"; @@ -479,17 +488,21 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan, #if defined(HAVE_INPUT_ZEROMQ) } else if (strcmp(subchan->inputProto, "tcp") == 0) { - operations = dabInputZmqOperations; + input_is_old_style = false; + subchan->input = new DabInputZmq(subchanuid); + subchan->inputName = full_inputName; } else if (strcmp(subchan->inputProto, "epmg") == 0) { - etiLog.log(warn, - "Using untested epmg:// zeromq input\n"); - operations = dabInputZmqOperations; + etiLog.level(warn) << "Using untested epmg:// zeromq input"; + input_is_old_style = false; + subchan->input = new DabInputZmq(subchanuid); + subchan->inputName = full_inputName; } else if (strcmp(subchan->inputProto, "ipc") == 0) { - etiLog.log(warn, - "Using untested ipc:// zeromq input\n"); - operations = dabInputZmqOperations; + etiLog.level(warn) << "Using untested ipc:// zeromq input"; + input_is_old_style = false; + subchan->input = new DabInputZmq(subchanuid); + subchan->inputName = full_inputName; #endif // defined(HAVE_INPUT_ZEROMQ) } else { stringstream ss; @@ -731,5 +744,8 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan, catch (ptree_error &e) {} /* Create object */ - subchan->input = new DabInputCompatible(operations); + if (input_is_old_style) { + subchan->input = new DabInputCompatible(operations); + } + // else { it's already been created! } } |