Kill off *_OUTPUT_OVERRIDEs in favour of just having CustomOutput to handle corner cases
This commit is contained in:
parent
35b6556694
commit
65db8c4a7b
@ -78,27 +78,40 @@ class BaseOutput(object):
|
||||
element.set_property(key, value)
|
||||
|
||||
|
||||
class CustomOutput(BaseOutput):
|
||||
"""
|
||||
Custom output for using alternate setups.
|
||||
|
||||
This output is intended to handle to main cases:
|
||||
|
||||
1. Simple things like switching which sink to use. Say :class:`LocalOutput`
|
||||
doesn't work for you and you want to switch to ALSA, simple. Set
|
||||
`CUSTOM_OUTPUT` to `alsasink` and you are good to go. Some possible
|
||||
sinks include:
|
||||
|
||||
- alsasink
|
||||
- osssink
|
||||
- pulsesink
|
||||
- ...and many more
|
||||
|
||||
2. Advanced setups that require complete control of the output bin. For
|
||||
these cases setup `CUSTOM_OUTPUT` with a `gst-launch` compatible string
|
||||
describing the target setup.
|
||||
|
||||
"""
|
||||
def describe_bin(self):
|
||||
return settings.CUSTOM_OUTPUT
|
||||
|
||||
|
||||
class LocalOutput(BaseOutput):
|
||||
"""
|
||||
Basic output to local audio sink.
|
||||
|
||||
This output will normally tell GStreamer to choose whatever it thinks is
|
||||
best for your system. In other words this is usually a sane choice.
|
||||
|
||||
Advanced:
|
||||
|
||||
However, there are chases when you want to explicitly set what GStreamer
|
||||
should use. This can be achieved by setting `settings.LOCAL_OUTPUT_OVERRIDE`
|
||||
to the sink you want to use. Some of the possible values are: alsasink,
|
||||
esdsink, jackaudiosink, oss4sink, osssink and pulsesink. Exact values that
|
||||
will work on your system will depend on your sound setup and installed
|
||||
GStreamer plugins. Run `gst-inspect0.10` for list of all available plugins.
|
||||
Also note that this accepts properties and bins in `gst-launch` format.
|
||||
"""
|
||||
|
||||
def describe_bin(self):
|
||||
if settings.LOCAL_OUTPUT_OVERRIDE:
|
||||
return settings.LOCAL_OUTPUT_OVERRIDE
|
||||
return 'autoaudiosink'
|
||||
|
||||
|
||||
@ -124,25 +137,13 @@ class ShoutcastOutput(BaseOutput):
|
||||
supports Shoutcast. The output supports setting for: server address, port,
|
||||
mount point, user, password and encoder to use. Please see
|
||||
:class:`mopidy.settings` for details about settings.
|
||||
|
||||
Advanced:
|
||||
|
||||
If you need to do something special that this output has not taken into
|
||||
account the setting `settings.SHOUTCAST_OUTPUT_OVERRIDE` has been provided
|
||||
to allow for manual setup of the bin using a gst-launch string. If this
|
||||
setting is set all other shoutcast settings will be ignored.
|
||||
"""
|
||||
|
||||
def describe_bin(self):
|
||||
if settings.SHOUTCAST_OUTPUT_OVERRIDE:
|
||||
return settings.SHOUTCAST_OUTPUT_OVERRIDE
|
||||
return 'audioconvert ! %s ! shout2send name=shoutcast' \
|
||||
% settings.SHOUTCAST_OUTPUT_ENCODER
|
||||
|
||||
def modify_bin(self, output):
|
||||
if settings.SHOUTCAST_OUTPUT_OVERRIDE:
|
||||
return
|
||||
|
||||
self.set_properties(output.get_by_name('shoutcast'), {
|
||||
u'ip': settings.SHOUTCAST_OUTPUT_SERVER,
|
||||
u'mount': settings.SHOUTCAST_OUTPUT_MOUNT,
|
||||
|
||||
@ -26,6 +26,13 @@ BACKENDS = (
|
||||
#: details on the format.
|
||||
CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(message)s'
|
||||
|
||||
#: Which GStreamer bin description to use in :class:`mopidy.outputs.CustomOutput`.
|
||||
#:
|
||||
#: Default::
|
||||
#:
|
||||
#: CUSTOM_OUTPUT = u'fakesink'
|
||||
CUSTOM_OUTPUT = u'fakesink'
|
||||
|
||||
#: The log format used for debug logging.
|
||||
#:
|
||||
#: See http://docs.python.org/library/logging.html#formatter-objects for
|
||||
@ -54,13 +61,6 @@ FRONTENDS = (
|
||||
u'mopidy.frontends.lastfm.LastfmFrontend',
|
||||
)
|
||||
|
||||
#: Which GStreamer bin description to use in :class:`mopidy.outputs.LocalOutput`.
|
||||
#:
|
||||
#: Default::
|
||||
#:
|
||||
#: LOCAL_OUTPUT_OVERRIDE = None
|
||||
LOCAL_OUTPUT_OVERRIDE = None
|
||||
|
||||
#: Your `Last.fm <http://www.last.fm/>`_ username.
|
||||
#:
|
||||
#: Used by :mod:`mopidy.frontends.lastfm`.
|
||||
@ -221,23 +221,6 @@ SHOUTCAST_OUTPUT_MOUNT = u'/stream'
|
||||
#: SHOUTCAST_OUTPUT_ENCODER = u'lame mode=stereo bitrate=320'
|
||||
SHOUTCAST_OUTPUT_ENCODER = u'lame mode=stereo bitrate=320'
|
||||
|
||||
#: Overrides to allow advanced setup of shoutcast. Using this settings implies
|
||||
#: that all other SHOUTCAST_OUTPUT_* settings will be ignored.
|
||||
#:
|
||||
#: Examples:
|
||||
#:
|
||||
#: ``vorbisenc ! oggmux ! shout2send mount=/stream port=8000``
|
||||
#: Encode with vorbis and use ogg mux.
|
||||
#: ``lame bitrate=320 ! shout2send mount=/stream port=8000``
|
||||
#: Encode with lame to bitrate=320.
|
||||
#:
|
||||
#: For all options see gst-inspect-0.10 lame, vorbisenc and shout2send.
|
||||
#:
|
||||
#: Default::
|
||||
#:
|
||||
#: SHOUTCAST_OUTPUT_OVERRIDE = None
|
||||
SHOUTCAST_OUTPUT_OVERRIDE = None
|
||||
|
||||
#: Path to the Spotify cache.
|
||||
#:
|
||||
#: Used by :mod:`mopidy.backends.spotify`.
|
||||
|
||||
@ -97,8 +97,9 @@ def validate_settings(defaults, settings):
|
||||
'DUMP_LOG_FILENAME': 'DEBUG_LOG_FILENAME',
|
||||
'DUMP_LOG_FORMAT': 'DEBUG_LOG_FORMAT',
|
||||
'FRONTEND': 'FRONTENDS',
|
||||
'GSTREAMER_AUDIO_SINK': 'LOCAL_OUTPUT_OVERRIDE',
|
||||
'GSTREAMER_AUDIO_SINK': 'CUSTOM_OUTPUT',
|
||||
'LOCAL_MUSIC_FOLDER': 'LOCAL_MUSIC_PATH',
|
||||
'LOCAL_OUTPUT_OVERRIDE': 'CUSTOM_OUTPUT',
|
||||
'LOCAL_PLAYLIST_FOLDER': 'LOCAL_PLAYLIST_PATH',
|
||||
'LOCAL_TAG_CACHE': 'LOCAL_TAG_CACHE_FILE',
|
||||
'OUTPUT': None,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user