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
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use ges_sys;
use glib;
use glib::object::Cast;
use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib_sys;
use gst;
use std::boxed::Box as Box_;
use std::mem::transmute;
use std::ptr;
use Asset;
#[cfg(any(feature = "v1_18", feature = "dox"))]
use Clip;
use Extractable;
#[cfg(any(feature = "v1_18", feature = "dox"))]
use FrameNumber;
use Group;
use Layer;
use TimelineElement;
use Track;
use TrackElement;

glib_wrapper! {
    /// `Timeline` is the central object for any multimedia timeline.
    ///
    /// A timeline is composed of a set of `Track`-s and a set of
    /// `Layer`-s, which are added to the timeline using
    /// `TimelineExt::add_track` and `TimelineExt::append_layer`, respectively.
    ///
    /// The contained tracks define the supported types of the timeline
    /// and provide the media output. Essentially, each track provides an
    /// additional source `gst::Pad`.
    ///
    /// Most usage of a timeline will likely only need a single `AudioTrack`
    /// and/or a single `VideoTrack`. You can create such a timeline with
    /// `Timeline::new_audio_video`. After this, you are unlikely to need to
    /// work with the tracks directly.
    ///
    /// A timeline's layers contain `Clip`-s, which in turn control the
    /// creation of `TrackElement`-s, which are added to the timeline's
    /// tracks. See `Timeline::select-tracks-for-object` if you wish to have
    /// more control over which track a clip's elements are added to.
    ///
    /// The layers are ordered, with higher priority layers having their
    /// content prioritised in the tracks. This ordering can be changed using
    /// `TimelineExt::move_layer`.
    ///
    /// ## Editing
    ///
    /// See `TimelineElement` for the various ways the elements of a timeline
    /// can be edited.
    ///
    /// If you change the timing or ordering of a timeline's
    /// `TimelineElement`-s, then these changes will not actually be taken
    /// into account in the output of the timeline's tracks until the
    /// `TimelineExt::commit` method is called. This allows you to move its
    /// elements around, say, in response to an end user's mouse dragging, with
    /// little expense before finalising their effect on the produced data.
    ///
    /// ## Overlaps and Auto-Transitions
    ///
    /// There are certain restrictions placed on how `Source`-s may overlap
    /// in a `Track` that belongs to a timeline. These will be enforced by
    /// GES, so the user will not need to keep track of them, but they should
    /// be aware that certain edits will be refused as a result if the overlap
    /// rules would be broken.
    ///
    /// Consider two `Source`-s, `A` and `B`, with start times `startA` and
    /// `startB`, and end times `endA` and `endB`, respectively. The start
    /// time refers to their `TimelineElement:start`, and the end time is
    /// their `TimelineElement:start` + `TimelineElement:duration`. These
    /// two sources *overlap* if:
    ///
    /// + they share the same `TrackElement:track` (non `None`), which belongs
    ///  to the timeline;
    /// + they share the same `GES_TIMELINE_ELEMENT_LAYER_PRIORITY`; and
    /// + `startA < endB` and `startB < endA `.
    ///
    /// Note that when `startA = endB` or `startB = endA` then the two sources
    /// will *touch* at their edges, but are not considered overlapping.
    ///
    /// If, in addition, `startA < startB < endA`, then we can say that the
    /// end of `A` overlaps the start of `B`.
    ///
    /// If, instead, `startA <= startB` and `endA >= endB`, then we can say
    /// that `A` fully overlaps `B`.
    ///
    /// The overlap rules for a timeline are that:
    ///
    /// 1. One source cannot fully overlap another source.
    /// 2. A source can only overlap the end of up to one other source at its
    ///  start.
    /// 3. A source can only overlap the start of up to one other source at its
    ///  end.
    ///
    /// The last two rules combined essentially mean that at any given timeline
    /// position, only up to two `Source`-s may overlap at that position. So
    /// triple or more overlaps are not allowed.
    ///
    /// If you switch on `Timeline:auto-transition`, then at any moment when
    /// the end of one source (the first source) overlaps the start of another
    /// (the second source), a `TransitionClip` will be automatically created
    /// for the pair in the same layer and it will cover their overlap. If the
    /// two elements are edited in a way such that the end of the first source
    /// no longer overlaps the start of the second, the transition will be
    /// automatically removed from the timeline. However, if the two sources
    /// still overlap at the same edges after the edit, then the same
    /// transition object will be kept, but with its timing and layer adjusted
    /// accordingly.
    ///
    /// ## Saving
    ///
    /// To save/load a timeline, you can use the `TimelineExt::load_from_uri`
    /// and `TimelineExt::save_to_uri` methods that use the default format.
    ///
    /// ## Playing
    ///
    /// A timeline is a `gst::Bin` with a source `gst::Pad` for each of its
    /// tracks, which you can fetch with `TimelineExt::get_pad_for_track`. You
    /// will likely want to link these to some compatible sink `gst::Element`-s to
    /// be able to play or capture the content of the timeline.
    ///
    /// You can use a `Pipeline` to easily preview/play the timeline's
    /// content, or render it to a file.
    ///
    /// # Implements
    ///
    /// [`TimelineExt`](trait.TimelineExt.html), [`gst::ElementExt`](../gst/trait.ElementExt.html), [`gst::ObjectExt`](../gst/trait.ObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`ExtractableExt`](trait.ExtractableExt.html)
    pub struct Timeline(Object<ges_sys::GESTimeline, ges_sys::GESTimelineClass, TimelineClass>) @extends gst::Element, gst::Object, @implements Extractable;

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

impl Timeline {
    /// Creates a new empty timeline.
    ///
    /// # Returns
    ///
    /// The new timeline.
    pub fn new() -> Timeline {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ges_sys::ges_timeline_new()) }
    }

    /// Creates a new timeline containing a single `AudioTrack` and a
    /// single `VideoTrack`.
    ///
    /// # Returns
    ///
    /// The new timeline, or `None` if the tracks
    /// could not be created and added.
    pub fn new_audio_video() -> Timeline {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ges_sys::ges_timeline_new_audio_video()) }
    }

    pub fn from_uri(uri: &str) -> Result<Option<Timeline>, glib::Error> {
        assert_initialized_main_thread!();
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ges_sys::ges_timeline_new_from_uri(uri.to_glib_none().0, &mut error);
            if error.is_null() {
                Ok(from_glib_none(ret))
            } else {
                Err(from_glib_full(error))
            }
        }
    }
}

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

