diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-14 16:05:16 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-14 16:05:16 +0200 |
commit | cdb85b87c07cdd912c765cdbfe3e32586cc34b0a (patch) | |
tree | dc32b7a9e660d62e5f1df1537419f80b3a8414c8 | |
parent | 052450fb9462a185341616b9e7c6193cd305b187 (diff) | |
download | dabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.tar.gz dabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.tar.bz2 dabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.zip |
Add EDI UDP multicast support
-rw-r--r-- | TODO.md | 5 | ||||
-rw-r--r-- | doc/example.mux | 8 | ||||
-rw-r--r-- | src/input/Edi.cpp | 10 |
3 files changed, 16 insertions, 7 deletions
@@ -20,11 +20,6 @@ and which ones would make sense to add. Also, there is no documentation on the possibilites of packet data. -Multicast support for the UDP input ------------------------------------ -The current UDP input implementation cannot join a multicast group. - - Improvements for inputs ----------------------- Add statistics to UDP input, in a similar way that ZeroMQ offers statistics. diff --git a/doc/example.mux b/doc/example.mux index 92a644d..f170bda 100644 --- a/doc/example.mux +++ b/doc/example.mux @@ -192,9 +192,15 @@ subchannels { ; for audio and dabplus, EDI input is available. It supports TCP server and UDP inputproto edi - ; Accepts connection to port 9001 from any interface + ; Accepts connection to port 9001 from any interface. Prefer disabling PFT when using TCP. inputuri "tcp://0.0.0.0:9001" + ; For UDP, PFT should be enabled at the sender. + ; Unicast UDP input: + ;inputuri "udp://:9001" + ; Multicast UDP input: + ;inputuri "udp://@239.10.0.1:9001" + ; Two buffer-management types are available: prebuffering and timestamped. ; prebuffering will accumulate a few frames before it starts streaming, and each ; time there is a buffer underrun (similar to how the ZMQ input works) diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index e206f28..338a8e6 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -80,6 +80,7 @@ Edi::~Edi() { void Edi::open(const std::string& name) { const std::regex re_udp("udp://:([0-9]+)"); + const std::regex re_udp_multicast("udp://@([0-9.]+):([0-9]+)"); const std::regex re_tcp("tcp://(.*):([0-9]+)"); lock_guard<mutex> lock(m_mutex); @@ -95,7 +96,14 @@ void Edi::open(const std::string& name) m_input_used = InputUsed::UDP; m_udp_sock.reinit(udp_port); m_udp_sock.setBlocking(false); - // TODO multicast + } + else if (std::regex_match(name, m, re_udp_multicast)) { + const string multicast_address = m[1].str(); + const int udp_port = std::stoi(m[2].str()); + m_input_used = InputUsed::UDP; + m_udp_sock.reinit(udp_port); + m_udp_sock.setBlocking(false); + m_udp_sock.joinGroup(multicast_address.c_str()); } else if (std::regex_match(name, m, re_tcp)) { m_input_used = InputUsed::TCP; |