gstreamer_editing_services/auto/
test_clip.rs1use 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
42mod sealed {
43 pub trait Sealed {}
44 impl<T: super::IsA<super::TestClip>> Sealed for T {}
45}
46
47pub trait TestClipExt: IsA<TestClip> + sealed::Sealed + 'static {
48 #[doc(alias = "ges_test_clip_get_frequency")]
49 #[doc(alias = "get_frequency")]
50 fn frequency(&self) -> f64 {
51 unsafe { ffi::ges_test_clip_get_frequency(self.as_ref().to_glib_none().0) }
52 }
53
54 #[doc(alias = "ges_test_clip_get_volume")]
55 #[doc(alias = "get_volume")]
56 fn volume(&self) -> f64 {
57 unsafe { ffi::ges_test_clip_get_volume(self.as_ref().to_glib_none().0) }
58 }
59
60 #[doc(alias = "ges_test_clip_get_vpattern")]
61 #[doc(alias = "get_vpattern")]
62 fn vpattern(&self) -> VideoTestPattern {
63 unsafe {
64 from_glib(ffi::ges_test_clip_get_vpattern(
65 self.as_ref().to_glib_none().0,
66 ))
67 }
68 }
69
70 #[doc(alias = "ges_test_clip_is_muted")]
71 fn is_muted(&self) -> bool {
72 unsafe { from_glib(ffi::ges_test_clip_is_muted(self.as_ref().to_glib_none().0)) }
73 }
74
75 #[doc(alias = "ges_test_clip_set_frequency")]
76 fn set_frequency(&self, freq: f64) {
77 unsafe {
78 ffi::ges_test_clip_set_frequency(self.as_ref().to_glib_none().0, freq);
79 }
80 }
81
82 #[doc(alias = "ges_test_clip_set_mute")]
83 #[doc(alias = "mute")]
84 fn set_mute(&self, mute: bool) {
85 unsafe {
86 ffi::ges_test_clip_set_mute(self.as_ref().to_glib_none().0, mute.into_glib());
87 }
88 }
89
90 #[doc(alias = "ges_test_clip_set_volume")]
91 #[doc(alias = "volume")]
92 fn set_volume(&self, volume: f64) {
93 unsafe {
94 ffi::ges_test_clip_set_volume(self.as_ref().to_glib_none().0, volume);
95 }
96 }
97
98 #[doc(alias = "ges_test_clip_set_vpattern")]
99 #[doc(alias = "vpattern")]
100 fn set_vpattern(&self, vpattern: VideoTestPattern) {
101 unsafe {
102 ffi::ges_test_clip_set_vpattern(self.as_ref().to_glib_none().0, vpattern.into_glib());
103 }
104 }
105
106 fn freq(&self) -> f64 {
107 ObjectExt::property(self.as_ref(), "freq")
108 }
109
110 fn set_freq(&self, freq: f64) {
111 ObjectExt::set_property(self.as_ref(), "freq", freq)
112 }
113
114 #[doc(alias = "freq")]
115 fn connect_freq_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
116 unsafe extern "C" fn notify_freq_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
117 this: *mut ffi::GESTestClip,
118 _param_spec: glib::ffi::gpointer,
119 f: glib::ffi::gpointer,
120 ) {
121 let f: &F = &*(f as *const F);
122 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
123 }
124 unsafe {
125 let f: Box_<F> = Box_::new(f);
126 connect_raw(
127 self.as_ptr() as *mut _,
128 b"notify::freq\0".as_ptr() as *const _,
129 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
130 notify_freq_trampoline::<Self, F> as *const (),
131 )),
132 Box_::into_raw(f),
133 )
134 }
135 }
136
137 #[doc(alias = "mute")]
138 fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
139 unsafe extern "C" fn notify_mute_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
140 this: *mut ffi::GESTestClip,
141 _param_spec: glib::ffi::gpointer,
142 f: glib::ffi::gpointer,
143 ) {
144 let f: &F = &*(f as *const F);
145 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
146 }
147 unsafe {
148 let f: Box_<F> = Box_::new(f);
149 connect_raw(
150 self.as_ptr() as *mut _,
151 b"notify::mute\0".as_ptr() as *const _,
152 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
153 notify_mute_trampoline::<Self, F> as *const (),
154 )),
155 Box_::into_raw(f),
156 )
157 }
158 }
159
160 #[doc(alias = "volume")]
161 fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
162 unsafe extern "C" fn notify_volume_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
163 this: *mut ffi::GESTestClip,
164 _param_spec: glib::ffi::gpointer,
165 f: glib::ffi::gpointer,
166 ) {
167 let f: &F = &*(f as *const F);
168 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
169 }
170 unsafe {
171 let f: Box_<F> = Box_::new(f);
172 connect_raw(
173 self.as_ptr() as *mut _,
174 b"notify::volume\0".as_ptr() as *const _,
175 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
176 notify_volume_trampoline::<Self, F> as *const (),
177 )),
178 Box_::into_raw(f),
179 )
180 }
181 }
182
183 #[doc(alias = "vpattern")]
184 fn connect_vpattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
185 unsafe extern "C" fn notify_vpattern_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
186 this: *mut ffi::GESTestClip,
187 _param_spec: glib::ffi::gpointer,
188 f: glib::ffi::gpointer,
189 ) {
190 let f: &F = &*(f as *const F);
191 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
192 }
193 unsafe {
194 let f: Box_<F> = Box_::new(f);
195 connect_raw(
196 self.as_ptr() as *mut _,
197 b"notify::vpattern\0".as_ptr() as *const _,
198 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
199 notify_vpattern_trampoline::<Self, F> as *const (),
200 )),
201 Box_::into_raw(f),
202 )
203 }
204 }
205}
206
207impl<O: IsA<TestClip>> TestClipExt for O {}