gstreamer-rs/gstreamer-video/src/auto/video_sink.rs

99 lines
3.1 KiB
Rust
Raw Normal View History

2020-06-12 14:05:46 +00:00
// 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)
2020-06-12 14:05:46 +00:00
// DO NOT EDIT
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
2021-04-19 16:24:43 +00:00
use glib::ToValue;
2020-06-12 14:05:46 +00:00
use std::boxed::Box as Box_;
use std::mem::transmute;
2020-12-17 22:34:53 +00:00
glib::wrapper! {
2020-11-22 09:50:37 +00:00
pub struct VideoSink(Object<ffi::GstVideoSink, ffi::GstVideoSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object;
2020-06-12 14:05:46 +00:00
match fn {
type_ => || ffi::gst_video_sink_get_type(),
2020-06-12 14:05:46 +00:00
}
}
unsafe impl Send for VideoSink {}
unsafe impl Sync for VideoSink {}
pub const NONE_VIDEO_SINK: Option<&VideoSink> = None;
pub trait VideoSinkExt: 'static {
#[doc(alias = "show-preroll-frame")]
2021-04-11 19:38:18 +00:00
fn shows_preroll_frame(&self) -> bool;
2020-06-12 14:05:46 +00:00
#[doc(alias = "show-preroll-frame")]
2021-04-11 19:38:18 +00:00
fn set_show_preroll_frame(&self, show_preroll_frame: bool);
2020-06-12 14:05:46 +00:00
#[doc(alias = "show-preroll-frame")]
fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
2020-06-12 14:05:46 +00:00
&self,
f: F,
) -> SignalHandlerId;
}
impl<O: IsA<VideoSink>> VideoSinkExt for O {
2021-04-11 19:38:18 +00:00
fn shows_preroll_frame(&self) -> bool {
2020-06-12 14:05:46 +00:00
unsafe {
2020-11-27 13:37:24 +00:00
let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
2020-11-22 09:50:37 +00:00
glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
2020-06-12 14:05:46 +00:00
b"show-preroll-frame\0".as_ptr() as *const _,
value.to_glib_none_mut().0,
);
value
.get()
.expect("Return Value for property `show-preroll-frame` getter")
}
}
2021-04-11 19:38:18 +00:00
fn set_show_preroll_frame(&self, show_preroll_frame: bool) {
2020-06-12 14:05:46 +00:00
unsafe {
2020-11-22 09:50:37 +00:00
glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
2020-06-12 14:05:46 +00:00
b"show-preroll-frame\0".as_ptr() as *const _,
2021-04-19 16:24:43 +00:00
show_preroll_frame.to_value().to_glib_none().0,
2020-06-12 14:05:46 +00:00
);
}
}
#[doc(alias = "show-preroll-frame")]
fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
2020-06-12 14:05:46 +00:00
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_show_preroll_frame_trampoline<
P,
F: Fn(&P) + Send + Sync + 'static,
>(
2020-11-22 09:50:37 +00:00
this: *mut ffi::GstVideoSink,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
2020-06-12 14:05:46 +00:00
) where
P: IsA<VideoSink>,
{
let f: &F = &*(f as *const F);
f(&VideoSink::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::show-preroll-frame\0".as_ptr() as *const _,
Some(transmute::<_, unsafe extern "C" fn()>(
notify_show_preroll_frame_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}