Max Kellermann
2240327286
ReplayGainInfo: move to tag/
2021-12-06 09:28:36 +01:00
Rosen Penev
4e276256c0
more braced init list conversion
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-12-06 09:16:04 +01:00
Max Kellermann
866e7ff3ce
config/PlayerConfig: move code to functions
2021-12-06 09:14:36 +01:00
Max Kellermann
2cafbb2aba
player/CrossFade: move code to CanCrossFade()
2021-12-03 23:45:34 +01:00
Max Kellermann
b78c64376f
player/Thread: move code to CheckCrossFade()
2021-12-03 23:32:41 +01:00
Max Kellermann
2518612b1b
player/CrossFade: add method IsMixRampEnabled()
2021-12-03 23:22:55 +01:00
Max Kellermann
dda521a150
ReplayGain{Config,Global}: move to config/
2021-12-03 23:08:16 +01:00
Max Kellermann
95a155b10d
Partition: pass configuration as struct
2021-12-03 23:03:41 +01:00
Max Kellermann
4e9b88559b
SingleMode: convert "pure" to "const"
2021-12-03 16:09:34 +01:00
Max Kellermann
3452682a42
IcyMetaDataParser: move to tag/
2021-12-03 16:07:39 +01:00
Max Kellermann
9262b24504
AudioCompress: move to pcm/
2021-12-03 16:04:59 +01:00
Max Kellermann
a5fa43b526
fs/io: move to io/
2021-12-03 14:35:41 +01:00
Max Kellermann
8681a3d74c
replace TextFile references with LineReader
2021-12-03 14:22:56 +01:00
Max Kellermann
f9c4d88b12
fs/io/TextFile: add interface LineReader
2021-12-03 14:20:29 +01:00
Max Kellermann
799032505e
io/uring/Queue: add method RequireSubmitEntry()
...
Fixes assertion failure when the submit queue is empty.
2021-12-03 13:58:39 +01:00
Max Kellermann
c8f174ac92
io/uring/Operation: disallow copying
2021-12-03 13:52:04 +01:00
Max Kellermann
047e169f3e
util/BindMethod: merge MakeBind{Method,Function}Wrapper(), they are identical now
2021-12-03 13:51:56 +01:00
Max Kellermann
687327c9e8
util/BindMethod: merge structs {Method,Function}SignatureHelper into one
2021-12-03 13:51:56 +01:00
Max Kellermann
26dc37bd76
util/BindMethod: merge structs {Method,Function}WrapperGenerator into one
2021-12-03 13:51:55 +01:00
Max Kellermann
c693e4aa64
util/BindMethod: remove unused struct MethodWithSignature
2021-12-03 13:51:55 +01:00
Max Kellermann
acab731fef
util/BindMethod: simplify MakeBindFunctionWrapper()
2021-12-03 13:51:55 +01:00
Max Kellermann
7e4ba3cb72
util/BindMethod: add MethodSignatureHelper::function_pointer
2021-12-03 13:51:55 +01:00
Max Kellermann
172c4d9c7d
util/BindMethod: remove unnecessary template arguments from BindMethodWrapperGenerator
2021-12-03 13:51:55 +01:00
Max Kellermann
bd5f6cbc7b
util/BindMethod: simplify more templates using "auto" template arguments
2021-12-03 13:51:55 +01:00
Max Kellermann
6fcd1c734b
util/BindMethod: eliminate struct BindMethodWrapperGenerator2
2021-12-03 13:51:55 +01:00
Max Kellermann
eca097dbfb
util/BindMethod: simplify more templates using "auto" template arguments
2021-12-03 13:51:55 +01:00
Max Kellermann
51ffafa011
util/BindMethod: use std::remove_reference_t
2021-12-03 13:51:25 +01:00
Max Kellermann
8dca602346
util/BindMethod: simplify BindMethod()
2021-12-03 13:51:18 +01:00
Max Kellermann
0ed24f3a05
util/IntrusiveList: disallow copying IntrusiveListHook
2021-12-03 13:50:05 +01:00
Max Kellermann
1c69913eca
decoder/flac: submit MixRamp only if there is actual data
2021-12-01 17:58:51 +01:00
Max Kellermann
cb5c6259fd
decoder/mad: submit MixRamp only if there is actual data
...
Fixes MixRamp failures when a MP3 file has two ID3 tags, one of them
without MixRamp.
2021-12-01 17:19:53 +01:00
Max Kellermann
bf287fefb5
decoder/mad: move parse_id3_mixramp() to tag/Id3MixRamp.cxx
2021-12-01 17:11:36 +01:00
Max Kellermann
20bf1d68e6
MixRampInfo: move to tag/
2021-12-01 17:09:02 +01:00
Max Kellermann
9bc4c168fd
tag/MixRamp: rename to MixRampParser.cxx
2021-12-01 17:07:53 +01:00
Max Kellermann
a45949b597
tag/MixRamp: [[gnu::...]] attributes
2021-12-01 15:48:33 +01:00
Max Kellermann
6009d4abab
tag/MixRamp: use std::string_view
2021-12-01 15:47:54 +01:00
Max Kellermann
16fb843c9b
tag/MixRamp: fix typo which broken MixRamp
...
Fixes regression by commit 8e0d810968
which is 2 years old, and nobody
noticed. D'oh, how embarassing!
2021-12-01 15:46:31 +01:00
Max Kellermann
933a1a41e6
lib/upnp/Discovery: use InjectEvent instead of DeferEvent
...
Fixes regression by commit 774b4313f2
2021-11-30 18:03:27 +01:00
August2111
1ff8626716
MSVC util/StringAPI.hxx add usage of MSVC compiler
2021-11-26 17:30:17 +01:00
Max Kellermann
c30466b84a
net/IPv4Address: add method GetPortBE()
2021-11-26 16:25:43 +01:00
Max Kellermann
868f1a4431
net/UniqueSocketDescriptor, ...: include <utility> instead of <algorithm>
...
Since C++11, std::swap() lives in <utility>.
2021-11-26 16:25:29 +01:00
Max Kellermann
05f529fffd
util/StringStrip: use [[gnu::...]] attributes
2021-11-26 16:24:55 +01:00
Rosen Penev
f22cf02ed8
fix wrong namespace name
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-26 08:08:45 +01:00
Rosen Penev
5b51d0f733
use some auto
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-26 08:08:45 +01:00
Rosen Penev
e03f82636a
const reference conversion
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-23 12:33:03 -08:00
Rosen Penev
d53d85bd79
remove unused includes
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-23 12:33:03 -08:00
Max Kellermann
4682ae0898
command/database: support relative offsets for "searchadd"
...
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1337
2021-11-23 12:17:32 +01:00
Max Kellermann
6f83bdd6f3
Merge branch '1' of git://github.com/neheb/MPD
2021-11-23 10:39:07 +01:00
Rosen Penev
9bcd425a85
array conversions
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-23 01:38:10 -08:00
Max Kellermann
ec917f70d2
Merge remote-tracking branches 'neheb/2' and 'neheb/3'
2021-11-23 09:23:43 +01:00
Rosen Penev
40ce4eeb43
use cinttypes header
...
stdint.h is deprecated.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:30:36 -08:00
Rosen Penev
29ae84e199
manual braced init
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:30:04 -08:00
Rosen Penev
250011f016
return by braced init list
...
shorter
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-22 23:28:08 -08:00
Max Kellermann
dcb5ca203c
db/DatabasePlaylist: increment only one variable
...
Fixes "searchaddpl" bug emitting bogus error "Bad position".
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1338
2021-11-22 20:47:34 +01:00
Max Kellermann
77df5a8f24
lib/pcre: migrate to PCRE2
...
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1352
2021-11-22 19:32:45 +01:00
Max Kellermann
f74996c02f
Merge remote-tracking branches 'neheb/1', 'neheb/2', 'neheb/3', 'neheb/4' and 'neheb/5'
2021-11-20 07:55:24 +01:00
Max Kellermann
eea2d35d3a
util/AllocatedString, ...: add missing include for std::exchange()
...
Fixes building with GCC 12.
2021-11-19 16:06:20 +01:00
Max Kellermann
d94e8bd82d
queue/IdTable: include cleanup
2021-11-19 16:03:09 +01:00
Max Kellermann
b0c92e1a34
queue/IdTable: lazy-initialize the "data" array
...
With large "max_playlist_length" settings, the "data" array can be
very large, and initializing it during MPD startup causes page faults,
resulting in allocation of physical RAM. This commit postpones the
initialization until the queue is really large, to avoid wasting
memory.
2021-11-19 16:00:39 +01:00
Max Kellermann
ead5bcf048
queue/IdTable: make size const
2021-11-19 15:51:10 +01:00
Shen-Ta Hsieh
e783c2bd2c
util/LazyRandomEngine: use std::optional to avoid allocation
...
Signed-off-by: Shen-Ta Hsieh <ibmibmibm.tw@gmail.com>
2021-11-14 03:53:42 +08:00
Rosen Penev
837fc98638
use const references
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:18:33 -08:00
Rosen Penev
5deca66fdc
add various nodiscard
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:17:26 -08:00
Rosen Penev
cfe2dd4147
use nullptr
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:16:19 -08:00
Rosen Penev
00f8d65a17
remove std::move
...
clang-tidy reports this is trivially copyable and thus std::move has no
effect.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:15:21 -08:00
Rosen Penev
4e0e4c00bf
treewide: replace lock_guard with scoped_lock
...
SonarLint reports the latter to be better:
std::scoped_lock basically provides the same feature as std::lock_guard,
but is more generic: It can lock several mutexes at the same time, with a
deadlock prevention mechanism (see {rule:cpp:S5524}). The equivalent code
to perform simultaneous locking with std::lock_guard is significantly more
complex. Therefore, it is simpler to use std::scoped_lock all the time,
even when locking only one mutex (there will be no performance impact).
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 17:13:03 -08:00
Max Kellermann
a8c77a6fba
Merge branch '1' of git://github.com/neheb/MPD
2021-11-11 10:33:17 +01:00
Rosen Penev
31aa6d0c4f
use auto with make_unique
...
C arrays can be used with make_unique in C++17.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 01:33:03 -08:00
Max Kellermann
d051c4931d
Merge branch '2' of git://github.com/neheb/MPD
2021-11-11 10:32:45 +01:00
Rosen Penev
94b0baceb0
convert address_family_ranking to std::array
...
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-11 01:27:31 -08:00
Max Kellermann
3464497880
command/database: add optional position parameter to "searchaddpl"
...
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1328
2021-11-11 09:52:49 +01:00
Max Kellermann
651f57bced
command/playlist: save only if at least one song was added
2021-11-11 09:50:31 +01:00
Max Kellermann
b4e72aba6c
command/playlist: move code to SearchInsertIntoPlaylist()
2021-11-11 09:40:41 +01:00
0xC0ncord
061dd2dfef
output/plugins: fix build error with clang and -stdlib=libc++
...
This fixes this build error observed with clang and -stdlib=libc++:
../mpd-0.23.3/src/output/plugins/PipeWireOutputPlugin.cxx:661:55: error: implicit instantiation of undefined template 'std::array<std::byte, 64>'
std::array<std::byte, MAX_CHANNELS * MAX_INTERLEAVE> buffer;
^
/usr/include/c++/v1/__tuple:219:64: note: template is declared here
template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array;
^
2021-11-10 15:35:56 -05:00
Max Kellermann
5f4ec7de5b
decoder/ffmpeg, lib/ffmpeg: make AVCodec pointers "const"
...
For libavcodec 59 support.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1333
2021-11-09 21:09:14 +01:00
Max Audron
6f81bb4b09
upnp: add option to configure interface for db plugin
...
Add an option to the UPnP database plugin to configure which interface
is used by upnp to discover servers.
upnp by default selects the first interface that is not loopback, which
in some cases might not be the desired interface. For example if wanting
to access a DLNA server over a VPN connection.
The "interface" option can now be set to the name of the desired
interface to achieve this.
The default behaviour remains unchanged.
2021-11-08 23:04:07 +01:00
Max Audron
4ed60a5711
upnp: expose interface configuration on UpnpInit2()
...
Adds the Interface Name as an argument to the *Init functions to make it
possible to select which interface is used by upnp to detect servers.
Currently "nullptr" is passed in to let the upnp library select an
interface, as before.
2021-11-08 22:53:01 +01:00
Max Kellermann
a4e4217204
Main: ignore the "pid_file" setting if started as systemd service
...
Commit 552c30eae
caused problems for those people who still had a
"pid_file" setting (even though that is obsolete with systemd),
because now /run/mpd is owned by root:root (our mpd.service has no
User=mpd directive, so systemd starts MPD as root).
To work around this problem, and to be able to keep
RuntimeDirectory=mpd (which solved a problem of other MPD users), the
best compromise seems to just ignore the "pid_file" setting when it is
of no use.
2021-11-05 09:02:56 +01:00
Max Kellermann
8754d705a1
CommandLine: rename struct options
2021-11-05 08:57:12 +01:00
Max Kellermann
23d4a2d6a5
Main: pass struct options by reference
2021-11-05 08:56:05 +01:00
Max Kellermann
ce77b148d9
CommandLine: add option --systemd
...
This way, MPD can reliably detect whether it was started as systemd
service, which is better than checking sd_booted(), which only checks
whether systemd manages all services, but still MPD could be started
manually.
2021-11-05 08:51:49 +01:00
Max Kellermann
3413b1aeb4
output/alsa: add option thesycon_dsd_workaround
2021-11-04 17:55:53 +01:00
Max Kellermann
356d13e9dd
lib/alsa/HwSetup: add missing include
2021-11-04 17:55:15 +01:00
Max Kellermann
5d0941476a
lib/alsa/Error: a std::system_error category for libasound errors
2021-11-04 14:59:00 +01:00
Max Kellermann
5ff0bbd0f8
lib/fmt/AudioFormatFormatter: add formatter for SampleFormat
2021-11-04 14:55:01 +01:00
Max Kellermann
14b3c0f0af
event/Loop: destruct the Uring::Manager in the destructor before assert()
...
Fixes assertion failure when the EventLoop gets destructed before
Run() was ever called.
Fixes https://bugs.debian.org/998310
2021-11-03 18:32:14 +01:00
Max Kellermann
056514d598
output/snapcast: reset unflushed_input after successful read
...
With the "wave" encoder, this has no effect, but it's more correct.
2021-10-31 16:35:42 +01:00
Max Kellermann
9a21bdfd6a
output/snapcast: implement Pause()
...
This uncomments the code which had been present already in the first
Snapcast commit (copied from the "httpd" output plugin), but I
commented it because I did not know whether I needed to send silence
samples to all Snapcast clients.
As a side effect, this fixes playback when no Snapcast client is
connected; this was broken because Pause() always returned a positive
value when there were no clients.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1310
2021-10-31 16:26:29 +01:00
Max Kellermann
03f99dd26e
db/update/Walk: use GetFilenameSuffix() instead of uri_get_suffix()
...
Unlike GetFilenameSuffix(), uri_get_suffix() removes the query string
first, which breaks file names with question marks in the name.
Therefore, uri_get_suffix() shall only be applied to remote URIs.
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1316
2021-10-31 13:18:24 +01:00
Max Kellermann
bfb1b641f9
db/update/InotifyUpdate: fix use-after-free bug
...
Regression by commit 2d8847f428
2021-10-28 13:39:38 +02:00
Max Kellermann
dcd19c0592
config/Path: use StringView::Split()
2021-10-26 12:55:01 +02:00
Max Kellermann
109159e0f7
Permission: use StringView::Split()
2021-10-26 12:25:47 +02:00
Max Kellermann
409b877eea
output/ao: include cleanup
2021-10-26 12:20:18 +02:00
Max Kellermann
c5bf7948ff
fs/StandardDirectory: use the RUNTIME_DIRECTORY environment variable
2021-10-26 09:30:16 +02:00
Max Kellermann
b9f7127691
fs/StandardDirectory: add GetAppRuntimeDir()
2021-10-26 09:30:16 +02:00
Max Kellermann
1e6f5f012c
fs/StandardDirectory: add GetUserRuntimeDir()
2021-10-26 09:30:16 +02:00
Max Kellermann
225d85fd9b
fs/StandardDirectory: use "if" with initializer
2021-10-26 09:29:57 +02:00
Max Kellermann
1bb22f118d
fs/StandardDirectory: add more pure/const attributes
2021-10-26 09:04:20 +02:00
Max Kellermann
48e8a26813
command/playlist: allow range in playlistdelete
2021-10-25 12:23:37 +02:00
Max Kellermann
ade847bc89
PlaylistFile: fold spl_move_index() into handle_playlistmove()
2021-10-25 12:13:45 +02:00