BugFix Detect and display hardware decoder name

This commit is contained in:
Bruno Herbelin
2023-06-03 00:14:34 +02:00
parent 0f7d42ab83
commit 1f9bff6182
2 changed files with 9 additions and 13 deletions

View File

@@ -701,7 +701,7 @@ void ImGuiVisitor::visit (MediaSource& s)
top = _top; top = _top;
top.y += ImGui::GetFrameHeight(); top.y += ImGui::GetFrameHeight();
ImGui::SetCursorPos(top); ImGui::SetCursorPos(top);
decoder = "Using hardware decoder\n" + decoder; decoder = "Hardware decoder\n" + decoder;
ImGuiToolkit::Indication(decoder.c_str(), ICON_FA_MICROCHIP); ImGuiToolkit::Indication(decoder.c_str(), ICON_FA_MICROCHIP);
} }

View File

@@ -585,18 +585,13 @@ bool MediaPlayer::isImage() const
std::string MediaPlayer::decoderName() std::string MediaPlayer::decoderName()
{ {
if (pipeline_) { if (decoder_name_.empty()) {
if (force_software_decoding_) { // try to know if it is a hardware decoder
decoder_name_ = "software"; if (pipeline_)
}
// decoder_name_ not initialized
else if (decoder_name_.empty()) {
// try to know if it is a hardware decoder
decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_); decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_);
// nope, then it is a sofware decoder // nope, then it is a sofware decoder
if (decoder_name_.empty()) if (decoder_name_.empty())
decoder_name_ = "software"; decoder_name_ = "software";
}
} }
return decoder_name_; return decoder_name_;
@@ -876,7 +871,8 @@ void MediaPlayer::init_texture(guint index)
pbo_index_ = 0; pbo_index_ = 0;
pbo_next_index_ = 1; 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()); Log::Info("MediaPlayer %s Uses %s decoding and OpenGL PBO texturing.", std::to_string(id_).c_str(), decoderName().c_str());
} }