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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
// 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 RTSPAddressPool;
use RTSPMedia;
use RTSPPublishClockMode;
use RTSPSuspendMode;
use RTSPTransportMode;
use ffi;
use glib;
use glib::StaticType;
use glib::Value;
use glib::object::Downcast;
use glib::object::IsA;
use glib::signal::SignalHandlerId;
use glib::signal::connect;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use gst;
use gst_rtsp;
use std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;

glib_wrapper! {
    /// The definition and logic for constructing the pipeline for a media. The media
    /// can contain multiple streams like audio and video.
    ///
    /// # Implements
    ///
    /// [`RTSPMediaFactoryExt`](trait.RTSPMediaFactoryExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
    pub struct RTSPMediaFactory(Object<ffi::GstRTSPMediaFactory, ffi::GstRTSPMediaFactoryClass>);

    match fn {
        get_type => || ffi::gst_rtsp_media_factory_get_type(),
    }
}

impl RTSPMediaFactory {
    /// Create a new `RTSPMediaFactory` instance.
    ///
    /// # Returns
    ///
    /// a new `RTSPMediaFactory` object.
    pub fn new() -> RTSPMediaFactory {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_new())
        }
    }
}

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

unsafe impl Send for RTSPMediaFactory {}
unsafe impl Sync for RTSPMediaFactory {}

/// Trait containing all `RTSPMediaFactory` methods.
///
/// # Implementors
///
/// [`RTSPMediaFactoryURI`](struct.RTSPMediaFactoryURI.html), [`RTSPMediaFactory`](struct.RTSPMediaFactory.html)
pub trait RTSPMediaFactoryExt {
    //fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);

    /// Construct the media object and create its streams. Implementations
    /// should create the needed gstreamer elements and add them to the result
    /// object. No state changes should be performed on them yet.
    ///
    /// One or more GstRTSPStream objects should be created from the result
    /// with gst_rtsp_media_create_stream ().
    ///
    /// After the media is constructed, it can be configured and then prepared
    /// with gst_rtsp_media_prepare ().
    /// ## `url`
    /// the url used
    ///
    /// # Returns
    ///
    /// a new `RTSPMedia` if the media could be prepared.
    fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia>;

    /// Construct and return a `gst::Element` that is a `gst::Bin` containing
    /// the elements to use for streaming the media.
    ///
    /// The bin should contain payloaders pay\%d for each stream. The default
    /// implementation of this function returns the bin created from the
    /// launch parameter.
    /// ## `url`
    /// the url used
    ///
    /// # Returns
    ///
    /// a new `gst::Element`.
    fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element>;

    /// Get the `RTSPAddressPool` used as the address pool of `self`.
    ///
    /// # Returns
    ///
    /// the `RTSPAddressPool` of `self`. `gobject::ObjectExt::unref` after
    /// usage.
    fn get_address_pool(&self) -> Option<RTSPAddressPool>;

    /// Get the kernel UDP buffer size.
    ///
    /// # Returns
    ///
    /// the kernel UDP buffer size.
    fn get_buffer_size(&self) -> u32;

    /// Returns the clock that is going to be used by the pipelines
    /// of all medias created from this factory.
    ///
    /// # Returns
    ///
    /// The GstClock
    fn get_clock(&self) -> Option<gst::Clock>;

    /// Get the latency that is used for receiving media
    ///
    /// # Returns
    ///
    /// latency in milliseconds
    fn get_latency(&self) -> u32;

    /// Get the `gst_parse_launch` pipeline description that will be used in the
    /// default prepare vmethod.
    ///
    /// # Returns
    ///
    /// the configured launch description. `g_free` after
    /// usage.
    fn get_launch(&self) -> Option<String>;

    /// Return the GType of the GstRTSPMedia subclass this
    /// factory will create.
    fn get_media_gtype(&self) -> glib::types::Type;

    /// Get the multicast interface used for `self`.
    ///
    /// # Returns
    ///
    /// the multicast interface for `self`. `g_free` after
    /// usage.
    fn get_multicast_iface(&self) -> Option<String>;

    //fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions>;

    /// Get the allowed profiles of `self`.
    ///
    /// # Returns
    ///
    /// a `gst_rtsp::RTSPProfile`
    fn get_profiles(&self) -> gst_rtsp::RTSPProfile;

    /// Get the allowed protocols of `self`.
    ///
    /// # Returns
    ///
    /// a `gst_rtsp::RTSPLowerTrans`
    fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans;

