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