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 ;
2017-07-03 11:06:08 +00:00
use Plugin ;
2017-05-12 12:24:03 +00:00
use State ;
use StateChange ;
use StateChangeReturn ;
use URIType ;
use ffi ;
use glib ;
use glib ::object ::Downcast ;
use glib ::object ::IsA ;
2017-09-09 13:01:32 +00:00
use glib ::signal ::SignalHandlerId ;
2017-05-12 12:24:03 +00:00
use glib ::signal ::connect ;
use glib ::translate ::* ;
use glib_ffi ;
2017-07-19 18:41:25 +00:00
use gobject_ffi ;
2017-05-12 12:24:03 +00:00
use std ::boxed ::Box as Box_ ;
use std ::mem ;
use std ::mem ::transmute ;
use std ::ptr ;
glib_wrapper! {
2017-11-09 11:33:40 +00:00
pub struct Element ( Object < ffi ::GstElement , ffi ::GstElementClass > ) : Object ;
2017-05-12 12:24:03 +00:00
match fn {
get_type = > | | ffi ::gst_element_get_type ( ) ,
}
}
impl Element {
pub fn make_from_uri < ' a , P : Into < Option < & ' a str > > > ( type_ : URIType , uri : & str , elementname : P ) -> Result < Element , Error > {
2017-07-10 09:36:15 +00:00
assert_initialized_main_thread! ( ) ;
2017-05-12 12:24:03 +00:00
let elementname = elementname . into ( ) ;
let elementname = elementname . to_glib_none ( ) ;
unsafe {
let mut error = ptr ::null_mut ( ) ;
let ret = ffi ::gst_element_make_from_uri ( type_ . to_glib ( ) , uri . to_glib_none ( ) . 0 , elementname . 0 , & mut error ) ;
if error . is_null ( ) { Ok ( from_glib_none ( ret ) ) } else { Err ( from_glib_full ( error ) ) }
}
}
2017-07-03 11:06:08 +00:00
pub fn register < ' a , P : Into < Option < & ' a Plugin > > > ( plugin : P , name : & str , rank : u32 , type_ : glib ::types ::Type ) -> bool {
2017-07-10 09:36:15 +00:00
assert_initialized_main_thread! ( ) ;
2017-07-03 11:06:08 +00:00
let plugin = plugin . into ( ) ;
let plugin = plugin . to_glib_none ( ) ;
unsafe {
from_glib ( ffi ::gst_element_register ( plugin . 0 , name . to_glib_none ( ) . 0 , rank , type_ . to_glib ( ) ) )
}
}
2017-05-12 12:24:03 +00:00
}
2017-06-25 08:04:37 +00:00
unsafe impl Send for Element { }
unsafe impl Sync for Element { }
2017-05-12 12:24:03 +00:00
pub trait ElementExt {
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
2017-10-01 13:52:15 +00:00
//#[cfg(any(feature = "v1_10", feature = "dox"))]
2017-11-27 17:16:34 +00:00
//fn call_async(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
2017-05-12 12:24:03 +00:00
fn change_state ( & self , transition : StateChange ) -> StateChangeReturn ;
fn continue_state ( & self , ret : StateChangeReturn ) -> StateChangeReturn ;
fn create_all_pads ( & self ) ;
2018-03-15 08:39:12 +00:00
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool;
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_sink_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool;
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_src_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool;
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 > ;
2017-07-10 21:02:08 +00:00
fn get_compatible_pad < ' a , P : IsA < Pad > , Q : Into < Option < & ' a Caps > > > ( & self , pad : & P , caps : Q ) -> Option < Pad > ;
2017-05-12 12:24:03 +00:00
fn get_compatible_pad_template ( & self , compattempl : & PadTemplate ) -> Option < PadTemplate > ;
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_state ( & self , timeout : ClockTime ) -> ( StateChangeReturn , State , State ) ;
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
2017-07-10 21:02:08 +00:00
fn link_filtered < ' a , P : IsA < Element > , Q : Into < Option < & ' a Caps > > > ( & self , dest : & P , filter : Q ) -> 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;
2017-06-24 09:02:24 +00:00
fn link_pads < ' a , ' b , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > > ( & self , srcpadname : P , dest : & Q , destpadname : R ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-07-10 21:02:08 +00:00
fn link_pads_filtered < ' a , ' b , ' c , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > , S : Into < Option < & ' c Caps > > > ( & self , srcpadname : P , dest : & Q , destpadname : R , filter : S ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
2017-12-20 16:07:55 +00:00
fn link_pads_full < ' a , ' b , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > > ( & self , srcpadname : P , dest : & Q , destpadname : R , flags : PadLinkCheck ) -> Result < ( ) , glib ::error ::BoolError > ;
2017-05-12 12:24:03 +00:00
fn lost_state ( & self ) ;
2017-07-03 14:52:10 +00:00
//fn message_full<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, 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"))]
2017-07-07 13:04:54 +00:00
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, 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
2017-07-10 21:02:08 +00:00
fn request_pad < ' a , ' b , P : Into < Option < & ' a str > > , Q : Into < Option < & ' b Caps > > > ( & self , templ : & PadTemplate , name : P , caps : Q ) -> Option < Pad > ;
2017-05-12 12:24:03 +00:00
fn set_base_time ( & self , time : ClockTime ) ;
2017-12-20 16:10:50 +00:00
fn set_bus < ' a , P : Into < Option < & ' a Bus > > > ( & self , bus : P ) ;
2017-05-12 12:24:03 +00:00
2017-12-20 16:13:06 +00:00
fn set_clock < ' a , P : IsA < Clock > + ' a , Q : Into < Option < & ' a P > > > ( & self , clock : Q ) -> 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 ) ;
fn set_state ( & self , state : State ) -> StateChangeReturn ;
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
}
impl < O : IsA < Element > + IsA < glib ::object ::Object > > ElementExt for O {
fn abort_state ( & self ) {
unsafe {
ffi ::gst_element_abort_state ( self . to_glib_none ( ) . 0 ) ;
}
}
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 {
2017-06-24 09:02:24 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_add_pad ( self . to_glib_none ( ) . 0 , pad . to_glib_none ( ) . 0 ) , " Failed to add pad " )
2017-05-12 12:24:03 +00:00
}
}
2017-10-01 13:52:15 +00:00
//#[cfg(any(feature = "v1_10", feature = "dox"))]
2017-11-27 17:16:34 +00:00
//fn call_async(&self, func: /*Unknown conversion*//*Unimplemented*/ElementCallAsyncFunc, destroy_notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
2017-05-12 12:24:03 +00:00
// unsafe { TODO: call ffi::gst_element_call_async() }
//}
fn change_state ( & self , transition : StateChange ) -> StateChangeReturn {
unsafe {
from_glib ( ffi ::gst_element_change_state ( self . to_glib_none ( ) . 0 , transition . to_glib ( ) ) )
}
}
fn continue_state ( & self , ret : StateChangeReturn ) -> StateChangeReturn {
unsafe {
from_glib ( ffi ::gst_element_continue_state ( self . to_glib_none ( ) . 0 , ret . to_glib ( ) ) )
}
}
fn create_all_pads ( & self ) {
unsafe {
ffi ::gst_element_create_all_pads ( self . to_glib_none ( ) . 0 ) ;
}
}
2018-03-15 08:39:12 +00:00
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool {
// unsafe { TODO: call ffi::gst_element_foreach_pad() }
//}
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_sink_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool {
// unsafe { TODO: call ffi::gst_element_foreach_sink_pad() }
//}
//#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn foreach_src_pad<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: /*Unknown conversion*//*Unimplemented*/ElementForeachPadFunc, user_data: P) -> bool {
// unsafe { TODO: call ffi::gst_element_foreach_src_pad() }
//}
2017-05-12 12:24:03 +00:00
fn get_base_time ( & self ) -> ClockTime {
unsafe {
2017-11-11 10:21:55 +00:00
from_glib ( ffi ::gst_element_get_base_time ( self . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_bus ( & self ) -> Option < Bus > {
unsafe {
from_glib_full ( ffi ::gst_element_get_bus ( self . to_glib_none ( ) . 0 ) )
}
}
fn get_clock ( & self ) -> Option < Clock > {
unsafe {
from_glib_full ( ffi ::gst_element_get_clock ( self . to_glib_none ( ) . 0 ) )
}
}
2017-07-10 21:02:08 +00:00
fn get_compatible_pad < ' a , P : IsA < Pad > , Q : Into < Option < & ' a Caps > > > ( & self , pad : & P , caps : Q ) -> Option < Pad > {
let caps = caps . into ( ) ;
let caps = caps . to_glib_none ( ) ;
unsafe {
from_glib_full ( ffi ::gst_element_get_compatible_pad ( self . to_glib_none ( ) . 0 , pad . to_glib_none ( ) . 0 , caps . 0 ) )
}
}
2017-05-12 12:24:03 +00:00
fn get_compatible_pad_template ( & self , compattempl : & PadTemplate ) -> Option < PadTemplate > {
unsafe {
from_glib_none ( ffi ::gst_element_get_compatible_pad_template ( self . to_glib_none ( ) . 0 , compattempl . to_glib_none ( ) . 0 ) )
}
}
2017-08-02 17:46:39 +00:00
fn get_context ( & self , context_type : & str ) -> Option < Context > {
unsafe {
from_glib_full ( ffi ::gst_element_get_context ( self . to_glib_none ( ) . 0 , context_type . to_glib_none ( ) . 0 ) )
}
}
2017-05-12 12:24:03 +00:00
2017-08-02 17:46:39 +00:00
fn get_contexts ( & self ) -> Vec < Context > {
unsafe {
FromGlibPtrContainer ::from_glib_full ( ffi ::gst_element_get_contexts ( self . to_glib_none ( ) . 0 ) )
}
}
2017-05-12 12:24:03 +00:00
fn get_factory ( & self ) -> Option < ElementFactory > {
unsafe {
from_glib_none ( ffi ::gst_element_get_factory ( self . to_glib_none ( ) . 0 ) )
}
}
fn get_request_pad ( & self , name : & str ) -> Option < Pad > {
unsafe {
from_glib_full ( ffi ::gst_element_get_request_pad ( self . to_glib_none ( ) . 0 , name . to_glib_none ( ) . 0 ) )
}
}
fn get_start_time ( & self ) -> ClockTime {
unsafe {
2017-11-11 10:21:55 +00:00
from_glib ( ffi ::gst_element_get_start_time ( self . to_glib_none ( ) . 0 ) )
2017-05-12 12:24:03 +00:00
}
}
fn get_state ( & self , timeout : ClockTime ) -> ( StateChangeReturn , State , State ) {
unsafe {
let mut state = mem ::uninitialized ( ) ;
let mut pending = mem ::uninitialized ( ) ;
2017-11-11 10:21:55 +00:00
let ret = from_glib ( ffi ::gst_element_get_state ( self . to_glib_none ( ) . 0 , & mut state , & mut pending , timeout . to_glib ( ) ) ) ;
2017-05-12 12:24:03 +00:00
( ret , from_glib ( state ) , from_glib ( pending ) )
}
}
fn get_static_pad ( & self , name : & str ) -> Option < Pad > {
unsafe {
from_glib_full ( ffi ::gst_element_get_static_pad ( self . to_glib_none ( ) . 0 , name . to_glib_none ( ) . 0 ) )
}
}
fn is_locked_state ( & self ) -> bool {
unsafe {
from_glib ( ffi ::gst_element_is_locked_state ( self . to_glib_none ( ) . 0 ) )
}
}
2017-09-17 15:41:02 +00:00
//fn iterate_pads(&self) -> /*Ignored*/Option<Iterator> {
// unsafe { TODO: call ffi::gst_element_iterate_pads() }
//}
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_sink_pads(&self) -> /*Ignored*/Option<Iterator> {
// unsafe { TODO: call ffi::gst_element_iterate_sink_pads() }
//}
2017-05-12 12:24:03 +00:00
2017-09-17 15:41:02 +00:00
//fn iterate_src_pads(&self) -> /*Ignored*/Option<Iterator> {
// unsafe { TODO: call ffi::gst_element_iterate_src_pads() }
//}
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 {
2017-06-24 09:02:24 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_link ( self . to_glib_none ( ) . 0 , dest . to_glib_none ( ) . 0 ) , " Failed to link elements " )
2017-05-12 12:24:03 +00:00
}
}
2017-07-10 21:02:08 +00:00
fn link_filtered < ' a , P : IsA < Element > , Q : Into < Option < & ' a Caps > > > ( & self , dest : & P , filter : Q ) -> Result < ( ) , glib ::error ::BoolError > {
let filter = filter . into ( ) ;
let filter = filter . to_glib_none ( ) ;
unsafe {
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_link_filtered ( self . to_glib_none ( ) . 0 , dest . to_glib_none ( ) . 0 , filter . 0 ) , " Failed to link elements " )
}
}
2017-05-12 12:24:03 +00:00
//fn link_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
// unsafe { TODO: call ffi::gst_element_link_many() }
//}
2017-06-24 09:02:24 +00:00
fn link_pads < ' a , ' b , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > > ( & self , srcpadname : P , dest : & Q , destpadname : R ) -> Result < ( ) , glib ::error ::BoolError > {
2017-05-12 12:24:03 +00:00
let srcpadname = srcpadname . into ( ) ;
let srcpadname = srcpadname . to_glib_none ( ) ;
let destpadname = destpadname . into ( ) ;
let destpadname = destpadname . to_glib_none ( ) ;
unsafe {
2017-06-24 09:02:24 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_link_pads ( self . to_glib_none ( ) . 0 , srcpadname . 0 , dest . to_glib_none ( ) . 0 , destpadname . 0 ) , " Failed to link pads " )
2017-05-12 12:24:03 +00:00
}
}
2017-07-10 21:02:08 +00:00
fn link_pads_filtered < ' a , ' b , ' c , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > , S : Into < Option < & ' c Caps > > > ( & self , srcpadname : P , dest : & Q , destpadname : R , filter : S ) -> Result < ( ) , glib ::error ::BoolError > {
let srcpadname = srcpadname . into ( ) ;
let srcpadname = srcpadname . to_glib_none ( ) ;
let destpadname = destpadname . into ( ) ;
let destpadname = destpadname . to_glib_none ( ) ;
let filter = filter . into ( ) ;
let filter = filter . to_glib_none ( ) ;
unsafe {
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_link_pads_filtered ( self . to_glib_none ( ) . 0 , srcpadname . 0 , dest . to_glib_none ( ) . 0 , destpadname . 0 , filter . 0 ) , " Failed to link pads " )
}
}
2017-05-12 12:24:03 +00:00
2017-12-20 16:07:55 +00:00
fn link_pads_full < ' a , ' b , P : Into < Option < & ' a str > > , Q : IsA < Element > , R : Into < Option < & ' b str > > > ( & self , srcpadname : P , dest : & Q , destpadname : R , flags : PadLinkCheck ) -> Result < ( ) , glib ::error ::BoolError > {
2017-08-14 19:19:47 +00:00
let srcpadname = srcpadname . into ( ) ;
let srcpadname = srcpadname . to_glib_none ( ) ;
let destpadname = destpadname . into ( ) ;
let destpadname = destpadname . to_glib_none ( ) ;
unsafe {
2017-12-20 16:07:55 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_link_pads_full ( self . to_glib_none ( ) . 0 , srcpadname . 0 , dest . to_glib_none ( ) . 0 , destpadname . 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 {
ffi ::gst_element_lost_state ( self . to_glib_none ( ) . 0 ) ;
}
}
2017-07-03 14:52:10 +00:00
//fn message_full<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32) {
2017-05-12 12:24:03 +00:00
// unsafe { TODO: call ffi::gst_element_message_full() }
//}
2017-10-01 13:52:15 +00:00
//#[cfg(any(feature = "v1_10", feature = "dox"))]
2017-07-07 13:04:54 +00:00
//fn message_full_with_details<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(&self, type_: /*Ignored*/MessageType, domain: /*Ignored*/glib::Quark, code: i32, text: P, debug: Q, file: &str, function: &str, line: i32, structure: &mut Structure) {
2017-05-12 12:24:03 +00:00
// unsafe { TODO: call ffi::gst_element_message_full_with_details() }
//}
fn no_more_pads ( & self ) {
unsafe {
ffi ::gst_element_no_more_pads ( self . to_glib_none ( ) . 0 ) ;
}
}
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 {
2017-12-20 16:07:28 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_post_message ( self . 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 {
from_glib_full ( ffi ::gst_element_provide_clock ( self . to_glib_none ( ) . 0 ) )
}
}
fn release_request_pad < P : IsA < Pad > > ( & self , pad : & P ) {
unsafe {
ffi ::gst_element_release_request_pad ( self . to_glib_none ( ) . 0 , pad . to_glib_none ( ) . 0 ) ;
}
}
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 {
2017-12-04 16:12:55 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_remove_pad ( self . to_glib_none ( ) . 0 , pad . to_glib_none ( ) . 0 ) , " Failed to remove pad " )
2017-05-12 12:24:03 +00:00
}
}
2017-07-10 21:02:08 +00:00
fn request_pad < ' a , ' b , P : Into < Option < & ' a str > > , Q : Into < Option < & ' b Caps > > > ( & self , templ : & PadTemplate , name : P , caps : Q ) -> Option < Pad > {
let name = name . into ( ) ;
let name = name . to_glib_none ( ) ;
let caps = caps . into ( ) ;
let caps = caps . to_glib_none ( ) ;
unsafe {
from_glib_full ( ffi ::gst_element_request_pad ( self . to_glib_none ( ) . 0 , templ . to_glib_none ( ) . 0 , name . 0 , caps . 0 ) )
}
}
2017-05-12 12:24:03 +00:00
fn set_base_time ( & self , time : ClockTime ) {
unsafe {
2017-11-11 10:21:55 +00:00
ffi ::gst_element_set_base_time ( self . to_glib_none ( ) . 0 , time . to_glib ( ) ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-12-20 16:10:50 +00:00
fn set_bus < ' a , P : Into < Option < & ' a Bus > > > ( & self , bus : P ) {
let bus = bus . into ( ) ;
let bus = bus . to_glib_none ( ) ;
2017-05-12 12:24:03 +00:00
unsafe {
2017-12-20 16:10:50 +00:00
ffi ::gst_element_set_bus ( self . to_glib_none ( ) . 0 , bus . 0 ) ;
2017-05-12 12:24:03 +00:00
}
}
2017-12-20 16:13:06 +00:00
fn set_clock < ' a , P : IsA < Clock > + ' a , Q : Into < Option < & ' a P > > > ( & self , clock : Q ) -> Result < ( ) , glib ::error ::BoolError > {
let clock = clock . into ( ) ;
let clock = clock . to_glib_none ( ) ;
2017-05-12 12:24:03 +00:00
unsafe {
2017-12-20 16:13:06 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_set_clock ( self . to_glib_none ( ) . 0 , clock . 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 {
ffi ::gst_element_set_context ( self . to_glib_none ( ) . 0 , context . to_glib_none ( ) . 0 ) ;
}
}
2017-05-12 12:24:03 +00:00
fn set_locked_state ( & self , locked_state : bool ) -> bool {
unsafe {
from_glib ( ffi ::gst_element_set_locked_state ( self . to_glib_none ( ) . 0 , locked_state . to_glib ( ) ) )
}
}
fn set_start_time ( & self , time : ClockTime ) {
unsafe {
2017-11-11 10:21:55 +00:00
ffi ::gst_element_set_start_time ( self . to_glib_none ( ) . 0 , time . to_glib ( ) ) ;
2017-05-12 12:24:03 +00:00
}
}
fn set_state ( & self , state : State ) -> StateChangeReturn {
unsafe {
from_glib ( ffi ::gst_element_set_state ( self . to_glib_none ( ) . 0 , state . to_glib ( ) ) )
}
}
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 {
2017-06-24 09:02:24 +00:00
glib ::error ::BoolError ::from_glib ( ffi ::gst_element_sync_state_with_parent ( self . 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 {
ffi ::gst_element_unlink ( self . to_glib_none ( ) . 0 , dest . to_glib_none ( ) . 0 ) ;
}
}
//fn unlink_many<P: IsA<Element>>(&self, element_2: &P, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
// unsafe { TODO: call ffi::gst_element_unlink_many() }
//}
fn unlink_pads < P : IsA < Element > > ( & self , srcpadname : & str , dest : & P , destpadname : & str ) {
unsafe {
ffi ::gst_element_unlink_pads ( self . to_glib_none ( ) . 0 , srcpadname . to_glib_none ( ) . 0 , dest . to_glib_none ( ) . 0 , destpadname . to_glib_none ( ) . 0 ) ;
}
}
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
unsafe {
2017-06-25 08:04:37 +00:00
let f : Box_ < Box_ < Fn ( & Self ) + Send + Sync + 'static > > = Box_ ::new ( Box_ ::new ( f ) ) ;
2017-05-12 12:24:03 +00:00
connect ( self . to_glib_none ( ) . 0 , " no-more-pads " ,
transmute ( no_more_pads_trampoline ::< Self > as usize ) , Box_ ::into_raw ( f ) as * mut _ )
}
}
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
unsafe {
2017-06-25 08:04:37 +00:00
let f : Box_ < Box_ < Fn ( & Self , & Pad ) + Send + Sync + 'static > > = Box_ ::new ( Box_ ::new ( f ) ) ;
2017-05-12 12:24:03 +00:00
connect ( self . to_glib_none ( ) . 0 , " pad-added " ,
transmute ( pad_added_trampoline ::< Self > as usize ) , Box_ ::into_raw ( f ) as * mut _ )
}
}
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
unsafe {
2017-06-25 08:04:37 +00:00
let f : Box_ < Box_ < Fn ( & Self , & Pad ) + Send + Sync + 'static > > = Box_ ::new ( Box_ ::new ( f ) ) ;
2017-05-12 12:24:03 +00:00
connect ( self . to_glib_none ( ) . 0 , " pad-removed " ,
transmute ( pad_removed_trampoline ::< Self > as usize ) , Box_ ::into_raw ( f ) as * mut _ )
}
}
}
unsafe extern " C " fn no_more_pads_trampoline < P > ( this : * mut ffi ::GstElement , f : glib_ffi ::gpointer )
where P : IsA < Element > {
2017-08-03 18:56:39 +00:00
let f : & & ( Fn ( & P ) + Send + Sync + 'static ) = transmute ( f ) ;
2017-09-09 13:01:32 +00:00
f ( & Element ::from_glib_borrow ( this ) . downcast_unchecked ( ) )
2017-05-12 12:24:03 +00:00
}
unsafe extern " C " fn pad_added_trampoline < P > ( this : * mut ffi ::GstElement , new_pad : * mut ffi ::GstPad , f : glib_ffi ::gpointer )
where P : IsA < Element > {
2017-08-03 18:56:39 +00:00
let f : & & ( Fn ( & P , & Pad ) + Send + Sync + 'static ) = transmute ( f ) ;
2017-09-09 13:01:32 +00:00
f ( & Element ::from_glib_borrow ( this ) . downcast_unchecked ( ) , & from_glib_borrow ( new_pad ) )
2017-05-12 12:24:03 +00:00
}
unsafe extern " C " fn pad_removed_trampoline < P > ( this : * mut ffi ::GstElement , old_pad : * mut ffi ::GstPad , f : glib_ffi ::gpointer )
where P : IsA < Element > {
2017-08-03 18:56:39 +00:00
let f : & & ( Fn ( & P , & Pad ) + Send + Sync + 'static ) = transmute ( f ) ;
2017-09-09 13:01:32 +00:00
f ( & Element ::from_glib_borrow ( this ) . downcast_unchecked ( ) , & from_glib_borrow ( old_pad ) )
2017-05-12 12:24:03 +00:00
}