aggregator.rs 6.28 KB
Newer Older
1 2 3 4
// 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

5
use glib::object::Cast;
6
use glib::object::IsA;
7
use glib::signal::connect_raw;
8
use glib::signal::SignalHandlerId;
9
use glib::translate::*;
10 11
use glib::StaticType;
use glib::Value;
12 13
use glib_sys;
use gobject_sys;
14
use gst;
15
use gst_base_sys;
16 17 18 19
use std::boxed::Box as Box_;
use std::mem::transmute;

glib_wrapper! {
20
    pub struct Aggregator(Object<gst_base_sys::GstAggregator, gst_base_sys::GstAggregatorClass, AggregatorClass>) @extends gst::Element, gst::Object;
21 22

    match fn {
23
        get_type => || gst_base_sys::gst_aggregator_get_type(),
24 25 26 27 28 29
    }
}

unsafe impl Send for Aggregator {}
unsafe impl Sync for Aggregator {}

30 31
pub const NONE_AGGREGATOR: Option<&Aggregator> = None;

32
pub trait AggregatorExt: 'static {
33
    //#[cfg(any(feature = "v1_14", feature = "dox"))]
34 35
    //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);

36
    #[cfg(any(feature = "v1_14", feature = "dox"))]
37 38
    fn get_buffer_pool(&self) -> Option<gst::BufferPool>;

39
    #[cfg(any(feature = "v1_14", feature = "dox"))]
40 41
    fn get_latency(&self) -> gst::ClockTime;

42
    #[cfg(any(feature = "v1_14", feature = "dox"))]
43 44
    fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime);

45
    #[cfg(any(feature = "v1_14", feature = "dox"))]
46 47
    fn set_src_caps(&self, caps: &gst::Caps);

48 49 50
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    fn simple_get_next_time(&self) -> gst::ClockTime;

51 52 53 54
    fn get_property_start_time(&self) -> u64;

    fn set_property_start_time(&self, start_time: u64);

55
    #[cfg(any(feature = "v1_14", feature = "dox"))]
56 57 58 59 60 61 62 63 64
    fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
65 66
}

67
impl<O: IsA<Aggregator>> AggregatorExt for O {
68
    //#[cfg(any(feature = "v1_14", feature = "dox"))]
69
    //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
70
    //    unsafe { TODO: call gst_base_sys:gst_aggregator_get_allocator() }
71 72
    //}

73
    #[cfg(any(feature = "v1_14", feature = "dox"))]
74 75
    fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
        unsafe {
76 77 78
            from_glib_full(gst_base_sys::gst_aggregator_get_buffer_pool(
                self.as_ref().to_glib_none().0,
            ))
79 80 81
        }
    }

82
    #[cfg(any(feature = "v1_14", feature = "dox"))]
83 84
    fn get_latency(&self) -> gst::ClockTime {
        unsafe {
85 86 87
            from_glib(gst_base_sys::gst_aggregator_get_latency(
                self.as_ref().to_glib_none().0,
            ))
88 89 90
        }
    }

91
    #[cfg(any(feature = "v1_14", feature = "dox"))]
92 93
    fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
        unsafe {
94 95 96 97 98
            gst_base_sys::gst_aggregator_set_latency(
                self.as_ref().to_glib_none().0,
                min_latency.to_glib(),
                max_latency.to_glib(),
            );
99 100 101
        }
    }

102
    #[cfg(any(feature = "v1_14", feature = "dox"))]
103 104
    fn set_src_caps(&self, caps: &gst::Caps) {
        unsafe {
105 106 107 108
            gst_base_sys::gst_aggregator_set_src_caps(
                self.as_ref().to_glib_none().0,
                caps.to_glib_none().0,
            );
109 110 111
        }
    }

112 113 114
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    fn simple_get_next_time(&self) -> gst::ClockTime {
        unsafe {
115 116 117
            from_glib(gst_base_sys::gst_aggregator_simple_get_next_time(
                self.as_ref().to_glib_none().0,
            ))
118 119 120
        }
    }

121 122 123
    fn get_property_start_time(&self) -> u64 {
        unsafe {
            let mut value = Value::from_type(<u64 as StaticType>::static_type());
124 125 126 127 128
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"start-time\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
François Laignel's avatar
Regen  
François Laignel committed
129 130 131 132
            value
                .get()
                .expect("Return Value for property `start-time` getter")
                .unwrap()
133 134 135 136 137
        }
    }

    fn set_property_start_time(&self, start_time: u64) {
        unsafe {
138 139 140 141 142
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"start-time\0".as_ptr() as *const _,
                Value::from(&start_time).to_glib_none().0,
            );
143 144 145
        }
    }

146
    #[cfg(any(feature = "v1_14", feature = "dox"))]
147 148 149 150 151 152 153 154 155 156
    fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstAggregator,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Aggregator>,
Sebastian Dröge's avatar
Sebastian Dröge committed
157 158 159 160
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast())
        }
161
        unsafe {
Sebastian Dröge's avatar
Sebastian Dröge committed
162
            let f: Box_<F> = Box_::new(f);
163 164 165 166 167 168
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::latency\0".as_ptr() as *const _,
                Some(transmute(notify_latency_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
169 170 171
        }
    }

172 173 174 175 176 177 178 179 180 181
    fn connect_property_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_start_time_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstAggregator,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Aggregator>,
Sebastian Dröge's avatar
Sebastian Dröge committed
182 183 184 185
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast())
        }
186
        unsafe {
Sebastian Dröge's avatar
Sebastian Dröge committed
187
            let f: Box_<F> = Box_::new(f);
188 189 190 191 192 193
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::start-time\0".as_ptr() as *const _,
                Some(transmute(notify_start_time_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
194 195 196
        }
    }
}