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