mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
fighting the crash everywhere: random crash at random location. Changing
computer might be better idea than changing the code indefinitely...
This commit is contained in:
@@ -96,7 +96,7 @@ set(PNG_LIBRARY PNG::PNG)
|
|||||||
# NB: set glfw3_PATH to /usr/local/Cellar/glfw/3.3.2/lib/cmake/glfw3
|
# NB: set glfw3_PATH to /usr/local/Cellar/glfw/3.3.2/lib/cmake/glfw3
|
||||||
#
|
#
|
||||||
find_package(glfw3 3.2 REQUIRED)
|
find_package(glfw3 3.2 REQUIRED)
|
||||||
macro_log_feature(glfw3_FOUND "GLFW3" "Open Source, multi-platform library for OpenGL" "http://www.glfw.org/" TRUE)
|
macro_log_feature(glfw3_FOUND "GLFW3" "Open Source multi-platform library for OpenGL" "http://www.glfw.org/" TRUE)
|
||||||
set(GLFW_LIBRARY glfw)
|
set(GLFW_LIBRARY glfw)
|
||||||
|
|
||||||
#find_package(OpenGL REQUIRED)
|
#find_package(OpenGL REQUIRED)
|
||||||
@@ -108,14 +108,14 @@ set(BUILD_STATIC_LIBS ON)
|
|||||||
# GLM
|
# GLM
|
||||||
#
|
#
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/glm)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/glm)
|
||||||
message(STATUS "Compiling 'GLM' OpenGL Mathematics https://glm.g-truc.net.")
|
message(STATUS "Compiling 'GLM' OpenGL mathematics https://glm.g-truc.net.")
|
||||||
|
|
||||||
#
|
#
|
||||||
# GLAD
|
# GLAD
|
||||||
#
|
#
|
||||||
set(GLAD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ext/glad/include)
|
set(GLAD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ext/glad/include)
|
||||||
add_library(GLAD "${CMAKE_CURRENT_SOURCE_DIR}/ext/glad/src/glad.c")
|
add_library(GLAD "${CMAKE_CURRENT_SOURCE_DIR}/ext/glad/src/glad.c")
|
||||||
message(STATUS "Compiling 'GLAD' generated at https://glad.dav1d.de/ -- ${GLAD_INCLUDE_DIR}.")
|
message(STATUS "Compiling 'GLAD' Open source multi-language OpenGL loader https://glad.dav1d.de/ -- ${GLAD_INCLUDE_DIR}.")
|
||||||
|
|
||||||
#
|
#
|
||||||
# DEAR IMGUI
|
# DEAR IMGUI
|
||||||
@@ -357,8 +357,8 @@ message(STATUS "Using 'CMakeRC ' from https://github.com/vector-of-bool/cmrc.git
|
|||||||
|
|
||||||
target_link_libraries(${VMIX_BINARY} LINK_PRIVATE
|
target_link_libraries(${VMIX_BINARY} LINK_PRIVATE
|
||||||
${GLFW_LIBRARY}
|
${GLFW_LIBRARY}
|
||||||
# ${OPENGL_LIBRARY}
|
|
||||||
GLAD
|
GLAD
|
||||||
|
glm::glm
|
||||||
${CMAKE_DL_LIBS}
|
${CMAKE_DL_LIBS}
|
||||||
${GOBJECT_LIBRARIES}
|
${GOBJECT_LIBRARIES}
|
||||||
${GSTREAMER_LIBRARY}
|
${GSTREAMER_LIBRARY}
|
||||||
@@ -375,7 +375,6 @@ target_link_libraries(${VMIX_BINARY} LINK_PRIVATE
|
|||||||
TINYXML2
|
TINYXML2
|
||||||
TINYFD
|
TINYFD
|
||||||
IMGUI
|
IMGUI
|
||||||
glm::glm
|
|
||||||
vmix::rc
|
vmix::rc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,17 @@ glm::vec3 FrameBuffer::getResolutionFromParameters(int ar, int h)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBuffer::FrameBuffer(glm::vec3 resolution, bool useAlpha, bool multiSampling): textureid_(0), intermediate_textureid_(0), framebufferid_(0), intermediate_framebufferid_(0), use_alpha_(useAlpha), use_multi_sampling_(multiSampling)
|
FrameBuffer::FrameBuffer(glm::vec3 resolution, bool useAlpha, bool multiSampling):
|
||||||
|
textureid_(0), intermediate_textureid_(0), framebufferid_(0), intermediate_framebufferid_(0),
|
||||||
|
use_alpha_(useAlpha), use_multi_sampling_(multiSampling)
|
||||||
{
|
{
|
||||||
attrib_.viewport = glm::ivec2(resolution);
|
attrib_.viewport = glm::ivec2(resolution);
|
||||||
attrib_.clear_color = glm::vec4(0.f, 0.f, 0.f, use_alpha_ ? 0.f : 1.f);
|
attrib_.clear_color = glm::vec4(0.f, 0.f, 0.f, use_alpha_ ? 0.f : 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameBuffer::FrameBuffer(uint width, uint height, bool useAlpha, bool multiSampling): textureid_(0), intermediate_textureid_(0), framebufferid_(0), intermediate_framebufferid_(0), use_alpha_(useAlpha), use_multi_sampling_(multiSampling)
|
FrameBuffer::FrameBuffer(uint width, uint height, bool useAlpha, bool multiSampling):
|
||||||
|
textureid_(0), intermediate_textureid_(0), framebufferid_(0), intermediate_framebufferid_(0),
|
||||||
|
use_alpha_(useAlpha), use_multi_sampling_(multiSampling)
|
||||||
{
|
{
|
||||||
attrib_.viewport = glm::ivec2(width, height);
|
attrib_.viewport = glm::ivec2(width, height);
|
||||||
attrib_.clear_color = glm::vec4(0.f, 0.f, 0.f, use_alpha_ ? 0.f : 1.f);
|
attrib_.clear_color = glm::vec4(0.f, 0.f, 0.f, use_alpha_ ? 0.f : 1.f);
|
||||||
@@ -63,14 +67,14 @@ void FrameBuffer::init()
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
|
||||||
|
|
||||||
// attach the multisampled texture to FBO (currently binded)
|
// attach the multisampled texture to FBO (framebufferid_ currently binded)
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, intermediate_textureid_, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE, intermediate_textureid_, 0);
|
||||||
|
|
||||||
// create an intermediate FBO
|
// create an intermediate FBO : this is the FBO to use for reading
|
||||||
glGenFramebuffers(1, &intermediate_framebufferid_);
|
glGenFramebuffers(1, &intermediate_framebufferid_);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, intermediate_framebufferid_);
|
glBindFramebuffer(GL_FRAMEBUFFER, intermediate_framebufferid_);
|
||||||
|
|
||||||
// attach the 2D texture to intermediate FBO
|
// attach the 2D texture to intermediate FBO (intermediate_framebufferid_)
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureid_, 0);
|
||||||
|
|
||||||
// Log::Info("New FBO %d Multi Sampling ", framebufferid_);
|
// Log::Info("New FBO %d Multi Sampling ", framebufferid_);
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ static MediaInfo UriDiscoverer_(std::string uri)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
MediaInfo video_stream_info;
|
MediaInfo video_stream_info;
|
||||||
|
// assume it will fail
|
||||||
|
video_stream_info.failed = true;
|
||||||
|
|
||||||
/* Instantiate the Discoverer */
|
/* Instantiate the Discoverer */
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
@@ -123,6 +125,8 @@ static MediaInfo UriDiscoverer_(std::string uri)
|
|||||||
GstDiscovererStreamInfo *tmpinf = (GstDiscovererStreamInfo *) tmp->data;
|
GstDiscovererStreamInfo *tmpinf = (GstDiscovererStreamInfo *) tmp->data;
|
||||||
if ( GST_IS_DISCOVERER_VIDEO_INFO(tmpinf) )
|
if ( GST_IS_DISCOVERER_VIDEO_INFO(tmpinf) )
|
||||||
{
|
{
|
||||||
|
// inform that it succeeded
|
||||||
|
video_stream_info.failed = false;
|
||||||
// found a video / image stream : fill-in information
|
// found a video / image stream : fill-in information
|
||||||
GstDiscovererVideoInfo* vinfo = GST_DISCOVERER_VIDEO_INFO(tmpinf);
|
GstDiscovererVideoInfo* vinfo = GST_DISCOVERER_VIDEO_INFO(tmpinf);
|
||||||
video_stream_info.width = gst_discoverer_video_info_get_width(vinfo);
|
video_stream_info.width = gst_discoverer_video_info_get_width(vinfo);
|
||||||
@@ -167,8 +171,6 @@ static MediaInfo UriDiscoverer_(std::string uri)
|
|||||||
gst_discoverer_stream_info_list_free(streams);
|
gst_discoverer_stream_info_list_free(streams);
|
||||||
|
|
||||||
if (!foundvideostream) {
|
if (!foundvideostream) {
|
||||||
// inform that it failed
|
|
||||||
video_stream_info.failed = true;
|
|
||||||
Log::Warning("Warning: No video stream in '%s'", uri.c_str());
|
Log::Warning("Warning: No video stream in '%s'", uri.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
69
Mixer.cpp
69
Mixer.cpp
@@ -26,7 +26,7 @@ using namespace tinyxml2;
|
|||||||
|
|
||||||
#include "Mixer.h"
|
#include "Mixer.h"
|
||||||
|
|
||||||
#define THREADED_LOADING
|
//#define THREADED_LOADING
|
||||||
|
|
||||||
// static semaphore to prevent multiple threads for load / save
|
// static semaphore to prevent multiple threads for load / save
|
||||||
static std::atomic<bool> sessionThreadActive_ = false;
|
static std::atomic<bool> sessionThreadActive_ = false;
|
||||||
@@ -40,17 +40,19 @@ static Session *loadSession_(const std::string& filename)
|
|||||||
{
|
{
|
||||||
Session *s = new Session;
|
Session *s = new Session;
|
||||||
|
|
||||||
// actual loading of xml file
|
if (s) {
|
||||||
SessionCreator creator( s );
|
// actual loading of xml file
|
||||||
|
SessionCreator creator( s );
|
||||||
|
|
||||||
if (creator.load(filename)) {
|
if (creator.load(filename)) {
|
||||||
// loaded ok
|
// loaded ok
|
||||||
s->setFilename(filename);
|
s->setFilename(filename);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// error loading
|
// error loading
|
||||||
delete s;
|
delete s;
|
||||||
s = nullptr;
|
s = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
@@ -148,6 +150,14 @@ Mixer::Mixer() : session_(nullptr), back_session_(nullptr), current_view_(nullpt
|
|||||||
|
|
||||||
void Mixer::update()
|
void Mixer::update()
|
||||||
{
|
{
|
||||||
|
if (garbage_.size()>0) {
|
||||||
|
|
||||||
|
delete garbage_.back();
|
||||||
|
garbage_.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef THREADED_LOADING
|
||||||
// if there is a session importer pending
|
// if there is a session importer pending
|
||||||
if (!sessionImporters_.empty()) {
|
if (!sessionImporters_.empty()) {
|
||||||
// check status of loader: did it finish ?
|
// check status of loader: did it finish ?
|
||||||
@@ -169,6 +179,7 @@ void Mixer::update()
|
|||||||
sessionLoaders_.pop_back();
|
sessionLoaders_.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// if a change of session is requested
|
// if a change of session is requested
|
||||||
if (sessionSwapRequested_) {
|
if (sessionSwapRequested_) {
|
||||||
@@ -588,10 +599,32 @@ void Mixer::saveas(const std::string& filename)
|
|||||||
|
|
||||||
void Mixer::load(const std::string& filename)
|
void Mixer::load(const std::string& filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#ifdef THREADED_LOADING
|
||||||
// load only one at a time
|
// load only one at a time
|
||||||
if (sessionLoaders_.empty()) {
|
if (sessionLoaders_.empty()) {
|
||||||
|
// Start async thread for loading the session
|
||||||
|
// Will be obtained in the future in update()
|
||||||
sessionLoaders_.emplace_back( std::async(std::launch::async, loadSession_, filename) );
|
sessionLoaders_.emplace_back( std::async(std::launch::async, loadSession_, filename) );
|
||||||
|
|
||||||
|
|
||||||
|
// Session *se = new Session;
|
||||||
|
|
||||||
|
// sessionLoaders_.emplace_back(std::async(std::launch::async,
|
||||||
|
// [](Session *s, const std::string& filename){
|
||||||
|
// // actual loading of xml file
|
||||||
|
// SessionCreator creator( s );
|
||||||
|
// if (creator.load(filename)) {
|
||||||
|
// // loaded ok
|
||||||
|
// s->setFilename(filename);
|
||||||
|
// }
|
||||||
|
// return s;
|
||||||
|
// }, se, filename));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
set( loadSession_(filename) );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mixer::open(const std::string& filename)
|
void Mixer::open(const std::string& filename)
|
||||||
@@ -622,9 +655,10 @@ void Mixer::import(const std::string& filename)
|
|||||||
{
|
{
|
||||||
// import only one at a time
|
// import only one at a time
|
||||||
if (sessionImporters_.empty()) {
|
if (sessionImporters_.empty()) {
|
||||||
|
// Start async thread for loading the session
|
||||||
|
// Will be obtained in the future in update()
|
||||||
sessionImporters_.emplace_back( std::async(std::launch::async, loadSession_, filename) );
|
sessionImporters_.emplace_back( std::async(std::launch::async, loadSession_, filename) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mixer::merge(Session *session)
|
void Mixer::merge(Session *session)
|
||||||
@@ -695,8 +729,9 @@ void Mixer::swap()
|
|||||||
// reset timer
|
// reset timer
|
||||||
update_time_ = GST_CLOCK_TIME_NONE;
|
update_time_ = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
// delete back
|
// delete back (former front session)
|
||||||
delete back_session_;
|
// delete back_session_;
|
||||||
|
garbage_.push_back(back_session_);
|
||||||
back_session_ = nullptr;
|
back_session_ = nullptr;
|
||||||
|
|
||||||
// notification
|
// notification
|
||||||
@@ -724,7 +759,8 @@ void Mixer::clear()
|
|||||||
{
|
{
|
||||||
// delete previous back session if needed
|
// delete previous back session if needed
|
||||||
if (back_session_)
|
if (back_session_)
|
||||||
delete back_session_;
|
garbage_.push_back(back_session_);
|
||||||
|
// delete back_session_;
|
||||||
|
|
||||||
// create empty session
|
// create empty session
|
||||||
back_session_ = new Session;
|
back_session_ = new Session;
|
||||||
@@ -744,7 +780,8 @@ void Mixer::set(Session *s)
|
|||||||
|
|
||||||
// delete previous back session if needed
|
// delete previous back session if needed
|
||||||
if (back_session_)
|
if (back_session_)
|
||||||
delete back_session_;
|
garbage_.push_back(back_session_);
|
||||||
|
// delete back_session_;
|
||||||
|
|
||||||
// set to new given session
|
// set to new given session
|
||||||
back_session_ = s;
|
back_session_ = s;
|
||||||
|
|||||||
1
Mixer.h
1
Mixer.h
@@ -82,6 +82,7 @@ protected:
|
|||||||
|
|
||||||
Session *session_;
|
Session *session_;
|
||||||
Session *back_session_;
|
Session *back_session_;
|
||||||
|
std::list<Session *> garbage_;
|
||||||
bool sessionSwapRequested_;
|
bool sessionSwapRequested_;
|
||||||
void swap();
|
void swap();
|
||||||
|
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ Scene::Scene()
|
|||||||
|
|
||||||
Scene::~Scene()
|
Scene::~Scene()
|
||||||
{
|
{
|
||||||
|
clear();
|
||||||
// bg and fg are deleted as children of root
|
// bg and fg are deleted as children of root
|
||||||
delete root_;
|
delete root_;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,12 @@
|
|||||||
|
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
Session::Session() : filename_(""), failedSource_(nullptr), active_(true), fading_target_(0.f)
|
Session::Session() : failedSource_(nullptr), active_(true), fading_target_(0.f)
|
||||||
{
|
{
|
||||||
|
filename_ = "";
|
||||||
|
|
||||||
config_[View::RENDERING] = new Group;
|
config_[View::RENDERING] = new Group;
|
||||||
config_[View::RENDERING]->scale_ = render_.resolution();
|
config_[View::RENDERING]->scale_ = FrameBuffer::getResolutionFromParameters(Settings::application.render.ratio, Settings::application.render.res);
|
||||||
|
|
||||||
config_[View::GEOMETRY] = new Group;
|
config_[View::GEOMETRY] = new Group;
|
||||||
config_[View::GEOMETRY]->scale_ = Settings::application.views[View::GEOMETRY].default_scale;
|
config_[View::GEOMETRY]->scale_ = Settings::application.views[View::GEOMETRY].default_scale;
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ void SessionCreator::visit(MediaPlayer &n)
|
|||||||
GstClockTime b = GST_CLOCK_TIME_NONE;
|
GstClockTime b = GST_CLOCK_TIME_NONE;
|
||||||
gap->QueryUnsigned64Attribute("begin", &a);
|
gap->QueryUnsigned64Attribute("begin", &a);
|
||||||
gap->QueryUnsigned64Attribute("end", &b);
|
gap->QueryUnsigned64Attribute("end", &b);
|
||||||
n.timeline().addGap( a, b ); // TODO ref access to timeline of source
|
n.timeline().addGap( a, b );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// playing properties
|
// playing properties
|
||||||
|
|||||||
5
View.cpp
5
View.cpp
@@ -541,7 +541,7 @@ uint MixingView::textureMixingQuadratic()
|
|||||||
|
|
||||||
RenderView::RenderView() : View(RENDERING), frame_buffer_(nullptr), fading_overlay_(nullptr)
|
RenderView::RenderView() : View(RENDERING), frame_buffer_(nullptr), fading_overlay_(nullptr)
|
||||||
{
|
{
|
||||||
// set resolution to settings or default
|
// set resolution to settings default
|
||||||
setResolution();
|
setResolution();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +571,8 @@ float RenderView::fading() const
|
|||||||
|
|
||||||
void RenderView::setResolution(glm::vec3 resolution)
|
void RenderView::setResolution(glm::vec3 resolution)
|
||||||
{
|
{
|
||||||
if (resolution.x < 128.f || resolution.y < 128.f)
|
// use default resolution if invalid resolution is given (default behavior)
|
||||||
|
if (resolution.x < 2.f || resolution.y < 2.f)
|
||||||
resolution = FrameBuffer::getResolutionFromParameters(Settings::application.render.ratio, Settings::application.render.res);
|
resolution = FrameBuffer::getResolutionFromParameters(Settings::application.render.ratio, Settings::application.render.res);
|
||||||
|
|
||||||
// do we need to change resolution ?
|
// do we need to change resolution ?
|
||||||
|
|||||||
Reference in New Issue
Block a user