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
25pub trait VideoSourceExt: IsA<VideoSource> + 'static {
26    #[cfg(feature = "v1_18")]
27    #[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
28    #[doc(alias = "ges_video_source_get_natural_size")]
29    #[doc(alias = "get_natural_size")]
30    fn natural_size(&self) -> Option<(i32, i32)> {
31        unsafe {
32            let mut width = std::mem::MaybeUninit::uninit();
33            let mut height = std::mem::MaybeUninit::uninit();
34            let ret = from_glib(ffi::ges_video_source_get_natural_size(
35                self.as_ref().to_glib_none().0,
36                width.as_mut_ptr(),
37                height.as_mut_ptr(),
38            ));
39            if ret {
40                Some((width.assume_init(), height.assume_init()))
41            } else {
42                None
43            }
44        }
45    }
46}
47
48impl<O: IsA<VideoSource>> VideoSourceExt for O {}