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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
// 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 glib;
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::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_base_sys;
use std::boxed::Box as Box_;
use std::mem::transmute;

glib_wrapper! {
    /// This is a generic base class for source elements. The following
    /// types of sources are supported:
    ///
    ///  * random access sources like files
    ///  * seekable sources
    ///  * live sources
    ///
    /// The source can be configured to operate in any `gst::Format` with the
    /// `BaseSrcExt::set_format` method. The currently set format determines
    /// the format of the internal `gst::Segment` and any `gst::EventType::Segment`
    /// events. The default format for `BaseSrc` is `gst::Format::Bytes`.
    ///
    /// `BaseSrc` always supports push mode scheduling. If the following
    /// conditions are met, it also supports pull mode scheduling:
    ///
    ///  * The format is set to `gst::Format::Bytes` (default).
    ///  * `BaseSrcClass.is_seekable`() returns `true`.
    ///
    /// If all the conditions are met for operating in pull mode, `BaseSrc` is
    /// automatically seekable in push mode as well. The following conditions must
    /// be met to make the element seekable in push mode when the format is not
    /// `gst::Format::Bytes`:
    ///
    /// * `BaseSrcClass.is_seekable`() returns `true`.
    /// * `BaseSrcClass.query`() can convert all supported seek formats to the
    ///  internal format as set with `BaseSrcExt::set_format`.
    /// * `BaseSrcClass.do_seek`() is implemented, performs the seek and returns
    ///  `true`.
    ///
    /// When the element does not meet the requirements to operate in pull mode, the
    /// offset and length in the `BaseSrcClass.create`() method should be ignored.
    /// It is recommended to subclass `PushSrc` instead, in this situation. If the
    /// element can operate in pull mode but only with specific offsets and
    /// lengths, it is allowed to generate an error when the wrong values are passed
    /// to the `BaseSrcClass.create`() function.
    ///
    /// `BaseSrc` has support for live sources. Live sources are sources that when
    /// paused discard data, such as audio or video capture devices. A typical live
    /// source also produces data at a fixed rate and thus provides a clock to publish
    /// this rate.
    /// Use `BaseSrcExt::set_live` to activate the live source mode.
    ///
    /// A live source does not produce data in the PAUSED state. This means that the
    /// `BaseSrcClass.create`() method will not be called in PAUSED but only in
    /// PLAYING. To signal the pipeline that the element will not produce data, the
    /// return value from the READY to PAUSED state will be
    /// `gst::StateChangeReturn::NoPreroll`.
    ///
    /// A typical live source will timestamp the buffers it creates with the
    /// current running time of the pipeline. This is one reason why a live source
    /// can only produce data in the PLAYING state, when the clock is actually
    /// distributed and running.
    ///
    /// Live sources that synchronize and block on the clock (an audio source, for
    /// example) can use `BaseSrc::wait_playing` when the
    /// `BaseSrcClass.create`() function was interrupted by a state change to
    /// PAUSED.
    ///
    /// The `BaseSrcClass.get_times`() method can be used to implement pseudo-live
    /// sources. It only makes sense to implement the `BaseSrcClass.get_times`()
    /// function if the source is a live source. The `BaseSrcClass.get_times`()
    /// function should return timestamps starting from 0, as if it were a non-live
    /// source. The base class will make sure that the timestamps are transformed
    /// into the current running_time. The base source will then wait for the
    /// calculated running_time before pushing out the buffer.
    ///
    /// For live sources, the base class will by default report a latency of 0.
    /// For pseudo live sources, the base class will by default measure the difference
    /// between the first buffer timestamp and the start time of get_times and will
    /// report this value as the latency.
    /// Subclasses should override the query function when this behaviour is not
    /// acceptable.
    ///
    /// There is only support in `BaseSrc` for exactly one source pad, which
    /// should be named "src". A source implementation (subclass of `BaseSrc`)
    /// should install a pad template in its class_init function, like so:
    ///
    /// ```C
    /// static void
    /// my_element_class_init (GstMyElementClass *klass)
    /// {
    ///   GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
    ///   // srctemplate should be a #GstStaticPadTemplate with direction
    ///   // %GST_PAD_SRC and name "src"
    ///   gst_element_class_add_static_pad_template (gstelement_class, &srctemplate);
    ///
    ///   gst_element_class_set_static_metadata (gstelement_class,
    ///      "Source name",
    ///      "Source",
    ///      "My Source element",
    ///      "The author <my.sink@my.email>");
    /// }
    /// ```
    ///
    /// ## Controlled shutdown of live sources in applications
    ///
    /// Applications that record from a live source may want to stop recording
    /// in a controlled way, so that the recording is stopped, but the data
    /// already in the pipeline is processed to the end (remember that many live
    /// sources would go on recording forever otherwise). For that to happen the
    /// application needs to make the source stop recording and send an EOS
    /// event down the pipeline. The application would then wait for an
    /// EOS message posted on the pipeline's bus to know when all data has
    /// been processed and the pipeline can safely be stopped.
    ///
    /// An application may send an EOS event to a source element to make it
    /// perform the EOS logic (send EOS event downstream or post a
    /// `gst::MessageType::SegmentDone` on the bus). This can typically be done
    /// with the `gst::ElementExt::send_event` function on the element or its parent bin.
    ///
    /// After the EOS has been sent to the element, the application should wait for
    /// an EOS message to be posted on the pipeline's bus. Once this EOS message is
    /// received, it may safely shut down the entire pipeline.
    ///
    /// # Implements
    ///
    /// [`BaseSrcExt`](trait.BaseSrcExt.html), [`gst::ElementExt`](../gst/trait.ElementExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`BaseSrcExtManual`](prelude/trait.BaseSrcExtManual.html)
    pub struct BaseSrc(Object<gst_base_sys::GstBaseSrc, gst_base_sys::GstBaseSrcClass, BaseSrcClass>) @extends gst::Element, gst::Object;

    match fn {
        get_type => || gst_base_sys::gst_base_src_get_type(),
    }
}

