2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
2017-12-18 08:05:42 +00:00
|
|
|
|
2021-04-26 12:15:53 +00:00
|
|
|
use glib::prelude::*;
|
2017-12-18 08:05:42 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use std::mem;
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_type_find_helper_for_data")]
|
2021-09-21 21:49:26 +00:00
|
|
|
pub fn type_find_helper_for_data(
|
|
|
|
obj: Option<&impl IsA<gst::Object>>,
|
|
|
|
data: impl AsRef<[u8]>,
|
2019-12-16 11:29:51 +00:00
|
|
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
2017-12-18 08:05:42 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
2019-07-11 12:34:28 +00:00
|
|
|
let mut prob = mem::MaybeUninit::uninit();
|
2017-12-18 08:05:42 +00:00
|
|
|
let data = data.as_ref();
|
|
|
|
let (ptr, len) = (data.as_ptr(), data.len());
|
2020-11-21 17:59:22 +00:00
|
|
|
let ret = ffi::gst_type_find_helper_for_data(
|
2019-01-16 11:32:58 +00:00
|
|
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
2018-07-27 10:36:40 +00:00
|
|
|
mut_override(ptr),
|
|
|
|
len,
|
2019-07-11 12:34:28 +00:00
|
|
|
prob.as_mut_ptr(),
|
|
|
|
);
|
|
|
|
if ret.is_null() {
|
2020-12-17 22:38:06 +00:00
|
|
|
Err(glib::bool_error!("No type could be found"))
|
2019-07-11 12:34:28 +00:00
|
|
|
} else {
|
2019-12-16 11:29:51 +00:00
|
|
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
2019-07-11 12:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_type_find_helper_for_data_with_extension")]
|
2021-09-21 21:49:26 +00:00
|
|
|
pub fn type_find_helper_for_data_with_extension(
|
|
|
|
obj: Option<&impl IsA<gst::Object>>,
|
|
|
|
data: impl AsRef<[u8]>,
|
2019-07-11 12:34:28 +00:00
|
|
|
extension: Option<&str>,
|
2019-12-16 11:29:51 +00:00
|
|
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
2019-07-11 12:34:28 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
let mut prob = mem::MaybeUninit::uninit();
|
|
|
|
let data = data.as_ref();
|
|
|
|
let (ptr, len) = (data.as_ptr(), data.len());
|
2020-11-21 17:59:22 +00:00
|
|
|
let ret = ffi::gst_type_find_helper_for_data_with_extension(
|
2019-07-11 12:34:28 +00:00
|
|
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
mut_override(ptr),
|
|
|
|
len,
|
|
|
|
extension.to_glib_none().0,
|
|
|
|
prob.as_mut_ptr(),
|
|
|
|
);
|
|
|
|
if ret.is_null() {
|
2020-12-17 22:38:06 +00:00
|
|
|
Err(glib::bool_error!("No type could be found"))
|
2019-07-11 12:34:28 +00:00
|
|
|
} else {
|
2019-12-16 11:29:51 +00:00
|
|
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
2019-07-11 12:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_type_find_helper_for_buffer")]
|
2019-07-11 12:34:28 +00:00
|
|
|
pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
|
|
|
obj: Option<&P>,
|
|
|
|
buf: &gst::Buffer,
|
2019-12-16 11:29:51 +00:00
|
|
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
2019-07-11 12:34:28 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
let mut prob = mem::MaybeUninit::uninit();
|
2020-11-21 17:59:22 +00:00
|
|
|
let ret = ffi::gst_type_find_helper_for_buffer(
|
2019-07-11 12:34:28 +00:00
|
|
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
buf.to_glib_none().0,
|
|
|
|
prob.as_mut_ptr(),
|
|
|
|
);
|
|
|
|
if ret.is_null() {
|
2020-12-17 22:38:06 +00:00
|
|
|
Err(glib::bool_error!("No type could be found"))
|
2019-07-11 12:34:28 +00:00
|
|
|
} else {
|
2019-12-16 11:29:51 +00:00
|
|
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
2019-07-11 12:34:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 13:37:49 +00:00
|
|
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
|
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
2021-05-19 20:35:47 +00:00
|
|
|
#[doc(alias = "gst_type_find_helper_for_buffer_with_extension")]
|
2019-07-11 12:34:28 +00:00
|
|
|
pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
|
|
|
obj: Option<&P>,
|
|
|
|
buf: &gst::Buffer,
|
|
|
|
extension: Option<&str>,
|
2019-12-16 11:29:51 +00:00
|
|
|
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
2019-07-11 12:34:28 +00:00
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
let mut prob = mem::MaybeUninit::uninit();
|
2020-11-21 17:59:22 +00:00
|
|
|
let ret = ffi::gst_type_find_helper_for_buffer_with_extension(
|
2019-07-11 12:34:28 +00:00
|
|
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
buf.to_glib_none().0,
|
|
|
|
extension.to_glib_none().0,
|
|
|
|
prob.as_mut_ptr(),
|
|
|
|
);
|
|
|
|
if ret.is_null() {
|
2020-12-17 22:38:06 +00:00
|
|
|
Err(glib::bool_error!("No type could be found"))
|
2019-07-11 12:34:28 +00:00
|
|
|
} else {
|
2019-12-16 11:29:51 +00:00
|
|
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
2019-07-11 12:34:28 +00:00
|
|
|
}
|
2017-12-18 08:05:42 +00:00
|
|
|
}
|
|
|
|
}
|