diff options
-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(); |