2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
2018-03-15 08:46:49 +00:00
|
|
|
|
2020-11-21 13:46:48 +00:00
|
|
|
use crate::PadTemplate;
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-11-21 13:46:48 +00:00
|
|
|
use crate::StaticPadTemplate;
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-11-21 13:46:48 +00:00
|
|
|
use glib::translate::*;
|
2018-03-15 08:46:49 +00:00
|
|
|
|
|
|
|
impl PadTemplate {
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
2020-06-11 08:53:35 +00:00
|
|
|
pub fn from_static_pad_template_with_gtype(
|
2018-04-01 08:30:03 +00:00
|
|
|
pad_template: &StaticPadTemplate,
|
|
|
|
pad_type: glib::types::Type,
|
2019-12-17 19:00:42 +00:00
|
|
|
) -> Result<PadTemplate, glib::BoolError> {
|
2018-03-15 08:46:49 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
2019-12-17 19:00:42 +00:00
|
|
|
Option::<_>::from_glib_none(
|
2020-11-21 13:46:48 +00:00
|
|
|
ffi::gst_pad_template_new_from_static_pad_template_with_gtype(
|
2018-04-01 08:30:03 +00:00
|
|
|
mut_override(pad_template.to_glib_none().0),
|
2021-04-27 15:15:46 +00:00
|
|
|
pad_type.into_glib(),
|
2018-04-01 08:30:03 +00:00
|
|
|
),
|
|
|
|
)
|
2020-12-17 22:38:06 +00:00
|
|
|
.ok_or_else(|| glib::bool_error!("Failed to create PadTemplate"))
|
2018-03-15 08:46:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|