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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
use crate::AggregatorPad;
#[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
use crate::AggregatorStartTimeSelection;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::StaticType;
use glib::ToValue;
use std::boxed::Box as Box_;
use std::mem::transmute;

glib::wrapper! {
    /// Manages a set of pads with the purpose of aggregating their buffers.
    /// Control is given to the subclass when all pads have data.
    ///
    ///  * Base class for mixers and muxers. Subclasses should at least implement
    ///  the [`crate::GstAggregatorClass.aggregate()`] virtual method.
    ///
    ///  * Installs a `GstPadChainFunction`, a `GstPadEventFullFunction` and a
    ///  `GstPadQueryFunction` to queue all serialized data packets per sink pad.
    ///  Subclasses should not overwrite those, but instead implement
    ///  [`crate::GstAggregatorClass.sink_event()`] and [`crate::GstAggregatorClass.sink_query()`] as
    ///  needed.
    ///
    ///  * When data is queued on all pads, the aggregate vmethod is called.
    ///
    ///  * One can peek at the data on any given GstAggregatorPad with the
    ///  [`crate::prelude::AggregatorPadExt::peek_buffer()`] method, and remove it from the pad
    ///  with the gst_aggregator_pad_pop_buffer () method. When a buffer
    ///  has been taken with pop_buffer (), a new buffer can be queued
    ///  on that pad.
    ///
    ///  * When [`crate::prelude::AggregatorPadExt::peek_buffer()`] or [`crate::prelude::AggregatorPadExt::has_buffer()`]
    ///  are called, a reference is taken to the returned buffer, which stays
    ///  valid until either:
    ///
    ///  - [`crate::prelude::AggregatorPadExt::pop_buffer()`] is called, in which case the caller
    ///  is guaranteed that the buffer they receive is the same as the peeked
    ///  buffer.
    ///  - [`crate::prelude::AggregatorPadExt::drop_buffer()`] is called, in which case the caller
    ///  is guaranteed that the dropped buffer is the one that was peeked.
    ///  - the subclass implementation of [`crate::AggregatorClass.aggregate`] returns.
    ///
    ///  Subsequent calls to [`crate::prelude::AggregatorPadExt::peek_buffer()`] or
    ///  [`crate::prelude::AggregatorPadExt::has_buffer()`] return / check the same buffer that was
    ///  returned / checked, until one of the conditions listed above is met.
    ///
    ///  Subclasses are only allowed to call these methods from the aggregate
    ///  thread.
    ///
    ///  * If the subclass wishes to push a buffer downstream in its aggregate
    ///  implementation, it should do so through the
    ///  [`Self::finish_buffer()`] method. This method will take care
    ///  of sending and ordering mandatory events such as stream start, caps
    ///  and segment. Buffer lists can also be pushed out with
    ///  [`Self::finish_buffer_list()`].
    ///
    ///  * Same goes for EOS events, which should not be pushed directly by the
    ///  subclass, it should instead return GST_FLOW_EOS in its aggregate
    ///  implementation.
    ///
    ///  * Note that the aggregator logic regarding gap event handling is to turn
    ///  these into gap buffers with matching PTS and duration. It will also
    ///  flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE
    ///  to ease their identification and subsequent processing.
    ///
    ///  * Subclasses must use (a subclass of) [`crate::AggregatorPad`] for both their
    ///  sink and source pads.
    ///  See [`crate::gst::ElementClass::add_static_pad_template_with_gtype()`].
    ///
    /// This class used to live in gst-plugins-bad and was moved to core.
    ///
    /// This is an Abstract Base Class, you cannot instantiate it.
    ///
    /// # Implements
    ///
    /// [`trait@crate::prelude::AggregatorExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::object::ObjectExt`], [`trait@crate::prelude::AggregatorExtManual`]
    pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass>) @extends gst::Element, gst::Object;

    match fn {
        type_ => || ffi::gst_aggregator_get_type(),
    }
}

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

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

