player: register external plugins only once

In case of multiple graph tab the player was registering
several time the gtk4paintablesink
This commit is contained in:
Stéphane Cerveau 2022-03-22 19:53:43 +01:00 committed by Stéphane Cerveau
parent 3689d4d57c
commit 3fbaa3166d
2 changed files with 4 additions and 4 deletions

View file

@ -12,6 +12,10 @@ use gtk::glib;
pub fn init() -> Result<()> { pub fn init() -> Result<()> {
std::env::set_var("GST_XINITTHREADS", "1"); std::env::set_var("GST_XINITTHREADS", "1");
gst::init()?; gst::init()?;
#[cfg(feature = "gtk4-plugin")]
{
gstgtk4::plugin_register_static().expect("Failed to register gstgtk4 plugin");
}
gtk::init()?; gtk::init()?;
Ok(()) Ok(())
} }

View file

@ -77,10 +77,6 @@ impl Player {
current_state: Cell::new(PipelineState::Stopped), current_state: Cell::new(PipelineState::Stopped),
n_video_sink: Cell::new(0), n_video_sink: Cell::new(0),
})); }));
#[cfg(feature = "gtk4-plugin")]
{
gstgtk4::plugin_register_static().expect("Failed to register gstgtk4 plugin");
}
Ok(pipeline) Ok(pipeline)
} }