Commit Graph

14200 Commits

Author SHA1 Message Date
Max Kellermann
1714cf3417 input/CdioParanoia: use IsEof() in Read() 2022-07-08 12:42:42 +02:00
Max Kellermann
1080c917be input/CdioParanoia: use std::min() 2022-07-08 12:37:21 +02:00
Max Kellermann
8eb3164878 input/CdioParanoia: fix crash if no drive was found
cdio_get_devices_with_cap() can return nullptr if no drive was found,
or it can instead return an empty list.  The latter caused MPD to
crash.
2022-07-08 12:05:20 +02:00
Max Kellermann
915c5442d1 input/CdioParanoia: use AtScopeExit() for cdio_free_device_list() 2022-07-08 12:03:57 +02:00
Max Kellermann
4d6ae6ffdd output/PipeWire: add nullptr check to SetVolume()
If the PipeWire output has not yet been enabled and no thread_loop has
been created yet, a nullptr dereference in SetVolume() was possible
because nullptr was passed to pw_thread_loop_lock().
2022-07-08 11:32:59 +02:00
Max Kellermann
ecee6f415b mixer/MixerInternal: remember error details
If a mixer is not open, rethrow the original exception each time
setting the volume is requested.  This further improves error messages
sent to MPD clients.
2022-07-08 11:11:53 +02:00
Max Kellermann
47680f936b mixer/All: auto-open "global" mixers
If a mixer is "global", it is available even if the output isn't
open.  However, since the check was changed from IsEnabled() to
IsReallyEnabled(), enabled outputs have not yet been used have not
been "really" enabled yet, preventing using the mixer.