pub const NONE_TIMELINE: Option<&Timeline> = None;

/// Trait containing all `Timeline` methods.
///
/// # Implementors
///
/// [`Timeline`](struct.Timeline.html)
pub trait TimelineExt: 'static {
    /// Add a layer to the timeline.
    ///
    /// If the layer contains `Clip`-s, then this may trigger the creation of
    /// their core track element children for the timeline's tracks, and the
    /// placement of the clip's children in the tracks of the timeline using
    /// `Timeline::select-tracks-for-object`. Some errors may occur if this
    /// would break one of the configuration rules of the timeline in one of
    /// its tracks. In such cases, some track elements would fail to be added
    /// to their tracks, but this method would still return `true`. As such, it
    /// is advised that you only add clips to layers that already part of a
    /// timeline. In such situations, `LayerExt::add_clip` is able to fail if
    /// adding the clip would cause such an error.
    ///
    /// # Deprecated since 1.18
    ///
    /// This method requires you to ensure the layer's
    /// `Layer:priority` will be unique to the timeline. Use
    /// `TimelineExt::append_layer` and `TimelineExt::move_layer` instead.
    /// ## `layer`
    /// The layer to add
    ///
    /// # Returns
    ///
    /// `true` if `layer` was properly added.
    #[cfg_attr(feature = "v1_18", deprecated)]
    fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError>;

    /// Add a track to the timeline.
    ///
    /// If the timeline already contains clips, then this may trigger the
    /// creation of their core track element children for the track, and the
    /// placement of the clip's children in the track of the timeline using
    /// `Timeline::select-tracks-for-object`. Some errors may occur if this
    /// would break one of the configuration rules for the timeline in the
    /// track. In such cases, some track elements would fail to be added to the
    /// track, but this method would still return `true`. As such, it is advised
    /// that you avoid adding tracks to timelines that already contain clips.
    /// ## `track`
    /// The track to add
    ///
    /// # Returns
    ///
    /// `true` if `track` was properly added.
    fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError>;

    /// Append a newly created layer to the timeline. The layer will
    /// be added at the lowest `Layer:priority` (numerically, the highest).
    ///
    /// # Returns
    ///
    /// The newly created layer.
    fn append_layer(&self) -> Layer;

    /// Commit all the pending changes of the clips contained in the
    /// timeline.
    ///
    /// When changes happen in a timeline, they are not immediately executed
    /// internally, in a way that effects the output data of the timeline. You
    /// should call this method when you are done with a set of changes and you
    /// want them to be executed.
    ///
    /// Any pending changes will be executed in the backend. The
    /// `Timeline::commited` signal will be emitted once this has completed.
    /// You should not try to change the state of the timeline, seek it or add
    /// tracks to it before receiving this signal. You can use
    /// `TimelineExt::commit_sync` if you do not want to perform other tasks in
    /// the mean time.
    ///
    /// Note that all the pending changes will automatically be executed when
    /// the timeline goes from `gst::State::Ready` to `gst::State::Paused`, which is
    /// usually triggered by a corresponding state changes in a containing
    /// `Pipeline`.
    ///
    /// # Returns
    ///
    /// `true` if pending changes were committed, or `false` if nothing
    /// needed to be committed.
    fn commit(&self) -> bool;

    /// Commit all the pending changes of the clips contained in the
    /// timeline and wait for the changes to complete.
    ///
    /// See `TimelineExt::commit`.
    ///
    /// # Returns
    ///
    /// `true` if pending changes were committed, or `false` if nothing
    /// needed to be committed.
    fn commit_sync(&self) -> bool;

    /// Gets `Timeline:auto-transition` for the timeline.
    ///
    /// # Returns
    ///
    /// The auto-transition of `self_`.
    fn get_auto_transition(&self) -> bool;

    /// Get the current `Timeline:duration` of the timeline
    ///
    /// # Returns
    ///
    /// The current duration of `self`.
    fn get_duration(&self) -> gst::ClockTime;

    /// Gets the element contained in the timeline with the given name.
    /// ## `name`
    /// The name of the element to find
    ///
    /// # Returns
    ///
    /// The timeline element in `self`
    /// with the given `name`, or `None` if it was not found.
    fn get_element(&self, name: &str) -> Option<TimelineElement>;

    /// This method allows you to convert a timeline `gst::ClockTime` into its
    /// corresponding `FrameNumber` in the timeline's output.
    ///
    /// Feature: `v1_18`
    ///
    /// ## `timestamp`
    /// The timestamp to get the corresponding frame number of
    ///
    /// # Returns
    ///
    /// The frame number `timestamp` corresponds to.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn get_frame_at(&self, timestamp: gst::ClockTime) -> FrameNumber;

    /// This method allows you to convert a timeline output frame number into a
    /// timeline `gst::ClockTime`. For example, this time could be used to seek to a
    /// particular frame in the timeline's output, or as the edit position for
    /// an element within the timeline.
    ///
    /// Feature: `v1_18`
    ///
    /// ## `frame_number`
    /// The frame number to get the corresponding timestamp of in the
    ///  timeline coordinates
    ///
    /// # Returns
    ///
    /// The timestamp corresponding to `frame_number` in the output of `self`.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn get_frame_time(&self, frame_number: FrameNumber) -> gst::ClockTime;

    /// Get the list of `Group`-s present in the timeline.
    ///
    /// # Returns
    ///
    /// The list of
    /// groups that contain clips present in `self`'s layers.
    /// Must not be changed.
    fn get_groups(&self) -> Vec<Group>;

    /// Retrieve the layer whose index in the timeline matches the given
    /// priority.
    /// ## `priority`
    /// The priority/index of the layer to find
    ///
    /// # Returns
    ///
    /// The layer with the given
    /// `priority`, or `None` if none was found.
    ///
    /// Since 1.6
    fn get_layer(&self, priority: u32) -> Option<Layer>;

    /// Get the list of `Layer`-s present in the timeline.
    ///
    /// # Returns
    ///
    /// The list of
    /// layers present in `self` sorted by priority.
    fn get_layers(&self) -> Vec<Layer>;

    /// Search for the `gst::Pad` corresponding to the given timeline's track.
    /// You can link to this pad to receive the output data of the given track.
    /// ## `track`
    /// A track
    ///
    /// # Returns
    ///
    /// The pad corresponding to `track`,
    /// or `None` if there is an error.
    fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad>;

    /// Gets the `Timeline:snapping-distance` for the timeline.
    ///
    /// # Returns
    ///
    /// The snapping distance (in nanoseconds) of `self`.
    fn get_snapping_distance(&self) -> gst::ClockTime;

    /// Search for the `Track` corresponding to the given timeline's pad.
    /// ## `pad`
    /// A pad
    ///
    /// # Returns
    ///
    /// The track corresponding to `pad`,
    /// or `None` if there is an error.
    fn get_track_for_pad<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track>;

    /// Get the list of `Track`-s used by the timeline.
    ///
    /// # Returns
    ///
    /// The list of tracks
    /// used by `self`.
    fn get_tracks(&self) -> Vec<Track>;

    /// Check whether the timeline is empty or not.
    ///
    /// # Returns
    ///
    /// `true` if `self` is empty.
    fn is_empty(&self) -> bool;

    /// Loads the contents of URI into the timeline.
    /// ## `uri`
    /// The URI to load from
    ///
    /// # Returns
    ///
    /// `true` if the timeline was loaded successfully from `uri`.
    fn load_from_uri(&self, uri: &str) -> Result<(), glib::Error>;

    /// Moves a layer within the timeline to the index given by
    /// `new_layer_priority`.
    /// An index of 0 corresponds to the layer with the highest priority in a
    /// timeline. If `new_layer_priority` is greater than the number of layers
    /// present in the timeline, it will become the lowest priority layer.
    ///
    /// Feature: `v1_16`
    ///
    /// ## `layer`
    /// A layer within `self`, whose priority should be changed
    /// ## `new_layer_priority`
    /// The new index for `layer`
    #[cfg(any(feature = "v1_16", feature = "dox"))]
    fn move_layer<P: IsA<Layer>>(
        &self,
        layer: &P,
        new_layer_priority: u32,
    ) -> Result<(), glib::error::BoolError>;

    /// Paste an element inside the timeline. `element` **must** be the return of
    /// `TimelineElementExt::copy` with `deep=TRUE`,
    /// and it should not be changed before pasting. `element` itself is not
    /// placed in the timeline, instead a new element is created, alike to the
    /// originally copied element. Note that the originally copied element must
    /// also lie within `self`, at both the point of copying and pasting.
    ///
    /// Pasting may fail if it would place the timeline in an unsupported
    /// configuration.
    ///
    /// After calling this function `element` should not be used. In particular,
    /// `element` can **not** be pasted again. Instead, you can copy the
    /// returned element and paste that copy (although, this is only possible
    /// if the paste was successful).
    ///
    /// See also `TimelineElementExt::paste`.
    /// ## `element`
    /// The element to paste
    /// ## `position`
    /// The position in the timeline `element` should be pasted to,
    /// i.e. the `TimelineElement:start` value for the pasted element.
    /// ## `layer_priority`
    /// The layer into which the element should be pasted.
    /// -1 means paste to the same layer from which `element` has been copied from
    ///
    /// # Returns
    ///
    /// The newly created element, or
    /// `None` if pasting fails.
    fn paste_element<P: IsA<TimelineElement>>(
        &self,
        element: &P,
        position: gst::ClockTime,
        layer_priority: i32,
    ) -> Option<TimelineElement>;

    /// Removes a layer from the timeline.
    /// ## `layer`
    /// The layer to remove
    ///
    /// # Returns
    ///
    /// `true` if `layer` was properly removed.
    fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError>;

    /// Remove a track from the timeline.
    /// ## `track`
    /// The track to remove
    ///
    /// # Returns
    ///
    /// `true` if `track` was properly removed.
    fn remove_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError>;

    /// Saves the timeline to the given location. If `formatter_asset` is `None`,
    /// the method will attempt to save in the same format the timeline was
    /// loaded from, before defaulting to the formatter with highest rank.
    /// ## `uri`
    /// The location to save to
    /// ## `formatter_asset`
    /// The formatter asset to use, or `None`
    /// ## `overwrite`
    /// `true` to overwrite file if it exists
    ///
    /// # Returns
    ///
    /// `true` if `self` was successfully saved to `uri`.
    fn save_to_uri<P: IsA<Asset>>(
        &self,
        uri: &str,
        formatter_asset: Option<&P>,
        overwrite: bool,
    ) -> Result<(), glib::Error>;

    /// Sets `Timeline:auto-transition` for the timeline. This will also set
    /// the corresponding `Layer:auto-transition` for all of the timeline's
    /// layers to the same value. See `LayerExt::set_auto_transition` if you
    /// wish to set the layer's `Layer:auto-transition` individually.
    /// ## `auto_transition`
    /// Whether transitions should be automatically added
    /// to `self`'s layers
    fn set_auto_transition(&self, auto_transition: bool);

    /// Sets `Timeline:snapping-distance` for the timeline. This new value
    /// will only effect future snappings and will not be used to snap the
    /// current element positions within the timeline.
    /// ## `snapping_distance`
    /// The snapping distance to use (in nanoseconds)
    fn set_snapping_distance(&self, snapping_distance: gst::ClockTime);

    /// This signal will be emitted once the changes initiated by
    /// `TimelineExt::commit` have been executed in the backend. Use
    /// `TimelineExt::commit_sync` if you do not want to have to connect
    /// to this signal.
    fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

    /// Will be emitted after the group is added to to the timeline. This can
    /// happen when grouping with `ges_container_group`, or by adding
    /// containers to a newly created group.
    ///
    /// Note that this should not be emitted whilst a timeline is being
    /// loaded from its `Project` asset. You should connect to the
    /// project's `Project::loaded` signal if you want to know which groups
    /// were created for the timeline.
    /// ## `group`
    /// The group that was added to `timeline`
    fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId;

    //fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;

    /// Will be emitted after the layer is added to the timeline.
    ///
    /// Note that this should not be emitted whilst a timeline is being
    /// loaded from its `Project` asset. You should connect to the
    /// project's `Project::loaded` signal if you want to know which
    /// layers were created for the timeline.
    /// ## `layer`
    /// The layer that was added to `timeline`
    fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId;

    /// Will be emitted after the layer is removed from the timeline.
    /// ## `layer`
    /// The layer that was removed from `timeline`
    fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId;

    /// Simplified version of `Timeline::select-tracks-for-object` which only
    /// allows `track_element` to be added to a single `Track`.
    ///
    /// Feature: `v1_18`
    ///
    /// ## `clip`
    /// The clip that `track_element` is being added to
    /// ## `track_element`
    /// The element being added
    ///
    /// # Returns
    ///
    /// A track to put `track_element` into, or `None` if
    /// it should be discarded.
    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn connect_select_element_track<F: Fn(&Self, &Clip, &TrackElement) -> Track + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    //fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;

    /// Will be emitted whenever a snapping event ends. After a snap event
    /// has started (see `Timeline::snapping-started`), it can later end
    /// because either another timeline edit has occurred (which may or may
    /// not have created a new snapping event), or because the timeline has
    /// been committed.
    /// ## `obj1`
    /// The first element that was snapping
    /// ## `obj2`
    /// The second element that was snapping
    /// ## `position`
    /// The position where the two objects were to be snapped to
    fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    /// Will be emitted whenever an element's movement invokes a snapping
    /// event during an edit (usually of one of its ancestors) because its
    /// start or end point lies within the `Timeline:snapping-distance` of
    /// another element's start or end point.
    ///
    /// See `EditMode` to see what can snap during an edit.
    ///
    /// Note that only up to one snapping-started signal will be emitted per
    /// element edit within a timeline.
    /// ## `obj1`
    /// The first element that is snapping
    /// ## `obj2`
    /// The second element that is snapping
    /// ## `position`
    /// The position where the two objects will snap to
    fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId;

    /// Will be emitted after the track is added to the timeline.
    ///
    /// Note that this should not be emitted whilst a timeline is being
    /// loaded from its `Project` asset. You should connect to the
    /// project's `Project::loaded` signal if you want to know which
    /// tracks were created for the timeline.
    /// ## `track`
    /// The track that was added to `timeline`
    fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId;

    /// Will be emitted after the track is removed from the timeline.
    /// ## `track`
    /// The track that was removed from `timeline`
    fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId;

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

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

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

