Skip to main content

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