From 7140d25a87f552432c4b60a8463a96ad5634dc1e Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 13 Oct 2024 23:29:28 +0200 Subject: [PATCH 1/3] Improve GUI Player timeline panel Adjust widgets to fit in panel --- src/SourceControlWindow.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/SourceControlWindow.cpp b/src/SourceControlWindow.cpp index 28d2388..e065c72 100644 --- a/src/SourceControlWindow.cpp +++ b/src/SourceControlWindow.cpp @@ -2436,13 +2436,13 @@ void SourceControlWindow::RenderMediaPlayer(MediaSource *ms) /// MERGE CUTS AT CURSOR /// ImGui::SameLine(0, IMGUI_SAME_LINE); - DragButtonIcon(19, 3, "Drop in timeline to\nMerge right", + DragButtonIcon(19, 3, "Drop in timeline to\nMerge two gaps", TimelinePayload(TimelinePayload::CUT_MERGE, 0, 0) ); /// /// ERASE CUT AT CURSOR /// ImGui::SameLine(0, IMGUI_SAME_LINE); - DragButtonIcon(0, 4, "Drop in timeline to\nErase right", + DragButtonIcon(0, 4, "Drop in timeline to\nErase a gap", TimelinePayload(TimelinePayload::CUT_ERASE, 0, 0) ); } else { @@ -2468,11 +2468,14 @@ void SourceControlWindow::RenderMediaPlayer(MediaSource *ms) ImGui::SameLine(0, 0); ImVec2 draw_pos = ImGui::GetCursorPos(); - ImGui::SetNextItemWidth(180); // TODO VARIABLE WIDTH + ImGui::SetCursorPosY(ImGui::GetTextLineHeightWithSpacing() * 0.333 ); + + float w = gap_dialog_size.x - 4.f * ImGui::GetTextLineHeightWithSpacing() ; + ImGui::SetNextItemWidth(w - draw_pos.x - IMGUI_SAME_LINE); // VARIABLE WIDTH ImGuiToolkit::InputTime("##Time", &target_time); - ImGui::SetCursorPos(ImVec2(draw_pos.x, draw_pos.y + 35)); - ImGuiToolkit::HSliderUInt64("#SliderTime", ImVec2(180, 14), &target_time, 0, tl->duration()); + // ImGui::SetCursorPos(ImVec2(draw_pos.x, draw_pos.y + 35)); + // ImGuiToolkit::HSliderUInt64("#SliderTime", ImVec2(180, 14), &target_time, 0, tl->duration()); // static int p = 5; // ImGuiToolkit::HSliderInt("#toto", ImVec2(140, 14), &p, 1, 9); @@ -2505,10 +2508,7 @@ void SourceControlWindow::RenderMediaPlayer(MediaSource *ms) // Action buttons ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - - ImGui::SetCursorPos( - ImVec2(gap_dialog_size.x - 4.f * ImGui::GetTextLineHeightWithSpacing() - IMGUI_SAME_LINE, - draw_pos.y)); + ImGui::SetCursorPos( ImVec2(w, draw_pos.y)); // ImGui::SameLine(0, IMGUI_SAME_LINE); if (ImGuiToolkit::ButtonIcon(17, 3, "Cut left at given time")) { @@ -2646,7 +2646,10 @@ void SourceControlWindow::RenderMediaPlayer(MediaSource *ms) // float md = 10000; ImGui::SameLine(0, IMGUI_SAME_LINE); - ImGui::SetNextItemWidth(180); + + ImVec2 draw_pos = ImGui::GetCursorPos(); + float w = gap_dialog_size.x - 3.f * ImGui::GetTextLineHeightWithSpacing() - IMGUI_SAME_LINE; + ImGui::SetNextItemWidth(w - draw_pos.x); float seconds = (float) d / 1000.f; if (current_curve > 0) { From 6da476aebba96807f1b3243aa65863d98ae1019b Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 13 Oct 2024 23:50:27 +0200 Subject: [PATCH 2/3] bugFix Allow fail of Stream source without deleting FB Reverting to previous code --- src/Stream.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Stream.cpp b/src/Stream.cpp index c74e498..a811971 100644 --- a/src/Stream.cpp +++ b/src/Stream.cpp @@ -77,6 +77,18 @@ Stream::~Stream() { Stream::close(); + // cleanup opengl texture + if (textureindex_) { + glDeleteTextures(1, &textureindex_); + textureindex_ = 0; + } + + // cleanup picture buffer + if (pbo_[0]) { + glDeleteBuffers(2, pbo_); + pbo_[0] = 0; + } + #ifdef STREAM_DEBUG g_printerr("Stream %s deleted\n", std::to_string(id_).c_str()); #endif @@ -440,17 +452,6 @@ void Stream::close() bus_ = nullptr; } - // cleanup opengl texture - if (textureindex_) { - glDeleteTextures(1, &textureindex_); - textureindex_ = 0; - } - - // cleanup picture buffer - if (pbo_[0]) { - glDeleteBuffers(2, pbo_); - pbo_[0] = 0; - } } From 7de751f882a1cd323c5e37bc396a091c9cc8d91f Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sun, 13 Oct 2024 23:58:02 +0200 Subject: [PATCH 3/3] Improve error message of Mixer --- src/Mixer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mixer.cpp b/src/Mixer.cpp index 981e68c..960a8c7 100644 --- a/src/Mixer.cpp +++ b/src/Mixer.cpp @@ -223,7 +223,7 @@ void Mixer::update() // (can be automatically repaired without user intervention) if (fail == Source::FAIL_RETRY) { if ( !recreateSource( *it ) ) { - Log::Warning("Source '%s' failed and could not be fixed.", (*it)->name().c_str()); + Log::Notify("Source '%s' failed.", (*it)->name().c_str()); // delete failed source if could not recreate it deleteSource( *it ); } @@ -236,7 +236,7 @@ void Mixer::update() // Delete FATAL failed sources from the mixer // (nothing can be done by the user) else { - Log::Warning("Source '%s' failed and was deleted.", (*it)->name().c_str()); + Log::Warning("Source '%s' failed.", (*it)->name().c_str()); deleteSource( *it ); } // needs refresh after intervention @@ -246,7 +246,7 @@ void Mixer::update() else if ( fail < Source::FAIL_CRITICAL ) { // This looks like we should try to recreate it if ( !recreateSource( *it ) ) { - Log::Warning("Source '%s' definitely failed and could not be fixed.", (*it)->name().c_str()); + Log::Warning("Source '%s' failed and could not be recovered.", (*it)->name().c_str()); // delete failed source if could not recreate it deleteSource( *it ); }