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