gstreamer-rs/gstreamer/src/auto/ghost_pad.rs
2021-04-13 17:54:38 +02:00

54 lines
1.5 KiB
Rust

// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::Object;
use crate::Pad;
use crate::ProxyPad;
use glib::object::IsA;
use glib::translate::*;
glib::wrapper! {
pub struct GhostPad(Object<ffi::GstGhostPad, ffi::GstGhostPadClass>) @extends ProxyPad, Pad, Object;
match fn {
get_type => || ffi::gst_ghost_pad_get_type(),
}
}
unsafe impl Send for GhostPad {}
unsafe impl Sync for GhostPad {}
pub const NONE_GHOST_PAD: Option<&GhostPad> = None;
pub trait GhostPadExt: 'static {
#[doc(alias = "gst_ghost_pad_get_target")]
fn target(&self) -> Option<Pad>;
#[doc(alias = "gst_ghost_pad_set_target")]
fn set_target<P: IsA<Pad>>(&self, newtarget: Option<&P>) -> Result<(), glib::error::BoolError>;
}
impl<O: IsA<GhostPad>> GhostPadExt for O {
fn target(&self) -> Option<Pad> {
unsafe {
from_glib_full(ffi::gst_ghost_pad_get_target(
self.as_ref().to_glib_none().0,
))
}
}
fn set_target<P: IsA<Pad>>(&self, newtarget: Option<&P>) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::gst_ghost_pad_set_target(
self.as_ref().to_glib_none().0,
newtarget.map(|p| p.as_ref()).to_glib_none().0
),
"Failed to set target"
)
}
}
}