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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
// 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 ges_sys;
use glib;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::StaticType;
use glib::Value;
use glib_sys;
use gobject_sys;
use gst;
use gst_pbutils;
use std::boxed::Box as Box_;
use std::mem::transmute;
use std::ptr;
use PipelineFlags;
use Timeline;

glib_wrapper! {
    /// `Pipeline` allows developers to view and render `Timeline`
    /// in a simple fashion.
    /// Its usage is inspired by the 'playbin' element from gst-plugins-base.
    ///
    /// # Implements
    ///
    /// [`GESPipelineExt`](trait.GESPipelineExt.html), [`gst::PipelineExt`](../gst/trait.PipelineExt.html), [`gst::ElementExt`](../gst/trait.ElementExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
    pub struct Pipeline(Object<ges_sys::GESPipeline, ges_sys::GESPipelineClass, PipelineClass>) @extends gst::Pipeline, gst::Element, gst::Object;

    match fn {
        get_type => || ges_sys::ges_pipeline_get_type(),
    }
}

impl Pipeline {
    /// Creates a new conveninence `Pipeline`.
    ///
    /// # Returns
    ///
    /// the new `Pipeline`.
    pub fn new() -> Pipeline {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ges_sys::ges_pipeline_new()) }
    }
}

impl Default for Pipeline {
    fn default() -> Self {
        Self::new()
    }
}

pub const NONE_PIPELINE: Option<&Pipeline> = None;

