Commit Graph

988 Commits

Author SHA1 Message Date
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
Max Kellermann
407fa2720a release v0.23.6
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmIvgaMQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEpzhEACOJOyOjtmeuu7Uc147O4YzL/7g5PEZMKHI
 yB/H2QOWnbgAKh+8AFT2YudR89mIXslfuIILRg8/NYkEFgNCrkBQETWsATPyqrCr
 rYJxPtjlC2fAlKkl9XM+qL1WMATIhvRVD9SZajZKwa+9H1y5mZGlMBWdzdxaJoUY
 bhlu7fYvyRMXsStUncyYfsKsuHyibq3d4Pk/jegZhJeMI9/MOKdjc9GJE6Rzz0cT
 dWGqpfBJ/WMZ9aKXB3fh7WVtiIl/hr/5K1QizL10pwmJ5o/LBNKk7eEREbPUvNc6
 S5BHBOyVYaqVTGZyaoF9XkMKv7qnKYNoD2g2H+J5cN87rMRI8DzY/MqUxmX0bCGc
 jOQinMcQuL7zMvYx0ypKdTiMas2OG/RlKluOgzhNIvzkWYCxh9iCozm7Wl3qsvY5
 uJEsaeIb/zgSmUC2637ltBE37lW/8m7RYWpuq82M2CnFx9oL6W3ah8SMm5ToBzYB
 jHrN7h+YcKoIrFcZsYVTCbLzGQnQ2kmzsyGecDeCK9aP16gTkALZdpexn0oIzEKv
 fNtNSU7MgYXLs0knrcBoQw0nQnH9ICuswqFiyr4jcFfqxbIw9mvHyLRIWnyhL9zj
 XiYEr3SqnuVnmuLSgHlYk6g4zpYFLJEHo+/7IlEqTItXeAcsIhjn6B/NDyKVvYQa
 Pfb1ORoumQ==
 =jMu8
 -----END PGP SIGNATURE-----

Merge tag 'v0.23.6'

