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
// 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

use crate::PipelineFlags;
use crate::Timeline;
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;
use std::ptr;

glib::wrapper! {
    /// A [`Pipeline`][crate::Pipeline] can take an audio-video [`Timeline`][crate::Timeline] and conveniently
    /// link its [`Track`][crate::Track]-s to an internal `playsink` element, for
    /// preview/playback, and an internal `encodebin` element, for rendering.
    /// You can switch between these modes using [`GESPipelineExt::set_mode()`][crate::prelude::GESPipelineExt::set_mode()].
    ///
    /// You can choose the specific audio and video sinks used for previewing
    /// the timeline by setting the `property::Pipeline::audio-sink` and
    /// `property::Pipeline::video-sink` properties.
    ///
    /// You can set the encoding and save location used in rendering by calling
    /// [`GESPipelineExt::set_render_settings()`][crate::prelude::GESPipelineExt::set_render_settings()].
    ///
    /// # Implements
    ///
    /// [`GESPipelineExt`][trait@crate::prelude::GESPipelineExt], [`trait@gst::prelude::PipelineExt`], [`trait@gst::prelude::BinExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`], [`trait@gst::prelude::ChildProxyExt`]
    #[doc(alias = "GESPipeline")]
    pub struct Pipeline(Object<ffi::GESPipeline, ffi::GESPipelineClass>) @extends gst::Pipeline, gst::Bin, gst::Element, gst::Object, @implements gst::ChildProxy;

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

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

    /// Creates a new pipeline.
    ///
    /// # Returns
    ///
    /// The newly created pipeline.
    #[doc(alias = "ges_pipeline_new")]
    pub fn new() -> Pipeline {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::ges_pipeline_new()) }
    }
}

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

