Improved handling of problematic video requiring software decode.

Always allow disabling hardware en/decode.
Warn and try to get info when gst discoverer errors.
This commit is contained in:
Ryan Kelln
2023-05-19 15:08:47 -04:00
parent e8b05cd7c2
commit 26cb75f93f
2 changed files with 18 additions and 15 deletions

View File

@@ -139,7 +139,8 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri)
video_stream_info.log = "Invalid URI";
break;
case GST_DISCOVERER_ERROR:
video_stream_info.log = std::string( "Error; " ) + err->message;
video_stream_info.log = std::string( "Warning: " ) + err->message;
result = GST_DISCOVERER_OK; // try to read the file anyways, discoverer can report errors but still read the file
break;
case GST_DISCOVERER_TIMEOUT:
video_stream_info.log = "Timeout loading";
@@ -355,7 +356,7 @@ void MediaPlayer::execute_open()
return;
}
// setup uridecodebin
// setup software decode
if (force_software_decoding_) {
g_object_set (G_OBJECT (gst_bin_get_by_name (GST_BIN (pipeline_), "decoder")), "force-sw-decoders", true, NULL);
}
@@ -584,8 +585,11 @@ bool MediaPlayer::isImage() const
std::string MediaPlayer::decoderName()
{
if (pipeline_) {
if (force_software_decoding_) {
decoder_name_ = "software";
}
// decoder_name_ not initialized
if (decoder_name_.empty()) {
else if (decoder_name_.empty()) {
// try to know if it is a hardware decoder
decoder_name_ = GstToolkit::used_gpu_decoding_plugins(pipeline_);
// nope, then it is a sofware decoder

View File

@@ -3146,8 +3146,7 @@ void SourceController::Render()
mediaplayer_active_->setRewindOnDisabled(true);
ImGui::EndMenu();
}
if (Settings::application.render.gpu_decoding)
{
// always allow for hardware decoding to be disabled
ImGui::Separator();
if (ImGui::BeginMenu(ICON_FA_MICROCHIP " Hardware decoding"))
{
@@ -3159,7 +3158,7 @@ void SourceController::Render()
mediaplayer_active_->setSoftwareDecodingForced(true);
ImGui::EndMenu();
}
}
ImGui::EndMenu();
}