2020-12-15 10:53:31 +00:00
|
|
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
2017-12-16 09:18:00 +00:00
|
|
|
|
2020-11-22 10:32:04 +00:00
|
|
|
use crate::PlayerVideoInfo;
|
2017-12-16 09:18:00 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use std::mem;
|
|
|
|
|
|
|
|
impl PlayerVideoInfo {
|
2021-04-11 19:39:50 +00:00
|
|
|
pub fn framerate(&self) -> gst::Fraction {
|
2017-12-16 09:18:00 +00:00
|
|
|
unsafe {
|
2019-07-11 12:34:28 +00:00
|
|
|
let mut fps_n = mem::MaybeUninit::uninit();
|
|
|
|
let mut fps_d = mem::MaybeUninit::uninit();
|
2020-11-22 10:32:04 +00:00
|
|
|
ffi::gst_player_video_info_get_framerate(
|
2019-03-19 07:58:20 +00:00
|
|
|
self.to_glib_none().0,
|
2019-07-11 12:34:28 +00:00
|
|
|
fps_n.as_mut_ptr(),
|
|
|
|
fps_d.as_mut_ptr(),
|
2019-03-19 07:58:20 +00:00
|
|
|
);
|
2019-07-11 12:34:28 +00:00
|
|
|
(fps_n.assume_init() as i32, fps_d.as_mut_ptr() as i32).into()
|
2017-12-16 09:18:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 19:39:50 +00:00
|
|
|
pub fn pixel_aspect_ratio(&self) -> gst::Fraction {
|
2017-12-16 09:18:00 +00:00
|
|
|
unsafe {
|
2019-07-11 12:34:28 +00:00
|
|
|
let mut par_n = mem::MaybeUninit::uninit();
|
|
|
|
let mut par_d = mem::MaybeUninit::uninit();
|
2020-11-22 10:32:04 +00:00
|
|
|
ffi::gst_player_video_info_get_pixel_aspect_ratio(
|
2017-12-16 09:18:00 +00:00
|
|
|
self.to_glib_none().0,
|
2019-07-11 12:34:28 +00:00
|
|
|
par_n.as_mut_ptr(),
|
|
|
|
par_d.as_mut_ptr(),
|
2017-12-16 09:18:00 +00:00
|
|
|
);
|
2019-07-11 12:34:28 +00:00
|
|
|
(par_n.assume_init() as i32, par_d.assume_init() as i32).into()
|
2017-12-16 09:18:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|