| 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) |
| 2 | // from gir-files (https://github.com/gtk-rs/gir-files) |
| 3 | // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) |
| 4 | // DO NOT EDIT |
| 5 | |
| 6 | use crate::ffi; |
| 7 | use glib::{ |
| 8 | object::ObjectType as _, |
| 9 | prelude::*, |
| 10 | signal::{connect_raw, SignalHandlerId}, |
| 11 | translate::*, |
| 12 | }; |
| 13 | use std::boxed::Box as Box_; |
| 14 | |
| 15 | glib::wrapper! { |
| 16 | #[doc (alias = "GstAggregatorPad" )] |
| 17 | pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass>) @extends gst::Pad, gst::Object; |
| 18 | |
| 19 | match fn { |
| 20 | type_ => || ffi::gst_aggregator_pad_get_type(), |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | impl AggregatorPad { |
| 25 | pub const NONE: Option<&'static AggregatorPad> = None; |
| 26 | } |
| 27 | |
| 28 | unsafe impl Send for AggregatorPad {} |
| 29 | unsafe impl Sync for AggregatorPad {} |
| 30 | |
| 31 | mod sealed { |
| 32 | pub trait Sealed {} |
| 33 | impl<T: super::IsA<super::AggregatorPad>> Sealed for T {} |
| 34 | } |
| 35 | |
| 36 | pub trait AggregatorPadExt: IsA<AggregatorPad> + sealed::Sealed + 'static { |
| 37 | #[doc (alias = "gst_aggregator_pad_drop_buffer" )] |
| 38 | fn drop_buffer(&self) -> bool { |
| 39 | unsafe { |
| 40 | from_glib(ffi::gst_aggregator_pad_drop_buffer( |
| 41 | self.as_ref().to_glib_none().0, |
| 42 | )) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | #[cfg (feature = "v1_14_1" )] |
| 47 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_14_1" )))] |
| 48 | #[doc (alias = "gst_aggregator_pad_has_buffer" )] |
| 49 | fn has_buffer(&self) -> bool { |
| 50 | unsafe { |
| 51 | from_glib(ffi::gst_aggregator_pad_has_buffer( |
| 52 | self.as_ref().to_glib_none().0, |
| 53 | )) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | #[doc (alias = "gst_aggregator_pad_is_eos" )] |
| 58 | fn is_eos(&self) -> bool { |
| 59 | unsafe { |
| 60 | from_glib(ffi::gst_aggregator_pad_is_eos( |
| 61 | self.as_ref().to_glib_none().0, |
| 62 | )) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | #[cfg (feature = "v1_20" )] |
| 67 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_20" )))] |
| 68 | #[doc (alias = "gst_aggregator_pad_is_inactive" )] |
| 69 | fn is_inactive(&self) -> bool { |
| 70 | unsafe { |
| 71 | from_glib(ffi::gst_aggregator_pad_is_inactive( |
| 72 | self.as_ref().to_glib_none().0, |
| 73 | )) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | #[doc (alias = "gst_aggregator_pad_peek_buffer" )] |
| 78 | fn peek_buffer(&self) -> Option<gst::Buffer> { |
| 79 | unsafe { |
| 80 | from_glib_full(ffi::gst_aggregator_pad_peek_buffer( |
| 81 | self.as_ref().to_glib_none().0, |
| 82 | )) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | #[doc (alias = "gst_aggregator_pad_pop_buffer" )] |
| 87 | fn pop_buffer(&self) -> Option<gst::Buffer> { |
| 88 | unsafe { |
| 89 | from_glib_full(ffi::gst_aggregator_pad_pop_buffer( |
| 90 | self.as_ref().to_glib_none().0, |
| 91 | )) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | #[cfg (feature = "v1_16" )] |
| 96 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
| 97 | #[doc (alias = "emit-signals" )] |
| 98 | fn emits_signals(&self) -> bool { |
| 99 | ObjectExt::property(self.as_ref(), "emit-signals" ) |
| 100 | } |
| 101 | |
| 102 | #[cfg (feature = "v1_16" )] |
| 103 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
| 104 | #[doc (alias = "emit-signals" )] |
| 105 | fn set_emit_signals(&self, emit_signals: bool) { |
| 106 | ObjectExt::set_property(self.as_ref(), "emit-signals" , emit_signals) |
| 107 | } |
| 108 | |
| 109 | #[doc (alias = "buffer-consumed" )] |
| 110 | fn connect_buffer_consumed<F: Fn(&Self, &gst::Buffer) + Send + Sync + 'static>( |
| 111 | &self, |
| 112 | f: F, |
| 113 | ) -> SignalHandlerId { |
| 114 | unsafe extern "C" fn buffer_consumed_trampoline< |
| 115 | P: IsA<AggregatorPad>, |
| 116 | F: Fn(&P, &gst::Buffer) + Send + Sync + 'static, |
| 117 | >( |
| 118 | this: *mut ffi::GstAggregatorPad, |
| 119 | object: *mut gst::ffi::GstBuffer, |
| 120 | f: glib::ffi::gpointer, |
| 121 | ) { |
| 122 | let f: &F = &*(f as *const F); |
| 123 | f( |
| 124 | AggregatorPad::from_glib_borrow(this).unsafe_cast_ref(), |
| 125 | &from_glib_borrow(object), |
| 126 | ) |
| 127 | } |
| 128 | unsafe { |
| 129 | let f: Box_<F> = Box_::new(f); |
| 130 | connect_raw( |
| 131 | self.as_ptr() as *mut _, |
| 132 | b"buffer-consumed \0" .as_ptr() as *const _, |
| 133 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 134 | buffer_consumed_trampoline::<Self, F> as *const (), |
| 135 | )), |
| 136 | Box_::into_raw(f), |
| 137 | ) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | #[cfg (feature = "v1_16" )] |
| 142 | #[cfg_attr (docsrs, doc(cfg(feature = "v1_16" )))] |
| 143 | #[doc (alias = "emit-signals" )] |
| 144 | fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>( |
| 145 | &self, |
| 146 | f: F, |
| 147 | ) -> SignalHandlerId { |
| 148 | unsafe extern "C" fn notify_emit_signals_trampoline< |
| 149 | P: IsA<AggregatorPad>, |
| 150 | F: Fn(&P) + Send + Sync + 'static, |
| 151 | >( |
| 152 | this: *mut ffi::GstAggregatorPad, |
| 153 | _param_spec: glib::ffi::gpointer, |
| 154 | f: glib::ffi::gpointer, |
| 155 | ) { |
| 156 | let f: &F = &*(f as *const F); |
| 157 | f(AggregatorPad::from_glib_borrow(this).unsafe_cast_ref()) |
| 158 | } |
| 159 | unsafe { |
| 160 | let f: Box_<F> = Box_::new(f); |
| 161 | connect_raw( |
| 162 | self.as_ptr() as *mut _, |
| 163 | b"notify::emit-signals \0" .as_ptr() as *const _, |
| 164 | Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>( |
| 165 | notify_emit_signals_trampoline::<Self, F> as *const (), |
| 166 | )), |
| 167 | Box_::into_raw(f), |
| 168 | ) |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {} |
| 174 | |