    /// Gets if and how the media clock should be published according to RFC7273.
    ///
    /// # Returns
    ///
    /// The GstRTSPPublishClockMode
    fn get_publish_clock_mode(&self) -> RTSPPublishClockMode;

    /// Get the time that is stored for retransmission purposes
    ///
    /// # Returns
    ///
    /// a `gst::ClockTime`
    fn get_retransmission_time(&self) -> gst::ClockTime;

    /// Get how media created from this factory will be suspended.
    ///
    /// # Returns
    ///
    /// a `RTSPSuspendMode`.
    fn get_suspend_mode(&self) -> RTSPSuspendMode;

    /// Get if media created from this factory can be used for PLAY or RECORD
    /// methods.
    ///
    /// # Returns
    ///
    /// The transport mode.
    fn get_transport_mode(&self) -> RTSPTransportMode;

    /// Get if media created from this factory will have an EOS event sent to the
    /// pipeline before shutdown.
    ///
    /// # Returns
    ///
    /// `true` if the media will receive EOS before shutdown.
    fn is_eos_shutdown(&self) -> bool;

    /// Get if media created from this factory can be shared between clients.
    ///
    /// # Returns
    ///
    /// `true` if the media will be shared between clients.
    fn is_shared(&self) -> bool;

    fn is_stop_on_disonnect(&self) -> bool;

    /// configure `pool` to be used as the address pool of `self`.
    /// ## `pool`
    /// a `RTSPAddressPool`
    fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P);

    /// Set the kernel UDP buffer size.
    /// ## `size`
    /// the new value
    fn set_buffer_size(&self, size: u32);

    /// Configures a specific clock to be used by the pipelines
    /// of all medias created from this factory.
    /// ## `clock`
    /// the clock to be used by the media factory
    fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q);

    /// Configure if media created from this factory will have an EOS sent to the
    /// pipeline before shutdown.
    /// ## `eos_shutdown`
    /// the new value
    fn set_eos_shutdown(&self, eos_shutdown: bool);

    /// Configure the latency used for receiving media
    /// ## `latency`
    /// latency in milliseconds
    fn set_latency(&self, latency: u32);

    /// The `gst_parse_launch` line to use for constructing the pipeline in the
    /// default prepare vmethod.
    ///
    /// The pipeline description should return a GstBin as the toplevel element
    /// which can be accomplished by enclosing the description with brackets '('
    /// ')'.
    ///
    /// The description should return a pipeline with payloaders named pay0, pay1,
    /// etc.. Each of the payloaders will result in a stream.
    /// ## `launch`
    /// the launch description
    fn set_launch(&self, launch: &str);

    /// Configure the GType of the GstRTSPMedia subclass to
    /// create (by default, overridden construct vmethods
    /// may of course do something different)
    /// ## `media_gtype`
    /// the GType of the class to create
    fn set_media_gtype(&self, media_gtype: glib::types::Type);

    /// configure `multicast_iface` to be used for `self`.
    /// ## `multicast_iface`
    /// a multicast interface name
    fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P);

    //fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P);

    /// Configure the allowed profiles for `self`.
    /// ## `profiles`
    /// the new flags
    fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile);

    /// Configure the allowed lower transport for `self`.
    /// ## `protocols`
    /// the new flags
    fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans);

    /// Sets if and how the media clock should be published according to RFC7273.
    /// ## `mode`
    /// the clock publish mode
    fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode);

    /// Configure the time to store for possible retransmission
    /// ## `time`
    /// a `gst::ClockTime`
    fn set_retransmission_time(&self, time: gst::ClockTime);

    /// Configure if media created from this factory can be shared between clients.
    /// ## `shared`
    /// the new value
    fn set_shared(&self, shared: bool);

    /// Configure if media created from this factory should be stopped
    /// when a client disconnects without sending TEARDOWN.
    /// ## `stop_on_disconnect`
    /// the new value
    fn set_stop_on_disconnect(&self, stop_on_disconnect: bool);

    /// Configure how media created from this factory will be suspended.
    /// ## `mode`
    /// the new `RTSPSuspendMode`
    fn set_suspend_mode(&self, mode: RTSPSuspendMode);

    /// Configure if this factory creates media for PLAY or RECORD modes.
    /// ## `mode`
    /// the new value
    fn set_transport_mode(&self, mode: RTSPTransportMode);

    fn get_property_eos_shutdown(&self) -> bool;

    fn get_property_shared(&self) -> bool;

    fn get_property_stop_on_disconnect(&self) -> bool;

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

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

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

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

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

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

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

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

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

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

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

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

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

