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-05-12 12:24:03 +00:00
// DO NOT EDIT
2017-07-10 21:02:08 +00:00
use Caps ;
2017-05-12 12:24:03 +00:00
use Element ;
2017-07-30 14:09:51 +00:00
use Event ;
use EventType ;
2017-05-12 12:24:03 +00:00
use Object ;
use PadDirection ;
2019-01-08 16:13:37 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-08-14 19:19:47 +00:00
use PadLinkCheck ;
2017-07-29 11:58:54 +00:00
use PadMode ;
2017-05-12 12:24:03 +00:00
use PadTemplate ;
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-07-04 22:47:33 +00:00
use Stream ;
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_12 " , feature = " dox " )) ]
2017-09-17 21:32:29 +00:00
use TaskState ;
2017-05-12 12:24:03 +00:00
use glib ;
2018-12-09 16:06:12 +00:00
use glib ::GString ;
2017-11-27 17:16:34 +00:00
use glib ::StaticType ;
2017-08-18 13:29:21 +00:00
use glib ::Value ;
2019-01-16 11:32:39 +00:00
use glib ::object ::Cast ;
2017-05-12 12:24:03 +00:00
use glib ::object ::IsA ;
2017-09-09 13:01:32 +00:00
use glib ::signal ::SignalHandlerId ;
2018-12-08 09:05:20 +00:00
use glib ::signal ::connect_raw ;
2017-05-12 12:24:03 +00:00
use glib ::translate ::* ;
2019-03-19 07:40:05 +00:00
use glib_sys ;
use gobject_sys ;
use gst_sys ;
2017-05-12 12:24:03 +00:00
use std ::boxed ::Box as Box_ ;
use std ::mem ::transmute ;
glib_wrapper! {
2019-03-19 07:40:05 +00:00
pub struct Pad ( Object < gst_sys ::GstPad , gst_sys ::GstPadClass , PadClass > ) @ extends Object ;
2017-05-12 12:24:03 +00:00
match fn {
2019-03-19 07:40:05 +00:00
get_type = > | | gst_sys ::gst_pad_get_type ( ) ,
2017-05-12 12:24:03 +00:00
}
}
impl Pad {
2019-03-19 07:40:05 +00:00
pub fn new ( name : Option < & str > , direction : PadDirection ) -> Pad {
2017-07-10 09:36:15 +00:00
assert_initialized_main_thread! ( ) ;
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_none ( gst_sys ::gst_pad_new ( name . to_glib_none ( ) . 0 , direction . to_glib ( ) ) )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
pub fn new_from_template ( templ : & PadTemplate , name : Option < & str > ) -> Pad {
2017-07-10 09:36:15 +00:00
skip_assert_initialized! ( ) ;
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_none ( gst_sys ::gst_pad_new_from_template ( templ . to_glib_none ( ) . 0 , name . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
}
2017-06-25 08:04:37 +00:00
unsafe impl Send for Pad { }
unsafe impl Sync for Pad { }
2019-01-16 11:32:39 +00:00
pub const NONE_PAD : Option < & Pad > = None ;
2018-12-08 09:05:20 +00:00
pub trait PadExt : 'static {
2017-07-29 11:58:54 +00:00
fn activate_mode ( & self , mode : PadMode , active : bool ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn can_link < P : IsA < Pad > > ( & self , sinkpad : & P ) -> bool ;
fn check_reconfigure ( & self ) -> bool ;
2019-03-19 07:40:05 +00:00
fn create_stream_id < P : IsA < Element > > ( & self , parent : & P , stream_id : Option < & str > ) -> Option < GString > ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
//fn create_stream_id_printf<P: IsA<Element>>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<GString>;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
//fn create_stream_id_printf_valist<P: IsA<Element>>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<GString>;
2017-05-12 12:24:03 +00:00
2019-01-29 13:53:44 +00:00
fn forward < P : FnMut ( & Pad ) -> bool > ( & self , forward : P ) -> bool ;
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn get_allowed_caps ( & self ) -> Option < Caps > ;
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn get_current_caps ( & self ) -> Option < Caps > ;
2017-05-12 12:24:03 +00:00
fn get_direction ( & self ) -> PadDirection ;
//fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer>;
fn get_offset ( & self ) -> i64 ;
fn get_pad_template ( & self ) -> Option < PadTemplate > ;
2017-07-10 21:02:08 +00:00
fn get_pad_template_caps ( & self ) -> Option < Caps > ;
2017-05-12 12:24:03 +00:00
fn get_parent_element ( & self ) -> Option < Element > ;
fn get_peer ( & self ) -> Option < Pad > ;
2017-07-30 14:09:51 +00:00
fn get_sticky_event ( & self , event_type : EventType , idx : u32 ) -> Option < Event > ;
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-07-04 22:47:33 +00:00
fn get_stream ( & self ) -> Option < Stream > ;
2017-05-12 12:24:03 +00:00
2018-12-09 16:06:12 +00:00
fn get_stream_id ( & self ) -> Option < GString > ;
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_12 " , feature = " dox " )) ]
2017-09-17 21:32:29 +00:00
fn get_task_state ( & self ) -> TaskState ;
2017-05-12 12:24:03 +00:00
fn has_current_caps ( & self ) -> bool ;
fn is_active ( & self ) -> bool ;
fn is_blocked ( & self ) -> bool ;
fn is_blocking ( & self ) -> bool ;
fn is_linked ( & self ) -> bool ;
2017-09-17 15:41:02 +00:00
//fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator>;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
//fn iterate_internal_links_default<P: IsA<Object>>(&self, parent: Option<&P>) -> /*Ignored*/Option<Iterator>;
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-06-24 09:02:24 +00:00
fn link_maybe_ghosting < P : IsA < Pad > > ( & self , sink : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2019-01-16 20:23:56 +00:00
fn link_maybe_ghosting_full < P : IsA < Pad > > ( & self , sink : & P , flags : PadLinkCheck ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn mark_reconfigure ( & self ) ;
fn needs_reconfigure ( & self ) -> bool ;
2017-06-24 09:02:24 +00:00
fn pause_task ( & self ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn peer_query_accept_caps ( & self , caps : & Caps ) -> bool ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn peer_query_caps ( & self , filter : Option < & Caps > ) -> Option < Caps > ;
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn query_accept_caps ( & self , caps : & Caps ) -> bool ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn query_caps ( & self , filter : Option < & Caps > ) -> Option < Caps > ;
2017-05-12 12:24:03 +00:00
2017-06-24 09:02:24 +00:00
fn set_active ( & self , active : bool ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2019-01-29 13:53:44 +00:00
//fn set_element_private(&self, priv_: /*Unimplemented*/Option<Fundamental: Pointer>);
2017-05-12 12:24:03 +00:00
fn set_offset ( & self , offset : i64 ) ;
2017-06-24 09:02:24 +00:00
fn stop_task ( & self ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-06-24 09:02:24 +00:00
fn unlink < P : IsA < Pad > > ( & self , sinkpad : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn use_fixed_caps ( & self ) ;
2017-08-18 13:29:21 +00:00
fn get_property_caps ( & self ) -> Option < Caps > ;
fn get_property_template ( & self ) -> Option < PadTemplate > ;
2019-01-21 20:00:48 +00:00
fn set_property_template ( & self , template : Option < & PadTemplate > ) ;
2017-08-18 13:29:21 +00:00
2017-09-09 13:01:32 +00:00
fn connect_linked < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
2017-05-12 12:24:03 +00:00
2017-09-09 13:01:32 +00:00
fn connect_unlinked < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
2017-08-18 13:29:21 +00:00
2017-09-09 13:01:32 +00:00
fn connect_property_caps_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
2017-08-18 13:29:21 +00:00
2017-09-09 13:01:32 +00:00
fn connect_property_offset_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
2017-08-18 13:29:21 +00:00
2017-09-09 13:01:32 +00:00
fn connect_property_template_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId ;
2017-05-12 12:24:03 +00:00
}
2018-12-08 09:05:20 +00:00
impl < O : IsA < Pad > > PadExt for O {
2017-07-29 11:58:54 +00:00
fn activate_mode ( & self , mode : PadMode , active : bool ) -> Result < ( ) , glib ::error ::BoolError > {
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_activate_mode ( self . as_ref ( ) . to_glib_none ( ) . 0 , mode . to_glib ( ) , active . to_glib ( ) ) , " Failed to activate mode pad " )
2017-07-29 11:58:54 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn can_link < P : IsA < Pad > > ( & self , sinkpad : & P ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_can_link ( self . as_ref ( ) . to_glib_none ( ) . 0 , sinkpad . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn check_reconfigure ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_check_reconfigure ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn create_stream_id < P : IsA < Element > > ( & self , parent : & P , stream_id : Option < & str > ) -> Option < GString > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_create_stream_id ( self . as_ref ( ) . to_glib_none ( ) . 0 , parent . as_ref ( ) . to_glib_none ( ) . 0 , stream_id . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
//fn create_stream_id_printf<P: IsA<Element>>(&self, parent: &P, stream_id: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<GString> {
// unsafe { TODO: call gst_sys:gst_pad_create_stream_id_printf() }
2017-05-12 12:24:03 +00:00
//}
2019-03-19 07:40:05 +00:00
//fn create_stream_id_printf_valist<P: IsA<Element>>(&self, parent: &P, stream_id: Option<&str>, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<GString> {
// unsafe { TODO: call gst_sys:gst_pad_create_stream_id_printf_valist() }
2017-05-12 12:24:03 +00:00
//}
2019-01-29 13:53:44 +00:00
fn forward < P : FnMut ( & Pad ) -> bool > ( & self , forward : P ) -> bool {
let forward_data : P = forward ;
2019-03-19 07:40:05 +00:00
unsafe extern " C " fn forward_func < P : FnMut ( & Pad ) -> bool > ( pad : * mut gst_sys ::GstPad , user_data : glib_sys ::gpointer ) -> glib_sys ::gboolean {
2019-01-29 13:53:44 +00:00
let pad = from_glib_borrow ( pad ) ;
let callback : * mut P = user_data as * const _ as usize as * mut P ;
let res = ( * callback ) ( & pad ) ;
res . to_glib ( )
}
let forward = Some ( forward_func ::< P > as _ ) ;
let super_callback0 : & P = & forward_data ;
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_forward ( self . as_ref ( ) . to_glib_none ( ) . 0 , forward , super_callback0 as * const _ as usize as * mut _ ) )
2019-01-29 13:53:44 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn get_allowed_caps ( & self ) -> Option < Caps > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_allowed_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn get_current_caps ( & self ) -> Option < Caps > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_current_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn get_direction ( & self ) -> PadDirection {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_get_direction ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
//fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer> {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_pad_get_element_private() }
2017-05-12 12:24:03 +00:00
//}
fn get_offset ( & self ) -> i64 {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_pad_get_offset ( self . as_ref ( ) . to_glib_none ( ) . 0 )
2017-05-12 12:24:03 +00:00
}
}
fn get_pad_template ( & self ) -> Option < PadTemplate > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_pad_template ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-07-10 21:02:08 +00:00
fn get_pad_template_caps ( & self ) -> Option < Caps > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_pad_template_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn get_parent_element ( & self ) -> Option < Element > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_parent_element ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_peer ( & self ) -> Option < Pad > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_peer ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-07-30 14:09:51 +00:00
fn get_sticky_event ( & self , event_type : EventType , idx : u32 ) -> Option < Event > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_sticky_event ( self . as_ref ( ) . to_glib_none ( ) . 0 , event_type . to_glib ( ) , idx ) )
2017-07-30 14:09:51 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-07-04 22:47:33 +00:00
fn get_stream ( & self ) -> Option < Stream > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_stream ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-07-04 22:47:33 +00:00
}
}
2017-05-12 12:24:03 +00:00
2018-12-09 16:06:12 +00:00
fn get_stream_id ( & self ) -> Option < GString > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_get_stream_id ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_12 " , feature = " dox " )) ]
2017-09-17 21:32:29 +00:00
fn get_task_state ( & self ) -> TaskState {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_get_task_state ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-09-17 21:32:29 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn has_current_caps ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_has_current_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn is_active ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_is_active ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn is_blocked ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_is_blocked ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn is_blocking ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_is_blocking ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn is_linked ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_is_linked ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-09-17 15:41:02 +00:00
//fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator> {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_pad_iterate_internal_links() }
2017-09-17 15:41:02 +00:00
//}
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
//fn iterate_internal_links_default<P: IsA<Object>>(&self, parent: Option<&P>) -> /*Ignored*/Option<Iterator> {
// unsafe { TODO: call gst_sys:gst_pad_iterate_internal_links_default() }
2017-09-17 15:41:02 +00:00
//}
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2017-06-24 09:02:24 +00:00
fn link_maybe_ghosting < P : IsA < Pad > > ( & self , sink : & P ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_link_maybe_ghosting ( self . as_ref ( ) . to_glib_none ( ) . 0 , sink . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to link pads, possibly ghosting " )
2017-05-12 12:24:03 +00:00
}
}
2017-10-01 13:52:15 +00:00
#[ cfg(any(feature = " v1_10 " , feature = " dox " )) ]
2019-01-16 20:23:56 +00:00
fn link_maybe_ghosting_full < P : IsA < Pad > > ( & self , sink : & P , flags : PadLinkCheck ) -> Result < ( ) , glib ::error ::BoolError > {
2017-08-14 19:19:47 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_link_maybe_ghosting_full ( self . as_ref ( ) . to_glib_none ( ) . 0 , sink . as_ref ( ) . to_glib_none ( ) . 0 , flags . to_glib ( ) ) , " Failed to link pads, possibly ghosting " )
2017-08-14 19:19:47 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn mark_reconfigure ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_pad_mark_reconfigure ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
fn needs_reconfigure ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_needs_reconfigure ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn pause_task ( & self ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_pause_task ( self . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to pause pad task " )
2017-05-12 12:24:03 +00:00
}
}
2017-07-10 21:02:08 +00:00
fn peer_query_accept_caps ( & self , caps : & Caps ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_peer_query_accept_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 , caps . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn peer_query_caps ( & self , filter : Option < & Caps > ) -> Option < Caps > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_peer_query_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 , filter . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn query_accept_caps ( & self , caps : & Caps ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_pad_query_accept_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 , caps . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn query_caps ( & self , filter : Option < & Caps > ) -> Option < Caps > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_pad_query_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 , filter . to_glib_none ( ) . 0 ) )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-06-24 09:02:24 +00:00
fn set_active ( & self , active : bool ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_set_active ( self . as_ref ( ) . to_glib_none ( ) . 0 , active . to_glib ( ) ) , " Failed to activate pad " )
2017-05-12 12:24:03 +00:00
}
}
2019-01-29 13:53:44 +00:00
//fn set_element_private(&self, priv_: /*Unimplemented*/Option<Fundamental: Pointer>) {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_pad_set_element_private() }
2017-05-12 12:24:03 +00:00
//}
fn set_offset ( & self , offset : i64 ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_pad_set_offset ( self . as_ref ( ) . to_glib_none ( ) . 0 , offset ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn stop_task ( & self ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_stop_task ( self . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to stop pad task " )
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn unlink < P : IsA < Pad > > ( & self , sinkpad : & P ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_pad_unlink ( self . as_ref ( ) . to_glib_none ( ) . 0 , sinkpad . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to unlink pad " )
2017-05-12 12:24:03 +00:00
}
}
fn use_fixed_caps ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_pad_use_fixed_caps ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-08-18 13:29:21 +00:00
fn get_property_caps ( & self ) -> Option < Caps > {
unsafe {
2018-02-06 14:42:34 +00:00
let mut value = Value ::from_type ( < Caps as StaticType > ::static_type ( ) ) ;
2019-03-19 07:40:05 +00:00
gobject_sys ::g_object_get_property ( self . to_glib_none ( ) . 0 as * mut gobject_sys ::GObject , b " caps \0 " . as_ptr ( ) as * const _ , value . to_glib_none_mut ( ) . 0 ) ;
2017-11-27 17:16:34 +00:00
value . get ( )
2017-08-18 13:29:21 +00:00
}
}
fn get_property_template ( & self ) -> Option < PadTemplate > {
unsafe {
2018-02-06 14:42:34 +00:00
let mut value = Value ::from_type ( < PadTemplate as StaticType > ::static_type ( ) ) ;
2019-03-19 07:40:05 +00:00
gobject_sys ::g_object_get_property ( self . to_glib_none ( ) . 0 as * mut gobject_sys ::GObject , b " template \0 " . as_ptr ( ) as * const _ , value . to_glib_none_mut ( ) . 0 ) ;
2017-11-27 17:16:34 +00:00
value . get ( )
2017-08-18 13:29:21 +00:00
}
}
2019-01-21 20:00:48 +00:00
fn set_property_template ( & self , template : Option < & PadTemplate > ) {
2017-08-18 13:29:21 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
gobject_sys ::g_object_set_property ( self . to_glib_none ( ) . 0 as * mut gobject_sys ::GObject , b " template \0 " . as_ptr ( ) as * const _ , Value ::from ( template ) . to_glib_none ( ) . 0 ) ;
2017-08-18 13:29:21 +00:00
}
}
2017-09-09 13:01:32 +00:00
fn connect_linked < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn linked_trampoline < P , F : Fn ( & P , & Pad ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstPad , peer : * mut gst_sys ::GstPad , f : glib_sys ::gpointer )
where P : IsA < Pad >
{
let f : & F = & * ( f as * const F ) ;
f ( & Pad ::from_glib_borrow ( this ) . unsafe_cast ( ) , & from_glib_borrow ( peer ) )
}
2017-05-12 12:24:03 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f : Box_ < F > = Box_ ::new ( f ) ;
2019-01-16 11:32:39 +00:00
connect_raw ( self . as_ptr ( ) as * mut _ , b " linked \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( linked_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-05-12 12:24:03 +00:00
}
}
2017-09-09 13:01:32 +00:00
fn connect_unlinked < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn unlinked_trampoline < P , F : Fn ( & P , & Pad ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstPad , peer : * mut gst_sys ::GstPad , f : glib_sys ::gpointer )
where P : IsA < Pad >
{
let f : & F = & * ( f as * const F ) ;
f ( & Pad ::from_glib_borrow ( this ) . unsafe_cast ( ) , & from_glib_borrow ( peer ) )
}
2017-05-12 12:24:03 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f : Box_ < F > = Box_ ::new ( f ) ;
2019-01-16 11:32:39 +00:00
connect_raw ( self . as_ptr ( ) as * mut _ , b " unlinked \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( unlinked_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-05-12 12:24:03 +00:00
}
}
2017-08-18 13:29:21 +00:00
2017-09-09 13:01:32 +00:00
fn connect_property_caps_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn notify_caps_trampoline < P , F : Fn ( & P ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstPad , _param_spec : glib_sys ::gpointer , f : glib_sys ::gpointer )
where P : IsA < Pad >
{
let f : & F = & * ( f as * const F ) ;
f ( & Pad ::from_glib_borrow ( this ) . unsafe_cast ( ) )
}
2017-08-18 13:29:21 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f : Box_ < F > = Box_ ::new ( f ) ;
2019-01-16 11:32:39 +00:00
connect_raw ( self . as_ptr ( ) as * mut _ , b " notify::caps \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( notify_caps_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-08-18 13:29:21 +00:00
}
}
2017-09-09 13:01:32 +00:00
fn connect_property_offset_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn notify_offset_trampoline < P , F : Fn ( & P ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstPad , _param_spec : glib_sys ::gpointer , f : glib_sys ::gpointer )
where P : IsA < Pad >
{
let f : & F = & * ( f as * const F ) ;
f ( & Pad ::from_glib_borrow ( this ) . unsafe_cast ( ) )
}
2017-08-18 13:29:21 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f : Box_ < F > = Box_ ::new ( f ) ;
2019-01-16 11:32:39 +00:00
connect_raw ( self . as_ptr ( ) as * mut _ , b " notify::offset \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( notify_offset_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-08-18 13:29:21 +00:00
}
}
2017-09-09 13:01:32 +00:00
fn connect_property_template_notify < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn notify_template_trampoline < P , F : Fn ( & P ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstPad , _param_spec : glib_sys ::gpointer , f : glib_sys ::gpointer )
where P : IsA < Pad >
{
let f : & F = & * ( f as * const F ) ;
f ( & Pad ::from_glib_borrow ( this ) . unsafe_cast ( ) )
}
2017-08-18 13:29:21 +00:00
unsafe {
2019-01-29 13:53:44 +00:00
let f : Box_ < F > = Box_ ::new ( f ) ;
2019-01-16 11:32:39 +00:00
connect_raw ( self . as_ptr ( ) as * mut _ , b " notify::template \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( notify_template_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-08-18 13:29:21 +00:00
}
}
2017-05-12 12:24:03 +00:00
}