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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
use crate::MarkerList;
use crate::{ffi, MetaFlag};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    /// A [`glib::Object`][crate::glib::Object] that implements [`MetaContainer`][crate::MetaContainer] can have metadata set on
    /// it, that is data that is unimportant to its function within GES, but
    /// may hold some useful information. In particular,
    /// [`MetaContainerExt::set_meta()`][crate::prelude::MetaContainerExt::set_meta()] can be used to store any [`glib::Value`][crate::glib::Value] under
    /// any generic field (specified by a string key). The same method can also
    /// be used to remove the field by passing [`None`]. A number of convenience
    /// methods are also provided to make it easier to set common value types.
    /// The metadata can then be read with [`MetaContainerExt::meta()`][crate::prelude::MetaContainerExt::meta()] and
    /// similar convenience methods.
    ///
    /// ## Registered Fields
    ///
    /// By default, any [`glib::Value`][crate::glib::Value] can be set for a metadata field. However, you
    /// can register some fields as static, that is they only allow values of a
    /// specific type to be set under them, using
    /// [`MetaContainerExt::register_meta()`][crate::prelude::MetaContainerExt::register_meta()] or
    /// [`MetaContainerExt::register_static_meta()`][crate::prelude::MetaContainerExt::register_static_meta()]. The set [`MetaFlag`][crate::MetaFlag] will
    /// determine whether the value can be changed, but even if it can be
    /// changed, it must be changed to a value of the same type.
    ///
    /// Internally, some GES objects will be initialized with static metadata
    /// fields. These will correspond to some standard keys, such as
    /// `GES_META_VOLUME`.
    ///
    /// ## Signals
    ///
    ///
    /// #### `notify-meta`
    ///  This is emitted for a meta container whenever the metadata under one
    /// of its fields changes, is set for the first time, or is removed. In
    /// the latter case, `value` will be [`None`].
    ///
    /// Detailed
    ///
    /// # Implements
    ///
    /// [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
    #[doc(alias = "GESMetaContainer")]
    pub struct MetaContainer(Interface<ffi::GESMetaContainer, ffi::GESMetaContainerInterface>);

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

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

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::MetaContainer>> Sealed for T {}
}

