diff --git a/mopidy/audio/utils.py b/mopidy/audio/utils.py index 9d0f46dd..5bb3c4ca 100644 --- a/mopidy/audio/utils.py +++ b/mopidy/audio/utils.py @@ -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.