Fixes a regression by commit 35dbc1a90c
(part of https://github.com/MusicPlayerDaemon/MPD/pull/1480).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1563
2022-07-08 11:05:26 +02:00
Max Kellermann
2d7181105d output/MultipleOutputs: SetVolume() throws on error
This reveals more about the nature of an error instead of just
returning "problems setting volume".
2022-07-08 10:56:55 +02:00
Max Kellermann
9bdc75524b python/build/libs.py: update CURL to 7.84.0 2022-07-08 10:13:52 +02:00
Max Kellermann
138738075b libfmt 9 support
libfmt version 9 broke the API by removing fmt::make_args_checked().

Fixes https://bugs.debian.org/1014543
2022-07-08 10:06:53 +02:00
Max Kellermann
2ee57f9b0d output/PipeWire: add nullptr check, fixing crash with PipeWire 0.3.53
Since PipeWire 0.3.53, control names can apparently be nulled, leading
to crashes in applications assertion that the string cannot be
nullptr.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1558
2022-07-04 19:20:08 +02:00
Max Kellermann
5a5655b790 lib/curl/Adapter: catch and postpone exceptions in WriteFunction()
This fixes a std::terminate() crash in the CURL storage plugin when
PropfindOperation::OnHeaders() throws an exception after receiving a
non-207 status.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1559
2022-07-01 12:43:42 +02:00
Max Kellermann
b88d1e6820 lib/curl/Headers: make the comparison type "transparent" 2022-07-01 12:17:41 +02:00
Max Kellermann
19d2864c34 lib/curl/Headers: central type definition for the header map 2022-07-01 12:17:36 +02:00
Max Kellermann
29e3a17f26 lib/curl/Request: move code from SetupEasy() to Setup.cxx 2022-07-01 12:17:26 +02:00
Max Kellermann
252e9f736f lib/curl/Request: move code to class CurlResponseHandlerAdapter 2022-07-01 12:17:20 +02:00
Max Kellermann
5d08988dda lib/curl/Handler: fix typo 2022-07-01 12:17:17 +02:00
Max Kellermann
47ca4246aa lib/curl/Request: add constructor with CurlEasy parameter 2022-07-01 12:17:13 +02:00
Max Kellermann
f8338d4f00 lib/curl/Request: use std::size_t 2022-07-01 12:16:59 +02:00
Max Kellermann
5cf6032c90 lib/curl/Request: move code to SetupEasy() 2022-07-01 12:16:55 +02:00
Max Kellermann
8d8b77412d lib/curl/Request: add API docs 2022-07-01 12:16:50 +02:00
Dave Hocker
c975d8b943 Fix deprecation warnings caused by name changes in OSX audio inerfaces 2022-05-24 10:20:47 +02:00
Max Kellermann
8bd1b5228c lib/upnp/Compat: suppress -Wunused-but-set-parameter 2022-05-19 20:10:41 +02:00
Caleb Xu
c6f7f57776 apple/Throw: add missing <cstring> header
strlen() and strcpy() are provided by the <string.h> and <cstring>
headers (as functions in global and std namespaces, respectively).

Compilers MAY provide an implementation for either of the functions
without including the extra header but the existence of a declaration
without the header is not assured.
2022-05-19 09:08:44 +02:00
Max Kellermann
b175e4128d encoder/meson.build: always generate encoder/Features.h
Fixes regression from commit 85f9863e0a
2022-05-09 22:52:59 +02:00
BurroCargado
11d1f56062 Fix seeking HLS on-demand streaming not working
This issue occurs when playing HLS streaming delivered
from a server that does not support partial requests.
The issue is reproduced as follows(using Ubuntu 20.04 PC):

1. Prepare HLS example content.

$ mkdir test
$ ffmpeg -i example.flac -vn -c:a aac -b:a 128000 -f hls -hls_list_size 0 test/output.m3u8
(ffmpeg 4.2.4 is used)

2. Prepare web server without partial requests support.
(Docker version 20.10.12 and NGINX official Docker image is used)

$ docker run --name tmp-nginx-container -d nginx
$ docker cp tmp-nginx-container:/etc/nginx/conf.d/default.conf .
$ docker rm -f tmp-nginx-container

Edit default.conf and add "max_ranges 0;" to "location / {...}".
This disables partial requests support,
removes 'Accept-Ranges: bytes' header from the server response.
Then, run the server:

$ docker run --name test-nginx -v $PWD/test:/usr/share/nginx/html:ro -v $PWD/default.conf:/etc/nginx/conf.d/default.conf -d -p 8080:80 nginx

3. Setup MPD to Play the next URL.

http://address-of-the-server:8080/output.m3u8

Seeking this stream results in "exception: Not seekable".
2022-05-07 12:18:56 +09:00
BurroCargado
bd840d4638 decoder/plugins/FFmpegDecoder: fix IsSeekable()
AVFMTCTX_UNSEEKABLE signals the stream is not seekable
according to FFmpeg source code description:
8e98dfc57f/libavformat/avformat.h (L1181)
2022-05-07 09:48:04 +09:00
Max Kellermann
c3d393f214 tag/Id3Picture: fix unaligned access 2022-04-26 21:03:48 +02:00
Max Kellermann
f88fc0ca1a util/ByteOrder: add class PackedBE32 2022-04-26 21:03:05 +02:00
Max Kellermann
fb8d8242ab tag/ApeLoader: fix unaligned access
Fixes part 4 of https://github.com/MusicPlayerDaemon/MPD/issues/1490
2022-04-26 21:00:41 +02:00
Max Kellermann
f2a3dfd700 decoder/ffmpeg: add missing nullptr checks
Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1490
2022-04-26 20:51:57 +02:00
Max Kellermann
85f9863e0a meson.build: always enable Wave encoder for Snapcast
Even if the "wave_encoder" option is disabled (and no other encoder
plugins are enabled), forcefully enable the Wave encoder (if Snapcast
is enabled).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1500
2022-04-26 20:13:43 +02:00
Max Kellermann
9659d19718 lib/upnp/Init: use if with initalizer 2022-04-26 17:58:33 +02:00
Rosen Penev
50d35c9677 upnp: use UpnpInit2 always
libupnp 1.14 removes the non 2 function. Fixes compilation there.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1499
2022-04-26 17:57:48 +02:00
Arsen Arsenović
35dbc1a90c mixer,output: prevent setting volume before outputs are really enabled
Previous versions of MPD would call SetVolume on enabled outputs before
they are ready, causing all of MPD to crash. Checking the really_enabled
flag prevents this, though it also prevents setting volume before the
player starts.

Before (with the PipeWire output):
  [i] ~$ mpc clear
  volume: 81%   repeat: off   random: off   single: off   consume: off
  [i] ~$ systemctl --user restart mpd.service
  [i] ~$ mpc volume 100
  MPD error: Connection closed by the server
  [i] ~ 1 $

After:
  [i] ~$ # mpd is freshly started w/o anything in the queue
  [i] ~$ mpc
  volume:100%   repeat: off   random: off   single: off   consume: off
  [i] ~$ mpc volume 80
  MPD error: problems setting volume
  [i] ~ 1 $ mpc
  volume:100%   repeat: off   random: off   single: off   consume: off
  [i] ~$
2022-04-26 17:45:29 +02:00
Arsen Arsenović
c7a4355153 outputs/pipewire: fix ParamChanged incorrectly setting volume
Previous versions of MPD would, on parameter change, set the PipeWire
volume before clearing the restore_volume flag, causing the call to
short circuit and do nothing. Instead, clear the flag before the call.
2022-04-26 17:44:19 +02:00
Max Kellermann
33a84a8ca2 output/shout: use shout_set_metadata_utf8() 2022-04-26 17:41:21 +02:00
Max Kellermann
1d04490ed3 output/shout: use shout_set_content_format() 2022-04-26 17:38:43 +02:00
Max Kellermann
4a30c2d79c output/shout: use shout_set_meta() 2022-04-26 17:24:49 +02:00
Max Kellermann
83072d6b9c output/shout: pass reference to Setup() 2022-04-26 16:49:18 +02:00
Max Kellermann
c779fc37eb output/shout: declare minimum version 2.4.0
This version was released 7 years ago, and it's reasonable to require
at least this version.
2022-04-26 16:46:36 +02:00
Max Kellermann
e08c13ad7e output/shout: add "noexcept" 2022-04-26 15:57:03 +02:00
Max Kellermann
2c82a6b2e0 output/shout: handle shout_metadata_add() errors
Fixes -Wunused-result
2022-04-26 15:56:55 +02:00
Andreas Ziegler
ee39af3419
fix typo in comment 2022-04-24 04:14:17 +00:00
aeolio
3882a5a263 src/lib/icu: fix iconv() detection when libiconv is installed 2022-04-20 16:10:39 +02:00
Vitaly Ostrosablin
ac06088948 Make volume changes to apply to disabled software mixers.
Move audio output state check ahead of mixer check and force volume
applying even for disabled software mixed outputs.

This fixes incorrect software mixer volume that used to occur when
volume was changed while output being disabled.

This is easily reproduced with following sequence of commands on
multi-output software mixed MPD setup.

 mpc volume 38; mpc disable 3; mpc volume 88; mpc enable 3

On current MPD, following commands would result in output 3 playing at
volume 38, while all other enabled outputs would play at volume
88. Moreover, global volume would display average of outputs real
volumes. In my case, it's 75.

After applying this patch, following commands would produce expected
behavior. All outputs play at expected (88) volume. And volume is
correctly displayed as 88.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1423

Signed-off-by: Vitaly Ostrosablin tmp6154@yandex.ru


Signed-off-by: Vitaly Ostrosablin <tmp6154@yandex.ru>
2022-03-26 06:29:18 +01:00
Max Kellermann
a757eebfbb decoder/OggSyncState: allow skipping up to 64 kB after seek
This is more of what we did in commit 70bd35abe2 because it turns
out there are Ogg-Opus files with pages larger than 40 kB.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1487
2022-03-16 16:54:50 +01:00
Max Kellermann
2aed7378cc TagAny: support CUE tracks
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1482
2022-03-14 18:42:31 +01:00
Max Kellermann
71cd6e6248 lib/xiph/meson.build: define FLAC__NO_DLL for static libFLAC build (Windows)
In libFLAC 0.3.4 (commit c9530118a4), the "dllimport" check has been
changed from "_MSC_VER" to "_WIN32", and now the MPD build is affected
by it.

Defining FLAC__NO_DLL disables the use of "dllimport", which allows
linking properly to the static libFLAC build.
2022-03-14 15:08:59 +01:00
Max Kellermann
603bbe0afd python/build/libs.py: update libnfs to 5.0.1 2022-03-14 14:52:24 +01:00
Richard Schorrig
aeaef85507 WasapiOutputPlugin pause bug fix
Wasapi output plugin won't start playing after being paused

The cause is that the scope guard in the WASAPI work thread
(WasapiOutputPlugin.cxx, function WasapiOutputThread::Work(), in the
while (true) loop) is set up too 'late' in the execution. There is one
condition ("if (data_in_frames >= buffer_size_in_frames)") when it is
hit, the loop will continue without executing the scope guard. This
scope guard is responsible for emptying the buffer again, and if the
buffer is not emptied, the above mentioned condition will stay true.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1451
2022-03-14 14:26:00 +01:00
nick black
ebae25d175 plugins/FfmpegIO: include libavutil/mem.h
ffmpeg from current git master no longer exposes
av_malloc() nor av_free() through other included
headers. directly include libavutil/mem.h to fix
compilation with (as-yet-unreleased) ffmpeg.
2022-03-14 14:11:31 +01:00
jcorporation
5ad1a01d7a Remove bmp, tiff and add webp for coverimage filenames
- supporting bmp and tiff seems outdated
- webp is more widely used for coverimages
2022-03-14 14:09:23 +01:00
Max Kellermann
8f84e1befd decoder/plugins/FfmpegIo: return AVERROR_EOF at end of file
This part of the AVIOContext API is not documented :-(

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1448
2022-03-14 14:00:28 +01:00
Max Kellermann
9975905faf output/PipeWire: initialize field "stream" in Open()
Must be initialized for the check in SetVolume().
2022-03-09 14:29:46 +01:00
Max Kellermann
86e9ed5f3a decoder/opus: fix "readpicture" on Opus files
Don't return early from ScanOpusTags() if only
TagHandler::WantPicture() is set.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1413
2022-01-26 14:43:45 +01:00
aeolio
3856224df9 lib/alsa/Error: add missing #include 2021-12-15 11:14:38 +01:00
aeolio
6d4bedfc56 lib/alsa/Error: fix typo 2021-12-15 11:14:34 +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
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