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
32/// Trait containing all [`struct@VideoSource`] methods.
33///
34/// # Implementors
35///
36/// [`ImageSource`][struct@crate::ImageSource], [`MultiFileSource`][struct@crate::MultiFileSource], [`TitleSource`][struct@crate::TitleSource], [`VideoSource`][struct@crate::VideoSource], [`VideoTestSource`][struct@crate::VideoTestSource], [`VideoUriSource`][struct@crate::VideoUriSource]
37pub trait VideoSourceExt: IsA<VideoSource> + 'static {
38    /// Retrieves the natural size of the video stream. The natural size, is
39    /// the size at which it will be displayed if no scaling is being applied.
40    ///
41    /// NOTE: The sources take into account the potential video rotation applied
42    /// by the `videoflip` element that is inside the source, effects applied on
43    /// the clip which potentially also rotate the element are not taken into
44    /// account.
45    ///
46    /// # Returns
47    ///
48    /// [`true`] if the object has a natural size, [`false`] otherwise.
49    ///
50    /// ## `width`
51    /// The natural width of the underlying source
52    ///
53    /// ## `height`
54    /// The natural height of the underlying source
55    #[cfg(feature = "v1_18")]
56    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
57    #[doc(alias = "ges_video_source_get_natural_size")]
58    #[doc(alias = "get_natural_size")]
59    fn natural_size(&self) -> Option<(i32, i32)> {
60        unsafe {
61            let mut width = std::mem::MaybeUninit::uninit();
62            let mut height = std::mem::MaybeUninit::uninit();
63            let ret = from_glib(ffi::ges_video_source_get_natural_size(
64                self.as_ref().to_glib_none().0,
65                width.as_mut_ptr(),
66                height.as_mut_ptr(),
67            ));
68            if ret {
69                Some((width.assume_init(), height.assume_init()))
70            } else {
71                None
72            }
73        }
74    }
75}
76
77impl<O: IsA<VideoSource>> VideoSourceExt for O {}