/// Trait containing all [`struct@Pipeline`] methods.
///
/// # Implementors
///
/// [`Pipeline`][struct@crate::Pipeline]
pub trait GESPipelineExt: 'static {
    /// Gets the `property::Pipeline::mode` of the pipeline.
    ///
    /// # Returns
    ///
    /// The current mode of `self`.
    #[doc(alias = "ges_pipeline_get_mode")]
    #[doc(alias = "get_mode")]
    fn mode(&self) -> PipelineFlags;

    /// Gets a sample from the pipeline of the currently displayed image in
    /// preview, in the specified format.
    ///
    /// Note that if you use "ANY" caps for `caps`, then the current format of
    /// the image is used. You can retrieve these caps from the returned sample
    /// with `gst_sample_get_caps()`.
    /// ## `caps`
    /// Some caps to specifying the desired format, or
    /// `GST_CAPS_ANY` to use the native format
    ///
    /// # Returns
    ///
    /// A sample of `self`'s current image preview in
    /// the format given by `caps`, or [`None`] if an error prevented fetching the
    /// sample.
    #[doc(alias = "ges_pipeline_get_thumbnail")]
    #[doc(alias = "get_thumbnail")]
    fn thumbnail(&self, caps: &gst::Caps) -> Option<gst::Sample>;

    /// Gets a sample from the pipeline of the currently displayed image in
    /// preview, in the 24-bit "RGB" format and of the desired width and
    /// height.
    ///
    /// See [`thumbnail()`][Self::thumbnail()].
    /// ## `width`
    /// The requested pixel width of the image, or -1 to use the native
    /// size
    /// ## `height`
    /// The requested pixel height of the image, or -1 to use the
    /// native size
    ///
    /// # Returns
    ///
    /// A sample of `self`'s current image preview in
    /// the "RGB" format, scaled to `width` and `height`, or [`None`] if an error
    /// prevented fetching the sample.
    #[doc(alias = "ges_pipeline_get_thumbnail_rgb24")]
    #[doc(alias = "get_thumbnail_rgb24")]
    fn thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample>;

    /// Gets the `property::Pipeline::audio-sink` of the pipeline.
    ///
    /// # Returns
    ///
    /// The audio sink used by `self` for preview.
    #[doc(alias = "ges_pipeline_preview_get_audio_sink")]
    fn preview_get_audio_sink(&self) -> Option<gst::Element>;

    /// Gets the `property::Pipeline::video-sink` of the pipeline.
    ///
    /// # Returns
    ///
    /// The video sink used by `self` for preview.
    #[doc(alias = "ges_pipeline_preview_get_video_sink")]
    fn preview_get_video_sink(&self) -> Option<gst::Element>;

    /// Sets the `property::Pipeline::audio-sink` of the pipeline.
    /// ## `sink`
    /// A audio sink for `self` to use for preview
    #[doc(alias = "ges_pipeline_preview_set_audio_sink")]
    fn preview_set_audio_sink(&self, sink: &impl IsA<gst::Element>);

    /// Sets the `property::Pipeline::video-sink` of the pipeline.
    /// ## `sink`
    /// A video sink for `self` to use for preview
    #[doc(alias = "ges_pipeline_preview_set_video_sink")]
    fn preview_set_video_sink(&self, sink: &impl IsA<gst::Element>);

    /// Saves the currently displayed image of the pipeline in preview to the
    /// given location, in the specified dimensions and format.
    /// ## `width`
    /// The requested pixel width of the image, or -1 to use the native
    /// size
    /// ## `height`
    /// The requested pixel height of the image, or -1 to use the
    /// native size
    /// ## `format`
    /// The desired mime type (for example, "image/jpeg")
    /// ## `location`
    /// The path to save the thumbnail to
    ///
    /// # Returns
    ///
    /// [`true`] if `self`'s current image preview was successfully saved
    /// to `location` using the given `format`, `height` and `width`.
    #[doc(alias = "ges_pipeline_save_thumbnail")]
    fn save_thumbnail(
        &self,
        width: i32,
        height: i32,
        format: &str,
        location: &str,
    ) -> Result<(), glib::Error>;

    /// Sets the `property::Pipeline::mode` of the pipeline.
    ///
    /// Note that the pipeline will be set to [`gst::State::Null`][crate::gst::State::Null] during this call to
    /// perform the necessary changes. You will need to set the state again yourself
    /// after calling this.
    ///
    /// > **NOTE**: [Rendering settings](ges_pipeline_set_render_settings) need to be
    /// > set before setting `mode` to [`PipelineFlags::RENDER`][crate::PipelineFlags::RENDER] or
    /// > [`PipelineFlags::SMART_RENDER`][crate::PipelineFlags::SMART_RENDER], the call to this method will fail
    /// > otherwise.
    /// ## `mode`
    /// The mode to set for `self`
    ///
    /// # Returns
    ///
    /// [`true`] if the mode of `self` was successfully set to `mode`.
    #[doc(alias = "ges_pipeline_set_mode")]
    fn set_mode(&self, mode: PipelineFlags) -> Result<(), glib::error::BoolError>;

    /// Specifies encoding setting to be used by the pipeline to render its
    /// `property::Pipeline::timeline`, and where the result should be written to.
    ///
    /// This method **must** be called before setting the pipeline mode to
    /// [`PipelineFlags::RENDER`][crate::PipelineFlags::RENDER].
    /// ## `output_uri`
    /// The URI to save the `property::Pipeline::timeline` rendering
    /// result to
    /// ## `profile`
    /// The encoding to use for rendering the `property::Pipeline::timeline`
    ///
    /// # Returns
    ///
    /// [`true`] if the settings were successfully set on `self`.
    #[doc(alias = "ges_pipeline_set_render_settings")]
    fn set_render_settings(
        &self,
        output_uri: &str,
        profile: &impl IsA<gst_pbutils::EncodingProfile>,
    ) -> Result<(), glib::error::BoolError>;

    /// Takes the given timeline and sets it as the `property::Pipeline::timeline` for
    /// the pipeline.
    ///
    /// Note that you should only call this method once on a given pipeline
    /// because a pipeline can not have its `property::Pipeline::timeline` changed after
    /// it has been set.
    /// ## `timeline`
    /// The timeline to set for `self`
    ///
    /// # Returns
    ///
    /// [`true`] if `timeline` was successfully given to `self`.
    #[doc(alias = "ges_pipeline_set_timeline")]
    fn set_timeline(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError>;

    /// The audio filter(s) to apply during playback in preview mode,
    /// immediately before the `property::Pipeline::audio-sink`. This exposes the
    /// `playsink:audio-filter` property of the internal `playsink`.
    #[doc(alias = "audio-filter")]
    fn audio_filter(&self) -> Option<gst::Element>;

    /// The audio filter(s) to apply during playback in preview mode,
    /// immediately before the `property::Pipeline::audio-sink`. This exposes the
    /// `playsink:audio-filter` property of the internal `playsink`.
    #[doc(alias = "audio-filter")]
    fn set_audio_filter<P: IsA<gst::Element>>(&self, audio_filter: Option<&P>);

    /// The audio sink used for preview. This exposes the
    /// `playsink:audio-sink` property of the internal `playsink`.
    #[doc(alias = "audio-sink")]
    fn audio_sink(&self) -> Option<gst::Element>;

    /// The audio sink used for preview. This exposes the
    /// `playsink:audio-sink` property of the internal `playsink`.
    #[doc(alias = "audio-sink")]
    fn set_audio_sink<P: IsA<gst::Element>>(&self, audio_sink: Option<&P>);

    /// The timeline used by this pipeline, whose content it will play and
    /// render, or [`None`] if the pipeline does not yet have a timeline.
    ///
    /// Note that after you set the timeline for the first time, subsequent
    /// calls to change the timeline will fail.
    fn timeline(&self) -> Option<Timeline>;

    /// The video filter(s) to apply during playback in preview mode,
    /// immediately before the `property::Pipeline::video-sink`. This exposes the
    /// `playsink:video-filter` property of the internal `playsink`.
    #[doc(alias = "video-filter")]
    fn video_filter(&self) -> Option<gst::Element>;

    /// The video filter(s) to apply during playback in preview mode,
    /// immediately before the `property::Pipeline::video-sink`. This exposes the
    /// `playsink:video-filter` property of the internal `playsink`.
    #[doc(alias = "video-filter")]
    fn set_video_filter<P: IsA<gst::Element>>(&self, video_filter: Option<&P>);

    /// The video sink used for preview. This exposes the
    /// `playsink:video-sink` property of the internal `playsink`.
    #[doc(alias = "video-sink")]
    fn video_sink(&self) -> Option<gst::Element>;

    /// The video sink used for preview. This exposes the
    /// `playsink:video-sink` property of the internal `playsink`.
    #[doc(alias = "video-sink")]
    fn set_video_sink<P: IsA<gst::Element>>(&self, video_sink: Option<&P>);

    #[doc(alias = "audio-filter")]
    fn connect_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    #[doc(alias = "audio-sink")]
    fn connect_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    #[doc(alias = "mode")]
    fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    #[doc(alias = "timeline")]
    fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    #[doc(alias = "video-filter")]
    fn connect_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    #[doc(alias = "video-sink")]
    fn connect_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}

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

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

    fn thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample> {
        unsafe {
            from_glib_full(ffi::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(ffi::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(ffi::ges_pipeline_preview_get_video_sink(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn preview_set_audio_sink(&self, sink: &impl IsA<gst::Element>) {
        unsafe {
            ffi::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(&self, sink: &impl IsA<gst::Element>) {
        unsafe {
            ffi::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 is_ok = ffi::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,
            );
            assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            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!(
                ffi::ges_pipeline_set_mode(self.as_ref().to_glib_none().0, mode.into_glib()),
                "Failed to set mode"
            )
        }
    }

    fn set_render_settings(
        &self,
        output_uri: &str,
        profile: &impl IsA<gst_pbutils::EncodingProfile>,
    ) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::result_from_gboolean!(
                ffi::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(&self, timeline: &impl IsA<Timeline>) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::result_from_gboolean!(
                ffi::ges_pipeline_set_timeline(
                    self.as_ref().to_glib_none().0,
                    timeline.as_ref().to_glib_full()
                ),
                "Failed to set timeline"
            )
        }
    }

    fn audio_filter(&self) -> Option<gst::Element> {
        glib::ObjectExt::property(self.as_ref(), "audio-filter")
    }

    fn set_audio_filter<P: IsA<gst::Element>>(&self, audio_filter: Option<&P>) {
        glib::ObjectExt::set_property(self.as_ref(), "audio-filter", &audio_filter)
    }

    fn audio_sink(&self) -> Option<gst::Element> {
        glib::ObjectExt::property(self.as_ref(), "audio-sink")
    }

    fn set_audio_sink<P: IsA<gst::Element>>(&self, audio_sink: Option<&P>) {
        glib::ObjectExt::set_property(self.as_ref(), "audio-sink", &audio_sink)
    }

    fn timeline(&self) -> Option<Timeline> {
        glib::ObjectExt::property(self.as_ref(), "timeline")
    }

    fn video_filter(&self) -> Option<gst::Element> {
        glib::ObjectExt::property(self.as_ref(), "video-filter")
    }

    fn set_video_filter<P: IsA<gst::Element>>(&self, video_filter: Option<&P>) {
        glib::ObjectExt::set_property(self.as_ref(), "video-filter", &video_filter)
    }

    fn video_sink(&self) -> Option<gst::Element> {
        glib::ObjectExt::property(self.as_ref(), "video-sink")
    }

    fn set_video_sink<P: IsA<gst::Element>>(&self, video_sink: Option<&P>) {
        glib::ObjectExt::set_property(self.as_ref(), "video-sink", &video_sink)
    }

    fn connect_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_audio_filter_trampoline<
            P: IsA<Pipeline>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_audio_filter_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_audio_sink_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_audio_sink_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_mode_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_mode_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_timeline_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_timeline_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_video_filter_trampoline<
            P: IsA<Pipeline>,
            F: Fn(&P) + 'static,
        >(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_video_filter_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_video_sink_trampoline<P: IsA<Pipeline>, F: Fn(&P) + 'static>(
            this: *mut ffi::GESPipeline,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(Pipeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        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::<_, unsafe extern "C" fn()>(
                    notify_video_sink_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}