1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use ges_sys; use glib; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib_sys; use std::boxed::Box as Box_; use std::mem::transmute; use Asset; use BaseEffect; use Container; use Extractable; use Layer; use TimelineElement; use Track; use TrackElement; use TrackType; glib_wrapper! { /// A `Clip` is a 'natural' object which controls one or more /// `TrackElement`(s) in one or more `Track`(s). /// /// Keeps a reference to the `TrackElement`(s) it created and /// sets/updates their properties. /// /// # Implements /// /// [`ClipExt`](trait.ClipExt.html), [`GESContainerExt`](trait.GESContainerExt.html), [`TimelineElementExt`](trait.TimelineElementExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`ExtractableExt`](trait.ExtractableExt.html) pub struct Clip(Object<ges_sys::GESClip, ges_sys::GESClipClass, ClipClass>) @extends Container, TimelineElement, @implements Extractable; match fn { get_type => || ges_sys::ges_clip_get_type(), } } pub const NONE_CLIP: Option<&Clip> = None; /// Trait containing all `Clip` methods. /// /// # Implementors /// /// [`Clip`](struct.Clip.html) pub trait ClipExt: 'static { /// Extracts a `TrackElement` from `asset` and adds it to the `self`. /// Should only be called in order to add operations to a `Clip`, /// ni other cases TrackElement are added automatically when adding the /// `Clip`/`Asset` to a layer. /// /// Takes a reference on `track_element`. /// ## `asset` /// a `Asset` with `GES_TYPE_TRACK_ELEMENT` as extractable_type /// /// # Returns /// /// Created `TrackElement` or NULL /// if an error happened fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Result<TrackElement, glib::BoolError>; /// Finds the `TrackElement` controlled by `self` that is used in `track`. You /// may optionally specify a GType to further narrow search criteria. /// /// Note: If many objects match, then the one with the highest priority will be /// returned. /// ## `track` /// a `Track` or NULL /// ## `type_` /// a `glib::Type` indicating the type of track element you are looking /// for or `G_TYPE_NONE` if you do not care about the track type. /// /// # Returns /// /// The `TrackElement` used by `track`, /// else `None`. Unref after usage fn find_track_element<P: IsA<Track>>( &self, track: Option<&P>, type_: glib::types::Type, ) -> Option<TrackElement>; /// Finds all the `TrackElement` controlled by `self` that is used in `track`. You /// may optionally specify a GType to further narrow search criteria. /// ## `track` /// a `Track` or NULL /// ## `track_type` /// a `TrackType` indicating the type of tracks in which elements /// should be searched. /// ## `type_` /// a `glib::Type` indicating the type of track element you are looking /// for or `G_TYPE_NONE` if you do not care about the track type. /// /// # Returns /// /// a `glib::List` of the /// `TrackElement` contained in `self`. /// The refcount of the objects will be increased. The user will have to /// unref each `TrackElement` and free the `glib::List`. fn find_track_elements<P: IsA<Track>>( &self, track: Option<&P>, track_type: TrackType, type_: glib::types::Type, ) -> Vec<TrackElement>; /// Get the `Layer` to which this clip belongs. /// /// # Returns /// /// The `Layer` where this `self` is being /// used, or `None` if it is not used on any layer. The caller should unref it /// usage. fn get_layer(&self) -> Option<Layer>; /// Get the formats supported by `self`. /// /// # Returns /// /// The formats supported by `self`. fn get_supported_formats(&self) -> TrackType; /// Gets the index position of an effect. /// ## `effect` /// The `BaseEffect` we want to get the top index from /// /// # Returns /// /// The top index of the effect, -1 if something went wrong. fn get_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P) -> i32; fn get_top_effect_position<P: IsA<BaseEffect>>(&self, effect: &P) -> i32; /// Get effects applied on `self` /// /// # Returns /// /// a `glib::List` of the /// `BaseEffect` that are applied on `self` order by ascendant priorities. /// The refcount of the objects will be increased. The user will have to /// unref each `BaseEffect` and free the `glib::List`. fn get_top_effects(&self) -> Vec<TrackElement>; /// Moves `self` to `layer`. If `self` is not in any layer, it adds it to /// `layer`, else, it removes it from its current layer, and adds it to `layer`. /// ## `layer` /// the new `Layer` /// /// # Returns /// /// `true` if `self` could be moved `false` otherwize fn move_to_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError>; /// Sets the formats supported by the file. /// ## `supportedformats` /// the `TrackType` defining formats supported by `self` fn set_supported_formats(&self, supportedformats: TrackType); /// This is a convenience method that lets you set the index of a top effect. /// ## `effect` /// The `BaseEffect` to move /// ## `newindex` /// the new index at which to move the `effect` inside this /// `Clip` /// /// # Returns /// /// `true` if `effect` was successfuly moved, `false` otherwise. fn set_top_effect_index<P: IsA<BaseEffect>>( &self, effect: &P, newindex: u32, ) -> Result<(), glib::error::BoolError>; fn set_top_effect_priority<P: IsA<BaseEffect>>( &self, effect: &P, newpriority: u32, ) -> Result<(), glib::error::BoolError>; /// The function modifies `self`, and creates another `Clip` so we have two /// clips at the end, splitted at the time specified by `position`, as a position /// in the timeline (not in the clip to be split). For example, if /// ges_clip_split is called on a 4-second clip playing from 0:01.00 until /// 0:05.00, with a split position of 0:02.00, this will result in one clip of 1 /// second and one clip of 3 seconds, not in two clips of 2 seconds. /// /// The newly created clip will be added to the same layer as `self` is in. This /// implies that `self` must be in a `Layer` for the operation to be possible. /// /// This method supports clips playing at a different tempo than one second per /// second. For example, splitting a clip with a `Effect` 'pitch tempo=1.5' /// four seconds after it starts, will set the inpoint of the new clip to six /// seconds after that of the clip to split. For this, the rate-changing /// property must be registered using `EffectClass::register_rate_property`; /// for the 'pitch' plugin, this is already done. /// ## `position` /// a `gst::ClockTime` representing the timeline position at which to split /// /// # Returns /// /// The newly created `Clip` resulting /// from the splitting or `None` if the clip can't be split. fn split(&self, position: u64) -> Result<Clip, glib::BoolError>; fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId; } impl<O: IsA<Clip>> ClipExt for O { fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Result<TrackElement, glib::BoolError> { unsafe { Option::<_>::from_glib_none(ges_sys::ges_clip_add_asset( self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, )) .ok_or_else(|| glib_bool_error!("Failed to add asset")) } } fn find_track_element<P: IsA<Track>>( &self, track: Option<&P>, type_: glib::types::Type, ) -> Option<TrackElement> { unsafe { from_glib_full(ges_sys::ges_clip_find_track_element( self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, type_.to_glib(), )) } } fn find_track_elements<P: IsA<Track>>( &self, track: Option<&P>, track_type: TrackType, type_: glib::types::Type, ) -> Vec<TrackElement> { unsafe { FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_find_track_elements( self.as_ref().to_glib_none().0, track.map(|p| p.as_ref()).to_glib_none().0, track_type.to_glib(), type_.to_glib(), )) } } fn get_layer(&self) -> Option<Layer> { unsafe { from_glib_full(ges_sys::ges_clip_get_layer(self.as_ref().to_glib_none().0)) } } fn get_supported_formats(&self) -> TrackType { unsafe { from_glib(ges_sys::ges_clip_get_supported_formats( self.as_ref().to_glib_none().0, )) } } fn get_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 { unsafe { ges_sys::ges_clip_get_top_effect_index( self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, ) } } fn get_top_effect_position<P: IsA<BaseEffect>>(&self, effect: &P) -> i32 { unsafe { ges_sys::ges_clip_get_top_effect_position( self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, ) } } fn get_top_effects(&self) -> Vec<TrackElement> { unsafe { FromGlibPtrContainer::from_glib_full(ges_sys::ges_clip_get_top_effects( self.as_ref().to_glib_none().0, )) } } fn move_to_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_clip_move_to_layer( self.as_ref().to_glib_none().0, layer.as_ref().to_glib_none().0 ), "Failed to move clip to specified layer" ) } } fn set_supported_formats(&self, supportedformats: TrackType) { unsafe { ges_sys::ges_clip_set_supported_formats( self.as_ref().to_glib_none().0, supportedformats.to_glib(), ); } } fn set_top_effect_index<P: IsA<BaseEffect>>( &self, effect: &P, newindex: u32, ) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_clip_set_top_effect_index( self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newindex ), "Failed to move effect" ) } } fn set_top_effect_priority<P: IsA<BaseEffect>>( &self, effect: &P, newpriority: u32, ) -> Result<(), glib::error::BoolError> { unsafe { glib_result_from_gboolean!( ges_sys::ges_clip_set_top_effect_priority( self.as_ref().to_glib_none().0, effect.as_ref().to_glib_none().0, newpriority ), "Failed to the set top effect priority" ) } } fn split(&self, position: u64) -> Result<Clip, glib::BoolError> { unsafe { Option::<_>::from_glib_none(ges_sys::ges_clip_split( self.as_ref().to_glib_none().0, position, )) .ok_or_else(|| glib_bool_error!("Failed to split clip")) } } fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_layer_trampoline<P, F: Fn(&P) + 'static>( this: *mut ges_sys::GESClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<Clip>, { let f: &F = &*(f as *const F); f(&Clip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::layer\0".as_ptr() as *const _, Some(transmute(notify_layer_trampoline::<Self, F> as usize)), Box_::into_raw(f), ) } } fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_supported_formats_trampoline<P, F: Fn(&P) + 'static>( this: *mut ges_sys::GESClip, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where P: IsA<Clip>, { let f: &F = &*(f as *const F); f(&Clip::from_glib_borrow(this).unsafe_cast()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::supported-formats\0".as_ptr() as *const _, Some(transmute( notify_supported_formats_trampoline::<Self, F> as usize, )), Box_::into_raw(f), ) } } }