gstreamer-rs/gstreamer/src/pad_template.rs

31 lines
1.1 KiB
Rust
Raw Normal View History

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
use crate::PadTemplate;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
use crate::StaticPadTemplate;
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
use glib::translate::*;
2018-03-15 08:46:49 +00:00
impl PadTemplate {
#[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
#[doc(alias = "gst_pad_template_new_from_static_pad_template_with_gtype")]
pub fn from_static_pad_template_with_gtype(
2018-04-01 08:30:03 +00:00
pad_template: &StaticPadTemplate,
pad_type: glib::types::Type,
) -> Result<PadTemplate, glib::BoolError> {
2018-03-15 08:46:49 +00:00
assert_initialized_main_thread!();
unsafe {
Option::<_>::from_glib_none(
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),
pad_type.into_glib(),
2018-04-01 08:30:03 +00:00
),
)
.ok_or_else(|| glib::bool_error!("Failed to create PadTemplate"))
2018-03-15 08:46:49 +00:00
}
}
}