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
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
// 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 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;
use std::mem::transmute;

glib::wrapper! {
    /// [`BaseSink`][crate::BaseSink] is the base class for sink elements in GStreamer, such as
    /// xvimagesink or filesink. It is a layer on top of [`gst::Element`][crate::gst::Element] that provides a
    /// simplified interface to plugin writers. [`BaseSink`][crate::BaseSink] handles many details
    /// for you, for example: preroll, clock synchronization, state changes,
    /// activation in push or pull mode, and queries.
    ///
    /// In most cases, when writing sink elements, there is no need to implement
    /// class methods from [`gst::Element`][crate::gst::Element] or to set functions on pads, because the
    /// [`BaseSink`][crate::BaseSink] infrastructure should be sufficient.
    ///
    /// [`BaseSink`][crate::BaseSink] provides support for exactly one sink pad, which should be
    /// named "sink". A sink implementation (subclass of [`BaseSink`][crate::BaseSink]) 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);
    ///
    ///   // sinktemplate should be a #GstStaticPadTemplate with direction
    ///   // %GST_PAD_SINK and name "sink"
    ///   gst_element_class_add_static_pad_template (gstelement_class, &sinktemplate);
    ///
    ///   gst_element_class_set_static_metadata (gstelement_class,
    ///       "Sink name",
    ///       "Sink",
    ///       "My Sink element",
    ///       "The author <my.sink@my.email>");
    /// }
    /// ```
    ///
    /// [`BaseSink`][crate::BaseSink] will handle the prerolling correctly. This means that it will
    /// return [`gst::StateChangeReturn::Async`][crate::gst::StateChangeReturn::Async] from a state change to PAUSED until the first
    /// buffer arrives in this element. The base class will call the
    /// `GstBaseSinkClass::preroll` vmethod with this preroll buffer and will then
    /// commit the state change to the next asynchronously pending state.
    ///
    /// When the element is set to PLAYING, [`BaseSink`][crate::BaseSink] will synchronise on the
    /// clock using the times returned from `GstBaseSinkClass::get_times`. If this
    /// function returns `GST_CLOCK_TIME_NONE` for the start time, no synchronisation
    /// will be done. Synchronisation can be disabled entirely by setting the object
    /// `property::BaseSink::sync` property to [`false`].
    ///
    /// After synchronisation the virtual method `GstBaseSinkClass::render` will be
    /// called. Subclasses should minimally implement this method.
    ///
    /// Subclasses that synchronise on the clock in the `GstBaseSinkClass::render`
    /// method are supported as well. These classes typically receive a buffer in
    /// the render method and can then potentially block on the clock while
    /// rendering. A typical example is an audiosink.
    /// These subclasses can use [`BaseSinkExt::wait_preroll()`][crate::prelude::BaseSinkExt::wait_preroll()] to perform the
    /// blocking wait.
    ///
    /// Upon receiving the EOS event in the PLAYING state, [`BaseSink`][crate::BaseSink] will wait
    /// for the clock to reach the time indicated by the stop time of the last
    /// `GstBaseSinkClass::get_times` call before posting an EOS message. When the
    /// element receives EOS in PAUSED, preroll completes, the event is queued and an
    /// EOS message is posted when going to PLAYING.
    ///
    /// [`BaseSink`][crate::BaseSink] will internally use the [`gst::EventType::Segment`][crate::gst::EventType::Segment] events to schedule
    /// synchronisation and clipping of buffers. Buffers that fall completely outside
    /// of the current segment are dropped. Buffers that fall partially in the
    /// segment are rendered (and prerolled). Subclasses should do any subbuffer
    /// clipping themselves when needed.
    ///
    /// [`BaseSink`][crate::BaseSink] will by default report the current playback position in
    /// [`gst::Format::Time`][crate::gst::Format::Time] based on the current clock time and segment information.
    /// If no clock has been set on the element, the query will be forwarded
    /// upstream.
    ///
    /// The `GstBaseSinkClass::set_caps` function will be called when the subclass
    /// should configure itself to process a specific media type.
    ///
    /// The `GstBaseSinkClass::start` and `GstBaseSinkClass::stop` virtual methods
    /// will be called when resources should be allocated. Any
    /// `GstBaseSinkClass::preroll`, `GstBaseSinkClass::render` and
    /// `GstBaseSinkClass::set_caps` function will be called between the
    /// `GstBaseSinkClass::start` and `GstBaseSinkClass::stop` calls.
    ///
    /// The `GstBaseSinkClass::event` virtual method will be called when an event is
    /// received by [`BaseSink`][crate::BaseSink]. Normally this method should only be overridden by
    /// very specific elements (such as file sinks) which need to handle the
    /// newsegment event specially.
    ///
    /// The `GstBaseSinkClass::unlock` method is called when the elements should
    /// unblock any blocking operations they perform in the
    /// `GstBaseSinkClass::render` method. This is mostly useful when the
    /// `GstBaseSinkClass::render` method performs a blocking write on a file
    /// descriptor, for example.
    ///
    /// The `property::BaseSink::max-lateness` property affects how the sink deals with
    /// buffers that arrive too late in the sink. A buffer arrives too late in the
    /// sink when the presentation time (as a combination of the last segment, buffer
    /// timestamp and element base_time) plus the duration is before the current
    /// time of the clock.
    /// If the frame is later than max-lateness, the sink will drop the buffer
    /// without calling the render method.
    /// This feature is disabled if sync is disabled, the
    /// `GstBaseSinkClass::get_times` method does not return a valid start time or
    /// max-lateness is set to -1 (the default).
    /// Subclasses can use [`BaseSinkExt::set_max_lateness()`][crate::prelude::BaseSinkExt::set_max_lateness()] to configure the
    /// max-lateness value.
    ///
    /// The `property::BaseSink::qos` property will enable the quality-of-service features of
    /// the basesink which gather statistics about the real-time performance of the
    /// clock synchronisation. For each buffer received in the sink, statistics are
    /// gathered and a QOS event is sent upstream with these numbers. This
    /// information can then be used by upstream elements to reduce their processing
    /// rate, for example.
    ///
    /// The `property::BaseSink::async` property can be used to instruct the sink to never
    /// perform an ASYNC state change. This feature is mostly usable when dealing
    /// with non-synchronized streams or sparse streams.
    ///
    /// This is an Abstract Base Class, you cannot instantiate it.
    ///
    /// # Implements
    ///
    /// [`BaseSinkExt`][trait@crate::prelude::BaseSinkExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`], [`BaseSinkExtManual`][trait@crate::prelude::BaseSinkExtManual]
    #[doc(alias = "GstBaseSink")]
    pub struct BaseSink(Object<ffi::GstBaseSink, ffi::GstBaseSinkClass>) @extends gst::Element, gst::Object;

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

unsafe impl Send for BaseSink {}
unsafe impl Sync for BaseSink {}

pub const NONE_BASE_SINK: Option<&BaseSink> = None;

/// Trait containing all [`struct@BaseSink`] methods.
///
/// # Implementors
///
/// [`BaseSink`][struct@crate::BaseSink]
pub trait BaseSinkExt: 'static {
    //#[doc(alias = "gst_base_sink_do_preroll")]
    //fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> Result<gst::FlowSuccess, gst::FlowError>;

    /// Get the number of bytes that the sink will pull when it is operating in pull
    /// mode.
    ///
    /// # Returns
    ///
    /// the number of bytes `self` will pull in pull mode.
    #[doc(alias = "gst_base_sink_get_blocksize")]
    #[doc(alias = "get_blocksize")]
    fn blocksize(&self) -> u32;

    /// Checks if `self` is currently configured to drop buffers which are outside
    /// the current segment
    ///
    /// # Returns
    ///
    /// [`true`] if the sink is configured to drop buffers outside the
    /// current segment.
    #[cfg(any(feature = "v1_12", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
    #[doc(alias = "gst_base_sink_get_drop_out_of_segment")]
    #[doc(alias = "get_drop_out_of_segment")]
    fn drops_out_of_segment(&self) -> bool;

    /// Get the last sample that arrived in the sink and was used for preroll or for
    /// rendering. This property can be used to generate thumbnails.
    ///
    /// The [`gst::Caps`][crate::gst::Caps] on the sample can be used to determine the type of the buffer.
    ///
    /// Free-function: gst_sample_unref
    ///
    /// # Returns
    ///
    /// a [`gst::Sample`][crate::gst::Sample]. `gst_sample_unref()` after
    ///  usage. This function returns [`None`] when no buffer has arrived in the
    ///  sink yet or when the sink is not in PAUSED or PLAYING.
    #[doc(alias = "gst_base_sink_get_last_sample")]
    #[doc(alias = "get_last_sample")]
    fn last_sample(&self) -> Option<gst::Sample>;

    /// Get the currently configured latency.
    ///
    /// # Returns
    ///
    /// The configured latency.
    #[doc(alias = "gst_base_sink_get_latency")]
    #[doc(alias = "get_latency")]
    fn latency(&self) -> gst::ClockTime;

    /// Get the maximum amount of bits per second that the sink will render.
    ///
    /// # Returns
    ///
    /// the maximum number of bits per second `self` will render.
    #[doc(alias = "gst_base_sink_get_max_bitrate")]
    #[doc(alias = "get_max_bitrate")]
    fn max_bitrate(&self) -> u64;

    /// Gets the max lateness value. See [`set_max_lateness()`][Self::set_max_lateness()] for
    /// more details.
    ///
    /// # Returns
    ///
    /// The maximum time in nanoseconds that a buffer can be late
    /// before it is dropped and not rendered. A value of -1 means an
    /// unlimited time.
    #[doc(alias = "gst_base_sink_get_max_lateness")]
    #[doc(alias = "get_max_lateness")]
    fn max_lateness(&self) -> i64;

    /// Get the processing deadline of `self`. see
    /// [`set_processing_deadline()`][Self::set_processing_deadline()] for more information about
    /// the processing deadline.
    ///
    /// # Returns
    ///
    /// the processing deadline
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_base_sink_get_processing_deadline")]
    #[doc(alias = "get_processing_deadline")]
    fn processing_deadline(&self) -> gst::ClockTime;

    /// Get the render delay of `self`. see [`set_render_delay()`][Self::set_render_delay()] for more
    /// information about the render delay.
    ///
    /// # Returns
    ///
    /// the render delay of `self`.
    #[doc(alias = "gst_base_sink_get_render_delay")]
    #[doc(alias = "get_render_delay")]
    fn render_delay(&self) -> gst::ClockTime;

    /// Return various [`BaseSink`][crate::BaseSink] statistics. This function returns a [`gst::Structure`][crate::gst::Structure]
    /// with name `application/x-gst-base-sink-stats` with the following fields:
    ///
    /// - "average-rate" G_TYPE_DOUBLE average frame rate
    /// - "dropped" G_TYPE_UINT64 Number of dropped frames
    /// - "rendered" G_TYPE_UINT64 Number of rendered frames
    ///
    /// # Returns
    ///
    /// pointer to [`gst::Structure`][crate::gst::Structure]
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "gst_base_sink_get_stats")]
    #[doc(alias = "get_stats")]
    fn stats(&self) -> gst::Structure;

    /// Checks if `self` is currently configured to synchronize against the
    /// clock.
    ///
    /// # Returns
    ///
    /// [`true`] if the sink is configured to synchronize against the clock.
    #[doc(alias = "gst_base_sink_get_sync")]
    #[doc(alias = "get_sync")]
    fn is_sync(&self) -> bool;

    /// Get the time that will be inserted between frames to control the
    /// maximum buffers per second.
    ///
    /// # Returns
    ///
    /// the number of nanoseconds `self` will put between frames.
    #[doc(alias = "gst_base_sink_get_throttle_time")]
    #[doc(alias = "get_throttle_time")]
    fn throttle_time(&self) -> u64;

    /// Get the synchronisation offset of `self`.
    ///
    /// # Returns
    ///
    /// The synchronisation offset.
    #[doc(alias = "gst_base_sink_get_ts_offset")]
    #[doc(alias = "get_ts_offset")]
    fn ts_offset(&self) -> gst::ClockTimeDiff;

    /// Set the number of bytes that the sink will pull when it is operating in pull
    /// mode.
    /// ## `blocksize`
    /// the blocksize in bytes
    #[doc(alias = "gst_base_sink_set_blocksize")]
    fn set_blocksize(&self, blocksize: u32);

    /// Configure `self` to drop buffers which are outside the current segment
    /// ## `drop_out_of_segment`
    /// drop buffers outside the segment
    #[cfg(any(feature = "v1_12", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
    #[doc(alias = "gst_base_sink_set_drop_out_of_segment")]
    fn set_drop_out_of_segment(&self, drop_out_of_segment: bool);

    /// Set the maximum amount of bits per second that the sink will render.
    /// ## `max_bitrate`
    /// the max_bitrate in bits per second
    #[doc(alias = "gst_base_sink_set_max_bitrate")]
    fn set_max_bitrate(&self, max_bitrate: u64);

    /// Sets the new max lateness value to `max_lateness`. This value is
    /// used to decide if a buffer should be dropped or not based on the
    /// buffer timestamp and the current clock time. A value of -1 means
    /// an unlimited time.
    /// ## `max_lateness`
    /// the new max lateness value.
    #[doc(alias = "gst_base_sink_set_max_lateness")]
    fn set_max_lateness(&self, max_lateness: i64);

    /// Maximum amount of time (in nanoseconds) that the pipeline can take
    /// for processing the buffer. This is added to the latency of live
    /// pipelines.
    ///
    /// This function is usually called by subclasses.
    /// ## `processing_deadline`
    /// the new processing deadline in nanoseconds.
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_base_sink_set_processing_deadline")]
    fn set_processing_deadline(&self, processing_deadline: gst::ClockTime);

    /// Set the render delay in `self` to `delay`. The render delay is the time
    /// between actual rendering of a buffer and its synchronisation time. Some
    /// devices might delay media rendering which can be compensated for with this
    /// function.
    ///
    /// After calling this function, this sink will report additional latency and
    /// other sinks will adjust their latency to delay the rendering of their media.
    ///
    /// This function is usually called by subclasses.
    /// ## `delay`
    /// the new delay
    #[doc(alias = "gst_base_sink_set_render_delay")]
    fn set_render_delay(&self, delay: gst::ClockTime);

    /// Configures `self` to synchronize on the clock or not. When
    /// `sync` is [`false`], incoming samples will be played as fast as
    /// possible. If `sync` is [`true`], the timestamps of the incoming
    /// buffers will be used to schedule the exact render time of its
    /// contents.
    /// ## `sync`
    /// the new sync value.
    #[doc(alias = "gst_base_sink_set_sync")]
    fn set_sync(&self, sync: bool);

    /// Set the time that will be inserted between rendered buffers. This
    /// can be used to control the maximum buffers per second that the sink
    /// will render.
    /// ## `throttle`
    /// the throttle time in nanoseconds
    #[doc(alias = "gst_base_sink_set_throttle_time")]
    fn set_throttle_time(&self, throttle: u64);

    /// Adjust the synchronisation of `self` with `offset`. A negative value will
    /// render buffers earlier than their timestamp. A positive value will delay
    /// rendering. This function can be used to fix playback of badly timestamped
    /// buffers.
    /// ## `offset`
    /// the new offset
    #[doc(alias = "gst_base_sink_set_ts_offset")]
    fn set_ts_offset(&self, offset: gst::ClockTimeDiff);

    /// This function will wait for preroll to complete and will then block until `time`
    /// is reached. It is usually called by subclasses that use their own internal
    /// synchronisation but want to let some synchronization (like EOS) be handled
    /// by the base class.
    ///
    /// This function should only be called with the PREROLL_LOCK held (like when
    /// receiving an EOS event in the ::event vmethod or when handling buffers in
    /// ::render).
    ///
    /// The `time` argument should be the running_time of when the timeout should happen
    /// and will be adjusted with any latency and offset configured in the sink.
    /// ## `time`
    /// the running_time to be reached
    ///
    /// # Returns
    ///
    /// [`gst::FlowReturn`][crate::gst::FlowReturn]
    ///
    /// ## `jitter`
    /// the jitter to be filled with time diff, or [`None`]
    #[doc(alias = "gst_base_sink_wait")]
    fn wait(
        &self,
        time: impl Into<Option<gst::ClockTime>>,
    ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff);

    #[doc(alias = "gst_base_sink_wait_clock")]
    fn wait_clock(
        &self,
        time: gst::ClockTime,
    ) -> (
        Result<gst::ClockSuccess, gst::ClockError>,
        gst::ClockTimeDiff,
    );

    #[doc(alias = "gst_base_sink_wait_preroll")]
    fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError>;

    #[doc(alias = "async")]
    fn is_async(&self) -> bool;

    #[doc(alias = "async")]
    fn set_async(&self, async_: bool);

    #[doc(alias = "enable-last-sample")]
    fn enables_last_sample(&self) -> bool;

    #[doc(alias = "enable-last-sample")]
    fn set_enable_last_sample(&self, enable_last_sample: bool);

    fn is_qos(&self) -> bool;

    fn set_qos(&self, qos: bool);

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

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

    #[doc(alias = "enable-last-sample")]
    fn connect_enable_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[doc(alias = "last-sample")]
    fn connect_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[doc(alias = "max-bitrate")]
    fn connect_max_bitrate_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[doc(alias = "max-lateness")]
    fn connect_max_lateness_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    #[doc(alias = "processing-deadline")]
    fn connect_processing_deadline_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

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

    #[doc(alias = "render-delay")]
    fn connect_render_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "stats")]
    fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;

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

    #[doc(alias = "throttle-time")]
    fn connect_throttle_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    #[doc(alias = "ts-offset")]
    fn connect_ts_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;
}

