aboutsummaryrefslogtreecommitdiffstats
path: root/src/input
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-14 16:05:16 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-05-14 16:05:16 +0200
commitcdb85b87c07cdd912c765cdbfe3e32586cc34b0a (patch)
treedc32b7a9e660d62e5f1df1537419f80b3a8414c8 /src/input
parent052450fb9462a185341616b9e7c6193cd305b187 (diff)
downloaddabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.tar.gz
dabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.tar.bz2
dabmux-cdb85b87c07cdd912c765cdbfe3e32586cc34b0a.zip
Add EDI UDP multicast support
Diffstat (limited to 'src/input')
-rw-r--r--src/input/Edi.cpp10
1 files changed, 9 insertions, 1 deletions
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;