gstreamer-rs/gstreamer-base/src/auto/base_transform.rs

216 lines
6.3 KiB
Rust

// 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 glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::{boxed::Box as Box_, mem::transmute};
glib::wrapper! {
#[doc(alias = "GstBaseTransform")]
pub struct BaseTransform(Object<ffi::GstBaseTransform, ffi::GstBaseTransformClass>) @extends gst::Element, gst::Object;
match fn {
type_ => || ffi::gst_base_transform_get_type(),
}
}
impl BaseTransform {
pub const NONE: Option<&'static BaseTransform> = None;
}
unsafe impl Send for BaseTransform {}
unsafe impl Sync for BaseTransform {}
pub trait BaseTransformExt: 'static {
#[doc(alias = "gst_base_transform_get_buffer_pool")]
#[doc(alias = "get_buffer_pool")]
fn buffer_pool(&self) -> Option<gst::BufferPool>;
#[doc(alias = "gst_base_transform_is_in_place")]
fn is_in_place(&self) -> bool;
#[doc(alias = "gst_base_transform_is_passthrough")]
fn is_passthrough(&self) -> bool;
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_base_transform_reconfigure")]
fn reconfigure(&self) -> bool;
#[doc(alias = "gst_base_transform_reconfigure_sink")]
fn reconfigure_sink(&self);
#[doc(alias = "gst_base_transform_reconfigure_src")]
fn reconfigure_src(&self);
#[doc(alias = "gst_base_transform_set_gap_aware")]
fn set_gap_aware(&self, gap_aware: bool);
#[doc(alias = "gst_base_transform_set_in_place")]
fn set_in_place(&self, in_place: bool);
#[doc(alias = "gst_base_transform_set_passthrough")]
fn set_passthrough(&self, passthrough: bool);
#[doc(alias = "gst_base_transform_set_prefer_passthrough")]
fn set_prefer_passthrough(&self, prefer_passthrough: bool);
#[doc(alias = "gst_base_transform_update_qos")]
fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime);
#[doc(alias = "gst_base_transform_update_src_caps")]
fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError>;
fn is_qos(&self) -> bool;
fn set_qos(&self, qos: bool);
#[doc(alias = "qos")]
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<BaseTransform>> BaseTransformExt for O {
fn buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe {
from_glib_full(ffi::gst_base_transform_get_buffer_pool(
self.as_ref().to_glib_none().0,
))
}
}
fn is_in_place(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_transform_is_in_place(
self.as_ref().to_glib_none().0,
))
}
}
fn is_passthrough(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_transform_is_passthrough(
self.as_ref().to_glib_none().0,
))
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
fn reconfigure(&self) -> bool {
unsafe {
from_glib(ffi::gst_base_transform_reconfigure(
self.as_ref().to_glib_none().0,
))
}
}
fn reconfigure_sink(&self) {
unsafe {
ffi::gst_base_transform_reconfigure_sink(self.as_ref().to_glib_none().0);
}
}
fn reconfigure_src(&self) {
unsafe {
ffi::gst_base_transform_reconfigure_src(self.as_ref().to_glib_none().0);
}
}
fn set_gap_aware(&self, gap_aware: bool) {
unsafe {
ffi::gst_base_transform_set_gap_aware(
self.as_ref().to_glib_none().0,
gap_aware.into_glib(),
);
}
}
fn set_in_place(&self, in_place: bool) {
unsafe {
ffi::gst_base_transform_set_in_place(
self.as_ref().to_glib_none().0,
in_place.into_glib(),
);
}
}
fn set_passthrough(&self, passthrough: bool) {
unsafe {
ffi::gst_base_transform_set_passthrough(
self.as_ref().to_glib_none().0,
passthrough.into_glib(),
);
}
}
fn set_prefer_passthrough(&self, prefer_passthrough: bool) {
unsafe {
ffi::gst_base_transform_set_prefer_passthrough(
self.as_ref().to_glib_none().0,
prefer_passthrough.into_glib(),
);
}
}
fn update_qos(&self, proportion: f64, diff: gst::ClockTimeDiff, timestamp: gst::ClockTime) {
unsafe {
ffi::gst_base_transform_update_qos(
self.as_ref().to_glib_none().0,
proportion,
diff,
timestamp.into_glib(),
);
}
}
fn update_src_caps(&self, updated_caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
unsafe {
glib::result_from_gboolean!(
ffi::gst_base_transform_update_src_caps(
self.as_ref().to_glib_none().0,
updated_caps.to_glib_none().0
),
"Failed to update src caps"
)
}
}
fn is_qos(&self) -> bool {
glib::ObjectExt::property(self.as_ref(), "qos")
}
fn set_qos(&self, qos: bool) {
glib::ObjectExt::set_property(self.as_ref(), "qos", qos)
}
fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_qos_trampoline<
P: IsA<BaseTransform>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstBaseTransform,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(BaseTransform::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::qos\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_qos_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}