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
42/// Trait containing all [`struct@Extractable`] methods.
43///
44/// # Implementors
45///
46/// [`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]
47pub trait ExtractableExt: IsA<Extractable> + 'static {
48    /// Get the asset that has been set on the extractable object.
49    ///
50    /// # Returns
51    ///
52    /// The asset set on `self`, or [`None`]
53    /// if no asset has been set.
54    #[doc(alias = "ges_extractable_get_asset")]
55    #[doc(alias = "get_asset")]
56    fn asset(&self) -> Option<Asset> {
57        unsafe {
58            from_glib_none(ffi::ges_extractable_get_asset(
59                self.as_ref().to_glib_none().0,
60            ))
61        }
62    }
63
64    /// Gets the [`id`][struct@crate::Asset#id] of some associated asset. It may be the case
65    /// that the object has no set asset, or even that such an asset does not
66    /// yet exist in the GES cache. Instead, this will return the asset
67    /// [`id`][struct@crate::Asset#id] that is _compatible_ with the current state of the object,
68    /// as determined by the [`Extractable`][crate::Extractable] implementer. If it was indeed
69    /// extracted from an asset, this should return the same as its
70    /// corresponding asset [`id`][struct@crate::Asset#id].
71    ///
72    /// # Returns
73    ///
74    /// The [`id`][struct@crate::Asset#id] of some associated [`Asset`][crate::Asset]
75    /// that is compatible with `self`'s current state.
76    #[doc(alias = "ges_extractable_get_id")]
77    #[doc(alias = "get_id")]
78    fn id(&self) -> glib::GString {
79        unsafe { from_glib_full(ffi::ges_extractable_get_id(self.as_ref().to_glib_none().0)) }
80    }
81
82    /// Sets the asset for this extractable object.
83    ///
84    /// When an object is extracted from an asset using [`AssetExt::extract()`][crate::prelude::AssetExt::extract()] its
85    /// asset will be automatically set. Note that many classes that implement
86    /// [`Extractable`][crate::Extractable] will automatically create their objects using assets
87    /// when you call their `new` methods. However, you can use this method to
88    /// associate an object with a compatible asset if it was created by other
89    /// means and does not yet have an asset. Or, for some implementations of
90    /// [`Extractable`][crate::Extractable], you can use this to change the asset of the given
91    /// extractable object, which will lead to a change in its state to
92    /// match the new asset [`id`][struct@crate::Asset#id].
93    /// ## `asset`
94    /// The asset to set
95    ///
96    /// # Returns
97    ///
98    /// [`true`] if `asset` could be successfully set on `self`.
99    #[doc(alias = "ges_extractable_set_asset")]
100    fn set_asset(&self, asset: &impl IsA<Asset>) -> Result<(), glib::error::BoolError> {
101        unsafe {
102            glib::result_from_gboolean!(
103                ffi::ges_extractable_set_asset(
104                    self.as_ref().to_glib_none().0,
105                    asset.as_ref().to_glib_none().0
106                ),
107                "Failed to set asset"
108            )
109        }
110    }
111}
112
113impl<O: IsA<Extractable>> ExtractableExt for O {}