Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ target_sources(tomato PUBLIC
./chat_gui/send_image_popup.cpp
./chat_gui/settings_window.hpp
./chat_gui/settings_window.cpp
./chat_gui/voip_video_display.hpp
./chat_gui/voip_video_display.cpp
./chat_gui/voip_chat_tab.hpp
./chat_gui/voip_chat_tab.cpp

Expand Down
51 changes: 51 additions & 0 deletions src/chat_gui/voip_video_display.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "./voip_video_display.hpp"

#include <solanaceae/contact/contact_store_i.hpp>

#include <vector>

VoIPVideoDisplay::VoIPVideoDisplay(
ObjectStore2& os,
ContactStore4I& cs,
StreamManager& sm,
TextureUploaderI& tu
) : _os(os), _cs(cs), _sm(sm), _tu(tu) {
}

VoIPVideoDisplay::~VoIPVideoDisplay(void) {
}

float VoIPVideoDisplay::render(float delta_time) {
// go over all contacts with os comp

{ // destory unrendered
std::vector<Contact4> to_destory;
_cs.registry()
.view<Contact::Components::VoIPVideoTexture>()
.each([this, &to_destory](Contact4 c, Contact::Components::VoIPVideoTexture& comp) {
if (comp.frames_since_render >= _frames_till_destory) {
// TODO: video sink

_tu.destroy(comp.texture);
to_destory.push_back(c);
return;
}
});
_cs.registry().erase<Contact::Components::VoIPVideoTexture>(to_destory.cbegin(), to_destory.cend());
}

// create/update rendered
_cs.registry()
.view<Contact::Components::VoIPVideoTexture>()
.each([this](Contact4 c, Contact::Components::VoIPVideoTexture& comp) {
// TODO: magic
if (comp.texture == 0) {

//comp.texture = _tu.upload(nullptr, w, h, format, TextureUploaderI::LINEAR, TextureUploaderI::STREAMING);
}
});

// render popout windows

return 1.f;
}
39 changes: 39 additions & 0 deletions src/chat_gui/voip_video_display.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once

#include <solanaceae/object_store/fwd.hpp>
#include <solanaceae/contact/fwd.hpp>
#include "../frame_streams/stream_manager.hpp"
#include "../texture_uploader.hpp"

namespace Contact::Components {
struct VoIPVideoTexture {
uint64_t texture {0};
// w,h,format
size_t frames_since_render {0};
};
} // Contact::Components

// creates/updates/destroys contact voip video sink textures that where rendered
// also connects/disconnects to voip stream source
// renders standalone(pop-out) video windows
class VoIPVideoDisplay final {
ObjectStore2& _os;
ContactStore4I& _cs;
StreamManager& _sm;
TextureUploaderI& _tu;

const size_t _frames_till_destory {2};

public:
VoIPVideoDisplay(
ObjectStore2& os,
ContactStore4I& cs,
StreamManager& sm,
TextureUploaderI& tu
);
~VoIPVideoDisplay(void);

public:
// call every frame
float render(float delta_time);
};
Loading