2018-10-31 16:10:30 +00:00
|
|
|
// 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 Asset;
|
|
|
|
use Clip;
|
|
|
|
use Extractable;
|
|
|
|
use Timeline;
|
|
|
|
use TrackType;
|
|
|
|
use ffi;
|
2019-01-16 11:32:39 +00:00
|
|
|
use glib::object::Cast;
|
2018-10-31 16:10:30 +00:00
|
|
|
use glib::object::IsA;
|
|
|
|
use glib::signal::SignalHandlerId;
|
2018-12-08 09:05:20 +00:00
|
|
|
use glib::signal::connect_raw;
|
2018-10-31 16:10:30 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
|
|
|
use gst;
|
|
|
|
use std::boxed::Box as Box_;
|
|
|
|
use std::mem::transmute;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
2019-01-16 11:32:39 +00:00
|
|
|
pub struct Layer(Object<ffi::GESLayer, ffi::GESLayerClass, LayerClass>) @implements Extractable;
|
2018-10-31 16:10:30 +00:00
|
|
|
|
|
|
|
match fn {
|
|
|
|
get_type => || ffi::ges_layer_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Layer {
|
|
|
|
pub fn new() -> Layer {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_none(ffi::ges_layer_new())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for Layer {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self::new()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
pub const NONE_LAYER: Option<&Layer> = None;
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
pub trait LayerExt: 'static {
|
2018-10-31 16:10:30 +00:00
|
|
|
fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip>;
|
|
|
|
|
|
|
|
fn add_clip<P: IsA<Clip>>(&self, clip: &P) -> bool;
|
|
|
|
|
|
|
|
fn get_auto_transition(&self) -> bool;
|
|
|
|
|
|
|
|
fn get_clips(&self) -> Vec<Clip>;
|
|
|
|
|
|
|
|
fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip>;
|
|
|
|
|
|
|
|
fn get_duration(&self) -> gst::ClockTime;
|
|
|
|
|
|
|
|
fn get_priority(&self) -> u32;
|
|
|
|
|
|
|
|
fn get_timeline(&self) -> Option<Timeline>;
|
|
|
|
|
|
|
|
fn is_empty(&self) -> bool;
|
|
|
|
|
|
|
|
fn remove_clip<P: IsA<Clip>>(&self, clip: &P) -> bool;
|
|
|
|
|
|
|
|
fn set_auto_transition(&self, auto_transition: bool);
|
|
|
|
|
|
|
|
#[cfg_attr(feature = "v1_16", deprecated)]
|
|
|
|
fn set_priority(&self, priority: u32);
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P);
|
2018-10-31 16:10:30 +00:00
|
|
|
|
|
|
|
fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
|
|
|
|
fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
|
|
|
|
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
|
|
|
|
#[cfg_attr(feature = "v1_16", deprecated)]
|
|
|
|
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
}
|
|
|
|
|
2018-12-08 09:05:20 +00:00
|
|
|
impl<O: IsA<Layer>> LayerExt for O {
|
2018-10-31 16:10:30 +00:00
|
|
|
fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip> {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib_none(ffi::ges_layer_add_asset(self.as_ref().to_glib_none().0, asset.as_ref().to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib()))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn add_clip<P: IsA<Clip>>(&self, clip: &P) -> bool {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib(ffi::ges_layer_add_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_auto_transition(&self) -> bool {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib(ffi::ges_layer_get_auto_transition(self.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_clips(&self) -> Vec<Clip> {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips(self.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip> {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval(self.as_ref().to_glib_none().0, start.to_glib(), end.to_glib()))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_duration(&self) -> gst::ClockTime {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib(ffi::ges_layer_get_duration(self.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_priority(&self) -> u32 {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::ges_layer_get_priority(self.as_ref().to_glib_none().0)
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_timeline(&self) -> Option<Timeline> {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib_none(ffi::ges_layer_get_timeline(self.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn is_empty(&self) -> bool {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib(ffi::ges_layer_is_empty(self.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn remove_clip<P: IsA<Clip>>(&self, clip: &P) -> bool {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
from_glib(ffi::ges_layer_remove_clip(self.as_ref().to_glib_none().0, clip.as_ref().to_glib_none().0))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_auto_transition(&self, auto_transition: bool) {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::ges_layer_set_auto_transition(self.as_ref().to_glib_none().0, auto_transition.to_glib());
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn set_priority(&self, priority: u32) {
|
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::ges_layer_set_priority(self.as_ref().to_glib_none().0, priority);
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-16 11:32:39 +00:00
|
|
|
fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) {
|
2018-10-31 16:10:30 +00:00
|
|
|
unsafe {
|
2019-01-16 11:32:39 +00:00
|
|
|
ffi::ges_layer_set_timeline(self.as_ref().to_glib_none().0, timeline.as_ref().to_glib_none().0);
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn connect_clip_added<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"clip-added\0".as_ptr() as *const _,
|
2018-10-31 16:10:30 +00:00
|
|
|
transmute(clip_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"clip-removed\0".as_ptr() as *const _,
|
2018-10-31 16:10:30 +00:00
|
|
|
transmute(clip_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"notify::auto-transition\0".as_ptr() as *const _,
|
2018-10-31 16:10:30 +00:00
|
|
|
transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
|
|
unsafe {
|
|
|
|
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
|
2019-01-16 11:32:39 +00:00
|
|
|
connect_raw(self.as_ptr() as *mut _, b"notify::priority\0".as_ptr() as *const _,
|
2018-10-31 16:10:30 +00:00
|
|
|
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn clip_added_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Layer> {
|
|
|
|
let f: &&(Fn(&P, &Clip) + 'static) = transmute(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn clip_removed_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Layer> {
|
|
|
|
let f: &&(Fn(&P, &Clip) + 'static) = transmute(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&Layer::from_glib_borrow(this).unsafe_cast(), &from_glib_borrow(clip))
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn notify_auto_transition_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Layer> {
|
|
|
|
let f: &&(Fn(&P) + 'static) = transmute(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&Layer::from_glib_borrow(this).unsafe_cast())
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
|
|
|
|
where P: IsA<Layer> {
|
|
|
|
let f: &&(Fn(&P) + 'static) = transmute(f);
|
2019-01-16 11:32:39 +00:00
|
|
|
f(&Layer::from_glib_borrow(this).unsafe_cast())
|
2018-10-31 16:10:30 +00:00
|
|
|
}
|