S026: vendored gst_mse 1.28.9 with fixes for early update-end, idle ticks, split A/V init segments; loaded ahead of the system copy

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 11:14:43 -06:00
commit e3dc9422ca

View file

@ -99,6 +99,34 @@ fn choose_gl(settings: &store::settings::Settings) {
}
}
/// Points GStreamer at Nacre's patched MSE plugin (`msesrc`, docs/engine/gst-mse-patches.md) ahead of the
/// system one. The matching library, libgstmse-1.0.so.0, is found through the binary's RUNPATH (build.rs).
/// Release layout: `<exe dir>/lib/gstreamer-1.0`; a dev build: `target/gst-mse/gstreamer-1.0` (tools/gst-mse.sh).
fn use_own_gst_mse() {
let Some(dir) = std::env::current_exe().ok().and_then(|exe| exe.parent().map(|dir| dir.to_path_buf())) else {
return;
};
let Some(plugins) = [dir.join("lib/gstreamer-1.0"), dir.join("../gst-mse/gstreamer-1.0")]
.into_iter()
.find(|plugins| plugins.join(if cfg!(windows) { "gstmse.dll" } else { "libgstmse.so" }).is_file())
else {
eprintln!("nacre: gst-mse: no patched mse plugin next to the binary, using the system one");
return;
};
let mut paths = vec![plugins.clone()];
paths.extend(std::env::var_os("GST_PLUGIN_PATH").iter().flat_map(std::env::split_paths));
if let Ok(value) = std::env::join_paths(paths) {
// SAFETY: called on the main thread before any other thread exists.
unsafe { std::env::set_var("GST_PLUGIN_PATH", value) };
}
let library = std::fs::read_to_string("/proc/self/maps")
.unwrap_or_default()
.lines()
.find_map(|line| line.split_whitespace().nth(5).filter(|path| path.contains("libgstmse-1.0")).map(str::to_owned))
.unwrap_or_else(|| "not loaded".into());
eprintln!("nacre: gst-mse: plugin {}, library {library}", plugins.display());
}
fn main() {
let launch = match parse_args() {
Ok(launch) => launch,
@ -113,6 +141,7 @@ fn main() {
return;
}
choose_gl(&store::settings::Settings::load(&paths.settings()));
use_own_gst_mse();
let event_loop = match EventLoop::<AppEvent>::with_user_event().build() {
Ok(event_loop) => event_loop,
Err(error) => {