impl<O: IsA<Timeline>> TimelineExt for O {
    fn add_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_timeline_add_layer(
                    self.as_ref().to_glib_none().0,
                    layer.as_ref().to_glib_none().0
                ),
                "Failed to add layer"
            )
        }
    }

    fn add_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_timeline_add_track(
                    self.as_ref().to_glib_none().0,
                    track.as_ref().to_glib_full()
                ),
                "Failed to add track"
            )
        }
    }

    fn append_layer(&self) -> Layer {
        unsafe {
            from_glib_none(ges_sys::ges_timeline_append_layer(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn commit(&self) -> bool {
        unsafe { from_glib(ges_sys::ges_timeline_commit(self.as_ref().to_glib_none().0)) }
    }

    fn commit_sync(&self) -> bool {
        unsafe {
            from_glib(ges_sys::ges_timeline_commit_sync(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_auto_transition(&self) -> bool {
        unsafe {
            from_glib(ges_sys::ges_timeline_get_auto_transition(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_duration(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ges_sys::ges_timeline_get_duration(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_element(&self, name: &str) -> Option<TimelineElement> {
        unsafe {
            from_glib_full(ges_sys::ges_timeline_get_element(
                self.as_ref().to_glib_none().0,
                name.to_glib_none().0,
            ))
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn get_frame_at(&self, timestamp: gst::ClockTime) -> FrameNumber {
        unsafe {
            ges_sys::ges_timeline_get_frame_at(self.as_ref().to_glib_none().0, timestamp.to_glib())
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn get_frame_time(&self, frame_number: FrameNumber) -> gst::ClockTime {
        unsafe {
            from_glib(ges_sys::ges_timeline_get_frame_time(
                self.as_ref().to_glib_none().0,
                frame_number,
            ))
        }
    }

    fn get_groups(&self) -> Vec<Group> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ges_sys::ges_timeline_get_groups(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_layer(&self, priority: u32) -> Option<Layer> {
        unsafe {
            from_glib_full(ges_sys::ges_timeline_get_layer(
                self.as_ref().to_glib_none().0,
                priority,
            ))
        }
    }

    fn get_layers(&self) -> Vec<Layer> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_layers(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad> {
        unsafe {
            from_glib_none(ges_sys::ges_timeline_get_pad_for_track(
                self.as_ref().to_glib_none().0,
                track.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_snapping_distance(&self) -> gst::ClockTime {
        unsafe {
            from_glib(ges_sys::ges_timeline_get_snapping_distance(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_track_for_pad<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track> {
        unsafe {
            from_glib_none(ges_sys::ges_timeline_get_track_for_pad(
                self.as_ref().to_glib_none().0,
                pad.as_ref().to_glib_none().0,
            ))
        }
    }

    fn get_tracks(&self) -> Vec<Track> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ges_sys::ges_timeline_get_tracks(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn is_empty(&self) -> bool {
        unsafe {
            from_glib(ges_sys::ges_timeline_is_empty(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn load_from_uri(&self, uri: &str) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = ges_sys::ges_timeline_load_from_uri(
                self.as_ref().to_glib_none().0,
                uri.to_glib_none().0,
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    #[cfg(any(feature = "v1_16", feature = "dox"))]
    fn move_layer<P: IsA<Layer>>(
        &self,
        layer: &P,
        new_layer_priority: u32,
    ) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_timeline_move_layer(
                    self.as_ref().to_glib_none().0,
                    layer.as_ref().to_glib_none().0,
                    new_layer_priority
                ),
                "Failed to move layer"
            )
        }
    }

    fn paste_element<P: IsA<TimelineElement>>(
        &self,
        element: &P,
        position: gst::ClockTime,
        layer_priority: i32,
    ) -> Option<TimelineElement> {
        unsafe {
            from_glib_full(ges_sys::ges_timeline_paste_element(
                self.as_ref().to_glib_none().0,
                element.as_ref().to_glib_none().0,
                position.to_glib(),
                layer_priority,
            ))
        }
    }

    fn remove_layer<P: IsA<Layer>>(&self, layer: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_timeline_remove_layer(
                    self.as_ref().to_glib_none().0,
                    layer.as_ref().to_glib_none().0
                ),
                "Failed to remove layer"
            )
        }
    }

    fn remove_track<P: IsA<Track>>(&self, track: &P) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib_result_from_gboolean!(
                ges_sys::ges_timeline_remove_track(
                    self.as_ref().to_glib_none().0,
                    track.as_ref().to_glib_none().0
                ),
                "Failed to remove track"
            )
        }
    }

    fn save_to_uri<P: IsA<Asset>>(
        &self,
        uri: &str,
        formatter_asset: Option<&P>,
        overwrite: bool,
    ) -> Result<(), glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let _ = ges_sys::ges_timeline_save_to_uri(
                self.as_ref().to_glib_none().0,
                uri.to_glib_none().0,
                formatter_asset.map(|p| p.as_ref()).to_glib_none().0,
                overwrite.to_glib(),
                &mut error,
            );
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    fn set_auto_transition(&self, auto_transition: bool) {
        unsafe {
            ges_sys::ges_timeline_set_auto_transition(
                self.as_ref().to_glib_none().0,
                auto_transition.to_glib(),
            );
        }
    }

    fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) {
        unsafe {
            ges_sys::ges_timeline_set_snapping_distance(
                self.as_ref().to_glib_none().0,
                snapping_distance.to_glib(),
            );
        }
    }

    fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn commited_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESTimeline,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Timeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"commited\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    commited_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn group_added_trampoline<P, F: Fn(&P, &Group) + 'static>(
            this: *mut ges_sys::GESTimeline,
            group: *mut ges_sys::GESGroup,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(group),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"group-added\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    group_added_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Empty ctype children: *.PtrArray TypeId { ns_id: 1, id: 54 }
    //}

    fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn layer_added_trampoline<P, F: Fn(&P, &Layer) + 'static>(
            this: *mut ges_sys::GESTimeline,
            layer: *mut ges_sys::GESLayer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(layer),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"layer-added\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    layer_added_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn layer_removed_trampoline<P, F: Fn(&P, &Layer) + 'static>(
            this: *mut ges_sys::GESTimeline,
            layer: *mut ges_sys::GESLayer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(layer),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"layer-removed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    layer_removed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[cfg(any(feature = "v1_18", feature = "dox"))]
    fn connect_select_element_track<F: Fn(&Self, &Clip, &TrackElement) -> Track + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn select_element_track_trampoline<
            P,
            F: Fn(&P, &Clip, &TrackElement) -> Track + 'static,
        >(
            this: *mut ges_sys::GESTimeline,
            clip: *mut ges_sys::GESClip,
            track_element: *mut ges_sys::GESTrackElement,
            f: glib_sys::gpointer,
        ) -> *mut ges_sys::GESTrack
        where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(clip),
                &from_glib_borrow(track_element),
            )
            .to_glib_full()
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"select-element-track\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    select_element_track_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    //fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
    //    Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 17 }
    //}

    fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn snapping_ended_trampoline<
            P,
            F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
        >(
            this: *mut ges_sys::GESTimeline,
            obj1: *mut ges_sys::GESTrackElement,
            obj2: *mut ges_sys::GESTrackElement,
            position: u64,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(obj1),
                &from_glib_borrow(obj2),
                position,
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"snapping-ended\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    snapping_ended_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn snapping_started_trampoline<
            P,
            F: Fn(&P, &TrackElement, &TrackElement, u64) + 'static,
        >(
            this: *mut ges_sys::GESTimeline,
            obj1: *mut ges_sys::GESTrackElement,
            obj2: *mut ges_sys::GESTrackElement,
            position: u64,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(obj1),
                &from_glib_borrow(obj2),
                position,
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"snapping-started\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    snapping_started_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn track_added_trampoline<P, F: Fn(&P, &Track) + 'static>(
            this: *mut ges_sys::GESTimeline,
            track: *mut ges_sys::GESTrack,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(track),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"track-added\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    track_added_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn track_removed_trampoline<P, F: Fn(&P, &Track) + 'static>(
            this: *mut ges_sys::GESTimeline,
            track: *mut ges_sys::GESTrack,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(
                &Timeline::from_glib_borrow(this).unsafe_cast_ref(),
                &from_glib_borrow(track),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"track-removed\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    track_removed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_auto_transition_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESTimeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Timeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::auto-transition\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_auto_transition_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

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

    fn connect_property_snapping_distance_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_snapping_distance_trampoline<P, F: Fn(&P) + 'static>(
            this: *mut ges_sys::GESTimeline,
            _param_spec: glib_sys::gpointer,
            f: glib_sys::gpointer,
        ) where
            P: IsA<Timeline>,
        {
            let f: &F = &*(f as *const F);
            f(&Timeline::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::snapping-distance\0".as_ptr() as *const _,
                Some(transmute::<_, unsafe extern "C" fn()>(
                    notify_snapping_distance_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}