unsafe impl Send for BaseSrc {}
unsafe impl Sync for BaseSrc {}

pub const NONE_BASE_SRC: Option<&BaseSrc> = None;

/// Trait containing all `BaseSrc` methods.
///
/// # Implementors
///
/// [`BaseSrc`](struct.BaseSrc.html), [`PushSrc`](struct.PushSrc.html)
pub trait BaseSrcExt: 'static {
    //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams);

    /// Get the number of bytes that `self` will push out with each buffer.
    ///
    /// # Returns
    ///
    /// the number of bytes pushed with each buffer.
    fn get_blocksize(&self) -> u32;

    ///
    /// # Returns
    ///
    /// the instance of the `gst::BufferPool` used
    /// by the src; unref it after usage.
    fn get_buffer_pool(&self) -> Option<gst::BufferPool>;

    /// Query if `self` timestamps outgoing buffers based on the current running_time.
    ///
    /// # Returns
    ///
    /// `true` if the base class will automatically timestamp outgoing buffers.
    fn get_do_timestamp(&self) -> bool;

    /// Get the current async behaviour of `self`. See also `BaseSrcExt::set_async`.
    ///
    /// # Returns
    ///
    /// `true` if `self` is operating in async mode.
    fn is_async(&self) -> bool;

    /// Check if an element is in live mode.
    ///
    /// # Returns
    ///
    /// `true` if element is in live mode.
    fn is_live(&self) -> bool;

    /// Negotiates src pad caps with downstream elements.
    /// Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again
    /// if `BaseSrcClass.negotiate`() fails.
    ///
    /// Do not call this in the `BaseSrcClass.fill`() vmethod. Call this in
    /// `BaseSrcClass.create`() or in `BaseSrcClass.alloc`(), _before_ any
    /// buffer is allocated.
    ///
    /// Feature: `v1_18`
    ///
    ///
    /// # Returns
    ///
    /// `true` if the negotiation succeeded, else `false`.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn negotiate(&self) -> bool;

    /// Prepare a new seamless segment for emission downstream. This function must
    /// only be called by derived sub-classes, and only from the `BaseSrcClass::create` function,
    /// as the stream-lock needs to be held.
    ///
    /// The format for the new segment will be the current format of the source, as
    /// configured with `BaseSrcExt::set_format`
    /// ## `start`
    /// The new start value for the segment
    /// ## `stop`
    /// Stop value for the new segment
    /// ## `time`
    /// The new time value for the start of the new segment
    ///
    /// # Returns
    ///
    /// `true` if preparation of the seamless segment succeeded.
    #[cfg_attr(feature = "v1_18", deprecated)]
    fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool;

    /// Configure async behaviour in `self`, no state change will block. The open,
    /// close, start, stop, play and pause virtual methods will be executed in a
    /// different thread and are thus allowed to perform blocking operations. Any
    /// blocking operation should be unblocked with the unlock vmethod.
    /// ## `async`
    /// new async mode
    fn set_async(&self, async: bool);

    /// If `automatic_eos` is `true`, `self` will automatically go EOS if a buffer
    /// after the total size is returned. By default this is `true` but sources
    /// that can't return an authoritative size and only know that they're EOS
    /// when trying to read more should set this to `false`.
    ///
    /// When `self` operates in `gst::Format::Time`, `BaseSrc` will send an EOS
    /// when a buffer outside of the currently configured segment is pushed if
    /// `automatic_eos` is `true`. Since 1.16, if `automatic_eos` is `false` an
    /// EOS will be pushed only when the `BaseSrcClass.create`() implementation
    /// returns `gst::FlowReturn::Eos`.
    /// ## `automatic_eos`
    /// automatic eos
    fn set_automatic_eos(&self, automatic_eos: bool);

    /// Set the number of bytes that `self` will push out with each buffer. When
    /// `blocksize` is set to -1, a default length will be used.
    /// ## `blocksize`
    /// the new blocksize in bytes
    fn set_blocksize(&self, blocksize: u32);

    /// Set new caps on the basesrc source pad.
    /// ## `caps`
    /// a `gst::Caps`
    ///
    /// # Returns
    ///
    /// `true` if the caps could be set
    fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError>;

    /// Configure `self` to automatically timestamp outgoing buffers based on the
    /// current running_time of the pipeline. This property is mostly useful for live
    /// sources.
    /// ## `timestamp`
    /// enable or disable timestamping
    fn set_do_timestamp(&self, timestamp: bool);

    /// If not `dynamic`, size is only updated when needed, such as when trying to
    /// read past current tracked size. Otherwise, size is checked for upon each
    /// read.
    /// ## `dynamic`
    /// new dynamic size mode
    fn set_dynamic_size(&self, dynamic: bool);

    /// Sets the default format of the source. This will be the format used
    /// for sending SEGMENT events and for performing seeks.
    ///
    /// If a format of GST_FORMAT_BYTES is set, the element will be able to
    /// operate in pull mode if the `BaseSrcClass.is_seekable`() returns `true`.
    ///
    /// This function must only be called in states < `gst::State::Paused`.
    /// ## `format`
    /// the format to use
    fn set_format(&self, format: gst::Format);

    /// If the element listens to a live source, `live` should
    /// be set to `true`.
    ///
    /// A live source will not produce data in the PAUSED state and
    /// will therefore not be able to participate in the PREROLL phase
    /// of a pipeline. To signal this fact to the application and the
    /// pipeline, the state change return value of the live source will
    /// be GST_STATE_CHANGE_NO_PREROLL.
    /// ## `live`
    /// new live-mode
    fn set_live(&self, live: bool);

    fn get_property_num_buffers(&self) -> i32;

    fn set_property_num_buffers(&self, num_buffers: i32);

    fn get_property_typefind(&self) -> bool;

    fn set_property_typefind(&self, typefind: bool);

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

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

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

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