/// Trait containing all `Aggregator` methods.
///
/// # Implementors
///
/// [`struct@crate::Aggregator`]
pub trait AggregatorExt: 'static {
    //#[doc(alias = "gst_aggregator_get_allocator")]
    //#[doc(alias = "get_allocator")]
    //fn allocator(&self, allocator: /*Ignored*/Option<gst::Allocator>, params: /*Ignored*/gst::AllocationParams);

    ///
    /// # Returns
    ///
    /// the instance of the [`crate::gst::BufferPool`] used
    /// by `trans`; free it after use it
    #[doc(alias = "gst_aggregator_get_buffer_pool")]
    #[doc(alias = "get_buffer_pool")]
    fn buffer_pool(&self) -> Option<gst::BufferPool>;

    /// Retrieves the latency values reported by `self` in response to the latency
    /// query, or `GST_CLOCK_TIME_NONE` if there is not live source connected and the element
    /// will not wait for the clock.
    ///
    /// Typically only called by subclasses.
    ///
    /// # Returns
    ///
    /// The latency or `GST_CLOCK_TIME_NONE` if the element does not sync
    #[doc(alias = "gst_aggregator_get_latency")]
    #[doc(alias = "get_latency")]
    fn latency(&self) -> gst::ClockTime;

    /// Negotiates src pad caps with downstream elements.
    /// Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
    /// if [`crate::GstAggregatorClass.negotiate()`] fails.
    ///
    /// # Returns
    ///
    /// [`true`] if the negotiation succeeded, else [`false`].
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_aggregator_negotiate")]
    fn negotiate(&self) -> bool;

    /// Use this function to determine what input buffers will be aggregated
    /// to produce the next output buffer. This should only be called from
    /// a [`crate::Aggregator::samples-selected`] handler, and can be used to precisely
    /// control aggregating parameters for a given set of input samples.
    ///
    /// # Returns
    ///
    /// The sample that is about to be aggregated. It may hold a [`crate::gst::Buffer`]
    ///  or a [`crate::gst::BufferList`]. The contents of its info structure is subclass-dependent,
    ///  and documented on a subclass basis. The buffers held by the sample are
    ///  not writable.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_aggregator_peek_next_sample")]
    fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample>;

    /// Lets [`crate::Aggregator`] sub-classes tell the baseclass what their internal
    /// latency is. Will also post a LATENCY message on the bus so the pipeline
    /// can reconfigure its global latency.
    /// ## `min_latency`
    /// minimum latency
    /// ## `max_latency`
    /// maximum latency
    #[doc(alias = "gst_aggregator_set_latency")]
    fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime);

    /// Sets the caps to be used on the src pad.
    /// ## `caps`
    /// The [`crate::gst::Caps`] to set on the src pad.
    #[doc(alias = "gst_aggregator_set_src_caps")]
    fn set_src_caps(&self, caps: &gst::Caps);

    /// This is a simple [`crate::GstAggregatorClass.get_next_time()`] implementation that
    /// just looks at the [`crate::gst::Segment`] on the srcpad of the aggregator and bases
    /// the next time on the running time there.
    ///
    /// This is the desired behaviour in most cases where you have a live source
    /// and you have a dead line based aggregator subclass.
    ///
    /// # Returns
    ///
    /// The running time based on the position
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_aggregator_simple_get_next_time")]
    fn simple_get_next_time(&self) -> gst::ClockTime;

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    //#[doc(alias = "gst_aggregator_update_segment")]
    //fn update_segment(&self, segment: /*Ignored*/&gst::Segment);

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn emits_signals(&self) -> bool;

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn set_emit_signals(&self, emit_signals: bool);

    #[doc(alias = "start-time")]
    fn start_time(&self) -> u64;

    #[doc(alias = "start-time")]
    fn set_start_time(&self, start_time: u64);

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn start_time_selection(&self) -> AggregatorStartTimeSelection;

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection);

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    //#[doc(alias = "samples-selected")]
    //fn connect_samples_selected<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[cfg(any(feature = "v1_14", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
    #[doc(alias = "latency")]
    fn connect_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F)
        -> SignalHandlerId;

    #[doc(alias = "start-time")]
    fn connect_start_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
}

