diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-05-28 16:56:43 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-05-28 17:22:25 +0200 |
commit | 43f4a3a2a695c303bd4fdfbd7fec6def29284f2e (patch) | |
tree | b4b853aae86ae97f8b9ffa8bc2cc477e7b336b4c /src/dabOutput/dabOutput.h | |
parent | 3dc74c15f76e999768643ed4381196292d5376bc (diff) | |
download | dabmux-43f4a3a2a695c303bd4fdfbd7fec6def29284f2e.tar.gz dabmux-43f4a3a2a695c303bd4fdfbd7fec6def29284f2e.tar.bz2 dabmux-43f4a3a2a695c303bd4fdfbd7fec6def29284f2e.zip |
Unify Socket abstractions
Diffstat (limited to 'src/dabOutput/dabOutput.h')
-rw-r--r-- | src/dabOutput/dabOutput.h | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/dabOutput/dabOutput.h b/src/dabOutput/dabOutput.h index 9cc18d7..c7e570b 100644 --- a/src/dabOutput/dabOutput.h +++ b/src/dabOutput/dabOutput.h @@ -28,8 +28,7 @@ #pragma once -#include "UdpSocket.h" -#include "TcpSocket.h" +#include "Socket.h" #include "Log.h" #include "string.h" #include <stdexcept> @@ -57,6 +56,8 @@ class DabOutput { return Open(name.c_str()); } + + // Return -1 on failure virtual int Write(void* buffer, int size) = 0; virtual int Close() = 0; @@ -145,15 +146,7 @@ class DabOutputRaw : public DabOutput class DabOutputUdp : public DabOutput { public: - DabOutputUdp() { - packet_ = new UdpPacket(6144); - socket_ = new UdpSocket(); - } - - virtual ~DabOutputUdp() { - delete socket_; - delete packet_; - } + DabOutputUdp(); int Open(const char* name); int Write(void* buffer, int size); @@ -171,8 +164,8 @@ class DabOutputUdp : public DabOutput DabOutputUdp operator=(const DabOutputUdp& other) = delete; std::string uri_; - UdpSocket* socket_; - UdpPacket* packet_; + Socket::UDPSocket socket_; + Socket::UDPPacket packet_; }; // -------------- TCP ------------------ @@ -190,7 +183,7 @@ class DabOutputTcp : public DabOutput private: std::string uri_; - std::shared_ptr<TCPDataDispatcher> dispatcher_; + std::shared_ptr<Socket::TCPDataDispatcher> dispatcher_; }; // -------------- Simul ------------------ |