gstreamer_editing_services/auto/
test_clip.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::{
7    ffi, Clip, Container, Extractable, MetaContainer, SourceClip, TimelineElement, VideoTestPattern,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17    #[doc(alias = "GESTestClip")]
18    pub struct TestClip(Object<ffi::GESTestClip, ffi::GESTestClipClass>) @extends SourceClip, Clip, Container, TimelineElement, @implements Extractable, MetaContainer;
19
20    match fn {
21        type_ => || ffi::ges_test_clip_get_type(),
22    }
23}
24
25impl TestClip {
26    pub const NONE: Option<&'static TestClip> = None;
27
28    #[doc(alias = "ges_test_clip_new")]
29    pub fn new() -> Option<TestClip> {
30        assert_initialized_main_thread!();
31        unsafe { from_glib_none(ffi::ges_test_clip_new()) }
32    }
33
34    #[doc(alias = "ges_test_clip_new_for_nick")]
35    #[doc(alias = "new_for_nick")]
36    pub fn for_nick(nick: &str) -> Option<TestClip> {
37        assert_initialized_main_thread!();
38        unsafe { from_glib_none(ffi::ges_test_clip_new_for_nick(nick.to_glib_none().0)) }
39    }
40}
41
42pub trait TestClipExt: IsA<TestClip> + 'static {
43    #[doc(alias = "ges_test_clip_get_frequency")]
44    #[doc(alias = "get_frequency")]
45    fn frequency(&self) -> f64 {
46        unsafe { ffi::ges_test_clip_get_frequency(self.as_ref().to_glib_none().0) }
47    }
48
49    #[doc(alias = "ges_test_clip_get_volume")]
50    #[doc(alias = "get_volume")]
51    fn volume(&self) -> f64 {
52        unsafe { ffi::ges_test_clip_get_volume(self.as_ref().to_glib_none().0) }
53    }
54
55    #[doc(alias = "ges_test_clip_get_vpattern")]
56    #[doc(alias = "get_vpattern")]
57    fn vpattern(&self) -> VideoTestPattern {
58        unsafe {
59            from_glib(ffi::ges_test_clip_get_vpattern(
60                self.as_ref().to_glib_none().0,
61            ))
62        }
63    }
64
65    #[doc(alias = "ges_test_clip_is_muted")]
66    fn is_muted(&self) -> bool {
67        unsafe { from_glib(ffi::ges_test_clip_is_muted(self.as_ref().to_glib_none().0)) }
68    }
69
70    #[doc(alias = "ges_test_clip_set_frequency")]
71    fn set_frequency(&self, freq: f64) {
72        unsafe {
73            ffi::ges_test_clip_set_frequency(self.as_ref().to_glib_none().0, freq);
74        }
75    }
76
77    #[doc(alias = "ges_test_clip_set_mute")]
78    #[doc(alias = "mute")]
79    fn set_mute(&self, mute: bool) {
80        unsafe {
81            ffi::ges_test_clip_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
82        }
83    }
84
85    #[doc(alias = "ges_test_clip_set_volume")]
86    #[doc(alias = "volume")]
87    fn set_volume(&self, volume: f64) {
88        unsafe {
89            ffi::ges_test_clip_set_volume(self.as_ref().to_glib_none().0, volume);
90        }
91    }
92
93    #[doc(alias = "ges_test_clip_set_vpattern")]
94    #[doc(alias = "vpattern")]
95    fn set_vpattern(&self, vpattern: VideoTestPattern) {
96        unsafe {
97            ffi::ges_test_clip_set_vpattern(self.as_ref().to_glib_none().0, vpattern.into_glib());
98        }
99    }
100
101    fn freq(&self) -> f64 {
102        ObjectExt::property(self.as_ref(), "freq")
103    }
104
105    fn set_freq(&self, freq: f64) {
106        ObjectExt::set_property(self.as_ref(), "freq", freq)
107    }
108
109    #[doc(alias = "freq")]
110    fn connect_freq_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
111        unsafe extern "C" fn notify_freq_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
112            this: *mut ffi::GESTestClip,
113            _param_spec: glib::ffi::gpointer,
114            f: glib::ffi::gpointer,
115        ) {
116            let f: &F = &*(f as *const F);
117            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
118        }
119        unsafe {
120            let f: Box_<F> = Box_::new(f);
121            connect_raw(
122                self.as_ptr() as *mut _,
123                c"notify::freq".as_ptr() as *const _,
124                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
125                    notify_freq_trampoline::<Self, F> as *const (),
126                )),
127                Box_::into_raw(f),
128            )
129        }
130    }
131
132    #[doc(alias = "mute")]
133    fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
134        unsafe extern "C" fn notify_mute_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
135            this: *mut ffi::GESTestClip,
136            _param_spec: glib::ffi::gpointer,
137            f: glib::ffi::gpointer,
138        ) {
139            let f: &F = &*(f as *const F);
140            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
141        }
142        unsafe {
143            let f: Box_<F> = Box_::new(f);
144            connect_raw(
145                self.as_ptr() as *mut _,
146                c"notify::mute".as_ptr() as *const _,
147                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
148                    notify_mute_trampoline::<Self, F> as *const (),
149                )),
150                Box_::into_raw(f),
151            )
152        }
153    }
154
155    #[doc(alias = "volume")]
156    fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
157        unsafe extern "C" fn notify_volume_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
158            this: *mut ffi::GESTestClip,
159            _param_spec: glib::ffi::gpointer,
160            f: glib::ffi::gpointer,
161        ) {
162            let f: &F = &*(f as *const F);
163            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
164        }
165        unsafe {
166            let f: Box_<F> = Box_::new(f);
167            connect_raw(
168                self.as_ptr() as *mut _,
169                c"notify::volume".as_ptr() as *const _,
170                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
171                    notify_volume_trampoline::<Self, F> as *const (),
172                )),
173                Box_::into_raw(f),
174            )
175        }
176    }
177
178    #[doc(alias = "vpattern")]
179    fn connect_vpattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
180        unsafe extern "C" fn notify_vpattern_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
181            this: *mut ffi::GESTestClip,
182            _param_spec: glib::ffi::gpointer,
183            f: glib::ffi::gpointer,
184        ) {
185            let f: &F = &*(f as *const F);
186            f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
187        }
188        unsafe {
189            let f: Box_<F> = Box_::new(f);
190            connect_raw(
191                self.as_ptr() as *mut _,
192                c"notify::vpattern".as_ptr() as *const _,
193                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
194                    notify_vpattern_trampoline::<Self, F> as *const (),
195                )),
196                Box_::into_raw(f),
197            )
198        }
199    }
200}
201
202impl<O: IsA<TestClip>> TestClipExt for O {}