From d7d099d2d70028ce92cab85c4b5d49b425069bb4 Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Thu, 1 Jun 2023 23:42:29 +0200 Subject: [PATCH] Add icon to show hardware decoding info in source panel --- src/ImGuiVisitor.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp index cc0c666..2638e3c 100644 --- a/src/ImGuiVisitor.cpp +++ b/src/ImGuiVisitor.cpp @@ -666,8 +666,9 @@ void ImGuiVisitor::visit (Source& s) void ImGuiVisitor::visit (MediaSource& s) { - ImVec2 top = ImGui::GetCursorPos(); - top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN; + ImVec2 _top = ImGui::GetCursorPos(); + _top.x = 0.5f * ImGui::GetFrameHeight() + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN; + ImVec2 top = _top; // Media info ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetContentRegionAvail().x IMGUI_RIGHT_ALIGN); @@ -694,6 +695,16 @@ void ImGuiVisitor::visit (MediaSource& s) if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) SystemToolkit::open(SystemToolkit::path_filename(s.path())); + // Icon to inform hardware decoding + std::string decoder = s.mediaplayer()->decoderName(); + if ( decoder.compare("software") != 0) { + top = _top; + top.y += ImGui::GetFrameHeight(); + ImGui::SetCursorPos(top); + decoder = "Using hardware decoder\n" + decoder; + ImGuiToolkit::Indication(decoder.c_str(), ICON_FA_MICROCHIP); + } + ImGui::SetCursorPos(botom); } else {