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-08-17 13:17:02 +00:00
|
|
|
|
2018-04-01 08:30:03 +00:00
|
|
|
use glib::translate::*;
|
2017-08-17 13:17:02 +00:00
|
|
|
|
2020-12-17 22:38:06 +00:00
|
|
|
glib::wrapper! {
|
2019-01-22 15:43:29 +00:00
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
2020-11-21 13:46:48 +00:00
|
|
|
pub struct ParseContext(Boxed<ffi::GstParseContext>);
|
2017-08-17 13:17:02 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
copy => |ptr| {
|
2021-01-07 19:08:36 +00:00
|
|
|
cfg_if::cfg_if! {
|
|
|
|
if #[cfg(feature = "v1_12_1")] {
|
|
|
|
ffi::gst_parse_context_copy(ptr)
|
|
|
|
} else {
|
|
|
|
glib::gobject_ffi::g_boxed_copy(ffi::gst_parse_context_get_type(), ptr as *mut _) as *mut ffi::GstParseContext
|
|
|
|
}
|
|
|
|
}
|
2017-08-17 13:17:02 +00:00
|
|
|
},
|
2021-01-07 19:08:36 +00:00
|
|
|
free => |ptr| ffi::gst_parse_context_free(ptr),
|
2020-11-21 13:46:48 +00:00
|
|
|
get_type => || ffi::gst_parse_context_get_type(),
|
2017-08-17 13:17:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-18 15:04:42 +00:00
|
|
|
unsafe impl Send for ParseContext {}
|
|
|
|
unsafe impl Sync for ParseContext {}
|
|
|
|
|
2017-08-17 13:17:02 +00:00
|
|
|
impl ParseContext {
|
|
|
|
pub fn new() -> Self {
|
2020-11-21 13:46:48 +00:00
|
|
|
unsafe { from_glib_full(ffi::gst_parse_context_new()) }
|
2017-08-17 13:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_missing_elements(&self) -> Vec<String> {
|
|
|
|
unsafe {
|
2020-11-21 13:46:48 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::gst_parse_context_get_missing_elements(
|
2017-08-17 13:17:02 +00:00
|
|
|
mut_override(self.to_glib_none().0),
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-10 11:54:43 +00:00
|
|
|
|
|
|
|
impl Default for ParseContext {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::new()
|
|
|
|
}
|
|
|
|
}
|