2017-12-16 09:18:00 +00:00
|
|
|
// Copyright (C) 2017 Sebastian Dröge <sebastian@centricular.com>
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
use glib::translate::*;
|
|
|
|
use gst;
|
2019-03-19 07:58:20 +00:00
|
|
|
use gst_player_sys;
|
2017-12-16 09:18:00 +00:00
|
|
|
use std::mem;
|
2018-04-25 08:10:06 +00:00
|
|
|
use PlayerVideoInfo;
|
2017-12-16 09:18:00 +00:00
|
|
|
|
|
|
|
impl PlayerVideoInfo {
|
|
|
|
pub fn get_framerate(&self) -> gst::Fraction {
|
|
|
|
unsafe {
|
2019-07-11 12:34:28 +00:00
|
|
|
let mut fps_n = mem::MaybeUninit::uninit();
|
|
|
|
let mut fps_d = mem::MaybeUninit::uninit();
|
2019-03-19 07:58:20 +00:00
|
|
|
gst_player_sys::gst_player_video_info_get_framerate(
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_pixel_aspect_ratio(&self) -> gst::Fraction {
|
|
|
|
unsafe {
|
2019-07-11 12:34:28 +00:00
|
|
|
let mut par_n = mem::MaybeUninit::uninit();
|
|
|
|
let mut par_d = mem::MaybeUninit::uninit();
|
2019-03-19 07:58:20 +00:00
|
|
|
gst_player_sys::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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|