Skip to main content

gstreamer_editing_services/auto/
marker_list.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
7#[cfg(feature = "v1_20")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
9use crate::MarkerFlags;
10use crate::{Marker, ffi};
11use glib::{
12    object::ObjectType as _,
13    prelude::*,
14    signal::{SignalHandlerId, connect_raw},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20    #[doc(alias = "GESMarkerList")]
21    pub struct MarkerList(Object<ffi::GESMarkerList, ffi::GESMarkerListClass>);
22
23    match fn {
24        type_ => || ffi::ges_marker_list_get_type(),
25    }
26}
27
28impl MarkerList {
29    #[doc(alias = "ges_marker_list_new")]
30    pub fn new() -> MarkerList {
31        assert_initialized_main_thread!();
32        unsafe { from_glib_full(ffi::ges_marker_list_new()) }
33    }
34
35    #[cfg_attr(feature = "v1_30", deprecated = "Since 1.30")]
36    #[allow(deprecated)]
37    #[doc(alias = "ges_marker_list_add")]
38    pub fn add(&self, position: impl Into<Option<gst::ClockTime>>) -> Marker {
39        unsafe {
40            from_glib_none(ffi::ges_marker_list_add(
41                self.to_glib_none().0,
42                position.into().into_glib(),
43            ))
44        }
45    }
46
47    #[cfg(feature = "v1_30")]
48    #[cfg_attr(docsrs, doc(cfg(feature = "v1_30")))]
49    #[doc(alias = "ges_marker_list_add_full")]
50    pub fn add_full(&self, position: impl Into<Option<gst::ClockTime>>) -> Marker {
51        unsafe {
52            from_glib_full(ffi::ges_marker_list_add_full(
53                self.to_glib_none().0,
54                position.into().into_glib(),
55            ))
56        }
57    }
58
59    #[doc(alias = "ges_marker_list_get_markers")]
60    #[doc(alias = "get_markers")]
61    pub fn markers(&self) -> Vec<Marker> {
62        unsafe {
63            FromGlibPtrContainer::from_glib_full(ffi::ges_marker_list_get_markers(
64                self.to_glib_none().0,
65            ))
66        }
67    }
68
69    #[doc(alias = "ges_marker_list_move")]
70    #[doc(alias = "move")]
71    pub fn move_(&self, marker: &Marker, position: impl Into<Option<gst::ClockTime>>) -> bool {
72        unsafe {
73            from_glib(ffi::ges_marker_list_move(
74                self.to_glib_none().0,
75                marker.to_glib_none().0,
76                position.into().into_glib(),
77            ))
78        }
79    }
80
81    #[doc(alias = "ges_marker_list_remove")]
82    pub fn remove(&self, marker: &Marker) -> bool {
83        unsafe {
84            from_glib(ffi::ges_marker_list_remove(
85                self.to_glib_none().0,
86                marker.to_glib_none().0,
87            ))
88        }
89    }
90
91    #[doc(alias = "ges_marker_list_size")]
92    pub fn size(&self) -> u32 {
93        unsafe { ffi::ges_marker_list_size(self.to_glib_none().0) }
94    }
95
96    #[cfg(feature = "v1_20")]
97    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
98    pub fn flags(&self) -> MarkerFlags {
99        ObjectExt::property(self, "flags")
100    }
101
102    #[cfg(feature = "v1_20")]
103    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
104    pub fn set_flags(&self, flags: MarkerFlags) {
105        ObjectExt::set_property(self, "flags", flags)
106    }
107
108    #[cfg(feature = "v1_18")]
109    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
110    #[doc(alias = "marker-added")]
111    pub fn connect_marker_added<F: Fn(&Self, u64, &Marker) + 'static>(
112        &self,
113        f: F,
114    ) -> SignalHandlerId {
115        unsafe extern "C" fn marker_added_trampoline<F: Fn(&MarkerList, u64, &Marker) + 'static>(
116            this: *mut ffi::GESMarkerList,
117            position: u64,
118            marker: *mut ffi::GESMarker,
119            f: glib::ffi::gpointer,
120        ) {
121            unsafe {
122                let f: &F = &*(f as *const F);
123                f(&from_glib_borrow(this), position, &from_glib_borrow(marker))
124            }
125        }
126        unsafe {
127            let f: Box_<F> = Box_::new(f);
128            connect_raw(
129                self.as_ptr() as *mut _,
130                c"marker-added".as_ptr(),
131                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
132                    marker_added_trampoline::<F> as *const (),
133                )),
134                Box_::into_raw(f),
135            )
136        }
137    }
138
139    #[cfg(feature = "v1_18")]
140    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
141    #[doc(alias = "marker-moved")]
142    pub fn connect_marker_moved<F: Fn(&Self, u64, u64, &Marker) + 'static>(
143        &self,
144        f: F,
145    ) -> SignalHandlerId {
146        unsafe extern "C" fn marker_moved_trampoline<
147            F: Fn(&MarkerList, u64, u64, &Marker) + 'static,
148        >(
149            this: *mut ffi::GESMarkerList,
150            previous_position: u64,
151            new_position: u64,
152            marker: *mut ffi::GESMarker,
153            f: glib::ffi::gpointer,
154        ) {
155            unsafe {
156                let f: &F = &*(f as *const F);
157                f(
158                    &from_glib_borrow(this),
159                    previous_position,
160                    new_position,
161                    &from_glib_borrow(marker),
162                )
163            }
164        }
165        unsafe {
166            let f: Box_<F> = Box_::new(f);
167            connect_raw(
168                self.as_ptr() as *mut _,
169                c"marker-moved".as_ptr(),
170                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
171                    marker_moved_trampoline::<F> as *const (),
172                )),
173                Box_::into_raw(f),
174            )
175        }
176    }
177
178    #[cfg(feature = "v1_18")]
179    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
180    #[doc(alias = "marker-removed")]
181    pub fn connect_marker_removed<F: Fn(&Self, &Marker) + 'static>(&self, f: F) -> SignalHandlerId {
182        unsafe extern "C" fn marker_removed_trampoline<F: Fn(&MarkerList, &Marker) + 'static>(
183            this: *mut ffi::GESMarkerList,
184            marker: *mut ffi::GESMarker,
185            f: glib::ffi::gpointer,
186        ) {
187            unsafe {
188                let f: &F = &*(f as *const F);
189                f(&from_glib_borrow(this), &from_glib_borrow(marker))
190            }
191        }
192        unsafe {
193            let f: Box_<F> = Box_::new(f);
194            connect_raw(
195                self.as_ptr() as *mut _,
196                c"marker-removed".as_ptr(),
197                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
198                    marker_removed_trampoline::<F> as *const (),
199                )),
200                Box_::into_raw(f),
201            )
202        }
203    }
204
205    #[cfg(feature = "v1_20")]
206    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
207    #[doc(alias = "flags")]
208    pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
209        unsafe extern "C" fn notify_flags_trampoline<F: Fn(&MarkerList) + 'static>(
210            this: *mut ffi::GESMarkerList,
211            _param_spec: glib::ffi::gpointer,
212            f: glib::ffi::gpointer,
213        ) {
214            unsafe {
215                let f: &F = &*(f as *const F);
216                f(&from_glib_borrow(this))
217            }
218        }
219        unsafe {
220            let f: Box_<F> = Box_::new(f);
221            connect_raw(
222                self.as_ptr() as *mut _,
223                c"notify::flags".as_ptr(),
224                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
225                    notify_flags_trampoline::<F> as *const (),
226                )),
227                Box_::into_raw(f),
228            )
229        }
230    }
231}
232
233#[cfg(feature = "v1_18")]
234#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
235impl Default for MarkerList {
236    fn default() -> Self {
237        Self::new()
238    }
239}