release v0.23.6
2022-03-14 18:58:47 +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
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
be72d45356 output/httpd: add config option "dscp"
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1401
2022-01-11 20:31:52 +01:00
Max Kellermann
d79bf853b1 output/httpd: make configuration fields const 2022-01-10 22:59:50 +01:00
Max Kellermann
a5fa43b526 fs/io: move to io/ 2021-12-03 14:35:41 +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
9bcd425a85 array conversions
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-11-23 01:38:10 -08: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
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
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
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
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
3413b1aeb4 output/alsa: add option thesycon_dsd_workaround 2021-11-04 17:55:53 +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
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
409b877eea output/ao: include cleanup 2021-10-26 12:20:18 +02:00
Max Kellermann
c8121176b3 output/alsa: add option "stop_dsd_silence" to work around DSD DAC noise 2021-10-23 12:25:32 +02:00
Max Kellermann
bf1d77a4d8 output/alsa: un-inline several methods 2021-10-23 12:02:27 +02:00
Max Kellermann
b8890726f2 lib/alsa/AllowedFormat: use std::string_view 2021-10-23 11:42:30 +02:00
Max Kellermann
0f84332654 output/alsa: make "mode" const 2021-10-23 11:39:59 +02:00
Max Kellermann
b8e0855ef3 output/pipewire: obey PipeWire's DSD bit order and interleave
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1297
2021-10-21 21:15:16 +02:00
Max Kellermann
6467502b9d output/pipewire: restore SampleFormat::DSD after ToPipeWireAudioFormat() call 2021-10-21 21:15:13 +02:00
Max Kellermann
15b67f20e5 output/pipewire: un-inline ParamChanged() 2021-10-21 20:11:22 +02:00
Max Kellermann
0825179f00 output/pipewire: add local reference variables 2021-10-21 20:02:59 +02:00
Max Kellermann
97211d0aad output/pipewire: rename field "buffer" to "pod_buffer" 2021-10-21 20:02:32 +02:00
Max Kellermann
029c499bfa output/pipewire: use std::fill_n() 2021-10-21 20:01:44 +02:00
Max Kellermann
0ba867ec16 output/pipewire: use MAX_CHANNELS, not SPA_AUDIO_MAX_CHANNELS
MPD supports only 8 channels, so MAX_CHANNELS is enough, the array
doens't need to be SPA_AUDIO_MAX_CHANNELS (which is 64).
2021-10-21 20:01:01 +02:00
Max Kellermann
866d147122 output/pipewire: make field "channels" unsigned 2021-10-21 19:59:48 +02:00
Max Kellermann
32851d1bc7 output/pipewire: DSD support
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1297
2021-10-20 11:39:54 +02:00
Max Kellermann
78257408b4 output/pipewire: report errors from the "state_changed" callback 2021-10-20 11:24:57 +02:00
Max Kellermann
f447b7615e output/pipewire: check pw_stream_connect() errors 2021-10-20 11:24:51 +02:00
Max Kellermann
04bf8a6b1a output/pipewire: fix memory leak in SendTag() 2021-10-20 10:16:36 +02:00
Max Kellermann
c4c64854d4 output/pipewire: evaluate errno after libpipewire function calls 2021-10-20 10:13:27 +02:00
Max Kellermann
17562dc90b output/pipewire: remove misplaced noexcept 2021-10-20 09:41:27 +02:00
Max Kellermann
7b24316734 output/pipewire: fix coding style 2021-10-20 09:41:10 +02:00
Max Kellermann
eb111a10e7 output/pipewire: remove redundant prefix and newline from log message 2021-10-19 14:38:37 +02:00
Nicolai Syvertsen
5ccf78855d Implement SendTag for PipeWire output plugin 2021-10-19 14:31:40 +02:00
Max Kellermann
070c03dbf7 event/Thread, ...: fix printf->libfmt remains 2021-10-19 13:19:07 +02:00
Max Kellermann
aa9933c0b5 output/pipewire: add noexcept 2021-10-19 08:58:50 +02:00
Max Kellermann
0697d1f859 output/pipewire: include cleanup 2021-10-19 08:57:33 +02:00
Nicolai Syvertsen
b941a7df83 Implement volume updates for pipewire output 2021-10-19 00:01:45 +02:00
Max Kellermann
d5be8c74b0 output/pipewire: attempt to change the graph sample rate
Requires PipeWire 0.3.32.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1283
2021-10-18 16:46:23 +02:00
Max Kellermann
c112cb60da output/snapcast: fix typo which caused "Failed to get chunk"
This bug caused a 9 second offset in all time stamps.  Due to that,
the Snapcast server thought the chunks are too old and discarded them.

Fixes https://github.com/MusicPlayerDaemon/MPD/discussions/1287
2021-10-18 16:40:11 +02:00
Max Kellermann
e4eb5b79c9 output/shout: move shout_new() call to Enable()
Don't allocate any memory until the output is really enabled.
2021-10-14 12:28:36 +02:00
Max Kellermann
1cfea20b22 output/shout: remove the defunct "timeout" option
The implementation was removed 12 years ago in commit f6455d5f79 and
nobody missed it.
2021-10-14 12:04:13 +02:00
Max Kellermann
72f6e018e7 Log: remove the obsolete printf-style functions 2021-10-13 17:41:19 +02:00
Max Kellermann
57a1403f08 output/pipewire: implement Delay(), fix busy loop while paused
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1265
2021-09-24 11:33:35 +02:00
Max Kellermann
bad3283182 output/pipewire: add flag "active", replaces some uses of "paused"
This way, we know whether we're explicitly "paused" or "not yet
activated because the ring buffer hasn't been filled yet".
2021-09-24 11:33:30 +02:00
Rosen Penev
40483d8478 fix wrong emplace usage
emplace already calls std::pair. No need for it again.

