From 1f9bff618212c7b1320542b17bbb443c272611df Mon Sep 17 00:00:00 2001 From: Bruno Herbelin Date: Sat, 3 Jun 2023 00:14:34 +0200 Subject: [PATCH] BugFix Detect and display hardware decoder name --- src/ImGuiVisitor.cpp | 2 +- src/MediaPlayer.cpp | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp index 2638e3c..6c1ea29 100644 --- a/src/ImGuiVisitor.cpp +++ b/src/ImGuiVisitor.cpp @@ -701,7 +701,7 @@ void ImGuiVisitor::visit (MediaSource& s) top = _top; top.y += ImGui::GetFrameHeight(); ImGui::SetCursorPos(top); - decoder = "Using hardware decoder\n" + decoder; + decoder = "Hardware decoder\n" + decoder; ImGuiToolkit::Indication(decoder.c_str(), ICON_FA_MICROCHIP); } diff --git a/src/MediaPlayer.cpp b/src/MediaPlayer.cpp index b361e62..d1b5551 100644 --- a/src/MediaPlayer.cpp +++ b/src/MediaPlayer.cpp @@ -585,18 +585,13 @@ bool MediaPlayer::isImage() const std::string MediaPlayer::decoderName() { - if (pipeline_) { - if (force_software_decoding_) { - decoder_name_ = "software"; - } - // decoder_name_ not initialized - else if (decoder_name_.empty()) { - // try to know if it is a hardware decoder + if (decoder_name_.empty()) { + // try to know if it is a hardware decoder + if (pipeline_) decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_); - // nope, then it is a sofware decoder - if (decoder_name_.empty()) - decoder_name_ = "software"; - } + // nope, then it is a sofware decoder + if (decoder_name_.empty()) + decoder_name_ = "software"; } return decoder_name_; @@ -876,7 +871,8 @@ void MediaPlayer::init_texture(guint index) pbo_index_ = 0; pbo_next_index_ = 1; - // initialize decoderName once + // initialize decoderName once (forced update) + decoder_name_ = ""; Log::Info("MediaPlayer %s Uses %s decoding and OpenGL PBO texturing.", std::to_string(id_).c_str(), decoderName().c_str()); }