// Copyright (C) 2017 Sebastian Dröge // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. use ffi; use glib::object::IsA; use glib::translate::*; use gst; use std::mem; pub fn type_find_helper_for_data< 'a, P: IsA + 'a, Q: Into>, R: AsRef<[u8]>, >( obj: Q, data: R, ) -> (Option, gst::TypeFindProbability) { assert_initialized_main_thread!(); let obj = obj.into(); unsafe { let mut prob = mem::uninitialized(); let data = data.as_ref(); let (ptr, len) = (data.as_ptr(), data.len()); let ret = from_glib_full(ffi::gst_type_find_helper_for_data( obj.map(|p| p.as_ref()).to_glib_none().0, mut_override(ptr), len, &mut prob, )); (ret, from_glib(prob)) } }