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
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
// 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 Caps;
use Element;
use Event;
use EventType;
use FlowReturn;
use Object;
use PadDirection;
use PadLinkCheck;
use PadLinkReturn;
use PadMode;
use PadTemplate;
#[cfg(any(feature = "v1_10", feature = "dox"))]
use Stream;
#[cfg(any(feature = "v1_12", feature = "dox"))]
use TaskState;
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 std::boxed::Box as Box_;
use std::mem;
use std::mem::transmute;
use std::ptr;

glib_wrapper! {
    /// A `Element` is linked to other elements via "pads", which are extremely
    /// light-weight generic link points.
    ///
    /// Pads have a `PadDirection`, source pads produce data, sink pads consume
    /// data.
    ///
    /// Pads are typically created from a `PadTemplate` with
    /// `Pad::new_from_template` and are then added to a `Element`. This usually
    /// happens when the element is created but it can also happen dynamically based
    /// on the data that the element is processing or based on the pads that the
    /// application requests.
    ///
    /// Pads without pad templates can be created with `Pad::new`,
    /// which takes a direction and a name as an argument. If the name is `None`,
    /// then a guaranteed unique name will be assigned to it.
    ///
    /// A `Element` creating a pad will typically use the various
    /// gst_pad_set_*`_function` calls to register callbacks for events, queries or
    /// dataflow on the pads.
    ///
    /// `gst_pad_get_parent` will retrieve the `Element` that owns the pad.
    ///
    /// After two pads are retrieved from an element by `ElementExt::get_static_pad`,
    /// the pads can be linked with `PadExt::link`. (For quick links,
    /// you can also use `ElementExt::link`, which will make the obvious
    /// link for you if it's straightforward.). Pads can be unlinked again with
    /// `PadExt::unlink`. `PadExt::get_peer` can be used to check what the pad is
    /// linked to.
    ///
    /// Before dataflow is possible on the pads, they need to be activated with
    /// `PadExt::set_active`.
    ///
    /// `Pad::query` and `Pad::peer_query` can be used to query various
    /// properties of the pad and the stream.
    ///
    /// To send a `Event` on a pad, use `Pad::send_event` and
    /// `Pad::push_event`. Some events will be sticky on the pad, meaning that
    /// after they pass on the pad they can be queried later with
    /// `PadExt::get_sticky_event` and `PadExt::sticky_events_foreach`.
    /// `PadExt::get_current_caps` and `PadExt::has_current_caps` are convenience
    /// functions to query the current sticky CAPS event on a pad.
    ///
    /// GstElements will use `Pad::push` and `Pad::pull_range` to push out
    /// or pull in a buffer.
    ///
    /// The dataflow, events and queries that happen on a pad can be monitored with
    /// probes that can be installed with `PadExt::add_probe`. `PadExt::is_blocked`
    /// can be used to check if a block probe is installed on the pad.
    /// `PadExt::is_blocking` checks if the blocking probe is currently blocking the
    /// pad. `Pad::remove_probe` is used to remove a previously installed probe
    /// and unblock blocking probes if any.
    ///
    /// Pad have an offset that can be retrieved with `PadExt::get_offset`. This
    /// offset will be applied to the running_time of all data passing over the pad.
    /// `PadExt::set_offset` can be used to change the offset.
    ///
    /// Convenience functions exist to start, pause and stop the task on a pad with
    /// `PadExt::start_task`, `PadExt::pause_task` and `PadExt::stop_task`
    /// respectively.
    ///
    /// # Implements
    ///
    /// [`PadExt`](trait.PadExt.html), [`GstObjectExt`](trait.GstObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html)
    pub struct Pad(Object<ffi::GstPad, ffi::GstPadClass>): Object;

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

impl Pad {
    /// Creates a new pad with the given name in the given direction.
    /// If name is `None`, a guaranteed unique name (across all pads)
    /// will be assigned.
    /// This function makes a copy of the name so you can safely free the name.
    /// ## `name`
    /// the name of the new pad.
    /// ## `direction`
    /// the `PadDirection` of the pad.
    ///
    /// # Returns
    ///
    /// a new `Pad`, or `None` in
    /// case of an error.
    ///
    /// MT safe.
    pub fn new<'a, P: Into<Option<&'a str>>>(name: P, direction: PadDirection) -> Pad {
        assert_initialized_main_thread!();
        let name = name.into();
        let name = name.to_glib_none();
        unsafe {
            from_glib_none(ffi::gst_pad_new(name.0, direction.to_glib()))
        }
    }

    /// Creates a new pad with the given name from the given template.
    /// If name is `None`, a guaranteed unique name (across all pads)
    /// will be assigned.
    /// This function makes a copy of the name so you can safely free the name.
    /// ## `templ`
    /// the pad template to use
    /// ## `name`
    /// the name of the pad
    ///
    /// # Returns
    ///
    /// a new `Pad`, or `None` in
    /// case of an error.
    pub fn new_from_template<'a, P: Into<Option<&'a str>>>(templ: &PadTemplate, name: P) -> Pad {
        skip_assert_initialized!();
        let name = name.into();
        let name = name.to_glib_none();
        unsafe {
            from_glib_none(ffi::gst_pad_new_from_template(templ.to_glib_none().0, name.0))
        }
    }
}

unsafe impl Send for Pad {}
unsafe impl Sync for Pad {}

/// Trait containing all `Pad` methods.
///
/// # Implementors
///
/// [`Pad`](struct.Pad.html), [`ProxyPad`](struct.ProxyPad.html)
pub trait PadExt {
    /// Activates or deactivates the given pad in `mode` via dispatching to the
    /// pad's activatemodefunc. For use from within pad activation functions only.
    ///
    /// If you don't know what this is, you probably don't want to call it.
    /// ## `mode`
    /// the requested activation mode
    /// ## `active`
    /// whether or not the pad should be active.
    ///
    /// # Returns
    ///
    /// `true` if the operation was successful.
    ///
    /// MT safe.
    fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError>;

    //fn add_probe(&self, mask: PadProbeType, callback: /*Unknown conversion*//*Unimplemented*/PadProbeCallback, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> libc::c_ulong;

    /// Checks if the source pad and the sink pad are compatible so they can be
    /// linked.
    /// ## `sinkpad`
    /// the sink `Pad`.
    ///
    /// # Returns
    ///
    /// `true` if the pads can be linked.
    fn can_link<P: IsA<Pad>>(&self, sinkpad: &P) -> bool;

    /// Check and clear the `PadFlags::NeedReconfigure` flag on `self` and return `true`
    /// if the flag was set.
    ///
    /// # Returns
    ///
    /// `true` is the GST_PAD_FLAG_NEED_RECONFIGURE flag was set on `self`.
    fn check_reconfigure(&self) -> bool;

    /// Creates a stream-id for the source `Pad` `self` by combining the
    /// upstream information with the optional `stream_id` of the stream
    /// of `self`. `self` must have a parent `Element` and which must have zero
    /// or one sinkpad. `stream_id` can only be `None` if the parent element
    /// of `self` has only a single source pad.
    ///
    /// This function generates an unique stream-id by getting the upstream
    /// stream-start event stream ID and appending `stream_id` to it. If the
    /// element has no sinkpad it will generate an upstream stream-id by
    /// doing an URI query on the element and in the worst case just uses
    /// a random number. Source elements that don't implement the URI
    /// handler interface should ideally generate a unique, deterministic
    /// stream-id manually instead.
    ///
    /// Since stream IDs are sorted alphabetically, any numbers in the
    /// stream ID should be printed with a fixed number of characters,
    /// preceded by 0's, such as by using the format \%03u instead of \%u.
    /// ## `parent`
    /// Parent `Element` of `self`
    /// ## `stream_id`
    /// The stream-id
    ///
    /// # Returns
    ///
    /// A stream-id for `self`. `g_free` after usage.
    fn create_stream_id<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q) -> Option<String>;

    //fn create_stream_id_printf<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<String>;

    //fn create_stream_id_printf_valist<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String>;

    //fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool;

    /// Gets the capabilities of the allowed media types that can flow through
    /// `self` and its peer.
    ///
    /// The allowed capabilities is calculated as the intersection of the results of
    /// calling `PadExt::query_caps` on `self` and its peer. The caller owns a reference
    /// on the resulting caps.
    ///
    /// # Returns
    ///
    /// the allowed `Caps` of the
    ///  pad link. Unref the caps when you no longer need it. This
    ///  function returns `None` when `self` has no peer.
    ///
    /// MT safe.
    fn get_allowed_caps(&self) -> Option<Caps>;

    /// Gets the capabilities currently configured on `self` with the last
    /// `EventType::Caps` event.
    ///
    /// # Returns
    ///
    /// the current caps of the pad with
    /// incremented ref-count or `None` when pad has no caps. Unref after usage.
    fn get_current_caps(&self) -> Option<Caps>;

    /// Gets the direction of the pad. The direction of the pad is
    /// decided at construction time so this function does not take
    /// the LOCK.
    ///
    /// # Returns
    ///
    /// the `PadDirection` of the pad.
    ///
    /// MT safe.
    fn get_direction(&self) -> PadDirection;

    //fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer>;

    /// Gets the `FlowReturn` return from the last data passed by this pad.
    fn get_last_flow_return(&self) -> FlowReturn;

    /// Get the offset applied to the running time of `self`. `self` has to be a source
    /// pad.
    ///
    /// # Returns
    ///
    /// the offset.
    fn get_offset(&self) -> i64;

    /// Gets the template for `self`.
    ///
    /// # Returns
    ///
    /// the `PadTemplate` from which
    ///  this pad was instantiated, or `None` if this pad has no
    ///  template. Unref after usage.
    fn get_pad_template(&self) -> Option<PadTemplate>;

    /// Gets the capabilities for `self`'s template.
    ///
    /// # Returns
    ///
    /// the `Caps` of this pad template.
    /// Unref after usage.
    fn get_pad_template_caps(&self) -> Option<Caps>;

    /// Gets the parent of `self`, cast to a `Element`. If a `self` has no parent or
    /// its parent is not an element, return `None`.
    ///
    /// # Returns
    ///
    /// the parent of the pad. The
    /// caller has a reference on the parent, so unref when you're finished
    /// with it.
    ///
    /// MT safe.
    fn get_parent_element(&self) -> Option<Element>;

    /// Gets the peer of `self`. This function refs the peer pad so
    /// you need to unref it after use.
    ///
    /// # Returns
    ///
    /// the peer `Pad`. Unref after usage.
    ///
    /// MT safe.
    fn get_peer(&self) -> Option<Pad>;

    /// Returns a new reference of the sticky event of type `event_type`
    /// from the event.
    /// ## `event_type`
    /// the `EventType` that should be retrieved.
    /// ## `idx`
    /// the index of the event
    ///
    /// # Returns
    ///
    /// a `Event` of type
    /// `event_type` or `None` when no event of `event_type` was on
    /// `self`. Unref after usage.
    fn get_sticky_event(&self, event_type: EventType, idx: u32) -> Option<Event>;

    /// Returns the current `Stream` for the `self`, or `None` if none has been
    /// set yet, i.e. the pad has not received a stream-start event yet.
    ///
    /// This is a convenience wrapper around `PadExt::get_sticky_event` and
    /// `Event::parse_stream`.
    ///
    /// Feature: `v1_10`
    ///
    ///
    /// # Returns
    ///
    /// the current `Stream` for `self`, or `None`.
    ///  unref the returned stream when no longer needed.
    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn get_stream(&self) -> Option<Stream>;

    /// Returns the current stream-id for the `self`, or `None` if none has been
    /// set yet, i.e. the pad has not received a stream-start event yet.
    ///
    /// This is a convenience wrapper around `PadExt::get_sticky_event` and
    /// `Event::parse_stream_start`.
    ///
    /// The returned stream-id string should be treated as an opaque string, its
    /// contents should not be interpreted.
    ///
    /// # Returns
    ///
    /// a newly-allocated copy of the stream-id for
    ///  `self`, or `None`. `g_free` the returned string when no longer
    ///  needed.
    fn get_stream_id(&self) -> Option<String>;

    /// Get `self` task state. If no task is currently
    /// set, `TaskState::Stopped` is returned.
    ///
    /// Feature: `v1_12`
    ///
    ///
    /// # Returns
    ///
    /// The current state of `self`'s task.
    #[cfg(any(feature = "v1_12", feature = "dox"))]
    fn get_task_state(&self) -> TaskState;

    /// Check if `self` has caps set on it with a `EventType::Caps` event.
    ///
    /// # Returns
    ///
    /// `true` when `self` has caps associated with it.
    fn has_current_caps(&self) -> bool;

    /// Query if a pad is active
    ///
    /// # Returns
    ///
    /// `true` if the pad is active.
    ///
    /// MT safe.
    fn is_active(&self) -> bool;

    /// Checks if the pad is blocked or not. This function returns the
    /// last requested state of the pad. It is not certain that the pad
    /// is actually blocking at this point (see `PadExt::is_blocking`).
    ///
    /// # Returns
    ///
    /// `true` if the pad is blocked.
    ///
    /// MT safe.
    fn is_blocked(&self) -> bool;

    /// Checks if the pad is blocking or not. This is a guaranteed state
    /// of whether the pad is actually blocking on a `Buffer` or a `Event`.
    ///
    /// # Returns
    ///
    /// `true` if the pad is blocking.
    ///
    /// MT safe.
    fn is_blocking(&self) -> bool;

    /// Checks if a `self` is linked to another pad or not.
    ///
    /// # Returns
    ///
    /// `true` if the pad is linked, `false` otherwise.
    ///
    /// MT safe.
    fn is_linked(&self) -> bool;

    //fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator>;

    //fn iterate_internal_links_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q) -> /*Ignored*/Option<Iterator>;

    /// Links the source pad and the sink pad.
    /// ## `sinkpad`
    /// the sink `Pad` to link.
    ///
    /// # Returns
    ///
    /// A result code indicating if the connection worked or
    ///  what went wrong.
    ///
    /// MT Safe.
    fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn;

    /// Links the source pad and the sink pad.
    ///
    /// This variant of `PadExt::link` provides a more granular control on the
    /// checks being done when linking. While providing some considerable speedups
    /// the caller of this method must be aware that wrong usage of those flags
    /// can cause severe issues. Refer to the documentation of `PadLinkCheck`
    /// for more information.
    ///
    /// MT Safe.
    /// ## `sinkpad`
    /// the sink `Pad` to link.
    /// ## `flags`
    /// the checks to validate when linking
    ///
    /// # Returns
    ///
    /// A result code indicating if the connection worked or
    ///  what went wrong.
    fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn;

    /// Links `self` to `sink`, creating any `GhostPad`'s in between as necessary.
    ///
    /// This is a convenience function to save having to create and add intermediate
    /// `GhostPad`'s as required for linking across `Bin` boundaries.
    ///
    /// If `self` or `sink` pads don't have parent elements or do not share a common
    /// ancestor, the link will fail.
    ///
    /// Feature: `v1_10`
    ///
    /// ## `sink`
    /// a `Pad`
    ///
    /// # Returns
    ///
    /// whether the link succeeded.
    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError>;

    /// Links `self` to `sink`, creating any `GhostPad`'s in between as necessary.
    ///
    /// This is a convenience function to save having to create and add intermediate
    /// `GhostPad`'s as required for linking across `Bin` boundaries.
    ///
    /// If `self` or `sink` pads don't have parent elements or do not share a common
    /// ancestor, the link will fail.
    ///
    /// Calling `PadExt::link_maybe_ghosting_full` with
    /// `flags` == `PadLinkCheck::Default` is the recommended way of linking
    /// pads with safety checks applied.
    ///
    /// Feature: `v1_10`
    ///
    /// ## `sink`
    /// a `Pad`
    /// ## `flags`
    /// some `PadLinkCheck` flags
    ///
    /// # Returns
    ///
    /// whether the link succeeded.
    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: PadLinkCheck) -> bool;

    /// Mark a pad for needing reconfiguration. The next call to
    /// `PadExt::check_reconfigure` will return `true` after this call.
    fn mark_reconfigure(&self);

    /// Check the `PadFlags::NeedReconfigure` flag on `self` and return `true`
    /// if the flag was set.
    ///
    /// # Returns
    ///
    /// `true` is the GST_PAD_FLAG_NEED_RECONFIGURE flag is set on `self`.
    fn needs_reconfigure(&self) -> bool;

    /// Pause the task of `self`. This function will also wait until the
    /// function executed by the task is finished if this function is not
    /// called from the task function.
    ///
    /// # Returns
    ///
    /// a `true` if the task could be paused or `false` when the pad
    /// has no task.
    fn pause_task(&self) -> Result<(), glib::error::BoolError>;

    /// Check if the peer of `self` accepts `caps`. If `self` has no peer, this function
    /// returns `true`.
    /// ## `caps`
    /// a `Caps` to check on the pad
    ///
    /// # Returns
    ///
    /// `true` if the peer of `self` can accept the caps or `self` has no peer.
    fn peer_query_accept_caps(&self, caps: &Caps) -> bool;

    /// Gets the capabilities of the peer connected to this pad. Similar to
    /// `PadExt::query_caps`.
    ///
    /// When called on srcpads `filter` contains the caps that
    /// upstream could produce in the order preferred by upstream. When
    /// called on sinkpads `filter` contains the caps accepted by
    /// downstream in the preferred order. `filter` might be `None` but
    /// if it is not `None` the returned caps will be a subset of `filter`.
    /// ## `filter`
    /// a `Caps` filter, or `None`.
    ///
    /// # Returns
    ///
    /// the caps of the peer pad with incremented
    /// ref-count. When there is no peer pad, this function returns `filter` or,
    /// when `filter` is `None`, ANY caps.
    fn peer_query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;

    /// Check if the given pad accepts the caps.
    /// ## `caps`
    /// a `Caps` to check on the pad
    ///
    /// # Returns
    ///
    /// `true` if the pad can accept the caps.
    fn query_accept_caps(&self, caps: &Caps) -> bool;

    /// Gets the capabilities this pad can produce or consume.
    /// Note that this method doesn't necessarily return the caps set by sending a
    /// `Event::new_caps` - use `PadExt::get_current_caps` for that instead.
    /// gst_pad_query_caps returns all possible caps a pad can operate with, using
    /// the pad's CAPS query function, If the query fails, this function will return
    /// `filter`, if not `None`, otherwise ANY.
    ///
    /// When called on sinkpads `filter` contains the caps that
    /// upstream could produce in the order preferred by upstream. When
    /// called on srcpads `filter` contains the caps accepted by
    /// downstream in the preferred order. `filter` might be `None` but
    /// if it is not `None` the returned caps will be a subset of `filter`.
    ///
    /// Note that this function does not return writable `Caps`, use
    /// `gst_caps_make_writable` before modifying the caps.
    /// ## `filter`
    /// suggested `Caps`, or `None`
    ///
    /// # Returns
    ///
    /// the caps of the pad with incremented ref-count.
    fn query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;

    //fn set_activate_function_full(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_activatemode_function_full(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    /// Activates or deactivates the given pad.
    /// Normally called from within core state change functions.
    ///
    /// If `active`, makes sure the pad is active. If it is already active, either in
    /// push or pull mode, just return. Otherwise dispatches to the pad's activate
    /// function to perform the actual activation.
    ///
    /// If not `active`, calls `PadExt::activate_mode` with the pad's current mode
    /// and a `false` argument.
    /// ## `active`
    /// whether or not the pad should be active.
    ///
    /// # Returns
    ///
    /// `true` if the operation was successful.
    ///
    /// MT safe.
    fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError>;

    //fn set_chain_function_full(&self, chain: /*Unknown conversion*//*Unimplemented*/PadChainFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_chain_list_function_full(&self, chainlist: /*Unknown conversion*//*Unimplemented*/PadChainListFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_element_private<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priv_: P);

    //fn set_event_full_function_full(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_event_function_full(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_getrange_function_full(&self, get: /*Unknown conversion*//*Unimplemented*/PadGetRangeFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_iterate_internal_links_function_full(&self, iterintlink: /*Unknown conversion*//*Unimplemented*/PadIterIntLinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_link_function_full(&self, link: /*Unknown conversion*//*Unimplemented*/PadLinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    /// Set the offset that will be applied to the running time of `self`.
    /// ## `offset`
    /// the offset
    fn set_offset(&self, offset: i64);

    //fn set_query_function_full(&self, query: /*Unknown conversion*//*Unimplemented*/PadQueryFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn set_unlink_function_full(&self, unlink: /*Unknown conversion*//*Unimplemented*/PadUnlinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);

    //fn start_task(&self, func: /*Unknown conversion*//*Unimplemented*/TaskFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> bool;

    //fn sticky_events_foreach<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, foreach_func: /*Unknown conversion*//*Unimplemented*/PadStickyEventsForeachFunction, user_data: P);

    /// Stop the task of `self`. This function will also make sure that the
    /// function executed by the task will effectively stop if not called
    /// from the GstTaskFunction.
    ///
    /// This function will deadlock if called from the GstTaskFunction of
    /// the task. Use `Task::pause` instead.
    ///
    /// Regardless of whether the pad has a task, the stream lock is acquired and
    /// released so as to ensure that streaming through this pad has finished.
    ///
    /// # Returns
    ///
    /// a `true` if the task could be stopped or `false` on error.
    fn stop_task(&self) -> Result<(), glib::error::BoolError>;

    /// Store the sticky `event` on `self`
    /// ## `event`
    /// a `Event`
    ///
    /// # Returns
    ///
    /// `FlowReturn::Ok` on success, `FlowReturn::Flushing` when the pad
    /// was flushing or `FlowReturn::Eos` when the pad was EOS.
    fn store_sticky_event(&self, event: &Event) -> FlowReturn;

    /// Unlinks the source pad from the sink pad. Will emit the `Pad::unlinked`
    /// signal on both pads.
    /// ## `sinkpad`
    /// the sink `Pad` to unlink.
    ///
    /// # Returns
    ///
    /// `true` if the pads were unlinked. This function returns `false` if
    /// the pads were not linked together.
    ///
    /// MT safe.
    fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError>;

    /// A helper function you can use that sets the FIXED_CAPS flag
    /// This way the default CAPS query will always return the negotiated caps
    /// or in case the pad is not negotiated, the padtemplate caps.
    ///
    /// The negotiated caps are the caps of the last CAPS event that passed on the
    /// pad. Use this function on a pad that, once it negotiated to a CAPS, cannot
    /// be renegotiated to something else.
    fn use_fixed_caps(&self);

    fn get_property_caps(&self) -> Option<Caps>;

    fn get_property_template(&self) -> Option<PadTemplate>;

    fn set_property_template(&self, template: Option<&PadTemplate>);

    /// Signals that a pad has been linked to the peer pad.
    /// ## `peer`
    /// the peer pad that has been connected
    fn connect_linked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;

    /// Signals that a pad has been unlinked from the peer pad.
    /// ## `peer`
    /// the peer pad that has been disconnected
    fn connect_unlinked<F: Fn(&Self, &Pad) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId;

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

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

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

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

impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
    fn activate_mode(&self, mode: PadMode, active: bool) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_activate_mode(self.to_glib_none().0, mode.to_glib(), active.to_glib()), "Failed to activate mode pad")
        }
    }

    //fn add_probe(&self, mask: PadProbeType, callback: /*Unknown conversion*//*Unimplemented*/PadProbeCallback, destroy_data: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> libc::c_ulong {
    //    unsafe { TODO: call ffi::gst_pad_add_probe() }
    //}

    fn can_link<P: IsA<Pad>>(&self, sinkpad: &P) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_can_link(self.to_glib_none().0, sinkpad.to_glib_none().0))
        }
    }

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

    fn create_stream_id<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q) -> Option<String> {
        let stream_id = stream_id.into();
        let stream_id = stream_id.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_create_stream_id(self.to_glib_none().0, parent.to_glib_none().0, stream_id.0))
        }
    }

    //fn create_stream_id_printf<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<String> {
    //    unsafe { TODO: call ffi::gst_pad_create_stream_id_printf() }
    //}

    //fn create_stream_id_printf_valist<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String> {
    //    unsafe { TODO: call ffi::gst_pad_create_stream_id_printf_valist() }
    //}

    //fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_forward() }
    //}

    fn get_allowed_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_allowed_caps(self.to_glib_none().0))
        }
    }

    fn get_current_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_current_caps(self.to_glib_none().0))
        }
    }

    fn get_direction(&self) -> PadDirection {
        unsafe {
            from_glib(ffi::gst_pad_get_direction(self.to_glib_none().0))
        }
    }

    //fn get_element_private(&self) -> /*Unimplemented*/Option<Fundamental: Pointer> {
    //    unsafe { TODO: call ffi::gst_pad_get_element_private() }
    //}

    fn get_last_flow_return(&self) -> FlowReturn {
        unsafe {
            from_glib(ffi::gst_pad_get_last_flow_return(self.to_glib_none().0))
        }
    }

    fn get_offset(&self) -> i64 {
        unsafe {
            ffi::gst_pad_get_offset(self.to_glib_none().0)
        }
    }

    fn get_pad_template(&self) -> Option<PadTemplate> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_pad_template(self.to_glib_none().0))
        }
    }

    fn get_pad_template_caps(&self) -> Option<Caps> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_pad_template_caps(self.to_glib_none().0))
        }
    }

    fn get_parent_element(&self) -> Option<Element> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_parent_element(self.to_glib_none().0))
        }
    }

    fn get_peer(&self) -> Option<Pad> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_peer(self.to_glib_none().0))
        }
    }

    fn get_sticky_event(&self, event_type: EventType, idx: u32) -> Option<Event> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_sticky_event(self.to_glib_none().0, event_type.to_glib(), idx))
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn get_stream(&self) -> Option<Stream> {
        unsafe {
            from_glib_full(ffi::gst_pad_get_stream(self.to_glib_none().0))
        }
    }

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

    #[cfg(any(feature = "v1_12", feature = "dox"))]
    fn get_task_state(&self) -> TaskState {
        unsafe {
            from_glib(ffi::gst_pad_get_task_state(self.to_glib_none().0))
        }
    }

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

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

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

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

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

    //fn iterate_internal_links(&self) -> /*Ignored*/Option<Iterator> {
    //    unsafe { TODO: call ffi::gst_pad_iterate_internal_links() }
    //}

    //fn iterate_internal_links_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q) -> /*Ignored*/Option<Iterator> {
    //    unsafe { TODO: call ffi::gst_pad_iterate_internal_links_default() }
    //}

    fn link<P: IsA<Pad>>(&self, sinkpad: &P) -> PadLinkReturn {
        unsafe {
            from_glib(ffi::gst_pad_link(self.to_glib_none().0, sinkpad.to_glib_none().0))
        }
    }

    fn link_full<P: IsA<Pad>>(&self, sinkpad: &P, flags: PadLinkCheck) -> PadLinkReturn {
        unsafe {
            from_glib(ffi::gst_pad_link_full(self.to_glib_none().0, sinkpad.to_glib_none().0, flags.to_glib()))
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn link_maybe_ghosting<P: IsA<Pad>>(&self, sink: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_link_maybe_ghosting(self.to_glib_none().0, sink.to_glib_none().0), "Failed to link pad, possibly ghosting")
        }
    }

    #[cfg(any(feature = "v1_10", feature = "dox"))]
    fn link_maybe_ghosting_full<P: IsA<Pad>>(&self, sink: &P, flags: PadLinkCheck) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_link_maybe_ghosting_full(self.to_glib_none().0, sink.to_glib_none().0, flags.to_glib()))
        }
    }

    fn mark_reconfigure(&self) {
        unsafe {
            ffi::gst_pad_mark_reconfigure(self.to_glib_none().0);
        }
    }

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

    fn pause_task(&self) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_pause_task(self.to_glib_none().0), "Failed to pause pad task")
        }
    }

    fn peer_query_accept_caps(&self, caps: &Caps) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_peer_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
        }
    }

    fn peer_query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps> {
        let filter = filter.into();
        let filter = filter.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_peer_query_caps(self.to_glib_none().0, filter.0))
        }
    }

    fn query_accept_caps(&self, caps: &Caps) -> bool {
        unsafe {
            from_glib(ffi::gst_pad_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
        }
    }

    fn query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps> {
        let filter = filter.into();
        let filter = filter.to_glib_none();
        unsafe {
            from_glib_full(ffi::gst_pad_query_caps(self.to_glib_none().0, filter.0))
        }
    }

    //fn set_activate_function_full(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_activate_function_full() }
    //}

    //fn set_activatemode_function_full(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_activatemode_function_full() }
    //}

    fn set_active(&self, active: bool) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_set_active(self.to_glib_none().0, active.to_glib()), "Failed to activate pad")
        }
    }

    //fn set_chain_function_full(&self, chain: /*Unknown conversion*//*Unimplemented*/PadChainFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_chain_function_full() }
    //}

    //fn set_chain_list_function_full(&self, chainlist: /*Unknown conversion*//*Unimplemented*/PadChainListFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_chain_list_function_full() }
    //}

    //fn set_element_private<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, priv_: P) {
    //    unsafe { TODO: call ffi::gst_pad_set_element_private() }
    //}

    //fn set_event_full_function_full(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFullFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_event_full_function_full() }
    //}

    //fn set_event_function_full(&self, event: /*Unknown conversion*//*Unimplemented*/PadEventFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_event_function_full() }
    //}

    //fn set_getrange_function_full(&self, get: /*Unknown conversion*//*Unimplemented*/PadGetRangeFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_getrange_function_full() }
    //}

    //fn set_iterate_internal_links_function_full(&self, iterintlink: /*Unknown conversion*//*Unimplemented*/PadIterIntLinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_iterate_internal_links_function_full() }
    //}

    //fn set_link_function_full(&self, link: /*Unknown conversion*//*Unimplemented*/PadLinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_link_function_full() }
    //}

    fn set_offset(&self, offset: i64) {
        unsafe {
            ffi::gst_pad_set_offset(self.to_glib_none().0, offset);
        }
    }

    //fn set_query_function_full(&self, query: /*Unknown conversion*//*Unimplemented*/PadQueryFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_query_function_full() }
    //}

    //fn set_unlink_function_full(&self, unlink: /*Unknown conversion*//*Unimplemented*/PadUnlinkFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
    //    unsafe { TODO: call ffi::gst_pad_set_unlink_function_full() }
    //}

    //fn start_task(&self, func: /*Unknown conversion*//*Unimplemented*/TaskFunction, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) -> bool {
    //    unsafe { TODO: call ffi::gst_pad_start_task() }
    //}

    //fn sticky_events_foreach<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, foreach_func: /*Unknown conversion*//*Unimplemented*/PadStickyEventsForeachFunction, user_data: P) {
    //    unsafe { TODO: call ffi::gst_pad_sticky_events_foreach() }
    //}

    fn stop_task(&self) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_stop_task(self.to_glib_none().0), "Failed to stop pad task")
        }
    }

    fn store_sticky_event(&self, event: &Event) -> FlowReturn {
        unsafe {
            from_glib(ffi::gst_pad_store_sticky_event(self.to_glib_none().0, event.to_glib_none().0))
        }
    }

    fn unlink<P: IsA<Pad>>(&self, sinkpad: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::error::BoolError::from_glib(ffi::gst_pad_unlink(self.to_glib_none().0, sinkpad.to_glib_none().0), "Failed to unlink pad")
        }
    }

    fn use_fixed_caps(&self) {
        unsafe {
            ffi::gst_pad_use_fixed_caps(self.to_glib_none().0);
        }
    }

    fn get_property_caps(&self) -> Option<Caps> {
        unsafe {
            let mut value = Value::from_type(<Caps as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "caps".to_glib_none().0, value.to_glib_none_mut().0);
            value.get()
        }
    }

    fn get_property_template(&self) -> Option<PadTemplate> {
        unsafe {
            let mut value = Value::from_type(<PadTemplate as StaticType>::static_type());
            gobject_ffi::g_object_get_property(self.to_glib_none().0, "template".to_glib_none().0, value.to_glib_none_mut().0);
            value.get()
        }
    }

    fn set_property_template(&self, template: Option<&PadTemplate>) {
        unsafe {
            gobject_ffi::g_object_set_property(self.to_glib_none().0, "template".to_glib_none().0, Value::from(template).to_glib_none().0);
        }
    }

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

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

    fn connect_property_caps_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::caps",
                transmute(notify_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_direction_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::direction",
                transmute(notify_direction_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_offset_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::offset",
                transmute(notify_offset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }

    fn connect_property_template_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::template",
                transmute(notify_template_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
        }
    }
}

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

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

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

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

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

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