2018-04-23 17:34:22 +00:00
|
|
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
|
|
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
2017-05-12 12:24:03 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
2017-07-10 21:02:08 +00:00
|
|
|
use Caps;
|
2017-05-12 12:24:03 +00:00
|
|
|
use Object;
|
|
|
|
use Pad;
|
|
|
|
use PadDirection;
|
2017-07-10 21:02:08 +00:00
|
|
|
use PadPresence;
|
2017-05-12 12:24:03 +00:00
|
|
|
use ffi;
|
2018-03-15 08:39:12 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
use glib;
|
2018-12-09 16:06:12 +00:00
|
|
|
use glib::GString;
|
2017-11-27 17:16:34 +00:00
|
|
|
use glib::StaticType;
|
2017-05-12 12:24:03 +00:00
|
|
|
use glib::Value;
|
|
|
|
use glib::object::IsA;
|
2017-09-09 13:01:32 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2017-05-12 12:24:03 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
|
|
|
use gobject_ffi;
|
|
|
|
use std::boxed::Box as Box_;
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
2017-11-09 11:33:40 +00:00
|
|
|
pub struct PadTemplate(Object<ffi::GstPadTemplate, ffi::GstPadTemplateClass>): Object;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
get_type => || ffi::gst_pad_template_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PadTemplate {
|
2017-07-10 21:02:08 +00:00
|
|
|
pub fn new(name_template: &str, direction: PadDirection, presence: PadPresence, caps: &Caps) -> PadTemplate {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_none(ffi::gst_pad_template_new(name_template.to_glib_none().0, direction.to_glib(), presence.to_glib(), caps.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2018-03-15 08:39:12 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
pub fn new_with_gtype(name_template: &str, direction: PadDirection, presence: PadPresence, caps: &Caps, pad_type: glib::types::Type) -> PadTemplate {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_none(ffi::gst_pad_template_new_with_gtype(name_template.to_glib_none().0, direction.to_glib(), presence.to_glib(), caps.to_glib_none().0, pad_type.to_glib()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
pub fn get_caps(&self) -> Option<Caps> {
|
2017-07-10 21:02:08 +00:00
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_pad_template_get_caps(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
pub fn pad_created<P: IsA<Pad>>(&self, pad: &P) {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
|
|
|
ffi::gst_pad_template_pad_created(self.to_glib_none().0, pad.to_glib_none().0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
pub fn get_property_direction(&self) -> PadDirection {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2018-02-06 14:42:34 +00:00
|
|
|
let mut value = Value::from_type(<PadDirection as StaticType>::static_type());
|
2018-12-08 09:05:20 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"direction\0".as_ptr() as *const _, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get().unwrap()
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 08:39:12 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
pub fn get_property_gtype(&self) -> glib::types::Type {
|
|
|
|
unsafe {
|
|
|
|
let mut value = Value::from_type(<glib::types::Type as StaticType>::static_type());
|
2018-12-08 09:05:20 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"gtype\0".as_ptr() as *const _, value.to_glib_none_mut().0);
|
2018-03-15 08:39:12 +00:00
|
|
|
value.get().unwrap()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-09 16:06:12 +00:00
|
|
|
pub fn get_property_name_template(&self) -> Option<GString> {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2018-12-09 16:06:12 +00:00
|
|
|
let mut value = Value::from_type(<GString as StaticType>::static_type());
|
2018-12-08 09:05:20 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"name-template\0".as_ptr() as *const _, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get()
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
pub fn get_property_presence(&self) -> PadPresence {
|
2017-07-10 21:02:08 +00:00
|
|
|
unsafe {
|
2018-02-06 14:42:34 +00:00
|
|
|
let mut value = Value::from_type(<PadPresence as StaticType>::static_type());
|
2018-12-08 09:05:20 +00:00
|
|
|
gobject_ffi::g_object_get_property(self.to_glib_none().0, b"presence\0".as_ptr() as *const _, value.to_glib_none_mut().0);
|
2017-11-27 17:16:34 +00:00
|
|
|
value.get().unwrap()
|
2017-07-10 21:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2017-09-09 13:01:32 +00:00
|
|
|
pub fn connect_pad_created<F: Fn(&PadTemplate, &Pad) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2017-08-17 11:50:25 +00:00
|
|
|
let f: Box_<Box_<Fn(&PadTemplate, &Pad) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
|
2018-12-08 09:05:20 +00:00
|
|
|
connect_raw(self.to_glib_none().0, b"pad-created\0".as_ptr() as *const _,
|
2017-08-17 11:50:25 +00:00
|
|
|
transmute(pad_created_trampoline as usize), Box_::into_raw(f) as *mut _)
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
unsafe impl Send for PadTemplate {}
|
|
|
|
unsafe impl Sync for PadTemplate {}
|
|
|
|
|
|
|
|
unsafe extern "C" fn pad_created_trampoline(this: *mut ffi::GstPadTemplate, pad: *mut ffi::GstPad, f: glib_ffi::gpointer) {
|
|
|
|
let f: &&(Fn(&PadTemplate, &Pad) + Send + Sync + 'static) = transmute(f);
|
2017-09-09 13:01:32 +00:00
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(pad))
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|