Player slight improvements

tick marks count adapted to fps, clamped refresh frequency computation, listing of all sources playable from menu
This commit is contained in:
Bruno
2021-06-19 00:47:47 +02:00
parent 9ec279754b
commit c6ac35addb
3 changed files with 16 additions and 5 deletions

View File

@@ -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

View File

@@ -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) ;
}

View File

@@ -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);