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 | |
6 | use crate::{ffi, Bin, ChildProxy, Clock, ClockTime, Element, Object}; |
7 | use glib::{ |
8 | prelude::*, |
9 | signal::{connect_raw, SignalHandlerId}, |
10 | translate::*, |
11 | }; |
12 | use std::boxed::Box as Box_; |
13 | |
14 | glib::wrapper! { |
15 | #[doc (alias = "GstPipeline" )] |
16 | pub struct Pipeline(Object<ffi::GstPipeline, ffi::GstPipelineClass>) @extends Bin, Element, Object, @implements ChildProxy; |
17 | |
18 | match fn { |
19 | type_ => || ffi::gst_pipeline_get_type(), |
20 | } |
21 | } |
22 | |
23 | impl Pipeline { |
24 | pub const NONE: Option<&'static Pipeline> = None; |
25 | } |
26 | |
27 | unsafe impl Send for Pipeline {} |
28 | unsafe impl Sync for Pipeline {} |
29 | |
30 | mod sealed { |
31 | pub trait Sealed {} |
32 | impl<T: super::IsA<super::Pipeline>> Sealed for T {} |
33 | } |
34 | |
35 | pub trait PipelineExt: IsA<Pipeline> + sealed::Sealed + 'static { |
36 | #[doc (alias = "gst_pipeline_auto_clock" )] |
37 | fn auto_clock(&self) { |
38 | unsafe { |
39 | ffi::gst_pipeline_auto_clock(self.as_ref().to_glib_none().0); |
40 | } |
41 | } |
42 | |
43 | #[doc (alias = "gst_pipeline_get_auto_flush_bus" )] |
44 | #[doc (alias = "get_auto_flush_bus" )] |
45 | #[doc (alias = "auto-flush-bus" )] |
46 | fn is_auto_flush_bus(&self) -> bool { |
47 | unsafe { |
48 | from_glib(ffi::gst_pipeline_get_auto_flush_bus( |
49 | self.as_ref().to_glib_none().0, |
50 | )) |
51 | } |
52 | } |
53 | |
54 | #[cfg (feature = "v1_24" )] |
55 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_24" )))] |
56 | #[doc (alias = "gst_pipeline_get_configured_latency" )] |
57 | #[doc (alias = "get_configured_latency" )] |
58 | fn configured_latency(&self) -> Option<ClockTime> { |
59 | unsafe { |
60 | from_glib(ffi::gst_pipeline_get_configured_latency( |
61 | self.as_ref().to_glib_none().0, |
62 | )) |
63 | } |
64 | } |
65 | |
66 | #[doc (alias = "gst_pipeline_get_delay" )] |
67 | #[doc (alias = "get_delay" )] |
68 | fn delay(&self) -> ClockTime { |
69 | unsafe { |
70 | try_from_glib(ffi::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) |
71 | .expect("mandatory glib value is None" ) |
72 | } |
73 | } |
74 | |
75 | #[doc (alias = "gst_pipeline_get_latency" )] |
76 | #[doc (alias = "get_latency" )] |
77 | fn latency(&self) -> Option<ClockTime> { |
78 | unsafe { |
79 | from_glib(ffi::gst_pipeline_get_latency( |
80 | self.as_ref().to_glib_none().0, |
81 | )) |
82 | } |
83 | } |
84 | |
85 | #[doc (alias = "gst_pipeline_get_pipeline_clock" )] |
86 | #[doc (alias = "get_pipeline_clock" )] |
87 | fn pipeline_clock(&self) -> Clock { |
88 | unsafe { |
89 | from_glib_full(ffi::gst_pipeline_get_pipeline_clock( |
90 | self.as_ref().to_glib_none().0, |
91 | )) |
92 | } |
93 | } |
94 | |
95 | #[cfg (feature = "v1_24" )] |
96 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_24" )))] |
97 | #[doc (alias = "gst_pipeline_is_live" )] |
98 | fn is_live(&self) -> bool { |
99 | unsafe { from_glib(ffi::gst_pipeline_is_live(self.as_ref().to_glib_none().0)) } |
100 | } |
101 | |
102 | #[doc (alias = "gst_pipeline_set_auto_flush_bus" )] |
103 | #[doc (alias = "auto-flush-bus" )] |
104 | fn set_auto_flush_bus(&self, auto_flush: bool) { |
105 | unsafe { |
106 | ffi::gst_pipeline_set_auto_flush_bus( |
107 | self.as_ref().to_glib_none().0, |
108 | auto_flush.into_glib(), |
109 | ); |
110 | } |
111 | } |
112 | |
113 | #[doc (alias = "gst_pipeline_set_delay" )] |
114 | #[doc (alias = "delay" )] |
115 | fn set_delay(&self, delay: ClockTime) { |
116 | unsafe { |
117 | ffi::gst_pipeline_set_delay(self.as_ref().to_glib_none().0, delay.into_glib()); |
118 | } |
119 | } |
120 | |
121 | #[doc (alias = "gst_pipeline_set_latency" )] |
122 | #[doc (alias = "latency" )] |
123 | fn set_latency(&self, latency: impl Into<Option<ClockTime>>) { |
124 | unsafe { |
125 | ffi::gst_pipeline_set_latency( |
126 | self.as_ref().to_glib_none().0, |
127 | latency.into().into_glib(), |
128 | ); |
129 | } |
130 | } |
131 | |
132 | #[doc (alias = "gst_pipeline_use_clock" )] |
133 | fn use_clock(&self, clock: Option<&impl IsA<Clock>>) { |
134 | unsafe { |
135 | ffi::gst_pipeline_use_clock( |
136 | self.as_ref().to_glib_none().0, |
137 | clock.map(|p| p.as_ref()).to_glib_none().0, |
138 | ); |
139 | } |
140 | } |
141 | |
142 | #[doc (alias = "auto-flush-bus" )] |
143 | fn connect_auto_flush_bus_notify<F: Fn(&Self) + Send + Sync + 'static>( |
144 | &self, |
145 | f: F, |
146 | ) -> SignalHandlerId { |
147 | unsafe extern "C" fn notify_auto_flush_bus_trampoline< |
148 | P: IsA<Pipeline>, |
149 | F: Fn(&P) + Send + Sync + 'static, |
150 | >( |
151 | this: *mut ffi::GstPipeline, |
152 | _param_spec: glib::ffi::gpointer, |
153 | f: glib::ffi::gpointer, |
154 | ) { |
155 | let f: &F = &*(f as *const F); |
156 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
157 | } |
158 | unsafe { |
159 | let f: Box_<F> = Box_::new(f); |
160 | connect_raw( |
161 | self.as_ptr() as *mut _, |
162 | b"notify::auto-flush-bus \0" .as_ptr() as *const _, |
163 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
164 | notify_auto_flush_bus_trampoline::<Self, F> as *const (), |
165 | )), |
166 | Box_::into_raw(f), |
167 | ) |
168 | } |
169 | } |
170 | |
171 | #[doc (alias = "delay" )] |
172 | fn connect_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
173 | unsafe extern "C" fn notify_delay_trampoline< |
174 | P: IsA<Pipeline>, |
175 | F: Fn(&P) + Send + Sync + 'static, |
176 | >( |
177 | this: *mut ffi::GstPipeline, |
178 | _param_spec: glib::ffi::gpointer, |
179 | f: glib::ffi::gpointer, |
180 | ) { |
181 | let f: &F = &*(f as *const F); |
182 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
183 | } |
184 | unsafe { |
185 | let f: Box_<F> = Box_::new(f); |
186 | connect_raw( |
187 | self.as_ptr() as *mut _, |
188 | b"notify::delay \0" .as_ptr() as *const _, |
189 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
190 | notify_delay_trampoline::<Self, F> as *const (), |
191 | )), |
192 | Box_::into_raw(f), |
193 | ) |
194 | } |
195 | } |
196 | |
197 | #[doc (alias = "latency" )] |
198 | fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( |
199 | &self, |
200 | f: F, |
201 | ) -> SignalHandlerId { |
202 | unsafe extern "C" fn notify_latency_trampoline< |
203 | P: IsA<Pipeline>, |
204 | F: Fn(&P) + Send + Sync + 'static, |
205 | >( |
206 | this: *mut ffi::GstPipeline, |
207 | _param_spec: glib::ffi::gpointer, |
208 | f: glib::ffi::gpointer, |
209 | ) { |
210 | let f: &F = &*(f as *const F); |
211 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
212 | } |
213 | unsafe { |
214 | let f: Box_<F> = Box_::new(f); |
215 | connect_raw( |
216 | self.as_ptr() as *mut _, |
217 | b"notify::latency \0" .as_ptr() as *const _, |
218 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
219 | notify_latency_trampoline::<Self, F> as *const (), |
220 | )), |
221 | Box_::into_raw(f), |
222 | ) |
223 | } |
224 | } |
225 | } |
226 | |
227 | impl<O: IsA<Pipeline>> PipelineExt for O {} |
228 | |