mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-22 15:08:12 +00:00
87 lines
2.4 KiB
Rust
87 lines
2.4 KiB
Rust
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
|
// DO NOT EDIT
|
|
|
|
use glib;
|
|
use glib::object::Cast;
|
|
use glib::object::IsA;
|
|
use glib::translate::*;
|
|
use gst_sys;
|
|
use Object;
|
|
use Pad;
|
|
use PadDirection;
|
|
use PadTemplate;
|
|
use ProxyPad;
|
|
|
|
glib_wrapper! {
|
|
pub struct GhostPad(Object<gst_sys::GstGhostPad, gst_sys::GstGhostPadClass, GhostPadClass>) @extends ProxyPad, Pad, Object;
|
|
|
|
match fn {
|
|
get_type => || gst_sys::gst_ghost_pad_get_type(),
|
|
}
|
|
}
|
|
|
|
impl GhostPad {
|
|
pub fn new_no_target(
|
|
name: Option<&str>,
|
|
dir: PadDirection,
|
|
) -> Result<GhostPad, glib::BoolError> {
|
|
assert_initialized_main_thread!();
|
|
unsafe {
|
|
Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new_no_target(
|
|
name.to_glib_none().0,
|
|
dir.to_glib(),
|
|
))
|
|
.map(|o| o.unsafe_cast())
|
|
.ok_or_else(|| glib_bool_error!("Failed to create GhostPad"))
|
|
}
|
|
}
|
|
|
|
pub fn new_no_target_from_template(
|
|
name: Option<&str>,
|
|
templ: &PadTemplate,
|
|
) -> Result<GhostPad, glib::BoolError> {
|
|
skip_assert_initialized!();
|
|
unsafe {
|
|
Option::<Pad>::from_glib_none(gst_sys::gst_ghost_pad_new_no_target_from_template(
|
|
name.to_glib_none().0,
|
|
templ.to_glib_none().0,
|
|
))
|
|
.map(|o| o.unsafe_cast())
|
|
.ok_or_else(|| glib_bool_error!("Failed to create GhostPad"))
|
|
}
|
|
}
|
|
}
|
|
|
|
unsafe impl Send for GhostPad {}
|
|
unsafe impl Sync for GhostPad {}
|
|
|
|
pub const NONE_GHOST_PAD: Option<&GhostPad> = None;
|
|
|
|
pub trait GhostPadExt: 'static {
|
|
fn get_target(&self) -> Option<Pad>;
|
|
|
|
fn set_target<P: IsA<Pad>>(&self, newtarget: Option<&P>) -> Result<(), glib::error::BoolError>;
|
|
}
|
|
|
|
impl<O: IsA<GhostPad>> GhostPadExt for O {
|
|
fn get_target(&self) -> Option<Pad> {
|
|
unsafe {
|
|
from_glib_full(gst_sys::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!(
|
|
gst_sys::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"
|
|
)
|
|
}
|
|
}
|
|
}
|