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    #[doc(alias = "GESVideoSource")]
14    pub struct VideoSource(Object<ffi::GESVideoSource, ffi::GESVideoSourceClass>) @extends Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;
15
16    match fn {
17        type_ => || ffi::ges_video_source_get_type(),
18    }
19}
20
21impl VideoSource {
22    pub const NONE: Option<&'static VideoSource> = None;
23}
24
25mod sealed {
26    pub trait Sealed {}
27    impl<T: super::IsA<super::VideoSource>> Sealed for T {}
28}
29
30pub trait VideoSourceExt: IsA<VideoSource> + sealed::Sealed + 'static {
31    #[cfg(feature = "v1_18")]
32    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
33    #[doc(alias = "ges_video_source_get_natural_size")]
34    #[doc(alias = "get_natural_size")]
35    fn natural_size(&self) -> Option<(i32, i32)> {
36        unsafe {
37            let mut width = std::mem::MaybeUninit::uninit();
38            let mut height = std::mem::MaybeUninit::uninit();
39            let ret = from_glib(ffi::ges_video_source_get_natural_size(
40                self.as_ref().to_glib_none().0,
41                width.as_mut_ptr(),
42                height.as_mut_ptr(),
43            ));
44            if ret {
45                Some((width.assume_init(), height.assume_init()))
46            } else {
47                None
48            }
49        }
50    }
51}
52
53impl<O: IsA<VideoSource>> VideoSourceExt for O {}