Skip to main content

gstreamer_editing_services/auto/
pipeline.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
6use crate::{PipelineFlags, Timeline, ffi};
7use glib::{
8    prelude::*,
9    signal::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GESPipeline")]
16    pub struct Pipeline(Object<ffi::GESPipeline, ffi::GESPipelineClass>) @extends gst::Pipeline, gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy;
17
18    match fn {
19        type_ => || ffi::ges_pipeline_get_type(),
20    }
21}
22
23impl Pipeline {
24    pub const NONE: Option<&'static Pipeline> = None;
25
26    #[doc(alias = "ges_pipeline_new")]
27    pub fn new() -> Pipeline {
28        assert_initialized_main_thread!();
29        unsafe { from_glib_none(ffi::ges_pipeline_new()) }
30    }
31}
32
33impl Default for Pipeline {
34    fn default() -> Self {
35        Self::new()
36    }
37}
38
39pub trait GESPipelineExt: IsA<Pipeline> + 'static {
40    #[doc(alias = "ges_pipeline_get_mode")]
41    #[doc(alias = "get_mode")]
42    fn mode(&self) -> PipelineFlags {
43        unsafe { from_glib(ffi::ges_pipeline_get_mode(self.as_ref().to_glib_none().0)) }
44    }
45
46    #[doc(alias = "ges_pipeline_get_thumbnail")]
47    #[doc(alias = "get_thumbnail")]
48    fn thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample> {
49        unsafe {
50            from_glib_full(ffi::ges_pipeline_get_thumbnail(
51                self.as_ref().to_glib_none().0,
52                caps.to_glib_none().0,
53            ))
54        }
55    }
56
57    #[doc(alias = "ges_pipeline_get_thumbnail_rgb24")]
58    #[doc(alias = "get_thumbnail_rgb24")]
59    fn thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample> {
60        unsafe {
61            from_glib_full(ffi::ges_pipeline_get_thumbnail_rgb24(
62                self.as_ref().to_glib_none().0,
63                width,
64                height,
65            ))
66        }
67    }
68
69    #[doc(alias = "ges_pipeline_preview_get_audio_sink")]
70    fn preview_get_audio_sink(&self) -> Option<gst::Element> {
71        unsafe {
72            from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(
73                self.as_ref().to_glib_none().0,
74            ))
75        }
76    }
77
78    #[doc(alias = "ges_pipeline_preview_get_video_sink")]
79    fn preview_get_video_sink(&self) -> Option<gst::Element> {
80        unsafe {
81            from_glib_full(ffi::ges_pipeline_preview_get_video_sink(
82                self.as_ref().to_glib_none().0,
83            ))
84        }
85    }
86
87    #[doc(alias = "ges_pipeline_preview_set_audio_sink")]
88    fn preview_set_audio_sink(&self, sink: Option<&impl IsA<gst::Element>>) {
89        unsafe {
90            ffi::ges_pipeline_preview_set_audio_sink(
91                self.as_ref().to_glib_none().0,
92                sink.map(|p| p.as_ref()).to_glib_none().0,
93            );
94        }
95    }
96
97    #[doc(alias = "ges_pipeline_preview_set_video_sink")]
98    fn preview_set_video_sink(&self, sink: Option<&impl IsA<gst::Element>>) {
99        unsafe {
100            ffi::ges_pipeline_preview_set_video_sink(
101                self.as_ref().to_glib_none().0,
102                sink.map(|p| p.as_ref()).to_glib_none().0,
103            );
104        }
105    }
106
107    #[doc(alias = "ges_pipeline_save_thumbnail")]
108    fn save_thumbnail(
109        &self,
110        width: i32,
111        height: i32,
112        format: &str,
113        location: &str,
114    ) -> Result<(), glib::Error> {
115        unsafe {
116            let mut error = std::ptr::null_mut();
117            let is_ok = ffi::ges_pipeline_save_thumbnail(
118                self.as_ref().to_glib_none().0,
119                width,
120                height,
121                format.to_glib_none().0,
122                location.to_glib_none().0,
123                &mut error,
124            );
125            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
126            if error.is_null() {
127                Ok(())
128            } else {
129                Err(from_glib_full(error))
130            }
131        }
132    }
133
134    #[doc(alias = "ges_pipeline_set_mode")]
135    #[doc(alias = "mode")]
136    fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> {
137        unsafe {
138            glib::result_from_gboolean!(
139                ffi::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.into_glib()),
140                "Failed to set mode"
141            )
142        }
143    }
144
145    #[doc(alias = "ges_pipeline_set_render_settings")]
146    fn set_render_settings(
147        &self,
148        output_uri: &str,
149        profile: &impl IsA<gst_pbutils::EncodingProfile>,
150    ) -> Result<(), glib::error::BoolError> {
151        unsafe {
152            glib::result_from_gboolean!(
153                ffi::ges_pipeline_set_render_settings(
154                    self.as_ref().to_glib_none().0,
155                    output_uri.to_glib_none().0,
156                    profile.as_ref().to_glib_none().0
157                ),
158                "Failed to set render settings"
159            )
160        }
161    }
162
163    #[doc(alias = "ges_pipeline_set_timeline")]
164    #[doc(alias = "timeline")]
165    fn set_timeline(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError> {
166        unsafe {
167            glib::result_from_gboolean!(
168                ffi::ges_pipeline_set_timeline(
169                    self.as_ref().to_glib_none().0,
170                    timeline.as_ref().to_glib_none().0
171                ),
172                "Failed to set timeline"
173            )
174        }
175    }
176
177    #[doc(alias = "audio-filter")]
178    fn audio_filter(&self) -> Option<gst::Element> {
179        ObjectExt::property(self.as_ref(), "audio-filter")
180    }
181
182    #[doc(alias = "audio-filter")]
183    fn set_audio_filter<P: IsA<gst::Element>>(&self, audio_filter: Option<&P>) {
184        ObjectExt::set_property(self.as_ref(), "audio-filter", audio_filter)
185    }
186
187    #[doc(alias = "audio-sink")]
188    fn audio_sink(&self) -> Option<gst::Element> {
189        ObjectExt::property(self.as_ref(), "audio-sink")
190    }
191
192    #[doc(alias = "audio-sink")]
193    fn set_audio_sink<P: IsA<gst::Element>>(&self, audio_sink: Option<&P>) {
194        ObjectExt::set_property(self.as_ref(), "audio-sink", audio_sink)
195    }
196
197    fn timeline(&self) -> Option<Timeline> {
198        ObjectExt::property(self.as_ref(), "timeline")
199    }
200
201    #[doc(alias = "video-filter")]
202    fn video_filter(&self) -> Option<gst::Element> {
203        ObjectExt::property(self.as_ref(), "video-filter")
204    }
205
206    #[doc(alias = "video-filter")]
207    fn set_video_filter<P: IsA<gst::Element>>(&self, video_filter: Option<&P>) {
208        ObjectExt::set_property(self.as_ref(), "video-filter", video_filter)
209    }
210
211    #[doc(alias = "video-sink")]
212    fn video_sink(&self) -> Option<gst::Element> {
213        ObjectExt::property(self.as_ref(), "video-sink")
214    }
215
216    #[doc(alias = "video-sink")]
217    fn set_video_sink<P: IsA<gst::Element>>(&self, video_sink: Option<&P>) {
218        ObjectExt::set_property(self.as_ref(), "video-sink", video_sink)
219    }
220
221    #[doc(alias = "audio-filter")]
222    fn connect_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
223        unsafe extern "C" fn notify_audio_filter_trampoline<
224            P: IsA<Pipeline>,
225            F: Fn(&P) + 'static,
226        >(
227            this: *mut ffi::GESPipeline,
228            _param_spec: glib::ffi::gpointer,
229            f: glib::ffi::gpointer,
230        ) {
231            unsafe {
232                let f: &F = &*(f as *const F);
233                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
234            }
235        }
236        unsafe {
237            let f: Box_<F> = Box_::new(f);
238            connect_raw(
239                self.as_ptr() as *mut _,
240                c"notify::audio-filter".as_ptr(),
241                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
242                    notify_audio_filter_trampoline::<Self, F> as *const (),
243                )),
244                Box_::into_raw(f),
245            )
246        }
247    }
248
249    #[doc(alias = "audio-sink")]
250    fn connect_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
251        unsafe extern "C" fn notify_audio_sink_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
252            this: *mut ffi::GESPipeline,
253            _param_spec: glib::ffi::gpointer,
254            f: glib::ffi::gpointer,
255        ) {
256            unsafe {
257                let f: &F = &*(f as *const F);
258                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
259            }
260        }
261        unsafe {
262            let f: Box_<F> = Box_::new(f);
263            connect_raw(
264                self.as_ptr() as *mut _,
265                c"notify::audio-sink".as_ptr(),
266                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
267                    notify_audio_sink_trampoline::<Self, F> as *const (),
268                )),
269                Box_::into_raw(f),
270            )
271        }
272    }
273
274    #[doc(alias = "mode")]
275    fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
276        unsafe extern "C" fn notify_mode_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
277            this: *mut ffi::GESPipeline,
278            _param_spec: glib::ffi::gpointer,
279            f: glib::ffi::gpointer,
280        ) {
281            unsafe {
282                let f: &F = &*(f as *const F);
283                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
284            }
285        }
286        unsafe {
287            let f: Box_<F> = Box_::new(f);
288            connect_raw(
289                self.as_ptr() as *mut _,
290                c"notify::mode".as_ptr(),
291                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
292                    notify_mode_trampoline::<Self, F> as *const (),
293                )),
294                Box_::into_raw(f),
295            )
296        }
297    }
298
299    #[doc(alias = "timeline")]
300    fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
301        unsafe extern "C" fn notify_timeline_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
302            this: *mut ffi::GESPipeline,
303            _param_spec: glib::ffi::gpointer,
304            f: glib::ffi::gpointer,
305        ) {
306            unsafe {
307                let f: &F = &*(f as *const F);
308                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
309            }
310        }
311        unsafe {
312            let f: Box_<F> = Box_::new(f);
313            connect_raw(
314                self.as_ptr() as *mut _,
315                c"notify::timeline".as_ptr(),
316                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
317                    notify_timeline_trampoline::<Self, F> as *const (),
318                )),
319                Box_::into_raw(f),
320            )
321        }
322    }
323
324    #[doc(alias = "video-filter")]
325    fn connect_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
326        unsafe extern "C" fn notify_video_filter_trampoline<
327            P: IsA<Pipeline>,
328            F: Fn(&P) + 'static,
329        >(
330            this: *mut ffi::GESPipeline,
331            _param_spec: glib::ffi::gpointer,
332            f: glib::ffi::gpointer,
333        ) {
334            unsafe {
335                let f: &F = &*(f as *const F);
336                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
337            }
338        }
339        unsafe {
340            let f: Box_<F> = Box_::new(f);
341            connect_raw(
342                self.as_ptr() as *mut _,
343                c"notify::video-filter".as_ptr(),
344                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
345                    notify_video_filter_trampoline::<Self, F> as *const (),
346                )),
347                Box_::into_raw(f),
348            )
349        }
350    }
351
352    #[doc(alias = "video-sink")]
353    fn connect_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
354        unsafe extern "C" fn notify_video_sink_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
355            this: *mut ffi::GESPipeline,
356            _param_spec: glib::ffi::gpointer,
357            f: glib::ffi::gpointer,
358        ) {
359            unsafe {
360                let f: &F = &*(f as *const F);
361                f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
362            }
363        }
364        unsafe {
365            let f: Box_<F> = Box_::new(f);
366            connect_raw(
367                self.as_ptr() as *mut _,
368                c"notify::video-sink".as_ptr(),
369                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
370                    notify_video_sink_trampoline::<Self, F> as *const (),
371                )),
372                Box_::into_raw(f),
373            )
374        }
375    }
376}
377
378impl<O: IsA<Pipeline>> GESPipelineExt for O {}