65 lines
1.5 KiB
Rust
65 lines
1.5 KiB
Rust
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 mod sample;
|
|
|
|
pub use bin::*;
|
|
pub use bus::*;
|
|
pub use caps::*;
|
|
pub use element::*;
|
|
pub use gstreamer;
|
|
#[doc(inline)]
|
|
pub use gstreamer::{Message, MessageType, MessageView, State};
|
|
pub use gstreamer_video::VideoFormat;
|
|
pub use pad::*;
|
|
pub use pipeline::*;
|
|
pub use plugins::*;
|
|
pub use sample::*;
|
|
|
|
pub(crate) mod priv_prelude {
|
|
pub use crate::errors::*;
|
|
pub use crate::wrapper::*;
|
|
pub use crate::*;
|
|
pub use gstreamer::prelude::ElementExt as _;
|
|
pub use gstreamer::prelude::*;
|
|
#[track_caller]
|
|
pub fn duration_to_clocktime(
|
|
timeout: impl Into<Option<core::time::Duration>>,
|
|
) -> Result<Option<gstreamer::ClockTime>> {
|
|
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(gstreamer::ClockTime::NONE),
|
|
}
|
|
}
|
|
}
|
|
|
|
use std::sync::Arc;
|
|
static GST: std::sync::LazyLock<std::sync::Arc<Gst>> = std::sync::LazyLock::new(|| {
|
|
gstreamer::init().expect("Failed to initialize GStreamer");
|
|
std::sync::Arc::new(Gst {
|
|
__private: core::marker::PhantomData,
|
|
})
|
|
});
|
|
|
|
pub struct Gst {
|
|
__private: core::marker::PhantomData<()>,
|
|
}
|
|
|
|
impl Gst {
|
|
pub fn new() -> Arc<Self> {
|
|
Arc::clone(&GST)
|
|
}
|
|
}
|