1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5glib::wrapper! {
6 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
7 #[doc(alias = "GstParseContext")]
8 pub struct ParseContext(Boxed<ffi::GstParseContext>);
9
10 match fn {
11 copy => |ptr| {
12 cfg_if::cfg_if! {
13 if #[cfg(feature = "v1_12_1")] {
14 ffi::gst_parse_context_copy(ptr)
15 } else {
16 glib::gobject_ffi::g_boxed_copy(ffi::gst_parse_context_get_type(), ptr as *mut _) as *mut ffi::GstParseContext
17 }
18 }
19 },
20 free => |ptr| ffi::gst_parse_context_free(ptr),
21 type_ => || ffi::gst_parse_context_get_type(),
22 }
23}
24
25unsafe impl Send for ParseContext {}
26unsafe impl Sync for ParseContext {}
27
28impl ParseContext {
29 #[doc(alias = "gst_parse_context_new")]
30 pub fn new() -> Self {
31 unsafe { from_glib_full(ptr:ffi::gst_parse_context_new()) }
32 }
33
34 #[doc(alias = "get_missing_elements")]
35 #[doc(alias = "gst_parse_context_get_missing_elements")]
36 pub fn missing_elements(&self) -> Vec<String> {
37 unsafe {
38 FromGlibPtrContainer::from_glib_full(ptr:ffi::gst_parse_context_get_missing_elements(
39 context:mut_override(self.to_glib_none().0),
40 ))
41 }
42 }
43}
44
45impl Default for ParseContext {
46 fn default() -> Self {
47 Self::new()
48 }
49}
50