gstreamer/
parse_context.rs

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