/// Trait containing all `Pipeline` methods.
///
/// # Implementors
///
/// [`Pipeline`](struct.Pipeline.html)
pub trait GESPipelineExt: 'static {
    ///
    /// # Returns
    ///
    /// the `PipelineFlags` currently in use.
    fn get_mode(&self) -> PipelineFlags;

    /// Returns a `gst::Sample` with the currently playing image in the format specified by
    /// caps. The caller should free the sample with `gst_sample_unref` when finished. If ANY
    /// caps are specified, the information will be returned in the whatever format
    /// is currently used by the sink. This information can be retrieve from caps
    /// associated with the buffer.
    /// ## `caps`
    /// caps specifying current format. Use `GST_CAPS_ANY`
    /// for native size.
    ///
    /// # Returns
    ///
    /// a `gst::Sample` or `None`
    fn get_thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample>;

    /// A convenience method for `GESPipelineExt::get_thumbnail` which
    /// returns a buffer in 24-bit RGB, optionally scaled to the specified width
    /// and height. If -1 is specified for either dimension, it will be left at
    /// native size. You can retreive this information from the caps associated
    /// with the buffer.
    ///
    /// The caller is responsible for unreffing the returned sample with
    /// `gst_sample_unref`.
    /// ## `width`
    /// the requested width or -1 for native size
    /// ## `height`
    /// the requested height or -1 for native size
    ///
    /// # Returns
    ///
    /// a `gst::Sample` or `None`
    fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample>;

    /// Obtains a pointer to playsink's audio sink element that is used for
    /// displaying audio when the `Pipeline` is in `PipelineFlags::FullPreview`
    ///
    /// The caller is responsible for unreffing the returned element with
    /// `gst::ObjectExt::unref`.
    ///
    /// # Returns
    ///
    /// a pointer to the playsink audio sink `gst::Element`
    fn preview_get_audio_sink(&self) -> Option<gst::Element>;

    /// Obtains a pointer to playsink's video sink element that is used for
    /// displaying video when the `Pipeline` is in `PipelineFlags::FullPreview`
    ///
    /// The caller is responsible for unreffing the returned element with
    /// `gst::ObjectExt::unref`.
    ///
    /// # Returns
    ///
    /// a pointer to the playsink video sink `gst::Element`
    fn preview_get_video_sink(&self) -> Option<gst::Element>;

    /// Sets playsink's audio sink element that is used for displaying audio when
    /// the `Pipeline` is in `PipelineFlags::FullPreview`
    /// ## `sink`
    /// a audio sink `gst::Element`
    fn preview_set_audio_sink<P: IsA<gst::Element>>(&self, sink: &P);

    /// Sets playsink's video sink element that is used for displaying video when
    /// the `Pipeline` is in `PipelineFlags::FullPreview`
    /// ## `sink`
    /// a video sink `gst::Element`
    fn preview_set_video_sink<P: IsA<gst::Element>>(&self, sink: &P);

    /// Saves the current frame to the specified `location`.
    /// ## `width`
    /// the requested width or -1 for native size
    /// ## `height`
    /// the requested height or -1 for native size
    /// ## `format`
    /// a string specifying the desired mime type (for example,
    /// image/jpeg)
    /// ## `location`
    /// the path to save the thumbnail
    ///
    /// # Returns
    ///
    /// `true` if the thumbnail was properly save, else `false`.
    fn save_thumbnail(
        &self,
        width: i32,
        height: i32,
        format: &str,
        location: &str,
    ) -> Result<(), glib::Error>;

    /// switches the `self` to the specified `mode`. The default mode when
    /// creating a `Pipeline` is `PipelineFlags::FullPreview`.
    ///
    /// Note: The `self` will be set to `gst::State::Null` during this call due to
    /// the internal changes that happen. The caller will therefore have to
    /// set the `self` to the requested state after calling this method.
    /// ## `mode`
    /// the `PipelineFlags` to use
    ///
    /// # Returns
    ///
    /// `true` if the mode was properly set, else `false`.
    fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError>;

    /// Specify where the pipeline shall be rendered and with what settings.
    ///
    /// A copy of `profile` and `output_uri` will be done internally, the caller can
    /// safely free those values afterwards.
    ///
    /// This method must be called before setting the pipeline mode to
    /// `PipelineFlags::Render`
    /// ## `output_uri`
    /// the URI to which the timeline will be rendered
    /// ## `profile`
    /// the `gst_pbutils::EncodingProfile` to use to render the timeline.
    ///
    /// # Returns
    ///
    /// `true` if the settings were aknowledged properly, else `false`
    fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(
        &self,
        output_uri: &str,
        profile: &P,
    ) -> Result<(), glib::error::BoolError>;

    /// Sets the timeline to use in this pipeline.
    ///
    /// The reference to the `timeline` will be stolen by the `self`.
    /// ## `timeline`
    /// the `Timeline` to set on the `self`.
    ///
    /// # Returns
    ///
    /// `true` if the `timeline` could be successfully set on the `self`,
    /// else `false`.
    fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::error::BoolError>;

    fn get_property_audio_filter(&self) -> Option<gst::Element>;

    fn set_property_audio_filter<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        audio_filter: Option<&P>,
    );

    /// Audio sink for the preview.
    fn get_property_audio_sink(&self) -> Option<gst::Element>;

    /// Audio sink for the preview.
    fn set_property_audio_sink<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        audio_sink: Option<&P>,
    );

    /// Timeline to use in this pipeline. See also
    /// `GESPipelineExt::set_timeline` for more info.
    fn get_property_timeline(&self) -> Option<Timeline>;

    fn get_property_video_filter(&self) -> Option<gst::Element>;

    fn set_property_video_filter<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        video_filter: Option<&P>,
    );

    /// Video sink for the preview.
    fn get_property_video_sink(&self) -> Option<gst::Element>;

    /// Video sink for the preview.
    fn set_property_video_sink<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        video_sink: Option<&P>,
    );

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

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

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

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

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

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

