From 3fbaa3166d18a6e02761d76de0e50d5d5770c9bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Tue, 22 Mar 2022 19:53:43 +0100 Subject: [PATCH] player: register external plugins only once In case of multiple graph tab the player was registering several time the gtk4paintablesink --- src/common.rs | 4 ++++ src/gps/player.rs | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common.rs b/src/common.rs index ed9a1fe..ea48f2a 100644 --- a/src/common.rs +++ b/src/common.rs @@ -12,6 +12,10 @@ use gtk::glib; pub fn init() -> Result<()> { std::env::set_var("GST_XINITTHREADS", "1"); gst::init()?; + #[cfg(feature = "gtk4-plugin")] + { + gstgtk4::plugin_register_static().expect("Failed to register gstgtk4 plugin"); + } gtk::init()?; Ok(()) } diff --git a/src/gps/player.rs b/src/gps/player.rs index c692c85..2b5dcca 100644 --- a/src/gps/player.rs +++ b/src/gps/player.rs @@ -77,10 +77,6 @@ impl Player { current_state: Cell::new(PipelineState::Stopped), n_video_sink: Cell::new(0), })); - #[cfg(feature = "gtk4-plugin")] - { - gstgtk4::plugin_register_static().expect("Failed to register gstgtk4 plugin"); - } Ok(pipeline) }