mopidy.audio — Audio API

The audio API is the interface we have built around GStreamer to support our specific use cases. Most backends should be able to get by with simply setting the URI of the resource they want to play, for these cases the default playback provider should be used.

For more advanced cases such as when the raw audio data is delivered outside of GStreamer or the backend needs to add metadata to the currently playing resource, developers should sub-class the base playback provider and implement the extra behaviour that is needed through the following API:

Audio listener

Audio scanner

Audio utils

class mopidy.audio.utils.Signals[source]

Helper for tracking gobject signal registrations

clear()[source]

Clear all registered signal handlers.

connect(element, event, func, *args)[source]

Connect a function + args to signal event on an element.

Each event may only be handled by one callback in this implementation.

disconnect(element, event)[source]

Disconnect whatever handler we have for an element+event pair.

Does nothing it the handler has already been removed.

mopidy.audio.utils.calculate_duration(num_samples, sample_rate)[source]

Determine duration of samples using GStreamer helper for precise math.

mopidy.audio.utils.clocktime_to_millisecond(value)[source]

Convert an internal GStreamer time to millisecond time.

mopidy.audio.utils.create_buffer(data, timestamp=None, duration=None)[source]

Create a new GStreamer buffer based on provided data.

Mainly intended to keep gst imports out of non-audio modules.

Changed in version 2.0: capabilites argument was removed.

mopidy.audio.utils.millisecond_to_clocktime(value)[source]

Convert a millisecond time to internal GStreamer time.

mopidy.audio.utils.setup_proxy(element, config)[source]

Configure a GStreamer element with proxy settings.

Parameters:
  • element (Gst.GstElement) – element to setup proxy in.
  • config (dict) – proxy settings to use.
mopidy.audio.utils.supported_uri_schemes(uri_schemes)[source]

Determine which URIs we can actually support from provided whitelist.

Parameters:uri_schemes (list or set or URI schemes as strings.) – list/set of URIs to check support for.
Return type:set of URI schemes we can support via this GStreamer install.