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
use Bus ;
2017-07-10 21:02:08 +00:00
use Caps ;
2017-05-12 12:24:03 +00:00
use Clock ;
use ClockTime ;
2017-08-02 17:46:39 +00:00
use Context ;
2017-05-12 12:24:03 +00:00
use ElementFactory ;
use Error ;
2017-07-03 10:56:26 +00:00
use Message ;
2017-05-12 12:24:03 +00:00
use Object ;
use Pad ;
2017-08-14 19:19:47 +00:00
use PadLinkCheck ;
2017-05-12 12:24:03 +00:00
use PadTemplate ;
use URIType ;
use glib ;
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 gst_sys ;
2017-05-12 12:24:03 +00:00
use std ::boxed ::Box as Box_ ;
use std ::mem ::transmute ;
use std ::ptr ;
glib_wrapper! {
2019-03-19 07:40:05 +00:00
pub struct Element ( Object < gst_sys ::GstElement , gst_sys ::GstElementClass , ElementClass > ) @ 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_element_get_type ( ) ,
2017-05-12 12:24:03 +00:00
}
}
impl Element {
2019-03-19 07:40:05 +00:00
pub fn make_from_uri ( type_ : URIType , uri : & str , elementname : Option < & str > ) -> Result < Element , Error > {
2017-07-10 09:36:15 +00:00
assert_initialized_main_thread! ( ) ;
2017-05-12 12:24:03 +00:00
unsafe {
let mut error = ptr ::null_mut ( ) ;
2019-03-19 07:40:05 +00:00
let ret = gst_sys ::gst_element_make_from_uri ( type_ . to_glib ( ) , uri . to_glib_none ( ) . 0 , elementname . to_glib_none ( ) . 0 , & mut error ) ;
2017-05-12 12:24:03 +00:00
if error . is_null ( ) { Ok ( from_glib_none ( ret ) ) } else { Err ( from_glib_full ( error ) ) }
}
}
}
2017-06-25 08:04:37 +00:00
unsafe impl Send for Element { }
unsafe impl Sync for Element { }
2019-01-16 11:32:39 +00:00
pub const NONE_ELEMENT : Option < & Element > = None ;
2018-12-08 09:05:20 +00:00
pub trait ElementExt : 'static {
2017-05-12 12:24:03 +00:00
fn abort_state ( & self ) ;
2017-06-24 09:02:24 +00:00
fn add_pad < P : IsA < Pad > > ( & self , pad : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn create_all_pads ( & self ) ;
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool ;
2018-03-15 08:39:12 +00:00
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_sink_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool ;
2018-03-15 08:39:12 +00:00
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_src_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool ;
2018-03-15 08:39:12 +00:00
2017-05-12 12:24:03 +00:00
fn get_base_time ( & self ) -> ClockTime ;
fn get_bus ( & self ) -> Option < Bus > ;
fn get_clock ( & self ) -> Option < Clock > ;
2019-03-19 07:40:05 +00:00
fn get_compatible_pad < P : IsA < Pad > > ( & self , pad : & P , caps : Option < & Caps > ) -> Option < Pad > ;
2017-05-12 12:24:03 +00:00
2019-01-21 20:00:48 +00:00
fn get_compatible_pad_template ( & self , compattempl : & PadTemplate ) -> Option < PadTemplate > ;
2017-05-12 12:24:03 +00:00
2017-08-02 17:46:39 +00:00
fn get_context ( & self , context_type : & str ) -> Option < Context > ;
2017-05-12 12:24:03 +00:00
2017-08-02 17:46:39 +00:00
fn get_contexts ( & self ) -> Vec < Context > ;
2017-05-12 12:24:03 +00:00
fn get_factory ( & self ) -> Option < ElementFactory > ;
fn get_request_pad ( & self , name : & str ) -> Option < Pad > ;
fn get_start_time ( & self ) -> ClockTime ;
fn get_static_pad ( & self , name : & str ) -> Option < Pad > ;
fn is_locked_state ( & self ) -> bool ;
2017-09-17 15:41:02 +00:00
//fn iterate_pads(&self) -> /*Ignored*/Option<Iterator>;
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_sink_pads(&self) -> /*Ignored*/Option<Iterator>;
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_src_pads(&self) -> /*Ignored*/Option<Iterator>;
2017-05-12 12:24:03 +00:00
2017-06-24 09:02:24 +00:00
fn link < P : IsA < Element > > ( & self , dest : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn link_filtered < P : IsA < Element > > ( & self , dest : & P , filter : Option < & Caps > ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool;
2019-03-19 07:40:05 +00:00
fn link_pads < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn link_pads_filtered < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > , filter : Option < & Caps > ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn link_pads_full < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > , flags : PadLinkCheck ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn lost_state ( & self ) ;
2019-03-19 07:40:05 +00:00
//fn message_full(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: Option<&str>, debug: Option<&str>, file: &str, function: &str, line: i32);
2017-05-12 12:24:03 +00:00
2017-10-01 13:52:15 +00:00
//#[cfg(any(feature = "v1_10", feature = "dox"))]
2019-03-19 07:40:05 +00:00
//fn message_full_with_details(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: Option<&str>, debug: Option<&str>, file: &str, function: &str, line: i32, structure: &mut Structure);
2017-05-12 12:24:03 +00:00
fn no_more_pads ( & self ) ;
2017-12-20 16:07:28 +00:00
fn post_message ( & self , message : & Message ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn provide_clock ( & self ) -> Option < Clock > ;
fn release_request_pad < P : IsA < Pad > > ( & self , pad : & P ) ;
2017-06-24 09:02:24 +00:00
fn remove_pad < P : IsA < Pad > > ( & self , pad : & P ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn request_pad ( & self , templ : & PadTemplate , name : Option < & str > , caps : Option < & Caps > ) -> Option < Pad > ;
2017-05-12 12:24:03 +00:00
fn set_base_time ( & self , time : ClockTime ) ;
2019-03-19 07:40:05 +00:00
fn set_bus ( & self , bus : Option < & Bus > ) ;
2017-05-12 12:24:03 +00:00
2019-03-19 07:40:05 +00:00
fn set_clock < P : IsA < Clock > > ( & self , clock : Option < & P > ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-08-02 17:46:39 +00:00
fn set_context ( & self , context : & Context ) ;
2017-05-12 12:24:03 +00:00
fn set_locked_state ( & self , locked_state : bool ) -> bool ;
fn set_start_time ( & self , time : ClockTime ) ;
2017-06-24 09:02:24 +00:00
fn sync_state_with_parent ( & self ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn unlink < P : IsA < Element > > ( & self , dest : & P ) ;
//fn unlink_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
fn unlink_pads < P : IsA < Element > > ( & self , srcpadname : & str , dest : & P , destpadname : & str ) ;
2017-09-09 13:01:32 +00:00
fn connect_no_more_pads < F : Fn ( & Self ) + 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_pad_added < 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_pad_removed < F : Fn ( & Self , & Pad ) + 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 < Element > > ElementExt for O {
2017-05-12 12:24:03 +00:00
fn abort_state ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_abort_state ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn add_pad < P : IsA < Pad > > ( & self , pad : & 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_element_add_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , pad . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to add pad " )
2017-05-12 12:24:03 +00:00
}
}
fn create_all_pads ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_create_all_pads ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool {
let func_data : P = func ;
2019-03-19 07:40:05 +00:00
unsafe extern " C " fn func_func < P : FnMut ( & Element , & Pad ) -> bool > ( element : * mut gst_sys ::GstElement , pad : * mut gst_sys ::GstPad , user_data : glib_sys ::gpointer ) -> glib_sys ::gboolean {
2019-01-29 13:53:44 +00:00
let element = from_glib_borrow ( element ) ;
let pad = from_glib_borrow ( pad ) ;
let callback : * mut P = user_data as * const _ as usize as * mut P ;
let res = ( * callback ) ( & element , & pad ) ;
res . to_glib ( )
}
let func = Some ( func_func ::< P > as _ ) ;
let super_callback0 : & P = & func_data ;
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_foreach_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , func , super_callback0 as * const _ as usize as * mut _ ) )
2019-01-29 13:53:44 +00:00
}
}
2018-03-15 08:39:12 +00:00
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_sink_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool {
let func_data : P = func ;
2019-03-19 07:40:05 +00:00
unsafe extern " C " fn func_func < P : FnMut ( & Element , & Pad ) -> bool > ( element : * mut gst_sys ::GstElement , pad : * mut gst_sys ::GstPad , user_data : glib_sys ::gpointer ) -> glib_sys ::gboolean {
2019-01-29 13:53:44 +00:00
let element = from_glib_borrow ( element ) ;
let pad = from_glib_borrow ( pad ) ;
let callback : * mut P = user_data as * const _ as usize as * mut P ;
let res = ( * callback ) ( & element , & pad ) ;
res . to_glib ( )
}
let func = Some ( func_func ::< P > as _ ) ;
let super_callback0 : & P = & func_data ;
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_foreach_sink_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , func , super_callback0 as * const _ as usize as * mut _ ) )
2019-01-29 13:53:44 +00:00
}
}
2018-03-15 08:39:12 +00:00
2019-01-29 13:53:44 +00:00
#[ cfg(any(feature = " v1_14 " , feature = " dox " )) ]
fn foreach_src_pad < P : FnMut ( & Element , & Pad ) -> bool > ( & self , func : P ) -> bool {
let func_data : P = func ;
2019-03-19 07:40:05 +00:00
unsafe extern " C " fn func_func < P : FnMut ( & Element , & Pad ) -> bool > ( element : * mut gst_sys ::GstElement , pad : * mut gst_sys ::GstPad , user_data : glib_sys ::gpointer ) -> glib_sys ::gboolean {
2019-01-29 13:53:44 +00:00
let element = from_glib_borrow ( element ) ;
let pad = from_glib_borrow ( pad ) ;
let callback : * mut P = user_data as * const _ as usize as * mut P ;
let res = ( * callback ) ( & element , & pad ) ;
res . to_glib ( )
}
let func = Some ( func_func ::< P > as _ ) ;
let super_callback0 : & P = & func_data ;
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_foreach_src_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , func , super_callback0 as * const _ as usize as * mut _ ) )
2019-01-29 13:53:44 +00:00
}
}
2018-03-15 08:39:12 +00:00
2017-05-12 12:24:03 +00:00
fn get_base_time ( & self ) -> ClockTime {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_get_base_time ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_bus ( & self ) -> Option < Bus > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_bus ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_clock ( & self ) -> Option < Clock > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_clock ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn get_compatible_pad < P : IsA < Pad > > ( & self , pad : & P , caps : Option < & Caps > ) -> Option < Pad > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_compatible_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , pad . 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-01-21 20:00:48 +00:00
fn get_compatible_pad_template ( & self , compattempl : & PadTemplate ) -> Option < PadTemplate > {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_none ( gst_sys ::gst_element_get_compatible_pad_template ( self . as_ref ( ) . to_glib_none ( ) . 0 , compattempl . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
2017-08-02 17:46:39 +00:00
fn get_context ( & self , context_type : & str ) -> Option < Context > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_context ( self . as_ref ( ) . to_glib_none ( ) . 0 , context_type . to_glib_none ( ) . 0 ) )
2017-08-02 17:46:39 +00:00
}
}
2017-05-12 12:24:03 +00:00
2017-08-02 17:46:39 +00:00
fn get_contexts ( & self ) -> Vec < Context > {
unsafe {
2019-03-19 07:40:05 +00:00
FromGlibPtrContainer ::from_glib_full ( gst_sys ::gst_element_get_contexts ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-08-02 17:46:39 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn get_factory ( & self ) -> Option < ElementFactory > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_none ( gst_sys ::gst_element_get_factory ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_request_pad ( & self , name : & str ) -> Option < Pad > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_request_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , name . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_start_time ( & self ) -> ClockTime {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_get_start_time ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_static_pad ( & self , name : & str ) -> Option < Pad > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_get_static_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , name . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn is_locked_state ( & self ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_is_locked_state ( 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_pads(&self) -> /*Ignored*/Option<Iterator> {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_element_iterate_pads() }
2017-09-17 15:41:02 +00:00
//}
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_sink_pads(&self) -> /*Ignored*/Option<Iterator> {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_element_iterate_sink_pads() }
2017-09-17 15:41:02 +00:00
//}
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_src_pads(&self) -> /*Ignored*/Option<Iterator> {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_element_iterate_src_pads() }
2017-09-17 15:41:02 +00:00
//}
2017-05-12 12:24:03 +00:00
2017-06-24 09:02:24 +00:00
fn link < P : IsA < Element > > ( & self , dest : & 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_element_link ( self . as_ref ( ) . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to link elements " )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn link_filtered < P : IsA < Element > > ( & self , dest : & P , filter : Option < & Caps > ) -> Result < ( ) , glib ::error ::BoolError > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_element_link_filtered ( self . as_ref ( ) . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 , filter . to_glib_none ( ) . 0 ) , " Failed to link elements " )
2017-07-10 21:02:08 +00:00
}
}
2017-05-12 12:24:03 +00:00
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_element_link_many() }
2017-05-12 12:24:03 +00:00
//}
2019-03-19 07:40:05 +00:00
fn link_pads < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > ) -> 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_element_link_pads ( self . as_ref ( ) . to_glib_none ( ) . 0 , srcpadname . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 , destpadname . to_glib_none ( ) . 0 ) , " Failed to link pads " )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn link_pads_filtered < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > , filter : Option < & Caps > ) -> Result < ( ) , glib ::error ::BoolError > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_element_link_pads_filtered ( self . as_ref ( ) . to_glib_none ( ) . 0 , srcpadname . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 , destpadname . to_glib_none ( ) . 0 , filter . to_glib_none ( ) . 0 ) , " Failed to link pads " )
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 link_pads_full < P : IsA < Element > > ( & self , srcpadname : Option < & str > , dest : & P , destpadname : Option < & str > , 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_element_link_pads_full ( self . as_ref ( ) . to_glib_none ( ) . 0 , srcpadname . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 , destpadname . to_glib_none ( ) . 0 , flags . to_glib ( ) ) , " Failed to link pads " )
2017-08-14 19:19:47 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn lost_state ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_lost_state ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
//fn message_full(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: Option<&str>, debug: Option<&str>, file: &str, function: &str, line: i32) {
// unsafe { TODO: call gst_sys:gst_element_message_full() }
2017-05-12 12:24:03 +00:00
//}
2017-10-01 13:52:15 +00:00
//#[cfg(any(feature = "v1_10", feature = "dox"))]
2019-03-19 07:40:05 +00:00
//fn message_full_with_details(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: Option<&str>, debug: Option<&str>, file: &str, function: &str, line: i32, structure: &mut Structure) {
// unsafe { TODO: call gst_sys:gst_element_message_full_with_details() }
2017-05-12 12:24:03 +00:00
//}
fn no_more_pads ( & self ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_no_more_pads ( self . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-12-20 16:07:28 +00:00
fn post_message ( & self , message : & Message ) -> Result < ( ) , glib ::error ::BoolError > {
2017-07-03 10:56:26 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
glib_result_from_gboolean! ( gst_sys ::gst_element_post_message ( self . as_ref ( ) . to_glib_none ( ) . 0 , message . to_glib_full ( ) ) , " Failed to post message " )
2017-07-03 10:56:26 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn provide_clock ( & self ) -> Option < Clock > {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_provide_clock ( self . as_ref ( ) . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn release_request_pad < P : IsA < Pad > > ( & self , pad : & P ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_release_request_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , pad . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn remove_pad < P : IsA < Pad > > ( & self , pad : & 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_element_remove_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , pad . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to remove pad " )
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn request_pad ( & self , templ : & PadTemplate , name : Option < & str > , caps : Option < & Caps > ) -> Option < Pad > {
2017-07-10 21:02:08 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
from_glib_full ( gst_sys ::gst_element_request_pad ( self . as_ref ( ) . to_glib_none ( ) . 0 , templ . to_glib_none ( ) . 0 , name . 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
fn set_base_time ( & self , time : ClockTime ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_set_base_time ( self . as_ref ( ) . to_glib_none ( ) . 0 , time . to_glib ( ) ) ;
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn set_bus ( & self , bus : Option < & Bus > ) {
2017-05-12 12:24:03 +00:00
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_set_bus ( self . as_ref ( ) . to_glib_none ( ) . 0 , bus . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2019-03-19 07:40:05 +00:00
fn set_clock < P : IsA < Clock > > ( & self , clock : Option < & 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_element_set_clock ( self . as_ref ( ) . to_glib_none ( ) . 0 , clock . map ( | p | p . as_ref ( ) ) . to_glib_none ( ) . 0 ) , " Failed to set clock " )
2017-05-12 12:24:03 +00:00
}
}
2017-08-02 17:46:39 +00:00
fn set_context ( & self , context : & Context ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_set_context ( self . as_ref ( ) . to_glib_none ( ) . 0 , context . to_glib_none ( ) . 0 ) ;
2017-08-02 17:46:39 +00:00
}
}
2017-05-12 12:24:03 +00:00
fn set_locked_state ( & self , locked_state : bool ) -> bool {
unsafe {
2019-03-19 07:40:05 +00:00
from_glib ( gst_sys ::gst_element_set_locked_state ( self . as_ref ( ) . to_glib_none ( ) . 0 , locked_state . to_glib ( ) ) )
2017-05-12 12:24:03 +00:00
}
}
fn set_start_time ( & self , time : ClockTime ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_set_start_time ( self . as_ref ( ) . to_glib_none ( ) . 0 , time . to_glib ( ) ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-06-24 09:02:24 +00:00
fn sync_state_with_parent ( & 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_element_sync_state_with_parent ( self . as_ref ( ) . to_glib_none ( ) . 0 ) , " Failed to sync state with parent " )
2017-05-12 12:24:03 +00:00
}
}
fn unlink < P : IsA < Element > > ( & self , dest : & P ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_unlink ( self . as_ref ( ) . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
//fn unlink_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
2019-03-19 07:40:05 +00:00
// unsafe { TODO: call gst_sys:gst_element_unlink_many() }
2017-05-12 12:24:03 +00:00
//}
fn unlink_pads < P : IsA < Element > > ( & self , srcpadname : & str , dest : & P , destpadname : & str ) {
unsafe {
2019-03-19 07:40:05 +00:00
gst_sys ::gst_element_unlink_pads ( self . as_ref ( ) . to_glib_none ( ) . 0 , srcpadname . to_glib_none ( ) . 0 , dest . as_ref ( ) . to_glib_none ( ) . 0 , destpadname . to_glib_none ( ) . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-09-09 13:01:32 +00:00
fn connect_no_more_pads < F : Fn ( & Self ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn no_more_pads_trampoline < P , F : Fn ( & P ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstElement , f : glib_sys ::gpointer )
where P : IsA < Element >
{
let f : & F = & * ( f as * const F ) ;
f ( & Element ::from_glib_borrow ( this ) . unsafe_cast ( ) )
}
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 " no-more-pads \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( no_more_pads_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_pad_added < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn pad_added_trampoline < P , F : Fn ( & P , & Pad ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstElement , new_pad : * mut gst_sys ::GstPad , f : glib_sys ::gpointer )
where P : IsA < Element >
{
let f : & F = & * ( f as * const F ) ;
f ( & Element ::from_glib_borrow ( this ) . unsafe_cast ( ) , & from_glib_borrow ( new_pad ) )
}
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 " pad-added \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( pad_added_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_pad_removed < F : Fn ( & Self , & Pad ) + Send + Sync + 'static > ( & self , f : F ) -> SignalHandlerId {
2019-06-18 10:10:46 +00:00
unsafe extern " C " fn pad_removed_trampoline < P , F : Fn ( & P , & Pad ) + Send + Sync + 'static > ( this : * mut gst_sys ::GstElement , old_pad : * mut gst_sys ::GstPad , f : glib_sys ::gpointer )
where P : IsA < Element >
{
let f : & F = & * ( f as * const F ) ;
f ( & Element ::from_glib_borrow ( this ) . unsafe_cast ( ) , & from_glib_borrow ( old_pad ) )
}
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 " pad-removed \0 " . as_ptr ( ) as * const _ ,
2019-01-29 13:53:44 +00:00
Some ( transmute ( pad_removed_trampoline ::< Self , F > as usize ) ) , Box_ ::into_raw ( f ) )
2017-05-12 12:24:03 +00:00
}
}
}