impl<O: IsA<Aggregator>> AggregatorExt for O {
    //fn allocator(&self, allocator: /*Ignored*/Option<gst::Allocator>, params: /*Ignored*/gst::AllocationParams) {
    //    unsafe { TODO: call ffi:gst_aggregator_get_allocator() }
    //}

    fn buffer_pool(&self) -> Option<gst::BufferPool> {
        unsafe {
            from_glib_full(ffi::gst_aggregator_get_buffer_pool(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn latency(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ffi::gst_aggregator_get_latency(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn negotiate(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_aggregator_negotiate(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn peek_next_sample<P: IsA<AggregatorPad>>(&self, pad: &P) -> Option<gst::Sample> {
        unsafe {
            from_glib_full(ffi::gst_aggregator_peek_next_sample(
                self.as_ref().to_glib_none().0,
                pad.as_ref().to_glib_none().0,
            ))
        }
    }

    fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
        unsafe {
            ffi::gst_aggregator_set_latency(
                self.as_ref().to_glib_none().0,
                min_latency.into_glib(),
                max_latency.into_glib(),
            );
        }
    }

    fn set_src_caps(&self, caps: &gst::Caps) {
        unsafe {
            ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
        }
    }

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    fn simple_get_next_time(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ffi::gst_aggregator_simple_get_next_time(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    //fn update_segment(&self, segment: /*Ignored*/&gst::Segment) {
    //    unsafe { TODO: call ffi:gst_aggregator_update_segment() }
    //}

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn emits_signals(&self) -> bool {
        unsafe {
            let mut value = glib::Value::from_type(<bool as StaticType>::static_type());
            glib::gobject_ffi::g_object_get_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"emit-signals\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `emit-signals` getter")
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn set_emit_signals(&self, emit_signals: bool) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"emit-signals\0".as_ptr() as *const _,
                emit_signals.to_value().to_glib_none().0,
            );
        }
    }

    fn start_time(&self) -> u64 {
        unsafe {
            let mut value = glib::Value::from_type(<u64 as StaticType>::static_type());
            glib::gobject_ffi::g_object_get_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"start-time\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `start-time` getter")
        }
    }

    fn set_start_time(&self, start_time: u64) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"start-time\0".as_ptr() as *const _,
                start_time.to_value().to_glib_none().0,
            );
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn start_time_selection(&self) -> AggregatorStartTimeSelection {
        unsafe {
            let mut value =
                glib::Value::from_type(<AggregatorStartTimeSelection as StaticType>::static_type());
            glib::gobject_ffi::g_object_get_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"start-time-selection\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `start-time-selection` getter")
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"start-time-selection\0".as_ptr() as *const _,
                start_time_selection.to_value().to_glib_none().0,
            );
        }
    }

    //#[cfg(any(feature = "v1_18", feature = "dox"))]
    //#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    //#[doc(alias = "samples-selected")]
    //fn connect_samples_selected<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Ignored segment: Gst.Segment
    //}

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn connect_emit_signals_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_emit_signals_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) where
            P: IsA<Aggregator>,
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::emit-signals\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_emit_signals_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(any(feature = "v1_14", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
    #[doc(alias = "latency")]
    fn connect_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 ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) where
            P: IsA<Aggregator>,
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::latency\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_latency_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "start-time")]
    fn connect_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 ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) where
            P: IsA<Aggregator>,
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::start-time\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_start_time_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn connect_start_time_selection_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_start_time_selection_trampoline<
            P,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) where
            P: IsA<Aggregator>,
        {
            let f: &F = &*(f as *const F);
            f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::start-time-selection\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_start_time_selection_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}