Commit Graph

6631 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
a9e351e00d decoder/gme: fix memory leak in container_scan() 2014-03-06 13:12:39 +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
d34ae0850c AllCommands: "findadd" requires the "add" permission 2014-02-27 23:08:22 +01:00
Max Kellermann
6526de024a output/pulse: remove bogus g_free() call 2014-02-24 21:23:49 +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
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
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
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
fdd76b3461 decoder/faad: fix memory leak 2014-01-08 22:11:00 +01:00
Max Kellermann
e490e5d0ab playlist/pls: don't free stack buffer 2014-01-08 19:50:44 +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
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
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
Steven O'Brien
6b3b8c6f2e fix FfmpegDecoderPlugin to use relative timestamps 2013-12-20 22:28:33 +01:00
Max Kellermann
a191db84f2 util/Error: add missing <algorithm> include
For std::move().
2013-12-19 10:58:20 +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
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
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
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
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
47c50c079d decoder/ffmpeg: use IgnoreError instead of local Error instance 2013-11-28 00:05:26 +01:00
Gaetan Bisson
3b0fea5fae input/cdio_paranoia: support libcdio-paranoia 0.90 2013-11-27 08:25:17 +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
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
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
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
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
f33acf8758 input/cdio_paranoia: add setting "default_byte_order"
Allows big-endian users to configure the fallback byte order to
little-endian.  Without this setting, MPD assumes native byte order if
the CD drive can't decide.
2013-11-07 18:17:54 +01:00
Max Kellermann
a846a4c643 AvahiPoll: don't close the dbus socket
Avoid closing it twice.
2013-11-07 01:10:07 +01:00
Max Kellermann
899c2bb9cc input/curl: unregister removed sockets from epoll
Fixes a crash bug.  See code comment.
2013-11-07 01:10:07 +01:00
Max Kellermann
f8f95e2dbd OutputControl: reduce the number of OutputThread wakeups
Wake up the OutputThread only if it hasn't already been woken up and
if it isn't already in the playback loop.
2013-11-06 23:51:17 +01:00
Max Kellermann
77c63511d8 PlayerThread: reduce the number of DecoderThread wakeups
After the number of decoded chunks has fallen below the threshold, the
PlayerThread woke up the DecoderThread over and over.  This commit
adds a boolean flag that avoids these duplicate wakeups, and thus
reduces the number of system calls.
2013-11-06 23:51:17 +01:00
Max Kellermann
0be5a6ab2b DecoderControl: reduce the number of PlayerThread wakeups
Wake up the PlayerThread only if it is really waiting for the decoder.
This greatly reduces the number of system calls in the DecoderThread.
2013-11-06 23:51:17 +01:00
Max Kellermann
9802e74859 DecoderInternal: lock DecoderControl in _flush_chunk()
Must hold the Mutex to signal the Cond object safely.
2013-11-06 23:51:17 +01:00
Max Kellermann
8e7d6eb151 DecoderInternal: wake up the player thread in _flush_chunk()
Merge duplicate code.
2013-11-06 23:51:17 +01:00
Max Kellermann
5c18e4f114 event/FullyBufferedSocket: remove obsolete TODO comment
We have a better solution now.
2013-11-06 23:50:36 +01:00