// 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 ges_sys; use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::Value; use glib_sys; use gobject_sys; use gst; use gst_pbutils; use std::boxed::Box as Box_; use std::mem::transmute; use std::ptr; use Error; use PipelineFlags; use Timeline; glib_wrapper! { pub struct Pipeline(Object) @extends gst::Pipeline, gst::Element, gst::Object; match fn { get_type => || ges_sys::ges_pipeline_get_type(), } } impl Pipeline { pub fn new() -> Pipeline { assert_initialized_main_thread!(); unsafe { from_glib_none(ges_sys::ges_pipeline_new()) } } } impl Default for Pipeline { fn default() -> Self { Self::new() } } pub const NONE_PIPELINE: Option<&Pipeline> = None; pub trait GESPipelineExt: 'static { fn get_mode(&self) -> PipelineFlags; fn get_thumbnail(&self, caps: &gst::Caps) -> Option; fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option; fn preview_get_audio_sink(&self) -> Option; fn preview_get_video_sink(&self) -> Option; fn preview_set_audio_sink>(&self, sink: &P); fn preview_set_video_sink>(&self, sink: &P); fn save_thumbnail( &self, width: i32, height: i32, format: &str, location: &str, ) -> Result<(), Error>; fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError>; fn set_render_settings>( &self, output_uri: &str, profile: &P, ) -> Result<(), glib::error::BoolError>; fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError>; fn get_property_audio_filter(&self) -> Option; fn set_property_audio_filter(&self, audio_filter: Option<&gst::Element>); fn get_property_audio_sink(&self) -> Option; fn set_property_audio_sink(&self, audio_sink: Option<&gst::Element>); fn get_property_timeline(&self) -> Option; fn get_property_video_filter(&self) -> Option; fn set_property_video_filter(&self, video_filter: Option<&gst::Element>); fn get_property_video_sink(&self) -> Option; fn set_property_video_sink(&self, video_sink: Option<&gst::Element>); fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId; fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId; fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId; fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId; fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId; fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId; } impl> GESPipelineExt for O { fn get_mode(&self) -> PipelineFlags { unsafe { from_glib(ges_sys::ges_pipeline_get_mode( self.as_ref().to_glib_none().0, )) } } fn get_thumbnail(&self, caps: &gst::Caps) -> Option { unsafe { from_glib_full(ges_sys::ges_pipeline_get_thumbnail( self.as_ref().to_glib_none().0, caps.to_glib_none().0, )) } } fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option { unsafe { from_glib_full(ges_sys::ges_pipeline_get_thumbnail_rgb24( self.as_ref().to_glib_none().0, width, height, )) } } fn preview_get_audio_sink(&self) -> Option { unsafe { from_glib_full(ges_sys::ges_pipeline_preview_get_audio_sink( self.as_ref().to_glib_none().0, )) } } fn preview_get_video_sink(&self) -> Option { unsafe { from_glib_full(ges_sys::ges_pipeline_preview_get_video_sink( self.as_ref().to_glib_none().0, )) } } fn preview_set_audio_sink>(&self, sink: &P) { unsafe { ges_sys::ges_pipeline_preview_set_audio_sink( self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0, ); } } fn preview_set_video_sink>(&self, sink: &P) { unsafe { ges_sys::ges_pipeline_preview_set_video_sink( self.as_ref().to_glib_none().0, sink.as_ref().to_glib_none().0, ); } } fn save_thumbnail( &self, width: i32, height: i32, format: &str, location: &str, ) -> Result<(), Error> { unsafe { let mut error = ptr::null_mut(); let _ = ges_sys::ges_pipeline_save_thumbnail( self.as_ref().to_glib_none().0, width, height, format.to_glib_none().0, location.to_glib_none().0, &mut error, ); if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.to_glib()), "Failed to set mode" ) } } fn set_render_settings>( &self, output_uri: &str, profile: &P, ) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_pipeline_set_render_settings( self.as_ref().to_glib_none().0, output_uri.to_glib_none().0, profile.as_ref().to_glib_none().0 ), "Failed to set render settings" ) } } fn set_timeline>(&self, timeline: &P) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_pipeline_set_timeline( self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_full() ), "Failed to set timeline" ) } } fn get_property_audio_filter(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-filter\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value.get() } } fn set_property_audio_filter(&self, audio_filter: Option<&gst::Element>) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-filter\0".as_ptr() as *const _, Value::from(audio_filter).to_glib_none().0, ); } } fn get_property_audio_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value.get() } } fn set_property_audio_sink(&self, audio_sink: Option<&gst::Element>) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"audio-sink\0".as_ptr() as *const _, Value::from(audio_sink).to_glib_none().0, ); } } fn get_property_timeline(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"timeline\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value.get() } } fn get_property_video_filter(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-filter\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value.get() } } fn set_property_video_filter(&self, video_filter: Option<&gst::Element>) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-filter\0".as_ptr() as *const _, Value::from(video_filter).to_glib_none().0, ); } } fn get_property_video_sink(&self) -> Option { unsafe { let mut value = Value::from_type(::static_type()); gobject_sys::g_object_get_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value.get() } } fn set_property_video_sink(&self, video_sink: Option<&gst::Element>) { unsafe { gobject_sys::g_object_set_property( self.to_glib_none().0 as *mut gobject_sys::GObject, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0, ); } } fn connect_property_audio_filter_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_audio_filter_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::audio-filter\0".as_ptr() as *const _, Some(transmute( notify_audio_filter_trampoline:: as usize, )), Box_::into_raw(f), ) } } fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_audio_sink_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::audio-sink\0".as_ptr() as *const _, Some(transmute(notify_audio_sink_trampoline:: as usize)), Box_::into_raw(f), ) } } fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_mode_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::mode\0".as_ptr() as *const _, Some(transmute(notify_mode_trampoline:: as usize)), Box_::into_raw(f), ) } } fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_timeline_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _, Some(transmute(notify_timeline_trampoline:: as usize)), Box_::into_raw(f), ) } } fn connect_property_video_filter_notify( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_video_filter_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::video-filter\0".as_ptr() as *const _, Some(transmute( notify_video_filter_trampoline:: as usize, )), Box_::into_raw(f), ) } } fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_video_sink_trampoline( this: *mut ges_sys::GESPipeline, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA, { let f: &F = &*(f as *const F); f(&Pipeline::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_ = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _, Some(transmute(notify_video_sink_trampoline:: as usize)), Box_::into_raw(f), ) } } }