feat(gst): enhance GStreamer integration with new modules and improved API
This commit introduces significant enhancements to the GStreamer integration by: - Adding new modules for bins, caps, elements, pads, and plugins - Implementing a more ergonomic API with helper methods like play(), pause(), ready() - Adding support for various GStreamer plugins including app, autodetect, playback, and videoconvertscale - Improving error handling with better context attachment - Updating dependencies to latest versions including gstreamer-video 0.24.4 - Refactoring existing code to use modern Rust patterns and features
This commit is contained in:
31
gst/src/pad.rs
Normal file
31
gst/src/pad.rs
Normal file
@@ -0,0 +1,31 @@
|
||||
use crate::*;
|
||||
/// Pads are link points between elements
|
||||
#[repr(transparent)]
|
||||
pub struct Pad {
|
||||
pub(crate) inner: gstreamer::Pad,
|
||||
}
|
||||
|
||||
impl From<gstreamer::Pad> for Pad {
|
||||
fn from(inner: gstreamer::Pad) -> Self {
|
||||
Pad { inner }
|
||||
}
|
||||
}
|
||||
|
||||
impl Pad {
|
||||
pub fn ghost(target: &Pad) -> Result<Pad> {
|
||||
let ghost_pad = gstreamer::GhostPad::with_target(&target.inner)
|
||||
.change_context(Error)
|
||||
.attach("Failed to create ghost pad")?;
|
||||
Ok(Pad {
|
||||
inner: ghost_pad.upcast(),
|
||||
})
|
||||
}
|
||||
pub fn activate(&self, activate: bool) -> Result<()> {
|
||||
use gstreamer::prelude::*;
|
||||
self.inner
|
||||
.set_active(activate)
|
||||
.change_context(Error)
|
||||
.attach("Failed to set_active pad")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user