Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f6125f0c35 | ||
![]() |
f780ac418a | ||
![]() |
61a72a5d13 | ||
![]() |
0c0a354753 | ||
![]() |
3c5f860fb8 | ||
![]() |
3da1fa88d0 | ||
![]() |
fac15aaffb | ||
![]() |
c926021599 | ||
![]() |
543776d9c9 | ||
![]() |
8bf3f9b874 | ||
![]() |
f07f8f7d88 | ||
![]() |
39b40ac1fd | ||
![]() |
ea639269d8 | ||
![]() |
0abaa3ecc5 | ||
![]() |
c4d3efe71d | ||
![]() |
85e82e3d4d | ||
![]() |
f44011519c | ||
![]() |
2c3eeb7194 | ||
![]() |
79839db3a3 | ||
![]() |
d478bdda8e | ||
![]() |
1eae9339f2 | ||
![]() |
923c1b6220 | ||
![]() |
09884e608b | ||
![]() |
e239009295 | ||
![]() |
3fae2150f5 | ||
![]() |
f9ca2f52c1 | ||
![]() |
4b81cf0c2c | ||
![]() |
e7acbf112c | ||
![]() |
304d45b551 | ||
![]() |
0f488dcecf | ||
![]() |
17039aec70 | ||
![]() |
fb6cb07912 | ||
![]() |
e9e0e02db3 | ||
![]() |
03507037e8 |
NEWS
android
doc
meson.buildsrc
MusicChunk.hxx
command
db
decoder
input
plugins
output
pcm
player
util
21
NEWS
21
NEWS
@@ -1,3 +1,24 @@
|
||||
ver 0.21.11 (2019/07/03)
|
||||
* input
|
||||
- tidal: deprecated because Tidal has changed the protocol
|
||||
* decoder
|
||||
- wildmidi: log error if library initialization fails
|
||||
* output
|
||||
- alsa: fix busy loop while draining
|
||||
- alsa: fix missing drain call
|
||||
- alsa: improve xrun-avoiding silence generator
|
||||
- alsa: log when generating silence due to slow decoder
|
||||
- alsa, osx: fix distortions with DSD_U32 and DoP on 32 bit CPUs
|
||||
* protocol
|
||||
- fix "list" with multiple "group" levels
|
||||
|
||||
ver 0.21.10 (2019/06/05)
|
||||
* decoder
|
||||
- opus: fix duplicate tags
|
||||
* output
|
||||
- httpd: reject some well-known URIs
|
||||
* fix crash bug (0.21.9 regression)
|
||||
|
||||
ver 0.21.9 (2019/05/20)
|
||||
* input
|
||||
- buffer: fix deadlock bug
|
||||
|
@@ -2,8 +2,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.musicpd"
|
||||
android:installLocation="auto"
|
||||
android:versionCode="32"
|
||||
android:versionName="0.21.9">
|
||||
android:versionCode="34"
|
||||
android:versionName="0.21.11">
|
||||
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26"/>
|
||||
|
||||
|
@@ -38,7 +38,7 @@ author = 'Max Kellermann'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.21.9'
|
||||
version = '0.21.11'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
|
@@ -2,12 +2,12 @@ Developer's Manual
|
||||
##################
|
||||
|
||||
Introduction
|
||||
============
|
||||
************
|
||||
|
||||
This is a guide for those who wish to hack on the MPD source code. MPD is an open project, and we are always happy about contributions. So far, more than 150 people have contributed patches. This document is work in progress. Most of it may be incomplete yet. Please help!
|
||||
|
||||
Code Style
|
||||
==========
|
||||
**********
|
||||
|
||||
* indent with tabs (width 8)
|
||||
* don't write CPP when you can write C++: use inline functions and constexpr instead of macros
|
||||
@@ -18,7 +18,6 @@ Code Style
|
||||
* classes and functions names use CamelCase; variables are lower-case with words separated by underscore
|
||||
|
||||
Some example code:
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
@@ -33,7 +32,7 @@ Some example code:
|
||||
}
|
||||
|
||||
Hacking The Source
|
||||
==================
|
||||
******************
|
||||
|
||||
MPD sources are managed in a git repository on
|
||||
`Github <https://github.com/MusicPlayerDaemon/>`_.
|
||||
@@ -59,7 +58,7 @@ possible, to be sure that you don't break any disabled code.
|
||||
Don't mix several changes in one single patch. Create a separate patch for every change. Tools like :program:`stgit` help you with that. This way, we can review your patches more easily, and we can pick the patches we like most first.
|
||||
|
||||
Basic stgit usage
|
||||
-----------------
|
||||
=================
|
||||
|
||||
stgit allows you to create a set of patches and refine all of them: you can go back to any patch at any time, and re-edit it (both the code and the commit message). You can reorder patches and insert new patches at any position. It encourages creating separate patches for tiny changes.
|
||||
|
||||
@@ -94,33 +93,7 @@ When the whole patch series is finished, convert stgit patches to git commits:
|
||||
stg commit
|
||||
|
||||
Submitting Patches
|
||||
==================
|
||||
******************
|
||||
|
||||
Submit pull requests on GitHub:
|
||||
https://github.com/MusicPlayerDaemon/MPD/pulls
|
||||
|
||||
Development Tools
|
||||
=================
|
||||
|
||||
Clang Static Analyzer
|
||||
---------------------
|
||||
|
||||
The `static analyzer <http://clang-analyzer.llvm.org/>`_ is a tool that helps find bugs. To run it on the MPD code base, install LLVM and clang. configure MPD to use clang:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
./configure --enable-debug CXX=clang++ CC=clang ...
|
||||
|
||||
It is recommended to use :code:`--enable-debug`, because the analyzer
|
||||
takes advantage of :dfn:`assert()` calls, which are only enabled in
|
||||
the debug build.
|
||||
|
||||
Now run the analyzer:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
scan-build --use-c++=clang++ --use-cc=clang make
|
||||
|
||||
The options :code:`--use-c++` and :code:`--use-cc` are necessary
|
||||
because it invokes :command:`cc` for actually compiling the sources by
|
||||
default. That breaks, because MPD requires a C99 compiler.
|
||||
|
@@ -1,165 +0,0 @@
|
||||
<?xml version='1.0' encoding="utf-8"?>
|
||||
<!DOCTYPE itemizedlist PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>artist</varname>: the artist name. Its meaning is not
|
||||
well-defined; see <varname>composer</varname> and
|
||||
<varname>performer</varname> for more specific tags.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>artistsort</varname>: same as
|
||||
<varname>artist</varname>, but for sorting. This usually omits
|
||||
prefixes such as "The".
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>album</varname>: the album name.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>albumsort</varname>: same as <varname>album</varname>,
|
||||
but for sorting.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>albumartist</varname>: on multi-artist albums, this is
|
||||
the artist name which shall be used for the whole album. The
|
||||
exact meaning of this tag is not well-defined.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>albumartistsort</varname>: same as
|
||||
<varname>albumartist</varname>, but for sorting.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>title</varname>: the song title.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>track</varname>: the decimal track number within the
|
||||
album.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>name</varname>: a name for this song. This is not the
|
||||
song title. The exact meaning of this tag is not well-defined.
|
||||
It is often used by badly configured internet radio stations
|
||||
with broken tags to squeeze both the artist name and the song
|
||||
title in one tag.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>genre</varname>: the music genre.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>date</varname>: the song's release date. This is
|
||||
usually a 4-digit year.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>composer</varname>: the artist who composed the song.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>performer</varname>: the artist who performed the song.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>comment</varname>: a human-readable comment about this
|
||||
song. The exact meaning of this tag is not well-defined.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>disc</varname>: the decimal disc number in a multi-disc
|
||||
album.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_artistid</varname>: the artist id in the
|
||||
<ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_albumid</varname>: the album id in the
|
||||
<ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_albumartistid</varname>: the album artist
|
||||
id in the <ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_trackid</varname>: the track id in the
|
||||
<ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_releasetrackid</varname>: the release track
|
||||
id in the <ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<varname>musicbrainz_workid</varname>: the work id in the
|
||||
<ulink
|
||||
url="https://picard.musicbrainz.org/docs/mappings/">MusicBrainz</ulink>
|
||||
database.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
203
doc/plugins.rst
203
doc/plugins.rst
@@ -4,10 +4,10 @@ Plugin reference
|
||||
.. _database_plugins:
|
||||
|
||||
Database plugins
|
||||
----------------
|
||||
================
|
||||
|
||||
simple
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
The default plugin. Stores a copy of the database in memory. A file is used for permanent storage.
|
||||
|
||||
@@ -25,7 +25,7 @@ The default plugin. Stores a copy of the database in memory. A file is used for
|
||||
- Compress the database file using gzip? Enabled by default (if built with zlib).
|
||||
|
||||
proxy
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Provides access to the database of another :program:`MPD` instance using libmpdclient. This is useful when you run mount the music directory via NFS/SMB, and the file server already runs a :program:`MPD` instance. Only the file server needs to update the database.
|
||||
|
||||
@@ -45,30 +45,30 @@ Provides access to the database of another :program:`MPD` instance using libmpdc
|
||||
- Send TCP keepalive packets to the "master" :program:`MPD` instance? This option can help avoid certain firewalls dropping inactive connections, at the expensive of a very small amount of additional network traffic. Disabled by default.
|
||||
|
||||
upnp
|
||||
~~~~
|
||||
----
|
||||
|
||||
Provides access to UPnP media servers.
|
||||
|
||||
Storage plugins
|
||||
---------------
|
||||
===============
|
||||
|
||||
local
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
The default plugin which gives :program:`MPD` access to local files. It is used when music_directory refers to a local directory.
|
||||
|
||||
curl
|
||||
~~~~
|
||||
----
|
||||
|
||||
A WebDAV client using libcurl. It is used when :code:`music_directory` contains a http:// or https:// URI, for example :samp:`https://the.server/dav/`.
|
||||
|
||||
smbclient
|
||||
~~~~~~~~~
|
||||
---------
|
||||
|
||||
Load music files from a SMB/CIFS server. It is used when :code:`music_directory` contains a smb:// URI, for example :samp:`smb://myfileserver/Music`.
|
||||
|
||||
nfs
|
||||
~~~
|
||||
---
|
||||
|
||||
Load music files from a NFS server. It is used when :code:`music_directory` contains a nfs:// URI according to RFC2224, for example :samp:`nfs://servername/path`.
|
||||
|
||||
@@ -81,7 +81,7 @@ This plugin uses libnfs, which supports only NFS version 3. Since :program:`MPD`
|
||||
Don't fear: "insecure" does not mean that your NFS server is insecure. A few decades ago, people thought the concept of "privileged ports" would make network services "secure", which was a fallacy. The absence of this obsolete "security" measure means little.
|
||||
|
||||
udisks
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Mount file systems (e.g. USB sticks or other removable media) using
|
||||
the udisks2 daemon via D-Bus. To obtain a valid udisks2 URI, consult
|
||||
@@ -106,29 +106,30 @@ MPD user.
|
||||
.. _neighbor_plugin:
|
||||
|
||||
Neighbor plugins
|
||||
----------------
|
||||
================
|
||||
|
||||
smbclient
|
||||
~~~~~~~~~
|
||||
---------
|
||||
|
||||
Provides a list of SMB/CIFS servers on the local network.
|
||||
|
||||
udisks
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Queries the udisks2 daemon via D-Bus and obtain a list of file systems (e.g. USB sticks or other removable media).
|
||||
|
||||
upnp
|
||||
~~~~
|
||||
----
|
||||
|
||||
Provides a list of UPnP servers on the local network.
|
||||
|
||||
.. _input_plugins:
|
||||
|
||||
Input plugins
|
||||
-------------
|
||||
=============
|
||||
|
||||
alsa
|
||||
~~~~
|
||||
----
|
||||
|
||||
Allows :program:`MPD` on Linux to play audio directly from a soundcard using the scheme alsa://. Audio is formatted as 44.1 kHz 16-bit stereo (CD format). Examples:
|
||||
|
||||
@@ -141,7 +142,7 @@ Allows :program:`MPD` on Linux to play audio directly from a soundcard using the
|
||||
mpc add alsa://hw:1,0 plays audio from device hw:1,0 cdio_paranoia
|
||||
|
||||
cdio_paranoia
|
||||
~~~~~~~~~~~~~
|
||||
-------------
|
||||
|
||||
Plays audio CDs using libcdio. The URI has the form: "cdda://[DEVICE][/TRACK]". The simplest form cdda:// plays the whole disc in the default drive.
|
||||
|
||||
@@ -157,7 +158,7 @@ Plays audio CDs using libcdio. The URI has the form: "cdda://[DEVICE][/TRACK]".
|
||||
- Request CDParanoia cap the extraction speed to Nx normal CD audio rotation speed, keeping the drive quiet.
|
||||
|
||||
curl
|
||||
~~~~
|
||||
----
|
||||
|
||||
Opens remote files or streams over HTTP using libcurl.
|
||||
|
||||
@@ -179,22 +180,22 @@ Note that unless overridden by the below settings (e.g. by setting them to a bla
|
||||
- Verify the certificate's name against host? `More information <http://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html>`_.
|
||||
|
||||
ffmpeg
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Access to various network protocols implemented by the FFmpeg library: gopher://, rtp://, rtsp://, rtmp://, rtmpt://, rtmps://
|
||||
|
||||
file
|
||||
~~~~
|
||||
----
|
||||
|
||||
Opens local files
|
||||
|
||||
mms
|
||||
~~~
|
||||
---
|
||||
|
||||
Plays streams with the MMS protocol using `libmms <https://launchpad.net/libmms>`_.
|
||||
|
||||
nfs
|
||||
~~~
|
||||
---
|
||||
|
||||
Allows :program:`MPD` to access files on NFSv3 servers without actually mounting them (i.e. in userspace, without help from the kernel's VFS layer). All URIs with the nfs:// scheme are used according to RFC2224. Example:
|
||||
|
||||
@@ -205,7 +206,7 @@ Allows :program:`MPD` to access files on NFSv3 servers without actually mounting
|
||||
Note that this usually requires enabling the "insecure" flag in the server's /etc/exports file, because :program:`MPD` cannot bind to so-called "privileged" ports. Don't fear: this will not make your file server insecure; the flag was named in a time long ago when privileged ports were thought to be meaningful for security. By today's standards, NFSv3 is not secure at all, and if you believe it is, you're already doomed.
|
||||
|
||||
smbclient
|
||||
~~~~~~~~~
|
||||
---------
|
||||
|
||||
Allows :program:`MPD` to access files on SMB/CIFS servers (e.g. Samba or Microsoft Windows). All URIs with the smb:// scheme are used. Example:
|
||||
|
||||
@@ -214,7 +215,7 @@ Allows :program:`MPD` to access files on SMB/CIFS servers (e.g. Samba or Microso
|
||||
mpc add smb://servername/sharename/filename.ogg
|
||||
|
||||
qobuz
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Play songs from the commercial streaming service Qobuz. It plays URLs in the form qobuz://track/ID, e.g.:
|
||||
|
||||
@@ -240,10 +241,15 @@ Play songs from the commercial streaming service Qobuz. It plays URLs in the for
|
||||
- The `Qobuz format identifier <https://github.com/Qobuz/api-documentation/blob/master/endpoints/track/getFileUrl.md#parameters>`_, i.e. a number which chooses the format and quality to be requested from Qobuz. The default is "5" (320 kbit/s MP3).
|
||||
|
||||
tidal
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Play songs from the commercial streaming service `Tidal <http://tidal.com/>`_. It plays URLs in the form tidal://track/ID, e.g.:
|
||||
|
||||
.. warning::
|
||||
|
||||
This plugin is currently defunct because Tidal has changed the
|
||||
protocol and decided not to share documentation.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
mpc add tidal://track/59727857
|
||||
@@ -266,10 +272,10 @@ Play songs from the commercial streaming service `Tidal <http://tidal.com/>`_. I
|
||||
.. _decoder_plugins:
|
||||
|
||||
Decoder plugins
|
||||
---------------
|
||||
===============
|
||||
|
||||
adplug
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes AdLib files using libadplug.
|
||||
|
||||
@@ -283,17 +289,17 @@ Decodes AdLib files using libadplug.
|
||||
- The sample rate that shall be synthesized by the plugin. Defaults to 48000.
|
||||
|
||||
audiofile
|
||||
~~~~~~~~~
|
||||
---------
|
||||
|
||||
Decodes WAV and AIFF files using libaudiofile.
|
||||
|
||||
faad
|
||||
~~~~
|
||||
----
|
||||
|
||||
Decodes AAC files using libfaad.
|
||||
|
||||
ffmpeg
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes various codecs using FFmpeg.
|
||||
|
||||
@@ -309,12 +315,12 @@ Decodes various codecs using FFmpeg.
|
||||
- Sets the FFmpeg muxer option probesize, which specifies probing size in bytes, i.e. the size of the data to analyze to get stream information. The `FFmpeg formats documentation <https://ffmpeg.org/ffmpeg-formats.html>`_ has more information.
|
||||
|
||||
flac
|
||||
~~~~
|
||||
----
|
||||
|
||||
Decodes FLAC files using libFLAC.
|
||||
|
||||
dsdiff
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes DFF files containing DSDIFF data (e.g. SACD rips).
|
||||
|
||||
@@ -328,12 +334,12 @@ Decodes DFF files containing DSDIFF data (e.g. SACD rips).
|
||||
- Decode the least significant bit first. Default is no.
|
||||
|
||||
dsf
|
||||
~~~
|
||||
---
|
||||
|
||||
Decodes DSF files containing DSDIFF data (e.g. SACD rips).
|
||||
|
||||
fluidsynth
|
||||
~~~~~~~~~~
|
||||
----------
|
||||
|
||||
MIDI decoder based on `FluidSynth <http://www.fluidsynth.org/>`_.
|
||||
|
||||
@@ -349,7 +355,7 @@ MIDI decoder based on `FluidSynth <http://www.fluidsynth.org/>`_.
|
||||
- The absolute path of the soundfont file. Defaults to :file:`/usr/share/sounds/sf2/FluidR3_GM.sf2`.
|
||||
|
||||
gme
|
||||
~~~
|
||||
---
|
||||
|
||||
Video game music file emulator based on `game-music-emu <https://bitbucket.org/mpyne/game-music-emu/wiki/Home>`_.
|
||||
|
||||
@@ -363,7 +369,7 @@ Video game music file emulator based on `game-music-emu <https://bitbucket.org/m
|
||||
- Enable more accurate sound emulation.
|
||||
|
||||
hybrid_dsd
|
||||
~~~~~~~~~~
|
||||
----------
|
||||
|
||||
`Hybrid-DSD
|
||||
<http://dsdmaster.blogspot.de/p/bitperfect-introduces-hybrid-dsd-file.html>`_
|
||||
@@ -386,12 +392,12 @@ of the file is better.
|
||||
- This specifies whether to support gapless playback of MP3s which have the necessary headers. Useful if your MP3s have headers with incorrect information. If you have such MP3s, it is highly recommended that you fix them using `vbrfix <http://www.willwap.co.uk/Programs/vbrfix.php>`_ instead of disabling gapless MP3 playback. The default is to support gapless MP3 playback.
|
||||
|
||||
mad
|
||||
~~~
|
||||
---
|
||||
|
||||
Decodes MP3 files using `libmad <http://www.underbit.com/products/mad/>`_.
|
||||
|
||||
mikmod
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Module player based on `MikMod <http://mikmod.sourceforge.net/>`_.
|
||||
|
||||
@@ -407,7 +413,7 @@ Module player based on `MikMod <http://mikmod.sourceforge.net/>`_.
|
||||
- Sets the sample rate generated by libmikmod. Default is 44100.
|
||||
|
||||
modplug
|
||||
~~~~~~~
|
||||
-------
|
||||
|
||||
Module player based on MODPlug.
|
||||
|
||||
@@ -421,27 +427,27 @@ Module player based on MODPlug.
|
||||
- Number of times to loop the module if it uses backward loops. Default is 0 which prevents looping. -1 loops forever.
|
||||
|
||||
mpcdec
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes Musepack files using `libmpcdec <http://www.musepack.net/>`_.
|
||||
|
||||
mpg123
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes MP3 files using `libmpg123 <http://www.mpg123.de/>`_.
|
||||
|
||||
opus
|
||||
~~~~
|
||||
----
|
||||
|
||||
Decodes Opus files using `libopus <http://www.opus-codec.org/>`_.
|
||||
|
||||
pcm
|
||||
~~~
|
||||
---
|
||||
|
||||
Read raw PCM samples. It understands the "audio/L16" MIME type with parameters "rate" and "channels" according to RFC 2586. It also understands the MPD-specific MIME type "audio/x-mpd-float".
|
||||
|
||||
sidplay
|
||||
~~~~~~~
|
||||
-------
|
||||
|
||||
C64 SID decoder based on `libsidplayfp <https://sourceforge.net/projects/sidplay-residfp/>`_ or `libsidplay2 <https://sourceforge.net/projects/sidplay2/>`_.
|
||||
|
||||
@@ -463,23 +469,23 @@ C64 SID decoder based on `libsidplayfp <https://sourceforge.net/projects/sidplay
|
||||
- Only libsidplayfp. Absolute path to basic rom image file.
|
||||
|
||||
sndfile
|
||||
~~~~~~~
|
||||
-------
|
||||
|
||||
Decodes WAV and AIFF files using `libsndfile <http://www.mega-nerd.com/libsndfile/>`_.
|
||||
|
||||
|
||||
vorbis
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Decodes Ogg-Vorbis files using `libvorbis <http://www.xiph.org/ogg/vorbis/>`_.
|
||||
|
||||
wavpack
|
||||
~~~~~~~
|
||||
-------
|
||||
|
||||
Decodes WavPack files using `libwavpack <http://www.wavpack.com/>`_.
|
||||
|
||||
wildmidi
|
||||
~~~~~~~~
|
||||
--------
|
||||
|
||||
MIDI decoder based on `libwildmidi <http://www.mindwerks.net/projects/wildmidi/>`_.
|
||||
|
||||
@@ -495,10 +501,11 @@ MIDI decoder based on `libwildmidi <http://www.mindwerks.net/projects/wildmidi/>
|
||||
.. _encoder_plugins:
|
||||
|
||||
Encoder plugins
|
||||
---------------
|
||||
===============
|
||||
|
||||
flac
|
||||
~~~~
|
||||
----
|
||||
|
||||
Encodes into `FLAC <https://xiph.org/flac/>`_ (lossless).
|
||||
|
||||
.. list-table::
|
||||
@@ -511,7 +518,7 @@ Encodes into `FLAC <https://xiph.org/flac/>`_ (lossless).
|
||||
- Sets the libFLAC compression level. The levels range from 0 (fastest, least compression) to 8 (slowest, most compression).
|
||||
|
||||
lame
|
||||
~~~~
|
||||
----
|
||||
|
||||
Encodes into MP3 using the `LAME <http://lame.sourceforge.net/>`_ library.
|
||||
|
||||
@@ -527,12 +534,12 @@ Encodes into MP3 using the `LAME <http://lame.sourceforge.net/>`_ library.
|
||||
- Sets the bit rate in kilobit per second. Cannot be used with quality.
|
||||
|
||||
null
|
||||
~~~~
|
||||
----
|
||||
|
||||
Does not encode anything, passes the input PCM data as-is.
|
||||
|
||||
shine
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Encodes into MP3 using the `Shine <https://github.com/savonet/shine>`_ library.
|
||||
|
||||
@@ -546,7 +553,7 @@ Encodes into MP3 using the `Shine <https://github.com/savonet/shine>`_ library.
|
||||
- Sets the bit rate in kilobit per second.
|
||||
|
||||
twolame
|
||||
~~~~~~~
|
||||
-------
|
||||
|
||||
Encodes into MP2 using the `TwoLAME <http://www.twolame.org/>`_ library.
|
||||
|
||||
@@ -562,7 +569,7 @@ Encodes into MP2 using the `TwoLAME <http://www.twolame.org/>`_ library.
|
||||
- Sets the bit rate in kilobit per second. Cannot be used with quality.
|
||||
|
||||
opus
|
||||
~~~~
|
||||
----
|
||||
|
||||
Encodes into `Ogg Opus <http://www.opus-codec.org/>`_.
|
||||
|
||||
@@ -584,7 +591,7 @@ Encodes into `Ogg Opus <http://www.opus-codec.org/>`_.
|
||||
.. _vorbis_plugin:
|
||||
|
||||
vorbis
|
||||
~~~~~~
|
||||
------
|
||||
|
||||
Encodes into `Ogg Vorbis <http://www.vorbis.com/>`_.
|
||||
|
||||
@@ -600,13 +607,13 @@ Encodes into `Ogg Vorbis <http://www.vorbis.com/>`_.
|
||||
- Sets the bit rate in kilobit per second. Cannot be used with quality.
|
||||
|
||||
wave
|
||||
~~~~
|
||||
----
|
||||
Encodes into WAV (lossless).
|
||||
|
||||
.. _resampler_plugins:
|
||||
|
||||
Resampler plugins
|
||||
-----------------
|
||||
=================
|
||||
|
||||
The resampler can be configured in a block named resampler, for example:
|
||||
|
||||
@@ -629,12 +636,12 @@ The following table lists the resampler options valid for all plugins:
|
||||
- The name of the plugin.
|
||||
|
||||
internal
|
||||
~~~~~~~~
|
||||
--------
|
||||
|
||||
A resampler built into :program:`MPD`. Its quality is very poor, but its CPU usage is low. This is the fallback if :program:`MPD` was compiled without an external resampler.
|
||||
|
||||
libsamplerate
|
||||
~~~~~~~~~~~~~
|
||||
-------------
|
||||
|
||||
A resampler using `libsamplerate <http://www.mega-nerd.com/SRC/>`_ a.k.a. Secret Rabbit Code (SRC).
|
||||
|
||||
@@ -667,7 +674,7 @@ The following converter types are provided by libsamplerate:
|
||||
- Linear interpolator, very fast, poor quality.
|
||||
|
||||
soxr
|
||||
~~~~
|
||||
----
|
||||
|
||||
A resampler using `libsoxr <http://sourceforge.net/projects/soxr/>`_, the SoX Resampler library
|
||||
|
||||
@@ -693,12 +700,12 @@ Valid quality values for libsoxr:
|
||||
.. _output_plugins:
|
||||
|
||||
Output plugins
|
||||
--------------
|
||||
==============
|
||||
|
||||
.. _alsa_plugin:
|
||||
|
||||
alsa
|
||||
~~~~
|
||||
----
|
||||
|
||||
The `Advanced Linux Sound Architecture (ALSA) <http://www.alsa-project.org/>`_ plugin uses libasound. It is recommended if you are using Linux.
|
||||
|
||||
@@ -757,7 +764,7 @@ The following attributes can be configured at runtime using the outputset comman
|
||||
|
||||
|
||||
ao
|
||||
~~
|
||||
--
|
||||
The ao plugin uses the portable `libao <https://www.xiph.org/ao/>`_ library. Use only if there is no native plugin for your operating system.
|
||||
|
||||
.. list-table::
|
||||
@@ -774,7 +781,8 @@ The ao plugin uses the portable `libao <https://www.xiph.org/ao/>`_ library. Use
|
||||
- This specifies how many bytes to write to the audio device at once. This parameter is to work around a bug in older versions of libao on sound cards with very small buffers. The default is 1024.
|
||||
|
||||
sndio
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
The sndio plugin uses the `sndio <http://www.sndio.org/>`_ library. It should normally be used on OpenBSD.
|
||||
|
||||
.. list-table::
|
||||
@@ -789,7 +797,7 @@ The sndio plugin uses the `sndio <http://www.sndio.org/>`_ library. It should no
|
||||
- Set the application buffer time in milliseconds.
|
||||
|
||||
fifo
|
||||
~~~~
|
||||
----
|
||||
|
||||
The fifo plugin writes raw PCM data to a FIFO (First In, First Out) file. The data can be read by another program.
|
||||
|
||||
@@ -803,7 +811,7 @@ The fifo plugin writes raw PCM data to a FIFO (First In, First Out) file. The da
|
||||
- This specifies the path of the FIFO to write to. Must be an absolute path. If the path does not exist, it will be created when MPD is started, and removed when MPD is stopped. The FIFO will be created with the same user and group as MPD is running as. Default permissions can be modified by using the builtin shell command umask. If a FIFO already exists at the specified path it will be reused, and will not be removed when MPD is stopped. You can use the "mkfifo" command to create this, and then you may modify the permissions to your liking.
|
||||
|
||||
haiku
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Use the SoundPlayer API on the Haiku operating system.
|
||||
|
||||
@@ -812,7 +820,8 @@ removed soon, unless there is a new maintainer.
|
||||
|
||||
|
||||
jack
|
||||
~~~~
|
||||
----
|
||||
|
||||
The jack plugin connects to a `JACK server <http://jackaudio.org/>`_.
|
||||
|
||||
.. list-table::
|
||||
@@ -835,7 +844,8 @@ The jack plugin connects to a `JACK server <http://jackaudio.org/>`_.
|
||||
- Sets the size of the ring buffer for each channel. Do not configure this value unless you know what you're doing.
|
||||
|
||||
httpd
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
The httpd plugin creates a HTTP server, similar to `ShoutCast <http://www.shoutcast.com/>`_ / `IceCast <http://icecast.org/>`_. HTTP streaming clients like mplayer, VLC, and mpv can connect to it.
|
||||
|
||||
It is highly recommended to configure a fixed format, because a stream cannot switch its audio format on-the-fly when the song changes.
|
||||
@@ -856,7 +866,8 @@ It is highly recommended to configure a fixed format, because a stream cannot sw
|
||||
- Sets a limit, number of concurrent clients. When set to 0 no limit will apply.
|
||||
|
||||
null
|
||||
~~~~
|
||||
----
|
||||
|
||||
The null plugin does nothing. It discards everything sent to it.
|
||||
|
||||
.. list-table::
|
||||
@@ -871,7 +882,8 @@ The null plugin does nothing. It discards everything sent to it.
|
||||
.. _oss_plugin:
|
||||
|
||||
oss
|
||||
~~~
|
||||
---
|
||||
|
||||
The "Open Sound System" plugin is supported on most Unix platforms.
|
||||
|
||||
On Linux, OSS has been superseded by ALSA. Use the ALSA output plugin :ref:`alsa_plugin` instead of this one on Linux.
|
||||
@@ -899,7 +911,7 @@ The according hardware mixer plugin understands the following settings:
|
||||
- Choose a mixer control, defaulting to PCM.
|
||||
|
||||
openal
|
||||
~~~~~~
|
||||
------
|
||||
The "OpenAL" plugin uses `libopenal <http://kcat.strangesoft.net/openal.html>`_. It is supported on many platforms. Use only if there is no native plugin for your operating system.
|
||||
|
||||
.. list-table::
|
||||
@@ -912,7 +924,7 @@ The "OpenAL" plugin uses `libopenal <http://kcat.strangesoft.net/openal.html>`_.
|
||||
- Sets the device which should be used. This can be any valid OpenAL device name. If not specified, then libopenal will choose a default device.
|
||||
|
||||
osx
|
||||
~~~
|
||||
---
|
||||
The "Mac OS X" plugin uses Apple's CoreAudio API.
|
||||
|
||||
.. list-table::
|
||||
@@ -933,7 +945,7 @@ The "Mac OS X" plugin uses Apple's CoreAudio API.
|
||||
The channel map may not refer to outputs that do not exist according to the format. If the format is "*:*:1" (mono) and you have a four-channel sound card then "-1,-1,0,0" (dual mono output on the second pair of sound card outputs) is a valid channel map but "-1,-1,0,1" is not because the second channel ('1') does not exist when the output is mono.
|
||||
|
||||
pipe
|
||||
~~~~
|
||||
----
|
||||
|
||||
The pipe plugin starts a program and writes raw PCM data into its standard input.
|
||||
|
||||
@@ -949,7 +961,7 @@ The pipe plugin starts a program and writes raw PCM data into its standard input
|
||||
.. _pulse_plugin:
|
||||
|
||||
pulse
|
||||
~~~~~
|
||||
-----
|
||||
The pulse plugin connects to a `PulseAudio <http://www.freedesktop.org/wiki/Software/PulseAudio/>`_ server. Requires libpulse.
|
||||
|
||||
.. list-table::
|
||||
@@ -966,7 +978,7 @@ The pulse plugin connects to a `PulseAudio <http://www.freedesktop.org/wiki/Soft
|
||||
- Specifies a linear scaling coefficient (ranging from 0.5 to 5.0) to apply when adjusting volume through :program:`MPD`. For example, chosing a factor equal to ``"0.7"`` means that setting the volume to 100 in :program:`MPD` will set the PulseAudio volume to 70%, and a factor equal to ``"3.5"`` means that volume 100 in :program:`MPD` corresponds to a 350% PulseAudio volume.
|
||||
|
||||
recorder
|
||||
~~~~~~~~
|
||||
--------
|
||||
The recorder plugin writes the audio played by :program:`MPD` to a file. This may be useful for recording radio streams.
|
||||
|
||||
.. list-table::
|
||||
@@ -978,13 +990,13 @@ The recorder plugin writes the audio played by :program:`MPD` to a file. This ma
|
||||
* - **path P**
|
||||
- Write to this file.
|
||||
* - **format_path P**
|
||||
- An alternative to path which provides a format string referring to tag values. The special tag iso8601 emits the current date and time in `ISO8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format (UTC). Every time a new song starts or a new tag gets received from a radio station, a new file is opened. If the format does not render a file name, nothing is recorded. A tag name enclosed in percent signs ('%') is replaced with the tag value. Example: :file:`~/.mpd/recorder/%artist% - %title%.ogg`. Square brackets can be used to group a substring. If none of the tags referred in the group can be found, the whole group is omitted. Example: [~/.mpd/recorder/[%artist% - ]%title%.ogg] (this omits the dash when no artist tag exists; if title also doesn't exist, no file is written). The operators "|" (logical "or") and "&" (logical "and") can be used to select portions of the format string depending on the existing tag values. Example: ~/.mpd/recorder/[%title%|%name%].ogg (use the "name" tag if no title exists)
|
||||
- An alternative to path which provides a format string referring to tag values. The special tag iso8601 emits the current date and time in `ISO8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ format (UTC). Every time a new song starts or a new tag gets received from a radio station, a new file is opened. If the format does not render a file name, nothing is recorded. A tag name enclosed in percent signs ('%') is replaced with the tag value. Example: :file:`-/.mpd/recorder/%artist% - %title%.ogg`. Square brackets can be used to group a substring. If none of the tags referred in the group can be found, the whole group is omitted. Example: [-/.mpd/recorder/[%artist% - ]%title%.ogg] (this omits the dash when no artist tag exists; if title also doesn't exist, no file is written). The operators "|" (logical "or") and "&" (logical "and") can be used to select portions of the format string depending on the existing tag values. Example: -/.mpd/recorder/[%title%|%name%].ogg (use the "name" tag if no title exists)
|
||||
* - **encoder NAME**
|
||||
- Chooses an encoder plugin. A list of encoder plugins can be found in the encoder plugin reference :ref:`encoder_plugins`.
|
||||
|
||||
|
||||
shout
|
||||
~~~~~
|
||||
-----
|
||||
The shout plugin connects to a ShoutCast or IceCast server using libshout. It forwards tags to this server.
|
||||
|
||||
You must set a format.
|
||||
@@ -1028,7 +1040,7 @@ You must set a format.
|
||||
.. _sles_output:
|
||||
|
||||
sles
|
||||
~~~~
|
||||
----
|
||||
|
||||
Plugin using the `OpenSL ES <https://www.khronos.org/opensles/>`__
|
||||
audio API. Its primary use is local playback on Android, where
|
||||
@@ -1036,7 +1048,7 @@ audio API. Its primary use is local playback on Android, where
|
||||
|
||||
|
||||
solaris
|
||||
~~~~~~~
|
||||
-------
|
||||
The "Solaris" plugin runs only on SUN Solaris, and plays via /dev/audio.
|
||||
|
||||
.. list-table::
|
||||
@@ -1052,22 +1064,22 @@ The "Solaris" plugin runs only on SUN Solaris, and plays via /dev/audio.
|
||||
.. _filter_plugins:
|
||||
|
||||
Filter plugins
|
||||
--------------
|
||||
==============
|
||||
|
||||
normalize
|
||||
~~~~~~~~~
|
||||
---------
|
||||
|
||||
Normalize the volume during playback (at the expensve of quality).
|
||||
|
||||
|
||||
null
|
||||
~~~~
|
||||
----
|
||||
|
||||
A no-op filter. Audio data is returned as-is.
|
||||
|
||||
|
||||
route
|
||||
~~~~~
|
||||
-----
|
||||
|
||||
Reroute channels.
|
||||
|
||||
@@ -1084,43 +1096,44 @@ Reroute channels.
|
||||
.. _playlist_plugins:
|
||||
|
||||
Playlist plugins
|
||||
----------------
|
||||
================
|
||||
|
||||
asx
|
||||
~~~
|
||||
---
|
||||
|
||||
Reads .asx playlist files.
|
||||
|
||||
cue
|
||||
~~~
|
||||
---
|
||||
Reads .cue files.
|
||||
|
||||
embcue
|
||||
~~~~~~
|
||||
------
|
||||
Reads CUE sheets from the "CUESHEET" tag of song files.
|
||||
|
||||
m3u
|
||||
~~~
|
||||
---
|
||||
Reads .m3u playlist files.
|
||||
|
||||
extm3u
|
||||
~~~~~~
|
||||
------
|
||||
Reads extended .m3u playlist files.
|
||||
|
||||
flac
|
||||
~~~~
|
||||
----
|
||||
Reads the cuesheet metablock from a FLAC file.
|
||||
|
||||
pls
|
||||
~~~
|
||||
---
|
||||
Reads .pls playlist files.
|
||||
|
||||
rss
|
||||
~~~
|
||||
---
|
||||
Reads music links from .rss files.
|
||||
|
||||
soundcloud
|
||||
~~~~~~~~~~
|
||||
----------
|
||||
|
||||
Download playlist from SoundCloud. It accepts URIs starting with soundcloud://.
|
||||
|
||||
.. list-table::
|
||||
@@ -1133,5 +1146,5 @@ Download playlist from SoundCloud. It accepts URIs starting with soundcloud://.
|
||||
- An API key to access the SoundCloud servers.
|
||||
|
||||
xspf
|
||||
~~~~
|
||||
----
|
||||
Reads XSPF playlist files.
|
||||
|
@@ -65,13 +65,13 @@ Binary Responses
|
||||
|
||||
Some commands can return binary data. This is initiated by a line
|
||||
containing ``binary: 1234`` (followed as usual by a newline). After
|
||||
that, the specified number of bytes of binary data follows (without an
|
||||
extra newline, because this binary data is not a text line), and
|
||||
finally the ``OK`` line. Example::
|
||||
that, the specified number of bytes of binary data follows, then a
|
||||
newline, and finally the ``OK`` line. Example::
|
||||
|
||||
foo: bar
|
||||
binary: 42
|
||||
<42 bytes>OK
|
||||
<42 bytes>
|
||||
OK
|
||||
|
||||
|
||||
Failure responses
|
||||
|
46
doc/user.rst
46
doc/user.rst
@@ -502,7 +502,7 @@ Audio Format Settings
|
||||
.. _audio_output_format:
|
||||
|
||||
Global Audio Format
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The setting ``audio_output_format`` forces :program:`MPD` to use one
|
||||
audio format for all outputs. Doing that is usually not a good idea.
|
||||
@@ -526,7 +526,7 @@ of bytes, not bits. Thus, a DSD "bit" rate of 22.5792 MHz (DSD512) is
|
||||
2822400 from :program:`MPD`'s point of view (44100*512/8).
|
||||
|
||||
Resampler
|
||||
~~~~~~~~~
|
||||
^^^^^^^^^
|
||||
|
||||
Sometimes, music needs to be resampled before it can be played; for example, CDs use a sample rate of 44,100 Hz while many cheap audio chips can only handle 48,000 Hz. Resampling reduces the quality and consumes a lot of CPU. There are different options, some of them optimized for high quality and others for low CPU usage, but you can't have both at the same time. Often, the resampler is the component that is responsible for most of :program:`MPD`'s CPU usage. Since :program:`MPD` comes with high quality defaults, it may appear that :program:`MPD` consumes more CPU than other software.
|
||||
|
||||
@@ -539,7 +539,7 @@ Client Connections
|
||||
.. _listeners:
|
||||
|
||||
Listeners
|
||||
~~~~~~~~~
|
||||
^^^^^^^^^
|
||||
|
||||
The setting :code:`bind_to_address` specifies which addresses
|
||||
:program:`MPD` listens on for connections from clients. It can be
|
||||
@@ -582,7 +582,7 @@ used.
|
||||
|
||||
|
||||
Permissions and Passwords
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
By default, all clients are unauthenticated and have a full set of permissions. This can be restricted with the settings :code:`default_permissions` and :code:`password`.
|
||||
|
||||
@@ -645,7 +645,7 @@ Other Settings
|
||||
Section :ref:`tags` contains a list of supported tags.
|
||||
|
||||
The State File
|
||||
~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
The state file is a file where :program:`MPD` saves and restores its state (play queue, playback position etc.) to keep it persistent across restarts and reboots. It is an optional setting.
|
||||
|
||||
@@ -663,7 +663,7 @@ The State File
|
||||
- Auto-save the state file this number of seconds after each state change. Defaults to 120 (2 minutes).
|
||||
|
||||
The Sticker Database
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
"Stickers" are pieces of information attached to songs. Some clients
|
||||
use them to store ratings and other volatile data. This feature
|
||||
@@ -680,7 +680,7 @@ requires :program:`SQLite`, compile-time configure option
|
||||
- The location of the sticker database.
|
||||
|
||||
Resource Limitations
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
These settings are various limitations to prevent :program:`MPD` from using too many resources (denial of service).
|
||||
|
||||
@@ -702,7 +702,7 @@ These settings are various limitations to prevent :program:`MPD` from using too
|
||||
- The maximum size of the output buffer to a client (maximum response size). Default is 8192 (8 MiB).
|
||||
|
||||
Buffer Settings
|
||||
~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Do not change these unless you know what you are doing.
|
||||
|
||||
@@ -716,7 +716,7 @@ Do not change these unless you know what you are doing.
|
||||
- Adjust the size of the internal audio buffer. Default is 4096 (4 MiB).
|
||||
|
||||
Zeroconf
|
||||
~~~~~~~~
|
||||
^^^^^^^^
|
||||
|
||||
If Zeroconf support (`Avahi <http://avahi.org/>`_ or Apple's Bonjour)
|
||||
was enabled at compile time with :code:`-Dzeroconf=...`,
|
||||
@@ -802,10 +802,12 @@ You can verify whether the real-time scheduler is active with the ps command:
|
||||
|
||||
The CLS column shows the CPU scheduler; TS is the normal scheduler; FF and RR are real-time schedulers. In this example, two threads use the real-time scheduler: the output thread and the rtio (real-time I/O) thread; these two are the important ones. The database update thread uses the idle scheduler ("IDL in ps), which only gets CPU when no other process needs it.
|
||||
|
||||
Note
|
||||
~~~~
|
||||
.. note::
|
||||
|
||||
There is a rumor that real-time scheduling improves audio quality. That is not true. All it does is reduce the probability of skipping (audio buffer xruns) when the computer is under heavy load.
|
||||
There is a rumor that real-time scheduling improves audio
|
||||
quality. That is not true. All it does is reduce the probability of
|
||||
skipping (audio buffer xruns) when the computer is under heavy
|
||||
load.
|
||||
|
||||
Using MPD
|
||||
*********
|
||||
@@ -833,7 +835,7 @@ Depending on the size of your music collection and the speed of the storage, thi
|
||||
To exclude a file from the update, create a file called :file:`.mpdignore` in its parent directory. Each line of that file may contain a list of shell wildcards. Matching files in the current directory and all subdirectories are excluded.
|
||||
|
||||
Mounting other storages into the music directory
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
:program:`MPD` has various storage plugins of which multiple instances can be "mounted" into the music directory. This way, you can use local music, file servers and USB sticks at the same time. Example:
|
||||
|
||||
@@ -979,18 +981,18 @@ Support
|
||||
-------
|
||||
|
||||
Getting Help
|
||||
~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The :program:`MPD` project runs a `forum <https://forum.musicpd.org/>`_ and an IRC channel (#mpd on Freenode) for requesting help. Visit the MPD help page for details on how to get help.
|
||||
|
||||
Common Problems
|
||||
~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
1. Database
|
||||
^^^^^^^^^^^
|
||||
"""""""""""
|
||||
|
||||
Question: I can't see my music in the MPD database!
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Check your :code:`music_directory` setting.
|
||||
* Does the MPD user have read permission on all music files, and read+execute permission on all music directories (and all of their parent directories)?
|
||||
@@ -998,22 +1000,22 @@ Question: I can't see my music in the MPD database!
|
||||
* Did you enable all relevant decoder plugins at compile time? :command:`mpd --version` will tell you.
|
||||
|
||||
Question: MPD doesn't read ID3 tags!
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* You probably compiled :program:`MPD` without libid3tag. :command:`mpd --version` will tell you.
|
||||
|
||||
2. Playback
|
||||
^^^^^^^^^^^
|
||||
"""""""""""
|
||||
|
||||
Question: I can't hear music on my client!
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* That problem usually follows a misunderstanding of the nature of :program:`MPD`. :program:`MPD` is a remote-controlled music player, not a music distribution system. Usually, the speakers are connected to the box where :program:`MPD` runs, and the :program:`MPD` client only sends control commands, but the client does not actually play your music.
|
||||
|
||||
:program:`MPD` has output plugins which allow hearing music on a remote host (such as httpd), but that is not :program:`MPD`'s primary design goal.
|
||||
|
||||
Question: "Device or resource busy"
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* This ALSA error means that another program uses your sound hardware exclusively. You can stop that program to allow :program:`MPD` to use it.
|
||||
|
||||
@@ -1032,7 +1034,7 @@ Your bug report should contain:
|
||||
* be clear about what you expect MPD to do, and what is actually happening
|
||||
|
||||
MPD crashes
|
||||
~~~~~~~~~~~
|
||||
^^^^^^^^^^^
|
||||
|
||||
All :program:`MPD` crashes are bugs which must be fixed by a developer, and you should write a bug report. (Many crash bugs are caused by codec libraries used by :program:`MPD`, and then that library must be fixed; but in any case, the :program:`MPD` `bug tracker <https://github.com/MusicPlayerDaemon/MPD/issues>`_ is a good place to report it first if you don't know.)
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
project(
|
||||
'mpd',
|
||||
['c', 'cpp'],
|
||||
version: '0.21.9',
|
||||
version: '0.21.11',
|
||||
meson_version: '>= 0.49.0',
|
||||
default_options: [
|
||||
'c_std=c99',
|
||||
@@ -20,7 +20,7 @@ conf.set_quoted('PACKAGE', meson.project_name())
|
||||
conf.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||
conf.set_quoted('VERSION', meson.project_version())
|
||||
conf.set_quoted('PROTOCOL_VERSION', '0.21.6')
|
||||
conf.set_quoted('PROTOCOL_VERSION', '0.21.11')
|
||||
conf.set_quoted('SYSTEM_CONFIG_FILE_LOCATION', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpd.conf'))
|
||||
|
||||
common_cppflags = [
|
||||
|
@@ -43,7 +43,15 @@ struct MusicChunk;
|
||||
/**
|
||||
* Meta information for #MusicChunk.
|
||||
*/
|
||||
struct MusicChunkInfo {
|
||||
struct alignas(8) MusicChunkInfo {
|
||||
/* align to multiple of 8 bytes, which adds padding at the
|
||||
end, so the size of MusicChunk::data is also a multiple of
|
||||
8 bytes; this is a workaround for a bug in the DSD_U32 and
|
||||
DoP converters which require processing 8 bytes at a time,
|
||||
discarding the remainder */
|
||||
/* TODO: once all converters have been fixed, we should remove
|
||||
this workaround */
|
||||
|
||||
/** the next chunk in a linked list */
|
||||
MusicChunkPtr next;
|
||||
|
||||
@@ -119,6 +127,10 @@ struct MusicChunk : MusicChunkInfo {
|
||||
/** the data (probably PCM) */
|
||||
uint8_t data[CHUNK_SIZE - sizeof(MusicChunkInfo)];
|
||||
|
||||
/* TODO: remove this check once all converters have been fixed
|
||||
(see comment in struct MusicChunkInfo for details) */
|
||||
static_assert(sizeof(data) % 8 == 0, "Wrong alignment");
|
||||
|
||||
/**
|
||||
* Prepares appending to the music chunk. Returns a buffer
|
||||
* where you may write into. After you are finished, call
|
||||
|
@@ -266,7 +266,7 @@ handle_list(Client &client, Request args, Response &r)
|
||||
}
|
||||
|
||||
std::unique_ptr<SongFilter> filter;
|
||||
TagType group = TAG_NUM_OF_ITEM_TYPES;
|
||||
std::vector<TagType> tag_types;
|
||||
|
||||
if (args.size == 1 &&
|
||||
/* parantheses are the syntax for filter expressions: no
|
||||
@@ -284,20 +284,31 @@ handle_list(Client &client, Request args, Response &r)
|
||||
args.shift()));
|
||||
}
|
||||
|
||||
if (args.size >= 2 &&
|
||||
StringIsEqual(args[args.size - 2], "group")) {
|
||||
while (args.size >= 2 &&
|
||||
StringIsEqual(args[args.size - 2], "group")) {
|
||||
const char *s = args[args.size - 1];
|
||||
group = tag_name_parse_i(s);
|
||||
const auto group = tag_name_parse_i(s);
|
||||
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||
r.FormatError(ACK_ERROR_ARG,
|
||||
"Unknown tag type: %s", s);
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
if (group == tagType ||
|
||||
std::find(tag_types.begin(), tag_types.end(),
|
||||
group) != tag_types.end()) {
|
||||
r.Error(ACK_ERROR_ARG, "Conflicting group");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
tag_types.emplace_back(group);
|
||||
|
||||
args.pop_back();
|
||||
args.pop_back();
|
||||
}
|
||||
|
||||
tag_types.emplace_back(tagType);
|
||||
|
||||
if (!args.empty()) {
|
||||
filter.reset(new SongFilter());
|
||||
try {
|
||||
@@ -310,13 +321,9 @@ handle_list(Client &client, Request args, Response &r)
|
||||
filter->Optimize();
|
||||
}
|
||||
|
||||
if (tagType < TAG_NUM_OF_ITEM_TYPES && tagType == group) {
|
||||
r.Error(ACK_ERROR_ARG, "Conflicting group");
|
||||
return CommandResult::ERROR;
|
||||
}
|
||||
|
||||
PrintUniqueTags(r, client.GetPartition(),
|
||||
tagType, group, filter.get());
|
||||
{&tag_types.front(), tag_types.size()},
|
||||
filter.get());
|
||||
return CommandResult::OK;
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "Interface.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "util/ChronoUtil.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
|
||||
#include <functional>
|
||||
|
||||
@@ -186,42 +187,29 @@ PrintSongUris(Response &r, Partition &partition,
|
||||
}
|
||||
|
||||
static void
|
||||
PrintUniqueTags(Response &r, TagType tag_type,
|
||||
const std::set<std::string> &values)
|
||||
PrintUniqueTags(Response &r, ConstBuffer<TagType> tag_types,
|
||||
const RecursiveMap<std::string> &map) noexcept
|
||||
{
|
||||
const char *const name = tag_item_names[tag_type];
|
||||
for (const auto &i : values)
|
||||
r.Format("%s: %s\n", name, i.c_str());
|
||||
}
|
||||
const char *const name = tag_item_names[tag_types.front()];
|
||||
tag_types.pop_front();
|
||||
|
||||
static void
|
||||
PrintGroupedUniqueTags(Response &r, TagType tag_type, TagType group,
|
||||
const std::map<std::string, std::set<std::string>> &groups)
|
||||
{
|
||||
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||
for (const auto &i : groups)
|
||||
PrintUniqueTags(r, tag_type, i.second);
|
||||
return;
|
||||
}
|
||||
for (const auto &i : map) {
|
||||
r.Format("%s: %s\n", name, i.first.c_str());
|
||||
|
||||
const char *const group_name = tag_item_names[group];
|
||||
for (const auto &i : groups) {
|
||||
r.Format("%s: %s\n", group_name, i.first.c_str());
|
||||
PrintUniqueTags(r, tag_type, i.second);
|
||||
if (!tag_types.empty())
|
||||
PrintUniqueTags(r, tag_types, i.second);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PrintUniqueTags(Response &r, Partition &partition,
|
||||
TagType type, TagType group,
|
||||
ConstBuffer<TagType> tag_types,
|
||||
const SongFilter *filter)
|
||||
{
|
||||
assert(type < TAG_NUM_OF_ITEM_TYPES);
|
||||
|
||||
const Database &db = partition.GetDatabaseOrThrow();
|
||||
|
||||
const DatabaseSelection selection("", true, filter);
|
||||
|
||||
PrintGroupedUniqueTags(r, type, group,
|
||||
db.CollectUniqueTags(selection, type, group));
|
||||
PrintUniqueTags(r, tag_types,
|
||||
db.CollectUniqueTags(selection, tag_types));
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
template<typename T> struct ConstBuffer;
|
||||
enum TagType : uint8_t;
|
||||
class TagMask;
|
||||
class SongFilter;
|
||||
@@ -45,7 +46,7 @@ PrintSongUris(Response &r, Partition &partition,
|
||||
|
||||
void
|
||||
PrintUniqueTags(Response &r, Partition &partition,
|
||||
TagType type, TagType group,
|
||||
ConstBuffer<TagType> tag_types,
|
||||
const SongFilter *filter);
|
||||
|
||||
#endif
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -25,15 +25,14 @@
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
struct DatabasePlugin;
|
||||
struct DatabaseStats;
|
||||
struct DatabaseSelection;
|
||||
struct LightSong;
|
||||
class TagMask;
|
||||
template<typename Key> class RecursiveMap;
|
||||
template<typename T> struct ConstBuffer;
|
||||
|
||||
class Database {
|
||||
const DatabasePlugin &plugin;
|
||||
@@ -106,13 +105,14 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect unique values of the given tag type.
|
||||
* Collect unique values of the given tag types. Each item in
|
||||
* the #tag_types parameter results in one nesting level in
|
||||
* the return value.
|
||||
*
|
||||
* Throws on error.
|
||||
*/
|
||||
virtual std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type,
|
||||
TagType group=TAG_NUM_OF_ITEM_TYPES) const = 0;
|
||||
virtual RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const = 0;
|
||||
|
||||
/**
|
||||
* Throws on error.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -21,36 +21,32 @@
|
||||
#include "Interface.hxx"
|
||||
#include "song/LightSong.hxx"
|
||||
#include "tag/VisitFallback.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
|
||||
static void
|
||||
CollectTags(std::set<std::string> &result,
|
||||
const Tag &tag,
|
||||
TagType tag_type) noexcept
|
||||
CollectUniqueTags(RecursiveMap<std::string> &result,
|
||||
const Tag &tag,
|
||||
ConstBuffer<TagType> tag_types) noexcept
|
||||
{
|
||||
VisitTagWithFallbackOrEmpty(tag, tag_type, [&result](const char *value){
|
||||
result.emplace(value);
|
||||
if (tag_types.empty())
|
||||
return;
|
||||
|
||||
const auto tag_type = tag_types.shift();
|
||||
|
||||
VisitTagWithFallbackOrEmpty(tag, tag_type, [&result, &tag, tag_types](const char *value){
|
||||
CollectUniqueTags(result[value], tag, tag_types);
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
CollectGroupTags(std::map<std::string, std::set<std::string>> &result,
|
||||
const Tag &tag,
|
||||
TagType tag_type,
|
||||
TagType group) noexcept
|
||||
{
|
||||
VisitTagWithFallbackOrEmpty(tag, group, [&](const char *group_name){
|
||||
CollectTags(result[group_name], tag, tag_type);
|
||||
});
|
||||
}
|
||||
|
||||
std::map<std::string, std::set<std::string>>
|
||||
RecursiveMap<std::string>
|
||||
CollectUniqueTags(const Database &db, const DatabaseSelection &selection,
|
||||
TagType tag_type, TagType group)
|
||||
ConstBuffer<TagType> tag_types)
|
||||
{
|
||||
std::map<std::string, std::set<std::string>> result;
|
||||
RecursiveMap<std::string> result;
|
||||
|
||||
db.Visit(selection, [&result, tag_type, group](const LightSong &song){
|
||||
CollectGroupTags(result, song.tag, tag_type, group);
|
||||
db.Visit(selection, [&result, tag_types](const LightSong &song){
|
||||
CollectUniqueTags(result, song.tag, tag_types);
|
||||
});
|
||||
|
||||
return result;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -29,9 +29,11 @@
|
||||
class TagMask;
|
||||
class Database;
|
||||
struct DatabaseSelection;
|
||||
template<typename Key> class RecursiveMap;
|
||||
template<typename T> struct ConstBuffer;
|
||||
|
||||
std::map<std::string, std::set<std::string>>
|
||||
RecursiveMap<std::string>
|
||||
CollectUniqueTags(const Database &db, const DatabaseSelection &selection,
|
||||
TagType tag_type, TagType group);
|
||||
ConstBuffer<TagType> tag_types);
|
||||
|
||||
#endif
|
||||
|
@@ -38,6 +38,8 @@
|
||||
#include "tag/Tag.hxx"
|
||||
#include "tag/Mask.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "protocol/Ack.hxx"
|
||||
@@ -127,9 +129,8 @@ public:
|
||||
VisitSong visit_song,
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type,
|
||||
TagType group) const override;
|
||||
RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
|
||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
@@ -412,8 +413,7 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection)
|
||||
static bool
|
||||
SendGroup(mpd_connection *connection, TagType group)
|
||||
{
|
||||
if (group == TAG_NUM_OF_ITEM_TYPES)
|
||||
return true;
|
||||
assert(group != TAG_NUM_OF_ITEM_TYPES);
|
||||
|
||||
#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
|
||||
const auto tag = Convert(group);
|
||||
@@ -428,6 +428,19 @@ SendGroup(mpd_connection *connection, TagType group)
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
SendGroup(mpd_connection *connection, ConstBuffer<TagType> group)
|
||||
{
|
||||
while (!group.empty()) {
|
||||
if (!SendGroup(connection, group.back()))
|
||||
return false;
|
||||
|
||||
group.pop_back();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ProxyDatabase::ProxyDatabase(EventLoop &_loop, DatabaseListener &_listener,
|
||||
const ConfigBlock &block)
|
||||
:Database(proxy_db_plugin),
|
||||
@@ -983,17 +996,20 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
||||
helper.Commit();
|
||||
}
|
||||
|
||||
std::map<std::string, std::set<std::string>>
|
||||
RecursiveMap<std::string>
|
||||
ProxyDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type, TagType group) const
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
try {
|
||||
// TODO: eliminate the const_cast
|
||||
const_cast<ProxyDatabase *>(this)->EnsureConnected();
|
||||
|
||||
enum mpd_tag_type tag_type2 = Convert(tag_type);
|
||||
enum mpd_tag_type tag_type2 = Convert(tag_types.back());
|
||||
if (tag_type2 == MPD_TAG_COUNT)
|
||||
throw std::runtime_error("Unsupported tag");
|
||||
|
||||
auto group = tag_types;
|
||||
group.pop_back();
|
||||
|
||||
if (!mpd_search_db_tags(connection, tag_type2) ||
|
||||
!SendConstraints(connection, selection) ||
|
||||
!SendGroup(connection, group))
|
||||
@@ -1002,44 +1018,33 @@ try {
|
||||
if (!mpd_search_commit(connection))
|
||||
ThrowError(connection);
|
||||
|
||||
std::map<std::string, std::set<std::string>> result;
|
||||
RecursiveMap<std::string> result;
|
||||
std::vector<RecursiveMap<std::string> *> position;
|
||||
position.emplace_back(&result);
|
||||
|
||||
if (group == TAG_NUM_OF_ITEM_TYPES) {
|
||||
auto &values = result[std::string()];
|
||||
while (auto *pair = mpd_recv_pair(connection)) {
|
||||
AtScopeExit(this, pair) {
|
||||
mpd_return_pair(connection, pair);
|
||||
};
|
||||
|
||||
while (auto *pair = mpd_recv_pair(connection)) {
|
||||
AtScopeExit(this, pair) {
|
||||
mpd_return_pair(connection, pair);
|
||||
};
|
||||
const auto current_type = tag_name_parse_i(pair->name);
|
||||
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
||||
continue;
|
||||
|
||||
const auto current_type = tag_name_parse_i(pair->name);
|
||||
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
||||
continue;
|
||||
auto it = std::find(tag_types.begin(), tag_types.end(),
|
||||
current_type);
|
||||
if (it == tag_types.end())
|
||||
continue;
|
||||
|
||||
if (current_type == tag_type)
|
||||
values.emplace(pair->value);
|
||||
}
|
||||
} else {
|
||||
std::set<std::string> *current_group = nullptr;
|
||||
size_t i = std::distance(tag_types.begin(), it);
|
||||
if (i > position.size())
|
||||
continue;
|
||||
|
||||
while (auto *pair = mpd_recv_pair(connection)) {
|
||||
AtScopeExit(this, pair) {
|
||||
mpd_return_pair(connection, pair);
|
||||
};
|
||||
if (i + 1 < position.size())
|
||||
position.resize(i + 1);
|
||||
|
||||
const auto current_type = tag_name_parse_i(pair->name);
|
||||
if (current_type == TAG_NUM_OF_ITEM_TYPES)
|
||||
continue;
|
||||
|
||||
if (current_type == tag_type) {
|
||||
if (current_group == nullptr)
|
||||
current_group = &result[std::string()];
|
||||
|
||||
current_group->emplace(pair->value);
|
||||
} else if (current_type == group) {
|
||||
current_group = &result[pair->value];
|
||||
}
|
||||
}
|
||||
auto &parent = *position[i];
|
||||
position.emplace_back(&parent[pair->value]);
|
||||
}
|
||||
|
||||
if (!mpd_response_finish(connection))
|
||||
|
@@ -42,6 +42,8 @@
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#ifdef ENABLE_ZLIB
|
||||
@@ -329,11 +331,11 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
||||
"No such directory");
|
||||
}
|
||||
|
||||
std::map<std::string, std::set<std::string>>
|
||||
RecursiveMap<std::string>
|
||||
SimpleDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type, TagType group) const
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
{
|
||||
return ::CollectUniqueTags(*this, selection, tag_type, group);
|
||||
return ::CollectUniqueTags(*this, selection, tag_types);
|
||||
}
|
||||
|
||||
DatabaseStats
|
||||
|
@@ -122,9 +122,8 @@ public:
|
||||
VisitSong visit_song,
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type,
|
||||
TagType group) const override;
|
||||
RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
|
||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
|
@@ -40,10 +40,11 @@
|
||||
#include "tag/Mask.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/RecursiveMap.hxx"
|
||||
#include "util/SplitString.hxx"
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
@@ -97,9 +98,8 @@ public:
|
||||
VisitSong visit_song,
|
||||
VisitPlaylist visit_playlist) const override;
|
||||
|
||||
std::map<std::string, std::set<std::string>> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag_type,
|
||||
TagType group) const override;
|
||||
RecursiveMap<std::string> CollectUniqueTags(const DatabaseSelection &selection,
|
||||
ConstBuffer<TagType> tag_types) const override;
|
||||
|
||||
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
|
||||
|
||||
@@ -624,11 +624,11 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
|
||||
helper.Commit();
|
||||
}
|
||||
|
||||
std::map<std::string, std::set<std::string>>
|
||||
RecursiveMap<std::string>
|
||||
UpnpDatabase::CollectUniqueTags(const DatabaseSelection &selection,
|
||||
TagType tag, TagType group) const
|
||||
ConstBuffer<TagType> tag_types) const
|
||||
{
|
||||
return ::CollectUniqueTags(*this, selection, tag, group);
|
||||
return ::CollectUniqueTags(*this, selection, tag_types);
|
||||
}
|
||||
|
||||
DatabaseStats
|
||||
|
@@ -20,6 +20,8 @@
|
||||
#include "config.h"
|
||||
#include "DecoderList.hxx"
|
||||
#include "DecoderPlugin.hxx"
|
||||
#include "PluginUnavailable.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "config/Data.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "plugins/AudiofileDecoderPlugin.hxx"
|
||||
@@ -45,6 +47,7 @@
|
||||
#include "plugins/FluidsynthDecoderPlugin.hxx"
|
||||
#include "plugins/SidplayDecoderPlugin.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -147,8 +150,17 @@ decoder_plugin_init_all(const ConfigData &config)
|
||||
if (param != nullptr)
|
||||
param->SetUsed();
|
||||
|
||||
if (plugin.Init(*param))
|
||||
decoder_plugins_enabled[i] = true;
|
||||
try {
|
||||
if (plugin.Init(*param))
|
||||
decoder_plugins_enabled[i] = true;
|
||||
} catch (const PluginUnavailable &e) {
|
||||
FormatError(e,
|
||||
"Decoder plugin '%s' is unavailable",
|
||||
plugin.name);
|
||||
} catch (...) {
|
||||
std::throw_with_nested(FormatRuntimeError("Failed to initialize decoder plugin '%s'",
|
||||
plugin.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2018 The Music Player Daemon Project
|
||||
* Copyright 2003-2019 The Music Player Daemon Project
|
||||
* http://www.musicpd.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef MPD_OPUS_READER_HXX
|
||||
#define MPD_OPUS_READER_HXX
|
||||
|
||||
#include "util/StringView.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -81,18 +83,16 @@ public:
|
||||
return ReadWord(length) && Skip(length);
|
||||
}
|
||||
|
||||
char *ReadString() {
|
||||
StringView ReadString() {
|
||||
uint32_t length;
|
||||
if (!ReadWord(length) || length >= 65536)
|
||||
if (!ReadWord(length))
|
||||
return nullptr;
|
||||
|
||||
const char *src = (const char *)Read(length);
|
||||
if (src == nullptr)
|
||||
return nullptr;
|
||||
|
||||
char *dest = new char[length + 1];
|
||||
*std::copy_n(src, length, dest) = 0;
|
||||
return dest;
|
||||
return {src, length};
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -24,6 +24,8 @@
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "ReplayGainInfo.hxx"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -91,18 +93,25 @@ ScanOpusTags(const void *data, size_t size,
|
||||
return false;
|
||||
|
||||
while (n-- > 0) {
|
||||
char *p = r.ReadString();
|
||||
if (p == nullptr)
|
||||
const auto s = r.ReadString();
|
||||
if (s == nullptr)
|
||||
return false;
|
||||
|
||||
char *eq = strchr(p, '=');
|
||||
if (eq != nullptr && eq > p) {
|
||||
*eq = 0;
|
||||
if (s.size >= 4096)
|
||||
continue;
|
||||
|
||||
ScanOneOpusTag(p, eq + 1, rgi, handler);
|
||||
}
|
||||
const auto eq = s.Find('=');
|
||||
if (eq == nullptr || eq == s.data)
|
||||
continue;
|
||||
|
||||
delete[] p;
|
||||
auto name = s, value = s;
|
||||
name.SetEnd(eq);
|
||||
value.MoveFront(eq + 1);
|
||||
|
||||
const std::string name2(name.data, name.size);
|
||||
const std::string value2(value.data, value.size);
|
||||
|
||||
ScanOneOpusTag(name2.c_str(), value2.c_str(), rgi, handler);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -20,18 +20,18 @@
|
||||
#include "WildmidiDecoderPlugin.hxx"
|
||||
#include "../DecoderAPI.hxx"
|
||||
#include "tag/Handler.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "util/StringFormat.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "fs/FileSystem.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "PluginUnavailable.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include <wildmidi_lib.h>
|
||||
}
|
||||
|
||||
static constexpr Domain wildmidi_domain("wildmidi");
|
||||
|
||||
static constexpr AudioFormat wildmidi_audio_format{48000, SampleFormat::S16, 2};
|
||||
|
||||
static bool
|
||||
@@ -43,14 +43,27 @@ wildmidi_init(const ConfigBlock &block)
|
||||
|
||||
if (!FileExists(path)) {
|
||||
const auto utf8 = path.ToUTF8();
|
||||
FormatDebug(wildmidi_domain,
|
||||
"configuration file does not exist: %s",
|
||||
utf8.c_str());
|
||||
return false;
|
||||
throw PluginUnavailable(StringFormat<1024>("configuration file does not exist: %s",
|
||||
utf8.c_str()));
|
||||
}
|
||||
|
||||
return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
|
||||
0) == 0;
|
||||
#ifdef LIBWILDMIDI_VERSION
|
||||
/* WildMidi_ClearError() requires libwildmidi 0.4 */
|
||||
WildMidi_ClearError();
|
||||
AtScopeExit() { WildMidi_ClearError(); };
|
||||
#endif
|
||||
|
||||
if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
|
||||
0) != 0) {
|
||||
#ifdef LIBWILDMIDI_VERSION
|
||||
/* WildMidi_GetError() requires libwildmidi 0.4 */
|
||||
throw PluginUnavailable(WildMidi_GetError());
|
||||
#else
|
||||
throw PluginUnavailable("WildMidi_Init() failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -180,6 +180,8 @@ InitTidalInput(EventLoop &event_loop, const ConfigBlock &block)
|
||||
if (password == nullptr)
|
||||
throw PluginUnavailable("No Tidal password configured");
|
||||
|
||||
FormatWarning(tidal_domain, "The Tidal input plugin is deprecated because Tidal has changed the protocol and doesn't share documentation");
|
||||
|
||||
tidal_audioquality = block.GetBlockValue("audioquality", "HIGH");
|
||||
|
||||
tidal_session = new TidalSessionManager(event_loop, base_url, token,
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "../OutputAPI.hxx"
|
||||
#include "mixer/MixerList.hxx"
|
||||
#include "pcm/PcmExport.hxx"
|
||||
#include "system/PeriodClock.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "thread/Cond.hxx"
|
||||
#include "util/Manual.hxx"
|
||||
@@ -56,6 +57,17 @@ class AlsaOutput final
|
||||
|
||||
DeferEvent defer_invalidate_sockets;
|
||||
|
||||
/**
|
||||
* This timer is used to re-schedule the #MultiSocketMonitor
|
||||
* after it had been disabled to wait for the next Play() call
|
||||
* to deliver more data. This timer is necessary to start
|
||||
* generating silence if Play() doesn't get called soon enough
|
||||
* to avoid the xrun.
|
||||
*/
|
||||
TimerEvent silence_timer;
|
||||
|
||||
PeriodClock throttle_silence_log;
|
||||
|
||||
Manual<PcmExport> pcm_export;
|
||||
|
||||
/**
|
||||
@@ -109,6 +121,8 @@ class AlsaOutput final
|
||||
*/
|
||||
snd_pcm_uframes_t period_frames;
|
||||
|
||||
std::chrono::steady_clock::duration effective_period_duration;
|
||||
|
||||
/**
|
||||
* If snd_pcm_avail() goes above this value and no more data
|
||||
* is available in the #ring_buffer, we need to play some
|
||||
@@ -128,13 +142,20 @@ class AlsaOutput final
|
||||
bool work_around_drain_bug;
|
||||
|
||||
/**
|
||||
* After Open(), has this output been activated by a Play()
|
||||
* command?
|
||||
* After Open() or Cancel(), has this output been activated by
|
||||
* a Play() command?
|
||||
*
|
||||
* Protected by #mutex.
|
||||
*/
|
||||
bool active;
|
||||
|
||||
/**
|
||||
* Is this output waiting for more data?
|
||||
*
|
||||
* Protected by #mutex.
|
||||
*/
|
||||
bool waiting;
|
||||
|
||||
/**
|
||||
* Do we need to call snd_pcm_prepare() before the next write?
|
||||
* It means that we put the device to SND_PCM_STATE_SETUP by
|
||||
@@ -176,7 +197,7 @@ class AlsaOutput final
|
||||
Alsa::PeriodBuffer period_buffer;
|
||||
|
||||
/**
|
||||
* Protects #cond, #error, #active, #drain.
|
||||
* Protects #cond, #error, #active, #waiting, #drain.
|
||||
*/
|
||||
mutable Mutex mutex;
|
||||
|
||||
@@ -248,6 +269,12 @@ private:
|
||||
return active;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool LockIsActiveAndNotWaiting() const noexcept {
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
return active && !waiting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the output by registering the sockets in the
|
||||
* #EventLoop. Before calling this, filling the ring buffer
|
||||
@@ -260,10 +287,11 @@ private:
|
||||
* was never unlocked
|
||||
*/
|
||||
bool Activate() noexcept {
|
||||
if (active)
|
||||
if (active && !waiting)
|
||||
return false;
|
||||
|
||||
active = true;
|
||||
waiting = false;
|
||||
|
||||
const ScopeUnlock unlock(mutex);
|
||||
defer_invalidate_sockets.Schedule();
|
||||
@@ -330,9 +358,23 @@ private:
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
error = std::current_exception();
|
||||
active = false;
|
||||
waiting = false;
|
||||
cond.signal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for @silence_timer
|
||||
*/
|
||||
void OnSilenceTimer() noexcept {
|
||||
{
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
assert(active);
|
||||
waiting = false;
|
||||
}
|
||||
|
||||
MultiSocketMonitor::InvalidateSockets();
|
||||
}
|
||||
|
||||
/* virtual methods from class MultiSocketMonitor */
|
||||
std::chrono::steady_clock::duration PrepareSockets() noexcept override;
|
||||
void DispatchSockets() noexcept override;
|
||||
@@ -344,6 +386,7 @@ AlsaOutput::AlsaOutput(EventLoop &_loop, const ConfigBlock &block)
|
||||
:AudioOutput(FLAG_ENABLE_DISABLE),
|
||||
MultiSocketMonitor(_loop),
|
||||
defer_invalidate_sockets(_loop, BIND_THIS_METHOD(InvalidateSockets)),
|
||||
silence_timer(_loop, BIND_THIS_METHOD(OnSilenceTimer)),
|
||||
device(block.GetBlockValue("device", "")),
|
||||
#ifdef ENABLE_DSD
|
||||
dop_setting(block.GetBlockValue("dop", false) ||
|
||||
@@ -500,8 +543,9 @@ AlsaOutput::Setup(AudioFormat &audio_format,
|
||||
alsa_period_size = 1;
|
||||
|
||||
period_frames = alsa_period_size;
|
||||
effective_period_duration = audio_format.FramesToTime<decltype(effective_period_duration)>(period_frames);
|
||||
|
||||
/* generate silence if there's less than once period of data
|
||||
/* generate silence if there's less than one period of data
|
||||
in the ALSA-PCM buffer */
|
||||
max_avail_frames = hw_result.buffer_size - hw_result.period_size;
|
||||
|
||||
@@ -684,6 +728,7 @@ AlsaOutput::Open(AudioFormat &audio_format)
|
||||
period_buffer.Allocate(period_frames, out_frame_size);
|
||||
|
||||
active = false;
|
||||
waiting = false;
|
||||
must_prepare = false;
|
||||
written = false;
|
||||
error = {};
|
||||
@@ -766,7 +811,7 @@ AlsaOutput::DrainInternal()
|
||||
/* need to call CopyRingToPeriodBuffer() and
|
||||
WriteFromPeriodBuffer() again in the next
|
||||
iteration, so don't finish the drain just yet */
|
||||
return period_buffer.IsEmpty();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!written)
|
||||
@@ -774,6 +819,24 @@ AlsaOutput::DrainInternal()
|
||||
don't need to drain it */
|
||||
return true;
|
||||
|
||||
switch (snd_pcm_state(pcm)) {
|
||||
case SND_PCM_STATE_PREPARED:
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
/* these states require a call to snd_pcm_drain() */
|
||||
break;
|
||||
|
||||
case SND_PCM_STATE_DRAINING:
|
||||
/* already draining, but not yet finished; this is
|
||||
probably a spurious epoll event, and we should wait
|
||||
for the next one */
|
||||
return false;
|
||||
|
||||
default:
|
||||
/* all other states cannot be drained, and we're
|
||||
done */
|
||||
return true;
|
||||
}
|
||||
|
||||
/* .. and finally drain the ALSA hardware buffer */
|
||||
|
||||
int result;
|
||||
@@ -827,9 +890,11 @@ AlsaOutput::CancelInternal() noexcept
|
||||
ring_buffer->reset();
|
||||
|
||||
active = false;
|
||||
waiting = false;
|
||||
|
||||
MultiSocketMonitor::Reset();
|
||||
defer_invalidate_sockets.Cancel();
|
||||
silence_timer.Cancel();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -858,6 +923,7 @@ AlsaOutput::Close() noexcept
|
||||
BlockingCall(GetEventLoop(), [this](){
|
||||
MultiSocketMonitor::Reset();
|
||||
defer_invalidate_sockets.Cancel();
|
||||
silence_timer.Cancel();
|
||||
});
|
||||
|
||||
period_buffer.Free();
|
||||
@@ -912,7 +978,7 @@ AlsaOutput::Play(const void *chunk, size_t size)
|
||||
std::chrono::steady_clock::duration
|
||||
AlsaOutput::PrepareSockets() noexcept
|
||||
{
|
||||
if (!LockIsActive()) {
|
||||
if (!LockIsActiveAndNotWaiting()) {
|
||||
ClearSocketList();
|
||||
return std::chrono::steady_clock::duration(-1);
|
||||
}
|
||||
@@ -977,28 +1043,42 @@ try {
|
||||
whenever more data arrives */
|
||||
/* the same applies when there is still enough
|
||||
data in the ALSA-PCM buffer (determined by
|
||||
snd_pcm_avail()); this can happend at the
|
||||
snd_pcm_avail()); this can happen at the
|
||||
start of playback, when our ring_buffer is
|
||||
smaller than the ALSA-PCM buffer */
|
||||
|
||||
{
|
||||
const std::lock_guard<Mutex> lock(mutex);
|
||||
active = false;
|
||||
waiting = true;
|
||||
cond.signal();
|
||||
}
|
||||
|
||||
/* avoid race condition: see if data has
|
||||
arrived meanwhile before disabling the
|
||||
event (but after clearing the "active"
|
||||
event (but after setting the "waiting"
|
||||
flag) */
|
||||
if (!CopyRingToPeriodBuffer()) {
|
||||
MultiSocketMonitor::Reset();
|
||||
defer_invalidate_sockets.Cancel();
|
||||
|
||||
/* just in case Play() doesn't get
|
||||
called soon enough, schedule a
|
||||
timer which generates silence
|
||||
before the xrun occurs */
|
||||
/* the timer fires in half of a
|
||||
period; this short duration may
|
||||
produce a few more wakeups than
|
||||
necessary, but should be small
|
||||
enough to avoid the xrun */
|
||||
silence_timer.Schedule(effective_period_duration / 2);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (throttle_silence_log.CheckUpdate(std::chrono::seconds(5)))
|
||||
FormatWarning(alsa_output_domain, "Decoder is too slow; playing silence to avoid xrun");
|
||||
|
||||
/* insert some silence if the buffer has not enough
|
||||
data yet, to avoid ALSA xrun */
|
||||
period_buffer.FillWithSilence(silence, out_frame_size);
|
||||
|
@@ -670,12 +670,13 @@ OssOutput::Play(const void *chunk, size_t size)
|
||||
|
||||
#ifdef AFMT_S24_PACKED
|
||||
const auto e = pcm_export->Export({chunk, size});
|
||||
if (e.empty())
|
||||
return size;
|
||||
|
||||
chunk = e.data;
|
||||
size = e.size;
|
||||
#endif
|
||||
|
||||
assert(size > 0);
|
||||
|
||||
while (true) {
|
||||
ret = fd.Write(chunk, size);
|
||||
if (ret > 0) {
|
||||
|
@@ -71,10 +71,10 @@ HttpdClient::HandleLine(const char *line) noexcept
|
||||
assert(state != State::RESPONSE);
|
||||
|
||||
if (state == State::REQUEST) {
|
||||
if (memcmp(line, "HEAD /", 6) == 0) {
|
||||
if (strncmp(line, "HEAD /", 6) == 0) {
|
||||
line += 6;
|
||||
head_method = true;
|
||||
} else if (memcmp(line, "GET /", 5) == 0) {
|
||||
} else if (strncmp(line, "GET /", 5) == 0) {
|
||||
line += 5;
|
||||
} else {
|
||||
/* only GET is supported */
|
||||
@@ -83,8 +83,19 @@ HttpdClient::HandleLine(const char *line) noexcept
|
||||
return false;
|
||||
}
|
||||
|
||||
/* blacklist some well-known request paths */
|
||||
if ((strncmp(line, "favicon.ico", 11) == 0 &&
|
||||
(line[11] == '\0' || line[11] == ' ')) ||
|
||||
(strncmp(line, "robots.txt", 10) == 0 &&
|
||||
(line[10] == '\0' || line[10] == ' ')) ||
|
||||
(strncmp(line, "sitemap.xml", 11) == 0 &&
|
||||
(line[11] == '\0' || line[11] == ' ')) ||
|
||||
(strncmp(line, ".well-known/", 12) == 0)) {
|
||||
should_reject = true;
|
||||
}
|
||||
|
||||
line = strchr(line, ' ');
|
||||
if (line == nullptr || memcmp(line + 1, "HTTP/", 5) != 0) {
|
||||
if (line == nullptr || strncmp(line + 1, "HTTP/", 5) != 0) {
|
||||
/* HTTP/0.9 without request headers */
|
||||
|
||||
if (head_method)
|
||||
@@ -129,14 +140,21 @@ HttpdClient::SendResponse() noexcept
|
||||
|
||||
assert(state == State::RESPONSE);
|
||||
|
||||
if (metadata_requested) {
|
||||
if (should_reject) {
|
||||
response =
|
||||
"HTTP/1.1 404 not found\r\n"
|
||||
"Content-Type: text/plain\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n"
|
||||
"404 not found";
|
||||
} else if (metadata_requested) {
|
||||
allocated =
|
||||
icy_server_metadata_header(httpd.name, httpd.genre,
|
||||
httpd.website,
|
||||
httpd.content_type,
|
||||
metaint);
|
||||
response = allocated.c_str();
|
||||
} else { /* revert to a normal HTTP request */
|
||||
} else { /* revert to a normal HTTP request */
|
||||
snprintf(buffer, sizeof(buffer),
|
||||
"HTTP/1.1 200 OK\r\n"
|
||||
"Content-Type: %s\r\n"
|
||||
@@ -415,7 +433,7 @@ HttpdClient::OnSocketInput(void *data, size_t length) noexcept
|
||||
if (!SendResponse())
|
||||
return InputResult::CLOSED;
|
||||
|
||||
if (head_method) {
|
||||
if (head_method || should_reject) {
|
||||
LockClose();
|
||||
return InputResult::CLOSED;
|
||||
}
|
||||
|
@@ -83,6 +83,11 @@ class HttpdClient final
|
||||
*/
|
||||
bool head_method = false;
|
||||
|
||||
/**
|
||||
* Should we reject this request?
|
||||
*/
|
||||
bool should_reject = false;
|
||||
|
||||
/* ICY */
|
||||
|
||||
/**
|
||||
|
@@ -173,7 +173,8 @@ public:
|
||||
* Export a PCM buffer.
|
||||
*
|
||||
* @param src the source PCM buffer
|
||||
* @return the destination buffer (may be a pointer to the source buffer)
|
||||
* @return the destination buffer; may be empty (and may be a
|
||||
* pointer to the source buffer)
|
||||
*/
|
||||
ConstBuffer<void> Export(ConstBuffer<void> src) noexcept;
|
||||
|
||||
|
@@ -996,7 +996,7 @@ Player::Run() noexcept
|
||||
}
|
||||
}
|
||||
|
||||
if (dc.IsIdle() && queued) {
|
||||
if (dc.IsIdle() && queued && IsDecoderAtCurrentSong()) {
|
||||
/* the decoder has finished the current song;
|
||||
make it decode the next song */
|
||||
|
||||
|
41
src/util/RecursiveMap.hxx
Normal file
41
src/util/RecursiveMap.hxx
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2019 Max Kellermann <max.kellermann@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef RECURSIVE_MAP_HXX
|
||||
#define RECURSIVE_MAP_HXX
|
||||
|
||||
#include <map>
|
||||
|
||||
/**
|
||||
* A #std::map which contains instances of itself.
|
||||
*/
|
||||
template<typename Key>
|
||||
class RecursiveMap : public std::map<Key, RecursiveMap<Key>> {};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user