gstreamer_editing_services/auto/meta_container.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6#[cfg(feature = "v1_18")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
8use crate::MarkerList;
9use crate::{ffi, MetaFlag};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 /// A [`glib::Object`][crate::glib::Object] that implements [`MetaContainer`][crate::MetaContainer] can have metadata set on
20 /// it, that is data that is unimportant to its function within GES, but
21 /// may hold some useful information. In particular,
22 /// [`MetaContainerExt::set_meta()`][crate::prelude::MetaContainerExt::set_meta()] can be used to store any [`glib::Value`][crate::glib::Value] under
23 /// any generic field (specified by a string key). The same method can also
24 /// be used to remove the field by passing [`None`]. A number of convenience
25 /// methods are also provided to make it easier to set common value types.
26 /// The metadata can then be read with [`MetaContainerExt::meta()`][crate::prelude::MetaContainerExt::meta()] and
27 /// similar convenience methods.
28 ///
29 /// ## Registered Fields
30 ///
31 /// By default, any [`glib::Value`][crate::glib::Value] can be set for a metadata field. However, you
32 /// can register some fields as static, that is they only allow values of a
33 /// specific type to be set under them, using
34 /// [`MetaContainerExt::register_meta()`][crate::prelude::MetaContainerExt::register_meta()] or
35 /// [`MetaContainerExt::register_static_meta()`][crate::prelude::MetaContainerExt::register_static_meta()]. The set [`MetaFlag`][crate::MetaFlag] will
36 /// determine whether the value can be changed, but even if it can be
37 /// changed, it must be changed to a value of the same type.
38 ///
39 /// Internally, some GES objects will be initialized with static metadata
40 /// fields. These will correspond to some standard keys, such as
41 /// `GES_META_VOLUME`.
42 ///
43 /// ## Signals
44 ///
45 ///
46 /// #### `notify-meta`
47 /// This is emitted for a meta container whenever the metadata under one
48 /// of its fields changes, is set for the first time, or is removed. In
49 /// the latter case, `value` will be [`None`].
50 ///
51 /// Detailed
52 ///
53 /// # Implements
54 ///
55 /// [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt]
56 #[doc(alias = "GESMetaContainer")]
57 pub struct MetaContainer(Interface<ffi::GESMetaContainer, ffi::GESMetaContainerInterface>);
58
59 match fn {
60 type_ => || ffi::ges_meta_container_get_type(),
61 }
62}
63
64impl MetaContainer {
65 pub const NONE: Option<&'static MetaContainer> = None;
66}
67
68mod sealed {
69 pub trait Sealed {}
70 impl<T: super::IsA<super::MetaContainer>> Sealed for T {}
71}
72
73/// Trait containing all [`struct@MetaContainer`] methods.
74///
75/// # Implementors
76///
77/// [`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]
78pub trait MetaContainerExt: IsA<MetaContainer> + sealed::Sealed + 'static {
79 /// Deserializes the given string, and adds and sets the found fields and
80 /// their values on the container. The string should be the return of
81 /// [`metas_to_string()`][Self::metas_to_string()].
82 /// ## `str`
83 /// A string to deserialize and add to `self`
84 ///
85 /// # Returns
86 ///
87 /// [`true`] if the fields in `str` was successfully deserialized
88 /// and added to `self`.
89 #[doc(alias = "ges_meta_container_add_metas_from_string")]
90 fn add_metas_from_string(&self, str: &str) -> bool {
91 unsafe {
92 from_glib(ffi::ges_meta_container_add_metas_from_string(
93 self.as_ref().to_glib_none().0,
94 str.to_glib_none().0,
95 ))
96 }
97 }
98
99 /// Checks whether the specified field has been registered as static, and
100 /// gets the registered type and flags of the field, as used in
101 /// [`register_meta()`][Self::register_meta()] and
102 /// [`register_static_meta()`][Self::register_static_meta()].
103 /// ## `meta_item`
104 /// The key for the `self` field to check
105 ///
106 /// # Returns
107 ///
108 /// [`true`] if the `meta_item` field has been registered on
109 /// `self`.
110 ///
111 /// ## `flags`
112 /// A destination to get the registered flags of
113 /// the field, or [`None`] to ignore
114 ///
115 /// ## `type_`
116 /// A destination to get the registered type of
117 /// the field, or [`None`] to ignore
118 #[doc(alias = "ges_meta_container_check_meta_registered")]
119 fn check_meta_registered(&self, meta_item: &str) -> Option<(MetaFlag, glib::types::Type)> {
120 unsafe {
121 let mut flags = std::mem::MaybeUninit::uninit();
122 let mut type_ = std::mem::MaybeUninit::uninit();
123 let ret = from_glib(ffi::ges_meta_container_check_meta_registered(
124 self.as_ref().to_glib_none().0,
125 meta_item.to_glib_none().0,
126 flags.as_mut_ptr(),
127 type_.as_mut_ptr(),
128 ));
129 if ret {
130 Some((
131 from_glib(flags.assume_init()),
132 from_glib(type_.assume_init()),
133 ))
134 } else {
135 None
136 }
137 }
138 }
139
140 /// Calls the given function on each of the meta container's set metadata
141 /// fields.
142 /// ## `func`
143 /// A function to call on each of
144 /// `self`'s set metadata fields
145 #[doc(alias = "ges_meta_container_foreach")]
146 fn foreach<P: FnMut(&MetaContainer, &str, &glib::Value)>(&self, func: P) {
147 let mut func_data: P = func;
148 unsafe extern "C" fn func_func<P: FnMut(&MetaContainer, &str, &glib::Value)>(
149 container: *const ffi::GESMetaContainer,
150 key: *const std::ffi::c_char,
151 value: *const glib::gobject_ffi::GValue,
152 user_data: glib::ffi::gpointer,
153 ) {
154 let container = from_glib_borrow(container);
155 let key: Borrowed<glib::GString> = from_glib_borrow(key);
156 let value = from_glib_borrow(value);
157 let callback = user_data as *mut P;
158 (*callback)(&container, key.as_str(), &value)
159 }
160 let func = Some(func_func::<P> as _);
161 let super_callback0: &mut P = &mut func_data;
162 unsafe {
163 ffi::ges_meta_container_foreach(
164 self.as_ref().to_glib_none().0,
165 func,
166 super_callback0 as *mut _ as *mut _,
167 );
168 }
169 }
170
171 /// Gets the current boolean value of the specified field of the meta
172 /// container. If the field does not have a set value, or it is of the
173 /// wrong type, the method will fail.
174 /// ## `meta_item`
175 /// The key for the `self` field to get
176 ///
177 /// # Returns
178 ///
179 /// [`true`] if the boolean value under `meta_item` was copied
180 /// to `dest`.
181 ///
182 /// ## `dest`
183 /// Destination into which the value under `meta_item`
184 /// should be copied.
185 #[doc(alias = "ges_meta_container_get_boolean")]
186 #[doc(alias = "get_boolean")]
187 fn boolean(&self, meta_item: &str) -> Option<bool> {
188 unsafe {
189 let mut dest = std::mem::MaybeUninit::uninit();
190 let ret = from_glib(ffi::ges_meta_container_get_boolean(
191 self.as_ref().to_glib_none().0,
192 meta_item.to_glib_none().0,
193 dest.as_mut_ptr(),
194 ));
195 if ret {
196 Some(from_glib(dest.assume_init()))
197 } else {
198 None
199 }
200 }
201 }
202
203 /// Gets the current date value of the specified field of the meta
204 /// container. If the field does not have a set value, or it is of the
205 /// wrong type, the method will fail.
206 /// ## `meta_item`
207 /// The key for the `self` field to get
208 ///
209 /// # Returns
210 ///
211 /// [`true`] if the date value under `meta_item` was copied
212 /// to `dest`.
213 ///
214 /// ## `dest`
215 /// Destination into which the value under `meta_item`
216 /// should be copied.
217 #[doc(alias = "ges_meta_container_get_date")]
218 #[doc(alias = "get_date")]
219 fn date(&self, meta_item: &str) -> Option<glib::Date> {
220 unsafe {
221 let mut dest = std::ptr::null_mut();
222 let ret = from_glib(ffi::ges_meta_container_get_date(
223 self.as_ref().to_glib_none().0,
224 meta_item.to_glib_none().0,
225 &mut dest,
226 ));
227 if ret {
228 Some(from_glib_full(dest))
229 } else {
230 None
231 }
232 }
233 }
234
235 /// Gets the current date time value of the specified field of the meta
236 /// container. If the field does not have a set value, or it is of the
237 /// wrong type, the method will fail.
238 /// ## `meta_item`
239 /// The key for the `self` field to get
240 ///
241 /// # Returns
242 ///
243 /// [`true`] if the date time value under `meta_item` was copied
244 /// to `dest`.
245 ///
246 /// ## `dest`
247 /// Destination into which the value under `meta_item`
248 /// should be copied.
249 #[doc(alias = "ges_meta_container_get_date_time")]
250 #[doc(alias = "get_date_time")]
251 fn date_time(&self, meta_item: &str) -> Option<gst::DateTime> {
252 unsafe {
253 let mut dest = std::ptr::null_mut();
254 let ret = from_glib(ffi::ges_meta_container_get_date_time(
255 self.as_ref().to_glib_none().0,
256 meta_item.to_glib_none().0,
257 &mut dest,
258 ));
259 if ret {
260 Some(from_glib_full(dest))
261 } else {
262 None
263 }
264 }
265 }
266
267 /// Gets the current double value of the specified field of the meta
268 /// container. If the field does not have a set value, or it is of the
269 /// wrong type, the method will fail.
270 /// ## `meta_item`
271 /// The key for the `self` field to get
272 ///
273 /// # Returns
274 ///
275 /// [`true`] if the double value under `meta_item` was copied
276 /// to `dest`.
277 ///
278 /// ## `dest`
279 /// Destination into which the value under `meta_item`
280 /// should be copied.
281 #[doc(alias = "ges_meta_container_get_double")]
282 #[doc(alias = "get_double")]
283 fn double(&self, meta_item: &str) -> Option<f64> {
284 unsafe {
285 let mut dest = std::mem::MaybeUninit::uninit();
286 let ret = from_glib(ffi::ges_meta_container_get_double(
287 self.as_ref().to_glib_none().0,
288 meta_item.to_glib_none().0,
289 dest.as_mut_ptr(),
290 ));
291 if ret {
292 Some(dest.assume_init())
293 } else {
294 None
295 }
296 }
297 }
298
299 /// Gets the current float value of the specified field of the meta
300 /// container. If the field does not have a set value, or it is of the
301 /// wrong type, the method will fail.
302 /// ## `meta_item`
303 /// The key for the `self` field to get
304 ///
305 /// # Returns
306 ///
307 /// [`true`] if the float value under `meta_item` was copied
308 /// to `dest`.
309 ///
310 /// ## `dest`
311 /// Destination into which the value under `meta_item`
312 /// should be copied.
313 #[doc(alias = "ges_meta_container_get_float")]
314 #[doc(alias = "get_float")]
315 fn float(&self, meta_item: &str) -> Option<f32> {
316 unsafe {
317 let mut dest = std::mem::MaybeUninit::uninit();
318 let ret = from_glib(ffi::ges_meta_container_get_float(
319 self.as_ref().to_glib_none().0,
320 meta_item.to_glib_none().0,
321 dest.as_mut_ptr(),
322 ));
323 if ret {
324 Some(dest.assume_init())
325 } else {
326 None
327 }
328 }
329 }
330
331 /// Gets the current int value of the specified field of the meta
332 /// container. If the field does not have a set value, or it is of the
333 /// wrong type, the method will fail.
334 /// ## `meta_item`
335 /// The key for the `self` field to get
336 ///
337 /// # Returns
338 ///
339 /// [`true`] if the int value under `meta_item` was copied
340 /// to `dest`.
341 ///
342 /// ## `dest`
343 /// Destination into which the value under `meta_item`
344 /// should be copied.
345 #[doc(alias = "ges_meta_container_get_int")]
346 #[doc(alias = "get_int")]
347 fn int(&self, meta_item: &str) -> Option<i32> {
348 unsafe {
349 let mut dest = std::mem::MaybeUninit::uninit();
350 let ret = from_glib(ffi::ges_meta_container_get_int(
351 self.as_ref().to_glib_none().0,
352 meta_item.to_glib_none().0,
353 dest.as_mut_ptr(),
354 ));
355 if ret {
356 Some(dest.assume_init())
357 } else {
358 None
359 }
360 }
361 }
362
363 /// Gets the current int64 value of the specified field of the meta
364 /// container. If the field does not have a set value, or it is of the
365 /// wrong type, the method will fail.
366 /// ## `meta_item`
367 /// The key for the `self` field to get
368 ///
369 /// # Returns
370 ///
371 /// [`true`] if the int64 value under `meta_item` was copied
372 /// to `dest`.
373 ///
374 /// ## `dest`
375 /// Destination into which the value under `meta_item`
376 /// should be copied.
377 #[doc(alias = "ges_meta_container_get_int64")]
378 #[doc(alias = "get_int64")]
379 fn int64(&self, meta_item: &str) -> Option<i64> {
380 unsafe {
381 let mut dest = std::mem::MaybeUninit::uninit();
382 let ret = from_glib(ffi::ges_meta_container_get_int64(
383 self.as_ref().to_glib_none().0,
384 meta_item.to_glib_none().0,
385 dest.as_mut_ptr(),
386 ));
387 if ret {
388 Some(dest.assume_init())
389 } else {
390 None
391 }
392 }
393 }
394
395 /// Gets the current marker list value of the specified field of the meta
396 /// container. If the field does not have a set value, or it is of the
397 /// wrong type, the method will fail.
398 /// ## `key`
399 /// The key for the `self` field to get
400 ///
401 /// # Returns
402 ///
403 /// A copy of the marker list value under `key`,
404 /// or [`None`] if it could not be fetched.
405 #[cfg(feature = "v1_18")]
406 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
407 #[doc(alias = "ges_meta_container_get_marker_list")]
408 #[doc(alias = "get_marker_list")]
409 fn marker_list(&self, key: &str) -> Option<MarkerList> {
410 unsafe {
411 from_glib_full(ffi::ges_meta_container_get_marker_list(
412 self.as_ref().to_glib_none().0,
413 key.to_glib_none().0,
414 ))
415 }
416 }
417
418 /// Gets the current value of the specified field of the meta container.
419 /// ## `key`
420 /// The key for the `self` field to get
421 ///
422 /// # Returns
423 ///
424 /// The value under `key`, or [`None`] if `self`
425 /// does not have the field set.
426 #[doc(alias = "ges_meta_container_get_meta")]
427 #[doc(alias = "get_meta")]
428 fn meta(&self, key: &str) -> Option<glib::Value> {
429 unsafe {
430 from_glib_none(ffi::ges_meta_container_get_meta(
431 self.as_ref().to_glib_none().0,
432 key.to_glib_none().0,
433 ))
434 }
435 }
436
437 /// Gets the current string value of the specified field of the meta
438 /// container. If the field does not have a set value, or it is of the
439 /// wrong type, the method will fail.
440 /// ## `meta_item`
441 /// The key for the `self` field to get
442 ///
443 /// # Returns
444 ///
445 /// The string value under `meta_item`, or [`None`]
446 /// if it could not be fetched.
447 #[doc(alias = "ges_meta_container_get_string")]
448 #[doc(alias = "get_string")]
449 fn string(&self, meta_item: &str) -> Option<glib::GString> {
450 unsafe {
451 from_glib_none(ffi::ges_meta_container_get_string(
452 self.as_ref().to_glib_none().0,
453 meta_item.to_glib_none().0,
454 ))
455 }
456 }
457
458 /// Gets the current uint value of the specified field of the meta
459 /// container. If the field does not have a set value, or it is of the
460 /// wrong type, the method will fail.
461 /// ## `meta_item`
462 /// The key for the `self` field to get
463 ///
464 /// # Returns
465 ///
466 /// [`true`] if the uint value under `meta_item` was copied
467 /// to `dest`.
468 ///
469 /// ## `dest`
470 /// Destination into which the value under `meta_item`
471 /// should be copied.
472 #[doc(alias = "ges_meta_container_get_uint")]
473 #[doc(alias = "get_uint")]
474 fn uint(&self, meta_item: &str) -> Option<u32> {
475 unsafe {
476 let mut dest = std::mem::MaybeUninit::uninit();
477 let ret = from_glib(ffi::ges_meta_container_get_uint(
478 self.as_ref().to_glib_none().0,
479 meta_item.to_glib_none().0,
480 dest.as_mut_ptr(),
481 ));
482 if ret {
483 Some(dest.assume_init())
484 } else {
485 None
486 }
487 }
488 }
489
490 /// Gets the current uint64 value of the specified field of the meta
491 /// container. If the field does not have a set value, or it is of the
492 /// wrong type, the method will fail.
493 /// ## `meta_item`
494 /// The key for the `self` field to get
495 ///
496 /// # Returns
497 ///
498 /// [`true`] if the uint64 value under `meta_item` was copied
499 /// to `dest`.
500 ///
501 /// ## `dest`
502 /// Destination into which the value under `meta_item`
503 /// should be copied.
504 #[doc(alias = "ges_meta_container_get_uint64")]
505 #[doc(alias = "get_uint64")]
506 fn uint64(&self, meta_item: &str) -> Option<u64> {
507 unsafe {
508 let mut dest = std::mem::MaybeUninit::uninit();
509 let ret = from_glib(ffi::ges_meta_container_get_uint64(
510 self.as_ref().to_glib_none().0,
511 meta_item.to_glib_none().0,
512 dest.as_mut_ptr(),
513 ));
514 if ret {
515 Some(dest.assume_init())
516 } else {
517 None
518 }
519 }
520 }
521
522 /// Serializes the set metadata fields of the meta container to a string.
523 ///
524 /// # Returns
525 ///
526 /// A serialized `self`.
527 #[doc(alias = "ges_meta_container_metas_to_string")]
528 fn metas_to_string(&self) -> glib::GString {
529 unsafe {
530 from_glib_full(ffi::ges_meta_container_metas_to_string(
531 self.as_ref().to_glib_none().0,
532 ))
533 }
534 }
535
536 /// Sets the value of the specified field of the meta container to the
537 /// given value, and registers the field to only hold a value of the
538 /// same type. After calling this, only values of the same type as `value`
539 /// can be set for this field. The given flags can be set to make this
540 /// field only readable after calling this method.
541 /// ## `flags`
542 /// Flags to be used for the registered field
543 /// ## `meta_item`
544 /// The key for the `self` field to register
545 /// ## `value`
546 /// The value to set for the registered field
547 ///
548 /// # Returns
549 ///
550 /// [`true`] if the `meta_item` field was successfully registered on
551 /// `self` to only hold `value` types, with the given `flags`, and the
552 /// field was successfully set to `value`.
553 #[doc(alias = "ges_meta_container_register_meta")]
554 fn register_meta(&self, flags: MetaFlag, meta_item: &str, value: &glib::Value) -> bool {
555 unsafe {
556 from_glib(ffi::ges_meta_container_register_meta(
557 self.as_ref().to_glib_none().0,
558 flags.into_glib(),
559 meta_item.to_glib_none().0,
560 value.to_glib_none().0,
561 ))
562 }
563 }
564
565 /// Sets the value of the specified field of the meta container to the
566 /// given boolean value, and registers the field to only hold a boolean
567 /// typed value. After calling this, only boolean values can be set for
568 /// this field. The given flags can be set to make this field only
569 /// readable after calling this method.
570 /// ## `flags`
571 /// Flags to be used for the registered field
572 /// ## `meta_item`
573 /// The key for the `self` field to register
574 /// ## `value`
575 /// The value to set for the registered field
576 ///
577 /// # Returns
578 ///
579 /// [`true`] if the `meta_item` field was successfully registered on
580 /// `self` to only hold boolean typed values, with the given `flags`,
581 /// and the field was successfully set to `value`.
582 #[doc(alias = "ges_meta_container_register_meta_boolean")]
583 fn register_meta_boolean(&self, flags: MetaFlag, meta_item: &str, value: bool) -> bool {
584 unsafe {
585 from_glib(ffi::ges_meta_container_register_meta_boolean(
586 self.as_ref().to_glib_none().0,
587 flags.into_glib(),
588 meta_item.to_glib_none().0,
589 value.into_glib(),
590 ))
591 }
592 }
593
594 /// Sets the value of the specified field of the meta container to the
595 /// given date value, and registers the field to only hold a date
596 /// typed value. After calling this, only date values can be set for
597 /// this field. The given flags can be set to make this field only
598 /// readable after calling this method.
599 /// ## `flags`
600 /// Flags to be used for the registered field
601 /// ## `meta_item`
602 /// The key for the `self` field to register
603 /// ## `value`
604 /// The value to set for the registered field
605 ///
606 /// # Returns
607 ///
608 /// [`true`] if the `meta_item` field was successfully registered on
609 /// `self` to only hold date typed values, with the given `flags`,
610 /// and the field was successfully set to `value`.
611 #[doc(alias = "ges_meta_container_register_meta_date")]
612 fn register_meta_date(&self, flags: MetaFlag, meta_item: &str, value: &glib::Date) -> bool {
613 unsafe {
614 from_glib(ffi::ges_meta_container_register_meta_date(
615 self.as_ref().to_glib_none().0,
616 flags.into_glib(),
617 meta_item.to_glib_none().0,
618 value.to_glib_none().0,
619 ))
620 }
621 }
622
623 /// Sets the value of the specified field of the meta container to the
624 /// given date time value, and registers the field to only hold a date time
625 /// typed value. After calling this, only date time values can be set for
626 /// this field. The given flags can be set to make this field only
627 /// readable after calling this method.
628 /// ## `flags`
629 /// Flags to be used for the registered field
630 /// ## `meta_item`
631 /// The key for the `self` field to register
632 /// ## `value`
633 /// The value to set for the registered field
634 ///
635 /// # Returns
636 ///
637 /// [`true`] if the `meta_item` field was successfully registered on
638 /// `self` to only hold date time typed values, with the given `flags`,
639 /// and the field was successfully set to `value`.
640 #[doc(alias = "ges_meta_container_register_meta_date_time")]
641 fn register_meta_date_time(
642 &self,
643 flags: MetaFlag,
644 meta_item: &str,
645 value: &gst::DateTime,
646 ) -> bool {
647 unsafe {
648 from_glib(ffi::ges_meta_container_register_meta_date_time(
649 self.as_ref().to_glib_none().0,
650 flags.into_glib(),
651 meta_item.to_glib_none().0,
652 value.to_glib_none().0,
653 ))
654 }
655 }
656
657 /// Sets the value of the specified field of the meta container to the
658 /// given double value, and registers the field to only hold a double
659 /// typed value. After calling this, only double values can be set for
660 /// this field. The given flags can be set to make this field only
661 /// readable after calling this method.
662 /// ## `flags`
663 /// Flags to be used for the registered field
664 /// ## `meta_item`
665 /// The key for the `self` field to register
666 /// ## `value`
667 /// The value to set for the registered field
668 ///
669 /// # Returns
670 ///
671 /// [`true`] if the `meta_item` field was successfully registered on
672 /// `self` to only hold double typed values, with the given `flags`,
673 /// and the field was successfully set to `value`.
674 #[doc(alias = "ges_meta_container_register_meta_double")]
675 fn register_meta_double(&self, flags: MetaFlag, meta_item: &str, value: f64) -> bool {
676 unsafe {
677 from_glib(ffi::ges_meta_container_register_meta_double(
678 self.as_ref().to_glib_none().0,
679 flags.into_glib(),
680 meta_item.to_glib_none().0,
681 value,
682 ))
683 }
684 }
685
686 /// Sets the value of the specified field of the meta container to the
687 /// given float value, and registers the field to only hold a float
688 /// typed value. After calling this, only float values can be set for
689 /// this field. The given flags can be set to make this field only
690 /// readable after calling this method.
691 /// ## `flags`
692 /// Flags to be used for the registered field
693 /// ## `meta_item`
694 /// The key for the `self` field to register
695 /// ## `value`
696 /// The value to set for the registered field
697 ///
698 /// # Returns
699 ///
700 /// [`true`] if the `meta_item` field was successfully registered on
701 /// `self` to only hold float typed values, with the given `flags`,
702 /// and the field was successfully set to `value`.
703 #[doc(alias = "ges_meta_container_register_meta_float")]
704 fn register_meta_float(&self, flags: MetaFlag, meta_item: &str, value: f32) -> bool {
705 unsafe {
706 from_glib(ffi::ges_meta_container_register_meta_float(
707 self.as_ref().to_glib_none().0,
708 flags.into_glib(),
709 meta_item.to_glib_none().0,
710 value,
711 ))
712 }
713 }
714
715 /// Sets the value of the specified field of the meta container to the
716 /// given int value, and registers the field to only hold an int
717 /// typed value. After calling this, only int values can be set for
718 /// this field. The given flags can be set to make this field only
719 /// readable after calling this method.
720 /// ## `flags`
721 /// Flags to be used for the registered field
722 /// ## `meta_item`
723 /// The key for the `self` field to register
724 /// ## `value`
725 /// The value to set for the registered field
726 ///
727 /// # Returns
728 ///
729 /// [`true`] if the `meta_item` field was successfully registered on
730 /// `self` to only hold int typed values, with the given `flags`,
731 /// and the field was successfully set to `value`.
732 #[doc(alias = "ges_meta_container_register_meta_int")]
733 fn register_meta_int(&self, flags: MetaFlag, meta_item: &str, value: i32) -> bool {
734 unsafe {
735 from_glib(ffi::ges_meta_container_register_meta_int(
736 self.as_ref().to_glib_none().0,
737 flags.into_glib(),
738 meta_item.to_glib_none().0,
739 value,
740 ))
741 }
742 }
743
744 /// Sets the value of the specified field of the meta container to the
745 /// given int64 value, and registers the field to only hold an int64
746 /// typed value. After calling this, only int64 values can be set for
747 /// this field. The given flags can be set to make this field only
748 /// readable after calling this method.
749 /// ## `flags`
750 /// Flags to be used for the registered field
751 /// ## `meta_item`
752 /// The key for the `self` field to register
753 /// ## `value`
754 /// The value to set for the registered field
755 ///
756 /// # Returns
757 ///
758 /// [`true`] if the `meta_item` field was successfully registered on
759 /// `self` to only hold int64 typed values, with the given `flags`,
760 /// and the field was successfully set to `value`.
761 #[doc(alias = "ges_meta_container_register_meta_int64")]
762 fn register_meta_int64(&self, flags: MetaFlag, meta_item: &str, value: i64) -> bool {
763 unsafe {
764 from_glib(ffi::ges_meta_container_register_meta_int64(
765 self.as_ref().to_glib_none().0,
766 flags.into_glib(),
767 meta_item.to_glib_none().0,
768 value,
769 ))
770 }
771 }
772
773 /// Sets the value of the specified field of the meta container to the
774 /// given string value, and registers the field to only hold a string
775 /// typed value. After calling this, only string values can be set for
776 /// this field. The given flags can be set to make this field only
777 /// readable after calling this method.
778 /// ## `flags`
779 /// Flags to be used for the registered field
780 /// ## `meta_item`
781 /// The key for the `self` field to register
782 /// ## `value`
783 /// The value to set for the registered field
784 ///
785 /// # Returns
786 ///
787 /// [`true`] if the `meta_item` field was successfully registered on
788 /// `self` to only hold string typed values, with the given `flags`,
789 /// and the field was successfully set to `value`.
790 #[doc(alias = "ges_meta_container_register_meta_string")]
791 fn register_meta_string(&self, flags: MetaFlag, meta_item: &str, value: &str) -> bool {
792 unsafe {
793 from_glib(ffi::ges_meta_container_register_meta_string(
794 self.as_ref().to_glib_none().0,
795 flags.into_glib(),
796 meta_item.to_glib_none().0,
797 value.to_glib_none().0,
798 ))
799 }
800 }
801
802 /// Sets the value of the specified field of the meta container to the
803 /// given uint value, and registers the field to only hold a uint
804 /// typed value. After calling this, only uint values can be set for
805 /// this field. The given flags can be set to make this field only
806 /// readable after calling this method.
807 /// ## `flags`
808 /// Flags to be used for the registered field
809 /// ## `meta_item`
810 /// The key for the `self` field to register
811 /// ## `value`
812 /// The value to set for the registered field
813 ///
814 /// # Returns
815 ///
816 /// [`true`] if the `meta_item` field was successfully registered on
817 /// `self` to only hold uint typed values, with the given `flags`,
818 /// and the field was successfully set to `value`.
819 #[doc(alias = "ges_meta_container_register_meta_uint")]
820 fn register_meta_uint(&self, flags: MetaFlag, meta_item: &str, value: u32) -> bool {
821 unsafe {
822 from_glib(ffi::ges_meta_container_register_meta_uint(
823 self.as_ref().to_glib_none().0,
824 flags.into_glib(),
825 meta_item.to_glib_none().0,
826 value,
827 ))
828 }
829 }
830
831 /// Sets the value of the specified field of the meta container to the
832 /// given uint64 value, and registers the field to only hold a uint64
833 /// typed value. After calling this, only uint64 values can be set for
834 /// this field. The given flags can be set to make this field only
835 /// readable after calling this method.
836 /// ## `flags`
837 /// Flags to be used for the registered field
838 /// ## `meta_item`
839 /// The key for the `self` field to register
840 /// ## `value`
841 /// The value to set for the registered field
842 ///
843 /// # Returns
844 ///
845 /// [`true`] if the `meta_item` field was successfully registered on
846 /// `self` to only hold uint64 typed values, with the given `flags`,
847 /// and the field was successfully set to `value`.
848 #[doc(alias = "ges_meta_container_register_meta_uint64")]
849 fn register_meta_uint64(&self, flags: MetaFlag, meta_item: &str, value: u64) -> bool {
850 unsafe {
851 from_glib(ffi::ges_meta_container_register_meta_uint64(
852 self.as_ref().to_glib_none().0,
853 flags.into_glib(),
854 meta_item.to_glib_none().0,
855 value,
856 ))
857 }
858 }
859
860 /// Registers a static metadata field on the container to only hold the
861 /// specified type. After calling this, setting a value under this field
862 /// can only succeed if its type matches the registered type of the field.
863 ///
864 /// Unlike [`register_meta()`][Self::register_meta()], no (initial) value is set
865 /// for this field, which means you can use this method to reserve the
866 /// space to be _optionally_ set later.
867 ///
868 /// Note that if a value has already been set for the field being
869 /// registered, then its type must match the registering type, and its
870 /// value will be left in place. If the field has no set value, then
871 /// you will likely want to include [`MetaFlag::WRITABLE`][crate::MetaFlag::WRITABLE] in `flags` to allow
872 /// the value to be set later.
873 /// ## `flags`
874 /// Flags to be used for the registered field
875 /// ## `meta_item`
876 /// The key for the `self` field to register
877 /// ## `type_`
878 /// The required value type for the registered field
879 ///
880 /// # Returns
881 ///
882 /// [`true`] if the `meta_item` field was successfully registered on
883 /// `self` to only hold `type_` values, with the given `flags`.
884 #[cfg(feature = "v1_18")]
885 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
886 #[doc(alias = "ges_meta_container_register_static_meta")]
887 fn register_static_meta(
888 &self,
889 flags: MetaFlag,
890 meta_item: &str,
891 type_: glib::types::Type,
892 ) -> bool {
893 unsafe {
894 from_glib(ffi::ges_meta_container_register_static_meta(
895 self.as_ref().to_glib_none().0,
896 flags.into_glib(),
897 meta_item.to_glib_none().0,
898 type_.into_glib(),
899 ))
900 }
901 }
902
903 /// Sets the value of the specified field of the meta container to the
904 /// given boolean value.
905 /// ## `meta_item`
906 /// The key for the `self` field to set
907 /// ## `value`
908 /// The value to set under `meta_item`
909 ///
910 /// # Returns
911 ///
912 /// [`true`] if `value` was set under `meta_item` for `self`.
913 #[doc(alias = "ges_meta_container_set_boolean")]
914 fn set_boolean(&self, meta_item: &str, value: bool) -> bool {
915 unsafe {
916 from_glib(ffi::ges_meta_container_set_boolean(
917 self.as_ref().to_glib_none().0,
918 meta_item.to_glib_none().0,
919 value.into_glib(),
920 ))
921 }
922 }
923
924 /// Sets the value of the specified field of the meta container to the
925 /// given date value.
926 /// ## `meta_item`
927 /// The key for the `self` field to set
928 /// ## `value`
929 /// The value to set under `meta_item`
930 ///
931 /// # Returns
932 ///
933 /// [`true`] if `value` was set under `meta_item` for `self`.
934 #[doc(alias = "ges_meta_container_set_date")]
935 fn set_date(&self, meta_item: &str, value: &glib::Date) -> bool {
936 unsafe {
937 from_glib(ffi::ges_meta_container_set_date(
938 self.as_ref().to_glib_none().0,
939 meta_item.to_glib_none().0,
940 value.to_glib_none().0,
941 ))
942 }
943 }
944
945 /// Sets the value of the specified field of the meta container to the
946 /// given date time value.
947 /// ## `meta_item`
948 /// The key for the `self` field to set
949 /// ## `value`
950 /// The value to set under `meta_item`
951 ///
952 /// # Returns
953 ///
954 /// [`true`] if `value` was set under `meta_item` for `self`.
955 #[doc(alias = "ges_meta_container_set_date_time")]
956 fn set_date_time(&self, meta_item: &str, value: &gst::DateTime) -> bool {
957 unsafe {
958 from_glib(ffi::ges_meta_container_set_date_time(
959 self.as_ref().to_glib_none().0,
960 meta_item.to_glib_none().0,
961 value.to_glib_none().0,
962 ))
963 }
964 }
965
966 /// Sets the value of the specified field of the meta container to the
967 /// given double value.
968 /// ## `meta_item`
969 /// The key for the `self` field to set
970 /// ## `value`
971 /// The value to set under `meta_item`
972 ///
973 /// # Returns
974 ///
975 /// [`true`] if `value` was set under `meta_item` for `self`.
976 #[doc(alias = "ges_meta_container_set_double")]
977 fn set_double(&self, meta_item: &str, value: f64) -> bool {
978 unsafe {
979 from_glib(ffi::ges_meta_container_set_double(
980 self.as_ref().to_glib_none().0,
981 meta_item.to_glib_none().0,
982 value,
983 ))
984 }
985 }
986
987 /// Sets the value of the specified field of the meta container to the
988 /// given float value.
989 /// ## `meta_item`
990 /// The key for the `self` field to set
991 /// ## `value`
992 /// The value to set under `meta_item`
993 ///
994 /// # Returns
995 ///
996 /// [`true`] if `value` was set under `meta_item` for `self`.
997 #[doc(alias = "ges_meta_container_set_float")]
998 fn set_float(&self, meta_item: &str, value: f32) -> bool {
999 unsafe {
1000 from_glib(ffi::ges_meta_container_set_float(
1001 self.as_ref().to_glib_none().0,
1002 meta_item.to_glib_none().0,
1003 value,
1004 ))
1005 }
1006 }
1007
1008 /// Sets the value of the specified field of the meta container to the
1009 /// given int value.
1010 /// ## `meta_item`
1011 /// The key for the `self` field to set
1012 /// ## `value`
1013 /// The value to set under `meta_item`
1014 ///
1015 /// # Returns
1016 ///
1017 /// [`true`] if `value` was set under `meta_item` for `self`.
1018 #[doc(alias = "ges_meta_container_set_int")]
1019 fn set_int(&self, meta_item: &str, value: i32) -> bool {
1020 unsafe {
1021 from_glib(ffi::ges_meta_container_set_int(
1022 self.as_ref().to_glib_none().0,
1023 meta_item.to_glib_none().0,
1024 value,
1025 ))
1026 }
1027 }
1028
1029 /// Sets the value of the specified field of the meta container to the
1030 /// given int64 value.
1031 /// ## `meta_item`
1032 /// The key for the `self` field to set
1033 /// ## `value`
1034 /// The value to set under `meta_item`
1035 ///
1036 /// # Returns
1037 ///
1038 /// [`true`] if `value` was set under `meta_item` for `self`.
1039 #[doc(alias = "ges_meta_container_set_int64")]
1040 fn set_int64(&self, meta_item: &str, value: i64) -> bool {
1041 unsafe {
1042 from_glib(ffi::ges_meta_container_set_int64(
1043 self.as_ref().to_glib_none().0,
1044 meta_item.to_glib_none().0,
1045 value,
1046 ))
1047 }
1048 }
1049
1050 /// Sets the value of the specified field of the meta container to the
1051 /// given marker list value.
1052 /// ## `meta_item`
1053 /// The key for the `self` field to set
1054 /// ## `list`
1055 /// The value to set under `meta_item`
1056 ///
1057 /// # Returns
1058 ///
1059 /// [`true`] if `value` was set under `meta_item` for `self`.
1060 #[cfg(feature = "v1_18")]
1061 #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
1062 #[doc(alias = "ges_meta_container_set_marker_list")]
1063 fn set_marker_list(&self, meta_item: &str, list: &MarkerList) -> bool {
1064 unsafe {
1065 from_glib(ffi::ges_meta_container_set_marker_list(
1066 self.as_ref().to_glib_none().0,
1067 meta_item.to_glib_none().0,
1068 list.to_glib_none().0,
1069 ))
1070 }
1071 }
1072
1073 /// Sets the value of the specified field of the meta container to a
1074 /// copy of the given value. If the given `value` is [`None`], the field
1075 /// given by `meta_item` is removed and [`true`] is returned.
1076 /// ## `meta_item`
1077 /// The key for the `self` field to set
1078 /// ## `value`
1079 /// The value to set under `meta_item`, or [`None`] to
1080 /// remove the corresponding field
1081 ///
1082 /// # Returns
1083 ///
1084 /// [`true`] if `value` was set under `meta_item` for `self`.
1085 #[doc(alias = "ges_meta_container_set_meta")]
1086 fn set_meta(&self, meta_item: &str, value: Option<&glib::Value>) -> bool {
1087 unsafe {
1088 from_glib(ffi::ges_meta_container_set_meta(
1089 self.as_ref().to_glib_none().0,
1090 meta_item.to_glib_none().0,
1091 value.to_glib_none().0,
1092 ))
1093 }
1094 }
1095
1096 /// Sets the value of the specified field of the meta container to the
1097 /// given string value.
1098 /// ## `meta_item`
1099 /// The key for the `self` field to set
1100 /// ## `value`
1101 /// The value to set under `meta_item`
1102 ///
1103 /// # Returns
1104 ///
1105 /// [`true`] if `value` was set under `meta_item` for `self`.
1106 #[doc(alias = "ges_meta_container_set_string")]
1107 fn set_string(&self, meta_item: &str, value: &str) -> bool {
1108 unsafe {
1109 from_glib(ffi::ges_meta_container_set_string(
1110 self.as_ref().to_glib_none().0,
1111 meta_item.to_glib_none().0,
1112 value.to_glib_none().0,
1113 ))
1114 }
1115 }
1116
1117 /// Sets the value of the specified field of the meta container to the
1118 /// given uint value.
1119 /// ## `meta_item`
1120 /// The key for the `self` field to set
1121 /// ## `value`
1122 /// The value to set under `meta_item`
1123 ///
1124 /// # Returns
1125 ///
1126 /// [`true`] if `value` was set under `meta_item` for `self`.
1127 #[doc(alias = "ges_meta_container_set_uint")]
1128 fn set_uint(&self, meta_item: &str, value: u32) -> bool {
1129 unsafe {
1130 from_glib(ffi::ges_meta_container_set_uint(
1131 self.as_ref().to_glib_none().0,
1132 meta_item.to_glib_none().0,
1133 value,
1134 ))
1135 }
1136 }
1137
1138 /// Sets the value of the specified field of the meta container to the
1139 /// given uint64 value.
1140 /// ## `meta_item`
1141 /// The key for the `self` field to set
1142 /// ## `value`
1143 /// The value to set under `meta_item`
1144 ///
1145 /// # Returns
1146 ///
1147 /// [`true`] if `value` was set under `meta_item` for `self`.
1148 #[doc(alias = "ges_meta_container_set_uint64")]
1149 fn set_uint64(&self, meta_item: &str, value: u64) -> bool {
1150 unsafe {
1151 from_glib(ffi::ges_meta_container_set_uint64(
1152 self.as_ref().to_glib_none().0,
1153 meta_item.to_glib_none().0,
1154 value,
1155 ))
1156 }
1157 }
1158
1159 /// This is emitted for a meta container whenever the metadata under one
1160 /// of its fields changes, is set for the first time, or is removed. In
1161 /// the latter case, `value` will be [`None`].
1162 /// ## `key`
1163 /// The key for the `container` field that changed
1164 /// ## `value`
1165 /// The new value under `key`
1166 #[doc(alias = "notify-meta")]
1167 fn connect_notify_meta<F: Fn(&Self, &str, Option<&glib::Value>) + 'static>(
1168 &self,
1169 detail: Option<&str>,
1170 f: F,
1171 ) -> SignalHandlerId {
1172 unsafe extern "C" fn notify_meta_trampoline<
1173 P: IsA<MetaContainer>,
1174 F: Fn(&P, &str, Option<&glib::Value>) + 'static,
1175 >(
1176 this: *mut ffi::GESMetaContainer,
1177 key: *mut std::ffi::c_char,
1178 value: *mut glib::gobject_ffi::GValue,
1179 f: glib::ffi::gpointer,
1180 ) {
1181 let f: &F = &*(f as *const F);
1182 f(
1183 MetaContainer::from_glib_borrow(this).unsafe_cast_ref(),
1184 &glib::GString::from_glib_borrow(key),
1185 Option::<glib::Value>::from_glib_borrow(value)
1186 .as_ref()
1187 .as_ref(),
1188 )
1189 }
1190 unsafe {
1191 let f: Box_<F> = Box_::new(f);
1192 let detailed_signal_name = detail.map(|name| format!("notify-meta::{name}\0"));
1193 let signal_name: &[u8] = detailed_signal_name
1194 .as_ref()
1195 .map_or(&b"notify-meta\0"[..], |n| n.as_bytes());
1196 connect_raw(
1197 self.as_ptr() as *mut _,
1198 signal_name.as_ptr() as *const _,
1199 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1200 notify_meta_trampoline::<Self, F> as *const (),
1201 )),
1202 Box_::into_raw(f),
1203 )
1204 }
1205 }
1206}
1207
1208impl<O: IsA<MetaContainer>> MetaContainerExt for O {}