aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/Udp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/Udp.h')
-rw-r--r--src/input/Udp.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/input/Udp.h b/src/input/Udp.h
index 379dbf3..dc01486 100644
--- a/src/input/Udp.h
+++ b/src/input/Udp.h
@@ -2,7 +2,7 @@
Copyright (C) 2009 Her Majesty the Queen in Right of Canada (Communications
Research Center Canada)
- Copyright (C) 2016
+ Copyright (C) 2017
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -28,11 +28,16 @@
#include <string>
#include <vector>
+#include <deque>
+#include <boost/thread.hpp>
#include "input/inputs.h"
#include "UdpSocket.h"
namespace Inputs {
+/* A Udp input that takes incoming datagrams, concatenates them
+ * together and gives them back.
+ */
class Udp : public InputBase {
public:
virtual int open(const std::string& name);
@@ -40,13 +45,35 @@ class Udp : public InputBase {
virtual int setBitrate(int bitrate);
virtual int close();
- private:
+ protected:
UdpSocket m_sock;
+ std::string m_name;
+
+ void openUdpSocket(const std::string& endpoint);
+ private:
// The content of the UDP packets gets written into the
// buffer, and the UDP packet boundaries disappear there.
std::vector<uint8_t> m_buffer;
};
+/* An input for STI-D(LI) carried in STI(PI, X) inside RTP inside UDP.
+ * Reorders incoming datagrams which must contain an RTP header and valid
+ * STI-D data.
+ *
+ * This is intended to be compatible with encoders from AVT.
+ */
+class Sti_d_Rtp : public Udp {
+ using vec_u8 = std::vector<uint8_t>;
+
+ public:
+ virtual int open(const std::string& name);
+ virtual int readFrame(uint8_t* buffer, size_t size);
+
+ private:
+ void receive_packet(void);
+ std::deque<vec_u8> m_queue;
+};
+
};