mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
Creation of the Connection Manager : this new mechanism continuously
checks for the presence of vimix programs in the network neibourhood. The list of connections can then be used for indentifying streaming requests and offers.
This commit is contained in:
65
Streamer.h
65
Streamer.h
@@ -4,9 +4,68 @@
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
#include <gst/app/gstappsrc.h>
|
||||
|
||||
#include "osc/OscReceivedElements.h"
|
||||
#include "osc/OscPacketListener.h"
|
||||
#include "ip/UdpSocket.h"
|
||||
|
||||
#include "NetworkToolkit.h"
|
||||
#include "FrameGrabber.h"
|
||||
|
||||
class Session;
|
||||
|
||||
class StreamingRequestListener : public osc::OscPacketListener {
|
||||
|
||||
protected:
|
||||
virtual void ProcessMessage( const osc::ReceivedMessage& m,
|
||||
const IpEndpointName& remoteEndpoint );
|
||||
};
|
||||
|
||||
class Streaming
|
||||
{
|
||||
// Private Constructor
|
||||
Streaming();
|
||||
Streaming(Streaming const& copy); // Not Implemented
|
||||
Streaming& operator=(Streaming const& copy); // Not Implemented
|
||||
|
||||
public:
|
||||
|
||||
static Streaming& manager()
|
||||
{
|
||||
// The only instance
|
||||
static Streaming _instance;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
void enable(bool on);
|
||||
void setSession(Session *se);
|
||||
|
||||
typedef struct {
|
||||
std::string client;
|
||||
std::string address;
|
||||
NetworkToolkit::Protocol protocol;
|
||||
int width;
|
||||
int height;
|
||||
} offer;
|
||||
|
||||
void makeOffer(const std::string &client);
|
||||
void retractOffer(offer o);
|
||||
|
||||
void addStream(const std::string &address);
|
||||
void removeStream(const std::string &address);
|
||||
|
||||
private:
|
||||
|
||||
std::string hostname_;
|
||||
static void listen();
|
||||
StreamingRequestListener listener_;
|
||||
UdpListeningReceiveSocket *receiver_;
|
||||
|
||||
Session *session_;
|
||||
int width_;
|
||||
int height_;
|
||||
std::vector<offer> offers_;
|
||||
};
|
||||
|
||||
class VideoStreamer : public FrameGrabber
|
||||
{
|
||||
// Frame buffer information
|
||||
@@ -14,6 +73,10 @@ class VideoStreamer : public FrameGrabber
|
||||
uint width_;
|
||||
uint height_;
|
||||
|
||||
//
|
||||
NetworkToolkit::Protocol protocol_;
|
||||
std::string address_;
|
||||
|
||||
// operation
|
||||
std::atomic<bool> streaming_;
|
||||
std::atomic<bool> accept_buffer_;
|
||||
@@ -30,7 +93,7 @@ class VideoStreamer : public FrameGrabber
|
||||
|
||||
public:
|
||||
|
||||
VideoStreamer();
|
||||
VideoStreamer(Streaming::offer config);
|
||||
~VideoStreamer();
|
||||
|
||||
void addFrame(FrameBuffer *frame_buffer, float dt) override;
|
||||
|
||||
Reference in New Issue
Block a user