gstreamer_editing_services/auto/
test_clip.rs1use crate::{
7 Clip, Container, Extractable, MetaContainer, SourceClip, TimelineElement, VideoTestPattern, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
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 unsafe {
117 let f: &F = &*(f as *const F);
118 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
119 }
120 }
121 unsafe {
122 let f: Box_<F> = Box_::new(f);
123 connect_raw(
124 self.as_ptr() as *mut _,
125 c"notify::freq".as_ptr(),
126 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
127 notify_freq_trampoline::<Self, F> as *const (),
128 )),
129 Box_::into_raw(f),
130 )
131 }
132 }
133
134 #[doc(alias = "mute")]
135 fn connect_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
136 unsafe extern "C" fn notify_mute_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
137 this: *mut ffi::GESTestClip,
138 _param_spec: glib::ffi::gpointer,
139 f: glib::ffi::gpointer,
140 ) {
141 unsafe {
142 let f: &F = &*(f as *const F);
143 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
144 }
145 }
146 unsafe {
147 let f: Box_<F> = Box_::new(f);
148 connect_raw(
149 self.as_ptr() as *mut _,
150 c"notify::mute".as_ptr(),
151 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
152 notify_mute_trampoline::<Self, F> as *const (),
153 )),
154 Box_::into_raw(f),
155 )
156 }
157 }
158
159 #[doc(alias = "volume")]
160 fn connect_volume_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
161 unsafe extern "C" fn notify_volume_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
162 this: *mut ffi::GESTestClip,
163 _param_spec: glib::ffi::gpointer,
164 f: glib::ffi::gpointer,
165 ) {
166 unsafe {
167 let f: &F = &*(f as *const F);
168 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
169 }
170 }
171 unsafe {
172 let f: Box_<F> = Box_::new(f);
173 connect_raw(
174 self.as_ptr() as *mut _,
175 c"notify::volume".as_ptr(),
176 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
177 notify_volume_trampoline::<Self, F> as *const (),
178 )),
179 Box_::into_raw(f),
180 )
181 }
182 }
183
184 #[doc(alias = "vpattern")]
185 fn connect_vpattern_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
186 unsafe extern "C" fn notify_vpattern_trampoline<P: IsA<TestClip>, F: Fn(&P) + 'static>(
187 this: *mut ffi::GESTestClip,
188 _param_spec: glib::ffi::gpointer,
189 f: glib::ffi::gpointer,
190 ) {
191 unsafe {
192 let f: &F = &*(f as *const F);
193 f(TestClip::from_glib_borrow(this).unsafe_cast_ref())
194 }
195 }
196 unsafe {
197 let f: Box_<F> = Box_::new(f);
198 connect_raw(
199 self.as_ptr() as *mut _,
200 c"notify::vpattern".as_ptr(),
201 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
202 notify_vpattern_trampoline::<Self, F> as *const (),
203 )),
204 Box_::into_raw(f),
205 )
206 }
207 }
208}
209
210impl<O: IsA<TestClip>> TestClipExt for O {}