From c6ac35addb94d73ff6bc5f9486db909c8af36d47 Mon Sep 17 00:00:00 2001 From: Bruno Date: Sat, 19 Jun 2021 00:47:47 +0200 Subject: [PATCH] Player slight improvements tick marks count adapted to fps, clamped refresh frequency computation, listing of all sources playable from menu --- ImGuiToolkit.cpp | 2 +- MediaPlayer.cpp | 2 +- UserInterfaceManager.cpp | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ImGuiToolkit.cpp b/ImGuiToolkit.cpp index 9799521..ce9bd19 100644 --- a/ImGuiToolkit.cpp +++ b/ImGuiToolkit.cpp @@ -483,7 +483,7 @@ void ImGuiToolkit::RenderTimeline (ImGuiWindow* window, ImRect timeline_bbox, gu { // try to put a label ticks every second label_tick_step = (SECOND / step) * step; - large_tick_step = 5 * step; + large_tick_step = label_tick_step % 5 ? (label_tick_step % 2 ? label_tick_step : label_tick_step / 2 ) : label_tick_step / 5; tick_delta = SECOND - label_tick_step; // round to nearest diff --git a/MediaPlayer.cpp b/MediaPlayer.cpp index 6cc0dcb..780a5d0 100644 --- a/MediaPlayer.cpp +++ b/MediaPlayer.cpp @@ -1250,6 +1250,6 @@ void MediaPlayer::TimeCounter::tic () // calculate instantaneous framerate // Exponential moving averate with previous framerate to filter jitter if (dt > 1.0) - fps = 0.5 * fps + 500.0 / dt ; + fps = CLAMP( 0.5 * fps + 500.0 / dt, 0.0, 1000.0) ; } diff --git a/UserInterfaceManager.cpp b/UserInterfaceManager.cpp index 6a1b5cd..e5c99f5 100644 --- a/UserInterfaceManager.cpp +++ b/UserInterfaceManager.cpp @@ -1075,7 +1075,7 @@ void UserInterface::RenderPreview() ImGui::Separator(); bool pinned = Settings::application.widget.preview_view == Settings::application.current_view; - if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin to current view", nullptr, &pinned) ){ + if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin window to view", nullptr, &pinned) ){ if (pinned) Settings::application.widget.preview_view = Settings::application.current_view; else @@ -2048,6 +2048,13 @@ void SourceController::Render() } if (ImGui::BeginMenu(IMGUI_TITLE_MEDIAPLAYER)) { + if (ImGui::MenuItem( ICON_FA_TH " List all")) { + selection_.clear(); + resetActiveSelection(); + Mixer::manager().unsetCurrentSource(); + Mixer::selection().clear(); + selection_ = playable_only( Mixer::manager().session()->getDepthSortedList() ); + } if (ImGui::MenuItem( ICON_FA_WIND " Clear")) { selection_.clear(); resetActiveSelection(); @@ -2057,7 +2064,7 @@ void SourceController::Render() ImGui::Separator(); bool pinned = Settings::application.widget.media_player_view == Settings::application.current_view; - if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin to current view", nullptr, &pinned) ){ + if ( ImGui::MenuItem( ICON_FA_MAP_PIN " Pin window to view", nullptr, &pinned) ){ if (pinned) Settings::application.widget.media_player_view = Settings::application.current_view; else @@ -2163,6 +2170,10 @@ void SourceController::Render() ImGui::EndMenu(); } } + else { + ImGui::SameLine(0, 2.f * g.Style.ItemSpacing.x ); + ImGui::TextDisabled(ICON_FA_FILM " Video"); + } ImGui::EndMenuBar(); } @@ -2752,7 +2763,7 @@ void SourceController::RenderSelectedSources() if (ImGui::Button( label.c_str() )) { active_selection_ = Mixer::manager().session()->numPlayGroups(); active_label_ = std::string("Selection #") + std::to_string(active_selection_); - Mixer::manager().session()->addPlayGroup( ids(playable_only(Mixer::selection().getCopy())) ); + Mixer::manager().session()->addPlayGroup( ids(playable_only(selection_)) ); } ImGui::PopStyleColor(2);