No need to emplace when calling std::make_shared.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-09-07 21:14:37 -07:00
Rosen Penev
6ec5089cc9 remove std::make_pair
make_pair is an old C++98 function that can be replaced by modern
shorter constructs.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-09-07 21:13:22 -07:00
Rosen Penev
20d74bb07e clang-tidy: replace loop with std::all_of
Found with readability-use-anyofallof

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-08-21 00:49:36 -07:00
Max Kellermann
f3d67115d7 output/wasapi: check ENABLE_DSD before setting dsd_mode 2021-08-10 15:00:58 +02:00
Max Kellermann
0dacde32f2 output/pipewire: append output name to PW node name 2021-08-10 11:30:25 +02:00
Max Kellermann
528e05f025 output/pipewire: add config option "remote" 2021-08-10 11:28:29 +02:00
Max Kellermann
269583f5dd output/pipewire: allow specifying a target by its name 2021-08-10 11:17:16 +02:00
Max Kellermann
7c9f4f7e4f output/pipewire: create inactive stream, fill ring_buffer first
This avoids underruns at the start of playback.
2021-08-10 10:50:42 +02:00
Max Kellermann
00fd692eba output/pipewire: wait for buffer to fill before resuming 2021-08-10 10:48:25 +02:00
Max Kellermann
668c3782b2 output/pipewire: smaller ring buffer, 500ms should be enough 2021-08-10 10:43:56 +02:00
Max Kellermann
1e0af2dadf output/pipewire: add type alias for boost::lockfree::spsc_queue 2021-08-10 10:43:54 +02:00
Max Kellermann
4ea2ea2a52 output/pipewire: update nbytes after calling PcmSilence()
This was missing in commit 8a243e6e28
2021-08-10 10:43:28 +02:00
Max Kellermann
8a243e6e28 output/pipewire: call pw_stream_flush() only if really draining
If draining was not requested, generate silence instead if there is no
data in the ring buffer.

The problem is that pw_stream_flush() appears to disable the stream
permanently, even though there is no state_changed callback - the
stream state remains at PW_STREAM_STATE_STREAMING, but the stream is
defunct.  I have no idea why and I havn't found any documentation
about it.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1219
2021-08-10 06:30:58 +02:00
Max Kellermann
d33aa01000 output/pipewire: reset the "paused" flag
This was missing in commit 4d1ce7023b
2021-08-09 19:31:22 +02:00
Constantin Fuerst
955502f881 output/oss: enable DoP
Explanation

This adds support for DOP using the PcmExport function if the macro
ENABLE_DSD is defined. If enabled within the config-file using "dop",
the boolean dop_setting will be true. If DSD input is encountered and
the setting is on, it is checked whether the oss-device supports the
required samplerate. If that is the case, dop_active is set to true
and conversion of the input is prevented. If the sample rate is not
supported, conversion to S32 is requested. When playing back, the
PcmExport is used to pack the incoming stream into PCM.  Reasoning

This is required for OSs without the required driver support for
native DSD playback that also have no ALSA. Mainly *BSD users are the
target audience for this functionality, as ALSA here is only a proxy
without full functionality.  Requirements

    DAC that supports the DOP standard
    Building with OSS, DSD and S32-Format

Supported Formats / Required PCM Formats

DSF, DFF and WavPack-DSD will work.

DSD64, 1 Channel -> S24:176.4kHz (untested, lack of time / missing samples)
DSD64, 2 Channel -> S24:352.8kHz
DSD64, 4 Channel -> S24:705.6kHz (untested, lmissing equipment)
DSD128, 1 Channel -> S24:352.8kHz (untested, lack of time / missing samples)
DSD128, 2 Channel -> S24:705.6kHz
DSD256, 1 Channel -> S24:705.6kHz (untested, lack of time / missing samples)
Changes

    inclusion of required files
    adding new domain for logging
    adding dop_satisfied private function
    adding required member variables for storing dop state and for dop-packing
    adding dop boolean parameter to many functions that are required to act a little differently when dop is active

