Files
jello/gst/src/pad.rs
2025-12-25 02:14:56 +05:30

46 lines
1.1 KiB
Rust

use crate::priv_prelude::*;
wrap_gst!(Pad, gstreamer::Pad);
impl Pad {
#[track_caller]
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(),
})
}
#[track_caller]
pub fn link(&self, peer: &Pad) -> Result<()> {
use gstreamer::prelude::*;
self.inner
.link(&peer.inner)
.change_context(Error)
.attach("Failed to link pads")?;
Ok(())
}
#[track_caller]
pub fn current_caps(&self) -> Result<Caps> {
let caps = self
.inner
.current_caps()
.ok_or(Error)
.attach("Failed to get pad caps")?;
Ok(Caps { inner: caps })
}
#[track_caller]
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(())
}
}