gstreamer_video/auto/
video_sink.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#![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
31mod sealed {
32    pub trait Sealed {}
33    impl<T: super::IsA<super::VideoSink>> Sealed for T {}
34}
35
36pub trait VideoSinkExt: IsA<VideoSink> + sealed::Sealed + 'static {
37    #[doc(alias = "show-preroll-frame")]
38    fn shows_preroll_frame(&self) -> bool {
39        ObjectExt::property(self.as_ref(), "show-preroll-frame")
40    }
41
42    #[doc(alias = "show-preroll-frame")]
43    fn set_show_preroll_frame(&self, show_preroll_frame: bool) {
44        ObjectExt::set_property(self.as_ref(), "show-preroll-frame", show_preroll_frame)
45    }
46
47    #[doc(alias = "show-preroll-frame")]
48    fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
49        &self,
50        f: F,
51    ) -> SignalHandlerId {
52        unsafe extern "C" fn notify_show_preroll_frame_trampoline<
53            P: IsA<VideoSink>,
54            F: Fn(&P) + Send + Sync + 'static,
55        >(
56            this: *mut ffi::GstVideoSink,
57            _param_spec: glib::ffi::gpointer,
58            f: glib::ffi::gpointer,
59        ) {
60            let f: &F = &*(f as *const F);
61            f(VideoSink::from_glib_borrow(this).unsafe_cast_ref())
62        }
63        unsafe {
64            let f: Box_<F> = Box_::new(f);
65            connect_raw(
66                self.as_ptr() as *mut _,
67                b"notify::show-preroll-frame\0".as_ptr() as *const _,
68                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
69                    notify_show_preroll_frame_trampoline::<Self, F> as *const (),
70                )),
71                Box_::into_raw(f),
72            )
73        }
74    }
75}
76
77impl<O: IsA<VideoSink>> VideoSinkExt for O {}