Testing

This has been tested to work with a Sabaj Da2 on FreeBSD, where the
red status indicator LED clearly shows that DSD playback is taking
place, instead of purple for "hi-res" which is seen when converting.
Issues

I have not tested this with S24 and right now AFMT_S32_NE is
required. If not defined, ENABLE_DSD will be undef'ed. This will be
addressed in a bit, however no DAC which supports DOP but not 32Bit is
known to me. Also, AFMT_S32_NE is not defined when building on FreeBSD
which is why this is just blatantly defined in the file at the moment.
Additionally, the new dop-option is not added into any documentation
whatsoever.
2021-08-05 16:21:43 +02:00
Max Kellermann
dee5d1b87b output/oss: replace the AudioFormat field with 3 raw OSS integers
This simplifies Reopen().
2021-08-05 16:03:53 +02:00
Max Kellermann
d42342e0ba output/oss: check returned value in oss_try_ioctl() 2021-08-05 15:53:30 +02:00
Max Kellermann
8da3f8c6a7 output/oss: oss_try_ioctl() throws on EINVAL
Eliminate some duplicate code.
2021-08-05 15:47:11 +02:00
Max Kellermann
c97aabe43a Merge branch 'v0.22.x' 2021-08-05 15:17:07 +02:00
Max Kellermann
17b0ac75ca output/oss: always enable PcmExport for alsa_channel_order
We need this even when AFMT_S24_PACKED is not available, for the
correct channel order in multi-channel files.  Internally, MPD uses
FLAC channel order, but OSS uses the same channel order as ALSA.
2021-08-05 15:11:54 +02:00
Max Kellermann
b77acd35f7 output/winmm: fix struct/class mismatch 2021-08-05 11:40:47 +02:00
Max Kellermann
968624035c mixer/pipewire: new plugin 2021-08-05 10:57:37 +02:00
Max Kellermann
b838bf3109 output/pipewire: un-inline StateChanged() 2021-08-05 10:48:17 +02:00
Max Kellermann
4d1ce7023b output/pipewire: implement Pause() 2021-08-04 17:26:54 +02:00
Max Kellermann
52577ac87a output/pipewire: implement Cancel() properly 2021-08-04 17:24:49 +02:00
Max Kellermann
239698cb5a output/pipewire: set channel positions 2021-07-30 15:55:37 +02:00
Max Kellermann
e55de6e9f0 output/pipewire: implement Drain() 2021-07-30 15:28:01 +02:00
Max Kellermann
cfaf2ed03c output/pipewire: move code to CheckThrowError() 2021-07-30 15:24:20 +02:00
Max Kellermann
6015960871 output/pipewire: reset the "interrupted" flag in Cancel()
This fixes seeking.
2021-07-30 15:20:32 +02:00
Max Kellermann
26328cc915 output/pipewire: detect connection errors 2021-07-30 14:31:06 +02:00
Max Kellermann
cd512f0b40 output/pipewire: replace usleep() with with pw_thread_loop_wait() 2021-07-30 14:31:04 +02:00
Max Kellermann
be14dd59a8 output/pipewire: remove obsolete TODO comment 2021-07-30 13:50:55 +02:00
Max Kellermann
97e5787ff7 output/pipewire: call libpipewire only while holding the lock
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1210
2021-07-30 13:49:22 +02:00
Max Kellermann
6975d3ca4b output/pipewire: switch from pw_main_loop to pw_thread_loop
We need this for pw_thread_loop_lock().
2021-07-30 13:42:59 +02:00
Max Kellermann
5eab2d96f4 output/winmm: fix struct/class mismatch 2021-07-16 08:30:34 +02:00
Max Kellermann
b29a43b4d7 decoder/mad, ...: more libfmt logging 2021-06-25 20:52:08 +02:00
Max Kellermann
6f539cfcd6 Partition, ...: use libfmt for logging 2021-06-24 21:40:11 +02:00
Max Kellermann
0185d58a2b Log: add libfmt support 2021-06-24 21:14:42 +02:00
Rosen Penev
6af7be4a45 add constexpr
Found with cppcoreguidelines-interfaces-global-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-31 13:45:39 -07:00
Rosen Penev
220d2bf026 clang-tidy: add explicit deleted constructors
Found with cppcoreguidelines-special-member-functions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-05-30 22:47:20 -07:00
Max Kellermann
4f75eb9bfe output/pipewire: remove unreachable "return" statement 2021-05-26 11:57:57 +02:00
Max Kellermann
96707c0426 release v0.22.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAmClOSYQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEkODD/49e950HLmZE8x3rmyeEEsgdvHkOVpPlKHo
 +wsmSsi+N0sQKgEOffSYyL0MRWaQqzRMnl1EcEVErCfQl5f1mOw9+TL4f5ZEjVNw
 CQFMy1awHtCfktgF5zq6NzXD3nor9mkjiP733x/kGcsxwfk/Y4radqUBKJ5Y4a2B
 YSg35a/YTOfLCmb9WBquwAi22x7AkyBzyrY3ToCzynVuaNcT3gvLsAAMFzRUKpqD
 QEoCtUxJ4CQayjWjtG/bBCs2TVSmJvovhM2xB4Jnm+MeZz+bKI0y+ALW2Wk0Agnd
 qxDqyCEnvHi5pf8i9usl4/A63VDC7HHj9kDSLtPLGTijv+7Wvvr4kNpwm2DuJ4q1
 1pOEgT480ryK1FPyO6XnYCk616NqjgMbplr6SQ1DuVpIddWdiGARoge/WiNvsbT9
 pnEp0q9V3cQmuJ30LlskMJHAPyrE3KSrO1s+4P2zUeirwnMnOCPdq+gT+lRw4GNG
 OqLFEDHaELgSaZxInCN8RCXdLMrpuvKm+FQQApU1KwbYPXIassR14yt6BPpjxqea
 vkvFLtpwFWthNPLkujak5rDqAPvbHzAeOfaOiZelzd21nl/1omiMXSXRcJkEjONi
 JC5VWJpi1PHMXocq6AcOQT/9XhIH4uDA+Xghn7CURBTB6WoB954TSmuVIjXTfgAv
 XQYqRR+7Yw==
 =Gtzo
 -----END PGP SIGNATURE-----