impl<O: IsA<BaseSink>> BaseSinkExt for O {
    //fn do_preroll(&self, obj: /*Ignored*/&gst::MiniObject) -> Result<gst::FlowSuccess, gst::FlowError> {
    //    unsafe { TODO: call ffi:gst_base_sink_do_preroll() }
    //}

    fn blocksize(&self) -> u32 {
        unsafe { ffi::gst_base_sink_get_blocksize(self.as_ref().to_glib_none().0) }
    }

    #[cfg(any(feature = "v1_12", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
    fn drops_out_of_segment(&self) -> bool {
        unsafe {
            from_glib(ffi::gst_base_sink_get_drop_out_of_segment(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn last_sample(&self) -> Option<gst::Sample> {
        unsafe {
            from_glib_full(ffi::gst_base_sink_get_last_sample(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn latency(&self) -> gst::ClockTime {
        unsafe {
            try_from_glib(ffi::gst_base_sink_get_latency(
                self.as_ref().to_glib_none().0,
            ))
            .expect("mandatory glib value is None")
        }
    }

    fn max_bitrate(&self) -> u64 {
        unsafe { ffi::gst_base_sink_get_max_bitrate(self.as_ref().to_glib_none().0) }
    }

    fn max_lateness(&self) -> i64 {
        unsafe { ffi::gst_base_sink_get_max_lateness(self.as_ref().to_glib_none().0) }
    }

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    fn processing_deadline(&self) -> gst::ClockTime {
        unsafe {
            try_from_glib(ffi::gst_base_sink_get_processing_deadline(
                self.as_ref().to_glib_none().0,
            ))
            .expect("mandatory glib value is None")
        }
    }

    fn render_delay(&self) -> gst::ClockTime {
        unsafe {
            try_from_glib(ffi::gst_base_sink_get_render_delay(
                self.as_ref().to_glib_none().0,
            ))
            .expect("mandatory glib value is None")
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    fn stats(&self) -> gst::Structure {
        unsafe { from_glib_full(ffi::gst_base_sink_get_stats(self.as_ref().to_glib_none().0)) }
    }

    fn is_sync(&self) -> bool {
        unsafe { from_glib(ffi::gst_base_sink_get_sync(self.as_ref().to_glib_none().0)) }
    }

    fn throttle_time(&self) -> u64 {
        unsafe { ffi::gst_base_sink_get_throttle_time(self.as_ref().to_glib_none().0) }
    }

    fn ts_offset(&self) -> gst::ClockTimeDiff {
        unsafe { ffi::gst_base_sink_get_ts_offset(self.as_ref().to_glib_none().0) }
    }

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

    #[cfg(any(feature = "v1_12", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
    fn set_drop_out_of_segment(&self, drop_out_of_segment: bool) {
        unsafe {
            ffi::gst_base_sink_set_drop_out_of_segment(
                self.as_ref().to_glib_none().0,
                drop_out_of_segment.into_glib(),
            );
        }
    }

    fn set_max_bitrate(&self, max_bitrate: u64) {
        unsafe {
            ffi::gst_base_sink_set_max_bitrate(self.as_ref().to_glib_none().0, max_bitrate);
        }
    }

    fn set_max_lateness(&self, max_lateness: i64) {
        unsafe {
            ffi::gst_base_sink_set_max_lateness(self.as_ref().to_glib_none().0, max_lateness);
        }
    }

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    fn set_processing_deadline(&self, processing_deadline: gst::ClockTime) {
        unsafe {
            ffi::gst_base_sink_set_processing_deadline(
                self.as_ref().to_glib_none().0,
                processing_deadline.into_glib(),
            );
        }
    }

    fn set_render_delay(&self, delay: gst::ClockTime) {
        unsafe {
            ffi::gst_base_sink_set_render_delay(self.as_ref().to_glib_none().0, delay.into_glib());
        }
    }

    fn set_sync(&self, sync: bool) {
        unsafe {
            ffi::gst_base_sink_set_sync(self.as_ref().to_glib_none().0, sync.into_glib());
        }
    }

    fn set_throttle_time(&self, throttle: u64) {
        unsafe {
            ffi::gst_base_sink_set_throttle_time(self.as_ref().to_glib_none().0, throttle);
        }
    }

    fn set_ts_offset(&self, offset: gst::ClockTimeDiff) {
        unsafe {
            ffi::gst_base_sink_set_ts_offset(self.as_ref().to_glib_none().0, offset);
        }
    }

    fn wait(
        &self,
        time: impl Into<Option<gst::ClockTime>>,
    ) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
        unsafe {
            let mut jitter = mem::MaybeUninit::uninit();
            let ret = try_from_glib(ffi::gst_base_sink_wait(
                self.as_ref().to_glib_none().0,
                time.into().into_glib(),
                jitter.as_mut_ptr(),
            ));
            let jitter = jitter.assume_init();
            (ret, jitter)
        }
    }

    fn wait_clock(
        &self,
        time: gst::ClockTime,
    ) -> (
        Result<gst::ClockSuccess, gst::ClockError>,
        gst::ClockTimeDiff,
    ) {
        unsafe {
            let mut jitter = mem::MaybeUninit::uninit();
            let ret = try_from_glib(ffi::gst_base_sink_wait_clock(
                self.as_ref().to_glib_none().0,
                time.into_glib(),
                jitter.as_mut_ptr(),
            ));
            let jitter = jitter.assume_init();
            (ret, jitter)
        }
    }

    fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
        unsafe {
            try_from_glib(ffi::gst_base_sink_wait_preroll(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

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

    fn set_async(&self, async_: bool) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"async\0".as_ptr() as *const _,
                async_.to_value().to_glib_none().0,
            );
        }
    }

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

    fn set_enable_last_sample(&self, enable_last_sample: bool) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"enable-last-sample\0".as_ptr() as *const _,
                enable_last_sample.to_value().to_glib_none().0,
            );
        }
    }

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

    fn set_qos(&self, qos: bool) {
        unsafe {
            glib::gobject_ffi::g_object_set_property(
                self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
                b"qos\0".as_ptr() as *const _,
                qos.to_value().to_glib_none().0,
            );
        }
    }

    #[doc(alias = "async")]
    fn connect_async_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_async_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::async\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_async_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "blocksize")]
    fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_blocksize_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::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),
            )
        }
    }

