Skip to main content

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::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// Provides useful functions and a base class for video sinks.
17    ///
18    /// GstVideoSink will configure the default base sink to drop frames that
19    /// arrive later than 20ms as this is considered the default threshold for
20    /// observing out-of-sync frames.
21    ///
22    /// ## Properties
23    ///
24    ///
25    /// #### `show-preroll-frame`
26    ///  Whether to show video frames during preroll. If set to [`false`], video
27    /// frames will only be rendered in PLAYING state.
28    ///
29    /// Readable | Writable | Construct
30    /// <details><summary><h4>BaseSink</h4></summary>
31    ///
32    ///
33    /// #### `async`
34    ///  If set to [`true`], the basesink will perform asynchronous state changes.
35    /// When set to [`false`], the sink will not signal the parent when it prerolls.
36    /// Use this option when dealing with sparse streams or when synchronisation is
37    /// not required.
38    ///
39    /// Readable | Writable
40    ///
41    ///
42    /// #### `blocksize`
43    ///  The amount of bytes to pull when operating in pull mode.
44    ///
45    /// Readable | Writable
46    ///
47    ///
48    /// #### `enable-last-sample`
49    ///  Enable the last-sample property. If [`false`], basesink doesn't keep a
50    /// reference to the last buffer arrived and the last-sample property is always
51    /// set to [`None`]. This can be useful if you need buffers to be released as soon
52    /// as possible, eg. if you're using a buffer pool.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `enable-last-sample-notify`
58    ///  Enable emission of the "notify::last-sample" signal. This is disabled by
59    /// default as it can be expensive: the notification is emitted for every
60    /// buffer that updates the last sample. It has no effect unless
61    /// [`enable-last-sample`][struct@crate::gst_base::BaseSink#enable-last-sample] is also [`true`].
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `last-sample`
67    ///  The last buffer that arrived in the sink and was used for preroll or for
68    /// rendering. This property can be used to generate thumbnails. This property
69    /// can be [`None`] when the sink has not yet received a buffer.
70    ///
71    /// Readable
72    ///
73    ///
74    /// #### `max-bitrate`
75    ///  Control the maximum amount of bits that will be rendered per second.
76    /// Setting this property to a value bigger than 0 will make the sink delay
77    /// rendering of the buffers when it would exceed to max-bitrate.
78    ///
79    /// Readable | Writable
80    ///
81    ///
82    /// #### `max-lateness`
83    ///  Readable | Writable
84    ///
85    ///
86    /// #### `processing-deadline`
87    ///  Maximum amount of time (in nanoseconds) that the pipeline can take
88    /// for processing the buffer. This is added to the latency of live
89    /// pipelines.
90    ///
91    /// Readable | Writable
92    ///
93    ///
94    /// #### `qos`
95    ///  Readable | Writable
96    ///
97    ///
98    /// #### `render-delay`
99    ///  The additional delay between synchronisation and actual rendering of the
100    /// media. This property will add additional latency to the device in order to
101    /// make other sinks compensate for the delay.
102    ///
103    /// Readable | Writable
104    ///
105    ///
106    /// #### `stats`
107    ///  Various [`gst_base::BaseSink`][crate::gst_base::BaseSink] statistics. This property returns a [`gst::Structure`][crate::gst::Structure]
108    /// with name `application/x-gst-base-sink-stats` with the following fields:
109    ///
110    /// - "average-rate" G_TYPE_DOUBLE average frame rate
111    /// - "dropped" G_TYPE_UINT64 Number of dropped frames
112    /// - "rendered" G_TYPE_UINT64 Number of rendered frames
113    ///
114    /// Readable
115    ///
116    ///
117    /// #### `sync`
118    ///  Readable | Writable
119    ///
120    ///
121    /// #### `throttle-time`
122    ///  The time to insert between buffers. This property can be used to control
123    /// the maximum amount of buffers per second to render. Setting this property
124    /// to a value bigger than 0 will make the sink create THROTTLE QoS events.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `ts-offset`
130    ///  Controls the final synchronisation, a negative value will render the buffer
131    /// earlier while a positive value delays playback. This property can be
132    /// used to fix synchronisation in bad files.
133    ///
134    /// Readable | Writable
135    /// </details>
136    /// <details><summary><h4>Object</h4></summary>
137    ///
138    ///
139    /// #### `name`
140    ///  Readable | Writable | Construct
141    ///
142    ///
143    /// #### `parent`
144    ///  The parent of the object. Please note, that when changing the 'parent'
145    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
146    /// signals due to locking issues. In some cases one can use
147    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
148    /// achieve a similar effect.
149    ///
150    /// Readable | Writable
151    /// </details>
152    ///
153    /// # Implements
154    ///
155    /// [`VideoSinkExt`][trait@crate::prelude::VideoSinkExt], [`trait@gst_base::prelude::BaseSinkExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
156    #[doc(alias = "GstVideoSink")]
157    pub struct VideoSink(Object<ffi::GstVideoSink, ffi::GstVideoSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object;
158
159    match fn {
160        type_ => || ffi::gst_video_sink_get_type(),
161    }
162}
163
164impl VideoSink {
165    pub const NONE: Option<&'static VideoSink> = None;
166}
167
168unsafe impl Send for VideoSink {}
169unsafe impl Sync for VideoSink {}
170
171/// Trait containing all [`struct@VideoSink`] methods.
172///
173/// # Implementors
174///
175/// [`VideoSink`][struct@crate::VideoSink]
176pub trait VideoSinkExt: IsA<VideoSink> + 'static {
177    /// Whether to show video frames during preroll. If set to [`false`], video
178    /// frames will only be rendered in PLAYING state.
179    #[doc(alias = "show-preroll-frame")]
180    fn shows_preroll_frame(&self) -> bool {
181        ObjectExt::property(self.as_ref(), "show-preroll-frame")
182    }
183
184    /// Whether to show video frames during preroll. If set to [`false`], video
185    /// frames will only be rendered in PLAYING state.
186    #[doc(alias = "show-preroll-frame")]
187    fn set_show_preroll_frame(&self, show_preroll_frame: bool) {
188        ObjectExt::set_property(self.as_ref(), "show-preroll-frame", show_preroll_frame)
189    }
190
191    #[doc(alias = "show-preroll-frame")]
192    fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
193        &self,
194        f: F,
195    ) -> SignalHandlerId {
196        unsafe extern "C" fn notify_show_preroll_frame_trampoline<
197            P: IsA<VideoSink>,
198            F: Fn(&P) + Send + Sync + 'static,
199        >(
200            this: *mut ffi::GstVideoSink,
201            _param_spec: glib::ffi::gpointer,
202            f: glib::ffi::gpointer,
203        ) {
204            unsafe {
205                let f: &F = &*(f as *const F);
206                f(VideoSink::from_glib_borrow(this).unsafe_cast_ref())
207            }
208        }
209        unsafe {
210            let f: Box_<F> = Box_::new(f);
211            connect_raw(
212                self.as_ptr() as *mut _,
213                c"notify::show-preroll-frame".as_ptr(),
214                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
215                    notify_show_preroll_frame_trampoline::<Self, F> as *const (),
216                )),
217                Box_::into_raw(f),
218            )
219        }
220    }
221}
222
223impl<O: IsA<VideoSink>> VideoSinkExt for O {}