diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2025-07-16 11:38:30 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2025-07-16 11:38:30 +0200 |
commit | cac0554c72e7f02965c53406efa308e1cffaa67b (patch) | |
tree | 7a3f1e0f2403fc3cb08c6f8978a94bb89273e1a9 | |
parent | 41a417bee0a55712a23a7a4bc080a021fe84ad51 (diff) | |
download | dabmux-cac0554c72e7f02965c53406efa308e1cffaa67b.tar.gz dabmux-cac0554c72e7f02965c53406efa308e1cffaa67b.tar.bz2 dabmux-cac0554c72e7f02965c53406efa308e1cffaa67b.zip |
Add support for UDP EDI input to specify local interface IP
-rw-r--r-- | doc/example.mux | 6 | ||||
-rw-r--r-- | src/input/Edi.cpp | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/doc/example.mux b/doc/example.mux index 34cd2ee..ae12fb2 100644 --- a/doc/example.mux +++ b/doc/example.mux @@ -211,11 +211,13 @@ subchannels { inputuri "tcp://0.0.0.0:9001" ; For UDP, PFT should be enabled at the sender. - ; Unicast UDP input: + ; Unicast UDP input, bound to all interfaces: ;inputuri "udp://:9001" + ; Unicast UDP input, bound to interface with IP 192.168.0.10: + ;inputuri "udp://192.168.0.10:9001" ; Multicast UDP input: ;inputuri "udp://@239.10.0.1:9001" - ; Multicast UDP input with local interface (192.168.0.10) specification + ; Multicast UDP input with local interface 192.168.0.10 specification ;inputuri "udp://192.168.0.10@239.10.0.1:9001" ; Two buffer-management types are available: prebuffering and timestamped. diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index 141641f..b100f32 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_bindto("udp://([^:]+):([0-9]+)"); const std::regex re_udp_multicast("udp://@([0-9.]+):([0-9]+)"); const std::regex re_udp_multicast_bindto("udp://([0-9.])+@([0-9.]+):([0-9]+)"); const std::regex re_tcp("tcp://(.*):([0-9]+)"); @@ -98,6 +99,12 @@ void Edi::open(const std::string& name) m_udp_sock.reinit(udp_port); m_udp_sock.setBlocking(false); } + else if (std::regex_match(name, m, re_udp_bindto)) { + const int udp_port = std::stoi(m[2].str()); + m_input_used = InputUsed::UDP; + m_udp_sock.reinit(udp_port, m[1].str()); + m_udp_sock.setBlocking(false); + } else if (std::regex_match(name, m, re_udp_multicast_bindto)) { const string bind_to = m[1].str(); const string multicast_address = m[2].str(); |