summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-07 21:59:59 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-11-07 21:59:59 +0100
commit4388257ae49ab64f510294037df50e057ac55794 (patch)
tree11e2399942353a97476df33bb956ca026e4f1700
parente9b2ff4084c48e5978298ac080275e474d7858a8 (diff)
downloaddabmux-4388257ae49ab64f510294037df50e057ac55794.tar.gz
dabmux-4388257ae49ab64f510294037df50e057ac55794.tar.bz2
dabmux-4388257ae49ab64f510294037df50e057ac55794.zip
Remove parser for old inputs
-rw-r--r--src/ConfigParser.cpp310
1 files changed, 0 insertions, 310 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 1ed1bac..0f05076 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -610,316 +610,6 @@ static void setup_subchannel_from_ptree(DabSubchannel* subchan,
subchan->inputUri = inputUri;
-#if OLD_INPUTS // {{{
- /* 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;
-
-
- if (0) {
-#if defined(HAVE_FORMAT_MPEG)
- } else if (type == "audio") {
- subchan->type = subchannel_type_t::Audio;
- subchan->bitrate = 0;
-
- if (0) {
-#if defined(HAVE_INPUT_FILE)
- } else if (proto == "file") {
- operations = dabInputMpegFileOperations;
-#endif // defined(HAVE_INPUT_FILE)
-#if defined(HAVE_INPUT_ZEROMQ)
- }
- else if (proto == "tcp" ||
- proto == "epgm" ||
- proto == "ipc") {
- input_is_old_style = false;
-
- auto zmqconfig = setup_zmq_input(pt, subchanuid);
-
- DabInputZmqMPEG* inzmq =
- new DabInputZmqMPEG(subchanuid, zmqconfig);
- rcs.enrol(inzmq);
- subchan->input = inzmq;
-
- if (proto == "epgm") {
- etiLog.level(warn) << "Using untested epgm:// zeromq input";
- }
- else if (proto == "ipc") {
- etiLog.level(warn) << "Using untested ipc:// zeromq input";
- }
-
-#endif // defined(HAVE_INPUT_ZEROMQ)
- } else {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": Invalid protocol for MPEG input (" <<
- proto << ")" << endl;
- throw runtime_error(ss.str());
- }
-#endif // defined(HAVE_INPUT_FILE) && defined(HAVE_FORMAT_MPEG)
-#if defined(HAVE_FORMAT_DABPLUS)
- } else if (type == "dabplus") {
- subchan->type = subchannel_type_t::Audio;
- subchan->bitrate = 32;
-
- if (0) {
-#if defined(HAVE_INPUT_FILE)
- } else if (proto == "file") {
- operations = dabInputDabplusFileOperations;
-#endif // defined(HAVE_INPUT_FILE)
-#if defined(HAVE_INPUT_ZEROMQ)
- }
- else if (proto == "tcp" ||
- proto == "epgm" ||
- proto == "ipc") {
- input_is_old_style = false;
-
- auto zmqconfig = setup_zmq_input(pt, subchanuid);
-
- DabInputZmqAAC* inzmq =
- new DabInputZmqAAC(subchanuid, zmqconfig);
-
- rcs.enrol(inzmq);
- subchan->input = inzmq;
-
- if (proto == "epgm") {
- etiLog.level(warn) << "Using untested epgm:// zeromq input";
- }
- else if (proto == "ipc") {
- etiLog.level(warn) << "Using untested ipc:// zeromq input";
- }
-#endif // defined(HAVE_INPUT_ZEROMQ)
- } else {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": Invalid protocol for DAB+ input (" <<
- proto << ")" << endl;
- throw runtime_error(ss.str());
- }
-#endif // defined(HAVE_FORMAT_DABPLUS)
- } else if (type == "data" and proto == "prbs") {
- input_is_old_style = false;
-
- subchan->input = make_shared<Inputs::Prbs>();
- subchan->type = subchannel_type_t::DataDmb;
- subchan->bitrate = DEFAULT_DATA_BITRATE;
- } else if (type == "data") {
- // TODO default proto should be udp://
- if (0) {
-#if defined(HAVE_INPUT_UDP)
- } else if (proto == "udp") {
- operations = dabInputUdpOperations;
-#endif
-#if defined(HAVE_INPUT_FILE) && defined(HAVE_FORMAT_RAW)
- } else if (proto == "file") {
- operations = dabInputRawFileOperations;
-#endif
-#if defined(HAVE_INPUT_FIFO)
- } else if (proto == "fifo") {
- operations = dabInputRawFifoOperations;
-#endif
- } else {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": Invalid protocol for data input (" <<
- proto << ")" << endl;
- throw runtime_error(ss.str());
- }
-
- subchan->type = subchannel_type_t::DataDmb;
- subchan->bitrate = DEFAULT_DATA_BITRATE;
-#ifdef HAVE_FORMAT_PACKET
- } else if (type == "packet") {
- subchan->type = subchannel_type_t::Packet;
- subchan->bitrate = DEFAULT_PACKET_BITRATE;
-#ifdef HAVE_INPUT_FILE
- operations = dabInputPacketFileOperations;
-#elif defined(HAVE_INPUT_FIFO)
- operations = dabInputFifoOperations;
-#else
-# pragma error("Must define at least one packet input")
-#endif // defined(HAVE_INPUT_FILE)
-#ifdef HAVE_FORMAT_EPM
- } else if (type == "enhancedpacket") {
- subchan->type = subchannel_type_t::Packet;
- subchan->bitrate = DEFAULT_PACKET_BITRATE;
- operations = dabInputEnhancedPacketFileOperations;
-#endif // defined(HAVE_FORMAT_EPM)
-#endif // defined(HAVE_FORMAT_PACKET)
-#ifdef HAVE_FORMAT_DMB
- } else if (type == "dmb") {
- // TODO default proto should be UDP
- if (0) {
-#if defined(HAVE_INPUT_UDP)
- } else if (proto == "udp") {
- operations = dabInputDmbUdpOperations;
-#endif
- } else if (proto == "file") {
- operations = dabInputDmbFileOperations;
- } else {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": Invalid protocol for DMB input (" <<
- proto << ")" << endl;
- throw runtime_error(ss.str());
- }
-
- subchan->type = subchannel_type_t::DataDmb;
- subchan->bitrate = DEFAULT_DATA_BITRATE;
-#endif
- } else {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid << " has unknown type!";
- throw runtime_error(ss.str());
- }
- subchan->startAddress = 0;
-
- if (type == "audio") {
- protection->form = UEP;
- protection->level = 2;
- protection->uep.tableIndex = 0;
- } else {
- protection->level = 2;
- protection->form = EEP;
- protection->eep.profile = EEP_A;
- }
-
- /* Get bitrate */
- try {
- subchan->bitrate = pt.get<int>("bitrate");
- if ((subchan->bitrate & 0x7) != 0) {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": Bitrate (" << subchan->bitrate << " not a multiple of 8!";
- throw runtime_error(ss.str());
- }
- }
- catch (ptree_error &e) {
- stringstream ss;
- ss << "Error, no bitrate defined for subchannel " << subchanuid;
- throw runtime_error(ss.str());
- }
-
-#if defined(HAVE_INPUT_FIFO) && defined(HAVE_INPUT_FILE)
- /* Get nonblock */
- bool nonblock = pt.get("nonblock", false);
- if (nonblock) {
- switch (subchan->type) {
-#ifdef HAVE_FORMAT_PACKET
- case subchannel_type_t::Packet:
- if (operations == dabInputPacketFileOperations) {
- operations = dabInputFifoOperations;
-#ifdef HAVE_FORMAT_EPM
- } else if (operations == dabInputEnhancedPacketFileOperations) {
- operations = dabInputEnhancedFifoOperations;
-#endif // defined(HAVE_FORMAT_EPM)
- } else {
- stringstream ss;
- ss << "Error, wrong packet operations for subchannel " <<
- subchanuid;
- throw runtime_error(ss.str());
- }
- break;
-#endif // defined(HAVE_FORMAT_PACKET)
-#ifdef HAVE_FORMAT_MPEG
- case subchannel_type_t::Audio:
- if (operations == dabInputMpegFileOperations) {
- operations = dabInputMpegFifoOperations;
- } else if (operations == dabInputDabplusFileOperations) {
- operations = dabInputDabplusFifoOperations;
- } else {
- stringstream ss;
- ss << "Error, wrong audio operations for subchannel " <<
- subchanuid;
- throw runtime_error(ss.str());
- }
- break;
-#endif // defined(HAVE_FORMAT_MPEG)
- case subchannel_type_t::DataDmb:
- case subchannel_type_t::Fidc:
- default:
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- " non-blocking I/O only available for audio or packet services!";
- throw runtime_error(ss.str());
- }
- }
-#endif // defined(HAVE_INPUT_FIFO) && defined(HAVE_INPUT_FILE)
-
-
- /* Get id */
-
- try {
- subchan->id = hexparse(pt.get<std::string>("id"));
- }
- catch (ptree_error &e) {
- for (int i = 0; i < 64; ++i) { // Find first free subchannel
- vector<DabSubchannel*>::iterator subchannel = getSubchannel(ensemble->subchannels, i);
- if (subchannel == ensemble->subchannels.end()) {
- subchannel = ensemble->subchannels.end() - 1;
- subchan->id = i;
- break;
- }
- }
- }
-
- /* Get optional protection profile */
- string profile = pt.get("protection-profile", "");
-
- if (profile == "EEP_A") {
- protection->form = EEP;
- protection->eep.profile = EEP_A;
- }
- else if (profile == "EEP_B") {
- protection->form = EEP;
- protection->eep.profile = EEP_B;
- }
- else if (profile == "UEP") {
- protection->form = UEP;
- }
-
- /* Get protection level */
- try {
- int level = pt.get<int>("protection");
-
- if (protection->form == UEP) {
- if ((level < 1) || (level > 5)) {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": protection level must be between "
- "1 to 5 inclusively (current = " << level << " )";
- throw runtime_error(ss.str());
- }
- }
- else if (protection->form == EEP) {
- if ((level < 1) || (level > 4)) {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": protection level must be between "
- "1 to 4 inclusively (current = " << level << " )";
- throw runtime_error(ss.str());
- }
- }
- protection->level = level - 1;
- }
- catch (ptree_error &e) {
- stringstream ss;
- ss << "Subchannel with uid " << subchanuid <<
- ": protection level undefined!";
- throw runtime_error(ss.str());
- }
-
- /* Create object */
- if (input_is_old_style) {
- subchan->input = new DabInputCompatible(operations);
- }
- // else { it's already been created! }
-#endif // 0 }}}
-
dabProtection* protection = &subchan->protection;
const bool nonblock = pt.get("nonblock", false);