gstreamer_video/auto/
video_sink.rs1#![allow(deprecated)]
6
7use crate::ffi;
8use glib::{
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "GstVideoSink")]
17 pub struct VideoSink(Object<ffi::GstVideoSink, ffi::GstVideoSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object;
18
19 match fn {
20 type_ => || ffi::gst_video_sink_get_type(),
21 }
22}
23
24impl VideoSink {
25 pub const NONE: Option<&'static VideoSink> = None;
26}
27
28unsafe impl Send for VideoSink {}
29unsafe impl Sync for VideoSink {}
30
31pub trait VideoSinkExt: IsA<VideoSink> + 'static {
32 #[doc(alias = "show-preroll-frame")]
33 fn shows_preroll_frame(&self) -> bool {
34 ObjectExt::property(self.as_ref(), "show-preroll-frame")
35 }
36
37 #[doc(alias = "show-preroll-frame")]
38 fn set_show_preroll_frame(&self, show_preroll_frame: bool) {
39 ObjectExt::set_property(self.as_ref(), "show-preroll-frame", show_preroll_frame)
40 }
41
42 #[doc(alias = "show-preroll-frame")]
43 fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
44 &self,
45 f: F,
46 ) -> SignalHandlerId {
47 unsafe extern "C" fn notify_show_preroll_frame_trampoline<
48 P: IsA<VideoSink>,
49 F: Fn(&P) + Send + Sync + 'static,
50 >(
51 this: *mut ffi::GstVideoSink,
52 _param_spec: glib::ffi::gpointer,
53 f: glib::ffi::gpointer,
54 ) {
55 let f: &F = &*(f as *const F);
56 f(VideoSink::from_glib_borrow(this).unsafe_cast_ref())
57 }
58 unsafe {
59 let f: Box_<F> = Box_::new(f);
60 connect_raw(
61 self.as_ptr() as *mut _,
62 c"notify::show-preroll-frame".as_ptr() as *const _,
63 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
64 notify_show_preroll_frame_trampoline::<Self, F> as *const (),
65 )),
66 Box_::into_raw(f),
67 )
68 }
69 }
70}
71
72impl<O: IsA<VideoSink>> VideoSinkExt for O {}