impl<O: IsA<BaseSrc>> BaseSrcExt for O {
    //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
    //    unsafe { TODO: call gst_base_sys:gst_base_src_get_allocator() }
    //}

    fn get_blocksize(&self) -> u32 {
        unsafe { gst_base_sys::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) }
    }

    fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
        unsafe {
            from_glib_full(gst_base_sys::gst_base_src_get_buffer_pool(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_do_timestamp(&self) -> bool {
        unsafe {
            from_glib(gst_base_sys::gst_base_src_get_do_timestamp(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn is_async(&self) -> bool {
        unsafe {
            from_glib(gst_base_sys::gst_base_src_is_async(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn is_live(&self) -> bool {
        unsafe {
            from_glib(gst_base_sys::gst_base_src_is_live(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

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

    fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool {
        unsafe {
            from_glib(gst_base_sys::gst_base_src_new_seamless_segment(
                self.as_ref().to_glib_none().0,
                start,
                stop,
                time,
            ))
        }
    }

    fn set_async(&self, async: bool) {
        unsafe {
            gst_base_sys::gst_base_src_set_async(self.as_ref().to_glib_none().0, async.to_glib());
        }
    }

    fn set_automatic_eos(&self, automatic_eos: bool) {
        unsafe {
            gst_base_sys::gst_base_src_set_automatic_eos(
                self.as_ref().to_glib_none().0,
                automatic_eos.to_glib(),
            );
        }
    }

    fn set_blocksize(&self, blocksize: u32) {
        unsafe {
            gst_base_sys::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize);
        }
    }

    fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                gst_base_sys::gst_base_src_set_caps(
                    self.as_ref().to_glib_none().0,
                    caps.to_glib_none().0
                ),
                "Failed to set caps"
            )
        }
    }

    fn set_do_timestamp(&self, timestamp: bool) {
        unsafe {
            gst_base_sys::gst_base_src_set_do_timestamp(
                self.as_ref().to_glib_none().0,
                timestamp.to_glib(),
            );
        }
    }

    fn set_dynamic_size(&self, dynamic: bool) {
        unsafe {
            gst_base_sys::gst_base_src_set_dynamic_size(
                self.as_ref().to_glib_none().0,
                dynamic.to_glib(),
            );
        }
    }

    fn set_format(&self, format: gst::Format) {
        unsafe {
            gst_base_sys::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.to_glib());
        }
    }

    fn set_live(&self, live: bool) {
        unsafe {
            gst_base_sys::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.to_glib());
        }
    }

    fn get_property_num_buffers(&self) -> i32 {
        unsafe {
            let mut value = Value::from_type(<i32 as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"num-buffers\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `num-buffers` getter")
                .unwrap()
        }
    }

    fn set_property_num_buffers(&self, num_buffers: i32) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"num-buffers\0".as_ptr() as *const _,
                Value::from(&num_buffers).to_glib_none().0,
            );
        }
    }

    fn get_property_typefind(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_sys::g_object_get_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"typefind\0".as_ptr() as *const _,
                value.to_glib_none_mut().0,
            );
            value
                .get()
                .expect("Return Value for property `typefind` getter")
                .unwrap()
        }
    }

    fn set_property_typefind(&self, typefind: bool) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"typefind\0".as_ptr() as *const _,
                Value::from(&typefind).to_glib_none().0,
            );
        }
    }

    fn connect_property_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_blocksize_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstBaseSrc,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<BaseSrc>,
        {
            let f: &F = &*(f as *const F);
            f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::blocksize\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_blocksize_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_do_timestamp_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstBaseSrc,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<BaseSrc>,
        {
            let f: &F = &*(f as *const F);
            f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::do-timestamp\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_do_timestamp_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_num_buffers_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstBaseSrc,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<BaseSrc>,
        {
            let f: &F = &*(f as *const F);
            f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::num-buffers\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_num_buffers_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_typefind_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
            this: *mut gst_base_sys::GstBaseSrc,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<BaseSrc>,
        {
            let f: &F = &*(f as *const F);
            f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::typefind\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_typefind_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}