1 // Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com> 2 // 3 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or 4 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your 6 // option. This file may not be copied, modified, or distributed 7 // except according to those terms. 8 9 use glib::translate::*; 10 use gobject_sys; 11 use gst_sys; 12 13 glib_wrapper! { 14 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 15 pub struct ParseContext(Boxed<gst_sys::GstParseContext>); 16 17 match fn { 18 copy => |ptr| { 19 gobject_sys::g_boxed_copy(gst_sys::gst_parse_context_get_type(), ptr as *mut _) as *mut gst_sys::GstParseContext 20 }, 21 free => |ptr| { 22 gobject_sys::g_boxed_free(gst_sys::gst_parse_context_get_type(), ptr as *mut _) 23 }, 24 get_type => || gst_sys::gst_parse_context_get_type(), 25 } 26 } 27 28 unsafe impl Send for ParseContext {} 29 unsafe impl Sync for ParseContext {} 30 31 impl ParseContext { new() -> Self32 pub fn new() -> Self { 33 unsafe { from_glib_full(gst_sys::gst_parse_context_new()) } 34 } 35 get_missing_elements(&self) -> Vec<String>36 pub fn get_missing_elements(&self) -> Vec<String> { 37 unsafe { 38 FromGlibPtrContainer::from_glib_full(gst_sys::gst_parse_context_get_missing_elements( 39 mut_override(self.to_glib_none().0), 40 )) 41 } 42 } 43 } 44 45 impl Default for ParseContext { default() -> Self46 fn default() -> Self { 47 Self::new() 48 } 49 } 50