Add new GStreamer-based software mixer and make it the default on all platforms
This commit is contained in:
parent
b87fced87e
commit
a4d231709e
@ -67,6 +67,16 @@ methods as described below.
|
||||
.. inheritance-diagram:: mopidy.mixers.dummy
|
||||
|
||||
|
||||
:mod:`mopidy.mixers.gstreamer_software` -- Software mixer for all platforms
|
||||
===========================================================================
|
||||
|
||||
.. automodule:: mopidy.mixers.gstreamer_software
|
||||
:synopsis: Software mixer for all platforms
|
||||
:members:
|
||||
|
||||
.. inheritance-diagram:: mopidy.mixers.gstreamer_software
|
||||
|
||||
|
||||
:mod:`mopidy.mixers.osa` -- Osa mixer for OS X
|
||||
==============================================
|
||||
|
||||
|
||||
@ -25,6 +25,8 @@ Another great release.
|
||||
- :mod:`mopidy.backends.libspotify` is now the default backend.
|
||||
- A Spotify application key is now bundled with the source. The
|
||||
``SPOTIFY_LIB_APPKEY`` setting is thus removed.
|
||||
- Added new :mod:`mopidy.mixers.GStreamerSoftwareMixer` which now is the
|
||||
default mixer on all platforms.
|
||||
- MPD frontend:
|
||||
|
||||
- Relocate from :mod:`mopidy.mpd` to :mod:`mopidy.frontends.mpd`.
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
from mopidy.mixers import BaseMixer
|
||||
|
||||
class GStreamerMixer(BaseMixer):
|
||||
"""Mixer which uses GStreamer to control volume."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(GStreamerMixer, self).__init__(*args, **kwargs)
|
||||
|
||||
def _get_volume(self):
|
||||
pass # TODO Get volume from GStreamerProcess
|
||||
|
||||
def _set_volume(self, volume):
|
||||
pass # TODO Send volume to GStreamerProcess
|
||||
|
||||
25
mopidy/mixers/gstreamer_software.py
Normal file
25
mopidy/mixers/gstreamer_software.py
Normal file
@ -0,0 +1,25 @@
|
||||
import multiprocessing
|
||||
|
||||
from mopidy.mixers import BaseMixer
|
||||
from mopidy.process import pickle_connection
|
||||
|
||||
class GStreamerSoftwareMixer(BaseMixer):
|
||||
"""Mixer which uses GStreamer to control volume in software."""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(GStreamerSoftwareMixer, self).__init__(*args, **kwargs)
|
||||
|
||||
def _get_volume(self):
|
||||
my_end, other_end = multiprocessing.Pipe()
|
||||
self.backend.output_queue.put({
|
||||
'command': 'get_volume',
|
||||
'reply_to': pickle_connection(other_end),
|
||||
})
|
||||
my_end.poll(None)
|
||||
return my_end.recv()
|
||||
|
||||
def _set_volume(self, volume):
|
||||
self.backend.output_queue.put({
|
||||
'command': 'set_volume',
|
||||
'volume': volume,
|
||||
})
|
||||
@ -93,6 +93,12 @@ class GStreamerProcess(BaseProcess):
|
||||
response = self.set_state(message['state'])
|
||||
connection = unpickle_connection(message['reply_to'])
|
||||
connection.send(response)
|
||||
elif message['command'] == 'get_volume':
|
||||
volume = self.get_volume()
|
||||
connection = unpickle_connection(message['reply_to'])
|
||||
connection.send(volume)
|
||||
elif message['command'] == 'set_volume':
|
||||
self.set_volume(message['volume'])
|
||||
else:
|
||||
logger.warning(u'Cannot handle message: %s', message)
|
||||
|
||||
|
||||
@ -82,22 +82,10 @@ LOCAL_TAG_CACHE = u'~/.mopidy/tag_cache'
|
||||
|
||||
#: Sound mixer to use. See :mod:`mopidy.mixers` for all available mixers.
|
||||
#:
|
||||
#: Default on Linux::
|
||||
#: Default::
|
||||
#:
|
||||
#: MIXER = u'mopidy.mixers.alsa.AlsaMixer'
|
||||
#:
|
||||
#: Default on OS X::
|
||||
#:
|
||||
#: MIXER = u'mopidy.mixers.osa.OsaMixer'
|
||||
#:
|
||||
#: Default on other operating systems::
|
||||
#:
|
||||
#: MIXER = u'mopidy.mixers.dummy.DummyMixer'
|
||||
MIXER = u'mopidy.mixers.dummy.DummyMixer'
|
||||
if sys.platform == 'linux2':
|
||||
MIXER = u'mopidy.mixers.alsa.AlsaMixer'
|
||||
elif sys.platform == 'darwin':
|
||||
MIXER = u'mopidy.mixers.osa.OsaMixer'
|
||||
#: MIXER = u'mopidy.mixers.gstreamer_software.GStreamerSoftwareMixer'
|
||||
MIXER = u'mopidy.mixers.gstreamer_software.GStreamerSoftwareMixer'
|
||||
|
||||
#: ALSA mixer only. What mixer control to use. If set to :class:`False`, first
|
||||
#: ``Master`` and then ``PCM`` will be tried.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user