mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
Add constants for SECOND, MSECOND, USECOND, NSECOND
And use them in the examples.
This commit is contained in:
parent
083a6b6eeb
commit
8013169e09
3 changed files with 8 additions and 3 deletions
|
@ -58,7 +58,7 @@ fn main_loop() -> Result<(), utils::ExampleError> {
|
|||
let mut buffer = gst::Buffer::with_size(WIDTH * HEIGHT * 4).unwrap();
|
||||
{
|
||||
let buffer = buffer.get_mut().unwrap();
|
||||
buffer.set_pts(i * 500_000_000);
|
||||
buffer.set_pts(i * 500 * gst::MSECOND);
|
||||
|
||||
let mut data = buffer.map_writable().unwrap();
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ fn create_ui(app: >k::Application) {
|
|||
let position = pipeline.query_position(gst::Format::Time);
|
||||
|
||||
if let Some(position) = position {
|
||||
let mut seconds = position / 1_000_000_000;
|
||||
let mut seconds = position / gst::SECOND;
|
||||
let mut minutes = seconds / 60;
|
||||
let hours = minutes / 60;
|
||||
|
||||
|
|
|
@ -142,7 +142,12 @@ pub fn init() -> Result<(), glib::Error> {
|
|||
}
|
||||
|
||||
pub const BUFFER_OFFSET_NONE: u64 = ffi::GST_BUFFER_OFFSET_NONE;
|
||||
pub const CLOCK_TIME_NONE: u64 = ffi::GST_CLOCK_TIME_NONE;
|
||||
pub const CLOCK_TIME_NONE: ClockTime = ffi::GST_CLOCK_TIME_NONE;
|
||||
|
||||
pub const SECOND: ClockTime = 1_000_000_000;
|
||||
pub const MSECOND: ClockTime = 1_000_000;
|
||||
pub const USECOND: ClockTime = 1_000;
|
||||
pub const NSECOND: ClockTime = 1;
|
||||
|
||||
// Re-export all the traits in a prelude module, so that applications
|
||||
// can always "use gst::prelude::*" without getting conflicts
|
||||
|
|
Loading…
Reference in a new issue