Compare commits

..

1940 Commits

Author SHA1 Message Date
Max Kellermann
82e261ad33 release v0.19.12 2015-12-15 21:54:42 +01:00
Benno Fünfstück
cae2811762 fix mpd crash on invalid utf8 stream title 2015-12-15 21:49:53 +01:00
Ben Boeckel
09112c6869 docs: add vlc and mpv to the list of example applications
These are other popular clients. In particular, VLC is available on
mobile devices.

Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
2015-12-15 21:30:26 +01:00
Christian Hesse
77aaf1baee fix LimitRTTIME in systemd unit file
systemd does not understand LimitRTTIME=-1. For no limit we have to use
the string 'infinity' (see systemd.exec(5)).

Signed-off-by: Christian Hesse <mail@eworm.de>
2015-12-15 21:17:04 +01:00
Jörg Krause
6626c2d00d Makefile.am: fix static build with alsa
Add ALSA_LIBS to MIXER_LIBS, otherwise building mpd in a static context fails
with lot of undefined references to alsa-lib (libasound) required by
src/mixer/plugins/AlsaMixerPlugin.cxx.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
2015-12-15 21:16:45 +01:00
Michael Paquier
315f9d98f6 Main: fix build failure on non-Linux systems 2015-11-10 08:38:53 +01:00
Max Kellermann
f087518e7a configure.ac: prepare for 0.19.12 2015-11-10 08:33:50 +01:00
Max Kellermann
db9997a106 release v0.19.11 2015-10-27 10:42:20 +01:00
Max Kellermann
0cbfb610f2 systemd: remove obsolete ControlGroup settings
This systemd feature has been removed a while ago without replacement,
and it turns out that systemd developers suggest not using control
groups at all to assign real-time privileges.  Therfore, a replacement
feature will not be implement in future systemd releases, and we can
really remove those lines completely.

See http://bugs.musicpd.org/view.php?id=4413
2015-10-27 10:36:23 +01:00
Max Kellermann
f901cd042b doc/user: section about real-time scheduling 2015-10-27 10:31:50 +01:00
Max Kellermann
5719207dfa gme: don't loop forever, fall back to GME's default play length
Fixes http://bugs.musicpd.org/view.php?id=4432
2015-10-26 17:16:20 +01:00
Max Kellermann
a84fbbe327 decoder/gme: free the gme_info_t as early as possible 2015-10-26 17:15:24 +01:00
Max Kellermann
93c97972b9 decoder/gme: call decoder_seek_error() on seek error 2015-10-26 16:32:39 +01:00
Max Kellermann
ac61d43720 output/Command: flush the mixer cache when enabling/disabling output
Fixes mixer lag (http://bugs.musicpd.org/view.php?id=4425).
2015-10-26 16:29:07 +01:00
Max Kellermann
1958f78cc1 decoder/ffmpeg: fix crash due to wrong avio_alloc_context() call
Allocate the buffer dynamically using av_malloc(), and free
AVIOContext.buffer in the destructor, as mandated by the libavformat
documentation.

Fixes http://bugs.musicpd.org/view.php?id=4446
2015-10-26 13:06:29 +01:00
Max Kellermann
a7ee64a25b decoder/mpcdec: use SampleTraits<SampleFormat::S24_P32>
Eliminates some duplicate code, and as a side effect, this works
around clang 3.8 compiler warning because a negative value was
shifted.
2015-10-16 18:12:32 +02:00
Max Kellermann
2a58f22649 decoder/mpcdec: use Clamp() 2015-10-16 18:11:42 +02:00
Max Kellermann
f066bb7716 unix/Daemon, playlist/...: remove unused Domain variables 2015-10-16 18:08:59 +02:00
Max Kellermann
4e3d182189 encoder/flac: fix crash with 32 bit playback
Copy to encoder->audio_format *after* adjusting the sample format to
S24_P32.

Fixes http://bugs.musicpd.org/view.php?id=4433
2015-10-16 18:05:34 +02:00
Max Kellermann
205fba74cf tag/ApeLoader: fix buffer overflow after unterminated key 2015-10-16 14:55:40 +02:00
Max Kellermann
a9bcf8d50d configure.ac: prepare for 0.19.11 2015-10-16 14:55:40 +02:00
Max Kellermann
b0ff3bc7a3 release v0.19.10 2015-06-21 15:51:50 +02:00
Max Kellermann
06301e279c PlayerThread: start the decoder on PlayerCommand::QUEUE
Fixes missing SongBorder() call, which causes "single" mode breakage.
2015-06-21 15:38:48 +02:00
Max Kellermann
6d6f274648 DecoderAPI: discard unused song tag early
If there's a stream tag, don't let the song tag override it in the
next update_stream_tag() call.
2015-06-21 15:10:55 +02:00
Max Kellermann
9acefcb256 DecoderThread: set Decoder::song_tag only for local files
If the song tag comes from a stream, and MPD playback restarts, MPD
would believe the tag should override the newly received tag.  This
makes the previous tag appear stuck.  This change passes the song tag
only if it's authoritative - i.e. if it's a song file.
2015-06-21 15:02:14 +02:00
Max Kellermann
e4d0293a31 DecoderAPI: "move" the Tag object
Reduce runtime overhead.
2015-06-20 16:06:09 +02:00
Romain Rollet
ae77542a11 OutputControl: fix fail_timer check right after booting
Right after booting, the monotonic clock starts with a very small
value, and AudioOutput::LockUpdate() may believe that the fail_timer
has not recovered yet.
2015-06-20 15:37:19 +02:00
Max Kellermann
980187f856 system/PeriodClock: make IsDefined() "constexpr" 2015-06-20 15:33:17 +02:00
Max Kellermann
327a8e6c59 decoder/ffmpeg: skip unwanted samples after seeking
When seeking to the beginning of a packet, skip the samples that come
before the desired time stamp.
2015-06-20 15:01:05 +02:00
Max Kellermann
d11e2724c4 decoder/ffmpeg: use AVSEEK_FLAG_BACKWARD for seeking
Ask FFmpeg to seek to the next packet boundary *before* the seek
position, so we don't miss audio data.  Now we get too much, but we'll
solve that in the next commit.
2015-06-20 14:29:42 +02:00
Max Kellermann
f768ca3a2d decoder/ffmpeg: move code to StreamRelativePts() 2015-06-19 18:56:29 +02:00
Max Kellermann
947e902288 input/curl: trigger the condition variable in RequestDone()
Fixes deadlock on small responses.
2015-06-19 16:45:38 +02:00
Thomas Guillem
3436a646b5 storage/nfs: fix deadlock when connecting
The Connect method can be called between Schedule and lock. In that case, when
locked, the state is already set to CONNECTING of READY and the condition won't
be signaled anymore.
2015-05-29 22:39:14 +02:00
jai
aed0af1e00 input/smbclient: fix DFF playback 2015-05-29 22:37:49 +02:00
Michal Nazarewicz
0d7ee2b014 OpusEncoderPlugin: initialise granulepos so we end up with sane values
Not initialising granulepos leads to it having arbitrary values in the
encoded stream including possibly negative values which are not valid
and confuse opusdec.  Explicitly initialise opus_encoder::granulepos
to avoid that problem.
2015-03-25 18:02:54 +01:00
Max Kellermann
2f5fd91bd8 configure.ac: prepare for 0.19.10 2015-03-25 18:02:54 +01:00
Max Kellermann
5761800197 release v0.19.9 2015-02-06 17:08:25 +01:00
Max Kellermann
0eebacc521 Merge tag 'v0.18.23' into v0.19.x 2015-02-06 17:07:47 +01:00
Max Kellermann
4a5528697d release v0.18.23 2015-02-06 17:04:14 +01:00
Max Kellermann
d38034bb5c fs/io/FileOutputStream: don't auto-delete file on WIN32
The file handle is never reset to INVALID_HANDLE_VALUE, and thus the
destructor will assume the operation shall be cancelled and will
delete the temporary file.

This was a major breakage for saving the database file and the state
file.
2015-02-06 14:36:55 +01:00
Max Kellermann
b3fe3e8b3d TagBuilder: allow adding duplicate tag types in Complement()
Build a table of pre-existing tag types before adding new items.  The
old way would check HasType() each time, which would return true after
the first instance of that tag type had been added, preventing
duplicate tag types to be merged.

This broke duplicate tag types loaded from the state file, because
this code path uses TagBuilder::Complement().
2015-02-06 12:25:34 +01:00
Max Kellermann
5489dec28d NEWS: fix v0.18.22 release date 2015-02-01 12:22:24 +01:00
Max Kellermann
8a6b4db19f Makefile.am: move org_musicpd_Bridge.h to BUILT_SOURCES 2015-01-31 00:05:30 +01:00
Max Kellermann
df43b6a05c Makefile.am: generate icon before compiling JNI classes
Apparently, Android's build.xml requires the icon to be available,
even when only running the Java compiler.
2015-01-31 00:05:30 +01:00
Max Kellermann
3adca3c2fa db/update/Walk: use std::unique_ptr instead of std::auto_ptr
std::auto_ptr is deprecated, and std::unique_ptr is much better
anyway.
2015-01-29 08:37:23 +01:00
PHO
39abd3ecb4 Avoid integer overflow in MonotonicClock{S,MS,US}
This is Darwin specific: the previous implementation was causing an integer
overflow when base.numer is very large. On PPC Darwin, the timebase info is 1000000000/33330116 and this is too large for integer arithmetic.
2015-01-29 08:34:37 +01:00
PHO
a4f4fc50b9 Avoid integer overflow in MonotonicClock{S,MS,US}
This is Darwin specific: the previous implementation was causing an integer
overflow when base.numer is very large. On PPC Darwin, the timebase info is 1000000000/33330116 and this is too large for integer arithmetic.
2015-01-29 08:33:48 +01:00
Max Kellermann
7bf638b0de decoder/DsdLib: use new[] to allocate the ID3 buffer
Don't abort the process if there's not enough memory.  This buffer is
not important and can be large.
2015-01-29 08:24:34 +01:00
Max Kellermann
56662a703c decoder/DsdLib: free ID3 buffer right after id3_tag_parse()
Merge two free() calls.
2015-01-29 08:24:34 +01:00
Max Kellermann
8b5f47d3a3 decoder/DsdLib: raise ID3 tag limit to 1 MB
A bug report was submitted with a 600 kB ID3 tag that could not be
read by MPD.
2015-01-29 08:20:14 +01:00
Max Kellermann
a289dcb9ee Merge branch 'v0.18.x' into v0.19.x 2015-01-26 20:48:19 +01:00
PHO
023b9c1e7e Test the existence of strndup(3) before using it.
This can eliminate the ad-hoc "#ifdef WIN32" and can also support other platforms lacking it as well (including Darwin 9).
2015-01-26 20:39:49 +01:00
Max Kellermann
4c61662644 test/read_mixer: add missing stdlib.h include 2015-01-26 20:39:49 +01:00
Max Kellermann
ad1b6ef0ac {playlist,input}/despotify: remove defunct plugin 2015-01-26 09:55:31 +01:00
Max Kellermann
ed5c6be2f1 util/list: disable gcc5 warning
This file has been removed in newer MPD versions, so don't care about
it now.
2015-01-23 16:50:31 +01:00
Max Kellermann
30cb082932 ClientProcess: cast enum to int before passing to printf()
Fixes gcc5 warning.
2015-01-23 16:50:31 +01:00
Max Kellermann
645554d12f configure.ac: prepare for 0.18.23 2015-01-23 16:47:13 +01:00
Max Kellermann
212b0faf0c android/build.py: use os.path.abspath() to build mpd_path
Fixes a bug that occurs when runing "build.py" from inside the
"android" directory.
2015-01-22 18:51:53 +01:00
Max Kellermann
276a0d9500 thread/Name: include stdio.h if HAVE_PRCTL
Caused a build failure with uClibc because snprintf() was not
available.
2015-01-21 20:40:56 +01:00
Max Kellermann
384b6c8288 doc/protocol: "playlistsearch" is case insensitive 2015-01-16 17:27:19 +01:00
Max Kellermann
a2af158fd3 configure.ac: prepare for 0.19.9 2015-01-16 17:26:50 +01:00
Max Kellermann
f33d2fb2e7 release v0.19.8 2015-01-14 23:12:24 +01:00
Max Kellermann
a9eec35aff Merge tag 'v0.18.22' into v0.19.x 2015-01-14 23:12:08 +01:00
Max Kellermann
8534f2d1e2 release v0.18.22 2015-01-14 23:04:49 +01:00
Max Kellermann
00740fb23b android/build.py: prepend "./" to "configure" if path is empty
Fixes in-tree build when the script is called as "android/build.py"
and not "./android/build.py".
2015-01-09 16:51:52 +01:00
Max Kellermann
37e9010887 input/async: reset the "open" flag after seeking successfully
Fixes a problem with the "curl" input plugin: IsEOF() always returns
true because the "open" flag was cleared by
CurlInputStream::RequestDone() when end-of-stream was reached.  This
flag stays false even when seeking to another position has succeeded.

This patch resets the "open" flag to true after seeking successfully.
2015-01-06 12:46:28 +01:00
Max Kellermann
4bd2c75056 thread/Name: disable pthread_setname_np() on NetBSD
NetBSD's pthread_setname_np() prototype is incompatible with the rest
of the world, and it requires to pass the string argument as a
non-const pointer.  Instead of working around this misdesign, I hereby
disable the feature on NetBSD.
2015-01-06 12:08:36 +01:00
Max Kellermann
b9ed850b98 thread/Name: enable FormatThreadName() with prctl()
Add macro HAVE_THREAD_NAME which is set when any method to set the
thread name is available.  Use that macro in FormatThreadName()
instead of just checking for HAVE_PTHREAD_SETNAME_NP.
2015-01-06 12:04:30 +01:00
Max Kellermann
11cea17496 thread/Name: indent preprocessor commands 2015-01-06 12:04:15 +01:00
Max Kellermann
163597ef69 db/simple: fix implicit nullptr/bool conversion
Return false on error, not nullptr.
2014-12-26 14:34:03 +01:00
Max Kellermann
95f84afd33 fs/Traits, ...: work around -Wtautological-pointer-compare
New in clang 3.6.
2014-12-26 14:34:03 +01:00
Max Kellermann
9f7fd1fbfb db/lazy, input/mms: add "override" keywords
Fixes -Winconsistent-missing-override (clang 3.6).
2014-12-26 14:29:29 +01:00
Max Kellermann
940cab8620 Merge branch 'v0.18.x' into v0.19.x 2014-12-26 14:28:52 +01:00
Max Kellermann
5b84c99d79 doc/user: remove autoconf/automake from Debian build dependencies 2014-12-26 14:00:50 +01:00
Max Kellermann
b295024574 doc/user: add more Debian build dependencies 2014-12-26 13:56:26 +01:00
Max Kellermann
34180f1745 doc/user: add libicu-dev to Debian build dependencies 2014-12-26 13:54:33 +01:00
Max Kellermann
665031467a db/proxy, output/shout: fix implicit nullptr/bool conversion
Return false on error, not nullptr.
2014-12-26 13:50:54 +01:00
Max Kellermann
df33171107 db/{simple,proxy}, ...: add "override" keywords
Fixes -Winconsistent-missing-override (clang 3.6).
2014-12-26 13:47:04 +01:00
Max Kellermann
53f4044890 util/{ASCII,UriUtil}, ...: work around -Wtautological-pointer-compare
New in clang 3.6.
2014-12-26 13:43:32 +01:00
Max Kellermann
a5049136ff DatabaseGlue: convert nullptr check to assertion 2014-12-26 13:43:32 +01:00
Max Kellermann
705b3c6b63 util/ASCII: fix indent 2014-12-26 13:37:38 +01:00
Max Kellermann
6b4ac66962 Compiler.h: add macro CLANG_CHECK_VERSION() 2014-12-26 13:31:03 +01:00
Max Kellermann
0964b06240 Compiler.h: add macro GCC_OLDER_THAN() 2014-12-26 13:30:44 +01:00
Max Kellermann
92eeca3ba7 util/Manual: reimplement GCC_CHECK_VERSION() using GCC_MAKE_VERSION() 2014-12-26 13:30:22 +01:00
Max Kellermann
2a86554ac4 Compiler.h: add macro GCC_MAKE_VERSION() 2014-12-26 13:30:11 +01:00
Max Kellermann
805caa30ce configure.ac: prepare for 0.18.22 2014-12-26 13:23:04 +01:00
Max Kellermann
a56949e9fa decoder/ffmpeg: support interleaved floating point 2014-12-23 20:51:08 +01:00
Max Kellermann
43da4c0eca input/mms: limit the mmsx_read() size 2014-12-23 20:34:45 +01:00
Max Kellermann
b9c7771830 decoder/DsdLib: add missing stdlib.h include 2014-12-23 10:08:46 +01:00
Jan Brittenson
35db88affe DSF ID3 tags hitting 4k size limit
Here's a change to dynamically allocate the DSD ID3 tag buffer.
Pretty much anything with cover art is going to exceed the existing,
static 4k limit...  Here's a change to dynamically allocate the buffer
and sanity check it at some upper limit.  I rather arbitrarily pulled
256k out of thin air just to keep a corrupt file from causing it to
trying to allocate a buffer larger than available memory.
2014-12-23 09:49:33 +01:00
Max Kellermann
e38faca455 configure.ac: prepare for 0.19.8 2014-12-23 09:48:31 +01:00
Max Kellermann
0255e8710c android: release v0.19.7 2014-12-23 09:42:52 +01:00
Max Kellermann
6d89020f80 release v0.19.7 2014-12-17 19:20:54 +01:00
Max Kellermann
9c56c49e73 Merge tag 'v0.18.21' into v0.19.x 2014-12-17 19:19:13 +01:00
Max Kellermann
acb798e544 release v0.18.21 2014-12-17 19:13:47 +01:00
Max Kellermann
c5720a15c7 LogBackend: force-flush stderr on WIN32
setvbuf() does not seem to have an effect on Windows.
2014-12-17 19:12:25 +01:00
Max Kellermann
90709b332a LogInit: make stderr line-buffered
Make sure everything gets logged right away.  No delays because
stdio's buffer is not yet full.
2014-12-17 19:12:01 +01:00
Max Kellermann
81f17d10c8 util/HugeAllocator: enable MEM_COMMIT on Windows
Without MEM_COMMIT, the reserved address space is not accessible, and
MPD crashes.
2014-12-17 19:10:58 +01:00
k44
773de38bd9 playlist/embcue: fix filename suffix detection
The definition of the playlist_plugin struct member of the embcue
plugin was incorrect.
2014-12-16 18:43:05 +01:00
Max Kellermann
a48704925d storage/nfs: add timeout 2014-12-15 00:45:13 +01:00
Max Kellermann
fa4beeee75 decoder/ffmpeg: detect and fix negative time stamps
Works around assertion failure due to something that appears to be a
(minor) FFmpeg bug.
2014-12-15 00:40:46 +01:00
Max Kellermann
d8351772d3 configure.ac: prepare for 0.18.21 2014-12-15 00:39:52 +01:00
Max Kellermann
68d1abdb85 storage/nfs: clear last_error in SetState()
Fixes bogus assertion failure.
2014-12-15 00:39:30 +01:00
Max Kellermann
7e8474a85a lib/nfs/Connection: unregister socket with SocketMonitor::Steal()
SocketMonitor::Cancel() does not actually unregister the socket; it
only disables the event.
2014-12-15 00:31:12 +01:00
Max Kellermann
82da364b8b lib/nfs/Connection: implement mount timeout 2014-12-15 00:05:53 +01:00
Max Kellermann
7fa91ec175 lib/nfs/Connection: add debug flag "in_destroy" 2014-12-15 00:03:30 +01:00
Max Kellermann
1d3a09d377 lib/nfs/Connection: add assertion 2014-12-14 22:51:37 +01:00
Max Kellermann
02563a35f0 lib/nfs/Connection: fix reconnect after mount failure
When mounting had not yet finished, SocketMonitor::IsDefined() was
always false, due to the workaround at the beginning of the function
that calls SocketMonitor::Steal().  This commit drops the IsDefined()
check because it was never necessary and breaks reconnect.
2014-12-14 22:49:16 +01:00
Max Kellermann
d653f35bb7 lib/nfs/Connection: fix typo in code comment 2014-12-14 22:49:09 +01:00
Max Kellermann
a543627abd lib/nfs/Connection: fix memory leak (and assertion failure)
nfs_destroy_context() will invoke all pending callbacks with
err==-EINTR.  In CancellableCallback::Callback(), this will invoke
NfsConnection::DeferClose(), which however is only designed to be
called from nfs_service().  In non-debug mode, this will leak memory
because nfs_close_async() is never called.

Workaround: before nfs_destroy_context(), invoke nfs_close_async() on
all pending file handles.
2014-12-14 16:02:47 +01:00
Max Kellermann
80f2ba7fca lib/nfs/Connection: move code to Service() 2014-12-14 15:45:10 +01:00
Max Kellermann
32bca64920 lib/nfs/Connection: add assertions 2014-12-14 15:40:29 +01:00
Max Kellermann
7fa1a84ec3 lib/nfs/Connection: move code to method InternalClose() 2014-12-14 15:38:09 +01:00
Max Kellermann
ab4bb26a0a lib/nfs/Connection: make in_service and in_event debug-only flags 2014-12-14 15:20:40 +01:00
Max Kellermann
4b8d258cff lib/nfs/Connection: fix crash while canceling a failing Open()
The method NfsConnection::CancellableCallback::Callback() will always
invoke NfsConnection::Close() on the file handle, even if the void
pointer is not a nfsfh.  This can happen if the Open() was not
successful, e.g. when the file does not exist.
2014-12-14 15:16:01 +01:00
Max Kellermann
3c29aa6271 event/Loop: read the "again" flag while holding mutex 2014-12-14 14:47:36 +01:00
Max Kellermann
51464b4317 lib/nfs/Connection: add assertions 2014-12-14 14:24:49 +01:00
Max Kellermann
2fec463542 util/HugeAllocator: disable MEM_LARGE_PAGES on Windows
MEM_LARGE_PAGES does not appear to work.  Instead, MEM_RESERVE appears
to be necessary.  Until I figure this out, this large pages are
disabled.
2014-12-12 13:20:58 +01:00
Max Kellermann
1affc641c4 input/Init: eliminate double colon from log message 2014-12-12 13:20:37 +01:00
Max Kellermann
0cfd4fff62 playlist/Print: don't skip non-existent songs in "listplaylist"
Skipping those songs silently will confuse the client, because
commands specifying the song index within a playlist
(e.g. playlistdelete) will be out of sync.

This copies spl_print()'s behavior to playlist_file_print().
2014-12-09 13:36:48 +01:00
Max Kellermann
8904127c10 configure.ac: prepare for 0.19.7 2014-12-09 13:09:03 +01:00
Max Kellermann
c46f48abec release v0.19.6 2014-12-08 15:12:41 +01:00
Max Kellermann
4acbf7b90d android/build.py: update FFmpeg to 2.5 2014-12-08 15:05:49 +01:00
Max Kellermann
cbc1a58e93 Merge tag 'v0.18.20' into v0.19.x 2014-12-08 15:03:09 +01:00
Max Kellermann
1b5f33a435 release v0.18.20 2014-12-08 14:57:17 +01:00
Max Kellermann
41b4a63f2b decoder/ffmpeg: support FFmpeg 2.5
Version 2.5 fixed an API oddity, however it broke API compatibility,
at least with C++.  Disable the workaround when a libavformat version
is detected that is recent enough.
2014-12-08 14:25:34 +01:00
Max Kellermann
d8fc2db910 thread/Id: drop "::" prefix before pthread function names
The "::" to explicitly refer to the global namespace appeared like a
good idea in C++, but it breaks with C libraries that implement
standard functions using macros (e.g. musl).
2014-12-08 14:17:17 +01:00
Max Kellermann
dc11dea7cc configure.ac: prepare for 0.18.20 2014-12-08 14:13:20 +01:00
Nix
811af02f56 Output: start with a null mixer.
There are code paths (mostly error cases) in which it is possible to
initialize an AudioOutput and then kill it without ever calling
audio_output_new().  In such a case, its destructor will attempt to
free a mixer that was never initialized, leading to an attempt to
take out a lock on a mutex that was similarly never initialized,
which hangs forever.

Fix by always initializing the mixer appropriately.
2014-12-01 22:14:09 +01:00
Max Kellermann
8780e23ed3 android/build.py: update ffmpeg 2.4.3, curl 7.39 2014-11-28 21:08:27 +01:00
Max Kellermann
be492ed108 android: update libFLAC to 1.3.1
Due to security vulnerabilities.
2014-11-28 21:08:27 +01:00
Max Kellermann
24da14f4f7 .gitignore: ignore /lib/ 2014-11-28 21:08:18 +01:00
Max Kellermann
03d2fb450f configure.ac: prepare for 0.19.6 2014-11-28 20:13:57 +01:00
Max Kellermann
67cba251c8 release v0.19.5 2014-11-26 20:11:42 +01:00
Max Kellermann
0bc511715b Makefile.am: distribute Android sources 2014-11-26 20:11:42 +01:00
Max Kellermann
27ce80544f Merge tag 'v0.18.19' into v0.19.x 2014-11-26 20:02:57 +01:00
Max Kellermann
04f627c2af release v0.18.19 2014-11-26 19:58:48 +01:00
Max Kellermann
e72eef421b lib/nfs/FileReader: clean up on disconnect
Avoids crash because Close() invokes a call on a destructed
NfsConnection.
2014-11-25 14:02:15 +01:00
Max Kellermann
016063c810 lib/nfs/FileReader: move code to CancelOrClose() 2014-11-25 14:00:32 +01:00
Max Kellermann
38f19981b2 lib/nfs/FileReader: reset state in OnNfsConnectionFailed()
Avoid calling NfsConnection::RemoveLease(), because the lease has been
removed already.
2014-11-25 13:51:09 +01:00
Max Kellermann
40dd968f13 lib/nfs/FileReader: update "state" in OnNfsError()
Clean up the "state" to indicate that there is no longer any
asynchronous operation.  Fixes another NFS-related crash due to
cleanup of a non-existing asynchronous operation.
2014-11-25 13:39:42 +01:00
Max Kellermann
3cef348f30 lib/nfs/Manager: defer NfsConnection destruction
Avoids a crash that occurs when NfsConnection::OnSocketReady()
dereferences itself before returning.
2014-11-25 13:31:18 +01:00
Max Kellermann
b293b16007 lib/nfs/Connection: broadcast error before closing connection
During the NfsLease::OnNfsConnectionFailed() call, the old (defunct)
nfs_context may be used to close file handles.  Such code does not yet
exist, but will be added soon to fix other bugs.
2014-11-25 13:27:06 +01:00
Max Kellermann
f5f43db2da lib/nfs/Connection: cancel DeferredMonitor on disconnect
Fixes potential second mount attempt after the old connection to the
NFS server was shut down.
2014-11-25 13:22:25 +01:00
Max Kellermann
029555d192 lib/nfs/FileReader: include Compiler.h for "final" fallback 2014-11-25 13:18:22 +01:00
Max Kellermann
fa4d202e71 decoder/mp4v2: remove because of incompatible license
libmp4v2 is licensed under MPL 1.1, which is incompatible with GPLv2.
Unfortunately, this means that we must remove the plugin.

More information can be found in the Debian bug report:

 http://bugs.debian.org/767504
2014-11-25 13:10:52 +01:00
Max Kellermann
a8ebfd7a92 event/DeferredMonitor: include cleanup 2014-11-25 10:44:06 +01:00
Max Kellermann
b19e5720cc test/run_input: make variables more local 2014-11-25 07:51:33 +01:00
Max Kellermann
a254f5a3a8 archive/zzip: fix inverted error handler
Set the Error when zzip_seek()==-1 and not on success.  Fixes a crash
after seeking.
2014-11-24 22:08:50 +01:00
Max Kellermann
143c735f96 configure.ac: prepare for 0.18.19 2014-11-24 22:08:50 +01:00
Max Kellermann
951bad46e0 decoder/{dsdiff,dsf,opus}: fix deadlock while seeking 2014-11-24 08:54:30 +01:00
Max Kellermann
716225cd2f doc/protocol: mention that "count" can have multiple filters 2014-11-24 08:09:58 +01:00
Max Kellermann
bbc618b8f9 configure.ac: prepare for 0.19.5 2014-11-24 08:09:44 +01:00
Max Kellermann
11ead56d6d android: release v0.19.4
Android releases were missing since 0.19.1.
2014-11-24 08:00:47 +01:00
Max Kellermann
e972ae4afa android: switch to gcc 4.9 / llvm 3.5 (NDK r10c) 2014-11-24 08:00:45 +01:00
Max Kellermann
0709065f50 Java/File: fix include guard 2014-11-24 07:51:25 +01:00
Max Kellermann
d6bc5c35a7 release v0.19.4 2014-11-18 21:40:52 +01:00
Max Kellermann
dc03f003ac Merge tag 'v0.18.18' into v0.19.x 2014-11-18 21:38:44 +01:00
Max Kellermann
7aa2104596 release v0.18.18 2014-11-18 21:34:03 +01:00
Max Kellermann
460cfba6ff QueueCommands: workaround for buggy clients that send "add /" 2014-11-18 21:31:54 +01:00
Max Kellermann
c8b93d6573 Client: assume uid==0 is local socket
A negative uid value means it's not a "local socket" (PF_LOCAL).
uid==0 means user "root" connected.
2014-11-18 20:56:27 +01:00
Max Kellermann
3f5f96ac91 event/ServerSocket: fix get_remote_uid() error value
Must return -1 on error, not 0.  0 is root.
2014-11-18 20:53:59 +01:00
Max Kellermann
7c6b991de7 decoder/opus: add MIME types audio/ogg and application/ogg 2014-11-12 15:16:34 +01:00
Max Kellermann
82460aa49f configure.ac: prepare for 0.19.4 2014-11-12 15:16:07 +01:00
Florent Le Coz
7e7b403043 Construct a Null AllocatedPath if the filename conversion into UTF8 failed 2014-11-11 17:15:19 +01:00
Max Kellermann
e5217e6ce9 release v0.19.3 2014-11-11 11:21:42 +01:00
Max Kellermann
c98cb1d6f9 decoder/opus: support chained streams 2014-11-11 11:20:18 +01:00
Max Kellermann
ba6f2b0467 decoder/opus: move code to HandleEOS() 2014-11-11 11:20:16 +01:00
Max Kellermann
23465ad985 decoder/opus: improved error logging 2014-11-11 11:20:03 +01:00
Max Kellermann
7886a14b74 decoder/opus: fix mistyped LoadEOSPacket() return value 2014-11-11 11:18:51 +01:00
Max Kellermann
466b6a23cd decoder/opus: eliminate flag "found_opus"
Check opus_decoder!=nullptr instead.
2014-11-11 08:30:11 +01:00
Max Kellermann
4a04f73434 decoder/opus: add constexpr output_buffer_frames 2014-11-11 07:45:31 +01:00
Misty De Meo
134cb6a017 Main: fix compilation on OS X using non-Apple compilers
Commit d42c0f1dc5 added an OS X-specific
method of calling mpd_main_after_fork(), which uses Grand Central
Dispatch. Since this uses a block literal, it breaks compilation on
compilers which don't support the block extension, e.g. non-Apple
compilers. This affects users on older OS X releases with GCD (which
depend on older Clang releases, or Apple GCCs, which don't support the
C++11 features MPD needs); or which don't support GCD at all (10.5 and
lower).

This patch changes the #ifdef so that the non-GCD code is used
as it was on OS X before this patch if blocks aren't available, via
checking __BLOCKS__ macro.
2014-11-11 06:22:24 +01:00
Max Kellermann
8d036c4b7c pcm/SoxrResampler: round output buffer size up
The old formula calculates the output buffer size with "regular"
rounding (to the nearest integer), however sometimes, that is
insufficient and the last sample cannot be resampled.  This causes
audible distortions.  By changing the formula to consider the worst
case (always round up), this problem is eliminated.
2014-11-10 22:52:17 +01:00
Max Kellermann
c64ad78c7b decoder/ffmpeg: support opus 2014-11-10 18:00:30 +01:00
Max Kellermann
4a043a915f configure.ac: prepare for 0.18.1 2014-11-10 17:59:06 +01:00
Max Kellermann
8ff0d99092 decoder/audiofile: fix bit rate calculation 2014-11-10 09:00:50 +01:00
Max Kellermann
2e47cb12c4 test/FakeDecoderAPI: dump bit rate 2014-11-10 09:00:38 +01:00
Max Kellermann
ff6f1655f0 input/curl: ignore ResponseBoundary() while seeking
While seeking, metadata must not be updated.  ResponseBoundary() was
added in MPD 0.19.1, but I forgot to add the IsSeeking() check there.
This caused the "seekable" flag to reset.
2014-11-10 08:45:19 +01:00
Max Kellermann
b5ba94f1de tag/Set: do AlbumArtist/Artist fallback only if AlbumArtist is not disabled
On "list albumartist", songs that have no AlbumArtist tag will use the
Artist tag.  However, if AlbumArtist is disabled via
"metadata_to_use", the TagBuilder::AddItem() call is ignored, and
PrintUniqueTag() attempts to print a nullptr string.

This commit fixes the problem by attempting the fallback only if
AlbumArtist is not disabled.
2014-11-08 19:25:01 +01:00
Max Kellermann
cbf79769d3 db/Count: include cleanup 2014-11-08 19:21:42 +01:00
Max Kellermann
125eb01e03 decoder/ffmpeg: support opus 2014-11-07 19:22:26 +01:00
Max Kellermann
ccb13205f4 db/upnp: fix valgrind warning 2014-11-07 19:12:43 +01:00
Max Kellermann
6f23e91e33 lib/upnp/ContentDirectoryService: swap uri_apply_base() parameters
When uri_apply_base() was moved from db/upnp/Util.cpp to
util/UriUtil.cpp, the parameter order was changed, however without
swapping the parameters in the ContentDirectoryService constructor.
2014-11-07 18:43:00 +01:00
Max Kellermann
1bd8a322f5 input/AsyncInputStream: set Error when seeking unseekable
Fixes crash in the "audiofile" decoder while logging the seek error.
2014-11-07 13:57:57 +01:00
Max Kellermann
362e73bea8 input/Open: expose input_domain 2014-11-07 13:57:57 +01:00
Max Kellermann
9f8c2b3b56 configure.ac: prepare for 0.19.3 2014-11-04 09:24:09 +01:00
Max Kellermann
6a7f6cdacd release v0.19.2 2014-11-02 13:46:32 +01:00
Max Kellermann
5715342fe0 Merge tag 'v0.18.17' into v0.19.x 2014-11-02 13:46:09 +01:00
Max Kellermann
38a0d15190 release v0.18.17 2014-11-02 13:06:20 +01:00
Max Kellermann
56f763a4a8 input/curl: forget Content-Length (and more) after redirect
Fixes playback of redirected streams.
2014-11-02 13:00:28 +01:00
Max Kellermann
a2eb14f3b3 AsyncInputStream: add method ClearTag() 2014-11-02 13:00:28 +01:00
Max Kellermann
05c63af7c4 InputStream: add method ClearMimeType() 2014-11-02 12:59:16 +01:00
Max Kellermann
1f59701c46 Merge branch 'v0.18.x' into v0.19.x 2014-11-02 12:27:46 +01:00
Max Kellermann
ec3191f502 input/curl: fix curl_easy_setopt() parameter types 2014-11-02 11:55:48 +01:00
Max Kellermann
32b5654a6e Decoder, Playlist: ignore URI query string for plugin detection
Use the new uri_get_suffix() overload that removes the query string.
2014-11-02 11:54:26 +01:00
Max Kellermann
674091424e util/UriUtil: add uri_get_suffix() overload that ignores query string 2014-11-02 11:53:31 +01:00
Max Kellermann
6ad336743d PlaylistFile: don't allow empty playlist name 2014-11-02 11:52:48 +01:00
Max Kellermann
c882568ccd playlist/m3u: recognize the file suffix ".m3u8" 2014-11-02 11:50:56 +01:00
Max Kellermann
f6b2899dd2 decoder/faad: remove workaround for ancient libfaad2 ABI bug
Many years ago, FAAD had a serious ABI bug: the NeAACDecInit()
prototype in its header declared the "samplerate" parameter to be
"unsigned long *", but internally, the function assumed it was
"uint32_t *" instead.  On 32 bit machines, that was no difference, but
on 64 bit, this left one portion of the return value uninitialized;
and worse, on big-endian, the wrong word was filled.  This bug had to
be worked around in MPD (commit 9c4e97a6).

A few months later, the bug was fixed in the FAAD CVS in commit 1.117
on file libfaad/decoder.c; the commit message was:

 "Use public headers internally to prevent duplicate declarations"

The commit message was too brief at best; the problem was not
duplicate declarations, but a prototype mismatch.  No mention of the
bug fix in the ChangeLog.

The MPD project never learned about this bug fix, and so MPD would
always pass a "uin32_t *" dressed up as a "unsigned long *".  Nearly 6
years later, it's about time to fix this second ABI problem.  Let's
kill the workaround!
2014-11-02 11:50:56 +01:00
Steven OBrien
bccd4ef2f7 decoder/ffmpeg: recognize MIME type audio/aacp 2014-11-02 11:50:56 +01:00
Max Kellermann
94c240a026 configure.ac: show DSD in result 2014-11-02 11:50:56 +01:00
Max Kellermann
c50a0cf7bf output/roar: remove unnecessary "volatile" keyword
A mutex acts as a memory barrier, and thus "volatile" is not
necessary.
2014-11-02 11:50:56 +01:00
Max Kellermann
c37f7abb79 TagString: use g_strndup() for unterminated string
Fixes buffer overflow bug.
2014-11-02 11:48:13 +01:00
Max Kellermann
432ce9b1de configure.ac: prepare for 0.18.17 2014-11-02 11:41:40 +01:00
Max Kellermann
054323c2bc lib/upnp/Discovery: add missing stdlib.h include 2014-11-02 11:04:13 +01:00
Max Kellermann
a8770aa606 input/curl: fix curl_easy_setopt() parameter types 2014-11-01 14:09:30 +01:00
Max Kellermann
7d5442e103 Decoder, Playlist: ignore URI query string for plugin detection
Use the new uri_get_suffix() overload that removes the query string.
2014-11-01 13:41:18 +01:00
Max Kellermann
eab32f2e5d util/UriUtil: add uri_get_suffix() overload that ignores query string 2014-11-01 12:45:47 +01:00
NanoTech
d42c0f1dc5 Main: run the OS X native event loop after forking 2014-10-31 15:03:53 +01:00
NanoTech
6ad1e4d99a Revert "Main: run the OS X native event loop"
This reverts commit f0be48ff90
(except for the NEWS entry).

If libdispatch (GCD) is used before forking, it
can't safely be used again after forking.
2014-10-31 15:03:46 +01:00
Max Kellermann
7350144ab3 PlaylistFile: don't allow empty playlist name 2014-10-31 14:59:27 +01:00
Max Kellermann
54c591bd9d decoder/mad: fix negative replay gain values
Negating an unsigned integer does not work.
2014-10-28 22:22:30 +01:00
Max Kellermann
217d88f21f TextInputStream: don't ignore unterminated last line 2014-10-28 22:10:47 +01:00
Max Kellermann
394e3be482 playlist/m3u: recognize the file suffix ".m3u8" 2014-10-26 08:14:16 +01:00
Max Kellermann
d7f024c510 OutputThread: fall back to PCM if given DSD sample rate is not supported
Works around the "PCM conversion from f to dsd is not implemented"
error message that prevents DSD playback.
2014-10-25 22:06:08 +02:00
Max Kellermann
bc5a53574c decoder/faad: remove workaround for ancient libfaad2 ABI bug
Many years ago, FAAD had a serious ABI bug: the NeAACDecInit()
prototype in its header declared the "samplerate" parameter to be
"unsigned long *", but internally, the function assumed it was
"uint32_t *" instead.  On 32 bit machines, that was no difference, but
on 64 bit, this left one portion of the return value uninitialized;
and worse, on big-endian, the wrong word was filled.  This bug had to
be worked around in MPD (commit 9c4e97a6).

A few months later, the bug was fixed in the FAAD CVS in commit 1.117
on file libfaad/decoder.c; the commit message was:

 "Use public headers internally to prevent duplicate declarations"

The commit message was too brief at best; the problem was not
duplicate declarations, but a prototype mismatch.  No mention of the
bug fix in the ChangeLog.

The MPD project never learned about this bug fix, and so MPD would
always pass a "uin32_t *" dressed up as a "unsigned long *".  Nearly 6
years later, it's about time to fix this second ABI problem.  Let's
kill the workaround!
2014-10-25 20:42:50 +02:00
Max Kellermann
30df709736 configure.ac: update VERSION_REVISION 2014-10-25 00:33:25 +02:00
Steven OBrien
8cd17ce045 decoder/ffmpeg: recognize MIME type audio/aacp 2014-10-25 00:26:58 +02:00
Max Kellermann
1bfbced258 configure.ac: add storage plugin section to result 2014-10-25 00:21:18 +02:00
Max Kellermann
6ac5980a17 configure.ac: show DSD in result 2014-10-25 00:19:01 +02:00
Max Kellermann
2e24adae89 configure.ac: require xmlto for --enable-documentation 2014-10-25 00:14:25 +02:00
Max Kellermann
188b94cb3e test/test_archive: don't use GLib 2014-10-25 00:08:04 +02:00
Max Kellermann
c48733e34f fs/Charset: work around clang's -Wunused-const-variable
MPD_PATH_MAX_UTF8 is only used by GLib-specific code currently.
2014-10-25 00:07:25 +02:00
Max Kellermann
f36db9bb04 configure.ac: auto-disable plugins that require GLib when --disable-glib is used 2014-10-24 23:46:20 +02:00
Max Kellermann
30dd29e251 configure.ac: improve database dependency checks
Abort if --enable-libmpdclient or --enable-upnp are used with
--disable-database, instead of ignoring the mismatch silently.
2014-10-24 23:43:21 +02:00
Max Kellermann
6cf1acfb48 test/DumpDatabase, ...: no g_thread_init() calls when GLib is disabled 2014-10-24 18:30:30 +02:00
Max Kellermann
a7b09d3d1c OutputThread: close the output plugin after filter failure
Fixes memory leak because ao_plugin_close() never gets called.
2014-10-24 00:35:16 +02:00
Max Kellermann
8fc3768166 OutputThread: unlock mutex for CloseFilter()
Be consistent.
2014-10-24 00:29:03 +02:00
Max Kellermann
b07bddf742 output/roar: remove unnecessary "volatile" keyword
A mutex acts as a memory barrier, and thus "volatile" is not
necessary.
2014-10-23 23:29:56 +02:00
Max Kellermann
220f957cd8 pcm/ChannelsConverter: fix variable used to generate error message
Use the "_format" parameter instead of the (uninitialized) "format"
attribute.
2014-10-23 22:44:53 +02:00
Max Kellermann
8ce48d83eb pcm/FormatConverter: move check to Open()
Report unsupported format while opening the filter, not later when the
first conversion takes place.
2014-10-23 22:42:08 +02:00
Max Kellermann
200cdb6b0a pcm/PcmConvert: assign {src,dest}_format at the end
Fixes assertion failure in destructor by not assigning
{src,dest}_format when an error occurs.
2014-10-23 22:39:51 +02:00
Max Kellermann
d9fb40203a pcm/PcmConvert: make AudioFormat parameters "const" 2014-10-23 22:39:51 +02:00
Max Kellermann
2d9e972195 configure.ac: prepare for 0.19.2 2014-10-23 21:57:04 +02:00
Max Kellermann
97a1a04116 release v0.19.1 2014-10-19 01:03:17 +02:00
Max Kellermann
493cd866f1 TextInputStream: manually shift the buffer before reading
Fixes truncated lines in m3u and cue files (regression by commit
67958f7).
2014-10-19 00:50:52 +02:00
Max Kellermann
063d369672 util/StaticFifoBuffer: make Shift() public 2014-10-19 00:49:08 +02:00
Max Kellermann
a0fae8dacc playlist/extm3u: strip first line for #EXTM3U detection 2014-10-17 20:45:18 +02:00
Max Kellermann
bc840b69d5 Makefile.am: distribute systemd/mpd.socket
The file systemd/mpd.service.in is being distributed implicitly, but
systemd/mpd.socket is not and needs to be added to EXTRA_DIST.
2014-10-12 08:38:52 +02:00
Max Kellermann
85301853d6 ThreadInputStream: call ThreadRead() inside the thread instead of Read()
Fixes deadlock bug in the "mms" plugin.
2014-10-11 21:59:06 +02:00
Max Kellermann
7cd53fb452 ThreadInputStream: add assertions 2014-10-11 21:57:31 +02:00
Max Kellermann
538ddf7af2 NEWS: add missing line 2014-10-11 21:48:52 +02:00
Max Kellermann
d5afa181f7 NEWS: fix typo in version number 2014-10-11 21:48:27 +02:00
Max Kellermann
8ed4124184 util/DynamicFifoBuffer: make the "Range" type public
Export it from the protected base class.  This fixes a build failure
on Mac OS X.
2014-10-11 20:28:08 +02:00
Max Kellermann
160242a74f configure.ac: prepare for 0.19.1 2014-10-11 20:25:19 +02:00
Max Kellermann
81b83bc904 release v0.19 2014-10-10 23:49:31 +02:00
Max Kellermann
2a716b7a7a doc: document the mount/neighbor commands 2014-10-10 23:22:39 +02:00
Max Kellermann
63272541eb doc/protocol: add more markup 2014-10-10 23:22:39 +02:00
Max Kellermann
464767c5fd db/upnp/Util: move caturl() to util/UriUtil.cxx 2014-10-10 22:43:40 +02:00
Max Kellermann
a9c3ca8606 event/IdleMonitor: remove redundant comment 2014-10-10 22:39:11 +02:00
Max Kellermann
86dd677e0c ZeroconfBonjour: use htons() instead of g_htons() 2014-10-10 22:30:38 +02:00
Max Kellermann
666f700a93 TagString: implement fix_utf8() without GLib 2014-10-10 22:11:38 +02:00
Max Kellermann
b70bf938c2 util/UTF8: add SequenceLengthUTF8() 2014-10-10 22:11:38 +02:00
Max Kellermann
d5cf41e043 util/UTF8: new library 2014-10-10 22:11:38 +02:00
Max Kellermann
b7a1954c33 TagString: return WritableBuffer<char> 2014-10-10 22:07:19 +02:00
Max Kellermann
6520589a37 TagString: use strndup() for unterminated string
Fixes buffer overflow bug.
2014-10-10 22:06:48 +02:00
Max Kellermann
f445b0178a TagString: remove ISO-Latin-1 fallback
MPD handles all strings in UTF-8 internally.  Those decoders which
read Latin-1 tags are supposed to implement the conversion, instead of
passing Latin-1 to TagBuilder::AddItem().  FixTagString() is simply
the wrong place to do that, and hard-coding Latin-1 is kind of
arbitrary.
2014-10-10 20:53:08 +02:00
Max Kellermann
f618065f7c fs/Traits: use value_type 2014-10-10 19:51:44 +02:00
nanotech
f0be48ff90 Main: run the OS X native event loop 2014-10-10 19:51:44 +02:00
Max Kellermann
bb922d577d storage/nfs: use the libnfs async API
Share the NFS connection with the NFS input plugin.
2014-10-09 08:09:08 +02:00
Max Kellermann
990809cc21 lib/nfs/Connection: reduce Error instance allocations 2014-10-09 08:08:17 +02:00
Max Kellermann
bfcc466647 lib/nfs/Glue: add assertion 2014-10-09 07:59:53 +02:00
Max Kellermann
3d2558bde6 StoragePlugin: pass EventLoop to constructor 2014-10-09 07:45:25 +02:00
Max Kellermann
1aac0b10c9 test/run_input, ...: add struct ScopeIOThread
Auto-stop the IO thread in all error handlers.
2014-10-07 20:02:13 +02:00
Max Kellermann
e5ff85b63c storage/nfs: move code to class MemoryStorageDirectoryReader
Read all directory entries into memory and close the struct nfsdir
before returning the StorageDirectoryReader instance.  This is what
libnfs does, anyway.
2014-10-07 06:36:11 +02:00
Max Kellermann
f0bb5b84f9 storage/nfs: move code to Copy() 2014-10-07 06:35:53 +02:00
Max Kellermann
07b50f6c69 lib/nfs/Connection: add methods {Open,Read,Close}Directory() 2014-10-07 06:35:50 +02:00
Max Kellermann
61b3aaaa07 lib/nfs/Connection: add method Stat(path) 2014-10-07 06:35:46 +02:00
Max Kellermann
b5119d7958 test/run_storage: new debug program 2014-10-07 06:21:34 +02:00
Max Kellermann
d3e72e4344 Makefile.am: add libnfs and libsmbclient to STORAGE_LIBS 2014-10-07 06:21:34 +02:00
Max Kellermann
60512ffa09 lib/nfs/Connection: make GetEventLoop() public 2014-10-06 08:47:13 +02:00
Max Kellermann
b1a252a64d lib/nfs/Base: kludge to reduce number of NFS mounts
Creating a NfsStorage sets its own export_name as the "base".  Now
NfsFileReader can use this information to derive the export_name to be
mounted, instead of guessing.  This solves the "too many connection"
problem on the NFS server while updating the database.
2014-10-05 07:41:50 +02:00
Max Kellermann
fb90b64bac Makefile.am: compile libffmpeg.a with FFMPEG_CFLAGS 2014-10-04 14:23:11 +02:00
Max Kellermann
6e7a398263 PlaylistStream: use OpenLocalInputStream() 2014-10-02 22:03:02 +02:00
Max Kellermann
44d2d9b1e8 PlaylistStream: pass Path instance to playlist_open_path()
Convert filesystem charset to UTF-8 for playlist_list_open_uri().
This fixes one of many remaining charset bugs.
2014-10-02 22:02:11 +02:00
Max Kellermann
8302ed44aa archive/bzip2: use OpenLocalInputStream() 2014-10-02 22:00:42 +02:00
Max Kellermann
7e12aea1d8 input/Open: use OpenLocalInputStream()
Make the "open" method of plugins "file" and "archive" dummy methods
that always fail.  Instead, let InputStream::Open() hard-code access
to these two plugins by using OpenLocalInputStream().  This allows
simplifyin the algorithm for falling back to probing archive plugins.
2014-10-02 21:50:14 +02:00
Max Kellermann
20346b0da4 DecoderThread: use OpenLocalInputStream() for local files 2014-10-02 21:48:52 +02:00
Max Kellermann
e0e65cbdf9 TagFile: use OpenLocalInputStream() 2014-10-02 21:43:40 +02:00
Max Kellermann
9d2d58c4b6 input/LocalOpen: new library for opening local files
Combines the "file" and the "archive" input plugins.
2014-10-02 21:06:01 +02:00
Max Kellermann
0c461c3859 input/archive: export function OpenArchiveInputStream() 2014-10-02 21:00:38 +02:00
Max Kellermann
0d38bd9b3b input/file: export function OpenFileInputStream() 2014-10-02 20:44:03 +02:00
Max Kellermann
2f02e49b9f input/file: generate Error when errno==ENOENT
This special case was useless.  Fixes the dreaded "Unrecognized URI"
error message when a file does not exist.
2014-10-02 20:16:05 +02:00
Max Kellermann
064e8a7c68 input/file: make the "fd" attribute "const" 2014-10-02 19:55:01 +02:00
Max Kellermann
e4dd269609 input/file: make variables more local 2014-10-02 19:18:58 +02:00
Max Kellermann
19dd59f38c storage: remove redundant "virtual" keywords
"override" implies "virtual".
2014-10-02 19:17:46 +02:00
Max Kellermann
37501d9bc7 input/file: convert to class 2014-10-02 19:14:59 +02:00
Max Kellermann
89f9561d10 storage/Interface: include cleanup 2014-10-01 23:38:17 +02:00
Max Kellermann
8af3f91e78 Makefile.am: fix header file names
Found by "make distcheck".
2014-10-01 23:28:18 +02:00
Max Kellermann
0661fd6f7c lib/nfs/FileReader: postpone the nfs_close_async() call
If an async opertion is in progress, nfs_close_async() will make
libnfs crash because the RPC callback will dereference an object that
was freed by nfs_close_async().
2014-10-01 23:10:32 +02:00
Max Kellermann
edd003b62a lib/nfs/Connection: fix memory leak when cancelling Open()
Close the newly allocated file handle passed to the callback.
2014-10-01 23:03:31 +02:00
Max Kellermann
10cc87e422 lib/nfs/Connection: remove Mutex
All locks are currenly held from only a single thread (the IOThread)
and thus we don't need the Mutex.
2014-10-01 22:15:06 +02:00
Max Kellermann
0470f648c6 lib/nfs/Connection: add method GetEventLoop() 2014-10-01 22:10:46 +02:00
Max Kellermann
777360149d lib/nfs/Connection: remove obsolete flag postponed_destroy 2014-10-01 22:10:05 +02:00
Max Kellermann
aa7774b82b lib/nfs/Connection: remove deprecated move constructor workaround
Not used anymore because NfsManager now uses boost::intrusive::set
instead of std::map.
2014-10-01 22:09:37 +02:00
Max Kellermann
d44da875e7 storage/nfs: make a few attributes "const" 2014-10-01 21:14:26 +02:00
Max Kellermann
f9ad73598b lib/nfs/Manager: use boost::intrusive::map
Reduce overhead for storing the key twice, and more overhead while
looking up the connection to remove it after a failure.
2014-10-01 20:49:40 +02:00
Max Kellermann
952fe98796 lib/nfs/Glue: add assertion 2014-10-01 20:44:54 +02:00
Max Kellermann
579912e52f lib/nfs/Glue: destruct the NfsManager in the I/O thread
This allows eliminating the indirection code from the NfsConnection
destructor.
2014-10-01 20:39:50 +02:00
Max Kellermann
1b5ec3e3ca lib/nfs/Glue: eliminate class NfsGlue
It's just a useless wrapper for class NfsManager.
2014-10-01 20:37:25 +02:00
Max Kellermann
fb4e6ac923 lib/nfs/Cancellable: use boost::intrusive::list
Reduce Remove() overhead because we don't have to walk the list to
find an iterator by reference.
2014-10-01 19:49:38 +02:00
Max Kellermann
3560dc4be6 Tag: support "AlbumSort"
The new tag is supported by all decoders that use the tag name table,
and the ID3v2 tag "TSOA" maps to it.
2014-09-29 18:55:59 +02:00
Max Kellermann
b002ea9a20 storage/nfs: convert file name to UTF-8
Assume the configured filesystem character set is also used by the NFS
server.
2014-09-28 18:26:54 +02:00
Max Kellermann
540317ea2b storage/nfs: use string::append() instead of string::insert()
Swap the order of adding the URI and the slash, because appending is
cheaper than inserting.
2014-09-28 18:25:51 +02:00
Max Kellermann
142d1951d2 storage/nfs: move code to UriToNfsPath() 2014-09-28 18:12:20 +02:00
Max Kellermann
cf06ba6d13 fs/AllocatedPath: add method Steal() 2014-09-28 18:12:20 +02:00
Max Kellermann
a8d800572e fs/AllocatedPath: API documentation grammar fixes 2014-09-28 18:06:18 +02:00
Wieland Hoffmann
5525ea45a4 Add MusicBrainz' Release Track Id tag
The Release Track Id uniquely identifies a recording on a release - that
is, even if a recording appears twice on a release (meaning that the
combination of recording and release id are not enough to figure out
which one it is), the release track id will allow differentiating the two.

The tag names are taken from
https://musicbrainz.org/doc/MusicBrainz_Picard/Tags/Mapping
2014-09-27 19:54:12 +02:00
Max Kellermann
3120958a17 pcm: --disable-dsd also disables the dsd2pcm library 2014-09-26 12:17:47 +02:00
Max Kellermann
052726ed50 PcmConvert: eliminate unused local variable "format" 2014-09-26 12:17:37 +02:00
Max Kellermann
8397196fbb output/alsa: change a few "dsd" to "dop" 2014-09-26 11:07:53 +02:00
Max Kellermann
8547611479 Merge tag 'v0.18.16' 2014-09-26 11:06:11 +02:00
Max Kellermann
fe45f28204 release v0.18.16 2014-09-26 10:57:04 +02:00
Max Kellermann
861067412f configure.ac: fix DSD breakage due to typo 2014-09-26 10:56:20 +02:00
Max Kellermann
7eca886608 configure.ac: prepare for 0.18.16 2014-09-26 10:55:43 +02:00
Max Kellermann
79b6f9e89e release v0.18.15 2014-09-26 09:41:40 +02:00
Max Kellermann
3d17c06777 configure.ac: allow building MPD without decoder plugin
There's always the "PCM" decoder plugin, which was never checked by
configure.ac.
2014-09-26 09:29:18 +02:00
Max Kellermann
d6c08fb79f configure.ac: allow building MPD without output plugin
MPD can easily be used as a database provider for the proxy database
plugin.  In that case, it needs only one "null" output, and no real
output plugin.
2014-09-26 09:29:18 +02:00
Max Kellermann
ef02b20811 CommandLine: update copyright year 2014-09-26 09:29:18 +02:00
Max Kellermann
8bf46a665e configure.ac: add option to disable the DSD decoders
Allow building a smaller MPD binary for people who don't need DSD.
2014-09-26 09:29:18 +02:00
Max Kellermann
c4fca2aa61 playlist/embcue: change name string to "embcue"
The name "cue" was listed twice in "mpd --version".
2014-09-26 09:29:18 +02:00
Max Kellermann
45310d0cf6 decoder/mp4v2: add tag table 2014-09-24 23:29:10 +02:00
Max Kellermann
87268c2297 test/test_protocol: add missing stdlib.h include
EXIT_SUCCESS and EXIT_FAILURE are defined in stdlib.h, not unistd.h.
D'oh!
2014-09-24 23:03:28 +02:00
Max Kellermann
032e435490 decoder/mpg123: support ID3v2, ReplayGain and MixRamp 2014-09-24 22:53:50 +02:00
Max Kellermann
78c43edcac decoder/mpg123: make variables more local 2014-09-24 22:53:39 +02:00
Max Kellermann
f32d34b965 decoder/flac: pass VorbisComment to flac_parse_mixramp() 2014-09-24 22:50:28 +02:00
Max Kellermann
8a7ff6a6fd decoder/flac: move code to tag/MixRamp.cxx 2014-09-24 22:44:58 +02:00
Max Kellermann
6c48aa5fae decoder/mad: move code to tag/MixRamp.cxx 2014-09-24 22:40:34 +02:00
Max Kellermann
d82547acd3 decoder/flac: pass VorbisComment to flac_parse_replay_gain() 2014-09-24 22:34:08 +02:00
Max Kellermann
441f9cc2ee tag/ReplayGain: add VorbisComment parser
Move code from the Vorbis and FLAC decoder plugins.
2014-09-24 22:21:13 +02:00
Max Kellermann
9f4fc8ad33 tag/ReplayGain: move code to template function 2014-09-24 22:19:55 +02:00
Max Kellermann
d1e31261fe decoder/{vorbis,flac}: move duplicate code to tag/VorbisComment.cxx 2014-09-24 21:50:42 +02:00
Max Kellermann
05dd9acba8 tag/ApeReplayGain, decoder/mad: move duplicate code to tag/ReplayGain.cxx 2014-09-24 21:50:34 +02:00
Max Kellermann
9270485723 Merge branch 'v0.18.x' 2014-09-24 21:49:20 +02:00
Max Kellermann
e93975cb46 test/test_protocol: add missing unistd.h include 2014-09-24 21:43:11 +02:00
Max Kellermann
cbdaf4827f CommandLine: make all OptionDefs "constexpr" 2014-09-22 09:10:17 +02:00
Max Kellermann
f2c28d287a DecoderBuffer: struct to class 2014-09-22 08:49:14 +02:00
Max Kellermann
90c228abca DecoderBuffer: convert functions to methods 2014-09-22 08:32:44 +02:00
Max Kellermann
505e6bec9e decoder/faad: use DecoderBuffer references 2014-09-22 08:30:25 +02:00
Max Kellermann
ee027f237b decoder/faad: allocate DecoderBuffer on stack 2014-09-22 08:29:07 +02:00
Max Kellermann
3ae0d6f421 DecoderBuffer: export the struct
Eliminates the functions _new() and _free().
2014-09-22 08:18:58 +02:00
Max Kellermann
13b66a77c7 DecoderBuffer: make "decoder" const 2014-09-21 14:02:39 +02:00
Max Kellermann
ed70836057 DecoderBuffer: convert pointer to reference 2014-09-21 13:50:27 +02:00
Max Kellermann
a68e52c2e3 DecoderBuffer: use class DynamicFifoBuffer 2014-09-21 13:39:26 +02:00
Max Kellermann
ea37b89753 decoder/adplug: log version number 2014-09-21 13:22:56 +02:00
Max Kellermann
5d89aa06f7 decoder/adplug: move the buffer into the loop 2014-09-21 13:20:30 +02:00
Max Kellermann
ead034e638 decoder/sndfile: include cleanup 2014-09-21 13:15:53 +02:00
Max Kellermann
a294838bcd decoder/audiofile: fix indent 2014-09-19 23:57:09 +02:00
Max Kellermann
1c03d1e87d decoder/sndfile: remove obsolete code comment 2014-09-19 23:00:12 +02:00
Max Kellermann
f8804c8a56 decoder/sndfile: remove debug printf() 2014-09-19 22:49:31 +02:00
Max Kellermann
7c444dea6e doc/user: add section "Satellite setup" 2014-09-19 22:41:00 +02:00
Max Kellermann
6d91d270d6 doc/user: more NFS instructions 2014-09-19 22:12:49 +02:00
Max Kellermann
dd1cec4196 decoder/sndfile: log detailed sf_open_virtual() error message 2014-09-19 21:51:24 +02:00
Max Kellermann
d1a8a4481e decoder/sndfile: support float and 16 bit samples
Support these PCM formats natively, instead of letting libsndfile
convert everything to 32 bit.
2014-09-19 21:44:16 +02:00
Max Kellermann
5921ffaa36 decoder/sndfile: move sf_readf_int() call to sndfile_read_frames() 2014-09-19 21:42:06 +02:00
Max Kellermann
cf47b68c1e decoder/sndfile: add sndfile_sample_format()
Prepare for other sample formats.
2014-09-19 21:06:44 +02:00
Max Kellermann
eeb8d0dbcd db/proxy: support empty values in VisitUniqueTags()
Workaround for assertion failure in PrintUniqueTag().
2014-09-18 17:22:31 +02:00
Max Kellermann
b6fa22bd84 OutputThread: retain negative mix ratio
Fixes MixRamp breakage.
2014-09-18 13:50:23 +02:00
Andrzej Rybczak
a0ef27a0cd command/list: reset used size after the list has been processed 2014-09-18 09:15:39 +02:00
Thomas Guillem
22eb831a71 Makefile.am: android AIDL need src/org/musicpd folder 2014-09-16 18:26:20 +02:00
Thomas Guillem
01ab9acd14 Makefile.am: fix android symlinks, use absolute paths 2014-09-16 18:26:07 +02:00
Thomas Guillem
74fcbb382f android/Bridge: add shutdown()
Break the mainloop and terminate run call.
2014-09-16 18:25:45 +02:00
Thomas Guillem
9836b1dddd CurlInputPlugin: fix crash after second init call
The second time init was called, http_200_aliases pointed to a freed pointer
and leaded to a SEGFAULT.
2014-09-16 18:25:25 +02:00
Max Kellermann
e304d0f8ee thread/Posix{Cond,Mutex}: don't ues PTHREAD_*_INITIALIZER on NetBSD
On NetBSD, PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER are
not compatible with C++11 "constexpr" (see Mantis ticket 0004110).  As
a workaround, don't ues "constexpr", and use the functions
pthread_mutex_init(), pthread_mutex_destroy(), pthread_cond_init() and
pthread_cond_destroy() instead.  This adds some runtime overhead, but
is portable to POSIX implementations that have awkward initializer
macros.
2014-09-13 11:26:17 +02:00
Max Kellermann
ab7b38d4b9 configure.ac: prepare for 0.18.15 2014-09-13 11:14:41 +02:00
Max Kellermann
a464dc681a Merge tag 'v0.18.14' 2014-09-11 19:26:58 +02:00
Max Kellermann
eaf675dc92 release v0.18.14 2014-09-11 19:09:49 +02:00
Max Kellermann
57068e526c test/run_decoder: dump MixRamp data 2014-09-09 19:17:22 +02:00
Max Kellermann
c14a00eec9 decoder/ffmpeg: use memset() to initialize AVProbeData 2014-09-09 19:07:46 +02:00
Max Kellermann
219c42522f decoder/ffmpeg: pass MIME type to ffmpeg/libav version 11
That attribute was uninitialized before, which could crash
libavformat.

See Debian bug 760669
2014-09-07 22:05:33 +02:00
Max Kellermann
e3a0f15837 Decoder*: add more assertions 2014-09-07 21:52:34 +02:00
Max Kellermann
a6bb27483b DecoderThread: clear the pipe when handling late SEEK
See code comment.  Fixes assertion failure in
decoder_command_finished().
2014-09-07 21:50:00 +02:00
Max Kellermann
7ada7def9e decoder/audiofile: fix crash after seeking
Log call was added to the wrong branch.

Fixes regression by commit ca1a1149
2014-09-06 19:32:10 +02:00
Max Kellermann
af384d9aa6 doc/user: require bit-perfect playback for DoP 2014-09-05 14:32:43 +02:00
Max Kellermann
223c129b6b output/pulse: simplify _wait_for_operation()
Eliminate the duplicate pa_operation_get_state() call.
2014-09-05 11:16:09 +02:00
Max Kellermann
421c4ae907 protocol/ArgParser: fix integer overflow in parse_range()
Casting std::numeric_limits<unsigned>::max() to "long" leads to an
overflow if sizeof(unsigned)==sizeof(long), and the result will be -1.

This happens on some 32 bit architectures, for example ARM and WIN32.

Workaround: use std::numeric_limits<int>::max(), which is the largest
signed integer.  Since sizeof(long)>=sizeof(int), this will never
overflow.

Fixes Mantis ticket 0004080.
2014-09-04 17:37:31 +02:00
Max Kellermann
4907f610d6 test/test_protocol: unit test for protocol/ArgParser.cxx 2014-09-04 17:10:30 +02:00
Max Kellermann
f9d1bbbffb configure.ac: prepare for 0.18.14 2014-09-03 19:59:26 +02:00
Max Kellermann
60589fc1cb input/nfs: auto-reconnect if failed while paused 2014-09-02 21:27:07 +02:00
Max Kellermann
5121316036 input/async: add method IsPaused() 2014-09-02 20:02:56 +02:00
Max Kellermann
68bdfa9d0e doc/user: add sections for bit-perfect playback and DSD 2014-09-02 14:42:05 +02:00
Max Kellermann
97b816200d doc/protocol: enable docbook-xslt option "use.id.as.filename" 2014-09-02 13:50:47 +02:00
Max Kellermann
059a643188 doc/user: enable docbook-xslt option "use.id.as.filename" 2014-09-02 13:44:38 +02:00
Max Kellermann
7facad41b7 doc/user: add links 2014-09-02 10:36:20 +02:00
Max Kellermann
3ee59e454c doc/user: remove redundant encoder plugin settings 2014-09-02 10:36:20 +02:00
Max Kellermann
43da1686da nfs/Connection: check for disappearing libnfs socket 2014-08-31 19:33:08 +02:00
Max Kellermann
6d643f92b7 nfs/Connection: use only BroadcastError()
Since BroadcastError() calls BroadcastMountError(), there's no need to
check mount_finished here.
2014-08-31 19:32:41 +02:00
Max Kellermann
559a01f585 nfs/Connection: nfs_get_fd() can return -1
While reconnecting to the NFS server, the socket is -1, because there
is no socket.  Fixes a potential crash (assertion failure).
2014-08-31 19:08:26 +02:00
Max Kellermann
ba8e3f11e2 input/nfs: notify client on error
Fixes hanging NFS client.
2014-08-31 18:26:32 +02:00
Max Kellermann
fd8a53ca3d nfs/Connection: use nfs_get_error() for mount error 2014-08-31 17:44:35 +02:00
Max Kellermann
8707aafaf7 nfs/Connection: fix assertion failure 2014-08-31 17:39:33 +02:00
Max Kellermann
e5a28bfd8d output/alsa, pcm: rename "DSD over USB" to "DoP"
The standard has been renamed since the early draft that was
implemented in MPD.
2014-08-31 16:12:26 +02:00
Max Kellermann
6e04d66a35 Merge tag 'v0.18.13' 2014-08-31 15:03:34 +02:00
Max Kellermann
86e8b3b4bd release v0.18.13 2014-08-31 14:50:23 +02:00
Max Kellermann
a26ead035a PlaylistControl: use SeekSongOrder(current) to keep current song
The "current" attribute is a "song order", not a "song position".
This is usually the same - except in random mode.  Fixes Mantis ticket
0004073.
2014-08-31 14:44:20 +02:00
Max Kellermann
704be54c3a PlaylistControl: move code to new method SeekSongOrder() 2014-08-31 14:23:06 +02:00
Max Kellermann
2406152576 output/alsa: fix endless loop at end of file in dsd_usb mode 2014-08-31 14:01:57 +02:00
Max Kellermann
af260b5a64 output/{alsa,oss}: add assertions 2014-08-31 14:00:09 +02:00
Joachim Fasting
4efa96df21 doc/protocol: fix description of "stats" response
Fix incorrect description of the "songs" field and add missing
"albums" field.

Signed-off-by: Joachim Fasting <joachifm@fastmail.fm>
2014-08-31 13:16:39 +02:00
Max Kellermann
26bef5d209 DecoderAPI: use std::min() 2014-08-31 08:27:51 +02:00
Max Kellermann
cd6e0ff88a MusicChunk: remove special case for num_frames==0
Simply return an empty WritableBuffer, not a nulled one.
2014-08-31 08:26:03 +02:00
Max Kellermann
2ca979425f MusicChunk: copy AudioFormat only when chunk is empty 2014-08-31 08:25:17 +02:00
Max Kellermann
8d822ebdb4 PlaylistMapper: pass the Storage::MapUTF() result to playlist_open_remote()
Finally allows loading playlist files on a storage plugin.  Commit
297e2747 attempted to implement this, but failed due to this bug.
2014-08-30 01:02:24 +02:00
Max Kellermann
bc5b5afcbf decoder/sndfile: refactor frame_to_time() 2014-08-30 00:53:14 +02:00
Max Kellermann
b373c53ce4 *: add missing Compiler.h includes
Necessary for "final" on gcc 4.6.
2014-08-30 00:46:52 +02:00
Max Kellermann
bc4b89c21a Chrono: workaround for gcc 4.6 constexpr problems 2014-08-30 00:41:56 +02:00
Max Kellermann
e10c287c93 PlayerControl: make settings "const" 2014-08-30 00:28:02 +02:00
Max Kellermann
ce42d53a09 PlayerControl: update include guard 2014-08-30 00:27:01 +02:00
Max Kellermann
a4f9d6d98b output/alsa: fix signed/unsigned comparison warning 2014-08-30 00:27:01 +02:00
Max Kellermann
eebd03701a db/simple: fix build failure without zlib 2014-08-30 00:25:12 +02:00
Max Kellermann
d5287682d1 ArgParser: allow fractional seconds in ParseCommandArg(SongTime) 2014-08-29 23:46:38 +02:00
Max Kellermann
7c567e3cbd CrossFade: pass total_time as SignedSongTime instance 2014-08-29 23:41:34 +02:00
Max Kellermann
58352ea69d db/Stats: use std::chrono::duration for the total duration
Use milliseconds precision to reduce rounding errors.
2014-08-29 23:25:03 +02:00
Max Kellermann
de64b35359 db/upnp: use DatabaseStats::Clear() 2014-08-29 23:24:49 +02:00
Max Kellermann
7df8e1eab2 db/Count: use std::chrono::duration for the total time
Use milliseconds precision to reduce rounding errors.
2014-08-29 23:18:40 +02:00
Max Kellermann
8b62127770 decoder/gme: fix song duration
The unit of gme_info_t::length is milliseconds, not centiseconds.
2014-08-29 23:03:29 +02:00
Max Kellermann
3158955198 TagHandler: pass SongTime to duration() 2014-08-29 22:52:04 +02:00
Max Kellermann
d9d97bd17b DecoderAPI: pass SignedSongTime to decoder_initialized() 2014-08-29 21:40:15 +02:00
Max Kellermann
94f6380d69 Chrono: add methods FromScale() 2014-08-29 21:38:08 +02:00
Max Kellermann
2ee821656f Chrono: rename ToScale() parameter 2014-08-29 21:38:08 +02:00
Max Kellermann
7556abb92d decoder/faad: bit_rate==0 is an error 2014-08-29 21:38:08 +02:00
Max Kellermann
9d3a85d434 MusicChunk: use SignedSongTime for the time stamp 2014-08-29 13:20:58 +02:00
Max Kellermann
147d301f10 MultipleOutputs: use SignedSongTime for elapsed_time 2014-08-29 13:20:58 +02:00
Max Kellermann
75a89c5983 PlayerThread: use SongTime for elapsed_time 2014-08-29 13:20:58 +02:00
Max Kellermann
2289968634 PlayerControl: use SignedSongTime for the song duration 2014-08-29 13:20:58 +02:00
Max Kellermann
ca252804c6 DecoderControl: use SignedSongTime for the song duration 2014-08-29 13:20:58 +02:00
Max Kellermann
7c25d83f1c Tag: use SignedSongTime for the song duration 2014-08-29 13:20:58 +02:00
Max Kellermann
8ce30c6a69 Chrono: convert SongTime to SignedSongTime implicitly 2014-08-29 13:20:58 +02:00
Max Kellermann
9fcaff749f Chrono: add SignedSongTime::FromS(unsigned) 2014-08-29 12:50:41 +02:00
Max Kellermann
3ac1475262 Chrono: add methods ToS(), RoundS() 2014-08-29 12:23:09 +02:00
Max Kellermann
ad64bab5b2 Chrono: add method SignedSongTime::Negative() 2014-08-29 12:18:13 +02:00
Max Kellermann
f02998b106 DecoderControl: use std::chrono::duration for start_ms and end_ms 2014-08-28 13:08:44 +02:00
Max Kellermann
127fe6ecf0 PlaylistEdit: pass std::chrono::duration to SetSongIdRange() 2014-08-28 13:03:18 +02:00
Max Kellermann
888ab0c89c db/simple/Song: use std::chrono::duration for start_ms and end_ms 2014-08-28 13:03:18 +02:00
Max Kellermann
2efd8ef52d db/LightSong: use std::chrono::duration for start_ms and end_ms 2014-08-28 13:03:18 +02:00
Max Kellermann
6ad933982f DetachedSong: use std::chrono::duration for start_ms and end_ms 2014-08-28 13:03:18 +02:00
Max Kellermann
854258f376 Chrono: override operator+ and operator-
Make sure we return the correct type.  This obsoletes the cast
constructor trick.
2014-08-28 13:03:18 +02:00
Max Kellermann
26f2d7fbae DecoderControl: update API documentation 2014-08-28 13:03:18 +02:00
Max Kellermann
3952920492 Playlist: use std::chrono::duration for Seek*() 2014-08-28 06:42:19 +02:00
Max Kellermann
c2001a7259 Chrono: add class SignedSongTime 2014-08-28 06:42:04 +02:00
Max Kellermann
78f911ac19 Chrono: add methods IsZero(), IsPositive() 2014-08-28 06:42:04 +02:00
Max Kellermann
0f2a7226fb PlayerControl: use std::chrono::duration for Seek() 2014-08-27 19:07:16 +02:00
Max Kellermann
f8d0ebe92f PlayerThread: check if total_time is valid before using it 2014-08-27 19:06:50 +02:00
Max Kellermann
ba6ba7d4be DecoderControl: use std::chrono::duration for Seek() 2014-08-27 18:48:43 +02:00
Max Kellermann
58e6f660f3 Chrono: add implicit conversion operator from std::chrono::duration 2014-08-27 18:47:14 +02:00
Max Kellermann
cd482ca655 Chrono: add method ToDoubleS() 2014-08-27 18:41:33 +02:00
Max Kellermann
e43b56eb38 Chrono: add template parameter to ToScale() 2014-08-27 18:41:33 +02:00
Max Kellermann
0c2d767f6f DecoderAPI: use std::chrono::duration for decoder_seek*()
For type safety and code readability.
2014-08-26 22:27:04 +02:00
Max Kellermann
02e697032f decoder/pcm: use integer seek times 2014-08-26 22:05:02 +02:00
Max Kellermann
07dc262690 decoder/dsf: use integer seek times 2014-08-26 22:00:16 +02:00
Max Kellermann
6bf8d5b936 decoder/dsdiff: use integer seek times 2014-08-26 21:53:50 +02:00
Max Kellermann
93858bf262 decoder/wildmidi: use integer seek times 2014-08-26 11:41:48 +02:00
Max Kellermann
f64da46a98 decoder/wavpack: use integer seek times 2014-08-26 11:39:58 +02:00
Max Kellermann
2052a029ee decoder/vorbis: use integer seek times 2014-08-26 11:38:39 +02:00
Max Kellermann
c6aafff701 decoder/sndfile: use integer seek times 2014-08-26 11:36:20 +02:00
Max Kellermann
26f0f92210 decoder/opus: use integer seek times 2014-08-26 11:34:56 +02:00
Max Kellermann
bdc4ae2b86 decoder/opus: remove redundant decoder_timestamp() call
After seeking, the MPD core automatically refreshes the timestamp, and
thus discards the value from decoder_timestamp().
2014-08-26 11:34:24 +02:00
Max Kellermann
9ca9341384 decoder/mpg123: use integer seek times 2014-08-26 11:31:57 +02:00
Max Kellermann
7f4f8b7c7d decoder/mpcdec: use integer seek times 2014-08-26 11:31:49 +02:00
Max Kellermann
8870526457 decoder/flac: use integer seek times 2014-08-26 11:30:21 +02:00
Max Kellermann
f057e1e17a decoder/audiofile: use integer seek times 2014-08-26 11:29:22 +02:00
Max Kellermann
8561c9c5a6 DecoderAPI: add decoder_seek_where_frame() 2014-08-26 11:27:41 +02:00
Max Kellermann
23199719d9 decoder/mp4v2: use integer seek times 2014-08-26 11:20:15 +02:00
Max Kellermann
a606ef0700 decoder/ffmpeg: use integer seek times 2014-08-26 11:15:53 +02:00
Max Kellermann
a234de1ee3 decoder/gme: use integer seek times 2014-08-26 11:15:40 +02:00
Max Kellermann
d266898617 decoder/modplug: use integer seek times 2014-08-26 11:11:36 +02:00
Max Kellermann
69b5929c5a decoder/mad: use integer seek times
Avoid roundtrips to floating point.
2014-08-26 11:07:47 +02:00
Max Kellermann
316c72a4ae DecoderAPI: add decoder_seek_where_ms()
Move to fixed-point integers instead of floating point.
2014-08-26 11:02:02 +02:00
Max Kellermann
9da88eec3e decoder/mad: move duplicate code to RecoverFrameError() 2014-08-26 10:52:17 +02:00
Max Kellermann
f10d9996d2 decoder/mad: simplify if/else chain 2014-08-26 10:52:17 +02:00
Max Kellermann
58ec9d3a73 decoder/mad: make variables more local 2014-08-26 10:34:04 +02:00
Max Kellermann
4a503ba1ad decoder/mad: simplify "return", eliminate check
This check was redundant, because we could only exit the loop when
ret==DECODE_OK.
2014-08-26 10:30:22 +02:00
Max Kellermann
2d096a569a output/alsa: fix coding style 2014-08-26 10:25:59 +02:00
Max Kellermann
e44ea5038e output/alsa: merge Init() into Configure() 2014-08-26 10:22:35 +02:00
Max Kellermann
b111aa0111 ZeroconfAvahi: fix coding style 2014-08-26 10:04:27 +02:00
Max Kellermann
773d24ebf7 ZeroconfAvahi: remove "goto" 2014-08-26 10:03:35 +02:00
Max Kellermann
bd371af0b3 ZeroconfAvahi: remove unused flag "avahi_running"
This flag is never read.
2014-08-26 10:02:06 +02:00
Max Kellermann
9d79c72c17 output/alsa: add API documentation 2014-08-26 09:37:30 +02:00
Max Kellermann
a86aaef4d0 output/alsa: support native DSD playback
Translate SampleFormat::DSD to SND_PCM_FORMAT_DSD_U8, which was added
to alsa-lib 1.0.27.1.
2014-08-26 07:11:53 +02:00
Max Kellermann
e463244db3 output/alsa: move alsa_configure() into the class 2014-08-26 07:10:16 +02:00
Max Kellermann
9e10b75f55 PcmExport: remove obsolete API documentation 2014-08-26 07:10:16 +02:00
Max Kellermann
294091ce60 output/alsa: remove obsolete macros 2014-08-26 05:53:15 +02:00
Max Kellermann
da6dd2dc92 decoder/mad: don't reset the xing struct
Not necessary.
2014-08-25 10:32:40 +02:00
Max Kellermann
40b9de66c7 decoder/mad: remove unused flag "found_xing" 2014-08-25 10:31:55 +02:00
Max Kellermann
aac985951a decoder/mad: convert enums/macros to constexpr 2014-08-24 21:06:50 +02:00
Max Kellermann
662cc5fe20 decoder/mad: make variables more local 2014-08-24 20:57:47 +02:00
Max Kellermann
e1e62d97a8 doc/mpd.conf.5: remove deprecated setting 2014-08-24 13:59:49 +02:00
Max Kellermann
a29cc48fec doc/{mpd.conf.5,mpdconf.example}: move documentation to the manual 2014-08-24 13:33:00 +02:00
Max Kellermann
42af040fbd StateFile: configurable interval 2014-08-24 13:24:20 +02:00
Max Kellermann
d383d617c2 StateFile: make "path" const 2014-08-24 13:24:20 +02:00
Max Kellermann
9d04c21cc2 doc/user: document the state file 2014-08-24 13:24:20 +02:00
Max Kellermann
ed8039e223 doc/user: add comments about libao and openal 2014-08-24 13:24:20 +02:00
Max Kellermann
f05743bf57 doc/user: add comment about Linux and OSS 2014-08-24 13:24:19 +02:00
Max Kellermann
c6be661bb5 doc/user: more markup 2014-08-24 13:24:19 +02:00
Max Kellermann
c84508ae9f Merge branch 'v0.18.x' 2014-08-24 13:20:35 +02:00
Max Kellermann
f06fe1ea98 event/TimeoutMonitor: really reset "active" flag before invoking OnTimeout()
The previous commit was broken.  D'oh!
2014-08-24 13:19:50 +02:00
Max Kellermann
77f2cd6513 Merge branch 'v0.18.x' 2014-08-24 13:15:17 +02:00
Max Kellermann
d16fb79708 event/TimeoutMonitor: reset "active" flag before invoking OnTimeout()
The IsActive() method returned true even if the timer was not active,
after it completed once.  This broke the state file timer, and the
state file was not saved periodically.
2014-08-24 13:13:12 +02:00
Max Kellermann
baad86bcd7 doc/user: document ALSA mixer plugin settings 2014-08-23 15:39:32 +02:00
Max Kellermann
8808aad529 decoder/dsdiff: implement seeking 2014-08-23 15:27:21 +02:00
Max Kellermann
6d7eaba845 decoder/dsdiff: refactor the main decoder loop
Check for STOP before decoding the first chunk.  This reduces the
command latency.
2014-08-23 15:25:40 +02:00
Max Kellermann
4259b17b91 decoder/dsdiff: add local variable "remaining_bytes"
Remember the chunk's total size.
2014-08-23 15:21:08 +02:00
Max Kellermann
828ea700e8 decoder/dsdiff: don't skip remaining bytes
Nobody cares.
2014-08-23 15:19:34 +02:00
Max Kellermann
7f22685fa3 decoder/dsdiff: eliminate local variable "buffer_samples" 2014-08-23 15:17:31 +02:00
Max Kellermann
40db9dff3b decoder/dsdiff: support only one "DSD" chunk
Eliminate the loop from dsdiff_stream_decode().  It makes the code
complex, real-world files with multiple DSD chunks are outside of the
specification, and the "chunk_size" variable would be bogus anyway.
2014-08-23 15:14:16 +02:00
Max Kellermann
fa82264604 pcm/PcmDsd: remove "lsbfirst" support
Unused.  Bit reversing is done in the decoder.
2014-08-23 14:46:34 +02:00
Max Kellermann
ae467aa42e pcm/dsd2pcm: add license headers
Obtained from the Mercurial repository at
https://code.google.com/p/dsd2pcm/
2014-08-23 14:42:23 +02:00
Thomas Klausner
c38f29ce56 system/ByteOrder: <endian.h> is a non-standard header that only Linux provides. 2014-08-23 14:27:44 +02:00
Max Kellermann
67cc09416f decoder/dsf: implement seeking 2014-08-23 14:00:38 +02:00
Max Kellermann
f2a75fbfc7 decoder/dsf: refactor the main decoder loop
Check for STOP before decoding the first chunk.  This reduces the
command latency.
2014-08-23 13:57:57 +02:00
Max Kellermann
b1fb09e183 decoder/dsf: make the buffer more local
This allows the compiler to discard buffer contents between two
iterations.
2014-08-23 13:55:52 +02:00
Max Kellermann
cd0082c630 decoder/dsf: eliminate pointless return statement 2014-08-23 13:54:07 +02:00
Max Kellermann
f78527d1e3 decoder/dsf: use the block count internally 2014-08-23 13:51:08 +02:00
Max Kellermann
1f642238a7 decoder/dsf: don't skip remaining bytes
Nobody cares.
2014-08-23 13:50:36 +02:00
Max Kellermann
6fe06cad98 decoder/dsf: count the blocks, not the remaining bytes
Prepare refactoring the whole plugin to use blocks instead of bytes.
A block is the smallest addressable unit, and it will simplify the
seeking code.
2014-08-23 13:44:53 +02:00
Max Kellermann
2335fdbb5a decoder/dsf: allow channel setups other than stereo
This finishes the multi-channel support.  Development of the feature
was started with commit 02cc77cd8
2014-08-23 13:40:21 +02:00
Max Kellermann
1b6f7c3eb7 decoder/dsf: eliminate another hard-coded stereo mode assumption
When calculating the upper bound using the "sample count" format
header, don't assume it's stereo.
2014-08-23 13:39:00 +02:00
Max Kellermann
67f0d26d17 decoder/dsf: fix big-endian bugs 2014-08-23 13:35:29 +02:00
Max Kellermann
8574bcd494 decoder/dsf: compare with InputStream::GetRest() instead of ..GetSize() 2014-08-23 13:26:17 +02:00
Max Kellermann
02cc77cd82 decoder/dsf: fix multi-channel files
The plugin was horribly bugged for files that were not stereo.
2014-08-22 07:30:32 +02:00
Max Kellermann
d8782ce5fd decoder/dsf: simplify dsf_to_pcm_order()
Don't pass the buffer size to the function, as it's known at compile
time.  Use "restrict" on the pointer arguments, and merge the two
loops, which allows the compiler to optimize this loop with a few SSE2
instructions.
2014-08-22 06:58:08 +02:00
Max Kellermann
dedc2986c6 decoder/dsf: fix noise at end of malformed file
Read one block at a time.  This discards the last partial block, which
cannot be interleaved anyway.  Previously, uninitialised memory was
used to interleave the last block, which generated some noise.
2014-08-21 17:46:25 +02:00
Max Kellermann
74cdc0005a decoder/dsf: eliminate temporary buffer
Convert into a second buffer that gets passed to decoder_data()
without copying back to the first buffer.
2014-08-21 17:15:29 +02:00
Max Kellermann
a756cd9565 decoder/dsf: add constant DSF_BLOCK_SIZE 2014-08-21 17:12:43 +02:00
Max Kellermann
ae27c3f4c5 decoder/dsf: use size_t loop variables when the limit is a size_t 2014-08-21 17:09:49 +02:00
Max Kellermann
6d41f36266 decoder/dsf: use memcpy() 2014-08-21 13:09:14 +02:00
Max Kellermann
57cbcdf2ec decoder/dsf: make the "scratch" buffer local
This allows the compiler to discard buffer contents between two
function calls.
2014-08-21 13:05:35 +02:00
Max Kellermann
455fd180b1 Merge branch 'v0.18.x' 2014-08-21 12:52:27 +02:00
Max Kellermann
78abcd7df7 decoer/dsdiff: fix endless loop on malformed file
Same bug as in the previous commit.
2014-08-21 12:48:03 +02:00
Max Kellermann
23dce21647 decoer/dsf: fix endless loop on malformed file
When the data chunk size is not a multiple of the frame size, the last
partial frame lead to an endless loop.  We fix this by checking
chunk_sze>=frame instead of chunk_sze>0.  This way, the partial frame
is simply skipped.
2014-08-21 12:37:22 +02:00
Max Kellermann
e6177c3349 decoder/dsf: remove unused attribute "id3_size" 2014-08-20 09:46:42 +02:00
Max Kellermann
e2adb82e29 decoder/DsdLib: use offset_type instead of uint64_t 2014-08-19 22:39:44 +02:00
Max Kellermann
bb472206de InputStream: move typedef offset_type to Offset.hxx
Reduce header dependencies.
2014-08-19 22:29:52 +02:00
Max Kellermann
d87cf5146e InputStream: CheapSeeking() returns false only for HTTP
Seeking on NFS or SMB is cheap.  Actually, only HTTP streams are
expensive to seek.  This enables a few features on NFS/SMB files, for
example Ogg tags.
2014-08-19 21:39:12 +02:00
Max Kellermann
87eb5cbced InputStream: move code to ExpensiveSeeking() 2014-08-19 21:38:18 +02:00
Max Kellermann
181edf4b53 InputStream: make offset_type unsigned 2014-08-19 21:23:03 +02:00
Max Kellermann
dfa53cb88e InputPlugin: remove typedef offset_type
Has been moved to class InputStream long ago.
2014-08-19 21:22:23 +02:00
Max Kellermann
d079cda174 InputStream: allow GetSize() only if KnownSize() 2014-08-19 21:02:00 +02:00
Max Kellermann
4265e71d6f InputStream: add constant UNKNOWN_SIZE 2014-08-19 21:00:50 +02:00
Max Kellermann
f66a72c66b input/proxy: use KnownSize() 2014-08-19 21:00:32 +02:00
Max Kellermann
9be90bd1c9 decoder/wavpack: add local reference variables 2014-08-19 20:58:08 +02:00
Max Kellermann
106e535577 decoder/sndfile: check InputStream::KnownSize() 2014-08-19 20:57:25 +02:00
Max Kellermann
194be51f05 decoder/pcm: check InputStream::KnownSize() 2014-08-19 20:57:00 +02:00
Max Kellermann
a862e363ea decoder/mpcdec: check InputStream::KnownSize() 2014-08-19 20:55:51 +02:00
Max Kellermann
2e64afca27 decoder/modplug: check InputStream::KnownSize() 2014-08-19 20:53:02 +02:00
Max Kellermann
51cda0be2a decoder/mad: check InputStream::KnownSize() 2014-08-19 20:44:29 +02:00
Max Kellermann
4da3291157 decoder/ffmpeg: check InputStream::KnownSize() 2014-08-19 20:44:29 +02:00
Max Kellermann
52edabf2cb decoder/faad: remove unnecessary cast to size_t 2014-08-19 20:44:29 +02:00
Max Kellermann
43a1a0f3ab decoder/faad: remove size!=0 check
Since we already checked InputStream::KnownSize(), we can assume that
GetSize() returns a valid value, and this check is obsolete.
2014-08-19 20:44:29 +02:00
Max Kellermann
e88524f274 decoder/faad: check InputStream::KnownSize()
Replace the bogus GetSize() check and call GetSize() only when
necessary.
2014-08-19 20:44:29 +02:00
Max Kellermann
7a929fcd27 decoder/faad: call GetSize() only when needed 2014-08-19 20:44:29 +02:00
Max Kellermann
7087fdf6c0 decoder/DsdLib: make variables more local 2014-08-19 20:44:29 +02:00
Max Kellermann
67093a5143 decoder/DsdLib: use fixed-length ID3 buffer
Variable-length arrays are not allowed in C++.
2014-08-19 20:42:40 +02:00
Max Kellermann
3f34016888 decoder/DsdLib: check InputStream::KnownSize() 2014-08-19 20:24:33 +02:00
Max Kellermann
1307633a84 decoder/dsf: check InputStream::KnownSize() 2014-08-19 20:24:09 +02:00
Max Kellermann
1a53f07d80 decoder/dsf: remove unnecessary ID3 offset check
If the offset is out of range, the seek will simply fail.  Not a
problem.
2014-08-19 20:23:36 +02:00
Max Kellermann
672f678ed6 InputStream: use KnownSize() in assertion 2014-08-19 11:59:19 +02:00
Max Kellermann
b924568f79 decoder/audiofile: check InputStream::KnownSize()
The plugin assumes that the size is known, but does not verify it at
runtime.
2014-08-19 11:58:15 +02:00
Max Kellermann
e6e9c21275 input/ffmpeg: use av_strerror()
Generate more detailed error messages.
2014-08-18 20:35:34 +02:00
Max Kellermann
636f5d4a1d {input,decoder}/ffmpeg: move ffmpeg_domain to lib/ffmpeg/Domain.cxx
Eliminate duplicate definition (in input plugin and decoder plugin).
2014-08-18 10:12:37 +02:00
Max Kellermann
41a4b280ee input/ffmpeg: update offset after seeking 2014-08-18 09:52:53 +02:00
Max Kellermann
27139bf41f input/ffmpeg: refactor error code path 2014-08-18 09:52:25 +02:00
Max Kellermann
12ba1957d0 input/ffmpeg: use "auto" 2014-08-18 09:47:28 +02:00
Jurgen Kramer
9b9d189a33 decoder/dsf: Allow up to DSD512. Enable DSD rates based on Fs=48kHz 2014-08-16 18:40:53 +02:00
Jurgen Kramer
7c3af4f56f Report bitrate for DSF and DSDIFF DSD decoders 2014-08-16 18:38:44 +02:00
Max Kellermann
880ce080b7 decoder/dsf: fix indent 2014-08-16 18:38:15 +02:00
Max Kellermann
6e84a03a35 PlayerThread: rename player_create() to StartPlayerThread() 2014-08-16 10:33:19 +02:00
Max Kellermann
a9f6556454 Merge branch 'v0.18.x' 2014-08-16 08:25:10 +02:00
Max Kellermann
2722211ba3 pcm/SoxrResampler: add missing string.h include 2014-08-16 08:25:06 +02:00
François Revol
e2e5cddcaa icu: include strings.h for strcasecmp
Again, POSIX says strcasecmp is not in string.h.
2014-08-16 07:53:08 +02:00
François Revol
40280fa6cf util: Fix header for strcasecmp
According to POSIX and both OSX and Linux manpages,
strcasecmp comes from strings.h, not string.h.

Most OSes also have them available in string.h,
but we just fixed the headers on Haiku and it now
only provides them in strings.h.

We might want to fall back to string.h for other
OSes though...

cf.
http://pubs.opengroup.org/onlinepubs/009695399/functions/strcasecmp.html
http://linux.die.net/man/3/strcasecmp
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/strcasecmp.3.html
2014-08-16 06:51:13 +02:00
Max Kellermann
8b7718fbdc encoder/shine: require libshine 3.1, adapt to new API
The "written" argument to shine_encode_buffer() and shine_flush() was
changed from "long" to "int", which breaks API and ABI compatibility.
This is a big deal, and it doesn't seem worthwile to keep support for
the (broken) 3.0 release.
2014-08-13 18:49:44 +02:00
Max Kellermann
fe9299ceff decoder/ffmpeg: use avcodec_descriptor_get() to determine codec name
In version 11, both ffmpeg and libav deprecate
AVCodecContext::codec_name.  The function avcodec_descriptor_get() has
been introduced long ago.
2014-08-13 18:40:39 +02:00
Max Kellermann
b44957ad91 PcmExport: add missing <iterator> include
For the range-based loop on a ConstBuffer object.
2014-08-13 13:00:37 +02:00
Max Kellermann
a049f972ec test/test_rewind: add missing stdlib.h include
For EXIT_SUCCESS.
2014-08-13 12:55:29 +02:00
Max Kellermann
069895d26b PcmDsdUsb: use class ConstBuffer 2014-08-12 22:21:24 +02:00
Max Kellermann
0e756e4377 PcmExport: use class ConstBuffer 2014-08-12 22:19:53 +02:00
Max Kellermann
ee7282ce0d test/test_pcm: add PcmExport unit test 2014-08-12 22:05:38 +02:00
Max Kellermann
d026367334 Merge branch 'v0.18.x' 2014-08-12 16:54:32 +02:00
Max Kellermann
7244dc4511 Filter: FilterPCM() returns ConstBuffer
API simplification.  We can now avoid abusing a "size_t*" as
additional return value.
2014-08-12 16:40:51 +02:00
Max Kellermann
56f61a6d59 PcmConvert: Convert() returns ConstBuffer 2014-08-12 16:36:07 +02:00
Max Kellermann
4d5f610029 Filter: update API documentation 2014-08-12 16:05:37 +02:00
Max Kellermann
c94b4466d5 MusicChunk: rename struct to MusicChunk 2014-08-12 15:56:41 +02:00
Max Kellermann
61f9e79ec9 MusicChunk: update API documentation 2014-08-12 15:56:11 +02:00
Max Kellermann
cf797657ed AllCommands: close connection after syntax error
Stop HTTP clients from exploiting MPD via forged POST requests.
2014-08-12 15:33:45 +02:00
Max Kellermann
c597538b40 util/HugeAllocator: implement on Windows 2014-08-11 23:06:45 +02:00
Max Kellermann
43f964e28d db/simple: check for I/O errors in Load() 2014-08-11 22:54:46 +02:00
Max Kellermann
8283f23651 fs/io/TextFile: add method Check() 2014-08-11 22:53:48 +02:00
Max Kellermann
7cc25f91ff fs/io/Reader: add "nonnull" attribute 2014-08-11 22:49:08 +02:00
Max Kellermann
5d2506e697 SongFilter: new filter "modified-since" 2014-08-11 22:38:58 +02:00
Max Kellermann
14908b7f28 doc/protocol: reformat the "find" types 2014-08-11 22:38:58 +02:00
Max Kellermann
2e122e1509 db/simple: compress the database file using gzip 2014-08-11 21:48:25 +02:00
Max Kellermann
486b5b6bfc fs/io/TextFile: use AutoGunzipReader
Several MPD subsystems can now read gzipped files; for example, the
database file can be gzipped.
2014-08-11 21:48:25 +02:00
Max Kellermann
88a2f128ec fs/io/AutoGunzipReader: new class 2014-08-11 21:48:25 +02:00
Max Kellermann
45c139cfb3 fs/io/PeekReader: new utility class 2014-08-11 21:48:25 +02:00
Max Kellermann
3a111e5d74 fs/io/GzipOutputStream,GunzipReader: move zlib_domain to src/lib/zlib/Domain.cxx 2014-08-11 21:48:25 +02:00
Max Kellermann
fc0c5e7359 configure.ac: fix typo, remove spaces 2014-08-11 21:20:27 +02:00
Max Kellermann
2ccfb71d12 util/CharUtil: add ToLowerASCII() 2014-08-11 18:42:05 +02:00
Max Kellermann
e8a5a9b1e8 Merge branch 'mp4v2' of github.com:ekroth/mpd 2014-08-09 00:10:04 +02:00
Andrée Ekroth
ec3568bd97 decoder/Mp4v2: fix crash with undefined error
When no track is found the error is now properly set.
Previously the calling function tried to log an undefined
error, which resulted in a crash. MPD falls back to
ffmpeg for unsupported tracks, such as ALAC.

This should fix issue 4051.
2014-08-08 23:24:26 +02:00
Max Kellermann
a67a881715 input/GunzipInputStream: new class 2014-08-08 20:11:29 +02:00
Max Kellermann
7a048f004d Merge branch 'id-3919' of git://github.com/ekroth/mpd 2014-08-07 22:52:46 +02:00
Andrée Ekroth
330b6a0482 decoder/Mp4v2: add MP4v2 decoder plugin
This plugin uses the MP4v2 library to play mp4/m4a files.
It is limited to file_decode.
2014-08-07 21:01:38 +02:00
Max Kellermann
aa2e4d92e0 fs/io/BufferedReader: new class to replace class TextFile
The new class is pluggable, to prepare for gzipped database files.

For now, the TextFile class remains, and will be refactored away
later.
2014-08-07 19:38:25 +02:00
Max Kellermann
0ea66a1275 fs/io/Reader: new interface 2014-08-07 19:38:25 +02:00
Max Kellermann
aafff8fd5c fs/output, fs/TextFile: move to fs/io/ 2014-08-07 19:38:25 +02:00
Max Kellermann
5ac2a69940 input/TextInputStream: move ReadBufferedLine() to util/TextFile.hxx 2014-08-07 19:38:25 +02:00
Max Kellermann
8278a12af9 Makefile.am: link libfs.a before libsystem.a
libfs.a depends on libsystem.a.
2014-08-07 19:38:25 +02:00
Max Kellermann
e88dd9b08b util/DynamicFifoBuffer: make GetCapacity() and Clear() public 2014-08-07 19:21:09 +02:00
Max Kellermann
bbea6564fc fs/output/FileOutputStream: use open_cloexec()
Support operating systems that don't have O_CLOEXEC.
2014-08-07 18:16:11 +02:00
Max Kellermann
1ca8d7ad45 TextInputStream: don't strip
Let the caller decide whether to strip.  Only remove \n and \r
(end-of-line markers).
2014-08-07 16:45:43 +02:00
Max Kellermann
67958f7fa7 util/{Static,Foreign}FifoBuffer: lazy shift
Reduce the number of unnecessary memmove() calls.
2014-08-07 16:11:00 +02:00
Max Kellermann
ab9c527274 util/StaticFifoBuffer: fix indent 2014-08-07 16:08:55 +02:00
Max Kellermann
36ff991960 TextInputStream: move code to ReadBufferedLine()
Look at the buffer first, before trying to read from the file.  This
reduces overhead because we don't refill the buffer after every line.
2014-08-07 16:08:02 +02:00
Max Kellermann
59d38f876a util/StringUtil: add StripRight() overload with "end" argument 2014-08-07 16:08:02 +02:00
Max Kellermann
5c5c6a965c LogBackend: use StripRight()
Eliminate duplicate code.
2014-08-07 16:08:02 +02:00
Max Kellermann
74aafe6a10 util/StringUtil: use IsWhitespaceOrNull() in StripRight()
The null byte is whitespace, too.
2014-08-07 16:08:02 +02:00
Max Kellermann
f860a2fbd6 util/StringUtil: move code to StripRight() 2014-08-07 16:08:02 +02:00
Max Kellermann
87bcf739ee util/StringUtil: rename strchug_fast() to StripLeft() 2014-08-07 16:08:02 +02:00
Max Kellermann
db6db51742 util/CharUtil: add IsWhitespaceFast() 2014-08-07 16:08:02 +02:00
Max Kellermann
981be7956b util/CharUtil: make IsWhitespace*() "constexpr" 2014-08-07 16:08:02 +02:00
Max Kellermann
8c10aa575c util/CharUtil: fix indent 2014-08-07 16:08:02 +02:00
Max Kellermann
17b316b94b fs/StandardDirectory: pass writable string to ParseConfigLine()
Eliminate the std::string overhead.
2014-08-07 16:07:52 +02:00
Max Kellermann
8921b4f9d1 event/BufferedSocket: fix inversed buffer check
This was broken by commit 84d20d9e, which deleted the "!" from the
check.
2014-08-07 16:07:48 +02:00
Max Kellermann
c3f111a56c event/BufferedSocket: fix inversed buffer check
This was broken by commit 84d20d9e, which deleted the "!" from the
check.
2014-08-07 16:03:44 +02:00
Max Kellermann
cf16d81fa4 util/ForeignFifoBuffer: add method Swap() 2014-08-07 09:02:24 +02:00
Max Kellermann
2beb763b4f util/ForeignFifoBuffer: add method MoveFrom() 2014-08-07 08:53:02 +02:00
Max Kellermann
69ae879c58 input/TextInputStream: return char*
Revert to the old API before commit e9e55b08, removing unnecessary
bloat.
2014-08-07 00:06:02 +02:00
Max Kellermann
08fee9a284 util/ForeignFifoBuffer: add method GetAvailable() 2014-08-06 22:55:59 +02:00
Max Kellermann
f89da17827 util/DynamicFifoBuffer: move code to new base class ForeignFifoBuffer 2014-08-06 17:39:07 +02:00
Max Kellermann
ea26da0be7 util/FifoBuffer: rename to StaticFifoBuffer 2014-08-06 17:29:05 +02:00
Max Kellermann
1f3d3970f6 db/update/InotifySource: remove FifoBuffer
Eliminate support for partial reads.  The Linux kernel will never
return partial results, so this buffering was unnecessary.
2014-08-06 17:20:03 +02:00
Max Kellermann
c9a71a7176 fs/GzipOutputStream: new class wrapping zlib 2014-08-06 16:35:10 +02:00
Max Kellermann
7ed8833fd5 Makefile.am: add variable FS_LIBS 2014-08-06 16:35:10 +02:00
François Revol
250318329f Makefile.am: fix dependencies for win32
It happened to me when doing the Haiku port, src/mpd failed to
be relinked properly when editing source files, and likely also
happens on win32, although I didn't try this change.

When building for windows, src_mpd_DEPENDENCIES is overriden.

Automake then disables the default version which contains all
the static libraries. In Makefile.in:
@HAVE_WINDOWS_FALSE@src_mpd_DEPENDENCIES = libmpd.a \

Instead we use EXTRA_src_mpd_DEPENDENCIES which is meant for this.
2014-08-02 08:48:44 +02:00
Max Kellermann
14c538c9c7 Win32Main: move to win32/ 2014-08-02 08:48:30 +02:00
Max Kellermann
abe4c57663 configure.ac: prepare for 0.18.13 2014-08-02 08:45:44 +02:00
Max Kellermann
9fb351a139 *Save, *State: use the OutputStream API instead of FILE* 2014-07-30 22:17:01 +02:00
Max Kellermann
0d0ccacdf3 fs/OutputStream: new infrastructure for writing to files 2014-07-30 22:12:02 +02:00
Max Kellermann
c8858f85d8 util/Error: add method FormatLastError() 2014-07-30 22:10:31 +02:00
Max Kellermann
d1bc46ffad util/Error: add SetLastError() overload with "DWORD code" parameter 2014-07-30 22:08:26 +02:00
Max Kellermann
32e5848f34 util/Error: add "printf" attributes 2014-07-30 22:02:46 +02:00
Max Kellermann
be36c0769a TagId3: fix printf string parameter 2014-07-30 22:02:46 +02:00
Max Kellermann
f9e63dfd65 util/DynamicFifoBuffer: fix typo in API documentation 2014-07-30 20:53:09 +02:00
Max Kellermann
fa05dac5ae StateFile: use nullptr instead of NULL 2014-07-30 18:45:14 +02:00
Max Kellermann
430dd3ae05 encoder/opus: use nullptr instead of NULL 2014-07-30 18:45:00 +02:00
Max Kellermann
664fc76ac7 system/Resolver: use nullptr instead of NULL 2014-07-30 18:44:40 +02:00
Max Kellermann
37d6cc07a7 pcm: use nullptr instead of NULL 2014-07-30 18:44:20 +02:00
Max Kellermann
d79b6cd8dc playlist/extm3u: use nullptr instead of NULL 2014-07-30 18:44:03 +02:00
Max Kellermann
d6510f9578 android build 5 2014-07-30 11:18:33 +02:00
Max Kellermann
59e8302c9d Makefile.am: add missing backslash
Fixes breakage by commit 1a619522
2014-07-30 11:18:33 +02:00
Max Kellermann
3422bd9b94 Merge tag 'v0.18.12' 2014-07-30 10:40:40 +02:00
Max Kellermann
a3f3c7ba24 release v0.18.12 2014-07-30 10:30:17 +02:00
Max Kellermann
82ecebb393 Main: don't require mpd.conf on Android
Don't fail to start if mpd.conf does not exist; just use default
values.
2014-07-30 10:22:22 +02:00
Max Kellermann
6ba0b029e6 android/Main: indicate when the native code has quit
Let the user know that MPD has failed.  Not the best thing to do, but
better than pretending it still runs.
2014-07-30 10:17:31 +02:00
Max Kellermann
604c9dacdb android/Loader: fix indent 2014-07-30 10:17:31 +02:00
Max Kellermann
1a619522ee Makefile.am: *.apk depends on android/src/*.java
Invoke "ant" when a Java source is modified.
2014-07-30 10:17:31 +02:00
Max Kellermann
88615fbff1 Makefile.am: move duplicate specification to APK_DEPS 2014-07-30 10:15:37 +02:00
Max Kellermann
d4f8f67173 Makefile.am: release .apk depends on icon
Missing piece from commit e0ca4347
2014-07-30 10:14:26 +02:00
Max Kellermann
174a0a2efc Makefile.am: new zipalign path 2014-07-30 09:45:03 +02:00
Max Kellermann
12b5494906 db/proxy: implement Update() 2014-07-29 23:35:09 +02:00
Max Kellermann
aa0f06d6b7 db/Interface: add virtual method Update()
For database plugins that don't use the UpdateService.
2014-07-29 23:31:27 +02:00
Max Kellermann
0c47685e02 OtherCommands: split handle_update() 2014-07-29 23:29:57 +02:00
Max Kellermann
e0ca4347be Android: generate icon from SVG 2014-07-14 19:05:01 +02:00
Qball Cow
e65d9408ee import MPD SVG icon 2014-07-14 19:04:46 +02:00
Max Kellermann
d8558a3af3 util/Cast: add "const" overload 2014-07-14 17:08:57 +02:00
Max Kellermann
72eedb1c98 util/Cast: add missing include 2014-07-14 17:08:41 +02:00
Max Kellermann
3c5cf9500d util/Cast: fix indent 2014-07-14 16:44:43 +02:00
Max Kellermann
7a1f3177c9 util/Cast: reimplement as template without macro 2014-07-14 16:24:07 +02:00
Max Kellermann
f8da8b0261 util/Cast: add const overloads 2014-07-14 16:02:02 +02:00
Max Kellermann
393cb7fd7d util/Cast: suppress "unused function" warning by using "inline" 2014-07-14 15:58:12 +02:00
Max Kellermann
e74e1256d4 util/Cast: fix indent 2014-07-14 15:57:48 +02:00
Max Kellermann
96abd70c13 decoder/dsdiff: move artist/title/id3 offsets out of DsdiffMetaData
They are only used inside dsdiff_read_metadata_extra().
2014-07-12 20:51:25 +02:00
Max Kellermann
1f9d9c3176 Merge branch 'v0.18.x' 2014-07-12 20:51:22 +02:00
Max Kellermann
94efeb2845 decoder/dsdiff: simplify dsdlib_skip() call 2014-07-12 20:51:00 +02:00
Max Kellermann
a73834436f decoder/dsdiff: simplify loop condition, merge branches 2014-07-12 20:46:24 +02:00
Max Kellermann
85f4aeca05 decoder/dsdiff: ignore garbage null byte at end of file
Failure to read another chunk header is not fatal.  Continue to read
metadata.
2014-07-12 20:41:26 +02:00
Max Kellermann
7db84a961a decoder/dsdiff: fix metadata parser bug (uninitialized variables) 2014-07-12 20:41:26 +02:00
Max Kellermann
74e95e88d8 PlaylistSong: always merge tags and LastModified 2014-07-12 19:41:04 +02:00
Max Kellermann
80d9baa9e8 QueueSave: use the long format to save partial songs
Previously, only streams were saved with range and tags, but this is
necessary for all "partial" songs (e.g. CUE tracks).
2014-07-12 19:36:39 +02:00
Max Kellermann
751995ab95 QueueCommands: new command "rangeid"
Manipulates the playback range of a queued song.
2014-07-12 18:55:41 +02:00
Max Kellermann
5ca6e2910a PlaylistSong, CueParser: don't override Tag::time
Now that Song::GetDuration() is used (which considers start_ms and
end_ms), we don't need to override the Tag's duration value.
2014-07-12 18:54:20 +02:00
Max Kellermann
071d05465a SongPrint: use DetachedSong::GetDuration()
Fixes the bogus duration of the last track in a CUE sheet.
2014-07-12 18:41:15 +02:00
Max Kellermann
11a9536271 TagPrint: split tag_print()
Add one method that prints only the tag values, but not the song
duration.
2014-07-12 17:42:38 +02:00
Max Kellermann
41a7203c28 Tag: add class const_iterator and methods begin(), end()
Enables using range-based "for".
2014-07-12 17:22:39 +02:00
Max Kellermann
543a58bb87 DecoderBuffer: implement _skip() using decoder_skip() 2014-07-12 02:26:38 +02:00
Max Kellermann
b2b95cad20 DecoderBuffer: add method _need()
Move code from the FAAD decoder plugin.
2014-07-12 02:23:48 +02:00
Max Kellermann
eabec967ec DecoderBuffer: remove unused method _is_full() 2014-07-12 02:23:36 +02:00
Max Kellermann
e42b152037 decoder/faad: eliminate the adts_find_frame() loop
This loop is completely unnecessary.  We just need to find the first
ADTS frame and feed it into NeAACDecInit().
2014-07-12 01:51:39 +02:00
Max Kellermann
da599e3f1a decoder/faad: split faad_stream_decode()
Eliminate duplicate cleanup code.
2014-07-12 01:47:07 +02:00
Max Kellermann
4c7b0b935b DecoderBuffer: remove unused method _is_empty() 2014-07-12 01:28:37 +02:00
Max Kellermann
c400876df1 Merge branch 'v0.18.x' 2014-07-12 01:27:18 +02:00
Max Kellermann
a960e2ef48 decoder/faad: estimate song duration for remote files
Previously, MPD tried to slurp the whole song file, count the number
of frames and calculate the song duration from that.  That however is
extremely expensive for remote files, and will delay playback for a
long time.  Workaround: check only the first 128 frames and try to
extrapolate from here.  Fixes Mantis ticket 0004035.
2014-07-12 00:37:00 +02:00
Max Kellermann
4fe272a7fb DecoderBuffer: add method _available() 2014-07-12 00:35:32 +02:00
Max Kellermann
a7d9f248ea DecoderBuffer: add method _get_stream() 2014-07-12 00:23:22 +02:00
Max Kellermann
06aa689383 decoder/faad: bail out early if sample rate is invalid 2014-07-12 00:23:11 +02:00
Max Kellermann
835b0c44cd decoder/faad: use adts_check_frame() in faad_song_duration()
Eliminate more duplicate code.
2014-07-12 00:18:02 +02:00
Max Kellermann
54b6f8a4ae decoder/faad: test "seekable" after ADTS frame check
Don't bother to check for ADIF just because the stream is not
seekable.
2014-07-12 00:17:51 +02:00
Max Kellermann
18787ebe8f decoder/faad: move code to faad_decoder_new()
Merge some duplicate code.
2014-07-12 00:17:43 +02:00
Max Kellermann
47e8fcf37e decoder/faad: remove unnecessary read
Eliminate some overhead when the caller doesn't need the buffer.
2014-07-12 00:17:30 +02:00
Max Kellermann
5958b78459 DecoderBuffer: add "pure" attributes 2014-07-12 00:16:41 +02:00
Max Kellermann
9d9697b366 DecoderBuffer: add method _clear() 2014-07-12 00:15:35 +02:00
Max Kellermann
6585e18571 decoder/faad: check sample_rate, not frames_per_second
Checking the integer is faster, easier and more reliable.
2014-07-11 23:12:08 +02:00
Max Kellermann
6f1b4292f0 decoder/faad: make variables more local 2014-07-11 22:52:31 +02:00
Max Kellermann
ef9ef03b1f decoder/faad: use MAX_CHANNELS
.. instead of declaring a new constant.
2014-07-11 22:40:28 +02:00
Max Kellermann
c4bea3dfe4 decoder/sndfile: implement scan_stream() instead of scan_file() 2014-07-11 22:09:35 +02:00
Max Kellermann
eaa9a1e33b decoder/sndfile: make variables more local 2014-07-11 22:03:26 +02:00
Max Kellermann
3e19298c9e decoder/sndfile: support more tag types 2014-07-11 22:03:13 +02:00
Max Kellermann
2a96ce97ee decoder/sndfile: add str_type to TagType table 2014-07-11 21:57:41 +02:00
Max Kellermann
8cfe901391 decoder/sndfile: move code to sndfile_handle_tag() 2014-07-11 21:56:02 +02:00
Max Kellermann
30f1ee7a1f decoder/sndfile: log libsndfile version on startup 2014-07-11 21:53:03 +02:00
Max Kellermann
46ff830daa PlaylistEdit: fix typo in code comment 2014-07-11 21:37:06 +02:00
Max Kellermann
828cd6fd0b Merge branch 'v0.18.x' 2014-07-11 21:33:50 +02:00
Max Kellermann
ecb67a1ed1 decoder/sndfile: use decoder_read_full()
Replaces the loop in sndfile_vio_read(), eliminating duplicate and
fragile code.
2014-07-11 21:18:44 +02:00
Max Kellermann
0ef843f138 decoder/sndfile: use decoder_read()
.. instead of InputStream::LockRead(). The former is cancellable.
2014-07-11 21:18:44 +02:00
Max Kellermann
eb79d83051 decoder/sndfile: log seek errors 2014-07-11 21:18:44 +02:00
Max Kellermann
ca1a11493d decoder/audiofile: log seek errors 2014-07-11 21:18:44 +02:00
Max Kellermann
69bb086ba5 decoder/audiofile: fix typo in comment 2014-07-11 21:18:44 +02:00
Max Kellermann
11a5ee821b PlaylistEdit: postpone UpdateQueuedSong() when adding multiple songs
Implement a "bulk" edit mode that postpones both UpdateQueuedSong()
and OnModified().  This way, the playlist version gets incremented
only once.  More importantly: when adding multiple songs to a queue
that consists of only one song, the first song that got added will
always be played next.  By postponing this choice, all newly added
songs get a chance to become the next song.  Fixes the second (and
last) part of Mantis ticket 0004005.
2014-07-11 20:22:35 +02:00
Max Kellermann
a8a85143f6 QueueCommands: make "result" more local 2014-07-11 20:22:35 +02:00
Max Kellermann
e2cc328eef Playlist: randomize next song when enabling "random" mode while not playing
Don't restore the current song after shufflung when MPD is stopped
(but still remembers the current song internally).  Fixes the first
part of Mantis ticket 0004005.
2014-07-11 19:41:39 +02:00
Max Kellermann
344d10a8e3 PlaylistControl: update code comment 2014-07-11 19:29:25 +02:00
Max Kellermann
681643ea9e input/curl: options "verify_peer" and "verify_host" 2014-07-11 16:39:42 +02:00
Max Kellermann
fa947e02ca test/FakeDecoderAPI: dump MixRamp data 2014-07-11 08:54:29 +02:00
Mantas Mikulėnas
cd289843f7 fs/StandardDirectory: look for cache dir in environment, not user-dirs
The XDG cache directory is part of the "base directories" spec like
$XDG_CONFIG_HOME, not "user directories".
2014-07-11 08:09:19 +02:00
Max Kellermann
b123392592 input/async: more API documentation 2014-07-10 10:33:43 +02:00
Max Kellermann
ccbb5c3e01 decoder/audiofile: log libaudiofile errors 2014-07-10 09:37:43 +02:00
Max Kellermann
49b63e084f decoder/audiofile: make variables more local 2014-07-10 09:26:12 +02:00
Max Kellermann
107321e385 decoder/audiofile: implement scan_stream() instead of scan_file() 2014-07-10 09:23:56 +02:00
Max Kellermann
1d214b4aed decoder/audiofile: use audiofile_get_duration() in _stream_decode() 2014-07-10 08:35:24 +02:00
Max Kellermann
2e1347aba4 decoder/audiofile: split audiofile_get_duration() 2014-07-10 08:31:41 +02:00
Max Kellermann
9ddb5931fb decoder/audiofile: remove unused Error variable 2014-07-09 20:03:11 +02:00
Max Kellermann
913064d6cc Merge branch 'v0.18.x' 2014-07-09 20:02:07 +02:00
Gustavo Zacarias
fb45b8a5c9 playlist/plugins/DespotifyPlaylistPlugin: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 19:54:35 +02:00
Gustavo Zacarias
f5c9056430 output/plugins/httpd/HttpdClient: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 19:54:35 +02:00
Gustavo Zacarias
0e39b59700 decoder/plugins/FlacIOHandle: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 19:54:35 +02:00
Max Kellermann
552af5455e decoder/dsdlib: use decoder_skip()
Reduce duplicate code.
2014-07-09 19:42:36 +02:00
Max Kellermann
8759bc1b41 decoder/dsdlib: pass unsigned offsets to dsdlib_skip*() 2014-07-09 19:39:10 +02:00
Joff
09384df32c decoder/dsd: use decoder_read_full() where appropriate
Addresses Mantis ticket 0004015.

[mk: use decoder_read_full() only when needed, and a few formal
changes]
2014-07-09 19:18:36 +02:00
Max Kellermann
20538516b9 decoder/audiofile: use decoder_read_full()
Works around WAV stream playback bug, because libaudiofile does not
like partial reads (Mantis 0004028).
2014-07-09 19:05:20 +02:00
Max Kellermann
0759421d11 DecoderAPI: add function decoder_read_full()
Move code from the "mad" plugin.
2014-07-09 19:03:58 +02:00
Max Kellermann
bf7417981f DecoderAPI: add function decoder_skip()
Move code from the "mad" plugin.
2014-07-09 19:03:31 +02:00
Max Kellermann
dba41e2e4a test: merge duplicate code to FakeDecoderAPI.cxx 2014-07-09 19:01:38 +02:00
Max Kellermann
bc6472bb9e decoder/audiofile: use decoder_read()
.. instead of InputStream::LockRead(). The former is cancellable.
2014-07-09 18:57:50 +02:00
Gustavo Zacarias
d4bd947bf5 playlist/PlsPlaylistPlugin: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 17:41:31 +02:00
Gustavo Zacarias
d8e8eabf60 output/HttpdClient: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 17:41:31 +02:00
Gustavo Zacarias
a70443af31 decoder/OpusDecoderPlugin: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 17:41:31 +02:00
Gustavo Zacarias
3f221e2edb decoder/AudiofileDecoderPlugin: fix build failure due to missing stdio.h include
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
2014-07-09 17:41:31 +02:00
Max Kellermann
56504534d8 thread/{Mutex,Cond}: relicense to BSD-2 2014-07-02 20:09:39 +02:00
Max Kellermann
80a45c91f9 thread/GLib{Mutex,Cond}: remove obsolete classes 2014-07-02 20:09:39 +02:00
Max Kellermann
3f695fdfaf lib/nfs/Connection: include poll.h 2014-06-30 10:22:08 +02:00
Christoph Tieben
88433bca22 Added Comment/Description to decoder/plugins/XiphTags.cxx 2014-06-27 21:14:55 +02:00
Christoph Tieben
34689eb2d2 decoder: vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
(see https://www.xiph.org/vorbis/doc/v-comment.html for Details)
2014-06-27 21:14:17 +02:00
Max Kellermann
211aea1441 util/ConstBuffer: add method skip_front() 2014-06-26 22:25:03 +02:00
Max Kellermann
74a46788cd util/ConstBuffer: wrap assert() in NDEBUG check
Fixes build failure because assert.h was not included.
2014-06-26 13:31:48 +02:00
Max Kellermann
7213c26798 util/ConstBuffer: add method Contains() 2014-06-23 22:30:01 +02:00
Max Kellermann
fa1fb47d75 Merge branch 'v0.18.x' 2014-06-23 10:13:50 +02:00
Max Kellermann
848ed14788 db/proxy: fall back to recursive walk on old libmpdclient/MPD
Error message was 'too few arguments for "find"' because the "base"
constraint was not supported, and no other constraints remained.
2014-06-23 09:18:11 +02:00
Max Kellermann
4c8a5dfb05 db/proxy: use mpd_song_get_{start,end}() only with libmpdclient >= 2.3 2014-06-23 09:17:35 +02:00
Max Kellermann
4f61ba766d configure.ac: prepare for 0.18.12 2014-06-23 09:14:35 +02:00
Max Kellermann
b9eeb6e6eb db/proxy: use mpd_song_get_{start,end}() only with libmpdclient >= 2.3 2014-06-23 08:57:51 +02:00
Max Kellermann
d5fa2af353 input/async: use IsEOF() instead of !open for "ready" check
Checking "!open" did not work with the NFS plugin because that plugin
does not close the file automatically, unlike CURL.
2014-06-21 14:13:31 +02:00
Max Kellermann
a877926f08 Revert "AsyncInputStream: fix assertion failure in AppendToBuffer()"
This reverts commit 966c4244cb.

The commit was bad, because the bug was really in
NfsInputStream::DoRead(); see previous commit.
2014-06-21 14:07:15 +02:00
Max Kellermann
3e4e6f7ced input/nfs: never read more than space available in buffer
Avoids off-by-one bug and obsoletes the bug fix in commit 966c4244
2014-06-21 14:06:31 +02:00
Max Kellermann
936eb43c0e db/proxy: initialize LightSong::real_uri
Fixes potential crash.
2014-06-21 12:37:23 +02:00
Max Kellermann
bb66cfa780 android build 4 2014-06-21 12:21:19 +02:00
Max Kellermann
1d626cb6ac android/build.py: add Boost 2014-06-21 12:06:58 +02:00
Max Kellermann
580346f4a7 android/build.py: upgrade CURL to 7.37.0 2014-06-21 12:06:58 +02:00
Max Kellermann
0fbcf64108 android/build.py: upgrade ffmpeg to 2.2.3 2014-06-21 11:38:43 +02:00
Max Kellermann
267faa3851 android/build.py: upgrade libogg to 1.3.2 2014-06-21 11:36:31 +02:00
Max Kellermann
fe50481f7b android/build.py: remove unused parameter from class FfmpegProject 2014-06-21 11:04:54 +02:00
nanotech
759616abd4 Makefile.am: use ICU_CFLAGS 2014-06-17 10:38:50 +02:00
Max Kellermann
eb8fd07900 lib/nfs/Manager: gcc 4.7 compatibility hack
std::map::emplace() is only available from gcc 4.8 on.
2014-06-17 10:35:34 +02:00
Max Kellermann
c99559dbe9 input/nfs: use the asynchronous libnfs API
More robust and cancellable.
2014-06-17 03:21:25 +02:00
Max Kellermann
966c4244cb AsyncInputStream: fix assertion failure in AppendToBuffer() 2014-06-17 03:21:11 +02:00
Max Kellermann
81283f8bcb AsyncInputStream: reset "paused" when seeking
May cause assertion failure.
2014-06-17 03:20:49 +02:00
Max Kellermann
8b84e5b3f9 input/curl: hold mutex while writing to postponed_error 2014-06-17 02:32:17 +02:00
Max Kellermann
e1d5ddb478 input/AsyncInputStream: add method IsBufferFull() 2014-06-17 02:32:17 +02:00
Max Kellermann
2da0322329 command: make argc unsigned 2014-06-16 19:50:34 +02:00
Max Kellermann
fefb35c782 Directory: eliminate attribute "have_stat"
Check for 0 in "device" and "inode" instead.
2014-06-16 19:46:35 +02:00
Max Kellermann
b2433a664c TagPool: move code to tag_value_slot_p() 2014-06-16 19:26:26 +02:00
Max Kellermann
adad4279f3 TagPool: convert macro to constexpr 2014-06-16 19:18:10 +02:00
Max Kellermann
3ca0a39a35 db/simple: use class boost::intrusive::list
Remove the C list_head library and use type-safe C++ instead.
2014-06-16 18:39:16 +02:00
Max Kellermann
52594e64d0 configure.ac: disable exceptions only with Boost 1.54 or newer
See https://svn.boost.org/trac/boost/ticket/7849
2014-06-16 18:39:16 +02:00
Max Kellermann
3364c1b893 ClientList: use class boost::intrusive::list
Eliminate extra allocations for the std::list node instances.
2014-06-11 09:27:17 +02:00
Max Kellermann
0801b3f495 configure.ac: check for Boost 2014-06-11 09:27:17 +02:00
Max Kellermann
657f00fe36 m4: update to pkg-config 0.28 2014-06-11 09:27:17 +02:00
Max Kellermann
044c81b644 m4: update to autoconf-archive 20140228 2014-06-11 08:08:33 +02:00
Max Kellermann
507d8fdc6f ClientList: add typedef List 2014-06-10 23:21:09 +02:00
Max Kellermann
31e29e62f4 zeroconf/Avahi: call dbus_shutdown() during shutdown
Make valgrind happy.
2014-06-10 23:21:09 +02:00
Max Kellermann
dfcb572985 Main: delete the Storage instance on shutdown 2014-06-10 23:21:09 +02:00
Max Kellermann
1d324176d1 lib/icu/Init: call u_init() and u_cleanup()
Make valgrind happy.
2014-06-10 23:21:09 +02:00
Max Kellermann
37b3190752 lib/icu: add IcuInit(), IcuFinish() 2014-06-10 23:21:09 +02:00
Max Kellermann
d51265d48f valgrind.suppressions: more library suppressions 2014-06-10 23:21:09 +02:00
Max Kellermann
dc14ac7a8f thread/Util: relicense to BSD-2 2014-05-31 12:11:53 +02:00
Max Kellermann
fb52a24da3 input/async: add offset/size comparison to IsEOF() 2014-05-24 15:19:22 +02:00
Max Kellermann
fbafb19657 input/curl: move code to AsyncInputStream
New base class for other InputStream implementations that run in the
I/O thread.
2014-05-24 14:36:28 +02:00
Max Kellermann
6c4438d8a9 input/curl: call SetReady() only if not yet ready
Fixes assertion failure.
2014-05-24 14:36:25 +02:00
Max Kellermann
be00737ced input/curl: include cleanup 2014-05-24 12:43:48 +02:00
Max Kellermann
07b93dcf80 InputStream: make Seek() always absolute
Remove the "whence" parameter that is not actually necessary, and only
complicates the InputStream implementations.
2014-05-22 13:52:00 +02:00
Max Kellermann
374c6a27db decoder/vorbis: make VorbisInputStream::input_stream a reference 2014-05-22 13:52:00 +02:00
Max Kellermann
36c9e95969 decoder/vorbis: add VorbisInputStream constructor 2014-05-22 13:52:00 +02:00
Max Kellermann
a3142ee4e6 decoder/vorbis: rename struct vorbis_input_stream to VorbisInputStream 2014-05-22 13:52:00 +02:00
Max Kellermann
437caeb90f decoder/vorbis: add "restrict" to pointers in vorbis_interleave()
Allows more compiler optimizations.
2014-05-22 13:52:00 +02:00
Max Kellermann
af49cace8d decoder/vorbis: log libvorbis version on startup 2014-05-22 13:52:00 +02:00
Max Kellermann
13b78d0d89 decoder/wavpack: move code to WavpackInput::ReadBytes() 2014-05-22 12:54:56 +02:00
Max Kellermann
65c135b451 decoder/wavpack: convert WavpackInput attributes to references 2014-05-22 12:52:33 +02:00
Max Kellermann
ec162f265f decoder/wavpack: move wavpack_input_init into struct WavpackInput 2014-05-22 12:47:20 +02:00
Max Kellermann
ba99696771 decoder/wavpack: wavpack_open_wvc() returns WavpackInput* 2014-05-22 12:36:55 +02:00
Max Kellermann
4eeea640f4 DecoderAPI: add function decoder_open_uri()
Move and refactor code from the Wavpack decoder plugin.
2014-05-22 12:35:20 +02:00
Max Kellermann
cc6f1020d0 test/run_decoder: merge code into FakeDecoderAPI.cxx
Eliminate duplicate code.
2014-05-22 12:35:20 +02:00
Max Kellermann
316ddc2382 test/run_decoder: auto-initialize struct Decoder 2014-05-22 12:35:20 +02:00
Max Kellermann
3452625fac Makefile.am: link test_rewind with GLib 2014-05-22 12:35:20 +02:00
Max Kellermann
426e0105a6 test/run_decoder: move the "uri" attribute out of struct Decoder 2014-05-22 11:17:11 +02:00
Max Kellermann
18f39aa012 test/run_decoder: move the DecoderPlugin pointer out of struct Decoder 2014-05-22 11:14:01 +02:00
Max Kellermann
631b635652 decoder/wavpack: rename struct wavpack_input to WavpackInput 2014-05-22 10:52:34 +02:00
Max Kellermann
49695d47d3 input/curl: relock mutex in error paths 2014-05-21 19:00:47 +02:00
Max Kellermann
5cec477131 input/curl: pass remaining size to CircularBuffer::Append() 2014-05-21 18:59:51 +02:00
Max Kellermann
a5d0300787 input/curl: move code to IcyInputStream 2014-05-21 18:47:49 +02:00
Max Kellermann
09b84c51ee input/rewind: move code to class ProxyInputStream 2014-05-21 18:47:49 +02:00
Max Kellermann
afe53997bf test/test_rewind: unit test for class RewindInputStream 2014-05-21 18:47:40 +02:00
Max Kellermann
c42e412c0a input/InputStream: move Open() to Open.cxx
Allow compiling test programs with only selected plugins.
2014-05-21 18:47:32 +02:00
Max Kellermann
542e7feba8 input/rewind: include cleanup 2014-05-21 18:47:22 +02:00
Max Kellermann
dc085e0bd2 input/rewind: work around assertion failure
Caused by commit 0b4fa41a
2014-05-21 18:47:12 +02:00
Max Kellermann
7c9517343c ThreadInputStream: include cleanup 2014-05-12 19:04:32 +02:00
Max Kellermann
0b4fa41aff InputStream: "protect" attributes 2014-05-12 18:59:46 +02:00
Max Kellermann
e138e2c880 input/cdio: convert to class 2014-05-12 18:59:25 +02:00
Max Kellermann
0d6345e98b input/cdio: move initialization code to constructor
Make attributes const, don't allow partial initialization.
Instantiate the CdioParanoiaInputStream object at the end of
input_cdio_open().
2014-05-12 18:54:05 +02:00
Max Kellermann
a84bcf597d input/cdio: handle cdio_open() failure 2014-05-12 18:53:47 +02:00
Max Kellermann
4bbd4ba855 input/cdio: initialize lsn_relofs in constructor 2014-05-12 18:48:16 +02:00
Max Kellermann
9e5b56b475 input/cdio: initialize attribute "buffer_lsn" 2014-05-12 18:47:27 +02:00
Max Kellermann
dd383037fd input/cdio: remove unused attribute "trackno" 2014-05-12 18:41:45 +02:00
Max Kellermann
3cd24c0a51 Merge tag 'v0.18.11' 2014-05-12 18:38:45 +02:00
Max Kellermann
8bfdb4ed0c release v0.18.11 2014-05-12 18:20:26 +02:00
Max Kellermann
41507d8129 icu/Collate: use u_strFoldCase() instead of ucol_getSortKey()
Turns out ucol_getSortKey() does not what I thought it does.
2014-05-12 14:43:30 +02:00
Max Kellermann
317a98a5a9 icu/Collate: UCharFromUTF8() returns WritableBuffer<UChar> 2014-05-12 14:39:40 +02:00
Max Kellermann
1395794923 icu/Collate: initialize error_code
Fixes the broken "search" command.
2014-05-12 14:13:09 +02:00
Max Kellermann
073e9d06ec mixer/software: keep attribute "volume" in the 0..100 range
The attribute must be 0..100 and not 0..1024.  Previously, the code
was inconsistent.
2014-05-12 12:46:14 +02:00
Max Kellermann
fd1b04932a InputStream: remove attribute "plugin" 2014-05-11 18:25:55 +02:00
Max Kellermann
d4b625b48e InputStream: make various methods abstract
Replace InputPlugin attributes.
2014-05-11 17:14:49 +02:00
Max Kellermann
82337dec44 InputStream: add virtual destructor
Replaces the method Close().
2014-05-11 17:12:50 +02:00
Max Kellermann
f1d0700252 input/plugins: make InputStream the base class
Prepare for adding virtual methods.
2014-05-11 17:12:50 +02:00
Max Kellermann
e1383a2d8e input/rewind: convert to class 2014-05-11 17:12:50 +02:00
Max Kellermann
6773adc771 InputStream: convert to class 2014-05-11 15:34:48 +02:00
Max Kellermann
ee2afb35dd Makefile.am: add variable NFS_SOURCES 2014-05-11 14:49:36 +02:00
Max Kellermann
0adcda387a PlaylistCommands: remove redundant playlist_load_spl() call
This case is handled already by playlist_open_in_playlist_dir() (via
playlist_mapper_open()).  And the call didn't work anyway.
2014-05-10 19:02:33 +02:00
Max Kellermann
fc1664d9fc PlaylistMapper: use map_spl_utf8_to_fs()
Eliminates some overhead and some duplicate code, and fixes a serious
bug: the old code did not append the ".m3u" suffix, and thus the
"load" command was completely broken for stored playlists.  D'oh!
2014-05-10 19:00:46 +02:00
Max Kellermann
70bd35abe2 decoder/OggUtil: allow skipping up to 32 kB after seek
Fixes missing song length on high-latency Opus files.

According to tests with 320 kbit/s opus files with 60ms packets, we
need to skip up to 29 kB.
2014-04-29 11:56:05 +02:00
Max Kellermann
12768babdf doc/protocol.xml: add warning to "listall" and "listallinfo" 2014-04-29 10:31:14 +02:00
Max Kellermann
bc2a1160b8 db/Count: implement grouping 2014-04-27 22:27:43 +02:00
Max Kellermann
75542e8f5d db/Count: add constructor 2014-04-27 22:27:28 +02:00
Max Kellermann
fcb55f841a DatabasePrint: move PrintSongCount() to Count.cxx 2014-04-26 22:59:21 +02:00
Max Kellermann
0efb67b51e DeferredMonitor: fix race condition when using GLib event loop
Turns out the lock-free code using atomics was not thread-safe.  The
given callback could be invoked by GLib before the source_id attribute
was assigned.  This commit changes the DeferredMonitor class to use a
Mutex to block the event loop until source_id is assigned.  This bug
does not exist in the 0.19 branch because it does not use the GLib
main loop anymore.
2014-04-26 22:11:23 +02:00
Max Kellermann
54ebf2a699 configure.ac: prepare for 0.18.11 2014-04-26 22:08:08 +02:00
Max Kellermann
154e601f4e db/Helpers: split library 2014-04-25 18:39:21 +02:00
Max Kellermann
4cca75b2e1 DatabasePrint: refactor variable/function names 2014-04-25 18:36:07 +02:00
Max Kellermann
6d616e55ae LogInit: fix file descriptor leak in SIGHUP handler 2014-04-25 12:31:06 +02:00
Max Kellermann
95b1a640b6 DatabaseCommands: disallow "grouping" by the selected tag
Fixes assertion failure.
2014-04-25 11:28:17 +02:00
Max Kellermann
ecc12c9ba1 db/Helpers: move code to tag/Set.cxx 2014-04-24 18:32:23 +02:00
Max Kellermann
9e50993c13 db/Helpers: move TagSet to dedicated header 2014-04-24 18:18:26 +02:00
Max Kellermann
b32ec857b1 db/Helpers: use set::emplace() 2014-04-24 18:17:07 +02:00
Max Kellermann
0de42d56fc DatabasePrint: eliminate printAllIn(), printInfoForAllIn() 2014-04-24 18:09:39 +02:00
Max Kellermann
6378ad69bb DatabasePrint: merge adjacent client_printf() calls 2014-04-24 18:07:12 +02:00
Max Kellermann
9616e9bf3b DatabasePrint: pass const SearchStats reference 2014-04-24 18:06:46 +02:00
Max Kellermann
7c8b73bffb DatabasePrint: use unsigned counts 2014-04-24 18:06:26 +02:00
Max Kellermann
ae178c77bd DatabaseCommands: "list" allows grouping 2014-04-24 11:38:49 +02:00
Max Kellermann
2220651253 TagBuilder: add method AddEmptyItem() 2014-04-24 11:38:48 +02:00
Max Kellermann
7fdd801479 DatabaseCommands: simplify the handle_list() argument parser 2014-04-24 11:38:48 +02:00
Max Kellermann
27002ad1ea db/Helpers: "list" on album artist falls back to the artist tag 2014-04-24 10:48:52 +02:00
Max Kellermann
986dd2fac1 db/Helpers: move code to CheckUniqueTag() 2014-04-24 10:47:53 +02:00
Max Kellermann
3965b490a9 db/Helpers: use reference instead of pointer 2014-04-24 10:31:19 +02:00
Max Kellermann
b999e16406 SongFilter: convert argv to ConstBuffer 2014-04-24 09:59:59 +02:00
Max Kellermann
7fb9bebd46 util/{Const,Writable}Buffer: add front(), back(), pop_{front,back}(), shift() 2014-04-24 09:50:19 +02:00
Max Kellermann
3b8a9dd6ec util/{Const,Writable}Buffer: add typedef reference_type 2014-04-24 09:47:59 +02:00
Max Kellermann
cfbee59152 doc/protocol.xml: change "in" to "base" 2014-04-24 09:37:31 +02:00
Max Kellermann
b4db28fed2 doc/protocol.xml: update and fix command "list" 2014-04-24 08:20:38 +02:00
Max Kellermann
c9aec3e866 DatabaseCommands: fix crash on "list base"
The string "base" is understood by locate_parse_type(), but not by
listAllUniqueTags().  The special tag type LOCATE_TAG_BASE_TYPE causes
a crash in PrintUniqueTag().
2014-04-24 08:19:08 +02:00
Max Kellermann
1d1f8be260 DatabasePrint: convert "type" to unsigned 2014-04-24 08:18:41 +02:00
Max Kellermann
38e6c0ad3f DatabaseCommands: clarify compatibility comment 2014-04-24 08:11:06 +02:00
Max Kellermann
7ecf4ad54d input/nfs: add missing string.h include
For strrchr().  Fixes build failure.
2014-04-23 12:53:19 +02:00
Max Kellermann
1c02b4b9f4 Merge tag 'release-0.18.10' 2014-04-10 13:49:20 +02:00
Max Kellermann
d0119548c1 release v0.18.10 2014-04-10 13:36:38 +02:00
Marcello Desantis
95ac6071b9 decoder/sndfile: work around libsndfile bug on partial read 2014-04-09 23:58:56 +02:00
Weng Xuetian
3a4e667078 PlaylistEdit: don't interrupt playback when current song gets deleted 2014-04-09 23:10:14 +02:00
Max Kellermann
afdefefbe4 icu/Collate: fix memory leak in IcuCaseFold() 2014-04-09 20:09:34 +02:00
Max Kellermann
5360c0c588 IOThread: make io_thread_get() "const" 2014-04-05 09:26:45 +02:00
Max Kellermann
74a05a7f53 pcm/Neon: explicit rounding
Convert to 31 bit first, then right-shift with rounding to 16 bit.
2014-03-19 06:54:06 +01:00
Max Kellermann
a68acf5c66 util/ConstBuffer: add FromVoid(), ToVoid() to "void" specialization
Provide the full API.
2014-03-18 12:09:17 +01:00
Max Kellermann
ce18c36ed9 decoder/ffmpeg: handle unknown stream start time 2014-03-18 09:16:09 +01:00
Max Kellermann
8e39cf62e7 decoder/ffmpeg: pass AVSEEK_FLAG_ANY to av_seek_frame()
This corrects a major mistake from commit 724a59aa - there was one
small thing that commit was supposed to do, and it failed.
AV_TIME_BASE is not a seek flag.
2014-03-18 09:10:36 +01:00
Max Kellermann
707d379b97 input/mms: move blocking I/O to thread 2014-03-16 11:48:46 +01:00
Max Kellermann
88a0a48b03 input/BufferedInputStream: new wrapper for moving plugin to thread 2014-03-16 10:26:40 +01:00
Max Kellermann
d51b90a880 thread/Thread: make the destructor non-virtual
The class does not have any virtual methods, and thus the (debug-only)
destructor does not need to be virtual.
2014-03-16 10:26:23 +01:00
Max Kellermann
e9912bcf8a input/alsa: don't initialize "seekable=false", "size=-1"
These are the default values already.
2014-03-16 09:52:17 +01:00
Max Kellermann
4a5cc9f610 test/run_decoder: use InputStream::OpenReady() instead of InputStream::Open() 2014-03-16 09:41:03 +01:00
Max Kellermann
e29fc62b68 test/{run_decoder,dump_playlist}: fix accidental search/replace hiccups 2014-03-16 09:41:03 +01:00
Max Kellermann
b55e1dcb5e pcm/Neon: make neon_x4_b() variadic 2014-03-16 09:30:50 +01:00
Max Kellermann
6f4775a8ee pcm/Neon: apply bit shift during float->int conversion
Avoid multiplication.  This is a speedup of 20%.
2014-03-16 09:05:30 +01:00
Max Kellermann
c7e2f558a0 input/curl: use CircularBuffer
Replaces its own weird buffering code.
2014-03-16 00:35:28 +01:00
Max Kellermann
328860c8ba util/CircularBuffer: add method GetSpace() 2014-03-16 00:28:42 +01:00
Max Kellermann
89ac111853 util/CircularBuffer: add method GetSize() 2014-03-16 00:27:18 +01:00
Max Kellermann
3d4f588a7f util/CircularBuffer: rename GetSize() to GetCapacity() 2014-03-15 23:12:20 +01:00
Max Kellermann
8f74bf314d input/curl: add method CurlInputStream::Open() 2014-03-15 22:56:05 +01:00
Max Kellermann
0dd5ebbdbe input/curl: move _seek() into the CurlInputStream class 2014-03-15 22:42:37 +01:00
Max Kellermann
2ae60767a3 input/curl: move _easy_init() into the CurlInputStream class 2014-03-15 22:38:46 +01:00
Max Kellermann
64f31f70f9 input/curl: pass std::string&& to HeaderReceived()
Code simplification.
2014-03-15 22:02:59 +01:00
Max Kellermann
23eacbd132 input/curl: move code to CurlInputStream methods 2014-03-15 20:43:37 +01:00
Max Kellermann
e9f16fca96 input/curl: rename "error" to "error_buffer" 2014-03-15 20:43:17 +01:00
Max Kellermann
3d30de91f3 input/curl: rename struct input_curl to CurlInputStream 2014-03-15 20:38:08 +01:00
Max Kellermann
f68d2f7c7f system/fd_util: export fd_set_cloexec() 2014-03-15 20:03:31 +01:00
Max Kellermann
f660d30138 util/CircularBuffer: new buffer class 2014-03-15 18:35:52 +01:00
Max Kellermann
b10276ff98 m4/ucred.m4: don't define _GNU_SOURCE
Not necessary anymore, because we enable this flag unconditionally
now.
2014-03-15 18:31:54 +01:00
Max Kellermann
7d353bbe2a configure.ac: always define _GNU_SOURCE on Linux
Make sure glibc gives us all features.
2014-03-15 18:27:09 +01:00
Max Kellermann
5696f91a1e pcm/PcmFormat: ARM NEON optimizations for float->s16
This is nearly 4 times faster than the "portable" algorithm.
2014-03-15 11:41:01 +01:00
Max Kellermann
3932e62fc7 test/test_pcm: replace 256 with prime number
Use some odd number that will expose problems with remaining samples
after optimized vector operations.
2014-03-15 10:53:13 +01:00
Max Kellermann
729304aef5 test/test_pcm_format: add unit test for float clamping 2014-03-15 10:00:47 +01:00
Max Kellermann
40cce050e7 test/test_pcm_all: move CPPUNIT_TEST_SUITE_REGISTRATION() to test_pcm_main.cxx
Run each unit test only once.  Using CPPUNIT_TEST_SUITE_REGISTRATION
from within the header meant that each unit class was registered again
for each source file that includes the header.
2014-03-15 10:00:47 +01:00
Max Kellermann
bb6ee71f08 pcm/PcmFormat: don't use WritableBuffer
The previous commit eliminated the need for that.
2014-03-14 23:23:16 +01:00
Max Kellermann
0d0642fd67 pcm/PcmFormat: instantiate FloatToInteger<S32>
.. instead of reusing FloatToInteger<S24> and converting from S24 to
S32 in-place.
2014-03-14 23:21:20 +01:00
Max Kellermann
08e6cf3dd2 pcm/PcmFormat: eliminate more duplicate code with templates
Refactor the conversion functions to classes and pass an instance to
the new function AllocateConvert().
2014-03-14 20:54:09 +01:00
Max Kellermann
044134eba0 pcm/PcmFormat: eliminate local variable "bits" 2014-03-14 20:53:22 +01:00
Max Kellermann
9fa6fa522e pcm/PcmFormat: remove obsolete AllocateFromFloat() overload 2014-03-14 20:53:14 +01:00
Pete Beardmore
d0cd98a63a MultipleOutputs: ensure input_audio_format is zero-initialised
-fixes SIGABRT when mpd is started from a previously paused state
-regression introduced by commit: f5a923b9d1:
'OutputAll: convert to class, move instance to class Partition'

-input_audio_format was previously declared using the static modifier
ensuring it was zero-initialised by default
-the current default-initialised input_audio_format contains garbage at
runtime which allows the AudioFormat.IsDefined() 'fail fast' test in
MultipleOutputs::Update to pass and the SIGABRT follows in
AudioOutput::Open when passed the invalid input_audio_format struct
-switching AudioFormat.IsDefined() for AudioFormat.IsValid() is an
alternative workaround
2014-03-14 20:27:21 +01:00
Max Kellermann
88eae9dabb command/{storage,file}: suppress bogus format warnings on WIN32 2014-03-14 08:58:43 +01:00
Max Kellermann
f2f1801c25 db/proxy: check connect error before initializing SocketMonitor
Fixes crash bug because mpd_connection_get_async() was called without
a connection.
2014-03-06 13:35:42 +01:00
Max Kellermann
a9e351e00d decoder/gme: fix memory leak in container_scan() 2014-03-06 13:12:39 +01:00
Max Kellermann
d65841a2db configure.ac: prepare for 0.18.10 2014-03-06 13:08:30 +01:00
Pete Beardmore
9da57e7458 PulseOutputPlugin: avoid locking mainloop object from within mainloop thread
-fixes regression introduced by:
 '8d6fedf8177d0d2ced81e6d93d35c368b2ac69db [PATCH] Mixer: add class MixerListener'
-listener.OnMixerVolumeChanged() called GetVolume() which attempted to acquire
the lock but as per 'pa_threaded_mainloop_lock()' documentation:
This function may not be called inside the event loop thread. Events that are
dispatched from the event loop thread are executed with this lock held
-this patch seperates the underlying action of GetVolume() into a new
GetVolumeInternal() function, to be called only when the lock is already held, as
is the case for the listener.OnMixerVolumeChanged() call
2014-03-05 17:17:41 +00:00
Pete Beardmore
3a3fb98f79 PulseOutputPlugin: set icon name 2014-03-04 15:18:30 +00:00
Max Kellermann
503ed9c331 Merge tag 'release-0.18.9' 2014-03-02 11:46:07 +01:00
Max Kellermann
2784d65618 release v0.18.9 2014-03-02 11:25:01 +01:00
Max Kellermann
47ea69233b output/alsa: remove the obsolete Raspberry Pi workaround
Has been superseded by the previous commit.
2014-03-02 11:22:04 +01:00
Max Kellermann
a884e37de1 output/alsa: call snd_pcm_prepare() after snd_pcm_drop()
Don't wait for an optimistic write to fail.  This is an improved
workaround for the infamous Raspberry Pi bug (see commit af991765).
It works much better and comes without the negative side effects.  The
old workaround is now obsolete.
2014-03-02 11:12:25 +01:00
Max Kellermann
0102a8665a event/SignalMonitor: fix build failure due to missing signal.h include 2014-03-02 10:21:31 +01:00
Max Kellermann
cb63189f6b android build 3 2014-03-02 00:53:41 +01:00
Max Kellermann
d77c83f4ba Main: auto-configure state file on Android 2014-03-02 00:35:37 +01:00
Max Kellermann
8cf3ac200b Main: use getExternalStorageDirectory() for locating mpd.conf 2014-03-02 00:24:31 +01:00
Max Kellermann
477877406a android/build.py: enable ffmpeg 2014-03-02 00:22:05 +01:00
Max Kellermann
2bf2f34b12 InputPlugin: allow init() to soft-fail
Add enum InputResult which is a tri-state.  Input plugins may now fail
and just become unavailable.
2014-03-02 00:17:32 +01:00
Max Kellermann
7453c26ec4 thread/Name: fall back to prctl() 2014-03-01 23:58:59 +01:00
Max Kellermann
b059ba69d6 output/sles: support stereo 2014-03-01 23:05:44 +01:00
Max Kellermann
36ca57a54e fs/StandardDirectory: add GetUserCacheDir()
Move code from CreateConfiguredDatabase() and add XDG support.  This
implements an automatic Linux fallback for the setting "db_file" if
none was specified.
2014-03-01 22:51:51 +01:00
Max Kellermann
efa6678bcc NEWS: add group "configuration" 2014-03-01 22:51:51 +01:00
Max Kellermann
b8f1850bba db/Configured: store database file in cache directory
Add class Context which wraps the Android/Java Context class and add a
JNI wrapper for method Context.getCacheDir().
2014-03-01 22:20:28 +01:00
Max Kellermann
5268f55344 java/File: add method ToAbsolutePath() returning AllocatedPath 2014-03-01 20:53:39 +01:00
Max Kellermann
e44c9a000d android/Environment: fix copyright header
Stole my own code from another project :-)
2014-03-01 20:22:22 +01:00
Max Kellermann
ffc926bda5 android/build.py: enable libid3tag 2014-03-01 19:18:50 +01:00
Max Kellermann
07c1ba1f5e TagId3: disable charset conversion without GLib 2014-03-01 19:18:50 +01:00
Max Kellermann
14168eadb2 Main: inline mpd_main() on Android 2014-03-01 19:09:31 +01:00
Max Kellermann
58771fc41c Android: obtain music directory from Environment.getExternalStoragePublicDirectory() 2014-03-01 18:48:20 +01:00
Max Kellermann
1e06c66c77 java: new helper library for the Android port 2014-03-01 18:48:20 +01:00
Max Kellermann
c73771e3ce Main: load mpd.conf from /sdcard/ on Android
Hard-coded path.  Will be replaced soon.
2014-03-01 18:48:20 +01:00
Max Kellermann
350d2bcd6e storage/Configured: fix fallback music directory
This was accidently disabled when storage plugins were introduced.
2014-03-01 18:45:09 +01:00
Max Kellermann
b2c523e56d android: use "strip" from the Android NDK 2014-03-01 08:52:28 +01:00
Max Kellermann
5bc5abf0e7 android: enable database plugins 2014-03-01 08:25:23 +01:00
Max Kellermann
44352e9ee4 Makefile.am: use Android API level 17
The SDK for level 9 cannot be downloaded anymore.
2014-03-01 08:24:49 +01:00
Max Kellermann
7ccc609da2 db/update/ExcludeList: make no-op if GLib is disabled
Quick hack to allow using the database without GLib (for Android).
2014-03-01 08:16:13 +01:00
Max Kellermann
ebc0168072 android: downgrade WRITE_EXTERNAL_STORAGE to READ_EXTERNAL_STORAGE
We're not using external storage yet, but as soon as we will, we only
need to read music files, not write them.
2014-03-01 07:58:01 +01:00
Max Kellermann
4ba7427fa0 util/{Const,Writable}Buffer: add operator[] 2014-03-01 07:49:13 +01:00
Max Kellermann
9dc5335e3e util/{Const,Writable}Buffer: add template specialization for "void"
Omit a few methods that are not applicable.
2014-03-01 07:37:58 +01:00
Max Kellermann
d333de1980 util/ConstBuffer: remove cast operator ConstBuffer<void>
This was bugged, because it did not scale the "size".
2014-03-01 07:37:20 +01:00
Max Kellermann
96afa8bd2b command: add command "listfiles"
Lists files and directories.  Supports storage plugins.
2014-03-01 06:25:57 +01:00
Max Kellermann
797bbeabeb m4: add missing file ax_pthread.m4 from autoconf-archive 2014-03-01 06:24:55 +01:00
Max Kellermann
20cdab5546 DatabasePrint: move code to PrintDirectoryURI() 2014-02-28 08:21:34 +01:00
Max Kellermann
6765234b60 DatabasePrint: add API documentation 2014-02-28 08:17:25 +01:00
Max Kellermann
4c27898ce7 {Other,Database}Commands: contract declaration and assignment 2014-02-28 07:12:04 +01:00
Max Kellermann
d34ae0850c AllCommands: "findadd" requires the "add" permission 2014-02-27 23:08:22 +01:00
Max Kellermann
e9a85aa4e4 db/simple: mount points
A SimpleDatabase instance can now "mount" other Database instances at
certain locations.  This is used to use a new SimpleDatabase instance
for each storage mount (issued with the "mount" protocol command).
Each such instance has its own database file, stored in the directory
that is specified with the "cache_directory" option.
2014-02-27 20:49:13 +01:00
Max Kellermann
2a16fc74fd CompositeStorage: add method GetMount() 2014-02-27 20:49:13 +01:00
Max Kellermann
f65254680a db/update/Queue: use std::list instead of std::queue
The problem with std::queue is that it doesn't give us enough control.
The method Clear() is a kludge already, but soon, we'll need
filtering.
2014-02-27 20:49:13 +01:00
Max Kellermann
d64edb6896 db/simple: GetRoot() returns reference 2014-02-27 19:29:10 +01:00
Max Kellermann
3f9ad8e104 db/update/Service: allocate UpdateWalk dynamically 2014-02-27 18:04:24 +01:00
Max Kellermann
1c772ef699 Playlist: use the Error library to return errors 2014-02-27 17:27:23 +01:00
Max Kellermann
809b89b5af Playlist*: move to queue/ 2014-02-27 17:12:42 +01:00
Max Kellermann
681e012fb5 db/update: cancel the update on shutdown 2014-02-27 16:58:35 +01:00
Max Kellermann
3be36643a1 db/UpdateGlue: rename to Service.cxx 2014-02-27 16:14:10 +01:00
Max Kellermann
21e19ef69f db/simple/Directory: eliminate method LookupSong()
Move to SimpleDatabase::GetSong() to give that method more control.
2014-02-26 20:10:31 +01:00
Max Kellermann
69a42fc901 db/simple/Directory: LookupDirectory() return remaining URI
Code can now be reused in LookupSong().
2014-02-26 19:50:46 +01:00
Max Kellermann
525789cd36 db/simple/Directory: make variables more local 2014-02-26 19:50:36 +01:00
Max Kellermann
367d660c08 db/Directory: add DEVICE_* documentation 2014-02-26 10:00:38 +01:00
Max Kellermann
4d73e4d605 db/simple: create dedicated directory 2014-02-26 09:17:41 +01:00
Max Kellermann
d86cc5bf42 db/Song: update API documentation for SimpleDatabasePlugin 2014-02-25 22:16:20 +01:00
Max Kellermann
5f262da09d db/simple: remove unused method LookupDirectory() 2014-02-25 20:13:40 +01:00
Max Kellermann
82985a9488 db/simple: make internal methods "private" 2014-02-25 19:48:01 +01:00
Max Kellermann
afcdb65f80 db/simple: add comment 2014-02-25 18:17:54 +01:00
Max Kellermann
6b66e86f40 db/simple: move Create() up 2014-02-25 18:17:39 +01:00
Max Kellermann
cb145d290e DirectorySave: save the flags "DEVICE_INARCHIVE" and "DEVICE_CONTAINER"
Helps avoid unnecessary archive scans during database update on a
fresh MPD process.
2014-02-25 18:16:19 +01:00
Max Kellermann
167803d2a1 DatabaseSave: increase DB_FORMAT version 2014-02-25 18:16:06 +01:00
Max Kellermann
58a981d2f6 DatabaseSave: add constant OLDEST_DB_FORMAT 2014-02-25 18:15:55 +01:00
Max Kellermann
8963cd1fab DirectorySave: move code to ParseLine() 2014-02-25 18:15:43 +01:00
Max Kellermann
6526de024a output/pulse: remove bogus g_free() call 2014-02-24 21:23:49 +01:00
Max Kellermann
55cd5a9a78 DirectorySave: save the mtime only if it is known 2014-02-24 21:17:06 +01:00
Max Kellermann
3f4c283203 icu/Collate: pass UErrorCode* to ucol_strcollUTF8()
Fixes crash after database update.
2014-02-24 21:05:44 +01:00
Max Kellermann
1e63e7c08b icu/Collate: initialize the error code before ucol_open()
Fixes initialization failure.
2014-02-24 21:04:23 +01:00
Max Kellermann
33fc3af775 SongSort, ...: use libicu instead of GLib's g_utf8_*() 2014-02-24 20:39:37 +01:00
Max Kellermann
6d9739165e output/httpd/client: eliminate GLib 2014-02-24 20:39:37 +01:00
Max Kellermann
7c5396ffb9 output/{shout,win32}: include cleanup 2014-02-24 20:34:09 +01:00
Max Kellermann
8319398957 output/openal: use usleep() instead of g_usleep() 2014-02-24 20:33:15 +01:00
Max Kellermann
a1509876de output/pulse: use setenv() instead of g_setenv()
There is no advantage in using g_setenv().
2014-02-24 20:31:38 +01:00
Max Kellermann
0f2cf51f43 output/pulse: remove bogus g_free() call 2014-02-24 20:29:29 +01:00
Max Kellermann
e99ff4fdbc decoder/gme: use free() instead of g_free() 2014-02-24 20:19:34 +01:00
Max Kellermann
25431f32a2 DecoderPlugin: free the container_scan() return value with delete[] 2014-02-24 20:19:34 +01:00
Max Kellermann
6ba1fe7568 UriUtil: support ftp:// URLs in uri_remove_auth() 2014-02-24 19:59:53 +01:00
Max Kellermann
bfae92e307 Main: use INT_MAX instead of G_MAXUINT 2014-02-24 18:57:03 +01:00
Max Kellermann
9c5bf542d1 android/build.py: add project parameter "cppflags" 2014-02-24 09:33:23 +01:00
Max Kellermann
61161269d8 android/build.py: add parameter that specifies a subdirectory 2014-02-24 09:32:38 +01:00
Max Kellermann
8fe004e98e fs/Charset: use "UTF-8" instead of "utf-8" as the default value
The upper-case name seems to be the canonical one.
2014-02-23 22:03:40 +01:00
Max Kellermann
09e5f17b5d Directory: use PathTraitsUTF8::Build() instead of g_strconcat() 2014-02-23 22:02:39 +01:00
Max Kellermann
db20e29af6 Directory: pass std::string&& to constructor 2014-02-23 22:02:02 +01:00
Max Kellermann
5f5c95cc68 android build 2 2014-02-22 13:40:29 +01:00
Max Kellermann
68f3015712 android/build.py: add libopus 2014-02-22 13:40:11 +01:00
Max Kellermann
240a697f6c encoder/opus: use xalloc() instead of g_malloc() 2014-02-22 13:40:11 +01:00
Max Kellermann
5a0dc808fd decoder/opus: use new[] instead of g_malloc() 2014-02-22 13:37:36 +01:00
Max Kellermann
befbf6bf13 android/build.py: add libmad 2014-02-22 10:22:31 +01:00
Max Kellermann
2d5c21c457 android/build.py: add option "autogen" 2014-02-22 10:22:31 +01:00
Max Kellermann
25977d56c8 android/build.py: add -Iroot/include and -Lroot/lib
Allow library auto-detection without pkg-config.
2014-02-22 10:22:31 +01:00
Max Kellermann
4dcf0b8ae0 first Android release
Finally, MPD runs on Android.  For some small value of "runs".  Very
much work left, too much to describe.
2014-02-22 01:39:08 +01:00
Max Kellermann
9574d11dc8 output/sles: new output plugin for Android 2014-02-22 00:18:46 +01:00
Max Kellermann
3d4689756c Main: disable command-line parser and signal handlers on Android 2014-02-22 00:18:46 +01:00
Max Kellermann
90114514a9 LogBackend: use __android_log_print() on Android 2014-02-22 00:18:46 +01:00
Max Kellermann
7757e59e78 input/curl: include cleanup 2014-02-22 00:18:29 +01:00
Max Kellermann
adb89e0121 Makefile.am: build shared library for Android
Doesn't work yet, just to get the Android port started.
2014-02-21 10:51:07 +01:00
Max Kellermann
b7a7953757 db/Directory: use "unsigned" for inode and device
This is what we get from the storage plugin via FileInfo.  Fixes a
compiler warning on Mac OS X where dev_t appears to be signed.
2014-02-21 10:48:43 +01:00
Max Kellermann
d25ef7eea4 configure.ac: detect Android cross-build
Define "ANDROID" if the host operating system is Android.
2014-02-21 10:27:07 +01:00
Max Kellermann
30a82076ba PlayerListener: new interface to replace GlobalEvents access 2014-02-21 10:22:35 +01:00
Max Kellermann
860339c132 Makefile.am: use AM_CPPFLAGS instead of src_mpd_CPPFLAGS
Fixes build failure caused by commit d9466cad0.
2014-02-21 10:22:35 +01:00
Max Kellermann
008723c62f ConfigGlobal: eliminate function config_get_next_param() 2014-02-20 00:04:23 +01:00
Max Kellermann
9e0ce23a03 test/run_{filter,output}: use config_find_block() 2014-02-20 00:04:23 +01:00
Max Kellermann
04ba433ca6 Main: initialize Partition before Listener
Fixes nullptr dereference (regression by commit df5f9f4a).
2014-02-20 00:04:23 +01:00
Max Kellermann
d884272ba8 Listen: eliminate local variable 2014-02-19 23:50:47 +01:00
Max Kellermann
e609c88334 Listen: reduce overhead for builds without systemd 2014-02-19 23:49:34 +01:00
Max Kellermann
e92a41fa3a db/upnp: move plugin source to upnp directory 2014-02-19 23:46:00 +01:00
Max Kellermann
df5f9f4a15 Listen: add Partition reference 2014-02-19 23:43:36 +01:00
Max Kellermann
d9466cad0e Makefile.am: move the MPD core to libmpd.a
Prepare for providing everything in a shared library, to be embedded
in another process.
2014-02-19 23:41:07 +01:00
Max Kellermann
150443b014 DatabasePlugin: add FLAG_REQUIRE_STORAGE
Ignore the storage configuration if FLAG_REQUIRE_STORAGE is not set in
the DatabasePlugin.
2014-02-19 23:24:17 +01:00
Max Kellermann
9e36af7916 DatabasePlugin: add attribute "flags" 2014-02-19 23:24:15 +01:00
Max Kellermann
85b8675e7a db/Interface: add attribute "plugin"
The new method IsPlugin() replaces the "is_simple" flag.
2014-02-19 23:17:21 +01:00
Max Kellermann
ae594ad92c DatabasePlugin: split header 2014-02-19 22:54:52 +01:00
Max Kellermann
8d6fedf817 Mixer: add class MixerListener
Use a listener interface instead of GlobalEvents.
2014-02-19 21:40:14 +01:00
Max Kellermann
f4f8fa7c94 output/Init: pass AudioOutput references 2014-02-19 21:38:48 +01:00
Max Kellermann
fb5fbb8088 util/Tokenizer: relicense to BSD-2 2014-02-19 10:41:48 +01:00
Max Kellermann
e06a807d30 Makefile.am: move DatabaseSave.cxx to libdatabase_plugins.a 2014-02-19 10:13:42 +01:00
Max Kellermann
6b09842cb6 Makefile.am: re-add src/AudioCompress/compress.c to test/run_normalize
Build was broken by previous commit.
2014-02-19 10:13:31 +01:00
Max Kellermann
ca813389dc Makefile.am: move AudioCompress to libfilter_plugins.a 2014-02-19 10:03:58 +01:00
Max Kellermann
e624171ba1 StickerCommands: include cleanup 2014-02-19 09:53:22 +01:00
Max Kellermann
0bbfb28992 output/httpd: move to dedicated directory 2014-02-19 09:22:08 +01:00
Max Kellermann
ee7bd695fd Timer: move to output/ 2014-02-19 09:22:08 +01:00
Max Kellermann
1cc17bfe7a cue/CueParser: move to playlist/ 2014-02-19 08:56:58 +01:00
Max Kellermann
8ae492dfeb Makefile.am: merge mpd_headers into src_mpd_SOURCES 2014-02-18 23:10:53 +01:00
Max Kellermann
e8789d7cb9 system/FatalError: remove GError support 2014-02-18 23:05:40 +01:00
Max Kellermann
0053cd0d0d Main: disable inotify check without database
Fix build failure.
2014-02-18 21:47:01 +01:00
Max Kellermann
c32477a223 Merge branch 'v0.18.x' 2014-02-18 21:46:41 +01:00
Max Kellermann
5e1e92626c event/SignalMonitor: unblock signals after fork
Fixes hanging child process in the "pipe" output plugin.
2014-02-18 19:13:50 +01:00
Max Kellermann
7fee85c80a configure.ac: fix linker failure when libvorbis/libogg are static
Link libvorbisfile first, followed to libvorbis and finally libogg.
This order is necessary because libvorbisfile depends on libvorbis.
2014-02-18 18:39:19 +01:00
Max Kellermann
a0c25941a8 Thread/Util: use __NR_ioprio_set instead of SYS_ioprio_set
Bionic doesn't have the SYS_* macros.
2014-02-18 10:44:18 +01:00
Max Kellermann
5eb468bce0 Thread/Util: make SCHED_RESET_ON_FORK optional
Use it if it exists, but don't insist if the C library is poor
(e.g. Bionic/Android).
2014-02-18 10:43:24 +01:00
Max Kellermann
7f8dd0e939 Makefile.am: rename libdecoder_plugins.a to libdecoder.a 2014-02-18 10:02:46 +01:00
Max Kellermann
28701cb9dd Makefile.am: remove unused variable DECODER_SRC 2014-02-18 10:01:37 +01:00
Max Kellermann
9b7f492c65 thread/Posix{Mutex,Cond}: disable "constexpr" on Android
Bionic's pthread declarations are non-literal.
2014-02-18 09:54:35 +01:00
Max Kellermann
6eda79d02d system/EPollFD: add epoll_create1() fallback for Android 2014-02-18 09:54:35 +01:00
Max Kellermann
fb5cf8e3ac .gitignore: add "/" prefixes 2014-02-18 09:41:25 +01:00
Max Kellermann
55e128cced test: various fixups for building without GLib 2014-02-18 09:18:42 +01:00
Max Kellermann
13056af8b2 Makefile.am: disable test_icy_parser without CURL 2014-02-18 09:18:42 +01:00
Max Kellermann
972c52891d configure.ac: check for libpthread
Required for building without GLib.
2014-02-18 09:18:42 +01:00
Max Kellermann
e10a8d95f6 PlaylistRegistry: disable the "pls" plugin without GLib 2014-02-18 09:18:42 +01:00
Max Kellermann
97f2be348c LogInit: disable SetLogCharset() without GLib 2014-02-18 09:18:42 +01:00
Max Kellermann
2b21312b36 util/StringUtil: add StringEndsWith()
Replaces g_str_has_suffix().
2014-02-18 09:18:42 +01:00
Max Kellermann
3a818b6d45 SongFilter: disable g_utf8_casefold() without GLib
Temporary hack for the experimental no-GLib build.
2014-02-18 09:18:42 +01:00
Max Kellermann
1709ab6810 fs/TextFile: use custom allocation instead of GString 2014-02-17 23:04:10 +01:00
Max Kellermann
ce925ba56f fs/Charset: disable if GLib is disabled 2014-02-17 22:48:26 +01:00
Max Kellermann
4ad14f6a2c TagId3: use xstrdup() instead of g_strdup() 2014-02-17 22:42:54 +01:00
Max Kellermann
579e48edbb util/StringUtil: add function Strip()
Replaces g_strstrip().
2014-02-17 22:37:43 +01:00
Max Kellermann
6a08f2281a TagString: disable UTF-8 validation if GLib is disabled 2014-02-17 22:33:10 +01:00
Max Kellermann
91729437a0 Main: initialize Database before Storage 2014-02-17 22:14:00 +01:00
Max Kellermann
3af7af0b8f Main: move code to InitDatabaseAndStorage() 2014-02-17 22:13:53 +01:00
Max Kellermann
1ddd00433e db/Configured: disallow both "db_file" and "database"
This is misconfiguration, and MPD should abort.
2014-02-17 22:13:53 +01:00
Max Kellermann
de160bb2d1 Main: move code to db/Configured.cxx 2014-02-17 22:13:53 +01:00
Max Kellermann
ff62b6742b Main: check if database exists before attempting to close it
Fixes nullptr dereference.
2014-02-17 22:13:53 +01:00
Max Kellermann
6da0af94df db/DatabaseSimple: remove obsolete header 2014-02-17 20:44:03 +01:00
Max Kellermann
5d87a274a5 configure.ac: link the Vorbis encoder with libogg
Fixes another linker failure.  Similar to commit ea406875
2014-02-17 19:42:38 +01:00
Max Kellermann
df9667a497 StorageCommands: add command "unmount" 2014-02-12 23:48:08 +01:00
Max Kellermann
e3e2ad4ae5 CompositeStorage: fix tree walk in Directory::Unmount() 2014-02-12 23:48:08 +01:00
Max Kellermann
ace4ba3171 StorageCommands: emit IDLE_MOUNT on successful "mount"
Add the new idle event to Idle.hxx/Idle.cxx.
2014-02-12 23:06:47 +01:00
Max Kellermann
0935ae330a StorageCommands: add command "listmounts" 2014-02-12 21:47:59 +01:00
Max Kellermann
9e02b13ab3 systemd: add socket activation files 2014-02-12 21:22:36 +01:00
Max Kellermann
5a486a940c systemd: assign real-time budget 2014-02-12 21:00:53 +01:00
Max Kellermann
d05ae4b444 util/HugeAllocator: relicense to BSD-2 2014-02-10 13:32:50 +01:00
Max Kellermann
73b0610d89 PlaylistSong: copy the "real" URI
Playback with some decoder plugins was broken because the Queue's
DetachedSong instances did not have the "real" URI (the mapped path).
2014-02-10 11:00:49 +01:00
Max Kellermann
57e862712a configure.ac: prepare for 0.18.9 2014-02-09 22:58:14 +01:00
Max Kellermann
73aec9ce63 StorageCommands: expose the "mount" command 2014-02-09 11:07:08 +01:00
Max Kellermann
a9fefcf600 Main: wrap the Storage instance in CompositeStorage 2014-02-09 11:07:08 +01:00
Max Kellermann
59ce67e2e5 CompositeStorage: new Storage implementation
This is the backend for the upcoming "mount" command.
2014-02-09 10:47:29 +01:00
Max Kellermann
2182209a8a db/update/Walk: disable FindAncestorLoop() if device/inode==0 2014-02-09 10:47:29 +01:00
Max Kellermann
e29a8b3a9c db/update/Walk: document FindAncestorLoop() 2014-02-09 10:46:39 +01:00
Max Kellermann
ace3f37af4 db/update/Walk: rename find_inode_ancestor() to FindAncestorLoop() 2014-02-09 10:46:39 +01:00
Max Kellermann
37b6899660 Main: move code to storage/Configured.cxx 2014-02-09 08:09:47 +01:00
Max Kellermann
570b12ec13 Idle: error out when unrecognized idle event was specified
Implements the error checks missing in commit 0bad8406
2014-02-09 08:07:48 +01:00
Max Kellermann
ac286ef734 OtherCommands: remove unnecessary nullptr check 2014-02-09 08:07:43 +01:00
Max Kellermann
b3663b5da2 storage/nfs: new storage plugin 2014-02-08 14:24:47 +01:00
Max Kellermann
d761d8b168 input/nfs: move nfs_domain to lib/nfs/Domain.cxx 2014-02-08 14:24:47 +01:00
Max Kellermann
fe7c6fee34 ArchivePlugin: pass Path to open() 2014-02-08 13:25:44 +01:00
Max Kellermann
9906daeca7 ArchivePlugin: rename struct archive_plugin to ArchivePlugin 2014-02-08 13:22:13 +01:00
Max Kellermann
5fb54095d2 doc/user: document storage plugins 2014-02-08 00:09:53 +01:00
Max Kellermann
3fdc678aae Main: support arbitrary storage plugins 2014-02-08 00:04:29 +01:00
Max Kellermann
a0088ccce1 storage: add struct StoragePlugin and a plugin registry 2014-02-07 23:46:15 +01:00
Max Kellermann
be081929f4 storage/local: remove utf8 path from constructor
Build the UTF-8 version of the path automatically in the constructor.
2014-02-07 23:41:06 +01:00
Max Kellermann
b0b086d473 Main: move storage initialization to InitStorage() 2014-02-07 23:37:39 +01:00
Max Kellermann
6798af52b6 Mapper: obtain music directory from Storage
Eliminate duplicate variable.
2014-02-07 23:34:29 +01:00
Max Kellermann
4d5ebafa6d Main: check the music directory
Move call from Mapper.cxx.
2014-02-07 23:29:20 +01:00
Max Kellermann
ec8873b178 Mapper: move check_directory() to the filesystem library 2014-02-07 23:25:47 +01:00
Max Kellermann
c45f205593 Main: chop separators from music directory
Move call from Mapper.cxx.
2014-02-07 23:13:24 +01:00
Max Kellermann
027b2063ba Mapper: remove unused functions 2014-02-07 23:03:25 +01:00
Max Kellermann
b531c4c2fe OtherCommands: use Storage::MapUTF8() instead of Mapper.cxx 2014-02-07 22:58:21 +01:00
Max Kellermann
4b010df99e Main: create Storage instance in glue_mapper_init()
Don't use the obsolete Mapper library to create it.
2014-02-07 22:54:18 +01:00
Max Kellermann
5e4dd4be9c Main: allow playlist directory without music directory 2014-02-07 22:39:17 +01:00
Max Kellermann
04d5896c1c NEWS: mention default soundcloud API key
Missing from commit 48c96bba
2014-02-07 22:38:04 +01:00
Max Kellermann
f947274626 InotifyUpdate: use class Storage instead of Mapper.cxx 2014-02-07 22:30:40 +01:00
Max Kellermann
f6939f71a7 InotifyUpdate: use the root name instead of mapper_get_music_directory_fs()
The root WatchDirectory instance already contains the music directory,
and we don't need to fetch it again.
2014-02-07 22:30:01 +01:00
Max Kellermann
25aa17ad89 InotifyUpdate: move functions into the WatchDirectory class 2014-02-07 22:24:26 +01:00
Max Kellermann
05ee057db5 InotifyUpdate: remove unnecessary #ifdefs 2014-02-07 22:17:27 +01:00
Max Kellermann
297e2747f3 PlaylistMapper: use class Storage instead of Mapper.cxx 2014-02-07 21:44:50 +01:00
Max Kellermann
77de233117 Playlist{Any,Registry,Mapper}: move functions to PlaylistStream.cxx 2014-02-07 21:30:49 +01:00
Max Kellermann
02b67edaf5 PlaylistSong: include cleanup 2014-02-07 21:30:03 +01:00
Max Kellermann
8549ccfd8c playlist/CloseSongEnumerator: new wrapper class
Simplifies a lot of code, because we don't need to return both the
SongEnumerator and the InputStream.
2014-02-07 20:27:24 +01:00
Max Kellermann
ffd16b55a6 StoragePlugin: add method MapToRelativeUTF8()
Replaces map_to_relative_path() from Mapper.cxx.
2014-02-07 19:09:28 +01:00
Max Kellermann
d744c997d8 fs/Traits: add function Relative()
Move code from Path::RelativeFS() and make it generic.
2014-02-07 19:08:51 +01:00
Max Kellermann
6b421cc354 DecoderPlugin: pass Path instance to file_decode() and scan_file() 2014-02-07 18:52:19 +01:00
Max Kellermann
37ec29b225 Mapper: remove unused function map_song_fs() 2014-02-07 18:51:19 +01:00
Max Kellermann
ca7f6a26b5 DecoderThread: use only DetachedSong::GetRealURI()
Don't use the mapper - all DetachedSong instances we get have already
been mapped.
2014-02-07 18:50:07 +01:00
Max Kellermann
9b69d22d7e DecoderThread: pass Path object around for local song files 2014-02-07 18:45:11 +01:00
Max Kellermann
4ab4cf8532 SongUpdate: pass Storage to UpdateFileInArchive() 2014-02-07 18:44:47 +01:00
Max Kellermann
3341b282b7 PlaylistSave: use DetachedSong::GetRealURI() in playlist_print_song()
The DetachedSong instance already knows its own absolute path, and
there is no need to ask the mapper again.
2014-02-07 18:42:16 +01:00
Max Kellermann
bb3b836dbb FileCommands: support remove database files 2014-02-07 18:41:42 +01:00
Max Kellermann
1873c67540 FileCommands: use Storage::MapFS() instead of map_uri_fs() 2014-02-07 18:38:10 +01:00
Max Kellermann
8fd8f23a6b FileCommands: move code to read_file_comments() 2014-02-07 18:33:43 +01:00
geneticdrift
f225051348 fixed possible format_context not closed in ffmpeg_decode 2014-02-07 12:07:43 +01:00
Max Kellermann
b2e3fdef0f storage/local: hide the class declarations
Hide inside CreateLocalStorage().
2014-02-07 01:11:52 +01:00
Max Kellermann
c13810ebaa Mapper: move map_song_detach() to db/DatabaseSong.cxx
Use Storage::MapUTF8() internally, don't use global variables.
2014-02-07 00:42:14 +01:00
Max Kellermann
19a982cf69 Mapper: convert IsInDatabase() check to assertion in map_song_detach() 2014-02-07 00:42:14 +01:00
Max Kellermann
746a47982b Merge tag 'release-0.18.8' 2014-02-07 00:17:36 +01:00
Max Kellermann
ddb5390d88 release v0.18.8 2014-02-07 00:06:31 +01:00
Max Kellermann
fce20e514e NEWS: fix 0.18.7 release year 2014-02-07 00:06:31 +01:00
Max Kellermann
327cbf48f5 pcm/FallbackResampler: add missing ConstBuffer<T>::ToVoid() call 2014-02-06 23:48:01 +01:00
geneticdrift
0f1f509be7 fixed leaked LocalDirectoryReader *const reader in UpdateWalk::UpdateDirectory 2014-02-06 23:08:24 +01:00
Max Kellermann
c8f0c7e9ed */smbclient: protect all libsmbclient calls with a mutex
libsmbclient is not thread-safe nor reentrant.  We must protect all
function calls with a global mutex, unfortunately.
2014-02-06 22:19:59 +01:00
Max Kellermann
a7989077ab neighbor/smbclient: move smbclient_domain to lib/smbclient/Domain.cxx 2014-02-06 22:12:50 +01:00
Max Kellermann
7e34737b2b Makefile.am: add variable SMBCLIENT_SOURCES 2014-02-06 22:11:59 +01:00
Max Kellermann
af66ed2505 doc/user: document the RoarAudio output plugin 2014-02-06 21:46:29 +01:00
Max Kellermann
ea4068757d configure.ac: link the Vorbis encoder with libvorbis
Since the encoder plugin uses a libvorbis function (and not only
libvorbisenc functions), we need to link with libvorbis explicitly.
2014-02-06 21:32:50 +01:00
Max Kellermann
0a0659d737 mixer/Plugin: pass AudioOutput reference to init()
Passing a void pointer is unsafe.
2014-02-06 21:10:12 +01:00
Max Kellermann
b6df4680df MixerPlugin: convert function pointers to Mixer virtual methods 2014-02-06 20:52:33 +01:00
Max Kellermann
e04090b477 Mixer: delete the implicit copy constructor 2014-02-06 20:52:25 +01:00
Max Kellermann
c9fb6f7bdb Mixer: make the constructor "explicit" 2014-02-06 20:52:25 +01:00
Max Kellermann
ad6b05ae17 mixer/software: use IgnoreError() 2014-02-06 20:52:25 +01:00
Max Kellermann
29b18d9ab7 SongUpdate: use the Storage interface, support remote files
This commit finally allows the database update to scan remote files,
e.g. using the smbclient storage plugin.  However, it is not yet
possible to configure that, therefore the feature is not accessible
yet.
2014-02-06 19:06:08 +01:00
Max Kellermann
ad309cdeae SongUpdate: make variables more local 2014-02-06 18:58:56 +01:00
Max Kellermann
e4322a716c input/nfs: new plugin using libnfs 2014-02-06 18:37:27 +01:00
Max Kellermann
90886c0760 doc/user: sort input plugins 2014-02-06 18:37:27 +01:00
Max Kellermann
957beeb0e9 storage/smbclient: Storage implementation using libsmbclient 2014-02-06 07:19:14 +01:00
Max Kellermann
522ad4cca6 Instance: narrow "storage" to class Storage 2014-02-06 07:19:14 +01:00
Max Kellermann
dc76b24e5f storage/local: OpenDirectory() returns StorageDirectoryReader* 2014-02-05 19:35:41 +01:00
Max Kellermann
e3e3053f32 storage/Interface: explicitly delete copy constructors 2014-02-05 19:30:58 +01:00
Max Kellermann
c8c3f20840 storage/local: move to src/storage/plugins/ 2014-02-05 19:26:21 +01:00
Max Kellermann
f6682aae77 db/update: include StorageInterface.hxx instead of LocalStorage.hxx 2014-02-05 19:26:18 +01:00
Max Kellermann
0ba1b73395 storage: add abstract interface
Prepare for the plugin interface.
2014-02-05 18:53:51 +01:00
Max Kellermann
4c995eb498 db/UpdateWalk: move LocalStorage to Instance
Keep only a reference.
2014-02-05 17:58:13 +01:00
Max Kellermann
144cfe70bf db/update/Remove: initialize attribute "removed_song"
Fixes bogus assertion failure.
2014-02-05 17:58:13 +01:00
Max Kellermann
855f26c43d Mixer: use reference instead of pointer for MixerPlugin 2014-02-05 17:25:47 +01:00
Max Kellermann
f86e159536 Mixer: rename struct mixer_plugin to MixerPlugin 2014-02-05 17:22:34 +01:00
Max Kellermann
243c4e1e83 Main: remove unused global variable "main_thread" 2014-02-05 17:04:16 +01:00
Max Kellermann
9ae7f186bc LocalStorage: new API abstracting filesystem walk
Prepare to make this a new plugin API, for example to use a SMB share
for the music_directory.
2014-02-05 10:04:03 +01:00
Max Kellermann
f8d114be42 db/UpdateIO: add "pure" attributes 2014-02-05 10:04:03 +01:00
Max Kellermann
2c70251df1 db/UpdateGlue: relax assertion
Fixes assertion failure when update gets launched during MPD startup.
2014-02-05 10:04:03 +01:00
Max Kellermann
d380db25be Instance: add attribute "event_loop"
Replaces global variable "main_loop".
2014-02-05 00:09:36 +01:00
Max Kellermann
e8938b1069 MixerPlugin: add EventLoop& init() parameter 2014-02-05 00:02:02 +01:00
Max Kellermann
4a28333039 event/Loop: remove the dummy constructor argument 2014-02-05 00:00:03 +01:00
Max Kellermann
ad7f2b2aec test/ShutdownHandler: make the constructor "explicit" 2014-02-05 00:00:00 +01:00
Max Kellermann
ff665b37cb db/DatabaseListener: add method OnDatabaseSongRemoved()
Decouples db/update/Remove.cpp from global variables.
2014-02-04 19:53:37 +01:00
Max Kellermann
ce73843014 db/proxy: include cleanup 2014-02-04 19:53:12 +01:00
Max Kellermann
bae6f653d1 Instance: merge DatabaseModified() into OnDatabaseModified() 2014-02-04 19:17:22 +01:00
Max Kellermann
eec6d09959 db/update/Service: use DatabaseListener instead of Instance
Don't use the global variable "instance".
2014-02-04 18:54:54 +01:00
Max Kellermann
c5fa8ed321 db/update/Service: use EventLoop::IsInside()
Don't use the global variable "main_thread".
2014-02-04 18:54:45 +01:00
Max Kellermann
abc16b919d {Message,Neighbor}Commands: use Client::partition instead of Main.hxx 2014-02-04 11:35:23 +01:00
Max Kellermann
2de7cd32ea ClientMessage: undefine GetMessage on WIN32 2014-02-04 11:35:14 +01:00
Max Kellermann
098aa18538 GlobalEvents: remove obsolete event DELETE 2014-02-04 11:25:41 +01:00
Max Kellermann
cf6281a5a7 Instance: add Database attribute
Move from db/DatabaseGlue.cxx, eliminating global variable.
2014-02-04 11:22:33 +01:00
Max Kellermann
f00710a57e Main: create UpdateService instance in glue_db_init_and_load() 2014-02-04 11:22:32 +01:00
Max Kellermann
c953904343 db/update/Service: initialize "progress" and "update_task_id"
Database update was randomly broken due to these uninitialized
variables.
2014-02-04 11:22:13 +01:00
Max Kellermann
ddd36338da StateFile: pass Database to SongLoader
Fixes loading database songs from state file (regression by commit
29072797c).
2014-02-04 10:30:51 +01:00
Max Kellermann
d76b6f878e db/update/Service: add SimpleDatabase reference
Don't use the global variables from the DatabaseSimple library.
2014-02-04 09:05:32 +01:00
Max Kellermann
f25ef8d682 db/update/Walk: add Directory reference parameter
Remove dependency on the DatabaseSimple library.
2014-02-04 09:05:32 +01:00
Max Kellermann
33a2c01ea2 db/Simple: remove unused function db_get_directory() 2014-02-04 09:03:17 +01:00
Max Kellermann
9c637df77e SongSticker: add Database reference parameter 2014-02-04 01:15:08 +01:00
Max Kellermann
29072797ca db/DatabasePlaylist: pass Database reference around
Reduce global variable usage, move to frontend code.
2014-02-04 00:57:43 +01:00
Max Kellermann
db69ceade6 db/LightSong: make "real_uri" a pointer
Reduce overhead.  LightSong can always point to the "real" allocated
string.
2014-02-04 00:38:52 +01:00
Max Kellermann
b9c248e7e7 PlaylistFile: use class SongLoader 2014-02-03 23:50:19 +01:00
Max Kellermann
d533b59ee3 PlaylistFile: switch spl_append_uri() arguments
Playlist file name first, to be consistent with the other functions in
this library.
2014-02-03 23:33:25 +01:00
Max Kellermann
5ad2980d69 QueueSave: use class SongLoader 2014-02-03 23:32:31 +01:00
Max Kellermann
ca36ac2ba1 SongLoader: new class that merges duplicate code
There was quite a lot of duplicate code for loading DetachedSong
objects, with different semantics for "securely" loading local files.
2014-02-03 23:32:10 +01:00
Max Kellermann
ba675d6a55 FileCommands: use PathTraitsUTF8::IsAbsolute() 2014-02-03 23:31:28 +01:00
Max Kellermann
e4c5a4f61b PlaylistSave: remove redundant backslash conversion
This is already being done by FixSeparators(), called from
PathToUTF8().
2014-02-03 23:15:57 +01:00
Max Kellermann
a8e52ad89f ClientFile: move client_allow_file() into the Client class 2014-02-02 13:59:07 +01:00
Max Kellermann
8cf4fb53aa Playlist: pass Database to DatabaseModified()
Don't use global variable.
2014-02-01 00:45:58 +01:00
Max Kellermann
1769ae54e4 Partition: disable DatabaseModified() if not ENABLE_DATABASE 2014-02-01 00:44:41 +01:00
Max Kellermann
e545679265 Main: don't measure DatabaseGlobalDeinit() time
Useless information.
2014-02-01 00:39:42 +01:00
Max Kellermann
981080500b Stats: pass Database reference around
Call GetDatabase() only once.
2014-02-01 00:38:57 +01:00
Max Kellermann
636d28b784 Stats: remove obsolete "simple" plugin special case
The proxy plugin has now implemented the "idle" event listener.
2014-02-01 00:37:01 +01:00
Max Kellermann
188783ac1a Stats: return false if update has failed 2014-02-01 00:36:36 +01:00
Max Kellermann
ff650d50a2 Mapper: assert that Song::parent is not nullptr 2014-01-31 23:14:13 +01:00
Max Kellermann
78689645dc db/update/Archive: delete archive from database on error 2014-01-31 22:24:28 +01:00
Max Kellermann
26970579b8 db/update/Editor: add locking method variants 2014-01-31 22:17:49 +01:00
Max Kellermann
04b4f53488 db/update: convert runtime check to assertion 2014-01-31 21:59:35 +01:00
Max Kellermann
c310941f69 fs/AllocatedPath: add conversion constructor from Path 2014-01-30 23:36:57 +01:00
Max Kellermann
c02f146791 fs/DirectoryReader: GetEntry() returns Path, not AllocatedPath
Reduce overhead, don't duplicate the string.
2014-01-30 22:20:57 +01:00
Max Kellermann
a631200cca update/Walk: declare std::string at assignment
Reduce overhead.
2014-01-30 22:19:56 +01:00
Max Kellermann
6207a3f999 PlaylistFile: narrow LoadPlaylistFileInfo() API to accept Path 2014-01-30 22:17:35 +01:00
Max Kellermann
0bd01824f6 fs/AllocatedPath: add Build() overlays with Path arguments 2014-01-30 22:15:13 +01:00
Max Kellermann
4465e2c46b db: add compile-time option to disable database 2014-01-30 20:39:40 +01:00
Max Kellermann
34b309b99a OtherCommands: merge duplicate code from handle_update(), handle_rescan() 2014-01-30 20:39:40 +01:00
Max Kellermann
c6725884bc db/update: convert to OO API
Move global variables into the new classes.  That may allow multiple
update threads for multiple databases one day.
2014-01-30 18:47:05 +01:00
Max Kellermann
a31738f6f1 Main, OutputThread: increase kernel timer slack (Linux)
Allows the kernel to combine timer wakeups with other processes,
reducing power usage.
2014-01-30 18:43:40 +01:00
Max Kellermann
39a2867ea8 NEWS: mention thread names 2014-01-30 18:43:16 +01:00
Max Kellermann
468c3df82d NEWS: add "threads" section 2014-01-30 18:43:03 +01:00
Max Kellermann
d5b017407d ExcludeList: move to db/update/ 2014-01-30 10:11:12 +01:00
Max Kellermann
4b044bd8e1 InotifyUpdate: pass EventLoop to mpd_inotify_init() 2014-01-29 18:36:32 +01:00
Max Kellermann
aeaf64b467 Listen: pass EventLoop to listen_global_init()
Don't use global variables.
2014-01-29 18:32:28 +01:00
Max Kellermann
a137f817f5 db/Directory: move isRootDirectory() to Uri.hxx
Decouple command/OtherCommands.cxx from the "simple" database plugin.
2014-01-29 18:05:33 +01:00
Max Kellermann
ff87145537 sticker: don't use classes Directory and Song
Don't depend on the "simple" database plugin.  This fixes an assertion
failure / crash and allows using stickers with other plugins.
2014-01-29 17:45:07 +01:00
Max Kellermann
667481c371 OutputThread: move more functions into the AudioOutput class 2014-01-29 09:26:11 +01:00
Max Kellermann
af71605769 output: rename "chunk" to "current_chunk" 2014-01-29 09:23:57 +01:00
Max Kellermann
4657a3bd0f output: move functions into the AudioOutput struct 2014-01-29 08:10:46 +01:00
Max Kellermann
cb7366f472 AudioOutput: make "plugin" a reference 2014-01-29 08:10:36 +01:00
Max Kellermann
bf803e241f AudioOutput: pass plugin to constructor
Make it "const".
2014-01-29 08:10:18 +01:00
Max Kellermann
8a8d023f90 doc/user: add Debian build dependencies 2014-01-29 08:10:07 +01:00
Max Kellermann
5b3aa45e58 CommandLine: remove junk from string literal 2014-01-29 08:09:48 +01:00
Max Kellermann
c4403c523f AudioOutput: add constructor and destructor 2014-01-28 12:37:58 +01:00
Max Kellermann
07b89b2bad ConfigTemplates: rename "AudioOutput" back to "audio_output"
sed gone horribly wrong.  D'oh!
2014-01-28 12:37:58 +01:00
Max Kellermann
68b79f97f3 output: rename source files 2014-01-28 11:42:54 +01:00
Max Kellermann
815d72065c output: rename struct audio_output to AudioOutput 2014-01-28 11:34:09 +01:00
Max Kellermann
e0dc721324 OutputPlugin: rename struct audio_output_plugin to AudioOutputPlugin 2014-01-28 11:33:15 +01:00
Max Kellermann
2f873edc9c thread/Name: implementation for Mac OS X
pthread_setname_np() doesn't have the "thread" argument on OS X.
2014-01-28 11:33:15 +01:00
Max Kellermann
d5f46a846a Makefile.am: make libneighbor.a conditional
Fixes non-Linux build without neighbor plugins.
2014-01-28 11:27:32 +01:00
Max Kellermann
f5a923b9d1 OutputAll: convert to class, move instance to class Partition
Another big chunk of code for multi-player support.
2014-01-28 09:20:53 +01:00
Max Kellermann
36bab6ef06 configure.ac: detect libsmbclient without pkg-config
The pkg-config file has been added in Samba 4.0.  This commits adds a
fallback for older libsmbclient versions.
2014-01-27 15:00:44 +01:00
Max Kellermann
5273900b0e neighbor/smbclient: add splice_after() fallback for gcc 4.6 2014-01-27 14:59:15 +01:00
Max Kellermann
1451344221 configure.ac: check if -lrt is necessary for clock_gettime() 2014-01-27 14:59:15 +01:00
Max Kellermann
8ed9f779cd Makefile.am: build test/run_neighbor_explorer with AM_LDADD 2014-01-27 14:54:40 +01:00
Max Kellermann
f548a966f5 Playlist{Info,Vector}: move to db/ 2014-01-27 11:05:21 +01:00
Max Kellermann
67ad31b8b2 doc/developer: mention git pull requests 2014-01-27 10:44:27 +01:00
Max Kellermann
35f46eaa3f doc/developer: update number of contributors 2014-01-27 10:44:22 +01:00
Max Kellermann
ccfb125f02 doc/developer: add mailman page 2014-01-27 10:44:05 +01:00
Max Kellermann
f29e3ce8d5 doc/developer: explain clang static analyzer 2014-01-27 10:36:48 +01:00
Max Kellermann
bcb4646d6b doc/developer: tag for email address 2014-01-27 10:36:26 +01:00
Max Kellermann
5b8af30da1 autogen.sh: re-add $ACLOCAL_FLAGS, $AUTOMAKE_FLAGS 2014-01-27 10:35:37 +01:00
Max Kellermann
30fadaed7f Merge branch 'v0.18.x' 2014-01-27 10:33:42 +01:00
Max Kellermann
2b10ecfa37 IcyMetadataParser: more robust tag parser
Allow semicolons and single quotes in the stream title.  This is not
part of any specification, but found in real life.
2014-01-27 10:08:21 +01:00
Max Kellermann
f7eb2b697e test/test_icy_parser: unit test for IcyMetaDataParser.cxx 2014-01-27 09:51:31 +01:00
Max Kellermann
c01282a322 Makefile.am: remove "sparse" rule
We're C++, and sparse understands only plain C.
2014-01-27 09:29:34 +01:00
Max Kellermann
0e3f18ed70 Makefile.am: move test-suite.log back to base directory
Was broken on out-of-tree builds.
2014-01-27 09:28:08 +01:00
Max Kellermann
e5b1d30f1b autogen.sh: simplify, no versioned program names
This was just too complex and fragile.  Anybody who has versioned
program names shall just call those programs manually.
2014-01-27 09:25:15 +01:00
Max Kellermann
6746b751c4 autogen.sh: don't run aclocal with -I /usr/local/share/aclocal
I expect that aclocal is clever enough to find its own include
directories.  If it does not, letting MPD guess it is not the most
reliable idea either.
2014-01-27 09:13:11 +01:00
Max Kellermann
544c69c61c configure.ac: move autoconf/automake helpers to build/ 2014-01-27 09:01:02 +01:00
Max Kellermann
0ab66db7b9 move systemd unit to directory systemd/ 2014-01-27 08:55:42 +01:00
Max Kellermann
f7669c201f Makefile.am: fix "distcheck" 2014-01-27 08:55:42 +01:00
Max Kellermann
0b3fbdba87 neighbor/upnp: UPnP media server discovery 2014-01-26 15:51:33 +01:00
Max Kellermann
3dad837ca6 db/upnp: remove sleep(2) call
This call was unnecessary.  It is a bad idea anyway to block the MPD
process for some arbitrary amount of time.
2014-01-26 15:50:30 +01:00
Max Kellermann
d7e78059b0 upnp: initialize the client handle only once
Eliminate class LibUPnP and move the code to ClientInit.cxx.  Its
initialization function can be called multiple times, but
UpnpRegisterClient() is called at most once.
2014-01-26 15:43:23 +01:00
Max Kellermann
01f7abfc63 upnp: move library initialization to Init.cxx
Allow calling UpnpGlobalInit() multiple times.
2014-01-26 15:23:26 +01:00
Max Kellermann
e57e89b9d5 upnp/discovery: use a plain UpnpClient_Handle instead of class LibUPnP 2014-01-26 15:22:33 +01:00
Max Kellermann
bcc1f93370 upnp: add class UpnpCallback
Each Upnp*Async() call passes a new cookie pointer, and the cookie
passed to UpnpRegisterClient() appears to be ignored.  Using this
interface is a more elegant approach than having one single "handler"
function.
2014-01-26 15:04:56 +01:00
Max Kellermann
b161d72326 CueParser: don't "move" the filename
This invalidated the std::string instance, and thus broke the CUE
parser (commit 322b061632).
2014-01-26 14:58:23 +01:00
Max Kellermann
66c013682f upnp: remove obsolete global variable "theLib" 2014-01-26 13:54:48 +01:00
Max Kellermann
9f3ba737d6 upnp/Discovery: add listener interface 2014-01-26 13:41:40 +01:00
Max Kellermann
f86f5ad224 db/upnp: move generic code to lib/upnp/ 2014-01-26 13:41:40 +01:00
Max Kellermann
8b6b3ff28a neighbor/Glue: fix rollback range 2014-01-26 13:41:40 +01:00
Max Kellermann
4a3dc2cea2 db/upnp: rename variables 2014-01-26 13:08:52 +01:00
Max Kellermann
bd0cfffe23 neighbor/Info: add constructor 2014-01-26 13:07:53 +01:00
Max Kellermann
8c5ea7ec55 Makefile.am: add DespotifyUtils.cxx to libinput.a and libplaylist_plugins.a
Simplifies test program rules.
2014-01-26 13:04:14 +01:00
Max Kellermann
412d1b0a01 Makefile.am: use $(MKDIR_P) 2014-01-26 12:32:51 +01:00
Max Kellermann
642be502c0 NeighborCommands: convert assertion to runtime check 2014-01-26 01:17:49 +01:00
Max Kellermann
5c4a42caa0 neighbor: new subsystem to detect file servers on the local network
This commit adds the NeighborPlugin API which can be used to detect
nearby file servers that can be used by input plugins.  This list of
servers is exported using the new "listneighbors" command.  The idle
even "neighbor" notifies interested clients when a new neighbor is
found or an existing one is lost.

There's a lot missing currently: protocol&user documentation, and a
way to "mount" remote servers into the music database.  Obviously,
some code from the UPnP database plugin can be moved to a neighbor
plugin.
2014-01-26 00:10:05 +01:00
Max Kellermann
e847788569 lib/smbclient/Init: return empty username/password
This appears to be the right thing to do when we want anonymous login.
2014-01-26 00:08:50 +01:00
Max Kellermann
86ca5b3f16 input/smbclient: move code to lib/smbclient/Init.cxx 2014-01-25 23:29:42 +01:00
Max Kellermann
9b1fbdbca6 ConfigGlobal: add config_find_block()
Merge duplicate code.
2014-01-24 16:55:17 +01:00
Max Kellermann
97391fd4b9 DespotifyUtils, Expat: move to lib/ 2014-01-24 16:44:36 +01:00
Max Kellermann
68eda78704 Mixer*: move to mixer/ 2014-01-24 16:44:32 +01:00
Max Kellermann
7c52a1c04b Filter*: move to filter/ 2014-01-24 16:43:57 +01:00
Max Kellermann
9d34fc394c Database*: move to db/ 2014-01-24 16:38:44 +01:00
Max Kellermann
973c9872f9 Sticker*: move to sticker/ 2014-01-24 16:38:15 +01:00
Max Kellermann
eef7ba48dd Win32Main: move to win32/ 2014-01-24 16:37:32 +01:00
Max Kellermann
299ff2b23f move daemonization code to unix/ 2014-01-24 16:37:21 +01:00
Max Kellermann
f8bfea8bae Input*: move to input/ 2014-01-24 16:33:33 +01:00
Max Kellermann
e199c33c6e Client*: move to client/ 2014-01-24 00:26:53 +01:00
Max Kellermann
08296cd66d Update*: move to update/ 2014-01-24 00:24:43 +01:00
Max Kellermann
197b503f3e Config*: move to config/ 2014-01-24 00:20:01 +01:00
Max Kellermann
129eb178eb Queue*: move to queue/ 2014-01-24 00:17:50 +01:00
Max Kellermann
6b70f5e490 Zeroconf*: move to zeroconf/ 2014-01-24 00:14:54 +01:00
Max Kellermann
4aa6d39fd8 archive/*: move to archive/plugins/ 2014-01-24 00:09:37 +01:00
Max Kellermann
51adaf2c47 decoder/*: move to decoder/plugins/ 2014-01-24 00:02:24 +01:00
Max Kellermann
ea5b901bcc output/*: move to output/plugins/ 2014-01-23 23:49:50 +01:00
Max Kellermann
f1f19841bd playlist/*: move to playlist/plugins/ 2014-01-23 23:30:12 +01:00
Max Kellermann
655ad34414 Encoder*: move to src/encoder
.. and move the plugins to src/encoder/plugins/.
2014-01-23 23:09:14 +01:00
Max Kellermann
017eecb8e8 UPGRADING: remove obsolete file
This file has been unmaintained for 5 years, and nowadays, MPD tries
very hard to stay compatible with older versions.
2014-01-23 23:06:01 +01:00
Max Kellermann
b8e382b011 db/upnp/Discovery: use std::list instead of std::map
There will only be very few items, and that does not justify the bloat
of std::map.
2014-01-23 22:35:22 +01:00
Max Kellermann
c9af358e4b db/upnp/Discovery: move code to LockAdd(), LockRemove() 2014-01-23 22:35:22 +01:00
Max Kellermann
3afcfe3330 db/upnp/Discovery: un-inline the destructor 2014-01-23 22:35:22 +01:00
Max Kellermann
b521d8564a Makefile.am: always link test/dump_playlist with DetachedSong.cxx
Fixes linker failure.
2014-01-23 22:25:47 +01:00
Max Kellermann
53a13e8bc6 DetachedSong: un-inline the destructor
Reduce bloat.
2014-01-23 21:22:52 +01:00
Max Kellermann
f3f5e2e162 db/upnp: un-inline a few destructors
Reduce bloat.
2014-01-23 21:17:40 +01:00
Max Kellermann
ec41d849bb thread/Name: set thread names
For debugging.
2014-01-23 10:07:14 +01:00
Max Kellermann
1d547fe273 thread/Util: set the SCHED_RESET_ON_FORK flag in SetThreadRealtime() 2014-01-23 09:14:09 +01:00
Max Kellermann
b52d8fbebe db/upnp: strict vpath checks for the "root" directory 2014-01-23 00:40:39 +01:00
Max Kellermann
b61a2c722c db/upnp: move code to VisitObject() 2014-01-23 00:28:27 +01:00
Max Kellermann
c455d2c1de db/upnp: merge two PathTraitsUTF8::Build() calls 2014-01-23 00:25:08 +01:00
Max Kellermann
77070f5ab9 db/upnp: move code to VisitItem() 2014-01-23 00:17:38 +01:00
Max Kellermann
8d5f7160ac db/upnp: fix subdirectory paths in "listallinfo"
Add missing server name prefix.
2014-01-23 00:07:35 +01:00
Max Kellermann
b167ce2913 base_uri 2014-01-23 00:06:17 +01:00
Max Kellermann
3ac15ca8d1 db/upnp: pass char* to visitSong()
Don't use std::string, reduce bloat.
2014-01-23 00:06:03 +01:00
Max Kellermann
f703d4fc3e db/upnp: call VisitDirectory on servers, even in recursive mode 2014-01-22 23:52:08 +01:00
Max Kellermann
77c461fed7 db/upnp: make several methods "const" 2014-01-22 23:50:33 +01:00
Max Kellermann
a89c21b06a db/upnp: inline Configure() 2014-01-22 23:30:53 +01:00
Max Kellermann
b74aa6b14c db/upnp: don't duplicate song data for VisitSong
Not necessary because we control the LightSong's life cycle.
2014-01-22 23:28:23 +01:00
Max Kellermann
0c4a791111 db/upnp: emplace/move in csvToStrings() 2014-01-22 23:21:23 +01:00
Max Kellermann
1feedd4d9c db/upnp: require an empty token list in csvToStrings() 2014-01-22 23:21:14 +01:00
Max Kellermann
0ec1808956 db/proxy: simplify csvToStrings() 2014-01-22 23:17:42 +01:00
Max Kellermann
546e7cafa4 db/proxy: merge redundant string::push_back() calls 2014-01-22 23:13:24 +01:00
Max Kellermann
d9926a1c21 db/upnp: use PathTraitsUTF8::Build() 2014-01-22 23:10:00 +01:00
Max Kellermann
e50969e31c db/proxy: fix for libmpdclient < 2.9 2014-01-22 23:09:36 +01:00
Max Kellermann
a6d9998e1d db/proxy: copy "Last-Modified" from remote directories 2014-01-22 23:07:21 +01:00
Max Kellermann
a42f9e4ee3 LightDirectory: new struct replacing Directory in the DB API 2014-01-22 23:01:32 +01:00
Max Kellermann
f16db6cd80 DatabasePrint: don't print zero mtime
Zero means "unknown".
2014-01-22 23:01:32 +01:00
Max Kellermann
4943606f4a db/upnp: append characters instead of single-character strings 2014-01-22 21:55:58 +01:00
Max Kellermann
87629dda81 db/upnp: use string::push_back() instead of string::append() 2014-01-22 21:55:08 +01:00
Max Kellermann
71928b473e db/upnp/Discovery: unlock mutex before deleting DiscoveredTask 2014-01-22 21:48:33 +01:00
Max Kellermann
a0bee9fa0a db/upnp/Discovery: eliminate two strlen() calls 2014-01-22 21:47:34 +01:00
Max Kellermann
0defd927f3 db/upnp: use std::list instead of std::set for SearchCapabilities
Reduce bloat.  We never used the set lookup.
2014-01-22 21:41:05 +01:00
Max Kellermann
6c41e8f63f db/upnp: check offset<total at end of loop 2014-01-22 21:37:21 +01:00
Max Kellermann
fa67a4e956 db/upnp: break when zero objects have been returned 2014-01-22 21:37:19 +01:00
Max Kellermann
bf9352fb26 db/upnp: free responses manually 2014-01-22 21:33:54 +01:00
Max Kellermann
7573d4e1ba db/upnp: break when count==0
Make this non-fatal.  Just stop reading more objects.
2014-01-22 21:33:19 +01:00
Max Kellermann
bfb483898f db/upnp: use ParseUnsigned() instead of atoi() 2014-01-22 21:11:04 +01:00
Max Kellermann
f363788d76 db/upnp: pass unsigned integers to readDirSlice() 2014-01-22 20:57:10 +01:00
Max Kellermann
714056f157 db/upnp: inline ContentDirectoryService::readDirSlice() 2014-01-22 20:42:36 +01:00
Max Kellermann
1abc96fa27 db/upnp: remove special case for "*"
Passing this to csvToStrings() will do the same.
2014-01-22 20:37:17 +01:00
Max Kellermann
0fa98479ad db/upnp: obtain char* from ixmlwrap::getFirstElementValue()
Fixes crash when there's no SearchCaps element.
2014-01-22 20:26:33 +01:00
Max Kellermann
02f2171010 db/upnp/Util: pass char* to csvToStrings() 2014-01-22 20:24:55 +01:00
Max Kellermann
a5e7d0a90f db/upnp: require an empty input capability set 2014-01-22 20:21:01 +01:00
Max Kellermann
9fb5134f64 db/upnp/Util: handle absolute URI paths properly in caturl()
Fixes problems with some UPnP servers.
2014-01-22 19:38:07 +01:00
Max Kellermann
9aeb23dfe9 db/upnp/Util: use string::back(), string::front() 2014-01-22 19:38:02 +01:00
Max Kellermann
e59d8c9378 db/upnp/Device: clear the "value" pointer on unknown element
Avoid appending to an obsolete string object.
2014-01-22 19:38:02 +01:00
Max Kellermann
0616667688 Main: glue_mapper_init() returns true if GetUserMusicDir() fails
Not a fatal error.  Fixes assertion failure.
2014-01-22 16:28:19 +01:00
Max Kellermann
9747cc9e58 db/upnp/Device: replace std::vector with a std::string pointer 2014-01-22 09:55:51 +01:00
Max Kellermann
7b44dea4b1 db/upnp/Device: remove unused UPnPService attributes 2014-01-22 09:51:26 +01:00
Max Kellermann
18aea922e9 db/upnp/Directory: "emplace" items into the vector 2014-01-22 09:43:49 +01:00
Max Kellermann
7d194aceb6 db/upnp/Device: emplace/move the UPnPService into the vector
Reduce overhead.
2014-01-22 09:42:46 +01:00
Max Kellermann
2722b8a3df db/upnp/Util: "emplace" items into the list
Reduce overhead.
2014-01-22 09:40:38 +01:00
Max Kellermann
fd754ff8f8 db/upnp/Directory: replace std::vector with a simple enum
Reduce bloat.
2014-01-22 09:32:11 +01:00
Max Kellermann
b7738e7af3 db/upnp/Directory: join all CDATA nodes for tag values
Expat can call CharacterData() multiple times if the CDATA contains
entity references.  We need to collect all of them in one large
string.
2014-01-22 08:44:35 +01:00
Max Kellermann
99bebabac9 db/upnp/Directory: make "m_dir" private 2014-01-22 08:44:20 +01:00
Max Kellermann
0ed48b364a db/upnp: merge duplicate branches in Namei() 2014-01-21 23:42:02 +01:00
Max Kellermann
b38b8b9c18 db/upnp: simplify Namei() 2014-01-21 23:37:27 +01:00
Max Kellermann
5434856136 db/upnp: use std::list instead of std::vector
Reduce overhead.
2014-01-21 23:33:28 +01:00
Max Kellermann
aa1eb2f40d db/upnp: use iterator in Namei() 2014-01-21 23:32:42 +01:00
Max Kellermann
7260d7883c db/upnp: move "objid" declaration down
Don't allocate the object when it's not needed.
2014-01-21 23:10:30 +01:00
Max Kellermann
154250f551 db/upnp: eliminate redundant Namei() parameter "oobjid"
The caller should better obtain the object id from the returned
UPnPDirObject instance.
2014-01-21 23:07:33 +01:00
Max Kellermann
3e4fb92cfb db/upnp: remove redundant objid.empty() check from VisitServer()
If Namei() succeeds, the object id is guaranteed to be set.
2014-01-21 23:07:06 +01:00
Max Kellermann
0da713e278 db/upnp: use std::move() to extract server name
Reduce runtime overhead.
2014-01-21 22:57:54 +01:00
Max Kellermann
94cb1545b3 db/upnp: use vector::front() instead of [0] 2014-01-21 22:57:16 +01:00
Max Kellermann
411527a240 db/upnp: don't use stringToTokens() in ParseDuration()
Reduce bloat.
2014-01-21 22:52:12 +01:00
Max Kellermann
7777057d35 db/upnp: don't construct redundant empty vector<string> in Visit()
We know already that vpath is empty, let's use this instance.
2014-01-21 22:47:57 +01:00
Max Kellermann
dc5ef9ad01 db/upnp: simplify GetSong() 2014-01-21 22:43:04 +01:00
Max Kellermann
7471f65d95 LightSong: add attribute "real_uri"
The UPnP database plugin can now show relative song URIs for remote
songs.
2014-01-21 21:08:11 +01:00
Max Kellermann
5d4b450c52 DetachedSong: add attribute "real_uri"
Prepare for UPnP songs that retain there database identity.
2014-01-21 21:06:56 +01:00
Max Kellermann
483b1f51c9 DetachedSong: remove parameter names from "defaulted" constructors
Suppresses gcc warnings.
2014-01-21 21:06:56 +01:00
Max Kellermann
ecac7a629e db/upnp: fix empty song URI
Fall back to UPnPDirObject::url if there is no override.
2014-01-21 21:02:21 +01:00
Max Kellermann
21209ff46b DetachedSong: use "default" copy/move constructors
Remove unnecessary explicit code.
2014-01-21 20:38:13 +01:00
Chase Geigle
716bdc36fd pcm/SoxrResampler: Add configurable quality levels 2014-01-21 20:35:26 +01:00
Max Kellermann
4f120f3714 PlaylistSong: modify the given song object in-place
Reduce bloat.
2014-01-21 00:28:37 +01:00
Max Kellermann
dd20a3ce7e test: add unit test for playlist_check_translate_song() 2014-01-21 00:28:34 +01:00
Max Kellermann
c727c86245 PlaylistSong: remove redundant "secure" check
This has been verified already in the caller.
2014-01-21 00:28:32 +01:00
Max Kellermann
82b4ec22be PlaylistSong: recurse after applying base_uri
Allows applying map_to_relative_path() with base_uri.
2014-01-20 23:47:43 +01:00
Max Kellermann
501f1e6de0 PlaylistSong: remove the IsInDatabase() check
No caller passes a database song to this function, but if he does,
this check doesn't make sense.
2014-01-20 23:32:03 +01:00
Max Kellermann
414d5b648c PlaylistSong: don't map relative URI to absolute path
This didn't make sense.
2014-01-20 23:31:08 +01:00
Max Kellermann
a237e7f860 CommandLine: show the current git tag and commit id 2014-01-20 23:31:08 +01:00
Max Kellermann
07a3bef25c PlaylistSong: pass reference variables internally 2014-01-20 19:57:26 +01:00
Max Kellermann
da67260c95 new developer mailing list 2014-01-20 17:20:57 +01:00
Max Kellermann
2f51285349 Merge branch 'v0.18.x' 2014-01-20 09:05:36 +01:00
Max Kellermann
ab9c9068d4 Queue: rename struct queue to Queue
Works around a build failure on Solaris because annoyingly, Solaris
reserves the name "queue".  This rename was pending anyway.
2014-01-20 08:57:46 +01:00
Max Kellermann
6b4d7d7315 Queue: make the constructor "explicit" 2014-01-20 08:57:41 +01:00
Max Kellermann
64465c1318 Song: make the "parent" attribute mandatory
The Song class is only used for database songs now.  A Song without a
Directory is not possible anymore.
2014-01-19 23:16:09 +01:00
Max Kellermann
a506adea41 Directory: use Song::Export() 2014-01-19 23:16:08 +01:00
Max Kellermann
f5ae1ce00b LightSong: new class to be used by DatabasePlugin callbacks
Detach the Song class completely from the public API, only to be used
by SimpleDatabase and the update thread.
2014-01-19 17:04:51 +01:00
Max Kellermann
738d6f1040 db/proxy: simplify error handling in GetSong()
Check mpd_response_finish() before using mpd_song.  Don't skip this
check even if the mpd_song is non-nullptr.
2014-01-19 11:37:42 +01:00
Max Kellermann
ba372197fb db/simple: make borrowed_song_count "mutable"
Simpler to use than const_cast.
2014-01-19 11:23:02 +01:00
Max Kellermann
bde27ccec3 Tag: pack attributes tighter
This saves another 3% memory.
2014-01-19 03:11:01 +01:00
Max Kellermann
d2cf74027c Song: embed the Tag object statically into class Song
Reduces overhead because we need to manage only one memory allocation.
According to valgrind/massif, we save 7%.
2014-01-19 02:58:55 +01:00
Max Kellermann
bc966577ff Song: use the VarSize library 2014-01-18 19:24:55 +01:00
Max Kellermann
fdf4dff561 db/upnp: move Tag from UPnPDirObject to Song
The UPnPDirObject is a temporary object, we can move its contents.
This reduces runtime overhead.
2014-01-18 19:09:42 +01:00
Max Kellermann
fab6cbed75 db/upnp/Discovery: eliminate attribute "last_seen" 2014-01-18 16:28:12 +01:00
Max Kellermann
051eede1ed db/upnp/Discovery: use monotonic clock instead of time() 2014-01-18 16:26:11 +01:00
Max Kellermann
0696cac50b db/upnp/Discovery: eliminate full copy in getServer() 2014-01-18 16:18:51 +01:00
Max Kellermann
0c2485e86c db/upnp: use getServer() in Visit()
Reduce bloat.
2014-01-18 16:13:33 +01:00
Max Kellermann
7d696a7063 db/upnp/Discovery: eliminate Error attribute
Move code to method Start() and add Error& parameters to several
methods.
2014-01-18 16:08:30 +01:00
Max Kellermann
53573e950f db/upnp: remove unnecessary m_superdir nullptr checks 2014-01-18 16:02:21 +01:00
Max Kellermann
1e99983263 db/upnp: pass ContentDirectoryService references 2014-01-18 15:58:02 +01:00
Max Kellermann
5409e43fb5 db/upnp: cache m_path.back() 2014-01-18 15:44:41 +01:00
Max Kellermann
f33f891c54 db/upnp: add UpnpMakeAction() helper function 2014-01-18 15:27:54 +01:00
Max Kellermann
6e55552292 db/upnp/ixmlwrap: getFirstElementValue() returns const char *
Eliminate the std::string bloat.
2014-01-18 15:01:19 +01:00
Max Kellermann
e569f82dd3 db/upnp: merge duplicate nullptr check 2014-01-18 14:44:06 +01:00
Max Kellermann
1a4940bbda db/upnp: free IXML_Document *request manually 2014-01-18 14:38:52 +01:00
Max Kellermann
22dd3c8048 db/upnp/Device: move code to method Parse()
Forward the Error to the caller.
2014-01-18 14:29:31 +01:00
Max Kellermann
04b7648e00 db/upnp/Device: use ContentDirectoryDescriptor's move operator
Reduce bloat.
2014-01-18 14:26:24 +01:00
Max Kellermann
be0759d465 db/upnp/Discovery: don't copy XML to std::string
Pass "const char *" to Expat.
2014-01-18 14:24:38 +01:00
Max Kellermann
339d939873 db/upnp/Discovery: fix memory leak 2014-01-18 14:03:18 +01:00
Max Kellermann
c1950e40e6 db/upnp: remove unused typedef DevServIt 2014-01-18 13:42:54 +01:00
Max Kellermann
ad76bad8fd db/upnp: use move operator to assign XML CDATA
Reduce runtime bloat.
2014-01-18 13:39:31 +01:00
Max Kellermann
55737e4ff6 db/upnp/Util: trimstring() constructs string from buffer
Reduce overhead by omitting the part of the buffer that consists only
of whitespace.
2014-01-18 13:36:50 +01:00
Max Kellermann
f3b4ddee6c db/upnp/Discovery: free the response body
Memory leak.
2014-01-18 13:08:48 +01:00
Max Kellermann
758b504cf3 db/upnp/Discovery: don't copy the response body
Bloat.
2014-01-18 13:07:42 +01:00
Max Kellermann
416f7c2600 db/upnp: don't hold mutex while downloading device description
Must not perform blocking I/O while holding a mutex.
2014-01-18 13:04:01 +01:00
Max Kellermann
b9f02f22c4 db/upnp: don't use WorkQueue for _ADVERTISEMENT_BYEBYE
Remove the ContentDirectoryDescriptor right away.  Reduces bloat.
2014-01-18 12:56:35 +01:00
Max Kellermann
b635610409 db/upnp: include cleanup 2014-01-18 12:51:25 +01:00
Max Kellermann
d4d4d6217f db/upnp: don't use LazyDatabase
Now that MPD forks early, this workaround is obsolete.
2014-01-18 12:48:28 +01:00
Max Kellermann
be47320a05 Daemon: fork as early as possible
Keep the parent process around until MPD has finished initializing.

This is important for libraries that are allergic to fork(), such as
libupnp.
2014-01-18 12:42:30 +01:00
Max Kellermann
9f3ce7551a PidFile: open in write-only mode 2014-01-18 12:42:12 +01:00
Max Kellermann
5f3b79e21d Daemon: move code to class PidFile 2014-01-18 12:10:20 +01:00
Max Kellermann
56c12bd1ea Daemon: don't use daemon(), always require fork()
Prepare for more advanced daemonization code, which will not work with
daemon().  Let's just require fork().  Everybody who supports daemon()
also supports fork().
2014-01-18 11:46:28 +01:00
Max Kellermann
3a6da7c594 Main: make variables more local 2014-01-18 11:34:13 +01:00
Max Kellermann
9909a80d6a Main: eliminate variable "success" 2014-01-18 11:20:20 +01:00
Max Kellermann
a52cae1dba pcm/Volume: make DSD a no-op
Kludge to work around DSD playback failure because the
ReplayGainFilterPlugin is always in the filter chain.
2014-01-17 23:57:30 +01:00
Max Kellermann
61b01f82ef Mapper: add function map_song_detach()
Make the DetachedSong(Song) conversion constructor private.  Everybody
should use map_song_detach() which will take over more
responsibilities soon.
2014-01-17 23:51:14 +01:00
Max Kellermann
75b847132a QueueSave: use DatabaseDetachSong() 2014-01-17 23:49:53 +01:00
Max Kellermann
32ec672311 DatabaseSong: new library merging duplicate code 2014-01-17 22:58:27 +01:00
Max Kellermann
e2812f722d db/upnp/Discovery: move callbacks and data structures into class
Eliminate global variables.
2014-01-17 10:13:04 +01:00
Max Kellermann
aa64a5328e db/upnp: split cluCallback() 2014-01-17 09:46:51 +01:00
Max Kellermann
59510f509a db/upnp: add local reference variables
Prepare to refactor some code.
2014-01-17 00:17:20 +01:00
Max Kellermann
a35c7bc81a db/upnp: move the LibUPnP instance to class UpnpDatabase
Delete the object when closing the database.
2014-01-16 09:30:24 +01:00
Max Kellermann
02769929b3 db/upnp: remove useless static Mutex 2014-01-16 09:29:11 +01:00
Max Kellermann
1a09003a6e db/upnp: move the UPnPDeviceDirectory instance to class UpnpDatabase
Delete the object when closing the database.
2014-01-16 09:08:04 +01:00
Max Kellermann
a827714823 db/upnp: don't initialize attributes to nullptr
Not necessary, these are not used.
2014-01-16 09:07:52 +01:00
Max Kellermann
8f9e76ca42 db/upnp: remove redundant m_root nullptr checks 2014-01-16 08:51:39 +01:00
Max Kellermann
478ace984a db/upnp/WorkQueue: use emplace() and std::move() 2014-01-16 08:46:41 +01:00
Max Kellermann
028fd268b8 db/upnp/WorkQueue: simplify start() 2014-01-16 08:43:57 +01:00
Max Kellermann
876a095166 Directory: initialize "mtime" and "have_stat" 2014-01-15 18:53:53 +01:00
Max Kellermann
14c3ff58a4 db/upnp/WorkQueue: fix pthread_t[] allocation size
Was using the wrong variable.
2014-01-15 18:51:10 +01:00
Max Kellermann
2819b302c3 db/upnp/Object: remove obsolete attribute "m_title" 2014-01-15 18:36:01 +01:00
Max Kellermann
9fb82f9687 DetachedSong: add method Update()
Don't create an intermediate Song instance when all we want is a
DetachedSong.
2014-01-15 12:05:44 +01:00
Max Kellermann
df80deb070 DetachedSong: remove misplaced std::move() 2014-01-15 11:52:17 +01:00
Max Kellermann
5fb72d7c8f Merge branch 'v0.18.x' 2014-01-15 11:47:49 +01:00
Max Kellermann
313d1d5d83 decoder/ffmpeg: support libav v10_alpha1 2014-01-15 11:33:18 +01:00
Max Kellermann
b7d6133593 decoder/ffmpeg: include cleanup 2014-01-15 11:31:51 +01:00
Max Kellermann
5b6bb114ad decoder/ffmpeg: check for av_samples_get_buffer_size() errors
Fixes potential nullptr dereference.
2014-01-15 11:25:58 +01:00
Max Kellermann
56f082c9d4 util/PeakBuffer: fix nullptr dereference when peak_size==0 2014-01-15 11:24:29 +01:00
Max Kellermann
a1b798e555 SongFilter, TagConfig: cast TAG_NUM_OF_ITEM_TYPES to integer
Fixes clang warning.
2014-01-15 11:23:41 +01:00
Max Kellermann
c91e08fbfd OutputAPI: fix typo in include guard 2014-01-15 11:22:59 +01:00
Max Kellermann
f882434547 configure.ac: prepare for 0.18.8 2014-01-15 11:22:06 +01:00
Max Kellermann
f1ca17f6a1 decoder/ffmpeg: check for av_samples_get_buffer_size() errors
Fixes potential nullptr dereference.
2014-01-14 23:16:07 +01:00
Max Kellermann
fe7cda57e4 util/PeakBuffer: fix nullptr dereference when peak_size==0 2014-01-14 23:07:04 +01:00
Max Kellermann
a3f9abcbd1 SongFilter, TagConfig: cast TAG_NUM_OF_ITEM_TYPES to integer
Fixes clang warning.
2014-01-14 22:40:07 +01:00
Max Kellermann
77041e2cd2 input/alsa: fix memory leak
Don't duplicate the MIME type when it gets passed to a std::string.
2014-01-14 22:38:30 +01:00
Max Kellermann
14235f171b decoder/sidplay: use free() instead of g_free()
This pointer was allocated by libc, not by GLib.
2014-01-14 22:35:07 +01:00
Max Kellermann
1f90e3ce7f playlist/extm3u: allocate Tag instance on the stack
Automate the life cycle, making the code safer.
2014-01-14 22:33:31 +01:00
Max Kellermann
676d8bb624 db/upnp/Object: add attribute "tag"
Replaces "m_title" and "m_props".  More bloat removed.
2014-01-14 22:33:18 +01:00
Max Kellermann
4bcaf5d306 db/upnp: move upnp_tags to Tags.cxx 2014-01-14 22:33:18 +01:00
Max Kellermann
70d3ad3ca1 OutputAPI: fix typo in include guard 2014-01-14 22:33:18 +01:00
Max Kellermann
46debfb8b5 db/upnp/Object: disallow copying, always move
Reduce bloat.
2014-01-14 14:11:07 +01:00
Max Kellermann
9a4b572d34 db/upnp: getTagValue() returns string pointer
Reduce bloat.
2014-01-14 13:42:08 +01:00
Max Kellermann
ddc75cc46b db/upnp/Directory: merge m_containers and m_items
There is no use in duplicating these containers.  It only means that
we have to search both, duplicating the code.
2014-01-14 13:37:21 +01:00
Max Kellermann
dafd0bc49a db/upnp: pass const reference to getTagValue() 2014-01-14 13:37:05 +01:00
Max Kellermann
2cb912e4f4 db/upnp: Namei() returns error when no object was found
Don't fail silently.
2014-01-14 12:34:49 +01:00
Max Kellermann
91a513e87d db/upnp/Directory: eliminate one std::string copy with std::move() 2014-01-14 12:27:21 +01:00
Max Kellermann
efdb41f2a6 db/upnp/Object: add attribute "name"
Call titleToPathElt() only once for each object.
2014-01-14 12:22:37 +01:00
Max Kellermann
26b850c15c db/upnp: use std::replace() in titleToPath() 2014-01-14 12:15:21 +01:00
Max Kellermann
9941735ae7 db/upnp: pass std::string to titleToPathElt() 2014-01-14 12:03:36 +01:00
Max Kellermann
29e5dc4413 db/upnp: don't sanitize the title tag
We need this only for path names.
2014-01-14 12:00:58 +01:00
Max Kellermann
3a660c5527 db/upnp/WorkQueue: remove unused attributes "high", "low" 2014-01-14 11:49:42 +01:00
Max Kellermann
738991494a db/upnp/WorkQueue: initialize "ok" to false, eliminate redundant checks 2014-01-14 11:48:19 +01:00
Max Kellermann
ee4c3ff1b8 db/upnp/WorkQueue: remove IsOK() check from put()
Not necessary, not worth the check.
2014-01-14 11:46:18 +01:00
Max Kellermann
60486bcc46 db/upnp/WorkQueue: remove redundant n_workers_exited check from IsOK() 2014-01-14 11:43:18 +01:00
Max Kellermann
79eed5182e db/upnp/WorkQueue: include cleanup 2014-01-14 11:41:28 +01:00
Max Kellermann
5de0f3f36a db/upnp/WorkQueue: remove unnecessary "waiting" attributes 2014-01-14 11:38:48 +01:00
Max Kellermann
9f316e11bd db/upnp/WorkQueue: remove unused method waitIdle()
Contrary to setTerminateAndWait()'s documentation, the method does
wait for worker threads to exit via pthread_join().
2014-01-14 11:31:49 +01:00
Max Kellermann
c6d8f6da70 db/upnp/WorkQueue: use array instead of std::list
Reduce bloat further.
2014-01-14 11:23:13 +01:00
Max Kellermann
73fd98b82e db/upnp/WorkQueue: use std::list instead of std::unordered_map
Reduce bloat.
2014-01-14 11:11:08 +01:00
Max Kellermann
6cb725391d db/upnp/WorkQueue: rename attributes 2014-01-14 11:07:06 +01:00
Max Kellermann
c13facdaca db/upnp/WorkQueue: pass reference to take() 2014-01-14 11:07:00 +01:00
Max Kellermann
e259474362 db/upnp/WorkQueue: remove unused method qsize() 2014-01-14 11:06:55 +01:00
Max Kellermann
7740855a78 db/upnp/WorkQueue: remove unused "szp" parameter from take() 2014-01-14 11:06:43 +01:00
Max Kellermann
d605170f9f db/upnp/WorkQueue: remove unused statistics 2014-01-14 10:51:33 +01:00
Max Kellermann
4734af747b OutputThread: use real-time priority 2014-01-14 09:59:04 +01:00
Max Kellermann
5d17731b73 UpdateGlue: let the update thread run at "idle" priority
The update thread should not affect the rest of the system, therefore
set "idle" priority, and let it only run when nobody else is using the
resources.
2014-01-14 09:09:52 +01:00
Max Kellermann
07a7fde825 Merge branch 'shine' of git://github.com/ekroth/mpd 2014-01-13 22:54:15 +01:00
Max Kellermann
049abef2d4 input/despotify: change name to "despotify"
The name "spt" didn't make much sense for this plugin.
2014-01-13 22:35:30 +01:00
Max Kellermann
7c60b50a39 CommandLine: print list of database plugins 2014-01-13 22:31:55 +01:00
Max Kellermann
4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Andrée Ekroth
cd5817b67e encoder/shine: fix segfault workaround
Initializing and closing the Shine library without
writing any data results in a segmentation fault.
The current workaround writes zeroes if there was
no actual data.
2014-01-13 22:28:29 +01:00
Max Kellermann
a4d580a6f8 db/upnp: add fallback for emplace()
The method emplace() was added in gcc 4.8.  This commit restores
compatibility with gcc 4.7.
2014-01-13 22:24:48 +01:00
Max Kellermann
ca43e634b5 db/upnp: use std::function for the libupnp callback
Replaces the bloated std::map.
2014-01-13 22:24:02 +01:00
Max Kellermann
85324f80fe db/upnp: fix "upnp:class" parser
"upnp:class" is an element, not an attribute of element "item".  This
fixes a regression from commit 65ebfb16
2014-01-13 22:23:00 +01:00
Andrée Ekroth
56a7fcf189 encoder/shine: remove unnecessary buffer
Now writes to the de-interleaved buffers directly,
instead of writing to an intermediate fifo buffer.

Fix indentation and 80 char width lines.
2014-01-13 17:55:12 +01:00
Max Kellermann
8cd15a02cd Merge tag 'release-0.18.7' 2014-01-13 11:52:35 +01:00
Max Kellermann
05ad335ae9 release v0.18.7 2014-01-13 11:39:27 +01:00
Andrée Ekroth
ea771c17c5 Shine encoding plugin
This encoding plugin features a fixed-point mp3 encoder,
with faster encoding on architectures without a FPU.

Right now the encoder is limited to stereo and 16 bit depth.
The bitrate and sample rate can be modified in audio_output.

audio_output {
        type            "httpd"
        name            "My shine stream"
        encoder         "shine"
        port            "8000"
        format          "44100:16:2"
        bitrate         "320"  # default: 128
}
2014-01-13 11:14:19 +01:00
Max Kellermann
7faeb2ff2b configure.ac: reject libmpcdec SV7 in configure script
Look for symbol "mpc_demux_init" which does not exist in SV7.  This
avoids build failures when SV7 was found by configure.ac.
2014-01-11 21:02:12 +01:00
Max Kellermann
65ebfb16c9 db/upnp/Directory: parse item_class in StartElement
Don't add to the std::map.
2014-01-11 01:40:21 +01:00
Max Kellermann
44a65fc5de db/upnp/Object: add attribute "url"
Don't store in the std::map.
2014-01-11 01:36:08 +01:00
Max Kellermann
f031eb1ef2 db/upnp/Directory: parse duration
Don't put all <res/> attributes to the attributes map; parse the
"duration" attribute as soon as we receive it, and store it in an
integer attribute.  This reduces bloat.
2014-01-11 01:31:13 +01:00
Max Kellermann
b50d79542c db/upnp: move stringToTokens() to Util.cxx 2014-01-11 01:30:05 +01:00
Max Kellermann
8351543c0f db/upnp: move lazy Open() call to new class LazyDatabase
Generic approach for the workaround.
2014-01-11 01:25:22 +01:00
Max Kellermann
8add78ed5e db/upnp/discovery: convert std::strings to const char *
Reduce bloat.
2014-01-11 01:21:54 +01:00
Max Kellermann
4b3a3d6faa db/upnp: remove unnecessary Mutex 2014-01-11 01:16:35 +01:00
Max Kellermann
71d012fa61 db/proxy: forward "idle" events
Send "idle" to the other MPD whenever there's nothing else to do and
forward incoming "idle database" events to all our MPD clients.
2014-01-11 01:11:19 +01:00
Max Kellermann
114df1f137 DatabasePlugin: add interface DatabaseListener
Allow database plugins to announce that they have been modified.
2014-01-11 01:01:54 +01:00
Max Kellermann
00adf7ff17 db/proxy: move code to Disconnect() 2014-01-11 00:46:33 +01:00
Max Kellermann
3f0415fa24 UpdateGlue: move stats_invalidate() call to Instance::DatabaseModified() 2014-01-11 00:46:33 +01:00
Max Kellermann
348d0c944e Stats: lazy initialization
Ask the DatabasePlugin for stats when the first client requests them,
not at startup.
2014-01-10 23:42:46 +01:00
Max Kellermann
e9ba5fcaf3 db/upnp: remove unused method setMaxContentLength() 2014-01-10 23:04:50 +01:00
Max Kellermann
48097745f6 db/upnp: remove "upnplog" option
We have removed all libupnp logging calls, and we don't need to debug
libupnp.
2014-01-10 23:00:27 +01:00
Max Kellermann
1091ca969f db/upnp: remove unused macro PLOGINF() 2014-01-10 23:00:18 +01:00
Max Kellermann
09d62cc630 db/upnp: remove unused method errAsString() 2014-01-10 23:00:10 +01:00
Max Kellermann
a2ead993e6 db/upnp/Device: remove unused attribute "m_tabs" 2014-01-10 23:00:03 +01:00
Max Kellermann
b330aa8dd5 db/upnp: remove unnecessary empty string checks from CharacterData() 2014-01-10 22:59:46 +01:00
Max Kellermann
1b8053a618 db/upnp/Directory: simplify checkobjok() 2014-01-10 22:59:28 +01:00
Max Kellermann
70e5ab3fde db/upnp/Directory: don't log unknown items 2014-01-10 22:59:16 +01:00
Max Kellermann
f4490f6918 db/upnp/Directory: eliminate the "attributes" std::map
Look up attributes in the "atts" array.  Reduce bloat.
2014-01-10 22:59:01 +01:00
Max Kellermann
dadd987bf4 db/upnp/Directory: move "res" attributes to array
Reduce bloat.
2014-01-10 22:58:37 +01:00
Max Kellermann
a1ced29279 db/upnp: use nullptr-terminated array
Reduce bloat.
2014-01-10 22:58:23 +01:00
Max Kellermann
791d6c1336 db/upnp/Directory: eliminate struct StackEl, use std::string
Reduces bloat.
2014-01-10 22:57:57 +01:00
Max Kellermann
10abb07960 db/upnp/Directory: make "attributes" a local variable
We only need it inside StartElement().  Reduces bloat.
2014-01-10 22:57:46 +01:00
Max Kellermann
040a5ddad5 db/upnp/Directory: move "res" tag handler to StartElement()
No need to handle this in EndElement() - in StartElement(), we already
have all we need.
2014-01-10 22:57:22 +01:00
Max Kellermann
e7eb04954d db/upnp/Directory: don't use std::map to parse upnp:class
Reduce excessive bloat.
2014-01-10 22:57:16 +01:00
Max Kellermann
09b00fa4e3 db/upnp/Object: use strictly-typed enums
At the same time, rename the enum types and the class attributes, and
add an "UNKNOWN" type/class.  The latter avoids the "-1" hack.
2014-01-10 22:56:52 +01:00
Max Kellermann
74842fd6d4 db/upnp: getprop() returns const char *
Return the return value, instead returning it in a reference
parameter.  Reduces bloat by reducing unnecessary std::string usage.
2014-01-10 22:56:45 +01:00
Max Kellermann
f23b47ba17 Expat: attributes come in name/value pairs (bug fix)
I wrongfully assumed that each array element is a name and a value
concatenated.
2014-01-10 22:56:28 +01:00
Max Kellermann
15eedfbb12 db/upnp: don't set mtime, start_ms, end_ms
Not necessary or useful.
2014-01-10 09:01:28 +01:00
Max Kellermann
cfc25e08dc db/upnp: use TagTable in upnpItemToSong()
Reduces bloat by eliminating one std::map.
2014-01-10 08:57:31 +01:00
Max Kellermann
1583eb36e4 doc/user: mention the upnp database plugin 2014-01-09 20:59:51 +01:00
Jean-Francois Dockes
406452f019 UPnP database plugin
[mk: renamed source files, applied coding style, reduced bloat, using
MPD's threading library, using MPD's error reporting and logging
library and refactoring, fixed lots of bugs]
2014-01-09 20:56:00 +01:00
Max Kellermann
12b139beaf ExpatParser: add Parse() overload with buffer 2014-01-09 20:56:00 +01:00
Max Kellermann
2ed1c22227 ExpatParser: add helper class CommonExpatParser 2014-01-09 20:56:00 +01:00
Max Kellermann
eb23ef1747 event/Loop: allow AddTimer() after Run() has returned
Kludge for libavahi-client quirk.
2014-01-09 20:56:00 +01:00
Max Kellermann
970b10d01b tag/TagTable: add lookup TagType -> name 2014-01-09 19:01:03 +01:00
Max Kellermann
61b938d6fa event/Loop: allow scheduling events before Run()
Add the debug-only flag "virgin" which gets checked by assert()
calls.  Fixes assertion failures when using zeroconf/avahi.
2014-01-09 17:52:55 +01:00
Max Kellermann
0c34555b02 Directory: remove method Free() 2014-01-09 13:21:56 +01:00
Max Kellermann
83a988e2e4 db/proxy: allocate Directory instance on the stack 2014-01-09 13:21:09 +01:00
Max Kellermann
91efe1cb5a Directory: convert to fixed-size struct
Using a variable-size struct with embedded string is not worth the
trouble here.  There are not so many Directory objects.
2014-01-09 13:14:14 +01:00
Max Kellermann
735241f049 Timer: remove unused method Synchronize() 2014-01-09 12:56:57 +01:00
Max Kellermann
dd82370a80 playlist/{asx,rss,xspf}: use Expat instead of GLib to parse XML 2014-01-09 12:19:52 +01:00
Max Kellermann
dab052e53d playlist/asx: make variables more local 2014-01-09 12:18:13 +01:00
Max Kellermann
322b061632 DetachedSong: fork of struct Song
From now on, struct Song will be used by the database only, and
DetachedSong will be used by everybody else.  DetachedSong is easier
to use, but Song has lower overhead.
2014-01-09 09:05:58 +01:00
Max Kellermann
43847f2244 test/DumpDatabase: fix nullptr dereference 2014-01-09 09:05:58 +01:00
Max Kellermann
8f9ba96c59 SongUpdate: move code to handle_lsinfo()
Don't create a temporary Song object in handle_lsinfo().  Instead,
print all tags while parsing the remote file.
2014-01-08 23:35:37 +01:00
Max Kellermann
10406c73b3 SongSave: make variables more local 2014-01-08 23:10:24 +01:00
Steven O'Brien
67a6a12916 doc/user.xml: add alsa input section 2014-01-08 23:02:21 +01:00
Max Kellermann
139122c57f Merge branch 'v0.18.x' 2014-01-08 22:14:12 +01:00
Max Kellermann
fdd76b3461 decoder/faad: fix memory leak 2014-01-08 22:11:00 +01:00
Max Kellermann
959d7ca9d0 valgrind.suppressions: add libsmbclient suppressions 2014-01-08 20:57:53 +01:00
Max Kellermann
e490e5d0ab playlist/pls: don't free stack buffer 2014-01-08 19:50:44 +01:00
Max Kellermann
3b568b0943 playlist/pls: make variables more local 2014-01-08 19:50:10 +01:00
Max Kellermann
b2e1b38864 playlist/pls: convert "while" loop to "for" loop 2014-01-08 19:50:05 +01:00
Max Kellermann
5c6fe97b35 playlist/pls: simplify error handler
Don't pass a GError** to g_key_file_get_X().  We don't need to dispose
something we didn't request in the first place.
2014-01-08 19:49:34 +01:00
Max Kellermann
2071070f39 DespotifyUtils: return Tag, not pointer 2014-01-08 19:49:27 +01:00
Max Kellermann
89a78a5f3c DespotifyUtils: pass const ds_track reference 2014-01-08 19:49:21 +01:00
Max Kellermann
bc23a6bb05 tag/TagBuilder: overload Commit() returning a Tag object 2014-01-08 19:49:08 +01:00
Max Kellermann
ac1983eae3 tag/TagBuilder: rename Commit() to CommitNew() 2014-01-08 19:48:55 +01:00
Steven O'Brien
33c5fc95b4 input/AlsaInputPlugin: remove unnecessary alsa s/w param setting to fix high CPU load issue 2014-01-08 14:00:42 +01:00
Max Kellermann
6a953394f4 SongSticker: use Song references 2014-01-08 00:41:08 +01:00
Max Kellermann
c152a88ff6 PlayerThread: use Song references 2014-01-08 00:36:59 +01:00
Max Kellermann
cbf57e7421 DecoderThread: use Song references 2014-01-08 00:35:28 +01:00
Max Kellermann
3f3ae48ff4 test: add missing includes 2014-01-07 23:57:39 +01:00
Max Kellermann
27ca0db7a6 util/Alloc: new library replacing GLib's g_malloc() 2014-01-07 23:35:18 +01:00
Max Kellermann
49f34fbf68 DecoderBuffer: use NewVarSize() 2014-01-07 23:31:26 +01:00
Max Kellermann
fe6094a822 tag/TagPool: use NewVarSize() to allocate TagPoolSlot 2014-01-07 23:24:59 +01:00
Max Kellermann
8a30c7992d tag/TagPool: rename struct slot to TagPoolSlot 2014-01-07 23:12:24 +01:00
Max Kellermann
70eb9335bd tag/TagPool: use gcc_packed instead of mpd_packed
By accident, this declared a global variable instead of adding the
"packed" attribute.
2014-01-07 23:11:00 +01:00
Max Kellermann
da80f91e1c Directory: make some code generic, move to VarSize.hxx 2014-01-07 23:10:56 +01:00
Max Kellermann
cc60d193ce Directory: use g_malloc() instead of g_malloc0()
Explicit attribute initialization.
2014-01-07 23:10:56 +01:00
Max Kellermann
3a05c421e0 doc/user: fix typo 2014-01-07 18:06:58 +01:00
Max Kellermann
0f99410ba1 playlist/soundcloud: parse URI without copying it 2014-01-07 10:21:42 +01:00
Max Kellermann
442dadd6fe playlist/soundcloud: change scheme check to assertion
The MPD core takes care for checking the scheme.
2014-01-07 09:40:31 +01:00
Max Kellermann
da9dd58f34 playlist/soundcloud: eliminate nullptr checks before g_free() 2014-01-07 09:27:50 +01:00
Max Kellermann
bd01d80ffc pcm/Utils: remove unused function pcm_end_pointer() 2014-01-07 00:46:47 +01:00
Max Kellermann
7eda72d440 pcm/Volume: use number of samples instead of end pointer 2014-01-07 00:42:02 +01:00
Max Kellermann
c75339edcc pcm/Format: change parameters/return values to ConstBuffer 2014-01-06 23:08:49 +01:00
Max Kellermann
b0b7244b3a pcm/Format: use number of samples instead of end pointer 2014-01-06 22:42:33 +01:00
Max Kellermann
a9e849ff4f DecoderBuffer: _read() returns ConstBuffer object 2014-01-06 22:17:30 +01:00
Max Kellermann
4c95a4d7c6 DecoderBuffer: add "pure" attributes 2014-01-06 22:16:56 +01:00
Max Kellermann
eac9fabd48 DecoderBuffer: add method _clear() 2014-01-06 21:59:43 +01:00
Max Kellermann
e2a08fa824 decoder/faad: make variables more local 2014-01-06 21:57:40 +01:00
Max Kellermann
d403749d09 decoder/faad: eliminate local variable "ret" 2014-01-06 21:57:40 +01:00
Max Kellermann
582c2105a9 event/Loop: cancel the WakeFD monitor in destructor 2014-01-06 21:57:40 +01:00
Steven O'Brien
f39a34ccfa input/AlsaInputPlugin.cxx: use I/O thread to poll for available data
[mk: modified to use MultiSocketMonitor instead of SocketMonitor]
2014-01-06 18:27:44 +01:00
Max Kellermann
08f5b9f1f9 event/MultiSocketMonitor: add method ClearSocketList() 2014-01-06 18:27:26 +01:00
Max Kellermann
793962c5b8 event/SocketMonitor: don't close the socket automatically
Users now have to call Close() explicitly.  This simplifies using the
class, as most users have automatic socket management already, and
Steal() had to be used often.
2014-01-06 18:26:55 +01:00
Max Kellermann
0d20130d07 util/Cast: new utility library 2014-01-06 18:21:45 +01:00
Max Kellermann
617090cfda event/IdleMonitor: cancel in destructor only if active
Debug-mode workaround for bogus assertion failure.
2014-01-06 18:21:45 +01:00
Max Kellermann
a9e604d51d event/MultiSocketMonitor: API documentation 2014-01-06 08:59:27 +01:00
Max Kellermann
e599b86424 event/Loop: try to avoid the WakeFD when adding DeferredMonitor
Add a flag that indicates whether the EventLoop is currently "busy".
As long as that flag is set, it does not need to be woken up - we can
simply add the DeferredMonitor to the list, and it will be caught by
EventLoop very soon.  This eliminates nearly all of the
DeferredMonitor overhead when compared to IdleMonitor, rendering
IdleMonitor mostly obsolete.
2014-01-05 02:15:34 +01:00
Max Kellermann
da9e584921 event/Loop: combine multiple WakeFD::Write() calls
Reduce DeferredMonitor overhead.
2014-01-05 02:15:10 +01:00
Max Kellermann
e9d764d7ad event/Loop: add attribute "again"
Improved support for added events.
2014-01-05 02:15:01 +01:00
Max Kellermann
6268955778 event/Loop: add thread-safety assertions 2014-01-05 02:14:31 +01:00
Max Kellermann
4ddfc6e9a2 output/httpd: move the clients.clear() call to the IOThread
This call is not thread-safe.
2014-01-05 02:13:35 +01:00
Max Kellermann
dcbc05a9cd output/httpd: import GetEventLoop() 2014-01-05 02:13:21 +01:00
Max Kellermann
4c705334fa ClientList: use "delete" instead of Client::Close()
Client::Close() installs a TimeoutMonitor, which is not something we
should do during shutdown.
2014-01-05 02:07:49 +01:00
Max Kellermann
c12da599b9 event/Loop: remove obsolete assertion 2014-01-05 01:41:03 +01:00
Max Kellermann
f685a48008 event/Loop: move code to HandleDeferred() 2014-01-05 01:35:12 +01:00
Max Kellermann
7c15e41da5 event/MultiSocketMonitor: add missing <algorithm> include
For std::find_if().
2014-01-05 01:35:12 +01:00
Max Kellermann
7b540f0226 event/MultiSocketMonitor: add method ReplaceSocketList()
Move code from AlsaMixerPlugin.
2014-01-05 01:28:36 +01:00
Max Kellermann
e29c22e662 event/MultiSocketMonitor: include cleanup 2014-01-05 00:39:29 +01:00
Max Kellermann
f0d3b47ad8 event/Loop: remove the GLib implementation
Now that the remaining known bugs in poll() implementation are fixed,
we can go on without the GLib implementation.
2014-01-04 19:31:23 +01:00
Max Kellermann
bfe7533546 output/httpd: move Bind()/Unbind() to the IOThread
Fixes more thread-safety bugs.
2014-01-04 19:29:51 +01:00
Max Kellermann
880bf17dae event/poll: eliminate one vector::size() call 2014-01-04 19:10:21 +01:00
Max Kellermann
c9da3363a0 output/httpd: move all broadcast operations to the IOThread
Add a Page queue to class HttpdOutput, and use DeferredMonitor to
flush this queue inside the IOThread.  This fixes a thread-safety
issue: much of EventLoop is not thread-safe, and the httpd plugin
ignored that problem.
2014-01-04 18:22:55 +01:00
Max Kellermann
9bd4ed3e60 output/httpd: use the IOThread
Do all I/O in the IOThread and not in the main thread.  This solves an
upcoming deadlock problem.
2014-01-04 18:21:40 +01:00
Max Kellermann
68fcc19565 output/httpd: move queue size check to HttpdClient::PushPage()
Don't let the server care for client problems.
2014-01-04 17:42:03 +01:00
Max Kellermann
8e4efd071e output/httpd: wrap the std::list in std::queue 2014-01-04 17:12:59 +01:00
Max Kellermann
f2ad9f6fad output/httpd: merge duplicate code to ClearQueue() 2014-01-04 17:11:22 +01:00
Max Kellermann
968c5eb767 output/httpd: keep track of queue size
Don't iterate the std::list each time.
2014-01-04 17:06:05 +01:00
Max Kellermann
19424e95db event/Loop: remove bogus "!quit" assertion
Commit 1f11959 allowed modifying the "quit" attribute from any thread,
and thus the assertion may fail spuriously.  This assertion is too
strict for the relaxed use of "quit".  Let's remove it and move the
"quit" check to before the SockedMonitor::Dispatch() call.
2014-01-04 17:06:05 +01:00
Max Kellermann
0f9ef2506f event/Loop: remove unused method AddCall() 2014-01-04 16:00:45 +01:00
Max Kellermann
1f1195975f event/Loop: non-recursive Break() implementation
Simply set the "quit" flag and wake up the thread.  This works even if
we're inside this thread.  Setting "quit" to a new value without mutex
protection is usually not safe, but good enough here.
2014-01-04 15:59:00 +01:00
Max Kellermann
87fce8ef27 mixer/alsa: use DeferredMonitor to update file descriptors
EventLoop::AddCall() and EventLoop::AddIdle() are unsafe, because we
can't cancel those calls.
2014-01-04 15:58:59 +01:00
Max Kellermann
d2a4f64fd6 event/BlockingCall: always use DeferredMonitor internally
There is no advantage of using EventLoop::AddCall(), now that
DeferredMonitor is thread-safe.
2014-01-04 15:58:59 +01:00
Max Kellermann
a357d84dce event/DeferredMonitor: make fully thread-safe
Instead of creating a new eventfd for each DeferredMonitor instance,
reuse EventLoop's eventfd, and add a std::list to EventLoop that
manages the list of pending DeferredMonitors.  This std::list is
protected by the same mutex as the "calls" list.

The bottom line is: reduced overhead because the per-instance eventfd
was eliminated, slightly added overhead due to Mutex usage (but
negligible), and we're thread-safe now.

This subsystem is now good enough to replace EventLoop::AddCall().
2014-01-04 15:58:59 +01:00
James McGlashan (DarkFox)
48c96bbaea Added application key for soundcloud plugin 2014-01-04 14:01:17 +01:00
James McGlashan (DarkFox)
c666794ce3 Added soundcloud documentation 2014-01-04 14:01:12 +01:00
James McGlashan (DarkFox)
1ee3df6976 Added user and search paramaters for SoundCloud plugin 2014-01-04 13:36:24 +01:00
James McGlashan (DarkFox)
d4dea53ae9 http -> https for SoundCloud plugin 2014-01-02 12:29:45 +01:00
Max Kellermann
d477a9222e output/httpd: change "struct" to "class" 2013-12-31 17:04:40 +01:00
Max Kellermann
69a9d29190 output/httpd: move code to methods Delay(), Play(), Cancel() 2013-12-31 17:01:08 +01:00
Max Kellermann
e2425592b6 output/httpd: move Cast() into the class 2013-12-31 16:59:24 +01:00
Max Kellermann
964b2661d8 output/httpd: add methods Init(), Finish() 2013-12-31 16:55:26 +01:00
Max Kellermann
8b65b524d5 output/httpd: use reference instead of pointer 2013-12-31 16:32:33 +01:00
Max Kellermann
f1ac2cd336 output/httpd: make the HttpdClient base class "private" 2013-12-31 16:24:51 +01:00
Max Kellermann
e73d0df2b6 event/*Monitor: document as not being thread-safe 2013-12-31 15:59:41 +01:00
Max Kellermann
af3f483924 event/Loop: document that AddCall() is thread-safe 2013-12-31 15:31:59 +01:00
Max Kellermann
809b0eb1f5 command: "lsinfo" and "readcomments" allowed for remote files 2013-12-29 18:25:32 +01:00
Max Kellermann
b5f3bfce92 SongUpdate: read tags from songs in an archive
Add the TagStream.cxx library, similar to TagFile.cxx, and use it to
load tags from song files inside archives.
2013-12-29 18:15:30 +01:00
Max Kellermann
aeb2baa495 InputStream: add static method OpenReady()
Merge some duplicate code.
2013-12-29 18:08:49 +01:00
Max Kellermann
afc70c120e util/UriUtil: uri_get_suffix() fails if name begins with dot
A file called ".jpg" is not a JPEG file with an empty name; it is
merely a hidden file.
2013-12-29 17:40:51 +01:00
Max Kellermann
ea9aff1d3f TagFile: rewind the stream before trying the next plugin
Got lost in commit c97685fe
2013-12-29 17:09:59 +01:00
Max Kellermann
cecae419fb DecoderList: add "pure" attribute 2013-12-29 17:06:59 +01:00
Max Kellermann
df4db50904 DecoderList: add function decoder_plugins_supports_suffix()
Replaces decoder_plugin_from_suffix().
2013-12-29 16:59:57 +01:00
Max Kellermann
decc4002a0 DecoderThread: use decoder_plugins_try()
.. instead of decoder_plugin_from_suffix().  This reduces overhead by
walking the array only once.
2013-12-29 16:51:18 +01:00
Max Kellermann
5bb563e3bc UpdateContainer: pass suffix instead of DecoderPlugin
Instead of using the first DecoderPlugin that supports the suffix, use
the first one that actually implements the "container_scan" method.
2013-12-29 16:46:02 +01:00
Max Kellermann
9be82891b0 TagFile: pass reference instead of pointer 2013-12-29 16:24:04 +01:00
Max Kellermann
c97685fe6c TagFile: use decoder_plugins_try()
.. instead of decoder_plugin_from_suffix().  This reduces overhead by
walking the array only once.
2013-12-29 16:13:11 +01:00
Max Kellermann
358b671033 DecoderList: remove unused function decoder_plugin_from_mime_type() 2013-12-29 15:53:55 +01:00
Max Kellermann
92a4bf4441 Merge branch 'v0.18.x' 2013-12-29 14:18:19 +01:00
Max Kellermann
d7f80eab68 configure.ac: improved check for libyajl 1.0
If we have libyajl 2.0.1 (without a pkg-config file), our configure.ac
would assume this is the libyajl 1.0 API, because the function
yajl_alloc() exists in both.  This commit changes the library check to
the function yajl_parse_complete() which was removed in the 2.0 API.
This fixes build failure with libyajl 2.0.1.
2013-12-29 14:12:33 +01:00
Max Kellermann
e30b356eb0 daemon: no initgroups() when already running as the configured user
We can assume that initgroups() would be a no-op in that case, however
initgroups() is not allowed for unprivileged users anyway.
2013-12-29 13:59:05 +01:00
Max Kellermann
09a0803116 Daemon: fix typo in comment 2013-12-29 13:59:05 +01:00
Max Kellermann
20ffedc745 Daemon: simplify nested "if" 2013-12-29 13:57:12 +01:00
Max Kellermann
0b1ad27ba8 Daemon: fix typo in cast 2013-12-29 13:47:29 +01:00
Max Kellermann
6a1b2f0387 configure.ac: prepare for 0.18.7 2013-12-29 10:40:59 +01:00
Max Kellermann
5465647c2e input/smbclient: new input plugin 2013-12-29 01:25:27 +01:00
Max Kellermann
a2baeed329 ls: add "pure" attribute 2013-12-29 01:25:27 +01:00
Max Kellermann
92aa464edb pcm/Volume: remove unused function pcm_volume_dither() 2013-12-28 18:39:26 +01:00
Max Kellermann
da29298d4d pcm/PcmMix: improved dithering
Use the existing PcmDither library.
2013-12-28 18:30:27 +01:00
Max Kellermann
afcf0795c4 pcm/Volume: improved dithering
Instead of just adding a rectangular random value before shifting back
to the normal scale, use the existing PcmDither library.
2013-12-28 18:30:24 +01:00
Max Kellermann
394e2815db pcm/PcmDither: inline Dither24To16() and Dither32To16() 2013-12-28 18:30:13 +01:00
Max Kellermann
f3bbe4bb1f pcm/Volume: remove optimized i386 assembly
This code is unable to dither.  Until we implement that, let's remove
the code for now.  i386 isn't relevant anymore anyway.
2013-12-28 17:24:54 +01:00
Max Kellermann
2a3a18a283 pcm/Traits: use 32 bit integer for S8 long_type
16 bit is not enough for volume calculations.
2013-12-25 12:28:18 +01:00
Max Kellermann
431c80f4f0 pcm/Dither: add API documentation 2013-12-24 23:45:38 +01:00
Max Kellermann
9ac18c39a1 pcm/Dither: move shift from DitherConvert() to Dither()
All callers need this shift, so let's move it to the basic method.
2013-12-24 23:39:29 +01:00
Max Kellermann
d1b7473418 pcm/Dither: rename DitherShift() to DitherConvert() 2013-12-24 23:38:11 +01:00
Max Kellermann
1ad52f131c test/*: use fprintf(stderr,...) and Log() instead of g_printerr()
Avoid GLib.
2013-12-24 14:44:08 +01:00
Max Kellermann
8064bbbc3f test/*: remove GLib logging setup
Obsolete, our logging library doesn't ues GLib anymore.
2013-12-24 14:13:03 +01:00
Max Kellermann
64e898f6db Merge tag 'release-0.18.6' 2013-12-24 12:20:24 +01:00
Max Kellermann
fb34519b96 release v0.18.6 2013-12-24 12:01:01 +01:00
Max Kellermann
91fed47648 PlayerThread: log the last song that was played 2013-12-24 11:58:10 +01:00
Max Kellermann
c05691b546 OutputControl: update both ReplayGainFilters
The "mode" of the second ReplayGainFilter was never set, and thus
replay gain was never applied to the new song during cross-fade.
2013-12-24 11:53:21 +01:00
Max Kellermann
1732166328 OutputThread: handle failing ReplayGainFilter::Open()
Since opening the PcmVolume object can now fail, this case must be
handled.
2013-12-24 10:52:33 +01:00
Max Kellermann
8edde7a4b3 pcm/Volume: convert to class
Prepare for adding state.
2013-12-23 10:58:37 +01:00
Max Kellermann
d11a0c9f14 pcm/Volume: apply volume into destination buffer 2013-12-23 10:55:29 +01:00
Max Kellermann
7be2abe6b5 pcm/Volume: convert i386 code to template specialization 2013-12-23 10:35:35 +01:00
Max Kellermann
4a62cd4ad8 pcm/Volume: move code to template pcm_volume_sample() 2013-12-23 10:35:23 +01:00
Max Kellermann
6d21b9448a pcm/PcmVolume: rename to Volume.cxx 2013-12-23 10:35:21 +01:00
Max Kellermann
2d1a3073f6 pcm/PcmConvert: move the Domain instance to Domain.cxx
Rename pcm_convert_domain to pcm_domain.  Move it out so we can use it
without depending on the whole PcmConvert library.
2013-12-23 10:35:19 +01:00
Max Kellermann
d7b9886387 ConfigData: initialise "used" in second constructor 2013-12-23 10:31:29 +01:00
Max Kellermann
1543e529f1 pcm/Dither: convert remaining methods to templates
Use the SampleTraits template and let the compiler generate a special
case for S32 instead of reusing S24_P32.
2013-12-22 22:18:06 +01:00
Max Kellermann
4043f320fe pcm/Dither: generic sample dithering using template 2013-12-22 22:06:25 +01:00
Max Kellermann
32b834aa04 pcm/Traits: include stddef.h for size_t 2013-12-22 22:06:25 +01:00
Max Kellermann
b43ec3d6f0 pcm/Traits: add MIN and MAX
Move from PcmClamp().
2013-12-22 21:32:25 +01:00
Max Kellermann
316a25dead pcm/Volume: add constant PCM_VOLUME_BITS 2013-12-22 21:31:17 +01:00
Max Kellermann
bfe020e06c pcm/Volume: make PCM_VOLUME_1 a "constexpr" 2013-12-22 21:20:40 +01:00
Max Kellermann
5aae560683 pcm/Prng: make pcm_prng() inline 2013-12-22 21:20:38 +01:00
Max Kellermann
86e72ffefb util/Clamp: generic Clamp() function 2013-12-22 21:08:06 +01:00
Max Kellermann
6416198e9f event/PollGroupPoll: include stddef.h instead of string.h 2013-12-21 21:21:25 +01:00
Max Kellermann
3c4cd9d08b input/alsa: fix build with gcc 4.6 2013-12-21 21:21:25 +01:00
Steven O'Brien
6b3b8c6f2e fix FfmpegDecoderPlugin to use relative timestamps 2013-12-20 22:28:33 +01:00
Max Kellermann
fdb02ee5ca configure.ac: skip Linux specific tests on other OSs 2013-12-20 21:38:07 +01:00
Steven O'Brien
35f85ddd86 add draft ALSA input plugin
I've created an elementary input plugin that plays sound from the
soundcard, so you can use MPD to listen to anything connected to the
line-in jack, or to Video4Linux FM radio cards that send audio through
the soundcard.  There has been a small number of posts here in the
past requesting line-in input, so here is a first, simplistic stab at
it.

The patch adds a new sheme, alsa://, which causes mpd to play data
read directly from a souncdard.  It defaults to hw:0,0, but you can
pass any ALSA device name in the URI.  So, using mpc for example:

 mpc add alsa://
 mpc play

will play from device hw:0,0.

To use a diffferent device:

 mpc add alsa://hw:1,0
2013-12-19 23:25:50 +01:00
Max Kellermann
e30fa7d15e configure.ac: add variable $host_is_unix 2013-12-19 12:59:01 +01:00
Max Kellermann
c476305149 configure.ac: add variable $host_is_solaris 2013-12-19 12:55:43 +01:00
Max Kellermann
45ad7696fe output/osx: fix typo 2013-12-19 12:46:21 +01:00
Max Kellermann
d86cd4e4b4 util/fifo_buffer: remove obsolete library 2013-12-19 12:17:09 +01:00
Max Kellermann
0e84d71559 output/osx: use DynamicFifoBuffer instead of struct fifo_buffer 2013-12-19 12:16:29 +01:00
Max Kellermann
5f14704eee configure.ac: increment protocol version to 0.19.0
Due to recent protocol additions ("addtagid", "cleartagid").
2013-12-19 12:16:29 +01:00
Max Kellermann
a191db84f2 util/Error: add missing <algorithm> include
For std::move().
2013-12-19 10:58:20 +01:00
Max Kellermann
52dca859c7 util/PeakBuffer: use IsEmpty() instead of IsNull()
The DynamicFifoBuffer methods never return nullptr when the buffer is
empty or full; instead, they return an empty buffer.  This bug caused
an endless loop.
2013-12-19 10:30:26 +01:00
Michal Smucr
e4d69f38b0 riff: recognize upper-case "ID3" chunk name
Some tagging libraries (eg. TagLib) produce that variant.
2013-12-19 09:35:54 +01:00
Max Kellermann
97fc001180 input/cdio: fix typo in #include path
Broken by commit 3b0fea5f
2013-12-17 08:58:00 +01:00
Max Kellermann
f544316314 util/{Domain,Error}: relicense to BSD 2-clause 2013-12-16 22:42:01 +01:00
Max Kellermann
ecdebb315f util/PeakBuffer: use DynamicFifoBuffer instead of struct fifo_buffer
Switch to the C++ version.
2013-12-15 23:07:08 +01:00
Max Kellermann
1f523be72d util/PeakBuffer: return ConstBuffer<void> 2013-12-15 23:07:08 +01:00
Max Kellermann
f2a20a0a80 util/WritableBuffer: add cast methods 2013-12-15 23:01:06 +01:00
Max Kellermann
e5a2efaa65 util/WritableBuffer: fix indent 2013-12-15 22:58:32 +01:00
Max Kellermann
c44cb3246d util/DynamicFifoBuffer: make constructor "explicit" 2013-12-15 22:35:21 +01:00
Max Kellermann
9cfd9d7ce0 Merge branch 'v0.18.x' 2013-12-15 19:17:40 +01:00
Max Kellermann
42a09ff17a mixer/alsa: fix deadlock
This deadlock was a regression by commit 8e38b4f8.  Since we currently
can't resolve this, let's revert the commit, and add a GLib specific
workaround for the build failure.
2013-12-15 19:07:25 +01:00
Max Kellermann
66d90dd412 test/*: use fprintf(stderr,...) and Log() instead of g_printerr()
Avoid GLib.
2013-12-15 18:52:13 +01:00
Max Kellermann
d5dfe7d457 configure.ac: add option "--disable-glib"
Allows building without GLib.  This fails to compile currently,
because GLib is still used in the MPD core.
2013-12-15 18:43:12 +01:00
Max Kellermann
0db0b4e302 Daemon: use strdup() instead of g_strdup() 2013-12-15 18:43:12 +01:00
Max Kellermann
635d6a19ef util/Tokenizer, ...: include cleanup 2013-12-15 18:33:26 +01:00
Max Kellermann
777844ae0c system/SocketError, ...: use strerror() instead of g_strerror()
Avoid GLib.
2013-12-15 18:32:07 +01:00
Max Kellermann
a10a4ad900 LogInit: move backend code to LogBackend.cxx 2013-12-15 18:27:52 +01:00
Max Kellermann
c330d694c7 Log: move Log() to LogBackend.cxx
Prepare for GLib removal.
2013-12-15 17:32:41 +01:00
Max Kellermann
73555f9088 Log: move enum LogLevel to LogLevel.hxx 2013-12-15 17:23:45 +01:00
Max Kellermann
e1ec65bd53 UriUtil: add function uri_get_scheme()
Replaces g_uri_parse_scheme().
2013-12-15 17:06:10 +01:00
Max Kellermann
65b8e52d80 output/alsa: use new[] instead of g_malloc() 2013-12-14 22:17:19 +01:00
Max Kellermann
4b7a418e28 playlist/soundcloud: fix coding style 2013-12-14 22:09:27 +01:00
Max Kellermann
73d917b76e playlist/soundcloud: make variables more local 2013-12-14 22:08:45 +01:00
Max Kellermann
527a6003e2 input/despotify: don't log "eof" flag after setting it 2013-12-14 13:58:28 +01:00
Max Kellermann
26c731a382 input/despotify: convert to class 2013-12-14 13:49:56 +01:00
Max Kellermann
8297563978 decoder/flac: simplify the comment parsers 2013-12-14 13:44:57 +01:00
Max Kellermann
1da0526072 decoder/flac: VorbisComment_Entry is null-terminated
Don't duplicate the buffer just to null-terminate the string.
According to libFLAC API documentation, the string is already
null-terminated.
2013-12-14 13:44:57 +01:00
Max Kellermann
635a67afac util/SplitString: new utility class
To replace g_strdup().
2013-12-14 12:58:26 +01:00
Max Kellermann
c7e7c819a2 decoder/vorbis: remove useless cast 2013-12-14 12:53:59 +01:00
Max Kellermann
fbf677d9b2 decoder/mad: use new[] instead of g_malloc() 2013-12-14 12:50:51 +01:00
Max Kellermann
d37b788ea8 DecoderAPI: add function decoder_read_full()
Move code from the "mad" plugin.
2013-12-14 12:43:06 +01:00
Max Kellermann
cb336ff666 DecoderAPI: add function decoder_skip()
Move code from the "mad" plugin.
2013-12-14 12:40:43 +01:00
Max Kellermann
e2e5433beb test: merge duplicate code to FakeDecoderAPI.cxx 2013-12-14 12:40:24 +01:00
Max Kellermann
c7b1038a9d Merge branch 'v0.18.x' 2013-12-14 12:37:16 +01:00
Max Kellermann
c170fed6f9 .gitignore: ignore "test-driver"
File generated by automake version 1.14.
2013-12-14 12:33:20 +01:00
Max Kellermann
d43aa12987 Tag: swap "base" and "add" in method Merge()
Fixes broken CUE sheet song tags (regression by commmit 7e8d254b).
2013-12-13 15:53:58 +01:00
Max Kellermann
8e38b4f83c mixer/alsa: use BlockingCall() instead of EventLoop::AddCall()
This is safer, and works without epoll().  Fixes a build failure with
uClibc, which does not support epoll().
2013-12-13 14:35:36 +01:00
Max Kellermann
db4ae19246 doc/mpd.conf.5: remove redundant documentation
The real and detailed documentation is in the user manual.
2013-12-11 21:04:28 +01:00
Max Kellermann
82a89c6bfe doc/user: document the "ao" output
Move from doc/mpd.conf.5.
2013-12-11 21:03:11 +01:00
Max Kellermann
166c70cab3 doc/user: document the "fifo" output
Move from doc/mpd.conf.5.
2013-12-11 20:58:06 +01:00
Max Kellermann
de78fe38c8 doc/user: document shout option "protocol" 2013-12-11 20:54:42 +01:00
mobidyc
96fa69ff6b SongUpdate: accept files without metadata
If the file was recognized by a decoder plugin, accept it - don't
require metadata.
2013-12-10 19:34:35 +01:00
Max Kellermann
39d94bd3ea TagFile: add return value API documentation 2013-12-10 19:32:26 +01:00
Lukas Stabe
695ca29274 output/osx: fix build failure 2013-12-10 19:19:31 +01:00
Max Kellermann
02e8da6c98 NEWS: add openal line 2013-12-10 19:19:27 +01:00
Denis Krjuchkov
ca69ad8beb CommandLine: refactor config search, use standard directory API 2013-12-08 17:25:20 +06:00
Denis Krjuchkov
e42637226f Main: use standard directory API 2013-12-08 17:25:19 +06:00
Denis Krjuchkov
ae25582178 ConfigPath: use standard directory API 2013-12-08 17:25:19 +06:00
Denis Krjuchkov
5d85792178 fs: implemented standard directories API 2013-12-08 17:24:43 +06:00
Denis Krjuchkov
acba9c0f61 TextFile: move to fs subsystem 2013-12-08 04:15:27 +06:00
Max Kellermann
ad7302a032 util/DynamicFifoBuffer: new class replacing growing_fifo 2013-12-05 11:49:21 +01:00
Max Kellermann
9f3bead99f test/run_encoder: destruct the Encoder before exiting 2013-12-05 11:49:21 +01:00
Denis Krjuchkov
38afc89407 fs/FileSystem.hxx: don't define CheckAccess() with mode on Windows 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
c161bb287c db/SimpleDatabasePlugin.cxx: don't use CheckAccess with mode on Windows 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
06d7169674 fs/FileSystem.hxx: add CheckAccess without mode parameter 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
8bf1640932 fs/Traits.cxx: don't return drive path without trailing separator 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
da50c888fe fs/Traits.hxx: introduce PathTraitsXXX::IsDrive function 2013-12-05 15:05:01 +06:00
Denis Krjuchkov
62dc8e4131 fs/Charset.cxx: replace \ with / when converting path to UTF-8 on Windows 2013-12-05 15:04:52 +06:00
Denis Krjuchkov
dc554ca61f PlaylistSong.cxx: don't use g_build_filename 2013-12-05 12:35:29 +06:00
Denis Krjuchkov
cbb9149a82 fs/Traits.hxx: add shorter forms of PathTraitsXXX::Build() 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
dab7348da8 fs/Traits.hxx: add PathTraitsUTF8::GetLength for consistency 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
378e8a6224 fs/AllocatedPath.cxx: don't use g_path_get_dirname 2013-12-05 12:35:28 +06:00
Denis Krjuchkov
289fdcc52b fs/Traits: implement GetBase/GetParent/Build using templates 2013-12-05 12:35:21 +06:00
Denis Krjuchkov
83e6e3e31f fs/Traits.cxx: don't return empty string if parent dir is root 2013-12-05 12:27:31 +06:00
Denis Krjuchkov
c387031252 fs/Traits.hxx: add FindLastSeparator function to PathTraitsXXX 2013-12-05 04:09:07 +06:00
Denis Krjuchkov
403bd77eff fs/Traits: improve compatibility between PathTraitsFS and PathTraitsUTF8 2013-12-05 04:01:29 +06:00
Denis Krjuchkov
b397c46184 fs/Traits.hxx: add gcc_nonnull_all where applicable 2013-12-05 03:56:51 +06:00
Denis Krjuchkov
0a6c4c31b2 fs/Traits: split PathTraits type into PathTraitsFS and PathTraitsUTF8 2013-12-05 03:53:43 +06:00
Max Kellermann
02fcf184b5 tag/ApeLoader: use new[]/delete[] instead of g_malloc()/g_free() 2013-12-04 15:21:10 +01:00
Max Kellermann
b978126bb0 DirectorySave: don't duplicate string
Not necessary anymore for playlist_metadata_load().
2013-12-04 15:11:23 +01:00
Max Kellermann
9f51d19087 PlaylistFile: use std::string for temporary string allocation 2013-12-04 15:07:45 +01:00
Max Kellermann
859184000f Mapper: update API documentation 2013-12-04 15:04:54 +01:00
Max Kellermann
1ad2f18c9e IcyMetaDataParser: use new[]/delete[] instead of g_malloc()/g_free() 2013-12-04 15:03:39 +01:00
Max Kellermann
06a49a5f9e TagId3: make variables more local 2013-12-04 14:52:34 +01:00
Max Kellermann
b811927e0e TagId3: use std::string for partial string copy 2013-12-04 14:43:09 +01:00
Max Kellermann
83cdd0a0c8 TagId3: use free() instead of g_free() for libid3tag allocations 2013-12-04 14:39:30 +01:00
Max Kellermann
53c69cd2ce TagId3: use new[]/delete[] instead of g_malloc()/g_free() 2013-12-04 14:36:13 +01:00
Max Kellermann
c6cf8e992d TagId3: gcc_unlikely instead of G_UNLIKELY 2013-12-04 14:35:16 +01:00
Max Kellermann
0c53e8c2d0 system/Resolver: use std::string to allocate internal buffer
No GLib memory allocation.
2013-12-04 14:27:28 +01:00
Max Kellermann
e1901e97c2 system/Resolver: sockaddr_to_string() returns std::string()
No GLib memory allocation.
2013-12-04 08:43:55 +01:00
Max Kellermann
d694150372 Tag: destructor calls Clear()
Eliminate duplicate code.
2013-12-03 13:19:45 +01:00
Max Kellermann
4ab586aaf1 Tag: use new[]/delete[] instead of g_new()/g_free() 2013-12-03 13:16:43 +01:00
Max Kellermann
8a5209ad93 Tag: remove method AddItem()
Use class TagBuilder instead.
2013-12-03 13:15:42 +01:00
Max Kellermann
308fdf6e9a input/curl: use class TagBuilder 2013-12-03 13:14:11 +01:00
Max Kellermann
9f4e96fdfa PaylistTag: use class TagBuilder 2013-12-03 12:59:55 +01:00
Max Kellermann
c36af35730 TagBuilder: add move operator 2013-12-03 12:59:33 +01:00
Max Kellermann
424f478c3f TagBuilder: reserve items in move constructor 2013-12-03 12:59:32 +01:00
Max Kellermann
5e0c272061 TagBuilder: make conversion constructors "explicit" 2013-12-03 12:53:13 +01:00
Max Kellermann
d99bdca094 playlist/xspf: use class TagBuilder 2013-12-03 12:33:14 +01:00
Max Kellermann
187069bec9 playlist/xspf: rename "tag" to "tag_type" 2013-12-03 12:30:55 +01:00
Max Kellermann
01de768f09 playlist/soundcloud: use class TagBuilder 2013-12-03 12:30:00 +01:00
Max Kellermann
73a861abf1 playlist/rss: use class TagBuilder 2013-12-03 12:25:22 +01:00
Max Kellermann
b4f60ee95c playlist/rss: rename "tag" to "tag_type" 2013-12-03 12:25:13 +01:00
Max Kellermann
85e587a882 playlist/pls: use class TagBuilder 2013-12-03 12:23:45 +01:00
Max Kellermann
d91f6dc1b5 playlist/extm3u: use class TagBuilder 2013-12-03 12:21:22 +01:00
Max Kellermann
78c0d8cc88 playlist/asx: use class TagBuilder 2013-12-03 12:15:43 +01:00
Max Kellermann
b23d2ad43b playlist/asx: rename "tag" to "tag_type" 2013-12-03 12:14:55 +01:00
Max Kellermann
ef68946e74 CueParser: use class TagBuilder 2013-12-03 12:09:21 +01:00
Max Kellermann
a5574f9189 TagBuilder: implement the assignment operator 2013-12-03 12:09:21 +01:00
Max Kellermann
ba61a92897 CueParser: rename local variables "current_tag" to "tag" 2013-12-03 11:58:27 +01:00
Max Kellermann
68fc3704e9 CueParser: rename "tag" to "header_tag" 2013-12-03 11:55:32 +01:00
Max Kellermann
69867015e9 DespotifyUtils: use class TagBuilder 2013-12-03 11:46:31 +01:00
Max Kellermann
923f18ef76 IcyMetaDataParser: use class TagBuilder 2013-12-03 11:46:26 +01:00
Max Kellermann
7e8d254b95 Tag: move code from Merge() to TagBuilder::Complement() 2013-12-03 11:46:24 +01:00
Max Kellermann
6325c3f14a TagBuilder: add Tag copy/move constructors 2013-12-03 11:46:23 +01:00
Max Kellermann
074a23e6b4 TagBuilder: add method HasType() 2013-12-03 11:46:21 +01:00
Max Kellermann
2fb61534a1 Merge branch 'master' of git://git.musicpd.org/dk/mpd 2013-12-03 11:46:04 +01:00
Max Kellermann
12b6c6ccf7 OutputAll: use new[]/delete[] instead of g_new()/g_free() 2013-12-03 10:51:50 +01:00
Denis Krjuchkov
55ed7bd34d AllocatedPath.hxx: use move constructor 2013-12-03 14:57:26 +06:00
Denis Krjuchkov
eeeef3eab5 fs/AllocatedPath: use PathTraits::BuildFS 2013-12-03 13:50:50 +06:00
Denis Krjuchkov
96413b1604 fs/Traits.hxx: implement BuildFS() method 2013-12-03 13:46:05 +06:00
Denis Krjuchkov
2278fe42e5 fs/Traits.hxx: move definition of AllocatedPath::string to PathTraits 2013-12-03 13:37:35 +06:00
Denis Krjuchkov
3a183f869f fs/Traits.hxx: add GetLengthFS()
There is no GetLengthUTF8() because strlen or std::string::size()
could be used instead.
2013-12-03 12:26:05 +06:00
Denis Krjuchkov
6c5828822c fs/AllocatedPath.hxx: add FromFS(std::string) method 2013-12-03 12:16:53 +06:00
Denis Krjuchkov
9dd824ba50 fs/Traits.hxx: don't use g_path_is_absolute 2013-12-03 11:59:57 +06:00
Denis Krjuchkov
d744ea3fca fs/Traits.hxx: simplify code
- Move definition of SEPARATOR_UTF8 out of #ifdef
- Remove duplicated check in IsSeparatorUTF8
2013-12-03 11:48:45 +06:00
Denis Krjuchkov
07352e82f1 PollGroupWinSelect: delete copy constructor and assignment operator 2013-12-03 11:43:26 +06:00
Denis Krjuchkov
1003cc9bf9 PollGroupWinSelect: uninline constructor and destructor 2013-12-03 11:41:36 +06:00
Lukas Stabe
0ea5f4ac3a output/openal: check __APPLE__ instead of HAVE_OSX
On OSX, the configure-flag --enable-osx is used to enable the
unsupported osx output. It sets the HAVE_OSX preprocessor define.

src/output/OpenALOutputPlugin.cxx uses this define to determine wether
it is building on OSX, and imports different headers (which have
nothing to do with the osx output) depending on wether or not it is
set.
2013-12-02 13:08:52 +01:00
Max Kellermann
2b717997e2 command: add commands "addtagid", "cleartagid" 2013-12-02 12:50:27 +01:00
Max Kellermann
20ebacf489 Tag: add methods RemoveAll(), RemoveType() 2013-12-02 12:46:48 +01:00
Max Kellermann
c6ef0e8887 pcm/Traits: add typedef "sum_type"
Allow 32 bit platforms to use 32 bit instead of 64 bit for summing 24
bit samples.
2013-12-02 11:48:10 +01:00
Max Kellermann
f761d583b5 pcm/Traits: use int_leastX_t types 2013-12-02 11:47:17 +01:00
Max Kellermann
cee1ac150e pcm/PcmChannels: implement fake N-to-M mapping
This is really just a mono mapper, but the important part is that this
library cannot fail anymore.
2013-12-02 11:42:19 +01:00
Max Kellermann
71b47ae3ef pcm/PcmChannels: use the SampleTraits library 2013-12-02 11:28:54 +01:00
Max Kellermann
36e3fda554 pcm/Traits: add template specialization for FLOAT 2013-12-02 11:26:38 +01:00
Max Kellermann
2b44a2c9bd pcm/PcmChannels: use struct ConstBuffer 2013-12-02 11:21:32 +01:00
Max Kellermann
af3b454805 pcm/PcmBuffer: add typed method GetT() 2013-12-02 11:21:32 +01:00
Max Kellermann
3a0f3eaa50 pcm/PcmUtils: use the SampleTraits library 2013-12-02 11:21:32 +01:00
Max Kellermann
80eb8d9e26 pcm/PcmUtils: remove unused function PcmClampN() 2013-12-02 11:21:32 +01:00
Max Kellermann
30c4136c4d pcm/PcmVolume: use the SampleTraits library 2013-12-02 11:21:32 +01:00
Max Kellermann
83e4475021 pcm/PcmFormat: use SampleTraits::long_type in ConvertFromFloat() 2013-12-02 11:21:32 +01:00
Max Kellermann
c071d6d9f6 pcm/PcmPrng: add "constexpr" 2013-12-02 11:21:32 +01:00
Denis Krjuchkov
1df426aa5c event: add poll() based PollGroup implementation 2013-12-02 14:39:52 +06:00
Max Kellermann
023482406f pcm/PcmMix: use the SampleTraits library for MixRamp 2013-12-01 22:49:50 +01:00
Max Kellermann
04ba40981f pcm/PcmMix: use the SampleTraits library 2013-12-01 22:44:16 +01:00
Max Kellermann
fc10bdf24d pcm/SampleTraits: use 64 bit for S24 long_type 2013-12-01 22:44:16 +01:00
Max Kellermann
28ad79c97a pcm/Traits: add typedef long_type 2013-12-01 19:32:48 +01:00
Max Kellermann
7661ad6653 pcm/Traits: add API documentation 2013-12-01 19:32:00 +01:00
Max Kellermann
e1436063ff pcm/PcmFormat: move generic definitions to Traits.hxx 2013-12-01 19:24:37 +01:00
Max Kellermann
3e11a28cd9 pcm/SoxrResampler: new resampler option using libsoxr 2013-12-01 19:13:39 +01:00
Max Kellermann
3ed80f3139 pcm/ConfiguredResampler: convert boolean flag to enum
Prepare for adding more resamplers.
2013-12-01 19:13:39 +01:00
Max Kellermann
a698cc8112 doc: move documentation from mpd.conf.5 to the user manual 2013-12-01 19:13:39 +01:00
Max Kellermann
916aaacb68 doc/user: remove obsolete "24_3" option 2013-12-01 19:13:39 +01:00
Max Kellermann
aaeb8150b7 NEWS: prepare for 0.19 2013-12-01 19:13:39 +01:00
Max Kellermann
5ba90cd8ea pcm/PcmResampler: convert to abstract interface
The PcmResampler interface is implemented by the two classes
FallbackPcmResampler and LibsampleratePcmResampler.  This prepares for
adding more resampler libraries.
2013-11-30 16:22:57 +01:00
Max Kellermann
e9127523db pcm/PcmConvert: move code to new class GluePcmResampler 2013-11-30 14:10:31 +01:00
Max Kellermann
92004f2e7e pcm/PcmConvert: move code to new class PcmChannelsConverter 2013-11-30 13:22:25 +01:00
Max Kellermann
0eefc7a43c pcm/PcmConvert: move code to new class PcmFormatConverter 2013-11-30 13:08:55 +01:00
Max Kellermann
3a666702af pcm/PcmConvert: add AudioFormat parameters
Don't use src_format.  In the middle of Convert(), the current
AudioFormat has already been modified, it's now something in between
src_format and dest_format.  This simplifies keeping track of what
remains to be done.
2013-11-30 13:00:41 +01:00
Max Kellermann
3c0c939689 pcm/PcmConvert: use struct ConstBuffer internally 2013-11-29 22:48:23 +01:00
Max Kellermann
413f7c64e5 pcm/PcmDsd: use struct ConstBuffer 2013-11-29 22:06:14 +01:00
Max Kellermann
6f47c1ca20 util/ConstBuffer: new utility class 2013-11-29 22:06:04 +01:00
Max Kellermann
abeebfe070 pcm/PcmDsd: make attributes private 2013-11-29 22:05:29 +01:00
Max Kellermann
1a002eb23d PcmConvert: add pcm_convert_global_init()
Wrapper for pcm_resample_global_init(), just in case other PCM
libraries need initialization, too.
2013-11-29 11:00:57 +01:00
Denis Krjuchkov
71bc15aca1 PollGroupEPoll.hxx: add const modifiers where applicable 2013-11-29 15:26:57 +06:00
Denis Krjuchkov
65b24ce557 Clock.cxx: provide all arguments for GetProcessTimes
All parameters seem mandatory, otherwise this call makes MPD crash.
2013-11-29 15:21:31 +06:00
Denis Krjuchkov
cfdd5edc49 event: implement PollGroup based on Windows select 2013-11-29 15:05:01 +06:00
Denis Krjuchkov
b9035d3e0a configure.ac: code style improvements
Rename HAVE_WINDOWS to host_is_windows for consistency.
Use 'yes' as true value instead of '1' for this variable.
Use test on this variable instead of case where applicable.
2013-11-29 12:30:29 +06:00
Max Kellermann
e504913b0f pcm: drop compatibility with libsamplerate older than 0.1.3
Remove compatibility code.
2013-11-28 20:48:02 +01:00
Max Kellermann
af4133e3c9 Util/StringUtil: add StringStartsWith()
Replaces GLib's g_str_has_prefix().
2013-11-28 18:48:35 +01:00
Max Kellermann
a788b7e747 PcmConvert: fix src_format corruption when converting from DSD
Method PcmConvert::Convert() modifies the src_format variable.  This
used to be a parameter, however commit d2679f59c made it an attribute
instead.  The modification to src_format persisted, and the next call
would return garbage.
2013-11-28 18:43:33 +01:00
Denis Krjuchkov
bb288f0284 event: introduce generic API for internal event loop 2013-11-28 17:06:16 +06:00
Max Kellermann
f90abe9530 include cleanup using iwyu 2013-11-28 11:50:54 +01:00
Max Kellermann
47c50c079d decoder/ffmpeg: use IgnoreError instead of local Error instance 2013-11-28 00:05:26 +01:00
Denis Krjuchkov
46bab7e4b9 Add infrastructure for using multiple event loops
This change adds two configuration options:

  --with-eventloop=[glib|internal|auto]
  --with-pollmethod=[epoll|auto]

First allows switching between GLib event loop and internal one.
Second chooses backend to use for internal event loop.
Conditional compilation symbols are changed accordingly.
Additional helper macro MPD_OPTIONAL_FUNC_NODEF is added as well.
2013-11-27 17:28:36 +06:00
Gaetan Bisson
3b0fea5fae input/cdio_paranoia: support libcdio-paranoia 0.90 2013-11-27 08:25:17 +01:00
Max Kellermann
443516cdda configure.ac: prepare for 0.18.6 2013-11-27 08:25:17 +01:00
Denis Krjuchkov
22fb49fa90 HttpdOutputPlugin.cxx: fix null pointer dereference 2013-11-26 18:13:23 +06:00
Denis Krjuchkov
957d187ae4 Main.cxx: initialize winsock before creating IO thread
Otherwise sockets can't be created during IO thread initialization.
2013-11-26 18:10:18 +06:00
Denis Krjuchkov
b88ea6735b configure.ac: set VERSION_MINOR to 19 2013-11-26 18:07:59 +06:00
Max Kellermann
51de8fd10a Volume, Output: use new class PeriodClock instead of GTimer 2013-11-25 22:09:46 +01:00
Max Kellermann
2ef6052536 ClientNew: fix nullptr dereference after g_get_prgname() failure
Hard-code the program name to "mpd" instead of using g_get_prgname().
The latter has become useless since this GLib variable doesn't get
initialized anymore.
2013-11-25 22:09:06 +01:00
Max Kellermann
394b1e6351 archive/iso9660: remove pointless formula 2013-11-24 22:49:15 +01:00
Max Kellermann
c95d068ef5 archive/iso9660: use reference instead of pointer 2013-11-24 22:47:50 +01:00
Max Kellermann
dbda35ffe1 archive/iso9660: convert structs to classes 2013-11-24 22:41:23 +01:00
Max Kellermann
6396e23a2a DatabaseGlue: make GetDatabase() "gcc_const"
This variable is initialized once on startup.  It will never change.
2013-11-24 22:04:45 +01:00
Max Kellermann
529b4bd185 Stats: use monotonic clock instead of GTimer
Reduce GLib usage.
2013-11-24 21:14:38 +01:00
Max Kellermann
85b51e4e77 Stats: use GetProcessTimes() on WIN32 to determine MPD uptime
Don't use GTimer if the operating system is able to tell us the
uptime.
2013-11-24 20:41:00 +01:00
Max Kellermann
e53a25cbae event: add API documentation 2013-11-24 19:28:04 +01:00
Max Kellermann
41e7145973 event/SocketMonitor: add missing space 2013-11-24 16:07:12 +01:00
Denis Krjuchkov
db238cc23f CommandLine: new command line parser
This implementation behaves mostly identical to old parser.
Few observable differences:
- There are no option groups (single group is used for all options)
- Option --stdout is hidden (it has been obsolete for a long time)
- MPD executable name (mpd) is hardcoded for simplicity
2013-11-24 17:29:05 +06:00
Max Kellermann
75e9c798e0 archive/iso9660: simplify _read() 2013-11-23 18:51:38 +01:00
Max Kellermann
99527051b5 Merge branch 'v0.18.x' 2013-11-23 18:45:02 +01:00
Max Kellermann
57e0cc5442 release v0.18.5 2013-11-23 18:30:12 +01:00
Max Kellermann
73f45d87d5 decoder/{dsf,dsdiff}: eliminate useless assignments 2013-11-23 18:30:12 +01:00
Max Kellermann
ae88ba986e archive/iso9660: eliminate useless assignments 2013-11-23 18:30:12 +01:00
Max Kellermann
d6247902ec input/curl: work around stream resume bug (fixed in libcurl 7.32.0) 2013-11-23 12:13:41 +01:00
Max Kellermann
a566c28a49 input/curl: add global variable "curl_version" 2013-11-23 12:08:46 +01:00
Max Kellermann
2eddb63a83 input/curl: dump version number 2013-11-23 12:02:39 +01:00
Max Kellermann
fc7d5b055d PcmResampleLibsamplerate: clip 24 bit data
Using pcm_resample_lsr_32() for 24 bit samples works, but may cause 24
bit overflows.  This commit makes 24 bit a special case with explicit
clipping.
2013-11-22 23:27:56 +01:00
Max Kellermann
87c8953e8e PcmResample: un-inline Resample24() 2013-11-22 23:24:40 +01:00
Max Kellermann
45d27a52f1 PcmUtils: add function PcmClampN() 2013-11-22 23:24:40 +01:00
Javier Domingo Cansino
bed98303a3 doc: audio_outputs sample output and explanation of each returned line 2013-11-22 10:18:17 +01:00
Max Kellermann
d22acc59c9 db/proxy: implement method GetUpdateStamp() 2013-11-22 00:45:27 +01:00
Max Kellermann
c064e8d62f DatabasePlugin: add method GetUpdateStamp()
Refactor SimpleDatabase::GetLastModified() to be generic for all
plugins.  Remove the SimpleDatabase assumption from db_stats_print(),
allowing it to be implemented by all database plugins.
2013-11-22 00:35:29 +01:00
Max Kellermann
099a2cb586 Stats: print db statistics only if db is available
Fixes crash on "stats" in certain configurations.
2013-11-22 00:27:37 +01:00
Max Kellermann
042fe2a9d0 Stats: print more unsigned integers 2013-11-22 00:23:27 +01:00
Max Kellermann
ff1c1107f3 Stats: auto-reload statistics with proxy plugin 2013-11-22 00:19:28 +01:00
Max Kellermann
41a3fd0fd0 Stats: use struct DatabaseStats
Eliminate redundant declaration.
2013-11-22 00:12:12 +01:00
Max Kellermann
b9169a5670 Stats: move the GTimer variable out of struct stats 2013-11-22 00:10:53 +01:00
Max Kellermann
2ecd5fa28d Stats: don't export the global variable "stats"
Unused outside of Stats.cxx.
2013-11-22 00:08:43 +01:00
Max Kellermann
e719b6cc41 Stats: print db_update as unsigned integer 2013-11-22 00:04:58 +01:00
Max Kellermann
67b8124a1d Mapper: _get_music_directory_utf8() may return nullptr
If no music_directory is configured, return nullptr instead of an
empty string.  This fixes a crash when db_file is configured without
music_directory.
2013-11-22 00:02:17 +01:00
Florian Schlichting
51ec499c89 system/ByteOrder: testing for endianness in a more general way
Fixes build tests on ia64 and mipsel by testing for endianness in a
more general / portable way.
2013-11-21 23:04:49 +01:00
Max Kellermann
3a4df25db2 util/ByteOrder: add comments 2013-11-21 23:04:31 +01:00
Max Kellermann
37cf78ef45 util/ByteOrder: indent the preprocessor directives
Improve readability.
2013-11-21 23:03:28 +01:00
Max Kellermann
727c622659 configure.ac: auto-detect fluidsynth by default
The option "--enable-fluidsynth" was documented to be "auto" by
default, when it was really "no".
2013-11-21 22:50:58 +01:00
Max Kellermann
74a778e65f configure.ac: prepare for 0.18.5 2013-11-18 20:03:30 +01:00
Denis Krjuchkov
1fc0c9fe8a NEWS: add version 0.18.5 change log 2013-11-18 16:40:00 +06:00
Denis Krjuchkov
740d8ec5ab system/fd_util.h: avoid symbol conflict with statically linked libmpdclient 2013-11-18 16:35:22 +06:00
Denis Krjuchkov
0bcc477d46 decoder/OggFind.cxx: include stdio.h for SEEK_END definition 2013-11-18 16:28:39 +06:00
Max Kellermann
d2679f59c5 PcmConvert: add methods Open(), Close()
Replaces Reset() and eliminates the AudioFormat parameters from the
Convert() method.
2013-11-13 21:06:33 +01:00
Max Kellermann
4ee147ea34 DecoderAPI: stop decoder on MPD error
This commit adds the basic infrastructure for reporting bugs from
DecoderAPI.cxx via DecoderThread.cxx to DecoderControl.
2013-11-13 20:57:13 +01:00
Max Kellermann
f1ca61d7d7 DecoderInternal: allocate PcmConvert dynamically
Reduce header dependencies and allow it to be nullptr to disable it.
2013-11-13 19:16:31 +01:00
Max Kellermann
a80b5cf19b DecoderInternal: move functions into the class 2013-11-13 19:13:47 +01:00
Max Kellermann
44ac84767e PcmResampleFallback: use PcmBuffer instead of PcmResampler
Lighter API.
2013-11-13 18:39:15 +01:00
Max Kellermann
a40d7ae4dd configure.ac: prepare version 0.19 2013-11-13 18:39:10 +01:00
Max Kellermann
35297f8d4f release v0.18.4 2013-11-13 18:26:01 +01:00
Max Kellermann
6f4202408c doc/example: remove "format" and "audio_output_format"
Just an attempt to prevent users from shooting themselves in the foot
by uncommenting these lines without knowing what they're doing.
2013-11-11 17:18:29 +01:00
Max Kellermann
0b6548a282 util/RefCount: no "constexpr" with libc++
Not supported by libc++.
2013-11-11 12:27:16 +01:00
Max Kellermann
faf5821816 util/LazyRandomEngine: make min()/max() static+constexpr
Required for building with libc++.
2013-11-11 12:27:15 +01:00
Max Kellermann
188673b746 output/httpd: don't use incomplete template argument with libc++ 2013-11-11 08:31:50 +01:00
Max Kellermann
287c70e361 filter/route, ...: add missing stdlib.h includes 2013-11-11 08:20:09 +01:00
Max Kellermann
f6b44af998 DespotifyUtils: add missing stdio.h include 2013-11-11 08:20:09 +01:00
Max Kellermann
84c3d9674f DecoderAPI: add missing math.h include 2013-11-11 08:18:54 +01:00
Jurgen Kramer
47d3758820 decoder/dsdiff: fix byte order bug 2013-11-10 16:49:39 +01:00
Max Kellermann
573ff3a24f DecoderThread: add missing <functional> include 2013-11-09 09:54:12 +01:00
Max Kellermann
32fcc22cb3 configure.ac: prepare for 0.18.4 2013-11-09 09:52:51 +01:00
Max Kellermann
daba1238b5 release v0.18.3 2013-11-08 12:55:12 +01:00
Max Kellermann
d125567f4a doc/developer: add text from the wiki 2013-11-08 12:54:16 +01:00
Max Kellermann
993eca9327 Makefile.am: disable dist-bzip2
bzip2-compressed tarballs are obsolete, xz is better and widely
understood.
2013-11-08 12:29:56 +01:00
Max Kellermann
e314844a4d doc: show .tar.xz in sample unpack command 2013-11-08 12:29:04 +01:00
Max Kellermann
017bc564af doc: replace the remaining wikia links 2013-11-08 12:26:07 +01:00
Max Kellermann
e076ff9085 DecoderAPI: log without holding mutex 2013-11-08 12:15:05 +01:00
Max Kellermann
2789493a5f PlayerThread: fix stuck MPD after song change (0.18.2 regression)
Commit 77c63511 caused MPD to become stuck right after a song change.
The problem was that at some point, the MusicBuffer became full, and
the DecoderThread working on the next song waits for the PlayerThread.
However, the PlayerThread was stuck in a loop of g_usleep() calls, and
never bothered to tell the DecoderThread that the MusicBuffer is not
full anymore.  This bug is very old, but its chance to occur went from
nearly 0% to nearly 100%.

The fix is to wake up the DecoderThread before waiting for it.  As a
side effect, I replaced the g_usleep() call with a Cond::Wait() call.
2013-11-08 12:02:21 +01:00
Max Kellermann
4ed0635447 DecoderInternal: simplify need_chunks()
Remove the "do_wait" parameter which is always true.  Check only
command==NONE and merge the "return" statements.
2013-11-08 11:59:56 +01:00
Max Kellermann
1904e504be DecoderInternal: don't wake up player in need_chunks
Nothing of interest happens here.  No need to wake up the player.
2013-11-08 11:58:23 +01:00
Max Kellermann
834715ea2f configure.ac: prepare for 0.18.3 2013-11-08 11:57:37 +01:00
1110 changed files with 53947 additions and 25590 deletions

133
.gitignore vendored
View File

@@ -6,73 +6,78 @@
*.lo
*.o
*.exe
.deps
.dirstamp
Makefile
Makefile.in
aclocal.m4
autom4te.cache
compile
config.guess
config.h
config.h.in
config.log
config.mk
config.status
config.sub
config_detected.h
config_detected.mk
configure
configure.lineno
depcomp
depmode
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
mpd
mpd.service
stamp-h1
tags
*~
.#*
.stgit*
src/dsd2pcm/dsd2pcm
src/win/mpd_win32_rc.rc
doc/doxygen.conf
doc/protocol.html
doc/protocol
doc/user
doc/developer
doc/sticker
doc/api
test/software_volume
test/run_convert
test/run_decoder
test/read_tags
test/run_filter
test/run_encoder
test/run_output
test/read_conf
test/run_input
test/read_mixer
test/dump_playlist
test/run_normalize
test/tmp
test/run_inotify
test/test_queue_priority
test/run_ntp_server
test/run_resolver
test/run_tcp_connect
test/test_pcm
test/dump_rva2
test/dump_text_file
test/test_util
test/test_byte_reverse
test/test_mixramp
test/test_vorbis_encoder
test/DumpDatabase
.deps
.dirstamp
tags
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/config.h
/config.h.in
/config.log
/config.mk
/config.status
/config_detected.h
/config_detected.mk
/configure
/configure.lineno
/depmode
/libtool
/ltmain.sh
/mkinstalldirs
/build
/src/mpd
/systemd/mpd.service
/stamp-h1
/src/dsd2pcm/dsd2pcm
/src/win32/mpd_win32_rc.rc
/doc/doxygen.conf
/doc/protocol.html
/doc/protocol
/doc/user
/doc/developer
/doc/sticker
/doc/api
/test/software_volume
/test/run_convert
/test/run_decoder
/test/read_tags
/test/run_filter
/test/run_encoder
/test/run_output
/test/read_conf
/test/run_input
/test/read_mixer
/test/dump_playlist
/test/run_normalize
/test/tmp
/test/run_inotify
/test/test_queue_priority
/test/test_protocol
/test/run_ntp_server
/test/run_resolver
/test/run_tcp_connect
/test/test_pcm
/test/dump_rva2
/test/dump_text_file
/test/test_util
/test/test_byte_reverse
/test/test_mixramp
/test/test_vorbis_encoder
/test/DumpDatabase
/lib/
/*.tar.gz
/*.tar.bz2

View File

@@ -1,5 +1,5 @@
Music Player Daemon - http://www.musicpd.org
Copyright (C) 2003-2013 The Music Player Daemon Project
Copyright (C) 2003-2014 The Music Player Daemon Project
The following people have contributed code to MPD:

22
INSTALL
View File

@@ -3,9 +3,11 @@
Introduction
------------
This document is a very small amount of documentation about what is needed to
install MPD. If more information is desired see the community wiki at
http://mpd.wikia.com.
install MPD. If more information is desired, read the user manual:
http://www.musicpd.org/doc/user/
Dependencies
------------
@@ -14,6 +16,8 @@ gcc 4.6 or later - http://gcc.gnu.org/
clang 3.2 or later - http://clang.llvm.org/
Any other C++11 compliant compiler should also work.
Boost 1.46 - http://www.boost.org/
GLib 2.28 - http://www.gtk.org/
General-purpose utility library.
@@ -112,9 +116,6 @@ For WavPack playback.
libadplug - http://adplug.sourceforge.net/
For AdLib playback.
despotify - https://github.com/SimonKagstrom/despotify
For Spotify playback.
Optional Miscellaneous Dependencies
-----------------------------------
@@ -161,13 +162,9 @@ Get the latest release from of MPD from <http://www.musicpd.org/>.
Compile
-------
1) unzip and untar the archive
1) unpack the archive
$ tar zxvf mpd-x.x.x.tar.gz
or
$ tar jxvf mpd-x.x.x.tar.bz2
$ tar xf mpd-x.x.x.tar.xz
2) change to directory created
@@ -208,6 +205,5 @@ Using MPD
---------
You can download many different interfaces for MPD at
<http://mpd.wikia.com/wiki/Clients>
MPD can be interfaced directly using telnet (see COMMANDS, if you are brave).
http://www.musicpd.org/clients/

File diff suppressed because it is too large Load Diff

384
NEWS
View File

@@ -1,3 +1,387 @@
ver 0.19.12 (2015/12/15)
* fix assertion failure on malformed UTF-8 tag
* fix build failure on non-Linux systems
* fix LimitRTTIME in systemd unit file
ver 0.19.11 (2015/10/27)
* tags
- ape: fix buffer overflow
* decoder
- ffmpeg: fix crash due to wrong avio_alloc_context() call
- gme: don't loop forever, fall back to GME's default play length
* encoder
- flac: fix crash with 32 bit playback
* mixer
- fix mixer lag after enabling/disabling output
ver 0.19.10 (2015/06/21)
* input
- curl: fix deadlock on small responses
- smbclient: fix DFF playback
* decoder
- ffmpeg: improve seeking accuracy
- fix stuck stream tags
* encoder
- opus: fix bogus granulepos
* output
- fix failure to open device right after booting
* neighbor
- nfs: fix deadlock when connecting
* fix "single" mode breakage due to queue edits
ver 0.19.9 (2015/02/06)
* decoder
- dsdiff, dsf: raise ID3 tag limit to 1 MB
* playlist: fix loading duplicate tag types from state file
* despotify: remove defunct plugin
* fix clock integer overflow on OS X
* fix gcc 5.0 warnings
* fix build failure with uClibc
* fix build failure on non-POSIX operating systems
* fix dependency issue on parallel Android build
* fix database/state file saving on Windows
ver 0.19.8 (2015/01/14)
* input
- curl: fix bug after rewinding from end-of-file
- mms: reduce delay at the beginning of playback
* decoder
- dsdiff, dsf: allow ID3 tags larger than 4 kB
- ffmpeg: support interleaved floating point
* fix clang 3.6 warnings
* fix build failure on NetBSD
ver 0.19.7 (2014/12/17)
* input
- nfs: fix crash while canceling a failing file open operation
- nfs: fix memory leak on connection failure
- nfs: fix reconnect after mount failure
- nfs: implement mount timeout (60 seconds)
* storage
- nfs: implement I/O timeout (60 seconds)
* playlist
- embcue: fix filename suffix detection
- don't skip non-existent songs in "listplaylist"
* decoder
- ffmpeg: fix time stamp underflow
* fix memory allocator bug on Windows
ver 0.19.6 (2014/12/08)
* decoder
- ffmpeg: support FFmpeg 2.5
* fix build failure with musl
* android
- update libFLAC to 1.3.1
- update FFmpeg to 2.5
ver 0.19.5 (2014/11/26)
* input
- nfs: fix crash on connection failure
* archive
- zzip: fix crash after seeking
* decoder
- dsdiff, dsf, opus: fix deadlock while seeking
- mp4v2: remove because of incompatible license
ver 0.19.4 (2014/11/18)
* protocol
- workaround for buggy clients that send "add /"
* decoder
- ffmpeg: support opus
- opus: add MIME types audio/ogg and application/ogg
* fix crash on failed filename charset conversion
* fix local socket detection from uid=0 (root)
ver 0.19.3 (2014/11/11)
* protocol
- fix "(null)" result string to "list" when AlbumArtist is disabled
* database
- upnp: fix breakage due to malformed URIs
* input
- curl: another fix for redirected streams
* decoder
- audiofile: fix crash while playing streams
- audiofile: fix bit rate calculation
- ffmpeg: support opus
- opus: fix bogus duration on streams
- opus: support chained streams
- opus: improved error logging
* fix distorted audio with soxr resampler
* fix build failure on Mac OS X with non-Apple compilers
ver 0.19.2 (2014/11/02)
* input
- curl: fix redirected streams
* playlist
- don't allow empty playlist name
- m3u: don't ignore unterminated last line
- m3u: recognize the file suffix ".m3u8"
* decoder
- ignore URI query string for plugin detection
- faad: remove workaround for ancient libfaad2 ABI bug
- ffmpeg: recognize MIME type audio/aacp
- mad: fix negative replay gain values
* output
- fix memory leak after filter initialization error
- fall back to PCM if given DSD sample rate is not supported
* fix assertion failure on unsupported PCM conversion
* auto-disable plugins that require GLib when --disable-glib is used
ver 0.19.1 (2014/10/19)
* input
- mms: fix deadlock bug
* playlist
- extm3u: fix Extended M3U detection
- m3u, extm3u, cue: fix truncated lines
* fix build failure on Mac OS X
* add missing file systemd/mpd.socket to tarball
ver 0.19 (2014/10/10)
* protocol
- new commands "addtagid", "cleartagid", "listfiles", "listmounts",
"listneighbors", "mount", "rangeid", "unmount"
- "lsinfo" and "readcomments" allowed for remote files
- "listneighbors" lists file servers on the local network
- "playlistadd" supports file:///
- "idle" with unrecognized event name fails
- "list" on album artist falls back to the artist tag
- "list" and "count" allow grouping
- new "search"/"find" filter "modified-since"
- "seek*" allows fractional position
- close connection after syntax error
* database
- proxy: forward "idle" events
- proxy: forward the "update" command
- proxy: copy "Last-Modified" from remote directories
- simple: compress the database file using gzip
- upnp: new plugin
- cancel the update on shutdown
* storage
- music_directory can point to a remote file server
- nfs: new plugin
- smbclient: new plugin
* playlist
- cue: fix bogus duration of the last track
- cue: restore CUE tracks from state file
- soundcloud: use https instead of http
- soundcloud: add default API key
* archive
- read tags from songs in an archive
* input
- alsa: new input plugin
- curl: options "verify_peer" and "verify_host"
- ffmpeg: update offset after seeking
- ffmpeg: improved error messages
- mms: non-blocking I/O
- nfs: new input plugin
- smbclient: new input plugin
* filter
- volume: improved software volume dithering
* decoder:
- vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
- audiofile: support scanning remote files
- audiofile: log libaudiofile errors
- dsdiff, dsf: report bit rate
- dsdiff, dsf: implement seeking
- dsf: support DSD512
- dsf: support multi-channel files
- dsf: fix big-endian bugs
- dsf: fix noise at end of malformed file
- mpg123: support ID3v2, ReplayGain and MixRamp
- sndfile: support scanning remote files
- sndfile: support tags "comment", "album", "track", "genre"
- sndfile: native floating point playback
- sndfile: optimized 16 bit playback
- mp4v2: support playback of MP4 files.
* encoder:
- shine: new encoder plugin
* output
- alsa: support native DSD playback
- alsa: rename "DSD over USB" to "DoP"
- osx: fix hang after (un)plugging headphones
* threads:
- the update thread runs at "idle" priority
- the output thread runs at "real-time" priority
- increase kernel timer slack on Linux
- name each thread (for debugging)
* configuration
- allow playlist directory without music directory
- use XDG to auto-detect "music_directory" and "db_file"
* add tags "AlbumSort", "MUSICBRAINZ_RELEASETRACKID"
* disable global Latin-1 fallback for tag values
* new resampler option using libsoxr
* ARM NEON optimizations
* install systemd unit for socket activation
* Android port
ver 0.18.23 (2015/02/06)
* despotify: remove defunct plugin
* fix clock integer overflow on OS X
* fix gcc 5.0 warnings
ver 0.18.22 (2015/01/14)
* fix clang 3.6 warnings
ver 0.18.21 (2014/12/17)
* playlist
- embcue: fix filename suffix detection
* decoder
- ffmpeg: fix time stamp underflow
ver 0.18.20 (2014/12/08)
* decoder
- ffmpeg: support FFmpeg 2.5
* fix build failure with musl
ver 0.18.19 (2014/11/26)
* archive
- zzip: fix crash after seeking
ver 0.18.18 (2014/11/18)
* decoder
- ffmpeg: support opus
* fix crash on failed filename charset conversion
* fix local socket detection from uid=0 (root)
ver 0.18.17 (2014/11/02)
* playlist
- don't allow empty playlist name
- m3u: recognize the file suffix ".m3u8"
* decoder
- ignore URI query string for plugin detection
- faad: remove workaround for ancient libfaad2 ABI bug
- ffmpeg: recognize MIME type audio/aacp
ver 0.18.16 (2014/09/26)
* fix DSD breakage due to typo in configure.ac
ver 0.18.15 (2014/09/26)
* command
- list: reset used size after the list has been processed
* fix MixRamp
* work around build failure on NetBSD
ver 0.18.14 (2014/09/11)
* protocol
- fix range parser bug on certain 32 bit architectures
* decoder
- audiofile: fix crash after seeking
- ffmpeg: fix crash with ffmpeg/libav version 11
- fix assertion failure after seeking
ver 0.18.13 (2014/08/31)
* protocol
- don't change song on "seekcur" in random mode
* decoder
- dsdiff, dsf: fix endless loop on malformed file
- ffmpeg: support ffmpeg/libav version 11
- gme: fix song duration
* output
- alsa: fix endless loop at end of file in dsd_usb mode
* fix state file saver
* fix build failure on Darwin
ver 0.18.12 (2014/07/30)
* database
- proxy: fix build failure with libmpdclient 2.2
- proxy: fix add/search and other commands with libmpdclient < 2.9
* decoder
- audiofile: improve responsiveness
- audiofile: fix WAV stream playback
- dsdiff, dsf: fix stream playback
- dsdiff: fix metadata parser bug (uninitialized variables)
- faad: estimate song duration for remote files
- sndfile: improve responsiveness
* randomize next song when enabling "random" mode while not playing
* randomize next song when adding to single-song queue
ver 0.18.11 (2014/05/12)
* decoder
- opus: fix missing song length on high-latency files
* fix race condition when using GLib event loop (non-Linux)
ver 0.18.10 (2014/04/10)
* decoder
- ffmpeg: fix seeking bug
- ffmpeg: handle unknown stream start time
- gme: fix memory leak
- sndfile: work around libsndfile bug on partial read
* don't interrupt playback when current song gets deleted
ver 0.18.9 (2014/03/02)
* protocol
- "findadd" requires the "add" permission
* output
- alsa: improved workaround for noise after manual song change
* decoder
- vorbis: fix linker failure when libvorbis/libogg are static
* encoder
- vorbis: fix another linker failure
* output
- pipe: fix hanging child process due to blocked signals
* fix build failure due to missing signal.h include
ver 0.18.8 (2014/02/07)
* decoder
- ffmpeg: support libav v10_alpha1
* encoder
- vorbis: fix linker failure
* output
- roar: documentation
* more robust Icy-Metadata parser
* fix Solaris build failure
ver 0.18.7 (2014/01/13)
* playlist
- pls: fix crash after parser error
- soundcloud: fix build failure with libyajl 2.0.1
* decoder
- faad: fix memory leak
- mpcdec: reject libmpcdec SV7 in configure script
* daemon: don't initialize supplementary groups when already running
as the configured user
ver 0.18.6 (2013/12/24)
* input
- cdio_paranoia: support libcdio-paranoia 0.90
* tags
- riff: recognize upper-case "ID3" chunk name
* decoder
- ffmpeg: use relative timestamps
* output
- openal: fix build failure on Mac OS X
- osx: fix build failure
* mixer
- alsa: fix build failure with uClibc
* fix replay gain during cross-fade
* accept files without metadata
ver 0.18.5 (2013/11/23)
* configuration
- fix crash when db_file is configured without music_directory
- fix crash on "stats" without db_file/music_directory
* database
- proxy: auto-reload statistics
- proxy: provide "db_update" in "stats" response
* input
- curl: work around stream resume bug (fixed in libcurl 7.32.0)
* decoder
- fluidsynth: auto-detect by default
* clip 24 bit data from libsamplerate
* fix ia64, mipsel and other little-endian architectures
* fix build failures due to missing includes
* fix build failure with static libmpdclient
ver 0.18.4 (2013/11/13)
* decoder
- dsdiff: fix byte order bug
* fix build failures due to missing includes
* libc++ compatibility
ver 0.18.3 (2013/11/08)
* fix stuck MPD after song change (0.18.2 regression)
ver 0.18.2 (2013/11/07)
* protocol:
- "close" flushes the output buffer

View File

@@ -1,92 +0,0 @@
Music Player Daemon (MPD) - UPGRADING
Upgrading to 0.14
-----------------
The filesystem character set is determined by GLib, if it is not
configured. GLib has an affinity towards UTF-8, while older MPD
versions used to choose ISO-Latin-1.
Upgrading to 0.13.0
-------------------
JACK, Avahi, and libsamplerate have been added as optional dependencies.
FLAC/OggFLAC now supports the 1.1.3 API, and libmikmod 3.2.0 betas are
supported as well.
New mpd.conf parameters include zeroconf_name, samplerate_converter, and
gapless_mp3_playback. See the mpd.conf man page or updated mpconf.example for
more information on these parameters.
Support for the ID3v2 "Original Artist/Performer" tag has been added. Your
MP3s will need to be rescanned for these tags to be included in the database.
This can be done by running mpd --create-db.
Upgrading to 0.12.0
-------------------
The ao_driver and ao_driver_options config parameters have been removed and
replaced with the audio_output config section. You will have to update your
config file to use this instead. See the mpd.conf man page or the new
mpdconf.example for details on specifying audio_output sections.
The db_file parameter is no longer optional. If you did not specify it in your
old config file then you will have to add it in order to run 0.12.0.
Support for OggFLAC and Musepack audio files has been added. Additionally,
scanning of MP3 files has been improved. To make use of these updates it is
highly recommended that you run mpd --create-db to recreate your entire
database.
Upgrading to 0.11.0
-------------------
The database format has changed a little bit, but in a backward compatible way.
This means that if you upgrade to 0.11.0 from 0.10.x, you do not need to make
any changes. However, if you downgrade back to 0.10.x, then you will need
to recreate your db.
The default port for MPD is now 6600, so update your mpd and client
configurations appropriately.
Upgrading to 0.10.0
-------------------
All information is now stored in the db in UTF-8 format, and the character
set used for the filesystem is stored in the db. Thus, it is highly
recommended that you recreate the db. To do so, run mpd with the
"--create-db" command line option. Also, note that the filesystem
character set will be determined from your current locale settings.
If your locale settings are not the same as those used for the filesystem,
then use the config file parameter "filesystem_charset" to specify the
correct character set (this maybe necessary if you create the db with root).
Upgrading to 0.9.3
------------------
Wave support was added, so to have your wave files added, update the db (mpc
update).
Also, song lengths are now stored in the db. To get this stuff
added to the db, you will need to recreate the db from scratch. To do this,
run mpd with the "--create-db" commandline option.
Upgrading to 0.9.0
------------------
The "stop_on_error" config parameter was removed, so be sure to remove this
parameter from your config file.
Upgrading to 0.8.x
------------------
If you have FLACs, then to have them added to your list of available music,
just use "update".
Upgrading from 0.5.x to 0.6.x
-----------------------------
If you have not compiled MPD with "make ogg", then nothing is needed.
If you compiled with "make ogg", just use "update" (available via the phpMp
interface) to add your OGGs to MPD's list of available music.

1
android/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.musicpd"
android:installLocation="auto"
android:versionCode="13"
android:versionName="0.19.9">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Main"
android:label="@string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>

433
android/build.py Executable file
View File

@@ -0,0 +1,433 @@
#!/usr/bin/env python3
import os, os.path
import sys, shutil, subprocess
import urllib.request
import hashlib
import re
if len(sys.argv) < 3:
print("Usage: build.py SDK_PATH NDK_PATH [configure_args...]", file=sys.stderr)
sys.exit(1)
sdk_path = sys.argv[1]
ndk_path = sys.argv[2]
configure_args = sys.argv[3:]
if not os.path.isfile(os.path.join(sdk_path, 'tools', 'android')):
print("SDK not found in", ndk_path, file=sys.stderr)
sys.exit(1)
if not os.path.isdir(ndk_path):
print("NDK not found in", ndk_path, file=sys.stderr)
sys.exit(1)
# the path to the MPD sources
mpd_path = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]) or '.', '..'))
# output directories
lib_path = os.path.abspath('lib')
tarball_path = lib_path
src_path = os.path.join(lib_path, 'src')
build_path = os.path.join(lib_path, 'build')
root_path = os.path.join(lib_path, 'root')
# build host configuration
build_arch = 'linux-x86_64'
# redirect pkg-config to use our root directory instead of the default
# one on the build host
os.environ['PKG_CONFIG_LIBDIR'] = os.path.join(root_path, 'lib/pkgconfig')
# select the NDK compiler
gcc_version = '4.9'
llvm_version = '3.5'
# select the NDK target
ndk_arch = 'arm'
host_arch = 'arm-linux-androideabi'
android_abi = 'armeabi-v7a'
ndk_platform = 'android-14'
# set up the NDK toolchain
gcc_toolchain = os.path.join(ndk_path, 'toolchains', host_arch + '-' + gcc_version, 'prebuilt', build_arch)
llvm_toolchain = os.path.join(ndk_path, 'toolchains', 'llvm-' + llvm_version, 'prebuilt', build_arch)
ndk_platform_path = os.path.join(ndk_path, 'platforms', ndk_platform)
target_root = os.path.join(ndk_platform_path, 'arch-' + ndk_arch)
llvm_triple = 'armv7-none-linux-androideabi'
def select_toolchain(use_cxx, use_clang):
global cc, cxx, ar, strip, cflags, cxxflags, cppflags, ldflags, libs
target_arch = '-march=armv7-a -mfloat-abi=softfp'
if use_clang:
cc = os.path.join(llvm_toolchain, 'bin/clang')
cxx = os.path.join(llvm_toolchain, 'bin/clang++')
target_arch += ' -target ' + llvm_triple + ' -integrated-as -gcc-toolchain ' + gcc_toolchain
else:
cc = os.path.join(gcc_toolchain, 'bin', host_arch + '-gcc')
cxx = os.path.join(gcc_toolchain, 'bin', host_arch + '-g++')
ar = os.path.join(gcc_toolchain, 'bin', host_arch + '-ar')
strip = os.path.join(gcc_toolchain, 'bin', host_arch + '-strip')
libstdcxx_path = os.path.join(ndk_path, 'sources/cxx-stl/gnu-libstdc++', gcc_version)
libstdcxx_cppflags = '-isystem ' + os.path.join(libstdcxx_path, 'include') + ' -isystem ' + os.path.join(libstdcxx_path, 'libs', android_abi, 'include')
if use_clang:
libstdcxx_cppflags += ' -D__STRICT_ANSI__'
libstdcxx_ldadd = os.path.join(libstdcxx_path, 'libs', android_abi, 'libgnustl_static.a')
cflags = '-Os -g ' + target_arch
cxxflags = '-Os -g ' + target_arch
cppflags = '--sysroot=' + target_root + ' -I' + root_path + '/include'
ldflags = '--sysroot=' + target_root + ' -L' + root_path + '/lib'
libs = ''
if use_cxx:
libs += ' ' + libstdcxx_ldadd
cppflags += ' ' + libstdcxx_cppflags
def file_md5(path):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
with open(path, 'rb') as f:
m = hashlib.md5()
while True:
data = f.read(65536)
if len(data) == 0:
# end of file
return m.hexdigest()
m.update(data)
def download_tarball(url, md5):
"""Download a tarball, verify its MD5 checksum and return the local path."""
global tarball_path
os.makedirs(tarball_path, exist_ok=True)
path = os.path.join(tarball_path, os.path.basename(url))
try:
calculated_md5 = file_md5(path)
if md5 == calculated_md5: return path
os.unlink(path)
except FileNotFoundError:
pass
tmp_path = path + '.tmp'
print("download", url)
urllib.request.urlretrieve(url, tmp_path)
calculated_md5 = file_md5(tmp_path)
if calculated_md5 != md5:
os.unlink(tmp_path)
raise "MD5 mismatch"
os.rename(tmp_path, path)
return path
class Project:
def __init__(self, url, md5, installed, name=None, version=None,
base=None,
use_cxx=False, use_clang=False):
if base is None:
basename = os.path.basename(url)
m = re.match(r'^(.+)\.(tar(\.(gz|bz2|xz|lzma))?|zip)$', basename)
if not m: raise
self.base = m.group(1)
else:
self.base = base
if name is None or version is None:
m = re.match(r'^([-\w]+)-(\d[\d.]*[a-z]?)$', self.base)
if name is None: name = m.group(1)
if version is None: version = m.group(2)
self.name = name
self.version = version
self.url = url
self.md5 = md5
self.installed = installed
self.use_cxx = use_cxx
self.use_clang = use_clang
def download(self):
return download_tarball(self.url, self.md5)
def is_installed(self):
global root_path
tarball = self.download()
installed = os.path.join(root_path, self.installed)
tarball_mtime = os.path.getmtime(tarball)
try:
return os.path.getmtime(installed) >= tarball_mtime
except FileNotFoundError:
return False
def unpack(self):
global src_path
tarball = self.download()
path = os.path.join(src_path, self.base)
try:
shutil.rmtree(path)
except FileNotFoundError:
pass
os.makedirs(src_path, exist_ok=True)
subprocess.check_call(['/bin/tar', 'xfC', tarball, src_path])
return path
def make_build_path(self):
path = os.path.join(build_path, self.base)
try:
shutil.rmtree(path)
except FileNotFoundError:
pass
os.makedirs(path, exist_ok=True)
return path
class AutotoolsProject(Project):
def __init__(self, url, md5, installed, configure_args=[],
autogen=False,
cppflags='',
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args
self.autogen = autogen
self.cppflags = cppflags
def build(self):
src = self.unpack()
if self.autogen:
subprocess.check_call(['/usr/bin/aclocal'], cwd=src)
subprocess.check_call(['/usr/bin/automake', '--add-missing', '--force-missing', '--foreign'], cwd=src)
subprocess.check_call(['/usr/bin/autoconf'], cwd=src)
subprocess.check_call(['/usr/bin/libtoolize', '--force'], cwd=src)
build = self.make_build_path()
select_toolchain(use_cxx=self.use_cxx, use_clang=self.use_clang)
configure = [
os.path.join(src, 'configure'),
'CC=' + cc,
'CXX=' + cxx,
'CFLAGS=' + cflags,
'CXXFLAGS=' + cxxflags,
'CPPFLAGS=' + cppflags + ' ' + self.cppflags,
'LDFLAGS=' + ldflags,
'LIBS=' + libs,
'AR=' + ar,
'STRIP=' + strip,
'--host=' + host_arch,
'--prefix=' + root_path,
'--with-sysroot=' + target_root,
'--enable-silent-rules',
] + self.configure_args
subprocess.check_call(configure, cwd=build)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build)
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build)
class FfmpegProject(Project):
def __init__(self, url, md5, installed, configure_args=[],
cppflags='',
**kwargs):
Project.__init__(self, url, md5, installed, **kwargs)
self.configure_args = configure_args
self.cppflags = cppflags
def build(self):
src = self.unpack()
build = self.make_build_path()
select_toolchain(use_cxx=self.use_cxx, use_clang=self.use_clang)
configure = [
os.path.join(src, 'configure'),
'--cc=' + cc,
'--cxx=' + cxx,
'--extra-cflags=' + cflags + ' ' + cppflags + ' ' + self.cppflags,
'--extra-cxxflags=' + cxxflags + ' ' + cppflags + ' ' + self.cppflags,
'--extra-ldflags=' + ldflags,
'--extra-libs=' + libs,
'--ar=' + ar,
'--enable-cross-compile',
'--target-os=linux',
'--arch=' + ndk_arch,
'--cpu=cortex-a8',
'--prefix=' + root_path,
] + self.configure_args
subprocess.check_call(configure, cwd=build)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'], cwd=build)
subprocess.check_call(['/usr/bin/make', '--quiet', 'install'], cwd=build)
class BoostProject(Project):
def __init__(self, url, md5, installed,
**kwargs):
m = re.match(r'.*/boost_(\d+)_(\d+)_(\d+)\.tar\.bz2$', url)
version = "%s.%s.%s" % (m.group(1), m.group(2), m.group(3))
Project.__init__(self, url, md5, installed,
name='boost', version=version,
**kwargs)
def build(self):
src = self.unpack()
# install the headers manually; don't build any library
# (because right now, we only use header-only libraries)
includedir = os.path.join(root_path, 'include')
for dirpath, dirnames, filenames in os.walk(os.path.join(src, 'boost')):
relpath = dirpath[len(src)+1:]
destdir = os.path.join(includedir, relpath)
try:
os.mkdir(destdir)
except:
pass
for name in filenames:
if name[-4:] == '.hpp':
shutil.copyfile(os.path.join(dirpath, name),
os.path.join(destdir, name))
# a list of third-party libraries to be used by MPD on Android
thirdparty_libs = [
AutotoolsProject(
'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz',
'5c3a34309d8b98640827e5d0991a4015',
'lib/libogg.a',
['--disable-shared', '--enable-static'],
),
AutotoolsProject(
'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.xz',
'55f2288055e44754275a17c9a2497391',
'lib/libvorbis.a',
['--disable-shared', '--enable-static'],
),
AutotoolsProject(
'http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz',
'c5a8cf7c0b066759542bc4ca46817ac6',
'lib/libopus.a',
['--disable-shared', '--enable-static'],
use_clang=True,
),
AutotoolsProject(
'http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz',
'b9922c9a0378c88d3e901b234f852698',
'lib/libFLAC.a',
[
'--disable-shared', '--enable-static',
'--disable-xmms-plugin', '--disable-cpplibs',
],
use_clang=True,
),
AutotoolsProject(
'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz',
'e5808ad997ba32c498803822078748c3',
'lib/libid3tag.a',
['--disable-shared', '--enable-static'],
autogen=True,
),
AutotoolsProject(
'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz',
'1be543bc30c56fb6bea1d7bf6a64e66c',
'lib/libmad.a',
['--disable-shared', '--enable-static'],
autogen=True,
),
FfmpegProject(
'http://ffmpeg.org/releases/ffmpeg-2.5.tar.bz2',
'4346fe710cc6bdd981f6534d2420d1ab',
'lib/libavcodec.a',
[
'--disable-shared', '--enable-static',
'--enable-gpl',
'--enable-small',
'--disable-pthreads',
'--disable-runtime-cpudetect',
'--disable-programs',
'--disable-doc',
'--disable-avdevice',
'--disable-swresample',
'--disable-swscale',
'--disable-postproc',
'--disable-avfilter',
'--disable-network',
'--disable-encoders',
'--disable-protocols',
'--disable-outdevs',
'--disable-filters',
],
),
AutotoolsProject(
'http://curl.haxx.se/download/curl-7.39.0.tar.lzma',
'e9aa6dec29920eba8ef706ea5823bad7',
'lib/libcurl.a',
[
'--disable-shared', '--enable-static',
'--disable-debug',
'--enable-http',
'--enable-ipv6',
'--disable-ftp', '--disable-file',
'--disable-ldap', '--disable-ldaps',
'--disable-rtsp', '--disable-proxy', '--disable-dict', '--disable-telnet',
'--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp',
'--disable-gopher',
'--disable-manual',
'--disable-threaded-resolver', '--disable-verbose', '--disable-sspi',
'--disable-crypto-auth', '--disable-ntlm-wb', '--disable-tls-srp', '--disable-cookies',
'--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2',
],
use_clang=True,
),
BoostProject(
'http://netcologne.dl.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2',
'd6eef4b4cacb2183f2bf265a5a03a354',
'include/boost/version.hpp',
),
]
# build the third-party libraries
for x in thirdparty_libs:
if not x.is_installed():
x.build()
# configure and build MPD
select_toolchain(use_cxx=True, use_clang=True)
configure = [
os.path.join(mpd_path, 'configure'),
'CC=' + cc,
'CXX=' + cxx,
'CFLAGS=' + cflags,
'CXXFLAGS=' + cxxflags,
'CPPFLAGS=' + cppflags,
'LDFLAGS=' + ldflags,
'LIBS=' + libs,
'AR=' + ar,
'STRIP=' + strip,
'--host=' + host_arch,
'--prefix=' + root_path,
'--with-sysroot=' + target_root,
'--with-android-sdk=' + sdk_path,
'--enable-silent-rules',
'--disable-glib',
'--disable-icu',
# disabled for now because these features require GLib:
'--disable-httpd-output',
'--disable-vorbis-encoder',
] + configure_args
subprocess.check_call(configure)
subprocess.check_call(['/usr/bin/make', '--quiet', '-j12'])

11
android/custom_rules.xml Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="mpd_rules">
<!-- setting these two properties works around a bug in Android
SDK's build.xml, which deletes all .class files every time -->
<property name="build.last.is.packaging.debug" value="true" />
<property name="build.is.packaging.debug" value="true" />
<target name="compile-jni-classes"
depends="-set-debug-mode,-compile"/>
</project>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MPD</string>
</resources>

30
android/src/Bridge.java Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.musicpd;
import android.content.Context;
/**
* Bridge to native code.
*/
public class Bridge {
public static native void run(Context context);
public static native void shutdown();
}

39
android/src/Loader.java Normal file
View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.musicpd;
import android.util.Log;
public class Loader {
private static final String TAG = "MPD";
public static boolean loaded = false;
public static String error;
static {
try {
System.loadLibrary("mpd");
loaded = true;
} catch (UnsatisfiedLinkError e) {
Log.e(TAG, e.getMessage());
error = e.getMessage();
}
}
}

75
android/src/Main.java Normal file
View File

@@ -0,0 +1,75 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.musicpd;
import android.app.Activity;
import android.os.Bundle;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;
import android.util.Log;
public class Main extends Activity implements Runnable {
private static final String TAG = "MPD";
Thread thread;
TextView textView;
final Handler quitHandler = new Handler() {
public void handleMessage(Message msg) {
textView.setText("Music Player Daemon has quit");
// TODO: what now? restart?
}
};
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!Loader.loaded) {
TextView tv = new TextView(this);
tv.setText("Failed to load the native MPD libary.\n" +
"Report this problem to us, and include the following information:\n" +
"ABI=" + Build.CPU_ABI + "\n" +
"PRODUCT=" + Build.PRODUCT + "\n" +
"FINGERPRINT=" + Build.FINGERPRINT + "\n" +
"error=" + Loader.error);
setContentView(tv);
return;
}
if (thread == null || !thread.isAlive()) {
thread = new Thread(this, "NativeMain");
thread.start();
}
textView = new TextView(this);
textView.setText("Music Player Daemon is running"
+ "\nCAUTION: this version is EXPERIMENTAL!");
setContentView(textView);
}
@Override public void run() {
Bridge.run(this);
quitHandler.sendMessage(quitHandler.obtainMessage());
}
}

View File

@@ -1,137 +1,11 @@
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
# (at one point this was based on the version in enlightenment's cvs)
package="mpd"
set -e
olddir="`pwd`"
srcdir="`dirname $0`"
test -z "$srcdir" && srcdir=.
cd "$srcdir"
DIE=
AM_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]*\).*/\1/"
AC_VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9][0-9]\).*/\1/"
VERSIONMKINT="sed -e s/[^0-9]//"
if test -n "$AM_FORCE_VERSION"
then
AM_VERSIONS="$AM_FORCE_VERSION"
else
AM_VERSIONS='1.11'
fi
if test -n "$AC_FORCE_VERSION"
then
AC_VERSIONS="$AC_FORCE_VERSION"
else
AC_VERSIONS='2.60 2.61'
fi
rm -rf config.cache build
mkdir build
versioned_bins ()
{
bin="$1"
needed_int=`echo $VERNEEDED | $VERSIONMKINT`
for i in $VERSIONS
do
i_int=`echo $i | $VERSIONMKINT`
if test $i_int -ge $needed_int
then
echo $bin-$i $bin$i $bin-$i_int $bin$i_int
fi
done
echo $bin
}
for c in autoconf autoheader automake aclocal
do
uc=`echo $c | tr '[:lower:]' '[:upper:]'`
eval "val=`echo '$'$uc`"
if test -n "$val"
then
echo "$uc=$val in environment, will not attempt to auto-detect"
continue
fi
case "$c" in
autoconf|autoheader)
VERNEEDED=`fgrep AC_PREREQ configure.ac | $AC_VERSIONGREP`
VERSIONS="$AC_VERSIONS"
pkg=autoconf
;;
automake|aclocal)
VERNEEDED=`fgrep AUTOMAKE_OPTIONS Makefile.am | $AM_VERSIONGREP`
VERSIONS="$AM_VERSIONS"
pkg=automake
;;
esac
printf "checking for $c ... "
for x in `versioned_bins $c`; do
($x --version < /dev/null > /dev/null 2>&1) > /dev/null 2>&1
if test $? -eq 0
then
echo $x
eval $uc=$x
break
fi
done
eval "val=`echo '$'$uc`"
if test -z "$val"
then
if test $c = $pkg
then
DIE="$DIE $c=$VERNEEDED"
else
DIE="$DIE $c($pkg)=$VERNEEDED"
fi
fi
done
if test -n "$DIE"
then
echo "You must have the following installed to compile $package:"
for i in $DIE
do
printf ' '
echo $i | sed -e 's/(/ (from /' -e 's/=\(.*\)/ (>= \1)/'
done
echo "Download the appropriate package(s) for your system,"
echo "or get the source from one of the GNU ftp sites"
echo "listed in http://www.gnu.org/order/ftp.html"
exit 1
fi
echo "Generating configuration files for $package, please wait...."
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
# /usr/share/aclocal is most likely included by default, already...
ac_local_paths='
/usr/local/share/aclocal
/sw/share/aclocal
/usr/pkg/share/aclocal
/opt/share/aclocal
/usr/gnu/share/aclocal
'
for i in $ac_local_paths; do
if test -d "$i"; then
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I $i"
# we probably only want one of these...
break
fi
done
echo " $ACLOCAL $ACLOCAL_FLAGS"
$ACLOCAL $ACLOCAL_FLAGS || exit 1
echo " $AUTOHEADER"
$AUTOHEADER || exit 1
echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
echo " $AUTOCONF"
$AUTOCONF || exit 1
cd "$olddir"
if test x$NOCONFIGURE = x; then
"$srcdir"/configure "$@" || exit 1
fi
aclocal -I m4 $ACLOCAL_FLAGS
autoheader
automake --add-missing $AUTOMAKE_FLAGS
autoconf

View File

@@ -1,20 +1,25 @@
AC_PREREQ(2.60)
AC_INIT(mpd, 0.18.2, musicpd-dev-team@lists.sourceforge.net)
AC_INIT(mpd, 0.19.12, musicpd-dev-team@lists.sourceforge.net)
VERSION_MAJOR=0
VERSION_MINOR=18
VERSION_REVISION=0
VERSION_MINOR=19
VERSION_REVISION=12
VERSION_EXTRA=0
AC_CONFIG_SRCDIR([src/Main.cxx])
AM_INIT_AUTOMAKE([foreign 1.11 dist-bzip2 dist-xz subdir-objects])
AC_CONFIG_AUX_DIR(build)
AM_INIT_AUTOMAKE([foreign 1.11 dist-xz subdir-objects])
AM_SILENT_RULES
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_DEFINE(PROTOCOL_VERSION, "0.18.0", [The MPD protocol version])
AC_DEFINE(PROTOCOL_VERSION, "0.19.0", [The MPD protocol version])
GIT_COMMIT=`GIT_DIR="$srcdir/.git" git describe --dirty --always 2>/dev/null`
if test x$GIT_COMMIT != x; then
AC_DEFINE_UNQUOTED(GIT_COMMIT, ["$GIT_COMMIT"], [The current git commit])
fi
dnl ---------------------------------------------------------------------------
dnl Programs
@@ -65,25 +70,54 @@ dnl OS Specific Defaults
dnl ---------------------------------------------------------------------------
AC_CANONICAL_HOST
host_is_unix=yes
host_is_linux=no
host_is_android=no
host_is_darwin=no
host_is_solaris=no
host_is_windows=no
linux_auto=no
case "$host_os" in
linux-android*)
host_is_android=yes
host_is_linux=yes
linux_auto=auto
AM_CPPFLAGS="$AM_CPPFLAGS -DANDROID"
;;
linux*)
host_is_linux=yes
linux_auto=auto
dnl allow using all glibc features
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
;;
mingw32* | windows*)
AC_CONFIG_FILES([
src/win/mpd_win32_rc.rc
src/win32/mpd_win32_rc.rc
])
AC_CHECK_TOOL(WINDRES, windres)
AM_CPPFLAGS="$AM_CPPFLAGS -DWIN32_LEAN_AND_MEAN"
AM_CPPFLAGS="$AM_CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600"
LIBS="$LIBS -lws2_32"
HAVE_WINDOWS=1
host_is_windows=yes
host_is_unix=no
;;
darwin*)
host_is_darwin=yes
;;
solaris*)
host_is_solaris=yes
;;
esac
AM_CONDITIONAL([HAVE_WINDOWS], [test x$HAVE_WINDOWS = x1])
AM_CONDITIONAL([ANDROID], [test x$host_is_android = xyes])
AM_CONDITIONAL([HAVE_WINDOWS], [test x$host_is_windows = xyes])
if test -z "$prefix" || test "x$prefix" = xNONE; then
local_lib=
@@ -121,6 +155,27 @@ if test -z "$prefix" || test "x$prefix" = xNONE; then
done
fi
dnl ---------------------------------------------------------------------------
dnl Android
dnl ---------------------------------------------------------------------------
AC_ARG_WITH([android-sdk],
AS_HELP_STRING([--with-android-sdk=DIR],
[Directory for Android SDK]),
[], [with_android_sdk=no])
if test x$host_is_android = xyes; then
if test x$with_android_sdk = xno; then
AC_MSG_ERROR([Android build requires option --with-android-sdk=DIR])
fi
if ! test -x $with_android_sdk/tools/android; then
AC_MSG_ERROR([Android SDK not found in $with_android_sdk])
fi
fi
AC_SUBST(ANDROID_SDK, [$with_android_sdk])
dnl ---------------------------------------------------------------------------
dnl Language Checks
dnl ---------------------------------------------------------------------------
@@ -137,7 +192,8 @@ fi
dnl ---------------------------------------------------------------------------
dnl Header/Library Checks
dnl ---------------------------------------------------------------------------
AC_CHECK_FUNCS(daemon fork)
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([syslog], [bsd socket inet],
[AC_DEFINE(HAVE_SYSLOG, 1, [Define if syslog() is available])])
@@ -145,10 +201,17 @@ AC_SEARCH_LIBS([syslog], [bsd socket inet],
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_CHECK_FUNCS(pipe2 accept4)
MPD_OPTIONAL_FUNC(eventfd, eventfd, USE_EVENTFD)
MPD_OPTIONAL_FUNC(signalfd, signalfd, USE_SIGNALFD)
MPD_OPTIONAL_FUNC(epoll, epoll_create1, USE_EPOLL)
if test x$host_is_linux = xyes; then
AC_CHECK_FUNCS(pipe2 accept4)
fi
AC_CHECK_FUNCS(getpwnam_r getpwuid_r)
AC_CHECK_FUNCS(strndup)
if test x$host_is_linux = xyes; then
MPD_OPTIONAL_FUNC(eventfd, eventfd, USE_EVENTFD)
MPD_OPTIONAL_FUNC(signalfd, signalfd, USE_SIGNALFD)
fi
AC_SEARCH_LIBS([exp], [m],,
[AC_MSG_ERROR([exp() not found])])
@@ -156,14 +219,96 @@ AC_SEARCH_LIBS([exp], [m],,
AC_CHECK_HEADERS(locale.h)
AC_CHECK_HEADERS(valgrind/memcheck.h)
AC_CHECK_HEADERS([sys/prctl.h], AC_CHECK_FUNCS([prctl]))
AX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
AM_CXXFLAGS="$AM_CXXFLAGS $PTHREAD_CFLAGS"
AC_CHECK_LIB([pthread], [pthread_setname_np],
[have_pthread_setname_np=yes],
[have_pthread_setname_np=no])
if test x$have_pthread_setname_np = xyes; then
AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Is pthread_setname_np() available?])
fi
dnl ---------------------------------------------------------------------------
dnl Event loop selection
dnl ---------------------------------------------------------------------------
MPD_OPTIONAL_FUNC_NODEF(poll, poll)
if test x$host_is_linux = xyes; then
MPD_OPTIONAL_FUNC_NODEF(epoll, epoll_create1)
fi
AC_ARG_WITH(pollmethod,
AS_HELP_STRING(
[--with-pollmethod=@<:@epoll|poll|winselect|auto@:>@],
[specify poll method for internal event loop (default=auto)]),,
[with_pollmethod=auto])
if test "x$with_pollmethod" = xauto; then
if test "x$enable_epoll" = xyes; then
with_pollmethod=epoll
elif test "x$enable_poll" = xyes; then
with_pollmethod=poll
elif test "x$host_is_windows" = xyes; then
with_pollmethod=winselect
else
AC_MSG_ERROR([no poll method is available for your platform])
fi
fi
case "$with_pollmethod" in
epoll)
AC_DEFINE(USE_EPOLL, 1, [Define to poll sockets with epoll])
;;
poll)
AC_DEFINE(USE_POLL, 1, [Define to poll sockets with poll])
;;
winselect)
AC_DEFINE(USE_WINSELECT, 1,
[Define to poll sockets with Windows select])
;;
*)
AC_MSG_ERROR([unknown pollmethod option: $with_pollmethod])
esac
dnl ---------------------------------------------------------------------------
dnl Allow tools to be specifically built
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(database,
AS_HELP_STRING([--enable-database],
[enable support for the music database]),,
enable_database=yes)
AM_CONDITIONAL(ENABLE_DATABASE, test x$enable_database = xyes)
if test x$enable_database = xyes; then
database_auto=auto
AC_DEFINE(ENABLE_DATABASE, 1, [Define to enable the music database])
else
database_auto=no
fi
AC_ARG_ENABLE(libmpdclient,
AS_HELP_STRING([--enable-libmpdclient],
[enable support for the MPD client]),,
enable_libmpdclient=auto)
MPD_DEPENDS([enable_libmpdclient], [enable_database],
[Cannot use --enable-libmpdclient with --disable-database])
AC_ARG_ENABLE(expat,
AS_HELP_STRING([--enable-expat],
[enable the expat XML parser]),,
enable_expat=auto)
AC_ARG_ENABLE(upnp,
AS_HELP_STRING([--enable-upnp],
[enable UPnP client support (default: auto)]),,
enable_upnp=auto)
MPD_DEPENDS([enable_upnp], [enable_database],
[Cannot use --enable-upnp with --disable-database])
AC_ARG_ENABLE(adplug,
AS_HELP_STRING([--enable-adplug],
@@ -172,7 +317,7 @@ AC_ARG_ENABLE(adplug,
AC_ARG_ENABLE(alsa,
AS_HELP_STRING([--enable-alsa], [enable ALSA support]),,
[enable_alsa=auto])
[enable_alsa=$linux_auto])
AC_ARG_ENABLE(roar,
AS_HELP_STRING([--enable-roar],
@@ -183,12 +328,19 @@ AC_ARG_ENABLE(ao,
AS_HELP_STRING([--enable-ao],
[enable support for libao]),,
enable_ao=auto)
MPD_DEPENDS([enable_ao], [enable_glib],
[Cannot use --enable-ao with --disable-glib])
AC_ARG_ENABLE(audiofile,
AS_HELP_STRING([--enable-audiofile],
[enable audiofile support (WAV and others)]),,
enable_audiofile=auto)
AC_ARG_ENABLE(zlib,
AS_HELP_STRING([--enable-zlib],
[enable zlib support (default: auto)]),,
enable_zlib=auto)
AC_ARG_ENABLE(bzip2,
AS_HELP_STRING([--enable-bzip2],
[enable bzip2 archive support (default: auto)]),,
@@ -198,12 +350,24 @@ AC_ARG_ENABLE(cdio-paranoia,
AS_HELP_STRING([--enable-cdio-paranoia],
[enable support for audio CD support]),,
enable_cdio_paranoia=auto)
MPD_DEPENDS([enable_cdio_paranoia], [enable_glib],
[Cannot use --enable-cdio-paranoia with --disable-glib])
AC_ARG_ENABLE(curl,
AS_HELP_STRING([--enable-curl],
[enable support for libcurl HTTP streaming (default: auto)]),,
[enable_curl=auto])
AC_ARG_ENABLE(smbclient,
AS_HELP_STRING([--enable-smbclient],
[enable support for libsmbclient (default: auto)]),,
[enable_smbclient=auto])
AC_ARG_ENABLE(nfs,
AS_HELP_STRING([--enable-nfs],
[enable support for libnfs (default: auto)]),,
[enable_nfs=auto])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable debugging (default: disabled)]),,
@@ -214,6 +378,11 @@ AC_ARG_ENABLE(documentation,
[build documentation (default: disable)]),,
[enable_documentation=no])
AC_ARG_ENABLE(dsd,
AS_HELP_STRING([--enable-dsd],
[enable DSD decoder (default: enable)]),,
[enable_dsd=yes])
AC_ARG_ENABLE(ffmpeg,
AS_HELP_STRING([--enable-ffmpeg],
[enable FFMPEG support]),,
@@ -238,11 +407,15 @@ AC_ARG_ENABLE(gme,
AS_HELP_STRING([--enable-gme],
[enable Blargg's game music emulator plugin]),,
enable_gme=auto)
MPD_DEPENDS([enable_gme], [enable_glib],
[Cannot use --enable-gme with --disable-glib])
AC_ARG_ENABLE(httpd-output,
AS_HELP_STRING([--enable-httpd-output],
[enables the HTTP server output]),,
[enable_httpd_output=auto])
MPD_DEPENDS([enable_httpd_output], [enable_glib],
[Cannot use --enable-httpd-output with --disable-glib])
AC_ARG_ENABLE(id3,
AS_HELP_STRING([--enable-id3],
@@ -268,18 +441,17 @@ AC_ARG_ENABLE(jack,
AS_HELP_STRING([--enable-jack],
[enable jack support]),,
enable_jack=auto)
MPD_DEPENDS([enable_jack], [enable_glib],
[Cannot use --enable-jack with --disable-glib])
AC_SYS_LARGEFILE
AC_ARG_ENABLE(despotify,
AS_HELP_STRING([--enable-despotify],
[enable support for despotify (default: disable)]),,
[enable_despotify=no])
AC_ARG_ENABLE(soundcloud,
AS_HELP_STRING([--enable-soundcloud],
[enable support for soundcloud.com]),,
[enable_soundcloud=auto])
MPD_DEPENDS([enable_soundcloud], [enable_glib],
[Cannot use --enable-soundcloud with --disable-glib])
AC_ARG_ENABLE(lame-encoder,
AS_HELP_STRING([--enable-lame-encoder],
@@ -295,6 +467,11 @@ AC_ARG_ENABLE(lsr,
[enable libsamplerate support]),,
enable_lsr=auto)
AC_ARG_ENABLE(soxr,
AS_HELP_STRING([--enable-soxr],
[enable the libsoxr resampler]),,
enable_soxr=auto)
AC_ARG_ENABLE(mad,
AS_HELP_STRING([--enable-mad],
[enable libmad mp3 decoder plugin]),,
@@ -364,7 +541,13 @@ AC_ARG_ENABLE(sidplay,
AS_HELP_STRING([--enable-sidplay],
[enable C64 SID support via libsidplay2]),,
enable_sidplay=auto)
MPD_DEPENDS([enable_sidplay], [enable_glib],
[Cannot use --enable-sidplay with --disable-glib])
AC_ARG_ENABLE(shine-encoder,
AS_HELP_STRING([--enable-shine-encoder],
[enables shine encoder]),,
[enable_shine_encoder=auto])
AC_ARG_ENABLE(shout,
AS_HELP_STRING([--enable-shout],
@@ -379,17 +562,19 @@ AC_ARG_ENABLE(sndfile,
AC_ARG_ENABLE(solaris_output,
AS_HELP_STRING([--enable-solaris-output],
[enables the Solaris /dev/audio output]),,
[enable_solaris_output=auto])
[enable_solaris_output=$host_is_solaris])
AC_ARG_ENABLE(sqlite,
AS_HELP_STRING([--enable-sqlite],
[enable support for the SQLite database]),,
[enable_sqlite=auto])
[enable_sqlite=$database_auto])
MPD_DEPENDS([enable_sqlite], [enable_glib],
[Cannot use --enable-sqlite with --disable-glib])
AC_ARG_ENABLE(systemd-daemon,
AS_HELP_STRING([--enable-systemd-daemon],
[use the systemd daemon library (default=auto)]),,
[enable_systemd_daemon=auto])
[enable_systemd_daemon=$linux_auto])
AC_ARG_ENABLE(tcp,
AS_HELP_STRING([--disable-tcp],
@@ -414,7 +599,7 @@ AC_ARG_ENABLE(twolame-encoder,
AC_ARG_ENABLE(un,
AS_HELP_STRING([--disable-un],
[disable support for clients connecting via unix domain sockets (default: enable)]),,
[enable_un=yes])
[enable_un=$host_is_unix])
AC_ARG_ENABLE(vorbis,
AS_HELP_STRING([--enable-vorbis],
@@ -425,6 +610,8 @@ AC_ARG_ENABLE(vorbis-encoder,
AS_HELP_STRING([--enable-vorbis-encoder],
[enable the Ogg Vorbis encoder]),,
[enable_vorbis_encoder=auto])
MPD_DEPENDS([enable_vorbis_encoder], [enable_glib],
[Cannot use --enable-vorbis-encoder with --disable-glib])
AC_ARG_ENABLE(wave-encoder,
AS_HELP_STRING([--enable-wave-encoder],
@@ -435,6 +622,8 @@ AC_ARG_ENABLE(wavpack,
AS_HELP_STRING([--enable-wavpack],
[enable WavPack support]),,
enable_wavpack=auto)
MPD_DEPENDS([enable_wavpack], [enable_glib],
[Cannot use --enable-wavpack with --disable-glib])
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],
@@ -470,13 +659,58 @@ AC_ARG_WITH(tremor-includes,
dnl ---------------------------------------------------------------------------
dnl Mandatory Libraries
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28 gthread-2.0],,
no_exceptions=yes
AX_BOOST_BASE([1.46],, [AC_MSG_ERROR([Boost not found])])
dnl Don't disable exceptions on Boost older than 1.54, because
dnl Boost.Intrusive supports this compiler mode only since 1.54;
dnl see https://svn.boost.org/trac/boost/ticket/7849
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION < 105400
#error detected Boost older than 1.54
#endif
]])],, [no_exceptions=no])
AC_LANG_POP([C++])
CPPFLAGS="$CPPFLAGS_SAVED"
AC_ARG_ENABLE(icu,
AS_HELP_STRING([--enable-icu],
[enable libicu for Unicode (default: enabled)]),,
enable_icu=yes)
if test x$enable_icu = xyes; then
PKG_CHECK_MODULES([ICU], [icu-i18n],,
[AC_MSG_ERROR([libicu not found])])
AC_DEFINE(HAVE_ICU, 1, [Define if libicu is used])
fi
AM_CONDITIONAL(HAVE_ICU, test x$enable_icu = xyes)
AC_ARG_ENABLE(glib,
AS_HELP_STRING([--enable-glib],
[enable GLib usage (default: enabled)]),,
enable_glib=yes)
if test x$enable_glib = xyes; then
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.28 gthread-2.0],,
[AC_MSG_ERROR([GLib 2.28 is required])])
if test x$GCC = xyes; then
# suppress warnings in the GLib headers
GLIB_CFLAGS=`echo $GLIB_CFLAGS |sed -e 's,-I/,-isystem /,g'`
if test x$GCC = xyes; then
# suppress warnings in the GLib headers
GLIB_CFLAGS=`echo $GLIB_CFLAGS |sed -e 's,-I/,-isystem /,g'`
fi
AC_DEFINE(HAVE_GLIB, 1, [Define if GLib is used])
fi
AM_CONDITIONAL(HAVE_GLIB, test x$enable_glib = xyes)
dnl ---------------------------------------------------------------------------
dnl Protocol Options
@@ -514,12 +748,6 @@ if test x$enable_tcp = xyes; then
AC_DEFINE(HAVE_TCP, 1, [Define if TCP socket support is enabled])
fi
case "$host_os" in
mingw* | windows* | cygwin*)
enable_un=no
;;
esac
if test x$enable_un = xyes; then
AC_DEFINE(HAVE_UN, 1, [Define if unix domain socket support is enabled])
STRUCT_UCRED
@@ -560,6 +788,15 @@ fi
AM_CONDITIONAL(HAVE_LIBMPDCLIENT, test x$enable_libmpdclient = xyes)
dnl -------------------------------- expat --------------------------------
MPD_AUTO_PKG(expat, EXPAT, [expat],
[expat XML parser], [expat not found])
if test x$enable_expat = xyes; then
AC_DEFINE(HAVE_EXPAT, 1, [Define to use the expat XML parser])
fi
AM_CONDITIONAL(HAVE_EXPAT, test x$enable_expat = xyes)
dnl --------------------------------- inotify ---------------------------------
AC_CHECK_FUNCS(inotify_init inotify_init1)
@@ -639,7 +876,7 @@ avahi)
;;
esac
MPD_AUTO_PKG(avahi, AVAHI, [avahi-client],
MPD_AUTO_PKG(avahi, AVAHI, [avahi-client dbus-1],
[avahi client library], [avahi-client not found])
if test x$enable_avahi = xyes; then
AC_DEFINE([HAVE_AVAHI], 1, [Define to enable Avahi Zeroconf support])
@@ -692,21 +929,22 @@ dnl Converter Plugins
dnl ---------------------------------------------------------------------------
dnl ------------------------------ libsamplerate ------------------------------
MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.0.15],
MPD_AUTO_PKG(lsr, SAMPLERATE, [samplerate >= 0.1.3],
[libsamplerate resampling], [libsamplerate not found])
if test x$enable_lsr = xyes; then
AC_DEFINE([HAVE_LIBSAMPLERATE], 1,
[Define to enable libsamplerate])
fi
AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
if test x$enable_lsr = xyes; then
PKG_CHECK_MODULES([SAMPLERATE_013],
[samplerate >= 0.1.3],,
[AC_DEFINE([HAVE_LIBSAMPLERATE_NOINT], 1,
[libsamplerate doesn't provide src_int_to_float_array() (<0.1.3)])])
dnl ------------------------------ libsoxr ------------------------------------
MPD_AUTO_PKG(soxr, SOXR, [soxr],
[libsoxr resampler], [libsoxr not found])
if test x$enable_soxr = xyes; then
AC_DEFINE([HAVE_SOXR], 1, [Define to enable libsoxr])
fi
AM_CONDITIONAL(HAVE_LIBSAMPLERATE, test x$enable_lsr = xyes)
AM_CONDITIONAL(HAVE_SOXR, test x$enable_soxr = xyes)
dnl ---------------------------------------------------------------------------
dnl Input Plugins
@@ -720,19 +958,28 @@ if test x$enable_curl = xyes; then
fi
AM_CONDITIONAL(ENABLE_CURL, test x$enable_curl = xyes)
dnl --------------------------------- Despotify ---------------------------------
MPD_AUTO_PKG(despotify, DESPOTIFY, [despotify],
[Despotify support], [despotify not found])
if test x$enable_despotify = xyes; then
AC_DEFINE(ENABLE_DESPOTIFY, 1, [Define when despotify is enabled])
dnl ----------------------------------- smbclient -----------------------------
MPD_AUTO_PKG_LIB(smbclient, SMBCLIENT, [smbclient >= 0.2],
[smbclient], [smbc_init], [-lsmbclient], [],
[smbclient input plugin], [libsmbclient not found])
if test x$enable_smbclient = xyes; then
AC_DEFINE(ENABLE_SMBCLIENT, 1, [Define when libsmbclient is used])
fi
AM_CONDITIONAL(ENABLE_DESPOTIFY, test x$enable_despotify = xyes)
AM_CONDITIONAL(ENABLE_SMBCLIENT, test x$enable_smbclient = xyes)
dnl ----------------------------------- NFS -----------------------------
MPD_AUTO_PKG(nfs, NFS, [libnfs],
[NFS input plugin], [libnfs not found])
if test x$enable_nfs = xyes; then
AC_DEFINE(ENABLE_NFS, 1, [Define when libnfs is used])
fi
AM_CONDITIONAL(ENABLE_NFS, test x$enable_nfs = xyes)
dnl --------------------------------- Soundcloud ------------------------------
if test x$enable_soundcloud != xno; then
PKG_CHECK_MODULES([YAJL], [yajl >= 2.0],
[found_soundcloud=yes],
AC_CHECK_LIB([yajl], [yajl_alloc],
AC_CHECK_LIB([yajl], [yajl_parse_complete],
[found_soundcloud=yes YAJL_CFLAGS=-DHAVE_YAJL1 YAJL_LIBS=-lyajl],
[found_soundcloud=no]))
fi
@@ -749,6 +996,7 @@ MPD_AUTO_PKG(cdio_paranoia, CDIO_PARANOIA, [libcdio_paranoia],
if test x$enable_cdio_paranoia = xyes; then
AC_DEFINE([ENABLE_CDIO_PARANOIA], 1,
[Define to enable libcdio_paranoia support])
AC_CHECK_HEADERS(cdio/paranoia/paranoia.h)
fi
AM_CONDITIONAL(ENABLE_CDIO_PARANOIA, test x$enable_cdio_paranoia = xyes)
@@ -762,6 +1010,30 @@ if test x$enable_mms = xyes; then
fi
AM_CONDITIONAL(ENABLE_MMS, test x$enable_mms = xyes)
dnl ---------------------------------------------------------------------------
dnl Neighbor Plugins
dnl ---------------------------------------------------------------------------
AC_ARG_ENABLE(neighbor-plugins,
AS_HELP_STRING([--enable-neighbor-plugins],
[enable support for neighbor discovery (default: auto)]),,
[enable_neighbor_plugins=auto])
if test x$enable_neighbor_plugins = xauto; then
if test x$enable_smbclient = xyes; then
enable_neighbor_plugins=yes
fi
if test x$enable_upnp = xyes; then
enable_neighbor_plugins=yes
fi
fi
if test x$enable_neighbor_plugins = xyes; then
AC_DEFINE(ENABLE_NEIGHBOR_PLUGINS, 1,
[Define to enable support for neighbor discovery])
fi
AM_CONDITIONAL(ENABLE_NEIGHBOR_PLUGINS, test x$enable_neighbor_plugins = xyes)
dnl ---------------------------------------------------------------------------
dnl Archive Plugins
dnl ---------------------------------------------------------------------------
@@ -781,6 +1053,16 @@ fi
AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
dnl ---------------------------------- zlib ---------------------------------
MPD_AUTO_PKG(zlib, ZLIB, [zlib],
[zlib support], [zlib not found])
AM_CONDITIONAL(HAVE_ZLIB, test x$enable_zlib = xyes)
if test x$enable_zlib = xyes; then
AC_DEFINE(HAVE_ZLIB, 1, [Define to enable zlib support])
fi
dnl ---------------------------------- libbz2 ---------------------------------
MPD_AUTO_LIB(bzip2, BZ2, bz2, BZ2_bzDecompressInit, [-lbz2], [],
@@ -797,6 +1079,24 @@ fi
AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
dnl ---------------------------------- libupnp ---------------------------------
if test x$enable_expat = xno; then
if test x$enable_upnp = xauto; then
AC_MSG_WARN([expat disabled -- disabling UPnP])
enable_upnp=no
elif test x$enable_upnp = xyes; then
AC_MSG_ERROR([expat disabled -- required for UPnP])
fi
fi
MPD_AUTO_PKG(upnp, UPNP, [libupnp],
[UPnP client support], [libupnp not found])
if test x$enable_upnp = xyes; then
AC_DEFINE(HAVE_LIBUPNP, 1, [Define when libupnp is used])
fi
AM_CONDITIONAL(HAVE_LIBUPNP, test x$enable_upnp = xyes)
dnl --------------------------------- libzzip ---------------------------------
MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
[libzzip archive library], [libzzip not found])
@@ -845,6 +1145,14 @@ if test x$enable_audiofile = xyes; then
AC_DEFINE(HAVE_AUDIOFILE, 1, [Define for audiofile support])
fi
dnl ----------------------------------- DSD -----------------------------------
if test x$enable_dsd = xyes; then
AC_DEFINE(ENABLE_DSD, 1, [Define for the DSD decoder])
fi
AM_CONDITIONAL(ENABLE_DSD, test x$enable_dsd = xyes)
dnl ----------------------------------- FAAD ----------------------------------
AM_PATH_FAAD()
@@ -874,10 +1182,12 @@ AM_CONDITIONAL(HAVE_FLAC, test x$enable_flac = xyes)
enable_flac_encoder=$enable_flac
dnl -------------------------------- FluidSynth -------------------------------
MPD_AUTO_PKG(fluidsynth, FLUIDSYNTH, [fluidsynth >= 1.1],
[fluidsynth decoder], [fluidsynth not found])
if test x$enable_fluidsynth = xyes; then
PKG_CHECK_MODULES(FLUIDSYNTH, [fluidsynth >= 1.1],
AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support]),
enable_fluidsynth=no)
AC_DEFINE(ENABLE_FLUIDSYNTH, 1, [Define for fluidsynth support])
fi
AM_CONDITIONAL(ENABLE_FLUIDSYNTH, test x$enable_fluidsynth = xyes)
@@ -957,7 +1267,7 @@ AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes)
dnl --------------------------------- musepack --------------------------------
MPD_AUTO_LIB(mpc, MPCDEC, mpcdec, main, [-lmpcdec], [],
MPD_AUTO_LIB(mpc, MPCDEC, mpcdec, mpc_demux_init, [-lmpcdec], [],
[mpcdec], [libmpcdec not found])
if test x$enable_mpc = xyes; then
AC_DEFINE(HAVE_MPCDEC, 1, [Define to use libmpcdec for MPC decoding])
@@ -1020,7 +1330,7 @@ if test x$enable_tremor = xyes; then
fi
fi
MPD_AUTO_PKG(vorbis, VORBIS, [vorbis vorbisfile ogg],
MPD_AUTO_PKG(vorbis, VORBIS, [vorbisfile vorbis ogg],
[Ogg Vorbis decoder], [libvorbis not found])
if test x$enable_vorbis = xyes; then
AC_DEFINE(ENABLE_VORBIS_DECODER, 1, [Define for Ogg Vorbis support])
@@ -1078,27 +1388,6 @@ AM_CONDITIONAL(ENABLE_WILDMIDI, test x$enable_wildmidi = xyes)
dnl ------------------------ Post Decoder Plugins Tests -----------------------
if
test x$enable_aac = xno &&
test x$enable_audiofile = xno &&
test x$enable_ffmpeg = xno &&
test x$enable_flac = xno &&
test x$enable_fluidsynth = xno &&
test x$enable_mad = xno &&
test x$enable_mikmod = xno; then
test x$enable_modplug = xno &&
test x$enable_mpc = xno &&
test x$enable_mpg123 = xno &&
test x$enable_opus = xno &&
test x$enable_sidplay = xno &&
test x$enable_tremor = xno &&
test x$enable_vorbis = xno &&
test x$enable_wavpack = xno &&
test x$enable_wildmidi = xno &&
AC_MSG_ERROR([No input plugins supported!])
fi
AM_CONDITIONAL(HAVE_XIPH,
test x$enable_vorbis = xyes || test x$enable_tremor = xyes || test x$enable_flac = xyes || test x$enable_opus = xyes)
@@ -1124,6 +1413,7 @@ else
enable_vorbis_encoder=no
enable_lame_encoder=no
enable_twolame_encoder=no
enable_shine_encoder=no
enable_wave_encoder=no
enable_flac_encoder=no
fi
@@ -1135,8 +1425,19 @@ if test x$enable_flac_encoder = xyes; then
fi
AM_CONDITIONAL(ENABLE_FLAC_ENCODER, test x$enable_flac_encoder = xyes)
dnl ------------------------------- Shine Encoder ------------------------------
MPD_AUTO_PKG(shine_encoder, SHINE, [shine >= 3.1],
[shine encoder], [libshine not found])
if test x$enable_shine_encoder = xyes; then
AC_DEFINE(ENABLE_SHINE_ENCODER, 1,
[Define to enable the shine encoder plugin])
fi
AM_CONDITIONAL(ENABLE_SHINE_ENCODER, test x$enable_shine_encoder = xyes)
dnl ---------------------------- Ogg Vorbis Encoder ---------------------------
MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc],
MPD_AUTO_PKG(vorbis_encoder, VORBISENC, [vorbisenc vorbis ogg],
[Ogg Vorbis encoder], [libvorbisenc not found])
if test x$enable_vorbis_encoder = xyes; then
@@ -1178,6 +1479,7 @@ if test x$enable_vorbis_encoder != xno ||
test x$enable_lame_encoder != xno ||
test x$enable_twolame_encoder != xno ||
test x$enable_flac_encoder != xno ||
test x$enable_shine_encoder != xno ||
test x$enable_wave_encoder != xno; then
# at least one encoder plugin is enabled
enable_encoder=yes
@@ -1373,18 +1675,6 @@ AM_CONDITIONAL(HAVE_SHOUT, test x$enable_shout = xyes)
dnl --------------------------------- Solaris ---------------------------------
if test x$enable_solaris_output = xauto; then
case "$host_os" in
solaris*)
enable_solaris_output=yes
;;
*)
enable_solaris_output=no
;;
esac
fi
if test x$enable_solaris_output = xyes; then
AC_DEFINE(ENABLE_SOLARIS_OUTPUT, 1, [Define to enable Solaris /dev/audio support])
fi
@@ -1393,48 +1683,26 @@ AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
dnl --------------------------------- WinMM ---------------------------------
case "$host_os" in
mingw32* | windows*)
AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
enable_winmm_output=yes
LIBS="$LIBS -lwinmm"
;;
*)
enable_winmm_output=no
;;
esac
if test "x$host_is_windows" = xyes; then
AC_DEFINE(ENABLE_WINMM_OUTPUT, 1, [Define to enable WinMM support])
enable_winmm_output=yes
LIBS="$LIBS -lwinmm"
else
enable_winmm_output=no
fi
AM_CONDITIONAL(ENABLE_WINMM_OUTPUT, test x$enable_winmm_output = xyes)
dnl --------------------- Post Audio Output Plugins Tests ---------------------
if
test x$enable_alsa = xno &&
test x$enable_roar = xno &&
test x$enable_ao = xno &&
test x$enable_fifo = xno &&
test x$enable_httpd_output = xno &&
test x$enable_jack = xno &&
test x$enable_openal = xno &&
test x$enable_oss = xno &&
test x$enable_osx = xno &&
test x$enable_pipe_output = xno &&
test x$enable_pulse = xno &&
test x$enable_recorder_output = xno &&
test x$enable_shout = xno &&
test x$enable_solaris_output = xno &&
test x$enable_winmm_output = xno; then
AC_MSG_ERROR([No Audio Output types configured!])
fi
dnl ---------------------------------------------------------------------------
dnl Documentation
dnl ---------------------------------------------------------------------------
if test x$enable_documentation = xyes; then
AC_PATH_PROG(XMLTO, xmlto)
if test x$XMLTO = x; then
AC_MSG_ERROR([xmlto not found])
fi
AC_SUBST(XMLTO)
AM_CONDITIONAL(HAVE_XMLTO, test x$XMLTO != x)
AC_PATH_PROG(DOXYGEN, doxygen)
if test x$DOXYGEN = x; then
@@ -1442,8 +1710,6 @@ if test x$enable_documentation = xyes; then
fi
AC_SUBST(DOXYGEN)
else
AM_CONDITIONAL(HAVE_XMLTO, false)
fi
AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
@@ -1478,8 +1744,12 @@ AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
AX_APPEND_COMPILE_FLAGS([-fno-threadsafe-statics])
AX_APPEND_COMPILE_FLAGS([-fmerge-all-constants])
AX_APPEND_COMPILE_FLAGS([-fno-exceptions])
AX_APPEND_COMPILE_FLAGS([-fno-rtti])
if test x$no_exceptions = xyes; then
AX_APPEND_COMPILE_FLAGS([-fno-exceptions])
AX_APPEND_COMPILE_FLAGS([-fno-rtti])
fi
AX_APPEND_COMPILE_FLAGS([-ffast-math])
AX_APPEND_COMPILE_FLAGS([-ftree-vectorize])
AC_LANG_POP
@@ -1546,9 +1816,14 @@ results(ipv6, "IPv6")
results(tcp, "TCP")
results(un,[UNIX Domain Sockets])
printf '\nStorage support:\n\t'
results(nfs, [NFS])
results(smbclient, [SMB])
printf '\nFile format support:\n\t'
results(aac, [AAC])
results(adplug, [AdPlug])
results(dsd, [DSD])
results(sidplay, [C64 SID])
results(ffmpeg, [FFMPEG])
results(flac, [FLAC])
@@ -1571,6 +1846,7 @@ results(wildmidi, [WildMidi])
printf '\nOther features:\n\t'
results(lsr, [libsamplerate])
results(soxr, [libsoxr])
results(libmpdclient, [libmpdclient])
results(inotify, [inotify])
results(sqlite, [SQLite])
@@ -1604,6 +1880,7 @@ if
printf '\nStreaming encoder support:\n\t'
results(flac_encoder, [FLAC])
results(lame_encoder, [LAME])
results(shine_encoder, [Shine])
results(vorbis_encoder, [Ogg Vorbis])
results(opus, [Opus])
results(twolame_encoder, [TwoLAME])
@@ -1613,11 +1890,14 @@ fi
printf '\nStreaming support:\n\t'
results(cdio_paranoia, [CDIO_PARANOIA])
results(curl,[CURL])
results(despotify,[Despotify])
results(smbclient,[SMBCLIENT])
results(soundcloud,[Soundcloud])
printf '\n\t'
results(mms,[MMS])
printf '\nEvent loop:\n\t'
printf $with_pollmethod
printf '\n\n##########################################\n\n'
echo 'Generating files needed for compilation'
@@ -1627,7 +1907,7 @@ dnl Generate files
dnl ---------------------------------------------------------------------------
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(doc/doxygen.conf)
AC_CONFIG_FILES(mpd.service)
AC_CONFIG_FILES(systemd/mpd.service)
AC_OUTPUT
echo 'MPD is ready for compilation, type "make" to begin.'

View File

@@ -10,7 +10,7 @@
<para>
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 50 people have contributed
contributions. So far, more than 150 people have contributed
patches.
</para>
@@ -68,12 +68,28 @@ foo(const char *abc, int xyz)
<chapter>
<title>Hacking The Source</title>
<para>
MPD sources are managed in a git repository on <ulink
url="http://git.musicpd.org/">git.musicpd.org</ulink>.
</para>
<para>
Always write your code against the latest git:
</para>
<programlisting>git clone git://git.musicpd.org/master/mpd.git</programlisting>
<para>
If you already have a clone, update it:
</para>
<programlisting>git pull --rebase git://git.musicpd.org/master/mpd.git master</programlisting>
<para>
You can do without "--rebase", but we recommend that you rebase
your repository on the "master" repository all the time.
</para>
<para>
Configure with the options <option>--enable-debug
--enable-werror</option>. Enable as many plugins as possible,
@@ -83,8 +99,55 @@ foo(const char *abc, int xyz)
<para>
Don't mix several changes in one single patch. Create a
separate patch for every change. Tools like
<application>stgit</application> help you with that.
<application>stgit</application> help you with that. This way,
we can review your patches more easily, and we can pick the
patches we like most first.
</para>
<section>
<title> Basic stgit usage</title>
<para>
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.
</para>
<para>
stgit needs to be initialized on a git repository: stg init
</para>
<para>
Before you edit the code, create a patch: stg new
my-patch-name (stgit now asks you for the commit message).
</para>
<para>
Now edit the code. Once you're finished, you have to "refresh"
the patch, i.e. your edits are incorporated into the patch you
have created: stg refresh
</para>
<para>
You may now continue editing the same patch, and refresh it as
often as you like. Create more patches, edit and refresh them.
</para>
<para>
To view the list of patches, type stg series. To go back to a
specific patch, type stg goto my-patch-name; now you can
re-edit it (don't forget stg refresh when you're finished with
that patch).
</para>
<para>
When the whole patch series is finished, convert stgit patches
to git commits: stg commit
</para>
</section>
</chapter>
<chapter>
@@ -92,7 +155,53 @@ foo(const char *abc, int xyz)
<para>
Send your patches to the mailing list:
musicpd-dev-team@lists.sourceforge.net
<email>mpd-devel@musicpd.org</email> (<ulink
url="http://mailman.blarg.de/listinfo/mpd-devel">subscribe
here</ulink>)
</para>
<para>
<command>git pull</command> requests are preferred. Regular
contributors can get <ulink
url="http://git.musicpd.org/account-policy.html">an account on
git.musicpd.org</ulink>, but any public git repository will do.
</para>
</chapter>
<chapter>
<title>Development Tools</title>
<section>
<title>Clang Static Analyzer</title>
<para>
The <ulink url="http://clang-analyzer.llvm.org/">clang static
analyzer</ulink> is a tool that helps find bugs. To run it on
the MPD code base, install LLVM and clang. Configure MPD to
use clang:
</para>
<programlisting>./configure --enable-debug CXX=clang++ CC=clang ...</programlisting>
<para>
It is recommended to use <option>--enable-debug</option>,
because the analyzer takes advantage of
<function>assert()</function> calls, which are only enabled in
the debug build.
</para>
<para>
Now run the analyzer:
</para>
<programlisting>scan-build --use-c++=clang++ --use-cc=clang make</programlisting>
<para>
The options <option>--use-c++</option> and
<option>--use-cc</option> are necessary because it invokes
<command>cc</command> for actually compiling the sources by
default. That breaks, because MPD requires a C99 compiler.
</para>
</section>
</chapter>
</book>

View File

@@ -136,53 +136,6 @@ for the format of this parameter. Multiple audio_output sections may be
specified. If no audio_output section is specified, then MPD will scan for a
usable audio output.
.TP
.B audio_output_format <sample_rate:bits:channels>
This specifies the sample rate, bits per sample, and number of channels of
audio that is sent to each audio output. Note that audio outputs may specify
their own audio format which will be used for actual output to the audio
device. An example is "44100:16:2" for 44100Hz, 16 bits, and 2 channels. The
default is to use the audio format of the input file.
Any of the three attributes may be an asterisk to specify that this
attribute should not be enforced
.TP
.B samplerate_converter <integer or prefix>
This specifies the libsamplerate converter to use. The supplied value should
either be an integer or a prefix of the name of a converter. The default is
"Fastest Sinc Interpolator".
At the time of this writing, the following converters are available:
.RS
.TP
Best Sinc Interpolator (0)
Band limited sinc interpolation, best quality, 97dB SNR, 96% BW.
.TP
Medium Sinc Interpolator (1)
Band limited sinc interpolation, medium quality, 97dB SNR, 90% BW.
.TP
Fastest Sinc Interpolator (2)
Band limited sinc interpolation, fastest, 97dB SNR, 80% BW.
.TP
ZOH Interpolator (3)
Zero order hold interpolator, very fast, very poor quality with audible
distortions.
.TP
Linear Interpolator (4)
Linear interpolator, very fast, poor quality.
.TP
internal
Poor quality, no floating point operations. This is the default (and
only choice) if MPD was compiled without libsamplerate.
.RE
.IP
For an up-to-date list of available converters, please see the libsamplerate
documentation (available online at <\fBhttp://www.mega\-nerd.com/SRC/\fP>).
.TP
.B replaygain <off or album or track or auto>
If specified, mpd will adjust the volume of songs played using ReplayGain tags
(see <\fBhttp://www.replaygain.org/\fP>). Setting this to "album" will adjust
@@ -198,39 +151,6 @@ This is the gain (in dB) applied to songs with ReplayGain tags.
.B volume_normalization <yes or no>
If yes, mpd will normalize the volume of songs as they play. The default is no.
.TP
.B audio_buffer_size <size in KiB>
This specifies the size of the audio buffer in kibibytes. The default is 4096,
large enough for nearly 12 seconds of CD-quality audio.
.TP
.B buffer_before_play <0-100%>
This specifies how much of the audio buffer should be filled before playing a
song. Try increasing this if you hear skipping when manually changing songs.
The default is 10%, a little over 1 second of CD-quality audio with the default
buffer size.
.TP
.B http_proxy_host <hostname>
This setting is deprecated. Use the "proxy" setting in the "curl"
input block. See MPD user manual for details.
.TP
.B connection_timeout <seconds>
If a client does not send any new data in this time period, the connection is
closed. The default is 60.
.TP
.B max_connections <number>
This specifies the maximum number of clients that can be connected to mpd. The
default is 5.
.TP
.B max_playlist_length <number>
This specifies the maximum number of songs that can be in the playlist. The
default is 16384.
.TP
.B max_command_list_size <size in KiB>
This specifies the maximum size a command list can be. The default is 2048.
.TP
.B max_output_buffer_size <size in KiB>
This specifies the maximum size of the output buffer to a client. The default
is 8192.
.TP
.B filesystem_charset <charset>
This specifies the character set used for the filesystem. A list of supported
character sets can be obtained by running "iconv \-l". The default is
@@ -260,7 +180,8 @@ clients. Note that you must recreate (not update) your database for changes to
this parameter to take effect. Possible values are artist, album, title,
track, name, genre, date, composer, performer, comment, disc,
musicbrainz_artistid, musicbrainz_albumid, musicbrainz_albumartistid,
musicbrainz_trackid. Multiple tags may be specified as a comma separated list.
musicbrainz_releasetrackid, musicbrainz_trackid. Multiple tags may be specified
as a comma separated list.
An example value is "artist,album,title,track". The special value "none" may
be used alone to disable all metadata. The default is to use all known tag
types except for comments and those starting with "musicbrainz".
@@ -274,16 +195,6 @@ of database.
Limit the depth of the directories being watched, 0 means only watch
the music directory itself. There is no limit by default.
.TP
.B despotify_user <name>
This specifies the user to use when logging in to Spotify using the despotify plugins.
.TP
.B despotify_password <name>
This specifies the password to use when logging in to Spotify using the despotify plugins.
.TP
.B despotify_high_bitrate <yes or no>
This specifies if the requested bitrate for Spotify should be high or not. Higher sounds
better but requires more processing and higher bandwidth. Default is yes.
.TP
.SH REQUIRED AUDIO OUTPUT PARAMETERS
.TP
.B type <type>
@@ -363,137 +274,6 @@ errors on bandwidth-limited devices. Some users have reported good results
with this set to 50000, but not all devices support values this high. Most
users do not need to change this. The default is 256000000 / sample_rate(kHz),
or 5804 microseconds for CD-quality audio.
.SH OPTIONAL OSS OUTPUT PARAMETERS
.TP
.B device <dev>
This specifies the device to use for audio output. The default is "/dev/dsp".
.TP
.B mixer_device <mixer dev>
This specifies which mixer to use. The default is "/dev/mixer".
.TP
.B mixer_control <mixer ctrl>
This specifies which mixer control to use (sometimes referred to as the
"device"). The default is to use the main PCM mixer. An example is "Pcm".
.SH OPTIONAL PULSE OUTPUT PARAMETERS
.TP
.B server <server list>
A space separated list of servers to try to connect to. See
<\fBhttp://www.pulseaudio.org/wiki/ServerStrings\fP> for more details. The
default is to let PulseAudio choose a server.
If you specify more than one server name, MPD tries to connect to one
after another until it successfully establishes a connection.
.TP
.B sink <sink>
The sink to output to. The default is to let PulseAudio choose a sink.
.SH OPTIONAL JACK OUTPUT PARAMETERS
.TP
.B client_name <name>
The client name to use when connecting to JACK. The output ports <name>:left
and <name>:right will also be created for the left and right channels,
respectively.
.TP
.B ports <left_port,right_port>
This specifies the left and right ports to connect to for the left and right
channels, respectively. The default is to let JACK choose a pair of ports.
.TP
.B ringbuffer_size <size in bytes>
This specifies the size of the ringbuffer in bytes. The default is 32768.
.SH OPTIONAL AO OUTPUT PARAMETERS
.TP
.B driver <driver>
This specifies the libao driver to use for audio output. Possible values
depend on what libao drivers are available. See
<\fBhttp://www.xiph.org/ao/doc/drivers.html\fP> for information on some
commonly used drivers. Typical values for Linux include "oss" and "alsa09".
The default is "default", which causes libao to select an appropriate plugin.
.TP
.B options <opts>
This specifies the options to use for the selected libao driver. For oss, the
only option available is "dsp". For alsa09, the available options are: "dev",
"buf_size", and "periods". See <\fBhttp://www.xiph.org/ao/doc/drivers.html\fP>
for available options for some commonly used drivers. Options are assigned
using "=", and ";" is used to separate options. An example for oss:
"dsp=/dev/dsp". An example for alsa09: "dev=hw:0,0;buf_size=4096". The
default is "".
.TP
.B write_size <size in bytes>
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.
.SH REQUIRED FIFO OUTPUT PARAMETERS
.TP
.B path <path>
This specifies the path of the FIFO to output 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 \fBnot\fP 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.
.SH REQUIRED SHOUT OUTPUT PARAMETERS
.TP
.B name <name>
This specifies not only the unique audio output name, but also the stream
title.
.TP
.B host <hostname>
This specifies the hostname of the icecast server to connect to.
.TP
.B port <port>
This specifies the port of the icecast server to connect to.
.TP
.B mount <mountpoint>
This specifies the icecast mountpoint to use.
.TP
.B password <password>
This specifies the password to use when logging in to the icecast server.
.TP
.B quality <quality>
This specifies the encoding quality to use. The value must be between 0
and 10. Fractional values, such as 2.5, are permitted. Either the quality or
the bitrate parameter must be specified, but not both. For Ogg, a
higher quality number produces higher quality output. For MP3, it's
just the opposite, with lower numbers producing higher quality output.
.TP
.B bitrate <kbps>
This specifies the bitrate to use for encoding. Either the quality or the
bitrate parameter must be specified, but not both.
.TP
.B format <sample_rate:bits:channels>
This specifies the sample rate, bits per sample, and number of channels to use
for encoding.
.SH OPTIONAL SHOUT OUTPUT PARAMETERS
.TP
.B encoding <encoding>
This specifies which output encoding to use. Should be either "ogg"
or "mp3", "mp3" is needed for shoutcast streaming. The default is "ogg".
.TP
.B protocol <protocol>
This specifies the protocol that wil be used to connect to the
icecast/shoutcast server. The options are "shoutcast", "icecast1" and
"icecast2". The default is "icecast2".
.TP
.B user <username>
This specifies the username to use when logging in to the icecast server. The
default is "source".
.TP
.B public <yes or no>
This specifies whether to request that the stream be listed in all public
stream directories that the icecast server knows about. The default is no.
.TP
.B timeout <seconds>
This specifies the number of seconds to wait before giving up on trying to
connect to the icecast server. The default is 2 seconds.
.TP
.B description <description>
This specifies a description of the stream.
.TP
.B url <url>
This specifies a URL associated with the stream.
.TP
.B genre <genre>
This specifies the genre(s) of the stream.
.SH FILES
.TP
.BI ~/.mpdconf

View File

@@ -1,5 +1,5 @@
# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# Files and directories #######################################################
@@ -204,16 +204,12 @@ input {
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of
# other audio outputs.
#
# An example of an ALSA output:
#
#audio_output {
# type "alsa"
# name "My ALSA Device"
## device "hw:0,0" # optional
## format "44100:16:2" # optional
## mixer_type "hardware" # optional
## mixer_device "default" # optional
## mixer_control "PCM" # optional
@@ -226,7 +222,6 @@ input {
# type "oss"
# name "My OSS Device"
## device "/dev/dsp" # optional
## format "44100:16:2" # optional
## mixer_type "hardware" # optional
## mixer_device "/dev/mixer" # optional
## mixer_control "PCM" # optional
@@ -330,12 +325,6 @@ input {
# mixer_type "none" # optional
#}
#
# This setting will change all decoded audio to be converted to the specified
# format before being passed to the audio outputs. By default, this setting is
# disabled.
#
#audio_output_format "44100:16:2"
#
# If MPD has been compiled with libsamplerate support, this setting specifies
# the sample rate converter to use. Possible values can be found in the
# mpd.conf man page or the libsamplerate documentation. By default, this is
@@ -384,38 +373,6 @@ input {
#
###############################################################################
# MPD Internal Buffering ######################################################
#
# This setting adjusts the size of internal decoded audio buffering. Changing
# this may have undesired effects. Don't change this if you don't know what you
# are doing.
#
#audio_buffer_size "4096"
#
# This setting controls the percentage of the buffer which is filled before
# beginning to play. Increasing this reduces the chance of audio file skipping,
# at the cost of increased time prior to audio playback.
#
#buffer_before_play "10%"
#
###############################################################################
# Resource Limitations ########################################################
#
# These settings are various limitations to prevent MPD from using too many
# resources. Generally, these settings should be minimized to prevent security
# risks, depending on the operating resources.
#
#connection_timeout "60"
#max_connections "10"
#max_playlist_length "16384"
#max_command_list_size "2048"
#max_output_buffer_size "8192"
#
###############################################################################
# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you

View File

@@ -4,18 +4,18 @@
<book>
<title>The Music Player Daemon protocol</title>
<chapter>
<chapter id="syntax">
<title>General protocol syntax</title>
<section>
<title>Protocol overview</title>
<para>
The MPD command protocol exchanges line-based text records
between client and server over TCP. Once the client is
connected to the server, they conduct a conversation until the
client closes the connection. The conversation flow is always
initiated by the client.
The <application>MPD</application> command protocol exchanges
line-based text records between client and server over TCP.
Once the client is connected to the server, they conduct a
conversation until the client closes the connection. The
conversation flow is always initiated by the client.
</para>
<para>
@@ -38,7 +38,7 @@
</para>
</section>
<section>
<section id="request_syntax">
<title>Requests</title>
<cmdsynopsis>
@@ -70,7 +70,7 @@
</para>
</section>
<section>
<section id="response_syntax">
<title>Responses</title>
<para>
@@ -79,7 +79,7 @@
denote the end of command execution.
</para>
<section>
<section id="failure_response_syntax">
<title>Failure responses</title>
<para>
@@ -188,7 +188,7 @@
</para>
</section>
<section>
<section id="range_syntax">
<title>Ranges</title>
<para>
@@ -203,21 +203,21 @@
</section>
</chapter>
<chapter>
<chapter id="recipes">
<title>Recipes</title>
<section>
<section id="queuing_recipe">
<title>Queuing</title>
<para>
Often, users run MPD with "<link
Often, users run <application>MPD</application> with "<link
linkend="command_random">random</link>" enabled, but want to
be able to insert songs "before" the rest of the playlist.
That is commonly called "queuing".
</para>
<para>
MPD implements this by allowing the client to specify a
<application>MPD</application> implements this by allowing the client to specify a
"priority" for each song in the playlist (commands <link
linkend="command_prio"><command>prio</command></link> and
<link
@@ -227,24 +227,25 @@
</para>
<para>
In "random" mode, MPD maintains an internal randomized
sequence of songs. In this sequence, songs with a higher
priority come first, and all songs with the same priority are
shuffled (by default, all songs are shuffled, because all have
the same priority "0"). When you increase the priority of a
song, it is moved to the front of the sequence according to
its new priority, but always after the current one. A song
that has been played already (it's "before" the current song
in that sequence) will only be scheduled for repeated playback
if its priority has become bigger than the priority of the
current song. Decreasing the priority of a song will moved it
farther to the end of the sequence. Changing the priority of
the current song has no effect on the sequence.
In "random" mode, <application>MPD</application> maintains an
internal randomized sequence of songs. In this sequence,
songs with a higher priority come first, and all songs with
the same priority are shuffled (by default, all songs are
shuffled, because all have the same priority "0"). When you
increase the priority of a song, it is moved to the front of
the sequence according to its new priority, but always after
the current one. A song that has been played already (it's
"before" the current song in that sequence) will only be
scheduled for repeated playback if its priority has become
bigger than the priority of the current song. Decreasing the
priority of a song will moved it farther to the end of the
sequence. Changing the priority of the current song has no
effect on the sequence.
</para>
</section>
</chapter>
<chapter>
<chapter id="command_reference">
<title>Command reference</title>
<note>
@@ -255,12 +256,12 @@
commands using song ids should be used instead of the commands
that manipulate and control playback based on playlist
position. Using song ids is a safer method when multiple
clients are interacting with MPD.
clients are interacting with <application>MPD</application>.
</para>
</note>
<section>
<title>Querying MPD's status</title>
<section id="status_commands">
<title>Querying <application>MPD</application>'s status</title>
<variablelist>
<varlistentry id="command_clearerror">
@@ -298,12 +299,14 @@
</term>
<listitem>
<para>
<footnote id="since_0_14"><simpara>Introduced with MPD 0.14</simpara></footnote>
<footnote id="since_0_14"><simpara>Introduced with
<application>MPD</application> 0.14</simpara></footnote>
Waits until there is a noteworthy change in one or more
of MPD's subsystems. As soon as there is one, it lists
all changed systems in a line in the format
<returnvalue>changed: SUBSYSTEM</returnvalue>, where
SUBSYSTEM is one of the following:
of <application>MPD</application>'s subsystems. As soon
as there is one, it lists all changed systems in a line
in the format <returnvalue>changed:
SUBSYSTEM</returnvalue>, where SUBSYSTEM is one of the
following:
</para>
<itemizedlist>
<listitem>
@@ -385,14 +388,15 @@
to wait for events as long as mpd runs. The
<command>idle</command> command can be canceled by
sending the command <command>noidle</command> (no other
commands are allowed). MPD will then leave
<command>idle</command> mode and print results
immediately; might be empty at this time.
commands are allowed). <application>MPD</application>
will then leave <command>idle</command> mode and print
results immediately; might be empty at this time.
</para>
<para>
If the optional <varname>SUBSYSTEMS</varname> argument is used,
MPD will only send notifications when something changed in
one of the specified subsytems.
If the optional <varname>SUBSYSTEMS</varname> argument
is used, <application>MPD</application> will only send
notifications when something changed in one of the
specified subsytems.
</para>
</listitem>
</varlistentry>
@@ -429,7 +433,7 @@
<listitem>
<para>
<varname>single</varname>:
<footnote id="since_0_15"><simpara>Introduced with MPD 0.15</simpara></footnote>
<footnote id="since_0_15"><simpara>Introduced with <application>MPD</application> 0.15</simpara></footnote>
<returnvalue>0 or 1</returnvalue>
</para>
</listitem>
@@ -504,7 +508,7 @@
<listitem>
<para>
<varname>elapsed</varname>:
<footnote id="since_0_16"><simpara>Introduced with MPD 0.16</simpara></footnote>
<footnote id="since_0_16"><simpara>Introduced with <application>MPD</application> 0.16</simpara></footnote>
<returnvalue>
Total time elapsed within the current song, but
with higher resolution.
@@ -576,7 +580,12 @@
</listitem>
<listitem>
<para>
<varname>songs</varname>: number of albums
<varname>albums</varname>: number of albums
</para>
</listitem>
<listitem>
<para>
<varname>songs</varname>: number of songs
</para>
</listitem>
<listitem>
@@ -607,7 +616,7 @@
</variablelist>
</section>
<section>
<section id="playback_option_commands">
<title>Playback options</title>
<variablelist>
@@ -740,7 +749,7 @@
<parameter>album</parameter>,
<parameter>auto</parameter><footnote
id="replay_gain_auto_since_0_16">
<simpara>added in MPD 0.16</simpara>
<simpara>added in <application>MPD</application> 0.16</simpara>
</footnote>.
</para>
<para>
@@ -790,7 +799,7 @@
</variablelist>
</section>
<section>
<section id="playback_commands">
<title>Controlling playback</title>
<variablelist>
@@ -877,8 +886,8 @@
<listitem>
<para>
Seeks to the position <varname>TIME</varname> (in
seconds) of entry <varname>SONGPOS</varname> in the
playlist.
seconds; fractions allowed) of entry
<varname>SONGPOS</varname> in the playlist.
</para>
</listitem>
</varlistentry>
@@ -893,7 +902,8 @@
<listitem>
<para>
Seeks to the position <varname>TIME</varname> (in
seconds) of song <varname>SONGID</varname>.
seconds; fractions allowed) of song
<varname>SONGID</varname>.
</para>
</listitem>
</varlistentry>
@@ -907,9 +917,10 @@
</term>
<listitem>
<para>
Seeks to the position <varname>TIME</varname> within the
current song. If prefixed by '+' or '-', then the time
is relative to the current playing position.
Seeks to the position <varname>TIME</varname> (in
seconds; fractions allowed) within the current song. If
prefixed by '+' or '-', then the time is relative to the
current playing position.
</para>
</listitem>
</varlistentry>
@@ -929,7 +940,7 @@
</variablelist>
</section>
<section>
<section id="queue">
<title>The current playlist</title>
<variablelist>
@@ -1030,7 +1041,7 @@ OK
at <varname>START:END</varname> to <varname>TO</varname>
in the playlist.
<footnote id="range_since_0_15">
<simpara>Ranges are supported since MPD 0.15</simpara>
<simpara>Ranges are supported since <application>MPD</application> 0.15</simpara>
</footnote>
</para>
</listitem>
@@ -1130,7 +1141,7 @@ OK
</term>
<listitem>
<para>
Searches case-sensitively for partial matches in the
Searches case-insensitively for partial matches in the
current playlist.
</para>
</listitem>
@@ -1213,6 +1224,28 @@ OK
</listitem>
</varlistentry>
<varlistentry id="command_rangeid">
<term>
<cmdsynopsis>
<command>rangeid</command>
<arg choice="req"><replaceable>ID</replaceable></arg>
<arg choice="req"><replaceable>START:END</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
<footnote id="since_0_19"><simpara>Since <application>MPD</application>
0.19</simpara></footnote> Specifies the portion of the
song that shall be played. <varname>START</varname> and
<varname>END</varname> are offsets in seconds
(fractional seconds allowed); both are optional.
Omitting both (i.e. sending just ":") means "remove the
range, play everything". A song that is currently
playing cannot be manipulated this way.
</para>
</listitem>
</varlistentry>
<varlistentry id="command_shuffle">
<term>
<cmdsynopsis>
@@ -1258,10 +1291,48 @@ OK
</para>
</listitem>
</varlistentry>
<varlistentry id="command_addtagid">
<term>
<cmdsynopsis>
<command>addtagid</command>
<arg choice="req"><replaceable>SONGID</replaceable></arg>
<arg choice="req"><replaceable>TAG</replaceable></arg>
<arg choice="req"><replaceable>VALUE</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Adds a tag to the specified song. Editing song tags is
only possible for remote songs. This change is
volatile: it may be overwritten by tags received from
the server, and the data is gone when the song gets
removed from the queue.
</para>
</listitem>
</varlistentry>
<varlistentry id="command_cleartagid">
<term>
<cmdsynopsis>
<command>cleartagid</command>
<arg choice="req"><replaceable>SONGID</replaceable></arg>
<arg choice="opt"><replaceable>TAG</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Removes tags from the specified song. If
<varname>TAG</varname> is not specified, then all tag
values will be removed. Editing song tags is only
possible for remote songs.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<section>
<section id="playlist_files">
<title>Stored playlists</title>
<para>
@@ -1451,16 +1522,20 @@ OK
</variablelist>
</section>
<section>
<section id="database">
<title>The music database</title>
<variablelist>
<varlistentry id="command_count">
<term>
<cmdsynopsis>
<command>count</command>
<arg choice="req"><replaceable>TAG</replaceable></arg>
<arg choice="req"><replaceable>NEEDLE</replaceable></arg>
<arg choice="opt"><replaceable>...</replaceable></arg>
<arg choice="opt">group</arg>
<arg choice="opt"><replaceable>GROUPTYPE</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
@@ -1468,8 +1543,15 @@ OK
Counts the number of songs and their total playtime in
the db matching <varname>TAG</varname> exactly.
</para>
<para>
The <parameter>group</parameter> keyword may be used to
group the results by a tag. The following prints
per-artist counts:
</para>
<programlisting>count group artist</programlisting>
</listitem>
</varlistentry>
<varlistentry id="command_find">
<term>
<cmdsynopsis>
@@ -1483,15 +1565,43 @@ OK
<para>
Finds songs in the db that are exactly
<varname>WHAT</varname>. <varname>TYPE</varname> can
be any tag supported by MPD, or one of the three special
parameters<parameter>file</parameter> to search by
be any tag supported by <application>MPD</application>, or one of the special
parameters:
</para>
full path (relative to the music directory),
<parameter>in</parameter> to restrict the search to
songs in the given directory (also relative to the music
directory) and
<parameter>any</parameter> to match against all
available tags. <varname>WHAT</varname> is what to find.
<itemizedlist>
<listitem>
<para>
<parameter>any</parameter> checks all tag values
</para>
</listitem>
<listitem>
<para>
<parameter>file</parameter> checks the full path
(relative to the music directory)
</para>
</listitem>
<listitem>
<para>
<parameter>base</parameter> restricts the search to
songs in the given directory (also relative to the
music directory)
</para>
</listitem>
<listitem>
<para>
<parameter>modified-since</parameter> compares the
file's time stamp with the given value (ISO 8601 or
UNIX time stamp)
</para>
</listitem>
</itemizedlist>
<para>
<varname>WHAT</varname> is what to find.
</para>
</listitem>
</varlistentry>
@@ -1512,27 +1622,43 @@ OK
</para>
</listitem>
</varlistentry>
<varlistentry id="command_list">
<term>
<cmdsynopsis>
<command>list</command>
<arg choice="req"><replaceable>TYPE</replaceable></arg>
<arg><replaceable>ARTIST</replaceable></arg>
<arg choice="opt"><replaceable>FILTERTYPE</replaceable></arg>
<arg choice="opt"><replaceable>FILTERWHAT</replaceable></arg>
<arg choice="opt"><replaceable>...</replaceable></arg>
<arg choice="opt">group</arg>
<arg choice="opt"><replaceable>GROUPTYPE</replaceable></arg>
<arg choice="opt"><replaceable>...</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Lists all tags of the specified type.
<varname>TYPE</varname> can be any tag supported by MPD or
Lists unique tags values of the specified type.
<varname>TYPE</varname> can be any tag supported by
<application>MPD</application> or
<parameter>file</parameter>.
</para>
<para>
<varname>ARTIST</varname> is an optional parameter when
type is album, this specifies to list albums by an
artist.
Additional arguments may specify a filter like the one
in the <link
linkend="command_find"><command>find</command>
command</link>.
</para>
<para>
The <parameter>group</parameter> keyword may be used
(repeatedly) to group the results by one or more tags.
The following example lists all album names,
grouped by their respective (album) artist:
</para>
<programlisting>list album group albumartist</programlisting>
</listitem>
</varlistentry>
<varlistentry id="command_listall">
<term>
<cmdsynopsis>
@@ -1545,6 +1671,14 @@ OK
Lists all songs and directories in
<varname>URI</varname>.
</para>
<para>
Do not use this command. Do not manage a client-side
copy of <application>MPD</application>'s database. That
is fragile and adds huge overhead. It will break with
large databases. Instead, query
<application>MPD</application> whenever you need
something.
</para>
</listitem>
</varlistentry>
<varlistentry id="command_listallinfo">
@@ -1560,6 +1694,40 @@ OK
returns metadata info in the same format as
<command>lsinfo</command>.
</para>
<para>
Do not use this command. Do not manage a client-side
copy of <application>MPD</application>'s database. That
is fragile and adds huge overhead. It will break with
large databases. Instead, query
<application>MPD</application> whenever you need
something.
</para>
</listitem>
</varlistentry>
<varlistentry id="command_listfiles">
<term>
<cmdsynopsis>
<command>listfiles</command>
<arg><replaceable>URI</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Lists the contents of the directory
<varname>URI</varname>, including files are not
recognized by <application>MPD</application>.
<varname>URI</varname> can be a path relative to the
music directory or an URI understood by one of the
storage plugins. The response contains at least one
line for each directory entry with the prefix "file: "
or "directory: ", and may be followed by file attributes
such as "Last-Modified" and "size".
</para>
<para>
For example, "smb://SERVER" returns a list of all shares
on the given SMB/CIFS server; "nfs://servername/path"
obtains a directory listing from the NFS server.
</para>
</listitem>
</varlistentry>
<varlistentry id="command_lsinfo">
@@ -1579,6 +1747,10 @@ OK
the list of stored playlists. This behavior is
deprecated; use "listplaylists" instead.
</para>
<para>
This command may be used to list metadata of remote
files (e.g. URI beginning with "http://" or "smb://").
</para>
<para>
Clients that are connected via UNIX domain socket may
use this command to read the tags of an arbitrary local
@@ -1600,6 +1772,10 @@ OK
to the music directory or a URL in the form
"file:///foo/bar.ogg".
</para>
<para>
This command may be used to list metadata of remote
files (e.g. URI beginning with "http://" or "smb://").
</para>
<para>
The response consists of lines in the form "KEY: VALUE".
Comments with suspicious characters (e.g. newlines) are
@@ -1717,22 +1893,131 @@ OK
</variablelist>
</section>
<section>
<section id="mount">
<title>Mounts and neighbors</title>
<para>
A "storage" provides access to files in a directory tree. The
most basic storage plugin is the "local" storage plugin which
accesses the local file system, and there are plugins to
access NFS and SMB servers.
</para>
<para>
Multiple storages can be "mounted" together, similar to the
<application>mount</application> command on many operating
systems, but without cooperation from the kernel. No
superuser privileges are necessary, beause this mapping exists
only inside the <application>MPD</application> process
</para>
<variablelist>
<varlistentry id="command_mount">
<term>
<cmdsynopsis>
<command>mount</command>
<arg choice="req"><replaceable>PATH</replaceable></arg>
<arg choice="req"><replaceable>URI</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Mount the specified remote storage URI at the given
path. Example:
</para>
<programlisting>mount foo nfs://192.168.1.4/export/mp3</programlisting>
</listitem>
</varlistentry>
<varlistentry id="command_umount">
<term>
<cmdsynopsis>
<command>unmount</command>
<arg choice="req"><replaceable>PATH</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Unmounts the specified path. Example:
</para>
<programlisting>unmount foo</programlisting>
</listitem>
</varlistentry>
<varlistentry id="command_listmounts">
<term>
<cmdsynopsis>
<command>listmounts</command>
</cmdsynopsis>
</term>
<listitem>
<para>
Queries a list of all mounts. By default, this contains
just the configured <varname>music_directory</varname>.
Example:
</para>
<programlisting>listmounts
mount:
storage: /home/foo/music
mount: foo
storage: nfs://192.168.1.4/export/mp3
OK
</programlisting>
</listitem>
</varlistentry>
<varlistentry id="command_listneighbors">
<term>
<cmdsynopsis>
<command>listneighbors</command>
</cmdsynopsis>
</term>
<listitem>
<para>
Queries a list of "neighbors" (e.g. accessible file
servers on the local net). Items on that list may be
used with the <link
linkend="command_mount"><command>mount</command></link>
command. Example:
</para>
<programlisting>listneighbors
neighbor: smb://FOO
name: FOO (Samba 4.1.11-Debian)
OK
</programlisting>
</listitem>
</varlistentry>
</variablelist>
</section>
<section id="stickers">
<title>Stickers</title>
<para>
"Stickers"<footnoteref linkend="since_0_15"/> are pieces of
information attached to existing MPD objects (e.g. song files,
information attached to existing
<application>MPD</application> objects (e.g. song files,
directories, albums). Clients can create arbitrary name/value
pairs. MPD itself does not assume any special meaning in
them.
pairs. <application>MPD</application> itself does not assume
any special meaning in them.
</para>
<para>
The goal is to allow clients to share additional (possibly
dynamic) information about songs, which is neither stored on
the client (not available to other clients), nor stored in the
song files (MPD has no write access).
song files (<application>MPD</application> has no write
access).
</para>
<para>
@@ -1837,7 +2122,7 @@ OK
</variablelist>
</section>
<section>
<section id="connection_commands">
<title>Connection settings</title>
<variablelist>
@@ -1849,7 +2134,8 @@ OK
</term>
<listitem>
<para>
Closes the connection to MPD. MPD will try to send the
Closes the connection to <application>MPD</application>.
<application>MPD</application> will try to send the
remaining output buffer before it actually closes the
connection, but that cannot be guaranteed. This command
will not generate a response.
@@ -1864,7 +2150,7 @@ OK
</term>
<listitem>
<para>
Kills MPD.
Kills <application>MPD</application>.
</para>
</listitem>
</varlistentry>
@@ -1898,7 +2184,7 @@ OK
</variablelist>
</section>
<section>
<section id="output_commands">
<title>Audio output devices</title>
<variablelist>
@@ -1952,12 +2238,38 @@ OK
<para>
Shows information about all outputs.
</para>
<screen>
outputid: 0
outputname: My ALSA Device
outputenabled: 0
OK
</screen>
<para>
Return information:
</para>
<itemizedlist>
<listitem>
<para>
<varname>outputid</varname>: ID of the output. May change between executions
</para>
</listitem>
<listitem>
<para>
<varname>outputname</varname>: Name of the output. It can be any.
</para>
</listitem>
<listitem>
<para>
<varname>outputenabled</varname>: Status of the output. 0 if disabled, 1 if enabled.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
</section>
<section>
<section id="reflection_commands">
<title>Reflection</title>
<variablelist>
@@ -2073,7 +2385,7 @@ suffix: mpc</programlisting>
</variablelist>
</section>
<section>
<section id="client_to_client">
<title>Client to client</title>
<para>

File diff suppressed because it is too large Load Diff

View File

@@ -54,10 +54,12 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
#serial 4
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
[for flag in $1; do
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
done
])dnl AX_APPEND_COMPILE_FLAGS

View File

@@ -52,10 +52,12 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
#serial 4
AC_DEFUN([AX_APPEND_LINK_FLAGS],
[for flag in $1; do
[AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3])
done
])dnl AX_APPEND_LINK_FLAGS

272
m4/ax_boost_base.m4 Normal file
View File

@@ -0,0 +1,272 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_base.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_BASE([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# DESCRIPTION
#
# Test for the Boost C++ libraries of a particular version (or newer)
#
# If no path to the installed boost library is given the macro searchs
# under /usr, /usr/local, /opt and /opt/local and evaluates the
# $BOOST_ROOT environment variable. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
#
# And sets:
#
# HAVE_BOOST
#
# LICENSE
#
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Peter Adolphs
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 23
AC_DEFUN([AX_BOOST_BASE],
[
AC_ARG_WITH([boost],
[AS_HELP_STRING([--with-boost@<:@=ARG@:>@],
[use Boost library from a standard location (ARG=yes),
from the specified location (ARG=<path>),
or disable it (ARG=no)
@<:@ARG=yes@:>@ ])],
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ac_boost_path=""
else
want_boost="yes"
ac_boost_path="$withval"
fi
],
[want_boost="yes"])
AC_ARG_WITH([boost-libdir],
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
[Force given directory for boost libraries. Note that this will override library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
[
if test -d "$withval"
then
ac_boost_lib_path="$withval"
else
AC_MSG_ERROR(--with-boost-libdir expected directory name)
fi
],
[ac_boost_lib_path=""]
)
if test "x$want_boost" = "xyes"; then
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
boost_lib_version_req_sub_minor="0"
fi
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
succeeded=no
dnl On 64-bit systems check for system libraries in both lib64 and lib.
dnl The former is specified by FHS, but e.g. Debian does not adhere to
dnl this (as it rises problems for generic multi-arch support).
dnl The last entry in the list is chosen by default when no libraries
dnl are found, e.g. when only header-only libraries are installed!
libsubdirs="lib"
ax_arch=`uname -m`
case $ax_arch in
x86_64|ppc64|s390x|sparc64|aarch64)
libsubdirs="lib64 lib lib64"
;;
esac
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
dnl them priority over the other paths since, if libs are found there, they
dnl are almost assuredly the ones desired.
AC_REQUIRE([AC_CANONICAL_HOST])
libsubdirs="lib/${host_cpu}-${host_os} $libsubdirs"
case ${host_cpu} in
i?86)
libsubdirs="lib/i386-${host_os} $libsubdirs"
;;
esac
dnl first we check the system location for boost libraries
dnl this location ist chosen if boost libraries are installed with the --layout=system option
dnl or if you install boost with RPM
if test "$ac_boost_path" != ""; then
BOOST_CPPFLAGS="-I$ac_boost_path/include"
for ac_boost_path_tmp in $libsubdirs; do
if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
break
fi
done
elif test "$cross_compiling" != yes; then
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
for libsubdir in $libsubdirs ; do
if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
break;
fi
done
fi
dnl overwrite ld flags if we have required special directory with
dnl --with-boost-libdir parameter
if test "$ac_boost_lib_path" != ""; then
BOOST_LDFLAGS="-L$ac_boost_lib_path"
fi
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_REQUIRE([AC_PROG_CXX])
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
dnl if we found no boost with system layout we search for boost libraries
dnl built and installed without the --layout=system option or for a staged(not installed) version
if test "x$succeeded" != "xyes"; then
_version=0
if test "$ac_boost_path" != ""; then
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
fi
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
done
fi
else
if test "$cross_compiling" != yes; then
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
V_CHECK=`expr $_version_tmp \> $_version`
if test "$V_CHECK" = "1" ; then
_version=$_version_tmp
best_path=$ac_boost_path
fi
done
fi
done
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
if test "$ac_boost_lib_path" = ""; then
for libsubdir in $libsubdirs ; do
if ls "$best_path/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
BOOST_LDFLAGS="-L$best_path/$libsubdir"
fi
fi
if test "x$BOOST_ROOT" != "x"; then
for libsubdir in $libsubdirs ; do
if ls "$BOOST_ROOT/stage/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
done
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/$libsubdir" && test -r "$BOOST_ROOT/stage/$libsubdir"; then
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
V_CHECK=`expr $stage_version_shorten \>\= $_version`
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
BOOST_CPPFLAGS="-I$BOOST_ROOT"
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/$libsubdir"
fi
fi
fi
fi
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION >= $WANT_BOOST_VERSION
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
succeeded=yes
found_system=yes
],[
])
AC_LANG_POP([C++])
fi
if test "$succeeded" != "yes" ; then
if test "$_version" = "0" ; then
AC_MSG_NOTICE([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
else
AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
fi
# execute ACTION-IF-NOT-FOUND (if present):
ifelse([$3], , :, [$3])
else
AC_SUBST(BOOST_CPPFLAGS)
AC_SUBST(BOOST_LDFLAGS)
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
# execute ACTION-IF-FOUND (if present):
ifelse([$2], , :, [$2])
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View File

@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
@@ -19,6 +19,8 @@
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
@@ -53,7 +55,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
#serial 3
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
@@ -61,7 +63,7 @@ AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])

View File

@@ -4,7 +4,7 @@
#
# SYNOPSIS
#
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
@@ -19,6 +19,8 @@
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_LINK_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
#
@@ -53,14 +55,14 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 2
#serial 3
AC_DEFUN([AX_CHECK_LINK_FLAG],
[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
ax_check_save_flags=$LDFLAGS
LDFLAGS="$LDFLAGS $4 $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
LDFLAGS=$ax_check_save_flags])

332
m4/ax_pthread.m4 Normal file
View File

@@ -0,0 +1,332 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
# sets the PTHREAD_LIBS output variable to the threads library and linker
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
# PTHREAD_CFLAGS.
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
# is not found. If ACTION-IF-FOUND is not specified, the default action
# will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or if
# you have any other suggestions or comments. This macro was based on work
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
# grateful for the helpful feedback of numerous users.
#
# Updated for Autoconf 2.68 by Daniel Richard G.
#
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test x"$ax_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
;;
esac
# Clang doesn't consider unrecognized options an error unless we specify
# -Werror. We throw in some extra Clang-specific options to ensure that
# this doesn't happen for GCC, which also accepts -Werror.
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
save_CFLAGS="$CFLAGS"
ax_pthread_extra_flags="-Werror"
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
[AC_MSG_RESULT([yes])],
[ax_pthread_extra_flags=
AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
if test x"$ax_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { a = 0; }
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
pthread_join(th, 0);
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT([$attr_name])
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
# TODO: What about Clang on Solaris?
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT([$flag])
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != xyes; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
ax_pthread_ok=no
$2
fi
AC_LANG_POP
])dnl AX_PTHREAD

37
m4/ax_require_defined.m4 Normal file
View File

@@ -0,0 +1,37 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_REQUIRE_DEFINED(MACRO)
#
# DESCRIPTION
#
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
# been defined and thus are available for use. This avoids random issues
# where a macro isn't expanded. Instead the configure script emits a
# non-fatal:
#
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
#
# It's like AC_REQUIRE except it doesn't expand the required macro.
#
# Here's an example:
#
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
#
# LICENSE
#
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
])dnl AX_REQUIRE_DEFINED

View File

@@ -62,36 +62,7 @@ int main() {
CPPFLAGS=$oldcppflags
fi
if test x$enable_aac = xyes; then
oldcflags=$CFLAGS
oldlibs=$LIBS
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $FAAD_CFLAGS -Werror"
LIBS="$LIBS $FAAD_LIBS"
CPPFLAGS=$CFLAGS
AC_MSG_CHECKING(for broken libfaad headers)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <faad.h>
#include <stddef.h>
#include <stdint.h>
int main() {
unsigned char channels;
uint32_t sample_rate;
NeAACDecInit2(NULL, NULL, 0, &sample_rate, &channels);
return 0;
}
])],
[AC_MSG_RESULT(correct)],
[AC_MSG_RESULT(broken);
AC_DEFINE(HAVE_FAAD_LONG, 1, [Define if faad.h uses the broken "unsigned long" pointers])])
CFLAGS=$oldcflags
LIBS=$oldlibs
CPPFLAGS=$oldcppflags
else
if test x$enable_aac = xno; then
FAAD_LIBS=""
FAAD_CFLAGS=""
fi

9
m4/mpd_depends.m4 Normal file
View File

@@ -0,0 +1,9 @@
AC_DEFUN([MPD_DEPENDS], [
if test x$$2 = xno; then
if test x$$1 = xauto; then
$1=no
elif test x$$1 = xyes; then
AC_MSG_ERROR([$3])
fi
fi
])

View File

@@ -10,3 +10,16 @@ AC_DEFUN([MPD_OPTIONAL_FUNC], [
[AC_CHECK_FUNC([$2],
[AC_DEFINE([$3], 1, [Define to use $1])],)])
])
dnl MPD_OPTIONAL_FUNC_NODEF(name, func)
dnl
dnl Allow the user to enable or disable the use of a function.
dnl Works similar to MPD_OPTIONAL_FUNC, however MPD_OPTIONAL_FUNC_NODEF
dnl does not invoke AC_DEFINE when function is enabled. Shell variable
dnl enable_$name is set to "yes" instead.
AC_DEFUN([MPD_OPTIONAL_FUNC_NODEF], [
AC_ARG_ENABLE([$1],
AS_HELP_STRING([--enable-$1],
[use the function "$1" (default: auto)]),,
[AC_CHECK_FUNC([$2], [enable_$1=yes],)])
])

117
m4/pkg.m4
View File

@@ -1,4 +1,5 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
@@ -25,8 +26,12 @@
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
@@ -39,7 +44,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
@@ -48,34 +52,32 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
fi
else
pkg_failed=untried
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
@@ -117,16 +119,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@@ -134,24 +137,78 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# -------------------------------------------
# Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])# PKG_CHECK_VAR

View File

@@ -1,5 +1,4 @@
# Check if "struct ucred" is available. If not, try harder with
# _GNU_SOURCE.
# Check if "struct ucred" is available.
#
# Author: Max Kellermann <max@duempel.org>
@@ -10,19 +9,6 @@ AC_DEFUN([STRUCT_UCRED],[
[struct ucred cred;],
mpd_cv_have_struct_ucred=yes,
mpd_cv_have_struct_ucred=no)
if test x$mpd_cv_have_struct_ucred = xno; then
# glibc 2.8 forces _GNU_SOURCE on us
AC_TRY_COMPILE(
[#define _GNU_SOURCE
#include <sys/socket.h>],
[struct ucred cred;],
mpd_cv_have_struct_ucred=yes,
mpd_cv_have_struct_ucred=no)
if test x$mpd_cv_have_struct_ucred = xyes; then
# :(
CFLAGS="$CFLAGS -D_GNU_SOURCE"
fi
fi
])
AC_MSG_RESULT($mpd_cv_have_struct_ucred)

857
mpd.svg Normal file
View File

@@ -0,0 +1,857 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
x="0"
y="0"
width="128"
height="128"
id="svg1"
sodipodi:version="0.32"
sodipodi:docname="mpd.svg"
inkscape:version="0.47pre4 r22446"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-test5.png"
inkscape:export-xdpi="76.799988"
inkscape:export-ydpi="76.799988">
<sodipodi:namedview
id="base"
inkscape:zoom="2.6884788"
inkscape:cx="71.610485"
inkscape:cy="61.484977"
inkscape:window-width="1680"
inkscape:window-height="994"
inkscape:window-x="0"
inkscape:window-y="0"
showguides="true"
inkscape:guide-bbox="true"
showgrid="false"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 80 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="160 : 80 : 1"
inkscape:persp3d-origin="80 : 53.333333 : 1"
id="perspective118" />
<linearGradient
id="linearGradient919">
<stop
style="stop-color:#000000;stop-opacity:0.86092716;"
offset="0.0000000"
id="stop920" />
<stop
style="stop-color:#ffffff;stop-opacity:0.0000000;"
offset="1.0000000"
id="stop921" />
</linearGradient>
<linearGradient
id="linearGradient1068">
<stop
offset="0.0000000"
style="stop-color:#d2d2d2;stop-opacity:1.0000000;"
id="stop1070" />
<stop
offset="1.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;"
id="stop1069" />
</linearGradient>
<linearGradient
id="linearGradient1065">
<stop
offset="0.0000000"
style="stop-color:#ffffff;stop-opacity:1.0000000;"
id="stop1067" />
<stop
offset="1.0000000"
style="stop-color:#c2bfbf;stop-opacity:0.99607843;"
id="stop1066" />
</linearGradient>
<linearGradient
id="linearGradient1060">
<stop
offset="0.0000000"
style="stop-color:#878787;stop-opacity:1.0000000;"
id="stop1063" />
<stop
offset="1.0000000"
style="stop-color:#000000;stop-opacity:0.99607843;"
id="stop1061" />
</linearGradient>
<linearGradient
id="linearGradient645">
<stop
style="stop-color:#aca597;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop646" />
<stop
style="stop-color:#ffffff;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop647" />
</linearGradient>
<linearGradient
id="linearGradient593">
<stop
style="stop-color:#478acf;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop594" />
<stop
style="stop-color:#65c6f7;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop595" />
</linearGradient>
<linearGradient
id="linearGradient574">
<stop
style="stop-color:#85ad92;stop-opacity:1.0000;"
offset="0"
id="stop575" />
<stop
style="stop-color:#559db2;stop-opacity:0.7725;"
offset="1"
id="stop576" />
</linearGradient>
<linearGradient
id="linearGradient570">
<stop
style="stop-color:#999999;stop-opacity:0.7176;"
offset="0"
id="stop571" />
<stop
style="stop-color:#ffffff;stop-opacity:0.3725;"
offset="1"
id="stop572" />
</linearGradient>
<linearGradient
id="linearGradient573"
xlink:href="#linearGradient1068"
x1="40.458553"
y1="389.65582"
x2="36.063946"
y2="357.28375"
gradientTransform="matrix(2.3025192,0,0,0.29683004,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient1213"
xlink:href="#linearGradient1068"
x1="123.71407"
y1="141.41566"
x2="98.353867"
y2="113.41083"
gradientTransform="matrix(0.91680324,0,0,0.74547827,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
<radialGradient
id="radialGradient581"
xlink:href="#linearGradient919"
cx="0.095785439"
cy="0.16814159"
r="1.5409589"
fx="0.095785439"
fy="0.16814159" />
<linearGradient
id="linearGradient580"
xlink:href="#linearGradient1068"
x1="132.0352"
y1="135.68469"
x2="119.62381"
y2="111.07157"
gradientTransform="matrix(0.90170536,0,0,0.75796032,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient1060"
id="linearGradient901"
x1="0.93491787"
y1="0.92044502"
x2="-0.052546836"
y2="0.20347559" />
<linearGradient
xlink:href="#linearGradient593"
id="linearGradient902" />
<linearGradient
xlink:href="#linearGradient1068"
id="linearGradient916"
x1="0.14831461"
y1="-1.6875"
x2="0.43370786"
y2="1.8125" />
<defs
id="defs890">
<linearGradient
id="linearGradient922"
x1="0"
y1="0.5"
x2="1"
y2="0.5"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient1065" />
<linearGradient
id="linearGradient908"
x1="0"
y1="0.5"
x2="1"
y2="0.5"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient1060" />
<linearGradient
id="linearGradient894"
x1="0"
y1="0.5"
x2="1"
y2="0.5"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient1068" />
<linearGradient
xlink:href="#linearGradient894"
id="linearGradient897"
x1="0.5955056"
y1="-0.33587787"
x2="0.61348313"
y2="1.1908396" />
<linearGradient
xlink:href="#linearGradient894"
id="linearGradient898"
x1="0.96449792"
y1="1.0278323"
x2="0.46738392"
y2="0.21800731" />
<linearGradient
xlink:href="#linearGradient908"
id="linearGradient907"
x1="0.57078654"
y1="2.3770492"
x2="0.33258426"
y2="0.49180329" />
<linearGradient
xlink:href="#linearGradient922"
id="linearGradient921"
x1="0.47058824"
y1="0.15384616"
x2="0.46547315"
y2="0.98380566" />
<linearGradient
xlink:href="#linearGradient922"
id="linearGradient948" />
<defs
id="defs987">
<linearGradient
id="linearGradient855"
x1="0"
y1="0.5"
x2="1"
y2="0.5"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient908" />
<linearGradient
id="linearGradient1188"
x1="0"
y1="0.5"
x2="1"
y2="0.5"
gradientUnits="objectBoundingBox"
spreadMethod="pad"
xlink:href="#linearGradient922" />
<linearGradient
id="linearGradient831">
<stop
style="stop-color:#94897f;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop832" />
<stop
style="stop-color:#fff5fe;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop833" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient1188"
id="linearGradient834"
x1="0.87550199"
y1="0.34817815"
x2="-0.29317269"
y2="0.93522269"
gradientUnits="objectBoundingBox"
spreadMethod="pad" />
<radialGradient
xlink:href="#linearGradient1188"
id="radialGradient835"
r="0.55628061"
fy="0.28125"
fx="0.59090906"
cy="0.28125"
cx="0.59090906"
spreadMethod="pad" />
<linearGradient
xlink:href="#linearGradient1188"
id="linearGradient893"
x1="0.12793733"
y1="0.76923078"
x2="0.49608356"
y2="0.70850199" />
<linearGradient
xlink:href="#linearGradient855"
id="linearGradient625"
x1="0.035955057"
y1="1.0276498"
x2="0.053932585"
y2="-0.359447" />
<linearGradient
xlink:href="#linearGradient1188"
id="linearGradient627"
x1="1.2826855"
y1="0.12550607"
x2="-0.15547703"
y2="0.96356273" />
<radialGradient
xlink:href="#linearGradient1188"
id="radialGradient628"
r="1.5982224"
fy="0.4866707"
fx="0.36789617"
cy="0.4866707"
cx="0.36789617"
gradientTransform="scale(0.877379,1.139758)" />
<linearGradient
xlink:href="#linearGradient1188"
id="linearGradient628"
x1="0.76923078"
y1="0.14979757"
x2="0.41909814"
y2="0.73279351" />
</defs>
<sodipodi:namedview
id="namedview898"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.4732669"
inkscape:cx="50.051177"
inkscape:cy="18.096983"
inkscape:window-width="1022"
inkscape:window-height="670"
showguides="false"
snaptoguides="false"
showgrid="false"
snaptogrid="false"
inkscape:window-x="0"
inkscape:window-y="25">
<sodipodi:guide
orientation="vertical"
position="28.705556"
id="guide879" />
<sodipodi:guide
orientation="horizontal"
position="30.130655"
id="guide880" />
</sodipodi:namedview>
</defs>
<sodipodi:namedview
id="namedview1003"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3368738"
inkscape:cx="24.541029"
inkscape:cy="14.368596"
inkscape:window-width="640"
inkscape:window-height="499"
showguides="true"
snaptoguides="true"
inkscape:window-x="138"
inkscape:window-y="169" />
<linearGradient
xlink:href="#linearGradient1060"
id="linearGradient1304"
x1="-0.20218579"
y1="0.21681416"
x2="0.67759562"
y2="0.57522124" />
<linearGradient
xlink:href="#linearGradient1065"
id="linearGradient1322"
x1="0.32404181"
y1="0.77876109"
x2="0.24041812"
y2="0.26548672" />
<defs
id="defs989">
<linearGradient
id="linearGradient850">
<stop
style="stop-color:#eed680;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop852" />
<stop
style="stop-color:#dfb546;stop-opacity:1.0000000;"
offset="0.68035328"
id="stop858" />
<stop
style="stop-color:#d8a429;stop-opacity:1.0000000;"
offset="0.77277374"
id="stop859" />
<stop
style="stop-color:#d1940c;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop857" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient850"
id="linearGradient569"
x1="0.11875"
y1="0.12612613"
x2="0.59375"
y2="0.66066068"
spreadMethod="pad" />
<linearGradient
id="linearGradient839">
<stop
style="stop-color:#46a046;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop840" />
<stop
style="stop-color:#df421e;stop-opacity:1.0000000;"
offset="0.39364964"
id="stop841" />
<stop
style="stop-color:#ada7c8;stop-opacity:1.0000000;"
offset="0.72036445"
id="stop842" />
<stop
style="stop-color:#eed680;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop843" />
</linearGradient>
<linearGradient
xlink:href="#linearGradient839"
id="linearGradient836"
x1="1.3267924e-17"
y1="0.5"
x2="1"
y2="0.5" />
<defs
id="defs604">
<linearGradient
id="linearGradient622">
<stop
style="stop-color:#f8e29d;stop-opacity:0.4471;"
offset="0"
id="stop623" />
<stop
style="stop-color:#272d2d;stop-opacity:0.4784;"
offset="1"
id="stop624" />
</linearGradient>
<linearGradient
id="linearGradient617">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop618" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop619" />
</linearGradient>
<linearGradient
id="linearGradient613">
<stop
style="stop-color:#ffffff;stop-opacity:0.6235;"
offset="0"
id="stop614" />
<stop
style="stop-color:#5d6567;stop-opacity:1;"
offset="1"
id="stop615" />
</linearGradient>
<linearGradient
id="linearGradient607">
<stop
style="stop-color:#d7d5d5;stop-opacity:1;"
offset="0"
id="stop608" />
<stop
style="stop-color:#000000;stop-opacity:0.4039;"
offset="1"
id="stop609" />
</linearGradient>
<radialGradient
xlink:href="#linearGradient607"
id="radialGradient610"
cx="1.4287461"
cy="0.75323397"
r="0.85534656"
fx="1.4287461"
fy="0.75323397"
gradientTransform="matrix(1,2.268336e-6,-1.975559e-5,1,5.713033e-8,3.856326e-8)" />
<linearGradient
xlink:href="#linearGradient617"
id="linearGradient612"
x1="7.7024956"
y1="-2.0263922"
x2="62.759903"
y2="56.137772"
gradientTransform="scale(0.9953779,1.0046436)"
gradientUnits="userSpaceOnUse" />
<radialGradient
xlink:href="#linearGradient613"
id="radialGradient616"
cx="58.70882"
cy="53.831562"
r="43.551846"
fx="58.70882"
fy="53.831562"
gradientTransform="scale(0.99517298,1.0048504)"
gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient617"
id="linearGradient621" />
<linearGradient
xlink:href="#linearGradient617"
id="linearGradient626"
x1="72.060211"
y1="55.161442"
x2="32.409"
y2="12.126946"
gradientTransform="matrix(0.995134,-1.068631e-5,-1.31398e-7,1.00489,0,0)"
gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient607"
id="linearGradient687"
x1="67.707405"
y1="49.314793"
x2="-10.031048"
y2="4.6068792"
gradientTransform="scale(0.99522839,1.0047945)"
gradientUnits="userSpaceOnUse" />
<linearGradient
xlink:href="#linearGradient617"
id="linearGradient742"
x1="-7.4378386"
y1="25.923714"
x2="18.009745"
y2="10.089797"
gradientTransform="scale(0.889853,1.123781)" />
</defs>
<sodipodi:namedview
id="namedview889"
showguides="true"
snaptoguides="true"
inkscape:zoom="7.5625000"
inkscape:cx="24.000000"
inkscape:cy="24.000000"
inkscape:window-width="640"
inkscape:window-height="496"
inkscape:window-x="0"
inkscape:window-y="26" />
</defs>
<sodipodi:namedview
id="namedview1023"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.5521067"
inkscape:cx="66.459318"
inkscape:cy="62.629296"
inkscape:window-width="1150"
inkscape:window-height="752"
showgrid="true"
snaptogrid="true"
inkscape:window-x="0"
inkscape:window-y="29">
<inkscape:grid
id="GridFromPre046Settings"
type="xygrid"
originx="0px"
originy="0px"
spacingx="1.0000000mm"
spacingy="1.0000000mm"
color="#0000ff"
empcolor="#0000ff"
opacity="0.2"
empopacity="0.4"
empspacing="5" />
</sodipodi:namedview>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1068"
id="linearGradient2924"
x1="41.673889"
y1="320.40921"
x2="36.082947"
y2="279.22458"
gradientTransform="matrix(2.3376099,0,0,0.29237422,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1068"
id="linearGradient2926"
x1="134.95444"
y1="108.16693"
x2="102.05431"
y2="71.835884"
gradientTransform="matrix(0.91680324,0,0,0.74547824,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1068"
id="linearGradient2928"
x1="145.32188"
y1="101.97199"
x2="129.22044"
y2="70.041069"
gradientTransform="matrix(0.90170536,0,0,0.75796032,-0.91913426,-1.5117091)"
gradientUnits="userSpaceOnUse" />
</defs>
<rect
style="fill-opacity:0.47154475;fill-rule:evenodd;stroke-width:3pt"
id="rect918"
width="48.72493"
height="42.16835"
ry="0.74231374"
x="67.536102"
y="66.474693"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.7811048" />
<rect
style="fill-opacity:0.47154475;fill-rule:evenodd;stroke-width:3pt"
id="rect1006"
width="63.211483"
height="54.705563"
ry="0.74231374"
x="64.47226"
y="30.558294"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.7811048" />
<rect
style="fill:#000000;fill-opacity:0.47058824;fill-rule:evenodd"
id="rect1005"
width="57.843418"
height="9.0050545"
ry="0.62889248"
x="65.398254"
y="82.153206"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.66175652" />
<rect
style="fill:url(#linearGradient2924);fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.82671446"
id="rect1007"
width="54.910637"
height="6.1445785"
ry="0.42912331"
x="64.622299"
y="82.282539"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.44939452" />
<rect
width="57.905403"
height="47.084496"
ry="1.7822117"
x="63.784973"
y="32.456562"
style="font-size:12px;fill:url(#linearGradient2926);fill-rule:evenodd;stroke:#000000;stroke-width:0"
id="rect1009"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="1.6336281" />
<rect
style="fill:#000000;fill-opacity:0.47058824;fill-rule:evenodd"
id="rect971"
width="44.58709"
height="6.9413123"
ry="0.62889248"
x="68.249886"
y="106.24529"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.66175652" />
<rect
width="64.637024"
height="54.068516"
ry="1.4120796"
x="59.853096"
y="28.740753"
style="font-size:12px;fill:url(#linearGradient2928);fill-rule:evenodd;stroke:#000000;stroke-width:1.65869105"
id="rect1008"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="1.3970968" />
<rect
width="51.129478"
height="39.964478"
ry="0.5422883"
x="66.358932"
y="34.89621"
style="font-size:12px;fill:#00b4ed;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.79054338;stroke-linejoin:round"
id="rect976"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.5422883" />
<metadata
id="metadata982">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<rect
width="44.634872"
height="36.293858"
ry="1.7822117"
x="67.006332"
y="67.937927"
style="font-size:12px;fill:url(#linearGradient1213);fill-rule:evenodd;stroke:#000000;stroke-width:0"
id="rect575"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="1.633628" />
<path
sodipodi:type="arc"
style="font-size:12px;fill:#444040;fill-opacity:0.47058824;fill-rule:evenodd"
id="path672"
d="m 68.473,57.85183 a 23.629898,3.2222576 0 1 1 -47.259797,0 23.629898,3.2222576 0 1 1 47.259797,0 z"
sodipodi:cx="44.843102"
sodipodi:cy="57.85183"
sodipodi:rx="23.629898"
sodipodi:ry="3.2222576"
transform="matrix(1.4221482,0,-0.30247168,1.9834766,9.6201687,-10.428817)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<path
sodipodi:type="arc"
style="font-size:12px;fill:#4e4d4b;fill-rule:evenodd;stroke:#000000;stroke-width:2.30019999;stroke-opacity:0.9565"
id="path625"
d="m 58.291138,27.531645 a 19.367088,19.556963 0 1 1 -38.734177,0 19.367088,19.556963 0 1 1 38.734177,0 z"
sodipodi:cx="38.924049"
sodipodi:cy="27.531645"
sodipodi:rx="19.367088"
sodipodi:ry="19.556963"
transform="matrix(-1.0172416,-0.47376693,-0.5523759,1.3286212,116.84611,57.272851)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<path
sodipodi:type="arc"
style="font-size:12px;fill:url(#linearGradient612);fill-rule:evenodd;stroke:#000000;stroke-width:2.06100011;stroke-opacity:0.9565"
id="path605"
d="m 58.291138,27.531645 a 19.367088,19.556963 0 1 1 -38.734177,0 19.367088,19.556963 0 1 1 38.734177,0 z"
sodipodi:cx="38.924049"
sodipodi:cy="27.531645"
sodipodi:rx="19.367088"
sodipodi:ry="19.556963"
transform="matrix(-1.4321234,-0.79696518,-1.1299666,2.2349846,128.07685,29.383033)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<path
sodipodi:type="arc"
style="font-size:12px;fill:url(#radialGradient616);fill-rule:evenodd;stroke:#000000;stroke-width:0.317;stroke-opacity:0.97829997"
id="path606"
d="m 58.291138,27.531645 a 19.367088,19.556963 0 1 1 -38.734177,0 19.367088,19.556963 0 1 1 38.734177,0 z"
sodipodi:cx="38.924049"
sodipodi:cy="27.531645"
sodipodi:rx="19.367088"
sodipodi:ry="19.556963"
transform="matrix(-1.1546358,-0.69851175,-0.95634664,1.9588777,108.06887,31.115628)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<path
sodipodi:type="arc"
style="font-size:12px;fill-rule:evenodd;stroke-width:1.63499999"
id="path686"
d="m 58.291138,27.531645 a 19.367088,19.556963 0 1 1 -38.734177,0 19.367088,19.556963 0 1 1 38.734177,0 z"
sodipodi:cx="38.924049"
sodipodi:cy="27.531645"
sodipodi:rx="19.367088"
sodipodi:ry="19.556963"
transform="matrix(-0.39495459,-0.4546194,-0.52881207,0.94219495,73.198184,52.427791)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<path
sodipodi:type="arc"
style="font-size:12px;fill:url(#linearGradient687);fill-rule:evenodd;stroke:#3f3b3b;stroke-width:0.77380002"
id="path611"
d="m 58.291138,27.531645 a 19.367088,19.556963 0 1 1 -38.734177,0 19.367088,19.556963 0 1 1 38.734177,0 z"
sodipodi:cx="38.924049"
sodipodi:cy="27.531645"
sodipodi:rx="19.367088"
sodipodi:ry="19.556963"
transform="matrix(-0.36949013,-0.40957751,-0.49471918,0.84885391,70.248021,52.066881)"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big2.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998" />
<rect
style="fill:url(#linearGradient573);fill-opacity:0.75;fill-rule:evenodd;stroke:#000000;stroke-width:0.82671446"
id="rect934"
width="42.326431"
height="4.7363882"
ry="0.42912331"
x="67.651756"
y="106.34497"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.44939449" />
<rect
width="49.823761"
height="41.677303"
ry="1.4120796"
x="63.975548"
y="65.073692"
style="font-size:12px;fill:url(#linearGradient580);fill-rule:evenodd;stroke:#000000;stroke-width:1.27855873;stroke-opacity:1"
id="rect562"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="1.3970969" />
<rect
width="39.411831"
height="30.805574"
ry="0.5422883"
x="68.990387"
y="70.097008"
style="font-size:12px;fill:#003d88;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.61407685;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:0.93023257"
id="rect975"
inkscape:export-filename="/cowserver/documents/httpd/vhosts/images/mpd-big7.png"
inkscape:export-xdpi="721.66998"
inkscape:export-ydpi="721.66998"
rx="0.5422883" />
</svg>

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,9 +21,9 @@
#include "AudioConfig.hxx"
#include "AudioFormat.hxx"
#include "AudioParser.hxx"
#include "ConfigData.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "config/ConfigData.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
#include "util/Error.hxx"
#include "system/FatalError.hxx"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

41
src/BulkEdit.hxx Normal file
View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_BULK_EDIT_HXX
#define MPD_BULK_EDIT_HXX
#include "Partition.hxx"
/**
* Begin a "bulk edit" and commit it automatically.
*/
class ScopeBulkEdit {
Partition &partition;
public:
ScopeBulkEdit(Partition &_partition):partition(_partition) {
partition.playlist.BeginBulk();
}
~ScopeBulkEdit() {
partition.playlist.CommitBulk(partition.pc);
}
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

226
src/Chrono.hxx Normal file
View File

@@ -0,0 +1,226 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_CHRONO_HXX
#define MPD_CHRONO_HXX
#include "Compiler.h"
#include <chrono>
#include <utility>
#include <cstdint>
#if defined(__GNUC__) && !GCC_CHECK_VERSION(4,7) && !defined(__clang__)
/* std::chrono::duration operators are "constexpr" since gcc 4.7 */
#define chrono_constexpr gcc_pure
#else
#define chrono_constexpr constexpr
#endif
/**
* A time stamp within a song. Granularity is 1 millisecond and the
* maximum value is about 49 days.
*/
class SongTime : public std::chrono::duration<std::uint32_t, std::milli> {
typedef std::chrono::duration<std::uint32_t, std::milli> Base;
typedef Base::rep rep;
public:
SongTime() = default;
template<typename T>
explicit constexpr SongTime(T t):Base(t) {}
static constexpr SongTime zero() {
return SongTime(Base::zero());
}
static constexpr SongTime FromS(unsigned s) {
return SongTime(rep(s) * 1000);
}
static constexpr SongTime FromS(float s) {
return SongTime(rep(s * 1000));
}
static constexpr SongTime FromS(double s) {
return SongTime(rep(s * 1000));
}
static constexpr SongTime FromMS(rep ms) {
return SongTime(ms);
}
constexpr rep ToS() const {
return count() / rep(1000);
}
constexpr rep RoundS() const {
return (count() + 500) / rep(1000);
}
constexpr rep ToMS() const {
return count();
}
template<typename T=rep>
constexpr T ToScale(unsigned scale) const {
return count() * T(scale) / 1000;
}
/**
* Convert a scalar value with the given scale to a #SongTime
* instance.
*
* @param value the input value
* @param scale the value's scale in Hz
*/
template<typename T=rep>
static constexpr SongTime FromScale(T value, unsigned scale) {
return SongTime(value * T(1000) / T(scale));
}
constexpr double ToDoubleS() const {
return double(count()) / 1000.;
};
constexpr bool IsZero() const {
return count() == 0;
}
constexpr bool IsPositive() const {
return count() > 0;
}
chrono_constexpr SongTime operator+(const SongTime &other) const {
return SongTime(*(const Base *)this + (const Base &)other);
}
chrono_constexpr SongTime operator-(const SongTime &other) const {
return SongTime(*(const Base *)this - (const Base &)other);
}
};
/**
* A variant of #SongTime that is based on a signed integer. It can
* be used for relative values.
*/
class SignedSongTime : public std::chrono::duration<std::int32_t, std::milli> {
typedef std::chrono::duration<std::int32_t, std::milli> Base;
typedef Base::rep rep;
public:
SignedSongTime() = default;
template<typename T>
explicit constexpr SignedSongTime(T t):Base(t) {}
/**
* Allow implicit conversion from SongTime to SignedSongTime.
*/
constexpr SignedSongTime(SongTime t):Base(t) {}
static constexpr SignedSongTime zero() {
return SignedSongTime(Base::zero());
}
/**
* Generate a negative value.
*/
static constexpr SignedSongTime Negative() {
return SignedSongTime(-1);
}
static constexpr SignedSongTime FromS(int s) {
return SignedSongTime(rep(s) * 1000);
}
static constexpr SignedSongTime FromS(unsigned s) {
return SignedSongTime(rep(s) * 1000);
}
static constexpr SignedSongTime FromS(float s) {
return SignedSongTime(rep(s * 1000));
}
static constexpr SignedSongTime FromS(double s) {
return SignedSongTime(rep(s * 1000));
}
static constexpr SignedSongTime FromMS(rep ms) {
return SignedSongTime(ms);
}
constexpr rep ToS() const {
return count() / rep(1000);
}
constexpr rep RoundS() const {
return (count() + 500) / rep(1000);
}
constexpr rep ToMS() const {
return count();
}
template<typename T=rep>
constexpr T ToScale(unsigned scale) const {
return count() * T(scale) / 1000;
}
/**
* Convert a scalar value with the given scale to a
* #SignedSongTime instance.
*
* @param value the input value
* @param scale the value's scale in Hz
*/
template<typename T=rep>
static constexpr SignedSongTime FromScale(T value, unsigned scale) {
return SignedSongTime(value * T(1000) / T(scale));
}
constexpr double ToDoubleS() const {
return double(count()) / 1000.;
};
constexpr bool IsZero() const {
return count() == 0;
}
constexpr bool IsPositive() const {
return count() > 0;
}
constexpr bool IsNegative() const {
return count() < 0;
}
chrono_constexpr SignedSongTime operator+(const SignedSongTime &other) const {
return SignedSongTime(*(const Base *)this + (const Base &)other);
}
chrono_constexpr SignedSongTime operator-(const SignedSongTime &other) const {
return SignedSongTime(*(const Base *)this - (const Base &)other);
}
};
#undef chrono_constexpr
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -22,57 +22,115 @@
#include "ls.hxx"
#include "LogInit.hxx"
#include "Log.hxx"
#include "ConfigGlobal.hxx"
#include "DecoderList.hxx"
#include "DecoderPlugin.hxx"
#include "OutputList.hxx"
#include "OutputPlugin.hxx"
#include "InputRegistry.hxx"
#include "InputPlugin.hxx"
#include "PlaylistRegistry.hxx"
#include "PlaylistPlugin.hxx"
#include "config/ConfigGlobal.hxx"
#include "decoder/DecoderList.hxx"
#include "decoder/DecoderPlugin.hxx"
#include "output/Registry.hxx"
#include "output/OutputPlugin.hxx"
#include "input/Registry.hxx"
#include "input/InputPlugin.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "playlist/PlaylistPlugin.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/StandardDirectory.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/FatalError.hxx"
#include "util/OptionDef.hxx"
#include "util/OptionParser.hxx"
#ifdef ENABLE_DATABASE
#include "db/Registry.hxx"
#include "db/DatabasePlugin.hxx"
#include "storage/Registry.hxx"
#include "storage/StoragePlugin.hxx"
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Registry.hxx"
#include "neighbor/NeighborPlugin.hxx"
#endif
#ifdef ENABLE_ENCODER
#include "EncoderList.hxx"
#include "EncoderPlugin.hxx"
#include "encoder/EncoderList.hxx"
#include "encoder/EncoderPlugin.hxx"
#endif
#ifdef ENABLE_ARCHIVE
#include "ArchiveList.hxx"
#include "ArchivePlugin.hxx"
#include "archive/ArchiveList.hxx"
#include "archive/ArchivePlugin.hxx"
#endif
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#define CONFIG_FILE_LOCATION "\\mpd\\mpd.conf"
#define CONFIG_FILE_LOCATION "mpd\\mpd.conf"
#define APP_CONFIG_FILE_LOCATION "conf\\mpd.conf"
#else
#define USER_CONFIG_FILE_LOCATION1 ".mpdconf"
#define USER_CONFIG_FILE_LOCATION2 ".mpd/mpd.conf"
#define USER_CONFIG_FILE_LOCATION_XDG "mpd/mpd.conf"
#endif
static constexpr OptionDef opt_kill(
"kill", "kill the currently running mpd session");
static constexpr OptionDef opt_no_config(
"no-config", "don't read from config");
static constexpr OptionDef opt_no_daemon(
"no-daemon", "don't detach from console");
static constexpr OptionDef opt_stdout(
"stdout", nullptr); // hidden, compatibility with old versions
static constexpr OptionDef opt_stderr(
"stderr", "print messages to stderr");
static constexpr OptionDef opt_verbose(
"verbose", 'v', "verbose logging");
static constexpr OptionDef opt_version(
"version", 'V', "print version number");
static constexpr OptionDef opt_help(
"help", 'h', "show help options");
static constexpr OptionDef opt_help_alt(
nullptr, '?', nullptr); // hidden, standard alias for --help
static constexpr Domain cmdline_domain("cmdline");
gcc_noreturn
static void version(void)
{
puts("Music Player Daemon " VERSION "\n"
puts("Music Player Daemon " VERSION
#ifdef GIT_COMMIT
" (" GIT_COMMIT ")"
#endif
"\n"
"\n"
"Copyright (C) 2003-2007 Warren Dukes <warren.dukes@gmail.com>\n"
"Copyright (C) 2008-2013 Max Kellermann <max@duempel.org>\n"
"Copyright (C) 2008-2014 Max Kellermann <max@duempel.org>\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"\n"
"warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
#ifdef ENABLE_DATABASE
puts("\n"
"Database plugins:");
for (auto i = database_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
puts("\n\n"
"Storage plugins:");
for (auto i = storage_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
puts("\n\n"
"Neighbor plugins:");
for (auto i = neighbor_plugins; *i != nullptr; ++i)
printf(" %s", (*i)->name);
#endif
puts("\n\n"
"Decoders plugins:");
decoder_plugins_for_each([](const DecoderPlugin &plugin){
@@ -132,122 +190,165 @@ static void version(void)
exit(EXIT_SUCCESS);
}
static const char *summary =
"Music Player Daemon - a daemon for playing music.";
gcc_pure
static AllocatedPath
PathBuildChecked(const AllocatedPath &a, PathTraits::const_pointer b)
static void PrintOption(const OptionDef &opt)
{
if (a.IsNull())
return AllocatedPath::Null();
if (opt.HasShortOption())
printf(" -%c, --%-12s%s\n",
opt.GetShortOption(),
opt.GetLongOption(),
opt.GetDescription());
else
printf(" --%-16s%s\n",
opt.GetLongOption(),
opt.GetDescription());
}
return AllocatedPath::Build(a, b);
gcc_noreturn
static void help(void)
{
puts("Usage:\n"
" mpd [OPTION...] [path/to/mpd.conf]\n"
"\n"
"Music Player Daemon - a daemon for playing music.\n"
"\n"
"Options:");
PrintOption(opt_help);
PrintOption(opt_kill);
PrintOption(opt_no_config);
PrintOption(opt_no_daemon);
PrintOption(opt_stderr);
PrintOption(opt_verbose);
PrintOption(opt_version);
exit(EXIT_SUCCESS);
}
class ConfigLoader
{
Error &error;
bool result;
public:
ConfigLoader(Error &_error) : error(_error), result(false) { }
bool GetResult() const { return result; }
bool TryFile(const Path path);
bool TryFile(const AllocatedPath &base_path,
PathTraitsFS::const_pointer path);
};
bool ConfigLoader::TryFile(Path path)
{
if (FileExists(path)) {
result = ReadConfigFile(path, error);
return true;
}
return false;
}
bool ConfigLoader::TryFile(const AllocatedPath &base_path,
PathTraitsFS::const_pointer path)
{
if (base_path.IsNull())
return false;
auto full_path = AllocatedPath::Build(base_path, path);
return TryFile(full_path);
}
bool
parse_cmdline(int argc, char **argv, struct options *options,
Error &error)
{
GOptionContext *context;
bool ret;
static gboolean option_version,
option_no_daemon,
option_no_config;
const GOptionEntry entries[] = {
{ "kill", 0, 0, G_OPTION_ARG_NONE, &options->kill,
"kill the currently running mpd session", nullptr },
{ "no-config", 0, 0, G_OPTION_ARG_NONE, &option_no_config,
"don't read from config", nullptr },
{ "no-daemon", 0, 0, G_OPTION_ARG_NONE, &option_no_daemon,
"don't detach from console", nullptr },
{ "stdout", 0, 0, G_OPTION_ARG_NONE, &options->log_stderr,
nullptr, nullptr },
{ "stderr", 0, 0, G_OPTION_ARG_NONE, &options->log_stderr,
"print messages to stderr", nullptr },
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &options->verbose,
"verbose logging", nullptr },
{ "version", 'V', 0, G_OPTION_ARG_NONE, &option_version,
"print version number", nullptr },
{ nullptr, 0, 0, G_OPTION_ARG_NONE, nullptr, nullptr, nullptr }
};
bool use_config_file = true;
options->kill = false;
options->daemon = true;
options->log_stderr = false;
options->verbose = false;
context = g_option_context_new("[path/to/mpd.conf]");
g_option_context_add_main_entries(context, entries, nullptr);
// First pass: handle command line options
OptionParser parser(argc, argv);
while (parser.HasEntries()) {
if (!parser.ParseNext())
continue;
if (parser.CheckOption(opt_kill)) {
options->kill = true;
continue;
}
if (parser.CheckOption(opt_no_config)) {
use_config_file = false;
continue;
}
if (parser.CheckOption(opt_no_daemon)) {
options->daemon = false;
continue;
}
if (parser.CheckOption(opt_stderr, opt_stdout)) {
options->log_stderr = true;
continue;
}
if (parser.CheckOption(opt_verbose)) {
options->verbose = true;
continue;
}
if (parser.CheckOption(opt_version))
version();
if (parser.CheckOption(opt_help, opt_help_alt))
help();
g_option_context_set_summary(context, summary);
GError *gerror = nullptr;
ret = g_option_context_parse(context, &argc, &argv, &gerror);
g_option_context_free(context);
if (!ret)
FatalError("option parsing failed", gerror);
if (option_version)
version();
error.Format(cmdline_domain, "invalid option: %s",
parser.GetOption());
return false;
}
/* initialize the logging library, so the configuration file
parser can use it already */
log_early_init(options->verbose);
options->daemon = !option_no_daemon;
if (option_no_config) {
if (!use_config_file) {
LogDebug(cmdline_domain,
"Ignoring config, using daemon defaults");
return true;
} else if (argc <= 1) {
/* default configuration file path */
}
#ifdef WIN32
AllocatedPath path = PathBuildChecked(AllocatedPath::FromUTF8(g_get_user_config_dir()),
CONFIG_FILE_LOCATION);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
const char *const*system_config_dirs =
g_get_system_config_dirs();
for (unsigned i = 0; system_config_dirs[i] != nullptr; ++i) {
path = PathBuildChecked(AllocatedPath::FromUTF8(system_config_dirs[i]),
CONFIG_FILE_LOCATION);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
// Second pass: find non-option parameters (i.e. config file)
const char *config_file = nullptr;
for (int i = 1; i < argc; ++i) {
if (OptionParser::IsOption(argv[i]))
continue;
if (config_file == nullptr) {
config_file = argv[i];
continue;
}
#else
AllocatedPath path = PathBuildChecked(AllocatedPath::FromUTF8(g_get_user_config_dir()),
USER_CONFIG_FILE_LOCATION_XDG);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
path = PathBuildChecked(AllocatedPath::FromUTF8(g_get_home_dir()),
USER_CONFIG_FILE_LOCATION1);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
path = PathBuildChecked(AllocatedPath::FromUTF8(g_get_home_dir()),
USER_CONFIG_FILE_LOCATION2);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
path = AllocatedPath::FromUTF8(SYSTEM_CONFIG_FILE_LOCATION);
if (!path.IsNull() && FileExists(path))
return ReadConfigFile(path, error);
#endif
error.Set(cmdline_domain, "No configuration file found");
return false;
} else if (argc == 2) {
/* specified configuration file */
return ReadConfigFile(Path::FromFS(argv[1]), error);
} else {
error.Set(cmdline_domain, "too many arguments");
return false;
}
if (config_file != nullptr) {
/* use specified configuration file */
return ReadConfigFile(Path::FromFS(config_file), error);
}
/* use default configuration file path */
ConfigLoader loader(error);
bool found =
#ifdef WIN32
loader.TryFile(GetUserConfigDir(), CONFIG_FILE_LOCATION) ||
loader.TryFile(GetSystemConfigDir(), CONFIG_FILE_LOCATION) ||
loader.TryFile(GetAppBaseDir(), APP_CONFIG_FILE_LOCATION);
#else
loader.TryFile(GetUserConfigDir(),
USER_CONFIG_FILE_LOCATION_XDG) ||
loader.TryFile(GetHomeDir(), USER_CONFIG_FILE_LOCATION1) ||
loader.TryFile(GetHomeDir(), USER_CONFIG_FILE_LOCATION2) ||
loader.TryFile(Path::FromFS(SYSTEM_CONFIG_FILE_LOCATION));
#endif
if (!found) {
error.Set(cmdline_domain, "No configuration file found");
return false;
}
return loader.GetResult();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,15 +20,13 @@
#ifndef MPD_COMMAND_LINE_HXX
#define MPD_COMMAND_LINE_HXX
#include <glib.h>
class Error;
struct options {
gboolean kill;
gboolean daemon;
gboolean log_stderr;
gboolean verbose;
bool kill;
bool daemon;
bool log_stderr;
bool verbose;
};
bool

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,33 +20,45 @@
#ifndef COMPILER_H
#define COMPILER_H
#define GCC_CHECK_VERSION(major, minor) \
(defined(__GNUC__) && \
(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
#define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel)
#ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
#else
#define GCC_VERSION 0
#endif
#define GCC_CHECK_VERSION(major, minor) \
(defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
/**
* Are we building with gcc (not clang or any other compiler) and a
* version older than the specified one?
*/
#define GCC_OLDER_THAN(major, minor) \
(defined(__GNUC__) && !defined(__clang__) && \
GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0))
#ifdef __clang__
# define CLANG_VERSION (__clang_major__ * 10000 \
+ __clang_minor__ * 100 \
+ __clang_patchlevel__)
# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
# if __clang_major__ < 3
# error Sorry, your clang version is too old. You need at least version 3.1.
# endif
#elif defined(__GNUC__)
# if !GCC_CHECK_VERSION(4,6)
# if GCC_OLDER_THAN(4,6)
# error Sorry, your gcc version is too old. You need at least version 4.6.
# endif
#else
# warning Untested compiler. Use at your own risk!
#endif
/**
* Are we building with the specified version of clang or newer?
*/
#define CLANG_CHECK_VERSION(major, minor) \
(defined(__clang__) && \
CLANG_VERSION >= GCC_MAKE_VERSION(major, minor, 0))
#if GCC_CHECK_VERSION(4,0)
/* GCC 4.x */
@@ -141,7 +153,7 @@
#if defined(__cplusplus)
/* support for C++11 "override" was added in gcc 4.7 */
#if !defined(__clang__) && !GCC_CHECK_VERSION(4,7)
#if GCC_OLDER_THAN(4,7)
#define override
#define final
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,7 @@
#include "config.h"
#include "CrossFade.hxx"
#include "Chrono.hxx"
#include "MusicChunk.hxx"
#include "AudioFormat.hxx"
#include "util/NumberParser.hxx"
@@ -26,8 +27,6 @@
#include "Log.hxx"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
static constexpr Domain cross_fade_domain("cross_fade");
@@ -87,7 +86,7 @@ mixramp_interpolate(const char *ramp_list, float required_db)
}
unsigned
CrossFadeSettings::Calculate(float total_time,
CrossFadeSettings::Calculate(SignedSongTime total_time,
float replay_gain_db, float replay_gain_prev_db,
const char *mixramp_start, const char *mixramp_prev_end,
const AudioFormat af,
@@ -97,7 +96,8 @@ CrossFadeSettings::Calculate(float total_time,
unsigned int chunks = 0;
float chunks_f;
if (duration < 0 || duration >= total_time ||
if (total_time.IsNegative() ||
duration < 0 || duration >= total_time.ToDoubleS() ||
/* we can't crossfade when the audio formats are different */
af != old_format)
return 0;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
#include "Compiler.h"
struct AudioFormat;
class SignedSongTime;
struct CrossFadeSettings {
/**
@@ -60,7 +61,7 @@ struct CrossFadeSettings {
* should be disabled for this song change
*/
gcc_pure
unsigned Calculate(float total_time,
unsigned Calculate(SignedSongTime total_time,
float replay_gain_db, float replay_gain_prev_db,
const char *mixramp_start,
const char *mixramp_prev_end,

View File

@@ -1,159 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "DatabaseGlue.hxx"
#include "DatabaseSimple.hxx"
#include "DatabaseRegistry.hxx"
#include "DatabaseSave.hxx"
#include "DatabaseError.hxx"
#include "Directory.hxx"
#include "util/Error.hxx"
#include "ConfigData.hxx"
#include "Stats.hxx"
#include "DatabasePlugin.hxx"
#include "db/SimpleDatabasePlugin.hxx"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
static Database *db;
static bool db_is_open;
static bool is_simple;
bool
DatabaseGlobalInit(const config_param &param, Error &error)
{
assert(db == nullptr);
assert(!db_is_open);
const char *plugin_name =
param.GetBlockValue("plugin", "simple");
is_simple = strcmp(plugin_name, "simple") == 0;
const DatabasePlugin *plugin = GetDatabasePluginByName(plugin_name);
if (plugin == nullptr) {
error.Format(db_domain,
"No such database plugin: %s", plugin_name);
return false;
}
db = plugin->create(param, error);
return db != nullptr;
}
void
DatabaseGlobalDeinit(void)
{
if (db_is_open)
db->Close();
if (db != nullptr)
delete db;
}
const Database *
GetDatabase()
{
assert(db == nullptr || db_is_open);
return db;
}
const Database *
GetDatabase(Error &error)
{
assert(db == nullptr || db_is_open);
if (db == nullptr)
error.Set(db_domain, DB_DISABLED, "No database");
return db;
}
bool
db_is_simple(void)
{
assert(db == nullptr || db_is_open);
return is_simple;
}
Directory *
db_get_root(void)
{
assert(db != nullptr);
assert(db_is_simple());
return ((SimpleDatabase *)db)->GetRoot();
}
Directory *
db_get_directory(const char *name)
{
if (db == nullptr)
return nullptr;
Directory *music_root = db_get_root();
if (name == nullptr)
return music_root;
return music_root->LookupDirectory(name);
}
bool
db_save(Error &error)
{
assert(db != nullptr);
assert(db_is_open);
assert(db_is_simple());
return ((SimpleDatabase *)db)->Save(error);
}
bool
DatabaseGlobalOpen(Error &error)
{
assert(db != nullptr);
assert(!db_is_open);
if (!db->Open(error))
return false;
db_is_open = true;
stats_update();
return true;
}
time_t
db_get_mtime(void)
{
assert(db != nullptr);
assert(db_is_open);
assert(db_is_simple());
return ((SimpleDatabase *)db)->GetLastModified();
}

View File

@@ -1,241 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "DatabasePrint.hxx"
#include "DatabaseSelection.hxx"
#include "SongFilter.hxx"
#include "PlaylistVector.hxx"
#include "SongPrint.hxx"
#include "TimePrint.hxx"
#include "Directory.hxx"
#include "Client.hxx"
#include "tag/Tag.hxx"
#include "Song.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include <functional>
static bool
PrintDirectoryBrief(Client &client, const Directory &directory)
{
if (!directory.IsRoot())
client_printf(client, "directory: %s\n", directory.GetPath());
return true;
}
static bool
PrintDirectoryFull(Client &client, const Directory &directory)
{
if (!directory.IsRoot()) {
client_printf(client, "directory: %s\n", directory.GetPath());
time_print(client, "Last-Modified", directory.mtime);
}
return true;
}
static void
print_playlist_in_directory(Client &client,
const Directory &directory,
const char *name_utf8)
{
if (directory.IsRoot())
client_printf(client, "playlist: %s\n", name_utf8);
else
client_printf(client, "playlist: %s/%s\n",
directory.GetPath(), name_utf8);
}
static bool
PrintSongBrief(Client &client, const Song &song)
{
assert(song.parent != nullptr);
song_print_uri(client, song);
if (song.tag != nullptr && song.tag->has_playlist)
/* this song file has an embedded CUE sheet */
print_playlist_in_directory(client, *song.parent, song.uri);
return true;
}
static bool
PrintSongFull(Client &client, const Song &song)
{
assert(song.parent != nullptr);
song_print_info(client, song);
if (song.tag != nullptr && song.tag->has_playlist)
/* this song file has an embedded CUE sheet */
print_playlist_in_directory(client, *song.parent, song.uri);
return true;
}
static bool
PrintPlaylistBrief(Client &client,
const PlaylistInfo &playlist,
const Directory &directory)
{
print_playlist_in_directory(client, directory, playlist.name.c_str());
return true;
}
static bool
PrintPlaylistFull(Client &client,
const PlaylistInfo &playlist,
const Directory &directory)
{
print_playlist_in_directory(client, directory, playlist.name.c_str());
if (playlist.mtime > 0)
time_print(client, "Last-Modified", playlist.mtime);
return true;
}
bool
db_selection_print(Client &client, const DatabaseSelection &selection,
bool full, Error &error)
{
const Database *db = GetDatabase(error);
if (db == nullptr)
return false;
using namespace std::placeholders;
const auto d = selection.filter == nullptr
? std::bind(full ? PrintDirectoryFull : PrintDirectoryBrief,
std::ref(client), _1)
: VisitDirectory();
const auto s = std::bind(full ? PrintSongFull : PrintSongBrief,
std::ref(client), _1);
const auto p = selection.filter == nullptr
? std::bind(full ? PrintPlaylistFull : PrintPlaylistBrief,
std::ref(client), _1, _2)
: VisitPlaylist();
return db->Visit(selection, d, s, p, error);
}
struct SearchStats {
int numberOfSongs;
unsigned long playTime;
};
static void printSearchStats(Client &client, SearchStats *stats)
{
client_printf(client, "songs: %i\n", stats->numberOfSongs);
client_printf(client, "playtime: %li\n", stats->playTime);
}
static bool
stats_visitor_song(SearchStats &stats, Song &song)
{
stats.numberOfSongs++;
stats.playTime += song.GetDuration();
return true;
}
bool
searchStatsForSongsIn(Client &client, const char *name,
const SongFilter *filter,
Error &error)
{
const Database *db = GetDatabase(error);
if (db == nullptr)
return false;
const DatabaseSelection selection(name, true, filter);
SearchStats stats;
stats.numberOfSongs = 0;
stats.playTime = 0;
using namespace std::placeholders;
const auto f = std::bind(stats_visitor_song, std::ref(stats),
_1);
if (!db->Visit(selection, f, error))
return false;
printSearchStats(client, &stats);
return true;
}
bool
printAllIn(Client &client, const char *uri_utf8, Error &error)
{
const DatabaseSelection selection(uri_utf8, true);
return db_selection_print(client, selection, false, error);
}
bool
printInfoForAllIn(Client &client, const char *uri_utf8,
Error &error)
{
const DatabaseSelection selection(uri_utf8, true);
return db_selection_print(client, selection, true, error);
}
static bool
PrintSongURIVisitor(Client &client, Song &song)
{
song_print_uri(client, song);
return true;
}
static bool
PrintUniqueTag(Client &client, TagType tag_type,
const char *value)
{
client_printf(client, "%s: %s\n", tag_item_names[tag_type], value);
return true;
}
bool
listAllUniqueTags(Client &client, int type,
const SongFilter *filter,
Error &error)
{
const Database *db = GetDatabase(error);
if (db == nullptr)
return false;
const DatabaseSelection selection("", true, filter);
if (type == LOCATE_TAG_FILE_TYPE) {
using namespace std::placeholders;
const auto f = std::bind(PrintSongURIVisitor,
std::ref(client), _1);
return db->Visit(selection, f, error);
} else {
using namespace std::placeholders;
const auto f = std::bind(PrintUniqueTag, std::ref(client),
(TagType)type, _1);
return db->VisitUniqueTags(selection, (TagType)type,
f, error);
}
}

View File

@@ -1,86 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DATABASE_SIMPLE_HXX
#define MPD_DATABASE_SIMPLE_HXX
#include "Compiler.h"
#include <sys/time.h>
struct config_param;
struct Directory;
struct db_selection;
struct db_visitor;
class Error;
/**
* Check whether the default #SimpleDatabasePlugin is used. This
* allows using db_get_root(), db_save(), db_get_mtime() and
* db_exists().
*/
bool
db_is_simple(void);
/**
* Returns the root directory object. Returns NULL if there is no
* configured music directory.
*
* May only be used if db_is_simple() returns true.
*/
gcc_pure
Directory *
db_get_root(void);
/**
* Caller must lock the #db_mutex.
*/
gcc_nonnull(1)
gcc_pure
Directory *
db_get_directory(const char *name);
/**
* May only be used if db_is_simple() returns true.
*/
bool
db_save(Error &error);
/**
* May only be used if db_is_simple() returns true.
*/
gcc_pure
time_t
db_get_mtime(void);
/**
* Returns true if there is a valid database file on the disk.
*
* May only be used if db_is_simple() returns true.
*/
gcc_pure
static inline bool
db_exists(void)
{
/* mtime is set only if the database file was loaded or saved
successfully */
return db_get_mtime() > 0;
}
#endif

View File

@@ -1,167 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "DecoderBuffer.hxx"
#include "DecoderAPI.hxx"
#include <glib.h>
#include <assert.h>
#include <string.h>
struct DecoderBuffer {
Decoder *decoder;
InputStream *is;
/** the allocated size of the buffer */
size_t size;
/** the current length of the buffer */
size_t length;
/** number of bytes already consumed at the beginning of the
buffer */
size_t consumed;
/** the actual buffer (dynamic size) */
unsigned char data[sizeof(size_t)];
};
DecoderBuffer *
decoder_buffer_new(Decoder *decoder, InputStream &is,
size_t size)
{
DecoderBuffer *buffer = (DecoderBuffer *)
g_malloc(sizeof(*buffer) - sizeof(buffer->data) + size);
assert(size > 0);
buffer->decoder = decoder;
buffer->is = &is;
buffer->size = size;
buffer->length = 0;
buffer->consumed = 0;
return buffer;
}
void
decoder_buffer_free(DecoderBuffer *buffer)
{
assert(buffer != nullptr);
g_free(buffer);
}
bool
decoder_buffer_is_empty(const DecoderBuffer *buffer)
{
return buffer->consumed == buffer->length;
}
bool
decoder_buffer_is_full(const DecoderBuffer *buffer)
{
return buffer->consumed == 0 && buffer->length == buffer->size;
}
static void
decoder_buffer_shift(DecoderBuffer *buffer)
{
assert(buffer->consumed > 0);
buffer->length -= buffer->consumed;
memmove(buffer->data, buffer->data + buffer->consumed, buffer->length);
buffer->consumed = 0;
}
bool
decoder_buffer_fill(DecoderBuffer *buffer)
{
size_t nbytes;
if (buffer->consumed > 0)
decoder_buffer_shift(buffer);
if (buffer->length >= buffer->size)
/* buffer is full */
return false;
nbytes = decoder_read(buffer->decoder, *buffer->is,
buffer->data + buffer->length,
buffer->size - buffer->length);
if (nbytes == 0)
/* end of file, I/O error or decoder command
received */
return false;
buffer->length += nbytes;
assert(buffer->length <= buffer->size);
return true;
}
const void *
decoder_buffer_read(const DecoderBuffer *buffer, size_t *length_r)
{
if (buffer->consumed >= buffer->length)
/* buffer is empty */
return nullptr;
*length_r = buffer->length - buffer->consumed;
return buffer->data + buffer->consumed;
}
void
decoder_buffer_consume(DecoderBuffer *buffer, size_t nbytes)
{
/* just move the "consumed" pointer - decoder_buffer_shift()
will do the real work later (called by
decoder_buffer_fill()) */
buffer->consumed += nbytes;
assert(buffer->consumed <= buffer->length);
}
bool
decoder_buffer_skip(DecoderBuffer *buffer, size_t nbytes)
{
size_t length;
const void *data;
bool success;
/* this could probably be optimized by seeking */
while (true) {
data = decoder_buffer_read(buffer, &length);
if (data != nullptr) {
if (length > nbytes)
length = nbytes;
decoder_buffer_consume(buffer, length);
nbytes -= length;
if (nbytes == 0)
return true;
}
success = decoder_buffer_fill(buffer);
if (!success)
return false;
}
}

View File

@@ -1,105 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DECODER_BUFFER_HXX
#define MPD_DECODER_BUFFER_HXX
#include <stddef.h>
/**
* This objects handles buffered reads in decoder plugins easily. You
* create a buffer object, and use its high-level methods to fill and
* read it. It will automatically handle shifting the buffer.
*/
struct DecoderBuffer;
struct Decoder;
struct InputStream;
/**
* Creates a new buffer.
*
* @param decoder the decoder object, used for decoder_read(), may be nullptr
* @param is the input stream object where we should read from
* @param size the maximum size of the buffer
* @return the new decoder_buffer object
*/
DecoderBuffer *
decoder_buffer_new(Decoder *decoder, InputStream &is,
size_t size);
/**
* Frees resources used by the decoder_buffer object.
*/
void
decoder_buffer_free(DecoderBuffer *buffer);
bool
decoder_buffer_is_empty(const DecoderBuffer *buffer);
bool
decoder_buffer_is_full(const DecoderBuffer *buffer);
/**
* Read data from the input_stream and append it to the buffer.
*
* @return true if data was appended; false if there is no data
* available (yet), end of file, I/O error or a decoder command was
* received
*/
bool
decoder_buffer_fill(DecoderBuffer *buffer);
/**
* Reads data from the buffer. This data is not yet consumed, you
* have to call decoder_buffer_consume() to do that. The returned
* buffer becomes invalid after a decoder_buffer_fill() or a
* decoder_buffer_consume() call.
*
* @param buffer the decoder_buffer object
* @param length_r pointer to a size_t where you will receive the
* number of bytes available
* @return a pointer to the read buffer, or nullptr if there is no data
* available
*/
const void *
decoder_buffer_read(const DecoderBuffer *buffer, size_t *length_r);
/**
* Consume (delete, invalidate) a part of the buffer. The "nbytes"
* parameter must not be larger than the length returned by
* decoder_buffer_read().
*
* @param buffer the decoder_buffer object
* @param nbytes the number of bytes to consume
*/
void
decoder_buffer_consume(DecoderBuffer *buffer, size_t nbytes);
/**
* Skips the specified number of bytes, discarding its data.
*
* @param buffer the decoder_buffer object
* @param nbytes the number of bytes to skip
* @return true on success, false on error
*/
bool
decoder_buffer_skip(DecoderBuffer *buffer, size_t nbytes);
#endif

View File

@@ -1,152 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "DespotifyUtils.hxx"
#include "tag/Tag.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
extern "C" {
#include <despotify.h>
}
const Domain despotify_domain("despotify");
static struct despotify_session *g_session;
static void (*registered_callbacks[8])(struct despotify_session *,
int, void *, void *);
static void *registered_callback_data[8];
static void
callback(struct despotify_session* ds, int sig,
void *data, gcc_unused void *callback_data)
{
size_t i;
for (i = 0; i < sizeof(registered_callbacks) / sizeof(registered_callbacks[0]); i++) {
void (*cb)(struct despotify_session *, int, void *, void *) = registered_callbacks[i];
void *cb_data = registered_callback_data[i];
if (cb)
cb(ds, sig, data, cb_data);
}
}
bool mpd_despotify_register_callback(void (*cb)(struct despotify_session *, int, void *, void *),
void *cb_data)
{
size_t i;
for (i = 0; i < sizeof(registered_callbacks) / sizeof(registered_callbacks[0]); i++) {
if (!registered_callbacks[i]) {
registered_callbacks[i] = cb;
registered_callback_data[i] = cb_data;
return true;
}
}
return false;
}
void mpd_despotify_unregister_callback(void (*cb)(struct despotify_session *, int, void *, void *))
{
size_t i;
for (i = 0; i < sizeof(registered_callbacks) / sizeof(registered_callbacks[0]); i++) {
if (registered_callbacks[i] == cb) {
registered_callbacks[i] = nullptr;
}
}
}
Tag *
mpd_despotify_tag_from_track(struct ds_track *track)
{
char tracknum[20];
char comment[80];
char date[20];
Tag *tag = new Tag();
if (!track->has_meta_data)
return tag;
snprintf(tracknum, sizeof(tracknum), "%d", track->tracknumber);
snprintf(date, sizeof(date), "%d", track->year);
snprintf(comment, sizeof(comment), "Bitrate %d Kbps, %sgeo restricted",
track->file_bitrate / 1000,
track->geo_restricted ? "" : "not ");
tag->AddItem(TAG_TITLE, track->title);
tag->AddItem(TAG_ARTIST, track->artist->name);
tag->AddItem(TAG_TRACK, tracknum);
tag->AddItem(TAG_ALBUM, track->album);
tag->AddItem(TAG_DATE, date);
tag->AddItem(TAG_COMMENT, comment);
tag->time = track->length / 1000;
return tag;
}
struct despotify_session *mpd_despotify_get_session(void)
{
const char *user;
const char *passwd;
bool high_bitrate;
if (g_session)
return g_session;
user = config_get_string(CONF_DESPOTIFY_USER, nullptr);
passwd = config_get_string(CONF_DESPOTIFY_PASSWORD, nullptr);
high_bitrate = config_get_bool(CONF_DESPOTIFY_HIGH_BITRATE, true);
if (user == nullptr || passwd == nullptr) {
LogDebug(despotify_domain,
"disabling despotify because account is not configured");
return nullptr;
}
if (!despotify_init()) {
LogWarning(despotify_domain, "Can't initialize despotify");
return nullptr;
}
g_session = despotify_init_client(callback, nullptr,
high_bitrate, true);
if (!g_session) {
LogWarning(despotify_domain,
"Can't initialize despotify client");
return nullptr;
}
if (!despotify_authenticate(g_session, user, passwd)) {
LogWarning(despotify_domain,
"Can't authenticate despotify session");
despotify_exit(g_session);
return nullptr;
}
return g_session;
}

View File

@@ -1,71 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DESPOTIFY_H
#define MPD_DESPOTIFY_H
struct Tag;
struct despotify_session;
struct ds_track;
extern const class Domain despotify_domain;
/**
* Return the current despotify session.
*
* If the session isn't initialized, this function will initialize
* it and connect to Spotify.
*
* @return a pointer to the despotify session, or nullptr if it can't
* be initialized (e.g., if the configuration isn't supplied)
*/
struct despotify_session *mpd_despotify_get_session(void);
/**
* Create a MPD tags structure from a spotify track
*
* @param track the track to convert
*
* @return a pointer to the filled in tags structure
*/
Tag *
mpd_despotify_tag_from_track(struct ds_track *track);
/**
* Register a despotify callback.
*
* Despotify calls this e.g., when a track ends.
*
* @param cb the callback
* @param cb_data the data to pass to the callback
*
* @return true if the callback could be registered
*/
bool mpd_despotify_register_callback(void (*cb)(struct despotify_session *, int, void *, void *),
void *cb_data);
/**
* Unregister a despotify callback.
*
* @param cb the callback to unregister.
*/
void mpd_despotify_unregister_callback(void (*cb)(struct despotify_session *, int, void *, void *));
#endif

73
src/DetachedSong.cxx Normal file
View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "DetachedSong.hxx"
#include "db/LightSong.hxx"
#include "util/UriUtil.hxx"
#include "fs/Traits.hxx"
DetachedSong::DetachedSong(const LightSong &other)
:uri(other.GetURI().c_str()),
real_uri(other.real_uri != nullptr ? other.real_uri : ""),
tag(*other.tag),
mtime(other.mtime),
start_time(other.start_time),
end_time(other.end_time) {}
DetachedSong::~DetachedSong()
{
/* this destructor exists here just so it won't inlined */
}
bool
DetachedSong::IsRemote() const
{
return uri_has_scheme(GetRealURI());
}
bool
DetachedSong::IsAbsoluteFile() const
{
return PathTraitsUTF8::IsAbsolute(GetRealURI());
}
bool
DetachedSong::IsInDatabase() const
{
/* here, we use GetURI() and not GetRealURI() because
GetRealURI() is never relative */
const char *_uri = GetURI();
return !uri_has_scheme(_uri) && !PathTraitsUTF8::IsAbsolute(_uri);
}
SignedSongTime
DetachedSong::GetDuration() const
{
SongTime a = start_time, b = end_time;
if (!b.IsPositive()) {
if (tag.duration.IsNegative())
return tag.duration;
b = SongTime(tag.duration);
}
return SignedSongTime(b - a);
}

226
src/DetachedSong.hxx Normal file
View File

@@ -0,0 +1,226 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DETACHED_SONG_HXX
#define MPD_DETACHED_SONG_HXX
#include "check.h"
#include "tag/Tag.hxx"
#include "Chrono.hxx"
#include "Compiler.h"
#include <string>
#include <utility>
#include <time.h>
struct LightSong;
class Storage;
class DetachedSong {
friend DetachedSong map_song_detach(const LightSong &song);
friend DetachedSong DatabaseDetachSong(const Storage &db,
const LightSong &song);
/**
* An UTF-8-encoded URI referring to the song file. This can
* be one of:
*
* - an absolute URL with a scheme
* (e.g. "http://example.com/foo.mp3")
*
* - an absolute file name
*
* - a file name relative to the music directory
*/
std::string uri;
/**
* The "real" URI, the one to be used for opening the
* resource. If this attribute is empty, then #uri shall be
* used.
*
* This attribute is used for songs from the database which
* have a relative URI.
*/
std::string real_uri;
Tag tag;
time_t mtime;
/**
* Start of this sub-song within the file.
*/
SongTime start_time;
/**
* End of this sub-song within the file.
* Unused if zero.
*/
SongTime end_time;
explicit DetachedSong(const LightSong &other);
public:
explicit DetachedSong(const DetachedSong &) = default;
explicit DetachedSong(const char *_uri)
:uri(_uri),
mtime(0),
start_time(SongTime::zero()), end_time(SongTime::zero()) {}
explicit DetachedSong(const std::string &_uri)
:uri(_uri),
mtime(0),
start_time(SongTime::zero()), end_time(SongTime::zero()) {}
explicit DetachedSong(std::string &&_uri)
:uri(std::move(_uri)),
mtime(0),
start_time(SongTime::zero()), end_time(SongTime::zero()) {}
template<typename U>
DetachedSong(U &&_uri, Tag &&_tag)
:uri(std::forward<U>(_uri)),
tag(std::move(_tag)),
mtime(0),
start_time(SongTime::zero()), end_time(SongTime::zero()) {}
DetachedSong(DetachedSong &&) = default;
~DetachedSong();
gcc_pure
const char *GetURI() const {
return uri.c_str();
}
template<typename T>
void SetURI(T &&_uri) {
uri = std::forward<T>(_uri);
}
/**
* Does this object have a "real" URI different from the
* displayed URI?
*/
gcc_pure
bool HasRealURI() const {
return !real_uri.empty();
}
/**
* Returns "real" URI (#real_uri) and falls back to just
* GetURI().
*/
gcc_pure
const char *GetRealURI() const {
return (HasRealURI() ? real_uri : uri).c_str();
}
template<typename T>
void SetRealURI(T &&_uri) {
real_uri = std::forward<T>(_uri);
}
/**
* Returns true if both objects refer to the same physical
* song.
*/
gcc_pure
bool IsSame(const DetachedSong &other) const {
return uri == other.uri;
}
gcc_pure gcc_nonnull_all
bool IsURI(const char *other_uri) const {
return uri == other_uri;
}
gcc_pure
bool IsRemote() const;
gcc_pure
bool IsFile() const {
return !IsRemote();
}
gcc_pure
bool IsAbsoluteFile() const;
gcc_pure
bool IsInDatabase() const;
const Tag &GetTag() const {
return tag;
}
Tag &WritableTag() {
return tag;
}
void SetTag(const Tag &_tag) {
tag = Tag(_tag);
}
void SetTag(Tag &&_tag) {
tag = std::move(_tag);
}
void MoveTagFrom(DetachedSong &&other) {
tag = std::move(other.tag);
}
time_t GetLastModified() const {
return mtime;
}
void SetLastModified(time_t _value) {
mtime = _value;
}
SongTime GetStartTime() const {
return start_time;
}
void SetStartTime(SongTime _value) {
start_time = _value;
}
SongTime GetEndTime() const {
return end_time;
}
void SetEndTime(SongTime _value) {
end_time = _value;
}
gcc_pure
SignedSongTime GetDuration() const;
/**
* Update the #tag and #mtime.
*
* @return true on success
*/
bool Update();
};
#endif

View File

@@ -1,331 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "Directory.hxx"
#include "SongFilter.hxx"
#include "PlaylistVector.hxx"
#include "DatabaseLock.hxx"
#include "SongSort.hxx"
#include "Song.hxx"
#include "fs/Traits.hxx"
#include "util/Error.hxx"
extern "C" {
#include "util/list_sort.h"
}
#include <glib.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
inline Directory *
Directory::Allocate(const char *path)
{
assert(path != nullptr);
const size_t path_size = strlen(path) + 1;
Directory *directory =
(Directory *)g_malloc0(sizeof(*directory)
- sizeof(directory->path)
+ path_size);
new(directory) Directory(path);
return directory;
}
Directory::Directory()
{
INIT_LIST_HEAD(&children);
INIT_LIST_HEAD(&songs);
path[0] = 0;
}
Directory::Directory(const char *_path)
{
INIT_LIST_HEAD(&children);
INIT_LIST_HEAD(&songs);
strcpy(path, _path);
}
Directory::~Directory()
{
Song *song, *ns;
directory_for_each_song_safe(song, ns, *this)
song->Free();
Directory *child, *n;
directory_for_each_child_safe(child, n, *this)
child->Free();
}
Directory *
Directory::NewGeneric(const char *path, Directory *parent)
{
assert(path != nullptr);
assert((*path == 0) == (parent == nullptr));
Directory *directory = Allocate(path);
directory->parent = parent;
return directory;
}
void
Directory::Free()
{
this->Directory::~Directory();
g_free(this);
}
void
Directory::Delete()
{
assert(holding_db_lock());
assert(parent != nullptr);
list_del(&siblings);
Free();
}
const char *
Directory::GetName() const
{
assert(!IsRoot());
return PathTraits::GetBaseUTF8(path);
}
Directory *
Directory::CreateChild(const char *name_utf8)
{
assert(holding_db_lock());
assert(name_utf8 != nullptr);
assert(*name_utf8 != 0);
char *allocated;
const char *path_utf8;
if (IsRoot()) {
allocated = nullptr;
path_utf8 = name_utf8;
} else {
allocated = g_strconcat(GetPath(),
"/", name_utf8, nullptr);
path_utf8 = allocated;
}
Directory *child = NewGeneric(path_utf8, this);
g_free(allocated);
list_add_tail(&child->siblings, &children);
return child;
}
const Directory *
Directory::FindChild(const char *name) const
{
assert(holding_db_lock());
const Directory *child;
directory_for_each_child(child, *this)
if (strcmp(child->GetName(), name) == 0)
return child;
return nullptr;
}
void
Directory::PruneEmpty()
{
assert(holding_db_lock());
Directory *child, *n;
directory_for_each_child_safe(child, n, *this) {
child->PruneEmpty();
if (child->IsEmpty())
child->Delete();
}
}
Directory *
Directory::LookupDirectory(const char *uri)
{
assert(holding_db_lock());
assert(uri != nullptr);
if (isRootDirectory(uri))
return this;
char *duplicated = g_strdup(uri), *name = duplicated;
Directory *d = this;
while (1) {
char *slash = strchr(name, '/');
if (slash == name) {
d = nullptr;
break;
}
if (slash != nullptr)
*slash = '\0';
d = d->FindChild(name);
if (d == nullptr || slash == nullptr)
break;
name = slash + 1;
}
g_free(duplicated);
return d;
}
void
Directory::AddSong(Song *song)
{
assert(holding_db_lock());
assert(song != nullptr);
assert(song->parent == this);
list_add_tail(&song->siblings, &songs);
}
void
Directory::RemoveSong(Song *song)
{
assert(holding_db_lock());
assert(song != nullptr);
assert(song->parent == this);
list_del(&song->siblings);
}
const Song *
Directory::FindSong(const char *name_utf8) const
{
assert(holding_db_lock());
assert(name_utf8 != nullptr);
Song *song;
directory_for_each_song(song, *this) {
assert(song->parent == this);
if (strcmp(song->uri, name_utf8) == 0)
return song;
}
return nullptr;
}
Song *
Directory::LookupSong(const char *uri)
{
char *duplicated, *base;
assert(holding_db_lock());
assert(uri != nullptr);
duplicated = g_strdup(uri);
base = strrchr(duplicated, '/');
Directory *d = this;
if (base != nullptr) {
*base++ = 0;
d = d->LookupDirectory(duplicated);
if (d == nullptr) {
g_free(duplicated);
return nullptr;
}
} else
base = duplicated;
Song *song = d->FindSong(base);
assert(song == nullptr || song->parent == d);
g_free(duplicated);
return song;
}
static int
directory_cmp(gcc_unused void *priv,
struct list_head *_a, struct list_head *_b)
{
const Directory *a = (const Directory *)_a;
const Directory *b = (const Directory *)_b;
return g_utf8_collate(a->path, b->path);
}
void
Directory::Sort()
{
assert(holding_db_lock());
list_sort(nullptr, &children, directory_cmp);
song_list_sort(&songs);
Directory *child;
directory_for_each_child(child, *this)
child->Sort();
}
bool
Directory::Walk(bool recursive, const SongFilter *filter,
VisitDirectory visit_directory, VisitSong visit_song,
VisitPlaylist visit_playlist,
Error &error) const
{
assert(!error.IsDefined());
if (visit_song) {
Song *song;
directory_for_each_song(song, *this)
if ((filter == nullptr || filter->Match(*song)) &&
!visit_song(*song, error))
return false;
}
if (visit_playlist) {
for (const PlaylistInfo &p : playlists)
if (!visit_playlist(p, *this, error))
return false;
}
Directory *child;
directory_for_each_child(child, *this) {
if (visit_directory &&
!visit_directory(*child, error))
return false;
if (recursive &&
!child->Walk(recursive, filter,
visit_directory, visit_song, visit_playlist,
error))
return false;
}
return true;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,6 @@
#include "GlobalEvents.hxx"
#include "util/Manual.hxx"
#include "event/DeferredMonitor.hxx"
#include "Compiler.h"
#include <atomic>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -33,12 +33,6 @@ class EventLoop;
namespace GlobalEvents {
enum Event {
/** database update was finished */
UPDATE,
/** during database update, a song was deleted */
DELETE,
/** an idle event was emitted */
IDLE,
@@ -48,9 +42,6 @@ namespace GlobalEvents {
/** the current song's tag has changed */
TAG,
/** a hardware mixer plugin has detected a change */
MIXER,
#ifdef WIN32
/** shutdown requested */
SHUTDOWN,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 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 "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "thread/Thread.hxx"
#include "thread/Name.hxx"
#include "event/Loop.hxx"
#include "system/FatalError.hxx"
#include "util/Error.hxx"
@@ -48,6 +49,8 @@ io_thread_run(void)
static void
io_thread_func(gcc_unused void *arg)
{
SetThreadName("io");
/* lock+unlock to synchronize with io_thread_start(), to be
sure that io.thread is set */
io.mutex.lock();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -49,7 +49,7 @@ io_thread_quit(void);
void
io_thread_deinit(void);
gcc_pure
gcc_const
EventLoop &
io_thread_get();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,11 +20,10 @@
#include "config.h"
#include "IcyMetaDataParser.hxx"
#include "tag/Tag.hxx"
#include "tag/TagBuilder.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
#include <glib.h>
#include <assert.h>
#include <string.h>
@@ -37,7 +36,7 @@ IcyMetaDataParser::Reset()
return;
if (data_rest == 0 && meta_size > 0)
g_free(meta_data);
delete[] meta_data;
delete tag;
@@ -66,7 +65,7 @@ IcyMetaDataParser::Data(size_t length)
}
static void
icy_add_item(Tag &tag, TagType type, const char *value)
icy_add_item(TagBuilder &tag, TagType type, const char *value)
{
size_t length = strlen(value);
@@ -81,33 +80,87 @@ icy_add_item(Tag &tag, TagType type, const char *value)
}
static void
icy_parse_tag_item(Tag &tag, const char *item)
icy_parse_tag_item(TagBuilder &tag, const char *name, const char *value)
{
gchar **p = g_strsplit(item, "=", 0);
if (strcmp(name, "StreamTitle") == 0)
icy_add_item(tag, TAG_TITLE, value);
else
FormatDebug(icy_metadata_domain,
"unknown icy-tag: '%s'", name);
}
if (p[0] != nullptr && p[1] != nullptr) {
if (strcmp(p[0], "StreamTitle") == 0)
icy_add_item(tag, TAG_TITLE, p[1]);
else
FormatDebug(icy_metadata_domain,
"unknown icy-tag: '%s'", p[0]);
/**
* Find a single quote that is followed by a semicolon (or by the end
* of the string). If that fails, return the first single quote. If
* that also fails, return #end.
*/
static char *
find_end_quote(char *p, char *const end)
{
char *fallback = std::find(p, end, '\'');
if (fallback >= end - 1 || fallback[1] == ';')
return fallback;
p = fallback + 1;
while (true) {
p = std::find(p, end, '\'');
if (p == end)
return fallback;
if (p == end - 1 || p[1] == ';')
return p;
++p;
}
g_strfreev(p);
}
static Tag *
icy_parse_tag(const char *p)
icy_parse_tag(char *p, char *const end)
{
Tag *tag = new Tag();
gchar **items = g_strsplit(p, ";", 0);
assert(p != nullptr);
assert(end != nullptr);
assert(p <= end);
for (unsigned i = 0; items[i] != nullptr; ++i)
icy_parse_tag_item(*tag, items[i]);
TagBuilder tag;
g_strfreev(items);
while (p != end) {
const char *const name = p;
char *eq = std::find(p, end, '=');
if (eq == end)
break;
return tag;
*eq = 0;
p = eq + 1;
if (*p != '\'') {
/* syntax error; skip to the next semicolon,
try to recover */
char *semicolon = std::find(p, end, ';');
if (semicolon == end)
break;
p = semicolon + 1;
continue;
}
++p;
const char *const value = p;
char *quote = find_end_quote(p, end);
if (quote == end)
break;
*quote = 0;
p = quote + 1;
icy_parse_tag_item(tag, name, value);
char *semicolon = std::find(p, end, ';');
if (semicolon == end)
break;
p = semicolon + 1;
}
return tag.CommitNew();
}
size_t
@@ -136,7 +189,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
/* initialize metadata reader, allocate enough
memory (+1 for the null terminator) */
meta_position = 0;
meta_data = (char *)g_malloc(meta_size + 1);
meta_data = new char[meta_size + 1];
}
assert(meta_position < meta_size);
@@ -152,16 +205,12 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
++length;
if (meta_position == meta_size) {
/* null-terminate the string */
meta_data[meta_size] = 0;
/* parse */
delete tag;
tag = icy_parse_tag(meta_data);
g_free(meta_data);
tag = icy_parse_tag(meta_data, meta_data + meta_size);
delete[] meta_data;
/* change back to normal data mode */
@@ -171,3 +220,32 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
return length;
}
size_t
IcyMetaDataParser::ParseInPlace(void *data, size_t length)
{
uint8_t *const dest0 = (uint8_t *)data;
uint8_t *dest = dest0;
const uint8_t *src = dest0;
while (length > 0) {
size_t chunk = Data(length);
if (chunk > 0) {
memmove(dest, src, chunk);
dest += chunk;
src += chunk;
length -= chunk;
if (length == 0)
break;
}
chunk = Meta(src, length);
if (chunk > 0) {
src += chunk;
length -= chunk;
}
}
return dest - dest0;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -75,6 +75,13 @@ public:
*/
size_t Meta(const void *data, size_t length);
/**
* Parse data and eliminate metadata.
*
* @return the number of data bytes remaining in the buffer
*/
size_t ParseInPlace(void *data, size_t length);
Tag *ReadTag() {
Tag *result = tag;
tag = nullptr;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,7 @@
#include "config.h"
#include "Idle.hxx"
#include "GlobalEvents.hxx"
#include "util/ASCII.hxx"
#include <atomic>
@@ -44,6 +45,8 @@ static const char *const idle_names[] = {
"update",
"subscription",
"message",
"neighbor",
"mount",
nullptr
};
@@ -69,3 +72,18 @@ idle_get_names(void)
{
return idle_names;
}
unsigned
idle_parse_name(const char *name)
{
#if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */
assert(name != nullptr);
#endif
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
if (StringEqualsCaseASCII(name, idle_names[i]))
return 1 << i;
return 0;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,8 @@
#ifndef MPD_IDLE_HXX
#define MPD_IDLE_HXX
#include "Compiler.h"
/** song database has been updated*/
static constexpr unsigned IDLE_DATABASE = 0x1;
@@ -59,6 +61,12 @@ static constexpr unsigned IDLE_SUBSCRIPTION = 0x200;
/** a message on the subscribed channel was received */
static constexpr unsigned IDLE_MESSAGE = 0x400;
/** a neighbor was found or lost */
static constexpr unsigned IDLE_NEIGHBOR = 0x800;
/** the mount list has changed */
static constexpr unsigned IDLE_MOUNT = 0x1000;
/**
* Adds idle flag (with bitwise "or") and queues notifications to all
* clients.
@@ -78,4 +86,12 @@ idle_get(void);
const char*const*
idle_get_names(void);
/**
* Parse an idle name and return its mask. Returns 0 if the given
* name is unknown.
*/
gcc_nonnull_all gcc_pure
unsigned
idle_parse_name(const char *name);
#endif

View File

@@ -1,192 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "InputStream.hxx"
#include "InputRegistry.hxx"
#include "InputPlugin.hxx"
#include "input/RewindInputPlugin.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include <assert.h>
#include <stdio.h> /* for SEEK_SET */
static constexpr Domain input_domain("input");
InputStream *
InputStream::Open(const char *url,
Mutex &mutex, Cond &cond,
Error &error)
{
input_plugins_for_each_enabled(plugin) {
InputStream *is;
is = plugin->open(url, mutex, cond, error);
if (is != nullptr) {
assert(is->plugin.close != nullptr);
assert(is->plugin.read != nullptr);
assert(is->plugin.eof != nullptr);
assert(!is->seekable || is->plugin.seek != nullptr);
is = input_rewind_open(is);
return is;
} else if (error.IsDefined())
return nullptr;
}
error.Set(input_domain, "Unrecognized URI");
return nullptr;
}
bool
InputStream::Check(Error &error)
{
return plugin.check == nullptr || plugin.check(this, error);
}
void
InputStream::Update()
{
if (plugin.update != nullptr)
plugin.update(this);
}
void
InputStream::WaitReady()
{
while (true) {
Update();
if (ready)
break;
cond.wait(mutex);
}
}
void
InputStream::LockWaitReady()
{
const ScopeLock protect(mutex);
WaitReady();
}
bool
InputStream::CheapSeeking() const
{
return IsSeekable() && !uri_has_scheme(uri.c_str());
}
bool
InputStream::Seek(offset_type _offset, int whence, Error &error)
{
if (plugin.seek == nullptr)
return false;
return plugin.seek(this, _offset, whence, error);
}
bool
InputStream::LockSeek(offset_type _offset, int whence, Error &error)
{
if (plugin.seek == nullptr)
return false;
const ScopeLock protect(mutex);
return Seek(_offset, whence, error);
}
bool
InputStream::Rewind(Error &error)
{
return Seek(0, SEEK_SET, error);
}
bool
InputStream::LockRewind(Error &error)
{
return LockSeek(0, SEEK_SET, error);
}
Tag *
InputStream::ReadTag()
{
return plugin.tag != nullptr
? plugin.tag(this)
: nullptr;
}
Tag *
InputStream::LockReadTag()
{
if (plugin.tag == nullptr)
return nullptr;
const ScopeLock protect(mutex);
return ReadTag();
}
bool
InputStream::IsAvailable()
{
return plugin.available != nullptr
? plugin.available(this)
: true;
}
size_t
InputStream::Read(void *ptr, size_t _size, Error &error)
{
assert(ptr != nullptr);
assert(_size > 0);
return plugin.read(this, ptr, _size, error);
}
size_t
InputStream::LockRead(void *ptr, size_t _size, Error &error)
{
assert(ptr != nullptr);
assert(_size > 0);
const ScopeLock protect(mutex);
return Read(ptr, _size, error);
}
void
InputStream::Close()
{
plugin.close(this);
}
bool
InputStream::IsEOF()
{
return plugin.eof(this);
}
bool
InputStream::LockIsEOF()
{
const ScopeLock protect(mutex);
return IsEOF();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,19 +21,26 @@
#include "Instance.hxx"
#include "Partition.hxx"
#include "Idle.hxx"
#include "Stats.hxx"
void
Instance::DeleteSong(const Song &song)
#ifdef ENABLE_DATABASE
#include "db/DatabaseError.hxx"
#include "db/LightSong.hxx"
#ifdef ENABLE_SQLITE
#include "sticker/StickerDatabase.hxx"
#include "sticker/SongSticker.hxx"
#endif
Database *
Instance::GetDatabase(Error &error)
{
partition->DeleteSong(song);
if (database == nullptr)
error.Set(db_domain, DB_DISABLED, "No database");
return database;
}
void
Instance::DatabaseModified()
{
partition->DatabaseModified();
idle_add(IDLE_DATABASE);
}
#endif
void
Instance::TagModified()
@@ -46,3 +53,50 @@ Instance::SyncWithPlayer()
{
partition->SyncWithPlayer();
}
#ifdef ENABLE_DATABASE
void
Instance::OnDatabaseModified()
{
assert(database != nullptr);
/* propagate the change to all subsystems */
stats_invalidate();
partition->DatabaseModified(*database);
idle_add(IDLE_DATABASE);
}
void
Instance::OnDatabaseSongRemoved(const LightSong &song)
{
assert(database != nullptr);
#ifdef ENABLE_SQLITE
/* if the song has a sticker, remove it */
if (sticker_enabled())
sticker_song_delete(song);
#endif
const auto uri = song.GetURI();
partition->DeleteSong(uri.c_str());
}
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
void
Instance::FoundNeighbor(gcc_unused const NeighborInfo &info)
{
idle_add(IDLE_NEIGHBOR);
}
void
Instance::LostNeighbor(gcc_unused const NeighborInfo &info)
{
idle_add(IDLE_NEIGHBOR);
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -21,23 +21,76 @@
#define MPD_INSTANCE_HXX
#include "check.h"
#include "Compiler.h"
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Listener.hxx"
class NeighborGlue;
#endif
#ifdef ENABLE_DATABASE
#include "db/DatabaseListener.hxx"
class Database;
class Storage;
class UpdateService;
#endif
class EventLoop;
class Error;
class ClientList;
struct Partition;
struct Song;
struct Instance {
struct Instance final
#if defined(ENABLE_DATABASE) || defined(ENABLE_NEIGHBOR_PLUGINS)
:
#endif
#ifdef ENABLE_DATABASE
public DatabaseListener
#ifdef ENABLE_NEIGHBOR_PLUGINS
,
#endif
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
public NeighborListener
#endif
{
EventLoop *event_loop;
#ifdef ENABLE_NEIGHBOR_PLUGINS
NeighborGlue *neighbors;
#endif
#ifdef ENABLE_DATABASE
Database *database;
/**
* This is really a #CompositeStorage. To avoid heavy include
* dependencies, we declare it as just #Storage.
*/
Storage *storage;
UpdateService *update;
#endif
ClientList *client_list;
Partition *partition;
void DeleteSong(const Song &song);
Instance() {
#ifdef ENABLE_DATABASE
storage = nullptr;
update = nullptr;
#endif
}
#ifdef ENABLE_DATABASE
/**
* The database has been modified. Propagate the change to
* all subsystems.
* Returns the global #Database instance. May return nullptr
* if this MPD configuration has no database (no
* music_directory was configured).
*/
void DatabaseModified();
Database *GetDatabase(Error &error);
#endif
/**
* A tag in the play queue has been modified by the player
@@ -49,6 +102,18 @@ struct Instance {
* Synchronize the player with the play queue.
*/
void SyncWithPlayer();
private:
#ifdef ENABLE_DATABASE
virtual void OnDatabaseModified() override;
virtual void OnDatabaseSongRemoved(const LightSong &song) override;
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
/* virtual methods from class NeighborListener */
virtual void FoundNeighbor(const NeighborInfo &info) override;
virtual void LostNeighbor(const NeighborInfo &info) override;
#endif
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,12 +19,10 @@
#include "config.h"
#include "Listen.hxx"
#include "Main.hxx"
#include "Instance.hxx"
#include "Client.hxx"
#include "ConfigData.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "client/Client.hxx"
#include "config/ConfigData.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
#include "event/ServerSocket.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
@@ -43,13 +41,16 @@ static constexpr Domain listen_domain("listen");
#define DEFAULT_PORT 6600
class ClientListener final : public ServerSocket {
Partition &partition;
public:
ClientListener():ServerSocket(*main_loop) {}
ClientListener(EventLoop &_loop, Partition &_partition)
:ServerSocket(_loop), partition(_partition) {}
private:
virtual void OnAccept(int fd, const sockaddr &address,
size_t address_length, int uid) {
client_new(*main_loop, *instance->partition,
client_new(GetEventLoop(), partition,
fd, &address, address_length, uid);
}
};
@@ -76,10 +77,11 @@ listen_add_config_param(unsigned int port,
}
}
#ifdef ENABLE_SYSTEMD_DAEMON
static bool
listen_systemd_activation(Error &error_r)
{
#ifdef ENABLE_SYSTEMD_DAEMON
int n = sd_listen_fds(true);
if (n <= 0) {
if (n < 0)
@@ -94,29 +96,26 @@ listen_systemd_activation(Error &error_r)
return false;
return true;
#else
(void)error_r;
return false;
#endif
}
bool
listen_global_init(Error &error)
{
assert(main_loop != nullptr);
#endif
bool
listen_global_init(EventLoop &loop, Partition &partition, Error &error)
{
int port = config_get_positive(CONF_PORT, DEFAULT_PORT);
const struct config_param *param =
config_get_next_param(CONF_BIND_TO_ADDRESS, nullptr);
bool success;
config_get_param(CONF_BIND_TO_ADDRESS);
listen_socket = new ClientListener();
listen_socket = new ClientListener(loop, partition);
#ifdef ENABLE_SYSTEMD_DAEMON
if (listen_systemd_activation(error))
return true;
if (error.IsDefined())
return false;
#endif
if (param != nullptr) {
/* "bind_to_address" is configured, create listeners
@@ -130,16 +129,12 @@ listen_global_init(Error &error)
param->line);
return false;
}
param = config_get_next_param(CONF_BIND_TO_ADDRESS,
param);
} while (param != nullptr);
} while ((param = param->next) != nullptr);
} else {
/* no "bind_to_address" configured, bind the
configured port on all interfaces */
success = listen_socket->AddPort(port, error);
if (!success) {
if (!listen_socket->AddPort(port, error)) {
delete listen_socket;
error.FormatPrefix("Failed to listen on *:%d: ", port);
return false;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,12 +20,14 @@
#ifndef MPD_LISTEN_HXX
#define MPD_LISTEN_HXX
class EventLoop;
class Error;
struct Partition;
extern int listen_port;
bool
listen_global_init(Error &error);
listen_global_init(EventLoop &loop, Partition &partition, Error &error);
void listen_global_finish(void);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,62 +19,19 @@
#include "config.h"
#include "LogV.hxx"
#include "ConfigData.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "system/fd_util.h"
#include "system/FatalError.hxx"
#include "fs/Path.hxx"
#include "fs/FileSystem.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "system/FatalError.hxx"
#include <glib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
static GLogLevelFlags
ToGLib(LogLevel level)
{
switch (level) {
case LogLevel::DEBUG:
return G_LOG_LEVEL_DEBUG;
case LogLevel::INFO:
return G_LOG_LEVEL_INFO;
case LogLevel::DEFAULT:
return G_LOG_LEVEL_MESSAGE;
case LogLevel::WARNING:
case LogLevel::ERROR:
return G_LOG_LEVEL_WARNING;
}
assert(false);
gcc_unreachable();
}
void
Log(const Domain &domain, LogLevel level, const char *msg)
{
g_log(domain.GetName(), ToGLib(level), "%s", msg);
}
void
LogFormatV(const Domain &domain, LogLevel level, const char *fmt, va_list ap)
{
g_logv(domain.GetName(), ToGLib(level), fmt, ap);
char msg[1024];
vsnprintf(msg, sizeof(msg), fmt, ap);
Log(domain, level, msg);
}
void
@@ -159,7 +116,7 @@ FormatError(const Error &error, const char *fmt, ...)
void
LogErrno(const Domain &domain, int e, const char *msg)
{
LogFormat(domain, LogLevel::ERROR, "%s: %s", msg, g_strerror(e));
LogFormat(domain, LogLevel::ERROR, "%s: %s", msg, strerror(e));
}
void

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,47 +20,12 @@
#ifndef MPD_LOG_HXX
#define MPD_LOG_HXX
#include "LogLevel.hxx"
#include "Compiler.h"
#ifdef WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ERROR
#undef ERROR
#endif
#endif
class Error;
class Domain;
enum class LogLevel {
/**
* Debug message for developers.
*/
DEBUG,
/**
* Unimportant informational message.
*/
INFO,
/**
* Interesting informational message.
*/
DEFAULT,
/**
* Warning: something may be wrong.
*/
WARNING,
/**
* An error has occurred, an operation could not finish
* successfully.
*/
ERROR,
};
void
Log(const Domain &domain, LogLevel level, const char *msg);

230
src/LogBackend.cxx Normal file
View File

@@ -0,0 +1,230 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "LogBackend.hxx"
#include "Log.hxx"
#include "util/Domain.hxx"
#include "util/StringUtil.hxx"
#ifdef HAVE_GLIB
#include <glib.h>
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#ifdef HAVE_SYSLOG
#include <syslog.h>
#endif
#ifdef ANDROID
#include <android/log.h>
static int
ToAndroidLogLevel(LogLevel log_level)
{
switch (log_level) {
case LogLevel::DEBUG:
return ANDROID_LOG_DEBUG;
case LogLevel::INFO:
case LogLevel::DEFAULT:
return ANDROID_LOG_INFO;
case LogLevel::WARNING:
return ANDROID_LOG_WARN;
case LogLevel::ERROR:
return ANDROID_LOG_ERROR;
}
assert(false);
gcc_unreachable();
}
#else
static LogLevel log_threshold = LogLevel::INFO;
#ifdef HAVE_GLIB
static const char *log_charset;
#endif
static bool enable_timestamp;
#ifdef HAVE_SYSLOG
static bool enable_syslog;
#endif
void
SetLogThreshold(LogLevel _threshold)
{
log_threshold = _threshold;
}
#ifdef HAVE_GLIB
void
SetLogCharset(const char *_charset)
{
log_charset = _charset;
}
#endif
void
EnableLogTimestamp()
{
#ifdef HAVE_SYSLOG
assert(!enable_syslog);
#endif
assert(!enable_timestamp);
enable_timestamp = true;
}
static const char *log_date(void)
{
static constexpr size_t LOG_DATE_BUF_SIZE = 16;
static char buf[LOG_DATE_BUF_SIZE];
time_t t = time(nullptr);
strftime(buf, LOG_DATE_BUF_SIZE, "%b %d %H:%M : ", localtime(&t));
return buf;
}
/**
* Determines the length of the string excluding trailing whitespace
* characters.
*/
static int
chomp_length(const char *p)
{
size_t length = strlen(p);
return StripRight(p, length);
}
#ifdef HAVE_SYSLOG
static int
ToSysLogLevel(LogLevel log_level)
{
switch (log_level) {
case LogLevel::DEBUG:
return LOG_DEBUG;
case LogLevel::INFO:
return LOG_INFO;
case LogLevel::DEFAULT:
return LOG_NOTICE;
case LogLevel::WARNING:
return LOG_WARNING;
case LogLevel::ERROR:
return LOG_ERR;
}
assert(false);
gcc_unreachable();
}
static void
SysLog(const Domain &domain, LogLevel log_level, const char *message)
{
syslog(ToSysLogLevel(log_level), "%s: %.*s",
domain.GetName(),
chomp_length(message), message);
}
void
LogInitSysLog()
{
openlog(PACKAGE, 0, LOG_DAEMON);
enable_syslog = true;
}
void
LogFinishSysLog()
{
if (enable_syslog)
closelog();
}
#endif
static void
FileLog(const Domain &domain, const char *message)
{
#ifdef HAVE_GLIB
char *converted;
if (log_charset != nullptr) {
converted = g_convert_with_fallback(message, -1,
log_charset, "utf-8",
nullptr, nullptr,
nullptr, nullptr);
if (converted != nullptr)
message = converted;
} else
converted = nullptr;
#endif
fprintf(stderr, "%s%s: %.*s\n",
enable_timestamp ? log_date() : "",
domain.GetName(),
chomp_length(message), message);
#ifdef WIN32
/* force-flush the log file, because setvbuf() does not seem
to have an effect on WIN32 */
fflush(stderr);
#endif
#ifdef HAVE_GLIB
g_free(converted);
#endif
}
#endif /* !ANDROID */
void
Log(const Domain &domain, LogLevel level, const char *msg)
{
#ifdef ANDROID
__android_log_print(ToAndroidLogLevel(level), "MPD",
"%s: %s", domain.GetName(), msg);
#else
if (level < log_threshold)
return;
#ifdef HAVE_SYSLOG
if (enable_syslog) {
SysLog(domain, level, msg);
return;
}
#endif
FileLog(domain, msg);
#endif /* !ANDROID */
}

45
src/LogBackend.hxx Normal file
View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_LOG_BACKEND_HXX
#define MPD_LOG_BACKEND_HXX
#include "check.h"
#include "LogLevel.hxx"
void
SetLogThreshold(LogLevel _threshold);
#ifdef HAVE_GLIB
void
SetLogCharset(const char *_charset);
#endif
void
EnableLogTimestamp();
void
LogInitSysLog();
void
LogFinishSysLog();
#endif /* LOG_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,48 +19,38 @@
#include "config.h"
#include "LogInit.hxx"
#include "LogBackend.hxx"
#include "Log.hxx"
#include "ConfigData.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "system/fd_util.h"
#include "config/ConfigData.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
#include "system/FatalError.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/FileSystem.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "util/CharUtil.hxx"
#include "system/FatalError.hxx"
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <errno.h>
#ifdef HAVE_GLIB
#include <glib.h>
#ifdef HAVE_SYSLOG
#include <syslog.h>
#endif
#define LOG_LEVEL_SECURE G_LOG_LEVEL_INFO
#include <assert.h>
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#define LOG_LEVEL_SECURE LogLevel::INFO
#define LOG_DATE_BUF_SIZE 16
#define LOG_DATE_LEN (LOG_DATE_BUF_SIZE - 1)
static constexpr Domain log_domain("log");
static GLogLevelFlags log_threshold = G_LOG_LEVEL_MESSAGE;
#ifndef ANDROID
static const char *log_charset;
static bool stdout_mode = true;
static int out_fd;
static AllocatedPath out_path = AllocatedPath::Null();
@@ -73,66 +63,6 @@ static void redirect_logs(int fd)
FatalSystemError("Failed to dup2 stderr");
}
static const char *log_date(void)
{
static char buf[LOG_DATE_BUF_SIZE];
time_t t = time(nullptr);
strftime(buf, LOG_DATE_BUF_SIZE, "%b %d %H:%M : ", localtime(&t));
return buf;
}
/**
* Determines the length of the string excluding trailing whitespace
* characters.
*/
static int
chomp_length(const char *p)
{
size_t length = strlen(p);
while (length > 0 && IsWhitespaceOrNull(p[length - 1]))
--length;
return (int)length;
}
static void
file_log_func(const gchar *domain,
GLogLevelFlags log_level,
const gchar *message, gcc_unused gpointer user_data)
{
char *converted;
if (log_level > log_threshold)
return;
if (log_charset != nullptr) {
converted = g_convert_with_fallback(message, -1,
log_charset, "utf-8",
nullptr, nullptr,
nullptr, nullptr);
if (converted != nullptr)
message = converted;
} else
converted = nullptr;
if (domain == nullptr)
domain = "";
fprintf(stderr, "%s%s%s%.*s\n",
stdout_mode ? "" : log_date(),
domain, *domain == 0 ? "" : ": ",
chomp_length(message), message);
g_free(converted);
}
static void
log_init_stdout(void)
{
g_log_set_default_handler(file_log_func, nullptr);
}
static int
open_log_file(void)
{
@@ -154,112 +84,66 @@ log_init_file(unsigned line, Error &error)
return false;
}
g_log_set_default_handler(file_log_func, nullptr);
EnableLogTimestamp();
return true;
}
#ifdef HAVE_SYSLOG
static int
glib_to_syslog_level(GLogLevelFlags log_level)
static inline LogLevel
parse_log_level(const char *value, unsigned line)
{
switch (log_level & G_LOG_LEVEL_MASK) {
case G_LOG_LEVEL_ERROR:
case G_LOG_LEVEL_CRITICAL:
return LOG_ERR;
case G_LOG_LEVEL_WARNING:
return LOG_WARNING;
case G_LOG_LEVEL_MESSAGE:
return LOG_NOTICE;
case G_LOG_LEVEL_INFO:
return LOG_INFO;
case G_LOG_LEVEL_DEBUG:
return LOG_DEBUG;
default:
return LOG_NOTICE;
if (0 == strcmp(value, "default"))
return LogLevel::DEFAULT;
if (0 == strcmp(value, "secure"))
return LOG_LEVEL_SECURE;
else if (0 == strcmp(value, "verbose"))
return LogLevel::DEBUG;
else {
FormatFatalError("unknown log level \"%s\" at line %u",
value, line);
}
}
static void
syslog_log_func(const gchar *domain,
GLogLevelFlags log_level, const gchar *message,
gcc_unused gpointer user_data)
{
if (stdout_mode) {
/* fall back to the file log function during
startup */
file_log_func(domain, log_level,
message, user_data);
return;
}
if (log_level > log_threshold)
return;
if (domain == nullptr)
domain = "";
syslog(glib_to_syslog_level(log_level), "%s%s%.*s",
domain, *domain == 0 ? "" : ": ",
chomp_length(message), message);
}
static void
log_init_syslog(void)
{
assert(out_path.IsNull());
openlog(PACKAGE, 0, LOG_DAEMON);
g_log_set_default_handler(syslog_log_func, nullptr);
}
#endif
static inline GLogLevelFlags
parse_log_level(const char *value, unsigned line)
{
if (0 == strcmp(value, "default"))
return G_LOG_LEVEL_MESSAGE;
if (0 == strcmp(value, "secure"))
return LOG_LEVEL_SECURE;
else if (0 == strcmp(value, "verbose"))
return G_LOG_LEVEL_DEBUG;
else {
FormatFatalError("unknown log level \"%s\" at line %u",
value, line);
return G_LOG_LEVEL_MESSAGE;
}
}
void
log_early_init(bool verbose)
{
if (verbose)
log_threshold = G_LOG_LEVEL_DEBUG;
#ifdef ANDROID
(void)verbose;
#else
/* force stderr to be line-buffered */
setvbuf(stderr, nullptr, _IOLBF, 0);
log_init_stdout();
if (verbose)
SetLogThreshold(LogLevel::DEBUG);
#endif
}
bool
log_init(bool verbose, bool use_stdout, Error &error)
{
#ifdef ANDROID
(void)verbose;
(void)use_stdout;
(void)error;
return true;
#else
const struct config_param *param;
g_get_charset(&log_charset);
#ifdef HAVE_GLIB
const char *charset;
g_get_charset(&charset);
SetLogCharset(charset);
#endif
if (verbose)
log_threshold = G_LOG_LEVEL_DEBUG;
SetLogThreshold(LogLevel::DEBUG);
else if ((param = config_get_param(CONF_LOG_LEVEL)) != nullptr)
log_threshold = parse_log_level(param->value.c_str(),
param->line);
SetLogThreshold(parse_log_level(param->value.c_str(),
param->line));
if (use_stdout) {
log_init_stdout();
return true;
} else {
param = config_get_param(CONF_LOG_FILE);
@@ -267,7 +151,7 @@ log_init(bool verbose, bool use_stdout, Error &error)
#ifdef HAVE_SYSLOG
/* no configuration: default to syslog (if
available) */
log_init_syslog();
LogInitSysLog();
return true;
#else
error.Set(log_domain,
@@ -276,7 +160,7 @@ log_init(bool verbose, bool use_stdout, Error &error)
#endif
#ifdef HAVE_SYSLOG
} else if (strcmp(param->value.c_str(), "syslog") == 0) {
log_init_syslog();
LogInitSysLog();
return true;
#endif
} else {
@@ -285,56 +169,70 @@ log_init(bool verbose, bool use_stdout, Error &error)
log_init_file(param->line, error);
}
}
#endif
}
#ifndef ANDROID
static void
close_log_files(void)
{
if (stdout_mode)
return;
#ifdef HAVE_SYSLOG
if (out_path.IsNull())
closelog();
LogFinishSysLog();
#endif
}
#endif
void
log_deinit(void)
{
#ifndef ANDROID
close_log_files();
out_path = AllocatedPath::Null();
#endif
}
void setup_log_output(bool use_stdout)
{
#ifdef ANDROID
(void)use_stdout;
#else
if (use_stdout)
return;
fflush(nullptr);
if (!use_stdout) {
#ifndef WIN32
if (out_path.IsNull())
out_fd = open("/dev/null", O_WRONLY);
if (out_fd < 0) {
#ifdef WIN32
return;
#else
out_fd = open("/dev/null", O_WRONLY);
if (out_fd < 0)
return;
#endif
if (out_fd >= 0) {
redirect_logs(out_fd);
close(out_fd);
}
stdout_mode = false;
log_charset = nullptr;
}
redirect_logs(out_fd);
close(out_fd);
out_fd = -1;
#ifdef HAVE_GLIB
SetLogCharset(nullptr);
#endif
#endif
}
int cycle_log_files(void)
{
#ifdef ANDROID
return 0;
#else
int fd;
if (stdout_mode || out_path.IsNull())
if (out_path.IsNull())
return 0;
assert(!out_path.IsNull());
FormatDebug(log_domain, "Cycling log files");
close_log_files();
@@ -348,6 +246,9 @@ int cycle_log_files(void)
}
redirect_logs(fd);
close(fd);
FormatDebug(log_domain, "Done cycling log files");
return 0;
#endif
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

59
src/LogLevel.hxx Normal file
View File

@@ -0,0 +1,59 @@
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_LOG_LEVEL_HXX
#define MPD_LOG_LEVEL_HXX
#ifdef WIN32
#include <windows.h>
/* damn you, windows.h! */
#ifdef ERROR
#undef ERROR
#endif
#endif
enum class LogLevel {
/**
* Debug message for developers.
*/
DEBUG,
/**
* Unimportant informational message.
*/
INFO,
/**
* Interesting informational message.
*/
DEFAULT,
/**
* Warning: something may be wrong.
*/
WARNING,
/**
* An error has occurred, an operation could not finish
* successfully.
*/
ERROR,
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@
#ifndef MPD_LOGV_HXX
#define MPD_LOGV_HXX
#include "Log.hxx"
#include "Log.hxx" // IWYU pragma: export
#include <stdarg.h>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,67 +23,86 @@
#include "CommandLine.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistGlobal.hxx"
#include "UpdateGlue.hxx"
#include "MusicChunk.hxx"
#include "StateFile.hxx"
#include "PlayerThread.hxx"
#include "Mapper.hxx"
#include "DatabaseGlue.hxx"
#include "DatabaseSimple.hxx"
#include "Permission.hxx"
#include "Listen.hxx"
#include "Client.hxx"
#include "ClientList.hxx"
#include "client/Client.hxx"
#include "client/ClientList.hxx"
#include "command/AllCommands.hxx"
#include "Partition.hxx"
#include "Volume.hxx"
#include "OutputAll.hxx"
#include "tag/TagConfig.hxx"
#include "ReplayGainConfig.hxx"
#include "Idle.hxx"
#include "SignalHandlers.hxx"
#include "Log.hxx"
#include "LogInit.hxx"
#include "GlobalEvents.hxx"
#include "InputInit.hxx"
#include "input/Init.hxx"
#include "event/Loop.hxx"
#include "IOThread.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Config.hxx"
#include "PlaylistRegistry.hxx"
#include "ZeroconfGlue.hxx"
#include "DecoderList.hxx"
#include "playlist/PlaylistRegistry.hxx"
#include "zeroconf/ZeroconfGlue.hxx"
#include "decoder/DecoderList.hxx"
#include "AudioConfig.hxx"
#include "pcm/PcmResample.hxx"
#include "Daemon.hxx"
#include "pcm/PcmConvert.hxx"
#include "unix/SignalHandlers.hxx"
#include "unix/Daemon.hxx"
#include "system/FatalError.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/Domain.hxx"
#include "thread/Id.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigData.hxx"
#include "ConfigDefaults.hxx"
#include "ConfigOption.hxx"
#include "thread/Slack.hxx"
#include "lib/icu/Init.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigData.hxx"
#include "config/ConfigDefaults.hxx"
#include "config/ConfigOption.hxx"
#include "config/ConfigError.hxx"
#include "Stats.hxx"
#ifdef ENABLE_DATABASE
#include "db/update/Service.hxx"
#include "db/Configured.hxx"
#include "db/DatabasePlugin.hxx"
#include "db/plugins/simple/SimpleDatabasePlugin.hxx"
#include "storage/Configured.hxx"
#include "storage/CompositeStorage.hxx"
#ifdef ENABLE_INOTIFY
#include "InotifyUpdate.hxx"
#include "db/update/InotifyUpdate.hxx"
#endif
#endif
#ifdef ENABLE_NEIGHBOR_PLUGINS
#include "neighbor/Glue.hxx"
#endif
#ifdef ENABLE_SQLITE
#include "StickerDatabase.hxx"
#include "sticker/StickerDatabase.hxx"
#endif
#ifdef ENABLE_ARCHIVE
#include "ArchiveList.hxx"
#include "archive/ArchiveList.hxx"
#endif
#include <glib.h>
#ifdef ANDROID
#include "java/Global.hxx"
#include "java/File.hxx"
#include "android/Environment.hxx"
#include "android/Context.hxx"
#include "fs/StandardDirectory.hxx"
#include "fs/FileSystem.hxx"
#include "org_musicpd_Bridge.h"
#endif
#ifdef HAVE_GLIB
#include <glib.h>
#endif
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_LOCALE_H
#include <locale.h>
@@ -94,18 +113,25 @@
#include <ws2tcpip.h>
#endif
#ifdef __BLOCKS__
#include <dispatch/dispatch.h>
#endif
#include <limits.h>
static constexpr unsigned DEFAULT_BUFFER_SIZE = 4096;
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
static constexpr Domain main_domain("main");
ThreadId main_thread;
EventLoop *main_loop;
#ifdef ANDROID
Context *context;
#endif
Instance *instance;
static StateFile *state_file;
#ifndef ANDROID
static bool
glue_daemonize_init(const struct options *options, Error &error)
{
@@ -123,28 +149,33 @@ glue_daemonize_init(const struct options *options, Error &error)
return true;
}
#endif
static bool
glue_mapper_init(Error &error)
{
auto music_dir = config_get_path(CONF_MUSIC_DIR, error);
if (music_dir.IsNull() && error.IsDefined())
return false;
auto playlist_dir = config_get_path(CONF_PLAYLIST_DIR, error);
if (playlist_dir.IsNull() && error.IsDefined())
return false;
if (music_dir.IsNull()) {
const char *path =
g_get_user_special_dir(G_USER_DIRECTORY_MUSIC);
if (path != nullptr) {
music_dir = AllocatedPath::FromUTF8(path, error);
if (music_dir.IsNull())
return false;
}
}
mapper_init(std::move(playlist_dir));
return true;
}
mapper_init(std::move(music_dir), std::move(playlist_dir));
#ifdef ENABLE_DATABASE
static bool
InitStorage(Error &error)
{
Storage *storage = CreateConfiguredStorage(io_thread_get(), error);
if (storage == nullptr)
return !error.IsDefined();
assert(!error.IsDefined());
CompositeStorage *composite = new CompositeStorage();
instance->storage = composite;
composite->Mount("", storage);
return true;
}
@@ -156,50 +187,60 @@ glue_mapper_init(Error &error)
static bool
glue_db_init_and_load(void)
{
const struct config_param *param = config_get_param(CONF_DATABASE);
const struct config_param *path = config_get_param(CONF_DB_FILE);
Error error;
instance->database =
CreateConfiguredDatabase(*instance->event_loop, *instance,
error);
if (instance->database == nullptr) {
if (error.IsDefined())
FatalError(error);
else
return true;
}
if (param != nullptr && path != nullptr)
LogWarning(main_domain,
"Found both 'database' and 'db_file' setting - ignoring the latter");
if (instance->database->GetPlugin().flags & DatabasePlugin::FLAG_REQUIRE_STORAGE) {
if (!InitStorage(error))
FatalError(error);
if (!mapper_has_music_directory()) {
if (param != nullptr)
LogDefault(main_domain,
if (instance->storage == nullptr) {
delete instance->database;
instance->database = nullptr;
LogDefault(config_domain,
"Found database setting without "
"music_directory - disabling database");
if (path != nullptr)
LogDefault(main_domain,
"Found db_file setting without "
"music_directory - disabling database");
return true;
return true;
}
} else {
if (IsStorageConfigured())
LogDefault(config_domain,
"Ignoring the storage configuration "
"because the database does not need it");
}
struct config_param *allocated = nullptr;
if (!instance->database->Open(error))
FatalError(error);
if (param == nullptr && path != nullptr) {
allocated = new config_param("database", path->line);
allocated->AddBlockParam("path", path->value.c_str(),
path->line);
param = allocated;
}
if (param == nullptr)
if (!instance->database->IsPlugin(simple_db_plugin))
return true;
Error error;
if (!DatabaseGlobalInit(*param, error))
FatalError(error);
delete allocated;
if (!DatabaseGlobalOpen(error))
FatalError(error);
SimpleDatabase &db = *(SimpleDatabase *)instance->database;
instance->update = new UpdateService(*instance->event_loop, db,
static_cast<CompositeStorage &>(*instance->storage),
*instance);
/* run database update after daemonization? */
return !db_is_simple() || db_exists();
return db.FileExists();
}
static bool
InitDatabaseAndStorage()
{
const bool create_db = !glue_db_init_and_load();
return create_db;
}
#endif
/**
* Configure and initialize the sticker subsystem.
*/
@@ -224,11 +265,27 @@ static bool
glue_state_file_init(Error &error)
{
auto path_fs = config_get_path(CONF_STATE_FILE, error);
if (path_fs.IsNull())
return !error.IsDefined();
if (path_fs.IsNull()) {
if (error.IsDefined())
return false;
state_file = new StateFile(std::move(path_fs),
*instance->partition, *main_loop);
#ifdef ANDROID
const auto cache_dir = GetUserCacheDir();
if (cache_dir.IsNull())
return true;
path_fs = AllocatedPath::Build(cache_dir, "state");
#else
return true;
#endif
}
unsigned interval = config_get_unsigned(CONF_STATE_FILE_INTERVAL,
StateFile::DEFAULT_INTERVAL);
state_file = new StateFile(std::move(path_fs), interval,
*instance->partition,
*instance->event_loop);
state_file->Read();
return true;
}
@@ -240,9 +297,8 @@ static void winsock_init(void)
{
#ifdef WIN32
WSADATA sockinfo;
int retval;
retval = WSAStartup(MAKEWORD(2, 2), &sockinfo);
int retval = WSAStartup(MAKEWORD(2, 2), &sockinfo);
if(retval != 0)
FormatFatalError("Attempt to open Winsock2 failed; error code %d",
retval);
@@ -260,14 +316,11 @@ static void
initialize_decoder_and_player(void)
{
const struct config_param *param;
char *test;
size_t buffer_size;
float perc;
unsigned buffered_chunks;
unsigned buffered_before_play;
size_t buffer_size;
param = config_get_param(CONF_AUDIO_BUFFER_SIZE);
if (param != nullptr) {
char *test;
long tmp = strtol(param->value.c_str(), &test, 10);
if (*test != '\0' || tmp <= 0 || tmp == LONG_MAX)
FormatFatalError("buffer size \"%s\" is not a "
@@ -279,14 +332,16 @@ initialize_decoder_and_player(void)
buffer_size *= 1024;
buffered_chunks = buffer_size / CHUNK_SIZE;
const unsigned buffered_chunks = buffer_size / CHUNK_SIZE;
if (buffered_chunks >= 1 << 15)
FormatFatalError("buffer size \"%lu\" is too big",
(unsigned long)buffer_size);
float perc;
param = config_get_param(CONF_BUFFER_BEFORE_PLAY);
if (param != nullptr) {
char *test;
perc = strtod(param->value.c_str(), &test);
if (*test != '%' || perc < 0 || perc > 100) {
FormatFatalError("buffered before play \"%s\" is not "
@@ -297,7 +352,7 @@ initialize_decoder_and_player(void)
} else
perc = DEFAULT_BUFFER_BEFORE_PLAY;
buffered_before_play = (perc / 100) * buffered_chunks;
unsigned buffered_before_play = (perc / 100) * buffered_chunks;
if (buffered_before_play > buffered_chunks)
buffered_before_play = buffered_chunks;
@@ -336,11 +391,13 @@ idle_event_emitted(void)
static void
shutdown_event_emitted(void)
{
main_loop->Break();
instance->event_loop->Break();
}
#endif
#ifndef ANDROID
int main(int argc, char *argv[])
{
#ifdef WIN32
@@ -350,14 +407,19 @@ int main(int argc, char *argv[])
#endif
}
#endif
static int mpd_main_after_fork(struct options);
#ifdef ANDROID
static inline
#endif
int mpd_main(int argc, char *argv[])
{
struct options options;
clock_t start;
bool create_db;
Error error;
bool success;
#ifndef ANDROID
daemonize_close_stdin();
#ifdef HAVE_LOCALE_H
@@ -365,19 +427,43 @@ int mpd_main(int argc, char *argv[])
setlocale(LC_CTYPE,"");
#endif
#ifdef HAVE_GLIB
g_set_application_name("Music Player Daemon");
#if !GLIB_CHECK_VERSION(2,32,0)
/* enable GLib's thread safety code */
g_thread_init(nullptr);
#endif
#endif
#endif
io_thread_init();
if (!IcuInit(error)) {
LogError(error);
return EXIT_FAILURE;
}
winsock_init();
io_thread_init();
config_global_init();
success = parse_cmdline(argc, argv, &options, error);
if (!success) {
#ifdef ANDROID
(void)argc;
(void)argv;
{
const auto sdcard = Environment::getExternalStorageDirectory();
if (!sdcard.IsNull()) {
const auto config_path =
AllocatedPath::Build(sdcard, "mpd.conf");
if (FileExists(config_path) &&
!ReadConfigFile(config_path, error)) {
LogError(error);
return EXIT_FAILURE;
}
}
}
#else
if (!parse_cmdline(argc, argv, &options, error)) {
LogError(error);
return EXIT_FAILURE;
}
@@ -386,6 +472,7 @@ int mpd_main(int argc, char *argv[])
LogError(error);
return EXIT_FAILURE;
}
#endif
stats_global_init();
TagLoadConfig();
@@ -395,23 +482,60 @@ int mpd_main(int argc, char *argv[])
return EXIT_FAILURE;
}
main_thread = ThreadId::GetCurrent();
main_loop = new EventLoop(EventLoop::Default());
instance = new Instance();
instance->event_loop = new EventLoop();
const unsigned max_clients = config_get_positive(CONF_MAX_CONN, 10);
instance->client_list = new ClientList(max_clients);
success = listen_global_init(error);
if (!success) {
#ifdef ENABLE_NEIGHBOR_PLUGINS
instance->neighbors = new NeighborGlue();
if (!instance->neighbors->Init(io_thread_get(), *instance, error)) {
LogError(error);
return EXIT_FAILURE;
}
daemonize_set_user();
if (instance->neighbors->IsEmpty()) {
delete instance->neighbors;
instance->neighbors = nullptr;
}
#endif
GlobalEvents::Initialize(*main_loop);
const unsigned max_clients = config_get_positive(CONF_MAX_CONN, 10);
instance->client_list = new ClientList(max_clients);
initialize_decoder_and_player();
if (!listen_global_init(*instance->event_loop, *instance->partition,
error)) {
LogError(error);
return EXIT_FAILURE;
}
#ifndef ANDROID
daemonize_set_user();
daemonize_begin(options.daemon);
#endif
#ifdef __BLOCKS__
/* Runs the OS X native event loop in the main thread, and runs
the rest of mpd_main on a new thread. This lets CoreAudio receive
route change notifications (e.g. plugging or unplugging headphones).
All hardware output on OS X ultimately uses CoreAudio internally.
This must be run after forking; if dispatch is called before forking,
the child process will have a broken internal dispatch state. */
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
exit(mpd_main_after_fork(options));
});
dispatch_main();
return EXIT_FAILURE; // unreachable, because dispatch_main never returns
#else
return mpd_main_after_fork(options);
#endif
}
static int mpd_main_after_fork(struct options options)
{
Error error;
GlobalEvents::Initialize(*instance->event_loop);
GlobalEvents::Register(GlobalEvents::IDLE, idle_event_emitted);
#ifdef WIN32
GlobalEvents::Register(GlobalEvents::SHUTDOWN, shutdown_event_emitted);
@@ -431,23 +555,23 @@ int mpd_main(int argc, char *argv[])
archive_plugin_init_all();
#endif
if (!pcm_resample_global_init(error)) {
if (!pcm_convert_global_init(error)) {
LogError(error);
return EXIT_FAILURE;
}
decoder_plugin_init_all();
update_global_init();
create_db = !glue_db_init_and_load();
#ifdef ENABLE_DATABASE
const bool create_db = InitDatabaseAndStorage();
#endif
glue_sticker_init();
command_init();
initialize_decoder_and_player();
volume_init();
initAudioConfig();
audio_output_all_init(instance->partition->pc);
instance->partition->outputs.Configure(*instance->event_loop,
instance->partition->pc);
client_manager_init();
replay_gain_global_init();
@@ -458,43 +582,59 @@ int mpd_main(int argc, char *argv[])
playlist_list_global_init();
daemonize(options.daemon);
#ifndef ANDROID
daemonize_commit();
setup_log_output(options.log_stderr);
SignalHandlersInit(*main_loop);
SignalHandlersInit(*instance->event_loop);
#endif
io_thread_start();
ZeroconfInit(*main_loop);
#ifdef ENABLE_NEIGHBOR_PLUGINS
if (instance->neighbors != nullptr &&
!instance->neighbors->Open(error))
FatalError(error);
#endif
player_create(instance->partition->pc);
ZeroconfInit(*instance->event_loop);
StartPlayerThread(instance->partition->pc);
#ifdef ENABLE_DATABASE
if (create_db) {
/* the database failed to load: recreate the
database */
unsigned job = update_enqueue("", true);
unsigned job = instance->update->Enqueue("", true);
if (job == 0)
FatalError("directory update failed");
}
#endif
if (!glue_state_file_init(error)) {
g_printerr("%s\n", error.GetMessage());
LogError(error);
return EXIT_FAILURE;
}
audio_output_all_set_replay_gain_mode(replay_gain_get_real_mode(instance->partition->playlist.queue.random));
instance->partition->outputs.SetReplayGainMode(replay_gain_get_real_mode(instance->partition->playlist.queue.random));
success = config_get_bool(CONF_AUTO_UPDATE, false);
#ifdef ENABLE_DATABASE
if (config_get_bool(CONF_AUTO_UPDATE, false)) {
#ifdef ENABLE_INOTIFY
if (success && mapper_has_music_directory())
mpd_inotify_init(config_get_unsigned(CONF_AUTO_UPDATE_DEPTH,
G_MAXUINT));
if (instance->storage != nullptr &&
instance->update != nullptr)
mpd_inotify_init(*instance->event_loop,
*instance->storage,
*instance->update,
config_get_unsigned(CONF_AUTO_UPDATE_DEPTH,
INT_MAX));
#else
if (success)
FormatWarning(main_domain,
FormatWarning(config_domain,
"inotify: auto_update was disabled. enable during compilation phase");
#endif
}
#endif
config_global_check();
@@ -506,8 +646,12 @@ int mpd_main(int argc, char *argv[])
win32_app_started();
#endif
/* the MPD frontend does not care about timer slack; set it to
a huge value to allow the kernel to reduce CPU wakeups */
SetThreadTimerSlackMS(100);
/* run the main loop */
main_loop->Run();
instance->event_loop->Run();
#ifdef WIN32
win32_app_stopping();
@@ -515,8 +659,11 @@ int mpd_main(int argc, char *argv[])
/* cleanup */
#ifdef ENABLE_INOTIFY
#if defined(ENABLE_DATABASE) && defined(ENABLE_INOTIFY)
mpd_inotify_finish();
if (instance->update != nullptr)
instance->update->CancelAllAsync();
#endif
if (state_file != nullptr) {
@@ -529,11 +676,23 @@ int mpd_main(int argc, char *argv[])
listen_global_finish();
delete instance->client_list;
start = clock();
DatabaseGlobalDeinit();
FormatDebug(main_domain,
"db_finish took %f seconds",
((float)(clock()-start))/CLOCKS_PER_SEC);
#ifdef ENABLE_NEIGHBOR_PLUGINS
if (instance->neighbors != nullptr) {
instance->neighbors->Close();
delete instance->neighbors;
}
#endif
#ifdef ENABLE_DATABASE
delete instance->update;
if (instance->database != nullptr) {
instance->database->Close();
delete instance->database;
}
delete instance->storage;
#endif
#ifdef ENABLE_SQLITE
sticker_global_finish();
@@ -543,27 +702,62 @@ int mpd_main(int argc, char *argv[])
playlist_list_global_finish();
input_stream_global_finish();
audio_output_all_finish();
volume_finish();
#ifdef ENABLE_DATABASE
mapper_finish();
#endif
delete instance->partition;
command_finish();
update_global_finish();
decoder_plugin_deinit_all();
#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all();
#endif
config_global_finish();
stats_global_finish();
io_thread_deinit();
#ifndef ANDROID
SignalHandlersFinish();
#endif
delete instance->event_loop;
delete instance;
delete main_loop;
instance = nullptr;
#ifndef ANDROID
daemonize_finish();
#endif
#ifdef WIN32
WSACleanup();
#endif
IcuFinish();
log_deinit();
return EXIT_SUCCESS;
}
#ifdef ANDROID
gcc_visibility_default
JNIEXPORT void JNICALL
Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context)
{
Java::Init(env);
Java::File::Initialise(env);
Environment::Initialise(env);
context = new Context(env, _context);
mpd_main(0, nullptr);
delete context;
Environment::Deinitialise(env);
}
gcc_visibility_default
JNIEXPORT void JNICALL
Java_org_musicpd_Bridge_shutdown(JNIEnv *, jclass)
{
if (instance != nullptr)
instance->event_loop->Break();
}
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,16 +20,18 @@
#ifndef MPD_MAIN_HXX
#define MPD_MAIN_HXX
class ThreadId;
class EventLoop;
class Context;
struct Instance;
extern ThreadId main_thread;
extern EventLoop *main_loop;
#ifdef ANDROID
extern Context *context;
#endif
extern Instance *instance;
#ifndef ANDROID
/**
* A entry point for application.
* On non-Windows platforms this is called directly from main()
@@ -38,6 +40,8 @@ extern Instance *instance;
*/
int mpd_main(int argc, char *argv[]);
#endif
#ifdef WIN32
/**

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,36 +23,18 @@
#include "config.h"
#include "Mapper.hxx"
#include "Directory.hxx"
#include "Song.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/Charset.hxx"
#include "fs/FileSystem.hxx"
#include "fs/DirectoryReader.hxx"
#include "util/Domain.hxx"
#include "Log.hxx"
#include "fs/CheckFile.hxx"
#ifdef ENABLE_DATABASE
#include "storage/StorageInterface.hxx"
#include "Instance.hxx"
#include "Main.hxx"
#endif
#include <assert.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h>
static constexpr Domain mapper_domain("mapper");
/**
* The absolute path of the music directory encoded in UTF-8.
*/
static std::string music_dir_utf8;
static size_t music_dir_utf8_length;
/**
* The absolute path of the music directory encoded in the filesystem
* character set.
*/
static AllocatedPath music_dir_fs = AllocatedPath::Null();
/**
* The absolute path of the playlist directory encoded in the
@@ -60,51 +42,6 @@ static AllocatedPath music_dir_fs = AllocatedPath::Null();
*/
static AllocatedPath playlist_dir_fs = AllocatedPath::Null();
static void
check_directory(const char *path_utf8, const AllocatedPath &path_fs)
{
struct stat st;
if (!StatFile(path_fs, st)) {
FormatErrno(mapper_domain,
"Failed to stat directory \"%s\"",
path_utf8);
return;
}
if (!S_ISDIR(st.st_mode)) {
FormatError(mapper_domain,
"Not a directory: %s", path_utf8);
return;
}
#ifndef WIN32
const auto x = AllocatedPath::Build(path_fs, ".");
if (!StatFile(x, st) && errno == EACCES)
FormatError(mapper_domain,
"No permission to traverse (\"execute\") directory: %s",
path_utf8);
#endif
const DirectoryReader reader(path_fs);
if (reader.HasFailed() && errno == EACCES)
FormatError(mapper_domain,
"No permission to read directory: %s", path_utf8);
}
static void
mapper_set_music_dir(AllocatedPath &&path)
{
assert(!path.IsNull());
music_dir_fs = std::move(path);
music_dir_fs.ChopSeparators();
music_dir_utf8 = music_dir_fs.ToUTF8();
music_dir_utf8_length = music_dir_utf8.length();
check_directory(music_dir_utf8.c_str(), music_dir_fs);
}
static void
mapper_set_playlist_dir(AllocatedPath &&path)
{
@@ -112,16 +49,12 @@ mapper_set_playlist_dir(AllocatedPath &&path)
playlist_dir_fs = std::move(path);
const auto utf8 = playlist_dir_fs.ToUTF8();
check_directory(utf8.c_str(), playlist_dir_fs);
CheckDirectoryReadable(playlist_dir_fs);
}
void
mapper_init(AllocatedPath &&_music_dir, AllocatedPath &&_playlist_dir)
mapper_init(AllocatedPath &&_playlist_dir)
{
if (!_music_dir.IsNull())
mapper_set_music_dir(std::move(_music_dir));
if (!_playlist_dir.IsNull())
mapper_set_playlist_dir(std::move(_playlist_dir));
}
@@ -130,28 +63,7 @@ void mapper_finish(void)
{
}
const char *
mapper_get_music_directory_utf8(void)
{
return music_dir_utf8.c_str();
}
const AllocatedPath &
mapper_get_music_directory_fs(void)
{
return music_dir_fs;
}
const char *
map_to_relative_path(const char *path_utf8)
{
return !music_dir_utf8.empty() &&
memcmp(path_utf8, music_dir_utf8.c_str(),
music_dir_utf8_length) == 0 &&
PathTraits::IsSeparatorUTF8(path_utf8[music_dir_utf8_length])
? path_utf8 + music_dir_utf8_length + 1
: path_utf8;
}
#ifdef ENABLE_DATABASE
AllocatedPath
map_uri_fs(const char *uri)
@@ -159,6 +71,10 @@ map_uri_fs(const char *uri)
assert(uri != nullptr);
assert(*uri != '/');
if (instance->storage == nullptr)
return AllocatedPath::Null();
const auto music_dir_fs = instance->storage->MapFS("");
if (music_dir_fs.IsNull())
return AllocatedPath::Null();
@@ -169,70 +85,17 @@ map_uri_fs(const char *uri)
return AllocatedPath::Build(music_dir_fs, uri_fs);
}
AllocatedPath
map_directory_fs(const Directory &directory)
{
assert(!music_dir_fs.IsNull());
if (directory.IsRoot())
return music_dir_fs;
return map_uri_fs(directory.GetPath());
}
AllocatedPath
map_directory_child_fs(const Directory &directory, const char *name)
{
assert(!music_dir_fs.IsNull());
/* check for invalid or unauthorized base names */
if (*name == 0 || strchr(name, '/') != nullptr ||
strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
return AllocatedPath::Null();
const auto parent_fs = map_directory_fs(directory);
if (parent_fs.IsNull())
return AllocatedPath::Null();
const auto name_fs = AllocatedPath::FromUTF8(name);
if (name_fs.IsNull())
return AllocatedPath::Null();
return AllocatedPath::Build(parent_fs, name_fs);
}
/**
* Map a song object that was created by song_dup_detached(). It does
* not have a real parent directory, only the dummy object
* #detached_root.
*/
static AllocatedPath
map_detached_song_fs(const char *uri_utf8)
{
auto uri_fs = AllocatedPath::FromUTF8(uri_utf8);
if (uri_fs.IsNull())
return uri_fs;
return AllocatedPath::Build(music_dir_fs, uri_fs);
}
AllocatedPath
map_song_fs(const Song &song)
{
assert(song.IsFile());
if (song.IsInDatabase())
return song.IsDetached()
? map_detached_song_fs(song.uri)
: map_directory_child_fs(*song.parent, song.uri);
else
return AllocatedPath::FromUTF8(song.uri);
}
std::string
map_fs_to_utf8(const char *path_fs)
{
if (PathTraits::IsSeparatorFS(path_fs[0])) {
if (PathTraitsFS::IsSeparator(path_fs[0])) {
if (instance->storage == nullptr)
return std::string();
const auto music_dir_fs = instance->storage->MapFS("");
if (music_dir_fs.IsNull())
return std::string();
path_fs = music_dir_fs.RelativeFS(path_fs);
if (path_fs == nullptr || *path_fs == 0)
return std::string();
@@ -241,6 +104,8 @@ map_fs_to_utf8(const char *path_fs)
return PathToUTF8(path_fs);
}
#endif
const AllocatedPath &
map_spl_path(void)
{

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,49 +30,14 @@
#define PLAYLIST_FILE_SUFFIX ".m3u"
class Path;
class AllocatedPath;
struct Directory;
struct Song;
void
mapper_init(AllocatedPath &&music_dir, AllocatedPath &&playlist_dir);
mapper_init(AllocatedPath &&playlist_dir);
void mapper_finish(void);
/**
* Return the absolute path of the music directory encoded in UTF-8.
*/
gcc_const
const char *
mapper_get_music_directory_utf8(void);
/**
* Return the absolute path of the music directory encoded in the
* filesystem character set.
*/
gcc_const
const AllocatedPath &
mapper_get_music_directory_fs(void);
/**
* Returns true if a music directory was configured.
*/
gcc_const
static inline bool
mapper_has_music_directory(void)
{
return mapper_get_music_directory_utf8() != nullptr;
}
/**
* If the specified absolute path points inside the music directory,
* this function converts it to a relative path. If not, it returns
* the unmodified string pointer.
*/
gcc_pure
const char *
map_to_relative_path(const char *path_utf8);
#ifdef ENABLE_DATABASE
/**
* Determines the absolute file system path of a relative URI. This
@@ -83,39 +48,6 @@ gcc_pure
AllocatedPath
map_uri_fs(const char *uri);
/**
* Determines the file system path of a directory object.
*
* @param directory the directory object
* @return the path in file system encoding, or nullptr if mapping failed
*/
gcc_pure
AllocatedPath
map_directory_fs(const Directory &directory);
/**
* Determines the file system path of a directory's child (may be a
* sub directory or a song).
*
* @param directory the parent directory object
* @param name the child's name in UTF-8
* @return the path in file system encoding, or nullptr if mapping failed
*/
gcc_pure
AllocatedPath
map_directory_child_fs(const Directory &directory, const char *name);
/**
* Determines the file system path of a song. This must not be a
* remote song.
*
* @param song the song object
* @return the path in file system encoding, or nullptr if mapping failed
*/
gcc_pure
AllocatedPath
map_song_fs(const Song &song);
/**
* Maps a file system path (relative to the music directory or
* absolute) to a relative path in UTF-8 encoding.
@@ -128,6 +60,8 @@ gcc_pure
std::string
map_fs_to_utf8(const char *path_fs);
#endif
/**
* Returns the playlist directory.
*/
@@ -137,8 +71,7 @@ map_spl_path(void);
/**
* Maps a playlist name (without the ".m3u" suffix) to a file system
* path. The return value is allocated on the heap and must be freed
* with g_free().
* path.
*
* @return the path in file system encoding, or nullptr if mapping failed
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify

View File

@@ -1,64 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/** \file
*
* Functions which affect the mixers of all audio outputs.
*/
#ifndef MPD_MIXER_ALL_HXX
#define MPD_MIXER_ALL_HXX
#include "Compiler.h"
/**
* Returns the average volume of all available mixers (range 0..100).
* Returns -1 if no mixer can be queried.
*/
gcc_pure
int
mixer_all_get_volume(void);
/**
* Sets the volume on all available mixers.
*
* @param volume the volume (range 0..100)
* @return true on success, false on failure
*/
bool
mixer_all_set_volume(unsigned volume);
/**
* Similar to mixer_all_get_volume(), but gets the volume only for
* software mixers. See #software_mixer_plugin. This function fails
* if no software mixer is configured.
*/
gcc_pure
int
mixer_all_get_software_volume(void);
/**
* Similar to mixer_all_set_volume(), but sets the volume only for
* software mixers. See #software_mixer_plugin. This function cannot
* fail, because the underlying software mixers cannot fail either.
*/
void
mixer_all_set_software_volume(unsigned volume);
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,7 @@ MusicBuffer::MusicBuffer(unsigned num_chunks)
FatalError("Failed to allocate buffer");
}
music_chunk *
MusicChunk *
MusicBuffer::Allocate()
{
const ScopeLock protect(mutex);
@@ -38,7 +38,7 @@ MusicBuffer::Allocate()
}
void
MusicBuffer::Return(music_chunk *chunk)
MusicBuffer::Return(MusicChunk *chunk)
{
assert(chunk != nullptr);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -23,22 +23,22 @@
#include "util/SliceBuffer.hxx"
#include "thread/Mutex.hxx"
struct music_chunk;
struct MusicChunk;
/**
* An allocator for #music_chunk objects.
* An allocator for #MusicChunk objects.
*/
class MusicBuffer {
/** a mutex which protects #buffer */
Mutex mutex;
SliceBuffer<music_chunk> buffer;
SliceBuffer<MusicChunk> buffer;
public:
/**
* Creates a new #MusicBuffer object.
*
* @param num_chunks the number of #music_chunk reserved in
* @param num_chunks the number of #MusicChunk reserved in
* this buffer
*/
MusicBuffer(unsigned num_chunks);
@@ -71,13 +71,13 @@ public:
* @return an empty chunk or nullptr if there are no chunks
* available
*/
music_chunk *Allocate();
MusicChunk *Allocate();
/**
* Returns a chunk to the buffer. It can be reused by
* Allocate() then.
*/
void Return(music_chunk *chunk);
void Return(MusicChunk *chunk);
};
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -24,14 +24,14 @@
#include <assert.h>
music_chunk::~music_chunk()
MusicChunk::~MusicChunk()
{
delete tag;
}
#ifndef NDEBUG
bool
music_chunk::CheckFormat(const AudioFormat other_format) const
MusicChunk::CheckFormat(const AudioFormat other_format) const
{
assert(other_format.IsValid());
@@ -40,34 +40,31 @@ music_chunk::CheckFormat(const AudioFormat other_format) const
#endif
WritableBuffer<void>
music_chunk::Write(const AudioFormat af,
float data_time, uint16_t _bit_rate)
MusicChunk::Write(const AudioFormat af,
SongTime data_time, uint16_t _bit_rate)
{
assert(CheckFormat(af));
assert(length == 0 || audio_format.IsValid());
if (length == 0) {
/* if the chunk is empty, nobody has set bitRate and
times yet */
time yet */
bit_rate = _bit_rate;
times = data_time;
time = data_time;
#ifndef NDEBUG
audio_format = af;
#endif
}
const size_t frame_size = af.GetFrameSize();
size_t num_frames = (sizeof(data) - length) / frame_size;
if (num_frames == 0)
return WritableBuffer<void>::Null();
#ifndef NDEBUG
audio_format = af;
#endif
return { data + length, num_frames * frame_size };
}
bool
music_chunk::Expand(const AudioFormat af, size_t _length)
MusicChunk::Expand(const AudioFormat af, size_t _length)
{
const size_t frame_size = af.GetFrameSize();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
#ifndef MPD_MUSIC_CHUNK_HXX
#define MPD_MUSIC_CHUNK_HXX
#include "Chrono.hxx"
#include "ReplayGainInfo.hxx"
#include "util/WritableBuffer.hxx"
@@ -39,15 +40,15 @@ struct Tag;
* A chunk of music data. Its format is defined by the
* MusicPipe::Push() caller.
*/
struct music_chunk {
struct MusicChunk {
/** the next chunk in a linked list */
struct music_chunk *next;
MusicChunk *next;
/**
* An optional chunk which should be mixed into this chunk.
* This is used for cross-fading.
*/
struct music_chunk *other;
MusicChunk *other;
/**
* The current mix ratio for cross-fading: 1.0 means play 100%
@@ -62,7 +63,7 @@ struct music_chunk {
uint16_t bit_rate;
/** the time stamp within the song */
float times;
SignedSongTime time;
/**
* An optional tag associated with this chunk (and the
@@ -92,13 +93,13 @@ struct music_chunk {
AudioFormat audio_format;
#endif
music_chunk()
MusicChunk()
:other(nullptr),
length(0),
tag(nullptr),
replay_gain_serial(0) {}
~music_chunk();
~MusicChunk();
bool IsEmpty() const {
return length == 0 && tag == nullptr;
@@ -116,9 +117,9 @@ struct music_chunk {
/**
* Prepares appending to the music chunk. Returns a buffer
* where you may write into. After you are finished, call
* music_chunk_expand().
* Expand().
*
* @param chunk the music_chunk object
* @param chunk the MusicChunk object
* @param audio_format the audio format for the appended data;
* must stay the same for the life cycle of this chunk
* @param data_time the time within the song
@@ -128,13 +129,14 @@ struct music_chunk {
* @return a writable buffer, or nullptr if the chunk is full
*/
WritableBuffer<void> Write(AudioFormat af,
float data_time, uint16_t bit_rate);
SongTime data_time,
uint16_t bit_rate);
/**
* Increases the length of the chunk after the caller has written to
* the buffer returned by music_chunk_write().
* the buffer returned by Write().
*
* @param chunk the music_chunk object
* @param chunk the MusicChunk object
* @param audio_format the audio format for the appended data; must
* stay the same for the life cycle of this chunk
* @param length the number of bytes which were appended

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -25,11 +25,11 @@
#ifndef NDEBUG
bool
MusicPipe::Contains(const music_chunk *chunk) const
MusicPipe::Contains(const MusicChunk *chunk) const
{
const ScopeLock protect(mutex);
for (const struct music_chunk *i = head; i != nullptr; i = i->next)
for (const MusicChunk *i = head; i != nullptr; i = i->next)
if (i == chunk)
return true;
@@ -38,12 +38,12 @@ MusicPipe::Contains(const music_chunk *chunk) const
#endif
music_chunk *
MusicChunk *
MusicPipe::Shift()
{
const ScopeLock protect(mutex);
music_chunk *chunk = head;
MusicChunk *chunk = head;
if (chunk != nullptr) {
assert(!chunk->IsEmpty());
@@ -62,7 +62,7 @@ MusicPipe::Shift()
#ifndef NDEBUG
/* poison the "next" reference */
chunk->next = (music_chunk *)(void *)0x01010101;
chunk->next = (MusicChunk *)(void *)0x01010101;
if (size == 0)
audio_format.Clear();
@@ -75,14 +75,14 @@ MusicPipe::Shift()
void
MusicPipe::Clear(MusicBuffer &buffer)
{
music_chunk *chunk;
MusicChunk *chunk;
while ((chunk = Shift()) != nullptr)
buffer.Return(chunk);
}
void
MusicPipe::Push(music_chunk *chunk)
MusicPipe::Push(MusicChunk *chunk)
{
assert(!chunk->IsEmpty());
assert(chunk->length == 0 || chunk->audio_format.IsValid());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -29,19 +29,19 @@
#include <assert.h>
struct music_chunk;
struct MusicChunk;
class MusicBuffer;
/**
* A queue of #music_chunk objects. One party appends chunks at the
* A queue of #MusicChunk objects. One party appends chunks at the
* tail, and the other consumes them from the head.
*/
class MusicPipe {
/** the first chunk */
music_chunk *head;
MusicChunk *head;
/** a pointer to the tail of the chunk */
music_chunk **tail_r;
MusicChunk **tail_r;
/** the current number of chunks */
unsigned size;
@@ -87,22 +87,22 @@ public:
* Checks if the specified chunk is enqueued in the music pipe.
*/
gcc_pure
bool Contains(const music_chunk *chunk) const;
bool Contains(const MusicChunk *chunk) const;
#endif
/**
* Returns the first #music_chunk from the pipe. Returns
* Returns the first #MusicChunk from the pipe. Returns
* nullptr if the pipe is empty.
*/
gcc_pure
const music_chunk *Peek() const {
const MusicChunk *Peek() const {
return head;
}
/**
* Removes the first chunk from the head, and returns it.
*/
music_chunk *Shift();
MusicChunk *Shift();
/**
* Clears the whole pipe and returns the chunks to the buffer.
@@ -114,7 +114,7 @@ public:
/**
* Pushes a chunk to the tail of the pipe.
*/
void Push(music_chunk *chunk);
void Push(MusicChunk *chunk);
/**
* Returns the number of chunks currently in this pipe.

View File

@@ -1,594 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "OutputAll.hxx"
#include "PlayerControl.hxx"
#include "OutputInternal.hxx"
#include "OutputControl.hxx"
#include "OutputError.hxx"
#include "MusicBuffer.hxx"
#include "MusicPipe.hxx"
#include "MusicChunk.hxx"
#include "system/FatalError.hxx"
#include "util/Error.hxx"
#include "ConfigData.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "notify.hxx"
#include <glib.h>
#include <assert.h>
#include <string.h>
static AudioFormat input_audio_format;
static struct audio_output **audio_outputs;
static unsigned int num_audio_outputs;
/**
* The #MusicBuffer object where consumed chunks are returned.
*/
static MusicBuffer *g_music_buffer;
/**
* The #MusicPipe object which feeds all audio outputs. It is filled
* by audio_output_all_play().
*/
static MusicPipe *g_mp;
/**
* The "elapsed_time" stamp of the most recently finished chunk.
*/
static float audio_output_all_elapsed_time = -1.0;
unsigned int audio_output_count(void)
{
return num_audio_outputs;
}
struct audio_output *
audio_output_get(unsigned i)
{
assert(i < num_audio_outputs);
assert(audio_outputs[i] != nullptr);
return audio_outputs[i];
}
struct audio_output *
audio_output_find(const char *name)
{
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_output_get(i);
if (strcmp(ao->name, name) == 0)
return ao;
}
/* name not found */
return nullptr;
}
gcc_const
static unsigned
audio_output_config_count(void)
{
unsigned int nr = 0;
const struct config_param *param = nullptr;
while ((param = config_get_next_param(CONF_AUDIO_OUTPUT, param)))
nr++;
if (!nr)
nr = 1; /* we'll always have at least one device */
return nr;
}
void
audio_output_all_init(PlayerControl &pc)
{
const struct config_param *param = nullptr;
unsigned int i;
Error error;
num_audio_outputs = audio_output_config_count();
audio_outputs = g_new(struct audio_output *, num_audio_outputs);
const config_param empty;
for (i = 0; i < num_audio_outputs; i++)
{
unsigned int j;
param = config_get_next_param(CONF_AUDIO_OUTPUT, param);
if (param == nullptr) {
/* only allow param to be nullptr if there
just one audio output */
assert(i == 0);
assert(num_audio_outputs == 1);
param = &empty;
}
audio_output *output = audio_output_new(*param, pc, error);
if (output == nullptr) {
if (param != nullptr)
FormatFatalError("line %i: %s",
param->line,
error.GetMessage());
else
FatalError(error);
}
audio_outputs[i] = output;
/* require output names to be unique: */
for (j = 0; j < i; j++) {
if (!strcmp(output->name, audio_outputs[j]->name)) {
FormatFatalError("output devices with identical "
"names: %s", output->name);
}
}
}
}
void
audio_output_all_finish(void)
{
unsigned int i;
for (i = 0; i < num_audio_outputs; i++) {
audio_output_disable(audio_outputs[i]);
audio_output_finish(audio_outputs[i]);
}
g_free(audio_outputs);
audio_outputs = nullptr;
num_audio_outputs = 0;
}
void
audio_output_all_enable_disable(void)
{
for (unsigned i = 0; i < num_audio_outputs; i++) {
struct audio_output *ao = audio_outputs[i];
bool enabled;
ao->mutex.lock();
enabled = ao->really_enabled;
ao->mutex.unlock();
if (ao->enabled != enabled) {
if (ao->enabled)
audio_output_enable(ao);
else
audio_output_disable(ao);
}
}
}
/**
* Determine if all (active) outputs have finished the current
* command.
*/
static bool
audio_output_all_finished(void)
{
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_outputs[i];
const ScopeLock protect(ao->mutex);
if (audio_output_is_open(ao) &&
!audio_output_command_is_finished(ao))
return false;
}
return true;
}
static void audio_output_wait_all(void)
{
while (!audio_output_all_finished())
audio_output_client_notify.Wait();
}
/**
* Signals all audio outputs which are open.
*/
static void
audio_output_allow_play_all(void)
{
for (unsigned i = 0; i < num_audio_outputs; ++i)
audio_output_allow_play(audio_outputs[i]);
}
static void
audio_output_reset_reopen(struct audio_output *ao)
{
const ScopeLock protect(ao->mutex);
if (!ao->open && ao->fail_timer != nullptr) {
g_timer_destroy(ao->fail_timer);
ao->fail_timer = nullptr;
}
}
/**
* Resets the "reopen" flag on all audio devices. MPD should
* immediately retry to open the device instead of waiting for the
* timeout when the user wants to start playback.
*/
static void
audio_output_all_reset_reopen(void)
{
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_outputs[i];
audio_output_reset_reopen(ao);
}
}
/**
* Opens all output devices which are enabled, but closed.
*
* @return true if there is at least open output device which is open
*/
static bool
audio_output_all_update(void)
{
unsigned int i;
bool ret = false;
if (!input_audio_format.IsDefined())
return false;
for (i = 0; i < num_audio_outputs; ++i)
ret = audio_output_update(audio_outputs[i],
input_audio_format, *g_mp) || ret;
return ret;
}
void
audio_output_all_set_replay_gain_mode(ReplayGainMode mode)
{
for (unsigned i = 0; i < num_audio_outputs; ++i)
audio_output_set_replay_gain_mode(audio_outputs[i], mode);
}
bool
audio_output_all_play(struct music_chunk *chunk, Error &error)
{
bool ret;
unsigned int i;
assert(g_music_buffer != nullptr);
assert(g_mp != nullptr);
assert(chunk != nullptr);
assert(chunk->CheckFormat(input_audio_format));
ret = audio_output_all_update();
if (!ret) {
/* TODO: obtain real error */
error.Set(output_domain, "Failed to open audio output");
return false;
}
g_mp->Push(chunk);
for (i = 0; i < num_audio_outputs; ++i)
audio_output_play(audio_outputs[i]);
return true;
}
bool
audio_output_all_open(const AudioFormat audio_format,
MusicBuffer &buffer,
Error &error)
{
bool ret = false, enabled = false;
unsigned int i;
assert(g_music_buffer == nullptr || g_music_buffer == &buffer);
assert((g_mp == nullptr) == (g_music_buffer == nullptr));
g_music_buffer = &buffer;
/* the audio format must be the same as existing chunks in the
pipe */
assert(g_mp == nullptr || g_mp->CheckFormat(audio_format));
if (g_mp == nullptr)
g_mp = new MusicPipe();
else
/* if the pipe hasn't been cleared, the the audio
format must not have changed */
assert(g_mp->IsEmpty() || audio_format == input_audio_format);
input_audio_format = audio_format;
audio_output_all_reset_reopen();
audio_output_all_enable_disable();
audio_output_all_update();
for (i = 0; i < num_audio_outputs; ++i) {
if (audio_outputs[i]->enabled)
enabled = true;
if (audio_outputs[i]->open)
ret = true;
}
if (!enabled)
error.Set(output_domain, "All audio outputs are disabled");
else if (!ret)
/* TODO: obtain real error */
error.Set(output_domain, "Failed to open audio output");
if (!ret)
/* close all devices if there was an error */
audio_output_all_close();
return ret;
}
/**
* Has the specified audio output already consumed this chunk?
*/
static bool
chunk_is_consumed_in(const struct audio_output *ao,
const struct music_chunk *chunk)
{
if (!ao->open)
return true;
if (ao->chunk == nullptr)
return false;
assert(chunk == ao->chunk || g_mp->Contains(ao->chunk));
if (chunk != ao->chunk) {
assert(chunk->next != nullptr);
return true;
}
return ao->chunk_finished && chunk->next == nullptr;
}
/**
* Has this chunk been consumed by all audio outputs?
*/
static bool
chunk_is_consumed(const struct music_chunk *chunk)
{
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_outputs[i];
const ScopeLock protect(ao->mutex);
if (!chunk_is_consumed_in(ao, chunk))
return false;
}
return true;
}
/**
* There's only one chunk left in the pipe (#g_mp), and all audio
* outputs have consumed it already. Clear the reference.
*/
static void
clear_tail_chunk(gcc_unused const struct music_chunk *chunk, bool *locked)
{
assert(chunk->next == nullptr);
assert(g_mp->Contains(chunk));
for (unsigned i = 0; i < num_audio_outputs; ++i) {
struct audio_output *ao = audio_outputs[i];
/* this mutex will be unlocked by the caller when it's
ready */
ao->mutex.lock();
locked[i] = ao->open;
if (!locked[i]) {
ao->mutex.unlock();
continue;
}
assert(ao->chunk == chunk);
assert(ao->chunk_finished);
ao->chunk = nullptr;
}
}
unsigned
audio_output_all_check(void)
{
const struct music_chunk *chunk;
bool is_tail;
struct music_chunk *shifted;
bool locked[num_audio_outputs];
assert(g_music_buffer != nullptr);
assert(g_mp != nullptr);
while ((chunk = g_mp->Peek()) != nullptr) {
assert(!g_mp->IsEmpty());
if (!chunk_is_consumed(chunk))
/* at least one output is not finished playing
this chunk */
return g_mp->GetSize();
if (chunk->length > 0 && chunk->times >= 0.0)
/* only update elapsed_time if the chunk
provides a defined value */
audio_output_all_elapsed_time = chunk->times;
is_tail = chunk->next == nullptr;
if (is_tail)
/* this is the tail of the pipe - clear the
chunk reference in all outputs */
clear_tail_chunk(chunk, locked);
/* remove the chunk from the pipe */
shifted = g_mp->Shift();
assert(shifted == chunk);
if (is_tail)
/* unlock all audio outputs which were locked
by clear_tail_chunk() */
for (unsigned i = 0; i < num_audio_outputs; ++i)
if (locked[i])
audio_outputs[i]->mutex.unlock();
/* return the chunk to the buffer */
g_music_buffer->Return(shifted);
}
return 0;
}
bool
audio_output_all_wait(PlayerControl &pc, unsigned threshold)
{
pc.Lock();
if (audio_output_all_check() < threshold) {
pc.Unlock();
return true;
}
pc.Wait();
pc.Unlock();
return audio_output_all_check() < threshold;
}
void
audio_output_all_pause(void)
{
unsigned int i;
audio_output_all_update();
for (i = 0; i < num_audio_outputs; ++i)
audio_output_pause(audio_outputs[i]);
audio_output_wait_all();
}
void
audio_output_all_drain(void)
{
for (unsigned i = 0; i < num_audio_outputs; ++i)
audio_output_drain_async(audio_outputs[i]);
audio_output_wait_all();
}
void
audio_output_all_cancel(void)
{
unsigned int i;
/* send the cancel() command to all audio outputs */
for (i = 0; i < num_audio_outputs; ++i)
audio_output_cancel(audio_outputs[i]);
audio_output_wait_all();
/* clear the music pipe and return all chunks to the buffer */
if (g_mp != nullptr)
g_mp->Clear(*g_music_buffer);
/* the audio outputs are now waiting for a signal, to
synchronize the cleared music pipe */
audio_output_allow_play_all();
/* invalidate elapsed_time */
audio_output_all_elapsed_time = -1.0;
}
void
audio_output_all_close(void)
{
unsigned int i;
for (i = 0; i < num_audio_outputs; ++i)
audio_output_close(audio_outputs[i]);
if (g_mp != nullptr) {
assert(g_music_buffer != nullptr);
g_mp->Clear(*g_music_buffer);
delete g_mp;
g_mp = nullptr;
}
g_music_buffer = nullptr;
input_audio_format.Clear();
audio_output_all_elapsed_time = -1.0;
}
void
audio_output_all_release(void)
{
unsigned int i;
for (i = 0; i < num_audio_outputs; ++i)
audio_output_release(audio_outputs[i]);
if (g_mp != nullptr) {
assert(g_music_buffer != nullptr);
g_mp->Clear(*g_music_buffer);
delete g_mp;
g_mp = nullptr;
}
g_music_buffer = nullptr;
input_audio_format.Clear();
audio_output_all_elapsed_time = -1.0;
}
void
audio_output_all_song_border(void)
{
/* clear the elapsed_time pointer at the beginning of a new
song */
audio_output_all_elapsed_time = 0.0;
}
float
audio_output_all_get_elapsed_time(void)
{
return audio_output_all_elapsed_time;
}

View File

@@ -1,174 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Functions for dealing with all configured (enabled) audion outputs
* at once.
*
*/
#ifndef OUTPUT_ALL_H
#define OUTPUT_ALL_H
#include "ReplayGainInfo.hxx"
#include "Compiler.h"
struct AudioFormat;
class MusicBuffer;
struct music_chunk;
struct PlayerControl;
class Error;
/**
* Global initialization: load audio outputs from the configuration
* file and initialize them.
*/
void
audio_output_all_init(PlayerControl &pc);
/**
* Global finalization: free memory occupied by audio outputs. All
*/
void
audio_output_all_finish(void);
/**
* Returns the total number of audio output devices, including those
* who are disabled right now.
*/
gcc_const
unsigned int audio_output_count(void);
/**
* Returns the "i"th audio output device.
*/
gcc_const
struct audio_output *
audio_output_get(unsigned i);
/**
* Returns the audio output device with the specified name. Returns
* NULL if the name does not exist.
*/
gcc_pure
struct audio_output *
audio_output_find(const char *name);
/**
* Checks the "enabled" flag of all audio outputs, and if one has
* changed, commit the change.
*/
void
audio_output_all_enable_disable(void);
/**
* Opens all audio outputs which are not disabled.
*
* @param audio_format the preferred audio format
* @param buffer the #music_buffer where consumed #music_chunk objects
* should be returned
* @return true on success, false on failure
*/
bool
audio_output_all_open(AudioFormat audio_format,
MusicBuffer &buffer,
Error &error);
/**
* Closes all audio outputs.
*/
void
audio_output_all_close(void);
/**
* Closes all audio outputs. Outputs with the "always_on" flag are
* put into pause mode.
*/
void
audio_output_all_release(void);
void
audio_output_all_set_replay_gain_mode(ReplayGainMode mode);
/**
* Enqueue a #music_chunk object for playing, i.e. pushes it to a
* #MusicPipe.
*
* @param chunk the #music_chunk object to be played
* @return true on success, false if no audio output was able to play
* (all closed then)
*/
bool
audio_output_all_play(struct music_chunk *chunk, Error &error);
/**
* Checks if the output devices have drained their music pipe, and
* returns the consumed music chunks to the #music_buffer.
*
* @return the number of chunks to play left in the #MusicPipe
*/
unsigned
audio_output_all_check(void);
/**
* Checks if the size of the #MusicPipe is below the #threshold. If
* not, it attempts to synchronize with all output threads, and waits
* until another #music_chunk is finished.
*
* @param threshold the maximum number of chunks in the pipe
* @return true if there are less than #threshold chunks in the pipe
*/
bool
audio_output_all_wait(PlayerControl &pc, unsigned threshold);
/**
* Puts all audio outputs into pause mode. Most implementations will
* simply close it then.
*/
void
audio_output_all_pause(void);
/**
* Drain all audio outputs.
*/
void
audio_output_all_drain(void);
/**
* Try to cancel data which may still be in the device's buffers.
*/
void
audio_output_all_cancel(void);
/**
* Indicate that a new song will begin now.
*/
void
audio_output_all_song_border(void);
/**
* Returns the "elapsed_time" stamp of the most recently finished
* chunk. A negative value is returned when no chunk has been
* finished yet.
*/
gcc_pure
float
audio_output_all_get_elapsed_time(void);
#endif

View File

@@ -1,334 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "OutputControl.hxx"
#include "OutputThread.hxx"
#include "OutputInternal.hxx"
#include "OutputPlugin.hxx"
#include "OutputError.hxx"
#include "MixerPlugin.hxx"
#include "MixerControl.hxx"
#include "notify.hxx"
#include "filter/ReplayGainFilterPlugin.hxx"
#include "FilterPlugin.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
#include <glib.h>
#include <assert.h>
#include <stdlib.h>
/** after a failure, wait this number of seconds before
automatically reopening the device */
static constexpr unsigned REOPEN_AFTER = 10;
struct notify audio_output_client_notify;
/**
* Waits for command completion.
*
* @param ao the #audio_output instance; must be locked
*/
static void ao_command_wait(struct audio_output *ao)
{
while (ao->command != AO_COMMAND_NONE) {
ao->mutex.unlock();
audio_output_client_notify.Wait();
ao->mutex.lock();
}
}
/**
* Sends a command to the #audio_output object, but does not wait for
* completion.
*
* @param ao the #audio_output instance; must be locked
*/
static void ao_command_async(struct audio_output *ao,
enum audio_output_command cmd)
{
assert(ao->command == AO_COMMAND_NONE);
ao->command = cmd;
ao->cond.signal();
}
/**
* Sends a command to the #audio_output object and waits for
* completion.
*
* @param ao the #audio_output instance; must be locked
*/
static void
ao_command(struct audio_output *ao, enum audio_output_command cmd)
{
ao_command_async(ao, cmd);
ao_command_wait(ao);
}
/**
* Lock the #audio_output object and execute the command
* synchronously.
*/
static void
ao_lock_command(struct audio_output *ao, enum audio_output_command cmd)
{
const ScopeLock protect(ao->mutex);
ao_command(ao, cmd);
}
void
audio_output_set_replay_gain_mode(struct audio_output *ao,
ReplayGainMode mode)
{
if (ao->replay_gain_filter != nullptr)
replay_gain_filter_set_mode(ao->replay_gain_filter, mode);
}
void
audio_output_enable(struct audio_output *ao)
{
if (!ao->thread.IsDefined()) {
if (ao->plugin->enable == nullptr) {
/* don't bother to start the thread now if the
device doesn't even have a enable() method;
just assign the variable and we're done */
ao->really_enabled = true;
return;
}
audio_output_thread_start(ao);
}
ao_lock_command(ao, AO_COMMAND_ENABLE);
}
void
audio_output_disable(struct audio_output *ao)
{
if (!ao->thread.IsDefined()) {
if (ao->plugin->disable == nullptr)
ao->really_enabled = false;
else
/* if there's no thread yet, the device cannot
be enabled */
assert(!ao->really_enabled);
return;
}
ao_lock_command(ao, AO_COMMAND_DISABLE);
}
/**
* Object must be locked (and unlocked) by the caller.
*/
static bool
audio_output_open(struct audio_output *ao,
const AudioFormat audio_format,
const MusicPipe &mp)
{
bool open;
assert(ao != nullptr);
assert(ao->allow_play);
assert(audio_format.IsValid());
if (ao->fail_timer != nullptr) {
g_timer_destroy(ao->fail_timer);
ao->fail_timer = nullptr;
}
if (ao->open && audio_format == ao->in_audio_format) {
assert(ao->pipe == &mp ||
(ao->always_on && ao->pause));
if (ao->pause) {
ao->chunk = nullptr;
ao->pipe = &mp;
/* unpause with the CANCEL command; this is a
hack, but suits well for forcing the thread
to leave the ao_pause() thread, and we need
to flush the device buffer anyway */
/* we're not using audio_output_cancel() here,
because that function is asynchronous */
ao_command(ao, AO_COMMAND_CANCEL);
}
return true;
}
ao->in_audio_format = audio_format;
ao->chunk = nullptr;
ao->pipe = &mp;
if (!ao->thread.IsDefined())
audio_output_thread_start(ao);
ao_command(ao, ao->open ? AO_COMMAND_REOPEN : AO_COMMAND_OPEN);
open = ao->open;
if (open && ao->mixer != nullptr) {
Error error;
if (!mixer_open(ao->mixer, error))
FormatWarning(output_domain,
"Failed to open mixer for '%s'",
ao->name);
}
return open;
}
/**
* Same as audio_output_close(), but expects the lock to be held by
* the caller.
*/
static void
audio_output_close_locked(struct audio_output *ao)
{
assert(ao != nullptr);
assert(ao->allow_play);
if (ao->mixer != nullptr)
mixer_auto_close(ao->mixer);
assert(!ao->open || ao->fail_timer == nullptr);
if (ao->open)
ao_command(ao, AO_COMMAND_CLOSE);
else if (ao->fail_timer != nullptr) {
g_timer_destroy(ao->fail_timer);
ao->fail_timer = nullptr;
}
}
bool
audio_output_update(struct audio_output *ao,
const AudioFormat audio_format,
const MusicPipe &mp)
{
const ScopeLock protect(ao->mutex);
if (ao->enabled && ao->really_enabled) {
if (ao->fail_timer == nullptr ||
g_timer_elapsed(ao->fail_timer, nullptr) > REOPEN_AFTER) {
return audio_output_open(ao, audio_format, mp);
}
} else if (audio_output_is_open(ao))
audio_output_close_locked(ao);
return false;
}
void
audio_output_play(struct audio_output *ao)
{
const ScopeLock protect(ao->mutex);
assert(ao->allow_play);
if (audio_output_is_open(ao) && !ao->in_playback_loop &&
!ao->woken_for_play) {
ao->woken_for_play = true;
ao->cond.signal();
}
}
void audio_output_pause(struct audio_output *ao)
{
if (ao->mixer != nullptr && ao->plugin->pause == nullptr)
/* the device has no pause mode: close the mixer,
unless its "global" flag is set (checked by
mixer_auto_close()) */
mixer_auto_close(ao->mixer);
const ScopeLock protect(ao->mutex);
assert(ao->allow_play);
if (audio_output_is_open(ao))
ao_command_async(ao, AO_COMMAND_PAUSE);
}
void
audio_output_drain_async(struct audio_output *ao)
{
const ScopeLock protect(ao->mutex);
assert(ao->allow_play);
if (audio_output_is_open(ao))
ao_command_async(ao, AO_COMMAND_DRAIN);
}
void audio_output_cancel(struct audio_output *ao)
{
const ScopeLock protect(ao->mutex);
if (audio_output_is_open(ao)) {
ao->allow_play = false;
ao_command_async(ao, AO_COMMAND_CANCEL);
}
}
void
audio_output_allow_play(struct audio_output *ao)
{
const ScopeLock protect(ao->mutex);
ao->allow_play = true;
if (audio_output_is_open(ao))
ao->cond.signal();
}
void
audio_output_release(struct audio_output *ao)
{
if (ao->always_on)
audio_output_pause(ao);
else
audio_output_close(ao);
}
void audio_output_close(struct audio_output *ao)
{
assert(ao != nullptr);
assert(!ao->open || ao->fail_timer == nullptr);
const ScopeLock protect(ao->mutex);
audio_output_close_locked(ao);
}
void audio_output_finish(struct audio_output *ao)
{
audio_output_close(ao);
assert(ao->fail_timer == nullptr);
if (ao->thread.IsDefined()) {
assert(ao->allow_play);
ao_lock_command(ao, AO_COMMAND_KILL);
ao->thread.Join();
}
audio_output_free(ao);
}

View File

@@ -1,90 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_OUTPUT_CONTROL_HXX
#define MPD_OUTPUT_CONTROL_HXX
#include "ReplayGainInfo.hxx"
#include <stddef.h>
struct audio_output;
struct AudioFormat;
struct config_param;
class MusicPipe;
void
audio_output_set_replay_gain_mode(struct audio_output *ao,
ReplayGainMode mode);
/**
* Enables the device.
*/
void
audio_output_enable(struct audio_output *ao);
/**
* Disables the device.
*/
void
audio_output_disable(struct audio_output *ao);
/**
* Opens or closes the device, depending on the "enabled" flag.
*
* @return true if the device is open
*/
bool
audio_output_update(struct audio_output *ao,
AudioFormat audio_format,
const MusicPipe &mp);
void
audio_output_play(struct audio_output *ao);
void audio_output_pause(struct audio_output *ao);
void
audio_output_drain_async(struct audio_output *ao);
/**
* Clear the "allow_play" flag and send the "CANCEL" command
* asynchronously. To finish the operation, the caller has to call
* audio_output_allow_play().
*/
void audio_output_cancel(struct audio_output *ao);
/**
* Set the "allow_play" and signal the thread.
*/
void
audio_output_allow_play(struct audio_output *ao);
void audio_output_close(struct audio_output *ao);
/**
* Closes the audio output, but if the "always_on" flag is set, put it
* into pause mode instead.
*/
void
audio_output_release(struct audio_output *ao);
void audio_output_finish(struct audio_output *ao);
#endif

View File

@@ -1,109 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "OutputPlugin.hxx"
#include "OutputInternal.hxx"
struct audio_output *
ao_plugin_init(const struct audio_output_plugin *plugin,
const config_param &param,
Error &error)
{
assert(plugin != nullptr);
assert(plugin->init != nullptr);
return plugin->init(param, error);
}
void
ao_plugin_finish(struct audio_output *ao)
{
ao->plugin->finish(ao);
}
bool
ao_plugin_enable(struct audio_output *ao, Error &error_r)
{
return ao->plugin->enable != nullptr
? ao->plugin->enable(ao, error_r)
: true;
}
void
ao_plugin_disable(struct audio_output *ao)
{
if (ao->plugin->disable != nullptr)
ao->plugin->disable(ao);
}
bool
ao_plugin_open(struct audio_output *ao, AudioFormat &audio_format,
Error &error)
{
return ao->plugin->open(ao, audio_format, error);
}
void
ao_plugin_close(struct audio_output *ao)
{
ao->plugin->close(ao);
}
unsigned
ao_plugin_delay(struct audio_output *ao)
{
return ao->plugin->delay != nullptr
? ao->plugin->delay(ao)
: 0;
}
void
ao_plugin_send_tag(struct audio_output *ao, const Tag *tag)
{
if (ao->plugin->send_tag != nullptr)
ao->plugin->send_tag(ao, tag);
}
size_t
ao_plugin_play(struct audio_output *ao, const void *chunk, size_t size,
Error &error)
{
return ao->plugin->play(ao, chunk, size, error);
}
void
ao_plugin_drain(struct audio_output *ao)
{
if (ao->plugin->drain != nullptr)
ao->plugin->drain(ao);
}
void
ao_plugin_cancel(struct audio_output *ao)
{
if (ao->plugin->cancel != nullptr)
ao->plugin->cancel(ao);
}
bool
ao_plugin_pause(struct audio_output *ao)
{
return ao->plugin->pause != nullptr && ao->plugin->pause(ao);
}

View File

@@ -1,679 +0,0 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "OutputThread.hxx"
#include "OutputInternal.hxx"
#include "OutputAPI.hxx"
#include "OutputError.hxx"
#include "pcm/PcmMix.hxx"
#include "notify.hxx"
#include "FilterInternal.hxx"
#include "filter/ConvertFilterPlugin.hxx"
#include "filter/ReplayGainFilterPlugin.hxx"
#include "PlayerControl.hxx"
#include "MusicPipe.hxx"
#include "MusicChunk.hxx"
#include "system/FatalError.hxx"
#include "util/Error.hxx"
#include "Log.hxx"
#include "Compiler.h"
#include <glib.h>
#include <assert.h>
#include <string.h>
static void ao_command_finished(struct audio_output *ao)
{
assert(ao->command != AO_COMMAND_NONE);
ao->command = AO_COMMAND_NONE;
ao->mutex.unlock();
audio_output_client_notify.Signal();
ao->mutex.lock();
}
static bool
ao_enable(struct audio_output *ao)
{
Error error;
bool success;
if (ao->really_enabled)
return true;
ao->mutex.unlock();
success = ao_plugin_enable(ao, error);
ao->mutex.lock();
if (!success) {
FormatError(error,
"Failed to enable \"%s\" [%s]",
ao->name, ao->plugin->name);
return false;
}
ao->really_enabled = true;
return true;
}
static void
ao_close(struct audio_output *ao, bool drain);
static void
ao_disable(struct audio_output *ao)
{
if (ao->open)
ao_close(ao, false);
if (ao->really_enabled) {
ao->really_enabled = false;
ao->mutex.unlock();
ao_plugin_disable(ao);
ao->mutex.lock();
}
}
static AudioFormat
ao_filter_open(struct audio_output *ao, AudioFormat &format,
Error &error_r)
{
assert(format.IsValid());
/* the replay_gain filter cannot fail here */
if (ao->replay_gain_filter != nullptr)
ao->replay_gain_filter->Open(format, error_r);
if (ao->other_replay_gain_filter != nullptr)
ao->other_replay_gain_filter->Open(format, error_r);
const AudioFormat af = ao->filter->Open(format, error_r);
if (!af.IsDefined()) {
if (ao->replay_gain_filter != nullptr)
ao->replay_gain_filter->Close();
if (ao->other_replay_gain_filter != nullptr)
ao->other_replay_gain_filter->Close();
}
return af;
}
static void
ao_filter_close(struct audio_output *ao)
{
if (ao->replay_gain_filter != nullptr)
ao->replay_gain_filter->Close();
if (ao->other_replay_gain_filter != nullptr)
ao->other_replay_gain_filter->Close();
ao->filter->Close();
}
static void
ao_open(struct audio_output *ao)
{
bool success;
Error error;
struct audio_format_string af_string;
assert(!ao->open);
assert(ao->pipe != nullptr);
assert(ao->chunk == nullptr);
assert(ao->in_audio_format.IsValid());
if (ao->fail_timer != nullptr) {
/* this can only happen when this
output thread fails while
audio_output_open() is run in the
player thread */
g_timer_destroy(ao->fail_timer);
ao->fail_timer = nullptr;
}
/* enable the device (just in case the last enable has failed) */
if (!ao_enable(ao))
/* still no luck */
return;
/* open the filter */
const AudioFormat filter_audio_format =
ao_filter_open(ao, ao->in_audio_format, error);
if (!filter_audio_format.IsDefined()) {
FormatError(error, "Failed to open filter for \"%s\" [%s]",
ao->name, ao->plugin->name);
ao->fail_timer = g_timer_new();
return;
}
assert(filter_audio_format.IsValid());
ao->out_audio_format = filter_audio_format;
ao->out_audio_format.ApplyMask(ao->config_audio_format);
ao->mutex.unlock();
success = ao_plugin_open(ao, ao->out_audio_format, error);
ao->mutex.lock();
assert(!ao->open);
if (!success) {
FormatError(error, "Failed to open \"%s\" [%s]",
ao->name, ao->plugin->name);
ao_filter_close(ao);
ao->fail_timer = g_timer_new();
return;
}
convert_filter_set(ao->convert_filter, ao->out_audio_format);
ao->open = true;
FormatDebug(output_domain,
"opened plugin=%s name=\"%s\" audio_format=%s",
ao->plugin->name, ao->name,
audio_format_to_string(ao->out_audio_format, &af_string));
if (ao->in_audio_format != ao->out_audio_format)
FormatDebug(output_domain, "converting from %s",
audio_format_to_string(ao->in_audio_format,
&af_string));
}
static void
ao_close(struct audio_output *ao, bool drain)
{
assert(ao->open);
ao->pipe = nullptr;
ao->chunk = nullptr;
ao->open = false;
ao->mutex.unlock();
if (drain)
ao_plugin_drain(ao);
else
ao_plugin_cancel(ao);
ao_plugin_close(ao);
ao_filter_close(ao);
ao->mutex.lock();
FormatDebug(output_domain, "closed plugin=%s name=\"%s\"",
ao->plugin->name, ao->name);
}
static void
ao_reopen_filter(struct audio_output *ao)
{
Error error;
ao_filter_close(ao);
const AudioFormat filter_audio_format =
ao_filter_open(ao, ao->in_audio_format, error);
if (!filter_audio_format.IsDefined()) {
FormatError(error,
"Failed to open filter for \"%s\" [%s]",
ao->name, ao->plugin->name);
/* this is a little code duplication fro ao_close(),
but we cannot call this function because we must
not call filter_close(ao->filter) again */
ao->pipe = nullptr;
ao->chunk = nullptr;
ao->open = false;
ao->fail_timer = g_timer_new();
ao->mutex.unlock();
ao_plugin_close(ao);
ao->mutex.lock();
return;
}
convert_filter_set(ao->convert_filter, ao->out_audio_format);
}
static void
ao_reopen(struct audio_output *ao)
{
if (!ao->config_audio_format.IsFullyDefined()) {
if (ao->open) {
const MusicPipe *mp = ao->pipe;
ao_close(ao, true);
ao->pipe = mp;
}
/* no audio format is configured: copy in->out, let
the output's open() method determine the effective
out_audio_format */
ao->out_audio_format = ao->in_audio_format;
ao->out_audio_format.ApplyMask(ao->config_audio_format);
}
if (ao->open)
/* the audio format has changed, and all filters have
to be reconfigured */
ao_reopen_filter(ao);
else
ao_open(ao);
}
/**
* Wait until the output's delay reaches zero.
*
* @return true if playback should be continued, false if a command
* was issued
*/
static bool
ao_wait(struct audio_output *ao)
{
while (true) {
unsigned delay = ao_plugin_delay(ao);
if (delay == 0)
return true;
(void)ao->cond.timed_wait(ao->mutex, delay);
if (ao->command != AO_COMMAND_NONE)
return false;
}
}
static const void *
ao_chunk_data(struct audio_output *ao, const struct music_chunk *chunk,
Filter *replay_gain_filter,
unsigned *replay_gain_serial_p,
size_t *length_r)
{
assert(chunk != nullptr);
assert(!chunk->IsEmpty());
assert(chunk->CheckFormat(ao->in_audio_format));
const void *data = chunk->data;
size_t length = chunk->length;
(void)ao;
assert(length % ao->in_audio_format.GetFrameSize() == 0);
if (length > 0 && replay_gain_filter != nullptr) {
if (chunk->replay_gain_serial != *replay_gain_serial_p) {
replay_gain_filter_set_info(replay_gain_filter,
chunk->replay_gain_serial != 0
? &chunk->replay_gain_info
: nullptr);
*replay_gain_serial_p = chunk->replay_gain_serial;
}
Error error;
data = replay_gain_filter->FilterPCM(data, length,
&length, error);
if (data == nullptr) {
FormatError(error, "\"%s\" [%s] failed to filter",
ao->name, ao->plugin->name);
return nullptr;
}
}
*length_r = length;
return data;
}
static const void *
ao_filter_chunk(struct audio_output *ao, const struct music_chunk *chunk,
size_t *length_r)
{
size_t length;
const void *data = ao_chunk_data(ao, chunk, ao->replay_gain_filter,
&ao->replay_gain_serial, &length);
if (data == nullptr)
return nullptr;
if (length == 0) {
/* empty chunk, nothing to do */
*length_r = 0;
return data;
}
/* cross-fade */
if (chunk->other != nullptr) {
size_t other_length;
const void *other_data =
ao_chunk_data(ao, chunk->other,
ao->other_replay_gain_filter,
&ao->other_replay_gain_serial,
&other_length);
if (other_data == nullptr)
return nullptr;
if (other_length == 0) {
*length_r = 0;
return data;
}
/* if the "other" chunk is longer, then that trailer
is used as-is, without mixing; it is part of the
"next" song being faded in, and if there's a rest,
it means cross-fading ends here */
if (length > other_length)
length = other_length;
void *dest = ao->cross_fade_buffer.Get(other_length);
memcpy(dest, other_data, other_length);
if (!pcm_mix(dest, data, length,
ao->in_audio_format.format,
1.0 - chunk->mix_ratio)) {
FormatError(output_domain,
"Cannot cross-fade format %s",
sample_format_to_string(ao->in_audio_format.format));
return nullptr;
}
data = dest;
length = other_length;
}
/* apply filter chain */
Error error;
data = ao->filter->FilterPCM(data, length, &length, error);
if (data == nullptr) {
FormatError(error, "\"%s\" [%s] failed to filter",
ao->name, ao->plugin->name);
return nullptr;
}
*length_r = length;
return data;
}
static bool
ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
{
assert(ao != nullptr);
assert(ao->filter != nullptr);
if (ao->tags && gcc_unlikely(chunk->tag != nullptr)) {
ao->mutex.unlock();
ao_plugin_send_tag(ao, chunk->tag);
ao->mutex.lock();
}
size_t size;
#if GCC_CHECK_VERSION(4,7)
/* workaround -Wmaybe-uninitialized false positive */
size = 0;
#endif
const char *data = (const char *)ao_filter_chunk(ao, chunk, &size);
if (data == nullptr) {
ao_close(ao, false);
/* don't automatically reopen this device for 10
seconds */
ao->fail_timer = g_timer_new();
return false;
}
Error error;
while (size > 0 && ao->command == AO_COMMAND_NONE) {
size_t nbytes;
if (!ao_wait(ao))
break;
ao->mutex.unlock();
nbytes = ao_plugin_play(ao, data, size, error);
ao->mutex.lock();
if (nbytes == 0) {
/* play()==0 means failure */
FormatError(error, "\"%s\" [%s] failed to play",
ao->name, ao->plugin->name);
ao_close(ao, false);
/* don't automatically reopen this device for
10 seconds */
assert(ao->fail_timer == nullptr);
ao->fail_timer = g_timer_new();
return false;
}
assert(nbytes <= size);
assert(nbytes % ao->out_audio_format.GetFrameSize() == 0);
data += nbytes;
size -= nbytes;
}
return true;
}
static const struct music_chunk *
ao_next_chunk(struct audio_output *ao)
{
return ao->chunk != nullptr
/* continue the previous play() call */
? ao->chunk->next
/* get the first chunk from the pipe */
: ao->pipe->Peek();
}
/**
* Plays all remaining chunks, until the tail of the pipe has been
* reached (and no more chunks are queued), or until a command is
* received.
*
* @return true if at least one chunk has been available, false if the
* tail of the pipe was already reached
*/
static bool
ao_play(struct audio_output *ao)
{
bool success;
const struct music_chunk *chunk;
assert(ao->pipe != nullptr);
chunk = ao_next_chunk(ao);
if (chunk == nullptr)
/* no chunk available */
return false;
ao->chunk_finished = false;
assert(!ao->in_playback_loop);
ao->in_playback_loop = true;
while (chunk != nullptr && ao->command == AO_COMMAND_NONE) {
assert(!ao->chunk_finished);
ao->chunk = chunk;
success = ao_play_chunk(ao, chunk);
if (!success) {
assert(ao->chunk == nullptr);
break;
}
assert(ao->chunk == chunk);
chunk = chunk->next;
}
assert(ao->in_playback_loop);
ao->in_playback_loop = false;
ao->chunk_finished = true;
ao->mutex.unlock();
ao->player_control->LockSignal();
ao->mutex.lock();
return true;
}
static void ao_pause(struct audio_output *ao)
{
bool ret;
ao->mutex.unlock();
ao_plugin_cancel(ao);
ao->mutex.lock();
ao->pause = true;
ao_command_finished(ao);
do {
if (!ao_wait(ao))
break;
ao->mutex.unlock();
ret = ao_plugin_pause(ao);
ao->mutex.lock();
if (!ret) {
ao_close(ao, false);
break;
}
} while (ao->command == AO_COMMAND_NONE);
ao->pause = false;
}
static void
audio_output_task(void *arg)
{
struct audio_output *ao = (struct audio_output *)arg;
ao->mutex.lock();
while (1) {
switch (ao->command) {
case AO_COMMAND_NONE:
break;
case AO_COMMAND_ENABLE:
ao_enable(ao);
ao_command_finished(ao);
break;
case AO_COMMAND_DISABLE:
ao_disable(ao);
ao_command_finished(ao);
break;
case AO_COMMAND_OPEN:
ao_open(ao);
ao_command_finished(ao);
break;
case AO_COMMAND_REOPEN:
ao_reopen(ao);
ao_command_finished(ao);
break;
case AO_COMMAND_CLOSE:
assert(ao->open);
assert(ao->pipe != nullptr);
ao_close(ao, false);
ao_command_finished(ao);
break;
case AO_COMMAND_PAUSE:
if (!ao->open) {
/* the output has failed after
audio_output_all_pause() has
submitted the PAUSE command; bail
out */
ao_command_finished(ao);
break;
}
ao_pause(ao);
/* don't "break" here: this might cause
ao_play() to be called when command==CLOSE
ends the paused state - "continue" checks
the new command first */
continue;
case AO_COMMAND_DRAIN:
if (ao->open) {
assert(ao->chunk == nullptr);
assert(ao->pipe->Peek() == nullptr);
ao->mutex.unlock();
ao_plugin_drain(ao);
ao->mutex.lock();
}
ao_command_finished(ao);
continue;
case AO_COMMAND_CANCEL:
ao->chunk = nullptr;
if (ao->open) {
ao->mutex.unlock();
ao_plugin_cancel(ao);
ao->mutex.lock();
}
ao_command_finished(ao);
continue;
case AO_COMMAND_KILL:
ao->chunk = nullptr;
ao_command_finished(ao);
ao->mutex.unlock();
return;
}
if (ao->open && ao->allow_play && ao_play(ao))
/* don't wait for an event if there are more
chunks in the pipe */
continue;
if (ao->command == AO_COMMAND_NONE) {
ao->woken_for_play = false;
ao->cond.wait(ao->mutex);
}
}
}
void audio_output_thread_start(struct audio_output *ao)
{
assert(ao->command == AO_COMMAND_NONE);
Error error;
if (!ao->thread.Start(audio_output_task, ao, error))
FatalError(error);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -19,21 +19,29 @@
#include "config.h"
#include "Partition.hxx"
#include "Song.hxx"
#include "DetachedSong.hxx"
#include "output/MultipleOutputs.hxx"
#include "mixer/Volume.hxx"
#include "Idle.hxx"
#include "GlobalEvents.hxx"
#ifdef ENABLE_DATABASE
void
Partition::DatabaseModified()
Partition::DatabaseModified(const Database &db)
{
playlist.DatabaseModified();
playlist.DatabaseModified(db);
}
#endif
void
Partition::TagModified()
{
Song *song = pc.LockReadTaggedSong();
DetachedSong *song = pc.LockReadTaggedSong();
if (song != nullptr) {
playlist.TagModified(std::move(*song));
song->Free();
delete song;
}
}
@@ -42,3 +50,24 @@ Partition::SyncWithPlayer()
{
playlist.SyncWithPlayer(pc);
}
void
Partition::OnPlayerSync()
{
GlobalEvents::Emit(GlobalEvents::PLAYLIST);
}
void
Partition::OnPlayerTagModified()
{
GlobalEvents::Emit(GlobalEvents::TAG);
}
void
Partition::OnMixerVolumeChanged(gcc_unused Mixer &mixer, gcc_unused int volume)
{
InvalidateHardwareVolume();
/* notify clients */
idle_add(IDLE_MIXER);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -20,20 +20,29 @@
#ifndef MPD_PARTITION_HXX
#define MPD_PARTITION_HXX
#include "Playlist.hxx"
#include "queue/Playlist.hxx"
#include "output/MultipleOutputs.hxx"
#include "mixer/Listener.hxx"
#include "PlayerControl.hxx"
#include "PlayerListener.hxx"
#include "Chrono.hxx"
#include "Compiler.h"
struct Instance;
class MultipleOutputs;
class SongLoader;
/**
* A partition of the Music Player Daemon. It is a separate unit with
* a playlist, a player, outputs etc.
*/
struct Partition {
struct Partition final : private PlayerListener, private MixerListener {
Instance &instance;
struct playlist playlist;
MultipleOutputs outputs;
PlayerControl pc;
Partition(Instance &_instance,
@@ -41,21 +50,17 @@ struct Partition {
unsigned buffer_chunks,
unsigned buffered_before_play)
:instance(_instance), playlist(max_length),
pc(buffer_chunks, buffered_before_play) {
}
outputs(*this),
pc(*this, outputs, buffer_chunks, buffered_before_play) {}
void ClearQueue() {
playlist.Clear(pc);
}
PlaylistResult AppendFile(const char *path_utf8,
unsigned *added_id=nullptr) {
return playlist.AppendFile(pc, path_utf8, added_id);
}
PlaylistResult AppendURI(const char *uri_utf8,
unsigned *added_id=nullptr) {
return playlist.AppendURI(pc, uri_utf8, added_id);
unsigned AppendURI(const SongLoader &loader,
const char *uri_utf8,
Error &error) {
return playlist.AppendURI(pc, loader, uri_utf8, error);
}
PlaylistResult DeletePosition(unsigned position) {
@@ -76,10 +81,14 @@ struct Partition {
return playlist.DeleteRange(pc, start, end);
}
void DeleteSong(const Song &song) {
playlist.DeleteSong(pc, song);
#ifdef ENABLE_DATABASE
void DeleteSong(const char *uri) {
playlist.DeleteSong(pc, uri);
}
#endif
void Shuffle(unsigned start, unsigned end) {
playlist.Shuffle(pc, start, end);
}
@@ -134,15 +143,15 @@ struct Partition {
}
PlaylistResult SeekSongPosition(unsigned song_position,
float seek_time) {
SongTime seek_time) {
return playlist.SeekSongPosition(pc, song_position, seek_time);
}
PlaylistResult SeekSongId(unsigned song_id, float seek_time) {
PlaylistResult SeekSongId(unsigned song_id, SongTime seek_time) {
return playlist.SeekSongId(pc, song_id, seek_time);
}
PlaylistResult SeekCurrent(float seek_time, bool relative) {
PlaylistResult SeekCurrent(SignedSongTime seek_time, bool relative) {
return playlist.SeekCurrent(pc, seek_time, relative);
}
@@ -166,11 +175,13 @@ struct Partition {
playlist.SetConsume(new_value);
}
#ifdef ENABLE_DATABASE
/**
* The database has been modified. Propagate the change to
* all subsystems.
*/
void DatabaseModified();
void DatabaseModified(const Database &db);
#endif
/**
* A tag in the play queue has been modified by the player
@@ -182,6 +193,14 @@ struct Partition {
* Synchronize the player with the play queue.
*/
void SyncWithPlayer();
private:
/* virtual methods from class PlayerListener */
virtual void OnPlayerSync() override;
virtual void OnPlayerTagModified() override;
/* virtual methods from class MixerListener */
virtual void OnMixerVolumeChanged(Mixer &mixer, int volume) override;
};
#endif

Some files were not shown because too many files have changed in this diff Show More