gstreamer_editing_services/auto/
video_source.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, Extractable, MetaContainer, Source, TimelineElement, TrackElement};
7use glib::prelude::*;
8#[cfg(feature = "v1_18")]
9#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
10use glib::translate::*;
11
12glib::wrapper! {
13    /// Base class for video sources
14    ///
15    /// This is an Abstract Base Class, you cannot instantiate it.
16    ///
17    /// # Implements
18    ///
19    /// [`VideoSourceExt`][trait@crate::prelude::VideoSourceExt], [`SourceExt`][trait@crate::prelude::SourceExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
20    #[doc(alias = "GESVideoSource")]
21    pub struct VideoSource(Object<ffi::GESVideoSource, ffi::GESVideoSourceClass>) @extends Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
22
23    match fn {
24        type_ => || ffi::ges_video_source_get_type(),
25    }
26}
27
28impl VideoSource {
29    pub const NONE: Option<&'static VideoSource> = None;
30}
31
32mod sealed {
33    pub trait Sealed {}
34    impl<T: super::IsA<super::VideoSource>> Sealed for T {}
35}
36
37/// Trait containing all [`struct@VideoSource`] methods.
38///
39/// # Implementors
40///
41/// [`ImageSource`][struct@crate::ImageSource], [`MultiFileSource`][struct@crate::MultiFileSource], [`TitleSource`][struct@crate::TitleSource], [`VideoSource`][struct@crate::VideoSource], [`VideoTestSource`][struct@crate::VideoTestSource], [`VideoUriSource`][struct@crate::VideoUriSource]
42pub trait VideoSourceExt: IsA<VideoSource> + sealed::Sealed + 'static {
43    /// Retrieves the natural size of the video stream. The natural size, is
44    /// the size at which it will be displayed if no scaling is being applied.
45    ///
46    /// NOTE: The sources take into account the potential video rotation applied
47    /// by the `videoflip` element that is inside the source, effects applied on
48    /// the clip which potentially also rotate the element are not taken into
49    /// account.
50    ///
51    /// # Returns
52    ///
53    /// [`true`] if the object has a natural size, [`false`] otherwise.
54    ///
55    /// ## `width`
56    /// The natural width of the underlying source
57    ///
58    /// ## `height`
59    /// The natural height of the underlying source
60    #[cfg(feature = "v1_18")]
61    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
62    #[doc(alias = "ges_video_source_get_natural_size")]
63    #[doc(alias = "get_natural_size")]
64    fn natural_size(&self) -> Option<(i32, i32)> {
65        unsafe {
66            let mut width = std::mem::MaybeUninit::uninit();
67            let mut height = std::mem::MaybeUninit::uninit();
68            let ret = from_glib(ffi::ges_video_source_get_natural_size(
69                self.as_ref().to_glib_none().0,
70                width.as_mut_ptr(),
71                height.as_mut_ptr(),
72            ));
73            if ret {
74                Some((width.assume_init(), height.assume_init()))
75            } else {
76                None
77            }
78        }
79    }
80}
81
82impl<O: IsA<VideoSource>> VideoSourceExt for O {}