mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
Following CppCheck recomendation, all classes that should not be manipulated by value are made non-assignable to ensure no mistake is made.
84 lines
1.9 KiB
C++
84 lines
1.9 KiB
C++
#ifndef NETWORKSOURCE_H
|
|
#define NETWORKSOURCE_H
|
|
|
|
#include "osc/OscReceivedElements.h"
|
|
#include "osc/OscPacketListener.h"
|
|
#include "osc/OscOutboundPacketStream.h"
|
|
#include "ip/UdpSocket.h"
|
|
|
|
#include "NetworkToolkit.h"
|
|
#include "Connection.h"
|
|
#include "StreamSource.h"
|
|
|
|
class NetworkStream;
|
|
|
|
class StreamerResponseListener : public osc::OscPacketListener
|
|
{
|
|
protected:
|
|
class NetworkStream *parent_;
|
|
virtual void ProcessMessage( const osc::ReceivedMessage& m,
|
|
const IpEndpointName& remoteEndpoint );
|
|
public:
|
|
inline void setParent(NetworkStream *s) { parent_ = s; }
|
|
StreamerResponseListener() : parent_(nullptr) {}
|
|
};
|
|
|
|
|
|
class NetworkStream : public Stream
|
|
{
|
|
friend class StreamerResponseListener;
|
|
|
|
public:
|
|
|
|
NetworkStream();
|
|
|
|
void connect(const std::string &nameconnection);
|
|
bool connected() const;
|
|
void disconnect();
|
|
|
|
void update() override;
|
|
|
|
glm::ivec2 resolution() const;
|
|
inline NetworkToolkit::Protocol protocol() const { return config_.protocol; }
|
|
std::string clientAddress() const;
|
|
std::string serverAddress() const;
|
|
|
|
private:
|
|
// connection information
|
|
ConnectionInfo streamer_;
|
|
StreamerResponseListener listener_;
|
|
UdpListeningReceiveSocket *receiver_;
|
|
std::atomic<bool> received_config_;
|
|
std::atomic<bool> connected_;
|
|
|
|
NetworkToolkit::StreamConfig config_;
|
|
};
|
|
|
|
|
|
class NetworkSource : public StreamSource
|
|
{
|
|
std::string connection_name_;
|
|
|
|
public:
|
|
NetworkSource(uint64_t id = 0);
|
|
~NetworkSource();
|
|
|
|
// Source interface
|
|
void accept (Visitor& v) override;
|
|
|
|
// StreamSource interface
|
|
Stream *stream() const override { return stream_; }
|
|
NetworkStream *networkStream() const;
|
|
|
|
// specific interface
|
|
void setConnection(const std::string &nameconnection);
|
|
std::string connection() const;
|
|
|
|
glm::ivec2 icon() const override { return glm::ivec2(18, 11); }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NETWORKSOURCE_H
|