2018-04-23 17:34:22 +00:00
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
2017-07-29 13:19:15 +00:00
// DO NOT EDIT
use Object ;
use Pad ;
use PadDirection ;
use PadTemplate ;
use ProxyPad ;
use ffi ;
use glib ;
2019-01-16 11:32:39 +00:00
use glib ::object ::Cast ;
2017-07-29 13:19:15 +00:00
use glib ::object ::IsA ;
use glib ::translate ::* ;
glib_wrapper! {
2019-01-16 11:32:39 +00:00
pub struct GhostPad ( Object < ffi ::GstGhostPad , ffi ::GstGhostPadClass , GhostPadClass > ) @ extends ProxyPad , Pad , Object ;
2017-07-29 13:19:15 +00:00
match fn {
get_type = > | | ffi ::gst_ghost_pad_get_type ( ) ,
}
}
impl GhostPad {
pub fn new_no_target < ' a , P : Into < Option < & ' a str > > > ( name : P , dir : PadDirection ) -> GhostPad {
assert_initialized_main_thread! ( ) ;
let name = name . into ( ) ;
unsafe {
2019-01-16 11:32:39 +00:00
Pad ::from_glib_none ( ffi ::gst_ghost_pad_new_no_target ( name . to_glib_none ( ) . 0 , dir . to_glib ( ) ) ) . unsafe_cast ( )
2017-07-29 13:19:15 +00:00
}
}
2019-01-16 11:32:39 +00:00
pub fn new_no_target_from_template < ' a , P : Into < Option < & ' a str > > , Q : IsA < PadTemplate > > ( name : P , templ : & Q ) -> GhostPad {
2017-07-29 13:19:15 +00:00
skip_assert_initialized! ( ) ;
let name = name . into ( ) ;
unsafe {
2019-01-16 11:32:39 +00:00
Pad ::from_glib_none ( ffi ::gst_ghost_pad_new_no_target_from_template ( name . to_glib_none ( ) . 0 , templ . as_ref ( ) . to_glib_none ( ) . 0 ) ) . unsafe_cast ( )
2017-07-29 13:19:15 +00:00
}
}
}
unsafe impl Send for GhostPad { }
unsafe impl Sync for GhostPad { }
2019-01-16 11:32:39 +00:00
pub const NONE_GHOST_PAD : Option < & GhostPad > = None ;
2018-12-08 09:05:20 +00:00
pub trait GhostPadExt : 'static {
2017-07-29 13:19:15 +00:00
fn get_target ( & self ) -> Option < Pad > ;
fn set_target < ' a , P : IsA < Pad > + ' a , Q : Into < Option < & ' a P > > > ( & self , newtarget : Q ) -> Result < ( ) , glib ::error ::BoolError > ;
}
impl < O : IsA < GhostPad > > GhostPadExt for O {
fn get_target ( & self ) -> Option < Pad > {
unsafe {
2019-01-16 11:32:39 +00:00
from_glib_full ( ffi ::gst_ghost_pad_get_target ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-07-29 13:19:15 +00:00
}
}
fn set_target < ' a , P : IsA < Pad > + ' a , Q : Into < Option < & ' a P > > > ( & self , newtarget : Q ) -> Result < ( ) , glib ::error ::BoolError > {
let newtarget = newtarget . into ( ) ;
unsafe {
2019-01-16 11:32:39 +00:00
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 " )
2017-07-29 13:19:15 +00:00
}
}
}