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
|
|
|
|
|
2018-03-15 08:39:12 +00:00
|
|
|
use glib;
|
2017-05-12 12:24:03 +00:00
|
|
|
use glib::object::IsA;
|
2019-06-18 10:10:46 +00:00
|
|
|
use glib::object::ObjectType as ObjectType_;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2019-06-18 10:12:00 +00:00
|
|
|
use glib::signal::SignalHandlerId;
|
2017-05-12 12:24:03 +00:00
|
|
|
use glib::translate::*;
|
2019-06-18 10:12:00 +00:00
|
|
|
use glib::GString;
|
|
|
|
use glib::StaticType;
|
|
|
|
use glib::Value;
|
2019-03-19 07:40:05 +00:00
|
|
|
use glib_sys;
|
|
|
|
use gobject_sys;
|
|
|
|
use gst_sys;
|
2017-05-12 12:24:03 +00:00
|
|
|
use std::boxed::Box as Box_;
|
2020-04-13 16:11:33 +00:00
|
|
|
use std::mem::transmute;
|
2019-06-18 10:12:00 +00:00
|
|
|
use Caps;
|
|
|
|
use Object;
|
|
|
|
use Pad;
|
|
|
|
use PadDirection;
|
|
|
|
use PadPresence;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
|
|
|
glib_wrapper! {
|
2020-11-07 10:17:25 +00:00
|
|
|
pub struct PadTemplate(Object<gst_sys::GstPadTemplate, gst_sys::GstPadTemplateClass>) @extends Object;
|
2017-05-12 12:24:03 +00:00
|
|
|
|
|
|
|
match fn {
|
2019-03-19 07:40:05 +00:00
|
|
|
get_type => || gst_sys::gst_pad_template_get_type(),
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PadTemplate {
|
2019-06-18 10:12:00 +00:00
|
|
|
pub fn new(
|
|
|
|
name_template: &str,
|
|
|
|
direction: PadDirection,
|
|
|
|
presence: PadPresence,
|
|
|
|
caps: &Caps,
|
2019-12-17 19:00:42 +00:00
|
|
|
) -> Result<PadTemplate, glib::BoolError> {
|
2017-07-10 21:02:08 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
2019-12-17 19:00:42 +00:00
|
|
|
Option::<_>::from_glib_none(gst_sys::gst_pad_template_new(
|
2019-06-18 10:12:00 +00:00
|
|
|
name_template.to_glib_none().0,
|
|
|
|
direction.to_glib(),
|
|
|
|
presence.to_glib(),
|
|
|
|
caps.to_glib_none().0,
|
|
|
|
))
|
2019-12-17 19:00:42 +00:00
|
|
|
.ok_or_else(|| glib_bool_error!("Failed to create pad template"))
|
2017-07-10 21:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2018-03-15 08:39:12 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
2020-11-19 09:16:33 +00:00
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-06-11 10:27:43 +00:00
|
|
|
pub fn with_gtype(
|
2019-06-18 10:12:00 +00:00
|
|
|
name_template: &str,
|
|
|
|
direction: PadDirection,
|
|
|
|
presence: PadPresence,
|
|
|
|
caps: &Caps,
|
|
|
|
pad_type: glib::types::Type,
|
2019-12-17 19:00:42 +00:00
|
|
|
) -> Result<PadTemplate, glib::BoolError> {
|
2018-03-15 08:39:12 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
2019-12-17 19:00:42 +00:00
|
|
|
Option::<_>::from_glib_none(gst_sys::gst_pad_template_new_with_gtype(
|
2019-06-18 10:12:00 +00:00
|
|
|
name_template.to_glib_none().0,
|
|
|
|
direction.to_glib(),
|
|
|
|
presence.to_glib(),
|
|
|
|
caps.to_glib_none().0,
|
|
|
|
pad_type.to_glib(),
|
|
|
|
))
|
2019-12-17 19:00:42 +00:00
|
|
|
.ok_or_else(|| glib_bool_error!("Failed to create pad template"))
|
2018-03-15 08:39:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-17 11:50:25 +00:00
|
|
|
pub fn get_caps(&self) -> Option<Caps> {
|
2019-06-18 10:12:00 +00:00
|
|
|
unsafe { from_glib_full(gst_sys::gst_pad_template_get_caps(self.to_glib_none().0)) }
|
2017-07-10 21:02:08 +00:00
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2020-07-06 08:37:14 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
2020-11-19 09:16:33 +00:00
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2020-07-06 08:37:14 +00:00
|
|
|
pub fn get_documentation_caps(&self) -> Option<Caps> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(gst_sys::gst_pad_template_get_documentation_caps(
|
|
|
|
self.to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
2019-06-18 10:12:00 +00:00
|
|
|
gst_sys::gst_pad_template_pad_created(
|
|
|
|
self.to_glib_none().0,
|
|
|
|
pad.as_ref().to_glib_none().0,
|
|
|
|
);
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-06 08:37:14 +00:00
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
2020-11-19 09:16:33 +00:00
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
2020-07-06 08:37:14 +00:00
|
|
|
pub fn set_documentation_caps(&self, caps: &Caps) {
|
|
|
|
unsafe {
|
|
|
|
gst_sys::gst_pad_template_set_documentation_caps(
|
|
|
|
self.to_glib_none().0,
|
|
|
|
caps.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());
|
2019-06-18 10:12:00 +00:00
|
|
|
gobject_sys::g_object_get_property(
|
|
|
|
self.as_ptr() as *mut gobject_sys::GObject,
|
|
|
|
b"direction\0".as_ptr() as *const _,
|
|
|
|
value.to_glib_none_mut().0,
|
|
|
|
);
|
2019-08-10 17:32:57 +00:00
|
|
|
value
|
|
|
|
.get()
|
|
|
|
.expect("Return Value for property `direction` getter")
|
|
|
|
.unwrap()
|
2017-05-12 12:24:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-15 08:39:12 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
2020-11-19 09:16:33 +00:00
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2018-03-15 08:39:12 +00:00
|
|
|
pub fn get_property_gtype(&self) -> glib::types::Type {
|
|
|
|
unsafe {
|
|
|
|
let mut value = Value::from_type(<glib::types::Type as StaticType>::static_type());
|
2019-06-18 10:12:00 +00:00
|
|
|
gobject_sys::g_object_get_property(
|
|
|
|
self.as_ptr() as *mut gobject_sys::GObject,
|
|
|
|
b"gtype\0".as_ptr() as *const _,
|
|
|
|
value.to_glib_none_mut().0,
|
|
|
|
);
|
2019-08-10 17:32:57 +00:00
|
|
|
value
|
|
|
|
.get()
|
|
|
|
.expect("Return Value for property `gtype` getter")
|
|
|
|
.unwrap()
|
2018-03-15 08:39:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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());
|
2019-06-18 10:12:00 +00:00
|
|
|
gobject_sys::g_object_get_property(
|
|
|
|
self.as_ptr() as *mut gobject_sys::GObject,
|
|
|
|
b"name-template\0".as_ptr() as *const _,
|
|
|
|
value.to_glib_none_mut().0,
|
|
|
|
);
|
2019-08-10 17:32:57 +00:00
|
|
|
value
|
|
|
|
.get()
|
|
|
|
.expect("Return Value for property `name-template` getter")
|
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());
|
2019-06-18 10:12:00 +00:00
|
|
|
gobject_sys::g_object_get_property(
|
|
|
|
self.as_ptr() as *mut gobject_sys::GObject,
|
|
|
|
b"presence\0".as_ptr() as *const _,
|
|
|
|
value.to_glib_none_mut().0,
|
|
|
|
);
|
2019-08-10 17:32:57 +00:00
|
|
|
value
|
|
|
|
.get()
|
|
|
|
.expect("Return Value for property `presence` getter")
|
|
|
|
.unwrap()
|
2017-07-10 21:02:08 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
|
2019-06-18 10:12:00 +00:00
|
|
|
pub fn connect_pad_created<F: Fn(&PadTemplate, &Pad) + Send + Sync + 'static>(
|
|
|
|
&self,
|
|
|
|
f: F,
|
|
|
|
) -> SignalHandlerId {
|
|
|
|
unsafe extern "C" fn pad_created_trampoline<
|
|
|
|
F: Fn(&PadTemplate, &Pad) + Send + Sync + 'static,
|
|
|
|
>(
|
|
|
|
this: *mut gst_sys::GstPadTemplate,
|
|
|
|
pad: *mut gst_sys::GstPad,
|
|
|
|
f: glib_sys::gpointer,
|
|
|
|
) {
|
2019-06-18 10:10:46 +00:00
|
|
|
let f: &F = &*(f as *const F);
|
|
|
|
f(&from_glib_borrow(this), &from_glib_borrow(pad))
|
|
|
|
}
|
2017-05-12 12:24:03 +00:00
|
|
|
unsafe {
|
2019-01-29 13:53:44 +00:00
|
|
|
let f: Box_<F> = Box_::new(f);
|
2019-06-18 10:12:00 +00:00
|
|
|
connect_raw(
|
|
|
|
self.as_ptr() as *mut _,
|
|
|
|
b"pad-created\0".as_ptr() as *const _,
|
2020-04-13 16:11:33 +00:00
|
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
|
|
pad_created_trampoline::<F> as *const (),
|
|
|
|
)),
|
2019-06-18 10:12:00 +00:00
|
|
|
Box_::into_raw(f),
|
|
|
|
)
|
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 {}
|