Merge tag 'v0.22.7'

release v0.22.7
2021-05-19 18:43:19 +02:00
Max Kellermann
bcf0fdd3a8 meson.build: define NOUSER on Windows for lighter windows.h
A few exceptions are needed for sources which include COM header
(directly or indirectly).

This fixes lots of shadow warnings, see
https://github.com/MusicPlayerDaemon/MPD/issues/1150
2021-05-19 18:02:49 +02:00
Max Kellermann
a169a05e41 win32, ...: avoid including windows.h
Include the most specific header documented by MSDN instead.
2021-05-19 17:25:32 +02:00
Max Kellermann
8efa5c7641 output/wasapi: use "%lu" in log calls
"%lu" is portable - it works with both POSIX and Microsoft flavors.

Fixes a part of https://github.com/MusicPlayerDaemon/MPD/issues/1150
2021-05-19 17:10:49 +02:00
Max Kellermann
a2bdac571a Merge branch 'v0.22.x' 2021-05-17 19:33:15 +02:00
Max Kellermann
0f02bbc2fe output/jack: enable on Windows
This enables the JACK output plugin on Windows, but doesn't link
against libjack64.dll, instead loads the DLL at runtime with
LoadLibrary().  This kludge avoids the extremely fragile JACK shared
memory protocol by using the system's libjack64.dll, without requiring
the same DLL at build time.
2021-04-26 21:47:20 +02:00
Max Kellermann
a7ba10423d Merge branch 'v0.22.x' 2021-03-13 08:41:10 +01:00
Shen-Ta Hsieh
4bcdcca7f5 output/wasapi: use calculated new buffer instead old one 2021-03-13 08:39:56 +01:00
bitkeeper
c08a8581ee Added cross-origin header to http headers of the http output.
The current http output doesn't provide a header for cross-origin support. This prevents to use the mpd http stream directly from an other webapplication due the origin from the webpage differs from then the audio stream.

