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    /// 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 | Writeable | 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 | Writeable
40    ///
41    ///
42    /// #### `blocksize`
43    ///  The amount of bytes to pull when operating in pull mode.
44    ///
45    /// Readable | Writeable
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 | Writeable
55    ///
56    ///
57    /// #### `last-sample`
58    ///  The last buffer that arrived in the sink and was used for preroll or for
59    /// rendering. This property can be used to generate thumbnails. This property
60    /// can be [`None`] when the sink has not yet received a buffer.
61    ///
62    /// Readable
63    ///
64    ///
65    /// #### `max-bitrate`
66    ///  Control the maximum amount of bits that will be rendered per second.
67    /// Setting this property to a value bigger than 0 will make the sink delay
68    /// rendering of the buffers when it would exceed to max-bitrate.
69    ///
70    /// Readable | Writeable
71    ///
72    ///
73    /// #### `max-lateness`
74    ///  Readable | Writeable
75    ///
76    ///
77    /// #### `processing-deadline`
78    ///  Maximum amount of time (in nanoseconds) that the pipeline can take
79    /// for processing the buffer. This is added to the latency of live
80    /// pipelines.
81    ///
82    /// Readable | Writeable
83    ///
84    ///
85    /// #### `qos`
86    ///  Readable | Writeable
87    ///
88    ///
89    /// #### `render-delay`
90    ///  The additional delay between synchronisation and actual rendering of the
91    /// media. This property will add additional latency to the device in order to
92    /// make other sinks compensate for the delay.
93    ///
94    /// Readable | Writeable
95    ///
96    ///
97    /// #### `stats`
98    ///  Various [`gst_base::BaseSink`][crate::gst_base::BaseSink] statistics. This property returns a [`gst::Structure`][crate::gst::Structure]
99    /// with name `application/x-gst-base-sink-stats` with the following fields:
100    ///
101    /// - "average-rate" G_TYPE_DOUBLE average frame rate
102    /// - "dropped" G_TYPE_UINT64 Number of dropped frames
103    /// - "rendered" G_TYPE_UINT64 Number of rendered frames
104    ///
105    /// Readable
106    ///
107    ///
108    /// #### `sync`
109    ///  Readable | Writeable
110    ///
111    ///
112    /// #### `throttle-time`
113    ///  The time to insert between buffers. This property can be used to control
114    /// the maximum amount of buffers per second to render. Setting this property
115    /// to a value bigger than 0 will make the sink create THROTTLE QoS events.
116    ///
117    /// Readable | Writeable
118    ///
119    ///
120    /// #### `ts-offset`
121    ///  Controls the final synchronisation, a negative value will render the buffer
122    /// earlier while a positive value delays playback. This property can be
123    /// used to fix synchronisation in bad files.
124    ///
125    /// Readable | Writeable
126    /// </details>
127    /// <details><summary><h4>Object</h4></summary>
128    ///
129    ///
130    /// #### `name`
131    ///  Readable | Writeable | Construct
132    ///
133    ///
134    /// #### `parent`
135    ///  The parent of the object. Please note, that when changing the 'parent'
136    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
137    /// signals due to locking issues. In some cases one can use
138    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
139    /// achieve a similar effect.
140    ///
141    /// Readable | Writeable
142    /// </details>
143    ///
144    /// # Implements
145    ///
146    /// [`VideoSinkExt`][trait@crate::prelude::VideoSinkExt], [`trait@gst_base::prelude::BaseSinkExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
147    #[doc(alias = "GstVideoSink")]
148    pub struct VideoSink(Object<ffi::GstVideoSink, ffi::GstVideoSinkClass>) @extends gst_base::BaseSink, gst::Element, gst::Object;
149
150    match fn {
151        type_ => || ffi::gst_video_sink_get_type(),
152    }
153}
154
155impl VideoSink {
156    pub const NONE: Option<&'static VideoSink> = None;
157}
158
159unsafe impl Send for VideoSink {}
160unsafe impl Sync for VideoSink {}
161
162/// Trait containing all [`struct@VideoSink`] methods.
163///
164/// # Implementors
165///
166/// [`VideoSink`][struct@crate::VideoSink]
167pub trait VideoSinkExt: IsA<VideoSink> + 'static {
168    /// Whether to show video frames during preroll. If set to [`false`], video
169    /// frames will only be rendered in PLAYING state.
170    #[doc(alias = "show-preroll-frame")]
171    fn shows_preroll_frame(&self) -> bool {
172        ObjectExt::property(self.as_ref(), "show-preroll-frame")
173    }
174
175    /// Whether to show video frames during preroll. If set to [`false`], video
176    /// frames will only be rendered in PLAYING state.
177    #[doc(alias = "show-preroll-frame")]
178    fn set_show_preroll_frame(&self, show_preroll_frame: bool) {
179        ObjectExt::set_property(self.as_ref(), "show-preroll-frame", show_preroll_frame)
180    }
181
182    #[doc(alias = "show-preroll-frame")]
183    fn connect_show_preroll_frame_notify<F: Fn(&Self) + Send + Sync + 'static>(
184        &self,
185        f: F,
186    ) -> SignalHandlerId {
187        unsafe extern "C" fn notify_show_preroll_frame_trampoline<
188            P: IsA<VideoSink>,
189            F: Fn(&P) + Send + Sync + 'static,
190        >(
191            this: *mut ffi::GstVideoSink,
192            _param_spec: glib::ffi::gpointer,
193            f: glib::ffi::gpointer,
194        ) {
195            let f: &F = &*(f as *const F);
196            f(VideoSink::from_glib_borrow(this).unsafe_cast_ref())
197        }
198        unsafe {
199            let f: Box_<F> = Box_::new(f);
200            connect_raw(
201                self.as_ptr() as *mut _,
202                c"notify::show-preroll-frame".as_ptr() as *const _,
203                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
204                    notify_show_preroll_frame_trampoline::<Self, F> as *const (),
205                )),
206                Box_::into_raw(f),
207            )
208        }
209    }
210}
211
212impl<O: IsA<VideoSink>> VideoSinkExt for O {}