    #[doc(alias = "enable-last-sample")]
    fn connect_enable_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_enable_last_sample_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::enable-last-sample\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_enable_last_sample_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "last-sample")]
    fn connect_last_sample_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_last_sample_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::last-sample\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_last_sample_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "max-bitrate")]
    fn connect_max_bitrate_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_max_bitrate_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::max-bitrate\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_max_bitrate_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "max-lateness")]
    fn connect_max_lateness_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_max_lateness_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::max-lateness\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_max_lateness_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
    #[doc(alias = "processing-deadline")]
    fn connect_processing_deadline_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_processing_deadline_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::processing-deadline\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_processing_deadline_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "qos")]
    fn connect_qos_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_qos_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::qos\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_qos_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "render-delay")]
    fn connect_render_delay_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_render_delay_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::render-delay\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_render_delay_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
    #[doc(alias = "stats")]
    fn connect_stats_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_stats_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::stats\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_stats_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "sync")]
    fn connect_sync_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_sync_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::sync\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_sync_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "throttle-time")]
    fn connect_throttle_time_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_throttle_time_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::throttle-time\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_throttle_time_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "ts-offset")]
    fn connect_ts_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_ts_offset_trampoline<
            P: IsA<BaseSink>,
            F: Fn(&P) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstBaseSink,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&BaseSink::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::ts-offset\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_ts_offset_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}