impl<O: IsA<RTSPMediaFactory> + IsA<glib::object::Object>> RTSPMediaFactoryExt for O {
    //fn add_role(&self, role: &str, fieldname: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
    //    unsafe { TODO: call ffi::gst_rtsp_media_factory_add_role() }
    //}

    fn construct(&self, url: &gst_rtsp::RTSPUrl) -> Option<RTSPMedia> {
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_construct(self.to_glib_none().0, url.to_glib_none().0))
        }
    }

    fn create_element(&self, url: &gst_rtsp::RTSPUrl) -> Option<gst::Element> {
        unsafe {
            from_glib_none(ffi::gst_rtsp_media_factory_create_element(self.to_glib_none().0, url.to_glib_none().0))
        }
    }

    fn get_address_pool(&self) -> Option<RTSPAddressPool> {
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_get_address_pool(self.to_glib_none().0))
        }
    }

    fn get_buffer_size(&self) -> u32 {
        unsafe {
            ffi::gst_rtsp_media_factory_get_buffer_size(self.to_glib_none().0)
        }
    }

    fn get_clock(&self) -> Option<gst::Clock> {
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_get_clock(self.to_glib_none().0))
        }
    }

    fn get_latency(&self) -> u32 {
        unsafe {
            ffi::gst_rtsp_media_factory_get_latency(self.to_glib_none().0)
        }
    }

    fn get_launch(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_get_launch(self.to_glib_none().0))
        }
    }

    fn get_media_gtype(&self) -> glib::types::Type {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_media_gtype(self.to_glib_none().0))
        }
    }

    fn get_multicast_iface(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gst_rtsp_media_factory_get_multicast_iface(self.to_glib_none().0))
        }
    }

    //fn get_permissions(&self) -> /*Ignored*/Option<RTSPPermissions> {
    //    unsafe { TODO: call ffi::gst_rtsp_media_factory_get_permissions() }
    //}

    fn get_profiles(&self) -> gst_rtsp::RTSPProfile {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_profiles(self.to_glib_none().0))
        }
    }

    fn get_protocols(&self) -> gst_rtsp::RTSPLowerTrans {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_protocols(self.to_glib_none().0))
        }
    }

    fn get_publish_clock_mode(&self) -> RTSPPublishClockMode {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_publish_clock_mode(self.to_glib_none().0))
        }
    }

    fn get_retransmission_time(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_retransmission_time(self.to_glib_none().0))
        }
    }

    fn get_suspend_mode(&self) -> RTSPSuspendMode {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_suspend_mode(self.to_glib_none().0))
        }
    }

    fn get_transport_mode(&self) -> RTSPTransportMode {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_get_transport_mode(self.to_glib_none().0))
        }
    }

    fn is_eos_shutdown(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_is_eos_shutdown(self.to_glib_none().0))
        }
    }

    fn is_shared(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_is_shared(self.to_glib_none().0))
        }
    }

    fn is_stop_on_disonnect(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_rtsp_media_factory_is_stop_on_disonnect(self.to_glib_none().0))
        }
    }

    fn set_address_pool<'a, P: Into<Option<&'a RTSPAddressPool>>>(&self, pool: P) {
        let pool = pool.into();
        let pool = pool.to_glib_none();
        unsafe {
            ffi::gst_rtsp_media_factory_set_address_pool(self.to_glib_none().0, pool.0);
        }
    }

    fn set_buffer_size(&self, size: u32) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_buffer_size(self.to_glib_none().0, size);
        }
    }

    fn set_clock<'a, P: IsA<gst::Clock> + 'a, Q: Into<Option<&'a P>>>(&self, clock: Q) {
        let clock = clock.into();
        let clock = clock.to_glib_none();
        unsafe {
            ffi::gst_rtsp_media_factory_set_clock(self.to_glib_none().0, clock.0);
        }
    }

    fn set_eos_shutdown(&self, eos_shutdown: bool) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_eos_shutdown(self.to_glib_none().0, eos_shutdown.to_glib());
        }
    }

    fn set_latency(&self, latency: u32) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_latency(self.to_glib_none().0, latency);
        }
    }

    fn set_launch(&self, launch: &str) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_launch(self.to_glib_none().0, launch.to_glib_none().0);
        }
    }

    fn set_media_gtype(&self, media_gtype: glib::types::Type) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_media_gtype(self.to_glib_none().0, media_gtype.to_glib());
        }
    }

    fn set_multicast_iface<'a, P: Into<Option<&'a str>>>(&self, multicast_iface: P) {
        let multicast_iface = multicast_iface.into();
        let multicast_iface = multicast_iface.to_glib_none();
        unsafe {
            ffi::gst_rtsp_media_factory_set_multicast_iface(self.to_glib_none().0, multicast_iface.0);
        }
    }

    //fn set_permissions<'a, P: Into<Option<&'a /*Ignored*/RTSPPermissions>>>(&self, permissions: P) {
    //    unsafe { TODO: call ffi::gst_rtsp_media_factory_set_permissions() }
    //}

    fn set_profiles(&self, profiles: gst_rtsp::RTSPProfile) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_profiles(self.to_glib_none().0, profiles.to_glib());
        }
    }

    fn set_protocols(&self, protocols: gst_rtsp::RTSPLowerTrans) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_protocols(self.to_glib_none().0, protocols.to_glib());
        }
    }

    fn set_publish_clock_mode(&self, mode: RTSPPublishClockMode) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_publish_clock_mode(self.to_glib_none().0, mode.to_glib());
        }
    }

    fn set_retransmission_time(&self, time: gst::ClockTime) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_retransmission_time(self.to_glib_none().0, time.to_glib());
        }
    }

    fn set_shared(&self, shared: bool) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_shared(self.to_glib_none().0, shared.to_glib());
        }
    }

    fn set_stop_on_disconnect(&self, stop_on_disconnect: bool) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_stop_on_disconnect(self.to_glib_none().0, stop_on_disconnect.to_glib());
        }
    }

    fn set_suspend_mode(&self, mode: RTSPSuspendMode) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_suspend_mode(self.to_glib_none().0, mode.to_glib());
        }
    }

    fn set_transport_mode(&self, mode: RTSPTransportMode) {
        unsafe {
            ffi::gst_rtsp_media_factory_set_transport_mode(self.to_glib_none().0, mode.to_glib());
        }
    }

    fn get_property_eos_shutdown(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "eos-shutdown".to_glib_none().0, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    fn get_property_shared(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "shared".to_glib_none().0, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    fn get_property_stop_on_disconnect(&self) -> bool {
        unsafe {
            let mut value = Value::from_type(<bool as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "stop-on-disconnect".to_glib_none().0, value.to_glib_none_mut().0);
            value.get().unwrap()
        }
    }

    fn connect_media_configure<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "media-configure",
                transmute(media_configure_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_media_constructed<F: Fn(&Self, &RTSPMedia) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self, &RTSPMedia) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "media-constructed",
                transmute(media_constructed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_buffer_size_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::buffer-size",
                transmute(notify_buffer_size_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_clock_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::clock",
                transmute(notify_clock_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_eos_shutdown_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::eos-shutdown",
                transmute(notify_eos_shutdown_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::latency",
                transmute(notify_latency_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_launch_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::launch",
                transmute(notify_launch_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_profiles_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::profiles",
                transmute(notify_profiles_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_protocols_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::protocols",
                transmute(notify_protocols_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_shared_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::shared",
                transmute(notify_shared_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_stop_on_disconnect_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::stop-on-disconnect",
                transmute(notify_stop_on_disconnect_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_suspend_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::suspend-mode",
                transmute(notify_suspend_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_transport_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe {
            let f: Box_<Box_<Fn(&Self) + Send + Sync + 'static>> = Box_::new(Box_::new(f));
            connect(self.to_glib_none().0, "notify::transport-mode",
                transmute(notify_transport_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }
}

unsafe extern "C" fn media_configure_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}

unsafe extern "C" fn media_constructed_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, object: *mut ffi::GstRTSPMedia, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P, &RTSPMedia) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object))
}

unsafe extern "C" fn notify_buffer_size_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_clock_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_eos_shutdown_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_latency_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_launch_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_profiles_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_protocols_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_shared_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_stop_on_disconnect_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_suspend_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}

unsafe extern "C" fn notify_transport_mode_trampoline<P>(this: *mut ffi::GstRTSPMediaFactory, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<RTSPMediaFactory> {
    let f: &&(Fn(&P) + Send + Sync + 'static) = transmute(f);
    f(&RTSPMediaFactory::from_glib_borrow(this).downcast_unchecked())
}