mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-20 06:39:59 +01:00
Fix Player menu for 'Timeline'
Replace 'Video' menu for MediaPlayer to 'Timeline'. Move Hardware decoding selection to MediaSource GUI Visitor.
This commit is contained in:
@@ -683,27 +683,55 @@ void ImGuiVisitor::visit (MediaSource& s)
|
||||
if ( !s.failed() ) {
|
||||
// icon (>) to open player
|
||||
if ( s.playable() ) {
|
||||
ImGui::SetCursorPos(top);
|
||||
std::string decoder = s.mediaplayer()->decoderName();
|
||||
if ( decoder.compare("software") != 0) {
|
||||
decoder = "Hardware decoder\n" + decoder;
|
||||
ImGuiToolkit::Indication(decoder.c_str(), 13, 2);
|
||||
}
|
||||
else
|
||||
ImGuiToolkit::Indication("Software decoder", 14, 2);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
ImGui::SetCursorPos(top);
|
||||
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
|
||||
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
|
||||
UserInterface::manager().showSourceEditor(&s);
|
||||
top.x += ImGui::GetFrameHeight();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(top);
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
|
||||
SystemToolkit::open(SystemToolkit::path_filename(s.path()));
|
||||
|
||||
ImGui::SetCursorPos(botom);
|
||||
|
||||
// Selector for Hardware or software decoding, if available
|
||||
if ( Settings::application.render.gpu_decoding ) {
|
||||
|
||||
MediaPlayer *mp = s.mediaplayer();
|
||||
if (mp) {
|
||||
// Build string information on decoder name with icon HW/SW
|
||||
bool hwdec = !mp->softwareDecodingForced();
|
||||
std::string decoder = mp->decoderName();
|
||||
if (hwdec) {
|
||||
if ( decoder.compare("software") != 0)
|
||||
decoder = ICON_FA_MICROCHIP " Hardware (" + decoder + ")";
|
||||
else
|
||||
decoder = ICON_FA_COGS " Software";
|
||||
}
|
||||
else
|
||||
decoder = ICON_FA_COGS " Software only";
|
||||
// Combo selector shoing the current state and the option to choose
|
||||
// between auto select and forced software decoding
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
if (ImGui::BeginCombo("Decoding", decoder.c_str() ) )
|
||||
{
|
||||
if (ImGui::Selectable( ICON_FA_MICROCHIP " / " ICON_FA_COGS " Auto select", &hwdec ))
|
||||
mp->setSoftwareDecodingForced(false);
|
||||
hwdec = mp->softwareDecodingForced();
|
||||
if (ImGui::Selectable( ICON_FA_COGS " Software only", &hwdec ))
|
||||
mp->setSoftwareDecodingForced(true);
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// info of software only decoding if disabled
|
||||
ImGuiToolkit::Icon(14,2,false);
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled("Hardware decoding disabled");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// failed
|
||||
|
||||
Reference in New Issue
Block a user