gstreamer_editing_services/auto/extractable.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
6use crate::{ffi, Asset};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// A [`glib::Object`][crate::glib::Object] that implements the [`Extractable`][crate::Extractable] interface can be
11 /// extracted from a [`Asset`][crate::Asset] using [`AssetExt::extract()`][crate::prelude::AssetExt::extract()].
12 ///
13 /// Each extractable type will have its own way of interpreting the
14 /// [`id`][struct@crate::Asset#id] of an asset (or, if it is associated with a specific
15 /// subclass of [`Asset`][crate::Asset], the asset subclass may handle the
16 /// interpretation of the [`id`][struct@crate::Asset#id]). By default, the requested asset
17 /// [`id`][struct@crate::Asset#id] will be ignored by a [`Extractable`][crate::Extractable] and will be set to
18 /// the type name of the extractable instead. Also by default, when the
19 /// requested asset is extracted, the returned object will simply be a
20 /// newly created default object of that extractable type. You should check
21 /// the documentation for each extractable type to see if they differ from
22 /// the default.
23 ///
24 /// After the object is extracted, it will have a reference to the asset it
25 /// came from, which you can retrieve using [`ExtractableExt::asset()`][crate::prelude::ExtractableExt::asset()].
26 ///
27 /// # Implements
28 ///
29 /// [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`trait@glib::ObjectExt`]
30 #[doc(alias = "GESExtractable")]
31 pub struct Extractable(Interface<ffi::GESExtractable, ffi::GESExtractableInterface>);
32
33 match fn {
34 type_ => || ffi::ges_extractable_get_type(),
35 }
36}
37
38impl Extractable {
39 pub const NONE: Option<&'static Extractable> = None;
40}
41
42mod sealed {
43 pub trait Sealed {}
44 impl<T: super::IsA<super::Extractable>> Sealed for T {}
45}
46
47/// Trait containing all [`struct@Extractable`] methods.
48///
49/// # Implementors
50///
51/// [`AudioSource`][struct@crate::AudioSource], [`AudioTestSource`][struct@crate::AudioTestSource], [`AudioTransition`][struct@crate::AudioTransition], [`AudioUriSource`][struct@crate::AudioUriSource], [`BaseEffectClip`][struct@crate::BaseEffectClip], [`BaseEffect`][struct@crate::BaseEffect], [`BaseTransitionClip`][struct@crate::BaseTransitionClip], [`BaseXmlFormatter`][struct@crate::BaseXmlFormatter], [`Clip`][struct@crate::Clip], [`CommandLineFormatter`][struct@crate::CommandLineFormatter], [`Container`][struct@crate::Container], [`EffectClip`][struct@crate::EffectClip], [`Effect`][struct@crate::Effect], [`Extractable`][struct@crate::Extractable], [`Formatter`][struct@crate::Formatter], [`Group`][struct@crate::Group], [`ImageSource`][struct@crate::ImageSource], [`Layer`][struct@crate::Layer], [`MultiFileSource`][struct@crate::MultiFileSource], [`OperationClip`][struct@crate::OperationClip], [`Operation`][struct@crate::Operation], [`OverlayClip`][struct@crate::OverlayClip], [`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], [`TrackElement`][struct@crate::TrackElement], [`TransitionClip`][struct@crate::TransitionClip], [`Transition`][struct@crate::Transition], [`UriClip`][struct@crate::UriClip], [`VideoSource`][struct@crate::VideoSource], [`VideoTestSource`][struct@crate::VideoTestSource], [`VideoTransition`][struct@crate::VideoTransition], [`VideoUriSource`][struct@crate::VideoUriSource], [`XmlFormatter`][struct@crate::XmlFormatter]
52pub trait ExtractableExt: IsA<Extractable> + sealed::Sealed + 'static {
53 /// Get the asset that has been set on the extractable object.
54 ///
55 /// # Returns
56 ///
57 /// The asset set on `self`, or [`None`]
58 /// if no asset has been set.
59 #[doc(alias = "ges_extractable_get_asset")]
60 #[doc(alias = "get_asset")]
61 fn asset(&self) -> Option<Asset> {
62 unsafe {
63 from_glib_none(ffi::ges_extractable_get_asset(
64 self.as_ref().to_glib_none().0,
65 ))
66 }
67 }
68
69 /// Gets the [`id`][struct@crate::Asset#id] of some associated asset. It may be the case
70 /// that the object has no set asset, or even that such an asset does not
71 /// yet exist in the GES cache. Instead, this will return the asset
72 /// [`id`][struct@crate::Asset#id] that is _compatible_ with the current state of the object,
73 /// as determined by the [`Extractable`][crate::Extractable] implementer. If it was indeed
74 /// extracted from an asset, this should return the same as its
75 /// corresponding asset [`id`][struct@crate::Asset#id].
76 ///
77 /// # Returns
78 ///
79 /// The [`id`][struct@crate::Asset#id] of some associated [`Asset`][crate::Asset]
80 /// that is compatible with `self`'s current state.
81 #[doc(alias = "ges_extractable_get_id")]
82 #[doc(alias = "get_id")]
83 fn id(&self) -> glib::GString {
84 unsafe { from_glib_full(ffi::ges_extractable_get_id(self.as_ref().to_glib_none().0)) }
85 }
86
87 /// Sets the asset for this extractable object.
88 ///
89 /// When an object is extracted from an asset using [`AssetExt::extract()`][crate::prelude::AssetExt::extract()] its
90 /// asset will be automatically set. Note that many classes that implement
91 /// [`Extractable`][crate::Extractable] will automatically create their objects using assets
92 /// when you call their `new` methods. However, you can use this method to
93 /// associate an object with a compatible asset if it was created by other
94 /// means and does not yet have an asset. Or, for some implementations of
95 /// [`Extractable`][crate::Extractable], you can use this to change the asset of the given
96 /// extractable object, which will lead to a change in its state to
97 /// match the new asset [`id`][struct@crate::Asset#id].
98 /// ## `asset`
99 /// The asset to set
100 ///
101 /// # Returns
102 ///
103 /// [`true`] if `asset` could be successfully set on `self`.
104 #[doc(alias = "ges_extractable_set_asset")]
105 fn set_asset(&self, asset: &impl IsA<Asset>) -> Result<(), glib::error::BoolError> {
106 unsafe {
107 glib::result_from_gboolean!(
108 ffi::ges_extractable_set_asset(
109 self.as_ref().to_glib_none().0,
110 asset.as_ref().to_glib_none().0
111 ),
112 "Failed to set asset"
113 )
114 }
115 }
116}
117
118impl<O: IsA<Extractable>> ExtractableExt for O {}