diff --git a/examples/src/bin/appsrc.rs b/examples/src/bin/appsrc.rs index 0f0c8f631..34b6a9ee5 100644 --- a/examples/src/bin/appsrc.rs +++ b/examples/src/bin/appsrc.rs @@ -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(); diff --git a/examples/src/bin/gtksink.rs b/examples/src/bin/gtksink.rs index 9f5ba2c08..1210a6bf9 100644 --- a/examples/src/bin/gtksink.rs +++ b/examples/src/bin/gtksink.rs @@ -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; diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 58cf44ce5..62d4682d3 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -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