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
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
// 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(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
use crate::{AggregatorPad, AggregatorStartTimeSelection};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

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 `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
    ///  `GstAggregatorClass::sink_event` and `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
    ///  [`AggregatorPadExt::peek_buffer()`][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 [`AggregatorPadExt::peek_buffer()`][crate::prelude::AggregatorPadExt::peek_buffer()] or [`AggregatorPadExt::has_buffer()`][crate::prelude::AggregatorPadExt::has_buffer()]
    ///  are called, a reference is taken to the returned buffer, which stays
    ///  valid until either:
    ///
    ///  - [`AggregatorPadExt::pop_buffer()`][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.
    ///  - [`AggregatorPadExt::drop_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 `GstAggregatorClass.aggregate` returns.
    ///
    ///  Subsequent calls to [`AggregatorPadExt::peek_buffer()`][crate::prelude::AggregatorPadExt::peek_buffer()] or
    ///  [`AggregatorPadExt::has_buffer()`][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
    ///  [`AggregatorExt::finish_buffer()`][crate::prelude::AggregatorExt::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
    ///  [`AggregatorExt::finish_buffer_list()`][crate::prelude::AggregatorExt::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.
    ///  In addition, if the gap event was flagged with GST_GAP_FLAG_MISSING_DATA,
    ///  a custom meta is added to the resulting gap buffer (GstAggregatorMissingDataMeta).
    ///
    ///  * Subclasses must use (a subclass of) [`AggregatorPad`][crate::AggregatorPad] for both their
    ///  sink and source pads.
    ///  See `gst_element_class_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.
    ///
    /// ## Properties
    ///
    ///
    /// #### `emit-signals`
    ///  Enables the emission of signals such as [`samples-selected`][struct@crate::Aggregator#samples-selected]
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `latency`
    ///  Readable | Writeable
    ///
    ///
    /// #### `min-upstream-latency`
    ///  Force minimum upstream latency (in nanoseconds). When sources with a
    /// higher latency are expected to be plugged in dynamically after the
    /// aggregator has started playing, this allows overriding the minimum
    /// latency reported by the initial source(s). This is only taken into
    /// account when larger than the actually reported minimum latency.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `start-time`
    ///  Readable | Writeable
    ///
    ///
    /// #### `start-time-selection`
    ///  Readable | Writeable
    /// <details><summary><h4>Object</h4></summary>
    ///
    ///
    /// #### `name`
    ///  Readable | Writeable | Construct
    ///
    ///
    /// #### `parent`
    ///  The parent of the object. Please note, that when changing the 'parent'
    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
    /// signals due to locking issues. In some cases one can use
    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
    /// achieve a similar effect.
    ///
    /// Readable | Writeable
    /// </details>
    ///
    /// ## Signals
    ///
    ///
    /// #### `samples-selected`
    ///  Signals that the [`Aggregator`][crate::Aggregator] subclass has selected the next set
    /// of input samples it will aggregate. Handlers may call
    /// [`AggregatorExt::peek_next_sample()`][crate::prelude::AggregatorExt::peek_next_sample()] at that point.
    ///
    ///
    /// <details><summary><h4>Element</h4></summary>
    ///
    ///
    /// #### `no-more-pads`
    ///  This signals that the element will not generate more dynamic pads.
    /// Note that this signal will usually be emitted from the context of
    /// the streaming thread.
    ///
    ///
    ///
    ///
    /// #### `pad-added`
    ///  a new [`gst::Pad`][crate::gst::Pad] has been added to the element. Note that this signal will
    /// usually be emitted from the context of the streaming thread. Also keep in
    /// mind that if you add new elements to the pipeline in the signal handler
    /// you will need to set them to the desired target state with
    /// [`ElementExtManual::set_state()`][crate::gst::prelude::ElementExtManual::set_state()] or [`ElementExtManual::sync_state_with_parent()`][crate::gst::prelude::ElementExtManual::sync_state_with_parent()].
    ///
    ///
    ///
    ///
    /// #### `pad-removed`
    ///  a [`gst::Pad`][crate::gst::Pad] has been removed from the element
    ///
    ///
    /// </details>
    /// <details><summary><h4>Object</h4></summary>
    ///
    ///
    /// #### `deep-notify`
    ///  The deep notify signal is used to be notified of property changes. It is
    /// typically attached to the toplevel bin to receive notifications from all
    /// the elements contained in that bin.
    ///
    /// Detailed
    /// </details>
    ///
    /// # Implements
    ///
    /// [`AggregatorExt`][trait@crate::prelude::AggregatorExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`AggregatorExtManual`][trait@crate::prelude::AggregatorExtManual]
    #[doc(alias = "GstAggregator")]
    pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass>) @extends gst::Element, gst::Object;

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

