Commit 917255de authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Add typefind helper bindings

parent 12ee7358
......@@ -31,6 +31,7 @@ manual = [
"Gst.FlowReturn",
"Gst.Format",
"Gst.Pad",
"Gst.TypeFindProbability",
]
[[object]]
......@@ -71,6 +72,15 @@ status = "manual"
trait = false
concurrency = "none"
[[object]]
name = "GstBase.*"
status = "generate"
[[object.function]]
name = "type_find_helper_for_data"
# broken data type
ignore = true
[[object]]
name = "Gst.Structure"
status = "manual"
......
// This file was generated by gir (d50d839) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::object::IsA;
use glib::translate::*;
use gst;
use std::mem;
pub fn type_find_helper<P: IsA<gst::Pad>>(src: &P, size: u64) -> Option<gst::Caps> {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gst_type_find_helper(src.to_glib_none().0, size))
}
}
pub fn type_find_helper_for_buffer<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, buf: &gst::Buffer) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!();
let obj = obj.into();
let obj = obj.to_glib_none();
unsafe {
let mut prob = mem::uninitialized();
let ret = from_glib_full(ffi::gst_type_find_helper_for_buffer(obj.0, buf.to_glib_none().0, &mut prob));
(ret, from_glib(prob))
}
}
pub fn type_find_helper_for_extension<'a, P: IsA<gst::Object> + 'a, Q: Into<Option<&'a P>>>(obj: Q, extension: &str) -> Option<gst::Caps> {
assert_initialized_main_thread!();
let obj = obj.into();
let obj = obj.to_glib_none();
unsafe {
from_glib_full(ffi::gst_type_find_helper_for_extension(obj.0, extension.to_glib_none().0))
}
}
//pub fn type_find_helper_get_range<'a, P: IsA<gst::Object>, Q: IsA<gst::Object> + 'a, R: Into<Option<&'a Q>>>(obj: &P, parent: R, func: /*Unknown conversion*//*Unimplemented*/TypeFindHelperGetRangeFunction, size: u64, extension: &str) -> (Option<gst::Caps>, gst::TypeFindProbability) {
// unsafe { TODO: call ffi::gst_type_find_helper_get_range() }
//}
......@@ -19,6 +19,8 @@ pub use self::base_transform::BaseTransformExt;
mod push_src;
pub use self::push_src::PushSrc;
pub mod functions;
#[doc(hidden)]
pub mod traits {
pub use super::BaseSinkExt;
......
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<gst::Object> + 'a,
Q: Into<Option<&'a P>>,
R: AsRef<[u8]>,
>(
obj: Q,
data: R,
) -> (Option<gst::Caps>, gst::TypeFindProbability) {
assert_initialized_main_thread!();
let obj = obj.into();
let obj = obj.to_glib_none();
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.0,
ptr,
len,
&mut prob,
));
(ret, from_glib(prob))
}
}
......@@ -37,6 +37,10 @@ pub use glib::{Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue
#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))]
mod auto;
pub use auto::*;
pub use auto::functions::*;
pub mod functions;
pub use functions::*;
mod adapter;
mod flow_combiner;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment