gstreamer_video/
enums.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(feature = "v1_16")]
4#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
5use glib::translate::*;
6
7#[cfg(feature = "v1_16")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
9use crate::VideoCaptionType;
10#[cfg(feature = "v1_20")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
12use crate::VideoOrientationMethod;
13
14#[cfg(feature = "v1_16")]
15#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
16impl VideoCaptionType {
17    #[doc(alias = "gst_video_caption_type_from_caps")]
18    pub fn from_caps(caps: &gst::CapsRef) -> VideoCaptionType {
19        skip_assert_initialized!();
20        unsafe { from_glib(crate::ffi::gst_video_caption_type_from_caps(caps.as_ptr())) }
21    }
22}
23
24#[cfg(feature = "v1_20")]
25#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
26impl VideoOrientationMethod {
27    #[cfg(feature = "v1_20")]
28    #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
29    #[doc(alias = "gst_video_orientation_from_tag")]
30    pub fn from_tag(taglist: &gst::TagListRef) -> Option<VideoOrientationMethod> {
31        skip_assert_initialized!();
32
33        unsafe {
34            use std::mem;
35
36            let mut method = mem::MaybeUninit::uninit();
37            let ret = from_glib(crate::ffi::gst_video_orientation_from_tag(
38                mut_override(taglist.as_ptr()),
39                method.as_mut_ptr(),
40            ));
41            if ret {
42                Some(from_glib(method.assume_init()))
43            } else {
44                None
45            }
46        }
47    }
48}