impl Aggregator {
    pub const NONE: Option<&'static Aggregator> = None;
}

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

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Aggregator>> Sealed for T {}
}

/// Trait containing all [`struct@Aggregator`] methods.
///
/// # Implementors
///
/// [`Aggregator`][struct@crate::Aggregator]
pub trait AggregatorExt: IsA<Aggregator> + sealed::Sealed + 'static {
    /// This method will push the provided output buffer downstream. If needed,
    /// mandatory events such as stream-start, caps, and segment events will be
    /// sent before pushing the buffer.
    /// ## `buffer`
    /// the [`gst::Buffer`][crate::gst::Buffer] to push.
    #[doc(alias = "gst_aggregator_finish_buffer")]
    fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
        unsafe {
            try_from_glib(ffi::gst_aggregator_finish_buffer(
                self.as_ref().to_glib_none().0,
                buffer.into_glib_ptr(),
            ))
        }
    }

    /// This method will push the provided output buffer list downstream. If needed,
    /// mandatory events such as stream-start, caps, and segment events will be
    /// sent before pushing the buffer.
    /// ## `bufferlist`
    /// the [`gst::BufferList`][crate::gst::BufferList] to push.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_aggregator_finish_buffer_list")]
    fn finish_buffer_list(
        &self,
        bufferlist: gst::BufferList,
    ) -> Result<gst::FlowSuccess, gst::FlowError> {
        unsafe {
            try_from_glib(ffi::gst_aggregator_finish_buffer_list(
                self.as_ref().to_glib_none().0,
                bufferlist.into_glib_ptr(),
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// the instance of the [`gst::BufferPool`][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> {
        unsafe {
            from_glib_full(ffi::gst_aggregator_get_buffer_pool(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Subclasses may use the return value to inform whether they should return
    /// [`gst::FlowReturn::Eos`][crate::gst::FlowReturn::Eos] from their aggregate implementation.
    ///
    /// # Returns
    ///
    /// whether live status was forced on `self`.
    #[cfg(feature = "v1_22")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
    #[doc(alias = "gst_aggregator_get_force_live")]
    #[doc(alias = "get_force_live")]
    fn is_force_live(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_aggregator_get_force_live(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    ///
    /// # Returns
    ///
    /// whether inactive pads will not be waited on
    #[cfg(feature = "v1_20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
    #[doc(alias = "gst_aggregator_get_ignore_inactive_pads")]
    #[doc(alias = "get_ignore_inactive_pads")]
    fn ignores_inactive_pads(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_aggregator_get_ignore_inactive_pads(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// 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) -> Option<gst::ClockTime> {
        unsafe {
            from_glib(ffi::gst_aggregator_get_latency(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

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

    /// Use this function to determine what input buffers will be aggregated
    /// to produce the next output buffer. This should only be called from
    /// a [`samples-selected`][struct@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 [`gst::Buffer`][crate::gst::Buffer]
    ///  or a [`gst::BufferList`][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(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_aggregator_peek_next_sample")]
    fn peek_next_sample(&self, pad: &impl IsA<AggregatorPad>) -> 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,
            ))
        }
    }

    /// Subclasses should call this at construction time in order for `self` to
    /// aggregate on a timeout even when no live source is connected.
    #[cfg(feature = "v1_22")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
    #[doc(alias = "gst_aggregator_set_force_live")]
    fn set_force_live(&self, force_live: bool) {
        unsafe {
            ffi::gst_aggregator_set_force_live(
                self.as_ref().to_glib_none().0,
                force_live.into_glib(),
            );
        }
    }

    /// Subclasses should call this when they don't want to time out
    /// waiting for a pad that hasn't yet received any buffers in live
    /// mode.
    ///
    /// [`Aggregator`][crate::Aggregator] will still wait once on each newly-added pad, making
    /// sure upstream has had a fair chance to start up.
    /// ## `ignore`
    /// whether inactive pads should not be waited on
    #[cfg(feature = "v1_20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
    #[doc(alias = "gst_aggregator_set_ignore_inactive_pads")]
    fn set_ignore_inactive_pads(&self, ignore: bool) {
        unsafe {
            ffi::gst_aggregator_set_ignore_inactive_pads(
                self.as_ref().to_glib_none().0,
                ignore.into_glib(),
            );
        }
    }

    /// Lets [`Aggregator`][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 if the values changed.
    /// ## `min_latency`
    /// minimum latency
    /// ## `max_latency`
    /// maximum latency
    #[doc(alias = "gst_aggregator_set_latency")]
    fn set_latency(
        &self,
        min_latency: gst::ClockTime,
        max_latency: impl Into<Option<gst::ClockTime>>,
    ) {
        unsafe {
            ffi::gst_aggregator_set_latency(
                self.as_ref().to_glib_none().0,
                min_latency.into_glib(),
                max_latency.into().into_glib(),
            );
        }
    }

    /// Sets the caps to be used on the src pad.
    /// ## `caps`
    /// The [`gst::Caps`][crate::gst::Caps] to set on the src pad.
    #[doc(alias = "gst_aggregator_set_src_caps")]
    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);
        }
    }

    /// This is a simple `GstAggregatorClass::get_next_time` implementation that
    /// just looks at the [`gst::Segment`][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(feature = "v1_16")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_aggregator_simple_get_next_time")]
    fn simple_get_next_time(&self) -> Option<gst::ClockTime> {
        unsafe {
            from_glib(ffi::gst_aggregator_simple_get_next_time(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Enables the emission of signals such as [`samples-selected`][struct@crate::Aggregator#samples-selected]
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn emits_signals(&self) -> bool {
        ObjectExt::property(self.as_ref(), "emit-signals")
    }

    /// Enables the emission of signals such as [`samples-selected`][struct@crate::Aggregator#samples-selected]
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "emit-signals")]
    fn set_emit_signals(&self, emit_signals: bool) {
        ObjectExt::set_property(self.as_ref(), "emit-signals", emit_signals)
    }

    #[doc(alias = "start-time")]
    fn start_time(&self) -> u64 {
        ObjectExt::property(self.as_ref(), "start-time")
    }

    #[doc(alias = "start-time")]
    fn set_start_time(&self, start_time: u64) {
        ObjectExt::set_property(self.as_ref(), "start-time", start_time)
    }

    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn start_time_selection(&self) -> AggregatorStartTimeSelection {
        ObjectExt::property(self.as_ref(), "start-time-selection")
    }

    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "start-time-selection")]
    fn set_start_time_selection(&self, start_time_selection: AggregatorStartTimeSelection) {
        ObjectExt::set_property(self.as_ref(), "start-time-selection", start_time_selection)
    }

    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, 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: IsA<Aggregator>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            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(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_emit_signals_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[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: IsA<Aggregator>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            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(std::mem::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: IsA<Aggregator>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            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(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_start_time_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, 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: IsA<Aggregator>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstAggregator,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            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(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_start_time_selection_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<Aggregator>> AggregatorExt for O {}