audio: Add clocktime_to_millisecond util function

This commit is contained in:
Stein Magnus Jodal 2013-01-03 19:38:31 +01:00
parent 45d4445eea
commit 64ae7865bb

View File

@ -6,7 +6,8 @@ import gst
def calculate_duration(num_samples, sample_rate):
"""Determine duration of samples using GStreamer helper for precise math."""
"""Determine duration of samples using GStreamer helper for precise
math."""
return gst.util_uint64_scale(num_samples, gst.SECOND, sample_rate)
@ -28,10 +29,15 @@ def create_buffer(data, capabilites=None, timestamp=None, duration=None):
def millisecond_to_clocktime(value):
"""Convert a millisecond time to internal gstreamer time."""
"""Convert a millisecond time to internal GStreamer time."""
return value * gst.MSECOND
def clocktime_to_millisecond(value):
"""Convert a millisecond time to internal GStreamer time."""
return value // gst.MSECOND
def supported_uri_schemes(uri_schemes):
"""Determine which URIs we can actually support from provided whitelist.