Commit Graph

1483 Commits

Author SHA1 Message Date
Max Kellermann
92022658f9 thread/Cond: add wait() overload which takes a unique_lock<>
Just like std::condition_variable, which however has no way to specify
the std::mutex directly.
2019-04-26 11:51:45 +02:00
Max Kellermann
b51bae5500 thread/*Cond: rename methods to match std::condition_variable 2019-04-25 19:46:43 +02:00
Max Kellermann
ea5e6d8f33 Merge branch 'v0.21.x' 2019-04-04 10:29:58 +02:00
Max Kellermann
325c7b8e8b output/httpd: close client connection on error
This missing piece probably never really hurt, because
HttpdClient::OnSocketClosed() would be called right after a socket
error, but it's better to be explicit about closing on error.
2019-04-04 09:39:22 +02:00
Max Kellermann
380656d8c9 output/httpd: add missing mutex lock 2019-04-03 22:53:03 +02:00
Max Kellermann
9111bc2c21 output/httpd: add more API documentation about locking 2019-04-03 22:49:25 +02:00
Max Kellermann
7a1b56fe96 release v0.21.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlykiHUQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFErFWEACP0T0em6pKOV9W2YHivtnJoBhb3wG46a2w
 rnyNuj0FM8nhMsWunvqbOExogGxZziTKYhSdvzOBwNSleG1Eyjks8yNuPpp7nHH/
 Y5gyRr1o6BR4hkukWDAIBWN/iXatUWHb/itInN0KhrqyU0YptNGbOF87vLfAZlqW
 MNVTXO4YAx/tYHEt/4ze/ljtrNvXsB8Zw86cNI+jrivdujdKVfiN5dUpbc5Hj8DA
 3i6Y5YFm4OvHbFENeMy/kVht8Ln0/3Ak+Z9L7ti9ZSWLbOaQc7+Nl0P/3pfftzWf
 YK6DsRyvJ2dEPylAXqRIkZWdIU1VwjKc7cKYJFljNAMhaUWcrefXIGQOv0+1kbqz
 CxLgk3hIK3R7lGbxLXDU7xD05hbOGgXe1BKO9alGhEsyB8+sT6qfVay/RlJPN+da
 mSnslSzPyS+p9ZdyDnWXq68FS8BIriajDVXP7/WNMKz9OEe5BiXBBQVDM5/XbxQU
 qPxLn/BVYzDXOw8msgyIZ/vqE1rpomJDILsK/EMJ/HLAOdR/Jo10wIAGAqiLPp2j
 n2R9jS7nxZKmEvcZkg/HroNiGSpT89f38bbW/MCdzxAkg4vQDxQ0OE9GoeBi3oiP
 g/SkM/sJ9UdlC3bq7TAhxK0huimAEg5Rh6Z1II00D89QmWFQT0hjmxo++9WwCQXw
 CkIiKRf7Ug==
 =KzqS
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.7'

release v0.21.7
2019-04-03 12:32:20 +02:00
François Revol
0d8942e64a Haiku: remove redundant calls to delete_sem()
Fixes #184.

Semaphores are kernel-managed objects, calling delete_sem() twice is not more
dangerous than calling close() twice on an fd though, it would just return
an error.
2019-03-29 14:33:49 +01:00
Max Kellermann
3a901098e9 release v0.21.6
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlyOz50QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEub0D/oDIXjCyFredPqElU6wgHKmJIWHXiPMIzY2
 L5dK3ilGcON3ZDK4myoYvA5dkqat11u72x5TG3crcm8rITXuNJr93ONomZnfRvkq
 NwG5JHcexJOOm/ppaE7xd0VmfifRlJWpm+nqgPrObvMz+dIWQIOojYOGLeLYxUvC
 0i8mmfs6dIir+vpH13U9r3EPa78AZcuKttkZaK1ByaoK32RKAYPFIQvZgfWLI4Kj
 RUOrH9piEOGVx+vKw54rj69S+a8Do0LtMhnzOWmfrG8XQzS4W6dsp6gunYsFA9gR
 DZsERbu70JGJ8mrIKrrbXNT4/M06hTyAwob9PoRybi2aCP5BvfgBaM6qCeTNKKgQ
 YNLXBZVMbF/hbkoPG+DiS9S5Meyp8T3GYjaT4Bi8GufJu7HGERPp721PPPJLeyBg
 SpQo9SeS6xHA0bquQ1BJ3FV0JVn31w+taybMK+5eZqxS3xDjlVNorU2Dua2tkJKW
 IoIdoTfsU498V3RgPYrefUt0jLKbfGHTiyL1vZ2inZyK0AswebKFYyIFZnHLXkO2
 Pi2NOuE5RYmqRmB4TEwvLubP0nW5OI5lHCyvY/2GVjankPW5ufPtJMcpjs3hvx4Y
 5ORmEJBx5d5Y2NG1rZdnWv+b4x02MA8eAD2L3pq7WJ148AkZD3ddBBm7MpIJuW/n
 fFH7/jl30A==
 =EnrO
 -----END PGP SIGNATURE-----

Merge tag 'v0.21.6'

release v0.21.6
2019-03-17 23:58:54 +01:00
Max Kellermann
b76d78e6ae output/sles: enable power saving mode 2019-03-17 18:04:40 +01:00
Jacob Vosmaer
0a6e484b1a output/plugins/OSXOutputPlugin: add boost meson dependency 2019-03-17 16:59:24 +01:00
Max Kellermann
a66097129d Merge branch 'v0.21.x' 2019-03-16 14:08:22 +01:00
Max Kellermann
0bb71f1f20 output/pulse: use pa_channel_map_init_extend() instead of _auto()
Unlike pa_channel_map_init_auto(), pa_channel_map_init_extend() does
not fail if there is no valid mapping for the given channel count, but
instead maps additional "AUX" channels.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/493
2019-03-16 14:03:10 +01:00
Max Kellermann
c176d94598 system/ByteOrder: move to util/ 2019-03-08 10:21:10 +01:00
Yue Wang
42b22187c8
[OSXOutput] Throw an error when device not found
Currently it falls back to system default device (either internal speaker or headphone) when device not found. 
I believe it is a better to fail in this case, to make it better aligned with platforms (such as alsa).
2019-01-25 19:50:27 -08:00
Max Kellermann
754f4048a8 output/shout: evaluate tls option only if TLS is enabled in libshout
Fixes build failure after commit
0cea67ee70
2019-01-21 14:36:43 +01:00
Jakob Ovrum
0cea67ee70 shout output plugin: add support for TLS 2019-01-19 17:36:14 +01:00
Max Kellermann
af7b928d7c output/httpd/Page: remove obsolete API documentation 2018-12-28 17:16:12 +01:00
Max Kellermann
c0d8a9b07a output/httpd/Page: add noexcept 2018-12-28 17:15:28 +01:00
Max Kellermann
5b0d23d553 output/httpd/IcyMetaDataServer: add noexcept 2018-12-28 17:14:27 +01:00
Max Kellermann
ab30695bd1 output/httpd: add noexcept 2018-12-28 17:06:01 +01:00
Max Kellermann
22e6d95c4b remove libwrap support
libwrap is an obscure artefact from a past long ago, when source IP
address meant something.

And its API is "interesting"; it requires the application to expose
two global variables `allow_severity` and `deny_severity`.  This led
to bug #437.  I don't want to declare those variables; instead, I'd
like to remove libwrap support.

Closes #437
2018-12-28 14:16:02 +01:00
HyShai
76268773b5
change HTTP Version to a valid version 2018-12-14 01:51:54 -05:00
Max Kellermann
ce49d99c2f check.h: remove obsolete header
Since we switched from autotools to Meson in commit
94592c1406, we don't need to include
`config.h` early to properly enable large file support.  Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.

This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
2018-11-19 16:33:49 +01:00
Max Kellermann
4cdcaa8630 output/alsa: don't call snd_pcm_drain() if nothing was written
Works around a problem where MPD goes into a busy loop because
snd_pcm_drain() always returns `-EAGAIN` without making any progress
(fixes #425).

This problem was triggered by snd_pcm_drain() after snd_pcm_cancel()
and snd_pcm_prepare(), but without submitting any data with
snd_pcm_writei().

I believe this is a kernel bug: in non-blocking mode, the kernel's
snd_pcm_drain() function returns early.  In this mode, it only checks
whether snd_pcm_drain_done() has been called already, but
snd_pcm_drain_done() is never called if no data was submitted.

In blocking mode, the following `for` loop detects this condition, so
snd_pcm_drain_done() is not necessary, but without this extra check,
we get `-EAGAIN` forever.
2018-11-16 12:49:37 +01:00
Max Kellermann
436ba3c96c output/alsa: drain the whole ring_buffer, not just one period
This fixes a problem which caused a failure with snd_pcm_writei()
because snd_pcm_drain() had already been called in the previous
iteration.  This commit makes sure that snd_pcm_drain() is only called
after the final snd_pcm_writei() call.

This fixes discarded samples at the end of playback.
2018-11-14 13:35:17 +01:00
Max Kellermann
5d12f52873 output/alsa: clear error after reopening device
When a playback error has occurred, MPD would never recover until one
restarts MPD.
2018-11-14 13:20:54 +01:00
Max Kellermann
b477f86c92 output/alsa: don't lock the mutex in CancelInternal()
CancelInternal() doesn't need to be protected because it is called
synchronously from Cancel().
2018-11-14 11:50:51 +01:00
Max Kellermann
020371f145 output/alsa: wake up the client thread after generating silence
Fixes a theoretical race condition which could occur in Drain() (but
was extremely unlikely).
2018-11-14 11:48:55 +01:00
Max Kellermann
ccafe3f3cf output/alsa: don't generate silence if ALSA-PCM buffer has enough data
If our `ring_buffer` is smaller than the ALSA-PCM buffer (if the
latter has more than the 4 periods we allocate), it can happen that
the start threshold is crossed and ALSA switches to
`SND_PCM_STATE_RUNNING`, but the `ring_buffer` is empty.  In this
case, MPDD will generate silence, even though the ALSA-PCM buffer has
enough data.  This causes stuttering (#420).

This commit amends an older workaround for a similar problem (commit
e08598e7e2) by adding a snd_pcm_avail()
check, and only generate silence if there is less than one period of
data in the ALSA-PCM buffer.

Fixes #420
2018-11-14 11:17:59 +01:00
Max Kellermann
3830748de5 output/alsa: clear the period_buffer in LockCaughtError()
The method Cancel() assumes that the `period_buffer` must be empty
when `active==false`, but that is not the case when Play() fails.

Of course the assertion in Cancel() is not 100% correct, but I decided
to rather fix this in LockCaughtError() because the `period_buffer`
should only be accessed from within the RTIO thread, and this is the
only code path where `active` can be set to `false` with a non-empty
`period_buffer`.

Fixes #423
2018-11-14 10:24:08 +01:00
Max Kellermann
1a43f5145d output/alsa: throw on snd_pcm_writei() error while draining
This implements real error handling, and avoids calling
CancelInternal() from this code path.
2018-11-14 10:08:29 +01:00
Max Kellermann
7f143a83c1 output/alsa: fix wrong use of errno
alsa-lib doesn't set errno, it returns errors as negative integers.
2018-11-14 10:07:23 +01:00
Max Kellermann
6ccc254179 output/alsa: throw after snd_pcm_drain() error 2018-11-14 10:04:10 +01:00
Max Kellermann
7db2450447 output/alsa: refactor the drain EAGAIN workaround 2018-11-14 10:00:50 +01:00
Max Kellermann
6c2a6a65e0 output/alsa: remove snd_pcm_state() check from DrainInternal()
This check was added 9 years ago in commit
4dc25d3908 to work around a dmix bug
which I assume has been fixed long ago.

Removing this fixes another corner case: if draining is requested
before the start threshold is reached, the PCM is still in
SND_PCM_STATE_PREPARED but not yet SND_PCM_STATE_RUNNING, which means
the submitted data will never be played.  This corner case is
realistic when playing songs shorter than the ALSA buffer (if the
buffer is very large).
2018-11-14 09:48:24 +01:00
Max Kellermann
4247a757b3 output/alsa: call snd_pcm_prepare() if draining is requested early
This fixes a corner case which has probably never occurred and
probably never will: if Cancel() is called, and then Play() followed
by Drain(), the plugin should really play that data.  However
currently, this never happens, because snd_pcm_prepare() is never
called.
2018-11-14 09:43:14 +01:00
Max Kellermann
228bf7eb09 output/thread: cancel the AudioOutputSource() instead of closing it
This fixes the assertion failure due to calling
AudioOutputSource::Close() twice.
2018-11-12 12:24:25 +01:00
Max Kellermann
5eaf2b8fc3 output/control: always close the AudioOutputSource in RELEASE
Fixes a crash bug with `always_on` outputs which occurs because the
`AudioOutputSource` still has a pointer to an outdated `MusicChunk`.

Fixes #415
2018-11-12 12:21:59 +01:00
Max Kellermann
e097fef79e output/control: add command RELEASE
With the new command, the decision to pause or close the output moves
into the output thread.
2018-11-12 12:09:37 +01:00
Max Kellermann
9a813cd3b1 output/Thread: update comment 2018-11-12 12:09:02 +01:00
Max Kellermann
1c60c8e014 output/Filtered: catch Drain() exceptions in CloseOutput() 2018-11-12 12:05:54 +01:00
Max Kellermann
eddda95900 output/interface: document that Drain() may throw 2018-11-12 12:04:42 +01:00
Max Kellermann
fee75dc766 {output,mixer}/alsa: use snd_pcm_poll_descriptors_revents()
This call was missing, causing very high CPU usage when the ALSA
output plugin was used with dmix.

Closes #391
2018-11-11 12:37:29 +01:00
Max Kellermann
12308a0f55 lib/alsa/NonBlock: move the functions into a class managing the state 2018-11-11 12:37:25 +01:00
Max Kellermann
583208db7e output/httpd: fix nullptr dereference crash bug
When `metadata_sent` is `false`, the plugin assumes there is metadata
which must be sent, even if no metadata page was passed to the plugin.
Initializing it to `true` avoids dereferencing this `nullptr`.

Fixes #412
2018-11-08 09:37:18 +01:00
Max Kellermann
b1fe105904 output/Source: reset current_chunk in Open()
If the output is already open, the `current_chunk` pointer may be
bogus and out of sync with `SharedPipeConsumer::chunk`, leading to an
assertion failure in `SharedPipeConsumer::Consume()`.

Fixes #411
2018-11-07 00:17:48 +01:00
Max Kellermann
f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann
06ca08ce55 output/roar: remove
Bugs in libroar which broke the MPD build have been annoying me for
quite some time, and the newest bug has now hit my main build machine:

 https://github.com/MusicPlayerDaemon/MPD/issues/377

Problem is the usage of the typedef `_IO_off64_t` in libroar's
`vio_stdio.h`:

 int roar_vio_to_stdio_lseek (void *__cookie, _IO_off64_t *__pos, int __w);

This `_IO_off64_t` is an internal implementation detail of glibc and
was removed in version 2.28.  Nobody must ever use it.  Why the ****
did the RoarAudio developers use it?  Not using internal typedefs
isn't exactly rocket science.

This annoys me enough to finally remove the plugin.  Anyway, I've
never heard of anybody using RoarAudio, so my best guess is that
nobody will notice.
2018-10-31 15:03:28 +01:00
Max Kellermann
0307b49f43 event/ServerSocket: make OnAccept() noexcept 2018-10-30 20:13:07 +01:00
Max Kellermann
94592c1406 build with Meson instead of autotools
So long, autotools!  This is my last MPD related project to migrate
away from it.  It has its strengths, but also very obvious weaknesses
and weirdnesses.  Today, many of its quirks are not needed anymore,
and are cumbersome and slow.  Now welcome our new Meson overlords!
2018-10-14 23:41:38 +02:00
Max Kellermann
863722545f player/CrossFade, ...: use lround() 2018-09-22 19:08:03 +02:00
Max Kellermann
ec54754e22 Compiler.h: move to util/ 2018-08-20 16:19:17 +02:00
Max Kellermann
1a9659ef45 output/Init: pass global configuration in struct AudioOutputDefaults 2018-08-19 07:52:23 +02:00
Max Kellermann
aaa438e745 mixer/Type: mixer_type_parse() throws on error 2018-08-19 07:49:54 +02:00
Max Kellermann
4531e4cc55 filter/LoadChain: move code to class FilterFactory
Eliminate a use of GetGlobalConfig().
2018-08-18 20:57:02 +02:00
1848
0c1a899fbe Added unix socket support in HttpdOutputPlugin 2018-08-07 19:28:29 +02:00
Yue Wang
2127a482da
Fix various bugs in OS X DSD playback
the most notable bugs are 

1. osx_output_set_device_format should use the target asbd rather than AudioFormat. This is because asbd's sample rate calculation reflects the real dop target rate of the DAC, white AudioFormat's sample rate is the original DSD format rate.

2. the original code value the highest rate that's the multiple of the target rate. This cause DOP always have the wrong rate chosen. This is also not necessary for PCM playback --- MPD's goal is bit perfect, and it's meaningless to raise to two or four times the PCM sample rate.

3.  if sample_rate cannot be synchronized, the test for falling back to PCM is wrong. If the file format is in DSD format such fallback is necessary, whatever the params.dop setting is.
2018-08-07 01:55:06 -07:00
Yue Wang
1e88e71b9a
[OSXOutputPlugin] Fix a bug that the stream sample rate is missing
the code here tried to guard DSD features behind ENABLE_DSD. However, the sample rate setting should be shared between two scenarios. 

40a1ebee29 (diff-ce7ecec9ea9ca3df90d9c290cb3ef9d4R795)


The code runs fine if the dac supports the sample rate, as Mac OS  will use the device rate if stream rate is 0. 
However, when DAC is uncapable of processing the sample rate, a wrong rate (device rate) will be used for the stream rate.
2018-07-28 00:06:56 -07:00
Max Kellermann
9ff2606bb8 config/Data: use std::forward_list to manage params and blocks 2018-07-18 11:03:19 +02:00
Max Kellermann
0c8ffa1ac3 output/MultipleOutputs: use struct ConfigData 2018-07-17 23:13:35 +02:00
Max Kellermann
7b02c0224c filter/LoadChain: use struct ConfigData 2018-07-17 22:05:24 +02:00
Max Kellermann
5b192beaa5 config/Global: remove ConfigBlock::SetUsed() call, let caller do that
This fixes an old bug which caused the "unused" warnings to be
unreliable; only the first block in the list was marked as being
"used", no matter if it was really used, and the rest was never marked
as "used", suppressing all warnings for them.
2018-07-17 21:08:41 +02:00
Max Kellermann
816603fd9a config/Config*: rename files, drop "Config" prefix 2018-07-16 19:50:07 +02:00
Max Kellermann
c457d8e442 Merge branch 'can' of git://github.com/Wang-Yue/MPD 2018-07-16 18:14:04 +02:00
Yue Wang
c58dffa685 Implement Cancel() for OSXOutputPlugin 2018-07-16 09:06:07 -07:00
Max Kellermann
ba41690063 output/Interface: add method ChangeAudioFormat()
This is just the API design; there is no implementation yet, and no
caller.
2018-07-16 11:46:33 +02:00
Max Kellermann
2fb5dbe62b output/alsa: use spsc_queue::reset()
This method was added in Boost 1.58.
2018-07-16 11:04:01 +02:00
Yue Wang
1d30df9b15
Update OSXOutputPlugin.cxx
some device seems to have issue with setting kAudioDevicePropertyVolumeScalar  with kAudioObjectPropertyElementMaster. Use AudioToolbox 's kAudioHardwareServiceDeviceProperty_VirtualMasterVolume instead. 

Ideally, we should get the steoro channels first, and set the kAudioDevicePropertyVolumeScalar for each channel, which is doable as presented in https://github.com/cmus/cmus/blob/master/op/coreaudio.c. I will do a follow up PR after refactor PR.
2018-07-13 22:27:24 -07:00
Yue Wang
ef84e5c8fa
further guard dop code by if (dop_enabled) 2018-07-13 16:36:29 -07:00
Yue Wang
6d2a30b860
Update OSXOutputPlugin.cxx
1 sec for pause is too long. we wait for the same amount of time as when ring buffer is not available for writing.
2018-07-13 16:14:59 -07:00
Yue Wang
9e0fa8e9ec
Fix a copy and paste from diff bug. 2018-07-13 15:53:51 -07:00
Yue Wang
5e8e038811
Enclose pcm_export into the ENABLE_DSD guard. 2018-07-13 15:31:48 -07:00
Yue Wang
e61a804b80
Simplify audio format assignment code 2018-07-13 15:09:11 -07:00
Yue Wang
40a1ebee29
Enable OSX output plugin to set hardware sample rate and bit depth at the same time
This PR will fix #271.

special thanks to @coroner21 who contributed a nice way to score hardware supported format in #292

Also, The DSD related code are all guarded with ENABLE_DSD  flag.
2018-07-13 12:48:43 -07:00
Yue Wang
680fdb0338
enable macOS to use Hardware Mixer
- Update the mixer to set on device property instead of audio unit property. When user choose "hardware" as mixer type, they will be able to change the hardware device volume instead of the software (AudioUnit) volume. 
- We don't use square root scale in volume calculation as previous code did. This will make the volume level in line with system volume meter --- That is, MPD will have the same percentage volume reading compared to System Setting (Either in "System Preference" or in "Audio Midi Setup" app)
2018-07-10 15:51:32 -07:00
Max Kellermann
9a29d02e7e Merge branch 'v0.20.x' 2018-07-06 19:43:01 +02:00
Max Kellermann
6f3c0d0a60 AudioFormat: include cleanup 2018-07-06 19:35:31 +02:00
Max Kellermann
60d5bf0240 util/StringFormat: new utility library 2018-07-06 19:07:02 +02:00
Max Kellermann
5f082a2739 output/httpd: remove broken DLNA support code
This code was added in 21851c0673 but
looks completely broken:

- the status code is "206 OK" but "206" would be "Partial Content"

- the "Content-Length" header has a bogus value

- the "Content-RangeX" parameter has different bogus values (why
  "Content-RangeX" anyway and not "Content-Range"?)

Apart from that, there are strange undocumented non-standard headers
which are probably there to work around bugs/expectations in one
broken proprietary client product.  But these days, MPD doesn't bend
over to support broken clients.  So let's kill this code.

Closes #304
2018-07-06 17:28:01 +02:00
Max Kellermann
09d4176210 output/multiple: use WaitAll() in EnableDisable() 2018-06-23 19:23:56 +02:00
Max Kellermann
30d41e45e2 output/multiple: remove unnecessary IsBusy() check from WaitAll()
AudioOutputControl::WaitForCommand() doesn't need this check.
2018-06-23 19:23:18 +02:00
Max Kellermann
1624a5eb8d output/Control: add another Cond attribute, replacing audio_output_client_notify 2018-06-23 19:11:48 +02:00
Max Kellermann
1bca29f9e2 output/Control: rename "cond" to "wake_cond"
Prepare for adding another Cond attribute.
2018-06-23 19:10:23 +02:00
Max Kellermann
efb8a9bd2c player, decoder, output: wrap MusicPipe in std::shared_ptr/std::unique_ptr 2018-06-23 18:45:57 +02:00
Max Kellermann
2be905b2e2 MusicPipe: eliminate the unused MusicBuffer reference
This requires re-adding the reference to struct DecoderControl, which
was removed recently by commit
9f14e7a98d
2018-06-23 18:36:24 +02:00
Max Kellermann
076be809c2 Music{Pipe,Chunk}: use MusicChunkPtr for the list links 2018-06-23 17:58:42 +02:00
Max Kellermann
88f1233d7b MusicPipe, output/multiple: include cleanup 2018-06-23 17:44:32 +02:00
Max Kellermann
54d295c247 MusicChunkPtr: managed MusicChunk pointer
Make all uses of MusicChunk safe.
2018-06-22 23:11:52 +02:00
Max Kellermann
e81b089612 MusicPipe: automatically clear in destructor
We can implement this now that we have a MusicBuffer reference.
2018-06-22 23:09:13 +02:00
Max Kellermann
9f14e7a98d MusicPipe: add MusicBuffer reference
This tiny amount of overhead allows omitting the MusicBuffer in
Clear().
2018-06-22 22:59:44 +02:00
Max Kellermann
cb412b221c output/multiple: update API documentation 2018-06-22 22:59:30 +02:00
Christian Kröner
58590b71d1 Fix pause for OSX output plugin (delay one second) 2018-06-02 19:02:37 +02:00
Max Kellermann
a8568d7246 Merge branch 'v0.20.x' 2018-05-03 20:15:11 +02:00
Max Kellermann
ac61fd1d78 {input,output}/alsa: work around -Wswitch due to SND_PCM_STATE_PRIVATE1 2018-05-03 11:59:18 +02:00
Max Kellermann
e08598e7e2 output/alsa: don't submit silence if PCM is not yet running
See code comment.  Closes #260
2018-04-26 17:14:42 +02:00
Max Kellermann
d301a79dcf output/alsa: CopyRingToPeriodBuffer() returns bool 2018-04-26 16:44:23 +02:00
Max Kellermann
98d76627a5 output/alsa: disable events in Cancel()
Don't reactivate the PCM device immediately after Cancel() is
finished; if Cancel() gets called this may mean that new data may take
a while to produce, or no data at all will be produced because the
current song is being stopped.

Once new data is available, Play() will automatically reactivate the
PCM.

This fixes underruns when switching songs manually (closes #264).
2018-04-26 16:41:49 +02:00
Max Kellermann
8a809013f3 output/alsa: reset "active" on error
Use the "active" flag in PrepareSockets() instead of LockHasError().
2018-04-26 16:18:59 +02:00
Max Kellermann
485ed0b156 output/alsa: make the "active" attribute thread-safe 2018-04-26 16:18:52 +02:00
Max Kellermann
7d546f80f9 output/alsa: merge Activate() and UnlockActivate()
Prepare to make the "active" attribute thread-safe.
2018-04-26 16:18:18 +02:00
Max Kellermann
5dfdc15f93 output/alsa: rethrow errors in Drain() 2018-04-26 16:17:14 +02:00
Max Kellermann
a6e5873443 output/alsa: thread-safety documentation for attribute "active" 2018-04-26 15:54:15 +02:00
Max Kellermann
e2cf777538 output/alsa: simplify MultiSocketMonitor::GetEventLoop() calls 2018-04-26 15:54:01 +02:00
Max Kellermann
9c61760713 output/alsa: remove obsolete comment, was moved to Alsa::PeriodBuffer::Allocate() 2018-04-10 15:42:29 +02:00
Christian Kröner
d84cd500bb Fix build with DSD disabled 2018-03-07 22:40:19 +01:00
Christian Kröner
5b456cadc4 Reset sample rate to initial state on OSX output 2018-03-07 22:38:09 +01:00
Christian Kröner
4be80982a4 Fix sample rate sync on Mac output for low rates 2018-03-07 21:32:21 +01:00
Christian Kröner
4d7f1f0c35 Implement Pause() for OSXOutput plugin 2018-03-07 11:59:43 +01:00
Christian Kröner
d3f097c7f1 Honor 'device "system"' setting for OSX output 2018-03-07 11:59:43 +01:00
Christian Kröner
e89c421313 Initial support for DSD over PCM on macOS
From: Christian Kröner <ckroener@gmx.net>

This just copies the necessary bits and pieces from the ALSA plugin and applies them to OSXOutput based on dop config setting. It only changes the OSXOutput plugin as needed for DoP (further changes to support additionally e.g. integer mode or setting the physical device mode require rather a complete rewrite of the output plugin).

Fortunately the Core Audio API is by default bit perfect and supports DoP with minimal changes (setting the sampling rate accordingly after ensuring that the physical mode supports at least 24 bits per channel seems to be enough). This was tested on an Amanero Combo384 device hooked up to a ES9018 DAC.

USAGE (try only on DACs that support DoP):
- Add dop "yes" option to mpdconf
- Be sure to set at least 24bits per channel before playing some DSD file (using Audio-MIDI-Setup)
- Based on the dop setting, MPD will change the sample rate as required and output DoP signal to the DAC
- Hog mode is recommended to ensure that no other program will try to mix some output with the DoP stream (resulting in bad noise)
- Alternatively set the default output device to another device (e.g. the built-in output) to avoid having other audio interfere with DSD playback
2018-02-26 14:55:03 +01:00
Max Kellermann
250b6a3d52 release v0.20.16
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlp2BjEQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEl0HEACEOGoX3a8slWwuPsqdOu+thc73SIMVzqF9
 xzxFbGLyp0MzXTAgU+SLzfbD4/gerglC7TRbGzsvVu7iwxXeKhEL/SJ5RhrCQM3E
 U8jaOeavMWeqX60pdbTz2zw4maKAD7U3fWcYxoh09EBaZa7Mm/j7URPLqrlWT7VD
 iWqdLcC4HZarOxBbq0CY7rQPVsAVZZ5l43MDV6hiInSn0wWo783G6BtYFgvgH8qk
 pZIL0yScQrjyj9D0fgfDC9DBVfHqMqpWW5G2rNhsXTUtpdb9V5tB2B8ZbIUWJfD7
 aVFztCwwmbiBle4UBHfyyDLfZkBZmU/qKc9+I3WUxT4DLbA8gDXZFjb7zU80NMge
 xzbXeO7XvxvSm7groqRh3Vy0nbkBMB9wTwzre3ULhYyhY2vVISb9lSyRtUE9xuR8
 SL2zpdgVcFdTUSKat63ikeU4sbYvssra3ZDRnAyoFF2iVpT2J2B95ZVNfaIYbRSQ
 lidlz8q3Px5GUDe3D0ao3hFk5t1Hg2jXx3nbz/Kk+SwZpsaiCewl6zjptye7R7zD
 e9OMxYrU+/opsynRE5NFuTvkRKUG1kC47/rWgGZWI9Cbv8+lse1NO0c7VzM7o1hH
 Bfk5AhEkv8tLNM+39evXdNQVB0cna5ndSDOkYBcPI78/PUNd+TnrPdfI/W3NCnRl
 I+CWQE3uSQ==
 =+tJ2
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.16'

release v0.20.16
2018-02-03 19:59:29 +01:00
Max Kellermann
ec408ca6a6 output/pulse: fix crash during auto-detection
The PulseOutput needs to be "enabled" before WaitConnection() may be
called.

Closes #207
2018-01-30 10:06:36 +01:00
Max Kellermann
eb771eaf0d output/Thread: re-lock the mutex after flush error
Fixes deadlock due to mutex double lock.
2018-01-29 22:30:56 +01:00
Max Kellermann
97f670658f util/StringFormat: new utility library 2018-01-24 13:28:28 +01:00
Max Kellermann
bbc5212436 fs/AllocatedPath: make the nullptr_t constructor public 2018-01-17 12:17:41 +01:00
Max Kellermann
8649ea3d6f thread/Thread: use BoundMethod 2018-01-07 17:20:26 +01:00
François Revol
5b18b66282 Haiku: fix build
Convert the fill_buffer to a class method, to allow accessing the private method.

Also remove the leftover Wrapper stuff.
2018-01-05 23:10:58 +01:00
Max Kellermann
4a120f8090 Merge branch 'v0.20.x' 2018-01-05 10:10:17 +01:00
Max Kellermann
c2cbb7b8ce output/haiku: remove unimplemented Cancel() method 2018-01-05 10:05:14 +01:00
Max Kellermann
79b0f97a3f output/Interface: clarify Play() API documentation 2018-01-05 08:35:40 +01:00
Max Kellermann
e3ef3e8d71 output/Control: unlock mutex during expensive operations 2018-01-04 10:36:18 +01:00
Max Kellermann
7574dfd339 output/Control: move code from FinishDestroy() to destructor 2018-01-04 10:34:27 +01:00
Max Kellermann
a5b93008f5 output/Filtered: remove redundant nullptr assignments from Setup() 2018-01-04 10:32:10 +01:00
Max Kellermann
0227af5bb7 output/Filtered: remove BeginDestroy()
All it does is "sometimes" close the mixer, but that is also done in
the destructor.
2018-01-04 10:29:27 +01:00
Max Kellermann
ef71df60f6 output/Multiple: use std::unique_ptr<FilteredAudioOutput> 2018-01-04 10:14:26 +01:00
Max Kellermann
f52b3b4e04 output/Multiple: dispose the AudioOutputControl instances
Fixes shutdown memory leak.
2018-01-04 10:11:23 +01:00
Max Kellermann
7e4e32cfe0 output/Filtered: eliminate FinishDestroy()
This is implicitly done by the destructor.
2018-01-04 10:05:31 +01:00
Max Kellermann
9f8649884b output/Control: dispose the FilteredAudioOutput
Fixes shutdown memory leak.
2018-01-04 10:01:34 +01:00
Max Kellermann
f1ee4caddd output/Init: fix configuration option name in error message 2018-01-04 09:57:28 +01:00
Max Kellermann
051b8fbb31 output/Thread: add "noexcept" 2018-01-04 09:54:35 +01:00
Max Kellermann
b0ea32f660 output/Control: remove unused method StopThread() 2018-01-04 09:20:22 +01:00
Max Kellermann
8322ae5a4c output/Control: use class ScopeUnlock() 2018-01-04 08:41:19 +01:00
Max Kellermann
98a7c62d7a player/Thread: don't send silence if decoder is slow
The output plugin shall decide whether to insert silence or do nothing
at all.  The ALSA output plugin has already implemented this.
Inserting silence is not necessary or helpful for some plugins, and
may even hurt them (e.g. "recorder").
2018-01-03 17:36:41 +01:00
Max Kellermann
1954e94de2 Merge branch 'work_tag' of git://github.com/loujine/MPD
Closes #181
2018-01-03 11:47:02 +01:00
Max Kellermann
6d0d8cf9cf filter/Filter: add virtual method Flush()
This will be used by filters which have internal buffers which need to
be flushed at the end, e.g. the "soxr" resampler.
2018-01-02 23:15:51 +01:00
Max Kellermann
5ede02aed8 filter/FilterConfig: rename to LoadChain.cxx 2018-01-02 23:09:36 +01:00
Max Kellermann
b0199245d5 output/Thread: move code to method InternalDrain() 2018-01-02 18:03:48 +01:00
Max Kellermann
b93e3b2cf6 output/Thread: move code to method InternalCloseError() 2018-01-02 18:02:14 +01:00
Max Kellermann
ae7fcf4c6b output/Thread: move common code to method Failure() 2018-01-02 18:00:20 +01:00
Max Kellermann
1607754771 output/Thread: update "last_error" after filter/play errors 2018-01-02 17:59:37 +01:00
Max Kellermann
028f659c40 output/Thread: move error handling code into the catch block 2018-01-02 17:48:14 +01:00
Max Kellermann
8dfdacf128 output/Thread: AudioOutput::Play() must not return zero 2018-01-02 17:47:46 +01:00
Max Kellermann
f4a56f839f output/haiku: remove size==0 check from Play()
By API contract, this parameter must not be zero.
2018-01-02 17:45:14 +01:00
Max Kellermann
67a8eedca0 output/ao: round write_size down to a multiple of the frame size 2018-01-02 17:33:33 +01:00
Max Kellermann
be65c7d5d0 config/Block: add method GetPositiveValue()
Adds missing checks to several plugins.
2018-01-02 17:24:34 +01:00
Max Kellermann
46406d6cca output/ao: use class SafeSingleton for libao initialization 2018-01-02 12:13:51 +01:00
Max Kellermann
d2358b42b6 output/Source: drop the "_instance" suffix from variable names 2018-01-02 09:59:22 +01:00
Max Kellermann
551ac56a33 Filter/Internal: split header 2018-01-01 18:48:34 +01:00
loujine
42959982a9 Add basic support for MUSICBRAINZ_WORKID tag 2017-12-30 19:05:21 +00:00