impl<O: IsA<Pipeline>> GESPipelineExt for O {
    fn get_mode(&self) -> PipelineFlags {
        unsafe {
            from_glib(ges_sys::ges_pipeline_get_mode(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample> {
        unsafe {
            from_glib_full(ges_sys::ges_pipeline_get_thumbnail(
                self.as_ref().to_glib_none().0,
                caps.to_glib_none().0,
            ))
        }
    }

    fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample> {
        unsafe {
            from_glib_full(ges_sys::ges_pipeline_get_thumbnail_rgb24(
                self.as_ref().to_glib_none().0,
                width,
                height,
            ))
        }
    }

    fn preview_get_audio_sink(&self) -> Option<gst::Element> {
        unsafe {
            from_glib_full(ges_sys::ges_pipeline_preview_get_audio_sink(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn preview_get_video_sink(&self) -> Option<gst::Element> {
        unsafe {
            from_glib_full(ges_sys::ges_pipeline_preview_get_video_sink(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn preview_set_audio_sink<P: IsA<gst::Element>>(&self, sink: &P) {
        unsafe {
            ges_sys::ges_pipeline_preview_set_audio_sink(
                self.as_ref().to_glib_none().0,
                sink.as_ref().to_glib_none().0,
            );
        }
    }

    fn preview_set_video_sink<P: IsA<gst::Element>>(&self, sink: &P) {
        unsafe {
            ges_sys::ges_pipeline_preview_set_video_sink(
                self.as_ref().to_glib_none().0,
                sink.as_ref().to_glib_none().0,
            );
        }
    }

    fn save_thumbnail(
        &self,
        width: i32,
        height: i32,
        format: &str,
        location: &str,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = ges_sys::ges_pipeline_save_thumbnail(
                self.as_ref().to_glib_none().0,
                width,
                height,
                format.to_glib_none().0,
                location.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.to_glib()),
                "Failed to set mode"
            )
        }
    }

    fn set_render_settings<P: IsA<gst_pbutils::EncodingProfile>>(
        &self,
        output_uri: &str,
        profile: &P,
    ) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_pipeline_set_render_settings(
                    self.as_ref().to_glib_none().0,
                    output_uri.to_glib_none().0,
                    profile.as_ref().to_glib_none().0
                ),
                "Failed to set render settings"
            )
        }
    }

    fn set_timeline<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_pipeline_set_timeline(
                    self.as_ref().to_glib_none().0,
                    timeline.as_ref().to_glib_full()
                ),
                "Failed to set timeline"
            )
        }
    }

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

    fn set_property_audio_filter<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        audio_filter: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"audio-filter\0".as_ptr() as *const _,
                Value::from(audio_filter).to_glib_none().0,
            );
        }
    }

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

    fn set_property_audio_sink<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        audio_sink: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"audio-sink\0".as_ptr() as *const _,
                Value::from(audio_sink).to_glib_none().0,
            );
        }
    }

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

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

    fn set_property_video_filter<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        video_filter: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"video-filter\0".as_ptr() as *const _,
                Value::from(video_filter).to_glib_none().0,
            );
        }
    }

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

    fn set_property_video_sink<P: IsA<gst::Element> + SetValueOptional>(
        &self,
        video_sink: Option<&P>,
    ) {
        unsafe {
            gobject_sys::g_object_set_property(
                self.to_glib_none().0 as *mut gobject_sys::GObject,
                b"video-sink\0".as_ptr() as *const _,
                Value::from(video_sink).to_glib_none().0,
            );
        }
    }

    fn connect_property_audio_filter_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_audio_filter_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::audio-filter\0".as_ptr() as *const _,
                Some(transmute(
                    notify_audio_filter_trampoline::<Self, F> as usize,
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_audio_sink_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::audio-sink\0".as_ptr() as *const _,
                Some(transmute(notify_audio_sink_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_mode_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::mode\0".as_ptr() as *const _,
                Some(transmute(notify_mode_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_timeline_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::timeline\0".as_ptr() as *const _,
                Some(transmute(notify_timeline_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_video_filter_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_video_filter_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::video-filter\0".as_ptr() as *const _,
                Some(transmute(
                    notify_video_filter_trampoline::<Self, F> as usize,
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_video_sink_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESPipeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Pipeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Pipeline::from_glib_borrow(this).unsafe_cast())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::video-sink\0".as_ptr() as *const _,
                Some(transmute(notify_video_sink_trampoline::<Self, F> as usize)),
                Box_::into_raw(f),
            )
        }
    }
}