1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::PlayerVideoInfo;
use glib::translate::*;
use std::mem;

impl PlayerVideoInfo {
    ///
    /// # Returns
    ///
    ///
    /// ## `fps_n`
    /// Numerator of frame rate
    ///
    /// ## `fps_d`
    /// Denominator of frame rate
    #[doc(alias = "get_framerate")]
    #[doc(alias = "gst_player_video_info_get_framerate")]
    pub fn framerate(&self) -> gst::Fraction {
        unsafe {
            let mut fps_n = mem::MaybeUninit::uninit();
            let mut fps_d = mem::MaybeUninit::uninit();
            ffi::gst_player_video_info_get_framerate(
                self.to_glib_none().0,
                fps_n.as_mut_ptr(),
                fps_d.as_mut_ptr(),
            );
            (fps_n.assume_init() as i32, fps_d.as_mut_ptr() as i32).into()
        }
    }

    /// Returns the pixel aspect ratio in `par_n` and `par_d`
    ///
    /// # Returns
    ///
    ///
    /// ## `par_n`
    /// numerator
    ///
    /// ## `par_d`
    /// denominator
    #[doc(alias = "get_pixel_aspect_ratio")]
    #[doc(alias = "gst_player_video_info_get_pixel_aspect_ratio")]
    pub fn pixel_aspect_ratio(&self) -> gst::Fraction {
        unsafe {
            let mut par_n = mem::MaybeUninit::uninit();
            let mut par_d = mem::MaybeUninit::uninit();
            ffi::gst_player_video_info_get_pixel_aspect_ratio(
                self.to_glib_none().0,
                par_n.as_mut_ptr(),
                par_d.as_mut_ptr(),
            );
            (par_n.assume_init() as i32, par_d.assume_init() as i32).into()
        }
    }
}