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::{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_, mem::transmute}; |
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 | fn is_auto_flush_bus(&self) -> bool { |
46 | unsafe { |
47 | from_glib(ffi::gst_pipeline_get_auto_flush_bus( |
48 | self.as_ref().to_glib_none().0, |
49 | )) |
50 | } |
51 | } |
52 | |
53 | #[doc (alias = "gst_pipeline_get_delay" )] |
54 | #[doc (alias = "get_delay" )] |
55 | fn delay(&self) -> ClockTime { |
56 | unsafe { |
57 | try_from_glib(ffi::gst_pipeline_get_delay(self.as_ref().to_glib_none().0)) |
58 | .expect("mandatory glib value is None" ) |
59 | } |
60 | } |
61 | |
62 | #[doc (alias = "gst_pipeline_get_latency" )] |
63 | #[doc (alias = "get_latency" )] |
64 | fn latency(&self) -> Option<ClockTime> { |
65 | unsafe { |
66 | from_glib(ffi::gst_pipeline_get_latency( |
67 | self.as_ref().to_glib_none().0, |
68 | )) |
69 | } |
70 | } |
71 | |
72 | #[doc (alias = "gst_pipeline_get_pipeline_clock" )] |
73 | #[doc (alias = "get_pipeline_clock" )] |
74 | fn pipeline_clock(&self) -> Clock { |
75 | unsafe { |
76 | from_glib_full(ffi::gst_pipeline_get_pipeline_clock( |
77 | self.as_ref().to_glib_none().0, |
78 | )) |
79 | } |
80 | } |
81 | |
82 | #[doc (alias = "gst_pipeline_set_auto_flush_bus" )] |
83 | fn set_auto_flush_bus(&self, auto_flush: bool) { |
84 | unsafe { |
85 | ffi::gst_pipeline_set_auto_flush_bus( |
86 | self.as_ref().to_glib_none().0, |
87 | auto_flush.into_glib(), |
88 | ); |
89 | } |
90 | } |
91 | |
92 | #[doc (alias = "gst_pipeline_set_delay" )] |
93 | fn set_delay(&self, delay: ClockTime) { |
94 | unsafe { |
95 | ffi::gst_pipeline_set_delay(self.as_ref().to_glib_none().0, delay.into_glib()); |
96 | } |
97 | } |
98 | |
99 | #[doc (alias = "gst_pipeline_set_latency" )] |
100 | fn set_latency(&self, latency: impl Into<Option<ClockTime>>) { |
101 | unsafe { |
102 | ffi::gst_pipeline_set_latency( |
103 | self.as_ref().to_glib_none().0, |
104 | latency.into().into_glib(), |
105 | ); |
106 | } |
107 | } |
108 | |
109 | #[doc (alias = "gst_pipeline_use_clock" )] |
110 | fn use_clock(&self, clock: Option<&impl IsA<Clock>>) { |
111 | unsafe { |
112 | ffi::gst_pipeline_use_clock( |
113 | self.as_ref().to_glib_none().0, |
114 | clock.map(|p| p.as_ref()).to_glib_none().0, |
115 | ); |
116 | } |
117 | } |
118 | |
119 | #[doc (alias = "auto-flush-bus" )] |
120 | fn connect_auto_flush_bus_notify<F: Fn(&Self) + Send + Sync + 'static>( |
121 | &self, |
122 | f: F, |
123 | ) -> SignalHandlerId { |
124 | unsafe extern "C" fn notify_auto_flush_bus_trampoline< |
125 | P: IsA<Pipeline>, |
126 | F: Fn(&P) + Send + Sync + 'static, |
127 | >( |
128 | this: *mut ffi::GstPipeline, |
129 | _param_spec: glib::ffi::gpointer, |
130 | f: glib::ffi::gpointer, |
131 | ) { |
132 | let f: &F = &*(f as *const F); |
133 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
134 | } |
135 | unsafe { |
136 | let f: Box_<F> = Box_::new(f); |
137 | connect_raw( |
138 | self.as_ptr() as *mut _, |
139 | b"notify::auto-flush-bus \0" .as_ptr() as *const _, |
140 | Some(transmute::<_, unsafe extern "C" fn()>( |
141 | notify_auto_flush_bus_trampoline::<Self, F> as *const (), |
142 | )), |
143 | Box_::into_raw(f), |
144 | ) |
145 | } |
146 | } |
147 | |
148 | #[doc (alias = "delay" )] |
149 | fn connect_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId { |
150 | unsafe extern "C" fn notify_delay_trampoline< |
151 | P: IsA<Pipeline>, |
152 | F: Fn(&P) + Send + Sync + 'static, |
153 | >( |
154 | this: *mut ffi::GstPipeline, |
155 | _param_spec: glib::ffi::gpointer, |
156 | f: glib::ffi::gpointer, |
157 | ) { |
158 | let f: &F = &*(f as *const F); |
159 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
160 | } |
161 | unsafe { |
162 | let f: Box_<F> = Box_::new(f); |
163 | connect_raw( |
164 | self.as_ptr() as *mut _, |
165 | b"notify::delay \0" .as_ptr() as *const _, |
166 | Some(transmute::<_, unsafe extern "C" fn()>( |
167 | notify_delay_trampoline::<Self, F> as *const (), |
168 | )), |
169 | Box_::into_raw(f), |
170 | ) |
171 | } |
172 | } |
173 | |
174 | #[doc (alias = "latency" )] |
175 | fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>( |
176 | &self, |
177 | f: F, |
178 | ) -> SignalHandlerId { |
179 | unsafe extern "C" fn notify_latency_trampoline< |
180 | P: IsA<Pipeline>, |
181 | F: Fn(&P) + Send + Sync + 'static, |
182 | >( |
183 | this: *mut ffi::GstPipeline, |
184 | _param_spec: glib::ffi::gpointer, |
185 | f: glib::ffi::gpointer, |
186 | ) { |
187 | let f: &F = &*(f as *const F); |
188 | f(Pipeline::from_glib_borrow(this).unsafe_cast_ref()) |
189 | } |
190 | unsafe { |
191 | let f: Box_<F> = Box_::new(f); |
192 | connect_raw( |
193 | self.as_ptr() as *mut _, |
194 | b"notify::latency \0" .as_ptr() as *const _, |
195 | Some(transmute::<_, unsafe extern "C" fn()>( |
196 | notify_latency_trampoline::<Self, F> as *const (), |
197 | )), |
198 | Box_::into_raw(f), |
199 | ) |
200 | } |
201 | } |
202 | } |
203 | |
204 | impl<O: IsA<Pipeline>> PipelineExt for O {} |
205 | |