Merge branch 'develop' of https://github.com/mopidy/mopidy into fix/310-persist-mopidy-state-between-runs
Conflicts: docs/config.rst Fix conflicts
This commit is contained in:
commit
af78f5952c
130
docs/audio.rst
Normal file
130
docs/audio.rst
Normal file
@ -0,0 +1,130 @@
|
||||
.. _audio:
|
||||
|
||||
*********************
|
||||
Advanced audio setups
|
||||
*********************
|
||||
|
||||
Mopidy has very few :ref:`audio configs <audio-config>`, but the ones we
|
||||
have are very powerful because they let you modify the GStreamer audio pipeline
|
||||
directly. Here we describe some use cases that can be solved with the audio
|
||||
configs and GStreamer.
|
||||
|
||||
|
||||
.. _custom-sink:
|
||||
|
||||
Custom audio sink
|
||||
=================
|
||||
|
||||
If you have successfully installed GStreamer, and then run the
|
||||
``gst-inspect-1.0`` command, you should see a long listing of installed
|
||||
plugins, ending in a summary line::
|
||||
|
||||
$ gst-inspect-1.0
|
||||
... long list of installed plugins ...
|
||||
Total count: 233 plugins, 1339 features
|
||||
|
||||
Next, you should be able to produce a audible tone by running::
|
||||
|
||||
gst-launch-1.0 audiotestsrc ! audioresample ! autoaudiosink
|
||||
|
||||
If you cannot hear any sound when running this command, you won't hear any
|
||||
sound from Mopidy either, as Mopidy by default uses GStreamer's
|
||||
``autoaudiosink`` to play audio. Thus, make this work before you file a bug
|
||||
against Mopidy.
|
||||
|
||||
If you for some reason want to use some other GStreamer audio sink than
|
||||
``autoaudiosink``, you can set the :confval:`audio/output` config value to a
|
||||
partial GStreamer pipeline description describing the GStreamer sink you want
|
||||
to use.
|
||||
|
||||
Example ``mopidy.conf`` for using OSS4:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = oss4sink
|
||||
|
||||
Again, this is the equivalent of the following ``gst-launch-1.0`` command, so
|
||||
make this work first::
|
||||
|
||||
gst-launch-1.0 audiotestsrc ! audioresample ! oss4sink
|
||||
|
||||
|
||||
.. _streaming:
|
||||
|
||||
Streaming through Icecast
|
||||
=========================
|
||||
|
||||
If you want to play the audio on another computer than the one running Mopidy,
|
||||
you can stream the audio from Mopidy through an Icecast audio streaming server.
|
||||
Multiple media players can then be connected to the streaming server
|
||||
simultaneously. To use the Icecast output, do the following:
|
||||
|
||||
#. Install, configure and start the Icecast server. It can be found in the
|
||||
``icecast2`` package in Debian/Ubuntu.
|
||||
|
||||
#. Set the :confval:`audio/output` config value to encode the output audio to
|
||||
MP3 (``lamemp3enc``) or Ogg Vorbis (``audioresample ! audioconvert !
|
||||
vorbisenc ! oggmux``) and send it to Icecast (``shout2send``).
|
||||
|
||||
You might also need to change the ``shout2send`` default settings, run
|
||||
``gst-inspect-1.0 shout2send`` to see the available settings. Most likely
|
||||
you want to change ``ip``, ``username``, ``password``, and ``mount``.
|
||||
|
||||
Example for MP3 streaming:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = lamemp3enc ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=hackme
|
||||
|
||||
Example for Ogg Vorbis streaming:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = audioresample ! audioconvert ! vorbisenc ! oggmux ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=hackme
|
||||
|
||||
Other advanced setups are also possible for outputs. Basically, anything you
|
||||
can use with the ``gst-launch-1.0`` command can be plugged into
|
||||
:confval:`audio/output`.
|
||||
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
- **Changing track:** As of Mopidy 1.2 we support gapless playback, and the
|
||||
stream does no longer end when changing from one track to another.
|
||||
|
||||
- **Previous/next:** The stream ends on previous and next. See :issue:`1306`
|
||||
for details. This can be worked around using a fallback stream, as described
|
||||
below.
|
||||
|
||||
- **Pause:** Pausing playback stops the stream. This is probably not something
|
||||
we're going to fix. This can be worked around using a fallback stream, as
|
||||
described below.
|
||||
|
||||
- **Metadata:** Track metadata is mostly missing from the stream. For Spotify,
|
||||
fixing :issue:`1357` should help. The general issue for other extensions is
|
||||
:issue:`866`.
|
||||
|
||||
|
||||
Fallback stream
|
||||
---------------
|
||||
|
||||
By using a *fallback stream* playing silence, you can somewhat mitigate the
|
||||
known issues above.
|
||||
|
||||
Example Icecast configuration:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<mount>
|
||||
<mount-name>/mopidy</mount-name>
|
||||
<fallback-mount>/silence.mp3</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
</mount>
|
||||
|
||||
You can easily find MP3 files with just silence by searching the web. The
|
||||
``silence.mp3`` file needs to be placed in the directory defined by
|
||||
``<webroot>...</webroot>`` in the Icecast configuration.
|
||||
@ -159,6 +159,10 @@ Audio
|
||||
argument is no longer in use and will be removed in the future. As far as we
|
||||
know, this is only used by Mopidy-Spotify.
|
||||
|
||||
- Duplicate seek events getting to AppSrc based backends is now fixed. This
|
||||
should prevent seeking in Mopidy-Spotify from glitching.
|
||||
(Fixes: :issue:`1404`)
|
||||
|
||||
Gapless
|
||||
-------
|
||||
|
||||
|
||||
161
docs/config.rst
161
docs/config.rst
@ -49,21 +49,18 @@ below, together with their default values. In addition, all :ref:`extensions
|
||||
defaults are documented on the :ref:`extension pages <ext>`.
|
||||
|
||||
|
||||
Default core configuration
|
||||
==========================
|
||||
Default configuration
|
||||
=====================
|
||||
|
||||
This is the default configuration for Mopidy itself. All extensions bring
|
||||
additional configuration values with their own defaults.
|
||||
|
||||
.. literalinclude:: ../mopidy/config/default.conf
|
||||
:language: ini
|
||||
|
||||
|
||||
Core configuration values
|
||||
=========================
|
||||
|
||||
Mopidy's core has the following configuration values that you can change.
|
||||
|
||||
|
||||
Core configuration
|
||||
------------------
|
||||
Core config section
|
||||
===================
|
||||
|
||||
.. confval:: core/cache_dir
|
||||
|
||||
@ -127,9 +124,15 @@ Core configuration
|
||||
- ``last``: like ``load``, additional start playback if last state was
|
||||
'playing'
|
||||
- ``play``: like ``load``, additional start playback
|
||||
|
||||
|
||||
.. _audio-config:
|
||||
|
||||
|
||||
Audio configuration
|
||||
-------------------
|
||||
===================
|
||||
|
||||
These are the available audio configurations. For specific use cases, see
|
||||
:ref:`audio`.
|
||||
|
||||
.. confval:: audio/mixer
|
||||
|
||||
@ -163,11 +166,12 @@ Audio configuration
|
||||
Expects a GStreamer sink. Typical values are ``autoaudiosink``,
|
||||
``alsasink``, ``osssink``, ``oss4sink``, ``pulsesink``, and ``shout2send``,
|
||||
and additional arguments specific to each sink. You can use the command
|
||||
``gst-inspect-0.10`` to see what output properties can be set on the sink.
|
||||
For example: ``gst-inspect-0.10 shout2send``
|
||||
``gst-inspect-1.0`` to see what output properties can be set on the sink.
|
||||
For example: ``gst-inspect-1.0 shout2send``
|
||||
|
||||
|
||||
Logging configuration
|
||||
---------------------
|
||||
=====================
|
||||
|
||||
.. confval:: logging/color
|
||||
|
||||
@ -218,7 +222,7 @@ Logging configuration
|
||||
.. _proxy-config:
|
||||
|
||||
Proxy configuration
|
||||
-------------------
|
||||
===================
|
||||
|
||||
Not all parts of Mopidy or all Mopidy extensions respect the proxy
|
||||
server configuration when connecting to the Internet. Currently, this is at
|
||||
@ -252,9 +256,10 @@ these configurations to help users on locked down networks.
|
||||
Extension configuration
|
||||
=======================
|
||||
|
||||
Mopidy's extensions have their own config values that you may want to tweak.
|
||||
For the available config values, please refer to the docs for each extension.
|
||||
Most, if not all, can be found at :ref:`ext`.
|
||||
Each installed Mopidy extension adds its own configuration section with one or
|
||||
more config values that you may want to tweak. For the available config
|
||||
values, please refer to the docs for each extension. Most, if not all, can be
|
||||
found at :ref:`ext`.
|
||||
|
||||
Mopidy extensions are enabled by default when they are installed. If you want
|
||||
to disable an extension without uninstalling it, all extensions support the
|
||||
@ -267,118 +272,14 @@ following to your ``mopidy.conf``::
|
||||
enabled = false
|
||||
|
||||
|
||||
Advanced configurations
|
||||
=======================
|
||||
Adding new configuration values
|
||||
===============================
|
||||
|
||||
Custom audio sink
|
||||
-----------------
|
||||
|
||||
If you have successfully installed GStreamer, and then run the ``gst-inspect``
|
||||
or ``gst-inspect-0.10`` command, you should see a long listing of installed
|
||||
plugins, ending in a summary line::
|
||||
|
||||
$ gst-inspect-0.10
|
||||
... long list of installed plugins ...
|
||||
Total count: 254 plugins (1 blacklist entry not shown), 1156 features
|
||||
|
||||
Next, you should be able to produce a audible tone by running::
|
||||
|
||||
gst-launch-0.10 audiotestsrc ! audioresample ! autoaudiosink
|
||||
|
||||
If you cannot hear any sound when running this command, you won't hear any
|
||||
sound from Mopidy either, as Mopidy by default uses GStreamer's
|
||||
``autoaudiosink`` to play audio. Thus, make this work before you file a bug
|
||||
against Mopidy.
|
||||
|
||||
If you for some reason want to use some other GStreamer audio sink than
|
||||
``autoaudiosink``, you can set the :confval:`audio/output` config value to a
|
||||
partial GStreamer pipeline description describing the GStreamer sink you want
|
||||
to use.
|
||||
|
||||
Example ``mopidy.conf`` for using OSS4:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = oss4sink
|
||||
|
||||
Again, this is the equivalent of the following ``gst-inspect`` command, so make
|
||||
this work first::
|
||||
|
||||
gst-launch-0.10 audiotestsrc ! audioresample ! oss4sink
|
||||
|
||||
|
||||
Streaming through SHOUTcast/Icecast
|
||||
-----------------------------------
|
||||
|
||||
.. warning:: Known issue
|
||||
|
||||
Currently, Mopidy does not handle end-of-track vs end-of-stream signalling
|
||||
in GStreamer correctly. This causes the SHOUTcast stream to be disconnected
|
||||
at the end of each track, rendering it quite useless. For further details,
|
||||
see :issue:`492`. You can also try the workaround_ mentioned below.
|
||||
|
||||
If you want to play the audio on another computer than the one running Mopidy,
|
||||
you can stream the audio from Mopidy through an SHOUTcast or Icecast audio
|
||||
streaming server. Multiple media players can then be connected to the streaming
|
||||
server simultaneously. To use the SHOUTcast output, do the following:
|
||||
|
||||
#. Install, configure and start the Icecast server. It can be found in the
|
||||
``icecast2`` package in Debian/Ubuntu.
|
||||
|
||||
#. Set the :confval:`audio/output` config value to ``lame ! shout2send``. An
|
||||
Ogg Vorbis encoder could be used instead of the lame MP3 encoder.
|
||||
|
||||
#. You might also need to change the ``shout2send`` default settings, run
|
||||
``gst-inspect-0.10 shout2send`` to see the available settings. Most likely
|
||||
you want to change ``ip``, ``username``, ``password``, and ``mount``.
|
||||
|
||||
Example for MP3 streaming:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = lame ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=hackme
|
||||
|
||||
Example for Ogg Vorbis streaming:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[audio]
|
||||
output = audioresample ! audioconvert ! vorbisenc ! oggmux ! shout2send mount=mopidy ip=127.0.0.1 port=8000 password=hackme
|
||||
|
||||
Other advanced setups are also possible for outputs. Basically, anything you
|
||||
can use with the ``gst-launch-0.10`` command can be plugged into
|
||||
:confval:`audio/output`.
|
||||
|
||||
.. _workaround:
|
||||
|
||||
**Workaround for end-of-track issues - fallback streams**
|
||||
|
||||
By using a *fallback stream* playing silence, you can somewhat mitigate the
|
||||
signalling issues.
|
||||
|
||||
Example Icecast configuration:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<mount>
|
||||
<mount-name>/mopidy</mount-name>
|
||||
<fallback-mount>/silence.mp3</fallback-mount>
|
||||
<fallback-override>1</fallback-override>
|
||||
</mount>
|
||||
|
||||
The ``silence.mp3`` file needs to be placed in the directory defined by
|
||||
``<webroot>...</webroot>``.
|
||||
|
||||
|
||||
New configuration values
|
||||
------------------------
|
||||
|
||||
Mopidy's config validator will stop you from defining any config values in
|
||||
your config file that Mopidy doesn't know about. This may sound obnoxious,
|
||||
but it helps us detect typos in your config, and deprecated config values that
|
||||
should be removed or updated.
|
||||
Mopidy's config validator will validate all of its own config sections and the
|
||||
config sections belonging to any installed extension. It will raise an error if
|
||||
you add any config values in your config file that Mopidy doesn't know about.
|
||||
This may sound obnoxious, but it helps us detect typos in your config, and to
|
||||
warn about deprecated config values that should be removed or updated.
|
||||
|
||||
If you're extending Mopidy, and want to use Mopidy's configuration
|
||||
system, you can add new sections to the config without triggering the config
|
||||
|
||||
@ -82,6 +82,7 @@ announcements related to Mopidy and Mopidy extensions.
|
||||
config
|
||||
running
|
||||
service
|
||||
audio
|
||||
troubleshooting
|
||||
|
||||
|
||||
|
||||
@ -50,15 +50,7 @@ please follow the directions :ref:`here <contributing>`.
|
||||
If you use Arch Linux, install the following packages from the official
|
||||
repository::
|
||||
|
||||
sudo pacman -S python2-gobject gst-python gst-plugins-good
|
||||
gst-plugins-ugly
|
||||
|
||||
.. warning::
|
||||
|
||||
``gst-python`` installs GStreamer GI overrides for Python 3. As far as
|
||||
we know, Arch currently lacks a package with the corresponding overrides
|
||||
built for Python 2. If a ``gst-python2`` package is added, it will
|
||||
depend on ``python2-gobject``, so we can then shorten this package list.
|
||||
sudo pacman -S gst-python2 gst-plugins-good gst-plugins-ugly
|
||||
|
||||
If you use Fedora you can install GStreamer like this::
|
||||
|
||||
|
||||
@ -385,6 +385,7 @@ class Audio(pykka.ThreadingActor):
|
||||
|
||||
self._playbin = None
|
||||
self._outputs = None
|
||||
self._queue = None
|
||||
self._about_to_finish_callback = None
|
||||
|
||||
self._handler = _Handler(self)
|
||||
@ -481,6 +482,7 @@ class Audio(pykka.ThreadingActor):
|
||||
audio_sink.add_pad(ghost_pad)
|
||||
|
||||
self._playbin.set_property('audio-sink', audio_sink)
|
||||
self._queue = queue
|
||||
|
||||
def _teardown_mixer(self):
|
||||
if self.mixer:
|
||||
@ -628,7 +630,12 @@ class Audio(pykka.ThreadingActor):
|
||||
# TODO: double check seek flags in use.
|
||||
gst_position = utils.millisecond_to_clocktime(position)
|
||||
gst_logger.debug('Sending flushing seek: position=%r', gst_position)
|
||||
result = self._playbin.seek_simple(
|
||||
# Send seek event to the queue not the playbin. The default behavior
|
||||
# for bins is to forward this event to all sinks. Which results in
|
||||
# duplicate seek events making it to appsrc. Since elements are not
|
||||
# allowed to act on the seek event, only modify it, this should be safe
|
||||
# to do.
|
||||
result = self._queue.seek_simple(
|
||||
Gst.Format.TIME, Gst.SeekFlags.FLUSH, gst_position)
|
||||
return result
|
||||
|
||||
@ -741,8 +748,7 @@ class Audio(pykka.ThreadingActor):
|
||||
gobject_value = GObject.Value()
|
||||
gobject_value.init(GObject.TYPE_STRING)
|
||||
gobject_value.set_string(value)
|
||||
taglist.add_value(
|
||||
Gst.TagMergeMode.REPLACE, Gst.TAG_ARTIST, gobject_value)
|
||||
taglist.add_value(Gst.TagMergeMode.REPLACE, tag, gobject_value)
|
||||
|
||||
# Default to blank data to trick shoutcast into clearing any previous
|
||||
# values it might have.
|
||||
|
||||
@ -161,10 +161,10 @@ def _gstreamer_check_elements():
|
||||
'flump3dec',
|
||||
'id3demux',
|
||||
'id3v2mux',
|
||||
'lame',
|
||||
'lamemp3enc',
|
||||
'mad',
|
||||
'mp3parse',
|
||||
# 'mpg123audiodec', # Only available in GStreamer 1.x
|
||||
'mpegaudioparse',
|
||||
'mpg123audiodec',
|
||||
|
||||
# Ogg Vorbis encoding and decoding
|
||||
'vorbisdec',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user