feat: Restructure the gst parent<->child relations

This commit is contained in:
uttarayan21
2025-12-23 01:09:01 +05:30
parent 043d1e99f0
commit 8d46bd2b85
11 changed files with 274 additions and 343 deletions

View File

@@ -1,13 +1,35 @@
use crate::*;
/// Pads are link points between elements
use crate::priv_prelude::*;
#[derive(Debug)]
#[repr(transparent)]
pub struct Pad {
pub(crate) inner: gstreamer::Pad,
}
impl From<gstreamer::Pad> for Pad {
fn from(inner: gstreamer::Pad) -> Self {
Pad { inner }
Self { inner }
}
}
impl From<Pad> for gstreamer::Pad {
fn from(wrapper: Pad) -> Self {
wrapper.inner
}
}
impl Pad {
pub fn into_inner(self) -> gstreamer::Pad {
self.inner
}
}
impl GstWrapper for Pad {
type GstType = gstreamer::Pad;
fn from_gst(gst: Self::GstType) -> Self {
Self { inner: gst }
}
fn into_gst(self) -> Self::GstType {
self.inner
}
fn as_gst_ref(&self) -> &Self::GstType {
&self.inner
}
}
@@ -30,6 +52,15 @@ impl Pad {
Ok(())
}
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 })
}
pub fn activate(&self, activate: bool) -> Result<()> {
use gstreamer::prelude::*;
self.inner