The fix is to add the following header to the http response:
Access-Control-Allow-Origin: *
2021-03-10 21:27:19 +01:00
Max Kellermann
25354b9d8c Merge branch 'v0.22.x' 2021-03-10 21:06:12 +01:00
Max Kellermann
25b0194036 output/wasapi: implement Drain() 2021-03-10 21:05:48 +01:00
Max Kellermann
77fe727e69 output/wasapi: move the "is_started" flag to class WasapiOutputThread 2021-03-10 20:43:28 +01:00
Max Kellermann
73f9824ddf output/wasapi: eliminate friend declaration 2021-03-10 20:38:41 +01:00
Max Kellermann
1fe0c673bc output/wasapi: implement Cancel() properly
Calling consume_all() is illegal in the producer thread.
2021-03-10 20:38:27 +01:00
Max Kellermann
8a045207a7 output/wasapi: add field paused
Fixes bogus Delay() results at the start of playback, because Delay()
thinks the output is paused.
2021-03-10 20:09:37 +01:00
Max Kellermann
fe7c5a4208 output/wasapi: initialize is_started in Open() 2021-03-10 20:07:22 +01:00
Max Kellermann
8024f7e84d output/wasapi: move the thread->Play() call right before the consumed_size check
Fixes a bogus assertion failure (which can now be removed).
2021-03-10 20:07:19 +01:00
Max Kellermann
14f0134097 output/wasapi: make device_config const 2021-03-10 20:05:14 +01:00
Max Kellermann
1da27be84d output/wasapi: move runtime fields below configuration fields 2021-03-10 20:00:08 +01:00
Max Kellermann
08135f2cb7 output/wasapi: make configuration fields const 2021-03-10 19:58:33 +01:00
Max Kellermann
5907656bbb output/wasapi: stop the IAudioClient while paused
Instead of generating silence, do nothing, don't waste CPU time.
2021-03-10 17:48:49 +01:00
Max Kellermann
2ac2bd26f8 output/wasapi: combine two if statements to one switch 2021-03-10 17:45:54 +01:00
Max Kellermann
a2be91aea5 output/wasapi: add method WasapiOutputThread::InterruptWaiter() 2021-03-10 17:42:26 +01:00
Max Kellermann
579428172e output/wasapi: remove the broken Delay() calculation code
This code is complicated - and broken: the producer thread is not
allowed to call consumer methods.  Also the code is not necessary
because this plugin implements Interrupt().
2021-03-10 17:39:07 +01:00
Max Kellermann
3e484637f9 output/wasapi: rename OpenDevice() to ChooseDevice()
OpenDevice was a confusing name because it does not actually open a
device.
2021-03-10 17:34:10 +01:00
Max Kellermann
3e93c392d7 output/wasapi: make enumerator a local variable 2021-03-10 17:23:41 +01:00
Max Kellermann
0a97e68aa9 output/wasapi: start after the buffer has been filled
Postpone the Start() call until there is something to be played.
2021-03-08 23:03:25 +01:00
Max Kellermann
69783a44c8 output/wasapi: move Start()/Stop() calls to WasapiOutputThread::Work() 2021-03-08 22:58:20 +01:00
Max Kellermann
3a948515ce output/wasapi: check for exceptions after Wait()
This finishes problems which occur early in the WasapiOutputThread;
previously, the error was ignored and the output blocked forever
without doing anything (and without reporting the error).
2021-03-08 22:46:40 +01:00
Max Kellermann
9ade93983c output/wasapi: rename method WaitDataPoped() to Wait() 2021-03-08 22:44:49 +01:00
Max Kellermann
6931ce9558 output/wasapi: make the Thread a field, not a base class 2021-03-08 22:30:19 +01:00
Max Kellermann
d6fb07a3e4 output/wasapi: start the WasapiOutputThread in its constructor 2021-03-08 22:29:33 +01:00
Max Kellermann
01d3c2705e output/wasapi: Finish() calls Join() 2021-03-08 22:28:36 +01:00
Max Kellermann
29346dc9c5 output/wasapi: remove the thread management code from DoDisable()
This is duplicate; this has already been done in Close().
2021-03-08 22:27:46 +01:00
Max Kellermann
798e68ef62 output/wasapi: don't clear the exception in CheckException()
This is pointless; the method cannot be called again anyway.
2021-03-08 22:18:48 +01:00
Max Kellermann
79397db5b4 output/wasapi: remove the "thrown" field
It is pointless to let WasapiOutputThread wait for the
CheckException() call.
2021-03-08 22:17:45 +01:00
Max Kellermann
9256190a9b output/wasapi: move catch block to the Work() function level
If an exception has been caught, the method cannot continue playback,
therefore it doesn't make sense to have the "catch" block inside the
"while" block (and not break the loop after catching an exception).
2021-03-08 22:15:36 +01:00
Max Kellermann
3a0dbb0a67 output/wasapi: make WasapiOutputThread::is_exclusive const 2021-03-08 22:09:23 +01:00
Max Kellermann
3d6c9d1b88 output/wasapi: catch all exception 2021-03-08 22:06:29 +01:00
Max Kellermann
5823e79fe7 output/wasapi: remove broken Drain() implementation
The current Drain() implementation does what Cancel() should do; it
does not wait for completion, but instead discards the buffer.
2021-03-08 21:41:34 +01:00
Max Kellermann
5f656dffda output/wasapi: implement Cancel() 2021-03-08 19:58:15 +01:00
Max Kellermann
34d4d9157a output/wasapi: add inline 2021-03-08 19:57:40 +01:00
Max Kellermann
22c329cdb4 output/wasapi: convert pointer to reference 2021-03-08 19:56:56 +01:00
Max Kellermann
980ef82216 output/wasapi: move SetEventHandle() call to thread constructor 2021-03-08 17:52:44 +01:00
Max Kellermann
84a06a72df output/wasapi: fix coding style 2021-03-08 17:52:43 +01:00
Max Kellermann
4833d0891d output/wasapi: eliminate kErrorId 2021-03-08 17:47:07 +01:00
Max Kellermann
cd53ca22c6 output/wasapi: remove unused function SafeTry() 2021-03-08 17:43:36 +01:00
Max Kellermann
927f1e03a3 win32/Com: make COINIT_APARTMENTTHREADED the default constructor 2021-03-08 14:02:49 +01:00
Max Kellermann
6a75c48dba win32/HResult: add MakeHResultError()
None of the current FormatHResultError() callers need the format string.
2021-03-08 13:46:36 +01:00
Max Kellermann
90d97053a8 win32/ComWorker: make COMWorker a real class, no static members 2021-03-06 20:46:29 +01:00
Max Kellermann
ee720064a7 Merge branch 'v0.22.x' 2021-03-05 19:41:17 +01:00
Shen-Ta Hsieh
e1fe9ebcd6 output/wasapi: Add dop support for WASAPI
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1102
2021-03-05 19:40:32 +01:00
Max Kellermann
e1b62fb90d Merge branch 'v0.22.x' 2021-03-05 19:33:46 +01:00