mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 19:29:58 +01:00
bugfix: do not use global pointer to recorder
This commit is contained in:
@@ -57,7 +57,6 @@ using namespace std;
|
|||||||
|
|
||||||
#include "TextEditor.h"
|
#include "TextEditor.h"
|
||||||
static TextEditor editor;
|
static TextEditor editor;
|
||||||
static Recorder *main_video_recorder = nullptr;
|
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
void ShowAboutGStreamer(bool* p_open);
|
void ShowAboutGStreamer(bool* p_open);
|
||||||
@@ -293,14 +292,11 @@ void UserInterface::handleKeyboard()
|
|||||||
}
|
}
|
||||||
else if (ImGui::IsKeyPressed( GLFW_KEY_R )) {
|
else if (ImGui::IsKeyPressed( GLFW_KEY_R )) {
|
||||||
// toggle recording
|
// toggle recording
|
||||||
if (main_video_recorder){
|
Recorder *rec = Mixer::manager().session()->frontRecorder();
|
||||||
main_video_recorder->stop();
|
if (rec)
|
||||||
main_video_recorder = nullptr;
|
rec->stop();
|
||||||
}
|
else
|
||||||
else {
|
Mixer::manager().session()->addRecorder(new VideoRecorder);
|
||||||
main_video_recorder = new VideoRecorder;
|
|
||||||
Mixer::manager().session()->addRecorder(main_video_recorder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -632,9 +628,9 @@ void UserInterface::Render()
|
|||||||
ImGuiToolkit::ShowStats(&Settings::application.widget.stats, &Settings::application.widget.stats_corner);
|
ImGuiToolkit::ShowStats(&Settings::application.widget.stats, &Settings::application.widget.stats_corner);
|
||||||
|
|
||||||
// TODO: better management of main_video_recorder
|
// TODO: better management of main_video_recorder
|
||||||
if (main_video_recorder && main_video_recorder->duration() > Settings::application.record.timeout ){
|
Recorder *rec = Mixer::manager().session()->frontRecorder();
|
||||||
main_video_recorder->stop();
|
if (rec && rec->duration() > Settings::application.record.timeout ){
|
||||||
main_video_recorder = nullptr;
|
rec->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// all IMGUI Rendering
|
// all IMGUI Rendering
|
||||||
@@ -885,6 +881,9 @@ void UserInterface::RenderPreview()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Recorder *rec = Mixer::manager().session()->frontRecorder();
|
||||||
|
|
||||||
// menu (no title bar)
|
// menu (no title bar)
|
||||||
if (ImGui::BeginMenuBar())
|
if (ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
@@ -904,17 +903,15 @@ void UserInterface::RenderPreview()
|
|||||||
Mixer::manager().session()->addRecorder(new PNGRecorder);
|
Mixer::manager().session()->addRecorder(new PNGRecorder);
|
||||||
|
|
||||||
// Stop recording menu if main recorder already exists
|
// Stop recording menu if main recorder already exists
|
||||||
if (main_video_recorder) {
|
if (rec) {
|
||||||
if ( ImGui::MenuItem( ICON_FA_SQUARE " Stop Record", CTRL_MOD "R") ) {
|
if ( ImGui::MenuItem( ICON_FA_SQUARE " Stop Record", CTRL_MOD "R") ) {
|
||||||
main_video_recorder->stop();
|
rec->stop();
|
||||||
main_video_recorder = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// start recording
|
// start recording
|
||||||
else {
|
else {
|
||||||
if ( ImGui::MenuItem( ICON_FA_CIRCLE " Record", CTRL_MOD "R") ) {
|
if ( ImGui::MenuItem( ICON_FA_CIRCLE " Record", CTRL_MOD "R") ) {
|
||||||
main_video_recorder = new VideoRecorder;
|
Mixer::manager().session()->addRecorder(new VideoRecorder);
|
||||||
Mixer::manager().session()->addRecorder(main_video_recorder);
|
|
||||||
}
|
}
|
||||||
// select profile
|
// select profile
|
||||||
ImGui::SetNextItemWidth(300);
|
ImGui::SetNextItemWidth(300);
|
||||||
@@ -965,7 +962,6 @@ void UserInterface::RenderPreview()
|
|||||||
// preview image
|
// preview image
|
||||||
ImGui::Image((void*)(intptr_t)output->texture(), imagesize);
|
ImGui::Image((void*)(intptr_t)output->texture(), imagesize);
|
||||||
// recording indicator overlay
|
// recording indicator overlay
|
||||||
Recorder *rec = Mixer::manager().session()->frontRecorder();
|
|
||||||
if (rec)
|
if (rec)
|
||||||
{
|
{
|
||||||
float r = ImGui::GetTextLineHeightWithSpacing();
|
float r = ImGui::GetTextLineHeightWithSpacing();
|
||||||
|
|||||||
Reference in New Issue
Block a user