1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT
use crate::ffi;
use glib::{prelude::*, translate::*};
/// Tries to find what type of data is flowing from the given source [`gst::Pad`][crate::gst::Pad].
///
/// Free-function: gst_caps_unref
/// ## `src`
/// A source [`gst::Pad`][crate::gst::Pad]
/// ## `size`
/// The length in bytes
///
/// # Returns
///
/// the [`gst::Caps`][crate::gst::Caps] corresponding to the data
/// stream. Returns [`None`] if no [`gst::Caps`][crate::gst::Caps] matches the data stream.
#[doc(alias = "gst_type_find_helper")]
pub fn type_find_helper(src: &impl IsA<gst::Pad>, size: u64) -> Result<gst::Caps, glib::BoolError> {
assert_initialized_main_thread!();
unsafe {
Option::<_>::from_glib_full(ffi::gst_type_find_helper(
src.as_ref().to_glib_none().0,
size,
))
.ok_or_else(|| glib::bool_error!("Could not find type"))
}
}
/// Tries to find the best [`gst::Caps`][crate::gst::Caps] associated with `extension`.
///
/// All available typefinders will be checked against the extension in order
/// of rank. The caps of the first typefinder that can handle `extension` will be
/// returned.
///
/// Free-function: gst_caps_unref
/// ## `obj`
/// object doing the typefinding, or [`None`] (used for logging)
/// ## `extension`
/// an extension
///
/// # Returns
///
/// the [`gst::Caps`][crate::gst::Caps] corresponding to
/// `extension`, or [`None`] if no type could be found. The caller should free
/// the caps returned with `gst_caps_unref()`.
#[doc(alias = "gst_type_find_helper_for_extension")]
pub fn type_find_helper_for_extension(
obj: Option<&impl IsA<gst::Object>>,
extension: &str,
) -> Result<gst::Caps, glib::BoolError> {
assert_initialized_main_thread!();
unsafe {
Option::<_>::from_glib_full(ffi::gst_type_find_helper_for_extension(
obj.map(|p| p.as_ref()).to_glib_none().0,
extension.to_glib_none().0,
))
.ok_or_else(|| glib::bool_error!("Could not find type"))
}
}
//#[doc(alias = "gst_type_find_helper_get_range")]
//pub fn type_find_helper_get_range<P: FnMut(&gst::Object, Option<&gst::Object>, u64, u32) -> Result<gst::FlowSuccess, gst::FlowError>>(obj: &impl IsA<gst::Object>, parent: Option<&impl IsA<gst::Object>>, func: P, size: u64, extension: Option<&str>) -> (Option<gst::Caps>, gst::TypeFindProbability) {
// unsafe { TODO: call ffi:gst_type_find_helper_get_range() }
//}
//#[cfg(feature = "v1_14_3")]
//#[cfg_attr(docsrs, doc(cfg(feature = "v1_14_3")))]
//#[doc(alias = "gst_type_find_helper_get_range_full")]
//pub fn type_find_helper_get_range_full<P: FnMut(&gst::Object, Option<&gst::Object>, u64, u32) -> Result<gst::FlowSuccess, gst::FlowError>>(obj: &impl IsA<gst::Object>, parent: Option<&impl IsA<gst::Object>>, func: P, size: u64, extension: Option<&str>) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::Caps, gst::TypeFindProbability) {
// unsafe { TODO: call ffi:gst_type_find_helper_get_range_full() }
//}