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