Enhance UriDiscoverer by disabling GPU decoding state when discovery

This commit is contained in:
brunoherbelin
2025-11-01 23:37:46 +01:00
parent 16e6437dc4
commit 1f10a359b5

View File

@@ -150,6 +150,9 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri)
Log::Warning("MediaPlayer Error creating discoverer instance: %s\n", err->message);
}
else {
// disable GPU decoding plugins to avoid conflicts during discovery
GstToolkit::enable_gpu_decoding_plugins(false);
GstDiscovererInfo *info = NULL;
info = gst_discoverer_discover_uri (discoverer, uri.c_str(), &err);
GstDiscovererResult result = gst_discoverer_info_get_result (info);
@@ -255,6 +258,10 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri)
gst_discoverer_info_unref (info);
g_object_unref( discoverer );
// restore GPU decoding plugins state
GstToolkit::enable_gpu_decoding_plugins(Settings::application.render.gpu_decoding);
}
g_clear_error (&err);
@@ -1392,6 +1399,19 @@ void MediaPlayer::update()
need_loop = true;
}
}
// test if position is flagged
else if ( isPlaying() ) {
// Avoid to pause repeatedly when inside a flagged section
static bool _in_flagged = false;
if (timeline_.isFlagged(position_)) {
// pause at this position
if (!_in_flagged)
play(false);
_in_flagged = true;
}
else
_in_flagged = false;
}
}
// manage loop mode