/// Trait containing all [`struct@MetaContainer`] methods.
///
/// # Implementors
///
/// [`Asset`][struct@crate::Asset], [`AudioSource`][struct@crate::AudioSource], [`AudioTestSource`][struct@crate::AudioTestSource], [`AudioTrack`][struct@crate::AudioTrack], [`AudioTransition`][struct@crate::AudioTransition], [`AudioUriSource`][struct@crate::AudioUriSource], [`BaseEffectClip`][struct@crate::BaseEffectClip], [`BaseEffect`][struct@crate::BaseEffect], [`BaseTransitionClip`][struct@crate::BaseTransitionClip], [`ClipAsset`][struct@crate::ClipAsset], [`Clip`][struct@crate::Clip], [`Container`][struct@crate::Container], [`EffectAsset`][struct@crate::EffectAsset], [`EffectClip`][struct@crate::EffectClip], [`Effect`][struct@crate::Effect], [`Group`][struct@crate::Group], [`ImageSource`][struct@crate::ImageSource], [`Layer`][struct@crate::Layer], [`Marker`][struct@crate::Marker], [`MetaContainer`][struct@crate::MetaContainer], [`MultiFileSource`][struct@crate::MultiFileSource], [`OperationClip`][struct@crate::OperationClip], [`Operation`][struct@crate::Operation], [`OverlayClip`][struct@crate::OverlayClip], [`Project`][struct@crate::Project], [`SourceClipAsset`][struct@crate::SourceClipAsset], [`SourceClip`][struct@crate::SourceClip], [`Source`][struct@crate::Source], [`TestClip`][struct@crate::TestClip], [`TextOverlayClip`][struct@crate::TextOverlayClip], [`TextOverlay`][struct@crate::TextOverlay], [`TimelineElement`][struct@crate::TimelineElement], [`Timeline`][struct@crate::Timeline], [`TitleClip`][struct@crate::TitleClip], [`TitleSource`][struct@crate::TitleSource], [`TrackElementAsset`][struct@crate::TrackElementAsset], [`TrackElement`][struct@crate::TrackElement], [`Track`][struct@crate::Track], [`TransitionClip`][struct@crate::TransitionClip], [`Transition`][struct@crate::Transition], [`UriClipAsset`][struct@crate::UriClipAsset], [`UriClip`][struct@crate::UriClip], [`UriSourceAsset`][struct@crate::UriSourceAsset], [`VideoSource`][struct@crate::VideoSource], [`VideoTestSource`][struct@crate::VideoTestSource], [`VideoTrack`][struct@crate::VideoTrack], [`VideoTransition`][struct@crate::VideoTransition], [`VideoUriSource`][struct@crate::VideoUriSource]
pub trait MetaContainerExt: IsA<MetaContainer> + sealed::Sealed + 'static {
    /// Deserializes the given string, and adds and sets the found fields and
    /// their values on the container. The string should be the return of
    /// [`metas_to_string()`][Self::metas_to_string()].
    /// ## `str`
    /// A string to deserialize and add to `self`
    ///
    /// # Returns
    ///
    /// [`true`] if the fields in `str` was successfully deserialized
    /// and added to `self`.
    #[doc(alias = "ges_meta_container_add_metas_from_string")]
    fn add_metas_from_string(&self, str: &str) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_add_metas_from_string(
                self.as_ref().to_glib_none().0,
                str.to_glib_none().0,
            ))
        }
    }

    /// Checks whether the specified field has been registered as static, and
    /// gets the registered type and flags of the field, as used in
    /// [`register_meta()`][Self::register_meta()] and
    /// [`register_static_meta()`][Self::register_static_meta()].
    /// ## `meta_item`
    /// The key for the `self` field to check
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field has been registered on
    /// `self`.
    ///
    /// ## `flags`
    /// A destination to get the registered flags of
    /// the field, or [`None`] to ignore
    ///
    /// ## `type_`
    /// A destination to get the registered type of
    /// the field, or [`None`] to ignore
    #[doc(alias = "ges_meta_container_check_meta_registered")]
    fn check_meta_registered(&self, meta_item: &str) -> Option<(MetaFlag, glib::types::Type)> {
        unsafe {
            let mut flags = std::mem::MaybeUninit::uninit();
            let mut type_ = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_check_meta_registered(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                flags.as_mut_ptr(),
                type_.as_mut_ptr(),
            ));
            if ret {
                Some((
                    from_glib(flags.assume_init()),
                    from_glib(type_.assume_init()),
                ))
            } else {
                None
            }
        }
    }

    /// Calls the given function on each of the meta container's set metadata
    /// fields.
    /// ## `func`
    /// A function to call on each of `self`'s set
    /// metadata fields
    #[doc(alias = "ges_meta_container_foreach")]
    fn foreach<P: FnMut(&MetaContainer, &str, &glib::Value)>(&self, func: P) {
        let func_data: P = func;
        unsafe extern "C" fn func_func<P: FnMut(&MetaContainer, &str, &glib::Value)>(
            container: *const ffi::GESMetaContainer,
            key: *const libc::c_char,
            value: *const glib::gobject_ffi::GValue,
            user_data: glib::ffi::gpointer,
        ) {
            let container = from_glib_borrow(container);
            let key: Borrowed<glib::GString> = from_glib_borrow(key);
            let value = from_glib_borrow(value);
            let callback = user_data as *mut P;
            (*callback)(&container, key.as_str(), &value)
        }
        let func = Some(func_func::<P> as _);
        let super_callback0: &P = &func_data;
        unsafe {
            ffi::ges_meta_container_foreach(
                self.as_ref().to_glib_none().0,
                func,
                super_callback0 as *const _ as *mut _,
            );
        }
    }

    /// Gets the current boolean value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the boolean value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_boolean")]
    #[doc(alias = "get_boolean")]
    fn boolean(&self, meta_item: &str) -> Option<bool> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_boolean(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(from_glib(dest.assume_init()))
            } else {
                None
            }
        }
    }

    /// Gets the current date value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the date value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_date")]
    #[doc(alias = "get_date")]
    fn date(&self, meta_item: &str) -> Option<glib::Date> {
        unsafe {
            let mut dest = std::ptr::null_mut();
            let ret = from_glib(ffi::ges_meta_container_get_date(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                &mut dest,
            ));
            if ret {
                Some(from_glib_full(dest))
            } else {
                None
            }
        }
    }

    /// Gets the current date time value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the date time value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_date_time")]
    #[doc(alias = "get_date_time")]
    fn date_time(&self, meta_item: &str) -> Option<gst::DateTime> {
        unsafe {
            let mut dest = std::ptr::null_mut();
            let ret = from_glib(ffi::ges_meta_container_get_date_time(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                &mut dest,
            ));
            if ret {
                Some(from_glib_full(dest))
            } else {
                None
            }
        }
    }

    /// Gets the current double value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the double value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_double")]
    #[doc(alias = "get_double")]
    fn double(&self, meta_item: &str) -> Option<f64> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_double(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Gets the current float value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the float value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_float")]
    #[doc(alias = "get_float")]
    fn float(&self, meta_item: &str) -> Option<f32> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_float(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Gets the current int value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the int value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_int")]
    #[doc(alias = "get_int")]
    fn int(&self, meta_item: &str) -> Option<i32> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_int(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Gets the current int64 value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the int64 value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_int64")]
    #[doc(alias = "get_int64")]
    fn int64(&self, meta_item: &str) -> Option<i64> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_int64(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Gets the current marker list value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `key`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// A copy of the marker list value under `key`,
    /// or [`None`] if it could not be fetched.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "ges_meta_container_get_marker_list")]
    #[doc(alias = "get_marker_list")]
    fn marker_list(&self, key: &str) -> Option<MarkerList> {
        unsafe {
            from_glib_full(ffi::ges_meta_container_get_marker_list(
                self.as_ref().to_glib_none().0,
                key.to_glib_none().0,
            ))
        }
    }

    /// Gets the current value of the specified field of the meta container.
    /// ## `key`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// The value under `key`, or [`None`] if `self`
    /// does not have the field set.
    #[doc(alias = "ges_meta_container_get_meta")]
    #[doc(alias = "get_meta")]
    fn meta(&self, key: &str) -> Option<glib::Value> {
        unsafe {
            from_glib_none(ffi::ges_meta_container_get_meta(
                self.as_ref().to_glib_none().0,
                key.to_glib_none().0,
            ))
        }
    }

    /// Gets the current string value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// The string value under `meta_item`, or [`None`]
    /// if it could not be fetched.
    #[doc(alias = "ges_meta_container_get_string")]
    #[doc(alias = "get_string")]
    fn string(&self, meta_item: &str) -> Option<glib::GString> {
        unsafe {
            from_glib_none(ffi::ges_meta_container_get_string(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
            ))
        }
    }

    /// Gets the current uint value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the uint value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_uint")]
    #[doc(alias = "get_uint")]
    fn uint(&self, meta_item: &str) -> Option<u32> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_uint(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Gets the current uint64 value of the specified field of the meta
    /// container. If the field does not have a set value, or it is of the
    /// wrong type, the method will fail.
    /// ## `meta_item`
    /// The key for the `self` field to get
    ///
    /// # Returns
    ///
    /// [`true`] if the uint64 value under `meta_item` was copied
    /// to `dest`.
    ///
    /// ## `dest`
    /// Destination into which the value under `meta_item`
    /// should be copied.
    #[doc(alias = "ges_meta_container_get_uint64")]
    #[doc(alias = "get_uint64")]
    fn uint64(&self, meta_item: &str) -> Option<u64> {
        unsafe {
            let mut dest = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::ges_meta_container_get_uint64(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                dest.as_mut_ptr(),
            ));
            if ret {
                Some(dest.assume_init())
            } else {
                None
            }
        }
    }

    /// Serializes the set metadata fields of the meta container to a string.
    ///
    /// # Returns
    ///
    /// A serialized `self`.
    #[doc(alias = "ges_meta_container_metas_to_string")]
    fn metas_to_string(&self) -> glib::GString {
        unsafe {
            from_glib_full(ffi::ges_meta_container_metas_to_string(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given value, and registers the field to only hold a value of the
    /// same type. After calling this, only values of the same type as `value`
    /// can be set for this field. The given flags can be set to make this
    /// field only readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold `value` types, with the given `flags`, and the
    /// field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta")]
    fn register_meta(&self, flags: MetaFlag, meta_item: &str, value: &glib::Value) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given boolean value, and registers the field to only hold a boolean
    /// typed value. After calling this, only boolean values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold boolean typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_boolean")]
    fn register_meta_boolean(&self, flags: MetaFlag, meta_item: &str, value: bool) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_boolean(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value.into_glib(),
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given date value, and registers the field to only hold a date
    /// typed value. After calling this, only date values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold date typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_date")]
    fn register_meta_date(&self, flags: MetaFlag, meta_item: &str, value: &glib::Date) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_date(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given date time value, and registers the field to only hold a date time
    /// typed value. After calling this, only date time values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold date time typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_date_time")]
    fn register_meta_date_time(
        &self,
        flags: MetaFlag,
        meta_item: &str,
        value: &gst::DateTime,
    ) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_date_time(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given double value, and registers the field to only hold a double
    /// typed value. After calling this, only double values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold double typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_double")]
    fn register_meta_double(&self, flags: MetaFlag, meta_item: &str, value: f64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_double(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given float value, and registers the field to only hold a float
    /// typed value. After calling this, only float values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold float typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_float")]
    fn register_meta_float(&self, flags: MetaFlag, meta_item: &str, value: f32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_float(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given int value, and registers the field to only hold an int
    /// typed value. After calling this, only int values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold int typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_int")]
    fn register_meta_int(&self, flags: MetaFlag, meta_item: &str, value: i32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_int(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given int64 value, and registers the field to only hold an int64
    /// typed value. After calling this, only int64 values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold int64 typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_int64")]
    fn register_meta_int64(&self, flags: MetaFlag, meta_item: &str, value: i64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_int64(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given string value, and registers the field to only hold a string
    /// typed value. After calling this, only string values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold string typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_string")]
    fn register_meta_string(&self, flags: MetaFlag, meta_item: &str, value: &str) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_string(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given uint value, and registers the field to only hold a uint
    /// typed value. After calling this, only uint values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold uint typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_uint")]
    fn register_meta_uint(&self, flags: MetaFlag, meta_item: &str, value: u32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_uint(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given uint64 value, and registers the field to only hold a uint64
    /// typed value. After calling this, only uint64 values can be set for
    /// this field. The given flags can be set to make this field only
    /// readable after calling this method.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `value`
    /// The value to set for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold uint64 typed values, with the given `flags`,
    /// and the field was successfully set to `value`.
    #[doc(alias = "ges_meta_container_register_meta_uint64")]
    fn register_meta_uint64(&self, flags: MetaFlag, meta_item: &str, value: u64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_meta_uint64(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Registers a static metadata field on the container to only hold the
    /// specified type. After calling this, setting a value under this field
    /// can only succeed if its type matches the registered type of the field.
    ///
    /// Unlike [`register_meta()`][Self::register_meta()], no (initial) value is set
    /// for this field, which means you can use this method to reserve the
    /// space to be _optionally_ set later.
    ///
    /// Note that if a value has already been set for the field being
    /// registered, then its type must match the registering type, and its
    /// value will be left in place. If the field has no set value, then
    /// you will likely want to include [`MetaFlag::WRITABLE`][crate::MetaFlag::WRITABLE] in `flags` to allow
    /// the value to be set later.
    /// ## `flags`
    /// Flags to be used for the registered field
    /// ## `meta_item`
    /// The key for the `self` field to register
    /// ## `type_`
    /// The required value type for the registered field
    ///
    /// # Returns
    ///
    /// [`true`] if the `meta_item` field was successfully registered on
    /// `self` to only hold `type_` values, with the given `flags`.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "ges_meta_container_register_static_meta")]
    fn register_static_meta(
        &self,
        flags: MetaFlag,
        meta_item: &str,
        type_: glib::types::Type,
    ) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_register_static_meta(
                self.as_ref().to_glib_none().0,
                flags.into_glib(),
                meta_item.to_glib_none().0,
                type_.into_glib(),
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given boolean value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_boolean")]
    fn set_boolean(&self, meta_item: &str, value: bool) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_boolean(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value.into_glib(),
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given date value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_date")]
    fn set_date(&self, meta_item: &str, value: &glib::Date) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_date(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given date time value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_date_time")]
    fn set_date_time(&self, meta_item: &str, value: &gst::DateTime) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_date_time(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given double value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_double")]
    fn set_double(&self, meta_item: &str, value: f64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_double(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given float value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_float")]
    fn set_float(&self, meta_item: &str, value: f32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_float(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given int value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_int")]
    fn set_int(&self, meta_item: &str, value: i32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_int(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given int64 value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_int64")]
    fn set_int64(&self, meta_item: &str, value: i64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_int64(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given marker list value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `list`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[cfg(feature = "v1_18")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
    #[doc(alias = "ges_meta_container_set_marker_list")]
    fn set_marker_list(&self, meta_item: &str, list: &MarkerList) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_marker_list(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                list.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to a
    /// copy of the given value. If the given `value` is [`None`], the field
    /// given by `meta_item` is removed and [`true`] is returned.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`, or [`None`] to
    /// remove the corresponding field
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_meta")]
    fn set_meta(&self, meta_item: &str, value: Option<&glib::Value>) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_meta(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given string value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_string")]
    fn set_string(&self, meta_item: &str, value: &str) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_string(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value.to_glib_none().0,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given uint value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_uint")]
    fn set_uint(&self, meta_item: &str, value: u32) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_uint(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// Sets the value of the specified field of the meta container to the
    /// given uint64 value.
    /// ## `meta_item`
    /// The key for the `self` field to set
    /// ## `value`
    /// The value to set under `meta_item`
    ///
    /// # Returns
    ///
    /// [`true`] if `value` was set under `meta_item` for `self`.
    #[doc(alias = "ges_meta_container_set_uint64")]
    fn set_uint64(&self, meta_item: &str, value: u64) -> bool {
        unsafe {
            from_glib(ffi::ges_meta_container_set_uint64(
                self.as_ref().to_glib_none().0,
                meta_item.to_glib_none().0,
                value,
            ))
        }
    }

    /// This is emitted for a meta container whenever the metadata under one
    /// of its fields changes, is set for the first time, or is removed. In
    /// the latter case, `value` will be [`None`].
    /// ## `key`
    /// The key for the `container` field that changed
    /// ## `value`
    /// The new value under `key`
    #[doc(alias = "notify-meta")]
    fn connect_notify_meta<F: Fn(&Self, &str, Option<&glib::Value>) + 'static>(
        &self,
        detail: Option<&str>,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_meta_trampoline<
            P: IsA<MetaContainer>,
            F: Fn(&P, &str, Option<&glib::Value>) + 'static,
        >(
            this: *mut ffi::GESMetaContainer,
            key: *mut libc::c_char,
            value: *mut glib::gobject_ffi::GValue,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                MetaContainer::from_glib_borrow(this).unsafe_cast_ref(),
                &glib::GString::from_glib_borrow(key),
                Option::<glib::Value>::from_glib_borrow(value)
                    .as_ref()
                    .as_ref(),
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            let detailed_signal_name = detail.map(|name| format!("notify-meta::{name}\0"));
            let signal_name: &[u8] = detailed_signal_name
                .as_ref()
                .map_or(&b"notify-meta\0"[..], |n| n.as_bytes());
            connect_raw(
                self.as_ptr() as *mut _,
                signal_name.as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_meta_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<MetaContainer>> MetaContainerExt for O {}