From ab64249989657e9b9e14735d3a1752f0f921056b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 13 Feb 2018 17:21:00 +0100 Subject: Make nonblock available again for file inputs --- src/ConfigParser.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/ConfigParser.cpp') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 17b34ca..120ca09 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -869,11 +869,6 @@ static void setup_subchannel_from_ptree(DabSubchannel* subchan, dabProtection* protection = &subchan->protection; - const bool nonblock = pt.get("nonblock", false); - if (nonblock) { - etiLog.level(warn) << "The nonblock option is not supported"; - } - if (type == "dabplus" or type == "audio") { subchan->type = subchannel_type_t::Audio; subchan->bitrate = 0; @@ -889,10 +884,7 @@ static void setup_subchannel_from_ptree(DabSubchannel* subchan, throw logic_error("Incomplete handling of file input"); } } - else if (proto == "tcp" || - proto == "epgm" || - proto == "ipc") { - + else if (proto == "tcp" or proto == "epgm" or proto == "ipc") { auto zmqconfig = setup_zmq_input(pt, subchanuid); if (type == "audio") { @@ -965,6 +957,17 @@ static void setup_subchannel_from_ptree(DabSubchannel* subchan, ss << "Subchannel with uid " << subchanuid << " has unknown type!"; throw runtime_error(ss.str()); } + + const bool nonblock = pt.get("nonblock", false); + if (nonblock) { + if (auto filein = dynamic_pointer_cast(subchan->input)) { + filein->setNonblocking(nonblock); + } + else { + etiLog.level(warn) << "The nonblock option is not supported"; + } + } + subchan->startAddress = 0; if (type == "audio") { -- cgit v1.2.3