From 0acabf70b7e6d70f324f3bdaf37cca960cad9d33 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Sun, 29 Sep 2024 13:11:29 +0200 Subject: [PATCH] voip model draft 1 --- src/frame_streams/voip_model.hpp | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/frame_streams/voip_model.hpp diff --git a/src/frame_streams/voip_model.hpp b/src/frame_streams/voip_model.hpp new file mode 100644 index 00000000..6346aea8 --- /dev/null +++ b/src/frame_streams/voip_model.hpp @@ -0,0 +1,71 @@ +#pragma once + +#include +#include + +struct VoIPModelI; + +namespace Components::VoIP { + + struct TagVoIPSession {}; + + // to talk to the model handling this session + struct VoIPModel { + VoIPModelI* ptr {nullptr}; + }; + + struct SessionState { + // ???? + // incoming + // outgoing + enum class State { + RINGING, + CONNECTED, + } state; + }; + + struct SessionContact { + Contact3 c{entt::null}; + }; + + struct StreamSources { + // list of all stream sources originating from this VoIP session + std::vector streams; + }; + + struct StreamSinks { + // list of all stream sinks going to this VoIP session + std::vector streams; + }; + +} // Components::VoIP + +// TODO: events? piggyback on objects? + +// stream model instead?? -> more generic than "just" audio and video? +// or specialized like this +// streams abstract type in a nice way +struct VoIPModelI { + virtual ~VoIPModelI(void) {} + + // enters a call/voicechat/videocall ??? + // - contact + // - default stream sources/sinks ? + // - enable a/v ? -> done on connecting to sources + // returns object tieing together the VoIP session + struct DefaultConfig { + bool incoming_audio {true}; + bool incoming_video {true}; + bool outgoing_audio {true}; + bool outgoing_video {true}; + }; + virtual ObjectHandle enter(const Contact3 c, const DefaultConfig& defaults = {}); + + // accept/join an invite to a session + virtual bool accept(ObjectHandle session); + + // leaves a call + // - VoIP session object + virtual bool leave(ObjectHandle session); +}; +