pub mod bin; pub mod bus; pub mod caps; pub mod element; pub mod errors; pub mod pad; pub mod pipeline; pub mod plugins; #[macro_use] pub mod wrapper; pub use bin::*; pub use bus::*; pub use caps::*; pub use element::*; pub use pad::*; pub use pipeline::*; pub use plugins::*; pub(crate) mod priv_prelude { pub use crate::errors::*; pub use crate::wrapper::*; pub use crate::*; pub use gstreamer::prelude::*; #[track_caller] pub fn duration_to_clocktime( timeout: impl Into>, ) -> Result> { match timeout.into() { Some(dur) => { let clocktime = gstreamer::ClockTime::try_from(dur) .change_context(Error) .attach("Failed to convert duration to ClockTime")?; Ok(Some(clocktime)) } None => Ok(None), } } } use errors::*; use gstreamer::prelude::*; use std::sync::Arc; static GST: std::sync::LazyLock> = std::sync::LazyLock::new(|| { gstreamer::init().expect("Failed to initialize GStreamer"); std::sync::Arc::new(Gst { __private: core::marker::PhantomData, }) }); /// This should be a global singleton pub struct Gst { __private: core::marker::PhantomData<()>, } impl Gst { pub fn new() -> Arc { Arc::clone(&GST) } // pub fn pipeline_from_str(&self, s: &str) -> Result { // let pipeline = gstreamer::parse::launch(s).change_context(Error)?; // let pipeline = pipeline.downcast::(); // let pipeline = match pipeline { // Err(_e) => return Err(Error).attach("Failed to downcast to Pipeline"), // Ok(p) => p, // }; // Ok(Pipeline { inner: pipeline }) // } }