summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO.md5
-rw-r--r--doc/example.mux8
-rw-r--r--src/input/Edi.cpp10
3 files changed, 16 insertions, 7 deletions
diff --git a/TODO.md b/TODO.md
index 13ed2c6..3ddc797 100644
--- a/TODO.md
+++ b/TODO.md
@@ -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;