Regenerate everything with latest gir

This commit is contained in:
Sebastian Dröge 2019-01-16 13:32:39 +02:00
parent 948fb2ae4b
commit 6da0a9d169
146 changed files with 2083 additions and 2039 deletions

View file

@ -5,6 +5,7 @@
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
@ -12,18 +13,11 @@ use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_base; use gst_base;
use gst_base_ffi;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct AppSink(Object<ffi::GstAppSink, ffi::GstAppSinkClass>): [ pub struct AppSink(Object<ffi::GstAppSink, ffi::GstAppSinkClass, AppSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object, @implements gst::URIHandler;
gst_base::BaseSink => gst_base_ffi::GstBaseSink,
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
gst::URIHandler => gst_ffi::GstURIHandler,
];
match fn { match fn {
get_type => || ffi::gst_app_sink_get_type(), get_type => || ffi::gst_app_sink_get_type(),
@ -99,9 +93,8 @@ impl AppSink {
pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) { pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) {
let caps = caps.into(); let caps = caps.into();
let caps = caps.to_glib_none();
unsafe { unsafe {
ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.0); ffi::gst_app_sink_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
} }
} }
@ -146,21 +139,21 @@ impl AppSink {
pub fn get_property_buffer_list(&self) -> bool { pub fn get_property_buffer_list(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"buffer-list\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"buffer-list\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_buffer_list(&self, buffer_list: bool) { pub fn set_property_buffer_list(&self, buffer_list: bool) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"buffer-list\0".as_ptr() as *const _, Value::from(&buffer_list).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"buffer-list\0".as_ptr() as *const _, Value::from(&buffer_list).to_glib_none().0);
} }
} }
pub fn get_property_eos(&self) -> bool { pub fn get_property_eos(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"eos\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"eos\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -168,7 +161,7 @@ impl AppSink {
pub fn connect_eos<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_eos<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"eos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"eos\0".as_ptr() as *const _,
transmute(eos_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(eos_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -176,7 +169,7 @@ impl AppSink {
pub fn connect_property_buffer_list_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_buffer_list_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::buffer-list\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::buffer-list\0".as_ptr() as *const _,
transmute(notify_buffer_list_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_buffer_list_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -184,7 +177,7 @@ impl AppSink {
pub fn connect_property_caps_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_caps_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::caps\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _,
transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -192,7 +185,7 @@ impl AppSink {
pub fn connect_property_drop_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_drop_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::drop\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::drop\0".as_ptr() as *const _,
transmute(notify_drop_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_drop_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -200,7 +193,7 @@ impl AppSink {
pub fn connect_property_emit_signals_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_emit_signals_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::emit-signals\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _,
transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -208,7 +201,7 @@ impl AppSink {
pub fn connect_property_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::eos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::eos\0".as_ptr() as *const _,
transmute(notify_eos_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_eos_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -216,7 +209,7 @@ impl AppSink {
pub fn connect_property_max_buffers_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_max_buffers_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::max-buffers\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-buffers\0".as_ptr() as *const _,
transmute(notify_max_buffers_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_buffers_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -224,7 +217,7 @@ impl AppSink {
pub fn connect_property_wait_on_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_wait_on_eos_notify<F: Fn(&AppSink) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSink) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::wait-on-eos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::wait-on-eos\0".as_ptr() as *const _,
transmute(notify_wait_on_eos_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_wait_on_eos_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -233,6 +226,8 @@ impl AppSink {
unsafe impl Send for AppSink {} unsafe impl Send for AppSink {}
unsafe impl Sync for AppSink {} unsafe impl Sync for AppSink {}
pub const NONE_APP_SINK: Option<&AppSink> = None;
unsafe extern "C" fn eos_trampoline(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) { unsafe extern "C" fn eos_trampoline(this: *mut ffi::GstAppSink, f: glib_ffi::gpointer) {
let f: &&(Fn(&AppSink) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&AppSink) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -6,6 +6,7 @@ use AppStreamType;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
@ -13,19 +14,12 @@ use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_base; use gst_base;
use gst_base_ffi;
use gst_ffi;
use libc; use libc;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass>): [ pub struct AppSrc(Object<ffi::GstAppSrc, ffi::GstAppSrcClass, AppSrcClass>) @extends gst_base::BaseSrc, gst::Element, gst::Object, @implements gst::URIHandler;
gst_base::BaseSrc => gst_base_ffi::GstBaseSrc,
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
gst::URIHandler => gst_ffi::GstURIHandler,
];
match fn { match fn {
get_type => || ffi::gst_app_src_get_type(), get_type => || ffi::gst_app_src_get_type(),
@ -82,9 +76,8 @@ impl AppSrc {
pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) { pub fn set_caps<'a, P: Into<Option<&'a gst::Caps>>>(&self, caps: P) {
let caps = caps.into(); let caps = caps.into();
let caps = caps.to_glib_none();
unsafe { unsafe {
ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.0); ffi::gst_app_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0);
} }
} }
@ -122,105 +115,105 @@ impl AppSrc {
pub fn get_property_block(&self) -> bool { pub fn get_property_block(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"block\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"block\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_block(&self, block: bool) { pub fn set_property_block(&self, block: bool) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"block\0".as_ptr() as *const _, Value::from(&block).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"block\0".as_ptr() as *const _, Value::from(&block).to_glib_none().0);
} }
} }
pub fn get_property_duration(&self) -> u64 { pub fn get_property_duration(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"duration\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_duration(&self, duration: u64) { pub fn set_property_duration(&self, duration: u64) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"duration\0".as_ptr() as *const _, Value::from(&duration).to_glib_none().0);
} }
} }
pub fn get_property_format(&self) -> gst::Format { pub fn get_property_format(&self) -> gst::Format {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Format as StaticType>::static_type()); let mut value = Value::from_type(<gst::Format as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"format\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"format\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_format(&self, format: gst::Format) { pub fn set_property_format(&self, format: gst::Format) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"format\0".as_ptr() as *const _, Value::from(&format).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"format\0".as_ptr() as *const _, Value::from(&format).to_glib_none().0);
} }
} }
pub fn get_property_is_live(&self) -> bool { pub fn get_property_is_live(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"is-live\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"is-live\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_is_live(&self, is_live: bool) { pub fn set_property_is_live(&self, is_live: bool) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"is-live\0".as_ptr() as *const _, Value::from(&is_live).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"is-live\0".as_ptr() as *const _, Value::from(&is_live).to_glib_none().0);
} }
} }
pub fn get_property_max_latency(&self) -> i64 { pub fn get_property_max_latency(&self) -> i64 {
unsafe { unsafe {
let mut value = Value::from_type(<i64 as StaticType>::static_type()); let mut value = Value::from_type(<i64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"max-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"max-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_max_latency(&self, max_latency: i64) { pub fn set_property_max_latency(&self, max_latency: i64) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"max-latency\0".as_ptr() as *const _, Value::from(&max_latency).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"max-latency\0".as_ptr() as *const _, Value::from(&max_latency).to_glib_none().0);
} }
} }
pub fn get_property_min_latency(&self) -> i64 { pub fn get_property_min_latency(&self) -> i64 {
unsafe { unsafe {
let mut value = Value::from_type(<i64 as StaticType>::static_type()); let mut value = Value::from_type(<i64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"min-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-latency\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_min_latency(&self, min_latency: i64) { pub fn set_property_min_latency(&self, min_latency: i64) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"min-latency\0".as_ptr() as *const _, Value::from(&min_latency).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-latency\0".as_ptr() as *const _, Value::from(&min_latency).to_glib_none().0);
} }
} }
pub fn get_property_min_percent(&self) -> u32 { pub fn get_property_min_percent(&self) -> u32 {
unsafe { unsafe {
let mut value = Value::from_type(<u32 as StaticType>::static_type()); let mut value = Value::from_type(<u32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"min-percent\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-percent\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_min_percent(&self, min_percent: u32) { pub fn set_property_min_percent(&self, min_percent: u32) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"min-percent\0".as_ptr() as *const _, Value::from(&min_percent).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"min-percent\0".as_ptr() as *const _, Value::from(&min_percent).to_glib_none().0);
} }
} }
pub fn connect_enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_enough_data<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"enough-data\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"enough-data\0".as_ptr() as *const _,
transmute(enough_data_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(enough_data_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -228,7 +221,7 @@ impl AppSrc {
pub fn connect_need_data<F: Fn(&AppSrc, u32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_need_data<F: Fn(&AppSrc, u32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc, u32) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc, u32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"need-data\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"need-data\0".as_ptr() as *const _,
transmute(need_data_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(need_data_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -236,7 +229,7 @@ impl AppSrc {
pub fn connect_seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_seek_data<F: Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc, u64) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"seek-data\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"seek-data\0".as_ptr() as *const _,
transmute(seek_data_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(seek_data_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -244,7 +237,7 @@ impl AppSrc {
pub fn connect_property_block_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_block_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::block\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::block\0".as_ptr() as *const _,
transmute(notify_block_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_block_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -252,7 +245,7 @@ impl AppSrc {
pub fn connect_property_caps_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_caps_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::caps\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::caps\0".as_ptr() as *const _,
transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_caps_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -260,7 +253,7 @@ impl AppSrc {
pub fn connect_property_current_level_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_current_level_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::current-level-bytes\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::current-level-bytes\0".as_ptr() as *const _,
transmute(notify_current_level_bytes_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_current_level_bytes_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -268,7 +261,7 @@ impl AppSrc {
pub fn connect_property_duration_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_duration_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -276,7 +269,7 @@ impl AppSrc {
pub fn connect_property_emit_signals_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_emit_signals_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::emit-signals\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::emit-signals\0".as_ptr() as *const _,
transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_emit_signals_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -284,7 +277,7 @@ impl AppSrc {
pub fn connect_property_format_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_format_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::format\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::format\0".as_ptr() as *const _,
transmute(notify_format_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_format_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -292,7 +285,7 @@ impl AppSrc {
pub fn connect_property_is_live_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_is_live_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::is-live\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::is-live\0".as_ptr() as *const _,
transmute(notify_is_live_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_is_live_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -300,7 +293,7 @@ impl AppSrc {
pub fn connect_property_max_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_max_bytes_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::max-bytes\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-bytes\0".as_ptr() as *const _,
transmute(notify_max_bytes_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_bytes_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -308,7 +301,7 @@ impl AppSrc {
pub fn connect_property_max_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_max_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::max-latency\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-latency\0".as_ptr() as *const _,
transmute(notify_max_latency_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_latency_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -316,7 +309,7 @@ impl AppSrc {
pub fn connect_property_min_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_min_latency_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::min-latency\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::min-latency\0".as_ptr() as *const _,
transmute(notify_min_latency_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_min_latency_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -324,7 +317,7 @@ impl AppSrc {
pub fn connect_property_min_percent_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_min_percent_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::min-percent\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::min-percent\0".as_ptr() as *const _,
transmute(notify_min_percent_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_min_percent_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -332,7 +325,7 @@ impl AppSrc {
pub fn connect_property_size_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_size_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::size\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::size\0".as_ptr() as *const _,
transmute(notify_size_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_size_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -340,7 +333,7 @@ impl AppSrc {
pub fn connect_property_stream_type_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_stream_type_notify<F: Fn(&AppSrc) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&AppSrc) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::stream-type\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::stream-type\0".as_ptr() as *const _,
transmute(notify_stream_type_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_stream_type_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -349,6 +342,8 @@ impl AppSrc {
unsafe impl Send for AppSrc {} unsafe impl Send for AppSrc {}
unsafe impl Sync for AppSrc {} unsafe impl Sync for AppSrc {}
pub const NONE_APP_SRC: Option<&AppSrc> = None;
unsafe extern "C" fn enough_data_trampoline(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) { unsafe extern "C" fn enough_data_trampoline(this: *mut ffi::GstAppSrc, f: glib_ffi::gpointer) {
let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&AppSrc) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -3,10 +3,10 @@
// DO NOT EDIT // DO NOT EDIT
mod app_sink; mod app_sink;
pub use self::app_sink::AppSink; pub use self::app_sink::{AppSink, AppSinkClass, NONE_APP_SINK};
mod app_src; mod app_src;
pub use self::app_src::AppSrc; pub use self::app_src::{AppSrc, AppSrcClass, NONE_APP_SRC};
mod enums; mod enums;
pub use self::enums::AppStreamType; pub use self::enums::AppStreamType;

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -3,7 +3,7 @@
// DO NOT EDIT // DO NOT EDIT
mod stream_volume; mod stream_volume;
pub use self::stream_volume::StreamVolume; pub use self::stream_volume::{StreamVolume, NONE_STREAM_VOLUME};
pub use self::stream_volume::StreamVolumeExt; pub use self::stream_volume::StreamVolumeExt;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]

View file

@ -4,7 +4,7 @@
use StreamVolumeFormat; use StreamVolumeFormat;
use ffi; use ffi;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,7 +14,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct StreamVolume(Object<ffi::GstStreamVolume, ffi::GstStreamVolumeInterface>); pub struct StreamVolume(Interface<ffi::GstStreamVolume>);
match fn { match fn {
get_type => || ffi::gst_stream_volume_get_type(), get_type => || ffi::gst_stream_volume_get_type(),
@ -33,6 +33,8 @@ impl StreamVolume {
unsafe impl Send for StreamVolume {} unsafe impl Send for StreamVolume {}
unsafe impl Sync for StreamVolume {} unsafe impl Sync for StreamVolume {}
pub const NONE_STREAM_VOLUME: Option<&StreamVolume> = None;
pub trait StreamVolumeExt: 'static { pub trait StreamVolumeExt: 'static {
fn get_mute(&self) -> bool; fn get_mute(&self) -> bool;
@ -50,32 +52,32 @@ pub trait StreamVolumeExt: 'static {
impl<O: IsA<StreamVolume>> StreamVolumeExt for O { impl<O: IsA<StreamVolume>> StreamVolumeExt for O {
fn get_mute(&self) -> bool { fn get_mute(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_stream_volume_get_mute(self.to_glib_none().0)) from_glib(ffi::gst_stream_volume_get_mute(self.as_ref().to_glib_none().0))
} }
} }
fn get_volume(&self, format: StreamVolumeFormat) -> f64 { fn get_volume(&self, format: StreamVolumeFormat) -> f64 {
unsafe { unsafe {
ffi::gst_stream_volume_get_volume(self.to_glib_none().0, format.to_glib()) ffi::gst_stream_volume_get_volume(self.as_ref().to_glib_none().0, format.to_glib())
} }
} }
fn set_mute(&self, mute: bool) { fn set_mute(&self, mute: bool) {
unsafe { unsafe {
ffi::gst_stream_volume_set_mute(self.to_glib_none().0, mute.to_glib()); ffi::gst_stream_volume_set_mute(self.as_ref().to_glib_none().0, mute.to_glib());
} }
} }
fn set_volume(&self, format: StreamVolumeFormat, val: f64) { fn set_volume(&self, format: StreamVolumeFormat, val: f64) {
unsafe { unsafe {
ffi::gst_stream_volume_set_volume(self.to_glib_none().0, format.to_glib(), val); ffi::gst_stream_volume_set_volume(self.as_ref().to_glib_none().0, format.to_glib(), val);
} }
} }
fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mute_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mute\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _,
transmute(notify_mute_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mute_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -83,7 +85,7 @@ impl<O: IsA<StreamVolume>> StreamVolumeExt for O {
fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_volume_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::volume\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _,
transmute(notify_volume_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_volume_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -92,11 +94,11 @@ impl<O: IsA<StreamVolume>> StreamVolumeExt for O {
unsafe extern "C" fn notify_mute_trampoline<P>(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mute_trampoline<P>(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<StreamVolume> { where P: IsA<StreamVolume> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&StreamVolume::from_glib_borrow(this).downcast_unchecked()) f(&StreamVolume::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_volume_trampoline<P>(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_volume_trampoline<P>(this: *mut ffi::GstStreamVolume, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<StreamVolume> { where P: IsA<StreamVolume> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&StreamVolume::from_glib_borrow(this).downcast_unchecked()) f(&StreamVolume::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -10,7 +10,7 @@ use gst;
use std::mem; use std::mem;
glib_wrapper! { glib_wrapper! {
pub struct Adapter(Object<ffi::GstAdapter, ffi::GstAdapterClass>); pub struct Adapter(Object<ffi::GstAdapter, ffi::GstAdapterClass, AdapterClass>);
match fn { match fn {
get_type => || ffi::gst_adapter_get_type(), get_type => || ffi::gst_adapter_get_type(),
@ -197,3 +197,5 @@ unsafe impl glib::SendUnique for Adapter {
self.ref_count() == 1 self.ref_count() == 1
} }
} }
pub const NONE_ADAPTER: Option<&Adapter> = None;

View file

@ -2,11 +2,10 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use AggregatorClass;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,15 +13,11 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass, AggregatorClass>): [ pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass, AggregatorClass>) @extends gst::Element, gst::Object;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_aggregator_get_type(), get_type => || ffi::gst_aggregator_get_type(),
@ -32,6 +27,8 @@ glib_wrapper! {
unsafe impl Send for Aggregator {} unsafe impl Send for Aggregator {}
unsafe impl Sync for Aggregator {} unsafe impl Sync for Aggregator {}
pub const NONE_AGGREGATOR: Option<&Aggregator> = None;
pub trait AggregatorExt: 'static { pub trait AggregatorExt: 'static {
//#[cfg(any(feature = "v1_14", feature = "dox"))] //#[cfg(any(feature = "v1_14", feature = "dox"))]
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
@ -67,28 +64,28 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_buffer_pool(&self) -> Option<gst::BufferPool> { fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_aggregator_get_buffer_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_aggregator_get_buffer_pool(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_latency(&self) -> gst::ClockTime { fn get_latency(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_get_latency(self.to_glib_none().0)) from_glib(ffi::gst_aggregator_get_latency(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_aggregator_set_latency(self.to_glib_none().0, min_latency.to_glib(), max_latency.to_glib()); ffi::gst_aggregator_set_latency(self.as_ref().to_glib_none().0, min_latency.to_glib(), max_latency.to_glib());
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn set_src_caps(&self, caps: &gst::Caps) { fn set_src_caps(&self, caps: &gst::Caps) {
unsafe { unsafe {
ffi::gst_aggregator_set_src_caps(self.to_glib_none().0, caps.to_glib_none().0); ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
} }
} }
@ -110,7 +107,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _,
transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -118,7 +115,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::start-time\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::start-time\0".as_ptr() as *const _,
transmute(notify_start_time_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_start_time_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -128,11 +125,11 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Aggregator> { where P: IsA<Aggregator> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&Aggregator::from_glib_borrow(this).downcast_unchecked()) f(&Aggregator::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_start_time_trampoline<P>(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_start_time_trampoline<P>(this: *mut ffi::GstAggregator, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Aggregator> { where P: IsA<Aggregator> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&Aggregator::from_glib_borrow(this).downcast_unchecked()) f(&Aggregator::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -2,18 +2,13 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use AggregatorPadClass;
use ffi; use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass, AggregatorPadClass>): [ pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass, AggregatorPadClass>) @extends gst::Pad, gst::Object;
gst::Pad => gst_ffi::GstPad,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_aggregator_pad_get_type(), get_type => || ffi::gst_aggregator_pad_get_type(),
@ -23,6 +18,8 @@ glib_wrapper! {
unsafe impl Send for AggregatorPad {} unsafe impl Send for AggregatorPad {}
unsafe impl Sync for AggregatorPad {} unsafe impl Sync for AggregatorPad {}
pub const NONE_AGGREGATOR_PAD: Option<&AggregatorPad> = None;
pub trait AggregatorPadExt: 'static { pub trait AggregatorPadExt: 'static {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn drop_buffer(&self) -> bool; fn drop_buffer(&self) -> bool;
@ -44,35 +41,35 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn drop_buffer(&self) -> bool { fn drop_buffer(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_pad_drop_buffer(self.to_glib_none().0)) from_glib(ffi::gst_aggregator_pad_drop_buffer(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14_1", feature = "dox"))] #[cfg(any(feature = "v1_14_1", feature = "dox"))]
fn has_buffer(&self) -> bool { fn has_buffer(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_pad_has_buffer(self.to_glib_none().0)) from_glib(ffi::gst_aggregator_pad_has_buffer(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn is_eos(&self) -> bool { fn is_eos(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_aggregator_pad_is_eos(self.to_glib_none().0)) from_glib(ffi::gst_aggregator_pad_is_eos(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn peek_buffer(&self) -> Option<gst::Buffer> { fn peek_buffer(&self) -> Option<gst::Buffer> {
unsafe { unsafe {
from_glib_full(ffi::gst_aggregator_pad_peek_buffer(self.to_glib_none().0)) from_glib_full(ffi::gst_aggregator_pad_peek_buffer(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn pop_buffer(&self) -> Option<gst::Buffer> { fn pop_buffer(&self) -> Option<gst::Buffer> {
unsafe { unsafe {
from_glib_full(ffi::gst_aggregator_pad_pop_buffer(self.to_glib_none().0)) from_glib_full(ffi::gst_aggregator_pad_pop_buffer(self.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -2,11 +2,10 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use BaseSinkClass;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,16 +13,12 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem; use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct BaseSink(Object<ffi::GstBaseSink, ffi::GstBaseSinkClass, BaseSinkClass>): [ pub struct BaseSink(Object<ffi::GstBaseSink, ffi::GstBaseSinkClass, BaseSinkClass>) @extends gst::Element, gst::Object;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_base_sink_get_type(), get_type => || ffi::gst_base_sink_get_type(),
@ -33,6 +28,8 @@ glib_wrapper! {
unsafe impl Send for BaseSink {} unsafe impl Send for BaseSink {}
unsafe impl Sync for BaseSink {} unsafe impl Sync for BaseSink {}
pub const NONE_BASE_SINK: Option<&BaseSink> = None;
pub trait BaseSinkExt: 'static { pub trait BaseSinkExt: 'static {
//fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> gst::FlowReturn; //fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> gst::FlowReturn;
@ -132,80 +129,80 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn get_blocksize(&self) -> u32 { fn get_blocksize(&self) -> u32 {
unsafe { unsafe {
ffi::gst_base_sink_get_blocksize(self.to_glib_none().0) ffi::gst_base_sink_get_blocksize(self.as_ref().to_glib_none().0)
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn get_drop_out_of_segment(&self) -> bool { fn get_drop_out_of_segment(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_get_drop_out_of_segment(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_get_drop_out_of_segment(self.as_ref().to_glib_none().0))
} }
} }
fn get_last_sample(&self) -> Option<gst::Sample> { fn get_last_sample(&self) -> Option<gst::Sample> {
unsafe { unsafe {
from_glib_full(ffi::gst_base_sink_get_last_sample(self.to_glib_none().0)) from_glib_full(ffi::gst_base_sink_get_last_sample(self.as_ref().to_glib_none().0))
} }
} }
fn get_latency(&self) -> gst::ClockTime { fn get_latency(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_get_latency(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_get_latency(self.as_ref().to_glib_none().0))
} }
} }
fn get_max_bitrate(&self) -> u64 { fn get_max_bitrate(&self) -> u64 {
unsafe { unsafe {
ffi::gst_base_sink_get_max_bitrate(self.to_glib_none().0) ffi::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0)
} }
} }
fn get_max_lateness(&self) -> i64 { fn get_max_lateness(&self) -> i64 {
unsafe { unsafe {
ffi::gst_base_sink_get_max_lateness(self.to_glib_none().0) ffi::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0)
} }
} }
fn get_render_delay(&self) -> gst::ClockTime { fn get_render_delay(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_get_render_delay(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_get_render_delay(self.as_ref().to_glib_none().0))
} }
} }
fn get_sync(&self) -> bool { fn get_sync(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_get_sync(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_get_sync(self.as_ref().to_glib_none().0))
} }
} }
fn get_throttle_time(&self) -> u64 { fn get_throttle_time(&self) -> u64 {
unsafe { unsafe {
ffi::gst_base_sink_get_throttle_time(self.to_glib_none().0) ffi::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0)
} }
} }
fn get_ts_offset(&self) -> gst::ClockTimeDiff { fn get_ts_offset(&self) -> gst::ClockTimeDiff {
unsafe { unsafe {
ffi::gst_base_sink_get_ts_offset(self.to_glib_none().0) ffi::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0)
} }
} }
fn is_async_enabled(&self) -> bool { fn is_async_enabled(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_is_async_enabled(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_is_async_enabled(self.as_ref().to_glib_none().0))
} }
} }
fn is_last_sample_enabled(&self) -> bool { fn is_last_sample_enabled(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_is_last_sample_enabled(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_is_last_sample_enabled(self.as_ref().to_glib_none().0))
} }
} }
fn is_qos_enabled(&self) -> bool { fn is_qos_enabled(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_sink_is_qos_enabled(self.to_glib_none().0)) from_glib(ffi::gst_base_sink_is_qos_enabled(self.as_ref().to_glib_none().0))
} }
} }
@ -215,82 +212,82 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
let mut upstream_live = mem::uninitialized(); let mut upstream_live = mem::uninitialized();
let mut min_latency = mem::uninitialized(); let mut min_latency = mem::uninitialized();
let mut max_latency = mem::uninitialized(); let mut max_latency = mem::uninitialized();
let ret = from_glib(ffi::gst_base_sink_query_latency(self.to_glib_none().0, &mut live, &mut upstream_live, &mut min_latency, &mut max_latency)); let ret = from_glib(ffi::gst_base_sink_query_latency(self.as_ref().to_glib_none().0, &mut live, &mut upstream_live, &mut min_latency, &mut max_latency));
if ret { Some((from_glib(live), from_glib(upstream_live), from_glib(min_latency), from_glib(max_latency))) } else { None } if ret { Some((from_glib(live), from_glib(upstream_live), from_glib(min_latency), from_glib(max_latency))) } else { None }
} }
} }
fn set_async_enabled(&self, enabled: bool) { fn set_async_enabled(&self, enabled: bool) {
unsafe { unsafe {
ffi::gst_base_sink_set_async_enabled(self.to_glib_none().0, enabled.to_glib()); ffi::gst_base_sink_set_async_enabled(self.as_ref().to_glib_none().0, enabled.to_glib());
} }
} }
fn set_blocksize(&self, blocksize: u32) { fn set_blocksize(&self, blocksize: u32) {
unsafe { unsafe {
ffi::gst_base_sink_set_blocksize(self.to_glib_none().0, blocksize); ffi::gst_base_sink_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) { fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) {
unsafe { unsafe {
ffi::gst_base_sink_set_drop_out_of_segment(self.to_glib_none().0, drop_out_of_segment.to_glib()); ffi::gst_base_sink_set_drop_out_of_segment(self.as_ref().to_glib_none().0, drop_out_of_segment.to_glib());
} }
} }
fn set_last_sample_enabled(&self, enabled: bool) { fn set_last_sample_enabled(&self, enabled: bool) {
unsafe { unsafe {
ffi::gst_base_sink_set_last_sample_enabled(self.to_glib_none().0, enabled.to_glib()); ffi::gst_base_sink_set_last_sample_enabled(self.as_ref().to_glib_none().0, enabled.to_glib());
} }
} }
fn set_max_bitrate(&self, max_bitrate: u64) { fn set_max_bitrate(&self, max_bitrate: u64) {
unsafe { unsafe {
ffi::gst_base_sink_set_max_bitrate(self.to_glib_none().0, max_bitrate); ffi::gst_base_sink_set_max_bitrate(self.as_ref().to_glib_none().0, max_bitrate);
} }
} }
fn set_max_lateness(&self, max_lateness: i64) { fn set_max_lateness(&self, max_lateness: i64) {
unsafe { unsafe {
ffi::gst_base_sink_set_max_lateness(self.to_glib_none().0, max_lateness); ffi::gst_base_sink_set_max_lateness(self.as_ref().to_glib_none().0, max_lateness);
} }
} }
fn set_qos_enabled(&self, enabled: bool) { fn set_qos_enabled(&self, enabled: bool) {
unsafe { unsafe {
ffi::gst_base_sink_set_qos_enabled(self.to_glib_none().0, enabled.to_glib()); ffi::gst_base_sink_set_qos_enabled(self.as_ref().to_glib_none().0, enabled.to_glib());
} }
} }
fn set_render_delay(&self, delay: gst::ClockTime) { fn set_render_delay(&self, delay: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_base_sink_set_render_delay(self.to_glib_none().0, delay.to_glib()); ffi::gst_base_sink_set_render_delay(self.as_ref().to_glib_none().0, delay.to_glib());
} }
} }
fn set_sync(&self, sync: bool) { fn set_sync(&self, sync: bool) {
unsafe { unsafe {
ffi::gst_base_sink_set_sync(self.to_glib_none().0, sync.to_glib()); ffi::gst_base_sink_set_sync(self.as_ref().to_glib_none().0, sync.to_glib());
} }
} }
fn set_throttle_time(&self, throttle: u64) { fn set_throttle_time(&self, throttle: u64) {
unsafe { unsafe {
ffi::gst_base_sink_set_throttle_time(self.to_glib_none().0, throttle); ffi::gst_base_sink_set_throttle_time(self.as_ref().to_glib_none().0, throttle);
} }
} }
fn set_ts_offset(&self, offset: gst::ClockTimeDiff) { fn set_ts_offset(&self, offset: gst::ClockTimeDiff) {
unsafe { unsafe {
ffi::gst_base_sink_set_ts_offset(self.to_glib_none().0, offset); ffi::gst_base_sink_set_ts_offset(self.as_ref().to_glib_none().0, offset);
} }
} }
fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff) { fn wait_clock(&self, time: gst::ClockTime) -> (gst::ClockReturn, gst::ClockTimeDiff) {
unsafe { unsafe {
let mut jitter = mem::uninitialized(); let mut jitter = mem::uninitialized();
let ret = from_glib(ffi::gst_base_sink_wait_clock(self.to_glib_none().0, time.to_glib(), &mut jitter)); let ret = from_glib(ffi::gst_base_sink_wait_clock(self.as_ref().to_glib_none().0, time.to_glib(), &mut jitter));
(ret, jitter) (ret, jitter)
} }
} }
@ -340,7 +337,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_async_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_async_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::async\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::async\0".as_ptr() as *const _,
transmute(notify_async_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_async_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -348,7 +345,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::blocksize\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _,
transmute(notify_blocksize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_blocksize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -356,7 +353,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_enable_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_enable_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::enable-last-sample\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::enable-last-sample\0".as_ptr() as *const _,
transmute(notify_enable_last_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_enable_last_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -364,7 +361,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::last-sample\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::last-sample\0".as_ptr() as *const _,
transmute(notify_last_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_last_sample_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -372,7 +369,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_max_bitrate_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_max_bitrate_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _,
transmute(notify_max_bitrate_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_bitrate_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -380,7 +377,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_max_lateness_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_max_lateness_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-lateness\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-lateness\0".as_ptr() as *const _,
transmute(notify_max_lateness_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_lateness_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -388,7 +385,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::qos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _,
transmute(notify_qos_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_qos_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -396,7 +393,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_render_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_render_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::render-delay\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::render-delay\0".as_ptr() as *const _,
transmute(notify_render_delay_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_render_delay_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -404,7 +401,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_sync_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_sync_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::sync\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::sync\0".as_ptr() as *const _,
transmute(notify_sync_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_sync_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -412,7 +409,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_throttle_time_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_throttle_time_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::throttle-time\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::throttle-time\0".as_ptr() as *const _,
transmute(notify_throttle_time_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_throttle_time_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -420,7 +417,7 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
fn connect_property_ts_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_ts_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::ts-offset\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::ts-offset\0".as_ptr() as *const _,
transmute(notify_ts_offset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_ts_offset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -429,65 +426,65 @@ impl<O: IsA<BaseSink>> BaseSinkExt for O {
unsafe extern "C" fn notify_async_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_async_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_blocksize_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_blocksize_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_enable_last_sample_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_enable_last_sample_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_last_sample_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_last_sample_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_max_bitrate_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_max_bitrate_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_max_lateness_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_max_lateness_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_qos_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_qos_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_render_delay_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_render_delay_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_sync_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_sync_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_throttle_time_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_throttle_time_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_ts_offset_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_ts_offset_trampoline<P>(this: *mut ffi::GstBaseSink, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSink> { where P: IsA<BaseSink> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSink::from_glib_borrow(this).downcast_unchecked()) f(&BaseSink::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -2,11 +2,10 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use BaseSrcClass;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,16 +13,12 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem; use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct BaseSrc(Object<ffi::GstBaseSrc, ffi::GstBaseSrcClass, BaseSrcClass>): [ pub struct BaseSrc(Object<ffi::GstBaseSrc, ffi::GstBaseSrcClass, BaseSrcClass>) @extends gst::Element, gst::Object;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_base_src_get_type(), get_type => || ffi::gst_base_src_get_type(),
@ -33,6 +28,8 @@ glib_wrapper! {
unsafe impl Send for BaseSrc {} unsafe impl Send for BaseSrc {}
unsafe impl Sync for BaseSrc {} unsafe impl Sync for BaseSrc {}
pub const NONE_BASE_SRC: Option<&BaseSrc> = None;
pub trait BaseSrcExt: 'static { pub trait BaseSrcExt: 'static {
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
@ -90,37 +87,37 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
fn get_blocksize(&self) -> u32 { fn get_blocksize(&self) -> u32 {
unsafe { unsafe {
ffi::gst_base_src_get_blocksize(self.to_glib_none().0) ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0)
} }
} }
fn get_buffer_pool(&self) -> Option<gst::BufferPool> { fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_base_src_get_buffer_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_base_src_get_buffer_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_do_timestamp(&self) -> bool { fn get_do_timestamp(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_src_get_do_timestamp(self.to_glib_none().0)) from_glib(ffi::gst_base_src_get_do_timestamp(self.as_ref().to_glib_none().0))
} }
} }
fn is_async(&self) -> bool { fn is_async(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_src_is_async(self.to_glib_none().0)) from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0))
} }
} }
fn is_live(&self) -> bool { fn is_live(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_src_is_live(self.to_glib_none().0)) from_glib(ffi::gst_base_src_is_live(self.as_ref().to_glib_none().0))
} }
} }
fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool { fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_src_new_seamless_segment(self.to_glib_none().0, start, stop, time)) from_glib(ffi::gst_base_src_new_seamless_segment(self.as_ref().to_glib_none().0, start, stop, time))
} }
} }
@ -129,56 +126,56 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
let mut live = mem::uninitialized(); let mut live = mem::uninitialized();
let mut min_latency = mem::uninitialized(); let mut min_latency = mem::uninitialized();
let mut max_latency = mem::uninitialized(); let mut max_latency = mem::uninitialized();
let ret = from_glib(ffi::gst_base_src_query_latency(self.to_glib_none().0, &mut live, &mut min_latency, &mut max_latency)); let ret = from_glib(ffi::gst_base_src_query_latency(self.as_ref().to_glib_none().0, &mut live, &mut min_latency, &mut max_latency));
if ret { Some((from_glib(live), from_glib(min_latency), from_glib(max_latency))) } else { None } if ret { Some((from_glib(live), from_glib(min_latency), from_glib(max_latency))) } else { None }
} }
} }
fn set_async(&self, async: bool) { fn set_async(&self, async: bool) {
unsafe { unsafe {
ffi::gst_base_src_set_async(self.to_glib_none().0, async.to_glib()); ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async.to_glib());
} }
} }
fn set_automatic_eos(&self, automatic_eos: bool) { fn set_automatic_eos(&self, automatic_eos: bool) {
unsafe { unsafe {
ffi::gst_base_src_set_automatic_eos(self.to_glib_none().0, automatic_eos.to_glib()); ffi::gst_base_src_set_automatic_eos(self.as_ref().to_glib_none().0, automatic_eos.to_glib());
} }
} }
fn set_blocksize(&self, blocksize: u32) { fn set_blocksize(&self, blocksize: u32) {
unsafe { unsafe {
ffi::gst_base_src_set_blocksize(self.to_glib_none().0, blocksize); ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
} }
} }
fn set_caps(&self, caps: &gst::Caps) -> bool { fn set_caps(&self, caps: &gst::Caps) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_src_set_caps(self.to_glib_none().0, caps.to_glib_none().0)) from_glib(ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0))
} }
} }
fn set_do_timestamp(&self, timestamp: bool) { fn set_do_timestamp(&self, timestamp: bool) {
unsafe { unsafe {
ffi::gst_base_src_set_do_timestamp(self.to_glib_none().0, timestamp.to_glib()); ffi::gst_base_src_set_do_timestamp(self.as_ref().to_glib_none().0, timestamp.to_glib());
} }
} }
fn set_dynamic_size(&self, dynamic: bool) { fn set_dynamic_size(&self, dynamic: bool) {
unsafe { unsafe {
ffi::gst_base_src_set_dynamic_size(self.to_glib_none().0, dynamic.to_glib()); ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.to_glib());
} }
} }
fn set_format(&self, format: gst::Format) { fn set_format(&self, format: gst::Format) {
unsafe { unsafe {
ffi::gst_base_src_set_format(self.to_glib_none().0, format.to_glib()); ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.to_glib());
} }
} }
fn set_live(&self, live: bool) { fn set_live(&self, live: bool) {
unsafe { unsafe {
ffi::gst_base_src_set_live(self.to_glib_none().0, live.to_glib()); ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.to_glib());
} }
} }
@ -213,7 +210,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::blocksize\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _,
transmute(notify_blocksize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_blocksize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -221,7 +218,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
fn connect_property_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _,
transmute(notify_do_timestamp_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_do_timestamp_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -229,7 +226,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
fn connect_property_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::num-buffers\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::num-buffers\0".as_ptr() as *const _,
transmute(notify_num_buffers_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_num_buffers_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -237,7 +234,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
fn connect_property_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::typefind\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::typefind\0".as_ptr() as *const _,
transmute(notify_typefind_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_typefind_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -246,23 +243,23 @@ impl<O: IsA<BaseSrc>> BaseSrcExt for O {
unsafe extern "C" fn notify_blocksize_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_blocksize_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> { where P: IsA<BaseSrc> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_do_timestamp_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_do_timestamp_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> { where P: IsA<BaseSrc> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_num_buffers_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_num_buffers_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> { where P: IsA<BaseSrc> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_typefind_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_typefind_trampoline<P>(this: *mut ffi::GstBaseSrc, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseSrc> { where P: IsA<BaseSrc> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseSrc::from_glib_borrow(this).downcast_unchecked()) f(&BaseSrc::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -2,11 +2,10 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use BaseTransformClass;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,15 +13,11 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct BaseTransform(Object<ffi::GstBaseTransform, ffi::GstBaseTransformClass, BaseTransformClass>): [ pub struct BaseTransform(Object<ffi::GstBaseTransform, ffi::GstBaseTransformClass, BaseTransformClass>) @extends gst::Element, gst::Object;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_base_transform_get_type(), get_type => || ffi::gst_base_transform_get_type(),
@ -32,6 +27,8 @@ glib_wrapper! {
unsafe impl Send for BaseTransform {} unsafe impl Send for BaseTransform {}
unsafe impl Sync for BaseTransform {} unsafe impl Sync for BaseTransform {}
pub const NONE_BASE_TRANSFORM: Option<&BaseTransform> = None;
pub trait BaseTransformExt: 'static { pub trait BaseTransformExt: 'static {
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams); //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);
@ -75,79 +72,79 @@ impl<O: IsA<BaseTransform>> BaseTransformExt for O {
fn get_buffer_pool(&self) -> Option<gst::BufferPool> { fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_base_transform_get_buffer_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_base_transform_get_buffer_pool(self.as_ref().to_glib_none().0))
} }
} }
fn is_in_place(&self) -> bool { fn is_in_place(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_transform_is_in_place(self.to_glib_none().0)) from_glib(ffi::gst_base_transform_is_in_place(self.as_ref().to_glib_none().0))
} }
} }
fn is_passthrough(&self) -> bool { fn is_passthrough(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_transform_is_passthrough(self.to_glib_none().0)) from_glib(ffi::gst_base_transform_is_passthrough(self.as_ref().to_glib_none().0))
} }
} }
fn is_qos_enabled(&self) -> bool { fn is_qos_enabled(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_transform_is_qos_enabled(self.to_glib_none().0)) from_glib(ffi::gst_base_transform_is_qos_enabled(self.as_ref().to_glib_none().0))
} }
} }
fn reconfigure_sink(&self) { fn reconfigure_sink(&self) {
unsafe { unsafe {
ffi::gst_base_transform_reconfigure_sink(self.to_glib_none().0); ffi::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0);
} }
} }
fn reconfigure_src(&self) { fn reconfigure_src(&self) {
unsafe { unsafe {
ffi::gst_base_transform_reconfigure_src(self.to_glib_none().0); ffi::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0);
} }
} }
fn set_gap_aware(&self, gap_aware: bool) { fn set_gap_aware(&self, gap_aware: bool) {
unsafe { unsafe {
ffi::gst_base_transform_set_gap_aware(self.to_glib_none().0, gap_aware.to_glib()); ffi::gst_base_transform_set_gap_aware(self.as_ref().to_glib_none().0, gap_aware.to_glib());
} }
} }
fn set_in_place(&self, in_place: bool) { fn set_in_place(&self, in_place: bool) {
unsafe { unsafe {
ffi::gst_base_transform_set_in_place(self.to_glib_none().0, in_place.to_glib()); ffi::gst_base_transform_set_in_place(self.as_ref().to_glib_none().0, in_place.to_glib());
} }
} }
fn set_passthrough(&self, passthrough: bool) { fn set_passthrough(&self, passthrough: bool) {
unsafe { unsafe {
ffi::gst_base_transform_set_passthrough(self.to_glib_none().0, passthrough.to_glib()); ffi::gst_base_transform_set_passthrough(self.as_ref().to_glib_none().0, passthrough.to_glib());
} }
} }
fn set_prefer_passthrough(&self, prefer_passthrough: bool) { fn set_prefer_passthrough(&self, prefer_passthrough: bool) {
unsafe { unsafe {
ffi::gst_base_transform_set_prefer_passthrough(self.to_glib_none().0, prefer_passthrough.to_glib()); ffi::gst_base_transform_set_prefer_passthrough(self.as_ref().to_glib_none().0, prefer_passthrough.to_glib());
} }
} }
fn set_qos_enabled(&self, enabled: bool) { fn set_qos_enabled(&self, enabled: bool) {
unsafe { unsafe {
ffi::gst_base_transform_set_qos_enabled(self.to_glib_none().0, enabled.to_glib()); ffi::gst_base_transform_set_qos_enabled(self.as_ref().to_glib_none().0, enabled.to_glib());
} }
} }
fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) { fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_base_transform_update_qos(self.to_glib_none().0, proportion, diff, timestamp.to_glib()); ffi::gst_base_transform_update_qos(self.as_ref().to_glib_none().0, proportion, diff, timestamp.to_glib());
} }
} }
fn update_src_caps(&self, updated_caps: &gst::Caps) -> bool { fn update_src_caps(&self, updated_caps: &gst::Caps) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_base_transform_update_src_caps(self.to_glib_none().0, updated_caps.to_glib_none().0)) from_glib(ffi::gst_base_transform_update_src_caps(self.as_ref().to_glib_none().0, updated_caps.to_glib_none().0))
} }
} }
@ -168,7 +165,7 @@ impl<O: IsA<BaseTransform>> BaseTransformExt for O {
fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::qos\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::qos\0".as_ptr() as *const _,
transmute(notify_qos_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_qos_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -177,5 +174,5 @@ impl<O: IsA<BaseTransform>> BaseTransformExt for O {
unsafe extern "C" fn notify_qos_trampoline<P>(this: *mut ffi::GstBaseTransform, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_qos_trampoline<P>(this: *mut ffi::GstBaseTransform, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<BaseTransform> { where P: IsA<BaseTransform> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&BaseTransform::from_glib_borrow(this).downcast_unchecked()) f(&BaseTransform::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -12,17 +12,16 @@ use std::mem;
pub fn type_find_helper<P: IsA<gst::Pad>>(src: &P, size: u64) -> Option<gst::Caps> { pub fn type_find_helper<P: IsA<gst::Pad>>(src: &P, size: u64) -> Option<gst::Caps> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_type_find_helper(src.to_glib_none().0, size)) from_glib_full(ffi::gst_type_find_helper(src.as_ref().to_glib_none().0, size))
} }
} }
pub fn type_find_helper_for_buffer<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, buf: &gst::Buffer) -> (Option<gst::Caps>, gst::TypeFindProbability) { pub fn type_find_helper_for_buffer<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, buf: &gst::Buffer) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let obj = obj.into(); let obj = obj.into();
let obj = obj.to_glib_none();
unsafe { unsafe {
let mut prob = mem::uninitialized(); let mut prob = mem::uninitialized();
let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer(obj.0, buf.to_glib_none().0, &mut prob)); let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer(obj.map(|p| p.as_ref()).to_glib_none().0, buf.to_glib_none().0, &mut prob));
(ret, from_glib(prob)) (ret, from_glib(prob))
} }
} }
@ -30,9 +29,8 @@ pub fn type_find_helper_for_buffer<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<
pub fn type_find_helper_for_extension<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, extension: &str) -> Option<gst::Caps> { pub fn type_find_helper_for_extension<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, extension: &str) -> Option<gst::Caps> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let obj = obj.into(); let obj = obj.into();
let obj = obj.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_type_find_helper_for_extension(obj.0, extension.to_glib_none().0)) from_glib_full(ffi::gst_type_find_helper_for_extension(obj.map(|p| p.as_ref()).to_glib_none().0, extension.to_glib_none().0))
} }
} }

View file

@ -3,36 +3,36 @@
// DO NOT EDIT // DO NOT EDIT
mod adapter; mod adapter;
pub use self::adapter::Adapter; pub use self::adapter::{Adapter, AdapterClass, NONE_ADAPTER};
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
mod aggregator; mod aggregator;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator::Aggregator; pub use self::aggregator::{Aggregator, AggregatorClass, NONE_AGGREGATOR};
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator::AggregatorExt; pub use self::aggregator::AggregatorExt;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
mod aggregator_pad; mod aggregator_pad;
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator_pad::AggregatorPad; pub use self::aggregator_pad::{AggregatorPad, AggregatorPadClass, NONE_AGGREGATOR_PAD};
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
pub use self::aggregator_pad::AggregatorPadExt; pub use self::aggregator_pad::AggregatorPadExt;
mod base_sink; mod base_sink;
pub use self::base_sink::BaseSink; pub use self::base_sink::{BaseSink, BaseSinkClass, NONE_BASE_SINK};
pub use self::base_sink::BaseSinkExt; pub use self::base_sink::BaseSinkExt;
mod base_src; mod base_src;
pub use self::base_src::BaseSrc; pub use self::base_src::{BaseSrc, BaseSrcClass, NONE_BASE_SRC};
pub use self::base_src::BaseSrcExt; pub use self::base_src::BaseSrcExt;
mod base_transform; mod base_transform;
pub use self::base_transform::BaseTransform; pub use self::base_transform::{BaseTransform, BaseTransformClass, NONE_BASE_TRANSFORM};
pub use self::base_transform::BaseTransformExt; pub use self::base_transform::BaseTransformExt;
mod push_src; mod push_src;
pub use self::push_src::PushSrc; pub use self::push_src::{PushSrc, PushSrcClass, NONE_PUSH_SRC};
pub mod functions; pub mod functions;

View file

@ -6,14 +6,9 @@ use BaseSrc;
use ffi; use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct PushSrc(Object<ffi::GstPushSrc, ffi::GstPushSrcClass>): [ pub struct PushSrc(Object<ffi::GstPushSrc, ffi::GstPushSrcClass, PushSrcClass>) @extends BaseSrc, gst::Element, gst::Object;
BaseSrc,
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_push_src_get_type(), get_type => || ffi::gst_push_src_get_type(),
@ -24,3 +19,5 @@ impl PushSrc {}
unsafe impl Send for PushSrc {} unsafe impl Send for PushSrc {}
unsafe impl Sync for PushSrc {} unsafe impl Sync for PushSrc {}
pub const NONE_PUSH_SRC: Option<&PushSrc> = None;

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -3,7 +3,7 @@
// DO NOT EDIT // DO NOT EDIT
mod test_clock; mod test_clock;
pub use self::test_clock::TestClock; pub use self::test_clock::{TestClock, TestClockClass, NONE_TEST_CLOCK};
#[doc(hidden)] #[doc(hidden)]
pub mod traits { pub mod traits {

View file

@ -5,22 +5,19 @@
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct TestClock(Object<ffi::GstTestClock, ffi::GstTestClockClass>): [ pub struct TestClock(Object<ffi::GstTestClock, ffi::GstTestClockClass, TestClockClass>) @extends gst::Clock, gst::Object;
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_test_clock_get_type(), get_type => || ffi::gst_test_clock_get_type(),
@ -31,14 +28,14 @@ impl TestClock {
pub fn new() -> TestClock { pub fn new() -> TestClock {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
gst::Clock::from_glib_full(ffi::gst_test_clock_new()).downcast_unchecked() gst::Clock::from_glib_full(ffi::gst_test_clock_new()).unsafe_cast()
} }
} }
pub fn new_with_start_time(start_time: gst::ClockTime) -> TestClock { pub fn new_with_start_time(start_time: gst::ClockTime) -> TestClock {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
gst::Clock::from_glib_full(ffi::gst_test_clock_new_with_start_time(start_time.to_glib())).downcast_unchecked() gst::Clock::from_glib_full(ffi::gst_test_clock_new_with_start_time(start_time.to_glib())).unsafe_cast()
} }
} }
@ -105,21 +102,21 @@ impl TestClock {
pub fn get_property_clock_type(&self) -> gst::ClockType { pub fn get_property_clock_type(&self) -> gst::ClockType {
unsafe { unsafe {
let mut value = Value::from_type(<gst::ClockType as StaticType>::static_type()); let mut value = Value::from_type(<gst::ClockType as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"clock-type\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"clock-type\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_clock_type(&self, clock_type: gst::ClockType) { pub fn set_property_clock_type(&self, clock_type: gst::ClockType) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"clock-type\0".as_ptr() as *const _, Value::from(&clock_type).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"clock-type\0".as_ptr() as *const _, Value::from(&clock_type).to_glib_none().0);
} }
} }
pub fn get_property_start_time(&self) -> u64 { pub fn get_property_start_time(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"start-time\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -131,7 +128,7 @@ impl TestClock {
pub fn connect_property_clock_type_notify<F: Fn(&TestClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_clock_type_notify<F: Fn(&TestClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&TestClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&TestClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::clock-type\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::clock-type\0".as_ptr() as *const _,
transmute(notify_clock_type_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_clock_type_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -146,6 +143,8 @@ impl Default for TestClock {
unsafe impl Send for TestClock {} unsafe impl Send for TestClock {}
unsafe impl Sync for TestClock {} unsafe impl Sync for TestClock {}
pub const NONE_TEST_CLOCK: Option<&TestClock> = None;
unsafe extern "C" fn notify_clock_type_trampoline(this: *mut ffi::GstTestClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_clock_type_trampoline(this: *mut ffi::GstTestClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&TestClock) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&TestClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -12,7 +12,7 @@ use gio_ffi;
use glib; use glib;
use glib::GString; use glib::GString;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -24,7 +24,7 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct Asset(Object<ffi::GESAsset, ffi::GESAssetClass>); pub struct Asset(Object<ffi::GESAsset, ffi::GESAssetClass, AssetClass>);
match fn { match fn {
get_type => || ffi::ges_asset_get_type(), get_type => || ffi::ges_asset_get_type(),
@ -42,30 +42,28 @@ impl Asset {
pub fn request<'a, P: Into<Option<&'a str>>>(extractable_type: glib::types::Type, id: P) -> Result<Option<Asset>, Error> { pub fn request<'a, P: Into<Option<&'a str>>>(extractable_type: glib::types::Type, id: P) -> Result<Option<Asset>, Error> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let id = id.into(); let id = id.into();
let id = id.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_asset_request(extractable_type.to_glib(), id.0, &mut error); let ret = ffi::ges_asset_request(extractable_type.to_glib(), id.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
pub fn request_async<'a, P: Into<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<Asset, Error>) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: P, callback: Q) { pub fn request_async<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: FnOnce(Result<Asset, Error>) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: Q, callback: R) {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let cancellable = cancellable.into(); let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none(); let user_data: Box<Box<R>> = Box::new(Box::new(callback));
let user_data: Box<Box<Q>> = Box::new(Box::new(callback)); unsafe extern "C" fn request_async_trampoline<R: FnOnce(Result<Asset, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
unsafe extern "C" fn request_async_trampoline<Q: FnOnce(Result<Asset, Error>) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer)
{ {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_asset_request_finish(res, &mut error); let ret = ffi::ges_asset_request_finish(res, &mut error);
let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) };
let callback: Box<Box<Q>> = Box::from_raw(user_data as *mut _); let callback: Box<Box<R>> = Box::from_raw(user_data as *mut _);
callback(result); callback(result);
} }
let callback = request_async_trampoline::<Q>; let callback = request_async_trampoline::<R>;
unsafe { unsafe {
ffi::ges_asset_request_async(extractable_type.to_glib(), id.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); ffi::ges_asset_request_async(extractable_type.to_glib(), id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box::into_raw(user_data) as *mut _);
} }
} }
@ -92,6 +90,8 @@ impl Asset {
} }
} }
pub const NONE_ASSET: Option<&Asset> = None;
pub trait AssetExt: 'static { pub trait AssetExt: 'static {
fn extract(&self) -> Result<Option<Extractable>, Error>; fn extract(&self) -> Result<Option<Extractable>, Error>;
@ -122,58 +122,57 @@ impl<O: IsA<Asset>> AssetExt for O {
fn extract(&self) -> Result<Option<Extractable>, Error> { fn extract(&self) -> Result<Option<Extractable>, Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_asset_extract(self.to_glib_none().0, &mut error); let ret = ffi::ges_asset_extract(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
} }
} }
fn get_error(&self) -> Option<Error> { fn get_error(&self) -> Option<Error> {
unsafe { unsafe {
from_glib_none(ffi::ges_asset_get_error(self.to_glib_none().0)) from_glib_none(ffi::ges_asset_get_error(self.as_ref().to_glib_none().0))
} }
} }
fn get_extractable_type(&self) -> glib::types::Type { fn get_extractable_type(&self) -> glib::types::Type {
unsafe { unsafe {
from_glib(ffi::ges_asset_get_extractable_type(self.to_glib_none().0)) from_glib(ffi::ges_asset_get_extractable_type(self.as_ref().to_glib_none().0))
} }
} }
fn get_id(&self) -> Option<GString> { fn get_id(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::ges_asset_get_id(self.to_glib_none().0)) from_glib_none(ffi::ges_asset_get_id(self.as_ref().to_glib_none().0))
} }
} }
fn get_proxy(&self) -> Option<Asset> { fn get_proxy(&self) -> Option<Asset> {
unsafe { unsafe {
from_glib_none(ffi::ges_asset_get_proxy(self.to_glib_none().0)) from_glib_none(ffi::ges_asset_get_proxy(self.as_ref().to_glib_none().0))
} }
} }
fn get_proxy_target(&self) -> Option<Asset> { fn get_proxy_target(&self) -> Option<Asset> {
unsafe { unsafe {
from_glib_none(ffi::ges_asset_get_proxy_target(self.to_glib_none().0)) from_glib_none(ffi::ges_asset_get_proxy_target(self.as_ref().to_glib_none().0))
} }
} }
fn list_proxies(&self) -> Vec<Asset> { fn list_proxies(&self) -> Vec<Asset> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.as_ref().to_glib_none().0))
} }
} }
fn set_proxy<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, proxy: Q) -> bool { fn set_proxy<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, proxy: Q) -> bool {
let proxy = proxy.into(); let proxy = proxy.into();
let proxy = proxy.to_glib_none();
unsafe { unsafe {
from_glib(ffi::ges_asset_set_proxy(self.to_glib_none().0, proxy.0)) from_glib(ffi::ges_asset_set_proxy(self.as_ref().to_glib_none().0, proxy.map(|p| p.as_ref()).to_glib_none().0))
} }
} }
fn unproxy<P: IsA<Asset>>(&self, proxy: &P) -> bool { fn unproxy<P: IsA<Asset>>(&self, proxy: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_asset_unproxy(self.to_glib_none().0, proxy.to_glib_none().0)) from_glib(ffi::ges_asset_unproxy(self.as_ref().to_glib_none().0, proxy.as_ref().to_glib_none().0))
} }
} }
@ -186,7 +185,7 @@ impl<O: IsA<Asset>> AssetExt for O {
fn connect_property_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::proxy\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::proxy\0".as_ptr() as *const _,
transmute(notify_proxy_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_proxy_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -194,7 +193,7 @@ impl<O: IsA<Asset>> AssetExt for O {
fn connect_property_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::proxy-target\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::proxy-target\0".as_ptr() as *const _,
transmute(notify_proxy_target_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_proxy_target_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -203,11 +202,11 @@ impl<O: IsA<Asset>> AssetExt for O {
unsafe extern "C" fn notify_proxy_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_proxy_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> { where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked()) f(&Asset::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_proxy_target_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_proxy_target_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> { where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked()) f(&Asset::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -9,7 +9,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct BaseEffect(Object<ffi::GESBaseEffect, ffi::GESBaseEffectClass>): TrackElement, TimelineElement, Extractable; pub struct BaseEffect(Object<ffi::GESBaseEffect, ffi::GESBaseEffectClass, BaseEffectClass>) @extends TrackElement, TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_base_effect_get_type(), get_type => || ffi::ges_base_effect_get_type(),
@ -17,3 +17,5 @@ glib_wrapper! {
} }
impl BaseEffect {} impl BaseEffect {}
pub const NONE_BASE_EFFECT: Option<&BaseEffect> = None;

View file

@ -13,7 +13,7 @@ use TrackElement;
use TrackType; use TrackType;
use ffi; use ffi;
use glib; use glib;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -23,13 +23,15 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Clip(Object<ffi::GESClip, ffi::GESClipClass>): Container, TimelineElement, Extractable; pub struct Clip(Object<ffi::GESClip, ffi::GESClipClass, ClipClass>) @extends Container, TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_clip_get_type(), get_type => || ffi::ges_clip_get_type(),
} }
} }
pub const NONE_CLIP: Option<&Clip> = None;
pub trait ClipExt: 'static { pub trait ClipExt: 'static {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement>; fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement>;
@ -47,7 +49,7 @@ pub trait ClipExt: 'static {
fn get_top_effects(&self) -> Vec<TrackElement>; fn get_top_effects(&self) -> Vec<TrackElement>;
fn move_to_layer(&self, layer: &Layer) -> bool; fn move_to_layer<P: IsA<Layer>>(&self, layer: &P) -> bool;
fn set_supported_formats(&self, supportedformats: TrackType); fn set_supported_formats(&self, supportedformats: TrackType);
@ -65,90 +67,88 @@ pub trait ClipExt: 'static {
impl<O: IsA<Clip>> ClipExt for O { impl<O: IsA<Clip>> ClipExt for O {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement> { fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement> {
unsafe { unsafe {
from_glib_none(ffi::ges_clip_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) from_glib_none(ffi::ges_clip_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0))
} }
} }
fn find_track_element<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, type_: glib::types::Type) -> Option<TrackElement> { fn find_track_element<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, type_: glib::types::Type) -> Option<TrackElement> {
let track = track.into(); let track = track.into();
let track = track.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::ges_clip_find_track_element(self.to_glib_none().0, track.0, type_.to_glib())) from_glib_full(ffi::ges_clip_find_track_element(self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, type_.to_glib()))
} }
} }
fn find_track_elements<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec<TrackElement> { fn find_track_elements<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec<TrackElement> {
let track = track.into(); let track = track.into();
let track = track.to_glib_none();
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_clip_find_track_elements(self.to_glib_none().0, track.0, track_type.to_glib(), type_.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::ges_clip_find_track_elements(self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, track_type.to_glib(), type_.to_glib()))
} }
} }
fn get_layer(&self) -> Option<Layer> { fn get_layer(&self) -> Option<Layer> {
unsafe { unsafe {
from_glib_full(ffi::ges_clip_get_layer(self.to_glib_none().0)) from_glib_full(ffi::ges_clip_get_layer(self.as_ref().to_glib_none().0))
} }
} }
fn get_supported_formats(&self) -> TrackType { fn get_supported_formats(&self) -> TrackType {
unsafe { unsafe {
from_glib(ffi::ges_clip_get_supported_formats(self.to_glib_none().0)) from_glib(ffi::ges_clip_get_supported_formats(self.as_ref().to_glib_none().0))
} }
} }
fn get_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 { fn get_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 {
unsafe { unsafe {
ffi::ges_clip_get_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0) ffi::ges_clip_get_top_effect_index(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0)
} }
} }
fn get_top_effect_position<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 { fn get_top_effect_position<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 {
unsafe { unsafe {
ffi::ges_clip_get_top_effect_position(self.to_glib_none().0, effect.to_glib_none().0) ffi::ges_clip_get_top_effect_position(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0)
} }
} }
fn get_top_effects(&self) -> Vec<TrackElement> { fn get_top_effects(&self) -> Vec<TrackElement> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_clip_get_top_effects(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_clip_get_top_effects(self.as_ref().to_glib_none().0))
} }
} }
fn move_to_layer(&self, layer: &Layer) -> bool { fn move_to_layer<P: IsA<Layer>>(&self, layer: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_clip_move_to_layer(self.to_glib_none().0, layer.to_glib_none().0)) from_glib(ffi::ges_clip_move_to_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0))
} }
} }
fn set_supported_formats(&self, supportedformats: TrackType) { fn set_supported_formats(&self, supportedformats: TrackType) {
unsafe { unsafe {
ffi::ges_clip_set_supported_formats(self.to_glib_none().0, supportedformats.to_glib()); ffi::ges_clip_set_supported_formats(self.as_ref().to_glib_none().0, supportedformats.to_glib());
} }
} }
fn set_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P, newindex: u32) -> bool { fn set_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P, newindex: u32) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_clip_set_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0, newindex)) from_glib(ffi::ges_clip_set_top_effect_index(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newindex))
} }
} }
fn set_top_effect_priority<P: IsA<BaseEffect>>(&self, effect: &P, newpriority: u32) -> bool { fn set_top_effect_priority<P: IsA<BaseEffect>>(&self, effect: &P, newpriority: u32) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_clip_set_top_effect_priority(self.to_glib_none().0, effect.to_glib_none().0, newpriority)) from_glib(ffi::ges_clip_set_top_effect_priority(self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newpriority))
} }
} }
fn split(&self, position: u64) -> Option<Clip> { fn split(&self, position: u64) -> Option<Clip> {
unsafe { unsafe {
from_glib_none(ffi::ges_clip_split(self.to_glib_none().0, position)) from_glib_none(ffi::ges_clip_split(self.as_ref().to_glib_none().0, position))
} }
} }
fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::layer\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::layer\0".as_ptr() as *const _,
transmute(notify_layer_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_layer_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -156,7 +156,7 @@ impl<O: IsA<Clip>> ClipExt for O {
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _,
transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -165,11 +165,11 @@ impl<O: IsA<Clip>> ClipExt for O {
unsafe extern "C" fn notify_layer_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_layer_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Clip> { where P: IsA<Clip> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Clip::from_glib_borrow(this).downcast_unchecked()) f(&Clip::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Clip> { where P: IsA<Clip> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Clip::from_glib_borrow(this).downcast_unchecked()) f(&Clip::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -11,7 +11,7 @@ use ffi;
use glib; use glib;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -22,7 +22,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Container(Object<ffi::GESContainer, ffi::GESContainerClass>): TimelineElement, Extractable; pub struct Container(Object<ffi::GESContainer, ffi::GESContainerClass, ContainerClass>) @extends TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_container_get_type(), get_type => || ffi::ges_container_get_type(),
@ -38,6 +38,8 @@ impl Container {
} }
} }
pub const NONE_CONTAINER: Option<&Container> = None;
pub trait GESContainerExt: 'static { pub trait GESContainerExt: 'static {
fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError>; fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError>;
@ -61,31 +63,31 @@ pub trait GESContainerExt: 'static {
impl<O: IsA<Container>> GESContainerExt for O { impl<O: IsA<Container>> GESContainerExt for O {
fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError> { fn add<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_container_add(self.to_glib_none().0, child.to_glib_none().0), "Failed to add element") glib_result_from_gboolean!(ffi::ges_container_add(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0), "Failed to add element")
} }
} }
fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError> { fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_container_edit(self.to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position), "Failed to edit container") glib_result_from_gboolean!(ffi::ges_container_edit(self.as_ref().to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position), "Failed to edit container")
} }
} }
fn get_children(&self, recursive: bool) -> Vec<TimelineElement> { fn get_children(&self, recursive: bool) -> Vec<TimelineElement> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_container_get_children(self.to_glib_none().0, recursive.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::ges_container_get_children(self.as_ref().to_glib_none().0, recursive.to_glib()))
} }
} }
fn remove<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError> { fn remove<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_container_remove(self.to_glib_none().0, child.to_glib_none().0), "Failed to remove element") glib_result_from_gboolean!(ffi::ges_container_remove(self.as_ref().to_glib_none().0, child.as_ref().to_glib_none().0), "Failed to remove element")
} }
} }
fn ungroup(&self, recursive: bool) -> Vec<Container> { fn ungroup(&self, recursive: bool) -> Vec<Container> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_container_ungroup(self.to_glib_full(), recursive.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::ges_container_ungroup(self.as_ref().to_glib_full(), recursive.to_glib()))
} }
} }
@ -100,7 +102,7 @@ impl<O: IsA<Container>> GESContainerExt for O {
fn connect_child_added<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_child_added<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"child-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"child-added\0".as_ptr() as *const _,
transmute(child_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(child_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -108,7 +110,7 @@ impl<O: IsA<Container>> GESContainerExt for O {
fn connect_child_removed<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_child_removed<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"child-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"child-removed\0".as_ptr() as *const _,
transmute(child_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(child_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -116,7 +118,7 @@ impl<O: IsA<Container>> GESContainerExt for O {
fn connect_property_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::height\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::height\0".as_ptr() as *const _,
transmute(notify_height_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_height_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -125,17 +127,17 @@ impl<O: IsA<Container>> GESContainerExt for O {
unsafe extern "C" fn child_added_trampoline<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) unsafe extern "C" fn child_added_trampoline<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer)
where P: IsA<Container> { where P: IsA<Container> {
let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f);
f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element))
} }
unsafe extern "C" fn child_removed_trampoline<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) unsafe extern "C" fn child_removed_trampoline<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer)
where P: IsA<Container> { where P: IsA<Container> {
let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f);
f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) f(&Container::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(element))
} }
unsafe extern "C" fn notify_height_trampoline<P>(this: *mut ffi::GESContainer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_height_trampoline<P>(this: *mut ffi::GESContainer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Container> { where P: IsA<Container> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Container::from_glib_borrow(this).downcast_unchecked()) f(&Container::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -15,7 +15,7 @@ use glib::translate::*;
use gobject_ffi; use gobject_ffi;
glib_wrapper! { glib_wrapper! {
pub struct Effect(Object<ffi::GESEffect, ffi::GESEffectClass>): BaseEffect, TrackElement, TimelineElement, Extractable; pub struct Effect(Object<ffi::GESEffect, ffi::GESEffectClass, EffectClass>) @extends BaseEffect, TrackElement, TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_effect_get_type(), get_type => || ffi::ges_effect_get_type(),
@ -31,6 +31,8 @@ impl Effect {
} }
} }
pub const NONE_EFFECT: Option<&Effect> = None;
pub trait EffectExt: 'static { pub trait EffectExt: 'static {
fn get_property_bin_description(&self) -> Option<GString>; fn get_property_bin_description(&self) -> Option<GString>;
} }

View file

@ -9,13 +9,15 @@ use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct Extractable(Object<ffi::GESExtractable, ffi::GESExtractableInterface>); pub struct Extractable(Interface<ffi::GESExtractable>);
match fn { match fn {
get_type => || ffi::ges_extractable_get_type(), get_type => || ffi::ges_extractable_get_type(),
} }
} }
pub const NONE_EXTRACTABLE: Option<&Extractable> = None;
pub trait ExtractableExt: 'static { pub trait ExtractableExt: 'static {
fn get_asset(&self) -> Option<Asset>; fn get_asset(&self) -> Option<Asset>;
@ -27,19 +29,19 @@ pub trait ExtractableExt: 'static {
impl<O: IsA<Extractable>> ExtractableExt for O { impl<O: IsA<Extractable>> ExtractableExt for O {
fn get_asset(&self) -> Option<Asset> { fn get_asset(&self) -> Option<Asset> {
unsafe { unsafe {
from_glib_none(ffi::ges_extractable_get_asset(self.to_glib_none().0)) from_glib_none(ffi::ges_extractable_get_asset(self.as_ref().to_glib_none().0))
} }
} }
fn get_id(&self) -> Option<GString> { fn get_id(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::ges_extractable_get_id(self.to_glib_none().0)) from_glib_full(ffi::ges_extractable_get_id(self.as_ref().to_glib_none().0))
} }
} }
fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> bool { fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_extractable_set_asset(self.to_glib_none().0, asset.to_glib_none().0)) from_glib(ffi::ges_extractable_set_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -8,7 +8,7 @@ use TimelineElement;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -19,7 +19,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Group(Object<ffi::GESGroup, ffi::GESGroupClass>): Container, TimelineElement, Extractable; pub struct Group(Object<ffi::GESGroup, ffi::GESGroupClass, GroupClass>) @extends Container, TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_group_get_type(), get_type => || ffi::ges_group_get_type(),
@ -41,6 +41,8 @@ impl Default for Group {
} }
} }
pub const NONE_GROUP: Option<&Group> = None;
pub trait GroupExt: 'static { pub trait GroupExt: 'static {
fn get_property_duration(&self) -> u64; fn get_property_duration(&self) -> u64;
@ -147,7 +149,7 @@ impl<O: IsA<Group>> GroupExt for O {
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -155,7 +157,7 @@ impl<O: IsA<Group>> GroupExt for O {
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::in-point\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _,
transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -163,7 +165,7 @@ impl<O: IsA<Group>> GroupExt for O {
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _,
transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -171,7 +173,7 @@ impl<O: IsA<Group>> GroupExt for O {
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _,
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -179,7 +181,7 @@ impl<O: IsA<Group>> GroupExt for O {
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::start\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _,
transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -188,29 +190,29 @@ impl<O: IsA<Group>> GroupExt for O {
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> { where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked()) f(&Group::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> { where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked()) f(&Group::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> { where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked()) f(&Group::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> { where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked()) f(&Group::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> { where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked()) f(&Group::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -8,7 +8,7 @@ use Extractable;
use Timeline; use Timeline;
use TrackType; use TrackType;
use ffi; use ffi;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -19,7 +19,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Layer(Object<ffi::GESLayer, ffi::GESLayerClass>): Extractable; pub struct Layer(Object<ffi::GESLayer, ffi::GESLayerClass, LayerClass>) @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_layer_get_type(), get_type => || ffi::ges_layer_get_type(),
@ -41,6 +41,8 @@ impl Default for Layer {
} }
} }
pub const NONE_LAYER: Option<&Layer> = None;
pub trait LayerExt: 'static { pub trait LayerExt: 'static {
fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip>; fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip>;
@ -67,7 +69,7 @@ pub trait LayerExt: 'static {
#[cfg_attr(feature = "v1_16", deprecated)] #[cfg_attr(feature = "v1_16", deprecated)]
fn set_priority(&self, priority: u32); fn set_priority(&self, priority: u32);
fn set_timeline(&self, timeline: &Timeline); fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P);
fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId;
@ -82,86 +84,86 @@ pub trait LayerExt: 'static {
impl<O: IsA<Layer>> LayerExt for O { impl<O: IsA<Layer>> LayerExt for O {
fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip> { fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip> {
unsafe { unsafe {
from_glib_none(ffi::ges_layer_add_asset(self.to_glib_none().0, asset.to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib())) from_glib_none(ffi::ges_layer_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib()))
} }
} }
fn add_clip<P: IsA<Clip>>(&self, clip: &P) -> bool { fn add_clip<P: IsA<Clip>>(&self, clip: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_layer_add_clip(self.to_glib_none().0, clip.to_glib_none().0)) from_glib(ffi::ges_layer_add_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0))
} }
} }
fn get_auto_transition(&self) -> bool { fn get_auto_transition(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_layer_get_auto_transition(self.to_glib_none().0)) from_glib(ffi::ges_layer_get_auto_transition(self.as_ref().to_glib_none().0))
} }
} }
fn get_clips(&self) -> Vec<Clip> { fn get_clips(&self) -> Vec<Clip> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips(self.as_ref().to_glib_none().0))
} }
} }
fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip> { fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval(self.to_glib_none().0, start.to_glib(), end.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval(self.as_ref().to_glib_none().0, start.to_glib(), end.to_glib()))
} }
} }
fn get_duration(&self) -> gst::ClockTime { fn get_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_layer_get_duration(self.to_glib_none().0)) from_glib(ffi::ges_layer_get_duration(self.as_ref().to_glib_none().0))
} }
} }
fn get_priority(&self) -> u32 { fn get_priority(&self) -> u32 {
unsafe { unsafe {
ffi::ges_layer_get_priority(self.to_glib_none().0) ffi::ges_layer_get_priority(self.as_ref().to_glib_none().0)
} }
} }
fn get_timeline(&self) -> Option<Timeline> { fn get_timeline(&self) -> Option<Timeline> {
unsafe { unsafe {
from_glib_none(ffi::ges_layer_get_timeline(self.to_glib_none().0)) from_glib_none(ffi::ges_layer_get_timeline(self.as_ref().to_glib_none().0))
} }
} }
fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_layer_is_empty(self.to_glib_none().0)) from_glib(ffi::ges_layer_is_empty(self.as_ref().to_glib_none().0))
} }
} }
fn remove_clip<P: IsA<Clip>>(&self, clip: &P) -> bool { fn remove_clip<P: IsA<Clip>>(&self, clip: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_layer_remove_clip(self.to_glib_none().0, clip.to_glib_none().0)) from_glib(ffi::ges_layer_remove_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0))
} }
} }
fn set_auto_transition(&self, auto_transition: bool) { fn set_auto_transition(&self, auto_transition: bool) {
unsafe { unsafe {
ffi::ges_layer_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); ffi::ges_layer_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib());
} }
} }
fn set_priority(&self, priority: u32) { fn set_priority(&self, priority: u32) {
unsafe { unsafe {
ffi::ges_layer_set_priority(self.to_glib_none().0, priority); ffi::ges_layer_set_priority(self.as_ref().to_glib_none().0, priority);
} }
} }
fn set_timeline(&self, timeline: &Timeline) { fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) {
unsafe { unsafe {
ffi::ges_layer_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); ffi::ges_layer_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0);
} }
} }
fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"clip-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"clip-added\0".as_ptr() as *const _,
transmute(clip_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(clip_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -169,7 +171,7 @@ impl<O: IsA<Layer>> LayerExt for O {
fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"clip-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"clip-removed\0".as_ptr() as *const _,
transmute(clip_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(clip_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -177,7 +179,7 @@ impl<O: IsA<Layer>> LayerExt for O {
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _,
transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -185,7 +187,7 @@ impl<O: IsA<Layer>> LayerExt for O {
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _,
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -194,23 +196,23 @@ impl<O: IsA<Layer>> LayerExt for O {
unsafe extern "C" fn clip_added_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) unsafe extern "C" fn clip_added_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
where P: IsA<Layer> { where P: IsA<Layer> {
let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); let f: &&(Fn(&P, &Clip) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip))
} }
unsafe extern "C" fn clip_removed_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) unsafe extern "C" fn clip_removed_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
where P: IsA<Layer> { where P: IsA<Layer> {
let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); let f: &&(Fn(&P, &Clip) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip))
} }
unsafe extern "C" fn notify_auto_transition_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_auto_transition_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Layer> { where P: IsA<Layer> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked()) f(&Layer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Layer> { where P: IsA<Layer> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked()) f(&Layer::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -3,70 +3,70 @@
// DO NOT EDIT // DO NOT EDIT
mod asset; mod asset;
pub use self::asset::Asset; pub use self::asset::{Asset, AssetClass, NONE_ASSET};
pub use self::asset::AssetExt; pub use self::asset::AssetExt;
mod base_effect; mod base_effect;
pub use self::base_effect::BaseEffect; pub use self::base_effect::{BaseEffect, BaseEffectClass, NONE_BASE_EFFECT};
mod clip; mod clip;
pub use self::clip::Clip; pub use self::clip::{Clip, ClipClass, NONE_CLIP};
pub use self::clip::ClipExt; pub use self::clip::ClipExt;
mod container; mod container;
pub use self::container::Container; pub use self::container::{Container, ContainerClass, NONE_CONTAINER};
pub use self::container::GESContainerExt; pub use self::container::GESContainerExt;
mod effect; mod effect;
pub use self::effect::Effect; pub use self::effect::{Effect, EffectClass, NONE_EFFECT};
pub use self::effect::EffectExt; pub use self::effect::EffectExt;
mod extractable; mod extractable;
pub use self::extractable::Extractable; pub use self::extractable::{Extractable, NONE_EXTRACTABLE};
pub use self::extractable::ExtractableExt; pub use self::extractable::ExtractableExt;
mod group; mod group;
pub use self::group::Group; pub use self::group::{Group, GroupClass, NONE_GROUP};
pub use self::group::GroupExt; pub use self::group::GroupExt;
mod layer; mod layer;
pub use self::layer::Layer; pub use self::layer::{Layer, LayerClass, NONE_LAYER};
pub use self::layer::LayerExt; pub use self::layer::LayerExt;
mod pipeline; mod pipeline;
pub use self::pipeline::Pipeline; pub use self::pipeline::{Pipeline, PipelineClass, NONE_PIPELINE};
pub use self::pipeline::GESPipelineExt; pub use self::pipeline::GESPipelineExt;
mod project; mod project;
pub use self::project::Project; pub use self::project::{Project, ProjectClass, NONE_PROJECT};
pub use self::project::ProjectExt; pub use self::project::ProjectExt;
mod timeline; mod timeline;
pub use self::timeline::Timeline; pub use self::timeline::{Timeline, TimelineClass, NONE_TIMELINE};
pub use self::timeline::TimelineExt; pub use self::timeline::TimelineExt;
mod timeline_element; mod timeline_element;
pub use self::timeline_element::TimelineElement; pub use self::timeline_element::{TimelineElement, TimelineElementClass, NONE_TIMELINE_ELEMENT};
pub use self::timeline_element::TimelineElementExt; pub use self::timeline_element::TimelineElementExt;
mod track; mod track;
pub use self::track::Track; pub use self::track::{Track, TrackClass, NONE_TRACK};
pub use self::track::GESTrackExt; pub use self::track::GESTrackExt;
mod track_element; mod track_element;
pub use self::track_element::TrackElement; pub use self::track_element::{TrackElement, TrackElementClass, NONE_TRACK_ELEMENT};
pub use self::track_element::TrackElementExt; pub use self::track_element::TrackElementExt;
mod uri_clip; mod uri_clip;
pub use self::uri_clip::UriClip; pub use self::uri_clip::{UriClip, UriClipClass, NONE_URI_CLIP};
pub use self::uri_clip::UriClipExt; pub use self::uri_clip::UriClipExt;
mod uri_clip_asset; mod uri_clip_asset;
pub use self::uri_clip_asset::UriClipAsset; pub use self::uri_clip_asset::{UriClipAsset, UriClipAssetClass, NONE_URI_CLIP_ASSET};
pub use self::uri_clip_asset::UriClipAssetExt; pub use self::uri_clip_asset::UriClipAssetExt;
mod uri_source_asset; mod uri_source_asset;
pub use self::uri_source_asset::UriSourceAsset; pub use self::uri_source_asset::{UriSourceAsset, UriSourceAssetClass, NONE_URI_SOURCE_ASSET};
pub use self::uri_source_asset::UriSourceAssetExt; pub use self::uri_source_asset::UriSourceAssetExt;
mod enums; mod enums;

View file

@ -9,7 +9,7 @@ use ffi;
use glib; use glib;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -17,18 +17,13 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use gst_pbutils; use gst_pbutils;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct Pipeline(Object<ffi::GESPipeline, ffi::GESPipelineClass>): [ pub struct Pipeline(Object<ffi::GESPipeline, ffi::GESPipelineClass, PipelineClass>) @extends gst::Pipeline, gst::Element, gst::Object;
gst::Pipeline => gst_ffi::GstPipeline,
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::ges_pipeline_get_type(), get_type => || ffi::ges_pipeline_get_type(),
@ -50,6 +45,8 @@ impl Default for Pipeline {
} }
} }
pub const NONE_PIPELINE: Option<&Pipeline> = None;
pub trait GESPipelineExt: 'static { pub trait GESPipelineExt: 'static {
fn get_mode(&self) -> PipelineFlags; fn get_mode(&self) -> PipelineFlags;
@ -71,7 +68,7 @@ pub trait GESPipelineExt: 'static {
fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>; fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError>;
fn set_timeline(&self, timeline: &Timeline) -> bool; fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> bool;
fn get_property_audio_filter(&self) -> Option<gst::Element>; fn get_property_audio_filter(&self) -> Option<gst::Element>;
@ -107,69 +104,69 @@ pub trait GESPipelineExt: 'static {
impl<O: IsA<Pipeline>> GESPipelineExt for O { impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn get_mode(&self) -> PipelineFlags { fn get_mode(&self) -> PipelineFlags {
unsafe { unsafe {
from_glib(ffi::ges_pipeline_get_mode(self.to_glib_none().0)) from_glib(ffi::ges_pipeline_get_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample> { fn get_thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample> {
unsafe { unsafe {
from_glib_full(ffi::ges_pipeline_get_thumbnail(self.to_glib_none().0, caps.to_glib_none().0)) from_glib_full(ffi::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<gst::Sample> { fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample> {
unsafe { unsafe {
from_glib_full(ffi::ges_pipeline_get_thumbnail_rgb24(self.to_glib_none().0, width, height)) from_glib_full(ffi::ges_pipeline_get_thumbnail_rgb24(self.as_ref().to_glib_none().0, width, height))
} }
} }
fn preview_get_audio_sink(&self) -> Option<gst::Element> { fn preview_get_audio_sink(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(self.to_glib_none().0)) from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(self.as_ref().to_glib_none().0))
} }
} }
fn preview_get_video_sink(&self) -> Option<gst::Element> { fn preview_get_video_sink(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.to_glib_none().0)) from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.as_ref().to_glib_none().0))
} }
} }
fn preview_set_audio_sink<P: IsA<gst::Element>>(&self, sink: &P) { fn preview_set_audio_sink<P: IsA<gst::Element>>(&self, sink: &P) {
unsafe { unsafe {
ffi::ges_pipeline_preview_set_audio_sink(self.to_glib_none().0, sink.to_glib_none().0); ffi::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<P: IsA<gst::Element>>(&self, sink: &P) { fn preview_set_video_sink<P: IsA<gst::Element>>(&self, sink: &P) {
unsafe { unsafe {
ffi::ges_pipeline_preview_set_video_sink(self.to_glib_none().0, sink.to_glib_none().0); ffi::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> { fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::ges_pipeline_save_thumbnail(self.to_glib_none().0, width, height, format.to_glib_none().0, location.to_glib_none().0, &mut error); let _ = ffi::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)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> { fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_pipeline_set_mode(self.to_glib_none().0, mode.to_glib()), "Failed to set mode") glib_result_from_gboolean!(ffi::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.to_glib()), "Failed to set mode")
} }
} }
fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError> { fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_pipeline_set_render_settings(self.to_glib_none().0, output_uri.to_glib_none().0, profile.to_glib_none().0), "Failed to set render settings") glib_result_from_gboolean!(ffi::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: &Timeline) -> bool { fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_pipeline_set_timeline(self.to_glib_none().0, timeline.to_glib_full())) from_glib(ffi::ges_pipeline_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_full()))
} }
} }
@ -240,7 +237,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::audio-filter\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::audio-filter\0".as_ptr() as *const _,
transmute(notify_audio_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_audio_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -248,7 +245,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::audio-sink\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::audio-sink\0".as_ptr() as *const _,
transmute(notify_audio_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_audio_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -256,7 +253,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mode\0".as_ptr() as *const _,
transmute(notify_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -264,7 +261,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeline\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _,
transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -272,7 +269,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::video-filter\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::video-filter\0".as_ptr() as *const _,
transmute(notify_video_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_video_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -280,7 +277,7 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
fn connect_property_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::video-sink\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _,
transmute(notify_video_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_video_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -289,35 +286,35 @@ impl<O: IsA<Pipeline>> GESPipelineExt for O {
unsafe extern "C" fn notify_audio_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_audio_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_audio_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_audio_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_mode_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mode_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_video_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_video_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_video_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_video_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> { where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) f(&Pipeline::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -8,7 +8,7 @@ use Timeline;
use ffi; use ffi;
use glib; use glib;
use glib::GString; use glib::GString;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -21,7 +21,7 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct Project(Object<ffi::GESProject, ffi::GESProjectClass>): Asset; pub struct Project(Object<ffi::GESProject, ffi::GESProjectClass, ProjectClass>) @extends Asset;
match fn { match fn {
get_type => || ffi::ges_project_get_type(), get_type => || ffi::ges_project_get_type(),
@ -32,13 +32,14 @@ impl Project {
pub fn new<'a, P: Into<Option<&'a str>>>(uri: P) -> Project { pub fn new<'a, P: Into<Option<&'a str>>>(uri: P) -> Project {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let uri = uri.into(); let uri = uri.into();
let uri = uri.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::ges_project_new(uri.0)) from_glib_full(ffi::ges_project_new(uri.to_glib_none().0))
} }
} }
} }
pub const NONE_PROJECT: Option<&Project> = None;
pub trait ProjectExt: 'static { pub trait ProjectExt: 'static {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool; fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool;
@ -58,11 +59,11 @@ pub trait ProjectExt: 'static {
fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile>; fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile>;
fn load(&self, timeline: &Timeline) -> Result<(), Error>; fn load<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), Error>;
fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> bool; fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> bool;
fn save<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error>; fn save<'a, P: IsA<Timeline>, Q: IsA<Asset> + 'a, R: Into<Option<&'a Q>>>(&self, timeline: &P, uri: &str, formatter_asset: R, overwrite: bool) -> Result<(), Error>;
fn connect_asset_added<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_asset_added<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId;
@ -80,84 +81,81 @@ pub trait ProjectExt: 'static {
impl<O: IsA<Project>> ProjectExt for O { impl<O: IsA<Project>> ProjectExt for O {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool { fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_project_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) from_glib(ffi::ges_project_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0))
} }
} }
fn add_encoding_profile<P: IsA<gst_pbutils::EncodingProfile>>(&self, profile: &P) -> bool { fn add_encoding_profile<P: IsA<gst_pbutils::EncodingProfile>>(&self, profile: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_project_add_encoding_profile(self.to_glib_none().0, profile.to_glib_none().0)) from_glib(ffi::ges_project_add_encoding_profile(self.as_ref().to_glib_none().0, profile.as_ref().to_glib_none().0))
} }
} }
fn create_asset<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> bool { fn create_asset<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> bool {
let id = id.into(); let id = id.into();
let id = id.to_glib_none();
unsafe { unsafe {
from_glib(ffi::ges_project_create_asset(self.to_glib_none().0, id.0, extractable_type.to_glib())) from_glib(ffi::ges_project_create_asset(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib()))
} }
} }
fn create_asset_sync<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> Result<Option<Asset>, Error> { fn create_asset_sync<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> Result<Option<Asset>, Error> {
let id = id.into(); let id = id.into();
let id = id.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::ges_project_create_asset_sync(self.to_glib_none().0, id.0, extractable_type.to_glib(), &mut error); let ret = ffi::ges_project_create_asset_sync(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib(), &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option<Asset> { fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option<Asset> {
unsafe { unsafe {
from_glib_full(ffi::ges_project_get_asset(self.to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) from_glib_full(ffi::ges_project_get_asset(self.as_ref().to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib()))
} }
} }
fn get_loading_assets(&self) -> Vec<Asset> { fn get_loading_assets(&self) -> Vec<Asset> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_project_get_loading_assets(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_project_get_loading_assets(self.as_ref().to_glib_none().0))
} }
} }
fn get_uri(&self) -> Option<GString> { fn get_uri(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::ges_project_get_uri(self.to_glib_none().0)) from_glib_full(ffi::ges_project_get_uri(self.as_ref().to_glib_none().0))
} }
} }
fn list_assets(&self, filter: glib::types::Type) -> Vec<Asset> { fn list_assets(&self, filter: glib::types::Type) -> Vec<Asset> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_project_list_assets(self.to_glib_none().0, filter.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::ges_project_list_assets(self.as_ref().to_glib_none().0, filter.to_glib()))
} }
} }
fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile> { fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_project_list_encoding_profiles(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::ges_project_list_encoding_profiles(self.as_ref().to_glib_none().0))
} }
} }
fn load(&self, timeline: &Timeline) -> Result<(), Error> { fn load<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::ges_project_load(self.to_glib_none().0, timeline.to_glib_none().0, &mut error); let _ = ffi::ges_project_load(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> bool { fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_project_remove_asset(self.to_glib_none().0, asset.to_glib_none().0)) from_glib(ffi::ges_project_remove_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0))
} }
} }
fn save<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { fn save<'a, P: IsA<Timeline>, Q: IsA<Asset> + 'a, R: Into<Option<&'a Q>>>(&self, timeline: &P, uri: &str, formatter_asset: R, overwrite: bool) -> Result<(), Error> {
let formatter_asset = formatter_asset.into(); let formatter_asset = formatter_asset.into();
let formatter_asset = formatter_asset.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::ges_project_save(self.to_glib_none().0, timeline.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); let _ = ffi::ges_project_save(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0, uri.to_glib_none().0, formatter_asset.map(|p| p.as_ref()).to_glib_none().0, overwrite.to_glib(), &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
@ -165,7 +163,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_asset_added<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_asset_added<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"asset-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"asset-added\0".as_ptr() as *const _,
transmute(asset_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(asset_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -173,7 +171,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_asset_loading<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_asset_loading<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"asset-loading\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"asset-loading\0".as_ptr() as *const _,
transmute(asset_loading_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(asset_loading_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -181,7 +179,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_asset_removed<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_asset_removed<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"asset-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"asset-removed\0".as_ptr() as *const _,
transmute(asset_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(asset_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -189,7 +187,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_error_loading_asset<F: Fn(&Self, &Error, &str, glib::types::Type) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_error_loading_asset<F: Fn(&Self, &Error, &str, glib::types::Type) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Error, &str, glib::types::Type) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Error, &str, glib::types::Type) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"error-loading-asset\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"error-loading-asset\0".as_ptr() as *const _,
transmute(error_loading_asset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(error_loading_asset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -197,7 +195,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Timeline) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Timeline) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"loaded\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"loaded\0".as_ptr() as *const _,
transmute(loaded_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(loaded_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -205,7 +203,7 @@ impl<O: IsA<Project>> ProjectExt for O {
fn connect_missing_uri<F: Fn(&Self, &Error, &Asset) -> Option<GString> + 'static>(&self, f: F) -> SignalHandlerId { fn connect_missing_uri<F: Fn(&Self, &Error, &Asset) -> Option<GString> + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Error, &Asset) -> Option<GString> + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Error, &Asset) -> Option<GString> + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"missing-uri\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"missing-uri\0".as_ptr() as *const _,
transmute(missing_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(missing_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -214,35 +212,35 @@ impl<O: IsA<Project>> ProjectExt for O {
unsafe extern "C" fn asset_added_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) unsafe extern "C" fn asset_added_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); let f: &&(Fn(&P, &Asset) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset))
} }
unsafe extern "C" fn asset_loading_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) unsafe extern "C" fn asset_loading_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); let f: &&(Fn(&P, &Asset) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset))
} }
unsafe extern "C" fn asset_removed_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) unsafe extern "C" fn asset_removed_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); let f: &&(Fn(&P, &Asset) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(asset))
} }
unsafe extern "C" fn error_loading_asset_trampoline<P>(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, id: *mut libc::c_char, extractable_type: glib_ffi::GType, f: glib_ffi::gpointer) unsafe extern "C" fn error_loading_asset_trampoline<P>(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, id: *mut libc::c_char, extractable_type: glib_ffi::GType, f: glib_ffi::gpointer)
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Error, &str, glib::types::Type) + 'static) = transmute(f); let f: &&(Fn(&P, &Error, &str, glib::types::Type) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error), &GString::from_glib_borrow(id), from_glib(extractable_type)) f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error), &GString::from_glib_borrow(id), from_glib(extractable_type))
} }
unsafe extern "C" fn loaded_trampoline<P>(this: *mut ffi::GESProject, timeline: *mut ffi::GESTimeline, f: glib_ffi::gpointer) unsafe extern "C" fn loaded_trampoline<P>(this: *mut ffi::GESProject, timeline: *mut ffi::GESTimeline, f: glib_ffi::gpointer)
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Timeline) + 'static) = transmute(f); let f: &&(Fn(&P, &Timeline) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(timeline)) f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(timeline))
} }
unsafe extern "C" fn missing_uri_trampoline<P>(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, wrong_asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) -> *mut libc::c_char unsafe extern "C" fn missing_uri_trampoline<P>(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, wrong_asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) -> *mut libc::c_char
where P: IsA<Project> { where P: IsA<Project> {
let f: &&(Fn(&P, &Error, &Asset) -> Option<GString> + 'static) = transmute(f); let f: &&(Fn(&P, &Error, &Asset) -> Option<GString> + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error), &from_glib_borrow(wrong_asset)).to_glib_full() f(&Project::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(error), &from_glib_borrow(wrong_asset)).to_glib_full()
} }

View file

@ -12,24 +12,19 @@ use Track;
use TrackElement; use TrackElement;
use ffi; use ffi;
use glib; use glib;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct Timeline(Object<ffi::GESTimeline, ffi::GESTimelineClass>): [ pub struct Timeline(Object<ffi::GESTimeline, ffi::GESTimelineClass, TimelineClass>) @extends gst::Element, gst::Object, @implements Extractable;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
Extractable,
];
match fn { match fn {
get_type => || ffi::ges_timeline_get_type(), get_type => || ffi::ges_timeline_get_type(),
@ -67,8 +62,10 @@ impl Default for Timeline {
} }
} }
pub const NONE_TIMELINE: Option<&Timeline> = None;
pub trait TimelineExt: 'static { pub trait TimelineExt: 'static {
fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError>;
fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError>; fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError>;
@ -102,11 +99,11 @@ pub trait TimelineExt: 'static {
fn load_from_uri(&self, uri: &str) -> Result<(), Error>; fn load_from_uri(&self, uri: &str) -> Result<(), Error>;
fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> Result<(), glib::error::BoolError>; fn move_layer<P: IsA<Layer>>(&self, layer: &P, new_layer_priority: u32) -> Result<(), glib::error::BoolError>;
fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement>; fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement>;
fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError>; fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError>;
fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool; fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool;
@ -144,160 +141,159 @@ pub trait TimelineExt: 'static {
} }
impl<O: IsA<Timeline>> TimelineExt for O { impl<O: IsA<Timeline>> TimelineExt for O {
fn add_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> { fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_timeline_add_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to add layer") glib_result_from_gboolean!(ffi::ges_timeline_add_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0), "Failed to add layer")
} }
} }
fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError> { fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_timeline_add_track(self.to_glib_none().0, track.to_glib_full()), "Failed to add track") glib_result_from_gboolean!(ffi::ges_timeline_add_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_full()), "Failed to add track")
} }
} }
fn append_layer(&self) -> Layer { fn append_layer(&self) -> Layer {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_append_layer(self.to_glib_none().0)) from_glib_none(ffi::ges_timeline_append_layer(self.as_ref().to_glib_none().0))
} }
} }
fn commit(&self) -> bool { fn commit(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_commit(self.to_glib_none().0)) from_glib(ffi::ges_timeline_commit(self.as_ref().to_glib_none().0))
} }
} }
fn commit_sync(&self) -> bool { fn commit_sync(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_commit_sync(self.to_glib_none().0)) from_glib(ffi::ges_timeline_commit_sync(self.as_ref().to_glib_none().0))
} }
} }
fn get_auto_transition(&self) -> bool { fn get_auto_transition(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_auto_transition(self.to_glib_none().0)) from_glib(ffi::ges_timeline_get_auto_transition(self.as_ref().to_glib_none().0))
} }
} }
fn get_duration(&self) -> gst::ClockTime { fn get_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_duration(self.to_glib_none().0)) from_glib(ffi::ges_timeline_get_duration(self.as_ref().to_glib_none().0))
} }
} }
fn get_element(&self, name: &str) -> Option<TimelineElement> { fn get_element(&self, name: &str) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_get_element(self.to_glib_none().0, name.to_glib_none().0)) from_glib_full(ffi::ges_timeline_get_element(self.as_ref().to_glib_none().0, name.to_glib_none().0))
} }
} }
fn get_groups(&self) -> Vec<Group> { fn get_groups(&self) -> Vec<Group> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(self.as_ref().to_glib_none().0))
} }
} }
fn get_layer(&self, priority: u32) -> Option<Layer> { fn get_layer(&self, priority: u32) -> Option<Layer> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_get_layer(self.to_glib_none().0, priority)) from_glib_full(ffi::ges_timeline_get_layer(self.as_ref().to_glib_none().0, priority))
} }
} }
fn get_layers(&self) -> Vec<Layer> { fn get_layers(&self) -> Vec<Layer> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.as_ref().to_glib_none().0))
} }
} }
fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad> { fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad> {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_get_pad_for_track(self.to_glib_none().0, track.to_glib_none().0)) from_glib_none(ffi::ges_timeline_get_pad_for_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_none().0))
} }
} }
fn get_snapping_distance(&self) -> gst::ClockTime { fn get_snapping_distance(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_get_snapping_distance(self.to_glib_none().0)) from_glib(ffi::ges_timeline_get_snapping_distance(self.as_ref().to_glib_none().0))
} }
} }
fn get_track_for_pad<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track> { fn get_track_for_pad<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track> {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_get_track_for_pad(self.to_glib_none().0, pad.to_glib_none().0)) from_glib_none(ffi::ges_timeline_get_track_for_pad(self.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0))
} }
} }
fn get_tracks(&self) -> Vec<Track> { fn get_tracks(&self) -> Vec<Track> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(self.as_ref().to_glib_none().0))
} }
} }
fn is_empty(&self) -> bool { fn is_empty(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_is_empty(self.to_glib_none().0)) from_glib(ffi::ges_timeline_is_empty(self.as_ref().to_glib_none().0))
} }
} }
fn load_from_uri(&self, uri: &str) -> Result<(), Error> { fn load_from_uri(&self, uri: &str) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::ges_timeline_load_from_uri(self.to_glib_none().0, uri.to_glib_none().0, &mut error); let _ = ffi::ges_timeline_load_from_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> Result<(), glib::error::BoolError> { fn move_layer<P: IsA<Layer>>(&self, layer: &P, new_layer_priority: u32) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_timeline_move_layer(self.to_glib_none().0, layer.to_glib_none().0, new_layer_priority), "Failed to move layer") glib_result_from_gboolean!(ffi::ges_timeline_move_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0, new_layer_priority), "Failed to move layer")
} }
} }
fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement> { fn paste_element<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_paste_element(self.to_glib_none().0, element.to_glib_none().0, position.to_glib(), layer_priority)) from_glib_none(ffi::ges_timeline_paste_element(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0, position.to_glib(), layer_priority))
} }
} }
fn remove_layer(&self, layer: &Layer) -> Result<(), glib::error::BoolError> { fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_timeline_remove_layer(self.to_glib_none().0, layer.to_glib_none().0), "Failed to remove layer") glib_result_from_gboolean!(ffi::ges_timeline_remove_layer(self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0), "Failed to remove layer")
} }
} }
fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool { fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_remove_track(self.to_glib_none().0, track.to_glib_none().0)) from_glib(ffi::ges_timeline_remove_track(self.as_ref().to_glib_none().0, track.as_ref().to_glib_none().0))
} }
} }
fn save_to_uri<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { fn save_to_uri<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> {
let formatter_asset = formatter_asset.into(); let formatter_asset = formatter_asset.into();
let formatter_asset = formatter_asset.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::ges_timeline_save_to_uri(self.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); let _ = ffi::ges_timeline_save_to_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0, formatter_asset.map(|p| p.as_ref()).to_glib_none().0, overwrite.to_glib(), &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn set_auto_transition(&self, auto_transition: bool) { fn set_auto_transition(&self, auto_transition: bool) {
unsafe { unsafe {
ffi::ges_timeline_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); ffi::ges_timeline_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib());
} }
} }
fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) { fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) {
unsafe { unsafe {
ffi::ges_timeline_set_snapping_distance(self.to_glib_none().0, snapping_distance.to_glib()); ffi::ges_timeline_set_snapping_distance(self.as_ref().to_glib_none().0, snapping_distance.to_glib());
} }
} }
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"commited\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _,
transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -305,7 +301,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Group) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Group) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"group-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"group-added\0".as_ptr() as *const _,
transmute(group_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(group_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -317,7 +313,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"layer-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"layer-added\0".as_ptr() as *const _,
transmute(layer_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(layer_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -325,7 +321,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"layer-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"layer-removed\0".as_ptr() as *const _,
transmute(layer_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(layer_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -337,7 +333,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"snapping-ended\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"snapping-ended\0".as_ptr() as *const _,
transmute(snapping_ended_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(snapping_ended_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -345,7 +341,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"snapping-started\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"snapping-started\0".as_ptr() as *const _,
transmute(snapping_started_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(snapping_started_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -353,7 +349,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"track-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"track-added\0".as_ptr() as *const _,
transmute(track_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(track_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -361,7 +357,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"track-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"track-removed\0".as_ptr() as *const _,
transmute(track_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(track_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -369,7 +365,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::auto-transition\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _,
transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -377,7 +373,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -385,7 +381,7 @@ impl<O: IsA<Timeline>> TimelineExt for O {
fn connect_property_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::snapping-distance\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::snapping-distance\0".as_ptr() as *const _,
transmute(notify_snapping_distance_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_snapping_distance_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -394,65 +390,65 @@ impl<O: IsA<Timeline>> TimelineExt for O {
unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTimeline, f: glib_ffi::gpointer) unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTimeline, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked()) f(&Timeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn group_added_trampoline<P>(this: *mut ffi::GESTimeline, group: *mut ffi::GESGroup, f: glib_ffi::gpointer) unsafe extern "C" fn group_added_trampoline<P>(this: *mut ffi::GESTimeline, group: *mut ffi::GESGroup, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &Group) + 'static) = transmute(f); let f: &&(Fn(&P, &Group) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(group)) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(group))
} }
unsafe extern "C" fn layer_added_trampoline<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) unsafe extern "C" fn layer_added_trampoline<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); let f: &&(Fn(&P, &Layer) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer))
} }
unsafe extern "C" fn layer_removed_trampoline<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) unsafe extern "C" fn layer_removed_trampoline<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); let f: &&(Fn(&P, &Layer) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(layer))
} }
unsafe extern "C" fn snapping_ended_trampoline<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) unsafe extern "C" fn snapping_ended_trampoline<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &from_glib_borrow(p0), p1)
} }
unsafe extern "C" fn snapping_started_trampoline<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) unsafe extern "C" fn snapping_started_trampoline<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object), &from_glib_borrow(p0), p1)
} }
unsafe extern "C" fn track_added_trampoline<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) unsafe extern "C" fn track_added_trampoline<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &Track) + 'static) = transmute(f); let f: &&(Fn(&P, &Track) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track))
} }
unsafe extern "C" fn track_removed_trampoline<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) unsafe extern "C" fn track_removed_trampoline<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P, &Track) + 'static) = transmute(f); let f: &&(Fn(&P, &Track) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) f(&Timeline::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(track))
} }
unsafe extern "C" fn notify_auto_transition_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_auto_transition_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked()) f(&Timeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked()) f(&Timeline::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_snapping_distance_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_snapping_distance_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> { where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked()) f(&Timeline::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -9,7 +9,7 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -21,13 +21,15 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct TimelineElement(Object<ffi::GESTimelineElement, ffi::GESTimelineElementClass>): Extractable; pub struct TimelineElement(Object<ffi::GESTimelineElement, ffi::GESTimelineElementClass, TimelineElementClass>) @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_timeline_element_get_type(), get_type => || ffi::ges_timeline_element_get_type(),
} }
} }
pub const NONE_TIMELINE_ELEMENT: Option<&TimelineElement> = None;
pub trait TimelineElementExt: 'static { pub trait TimelineElementExt: 'static {
//fn add_child_property<P: IsA</*Ignored*/glib::ParamSpec>, Q: IsA<glib::Object>>(&self, pspec: &P, child: &Q) -> bool; //fn add_child_property<P: IsA</*Ignored*/glib::ParamSpec>, Q: IsA<glib::Object>>(&self, pspec: &P, child: &Q) -> bool;
@ -99,7 +101,7 @@ pub trait TimelineElementExt: 'static {
fn set_start(&self, start: gst::ClockTime); fn set_start(&self, start: gst::ClockTime);
fn set_timeline(&self, timeline: &Timeline) -> bool; fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> bool;
fn trim(&self, start: gst::ClockTime) -> bool; fn trim(&self, start: gst::ClockTime) -> bool;
@ -139,7 +141,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn copy(&self, deep: bool) -> Option<TimelineElement> { fn copy(&self, deep: bool) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_element_copy(self.to_glib_none().0, deep.to_glib())) from_glib_none(ffi::ges_timeline_element_copy(self.as_ref().to_glib_none().0, deep.to_glib()))
} }
} }
@ -161,61 +163,61 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn get_duration(&self) -> gst::ClockTime { fn get_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_duration(self.to_glib_none().0)) from_glib(ffi::ges_timeline_element_get_duration(self.as_ref().to_glib_none().0))
} }
} }
fn get_inpoint(&self) -> gst::ClockTime { fn get_inpoint(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_inpoint(self.to_glib_none().0)) from_glib(ffi::ges_timeline_element_get_inpoint(self.as_ref().to_glib_none().0))
} }
} }
fn get_max_duration(&self) -> gst::ClockTime { fn get_max_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_max_duration(self.to_glib_none().0)) from_glib(ffi::ges_timeline_element_get_max_duration(self.as_ref().to_glib_none().0))
} }
} }
fn get_name(&self) -> Option<GString> { fn get_name(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_element_get_name(self.to_glib_none().0)) from_glib_full(ffi::ges_timeline_element_get_name(self.as_ref().to_glib_none().0))
} }
} }
fn get_parent(&self) -> Option<TimelineElement> { fn get_parent(&self) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_element_get_parent(self.to_glib_none().0)) from_glib_full(ffi::ges_timeline_element_get_parent(self.as_ref().to_glib_none().0))
} }
} }
fn get_priority(&self) -> u32 { fn get_priority(&self) -> u32 {
unsafe { unsafe {
ffi::ges_timeline_element_get_priority(self.to_glib_none().0) ffi::ges_timeline_element_get_priority(self.as_ref().to_glib_none().0)
} }
} }
fn get_start(&self) -> gst::ClockTime { fn get_start(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_start(self.to_glib_none().0)) from_glib(ffi::ges_timeline_element_get_start(self.as_ref().to_glib_none().0))
} }
} }
fn get_timeline(&self) -> Option<Timeline> { fn get_timeline(&self) -> Option<Timeline> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_element_get_timeline(self.to_glib_none().0)) from_glib_full(ffi::ges_timeline_element_get_timeline(self.as_ref().to_glib_none().0))
} }
} }
fn get_toplevel_parent(&self) -> Option<TimelineElement> { fn get_toplevel_parent(&self) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(self.to_glib_none().0)) from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(self.as_ref().to_glib_none().0))
} }
} }
fn get_track_types(&self) -> TrackType { fn get_track_types(&self) -> TrackType {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_get_track_types(self.to_glib_none().0)) from_glib(ffi::ges_timeline_element_get_track_types(self.as_ref().to_glib_none().0))
} }
} }
@ -229,7 +231,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn paste(&self, paste_position: gst::ClockTime) -> Option<TimelineElement> { fn paste(&self, paste_position: gst::ClockTime) -> Option<TimelineElement> {
unsafe { unsafe {
from_glib_none(ffi::ges_timeline_element_paste(self.to_glib_none().0, paste_position.to_glib())) from_glib_none(ffi::ges_timeline_element_paste(self.as_ref().to_glib_none().0, paste_position.to_glib()))
} }
} }
@ -239,25 +241,25 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn ripple(&self, start: gst::ClockTime) -> bool { fn ripple(&self, start: gst::ClockTime) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_ripple(self.to_glib_none().0, start.to_glib())) from_glib(ffi::ges_timeline_element_ripple(self.as_ref().to_glib_none().0, start.to_glib()))
} }
} }
fn ripple_end(&self, end: gst::ClockTime) -> bool { fn ripple_end(&self, end: gst::ClockTime) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_ripple_end(self.to_glib_none().0, end.to_glib())) from_glib(ffi::ges_timeline_element_ripple_end(self.as_ref().to_glib_none().0, end.to_glib()))
} }
} }
fn roll_end(&self, end: gst::ClockTime) -> bool { fn roll_end(&self, end: gst::ClockTime) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_roll_end(self.to_glib_none().0, end.to_glib())) from_glib(ffi::ges_timeline_element_roll_end(self.as_ref().to_glib_none().0, end.to_glib()))
} }
} }
fn roll_start(&self, start: gst::ClockTime) -> bool { fn roll_start(&self, start: gst::ClockTime) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_roll_start(self.to_glib_none().0, start.to_glib())) from_glib(ffi::ges_timeline_element_roll_start(self.as_ref().to_glib_none().0, start.to_glib()))
} }
} }
@ -279,57 +281,56 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn set_duration(&self, duration: gst::ClockTime) { fn set_duration(&self, duration: gst::ClockTime) {
unsafe { unsafe {
ffi::ges_timeline_element_set_duration(self.to_glib_none().0, duration.to_glib()); ffi::ges_timeline_element_set_duration(self.as_ref().to_glib_none().0, duration.to_glib());
} }
} }
fn set_inpoint(&self, inpoint: gst::ClockTime) { fn set_inpoint(&self, inpoint: gst::ClockTime) {
unsafe { unsafe {
ffi::ges_timeline_element_set_inpoint(self.to_glib_none().0, inpoint.to_glib()); ffi::ges_timeline_element_set_inpoint(self.as_ref().to_glib_none().0, inpoint.to_glib());
} }
} }
fn set_max_duration(&self, maxduration: gst::ClockTime) { fn set_max_duration(&self, maxduration: gst::ClockTime) {
unsafe { unsafe {
ffi::ges_timeline_element_set_max_duration(self.to_glib_none().0, maxduration.to_glib()); ffi::ges_timeline_element_set_max_duration(self.as_ref().to_glib_none().0, maxduration.to_glib());
} }
} }
fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> bool { fn set_name<'a, P: Into<Option<&'a str>>>(&self, name: P) -> bool {
let name = name.into(); let name = name.into();
let name = name.to_glib_none();
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_name(self.to_glib_none().0, name.0)) from_glib(ffi::ges_timeline_element_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0))
} }
} }
fn set_parent<P: IsA<TimelineElement>>(&self, parent: &P) -> bool { fn set_parent<P: IsA<TimelineElement>>(&self, parent: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_parent(self.to_glib_none().0, parent.to_glib_none().0)) from_glib(ffi::ges_timeline_element_set_parent(self.as_ref().to_glib_none().0, parent.as_ref().to_glib_none().0))
} }
} }
fn set_priority(&self, priority: u32) { fn set_priority(&self, priority: u32) {
unsafe { unsafe {
ffi::ges_timeline_element_set_priority(self.to_glib_none().0, priority); ffi::ges_timeline_element_set_priority(self.as_ref().to_glib_none().0, priority);
} }
} }
fn set_start(&self, start: gst::ClockTime) { fn set_start(&self, start: gst::ClockTime) {
unsafe { unsafe {
ffi::ges_timeline_element_set_start(self.to_glib_none().0, start.to_glib()); ffi::ges_timeline_element_set_start(self.as_ref().to_glib_none().0, start.to_glib());
} }
} }
fn set_timeline(&self, timeline: &Timeline) -> bool { fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0)) from_glib(ffi::ges_timeline_element_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0))
} }
} }
fn trim(&self, start: gst::ClockTime) -> bool { fn trim(&self, start: gst::ClockTime) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_timeline_element_trim(self.to_glib_none().0, start.to_glib())) from_glib(ffi::ges_timeline_element_trim(self.as_ref().to_glib_none().0, start.to_glib()))
} }
} }
@ -368,7 +369,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -376,7 +377,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::in-point\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::in-point\0".as_ptr() as *const _,
transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -384,7 +385,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-duration\0".as_ptr() as *const _,
transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -392,7 +393,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::name\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::name\0".as_ptr() as *const _,
transmute(notify_name_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_name_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -400,7 +401,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::parent\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::parent\0".as_ptr() as *const _,
transmute(notify_parent_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_parent_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -408,7 +409,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::priority\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _,
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -416,7 +417,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::serialize\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::serialize\0".as_ptr() as *const _,
transmute(notify_serialize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_serialize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -424,7 +425,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::start\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::start\0".as_ptr() as *const _,
transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -432,7 +433,7 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeline\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::timeline\0".as_ptr() as *const _,
transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -441,53 +442,53 @@ impl<O: IsA<TimelineElement>> TimelineElementExt for O {
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_name_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_name_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_parent_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_parent_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_serialize_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_serialize_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> { where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) f(&TimelineElement::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -9,7 +9,7 @@ use ffi;
use glib; use glib;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -17,15 +17,11 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Track(Object<ffi::GESTrack, ffi::GESTrackClass>): [ pub struct Track(Object<ffi::GESTrack, ffi::GESTrackClass, TrackClass>) @extends gst::Element, gst::Object;
gst::Element => gst_ffi::GstElement,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::ges_track_get_type(), get_type => || ffi::ges_track_get_type(),
@ -41,6 +37,8 @@ impl Track {
} }
} }
pub const NONE_TRACK: Option<&Track> = None;
pub trait GESTrackExt: 'static { pub trait GESTrackExt: 'static {
fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError>; fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError>;
@ -62,7 +60,7 @@ pub trait GESTrackExt: 'static {
fn set_restriction_caps(&self, caps: &gst::Caps); fn set_restriction_caps(&self, caps: &gst::Caps);
fn set_timeline(&self, timeline: &Timeline); fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P);
fn update_restriction_caps(&self, caps: &gst::Caps); fn update_restriction_caps(&self, caps: &gst::Caps);
@ -88,43 +86,43 @@ pub trait GESTrackExt: 'static {
impl<O: IsA<Track>> GESTrackExt for O { impl<O: IsA<Track>> GESTrackExt for O {
fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> { fn add_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_track_add_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to add element") glib_result_from_gboolean!(ffi::ges_track_add_element(self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0), "Failed to add element")
} }
} }
fn commit(&self) -> bool { fn commit(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_commit(self.to_glib_none().0)) from_glib(ffi::ges_track_commit(self.as_ref().to_glib_none().0))
} }
} }
fn get_caps(&self) -> Option<gst::Caps> { fn get_caps(&self) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_get_caps(self.to_glib_none().0)) from_glib_none(ffi::ges_track_get_caps(self.as_ref().to_glib_none().0))
} }
} }
fn get_elements(&self) -> Vec<TrackElement> { fn get_elements(&self) -> Vec<TrackElement> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(self.as_ref().to_glib_none().0))
} }
} }
fn get_mixing(&self) -> bool { fn get_mixing(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_get_mixing(self.to_glib_none().0)) from_glib(ffi::ges_track_get_mixing(self.as_ref().to_glib_none().0))
} }
} }
fn get_timeline(&self) -> Option<Timeline> { fn get_timeline(&self) -> Option<Timeline> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_get_timeline(self.to_glib_none().0)) from_glib_none(ffi::ges_track_get_timeline(self.as_ref().to_glib_none().0))
} }
} }
fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> { fn remove_element<P: IsA<TrackElement>>(&self, object: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::ges_track_remove_element(self.to_glib_none().0, object.to_glib_none().0), "Failed to remove element") glib_result_from_gboolean!(ffi::ges_track_remove_element(self.as_ref().to_glib_none().0, object.as_ref().to_glib_none().0), "Failed to remove element")
} }
} }
@ -134,25 +132,25 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn set_mixing(&self, mixing: bool) { fn set_mixing(&self, mixing: bool) {
unsafe { unsafe {
ffi::ges_track_set_mixing(self.to_glib_none().0, mixing.to_glib()); ffi::ges_track_set_mixing(self.as_ref().to_glib_none().0, mixing.to_glib());
} }
} }
fn set_restriction_caps(&self, caps: &gst::Caps) { fn set_restriction_caps(&self, caps: &gst::Caps) {
unsafe { unsafe {
ffi::ges_track_set_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); ffi::ges_track_set_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
} }
} }
fn set_timeline(&self, timeline: &Timeline) { fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) {
unsafe { unsafe {
ffi::ges_track_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); ffi::ges_track_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0);
} }
} }
fn update_restriction_caps(&self, caps: &gst::Caps) { fn update_restriction_caps(&self, caps: &gst::Caps) {
unsafe { unsafe {
ffi::ges_track_update_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); ffi::ges_track_update_restriction_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
} }
} }
@ -183,7 +181,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"commited\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"commited\0".as_ptr() as *const _,
transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -191,7 +189,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"track-element-added\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"track-element-added\0".as_ptr() as *const _,
transmute(track_element_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(track_element_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -199,7 +197,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"track-element-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"track-element-removed\0".as_ptr() as *const _,
transmute(track_element_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(track_element_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -207,7 +205,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -215,7 +213,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_property_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mixing\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mixing\0".as_ptr() as *const _,
transmute(notify_mixing_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mixing_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -223,7 +221,7 @@ impl<O: IsA<Track>> GESTrackExt for O {
fn connect_property_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::restriction-caps\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::restriction-caps\0".as_ptr() as *const _,
transmute(notify_restriction_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_restriction_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -232,35 +230,35 @@ impl<O: IsA<Track>> GESTrackExt for O {
unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTrack, f: glib_ffi::gpointer) unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked()) f(&Track::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn track_element_added_trampoline<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) unsafe extern "C" fn track_element_added_trampoline<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect))
} }
unsafe extern "C" fn track_element_removed_trampoline<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) unsafe extern "C" fn track_element_removed_trampoline<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) f(&Track::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(effect))
} }
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked()) f(&Track::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_mixing_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mixing_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked()) f(&Track::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_restriction_caps_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_restriction_caps_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> { where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked()) f(&Track::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -13,7 +13,7 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -25,13 +25,15 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct TrackElement(Object<ffi::GESTrackElement, ffi::GESTrackElementClass>): TimelineElement, Extractable; pub struct TrackElement(Object<ffi::GESTrackElement, ffi::GESTrackElementClass, TrackElementClass>) @extends TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_track_element_get_type(), get_type => || ffi::ges_track_element_get_type(),
} }
} }
pub const NONE_TRACK_ELEMENT: Option<&TrackElement> = None;
pub trait TrackElementExt: 'static { pub trait TrackElementExt: 'static {
fn add_children_props<P: IsA<gst::Element>>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]); fn add_children_props<P: IsA<gst::Element>>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]);
@ -59,7 +61,7 @@ pub trait TrackElementExt: 'static {
fn set_active(&self, active: bool) -> bool; fn set_active(&self, active: bool) -> bool;
//fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool; //fn set_control_source<P: IsA</*Ignored*/gst::ControlSource>>(&self, source: &P, property_name: &str, binding_type: &str) -> bool;
fn set_track_type(&self, type_: TrackType); fn set_track_type(&self, type_: TrackType);
@ -79,13 +81,13 @@ pub trait TrackElementExt: 'static {
impl<O: IsA<TrackElement>> TrackElementExt for O { impl<O: IsA<TrackElement>> TrackElementExt for O {
fn add_children_props<P: IsA<gst::Element>>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]) { fn add_children_props<P: IsA<gst::Element>>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]) {
unsafe { unsafe {
ffi::ges_track_element_add_children_props(self.to_glib_none().0, element.to_glib_none().0, wanted_categories.to_glib_none().0, blacklist.to_glib_none().0, whitelist.to_glib_none().0); ffi::ges_track_element_add_children_props(self.as_ref().to_glib_none().0, element.as_ref().to_glib_none().0, wanted_categories.to_glib_none().0, blacklist.to_glib_none().0, whitelist.to_glib_none().0);
} }
} }
fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> bool { fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_element_edit(self.to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position)) from_glib(ffi::ges_track_element_edit(self.as_ref().to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position))
} }
} }
@ -99,37 +101,37 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
fn get_element(&self) -> Option<gst::Element> { fn get_element(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_element_get_element(self.to_glib_none().0)) from_glib_none(ffi::ges_track_element_get_element(self.as_ref().to_glib_none().0))
} }
} }
fn get_gnlobject(&self) -> Option<gst::Element> { fn get_gnlobject(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_element_get_gnlobject(self.to_glib_none().0)) from_glib_none(ffi::ges_track_element_get_gnlobject(self.as_ref().to_glib_none().0))
} }
} }
fn get_nleobject(&self) -> Option<gst::Element> { fn get_nleobject(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_element_get_nleobject(self.to_glib_none().0)) from_glib_none(ffi::ges_track_element_get_nleobject(self.as_ref().to_glib_none().0))
} }
} }
fn get_track(&self) -> Option<Track> { fn get_track(&self) -> Option<Track> {
unsafe { unsafe {
from_glib_none(ffi::ges_track_element_get_track(self.to_glib_none().0)) from_glib_none(ffi::ges_track_element_get_track(self.as_ref().to_glib_none().0))
} }
} }
fn get_track_type(&self) -> TrackType { fn get_track_type(&self) -> TrackType {
unsafe { unsafe {
from_glib(ffi::ges_track_element_get_track_type(self.to_glib_none().0)) from_glib(ffi::ges_track_element_get_track_type(self.as_ref().to_glib_none().0))
} }
} }
fn is_active(&self) -> bool { fn is_active(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_element_is_active(self.to_glib_none().0)) from_glib(ffi::ges_track_element_is_active(self.as_ref().to_glib_none().0))
} }
} }
@ -139,23 +141,23 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
fn remove_control_binding(&self, property_name: &str) -> bool { fn remove_control_binding(&self, property_name: &str) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_element_remove_control_binding(self.to_glib_none().0, property_name.to_glib_none().0)) from_glib(ffi::ges_track_element_remove_control_binding(self.as_ref().to_glib_none().0, property_name.to_glib_none().0))
} }
} }
fn set_active(&self, active: bool) -> bool { fn set_active(&self, active: bool) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_track_element_set_active(self.to_glib_none().0, active.to_glib())) from_glib(ffi::ges_track_element_set_active(self.as_ref().to_glib_none().0, active.to_glib()))
} }
} }
//fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool { //fn set_control_source<P: IsA</*Ignored*/gst::ControlSource>>(&self, source: &P, property_name: &str, binding_type: &str) -> bool {
// unsafe { TODO: call ffi::ges_track_element_set_control_source() } // unsafe { TODO: call ffi::ges_track_element_set_control_source() }
//} //}
fn set_track_type(&self, type_: TrackType) { fn set_track_type(&self, type_: TrackType) {
unsafe { unsafe {
ffi::ges_track_element_set_track_type(self.to_glib_none().0, type_.to_glib()); ffi::ges_track_element_set_track_type(self.as_ref().to_glib_none().0, type_.to_glib());
} }
} }
@ -178,7 +180,7 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::active\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _,
transmute(notify_active_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_active_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -186,7 +188,7 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
fn connect_property_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::track\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::track\0".as_ptr() as *const _,
transmute(notify_track_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_track_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -194,7 +196,7 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::track-type\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::track-type\0".as_ptr() as *const _,
transmute(notify_track_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_track_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -203,17 +205,17 @@ impl<O: IsA<TrackElement>> TrackElementExt for O {
unsafe extern "C" fn notify_active_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_active_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> { where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) f(&TrackElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_track_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_track_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> { where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) f(&TrackElement::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_track_type_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_track_type_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> { where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) f(&TrackElement::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -10,7 +10,7 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -21,7 +21,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct UriClip(Object<ffi::GESUriClip, ffi::GESUriClipClass>): Clip, Container, TimelineElement, Extractable; pub struct UriClip(Object<ffi::GESUriClip, ffi::GESUriClipClass, UriClipClass>) @extends Clip, Container, TimelineElement, @implements Extractable;
match fn { match fn {
get_type => || ffi::ges_uri_clip_get_type(), get_type => || ffi::ges_uri_clip_get_type(),
@ -37,6 +37,8 @@ impl UriClip {
} }
} }
pub const NONE_URI_CLIP: Option<&UriClip> = None;
pub trait UriClipExt: 'static { pub trait UriClipExt: 'static {
fn get_uri(&self) -> Option<GString>; fn get_uri(&self) -> Option<GString>;
@ -62,31 +64,31 @@ pub trait UriClipExt: 'static {
impl<O: IsA<UriClip>> UriClipExt for O { impl<O: IsA<UriClip>> UriClipExt for O {
fn get_uri(&self) -> Option<GString> { fn get_uri(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::ges_uri_clip_get_uri(self.to_glib_none().0)) from_glib_none(ffi::ges_uri_clip_get_uri(self.as_ref().to_glib_none().0))
} }
} }
fn is_image(&self) -> bool { fn is_image(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_is_image(self.to_glib_none().0)) from_glib(ffi::ges_uri_clip_is_image(self.as_ref().to_glib_none().0))
} }
} }
fn is_muted(&self) -> bool { fn is_muted(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_is_muted(self.to_glib_none().0)) from_glib(ffi::ges_uri_clip_is_muted(self.as_ref().to_glib_none().0))
} }
} }
fn set_is_image(&self, is_image: bool) { fn set_is_image(&self, is_image: bool) {
unsafe { unsafe {
ffi::ges_uri_clip_set_is_image(self.to_glib_none().0, is_image.to_glib()); ffi::ges_uri_clip_set_is_image(self.as_ref().to_glib_none().0, is_image.to_glib());
} }
} }
fn set_mute(&self, mute: bool) { fn set_mute(&self, mute: bool) {
unsafe { unsafe {
ffi::ges_uri_clip_set_mute(self.to_glib_none().0, mute.to_glib()); ffi::ges_uri_clip_set_mute(self.as_ref().to_glib_none().0, mute.to_glib());
} }
} }
@ -109,7 +111,7 @@ impl<O: IsA<UriClip>> UriClipExt for O {
fn connect_property_is_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_is_image_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::is-image\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::is-image\0".as_ptr() as *const _,
transmute(notify_is_image_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_is_image_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -117,7 +119,7 @@ impl<O: IsA<UriClip>> UriClipExt for O {
fn connect_property_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mute\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _,
transmute(notify_mute_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mute_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -125,7 +127,7 @@ impl<O: IsA<UriClip>> UriClipExt for O {
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _,
transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -134,17 +136,17 @@ impl<O: IsA<UriClip>> UriClipExt for O {
unsafe extern "C" fn notify_is_image_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_is_image_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> { where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked()) f(&UriClip::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_mute_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mute_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> { where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked()) f(&UriClip::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> { where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked()) f(&UriClip::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -7,7 +7,7 @@ use Error;
use UriSourceAsset; use UriSourceAsset;
use ffi; use ffi;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -21,7 +21,7 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct UriClipAsset(Object<ffi::GESUriClipAsset, ffi::GESUriClipAssetClass>): Asset; pub struct UriClipAsset(Object<ffi::GESUriClipAsset, ffi::GESUriClipAssetClass, UriClipAssetClass>) @extends Asset;
match fn { match fn {
get_type => || ffi::ges_uri_clip_asset_get_type(), get_type => || ffi::ges_uri_clip_asset_get_type(),
@ -29,7 +29,7 @@ glib_wrapper! {
} }
impl UriClipAsset { impl UriClipAsset {
//pub fn new<'a, P: Into<Option<&'a gio::Cancellable>>, Q: /*Unimplemented*/gio::AsyncReadyCallback>(uri: &str, cancellable: P, callback: Q) { //pub fn new<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>, R: /*Unimplemented*/gio::AsyncReadyCallback>(uri: &str, cancellable: Q, callback: R) {
// unsafe { TODO: call ffi::ges_uri_clip_asset_new() } // unsafe { TODO: call ffi::ges_uri_clip_asset_new() }
//} //}
@ -43,6 +43,8 @@ impl UriClipAsset {
} }
} }
pub const NONE_URI_CLIP_ASSET: Option<&UriClipAsset> = None;
pub trait UriClipAssetExt: 'static { pub trait UriClipAssetExt: 'static {
fn get_duration(&self) -> gst::ClockTime; fn get_duration(&self) -> gst::ClockTime;
@ -60,25 +62,25 @@ pub trait UriClipAssetExt: 'static {
impl<O: IsA<UriClipAsset>> UriClipAssetExt for O { impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
fn get_duration(&self) -> gst::ClockTime { fn get_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_asset_get_duration(self.to_glib_none().0)) from_glib(ffi::ges_uri_clip_asset_get_duration(self.as_ref().to_glib_none().0))
} }
} }
fn get_info(&self) -> Option<gst_pbutils::DiscovererInfo> { fn get_info(&self) -> Option<gst_pbutils::DiscovererInfo> {
unsafe { unsafe {
from_glib_none(ffi::ges_uri_clip_asset_get_info(const_override(self.to_glib_none().0))) from_glib_none(ffi::ges_uri_clip_asset_get_info(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_stream_assets(&self) -> Vec<UriSourceAsset> { fn get_stream_assets(&self) -> Vec<UriSourceAsset> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_uri_clip_asset_get_stream_assets(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::ges_uri_clip_asset_get_stream_assets(self.as_ref().to_glib_none().0))
} }
} }
fn is_image(&self) -> bool { fn is_image(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::ges_uri_clip_asset_is_image(self.to_glib_none().0)) from_glib(ffi::ges_uri_clip_asset_is_image(self.as_ref().to_glib_none().0))
} }
} }
@ -91,7 +93,7 @@ impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -100,5 +102,5 @@ impl<O: IsA<UriClipAsset>> UriClipAssetExt for O {
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESUriClipAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESUriClipAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClipAsset> { where P: IsA<UriClipAsset> {
let f: &&(Fn(&P) + 'static) = transmute(f); let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClipAsset::from_glib_borrow(this).downcast_unchecked()) f(&UriClipAsset::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -11,13 +11,15 @@ use glib::translate::*;
use gst_pbutils; use gst_pbutils;
glib_wrapper! { glib_wrapper! {
pub struct UriSourceAsset(Object<ffi::GESUriSourceAsset, ffi::GESUriSourceAssetClass>): Asset; pub struct UriSourceAsset(Object<ffi::GESUriSourceAsset, ffi::GESUriSourceAssetClass, UriSourceAssetClass>) @extends Asset;
match fn { match fn {
get_type => || ffi::ges_uri_source_asset_get_type(), get_type => || ffi::ges_uri_source_asset_get_type(),
} }
} }
pub const NONE_URI_SOURCE_ASSET: Option<&UriSourceAsset> = None;
pub trait UriSourceAssetExt: 'static { pub trait UriSourceAssetExt: 'static {
fn get_filesource_asset(&self) -> Option<UriClipAsset>; fn get_filesource_asset(&self) -> Option<UriClipAsset>;
@ -29,19 +31,19 @@ pub trait UriSourceAssetExt: 'static {
impl<O: IsA<UriSourceAsset>> UriSourceAssetExt for O { impl<O: IsA<UriSourceAsset>> UriSourceAssetExt for O {
fn get_filesource_asset(&self) -> Option<UriClipAsset> { fn get_filesource_asset(&self) -> Option<UriClipAsset> {
unsafe { unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.to_glib_none().0)) from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_info(&self) -> Option<gst_pbutils::DiscovererStreamInfo> { fn get_stream_info(&self) -> Option<gst_pbutils::DiscovererStreamInfo> {
unsafe { unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.to_glib_none().0)) from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_uri(&self) -> Option<GString> { fn get_stream_uri(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.to_glib_none().0)) from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -6,7 +6,7 @@ use GLContext;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -14,14 +14,11 @@ use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct GLBaseFilter(Object<ffi::GstGLBaseFilter, ffi::GstGLBaseFilterClass>): [ pub struct GLBaseFilter(Object<ffi::GstGLBaseFilter, ffi::GstGLBaseFilterClass, GLBaseFilterClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_base_filter_get_type(), get_type => || ffi::gst_gl_base_filter_get_type(),
@ -31,6 +28,8 @@ glib_wrapper! {
unsafe impl Send for GLBaseFilter {} unsafe impl Send for GLBaseFilter {}
unsafe impl Sync for GLBaseFilter {} unsafe impl Sync for GLBaseFilter {}
pub const NONE_GL_BASE_FILTER: Option<&GLBaseFilter> = None;
pub trait GLBaseFilterExt: 'static { pub trait GLBaseFilterExt: 'static {
fn get_property_context(&self) -> Option<GLContext>; fn get_property_context(&self) -> Option<GLContext>;
@ -49,7 +48,7 @@ impl<O: IsA<GLBaseFilter>> GLBaseFilterExt for O {
fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_context_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::context\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::context\0".as_ptr() as *const _,
transmute(notify_context_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_context_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -58,5 +57,5 @@ impl<O: IsA<GLBaseFilter>> GLBaseFilterExt for O {
unsafe extern "C" fn notify_context_trampoline<P>(this: *mut ffi::GstGLBaseFilter, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_context_trampoline<P>(this: *mut ffi::GstGLBaseFilter, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<GLBaseFilter> { where P: IsA<GLBaseFilter> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&GLBaseFilter::from_glib_borrow(this).downcast_unchecked()) f(&GLBaseFilter::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -4,14 +4,12 @@
use GLContext; use GLContext;
use ffi; use ffi;
use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct GLColorConvert(Object<ffi::GstGLColorConvert, ffi::GstGLColorConvertClass>): [ pub struct GLColorConvert(Object<ffi::GstGLColorConvert, ffi::GstGLColorConvertClass, GLColorConvertClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_color_convert_get_type(), get_type => || ffi::gst_gl_color_convert_get_type(),
@ -19,10 +17,10 @@ glib_wrapper! {
} }
impl GLColorConvert { impl GLColorConvert {
pub fn new(context: &GLContext) -> GLColorConvert { pub fn new<P: IsA<GLContext>>(context: &P) -> GLColorConvert {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_color_convert_new(context.to_glib_none().0)) from_glib_full(ffi::gst_gl_color_convert_new(context.as_ref().to_glib_none().0))
} }
} }
@ -32,13 +30,15 @@ impl GLColorConvert {
} }
} }
pub fn transform_caps(context: &GLContext, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option<gst::Caps> { pub fn transform_caps<P: IsA<GLContext>>(context: &P, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option<gst::Caps> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_color_convert_transform_caps(context.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) from_glib_full(ffi::gst_gl_color_convert_transform_caps(context.as_ref().to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0))
} }
} }
} }
unsafe impl Send for GLColorConvert {} unsafe impl Send for GLColorConvert {}
unsafe impl Sync for GLColorConvert {} unsafe impl Sync for GLColorConvert {}
pub const NONE_GL_COLOR_CONVERT: Option<&GLColorConvert> = None;

View file

@ -14,14 +14,11 @@ use glib;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct GLContext(Object<ffi::GstGLContext, ffi::GstGLContextClass>): [ pub struct GLContext(Object<ffi::GstGLContext, ffi::GstGLContextClass, GLContextClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_context_get_type(), get_type => || ffi::gst_gl_context_get_type(),
@ -32,7 +29,7 @@ impl GLContext {
pub fn new<P: IsA<GLDisplay>>(display: &P) -> GLContext { pub fn new<P: IsA<GLDisplay>>(display: &P) -> GLContext {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_gl_context_new(display.to_glib_none().0)) from_glib_none(ffi::gst_gl_context_new(display.as_ref().to_glib_none().0))
} }
} }
@ -57,10 +54,12 @@ impl GLContext {
unsafe impl Send for GLContext {} unsafe impl Send for GLContext {}
unsafe impl Sync for GLContext {} unsafe impl Sync for GLContext {}
pub const NONE_GL_CONTEXT: Option<&GLContext> = None;
pub trait GLContextExt: 'static { pub trait GLContextExt: 'static {
fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError>; fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError>;
fn can_share(&self, other_context: &GLContext) -> bool; fn can_share<P: IsA<GLContext>>(&self, other_context: &P) -> bool;
fn check_feature(&self, feature: &str) -> bool; fn check_feature(&self, feature: &str) -> bool;
@ -72,7 +71,7 @@ pub trait GLContextExt: 'static {
fn clear_shader(&self); fn clear_shader(&self);
fn create<'a, P: Into<Option<&'a GLContext>>>(&self, other_context: P) -> Result<(), Error>; fn create<'a, P: IsA<GLContext> + 'a, Q: Into<Option<&'a P>>>(&self, other_context: Q) -> Result<(), Error>;
fn destroy(&self); fn destroy(&self);
@ -92,9 +91,9 @@ pub trait GLContextExt: 'static {
fn is_shared(&self) -> bool; fn is_shared(&self) -> bool;
fn set_shared_with(&self, share: &GLContext); fn set_shared_with<P: IsA<GLContext>>(&self, share: &P);
fn set_window(&self, window: &GLWindow) -> bool; fn set_window<P: IsA<GLWindow>>(&self, window: &P) -> bool;
fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool; fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool;
@ -104,85 +103,84 @@ pub trait GLContextExt: 'static {
impl<O: IsA<GLContext>> GLContextExt for O { impl<O: IsA<GLContext>> GLContextExt for O {
fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError> { fn activate(&self, activate: bool) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_gl_context_activate(self.to_glib_none().0, activate.to_glib()), "Failed to activate OpenGL context") glib_result_from_gboolean!(ffi::gst_gl_context_activate(self.as_ref().to_glib_none().0, activate.to_glib()), "Failed to activate OpenGL context")
} }
} }
fn can_share(&self, other_context: &GLContext) -> bool { fn can_share<P: IsA<GLContext>>(&self, other_context: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_can_share(self.to_glib_none().0, other_context.to_glib_none().0)) from_glib(ffi::gst_gl_context_can_share(self.as_ref().to_glib_none().0, other_context.as_ref().to_glib_none().0))
} }
} }
fn check_feature(&self, feature: &str) -> bool { fn check_feature(&self, feature: &str) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_check_feature(self.to_glib_none().0, feature.to_glib_none().0)) from_glib(ffi::gst_gl_context_check_feature(self.as_ref().to_glib_none().0, feature.to_glib_none().0))
} }
} }
fn check_framebuffer_status(&self, fbo_target: u32) -> bool { fn check_framebuffer_status(&self, fbo_target: u32) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_check_framebuffer_status(self.to_glib_none().0, fbo_target)) from_glib(ffi::gst_gl_context_check_framebuffer_status(self.as_ref().to_glib_none().0, fbo_target))
} }
} }
fn check_gl_version(&self, api: GLAPI, maj: i32, min: i32) -> bool { fn check_gl_version(&self, api: GLAPI, maj: i32, min: i32) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_check_gl_version(self.to_glib_none().0, api.to_glib(), maj, min)) from_glib(ffi::gst_gl_context_check_gl_version(self.as_ref().to_glib_none().0, api.to_glib(), maj, min))
} }
} }
fn clear_framebuffer(&self) { fn clear_framebuffer(&self) {
unsafe { unsafe {
ffi::gst_gl_context_clear_framebuffer(self.to_glib_none().0); ffi::gst_gl_context_clear_framebuffer(self.as_ref().to_glib_none().0);
} }
} }
fn clear_shader(&self) { fn clear_shader(&self) {
unsafe { unsafe {
ffi::gst_gl_context_clear_shader(self.to_glib_none().0); ffi::gst_gl_context_clear_shader(self.as_ref().to_glib_none().0);
} }
} }
fn create<'a, P: Into<Option<&'a GLContext>>>(&self, other_context: P) -> Result<(), Error> { fn create<'a, P: IsA<GLContext> + 'a, Q: Into<Option<&'a P>>>(&self, other_context: Q) -> Result<(), Error> {
let other_context = other_context.into(); let other_context = other_context.into();
let other_context = other_context.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_gl_context_create(self.to_glib_none().0, other_context.0, &mut error); let _ = ffi::gst_gl_context_create(self.as_ref().to_glib_none().0, other_context.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn destroy(&self) { fn destroy(&self) {
unsafe { unsafe {
ffi::gst_gl_context_destroy(self.to_glib_none().0); ffi::gst_gl_context_destroy(self.as_ref().to_glib_none().0);
} }
} }
fn fill_info(&self) -> Result<(), Error> { fn fill_info(&self) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_gl_context_fill_info(self.to_glib_none().0, &mut error); let _ = ffi::gst_gl_context_fill_info(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
fn get_display(&self) -> GLDisplay { fn get_display(&self) -> GLDisplay {
unsafe { unsafe {
from_glib_full(ffi::gst_gl_context_get_display(self.to_glib_none().0)) from_glib_full(ffi::gst_gl_context_get_display(self.as_ref().to_glib_none().0))
} }
} }
fn get_gl_api(&self) -> GLAPI { fn get_gl_api(&self) -> GLAPI {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_get_gl_api(self.to_glib_none().0)) from_glib(ffi::gst_gl_context_get_gl_api(self.as_ref().to_glib_none().0))
} }
} }
fn get_gl_platform(&self) -> GLPlatform { fn get_gl_platform(&self) -> GLPlatform {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_get_gl_platform(self.to_glib_none().0)) from_glib(ffi::gst_gl_context_get_gl_platform(self.as_ref().to_glib_none().0))
} }
} }
@ -190,7 +188,7 @@ impl<O: IsA<GLContext>> GLContextExt for O {
unsafe { unsafe {
let mut major = mem::uninitialized(); let mut major = mem::uninitialized();
let mut minor = mem::uninitialized(); let mut minor = mem::uninitialized();
ffi::gst_gl_context_get_gl_platform_version(self.to_glib_none().0, &mut major, &mut minor); ffi::gst_gl_context_get_gl_platform_version(self.as_ref().to_glib_none().0, &mut major, &mut minor);
(major, minor) (major, minor)
} }
} }
@ -199,44 +197,44 @@ impl<O: IsA<GLContext>> GLContextExt for O {
unsafe { unsafe {
let mut maj = mem::uninitialized(); let mut maj = mem::uninitialized();
let mut min = mem::uninitialized(); let mut min = mem::uninitialized();
ffi::gst_gl_context_get_gl_version(self.to_glib_none().0, &mut maj, &mut min); ffi::gst_gl_context_get_gl_version(self.as_ref().to_glib_none().0, &mut maj, &mut min);
(maj, min) (maj, min)
} }
} }
fn get_window(&self) -> Option<GLWindow> { fn get_window(&self) -> Option<GLWindow> {
unsafe { unsafe {
from_glib_full(ffi::gst_gl_context_get_window(self.to_glib_none().0)) from_glib_full(ffi::gst_gl_context_get_window(self.as_ref().to_glib_none().0))
} }
} }
fn is_shared(&self) -> bool { fn is_shared(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_is_shared(self.to_glib_none().0)) from_glib(ffi::gst_gl_context_is_shared(self.as_ref().to_glib_none().0))
} }
} }
fn set_shared_with(&self, share: &GLContext) { fn set_shared_with<P: IsA<GLContext>>(&self, share: &P) {
unsafe { unsafe {
ffi::gst_gl_context_set_shared_with(self.to_glib_none().0, share.to_glib_none().0); ffi::gst_gl_context_set_shared_with(self.as_ref().to_glib_none().0, share.as_ref().to_glib_none().0);
} }
} }
fn set_window(&self, window: &GLWindow) -> bool { fn set_window<P: IsA<GLWindow>>(&self, window: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_set_window(self.to_glib_none().0, window.to_glib_full())) from_glib(ffi::gst_gl_context_set_window(self.as_ref().to_glib_none().0, window.as_ref().to_glib_full()))
} }
} }
fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool { fn supports_glsl_profile_version(&self, version: GLSLVersion, profile: GLSLProfile) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_context_supports_glsl_profile_version(self.to_glib_none().0, version.to_glib(), profile.to_glib())) from_glib(ffi::gst_gl_context_supports_glsl_profile_version(self.as_ref().to_glib_none().0, version.to_glib(), profile.to_glib()))
} }
} }
fn swap_buffers(&self) { fn swap_buffers(&self) {
unsafe { unsafe {
ffi::gst_gl_context_swap_buffers(self.to_glib_none().0); ffi::gst_gl_context_swap_buffers(self.as_ref().to_glib_none().0);
} }
} }
} }

View file

@ -9,22 +9,19 @@ use GLDisplayType;
use GLWindow; use GLWindow;
use ffi; use ffi;
use glib; use glib;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct GLDisplay(Object<ffi::GstGLDisplay, ffi::GstGLDisplayClass>): [ pub struct GLDisplay(Object<ffi::GstGLDisplay, ffi::GstGLDisplayClass, GLDisplayClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_display_get_type(), get_type => || ffi::gst_gl_display_get_type(),
@ -49,10 +46,12 @@ impl Default for GLDisplay {
unsafe impl Send for GLDisplay {} unsafe impl Send for GLDisplay {}
unsafe impl Sync for GLDisplay {} unsafe impl Sync for GLDisplay {}
pub trait GLDisplayExt: 'static { pub const NONE_GL_DISPLAY: Option<&GLDisplay> = None;
fn add_context(&self, context: &GLContext) -> Result<(), glib::error::BoolError>;
fn create_context(&self, other_context: &GLContext) -> Result<GLContext, Error>; pub trait GLDisplayExt: 'static {
fn add_context<P: IsA<GLContext>>(&self, context: &P) -> Result<(), glib::error::BoolError>;
fn create_context<P: IsA<GLContext>>(&self, other_context: &P) -> Result<GLContext, Error>;
fn create_window(&self) -> Option<GLWindow>; fn create_window(&self) -> Option<GLWindow>;
@ -64,67 +63,67 @@ pub trait GLDisplayExt: 'static {
fn get_handle_type(&self) -> GLDisplayType; fn get_handle_type(&self) -> GLDisplayType;
fn remove_window(&self, window: &GLWindow) -> Result<(), glib::error::BoolError>; fn remove_window<P: IsA<GLWindow>>(&self, window: &P) -> Result<(), glib::error::BoolError>;
fn connect_create_context<F: Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; fn connect_create_context<F: Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
} }
impl<O: IsA<GLDisplay>> GLDisplayExt for O { impl<O: IsA<GLDisplay>> GLDisplayExt for O {
fn add_context(&self, context: &GLContext) -> Result<(), glib::error::BoolError> { fn add_context<P: IsA<GLContext>>(&self, context: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_gl_display_add_context(self.to_glib_none().0, context.to_glib_none().0), "Failed to add OpenGL context") glib_result_from_gboolean!(ffi::gst_gl_display_add_context(self.as_ref().to_glib_none().0, context.as_ref().to_glib_none().0), "Failed to add OpenGL context")
} }
} }
fn create_context(&self, other_context: &GLContext) -> Result<GLContext, Error> { fn create_context<P: IsA<GLContext>>(&self, other_context: &P) -> Result<GLContext, Error> {
unsafe { unsafe {
let mut p_context = ptr::null_mut(); let mut p_context = ptr::null_mut();
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_gl_display_create_context(self.to_glib_none().0, other_context.to_glib_none().0, &mut p_context, &mut error); let _ = ffi::gst_gl_display_create_context(self.as_ref().to_glib_none().0, other_context.as_ref().to_glib_none().0, &mut p_context, &mut error);
if error.is_null() { Ok(from_glib_full(p_context)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(p_context)) } else { Err(from_glib_full(error)) }
} }
} }
fn create_window(&self) -> Option<GLWindow> { fn create_window(&self) -> Option<GLWindow> {
unsafe { unsafe {
from_glib_full(ffi::gst_gl_display_create_window(self.to_glib_none().0)) from_glib_full(ffi::gst_gl_display_create_window(self.as_ref().to_glib_none().0))
} }
} }
fn filter_gl_api(&self, gl_api: GLAPI) { fn filter_gl_api(&self, gl_api: GLAPI) {
unsafe { unsafe {
ffi::gst_gl_display_filter_gl_api(self.to_glib_none().0, gl_api.to_glib()); ffi::gst_gl_display_filter_gl_api(self.as_ref().to_glib_none().0, gl_api.to_glib());
} }
} }
fn get_gl_api(&self) -> GLAPI { fn get_gl_api(&self) -> GLAPI {
unsafe { unsafe {
from_glib(ffi::gst_gl_display_get_gl_api(self.to_glib_none().0)) from_glib(ffi::gst_gl_display_get_gl_api(self.as_ref().to_glib_none().0))
} }
} }
fn get_gl_api_unlocked(&self) -> GLAPI { fn get_gl_api_unlocked(&self) -> GLAPI {
unsafe { unsafe {
from_glib(ffi::gst_gl_display_get_gl_api_unlocked(self.to_glib_none().0)) from_glib(ffi::gst_gl_display_get_gl_api_unlocked(self.as_ref().to_glib_none().0))
} }
} }
fn get_handle_type(&self) -> GLDisplayType { fn get_handle_type(&self) -> GLDisplayType {
unsafe { unsafe {
from_glib(ffi::gst_gl_display_get_handle_type(self.to_glib_none().0)) from_glib(ffi::gst_gl_display_get_handle_type(self.as_ref().to_glib_none().0))
} }
} }
fn remove_window(&self, window: &GLWindow) -> Result<(), glib::error::BoolError> { fn remove_window<P: IsA<GLWindow>>(&self, window: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_gl_display_remove_window(self.to_glib_none().0, window.to_glib_none().0), "Failed to remove window") glib_result_from_gboolean!(ffi::gst_gl_display_remove_window(self.as_ref().to_glib_none().0, window.as_ref().to_glib_none().0), "Failed to remove window")
} }
} }
fn connect_create_context<F: Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_create_context<F: Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &GLContext) -> GLContext + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"create-context\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"create-context\0".as_ptr() as *const _,
transmute(create_context_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(create_context_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -133,5 +132,5 @@ impl<O: IsA<GLDisplay>> GLDisplayExt for O {
unsafe extern "C" fn create_context_trampoline<P>(this: *mut ffi::GstGLDisplay, context: *mut ffi::GstGLContext, f: glib_ffi::gpointer) -> *mut ffi::GstGLContext unsafe extern "C" fn create_context_trampoline<P>(this: *mut ffi::GstGLDisplay, context: *mut ffi::GstGLContext, f: glib_ffi::gpointer) -> *mut ffi::GstGLContext
where P: IsA<GLDisplay> { where P: IsA<GLDisplay> {
let f: &&(Fn(&P, &GLContext) -> GLContext + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &GLContext) -> GLContext + Send + Sync + 'static) = transmute(f);
f(&GLDisplay::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(context)).to_glib_full() f(&GLDisplay::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(context)).to_glib_full()
} }

View file

@ -6,13 +6,9 @@ use GLDisplay;
use ffi; use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct GLDisplayEGL(Object<ffi::GstGLDisplayEGL, ffi::GstGLDisplayEGLClass>): [ pub struct GLDisplayEGL(Object<ffi::GstGLDisplayEGL, ffi::GstGLDisplayEGLClass, GLDisplayEGLClass>) @extends GLDisplay, gst::Object;
GLDisplay,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_display_egl_get_type(), get_type => || ffi::gst_gl_display_egl_get_type(),
@ -44,3 +40,5 @@ impl Default for GLDisplayEGL {
unsafe impl Send for GLDisplayEGL {} unsafe impl Send for GLDisplayEGL {}
unsafe impl Sync for GLDisplayEGL {} unsafe impl Sync for GLDisplayEGL {}
pub const NONE_GL_DISPLAY_EGL: Option<&GLDisplayEGL> = None;

View file

@ -7,13 +7,10 @@ use ffi;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
use std::mem; use std::mem;
glib_wrapper! { glib_wrapper! {
pub struct GLFramebuffer(Object<ffi::GstGLFramebuffer, ffi::GstGLFramebufferClass>): [ pub struct GLFramebuffer(Object<ffi::GstGLFramebuffer, ffi::GstGLFramebufferClass, GLFramebufferClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_framebuffer_get_type(), get_type => || ffi::gst_gl_framebuffer_get_type(),
@ -21,17 +18,17 @@ glib_wrapper! {
} }
impl GLFramebuffer { impl GLFramebuffer {
pub fn new(context: &GLContext) -> GLFramebuffer { pub fn new<P: IsA<GLContext>>(context: &P) -> GLFramebuffer {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_framebuffer_new(context.to_glib_none().0)) from_glib_full(ffi::gst_gl_framebuffer_new(context.as_ref().to_glib_none().0))
} }
} }
pub fn new_with_default_depth(context: &GLContext, width: u32, height: u32) -> GLFramebuffer { pub fn new_with_default_depth<P: IsA<GLContext>>(context: &P, width: u32, height: u32) -> GLFramebuffer {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_gl_framebuffer_new_with_default_depth(context.to_glib_none().0, width, height)) from_glib_none(ffi::gst_gl_framebuffer_new_with_default_depth(context.as_ref().to_glib_none().0, width, height))
} }
} }
} }
@ -39,6 +36,8 @@ impl GLFramebuffer {
unsafe impl Send for GLFramebuffer {} unsafe impl Send for GLFramebuffer {}
unsafe impl Sync for GLFramebuffer {} unsafe impl Sync for GLFramebuffer {}
pub const NONE_GL_FRAMEBUFFER: Option<&GLFramebuffer> = None;
pub trait GLFramebufferExt: 'static { pub trait GLFramebufferExt: 'static {
//fn attach(&self, attachment_point: u32, mem: /*Ignored*/&mut GLBaseMemory); //fn attach(&self, attachment_point: u32, mem: /*Ignored*/&mut GLBaseMemory);
@ -58,7 +57,7 @@ impl<O: IsA<GLFramebuffer>> GLFramebufferExt for O {
fn bind(&self) { fn bind(&self) {
unsafe { unsafe {
ffi::gst_gl_framebuffer_bind(self.to_glib_none().0); ffi::gst_gl_framebuffer_bind(self.as_ref().to_glib_none().0);
} }
} }
@ -70,14 +69,14 @@ impl<O: IsA<GLFramebuffer>> GLFramebufferExt for O {
unsafe { unsafe {
let mut width = mem::uninitialized(); let mut width = mem::uninitialized();
let mut height = mem::uninitialized(); let mut height = mem::uninitialized();
ffi::gst_gl_framebuffer_get_effective_dimensions(self.to_glib_none().0, &mut width, &mut height); ffi::gst_gl_framebuffer_get_effective_dimensions(self.as_ref().to_glib_none().0, &mut width, &mut height);
(width, height) (width, height)
} }
} }
fn get_id(&self) -> u32 { fn get_id(&self) -> u32 {
unsafe { unsafe {
ffi::gst_gl_framebuffer_get_id(self.to_glib_none().0) ffi::gst_gl_framebuffer_get_id(self.as_ref().to_glib_none().0)
} }
} }
} }

View file

@ -4,14 +4,12 @@
use GLContext; use GLContext;
use ffi; use ffi;
use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct GLOverlayCompositor(Object<ffi::GstGLOverlayCompositor, ffi::GstGLOverlayCompositorClass>): [ pub struct GLOverlayCompositor(Object<ffi::GstGLOverlayCompositor, ffi::GstGLOverlayCompositorClass, GLOverlayCompositorClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_overlay_compositor_get_type(), get_type => || ffi::gst_gl_overlay_compositor_get_type(),
@ -19,10 +17,10 @@ glib_wrapper! {
} }
impl GLOverlayCompositor { impl GLOverlayCompositor {
pub fn new(context: &GLContext) -> GLOverlayCompositor { pub fn new<P: IsA<GLContext>>(context: &P) -> GLOverlayCompositor {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_gl_overlay_compositor_new(context.to_glib_none().0)) from_glib_none(ffi::gst_gl_overlay_compositor_new(context.as_ref().to_glib_none().0))
} }
} }
@ -48,3 +46,5 @@ impl GLOverlayCompositor {
unsafe impl Send for GLOverlayCompositor {} unsafe impl Send for GLOverlayCompositor {}
unsafe impl Sync for GLOverlayCompositor {} unsafe impl Sync for GLOverlayCompositor {}
pub const NONE_GL_OVERLAY_COMPOSITOR: Option<&GLOverlayCompositor> = None;

View file

@ -8,21 +8,20 @@ use GLSLStage;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct GLShader(Object<ffi::GstGLShader, ffi::GstGLShaderClass>): [ pub struct GLShader(Object<ffi::GstGLShader, ffi::GstGLShaderClass, GLShaderClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_shader_get_type(), get_type => || ffi::gst_gl_shader_get_type(),
@ -30,39 +29,39 @@ glib_wrapper! {
} }
impl GLShader { impl GLShader {
pub fn new(context: &GLContext) -> GLShader { pub fn new<P: IsA<GLContext>>(context: &P) -> GLShader {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_shader_new(context.to_glib_none().0)) from_glib_full(ffi::gst_gl_shader_new(context.as_ref().to_glib_none().0))
} }
} }
pub fn new_default(context: &GLContext) -> Result<GLShader, Error> { pub fn new_default<P: IsA<GLContext>>(context: &P) -> Result<GLShader, Error> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::gst_gl_shader_new_default(context.to_glib_none().0, &mut error); let ret = ffi::gst_gl_shader_new_default(context.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
//pub fn new_link_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { //pub fn new_link_with_stages<P: IsA<GLContext>>(context: &P, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader {
// unsafe { TODO: call ffi::gst_gl_shader_new_link_with_stages() } // unsafe { TODO: call ffi::gst_gl_shader_new_link_with_stages() }
//} //}
//pub fn new_with_stages(context: &GLContext, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader { //pub fn new_with_stages<P: IsA<GLContext>>(context: &P, error: &mut Error, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> GLShader {
// unsafe { TODO: call ffi::gst_gl_shader_new_with_stages() } // unsafe { TODO: call ffi::gst_gl_shader_new_with_stages() }
//} //}
pub fn attach(&self, stage: &GLSLStage) -> bool { pub fn attach<P: IsA<GLSLStage>>(&self, stage: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0)) from_glib(ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.as_ref().to_glib_none().0))
} }
} }
pub fn attach_unlocked(&self, stage: &GLSLStage) -> bool { pub fn attach_unlocked<P: IsA<GLSLStage>>(&self, stage: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0)) from_glib(ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.as_ref().to_glib_none().0))
} }
} }
@ -78,23 +77,23 @@ impl GLShader {
} }
} }
pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), Error> { pub fn compile_attach_stage<P: IsA<GLSLStage>>(&self, stage: &P) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.to_glib_none().0, &mut error); let _ = ffi::gst_gl_shader_compile_attach_stage(self.to_glib_none().0, stage.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
pub fn detach(&self, stage: &GLSLStage) { pub fn detach<P: IsA<GLSLStage>>(&self, stage: &P) {
unsafe { unsafe {
ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.to_glib_none().0); ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.as_ref().to_glib_none().0);
} }
} }
pub fn detach_unlocked(&self, stage: &GLSLStage) { pub fn detach_unlocked<P: IsA<GLSLStage>>(&self, stage: &P) {
unsafe { unsafe {
ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0); ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.as_ref().to_glib_none().0);
} }
} }
@ -249,7 +248,7 @@ impl GLShader {
pub fn get_property_linked(&self) -> bool { pub fn get_property_linked(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"linked\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -257,7 +256,7 @@ impl GLShader {
pub fn connect_property_linked_notify<F: Fn(&GLShader) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_linked_notify<F: Fn(&GLShader) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLShader) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLShader) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::linked\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::linked\0".as_ptr() as *const _,
transmute(notify_linked_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_linked_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -266,6 +265,8 @@ impl GLShader {
unsafe impl Send for GLShader {} unsafe impl Send for GLShader {}
unsafe impl Sync for GLShader {} unsafe impl Sync for GLShader {}
pub const NONE_GL_SHADER: Option<&GLShader> = None;
unsafe extern "C" fn notify_linked_trampoline(this: *mut ffi::GstGLShader, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_linked_trampoline(this: *mut ffi::GstGLShader, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&GLShader) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&GLShader) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -4,15 +4,13 @@
use GLContext; use GLContext;
use ffi; use ffi;
use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct GLUpload(Object<ffi::GstGLUpload, ffi::GstGLUploadClass>): [ pub struct GLUpload(Object<ffi::GstGLUpload, ffi::GstGLUploadClass, GLUploadClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_upload_get_type(), get_type => || ffi::gst_gl_upload_get_type(),
@ -20,10 +18,10 @@ glib_wrapper! {
} }
impl GLUpload { impl GLUpload {
pub fn new(context: &GLContext) -> GLUpload { pub fn new<P: IsA<GLContext>>(context: &P) -> GLUpload {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_upload_new(context.to_glib_none().0)) from_glib_full(ffi::gst_gl_upload_new(context.as_ref().to_glib_none().0))
} }
} }
@ -42,15 +40,15 @@ impl GLUpload {
} }
} }
pub fn set_context(&self, context: &GLContext) { pub fn set_context<P: IsA<GLContext>>(&self, context: &P) {
unsafe { unsafe {
ffi::gst_gl_upload_set_context(self.to_glib_none().0, context.to_glib_none().0); ffi::gst_gl_upload_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0);
} }
} }
pub fn transform_caps(&self, context: &GLContext, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option<gst::Caps> { pub fn transform_caps<P: IsA<GLContext>>(&self, context: &P, direction: gst::PadDirection, caps: &gst::Caps, filter: &gst::Caps) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_full(ffi::gst_gl_upload_transform_caps(self.to_glib_none().0, context.to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0)) from_glib_full(ffi::gst_gl_upload_transform_caps(self.to_glib_none().0, context.as_ref().to_glib_none().0, direction.to_glib(), caps.to_glib_none().0, filter.to_glib_none().0))
} }
} }
@ -64,3 +62,5 @@ impl GLUpload {
unsafe impl Send for GLUpload {} unsafe impl Send for GLUpload {}
unsafe impl Sync for GLUpload {} unsafe impl Sync for GLUpload {}
pub const NONE_GL_UPLOAD: Option<&GLUpload> = None;

View file

@ -7,21 +7,20 @@ use GLStereoDownmix;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use gst_video; use gst_video;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct GLViewConvert(Object<ffi::GstGLViewConvert, ffi::GstGLViewConvertClass>): [ pub struct GLViewConvert(Object<ffi::GstGLViewConvert, ffi::GstGLViewConvertClass, GLViewConvertClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_view_convert_get_type(), get_type => || ffi::gst_gl_view_convert_get_type(),
@ -54,9 +53,9 @@ impl GLViewConvert {
} }
} }
pub fn set_context(&self, context: &GLContext) { pub fn set_context<P: IsA<GLContext>>(&self, context: &P) {
unsafe { unsafe {
ffi::gst_gl_view_convert_set_context(self.to_glib_none().0, context.to_glib_none().0); ffi::gst_gl_view_convert_set_context(self.to_glib_none().0, context.as_ref().to_glib_none().0);
} }
} }
@ -69,77 +68,77 @@ impl GLViewConvert {
pub fn get_property_downmix_mode(&self) -> GLStereoDownmix { pub fn get_property_downmix_mode(&self) -> GLStereoDownmix {
unsafe { unsafe {
let mut value = Value::from_type(<GLStereoDownmix as StaticType>::static_type()); let mut value = Value::from_type(<GLStereoDownmix as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"downmix-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"downmix-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_downmix_mode(&self, downmix_mode: GLStereoDownmix) { pub fn set_property_downmix_mode(&self, downmix_mode: GLStereoDownmix) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"downmix-mode\0".as_ptr() as *const _, Value::from(&downmix_mode).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"downmix-mode\0".as_ptr() as *const _, Value::from(&downmix_mode).to_glib_none().0);
} }
} }
pub fn get_property_input_flags_override(&self) -> gst_video::VideoMultiviewFlags { pub fn get_property_input_flags_override(&self) -> gst_video::VideoMultiviewFlags {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"input-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"input-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) { pub fn set_property_input_flags_override(&self, input_flags_override: gst_video::VideoMultiviewFlags) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"input-flags-override\0".as_ptr() as *const _, Value::from(&input_flags_override).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"input-flags-override\0".as_ptr() as *const _, Value::from(&input_flags_override).to_glib_none().0);
} }
} }
pub fn get_property_input_mode_override(&self) -> gst_video::VideoMultiviewMode { pub fn get_property_input_mode_override(&self) -> gst_video::VideoMultiviewMode {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewMode as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewMode as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"input-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"input-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) { pub fn set_property_input_mode_override(&self, input_mode_override: gst_video::VideoMultiviewMode) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"input-mode-override\0".as_ptr() as *const _, Value::from(&input_mode_override).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"input-mode-override\0".as_ptr() as *const _, Value::from(&input_mode_override).to_glib_none().0);
} }
} }
pub fn get_property_output_flags_override(&self) -> gst_video::VideoMultiviewFlags { pub fn get_property_output_flags_override(&self) -> gst_video::VideoMultiviewFlags {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"output-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"output-flags-override\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) { pub fn set_property_output_flags_override(&self, output_flags_override: gst_video::VideoMultiviewFlags) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"output-flags-override\0".as_ptr() as *const _, Value::from(&output_flags_override).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"output-flags-override\0".as_ptr() as *const _, Value::from(&output_flags_override).to_glib_none().0);
} }
} }
pub fn get_property_output_mode_override(&self) -> gst_video::VideoMultiviewMode { pub fn get_property_output_mode_override(&self) -> gst_video::VideoMultiviewMode {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewMode as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewMode as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"output-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"output-mode-override\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) { pub fn set_property_output_mode_override(&self, output_mode_override: gst_video::VideoMultiviewMode) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"output-mode-override\0".as_ptr() as *const _, Value::from(&output_mode_override).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"output-mode-override\0".as_ptr() as *const _, Value::from(&output_mode_override).to_glib_none().0);
} }
} }
pub fn connect_property_downmix_mode_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_downmix_mode_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::downmix-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::downmix-mode\0".as_ptr() as *const _,
transmute(notify_downmix_mode_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_downmix_mode_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -147,7 +146,7 @@ impl GLViewConvert {
pub fn connect_property_input_flags_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_input_flags_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::input-flags-override\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::input-flags-override\0".as_ptr() as *const _,
transmute(notify_input_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_input_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -155,7 +154,7 @@ impl GLViewConvert {
pub fn connect_property_input_mode_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_input_mode_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::input-mode-override\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::input-mode-override\0".as_ptr() as *const _,
transmute(notify_input_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_input_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -163,7 +162,7 @@ impl GLViewConvert {
pub fn connect_property_output_flags_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_output_flags_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::output-flags-override\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::output-flags-override\0".as_ptr() as *const _,
transmute(notify_output_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_output_flags_override_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -171,7 +170,7 @@ impl GLViewConvert {
pub fn connect_property_output_mode_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_output_mode_override_notify<F: Fn(&GLViewConvert) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&GLViewConvert) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::output-mode-override\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::output-mode-override\0".as_ptr() as *const _,
transmute(notify_output_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_output_mode_override_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -186,6 +185,8 @@ impl Default for GLViewConvert {
unsafe impl Send for GLViewConvert {} unsafe impl Send for GLViewConvert {}
unsafe impl Sync for GLViewConvert {} unsafe impl Sync for GLViewConvert {}
pub const NONE_GL_VIEW_CONVERT: Option<&GLViewConvert> = None;
unsafe extern "C" fn notify_downmix_mode_trampoline(this: *mut ffi::GstGLViewConvert, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_downmix_mode_trampoline(this: *mut ffi::GstGLViewConvert, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&GLViewConvert) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&GLViewConvert) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -6,23 +6,20 @@ use GLContext;
use GLDisplay; use GLDisplay;
use ffi; use ffi;
use glib::GString; use glib::GString;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gst; use gst;
use gst_ffi;
use libc; use libc;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem; use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct GLWindow(Object<ffi::GstGLWindow, ffi::GstGLWindowClass>): [ pub struct GLWindow(Object<ffi::GstGLWindow, ffi::GstGLWindowClass, GLWindowClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_gl_window_get_type(), get_type => || ffi::gst_gl_window_get_type(),
@ -33,7 +30,7 @@ impl GLWindow {
pub fn new<P: IsA<GLDisplay>>(display: &P) -> GLWindow { pub fn new<P: IsA<GLDisplay>>(display: &P) -> GLWindow {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_gl_window_new(display.to_glib_none().0)) from_glib_full(ffi::gst_gl_window_new(display.as_ref().to_glib_none().0))
} }
} }
} }
@ -41,6 +38,8 @@ impl GLWindow {
unsafe impl Send for GLWindow {} unsafe impl Send for GLWindow {}
unsafe impl Sync for GLWindow {} unsafe impl Sync for GLWindow {}
pub const NONE_GL_WINDOW: Option<&GLWindow> = None;
pub trait GLWindowExt: 'static { pub trait GLWindowExt: 'static {
fn draw(&self); fn draw(&self);
@ -76,13 +75,13 @@ pub trait GLWindowExt: 'static {
impl<O: IsA<GLWindow>> GLWindowExt for O { impl<O: IsA<GLWindow>> GLWindowExt for O {
fn draw(&self) { fn draw(&self) {
unsafe { unsafe {
ffi::gst_gl_window_draw(self.to_glib_none().0); ffi::gst_gl_window_draw(self.as_ref().to_glib_none().0);
} }
} }
fn get_context(&self) -> Option<GLContext> { fn get_context(&self) -> Option<GLContext> {
unsafe { unsafe {
from_glib_full(ffi::gst_gl_window_get_context(self.to_glib_none().0)) from_glib_full(ffi::gst_gl_window_get_context(self.as_ref().to_glib_none().0))
} }
} }
@ -90,75 +89,75 @@ impl<O: IsA<GLWindow>> GLWindowExt for O {
unsafe { unsafe {
let mut width = mem::uninitialized(); let mut width = mem::uninitialized();
let mut height = mem::uninitialized(); let mut height = mem::uninitialized();
ffi::gst_gl_window_get_surface_dimensions(self.to_glib_none().0, &mut width, &mut height); ffi::gst_gl_window_get_surface_dimensions(self.as_ref().to_glib_none().0, &mut width, &mut height);
(width, height) (width, height)
} }
} }
fn handle_events(&self, handle_events: bool) { fn handle_events(&self, handle_events: bool) {
unsafe { unsafe {
ffi::gst_gl_window_handle_events(self.to_glib_none().0, handle_events.to_glib()); ffi::gst_gl_window_handle_events(self.as_ref().to_glib_none().0, handle_events.to_glib());
} }
} }
fn queue_resize(&self) { fn queue_resize(&self) {
unsafe { unsafe {
ffi::gst_gl_window_queue_resize(self.to_glib_none().0); ffi::gst_gl_window_queue_resize(self.as_ref().to_glib_none().0);
} }
} }
fn quit(&self) { fn quit(&self) {
unsafe { unsafe {
ffi::gst_gl_window_quit(self.to_glib_none().0); ffi::gst_gl_window_quit(self.as_ref().to_glib_none().0);
} }
} }
fn resize(&self, width: u32, height: u32) { fn resize(&self, width: u32, height: u32) {
unsafe { unsafe {
ffi::gst_gl_window_resize(self.to_glib_none().0, width, height); ffi::gst_gl_window_resize(self.as_ref().to_glib_none().0, width, height);
} }
} }
fn run(&self) { fn run(&self) {
unsafe { unsafe {
ffi::gst_gl_window_run(self.to_glib_none().0); ffi::gst_gl_window_run(self.as_ref().to_glib_none().0);
} }
} }
fn send_key_event(&self, event_type: &str, key_str: &str) { fn send_key_event(&self, event_type: &str, key_str: &str) {
unsafe { unsafe {
ffi::gst_gl_window_send_key_event(self.to_glib_none().0, event_type.to_glib_none().0, key_str.to_glib_none().0); ffi::gst_gl_window_send_key_event(self.as_ref().to_glib_none().0, event_type.to_glib_none().0, key_str.to_glib_none().0);
} }
} }
fn send_mouse_event(&self, event_type: &str, button: i32, posx: f64, posy: f64) { fn send_mouse_event(&self, event_type: &str, button: i32, posx: f64, posy: f64) {
unsafe { unsafe {
ffi::gst_gl_window_send_mouse_event(self.to_glib_none().0, event_type.to_glib_none().0, button, posx, posy); ffi::gst_gl_window_send_mouse_event(self.as_ref().to_glib_none().0, event_type.to_glib_none().0, button, posx, posy);
} }
} }
fn set_preferred_size(&self, width: i32, height: i32) { fn set_preferred_size(&self, width: i32, height: i32) {
unsafe { unsafe {
ffi::gst_gl_window_set_preferred_size(self.to_glib_none().0, width, height); ffi::gst_gl_window_set_preferred_size(self.as_ref().to_glib_none().0, width, height);
} }
} }
fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> bool { fn set_render_rectangle(&self, x: i32, y: i32, width: i32, height: i32) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_gl_window_set_render_rectangle(self.to_glib_none().0, x, y, width, height)) from_glib(ffi::gst_gl_window_set_render_rectangle(self.as_ref().to_glib_none().0, x, y, width, height))
} }
} }
fn show(&self) { fn show(&self) {
unsafe { unsafe {
ffi::gst_gl_window_show(self.to_glib_none().0); ffi::gst_gl_window_show(self.as_ref().to_glib_none().0);
} }
} }
fn connect_key_event<F: Fn(&Self, &str, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_key_event<F: Fn(&Self, &str, &str) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &str, &str) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &str, &str) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"key-event\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"key-event\0".as_ptr() as *const _,
transmute(key_event_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(key_event_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -166,7 +165,7 @@ impl<O: IsA<GLWindow>> GLWindowExt for O {
fn connect_mouse_event<F: Fn(&Self, &str, i32, f64, f64) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_mouse_event<F: Fn(&Self, &str, i32, f64, f64) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &str, i32, f64, f64) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &str, i32, f64, f64) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"mouse-event\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"mouse-event\0".as_ptr() as *const _,
transmute(mouse_event_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(mouse_event_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -175,11 +174,11 @@ impl<O: IsA<GLWindow>> GLWindowExt for O {
unsafe extern "C" fn key_event_trampoline<P>(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, key: *mut libc::c_char, f: glib_ffi::gpointer) unsafe extern "C" fn key_event_trampoline<P>(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, key: *mut libc::c_char, f: glib_ffi::gpointer)
where P: IsA<GLWindow> { where P: IsA<GLWindow> {
let f: &&(Fn(&P, &str, &str) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &str, &str) + Send + Sync + 'static) = transmute(f);
f(&GLWindow::from_glib_borrow(this).downcast_unchecked(), &GString::from_glib_borrow(id), &GString::from_glib_borrow(key)) f(&GLWindow::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(id), &GString::from_glib_borrow(key))
} }
unsafe extern "C" fn mouse_event_trampoline<P>(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, button: libc::c_int, x: libc::c_double, y: libc::c_double, f: glib_ffi::gpointer) unsafe extern "C" fn mouse_event_trampoline<P>(this: *mut ffi::GstGLWindow, id: *mut libc::c_char, button: libc::c_int, x: libc::c_double, y: libc::c_double, f: glib_ffi::gpointer)
where P: IsA<GLWindow> { where P: IsA<GLWindow> {
let f: &&(Fn(&P, &str, i32, f64, f64) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &str, i32, f64, f64) + Send + Sync + 'static) = transmute(f);
f(&GLWindow::from_glib_borrow(this).downcast_unchecked(), &GString::from_glib_borrow(id), button, x, y) f(&GLWindow::from_glib_borrow(this).unsafe_cast(), &GString::from_glib_borrow(id), button, x, y)
} }

View file

@ -8,15 +8,13 @@ use GLSLProfile;
use GLSLVersion; use GLSLVersion;
use ffi; use ffi;
use glib::GString; use glib::GString;
use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct GLSLStage(Object<ffi::GstGLSLStage, ffi::GstGLSLStageClass>): [ pub struct GLSLStage(Object<ffi::GstGLSLStage, ffi::GstGLSLStageClass, GLSLStageClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_glsl_stage_get_type(), get_type => || ffi::gst_glsl_stage_get_type(),
@ -24,39 +22,39 @@ glib_wrapper! {
} }
impl GLSLStage { impl GLSLStage {
pub fn new(context: &GLContext, type_: u32) -> GLSLStage { pub fn new<P: IsA<GLContext>>(context: &P, type_: u32) -> GLSLStage {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_glsl_stage_new(context.to_glib_none().0, type_)) from_glib_none(ffi::gst_glsl_stage_new(context.as_ref().to_glib_none().0, type_))
} }
} }
pub fn new_default_fragment(context: &GLContext) -> GLSLStage { pub fn new_default_fragment<P: IsA<GLContext>>(context: &P) -> GLSLStage {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_glsl_stage_new_default_fragment(context.to_glib_none().0)) from_glib_none(ffi::gst_glsl_stage_new_default_fragment(context.as_ref().to_glib_none().0))
} }
} }
pub fn new_default_vertex(context: &GLContext) -> GLSLStage { pub fn new_default_vertex<P: IsA<GLContext>>(context: &P) -> GLSLStage {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_glsl_stage_new_default_vertex(context.to_glib_none().0)) from_glib_none(ffi::gst_glsl_stage_new_default_vertex(context.as_ref().to_glib_none().0))
} }
} }
pub fn new_with_string(context: &GLContext, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &str) -> GLSLStage { pub fn new_with_string<P: IsA<GLContext>>(context: &P, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &str) -> GLSLStage {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_none(ffi::gst_glsl_stage_new_with_string(context.to_glib_none().0, type_, version.to_glib(), profile.to_glib(), str.to_glib_none().0)) from_glib_none(ffi::gst_glsl_stage_new_with_string(context.as_ref().to_glib_none().0, type_, version.to_glib(), profile.to_glib(), str.to_glib_none().0))
} }
} }
pub fn new_with_strings(context: &GLContext, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &[&str]) -> GLSLStage { pub fn new_with_strings<P: IsA<GLContext>>(context: &P, type_: u32, version: GLSLVersion, profile: GLSLProfile, str: &[&str]) -> GLSLStage {
skip_assert_initialized!(); skip_assert_initialized!();
let n_strings = str.len() as i32; let n_strings = str.len() as i32;
unsafe { unsafe {
from_glib_none(ffi::gst_glsl_stage_new_with_strings(context.to_glib_none().0, type_, version.to_glib(), profile.to_glib(), n_strings, str.to_glib_none().0)) from_glib_none(ffi::gst_glsl_stage_new_with_strings(context.as_ref().to_glib_none().0, type_, version.to_glib(), profile.to_glib(), n_strings, str.to_glib_none().0))
} }
} }
@ -102,3 +100,5 @@ impl GLSLStage {
unsafe impl Send for GLSLStage {} unsafe impl Send for GLSLStage {}
unsafe impl Sync for GLSLStage {} unsafe impl Sync for GLSLStage {}
pub const NONE_GLSL_STAGE: Option<&GLSLStage> = None;

View file

@ -3,46 +3,46 @@
// DO NOT EDIT // DO NOT EDIT
mod gl_base_filter; mod gl_base_filter;
pub use self::gl_base_filter::GLBaseFilter; pub use self::gl_base_filter::{GLBaseFilter, GLBaseFilterClass, NONE_GL_BASE_FILTER};
pub use self::gl_base_filter::GLBaseFilterExt; pub use self::gl_base_filter::GLBaseFilterExt;
mod gl_color_convert; mod gl_color_convert;
pub use self::gl_color_convert::GLColorConvert; pub use self::gl_color_convert::{GLColorConvert, GLColorConvertClass, NONE_GL_COLOR_CONVERT};
mod gl_context; mod gl_context;
pub use self::gl_context::GLContext; pub use self::gl_context::{GLContext, GLContextClass, NONE_GL_CONTEXT};
pub use self::gl_context::GLContextExt; pub use self::gl_context::GLContextExt;
mod gl_display; mod gl_display;
pub use self::gl_display::GLDisplay; pub use self::gl_display::{GLDisplay, GLDisplayClass, NONE_GL_DISPLAY};
pub use self::gl_display::GLDisplayExt; pub use self::gl_display::GLDisplayExt;
#[cfg(any(feature = "egl", feature = "dox"))] #[cfg(any(feature = "egl", feature = "dox"))]
mod gl_display_egl; mod gl_display_egl;
#[cfg(any(feature = "egl", feature = "dox"))] #[cfg(any(feature = "egl", feature = "dox"))]
pub use self::gl_display_egl::GLDisplayEGL; pub use self::gl_display_egl::{GLDisplayEGL, GLDisplayEGLClass, NONE_GL_DISPLAY_EGL};
mod gl_framebuffer; mod gl_framebuffer;
pub use self::gl_framebuffer::GLFramebuffer; pub use self::gl_framebuffer::{GLFramebuffer, GLFramebufferClass, NONE_GL_FRAMEBUFFER};
pub use self::gl_framebuffer::GLFramebufferExt; pub use self::gl_framebuffer::GLFramebufferExt;
mod gl_overlay_compositor; mod gl_overlay_compositor;
pub use self::gl_overlay_compositor::GLOverlayCompositor; pub use self::gl_overlay_compositor::{GLOverlayCompositor, GLOverlayCompositorClass, NONE_GL_OVERLAY_COMPOSITOR};
mod glsl_stage; mod glsl_stage;
pub use self::glsl_stage::GLSLStage; pub use self::glsl_stage::{GLSLStage, GLSLStageClass, NONE_GLSL_STAGE};
mod gl_shader; mod gl_shader;
pub use self::gl_shader::GLShader; pub use self::gl_shader::{GLShader, GLShaderClass, NONE_GL_SHADER};
mod gl_upload; mod gl_upload;
pub use self::gl_upload::GLUpload; pub use self::gl_upload::{GLUpload, GLUploadClass, NONE_GL_UPLOAD};
mod gl_view_convert; mod gl_view_convert;
pub use self::gl_view_convert::GLViewConvert; pub use self::gl_view_convert::{GLViewConvert, GLViewConvertClass, NONE_GL_VIEW_CONVERT};
mod gl_window; mod gl_window;
pub use self::gl_window::GLWindow; pub use self::gl_window::{GLWindow, GLWindowClass, NONE_GL_WINDOW};
pub use self::gl_window::GLWindowExt; pub use self::gl_window::GLWindowExt;
mod enums; mod enums;

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -3,16 +3,16 @@
// DO NOT EDIT // DO NOT EDIT
mod net_client_clock; mod net_client_clock;
pub use self::net_client_clock::NetClientClock; pub use self::net_client_clock::{NetClientClock, NetClientClockClass, NONE_NET_CLIENT_CLOCK};
mod net_time_provider; mod net_time_provider;
pub use self::net_time_provider::NetTimeProvider; pub use self::net_time_provider::{NetTimeProvider, NetTimeProviderClass, NONE_NET_TIME_PROVIDER};
mod ntp_clock; mod ntp_clock;
pub use self::ntp_clock::NtpClock; pub use self::ntp_clock::{NtpClock, NtpClockClass, NONE_NTP_CLOCK};
mod ptp_clock; mod ptp_clock;
pub use self::ptp_clock::PtpClock; pub use self::ptp_clock::{PtpClock, PtpClockClass, NONE_PTP_CLOCK};
#[doc(hidden)] #[doc(hidden)]
pub mod traits { pub mod traits {

View file

@ -3,24 +3,23 @@
// DO NOT EDIT // DO NOT EDIT
use ffi; use ffi;
use glib;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct NetClientClock(Object<ffi::GstNetClientClock, ffi::GstNetClientClockClass>): [ pub struct NetClientClock(Object<ffi::GstNetClientClock, ffi::GstNetClientClockClass, NetClientClockClass>) @extends gst::Clock, gst::Object;
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_net_client_clock_get_type(), get_type => || ffi::gst_net_client_clock_get_type(),
@ -31,7 +30,7 @@ impl NetClientClock {
pub fn get_property_address(&self) -> Option<GString> { pub fn get_property_address(&self) -> Option<GString> {
unsafe { unsafe {
let mut value = Value::from_type(<GString as StaticType>::static_type()); let mut value = Value::from_type(<GString as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -39,14 +38,14 @@ impl NetClientClock {
pub fn set_property_address<'a, P: Into<Option<&'a str>>>(&self, address: P) { pub fn set_property_address<'a, P: Into<Option<&'a str>>>(&self, address: P) {
let address = address.into(); let address = address.into();
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, Value::from(address).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"address\0".as_ptr() as *const _, Value::from(address).to_glib_none().0);
} }
} }
pub fn get_property_base_time(&self) -> u64 { pub fn get_property_base_time(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"base-time\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"base-time\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -54,21 +53,21 @@ impl NetClientClock {
pub fn get_property_bus(&self) -> Option<gst::Bus> { pub fn get_property_bus(&self) -> Option<gst::Bus> {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Bus as StaticType>::static_type()); let mut value = Value::from_type(<gst::Bus as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"bus\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"bus\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
pub fn set_property_bus(&self, bus: Option<&gst::Bus>) { pub fn set_property_bus<P: IsA<gst::Bus> + glib::value::SetValueOptional>(&self, bus: Option<&P>) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"bus\0".as_ptr() as *const _, Value::from(bus).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"bus\0".as_ptr() as *const _, Value::from(bus).to_glib_none().0);
} }
} }
pub fn get_property_internal_clock(&self) -> Option<gst::Clock> { pub fn get_property_internal_clock(&self) -> Option<gst::Clock> {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Clock as StaticType>::static_type()); let mut value = Value::from_type(<gst::Clock as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -76,63 +75,63 @@ impl NetClientClock {
pub fn get_property_minimum_update_interval(&self) -> u64 { pub fn get_property_minimum_update_interval(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"minimum-update-interval\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"minimum-update-interval\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_minimum_update_interval(&self, minimum_update_interval: u64) { pub fn set_property_minimum_update_interval(&self, minimum_update_interval: u64) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"minimum-update-interval\0".as_ptr() as *const _, Value::from(&minimum_update_interval).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"minimum-update-interval\0".as_ptr() as *const _, Value::from(&minimum_update_interval).to_glib_none().0);
} }
} }
pub fn get_property_port(&self) -> i32 { pub fn get_property_port(&self) -> i32 {
unsafe { unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type()); let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_port(&self, port: i32) { pub fn set_property_port(&self, port: i32) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, Value::from(&port).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"port\0".as_ptr() as *const _, Value::from(&port).to_glib_none().0);
} }
} }
pub fn get_property_qos_dscp(&self) -> i32 { pub fn get_property_qos_dscp(&self) -> i32 {
unsafe { unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type()); let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_qos_dscp(&self, qos_dscp: i32) { pub fn set_property_qos_dscp(&self, qos_dscp: i32) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0);
} }
} }
pub fn get_property_round_trip_limit(&self) -> u64 { pub fn get_property_round_trip_limit(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"round-trip-limit\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"round-trip-limit\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_round_trip_limit(&self, round_trip_limit: u64) { pub fn set_property_round_trip_limit(&self, round_trip_limit: u64) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"round-trip-limit\0".as_ptr() as *const _, Value::from(&round_trip_limit).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"round-trip-limit\0".as_ptr() as *const _, Value::from(&round_trip_limit).to_glib_none().0);
} }
} }
pub fn connect_property_address_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_address_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::address\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _,
transmute(notify_address_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_address_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -140,7 +139,7 @@ impl NetClientClock {
pub fn connect_property_bus_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_bus_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::bus\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::bus\0".as_ptr() as *const _,
transmute(notify_bus_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_bus_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -148,7 +147,7 @@ impl NetClientClock {
pub fn connect_property_internal_clock_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_internal_clock_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::internal-clock\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _,
transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -156,7 +155,7 @@ impl NetClientClock {
pub fn connect_property_minimum_update_interval_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_minimum_update_interval_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::minimum-update-interval\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::minimum-update-interval\0".as_ptr() as *const _,
transmute(notify_minimum_update_interval_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_minimum_update_interval_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -164,7 +163,7 @@ impl NetClientClock {
pub fn connect_property_port_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_port_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::port\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::port\0".as_ptr() as *const _,
transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_port_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -172,7 +171,7 @@ impl NetClientClock {
pub fn connect_property_qos_dscp_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_qos_dscp_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::qos-dscp\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _,
transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -180,7 +179,7 @@ impl NetClientClock {
pub fn connect_property_round_trip_limit_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_round_trip_limit_notify<F: Fn(&NetClientClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetClientClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::round-trip-limit\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::round-trip-limit\0".as_ptr() as *const _,
transmute(notify_round_trip_limit_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_round_trip_limit_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -189,6 +188,8 @@ impl NetClientClock {
unsafe impl Send for NetClientClock {} unsafe impl Send for NetClientClock {}
unsafe impl Sync for NetClientClock {} unsafe impl Sync for NetClientClock {}
pub const NONE_NET_CLIENT_CLOCK: Option<&NetClientClock> = None;
unsafe extern "C" fn notify_address_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_address_trampoline(this: *mut ffi::GstNetClientClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&NetClientClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -6,20 +6,18 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct NetTimeProvider(Object<ffi::GstNetTimeProvider, ffi::GstNetTimeProviderClass>): [ pub struct NetTimeProvider(Object<ffi::GstNetTimeProvider, ffi::GstNetTimeProviderClass, NetTimeProviderClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_net_time_provider_get_type(), get_type => || ffi::gst_net_time_provider_get_type(),
@ -30,21 +28,21 @@ impl NetTimeProvider {
pub fn get_property_active(&self) -> bool { pub fn get_property_active(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"active\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_active(&self, active: bool) { pub fn set_property_active(&self, active: bool) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"active\0".as_ptr() as *const _, Value::from(&active).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"active\0".as_ptr() as *const _, Value::from(&active).to_glib_none().0);
} }
} }
pub fn get_property_address(&self) -> Option<GString> { pub fn get_property_address(&self) -> Option<GString> {
unsafe { unsafe {
let mut value = Value::from_type(<GString as StaticType>::static_type()); let mut value = Value::from_type(<GString as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"address\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -52,7 +50,7 @@ impl NetTimeProvider {
pub fn get_property_clock(&self) -> Option<gst::Clock> { pub fn get_property_clock(&self) -> Option<gst::Clock> {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Clock as StaticType>::static_type()); let mut value = Value::from_type(<gst::Clock as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"clock\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -60,7 +58,7 @@ impl NetTimeProvider {
pub fn get_property_port(&self) -> i32 { pub fn get_property_port(&self) -> i32 {
unsafe { unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type()); let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"port\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -68,21 +66,21 @@ impl NetTimeProvider {
pub fn get_property_qos_dscp(&self) -> i32 { pub fn get_property_qos_dscp(&self) -> i32 {
unsafe { unsafe {
let mut value = Value::from_type(<i32 as StaticType>::static_type()); let mut value = Value::from_type(<i32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"qos-dscp\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_qos_dscp(&self, qos_dscp: i32) { pub fn set_property_qos_dscp(&self, qos_dscp: i32) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"qos-dscp\0".as_ptr() as *const _, Value::from(&qos_dscp).to_glib_none().0);
} }
} }
pub fn connect_property_active_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_active_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::active\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::active\0".as_ptr() as *const _,
transmute(notify_active_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_active_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -90,7 +88,7 @@ impl NetTimeProvider {
pub fn connect_property_qos_dscp_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_qos_dscp_notify<F: Fn(&NetTimeProvider) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&NetTimeProvider) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::qos-dscp\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::qos-dscp\0".as_ptr() as *const _,
transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_qos_dscp_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -99,6 +97,8 @@ impl NetTimeProvider {
unsafe impl Send for NetTimeProvider {} unsafe impl Send for NetTimeProvider {}
unsafe impl Sync for NetTimeProvider {} unsafe impl Sync for NetTimeProvider {}
pub const NONE_NET_TIME_PROVIDER: Option<&NetTimeProvider> = None;
unsafe extern "C" fn notify_active_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_active_trampoline(this: *mut ffi::GstNetTimeProvider, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&NetTimeProvider) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -6,14 +6,9 @@ use NetClientClock;
use ffi; use ffi;
use glib::translate::*; use glib::translate::*;
use gst; use gst;
use gst_ffi;
glib_wrapper! { glib_wrapper! {
pub struct NtpClock(Object<ffi::GstNtpClock, ffi::GstNtpClockClass>): [ pub struct NtpClock(Object<ffi::GstNtpClock, ffi::GstNtpClockClass, NtpClockClass>) @extends NetClientClock, gst::Clock, gst::Object;
NetClientClock,
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_ntp_clock_get_type(), get_type => || ffi::gst_ntp_clock_get_type(),
@ -24,3 +19,5 @@ impl NtpClock {}
unsafe impl Send for NtpClock {} unsafe impl Send for NtpClock {}
unsafe impl Sync for NtpClock {} unsafe impl Sync for NtpClock {}
pub const NONE_NTP_CLOCK: Option<&NtpClock> = None;

View file

@ -5,21 +5,18 @@
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct PtpClock(Object<ffi::GstPtpClock, ffi::GstPtpClockClass>): [ pub struct PtpClock(Object<ffi::GstPtpClock, ffi::GstPtpClockClass, PtpClockClass>) @extends gst::Clock, gst::Object;
gst::Clock => gst_ffi::GstClock,
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_ptp_clock_get_type(), get_type => || ffi::gst_ptp_clock_get_type(),
@ -30,7 +27,7 @@ impl PtpClock {
pub fn get_property_domain(&self) -> u32 { pub fn get_property_domain(&self) -> u32 {
unsafe { unsafe {
let mut value = Value::from_type(<u32 as StaticType>::static_type()); let mut value = Value::from_type(<u32 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"domain\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"domain\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -38,7 +35,7 @@ impl PtpClock {
pub fn get_property_grandmaster_clock_id(&self) -> u64 { pub fn get_property_grandmaster_clock_id(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"grandmaster-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"grandmaster-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -46,7 +43,7 @@ impl PtpClock {
pub fn get_property_internal_clock(&self) -> Option<gst::Clock> { pub fn get_property_internal_clock(&self) -> Option<gst::Clock> {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Clock as StaticType>::static_type()); let mut value = Value::from_type(<gst::Clock as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"internal-clock\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -54,7 +51,7 @@ impl PtpClock {
pub fn get_property_master_clock_id(&self) -> u64 { pub fn get_property_master_clock_id(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"master-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"master-clock-id\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
@ -62,7 +59,7 @@ impl PtpClock {
pub fn connect_property_grandmaster_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_grandmaster_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::grandmaster-clock-id\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::grandmaster-clock-id\0".as_ptr() as *const _,
transmute(notify_grandmaster_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_grandmaster_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -70,7 +67,7 @@ impl PtpClock {
pub fn connect_property_internal_clock_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_internal_clock_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::internal-clock\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::internal-clock\0".as_ptr() as *const _,
transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_internal_clock_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -78,7 +75,7 @@ impl PtpClock {
pub fn connect_property_master_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_master_clock_id_notify<F: Fn(&PtpClock) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&PtpClock) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::master-clock-id\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::master-clock-id\0".as_ptr() as *const _,
transmute(notify_master_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_master_clock_id_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -87,6 +84,8 @@ impl PtpClock {
unsafe impl Send for PtpClock {} unsafe impl Send for PtpClock {}
unsafe impl Sync for PtpClock {} unsafe impl Sync for PtpClock {}
pub const NONE_PTP_CLOCK: Option<&PtpClock> = None;
unsafe extern "C" fn notify_grandmaster_clock_id_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_grandmaster_clock_id_trampoline(this: *mut ffi::GstPtpClock, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&PtpClock) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -6,6 +6,7 @@ use DiscovererInfo;
use Error; use Error;
use ffi; use ffi;
use glib; use glib;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
@ -17,7 +18,7 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct Discoverer(Object<ffi::GstDiscoverer, ffi::GstDiscovererClass>); pub struct Discoverer(Object<ffi::GstDiscoverer, ffi::GstDiscovererClass, DiscovererClass>);
match fn { match fn {
get_type => || ffi::gst_discoverer_get_type(), get_type => || ffi::gst_discoverer_get_type(),
@ -63,7 +64,7 @@ impl Discoverer {
pub fn connect_discovered<F: Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_discovered<F: Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"discovered\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"discovered\0".as_ptr() as *const _,
transmute(discovered_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(discovered_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -71,7 +72,7 @@ impl Discoverer {
pub fn connect_finished<F: Fn(&Discoverer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_finished<F: Fn(&Discoverer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Discoverer) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Discoverer) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"finished\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"finished\0".as_ptr() as *const _,
transmute(finished_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(finished_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -79,7 +80,7 @@ impl Discoverer {
pub fn connect_source_setup<F: Fn(&Discoverer, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_source_setup<F: Fn(&Discoverer, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Discoverer, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Discoverer, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"source-setup\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"source-setup\0".as_ptr() as *const _,
transmute(source_setup_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(source_setup_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -87,7 +88,7 @@ impl Discoverer {
pub fn connect_starting<F: Fn(&Discoverer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_starting<F: Fn(&Discoverer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Discoverer) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Discoverer) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"starting\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"starting\0".as_ptr() as *const _,
transmute(starting_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(starting_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -96,6 +97,8 @@ impl Discoverer {
unsafe impl Send for Discoverer {} unsafe impl Send for Discoverer {}
unsafe impl Sync for Discoverer {} unsafe impl Sync for Discoverer {}
pub const NONE_DISCOVERER: Option<&Discoverer> = None;
unsafe extern "C" fn discovered_trampoline(this: *mut ffi::GstDiscoverer, info: *mut ffi::GstDiscovererInfo, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) { unsafe extern "C" fn discovered_trampoline(this: *mut ffi::GstDiscoverer, info: *mut ffi::GstDiscovererInfo, error: *mut glib_ffi::GError, f: glib_ffi::gpointer) {
let f: &&(Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&Discoverer, &DiscovererInfo, &Option<Error>) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this), &from_glib_borrow(info), &from_glib_borrow(error)) f(&from_glib_borrow(this), &from_glib_borrow(info), &from_glib_borrow(error))

View file

@ -8,7 +8,7 @@ use glib::GString;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererAudioInfo(Object<ffi::GstDiscovererAudioInfo>): DiscovererStreamInfo; pub struct DiscovererAudioInfo(Object<ffi::GstDiscovererAudioInfo, DiscovererAudioInfoClass>) @extends DiscovererStreamInfo;
match fn { match fn {
get_type => || ffi::gst_discoverer_audio_info_get_type(), get_type => || ffi::gst_discoverer_audio_info_get_type(),
@ -62,3 +62,5 @@ impl DiscovererAudioInfo {
unsafe impl Send for DiscovererAudioInfo {} unsafe impl Send for DiscovererAudioInfo {}
unsafe impl Sync for DiscovererAudioInfo {} unsafe impl Sync for DiscovererAudioInfo {}
pub const NONE_DISCOVERER_AUDIO_INFO: Option<&DiscovererAudioInfo> = None;

View file

@ -7,7 +7,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererContainerInfo(Object<ffi::GstDiscovererContainerInfo>): DiscovererStreamInfo; pub struct DiscovererContainerInfo(Object<ffi::GstDiscovererContainerInfo, DiscovererContainerInfoClass>) @extends DiscovererStreamInfo;
match fn { match fn {
get_type => || ffi::gst_discoverer_container_info_get_type(), get_type => || ffi::gst_discoverer_container_info_get_type(),
@ -24,3 +24,5 @@ impl DiscovererContainerInfo {
unsafe impl Send for DiscovererContainerInfo {} unsafe impl Send for DiscovererContainerInfo {}
unsafe impl Sync for DiscovererContainerInfo {} unsafe impl Sync for DiscovererContainerInfo {}
pub const NONE_DISCOVERER_CONTAINER_INFO: Option<&DiscovererContainerInfo> = None;

View file

@ -13,7 +13,7 @@ use glib::translate::*;
use gst; use gst;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererInfo(Object<ffi::GstDiscovererInfo>); pub struct DiscovererInfo(Object<ffi::GstDiscovererInfo, DiscovererInfoClass>);
match fn { match fn {
get_type => || ffi::gst_discoverer_info_get_type(), get_type => || ffi::gst_discoverer_info_get_type(),
@ -32,6 +32,8 @@ impl DiscovererInfo {
unsafe impl Send for DiscovererInfo {} unsafe impl Send for DiscovererInfo {}
unsafe impl Sync for DiscovererInfo {} unsafe impl Sync for DiscovererInfo {}
pub const NONE_DISCOVERER_INFO: Option<&DiscovererInfo> = None;
pub trait DiscovererInfoExt: 'static { pub trait DiscovererInfoExt: 'static {
fn copy(&self) -> DiscovererInfo; fn copy(&self) -> DiscovererInfo;
@ -74,110 +76,110 @@ pub trait DiscovererInfoExt: 'static {
impl<O: IsA<DiscovererInfo>> DiscovererInfoExt for O { impl<O: IsA<DiscovererInfo>> DiscovererInfoExt for O {
fn copy(&self) -> DiscovererInfo { fn copy(&self) -> DiscovererInfo {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_info_copy(self.to_glib_none().0)) from_glib_full(ffi::gst_discoverer_info_copy(self.as_ref().to_glib_none().0))
} }
} }
fn get_audio_streams(&self) -> Vec<DiscovererStreamInfo> { fn get_audio_streams(&self) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams(self.as_ref().to_glib_none().0))
} }
} }
fn get_container_streams(&self) -> Vec<DiscovererStreamInfo> { fn get_container_streams(&self) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams(self.as_ref().to_glib_none().0))
} }
} }
fn get_duration(&self) -> gst::ClockTime { fn get_duration(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_discoverer_info_get_duration(const_override(self.to_glib_none().0))) from_glib(ffi::gst_discoverer_info_get_duration(const_override(self.as_ref().to_glib_none().0)))
} }
} }
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
fn get_live(&self) -> bool { fn get_live(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_discoverer_info_get_live(const_override(self.to_glib_none().0))) from_glib(ffi::gst_discoverer_info_get_live(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_misc(&self) -> Option<gst::Structure> { fn get_misc(&self) -> Option<gst::Structure> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_info_get_misc(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_discoverer_info_get_misc(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_missing_elements_installer_details(&self) -> Vec<GString> { fn get_missing_elements_installer_details(&self) -> Vec<GString> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_discoverer_info_get_missing_elements_installer_details(const_override(self.to_glib_none().0))) FromGlibPtrContainer::from_glib_none(ffi::gst_discoverer_info_get_missing_elements_installer_details(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_result(&self) -> DiscovererResult { fn get_result(&self) -> DiscovererResult {
unsafe { unsafe {
from_glib(ffi::gst_discoverer_info_get_result(const_override(self.to_glib_none().0))) from_glib(ffi::gst_discoverer_info_get_result(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_seekable(&self) -> bool { fn get_seekable(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_discoverer_info_get_seekable(const_override(self.to_glib_none().0))) from_glib(ffi::gst_discoverer_info_get_seekable(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_stream_info(&self) -> Option<DiscovererStreamInfo> { fn get_stream_info(&self) -> Option<DiscovererStreamInfo> {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_info_get_stream_info(self.to_glib_none().0)) from_glib_full(ffi::gst_discoverer_info_get_stream_info(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_list(&self) -> Vec<DiscovererStreamInfo> { fn get_stream_list(&self) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list(self.as_ref().to_glib_none().0))
} }
} }
fn get_streams(&self, streamtype: glib::types::Type) -> Vec<DiscovererStreamInfo> { fn get_streams(&self, streamtype: glib::types::Type) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams(self.to_glib_none().0, streamtype.to_glib())) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams(self.as_ref().to_glib_none().0, streamtype.to_glib()))
} }
} }
fn get_subtitle_streams(&self) -> Vec<DiscovererStreamInfo> { fn get_subtitle_streams(&self) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams(self.as_ref().to_glib_none().0))
} }
} }
fn get_tags(&self) -> Option<gst::TagList> { fn get_tags(&self) -> Option<gst::TagList> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_info_get_tags(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_discoverer_info_get_tags(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_toc(&self) -> Option<gst::Toc> { fn get_toc(&self) -> Option<gst::Toc> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_info_get_toc(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_discoverer_info_get_toc(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_uri(&self) -> Option<GString> { fn get_uri(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_info_get_uri(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_discoverer_info_get_uri(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_video_streams(&self) -> Vec<DiscovererStreamInfo> { fn get_video_streams(&self) -> Vec<DiscovererStreamInfo> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams(self.as_ref().to_glib_none().0))
} }
} }
fn to_variant(&self, flags: DiscovererSerializeFlags) -> Option<glib::Variant> { fn to_variant(&self, flags: DiscovererSerializeFlags) -> Option<glib::Variant> {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_info_to_variant(self.to_glib_none().0, flags.to_glib())) from_glib_full(ffi::gst_discoverer_info_to_variant(self.as_ref().to_glib_none().0, flags.to_glib()))
} }
} }
} }

View file

@ -9,7 +9,7 @@ use glib::translate::*;
use gst; use gst;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererStreamInfo(Object<ffi::GstDiscovererStreamInfo>); pub struct DiscovererStreamInfo(Object<ffi::GstDiscovererStreamInfo, DiscovererStreamInfoClass>);
match fn { match fn {
get_type => || ffi::gst_discoverer_stream_info_get_type(), get_type => || ffi::gst_discoverer_stream_info_get_type(),
@ -19,6 +19,8 @@ glib_wrapper! {
unsafe impl Send for DiscovererStreamInfo {} unsafe impl Send for DiscovererStreamInfo {}
unsafe impl Sync for DiscovererStreamInfo {} unsafe impl Sync for DiscovererStreamInfo {}
pub const NONE_DISCOVERER_STREAM_INFO: Option<&DiscovererStreamInfo> = None;
pub trait DiscovererStreamInfoExt: 'static { pub trait DiscovererStreamInfoExt: 'static {
fn get_caps(&self) -> Option<gst::Caps>; fn get_caps(&self) -> Option<gst::Caps>;
@ -40,49 +42,49 @@ pub trait DiscovererStreamInfoExt: 'static {
impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExt for O { impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExt for O {
fn get_caps(&self) -> Option<gst::Caps> { fn get_caps(&self) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_stream_info_get_caps(self.to_glib_none().0)) from_glib_full(ffi::gst_discoverer_stream_info_get_caps(self.as_ref().to_glib_none().0))
} }
} }
fn get_misc(&self) -> Option<gst::Structure> { fn get_misc(&self) -> Option<gst::Structure> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_stream_info_get_misc(self.to_glib_none().0)) from_glib_none(ffi::gst_discoverer_stream_info_get_misc(self.as_ref().to_glib_none().0))
} }
} }
fn get_next(&self) -> Option<DiscovererStreamInfo> { fn get_next(&self) -> Option<DiscovererStreamInfo> {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_stream_info_get_next(self.to_glib_none().0)) from_glib_full(ffi::gst_discoverer_stream_info_get_next(self.as_ref().to_glib_none().0))
} }
} }
fn get_previous(&self) -> Option<DiscovererStreamInfo> { fn get_previous(&self) -> Option<DiscovererStreamInfo> {
unsafe { unsafe {
from_glib_full(ffi::gst_discoverer_stream_info_get_previous(self.to_glib_none().0)) from_glib_full(ffi::gst_discoverer_stream_info_get_previous(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_id(&self) -> Option<GString> { fn get_stream_id(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id(self.to_glib_none().0)) from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_type_nick(&self) -> GString { fn get_stream_type_nick(&self) -> GString {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_stream_info_get_stream_type_nick(self.to_glib_none().0)) from_glib_none(ffi::gst_discoverer_stream_info_get_stream_type_nick(self.as_ref().to_glib_none().0))
} }
} }
fn get_tags(&self) -> Option<gst::TagList> { fn get_tags(&self) -> Option<gst::TagList> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_stream_info_get_tags(self.to_glib_none().0)) from_glib_none(ffi::gst_discoverer_stream_info_get_tags(self.as_ref().to_glib_none().0))
} }
} }
fn get_toc(&self) -> Option<gst::Toc> { fn get_toc(&self) -> Option<gst::Toc> {
unsafe { unsafe {
from_glib_none(ffi::gst_discoverer_stream_info_get_toc(self.to_glib_none().0)) from_glib_none(ffi::gst_discoverer_stream_info_get_toc(self.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -8,7 +8,7 @@ use glib::GString;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererSubtitleInfo(Object<ffi::GstDiscovererSubtitleInfo>): DiscovererStreamInfo; pub struct DiscovererSubtitleInfo(Object<ffi::GstDiscovererSubtitleInfo, DiscovererSubtitleInfoClass>) @extends DiscovererStreamInfo;
match fn { match fn {
get_type => || ffi::gst_discoverer_subtitle_info_get_type(), get_type => || ffi::gst_discoverer_subtitle_info_get_type(),
@ -25,3 +25,5 @@ impl DiscovererSubtitleInfo {
unsafe impl Send for DiscovererSubtitleInfo {} unsafe impl Send for DiscovererSubtitleInfo {}
unsafe impl Sync for DiscovererSubtitleInfo {} unsafe impl Sync for DiscovererSubtitleInfo {}
pub const NONE_DISCOVERER_SUBTITLE_INFO: Option<&DiscovererSubtitleInfo> = None;

View file

@ -7,7 +7,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct DiscovererVideoInfo(Object<ffi::GstDiscovererVideoInfo>): DiscovererStreamInfo; pub struct DiscovererVideoInfo(Object<ffi::GstDiscovererVideoInfo, DiscovererVideoInfoClass>) @extends DiscovererStreamInfo;
match fn { match fn {
get_type => || ffi::gst_discoverer_video_info_get_type(), get_type => || ffi::gst_discoverer_video_info_get_type(),
@ -60,3 +60,5 @@ impl DiscovererVideoInfo {
unsafe impl Send for DiscovererVideoInfo {} unsafe impl Send for DiscovererVideoInfo {}
unsafe impl Sync for DiscovererVideoInfo {} unsafe impl Sync for DiscovererVideoInfo {}
pub const NONE_DISCOVERER_VIDEO_INFO: Option<&DiscovererVideoInfo> = None;

View file

@ -7,7 +7,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct EncodingAudioProfile(Object<ffi::GstEncodingAudioProfile, ffi::GstEncodingAudioProfileClass>): EncodingProfile; pub struct EncodingAudioProfile(Object<ffi::GstEncodingAudioProfile, ffi::GstEncodingAudioProfileClass, EncodingAudioProfileClass>) @extends EncodingProfile;
match fn { match fn {
get_type => || ffi::gst_encoding_audio_profile_get_type(), get_type => || ffi::gst_encoding_audio_profile_get_type(),
@ -18,3 +18,5 @@ impl EncodingAudioProfile {}
unsafe impl Send for EncodingAudioProfile {} unsafe impl Send for EncodingAudioProfile {}
unsafe impl Sync for EncodingAudioProfile {} unsafe impl Sync for EncodingAudioProfile {}
pub const NONE_ENCODING_AUDIO_PROFILE: Option<&EncodingAudioProfile> = None;

View file

@ -8,7 +8,7 @@ use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct EncodingContainerProfile(Object<ffi::GstEncodingContainerProfile, ffi::GstEncodingContainerProfileClass>): EncodingProfile; pub struct EncodingContainerProfile(Object<ffi::GstEncodingContainerProfile, ffi::GstEncodingContainerProfileClass, EncodingContainerProfileClass>) @extends EncodingProfile;
match fn { match fn {
get_type => || ffi::gst_encoding_container_profile_get_type(), get_type => || ffi::gst_encoding_container_profile_get_type(),
@ -18,6 +18,8 @@ glib_wrapper! {
unsafe impl Send for EncodingContainerProfile {} unsafe impl Send for EncodingContainerProfile {}
unsafe impl Sync for EncodingContainerProfile {} unsafe impl Sync for EncodingContainerProfile {}
pub const NONE_ENCODING_CONTAINER_PROFILE: Option<&EncodingContainerProfile> = None;
pub trait EncodingContainerProfileExt: 'static { pub trait EncodingContainerProfileExt: 'static {
fn contains_profile<P: IsA<EncodingProfile>>(&self, profile: &P) -> bool; fn contains_profile<P: IsA<EncodingProfile>>(&self, profile: &P) -> bool;
@ -27,13 +29,13 @@ pub trait EncodingContainerProfileExt: 'static {
impl<O: IsA<EncodingContainerProfile>> EncodingContainerProfileExt for O { impl<O: IsA<EncodingContainerProfile>> EncodingContainerProfileExt for O {
fn contains_profile<P: IsA<EncodingProfile>>(&self, profile: &P) -> bool { fn contains_profile<P: IsA<EncodingProfile>>(&self, profile: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_encoding_container_profile_contains_profile(self.to_glib_none().0, profile.to_glib_none().0)) from_glib(ffi::gst_encoding_container_profile_contains_profile(self.as_ref().to_glib_none().0, profile.as_ref().to_glib_none().0))
} }
} }
fn get_profiles(&self) -> Vec<EncodingProfile> { fn get_profiles(&self) -> Vec<EncodingProfile> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_container_profile_get_profiles(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_container_profile_get_profiles(self.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -10,7 +10,7 @@ use glib::translate::*;
use gst; use gst;
glib_wrapper! { glib_wrapper! {
pub struct EncodingProfile(Object<ffi::GstEncodingProfile, ffi::GstEncodingProfileClass>); pub struct EncodingProfile(Object<ffi::GstEncodingProfile, ffi::GstEncodingProfileClass, EncodingProfileClass>);
match fn { match fn {
get_type => || ffi::gst_encoding_profile_get_type(), get_type => || ffi::gst_encoding_profile_get_type(),
@ -21,18 +21,16 @@ impl EncodingProfile {
pub fn find<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(targetname: &str, profilename: P, category: Q) -> Option<EncodingProfile> { pub fn find<'a, 'b, P: Into<Option<&'a str>>, Q: Into<Option<&'b str>>>(targetname: &str, profilename: P, category: Q) -> Option<EncodingProfile> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let profilename = profilename.into(); let profilename = profilename.into();
let profilename = profilename.to_glib_none();
let category = category.into(); let category = category.into();
let category = category.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_find(targetname.to_glib_none().0, profilename.0, category.0)) from_glib_full(ffi::gst_encoding_profile_find(targetname.to_glib_none().0, profilename.to_glib_none().0, category.to_glib_none().0))
} }
} }
pub fn from_discoverer(info: &DiscovererInfo) -> Option<EncodingProfile> { pub fn from_discoverer<P: IsA<DiscovererInfo>>(info: &P) -> Option<EncodingProfile> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_from_discoverer(info.to_glib_none().0)) from_glib_full(ffi::gst_encoding_profile_from_discoverer(info.as_ref().to_glib_none().0))
} }
} }
} }
@ -40,6 +38,8 @@ impl EncodingProfile {
unsafe impl Send for EncodingProfile {} unsafe impl Send for EncodingProfile {}
unsafe impl Sync for EncodingProfile {} unsafe impl Sync for EncodingProfile {}
pub const NONE_ENCODING_PROFILE: Option<&EncodingProfile> = None;
pub trait EncodingProfileExt: 'static { pub trait EncodingProfileExt: 'static {
fn copy(&self) -> EncodingProfile; fn copy(&self) -> EncodingProfile;
@ -73,85 +73,85 @@ pub trait EncodingProfileExt: 'static {
impl<O: IsA<EncodingProfile>> EncodingProfileExt for O { impl<O: IsA<EncodingProfile>> EncodingProfileExt for O {
fn copy(&self) -> EncodingProfile { fn copy(&self) -> EncodingProfile {
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_copy(self.to_glib_none().0)) from_glib_full(ffi::gst_encoding_profile_copy(self.as_ref().to_glib_none().0))
} }
} }
fn get_allow_dynamic_output(&self) -> bool { fn get_allow_dynamic_output(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_encoding_profile_get_allow_dynamic_output(self.to_glib_none().0)) from_glib(ffi::gst_encoding_profile_get_allow_dynamic_output(self.as_ref().to_glib_none().0))
} }
} }
fn get_description(&self) -> Option<GString> { fn get_description(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_description(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_description(self.as_ref().to_glib_none().0))
} }
} }
fn get_file_extension(&self) -> Option<GString> { fn get_file_extension(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_file_extension(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_file_extension(self.as_ref().to_glib_none().0))
} }
} }
fn get_format(&self) -> gst::Caps { fn get_format(&self) -> gst::Caps {
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_get_format(self.to_glib_none().0)) from_glib_full(ffi::gst_encoding_profile_get_format(self.as_ref().to_glib_none().0))
} }
} }
fn get_input_caps(&self) -> gst::Caps { fn get_input_caps(&self) -> gst::Caps {
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_get_input_caps(self.to_glib_none().0)) from_glib_full(ffi::gst_encoding_profile_get_input_caps(self.as_ref().to_glib_none().0))
} }
} }
fn get_name(&self) -> Option<GString> { fn get_name(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_name(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_name(self.as_ref().to_glib_none().0))
} }
} }
fn get_presence(&self) -> u32 { fn get_presence(&self) -> u32 {
unsafe { unsafe {
ffi::gst_encoding_profile_get_presence(self.to_glib_none().0) ffi::gst_encoding_profile_get_presence(self.as_ref().to_glib_none().0)
} }
} }
fn get_preset(&self) -> Option<GString> { fn get_preset(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_preset(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_preset(self.as_ref().to_glib_none().0))
} }
} }
fn get_preset_name(&self) -> Option<GString> { fn get_preset_name(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_preset_name(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_preset_name(self.as_ref().to_glib_none().0))
} }
} }
fn get_restriction(&self) -> Option<gst::Caps> { fn get_restriction(&self) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_profile_get_restriction(self.to_glib_none().0)) from_glib_full(ffi::gst_encoding_profile_get_restriction(self.as_ref().to_glib_none().0))
} }
} }
fn get_type_nick(&self) -> Option<GString> { fn get_type_nick(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_profile_get_type_nick(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_profile_get_type_nick(self.as_ref().to_glib_none().0))
} }
} }
fn is_enabled(&self) -> bool { fn is_enabled(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_encoding_profile_is_enabled(self.to_glib_none().0)) from_glib(ffi::gst_encoding_profile_is_enabled(self.as_ref().to_glib_none().0))
} }
} }
fn is_equal<P: IsA<EncodingProfile>>(&self, b: &P) -> bool { fn is_equal<P: IsA<EncodingProfile>>(&self, b: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_encoding_profile_is_equal(self.to_glib_none().0, b.to_glib_none().0)) from_glib(ffi::gst_encoding_profile_is_equal(self.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -12,7 +12,7 @@ use std;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct EncodingTarget(Object<ffi::GstEncodingTarget>); pub struct EncodingTarget(Object<ffi::GstEncodingTarget, EncodingTargetClass>);
match fn { match fn {
get_type => || ffi::gst_encoding_target_get_type(), get_type => || ffi::gst_encoding_target_get_type(),
@ -30,10 +30,9 @@ impl EncodingTarget {
pub fn load<'a, P: Into<Option<&'a str>>>(name: &str, category: P) -> Result<EncodingTarget, Error> { pub fn load<'a, P: Into<Option<&'a str>>>(name: &str, category: P) -> Result<EncodingTarget, Error> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let category = category.into(); let category = category.into();
let category = category.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::gst_encoding_target_load(name.to_glib_none().0, category.0, &mut error); let ret = ffi::gst_encoding_target_load(name.to_glib_none().0, category.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
@ -51,6 +50,8 @@ impl EncodingTarget {
unsafe impl Send for EncodingTarget {} unsafe impl Send for EncodingTarget {}
unsafe impl Sync for EncodingTarget {} unsafe impl Sync for EncodingTarget {}
pub const NONE_ENCODING_TARGET: Option<&EncodingTarget> = None;
pub trait EncodingTargetExt: 'static { pub trait EncodingTargetExt: 'static {
fn get_category(&self) -> GString; fn get_category(&self) -> GString;
@ -70,38 +71,38 @@ pub trait EncodingTargetExt: 'static {
impl<O: IsA<EncodingTarget>> EncodingTargetExt for O { impl<O: IsA<EncodingTarget>> EncodingTargetExt for O {
fn get_category(&self) -> GString { fn get_category(&self) -> GString {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_target_get_category(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_target_get_category(self.as_ref().to_glib_none().0))
} }
} }
fn get_description(&self) -> GString { fn get_description(&self) -> GString {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_target_get_description(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_target_get_description(self.as_ref().to_glib_none().0))
} }
} }
fn get_name(&self) -> GString { fn get_name(&self) -> GString {
unsafe { unsafe {
from_glib_none(ffi::gst_encoding_target_get_name(self.to_glib_none().0)) from_glib_none(ffi::gst_encoding_target_get_name(self.as_ref().to_glib_none().0))
} }
} }
fn get_profile(&self, name: &str) -> Option<EncodingProfile> { fn get_profile(&self, name: &str) -> Option<EncodingProfile> {
unsafe { unsafe {
from_glib_full(ffi::gst_encoding_target_get_profile(self.to_glib_none().0, name.to_glib_none().0)) from_glib_full(ffi::gst_encoding_target_get_profile(self.as_ref().to_glib_none().0, name.to_glib_none().0))
} }
} }
fn get_profiles(&self) -> Vec<EncodingProfile> { fn get_profiles(&self) -> Vec<EncodingProfile> {
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_target_get_profiles(self.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::gst_encoding_target_get_profiles(self.as_ref().to_glib_none().0))
} }
} }
fn save(&self) -> Result<(), Error> { fn save(&self) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_encoding_target_save(self.to_glib_none().0, &mut error); let _ = ffi::gst_encoding_target_save(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }
@ -109,7 +110,7 @@ impl<O: IsA<EncodingTarget>> EncodingTargetExt for O {
fn save_to_file<P: AsRef<std::path::Path>>(&self, filepath: P) -> Result<(), Error> { fn save_to_file<P: AsRef<std::path::Path>>(&self, filepath: P) -> Result<(), Error> {
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let _ = ffi::gst_encoding_target_save_to_file(self.to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error); let _ = ffi::gst_encoding_target_save_to_file(self.as_ref().to_glib_none().0, filepath.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
} }
} }

View file

@ -7,7 +7,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct EncodingVideoProfile(Object<ffi::GstEncodingVideoProfile, ffi::GstEncodingVideoProfileClass>): EncodingProfile; pub struct EncodingVideoProfile(Object<ffi::GstEncodingVideoProfile, ffi::GstEncodingVideoProfileClass, EncodingVideoProfileClass>) @extends EncodingProfile;
match fn { match fn {
get_type => || ffi::gst_encoding_video_profile_get_type(), get_type => || ffi::gst_encoding_video_profile_get_type(),
@ -30,3 +30,5 @@ impl EncodingVideoProfile {
unsafe impl Send for EncodingVideoProfile {} unsafe impl Send for EncodingVideoProfile {}
unsafe impl Sync for EncodingVideoProfile {} unsafe impl Sync for EncodingVideoProfile {}
pub const NONE_ENCODING_VIDEO_PROFILE: Option<&EncodingVideoProfile> = None;

View file

@ -12,9 +12,8 @@ use std::mem;
pub fn encoding_list_all_targets<'a, P: Into<Option<&'a str>>>(categoryname: P) -> Vec<EncodingTarget> { pub fn encoding_list_all_targets<'a, P: Into<Option<&'a str>>>(categoryname: P) -> Vec<EncodingTarget> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
let categoryname = categoryname.into(); let categoryname = categoryname.into();
let categoryname = categoryname.to_glib_none();
unsafe { unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets(categoryname.0)) FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_all_targets(categoryname.to_glib_none().0))
} }
} }

View file

@ -3,45 +3,45 @@
// DO NOT EDIT // DO NOT EDIT
mod discoverer; mod discoverer;
pub use self::discoverer::Discoverer; pub use self::discoverer::{Discoverer, DiscovererClass, NONE_DISCOVERER};
mod discoverer_audio_info; mod discoverer_audio_info;
pub use self::discoverer_audio_info::DiscovererAudioInfo; pub use self::discoverer_audio_info::{DiscovererAudioInfo, DiscovererAudioInfoClass, NONE_DISCOVERER_AUDIO_INFO};
mod discoverer_container_info; mod discoverer_container_info;
pub use self::discoverer_container_info::DiscovererContainerInfo; pub use self::discoverer_container_info::{DiscovererContainerInfo, DiscovererContainerInfoClass, NONE_DISCOVERER_CONTAINER_INFO};
mod discoverer_info; mod discoverer_info;
pub use self::discoverer_info::DiscovererInfo; pub use self::discoverer_info::{DiscovererInfo, DiscovererInfoClass, NONE_DISCOVERER_INFO};
pub use self::discoverer_info::DiscovererInfoExt; pub use self::discoverer_info::DiscovererInfoExt;
mod discoverer_stream_info; mod discoverer_stream_info;
pub use self::discoverer_stream_info::DiscovererStreamInfo; pub use self::discoverer_stream_info::{DiscovererStreamInfo, DiscovererStreamInfoClass, NONE_DISCOVERER_STREAM_INFO};
pub use self::discoverer_stream_info::DiscovererStreamInfoExt; pub use self::discoverer_stream_info::DiscovererStreamInfoExt;
mod discoverer_subtitle_info; mod discoverer_subtitle_info;
pub use self::discoverer_subtitle_info::DiscovererSubtitleInfo; pub use self::discoverer_subtitle_info::{DiscovererSubtitleInfo, DiscovererSubtitleInfoClass, NONE_DISCOVERER_SUBTITLE_INFO};
mod discoverer_video_info; mod discoverer_video_info;
pub use self::discoverer_video_info::DiscovererVideoInfo; pub use self::discoverer_video_info::{DiscovererVideoInfo, DiscovererVideoInfoClass, NONE_DISCOVERER_VIDEO_INFO};
mod encoding_audio_profile; mod encoding_audio_profile;
pub use self::encoding_audio_profile::EncodingAudioProfile; pub use self::encoding_audio_profile::{EncodingAudioProfile, EncodingAudioProfileClass, NONE_ENCODING_AUDIO_PROFILE};
mod encoding_container_profile; mod encoding_container_profile;
pub use self::encoding_container_profile::EncodingContainerProfile; pub use self::encoding_container_profile::{EncodingContainerProfile, EncodingContainerProfileClass, NONE_ENCODING_CONTAINER_PROFILE};
pub use self::encoding_container_profile::EncodingContainerProfileExt; pub use self::encoding_container_profile::EncodingContainerProfileExt;
mod encoding_profile; mod encoding_profile;
pub use self::encoding_profile::EncodingProfile; pub use self::encoding_profile::{EncodingProfile, EncodingProfileClass, NONE_ENCODING_PROFILE};
pub use self::encoding_profile::EncodingProfileExt; pub use self::encoding_profile::EncodingProfileExt;
mod encoding_target; mod encoding_target;
pub use self::encoding_target::EncodingTarget; pub use self::encoding_target::{EncodingTarget, EncodingTargetClass, NONE_ENCODING_TARGET};
pub use self::encoding_target::EncodingTargetExt; pub use self::encoding_target::EncodingTargetExt;
mod encoding_video_profile; mod encoding_video_profile;
pub use self::encoding_video_profile::EncodingVideoProfile; pub use self::encoding_video_profile::{EncodingVideoProfile, EncodingVideoProfileClass, NONE_ENCODING_VIDEO_PROFILE};
mod enums; mod enums;
pub use self::enums::DiscovererResult; pub use self::enums::DiscovererResult;

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -3,36 +3,36 @@
// DO NOT EDIT // DO NOT EDIT
mod player; mod player;
pub use self::player::Player; pub use self::player::{Player, PlayerClass, NONE_PLAYER};
mod player_audio_info; mod player_audio_info;
pub use self::player_audio_info::PlayerAudioInfo; pub use self::player_audio_info::{PlayerAudioInfo, PlayerAudioInfoClass, NONE_PLAYER_AUDIO_INFO};
mod player_gmain_context_signal_dispatcher; mod player_gmain_context_signal_dispatcher;
pub use self::player_gmain_context_signal_dispatcher::PlayerGMainContextSignalDispatcher; pub use self::player_gmain_context_signal_dispatcher::{PlayerGMainContextSignalDispatcher, PlayerGMainContextSignalDispatcherClass, NONE_PLAYER_GMAIN_CONTEXT_SIGNAL_DISPATCHER};
mod player_media_info; mod player_media_info;
pub use self::player_media_info::PlayerMediaInfo; pub use self::player_media_info::{PlayerMediaInfo, PlayerMediaInfoClass, NONE_PLAYER_MEDIA_INFO};
mod player_signal_dispatcher; mod player_signal_dispatcher;
pub use self::player_signal_dispatcher::PlayerSignalDispatcher; pub use self::player_signal_dispatcher::{PlayerSignalDispatcher, NONE_PLAYER_SIGNAL_DISPATCHER};
pub use self::player_signal_dispatcher::PlayerSignalDispatcherExt; pub use self::player_signal_dispatcher::PlayerSignalDispatcherExt;
mod player_stream_info; mod player_stream_info;
pub use self::player_stream_info::PlayerStreamInfo; pub use self::player_stream_info::{PlayerStreamInfo, PlayerStreamInfoClass, NONE_PLAYER_STREAM_INFO};
pub use self::player_stream_info::PlayerStreamInfoExt; pub use self::player_stream_info::PlayerStreamInfoExt;
mod player_subtitle_info; mod player_subtitle_info;
pub use self::player_subtitle_info::PlayerSubtitleInfo; pub use self::player_subtitle_info::{PlayerSubtitleInfo, PlayerSubtitleInfoClass, NONE_PLAYER_SUBTITLE_INFO};
mod player_video_info; mod player_video_info;
pub use self::player_video_info::PlayerVideoInfo; pub use self::player_video_info::{PlayerVideoInfo, PlayerVideoInfoClass, NONE_PLAYER_VIDEO_INFO};
mod player_video_overlay_video_renderer; mod player_video_overlay_video_renderer;
pub use self::player_video_overlay_video_renderer::PlayerVideoOverlayVideoRenderer; pub use self::player_video_overlay_video_renderer::{PlayerVideoOverlayVideoRenderer, PlayerVideoOverlayVideoRendererClass, NONE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER};
mod player_video_renderer; mod player_video_renderer;
pub use self::player_video_renderer::PlayerVideoRenderer; pub use self::player_video_renderer::{PlayerVideoRenderer, NONE_PLAYER_VIDEO_RENDERER};
pub use self::player_video_renderer::PlayerVideoRendererExt; pub use self::player_video_renderer::PlayerVideoRendererExt;
mod player_visualization; mod player_visualization;

View file

@ -16,22 +16,21 @@ use glib;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::IsA;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
use glib_ffi; use glib_ffi;
use gobject_ffi; use gobject_ffi;
use gst; use gst;
use gst_ffi;
use gst_video; use gst_video;
use libc; use libc;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct Player(Object<ffi::GstPlayer, ffi::GstPlayerClass>): [ pub struct Player(Object<ffi::GstPlayer, ffi::GstPlayerClass, PlayerClass>) @extends gst::Object;
gst::Object => gst_ffi::GstObject,
];
match fn { match fn {
get_type => || ffi::gst_player_get_type(), get_type => || ffi::gst_player_get_type(),
@ -137,9 +136,8 @@ impl Player {
pub fn get_video_snapshot<'a, P: Into<Option<&'a gst::Structure>>>(&self, format: PlayerSnapshotFormat, config: P) -> Option<gst::Sample> { pub fn get_video_snapshot<'a, P: Into<Option<&'a gst::Structure>>>(&self, format: PlayerSnapshotFormat, config: P) -> Option<gst::Sample> {
let config = config.into(); let config = config.into();
let config = config.to_glib_none();
unsafe { unsafe {
from_glib_full(ffi::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.0)) from_glib_full(ffi::gst_player_get_video_snapshot(self.to_glib_none().0, format.to_glib(), config.to_glib_none().0))
} }
} }
@ -259,9 +257,8 @@ impl Player {
pub fn set_visualization<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError> { pub fn set_visualization<'a, P: Into<Option<&'a str>>>(&self, name: P) -> Result<(), glib::error::BoolError> {
let name = name.into(); let name = name.into();
let name = name.to_glib_none();
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_player_set_visualization(self.to_glib_none().0, name.0), "Failed to set visualization") glib_result_from_gboolean!(ffi::gst_player_set_visualization(self.to_glib_none().0, name.to_glib_none().0), "Failed to set visualization")
} }
} }
@ -286,7 +283,7 @@ impl Player {
pub fn get_property_suburi(&self) -> Option<GString> { pub fn get_property_suburi(&self) -> Option<GString> {
unsafe { unsafe {
let mut value = Value::from_type(<GString as StaticType>::static_type()); let mut value = Value::from_type(<GString as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"suburi\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"suburi\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -294,56 +291,56 @@ impl Player {
pub fn set_property_suburi<'a, P: Into<Option<&'a str>>>(&self, suburi: P) { pub fn set_property_suburi<'a, P: Into<Option<&'a str>>>(&self, suburi: P) {
let suburi = suburi.into(); let suburi = suburi.into();
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"suburi\0".as_ptr() as *const _, Value::from(suburi).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"suburi\0".as_ptr() as *const _, Value::from(suburi).to_glib_none().0);
} }
} }
pub fn get_property_video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags { pub fn get_property_video_multiview_flags(&self) -> gst_video::VideoMultiviewFlags {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewFlags as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"video-multiview-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-multiview-flags\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) { pub fn set_property_video_multiview_flags(&self, video_multiview_flags: gst_video::VideoMultiviewFlags) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-multiview-flags\0".as_ptr() as *const _, Value::from(&video_multiview_flags).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-multiview-flags\0".as_ptr() as *const _, Value::from(&video_multiview_flags).to_glib_none().0);
} }
} }
pub fn get_property_video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking { pub fn get_property_video_multiview_mode(&self) -> gst_video::VideoMultiviewFramePacking {
unsafe { unsafe {
let mut value = Value::from_type(<gst_video::VideoMultiviewFramePacking as StaticType>::static_type()); let mut value = Value::from_type(<gst_video::VideoMultiviewFramePacking as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"video-multiview-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-multiview-mode\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get().unwrap() value.get().unwrap()
} }
} }
pub fn set_property_video_multiview_mode(&self, video_multiview_mode: gst_video::VideoMultiviewFramePacking) { pub fn set_property_video_multiview_mode(&self, video_multiview_mode: gst_video::VideoMultiviewFramePacking) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-multiview-mode\0".as_ptr() as *const _, Value::from(&video_multiview_mode).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-multiview-mode\0".as_ptr() as *const _, Value::from(&video_multiview_mode).to_glib_none().0);
} }
} }
pub fn get_audio_streams(info: &PlayerMediaInfo) -> Vec<PlayerAudioInfo> { pub fn get_audio_streams<P: IsA<PlayerMediaInfo>>(info: &P) -> Vec<PlayerAudioInfo> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(info.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_audio_streams(info.as_ref().to_glib_none().0))
} }
} }
pub fn get_subtitle_streams(info: &PlayerMediaInfo) -> Vec<PlayerSubtitleInfo> { pub fn get_subtitle_streams<P: IsA<PlayerMediaInfo>>(info: &P) -> Vec<PlayerSubtitleInfo> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(info.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_subtitle_streams(info.as_ref().to_glib_none().0))
} }
} }
pub fn get_video_streams(info: &PlayerMediaInfo) -> Vec<PlayerVideoInfo> { pub fn get_video_streams<P: IsA<PlayerMediaInfo>>(info: &P) -> Vec<PlayerVideoInfo> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(info.to_glib_none().0)) FromGlibPtrContainer::from_glib_none(ffi::gst_player_get_video_streams(info.as_ref().to_glib_none().0))
} }
} }
@ -357,7 +354,7 @@ impl Player {
pub fn connect_buffering<F: Fn(&Player, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_buffering<F: Fn(&Player, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, i32) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, i32) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"buffering\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"buffering\0".as_ptr() as *const _,
transmute(buffering_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(buffering_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -365,7 +362,7 @@ impl Player {
pub fn connect_end_of_stream<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_end_of_stream<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"end-of-stream\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"end-of-stream\0".as_ptr() as *const _,
transmute(end_of_stream_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(end_of_stream_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -373,7 +370,7 @@ impl Player {
pub fn connect_error<F: Fn(&Player, &Error) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_error<F: Fn(&Player, &Error) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, &Error) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, &Error) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"error\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"error\0".as_ptr() as *const _,
transmute(error_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(error_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -381,7 +378,7 @@ impl Player {
pub fn connect_media_info_updated<F: Fn(&Player, &PlayerMediaInfo) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_media_info_updated<F: Fn(&Player, &PlayerMediaInfo) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, &PlayerMediaInfo) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, &PlayerMediaInfo) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"media-info-updated\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"media-info-updated\0".as_ptr() as *const _,
transmute(media_info_updated_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(media_info_updated_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -389,7 +386,7 @@ impl Player {
pub fn connect_mute_changed<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_mute_changed<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"mute-changed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"mute-changed\0".as_ptr() as *const _,
transmute(mute_changed_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(mute_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -397,7 +394,7 @@ impl Player {
pub fn connect_state_changed<F: Fn(&Player, PlayerState) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_state_changed<F: Fn(&Player, PlayerState) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, PlayerState) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, PlayerState) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"state-changed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"state-changed\0".as_ptr() as *const _,
transmute(state_changed_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(state_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -405,7 +402,7 @@ impl Player {
pub fn connect_uri_loaded<F: Fn(&Player, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_uri_loaded<F: Fn(&Player, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, &str) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, &str) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"uri-loaded\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"uri-loaded\0".as_ptr() as *const _,
transmute(uri_loaded_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(uri_loaded_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -413,7 +410,7 @@ impl Player {
pub fn connect_video_dimensions_changed<F: Fn(&Player, i32, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_video_dimensions_changed<F: Fn(&Player, i32, i32) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, i32, i32) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, i32, i32) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"video-dimensions-changed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"video-dimensions-changed\0".as_ptr() as *const _,
transmute(video_dimensions_changed_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(video_dimensions_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -421,7 +418,7 @@ impl Player {
pub fn connect_volume_changed<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_volume_changed<F: Fn(&Player) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"volume-changed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"volume-changed\0".as_ptr() as *const _,
transmute(volume_changed_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(volume_changed_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -429,7 +426,7 @@ impl Player {
pub fn connect_warning<F: Fn(&Player, &Error) + Send + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_warning<F: Fn(&Player, &Error) + Send + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player, &Error) + Send + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player, &Error) + Send + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"warning\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"warning\0".as_ptr() as *const _,
transmute(warning_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(warning_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -437,7 +434,7 @@ impl Player {
pub fn connect_property_audio_video_offset_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_audio_video_offset_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::audio-video-offset\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::audio-video-offset\0".as_ptr() as *const _,
transmute(notify_audio_video_offset_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_audio_video_offset_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -445,7 +442,7 @@ impl Player {
pub fn connect_property_current_audio_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_current_audio_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::current-audio-track\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::current-audio-track\0".as_ptr() as *const _,
transmute(notify_current_audio_track_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_current_audio_track_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -453,7 +450,7 @@ impl Player {
pub fn connect_property_current_subtitle_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_current_subtitle_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::current-subtitle-track\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::current-subtitle-track\0".as_ptr() as *const _,
transmute(notify_current_subtitle_track_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_current_subtitle_track_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -461,7 +458,7 @@ impl Player {
pub fn connect_property_current_video_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_current_video_track_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::current-video-track\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::current-video-track\0".as_ptr() as *const _,
transmute(notify_current_video_track_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_current_video_track_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -469,7 +466,7 @@ impl Player {
pub fn connect_property_duration_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_duration_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::duration\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_duration_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -477,7 +474,7 @@ impl Player {
pub fn connect_property_media_info_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_media_info_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::media-info\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::media-info\0".as_ptr() as *const _,
transmute(notify_media_info_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_media_info_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -485,7 +482,7 @@ impl Player {
pub fn connect_property_mute_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_mute_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::mute\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mute\0".as_ptr() as *const _,
transmute(notify_mute_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_mute_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -493,7 +490,7 @@ impl Player {
pub fn connect_property_pipeline_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_pipeline_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::pipeline\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::pipeline\0".as_ptr() as *const _,
transmute(notify_pipeline_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_pipeline_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -501,7 +498,7 @@ impl Player {
pub fn connect_property_position_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_position_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::position\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::position\0".as_ptr() as *const _,
transmute(notify_position_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_position_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -509,7 +506,7 @@ impl Player {
pub fn connect_property_rate_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_rate_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::rate\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::rate\0".as_ptr() as *const _,
transmute(notify_rate_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_rate_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -517,7 +514,7 @@ impl Player {
pub fn connect_property_suburi_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_suburi_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::suburi\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::suburi\0".as_ptr() as *const _,
transmute(notify_suburi_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_suburi_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -525,7 +522,7 @@ impl Player {
pub fn connect_property_uri_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_uri_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::uri\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _,
transmute(notify_uri_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_uri_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -533,7 +530,7 @@ impl Player {
pub fn connect_property_video_multiview_flags_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_video_multiview_flags_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::video-multiview-flags\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-flags\0".as_ptr() as *const _,
transmute(notify_video_multiview_flags_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_video_multiview_flags_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -541,7 +538,7 @@ impl Player {
pub fn connect_property_video_multiview_mode_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_video_multiview_mode_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::video-multiview-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::video-multiview-mode\0".as_ptr() as *const _,
transmute(notify_video_multiview_mode_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_video_multiview_mode_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -549,7 +546,7 @@ impl Player {
pub fn connect_property_volume_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_volume_notify<F: Fn(&Player) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Player) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::volume\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::volume\0".as_ptr() as *const _,
transmute(notify_volume_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_volume_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -558,6 +555,8 @@ impl Player {
unsafe impl Send for Player {} unsafe impl Send for Player {}
unsafe impl Sync for Player {} unsafe impl Sync for Player {}
pub const NONE_PLAYER: Option<&Player> = None;
unsafe extern "C" fn buffering_trampoline(this: *mut ffi::GstPlayer, object: libc::c_int, f: glib_ffi::gpointer) { unsafe extern "C" fn buffering_trampoline(this: *mut ffi::GstPlayer, object: libc::c_int, f: glib_ffi::gpointer) {
let f: &&(Fn(&Player, i32) + Send + 'static) = transmute(f); let f: &&(Fn(&Player, i32) + Send + 'static) = transmute(f);
f(&from_glib_borrow(this), object) f(&from_glib_borrow(this), object)

View file

@ -8,7 +8,7 @@ use glib::GString;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct PlayerAudioInfo(Object<ffi::GstPlayerAudioInfo, ffi::GstPlayerAudioInfoClass>): PlayerStreamInfo; pub struct PlayerAudioInfo(Object<ffi::GstPlayerAudioInfo, ffi::GstPlayerAudioInfoClass, PlayerAudioInfoClass>) @extends PlayerStreamInfo;
match fn { match fn {
get_type => || ffi::gst_player_audio_info_get_type(), get_type => || ffi::gst_player_audio_info_get_type(),
@ -49,3 +49,5 @@ impl PlayerAudioInfo {
unsafe impl Send for PlayerAudioInfo {} unsafe impl Send for PlayerAudioInfo {}
unsafe impl Sync for PlayerAudioInfo {} unsafe impl Sync for PlayerAudioInfo {}
pub const NONE_PLAYER_AUDIO_INFO: Option<&PlayerAudioInfo> = None;

View file

@ -7,11 +7,12 @@ use ffi;
use glib; use glib;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::ObjectType;
use glib::translate::*; use glib::translate::*;
use gobject_ffi; use gobject_ffi;
glib_wrapper! { glib_wrapper! {
pub struct PlayerGMainContextSignalDispatcher(Object<ffi::GstPlayerGMainContextSignalDispatcher, ffi::GstPlayerGMainContextSignalDispatcherClass>): PlayerSignalDispatcher; pub struct PlayerGMainContextSignalDispatcher(Object<ffi::GstPlayerGMainContextSignalDispatcher, ffi::GstPlayerGMainContextSignalDispatcherClass, PlayerGMainContextSignalDispatcherClass>) @implements PlayerSignalDispatcher;
match fn { match fn {
get_type => || ffi::gst_player_g_main_context_signal_dispatcher_get_type(), get_type => || ffi::gst_player_g_main_context_signal_dispatcher_get_type(),
@ -22,7 +23,7 @@ impl PlayerGMainContextSignalDispatcher {
pub fn get_property_application_context(&self) -> Option<glib::MainContext> { pub fn get_property_application_context(&self) -> Option<glib::MainContext> {
unsafe { unsafe {
let mut value = Value::from_type(<glib::MainContext as StaticType>::static_type()); let mut value = Value::from_type(<glib::MainContext as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"application-context\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"application-context\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
@ -30,3 +31,5 @@ impl PlayerGMainContextSignalDispatcher {
unsafe impl Send for PlayerGMainContextSignalDispatcher {} unsafe impl Send for PlayerGMainContextSignalDispatcher {}
unsafe impl Sync for PlayerGMainContextSignalDispatcher {} unsafe impl Sync for PlayerGMainContextSignalDispatcher {}
pub const NONE_PLAYER_GMAIN_CONTEXT_SIGNAL_DISPATCHER: Option<&PlayerGMainContextSignalDispatcher> = None;

View file

@ -12,7 +12,7 @@ use glib::translate::*;
use gst; use gst;
glib_wrapper! { glib_wrapper! {
pub struct PlayerMediaInfo(Object<ffi::GstPlayerMediaInfo, ffi::GstPlayerMediaInfoClass>); pub struct PlayerMediaInfo(Object<ffi::GstPlayerMediaInfo, ffi::GstPlayerMediaInfoClass, PlayerMediaInfoClass>);
match fn { match fn {
get_type => || ffi::gst_player_media_info_get_type(), get_type => || ffi::gst_player_media_info_get_type(),
@ -119,3 +119,5 @@ impl PlayerMediaInfo {
unsafe impl Send for PlayerMediaInfo {} unsafe impl Send for PlayerMediaInfo {}
unsafe impl Sync for PlayerMediaInfo {} unsafe impl Sync for PlayerMediaInfo {}
pub const NONE_PLAYER_MEDIA_INFO: Option<&PlayerMediaInfo> = None;

View file

@ -7,7 +7,7 @@ use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct PlayerSignalDispatcher(Object<ffi::GstPlayerSignalDispatcher, ffi::GstPlayerSignalDispatcherInterface>); pub struct PlayerSignalDispatcher(Interface<ffi::GstPlayerSignalDispatcher>);
match fn { match fn {
get_type => || ffi::gst_player_signal_dispatcher_get_type(), get_type => || ffi::gst_player_signal_dispatcher_get_type(),
@ -17,6 +17,8 @@ glib_wrapper! {
unsafe impl Send for PlayerSignalDispatcher {} unsafe impl Send for PlayerSignalDispatcher {}
unsafe impl Sync for PlayerSignalDispatcher {} unsafe impl Sync for PlayerSignalDispatcher {}
pub const NONE_PLAYER_SIGNAL_DISPATCHER: Option<&PlayerSignalDispatcher> = None;
pub trait PlayerSignalDispatcherExt: 'static {} pub trait PlayerSignalDispatcherExt: 'static {}
impl<O: IsA<PlayerSignalDispatcher>> PlayerSignalDispatcherExt for O {} impl<O: IsA<PlayerSignalDispatcher>> PlayerSignalDispatcherExt for O {}

View file

@ -9,7 +9,7 @@ use glib::translate::*;
use gst; use gst;
glib_wrapper! { glib_wrapper! {
pub struct PlayerStreamInfo(Object<ffi::GstPlayerStreamInfo, ffi::GstPlayerStreamInfoClass>); pub struct PlayerStreamInfo(Object<ffi::GstPlayerStreamInfo, ffi::GstPlayerStreamInfoClass, PlayerStreamInfoClass>);
match fn { match fn {
get_type => || ffi::gst_player_stream_info_get_type(), get_type => || ffi::gst_player_stream_info_get_type(),
@ -19,6 +19,8 @@ glib_wrapper! {
unsafe impl Send for PlayerStreamInfo {} unsafe impl Send for PlayerStreamInfo {}
unsafe impl Sync for PlayerStreamInfo {} unsafe impl Sync for PlayerStreamInfo {}
pub const NONE_PLAYER_STREAM_INFO: Option<&PlayerStreamInfo> = None;
pub trait PlayerStreamInfoExt: 'static { pub trait PlayerStreamInfoExt: 'static {
fn get_caps(&self) -> Option<gst::Caps>; fn get_caps(&self) -> Option<gst::Caps>;
@ -34,31 +36,31 @@ pub trait PlayerStreamInfoExt: 'static {
impl<O: IsA<PlayerStreamInfo>> PlayerStreamInfoExt for O { impl<O: IsA<PlayerStreamInfo>> PlayerStreamInfoExt for O {
fn get_caps(&self) -> Option<gst::Caps> { fn get_caps(&self) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_codec(&self) -> Option<GString> { fn get_codec(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_index(&self) -> i32 { fn get_index(&self) -> i32 {
unsafe { unsafe {
ffi::gst_player_stream_info_get_index(const_override(self.to_glib_none().0)) ffi::gst_player_stream_info_get_index(const_override(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream_type(&self) -> GString { fn get_stream_type(&self) -> GString {
unsafe { unsafe {
from_glib_none(ffi::gst_player_stream_info_get_stream_type(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_player_stream_info_get_stream_type(const_override(self.as_ref().to_glib_none().0)))
} }
} }
fn get_tags(&self) -> Option<gst::TagList> { fn get_tags(&self) -> Option<gst::TagList> {
unsafe { unsafe {
from_glib_none(ffi::gst_player_stream_info_get_tags(const_override(self.to_glib_none().0))) from_glib_none(ffi::gst_player_stream_info_get_tags(const_override(self.as_ref().to_glib_none().0)))
} }
} }
} }

View file

@ -8,7 +8,7 @@ use glib::GString;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct PlayerSubtitleInfo(Object<ffi::GstPlayerSubtitleInfo, ffi::GstPlayerSubtitleInfoClass>): PlayerStreamInfo; pub struct PlayerSubtitleInfo(Object<ffi::GstPlayerSubtitleInfo, ffi::GstPlayerSubtitleInfoClass, PlayerSubtitleInfoClass>) @extends PlayerStreamInfo;
match fn { match fn {
get_type => || ffi::gst_player_subtitle_info_get_type(), get_type => || ffi::gst_player_subtitle_info_get_type(),
@ -25,3 +25,5 @@ impl PlayerSubtitleInfo {
unsafe impl Send for PlayerSubtitleInfo {} unsafe impl Send for PlayerSubtitleInfo {}
unsafe impl Sync for PlayerSubtitleInfo {} unsafe impl Sync for PlayerSubtitleInfo {}
pub const NONE_PLAYER_SUBTITLE_INFO: Option<&PlayerSubtitleInfo> = None;

View file

@ -7,7 +7,7 @@ use ffi;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct PlayerVideoInfo(Object<ffi::GstPlayerVideoInfo, ffi::GstPlayerVideoInfoClass>): PlayerStreamInfo; pub struct PlayerVideoInfo(Object<ffi::GstPlayerVideoInfo, ffi::GstPlayerVideoInfoClass, PlayerVideoInfoClass>) @extends PlayerStreamInfo;
match fn { match fn {
get_type => || ffi::gst_player_video_info_get_type(), get_type => || ffi::gst_player_video_info_get_type(),
@ -42,3 +42,5 @@ impl PlayerVideoInfo {
unsafe impl Send for PlayerVideoInfo {} unsafe impl Send for PlayerVideoInfo {}
unsafe impl Sync for PlayerVideoInfo {} unsafe impl Sync for PlayerVideoInfo {}
pub const NONE_PLAYER_VIDEO_INFO: Option<&PlayerVideoInfo> = None;

View file

@ -8,6 +8,7 @@ use glib;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::IsA; use glib::object::IsA;
use glib::object::ObjectType;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
use glib::translate::*; use glib::translate::*;
@ -19,7 +20,7 @@ use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct PlayerVideoOverlayVideoRenderer(Object<ffi::GstPlayerVideoOverlayVideoRenderer, ffi::GstPlayerVideoOverlayVideoRendererClass>): PlayerVideoRenderer; pub struct PlayerVideoOverlayVideoRenderer(Object<ffi::GstPlayerVideoOverlayVideoRenderer, ffi::GstPlayerVideoOverlayVideoRendererClass, PlayerVideoOverlayVideoRendererClass>) @implements PlayerVideoRenderer;
match fn { match fn {
get_type => || ffi::gst_player_video_overlay_video_renderer_get_type(), get_type => || ffi::gst_player_video_overlay_video_renderer_get_type(),
@ -61,14 +62,14 @@ impl PlayerVideoOverlayVideoRenderer {
pub fn get_property_video_sink(&self) -> Option<gst::Element> { pub fn get_property_video_sink(&self) -> Option<gst::Element> {
unsafe { unsafe {
let mut value = Value::from_type(<gst::Element as StaticType>::static_type()); let mut value = Value::from_type(<gst::Element as StaticType>::static_type());
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0); gobject_ffi::g_object_get_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-sink\0".as_ptr() as *const _, value.to_glib_none_mut().0);
value.get() value.get()
} }
} }
pub fn set_property_video_sink<P: IsA<gst::Element> + glib::value::SetValueOptional>(&self, video_sink: Option<&P>) { pub fn set_property_video_sink<P: IsA<gst::Element> + glib::value::SetValueOptional>(&self, video_sink: Option<&P>) {
unsafe { unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0); gobject_ffi::g_object_set_property(self.as_ptr() as *mut gobject_ffi::GObject, b"video-sink\0".as_ptr() as *const _, Value::from(video_sink).to_glib_none().0);
} }
} }
@ -83,7 +84,7 @@ impl PlayerVideoOverlayVideoRenderer {
pub fn connect_property_video_sink_notify<F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_video_sink_notify<F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::video-sink\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::video-sink\0".as_ptr() as *const _,
transmute(notify_video_sink_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_video_sink_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -91,7 +92,7 @@ impl PlayerVideoOverlayVideoRenderer {
pub fn connect_property_window_handle_notify<F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { pub fn connect_property_window_handle_notify<F: Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0, b"notify::window-handle\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::window-handle\0".as_ptr() as *const _,
transmute(notify_window_handle_trampoline as usize), Box_::into_raw(f) as *mut _) transmute(notify_window_handle_trampoline as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -100,6 +101,8 @@ impl PlayerVideoOverlayVideoRenderer {
unsafe impl Send for PlayerVideoOverlayVideoRenderer {} unsafe impl Send for PlayerVideoOverlayVideoRenderer {}
unsafe impl Sync for PlayerVideoOverlayVideoRenderer {} unsafe impl Sync for PlayerVideoOverlayVideoRenderer {}
pub const NONE_PLAYER_VIDEO_OVERLAY_VIDEO_RENDERER: Option<&PlayerVideoOverlayVideoRenderer> = None;
unsafe extern "C" fn notify_video_sink_trampoline(this: *mut ffi::GstPlayerVideoOverlayVideoRenderer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) { unsafe extern "C" fn notify_video_sink_trampoline(this: *mut ffi::GstPlayerVideoOverlayVideoRenderer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) {
let f: &&(Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&PlayerVideoOverlayVideoRenderer) + Send + Sync + 'static) = transmute(f);
f(&from_glib_borrow(this)) f(&from_glib_borrow(this))

View file

@ -7,7 +7,7 @@ use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct PlayerVideoRenderer(Object<ffi::GstPlayerVideoRenderer, ffi::GstPlayerVideoRendererInterface>); pub struct PlayerVideoRenderer(Interface<ffi::GstPlayerVideoRenderer>);
match fn { match fn {
get_type => || ffi::gst_player_video_renderer_get_type(), get_type => || ffi::gst_player_video_renderer_get_type(),
@ -17,6 +17,8 @@ glib_wrapper! {
unsafe impl Send for PlayerVideoRenderer {} unsafe impl Send for PlayerVideoRenderer {}
unsafe impl Sync for PlayerVideoRenderer {} unsafe impl Sync for PlayerVideoRenderer {}
pub const NONE_PLAYER_VIDEO_RENDERER: Option<&PlayerVideoRenderer> = None;
pub trait PlayerVideoRendererExt: 'static {} pub trait PlayerVideoRendererExt: 'static {}
impl<O: IsA<PlayerVideoRenderer>> PlayerVideoRendererExt for O {} impl<O: IsA<PlayerVideoRenderer>> PlayerVideoRendererExt for O {}

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ d41632a) Generated by gir (https://github.com/gtk-rs/gir @ dd6fb0a)
from gir-files (https://github.com/gtk-rs/gir-files @ ???) from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -3,59 +3,59 @@
// DO NOT EDIT // DO NOT EDIT
mod rtsp_address_pool; mod rtsp_address_pool;
pub use self::rtsp_address_pool::RTSPAddressPool; pub use self::rtsp_address_pool::{RTSPAddressPool, RTSPAddressPoolClass, NONE_RTSP_ADDRESS_POOL};
pub use self::rtsp_address_pool::RTSPAddressPoolExt; pub use self::rtsp_address_pool::RTSPAddressPoolExt;
mod rtsp_auth; mod rtsp_auth;
pub use self::rtsp_auth::RTSPAuth; pub use self::rtsp_auth::{RTSPAuth, RTSPAuthClass, NONE_RTSP_AUTH};
pub use self::rtsp_auth::RTSPAuthExt; pub use self::rtsp_auth::RTSPAuthExt;
mod rtsp_client; mod rtsp_client;
pub use self::rtsp_client::RTSPClient; pub use self::rtsp_client::{RTSPClient, RTSPClientClass, NONE_RTSP_CLIENT};
pub use self::rtsp_client::RTSPClientExt; pub use self::rtsp_client::RTSPClientExt;
mod rtsp_media; mod rtsp_media;
pub use self::rtsp_media::RTSPMedia; pub use self::rtsp_media::{RTSPMedia, RTSPMediaClass, NONE_RTSP_MEDIA};
pub use self::rtsp_media::RTSPMediaExt; pub use self::rtsp_media::RTSPMediaExt;
mod rtsp_media_factory; mod rtsp_media_factory;
pub use self::rtsp_media_factory::RTSPMediaFactory; pub use self::rtsp_media_factory::{RTSPMediaFactory, RTSPMediaFactoryClass, NONE_RTSP_MEDIA_FACTORY};
pub use self::rtsp_media_factory::RTSPMediaFactoryExt; pub use self::rtsp_media_factory::RTSPMediaFactoryExt;
mod rtsp_media_factory_uri; mod rtsp_media_factory_uri;
pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURI; pub use self::rtsp_media_factory_uri::{RTSPMediaFactoryURI, RTSPMediaFactoryURIClass, NONE_RTSP_MEDIA_FACTORY_URI};
pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURIExt; pub use self::rtsp_media_factory_uri::RTSPMediaFactoryURIExt;
mod rtsp_mount_points; mod rtsp_mount_points;
pub use self::rtsp_mount_points::RTSPMountPoints; pub use self::rtsp_mount_points::{RTSPMountPoints, RTSPMountPointsClass, NONE_RTSP_MOUNT_POINTS};
pub use self::rtsp_mount_points::RTSPMountPointsExt; pub use self::rtsp_mount_points::RTSPMountPointsExt;
mod rtsp_server; mod rtsp_server;
pub use self::rtsp_server::RTSPServer; pub use self::rtsp_server::{RTSPServer, RTSPServerClass, NONE_RTSP_SERVER};
pub use self::rtsp_server::RTSPServerExt; pub use self::rtsp_server::RTSPServerExt;
mod rtsp_session; mod rtsp_session;
pub use self::rtsp_session::RTSPSession; pub use self::rtsp_session::{RTSPSession, RTSPSessionClass, NONE_RTSP_SESSION};
pub use self::rtsp_session::RTSPSessionExt; pub use self::rtsp_session::RTSPSessionExt;
mod rtsp_session_media; mod rtsp_session_media;
pub use self::rtsp_session_media::RTSPSessionMedia; pub use self::rtsp_session_media::{RTSPSessionMedia, RTSPSessionMediaClass, NONE_RTSP_SESSION_MEDIA};
pub use self::rtsp_session_media::RTSPSessionMediaExt; pub use self::rtsp_session_media::RTSPSessionMediaExt;
mod rtsp_session_pool; mod rtsp_session_pool;
pub use self::rtsp_session_pool::RTSPSessionPool; pub use self::rtsp_session_pool::{RTSPSessionPool, RTSPSessionPoolClass, NONE_RTSP_SESSION_POOL};
pub use self::rtsp_session_pool::RTSPSessionPoolExt; pub use self::rtsp_session_pool::RTSPSessionPoolExt;
mod rtsp_stream; mod rtsp_stream;
pub use self::rtsp_stream::RTSPStream; pub use self::rtsp_stream::{RTSPStream, RTSPStreamClass, NONE_RTSP_STREAM};
pub use self::rtsp_stream::RTSPStreamExt; pub use self::rtsp_stream::RTSPStreamExt;
mod rtsp_stream_transport; mod rtsp_stream_transport;
pub use self::rtsp_stream_transport::RTSPStreamTransport; pub use self::rtsp_stream_transport::{RTSPStreamTransport, RTSPStreamTransportClass, NONE_RTSP_STREAM_TRANSPORT};
pub use self::rtsp_stream_transport::RTSPStreamTransportExt; pub use self::rtsp_stream_transport::RTSPStreamTransportExt;
mod rtsp_thread_pool; mod rtsp_thread_pool;
pub use self::rtsp_thread_pool::RTSPThreadPool; pub use self::rtsp_thread_pool::{RTSPThreadPool, RTSPThreadPoolClass, NONE_RTSP_THREAD_POOL};
pub use self::rtsp_thread_pool::RTSPThreadPoolExt; pub use self::rtsp_thread_pool::RTSPThreadPoolExt;
mod rtsp_address; mod rtsp_address;

View file

@ -10,7 +10,7 @@ use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
glib_wrapper! { glib_wrapper! {
pub struct RTSPAddressPool(Object<ffi::GstRTSPAddressPool, ffi::GstRTSPAddressPoolClass>); pub struct RTSPAddressPool(Object<ffi::GstRTSPAddressPool, ffi::GstRTSPAddressPoolClass, RTSPAddressPoolClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_address_pool_get_type(), get_type => || ffi::gst_rtsp_address_pool_get_type(),
@ -35,6 +35,8 @@ impl Default for RTSPAddressPool {
unsafe impl Send for RTSPAddressPool {} unsafe impl Send for RTSPAddressPool {}
unsafe impl Sync for RTSPAddressPool {} unsafe impl Sync for RTSPAddressPool {}
pub const NONE_RTSP_ADDRESS_POOL: Option<&RTSPAddressPool> = None;
pub trait RTSPAddressPoolExt: 'static { pub trait RTSPAddressPoolExt: 'static {
fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress>; fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress>;
@ -50,31 +52,31 @@ pub trait RTSPAddressPoolExt: 'static {
impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExt for O { impl<O: IsA<RTSPAddressPool>> RTSPAddressPoolExt for O {
fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress> { fn acquire_address(&self, flags: RTSPAddressFlags, n_ports: i32) -> Option<RTSPAddress> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_address_pool_acquire_address(self.to_glib_none().0, flags.to_glib(), n_ports)) from_glib_full(ffi::gst_rtsp_address_pool_acquire_address(self.as_ref().to_glib_none().0, flags.to_glib(), n_ports))
} }
} }
fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError> { fn add_range(&self, min_address: &str, max_address: &str, min_port: u16, max_port: u16, ttl: u8) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_address_pool_add_range(self.to_glib_none().0, min_address.to_glib_none().0, max_address.to_glib_none().0, min_port, max_port, ttl), "Failed to add address range") glib_result_from_gboolean!(ffi::gst_rtsp_address_pool_add_range(self.as_ref().to_glib_none().0, min_address.to_glib_none().0, max_address.to_glib_none().0, min_port, max_port, ttl), "Failed to add address range")
} }
} }
fn clear(&self) { fn clear(&self) {
unsafe { unsafe {
ffi::gst_rtsp_address_pool_clear(self.to_glib_none().0); ffi::gst_rtsp_address_pool_clear(self.as_ref().to_glib_none().0);
} }
} }
fn dump(&self) { fn dump(&self) {
unsafe { unsafe {
ffi::gst_rtsp_address_pool_dump(self.to_glib_none().0); ffi::gst_rtsp_address_pool_dump(self.as_ref().to_glib_none().0);
} }
} }
fn has_unicast_addresses(&self) -> bool { fn has_unicast_addresses(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_address_pool_has_unicast_addresses(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_address_pool_has_unicast_addresses(self.as_ref().to_glib_none().0))
} }
} }
} }

View file

@ -7,7 +7,7 @@ use ffi;
use gio; use gio;
use gio_ffi; use gio_ffi;
use glib::GString; use glib::GString;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -19,7 +19,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPAuth(Object<ffi::GstRTSPAuth, ffi::GstRTSPAuthClass>); pub struct RTSPAuth(Object<ffi::GstRTSPAuth, ffi::GstRTSPAuthClass, RTSPAuthClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_auth_get_type(), get_type => || ffi::gst_rtsp_auth_get_type(),
@ -58,6 +58,8 @@ impl Default for RTSPAuth {
unsafe impl Send for RTSPAuth {} unsafe impl Send for RTSPAuth {}
unsafe impl Sync for RTSPAuth {} unsafe impl Sync for RTSPAuth {}
pub const NONE_RTSP_AUTH: Option<&RTSPAuth> = None;
pub trait RTSPAuthExt: 'static { pub trait RTSPAuthExt: 'static {
fn add_basic(&self, basic: &str, token: &RTSPToken); fn add_basic(&self, basic: &str, token: &RTSPToken);
@ -85,7 +87,7 @@ pub trait RTSPAuthExt: 'static {
fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode); fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode);
fn set_tls_certificate<'a, P: Into<Option<&'a gio::TlsCertificate>>>(&self, cert: P); fn set_tls_certificate<'a, P: IsA<gio::TlsCertificate> + 'a, Q: Into<Option<&'a P>>>(&self, cert: Q);
fn set_tls_database<'a, P: IsA<gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q); fn set_tls_database<'a, P: IsA<gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q);
@ -95,94 +97,92 @@ pub trait RTSPAuthExt: 'static {
impl<O: IsA<RTSPAuth>> RTSPAuthExt for O { impl<O: IsA<RTSPAuth>> RTSPAuthExt for O {
fn add_basic(&self, basic: &str, token: &RTSPToken) { fn add_basic(&self, basic: &str, token: &RTSPToken) {
unsafe { unsafe {
ffi::gst_rtsp_auth_add_basic(self.to_glib_none().0, basic.to_glib_none().0, token.to_glib_none().0); ffi::gst_rtsp_auth_add_basic(self.as_ref().to_glib_none().0, basic.to_glib_none().0, token.to_glib_none().0);
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn add_digest(&self, user: &str, pass: &str, token: &RTSPToken) { fn add_digest(&self, user: &str, pass: &str, token: &RTSPToken) {
unsafe { unsafe {
ffi::gst_rtsp_auth_add_digest(self.to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none().0); ffi::gst_rtsp_auth_add_digest(self.as_ref().to_glib_none().0, user.to_glib_none().0, pass.to_glib_none().0, token.to_glib_none().0);
} }
} }
fn get_default_token(&self) -> Option<RTSPToken> { fn get_default_token(&self) -> Option<RTSPToken> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_auth_get_default_token(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_auth_get_default_token(self.as_ref().to_glib_none().0))
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn get_supported_methods(&self) -> gst_rtsp::RTSPAuthMethod { fn get_supported_methods(&self) -> gst_rtsp::RTSPAuthMethod {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_auth_get_supported_methods(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_auth_get_supported_methods(self.as_ref().to_glib_none().0))
} }
} }
fn get_tls_authentication_mode(&self) -> gio::TlsAuthenticationMode { fn get_tls_authentication_mode(&self) -> gio::TlsAuthenticationMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_auth_get_tls_authentication_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_auth_get_tls_authentication_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_tls_certificate(&self) -> Option<gio::TlsCertificate> { fn get_tls_certificate(&self) -> Option<gio::TlsCertificate> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_auth_get_tls_certificate(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_auth_get_tls_certificate(self.as_ref().to_glib_none().0))
} }
} }
fn get_tls_database(&self) -> Option<gio::TlsDatabase> { fn get_tls_database(&self) -> Option<gio::TlsDatabase> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_auth_get_tls_database(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_auth_get_tls_database(self.as_ref().to_glib_none().0))
} }
} }
fn remove_basic(&self, basic: &str) { fn remove_basic(&self, basic: &str) {
unsafe { unsafe {
ffi::gst_rtsp_auth_remove_basic(self.to_glib_none().0, basic.to_glib_none().0); ffi::gst_rtsp_auth_remove_basic(self.as_ref().to_glib_none().0, basic.to_glib_none().0);
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn remove_digest(&self, user: &str) { fn remove_digest(&self, user: &str) {
unsafe { unsafe {
ffi::gst_rtsp_auth_remove_digest(self.to_glib_none().0, user.to_glib_none().0); ffi::gst_rtsp_auth_remove_digest(self.as_ref().to_glib_none().0, user.to_glib_none().0);
} }
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod) { fn set_supported_methods(&self, methods: gst_rtsp::RTSPAuthMethod) {
unsafe { unsafe {
ffi::gst_rtsp_auth_set_supported_methods(self.to_glib_none().0, methods.to_glib()); ffi::gst_rtsp_auth_set_supported_methods(self.as_ref().to_glib_none().0, methods.to_glib());
} }
} }
fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode) { fn set_tls_authentication_mode(&self, mode: gio::TlsAuthenticationMode) {
unsafe { unsafe {
ffi::gst_rtsp_auth_set_tls_authentication_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_auth_set_tls_authentication_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_tls_certificate<'a, P: Into<Option<&'a gio::TlsCertificate>>>(&self, cert: P) { fn set_tls_certificate<'a, P: IsA<gio::TlsCertificate> + 'a, Q: Into<Option<&'a P>>>(&self, cert: Q) {
let cert = cert.into(); let cert = cert.into();
let cert = cert.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_auth_set_tls_certificate(self.to_glib_none().0, cert.0); ffi::gst_rtsp_auth_set_tls_certificate(self.as_ref().to_glib_none().0, cert.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_tls_database<'a, P: IsA<gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q) { fn set_tls_database<'a, P: IsA<gio::TlsDatabase> + 'a, Q: Into<Option<&'a P>>>(&self, database: Q) {
let database = database.into(); let database = database.into();
let database = database.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_auth_set_tls_database(self.to_glib_none().0, database.0); ffi::gst_rtsp_auth_set_tls_database(self.as_ref().to_glib_none().0, database.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn connect_accept_certificate<F: Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_accept_certificate<F: Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"accept-certificate\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"accept-certificate\0".as_ptr() as *const _,
transmute(accept_certificate_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(accept_certificate_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -191,5 +191,5 @@ impl<O: IsA<RTSPAuth>> RTSPAuthExt for O {
unsafe extern "C" fn accept_certificate_trampoline<P>(this: *mut ffi::GstRTSPAuth, connection: *mut gio_ffi::GTlsConnection, peer_cert: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) -> glib_ffi::gboolean unsafe extern "C" fn accept_certificate_trampoline<P>(this: *mut ffi::GstRTSPAuth, connection: *mut gio_ffi::GTlsConnection, peer_cert: *mut gio_ffi::GTlsCertificate, errors: gio_ffi::GTlsCertificateFlags, f: glib_ffi::gpointer) -> glib_ffi::gboolean
where P: IsA<RTSPAuth> { where P: IsA<RTSPAuth> {
let f: &&(Fn(&P, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &gio::TlsConnection, &gio::TlsCertificate, gio::TlsCertificateFlags) -> bool + Send + Sync + 'static) = transmute(f);
f(&RTSPAuth::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(connection), &from_glib_borrow(peer_cert), from_glib(errors)).to_glib() f(&RTSPAuth::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(connection), &from_glib_borrow(peer_cert), from_glib(errors)).to_glib()
} }

View file

@ -11,7 +11,7 @@ use RTSPThreadPool;
use ffi; use ffi;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -26,7 +26,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPClient(Object<ffi::GstRTSPClient, ffi::GstRTSPClientClass>); pub struct RTSPClient(Object<ffi::GstRTSPClient, ffi::GstRTSPClientClass, RTSPClientClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_client_get_type(), get_type => || ffi::gst_rtsp_client_get_type(),
@ -51,6 +51,8 @@ impl Default for RTSPClient {
unsafe impl Send for RTSPClient {} unsafe impl Send for RTSPClient {}
unsafe impl Sync for RTSPClient {} unsafe impl Sync for RTSPClient {}
pub const NONE_RTSP_CLIENT: Option<&RTSPClient> = None;
pub trait RTSPClientExt: 'static { pub trait RTSPClientExt: 'static {
fn close(&self); fn close(&self);
@ -66,21 +68,21 @@ pub trait RTSPClientExt: 'static {
//fn handle_message(&self, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; //fn handle_message(&self, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult;
//fn send_message<'a, P: Into<Option<&'a RTSPSession>>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult; //fn send_message<'a, P: IsA<RTSPSession> + 'a, Q: Into<Option<&'a P>>>(&self, session: Q, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult;
//fn session_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPClientSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession>; //fn session_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPClientSessionFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPSession>;
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P); fn set_auth<'a, P: IsA<RTSPAuth> + 'a, Q: Into<Option<&'a P>>>(&self, auth: Q);
//fn set_connection(&self, conn: /*Ignored*/&mut gst_rtsp::RTSPConnection) -> bool; //fn set_connection(&self, conn: /*Ignored*/&mut gst_rtsp::RTSPConnection) -> bool;
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P); fn set_mount_points<'a, P: IsA<RTSPMountPoints> + 'a, Q: Into<Option<&'a P>>>(&self, mounts: Q);
//fn set_send_func<'a, P: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, func: /*Unknown conversion*//*Unimplemented*/RTSPClientSendFunc, notify: P); //fn set_send_func<'a, P: Into<Option<&'a /*Ignored*/glib::DestroyNotify>>>(&self, func: /*Unknown conversion*//*Unimplemented*/RTSPClientSendFunc, notify: P);
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P); fn set_session_pool<'a, P: IsA<RTSPSessionPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P); fn set_thread_pool<'a, P: IsA<RTSPThreadPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn get_property_drop_backlog(&self) -> bool; fn get_property_drop_backlog(&self) -> bool;
@ -156,13 +158,13 @@ pub trait RTSPClientExt: 'static {
impl<O: IsA<RTSPClient>> RTSPClientExt for O { impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn close(&self) { fn close(&self) {
unsafe { unsafe {
ffi::gst_rtsp_client_close(self.to_glib_none().0); ffi::gst_rtsp_client_close(self.as_ref().to_glib_none().0);
} }
} }
fn get_auth(&self) -> Option<RTSPAuth> { fn get_auth(&self) -> Option<RTSPAuth> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_client_get_auth(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_client_get_auth(self.as_ref().to_glib_none().0))
} }
} }
@ -172,19 +174,19 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn get_mount_points(&self) -> Option<RTSPMountPoints> { fn get_mount_points(&self) -> Option<RTSPMountPoints> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_client_get_mount_points(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_client_get_mount_points(self.as_ref().to_glib_none().0))
} }
} }
fn get_session_pool(&self) -> Option<RTSPSessionPool> { fn get_session_pool(&self) -> Option<RTSPSessionPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_client_get_session_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_client_get_session_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_thread_pool(&self) -> Option<RTSPThreadPool> { fn get_thread_pool(&self) -> Option<RTSPThreadPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_client_get_thread_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_client_get_thread_pool(self.as_ref().to_glib_none().0))
} }
} }
@ -192,7 +194,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
// unsafe { TODO: call ffi::gst_rtsp_client_handle_message() } // unsafe { TODO: call ffi::gst_rtsp_client_handle_message() }
//} //}
//fn send_message<'a, P: Into<Option<&'a RTSPSession>>>(&self, session: P, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult { //fn send_message<'a, P: IsA<RTSPSession> + 'a, Q: Into<Option<&'a P>>>(&self, session: Q, message: /*Ignored*/&mut gst_rtsp::RTSPMessage) -> gst_rtsp::RTSPResult {
// unsafe { TODO: call ffi::gst_rtsp_client_send_message() } // unsafe { TODO: call ffi::gst_rtsp_client_send_message() }
//} //}
@ -200,11 +202,10 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
// unsafe { TODO: call ffi::gst_rtsp_client_session_filter() } // unsafe { TODO: call ffi::gst_rtsp_client_session_filter() }
//} //}
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P) { fn set_auth<'a, P: IsA<RTSPAuth> + 'a, Q: Into<Option<&'a P>>>(&self, auth: Q) {
let auth = auth.into(); let auth = auth.into();
let auth = auth.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_client_set_auth(self.to_glib_none().0, auth.0); ffi::gst_rtsp_client_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
@ -212,11 +213,10 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
// unsafe { TODO: call ffi::gst_rtsp_client_set_connection() } // unsafe { TODO: call ffi::gst_rtsp_client_set_connection() }
//} //}
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P) { fn set_mount_points<'a, P: IsA<RTSPMountPoints> + 'a, Q: Into<Option<&'a P>>>(&self, mounts: Q) {
let mounts = mounts.into(); let mounts = mounts.into();
let mounts = mounts.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_client_set_mount_points(self.to_glib_none().0, mounts.0); ffi::gst_rtsp_client_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
@ -224,19 +224,17 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
// unsafe { TODO: call ffi::gst_rtsp_client_set_send_func() } // unsafe { TODO: call ffi::gst_rtsp_client_set_send_func() }
//} //}
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P) { fn set_session_pool<'a, P: IsA<RTSPSessionPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_client_set_session_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_client_set_session_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P) { fn set_thread_pool<'a, P: IsA<RTSPThreadPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_client_set_thread_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_client_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
@ -257,7 +255,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_announce_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_announce_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"announce-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"announce-request\0".as_ptr() as *const _,
transmute(announce_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(announce_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -269,7 +267,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_closed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_closed<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"closed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"closed\0".as_ptr() as *const _,
transmute(closed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(closed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -277,7 +275,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_describe_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_describe_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"describe-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"describe-request\0".as_ptr() as *const _,
transmute(describe_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(describe_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -285,7 +283,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_get_parameter_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_get_parameter_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"get-parameter-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"get-parameter-request\0".as_ptr() as *const _,
transmute(get_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(get_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -293,7 +291,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_handle_response<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_handle_response<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"handle-response\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"handle-response\0".as_ptr() as *const _,
transmute(handle_response_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(handle_response_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -301,7 +299,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_new_session<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_new_session<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"new-session\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"new-session\0".as_ptr() as *const _,
transmute(new_session_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(new_session_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -309,7 +307,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_options_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_options_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"options-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"options-request\0".as_ptr() as *const _,
transmute(options_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(options_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -317,7 +315,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pause_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pause_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pause-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pause-request\0".as_ptr() as *const _,
transmute(pause_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pause_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -325,7 +323,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_play_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_play_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"play-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"play-request\0".as_ptr() as *const _,
transmute(play_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(play_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -334,7 +332,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_announce_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_announce_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-announce-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-announce-request\0".as_ptr() as *const _,
transmute(pre_announce_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_announce_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -343,7 +341,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_describe_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_describe_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-describe-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-describe-request\0".as_ptr() as *const _,
transmute(pre_describe_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_describe_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -352,7 +350,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_get_parameter_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_get_parameter_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-get-parameter-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-get-parameter-request\0".as_ptr() as *const _,
transmute(pre_get_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_get_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -361,7 +359,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_options_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_options_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-options-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-options-request\0".as_ptr() as *const _,
transmute(pre_options_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_options_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -370,7 +368,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_pause_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_pause_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-pause-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-pause-request\0".as_ptr() as *const _,
transmute(pre_pause_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_pause_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -379,7 +377,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_play_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_play_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-play-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-play-request\0".as_ptr() as *const _,
transmute(pre_play_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_play_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -388,7 +386,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_record_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_record_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-record-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-record-request\0".as_ptr() as *const _,
transmute(pre_record_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_record_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -397,7 +395,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_set_parameter_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_set_parameter_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-set-parameter-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-set-parameter-request\0".as_ptr() as *const _,
transmute(pre_set_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_set_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -406,7 +404,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_setup_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_setup_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-setup-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-setup-request\0".as_ptr() as *const _,
transmute(pre_setup_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_setup_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -415,7 +413,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_pre_teardown_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_pre_teardown_request<F: Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"pre-teardown-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"pre-teardown-request\0".as_ptr() as *const _,
transmute(pre_teardown_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(pre_teardown_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -423,7 +421,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_record_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_record_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"record-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"record-request\0".as_ptr() as *const _,
transmute(record_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(record_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -435,7 +433,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_set_parameter_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_set_parameter_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"set-parameter-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"set-parameter-request\0".as_ptr() as *const _,
transmute(set_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(set_parameter_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -443,7 +441,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_setup_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_setup_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"setup-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"setup-request\0".as_ptr() as *const _,
transmute(setup_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(setup_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -451,7 +449,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_teardown_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_teardown_request<F: Fn(&Self, &RTSPContext) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPContext) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"teardown-request\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"teardown-request\0".as_ptr() as *const _,
transmute(teardown_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(teardown_request_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -459,7 +457,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_property_drop_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_drop_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::drop-backlog\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::drop-backlog\0".as_ptr() as *const _,
transmute(notify_drop_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_drop_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -467,7 +465,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mount-points\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _,
transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -475,7 +473,7 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::session-pool\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _,
transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -484,165 +482,165 @@ impl<O: IsA<RTSPClient>> RTSPClientExt for O {
unsafe extern "C" fn announce_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn announce_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn closed_trampoline<P>(this: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) unsafe extern "C" fn closed_trampoline<P>(this: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) f(&RTSPClient::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn describe_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn describe_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn get_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn get_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn handle_response_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn handle_response_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn new_session_trampoline<P>(this: *mut ffi::GstRTSPClient, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer) unsafe extern "C" fn new_session_trampoline<P>(this: *mut ffi::GstRTSPClient, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn options_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn options_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn pause_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn pause_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn play_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn play_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_announce_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_announce_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_describe_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_describe_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_get_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_get_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_options_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_options_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_pause_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_pause_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_play_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_play_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_record_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_record_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_set_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_set_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_setup_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_setup_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
#[cfg(any(feature = "v1_12", feature = "dox"))] #[cfg(any(feature = "v1_12", feature = "dox"))]
unsafe extern "C" fn pre_teardown_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode unsafe extern "C" fn pre_teardown_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) -> gst_rtsp_ffi::GstRTSPStatusCode
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) -> gst_rtsp::RTSPStatusCode + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)).to_glib() f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx)).to_glib()
} }
unsafe extern "C" fn record_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn record_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn set_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn set_parameter_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn setup_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn setup_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn teardown_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer) unsafe extern "C" fn teardown_request_trampoline<P>(this: *mut ffi::GstRTSPClient, ctx: *mut ffi::GstRTSPContext, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPContext) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(ctx)) f(&RTSPClient::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(ctx))
} }
unsafe extern "C" fn notify_drop_backlog_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_drop_backlog_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) f(&RTSPClient::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) f(&RTSPClient::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPClient, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPClient> { where P: IsA<RTSPClient> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPClient::from_glib_borrow(this).downcast_unchecked()) f(&RTSPClient::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -13,7 +13,7 @@ use glib;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -27,7 +27,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPMedia(Object<ffi::GstRTSPMedia, ffi::GstRTSPMediaClass>); pub struct RTSPMedia(Object<ffi::GstRTSPMedia, ffi::GstRTSPMediaClass, RTSPMediaClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_media_get_type(), get_type => || ffi::gst_rtsp_media_get_type(),
@ -38,7 +38,7 @@ impl RTSPMedia {
pub fn new<P: IsA<gst::Element>>(element: &P) -> RTSPMedia { pub fn new<P: IsA<gst::Element>>(element: &P) -> RTSPMedia {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_new(element.to_glib_full())) from_glib_full(ffi::gst_rtsp_media_new(element.as_ref().to_glib_full()))
} }
} }
} }
@ -46,6 +46,8 @@ impl RTSPMedia {
unsafe impl Send for RTSPMedia {} unsafe impl Send for RTSPMedia {}
unsafe impl Sync for RTSPMedia {} unsafe impl Sync for RTSPMedia {}
pub const NONE_RTSP_MEDIA: Option<&RTSPMedia> = None;
pub trait RTSPMediaExt: 'static { pub trait RTSPMediaExt: 'static {
fn collect_streams(&self); fn collect_streams(&self);
@ -113,7 +115,7 @@ pub trait RTSPMediaExt: 'static {
//fn seekable(&self) -> /*Ignored*/gst::ClockTimeDiff; //fn seekable(&self) -> /*Ignored*/gst::ClockTimeDiff;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P); fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn set_buffer_size(&self, size: u32); fn set_buffer_size(&self, size: u32);
@ -153,7 +155,7 @@ pub trait RTSPMediaExt: 'static {
fn suspend(&self) -> Result<(), glib::error::BoolError>; fn suspend(&self) -> Result<(), glib::error::BoolError>;
fn take_pipeline(&self, pipeline: &gst::Pipeline); fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P);
fn unprepare(&self) -> Result<(), glib::error::BoolError>; fn unprepare(&self) -> Result<(), glib::error::BoolError>;
@ -211,7 +213,7 @@ pub trait RTSPMediaExt: 'static {
impl<O: IsA<RTSPMedia>> RTSPMediaExt for O { impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn collect_streams(&self) { fn collect_streams(&self) {
unsafe { unsafe {
ffi::gst_rtsp_media_collect_streams(self.to_glib_none().0); ffi::gst_rtsp_media_collect_streams(self.as_ref().to_glib_none().0);
} }
} }
@ -221,55 +223,55 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn create_stream<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(&self, payloader: &P, pad: &Q) -> Option<RTSPStream> { fn create_stream<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(&self, payloader: &P, pad: &Q) -> Option<RTSPStream> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_media_create_stream(self.to_glib_none().0, payloader.to_glib_none().0, pad.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_media_create_stream(self.as_ref().to_glib_none().0, payloader.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0))
} }
} }
fn find_stream(&self, control: &str) -> Option<RTSPStream> { fn find_stream(&self, control: &str) -> Option<RTSPStream> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_media_find_stream(self.to_glib_none().0, control.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_media_find_stream(self.as_ref().to_glib_none().0, control.to_glib_none().0))
} }
} }
fn get_address_pool(&self) -> Option<RTSPAddressPool> { fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_get_address_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_get_address_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_base_time(&self) -> gst::ClockTime { fn get_base_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_base_time(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_base_time(self.as_ref().to_glib_none().0))
} }
} }
fn get_buffer_size(&self) -> u32 { fn get_buffer_size(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_media_get_buffer_size(self.to_glib_none().0) ffi::gst_rtsp_media_get_buffer_size(self.as_ref().to_glib_none().0)
} }
} }
fn get_clock(&self) -> Option<gst::Clock> { fn get_clock(&self) -> Option<gst::Clock> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_get_clock(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_get_clock(self.as_ref().to_glib_none().0))
} }
} }
fn get_element(&self) -> Option<gst::Element> { fn get_element(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_get_element(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_get_element(self.as_ref().to_glib_none().0))
} }
} }
fn get_latency(&self) -> u32 { fn get_latency(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_media_get_latency(self.to_glib_none().0) ffi::gst_rtsp_media_get_latency(self.as_ref().to_glib_none().0)
} }
} }
fn get_multicast_iface(&self) -> Option<GString> { fn get_multicast_iface(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_get_multicast_iface(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_get_multicast_iface(self.as_ref().to_glib_none().0))
} }
} }
@ -279,49 +281,49 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn get_profiles(&self) -> gst_rtsp::RTSPProfile { fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_profiles(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_profiles(self.as_ref().to_glib_none().0))
} }
} }
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_protocols(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_protocols(self.as_ref().to_glib_none().0))
} }
} }
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_publish_clock_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_publish_clock_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_range_string(&self, play: bool, unit: gst_rtsp::RTSPRangeUnit) -> Option<GString> { fn get_range_string(&self, play: bool, unit: gst_rtsp::RTSPRangeUnit) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_get_range_string(self.to_glib_none().0, play.to_glib(), unit.to_glib())) from_glib_full(ffi::gst_rtsp_media_get_range_string(self.as_ref().to_glib_none().0, play.to_glib(), unit.to_glib()))
} }
} }
fn get_retransmission_time(&self) -> gst::ClockTime { fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_retransmission_time(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_retransmission_time(self.as_ref().to_glib_none().0))
} }
} }
fn get_status(&self) -> RTSPMediaStatus { fn get_status(&self) -> RTSPMediaStatus {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_status(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_status(self.as_ref().to_glib_none().0))
} }
} }
fn get_stream(&self, idx: u32) -> Option<RTSPStream> { fn get_stream(&self, idx: u32) -> Option<RTSPStream> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_media_get_stream(self.to_glib_none().0, idx)) from_glib_none(ffi::gst_rtsp_media_get_stream(self.as_ref().to_glib_none().0, idx))
} }
} }
fn get_suspend_mode(&self) -> RTSPSuspendMode { fn get_suspend_mode(&self) -> RTSPSuspendMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_suspend_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_suspend_mode(self.as_ref().to_glib_none().0))
} }
} }
@ -331,7 +333,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn get_transport_mode(&self) -> RTSPTransportMode { fn get_transport_mode(&self) -> RTSPTransportMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_get_transport_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_get_transport_mode(self.as_ref().to_glib_none().0))
} }
} }
@ -341,37 +343,37 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn is_eos_shutdown(&self) -> bool { fn is_eos_shutdown(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_is_eos_shutdown(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_is_eos_shutdown(self.as_ref().to_glib_none().0))
} }
} }
fn is_reusable(&self) -> bool { fn is_reusable(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_is_reusable(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_is_reusable(self.as_ref().to_glib_none().0))
} }
} }
fn is_shared(&self) -> bool { fn is_shared(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_is_shared(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_is_shared(self.as_ref().to_glib_none().0))
} }
} }
fn is_stop_on_disconnect(&self) -> bool { fn is_stop_on_disconnect(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_is_stop_on_disconnect(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_is_stop_on_disconnect(self.as_ref().to_glib_none().0))
} }
} }
fn is_time_provider(&self) -> bool { fn is_time_provider(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_is_time_provider(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_is_time_provider(self.as_ref().to_glib_none().0))
} }
} }
fn n_streams(&self) -> u32 { fn n_streams(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_media_n_streams(self.to_glib_none().0) ffi::gst_rtsp_media_n_streams(self.as_ref().to_glib_none().0)
} }
} }
@ -391,45 +393,42 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
// unsafe { TODO: call ffi::gst_rtsp_media_seekable() } // unsafe { TODO: call ffi::gst_rtsp_media_seekable() }
//} //}
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) { fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_set_address_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_media_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_buffer_size(&self, size: u32) { fn set_buffer_size(&self, size: u32) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_buffer_size(self.to_glib_none().0, size); ffi::gst_rtsp_media_set_buffer_size(self.as_ref().to_glib_none().0, size);
} }
} }
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) { fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) {
let clock = clock.into(); let clock = clock.into();
let clock = clock.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_set_clock(self.to_glib_none().0, clock.0); ffi::gst_rtsp_media_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_eos_shutdown(&self, eos_shutdown: bool) { fn set_eos_shutdown(&self, eos_shutdown: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib()); ffi::gst_rtsp_media_set_eos_shutdown(self.as_ref().to_glib_none().0, eos_shutdown.to_glib());
} }
} }
fn set_latency(&self, latency: u32) { fn set_latency(&self, latency: u32) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_latency(self.to_glib_none().0, latency); ffi::gst_rtsp_media_set_latency(self.as_ref().to_glib_none().0, latency);
} }
} }
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) { fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into(); let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); ffi::gst_rtsp_media_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0);
} }
} }
@ -439,43 +438,43 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn set_pipeline_state(&self, state: gst::State) { fn set_pipeline_state(&self, state: gst::State) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_pipeline_state(self.to_glib_none().0, state.to_glib()); ffi::gst_rtsp_media_set_pipeline_state(self.as_ref().to_glib_none().0, state.to_glib());
} }
} }
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_profiles(self.to_glib_none().0, profiles.to_glib()); ffi::gst_rtsp_media_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib());
} }
} }
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_protocols(self.to_glib_none().0, protocols.to_glib()); ffi::gst_rtsp_media_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib());
} }
} }
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_retransmission_time(self.to_glib_none().0, time.to_glib()); ffi::gst_rtsp_media_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib());
} }
} }
fn set_reusable(&self, reusable: bool) { fn set_reusable(&self, reusable: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_reusable(self.to_glib_none().0, reusable.to_glib()); ffi::gst_rtsp_media_set_reusable(self.as_ref().to_glib_none().0, reusable.to_glib());
} }
} }
fn set_shared(&self, shared: bool) { fn set_shared(&self, shared: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_shared(self.to_glib_none().0, shared.to_glib()); ffi::gst_rtsp_media_set_shared(self.as_ref().to_glib_none().0, shared.to_glib());
} }
} }
@ -485,19 +484,19 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) { fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib()); ffi::gst_rtsp_media_set_stop_on_disconnect(self.as_ref().to_glib_none().0, stop_on_disconnect.to_glib());
} }
} }
fn set_suspend_mode(&self, mode: RTSPSuspendMode) { fn set_suspend_mode(&self, mode: RTSPSuspendMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_suspend_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_set_suspend_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_transport_mode(&self, mode: RTSPTransportMode) { fn set_transport_mode(&self, mode: RTSPTransportMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_set_transport_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
@ -507,31 +506,31 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn suspend(&self) -> Result<(), glib::error::BoolError> { fn suspend(&self) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_media_suspend(self.to_glib_none().0), "Failed to suspend media") glib_result_from_gboolean!(ffi::gst_rtsp_media_suspend(self.as_ref().to_glib_none().0), "Failed to suspend media")
} }
} }
fn take_pipeline(&self, pipeline: &gst::Pipeline) { fn take_pipeline<P: IsA<gst::Pipeline>>(&self, pipeline: &P) {
unsafe { unsafe {
ffi::gst_rtsp_media_take_pipeline(self.to_glib_none().0, pipeline.to_glib_full()); ffi::gst_rtsp_media_take_pipeline(self.as_ref().to_glib_none().0, pipeline.as_ref().to_glib_full());
} }
} }
fn unprepare(&self) -> Result<(), glib::error::BoolError> { fn unprepare(&self) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_media_unprepare(self.to_glib_none().0), "Failed to unprepare media") glib_result_from_gboolean!(ffi::gst_rtsp_media_unprepare(self.as_ref().to_glib_none().0), "Failed to unprepare media")
} }
} }
fn unsuspend(&self) -> Result<(), glib::error::BoolError> { fn unsuspend(&self) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_media_unsuspend(self.to_glib_none().0), "Failed to unsuspend media") glib_result_from_gboolean!(ffi::gst_rtsp_media_unsuspend(self.as_ref().to_glib_none().0), "Failed to unsuspend media")
} }
} }
fn use_time_provider(&self, time_provider: bool) { fn use_time_provider(&self, time_provider: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_use_time_provider(self.to_glib_none().0, time_provider.to_glib()); ffi::gst_rtsp_media_use_time_provider(self.as_ref().to_glib_none().0, time_provider.to_glib());
} }
} }
@ -576,7 +575,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_new_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_new_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"new-state\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"new-state\0".as_ptr() as *const _,
transmute(new_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(new_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -584,7 +583,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_new_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_new_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"new-stream\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"new-stream\0".as_ptr() as *const _,
transmute(new_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(new_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -592,7 +591,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_prepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_prepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"prepared\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"prepared\0".as_ptr() as *const _,
transmute(prepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(prepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -600,7 +599,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_removed_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_removed_stream<F: Fn(&Self, &RTSPStream) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPStream) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"removed-stream\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"removed-stream\0".as_ptr() as *const _,
transmute(removed_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(removed_stream_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -608,7 +607,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_target_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_target_state<F: Fn(&Self, i32) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, i32) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"target-state\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"target-state\0".as_ptr() as *const _,
transmute(target_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(target_state_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -616,7 +615,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_unprepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_unprepared<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"unprepared\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"unprepared\0".as_ptr() as *const _,
transmute(unprepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(unprepared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -624,7 +623,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _,
transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -632,7 +631,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::clock\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _,
transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -640,7 +639,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _,
transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -648,7 +647,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _,
transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -656,7 +655,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _,
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -664,7 +663,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _,
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -672,7 +671,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_reusable_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_reusable_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::reusable\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::reusable\0".as_ptr() as *const _,
transmute(notify_reusable_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_reusable_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -680,7 +679,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::shared\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _,
transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -688,7 +687,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _,
transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -696,7 +695,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _,
transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -704,7 +703,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_time_provider_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_time_provider_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::time-provider\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::time-provider\0".as_ptr() as *const _,
transmute(notify_time_provider_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_time_provider_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -712,7 +711,7 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _,
transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -721,107 +720,107 @@ impl<O: IsA<RTSPMedia>> RTSPMediaExt for O {
unsafe extern "C" fn new_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer) unsafe extern "C" fn new_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object)
} }
unsafe extern "C" fn new_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer) unsafe extern "C" fn new_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn prepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) unsafe extern "C" fn prepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn removed_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer) unsafe extern "C" fn removed_stream_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: *mut ffi::GstRTSPStream, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPStream) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn target_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer) unsafe extern "C" fn target_state_trampoline<P>(this: *mut ffi::GstRTSPMedia, object: libc::c_int, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, i32) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked(), object) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast(), object)
} }
unsafe extern "C" fn unprepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) unsafe extern "C" fn unprepared_trampoline<P>(this: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_reusable_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_reusable_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_time_provider_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_time_provider_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMedia, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMedia> { where P: IsA<RTSPMedia> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMedia::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMedia::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -12,7 +12,7 @@ use glib;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -25,7 +25,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPMediaFactory(Object<ffi::GstRTSPMediaFactory, ffi::GstRTSPMediaFactoryClass>); pub struct RTSPMediaFactory(Object<ffi::GstRTSPMediaFactory, ffi::GstRTSPMediaFactoryClass, RTSPMediaFactoryClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_media_factory_get_type(), get_type => || ffi::gst_rtsp_media_factory_get_type(),
@ -50,6 +50,8 @@ impl Default for RTSPMediaFactory {
unsafe impl Send for RTSPMediaFactory {} unsafe impl Send for RTSPMediaFactory {}
unsafe impl Sync for RTSPMediaFactory {} unsafe impl Sync for RTSPMediaFactory {}
pub const NONE_RTSP_MEDIA_FACTORY: Option<&RTSPMediaFactory> = None;
pub trait RTSPMediaFactoryExt: 'static { pub trait RTSPMediaFactoryExt: 'static {
//fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); //fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
@ -91,7 +93,7 @@ pub trait RTSPMediaFactoryExt: 'static {
fn is_stop_on_disonnect(&self) -> bool; fn is_stop_on_disonnect(&self) -> bool;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P); fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn set_buffer_size(&self, size: u32); fn set_buffer_size(&self, size: u32);
@ -165,55 +167,55 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia> { fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_construct(self.to_glib_none().0, url.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_construct(self.as_ref().to_glib_none().0, url.to_glib_none().0))
} }
} }
fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> { fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_media_factory_create_element(self.to_glib_none().0, url.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_media_factory_create_element(self.as_ref().to_glib_none().0, url.to_glib_none().0))
} }
} }
fn get_address_pool(&self) -> Option<RTSPAddressPool> { fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_address_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_get_address_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_buffer_size(&self) -> u32 { fn get_buffer_size(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_get_buffer_size(self.to_glib_none().0) ffi::gst_rtsp_media_factory_get_buffer_size(self.as_ref().to_glib_none().0)
} }
} }
fn get_clock(&self) -> Option<gst::Clock> { fn get_clock(&self) -> Option<gst::Clock> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.as_ref().to_glib_none().0))
} }
} }
fn get_latency(&self) -> u32 { fn get_latency(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_get_latency(self.to_glib_none().0) ffi::gst_rtsp_media_factory_get_latency(self.as_ref().to_glib_none().0)
} }
} }
fn get_launch(&self) -> Option<GString> { fn get_launch(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.as_ref().to_glib_none().0))
} }
} }
fn get_media_gtype(&self) -> glib::types::Type { fn get_media_gtype(&self) -> glib::types::Type {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.as_ref().to_glib_none().0))
} }
} }
fn get_multicast_iface(&self) -> Option<GString> { fn get_multicast_iface(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.as_ref().to_glib_none().0))
} }
} }
@ -223,109 +225,106 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn get_profiles(&self) -> gst_rtsp::RTSPProfile { fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.as_ref().to_glib_none().0))
} }
} }
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.as_ref().to_glib_none().0))
} }
} }
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_publish_clock_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_publish_clock_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_retransmission_time(&self) -> gst::ClockTime { fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(self.as_ref().to_glib_none().0))
} }
} }
fn get_suspend_mode(&self) -> RTSPSuspendMode { fn get_suspend_mode(&self) -> RTSPSuspendMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_transport_mode(&self) -> RTSPTransportMode { fn get_transport_mode(&self) -> RTSPTransportMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.as_ref().to_glib_none().0))
} }
} }
fn is_eos_shutdown(&self) -> bool { fn is_eos_shutdown(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.as_ref().to_glib_none().0))
} }
} }
fn is_shared(&self) -> bool { fn is_shared(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_shared(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_is_shared(self.as_ref().to_glib_none().0))
} }
} }
fn is_stop_on_disonnect(&self) -> bool { fn is_stop_on_disonnect(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.as_ref().to_glib_none().0))
} }
} }
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) { fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_address_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_media_factory_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_buffer_size(&self, size: u32) { fn set_buffer_size(&self, size: u32) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_buffer_size(self.to_glib_none().0, size); ffi::gst_rtsp_media_factory_set_buffer_size(self.as_ref().to_glib_none().0, size);
} }
} }
fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) { fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) {
let clock = clock.into(); let clock = clock.into();
let clock = clock.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_clock(self.to_glib_none().0, clock.0); ffi::gst_rtsp_media_factory_set_clock(self.as_ref().to_glib_none().0, clock.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_eos_shutdown(&self, eos_shutdown: bool) { fn set_eos_shutdown(&self, eos_shutdown: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib()); ffi::gst_rtsp_media_factory_set_eos_shutdown(self.as_ref().to_glib_none().0, eos_shutdown.to_glib());
} }
} }
fn set_latency(&self, latency: u32) { fn set_latency(&self, latency: u32) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_latency(self.to_glib_none().0, latency); ffi::gst_rtsp_media_factory_set_latency(self.as_ref().to_glib_none().0, latency);
} }
} }
fn set_launch(&self, launch: &str) { fn set_launch(&self, launch: &str) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_launch(self.to_glib_none().0, launch.to_glib_none().0); ffi::gst_rtsp_media_factory_set_launch(self.as_ref().to_glib_none().0, launch.to_glib_none().0);
} }
} }
fn set_media_gtype(&self, media_gtype: glib::types::Type) { fn set_media_gtype(&self, media_gtype: glib::types::Type) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_media_gtype(self.to_glib_none().0, media_gtype.to_glib()); ffi::gst_rtsp_media_factory_set_media_gtype(self.as_ref().to_glib_none().0, media_gtype.to_glib());
} }
} }
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) { fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into(); let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); ffi::gst_rtsp_media_factory_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0);
} }
} }
@ -335,49 +334,49 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_profiles(self.to_glib_none().0, profiles.to_glib()); ffi::gst_rtsp_media_factory_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib());
} }
} }
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_protocols(self.to_glib_none().0, protocols.to_glib()); ffi::gst_rtsp_media_factory_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib());
} }
} }
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_factory_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_retransmission_time(self.to_glib_none().0, time.to_glib()); ffi::gst_rtsp_media_factory_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib());
} }
} }
fn set_shared(&self, shared: bool) { fn set_shared(&self, shared: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_shared(self.to_glib_none().0, shared.to_glib()); ffi::gst_rtsp_media_factory_set_shared(self.as_ref().to_glib_none().0, shared.to_glib());
} }
} }
fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) { fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib()); ffi::gst_rtsp_media_factory_set_stop_on_disconnect(self.as_ref().to_glib_none().0, stop_on_disconnect.to_glib());
} }
} }
fn set_suspend_mode(&self, mode: RTSPSuspendMode) { fn set_suspend_mode(&self, mode: RTSPSuspendMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_suspend_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_factory_set_suspend_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_transport_mode(&self, mode: RTSPTransportMode) { fn set_transport_mode(&self, mode: RTSPTransportMode) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_set_transport_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_media_factory_set_transport_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
@ -408,7 +407,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_media_configure<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_media_configure<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"media-configure\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"media-configure\0".as_ptr() as *const _,
transmute(media_configure_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(media_configure_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -416,7 +415,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_media_constructed<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_media_constructed<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"media-constructed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"media-constructed\0".as_ptr() as *const _,
transmute(media_constructed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(media_constructed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -424,7 +423,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::buffer-size\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::buffer-size\0".as_ptr() as *const _,
transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -432,7 +431,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::clock\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::clock\0".as_ptr() as *const _,
transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -440,7 +439,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::eos-shutdown\0".as_ptr() as *const _,
transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -448,7 +447,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::latency\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::latency\0".as_ptr() as *const _,
transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -456,7 +455,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_launch_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_launch_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::launch\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::launch\0".as_ptr() as *const _,
transmute(notify_launch_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_launch_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -464,7 +463,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _,
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -472,7 +471,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _,
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -480,7 +479,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::shared\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::shared\0".as_ptr() as *const _,
transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -488,7 +487,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::stop-on-disconnect\0".as_ptr() as *const _,
transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -496,7 +495,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::suspend-mode\0".as_ptr() as *const _,
transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -504,7 +503,7 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::transport-mode\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::transport-mode\0".as_ptr() as *const _,
transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -513,77 +512,77 @@ impl<O: IsA<RTSPMediaFactory>> RTSPMediaFactoryExt for O {
unsafe extern "C" fn media_configure_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) unsafe extern "C" fn media_configure_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn media_constructed_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer) unsafe extern "C" fn media_constructed_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_launch_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_launch_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> { where P: IsA<RTSPMediaFactory> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactory::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -7,7 +7,7 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -18,7 +18,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPMediaFactoryURI(Object<ffi::GstRTSPMediaFactoryURI, ffi::GstRTSPMediaFactoryURIClass>): RTSPMediaFactory; pub struct RTSPMediaFactoryURI(Object<ffi::GstRTSPMediaFactoryURI, ffi::GstRTSPMediaFactoryURIClass, RTSPMediaFactoryURIClass>) @extends RTSPMediaFactory;
match fn { match fn {
get_type => || ffi::gst_rtsp_media_factory_uri_get_type(), get_type => || ffi::gst_rtsp_media_factory_uri_get_type(),
@ -43,6 +43,8 @@ impl Default for RTSPMediaFactoryURI {
unsafe impl Send for RTSPMediaFactoryURI {} unsafe impl Send for RTSPMediaFactoryURI {}
unsafe impl Sync for RTSPMediaFactoryURI {} unsafe impl Sync for RTSPMediaFactoryURI {}
pub const NONE_RTSP_MEDIA_FACTORY_URI: Option<&RTSPMediaFactoryURI> = None;
pub trait RTSPMediaFactoryURIExt: 'static { pub trait RTSPMediaFactoryURIExt: 'static {
fn get_uri(&self) -> Option<GString>; fn get_uri(&self) -> Option<GString>;
@ -60,13 +62,13 @@ pub trait RTSPMediaFactoryURIExt: 'static {
impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O { impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {
fn get_uri(&self) -> Option<GString> { fn get_uri(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_media_factory_uri_get_uri(self.as_ref().to_glib_none().0))
} }
} }
fn set_uri(&self, uri: &str) { fn set_uri(&self, uri: &str) {
unsafe { unsafe {
ffi::gst_rtsp_media_factory_uri_set_uri(self.to_glib_none().0, uri.to_glib_none().0); ffi::gst_rtsp_media_factory_uri_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0);
} }
} }
@ -87,7 +89,7 @@ impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {
fn connect_property_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_uri_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::uri\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::uri\0".as_ptr() as *const _,
transmute(notify_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -95,7 +97,7 @@ impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {
fn connect_property_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_use_gstpay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::use-gstpay\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::use-gstpay\0".as_ptr() as *const _,
transmute(notify_use_gstpay_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_use_gstpay_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -104,11 +106,11 @@ impl<O: IsA<RTSPMediaFactoryURI>> RTSPMediaFactoryURIExt for O {
unsafe extern "C" fn notify_uri_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_uri_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactoryURI> { where P: IsA<RTSPMediaFactoryURI> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_use_gstpay_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_use_gstpay_trampoline<P>(this: *mut ffi::GstRTSPMediaFactoryURI, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactoryURI> { where P: IsA<RTSPMediaFactoryURI> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPMediaFactoryURI::from_glib_borrow(this).downcast_unchecked()) f(&RTSPMediaFactoryURI::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -11,7 +11,7 @@ use gst_rtsp;
use std::mem; use std::mem;
glib_wrapper! { glib_wrapper! {
pub struct RTSPMountPoints(Object<ffi::GstRTSPMountPoints, ffi::GstRTSPMountPointsClass>); pub struct RTSPMountPoints(Object<ffi::GstRTSPMountPoints, ffi::GstRTSPMountPointsClass, RTSPMountPointsClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_mount_points_get_type(), get_type => || ffi::gst_rtsp_mount_points_get_type(),
@ -36,6 +36,8 @@ impl Default for RTSPMountPoints {
unsafe impl Send for RTSPMountPoints {} unsafe impl Send for RTSPMountPoints {}
unsafe impl Sync for RTSPMountPoints {} unsafe impl Sync for RTSPMountPoints {}
pub const NONE_RTSP_MOUNT_POINTS: Option<&RTSPMountPoints> = None;
pub trait RTSPMountPointsExt: 'static { pub trait RTSPMountPointsExt: 'static {
fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P); fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P);
@ -49,27 +51,27 @@ pub trait RTSPMountPointsExt: 'static {
impl<O: IsA<RTSPMountPoints>> RTSPMountPointsExt for O { impl<O: IsA<RTSPMountPoints>> RTSPMountPointsExt for O {
fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P) { fn add_factory<P: IsA<RTSPMediaFactory>>(&self, path: &str, factory: &P) {
unsafe { unsafe {
ffi::gst_rtsp_mount_points_add_factory(self.to_glib_none().0, path.to_glib_none().0, factory.to_glib_full()); ffi::gst_rtsp_mount_points_add_factory(self.as_ref().to_glib_none().0, path.to_glib_none().0, factory.as_ref().to_glib_full());
} }
} }
fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<GString> { fn make_path(&self, url: &gst_rtsp::RTSPUrl) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_mount_points_make_path(self.to_glib_none().0, url.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_mount_points_make_path(self.as_ref().to_glib_none().0, url.to_glib_none().0))
} }
} }
fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) { fn match_(&self, path: &str) -> (RTSPMediaFactory, i32) {
unsafe { unsafe {
let mut matched = mem::uninitialized(); let mut matched = mem::uninitialized();
let ret = from_glib_full(ffi::gst_rtsp_mount_points_match(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); let ret = from_glib_full(ffi::gst_rtsp_mount_points_match(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched));
(ret, matched) (ret, matched)
} }
} }
fn remove_factory(&self, path: &str) { fn remove_factory(&self, path: &str) {
unsafe { unsafe {
ffi::gst_rtsp_mount_points_remove_factory(self.to_glib_none().0, path.to_glib_none().0); ffi::gst_rtsp_mount_points_remove_factory(self.as_ref().to_glib_none().0, path.to_glib_none().0);
} }
} }
} }

View file

@ -12,7 +12,7 @@ use ffi;
use gio; use gio;
use glib; use glib;
use glib::GString; use glib::GString;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -23,7 +23,7 @@ use std::mem::transmute;
use std::ptr; use std::ptr;
glib_wrapper! { glib_wrapper! {
pub struct RTSPServer(Object<ffi::GstRTSPServer, ffi::GstRTSPServerClass>); pub struct RTSPServer(Object<ffi::GstRTSPServer, ffi::GstRTSPServerClass, RTSPServerClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_server_get_type(), get_type => || ffi::gst_rtsp_server_get_type(),
@ -38,10 +38,10 @@ impl RTSPServer {
} }
} }
pub fn io_func<P: IsA<RTSPServer>>(socket: &gio::Socket, condition: glib::IOCondition, server: &P) -> bool { pub fn io_func<P: IsA<gio::Socket>, Q: IsA<RTSPServer>>(socket: &P, condition: glib::IOCondition, server: &Q) -> bool {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib(ffi::gst_rtsp_server_io_func(socket.to_glib_none().0, condition.to_glib(), server.to_glib_none().0)) from_glib(ffi::gst_rtsp_server_io_func(socket.as_ref().to_glib_none().0, condition.to_glib(), server.as_ref().to_glib_none().0))
} }
} }
} }
@ -55,12 +55,14 @@ impl Default for RTSPServer {
unsafe impl Send for RTSPServer {} unsafe impl Send for RTSPServer {}
unsafe impl Sync for RTSPServer {} unsafe impl Sync for RTSPServer {}
pub const NONE_RTSP_SERVER: Option<&RTSPServer> = None;
pub trait RTSPServerExt: 'static { pub trait RTSPServerExt: 'static {
//fn client_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPServerClientFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPClient>; //fn client_filter<'a, P: Into<Option<&'a /*Unimplemented*/RTSPServerClientFilterFunc>>, Q: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, func: P, user_data: Q) -> Vec<RTSPClient>;
fn create_socket<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<gio::Socket, Error>; fn create_socket<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>>(&self, cancellable: Q) -> Result<gio::Socket, Error>;
fn create_source<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Source, Error>; fn create_source<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>>(&self, cancellable: Q) -> Result<glib::Source, Error>;
fn get_address(&self) -> Option<GString>; fn get_address(&self) -> Option<GString>;
@ -80,19 +82,19 @@ pub trait RTSPServerExt: 'static {
fn set_address(&self, address: &str); fn set_address(&self, address: &str);
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P); fn set_auth<'a, P: IsA<RTSPAuth> + 'a, Q: Into<Option<&'a P>>>(&self, auth: Q);
fn set_backlog(&self, backlog: i32); fn set_backlog(&self, backlog: i32);
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P); fn set_mount_points<'a, P: IsA<RTSPMountPoints> + 'a, Q: Into<Option<&'a P>>>(&self, mounts: Q);
fn set_service(&self, service: &str); fn set_service(&self, service: &str);
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P); fn set_session_pool<'a, P: IsA<RTSPSessionPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P); fn set_thread_pool<'a, P: IsA<RTSPThreadPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn transfer_connection<'a, P: Into<Option<&'a str>>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool; fn transfer_connection<'a, P: IsA<gio::Socket>, Q: Into<Option<&'a str>>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> bool;
fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId; fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
@ -114,136 +116,129 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
// unsafe { TODO: call ffi::gst_rtsp_server_client_filter() } // unsafe { TODO: call ffi::gst_rtsp_server_client_filter() }
//} //}
fn create_socket<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<gio::Socket, Error> { fn create_socket<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>>(&self, cancellable: Q) -> Result<gio::Socket, Error> {
let cancellable = cancellable.into(); let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::gst_rtsp_server_create_socket(self.to_glib_none().0, cancellable.0, &mut error); let ret = ffi::gst_rtsp_server_create_socket(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
fn create_source<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, cancellable: P) -> Result<glib::Source, Error> { fn create_source<'a, P: IsA<gio::Cancellable> + 'a, Q: Into<Option<&'a P>>>(&self, cancellable: Q) -> Result<glib::Source, Error> {
let cancellable = cancellable.into(); let cancellable = cancellable.into();
let cancellable = cancellable.to_glib_none();
unsafe { unsafe {
let mut error = ptr::null_mut(); let mut error = ptr::null_mut();
let ret = ffi::gst_rtsp_server_create_source(self.to_glib_none().0, cancellable.0, &mut error); let ret = ffi::gst_rtsp_server_create_source(self.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
} }
} }
fn get_address(&self) -> Option<GString> { fn get_address(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_address(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_address(self.as_ref().to_glib_none().0))
} }
} }
fn get_auth(&self) -> Option<RTSPAuth> { fn get_auth(&self) -> Option<RTSPAuth> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_auth(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_auth(self.as_ref().to_glib_none().0))
} }
} }
fn get_backlog(&self) -> i32 { fn get_backlog(&self) -> i32 {
unsafe { unsafe {
ffi::gst_rtsp_server_get_backlog(self.to_glib_none().0) ffi::gst_rtsp_server_get_backlog(self.as_ref().to_glib_none().0)
} }
} }
fn get_bound_port(&self) -> i32 { fn get_bound_port(&self) -> i32 {
unsafe { unsafe {
ffi::gst_rtsp_server_get_bound_port(self.to_glib_none().0) ffi::gst_rtsp_server_get_bound_port(self.as_ref().to_glib_none().0)
} }
} }
fn get_mount_points(&self) -> Option<RTSPMountPoints> { fn get_mount_points(&self) -> Option<RTSPMountPoints> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_mount_points(self.as_ref().to_glib_none().0))
} }
} }
fn get_service(&self) -> Option<GString> { fn get_service(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_service(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_service(self.as_ref().to_glib_none().0))
} }
} }
fn get_session_pool(&self) -> Option<RTSPSessionPool> { fn get_session_pool(&self) -> Option<RTSPSessionPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_session_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_thread_pool(&self) -> Option<RTSPThreadPool> { fn get_thread_pool(&self) -> Option<RTSPThreadPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_server_get_thread_pool(self.as_ref().to_glib_none().0))
} }
} }
fn set_address(&self, address: &str) { fn set_address(&self, address: &str) {
unsafe { unsafe {
ffi::gst_rtsp_server_set_address(self.to_glib_none().0, address.to_glib_none().0); ffi::gst_rtsp_server_set_address(self.as_ref().to_glib_none().0, address.to_glib_none().0);
} }
} }
fn set_auth<'a, P: Into<Option<&'a RTSPAuth>>>(&self, auth: P) { fn set_auth<'a, P: IsA<RTSPAuth> + 'a, Q: Into<Option<&'a P>>>(&self, auth: Q) {
let auth = auth.into(); let auth = auth.into();
let auth = auth.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_server_set_auth(self.to_glib_none().0, auth.0); ffi::gst_rtsp_server_set_auth(self.as_ref().to_glib_none().0, auth.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_backlog(&self, backlog: i32) { fn set_backlog(&self, backlog: i32) {
unsafe { unsafe {
ffi::gst_rtsp_server_set_backlog(self.to_glib_none().0, backlog); ffi::gst_rtsp_server_set_backlog(self.as_ref().to_glib_none().0, backlog);
} }
} }
fn set_mount_points<'a, P: Into<Option<&'a RTSPMountPoints>>>(&self, mounts: P) { fn set_mount_points<'a, P: IsA<RTSPMountPoints> + 'a, Q: Into<Option<&'a P>>>(&self, mounts: Q) {
let mounts = mounts.into(); let mounts = mounts.into();
let mounts = mounts.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_server_set_mount_points(self.to_glib_none().0, mounts.0); ffi::gst_rtsp_server_set_mount_points(self.as_ref().to_glib_none().0, mounts.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_service(&self, service: &str) { fn set_service(&self, service: &str) {
unsafe { unsafe {
ffi::gst_rtsp_server_set_service(self.to_glib_none().0, service.to_glib_none().0); ffi::gst_rtsp_server_set_service(self.as_ref().to_glib_none().0, service.to_glib_none().0);
} }
} }
fn set_session_pool<'a, P: Into<Option<&'a RTSPSessionPool>>>(&self, pool: P) { fn set_session_pool<'a, P: IsA<RTSPSessionPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_server_set_session_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_server_set_session_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_thread_pool<'a, P: Into<Option<&'a RTSPThreadPool>>>(&self, pool: P) { fn set_thread_pool<'a, P: IsA<RTSPThreadPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_server_set_thread_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_server_set_thread_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn transfer_connection<'a, P: Into<Option<&'a str>>>(&self, socket: &gio::Socket, ip: &str, port: i32, initial_buffer: P) -> bool { fn transfer_connection<'a, P: IsA<gio::Socket>, Q: Into<Option<&'a str>>>(&self, socket: &P, ip: &str, port: i32, initial_buffer: Q) -> bool {
let initial_buffer = initial_buffer.into(); let initial_buffer = initial_buffer.into();
let initial_buffer = initial_buffer.to_glib_none();
unsafe { unsafe {
from_glib(ffi::gst_rtsp_server_transfer_connection(self.to_glib_none().0, socket.to_glib_full(), ip.to_glib_none().0, port, initial_buffer.0)) from_glib(ffi::gst_rtsp_server_transfer_connection(self.as_ref().to_glib_none().0, socket.as_ref().to_glib_full(), ip.to_glib_none().0, port, initial_buffer.to_glib_none().0))
} }
} }
fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_client_connected<F: Fn(&Self, &RTSPClient) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPClient) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPClient) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"client-connected\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"client-connected\0".as_ptr() as *const _,
transmute(client_connected_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(client_connected_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -251,7 +246,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_address_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_address_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::address\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::address\0".as_ptr() as *const _,
transmute(notify_address_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_address_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -259,7 +254,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_backlog_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::backlog\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::backlog\0".as_ptr() as *const _,
transmute(notify_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_backlog_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -267,7 +262,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_bound_port_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_bound_port_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::bound-port\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::bound-port\0".as_ptr() as *const _,
transmute(notify_bound_port_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_bound_port_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -275,7 +270,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_mount_points_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::mount-points\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::mount-points\0".as_ptr() as *const _,
transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_mount_points_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -283,7 +278,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_service_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_service_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::service\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::service\0".as_ptr() as *const _,
transmute(notify_service_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_service_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -291,7 +286,7 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_session_pool_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::session-pool\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::session-pool\0".as_ptr() as *const _,
transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_session_pool_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -300,41 +295,41 @@ impl<O: IsA<RTSPServer>> RTSPServerExt for O {
unsafe extern "C" fn client_connected_trampoline<P>(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer) unsafe extern "C" fn client_connected_trampoline<P>(this: *mut ffi::GstRTSPServer, object: *mut ffi::GstRTSPClient, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P, &RTSPClient) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPClient) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPServer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn notify_address_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_address_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_backlog_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_backlog_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_bound_port_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_bound_port_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_mount_points_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_service_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_service_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_session_pool_trampoline<P>(this: *mut ffi::GstRTSPServer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPServer> { where P: IsA<RTSPServer> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPServer::from_glib_borrow(this).downcast_unchecked()) f(&RTSPServer::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -8,7 +8,7 @@ use ffi;
use glib::GString; use glib::GString;
use glib::StaticType; use glib::StaticType;
use glib::Value; use glib::Value;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -20,7 +20,7 @@ use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPSession(Object<ffi::GstRTSPSession, ffi::GstRTSPSessionClass>); pub struct RTSPSession(Object<ffi::GstRTSPSession, ffi::GstRTSPSessionClass, RTSPSessionClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_session_get_type(), get_type => || ffi::gst_rtsp_session_get_type(),
@ -39,6 +39,8 @@ impl RTSPSession {
unsafe impl Send for RTSPSession {} unsafe impl Send for RTSPSession {}
unsafe impl Sync for RTSPSession {} unsafe impl Sync for RTSPSession {}
pub const NONE_RTSP_SESSION: Option<&RTSPSession> = None;
pub trait RTSPSessionExt: 'static { pub trait RTSPSessionExt: 'static {
fn allow_expire(&self); fn allow_expire(&self);
@ -64,7 +66,7 @@ pub trait RTSPSessionExt: 'static {
fn prevent_expire(&self); fn prevent_expire(&self);
fn release_media(&self, media: &RTSPSessionMedia) -> bool; fn release_media<P: IsA<RTSPSessionMedia>>(&self, media: &P) -> bool;
fn set_timeout(&self, timeout: u32); fn set_timeout(&self, timeout: u32);
@ -82,7 +84,7 @@ pub trait RTSPSessionExt: 'static {
impl<O: IsA<RTSPSession>> RTSPSessionExt for O { impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn allow_expire(&self) { fn allow_expire(&self) {
unsafe { unsafe {
ffi::gst_rtsp_session_allow_expire(self.to_glib_none().0); ffi::gst_rtsp_session_allow_expire(self.as_ref().to_glib_none().0);
} }
} }
@ -92,27 +94,27 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn get_header(&self) -> Option<GString> { fn get_header(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_session_get_header(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_session_get_header(self.as_ref().to_glib_none().0))
} }
} }
fn get_media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) { fn get_media(&self, path: &str) -> (Option<RTSPSessionMedia>, i32) {
unsafe { unsafe {
let mut matched = mem::uninitialized(); let mut matched = mem::uninitialized();
let ret = from_glib_none(ffi::gst_rtsp_session_get_media(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); let ret = from_glib_none(ffi::gst_rtsp_session_get_media(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched));
(ret, matched) (ret, matched)
} }
} }
fn get_sessionid(&self) -> Option<GString> { fn get_sessionid(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_session_get_sessionid(self.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_session_get_sessionid(self.as_ref().to_glib_none().0))
} }
} }
fn get_timeout(&self) -> u32 { fn get_timeout(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_session_get_timeout(self.to_glib_none().0) ffi::gst_rtsp_session_get_timeout(self.as_ref().to_glib_none().0)
} }
} }
@ -122,13 +124,13 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn is_expired_usec(&self, now: i64) -> bool { fn is_expired_usec(&self, now: i64) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_session_is_expired_usec(self.to_glib_none().0, now)) from_glib(ffi::gst_rtsp_session_is_expired_usec(self.as_ref().to_glib_none().0, now))
} }
} }
fn manage_media<P: IsA<RTSPMedia>>(&self, path: &str, media: &P) -> Option<RTSPSessionMedia> { fn manage_media<P: IsA<RTSPMedia>>(&self, path: &str, media: &P) -> Option<RTSPSessionMedia> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_session_manage_media(self.to_glib_none().0, path.to_glib_none().0, media.to_glib_full())) from_glib_none(ffi::gst_rtsp_session_manage_media(self.as_ref().to_glib_none().0, path.to_glib_none().0, media.as_ref().to_glib_full()))
} }
} }
@ -138,31 +140,31 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn next_timeout_usec(&self, now: i64) -> i32 { fn next_timeout_usec(&self, now: i64) -> i32 {
unsafe { unsafe {
ffi::gst_rtsp_session_next_timeout_usec(self.to_glib_none().0, now) ffi::gst_rtsp_session_next_timeout_usec(self.as_ref().to_glib_none().0, now)
} }
} }
fn prevent_expire(&self) { fn prevent_expire(&self) {
unsafe { unsafe {
ffi::gst_rtsp_session_prevent_expire(self.to_glib_none().0); ffi::gst_rtsp_session_prevent_expire(self.as_ref().to_glib_none().0);
} }
} }
fn release_media(&self, media: &RTSPSessionMedia) -> bool { fn release_media<P: IsA<RTSPSessionMedia>>(&self, media: &P) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_session_release_media(self.to_glib_none().0, media.to_glib_none().0)) from_glib(ffi::gst_rtsp_session_release_media(self.as_ref().to_glib_none().0, media.as_ref().to_glib_none().0))
} }
} }
fn set_timeout(&self, timeout: u32) { fn set_timeout(&self, timeout: u32) {
unsafe { unsafe {
ffi::gst_rtsp_session_set_timeout(self.to_glib_none().0, timeout); ffi::gst_rtsp_session_set_timeout(self.as_ref().to_glib_none().0, timeout);
} }
} }
fn touch(&self) { fn touch(&self) {
unsafe { unsafe {
ffi::gst_rtsp_session_touch(self.to_glib_none().0); ffi::gst_rtsp_session_touch(self.as_ref().to_glib_none().0);
} }
} }
@ -183,7 +185,7 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn connect_property_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_timeout_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeout\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::timeout\0".as_ptr() as *const _,
transmute(notify_timeout_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_timeout_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -191,7 +193,7 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
fn connect_property_timeout_always_visible_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_timeout_always_visible_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::timeout-always-visible\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::timeout-always-visible\0".as_ptr() as *const _,
transmute(notify_timeout_always_visible_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_timeout_always_visible_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -200,11 +202,11 @@ impl<O: IsA<RTSPSession>> RTSPSessionExt for O {
unsafe extern "C" fn notify_timeout_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_timeout_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSession> { where P: IsA<RTSPSession> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSession::from_glib_borrow(this).downcast_unchecked()) f(&RTSPSession::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_timeout_always_visible_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_timeout_always_visible_trampoline<P>(this: *mut ffi::GstRTSPSession, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSession> { where P: IsA<RTSPSession> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSession::from_glib_borrow(this).downcast_unchecked()) f(&RTSPSession::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -13,7 +13,7 @@ use gst;
use std::mem; use std::mem;
glib_wrapper! { glib_wrapper! {
pub struct RTSPSessionMedia(Object<ffi::GstRTSPSessionMedia, ffi::GstRTSPSessionMediaClass>); pub struct RTSPSessionMedia(Object<ffi::GstRTSPSessionMedia, ffi::GstRTSPSessionMediaClass, RTSPSessionMediaClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_session_media_get_type(), get_type => || ffi::gst_rtsp_session_media_get_type(),
@ -24,7 +24,7 @@ impl RTSPSessionMedia {
pub fn new<P: IsA<RTSPMedia>>(path: &str, media: &P) -> RTSPSessionMedia { pub fn new<P: IsA<RTSPMedia>>(path: &str, media: &P) -> RTSPSessionMedia {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_session_media_new(path.to_glib_none().0, media.to_glib_full())) from_glib_full(ffi::gst_rtsp_session_media_new(path.to_glib_none().0, media.as_ref().to_glib_full()))
} }
} }
} }
@ -32,6 +32,8 @@ impl RTSPSessionMedia {
unsafe impl Send for RTSPSessionMedia {} unsafe impl Send for RTSPSessionMedia {}
unsafe impl Sync for RTSPSessionMedia {} unsafe impl Sync for RTSPSessionMedia {}
pub const NONE_RTSP_SESSION_MEDIA: Option<&RTSPSessionMedia> = None;
pub trait RTSPSessionMediaExt: 'static { pub trait RTSPSessionMediaExt: 'static {
//fn alloc_channels(&self, range: /*Ignored*/gst_rtsp::RTSPRange) -> bool; //fn alloc_channels(&self, range: /*Ignored*/gst_rtsp::RTSPRange) -> bool;
@ -53,7 +55,7 @@ pub trait RTSPSessionMediaExt: 'static {
fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError>; fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError>;
//fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport>; //fn set_transport<P: IsA<RTSPStream>>(&self, stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport>;
} }
impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O { impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
@ -63,19 +65,19 @@ impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
fn get_base_time(&self) -> gst::ClockTime { fn get_base_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_session_media_get_base_time(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_session_media_get_base_time(self.as_ref().to_glib_none().0))
} }
} }
fn get_media(&self) -> Option<RTSPMedia> { fn get_media(&self) -> Option<RTSPMedia> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_session_media_get_media(self.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_session_media_get_media(self.as_ref().to_glib_none().0))
} }
} }
fn get_rtpinfo(&self) -> Option<GString> { fn get_rtpinfo(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_session_media_get_rtpinfo(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_session_media_get_rtpinfo(self.as_ref().to_glib_none().0))
} }
} }
@ -85,7 +87,7 @@ impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
fn get_transport(&self, idx: u32) -> Option<RTSPStreamTransport> { fn get_transport(&self, idx: u32) -> Option<RTSPStreamTransport> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_session_media_get_transport(self.to_glib_none().0, idx)) from_glib_none(ffi::gst_rtsp_session_media_get_transport(self.as_ref().to_glib_none().0, idx))
} }
} }
@ -96,7 +98,7 @@ impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
fn matches(&self, path: &str) -> Option<i32> { fn matches(&self, path: &str) -> Option<i32> {
unsafe { unsafe {
let mut matched = mem::uninitialized(); let mut matched = mem::uninitialized();
let ret = from_glib(ffi::gst_rtsp_session_media_matches(self.to_glib_none().0, path.to_glib_none().0, &mut matched)); let ret = from_glib(ffi::gst_rtsp_session_media_matches(self.as_ref().to_glib_none().0, path.to_glib_none().0, &mut matched));
if ret { Some(matched) } else { None } if ret { Some(matched) } else { None }
} }
} }
@ -107,11 +109,11 @@ impl<O: IsA<RTSPSessionMedia>> RTSPSessionMediaExt for O {
fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError> { fn set_state(&self, state: gst::State) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_session_media_set_state(self.to_glib_none().0, state.to_glib()), "Failed to set state of session media") glib_result_from_gboolean!(ffi::gst_rtsp_session_media_set_state(self.as_ref().to_glib_none().0, state.to_glib()), "Failed to set state of session media")
} }
} }
//fn set_transport(&self, stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport> { //fn set_transport<P: IsA<RTSPStream>>(&self, stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> Option<RTSPStreamTransport> {
// unsafe { TODO: call ffi::gst_rtsp_session_media_set_transport() } // unsafe { TODO: call ffi::gst_rtsp_session_media_set_transport() }
//} //}
} }

View file

@ -5,7 +5,7 @@
use RTSPSession; use RTSPSession;
use ffi; use ffi;
use glib; use glib;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -15,7 +15,7 @@ use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPSessionPool(Object<ffi::GstRTSPSessionPool, ffi::GstRTSPSessionPoolClass>); pub struct RTSPSessionPool(Object<ffi::GstRTSPSessionPool, ffi::GstRTSPSessionPoolClass, RTSPSessionPoolClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_session_pool_get_type(), get_type => || ffi::gst_rtsp_session_pool_get_type(),
@ -40,6 +40,8 @@ impl Default for RTSPSessionPool {
unsafe impl Send for RTSPSessionPool {} unsafe impl Send for RTSPSessionPool {}
unsafe impl Sync for RTSPSessionPool {} unsafe impl Sync for RTSPSessionPool {}
pub const NONE_RTSP_SESSION_POOL: Option<&RTSPSessionPool> = None;
pub trait RTSPSessionPoolExt: 'static { pub trait RTSPSessionPoolExt: 'static {
fn cleanup(&self) -> u32; fn cleanup(&self) -> u32;
@ -53,7 +55,7 @@ pub trait RTSPSessionPoolExt: 'static {
fn get_n_sessions(&self) -> u32; fn get_n_sessions(&self) -> u32;
fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError>; fn remove<P: IsA<RTSPSession>>(&self, sess: &P) -> Result<(), glib::error::BoolError>;
fn set_max_sessions(&self, max: u32); fn set_max_sessions(&self, max: u32);
@ -65,13 +67,13 @@ pub trait RTSPSessionPoolExt: 'static {
impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExt for O { impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExt for O {
fn cleanup(&self) -> u32 { fn cleanup(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_session_pool_cleanup(self.to_glib_none().0) ffi::gst_rtsp_session_pool_cleanup(self.as_ref().to_glib_none().0)
} }
} }
fn create(&self) -> Option<RTSPSession> { fn create(&self) -> Option<RTSPSession> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_session_pool_create(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_session_pool_create(self.as_ref().to_glib_none().0))
} }
} }
@ -81,38 +83,38 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExt for O {
fn find(&self, sessionid: &str) -> Option<RTSPSession> { fn find(&self, sessionid: &str) -> Option<RTSPSession> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_session_pool_find(self.to_glib_none().0, sessionid.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_session_pool_find(self.as_ref().to_glib_none().0, sessionid.to_glib_none().0))
} }
} }
fn get_max_sessions(&self) -> u32 { fn get_max_sessions(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_session_pool_get_max_sessions(self.to_glib_none().0) ffi::gst_rtsp_session_pool_get_max_sessions(self.as_ref().to_glib_none().0)
} }
} }
fn get_n_sessions(&self) -> u32 { fn get_n_sessions(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_session_pool_get_n_sessions(self.to_glib_none().0) ffi::gst_rtsp_session_pool_get_n_sessions(self.as_ref().to_glib_none().0)
} }
} }
fn remove(&self, sess: &RTSPSession) -> Result<(), glib::error::BoolError> { fn remove<P: IsA<RTSPSession>>(&self, sess: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_session_pool_remove(self.to_glib_none().0, sess.to_glib_none().0), "Failed to remove session from pool") glib_result_from_gboolean!(ffi::gst_rtsp_session_pool_remove(self.as_ref().to_glib_none().0, sess.as_ref().to_glib_none().0), "Failed to remove session from pool")
} }
} }
fn set_max_sessions(&self, max: u32) { fn set_max_sessions(&self, max: u32) {
unsafe { unsafe {
ffi::gst_rtsp_session_pool_set_max_sessions(self.to_glib_none().0, max); ffi::gst_rtsp_session_pool_set_max_sessions(self.as_ref().to_glib_none().0, max);
} }
} }
fn connect_session_removed<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_session_removed<F: Fn(&Self, &RTSPSession) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &RTSPSession) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"session-removed\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"session-removed\0".as_ptr() as *const _,
transmute(session_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(session_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -120,7 +122,7 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExt for O {
fn connect_property_max_sessions_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_max_sessions_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::max-sessions\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::max-sessions\0".as_ptr() as *const _,
transmute(notify_max_sessions_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_max_sessions_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -129,11 +131,11 @@ impl<O: IsA<RTSPSessionPool>> RTSPSessionPoolExt for O {
unsafe extern "C" fn session_removed_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer) unsafe extern "C" fn session_removed_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, object: *mut ffi::GstRTSPSession, f: glib_ffi::gpointer)
where P: IsA<RTSPSessionPool> { where P: IsA<RTSPSessionPool> {
let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &RTSPSession) + Send + Sync + 'static) = transmute(f);
f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn notify_max_sessions_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_max_sessions_trampoline<P>(this: *mut ffi::GstRTSPSessionPool, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPSessionPool> { where P: IsA<RTSPSessionPool> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPSessionPool::from_glib_borrow(this).downcast_unchecked()) f(&RTSPSessionPool::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -10,7 +10,7 @@ use ffi;
use gio; use gio;
use glib; use glib;
use glib::GString; use glib::GString;
use glib::object::Downcast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::SignalHandlerId; use glib::signal::SignalHandlerId;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -24,7 +24,7 @@ use std::mem;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib_wrapper! {
pub struct RTSPStream(Object<ffi::GstRTSPStream, ffi::GstRTSPStreamClass>); pub struct RTSPStream(Object<ffi::GstRTSPStream, ffi::GstRTSPStreamClass, RTSPStreamClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_stream_get_type(), get_type => || ffi::gst_rtsp_stream_get_type(),
@ -35,7 +35,7 @@ impl RTSPStream {
pub fn new<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(idx: u32, payloader: &P, pad: &Q) -> RTSPStream { pub fn new<P: IsA<gst::Element>, Q: IsA<gst::Pad>>(idx: u32, payloader: &P, pad: &Q) -> RTSPStream {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_new(idx, payloader.to_glib_none().0, pad.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_new(idx, payloader.as_ref().to_glib_none().0, pad.as_ref().to_glib_none().0))
} }
} }
} }
@ -43,8 +43,10 @@ impl RTSPStream {
unsafe impl Send for RTSPStream {} unsafe impl Send for RTSPStream {}
unsafe impl Sync for RTSPStream {} unsafe impl Sync for RTSPStream {}
pub const NONE_RTSP_STREAM: Option<&RTSPStream> = None;
pub trait RTSPStreamExt: 'static { pub trait RTSPStreamExt: 'static {
fn add_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError>; fn add_transport<P: IsA<RTSPStreamTransport>>(&self, trans: &P) -> Result<(), glib::error::BoolError>;
//fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_settings: bool) -> bool; //fn allocate_udp_sockets(&self, family: gio::SocketFamily, transport: /*Ignored*/&mut gst_rtsp::RTSPTransport, use_client_settings: bool) -> bool;
@ -124,7 +126,7 @@ pub trait RTSPStreamExt: 'static {
fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError>; fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError>;
fn remove_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError>; fn remove_transport<P: IsA<RTSPStreamTransport>>(&self, trans: &P) -> Result<(), glib::error::BoolError>;
fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element>; fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element>;
@ -132,7 +134,7 @@ pub trait RTSPStreamExt: 'static {
fn seekable(&self) -> bool; fn seekable(&self) -> bool;
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P); fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q);
fn set_blocked(&self, blocked: bool) -> bool; fn set_blocked(&self, blocked: bool) -> bool;
@ -180,9 +182,9 @@ pub trait RTSPStreamExt: 'static {
} }
impl<O: IsA<RTSPStream>> RTSPStreamExt for O { impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn add_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> { fn add_transport<P: IsA<RTSPStreamTransport>>(&self, trans: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_add_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to add transport") glib_result_from_gboolean!(ffi::gst_rtsp_stream_add_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to add transport")
} }
} }
@ -196,127 +198,127 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn get_address_pool(&self) -> Option<RTSPAddressPool> { fn get_address_pool(&self) -> Option<RTSPAddressPool> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_address_pool(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_address_pool(self.as_ref().to_glib_none().0))
} }
} }
fn get_buffer_size(&self) -> u32 { fn get_buffer_size(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_buffer_size(self.to_glib_none().0) ffi::gst_rtsp_stream_get_buffer_size(self.as_ref().to_glib_none().0)
} }
} }
fn get_caps(&self) -> Option<gst::Caps> { fn get_caps(&self) -> Option<gst::Caps> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_caps(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_caps(self.as_ref().to_glib_none().0))
} }
} }
fn get_control(&self) -> Option<GString> { fn get_control(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_control(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_control(self.as_ref().to_glib_none().0))
} }
} }
fn get_current_seqnum(&self) -> u16 { fn get_current_seqnum(&self) -> u16 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_current_seqnum(self.to_glib_none().0) ffi::gst_rtsp_stream_get_current_seqnum(self.as_ref().to_glib_none().0)
} }
} }
fn get_dscp_qos(&self) -> i32 { fn get_dscp_qos(&self) -> i32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_dscp_qos(self.to_glib_none().0) ffi::gst_rtsp_stream_get_dscp_qos(self.as_ref().to_glib_none().0)
} }
} }
fn get_index(&self) -> u32 { fn get_index(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_index(self.to_glib_none().0) ffi::gst_rtsp_stream_get_index(self.as_ref().to_glib_none().0)
} }
} }
fn get_joined_bin(&self) -> Option<gst::Bin> { fn get_joined_bin(&self) -> Option<gst::Bin> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_joined_bin(self.as_ref().to_glib_none().0))
} }
} }
fn get_mtu(&self) -> u32 { fn get_mtu(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_mtu(self.to_glib_none().0) ffi::gst_rtsp_stream_get_mtu(self.as_ref().to_glib_none().0)
} }
} }
fn get_multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress> { fn get_multicast_address(&self, family: gio::SocketFamily) -> Option<RTSPAddress> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(self.to_glib_none().0, family.to_glib())) from_glib_full(ffi::gst_rtsp_stream_get_multicast_address(self.as_ref().to_glib_none().0, family.to_glib()))
} }
} }
fn get_multicast_iface(&self) -> Option<GString> { fn get_multicast_iface(&self) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_multicast_iface(self.as_ref().to_glib_none().0))
} }
} }
fn get_profiles(&self) -> gst_rtsp::RTSPProfile { fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_get_profiles(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_get_profiles(self.as_ref().to_glib_none().0))
} }
} }
fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans { fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_get_protocols(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_get_protocols(self.as_ref().to_glib_none().0))
} }
} }
fn get_pt(&self) -> u32 { fn get_pt(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_pt(self.to_glib_none().0) ffi::gst_rtsp_stream_get_pt(self.as_ref().to_glib_none().0)
} }
} }
fn get_publish_clock_mode(&self) -> RTSPPublishClockMode { fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_get_publish_clock_mode(self.as_ref().to_glib_none().0))
} }
} }
fn get_retransmission_pt(&self) -> u32 { fn get_retransmission_pt(&self) -> u32 {
unsafe { unsafe {
ffi::gst_rtsp_stream_get_retransmission_pt(self.to_glib_none().0) ffi::gst_rtsp_stream_get_retransmission_pt(self.as_ref().to_glib_none().0)
} }
} }
fn get_retransmission_time(&self) -> gst::ClockTime { fn get_retransmission_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_get_retransmission_time(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_get_retransmission_time(self.as_ref().to_glib_none().0))
} }
} }
fn get_rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> { fn get_rtcp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtcp_multicast_socket(self.to_glib_none().0, family.to_glib())) from_glib_full(ffi::gst_rtsp_stream_get_rtcp_multicast_socket(self.as_ref().to_glib_none().0, family.to_glib()))
} }
} }
fn get_rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> { fn get_rtcp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtcp_socket(self.to_glib_none().0, family.to_glib())) from_glib_full(ffi::gst_rtsp_stream_get_rtcp_socket(self.as_ref().to_glib_none().0, family.to_glib()))
} }
} }
fn get_rtp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> { fn get_rtp_multicast_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtp_multicast_socket(self.to_glib_none().0, family.to_glib())) from_glib_full(ffi::gst_rtsp_stream_get_rtp_multicast_socket(self.as_ref().to_glib_none().0, family.to_glib()))
} }
} }
fn get_rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> { fn get_rtp_socket(&self, family: gio::SocketFamily) -> Option<gio::Socket> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(self.to_glib_none().0, family.to_glib())) from_glib_full(ffi::gst_rtsp_stream_get_rtp_socket(self.as_ref().to_glib_none().0, family.to_glib()))
} }
} }
@ -326,14 +328,14 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
let mut seq = mem::uninitialized(); let mut seq = mem::uninitialized();
let mut clock_rate = mem::uninitialized(); let mut clock_rate = mem::uninitialized();
let mut running_time = mem::uninitialized(); let mut running_time = mem::uninitialized();
let ret = from_glib(ffi::gst_rtsp_stream_get_rtpinfo(self.to_glib_none().0, &mut rtptime, &mut seq, &mut clock_rate, &mut running_time)); let ret = from_glib(ffi::gst_rtsp_stream_get_rtpinfo(self.as_ref().to_glib_none().0, &mut rtptime, &mut seq, &mut clock_rate, &mut running_time));
if ret { Some((rtptime, seq, clock_rate, from_glib(running_time))) } else { None } if ret { Some((rtptime, seq, clock_rate, from_glib(running_time))) } else { None }
} }
} }
fn get_rtpsession(&self) -> Option<glib::Object> { fn get_rtpsession(&self) -> Option<glib::Object> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_rtpsession(self.as_ref().to_glib_none().0))
} }
} }
@ -343,65 +345,64 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn get_sinkpad(&self) -> Option<gst::Pad> { fn get_sinkpad(&self) -> Option<gst::Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_sinkpad(self.as_ref().to_glib_none().0))
} }
} }
fn get_srcpad(&self) -> Option<gst::Pad> { fn get_srcpad(&self) -> Option<gst::Pad> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_srcpad(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_srcpad(self.as_ref().to_glib_none().0))
} }
} }
fn get_srtp_encoder(&self) -> Option<gst::Element> { fn get_srtp_encoder(&self) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(self.to_glib_none().0)) from_glib_full(ffi::gst_rtsp_stream_get_srtp_encoder(self.as_ref().to_glib_none().0))
} }
} }
fn get_ssrc(&self) -> u32 { fn get_ssrc(&self) -> u32 {
unsafe { unsafe {
let mut ssrc = mem::uninitialized(); let mut ssrc = mem::uninitialized();
ffi::gst_rtsp_stream_get_ssrc(self.to_glib_none().0, &mut ssrc); ffi::gst_rtsp_stream_get_ssrc(self.as_ref().to_glib_none().0, &mut ssrc);
ssrc ssrc
} }
} }
fn has_control<'a, P: Into<Option<&'a str>>>(&self, control: P) -> bool { fn has_control<'a, P: Into<Option<&'a str>>>(&self, control: P) -> bool {
let control = control.into(); let control = control.into();
let control = control.to_glib_none();
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_has_control(self.to_glib_none().0, control.0)) from_glib(ffi::gst_rtsp_stream_has_control(self.as_ref().to_glib_none().0, control.to_glib_none().0))
} }
} }
fn is_blocking(&self) -> bool { fn is_blocking(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_is_blocking(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_is_blocking(self.as_ref().to_glib_none().0))
} }
} }
fn is_client_side(&self) -> bool { fn is_client_side(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_is_client_side(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_is_client_side(self.as_ref().to_glib_none().0))
} }
} }
fn is_complete(&self) -> bool { fn is_complete(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_is_complete(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_is_complete(self.as_ref().to_glib_none().0))
} }
} }
fn is_receiver(&self) -> bool { fn is_receiver(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_is_receiver(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_is_receiver(self.as_ref().to_glib_none().0))
} }
} }
fn is_sender(&self) -> bool { fn is_sender(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_is_sender(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_is_sender(self.as_ref().to_glib_none().0))
} }
} }
@ -411,133 +412,130 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn join_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError> { fn join_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q, state: gst::State) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_join_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0, state.to_glib()), "Failed to join bin") glib_result_from_gboolean!(ffi::gst_rtsp_stream_join_bin(self.as_ref().to_glib_none().0, bin.as_ref().to_glib_none().0, rtpbin.as_ref().to_glib_none().0, state.to_glib()), "Failed to join bin")
} }
} }
fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError> { fn leave_bin<P: IsA<gst::Bin>, Q: IsA<gst::Element>>(&self, bin: &P, rtpbin: &Q) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_leave_bin(self.to_glib_none().0, bin.to_glib_none().0, rtpbin.to_glib_none().0), "Failed to leave bin") glib_result_from_gboolean!(ffi::gst_rtsp_stream_leave_bin(self.as_ref().to_glib_none().0, bin.as_ref().to_glib_none().0, rtpbin.as_ref().to_glib_none().0), "Failed to leave bin")
} }
} }
fn remove_transport(&self, trans: &RTSPStreamTransport) -> Result<(), glib::error::BoolError> { fn remove_transport<P: IsA<RTSPStreamTransport>>(&self, trans: &P) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_remove_transport(self.to_glib_none().0, trans.to_glib_none().0), "Failed to remove transport") glib_result_from_gboolean!(ffi::gst_rtsp_stream_remove_transport(self.as_ref().to_glib_none().0, trans.as_ref().to_glib_none().0), "Failed to remove transport")
} }
} }
fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element> { fn request_aux_sender(&self, sessid: u32) -> Option<gst::Element> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(self.to_glib_none().0, sessid)) from_glib_full(ffi::gst_rtsp_stream_request_aux_sender(self.as_ref().to_glib_none().0, sessid))
} }
} }
fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option<RTSPAddress> { fn reserve_address(&self, address: &str, port: u32, n_ports: u32, ttl: u32) -> Option<RTSPAddress> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_reserve_address(self.to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl)) from_glib_full(ffi::gst_rtsp_stream_reserve_address(self.as_ref().to_glib_none().0, address.to_glib_none().0, port, n_ports, ttl))
} }
} }
fn seekable(&self) -> bool { fn seekable(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_seekable(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_seekable(self.as_ref().to_glib_none().0))
} }
} }
fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) { fn set_address_pool<'a, P: IsA<RTSPAddressPool> + 'a, Q: Into<Option<&'a P>>>(&self, pool: Q) {
let pool = pool.into(); let pool = pool.into();
let pool = pool.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_stream_set_address_pool(self.to_glib_none().0, pool.0); ffi::gst_rtsp_stream_set_address_pool(self.as_ref().to_glib_none().0, pool.map(|p| p.as_ref()).to_glib_none().0);
} }
} }
fn set_blocked(&self, blocked: bool) -> bool { fn set_blocked(&self, blocked: bool) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_set_blocked(self.to_glib_none().0, blocked.to_glib())) from_glib(ffi::gst_rtsp_stream_set_blocked(self.as_ref().to_glib_none().0, blocked.to_glib()))
} }
} }
fn set_buffer_size(&self, size: u32) { fn set_buffer_size(&self, size: u32) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_buffer_size(self.to_glib_none().0, size); ffi::gst_rtsp_stream_set_buffer_size(self.as_ref().to_glib_none().0, size);
} }
} }
fn set_client_side(&self, client_side: bool) { fn set_client_side(&self, client_side: bool) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_client_side(self.to_glib_none().0, client_side.to_glib()); ffi::gst_rtsp_stream_set_client_side(self.as_ref().to_glib_none().0, client_side.to_glib());
} }
} }
fn set_control<'a, P: Into<Option<&'a str>>>(&self, control: P) { fn set_control<'a, P: Into<Option<&'a str>>>(&self, control: P) {
let control = control.into(); let control = control.into();
let control = control.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_stream_set_control(self.to_glib_none().0, control.0); ffi::gst_rtsp_stream_set_control(self.as_ref().to_glib_none().0, control.to_glib_none().0);
} }
} }
fn set_dscp_qos(&self, dscp_qos: i32) { fn set_dscp_qos(&self, dscp_qos: i32) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_dscp_qos(self.to_glib_none().0, dscp_qos); ffi::gst_rtsp_stream_set_dscp_qos(self.as_ref().to_glib_none().0, dscp_qos);
} }
} }
fn set_mtu(&self, mtu: u32) { fn set_mtu(&self, mtu: u32) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_mtu(self.to_glib_none().0, mtu); ffi::gst_rtsp_stream_set_mtu(self.as_ref().to_glib_none().0, mtu);
} }
} }
fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) { fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
let multicast_iface = multicast_iface.into(); let multicast_iface = multicast_iface.into();
let multicast_iface = multicast_iface.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_stream_set_multicast_iface(self.to_glib_none().0, multicast_iface.0); ffi::gst_rtsp_stream_set_multicast_iface(self.as_ref().to_glib_none().0, multicast_iface.to_glib_none().0);
} }
} }
fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) { fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_profiles(self.to_glib_none().0, profiles.to_glib()); ffi::gst_rtsp_stream_set_profiles(self.as_ref().to_glib_none().0, profiles.to_glib());
} }
} }
fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) { fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_protocols(self.to_glib_none().0, protocols.to_glib()); ffi::gst_rtsp_stream_set_protocols(self.as_ref().to_glib_none().0, protocols.to_glib());
} }
} }
fn set_pt_map(&self, pt: u32, caps: &gst::Caps) { fn set_pt_map(&self, pt: u32, caps: &gst::Caps) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_pt_map(self.to_glib_none().0, pt, caps.to_glib_none().0); ffi::gst_rtsp_stream_set_pt_map(self.as_ref().to_glib_none().0, pt, caps.to_glib_none().0);
} }
} }
fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) { fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib()); ffi::gst_rtsp_stream_set_publish_clock_mode(self.as_ref().to_glib_none().0, mode.to_glib());
} }
} }
fn set_retransmission_pt(&self, rtx_pt: u32) { fn set_retransmission_pt(&self, rtx_pt: u32) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_retransmission_pt(self.to_glib_none().0, rtx_pt); ffi::gst_rtsp_stream_set_retransmission_pt(self.as_ref().to_glib_none().0, rtx_pt);
} }
} }
fn set_retransmission_time(&self, time: gst::ClockTime) { fn set_retransmission_time(&self, time: gst::ClockTime) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_retransmission_time(self.to_glib_none().0, time.to_glib()); ffi::gst_rtsp_stream_set_retransmission_time(self.as_ref().to_glib_none().0, time.to_glib());
} }
} }
fn set_seqnum_offset(&self, seqnum: u16) { fn set_seqnum_offset(&self, seqnum: u16) {
unsafe { unsafe {
ffi::gst_rtsp_stream_set_seqnum_offset(self.to_glib_none().0, seqnum); ffi::gst_rtsp_stream_set_seqnum_offset(self.as_ref().to_glib_none().0, seqnum);
} }
} }
@ -547,22 +545,21 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn unblock_linked(&self) -> bool { fn unblock_linked(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_unblock_linked(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_unblock_linked(self.as_ref().to_glib_none().0))
} }
} }
fn update_crypto<'a, P: Into<Option<&'a gst::Caps>>>(&self, ssrc: u32, crypto: P) -> bool { fn update_crypto<'a, P: Into<Option<&'a gst::Caps>>>(&self, ssrc: u32, crypto: P) -> bool {
let crypto = crypto.into(); let crypto = crypto.into();
let crypto = crypto.to_glib_none();
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_update_crypto(self.to_glib_none().0, ssrc, crypto.0)) from_glib(ffi::gst_rtsp_stream_update_crypto(self.as_ref().to_glib_none().0, ssrc, crypto.to_glib_none().0))
} }
} }
fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_new_rtcp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"new-rtcp-encoder\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"new-rtcp-encoder\0".as_ptr() as *const _,
transmute(new_rtcp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(new_rtcp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -570,7 +567,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_new_rtp_encoder<F: Fn(&Self, &gst::Element) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self, &gst::Element) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"new-rtp-encoder\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"new-rtp-encoder\0".as_ptr() as *const _,
transmute(new_rtp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(new_rtp_encoder_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -578,7 +575,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn connect_property_control_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_control_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::control\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::control\0".as_ptr() as *const _,
transmute(notify_control_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_control_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -586,7 +583,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::profiles\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::profiles\0".as_ptr() as *const _,
transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -594,7 +591,7 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe { unsafe {
let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f)); let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
connect_raw(self.to_glib_none().0 as *mut _, b"notify::protocols\0".as_ptr() as *const _, connect_raw(self.as_ptr() as *mut _, b"notify::protocols\0".as_ptr() as *const _,
transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _) transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
} }
} }
@ -603,29 +600,29 @@ impl<O: IsA<RTSPStream>> RTSPStreamExt for O {
unsafe extern "C" fn new_rtcp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer) unsafe extern "C" fn new_rtcp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> { where P: IsA<RTSPStream> {
let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn new_rtp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer) unsafe extern "C" fn new_rtp_encoder_trampoline<P>(this: *mut ffi::GstRTSPStream, object: *mut gst_ffi::GstElement, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> { where P: IsA<RTSPStream> {
let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P, &gst::Element) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object)) f(&RTSPStream::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(object))
} }
unsafe extern "C" fn notify_control_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_control_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> { where P: IsA<RTSPStream> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) f(&RTSPStream::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> { where P: IsA<RTSPStream> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) f(&RTSPStream::from_glib_borrow(this).unsafe_cast())
} }
unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPStream, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPStream> { where P: IsA<RTSPStream> {
let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f); let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
f(&RTSPStream::from_glib_borrow(this).downcast_unchecked()) f(&RTSPStream::from_glib_borrow(this).unsafe_cast())
} }

View file

@ -12,7 +12,7 @@ use gst;
use gst_rtsp; use gst_rtsp;
glib_wrapper! { glib_wrapper! {
pub struct RTSPStreamTransport(Object<ffi::GstRTSPStreamTransport, ffi::GstRTSPStreamTransportClass>); pub struct RTSPStreamTransport(Object<ffi::GstRTSPStreamTransport, ffi::GstRTSPStreamTransportClass, RTSPStreamTransportClass>);
match fn { match fn {
get_type => || ffi::gst_rtsp_stream_transport_get_type(), get_type => || ffi::gst_rtsp_stream_transport_get_type(),
@ -20,11 +20,13 @@ glib_wrapper! {
} }
impl RTSPStreamTransport { impl RTSPStreamTransport {
//pub fn new(stream: &RTSPStream, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> RTSPStreamTransport { //pub fn new<P: IsA<RTSPStream>>(stream: &P, tr: /*Ignored*/&mut gst_rtsp::RTSPTransport) -> RTSPStreamTransport {
// unsafe { TODO: call ffi::gst_rtsp_stream_transport_new() } // unsafe { TODO: call ffi::gst_rtsp_stream_transport_new() }
//} //}
} }
pub const NONE_RTSP_STREAM_TRANSPORT: Option<&RTSPStreamTransport> = None;
pub trait RTSPStreamTransportExt: 'static { pub trait RTSPStreamTransportExt: 'static {
fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<GString>; fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<GString>;
@ -58,13 +60,13 @@ pub trait RTSPStreamTransportExt: 'static {
impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O { impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<GString> { fn get_rtpinfo(&self, start_time: gst::ClockTime) -> Option<GString> {
unsafe { unsafe {
from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo(self.to_glib_none().0, start_time.to_glib())) from_glib_full(ffi::gst_rtsp_stream_transport_get_rtpinfo(self.as_ref().to_glib_none().0, start_time.to_glib()))
} }
} }
fn get_stream(&self) -> Option<RTSPStream> { fn get_stream(&self) -> Option<RTSPStream> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_stream_transport_get_stream(self.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_stream_transport_get_stream(self.as_ref().to_glib_none().0))
} }
} }
@ -74,37 +76,37 @@ impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn get_url(&self) -> Option<gst_rtsp::RTSPUrl> { fn get_url(&self) -> Option<gst_rtsp::RTSPUrl> {
unsafe { unsafe {
from_glib_none(ffi::gst_rtsp_stream_transport_get_url(self.to_glib_none().0)) from_glib_none(ffi::gst_rtsp_stream_transport_get_url(self.as_ref().to_glib_none().0))
} }
} }
fn is_timed_out(&self) -> bool { fn is_timed_out(&self) -> bool {
unsafe { unsafe {
from_glib(ffi::gst_rtsp_stream_transport_is_timed_out(self.to_glib_none().0)) from_glib(ffi::gst_rtsp_stream_transport_is_timed_out(self.as_ref().to_glib_none().0))
} }
} }
fn keep_alive(&self) { fn keep_alive(&self) {
unsafe { unsafe {
ffi::gst_rtsp_stream_transport_keep_alive(self.to_glib_none().0); ffi::gst_rtsp_stream_transport_keep_alive(self.as_ref().to_glib_none().0);
} }
} }
fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { fn send_rtcp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtcp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp") glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtcp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtcp")
} }
} }
fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> { fn send_rtp(&self, buffer: &gst::Buffer) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtp(self.to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp") glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_send_rtp(self.as_ref().to_glib_none().0, buffer.to_glib_none().0), "Failed to send rtp")
} }
} }
fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> { fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
unsafe { unsafe {
glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_set_active(self.to_glib_none().0, active.to_glib()), "Failed to set active") glib_result_from_gboolean!(ffi::gst_rtsp_stream_transport_set_active(self.as_ref().to_glib_none().0, active.to_glib()), "Failed to set active")
} }
} }
@ -118,7 +120,7 @@ impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn set_timed_out(&self, timedout: bool) { fn set_timed_out(&self, timedout: bool) {
unsafe { unsafe {
ffi::gst_rtsp_stream_transport_set_timed_out(self.to_glib_none().0, timedout.to_glib()); ffi::gst_rtsp_stream_transport_set_timed_out(self.as_ref().to_glib_none().0, timedout.to_glib());
} }
} }
@ -128,9 +130,8 @@ impl<O: IsA<RTSPStreamTransport>> RTSPStreamTransportExt for O {
fn set_url<'a, P: Into<Option<&'a gst_rtsp::RTSPUrl>>>(&self, url: P) { fn set_url<'a, P: Into<Option<&'a gst_rtsp::RTSPUrl>>>(&self, url: P) {
let url = url.into(); let url = url.into();
let url = url.to_glib_none();
unsafe { unsafe {
ffi::gst_rtsp_stream_transport_set_url(self.to_glib_none().0, url.0); ffi::gst_rtsp_stream_transport_set_url(self.as_ref().to_glib_none().0, url.to_glib_none().0);
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show more