Commit Graph

1933 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
Max Kellermann
c40354bbcb player/Outputs: abstract interface wrapping class MultipleOutputs 2017-12-29 16:39:05 +01:00
Max Kellermann
c04aafb4e3 output/Multiple: add "noexcept" 2017-12-29 16:29:49 +01:00
Max Kellermann
edef62df86 filter/Internal: return std::unique_ptr<Filter> 2017-12-27 11:56:05 +01:00
Max Kellermann
e2621d5e44 filter/Plugin: return std::unique_ptr<PreparedFilter> 2017-12-27 11:39:01 +01:00
Max Kellermann
03cf6591c0 output/Source: convert prepared_filter to reference 2017-12-27 11:21:43 +01:00
Max Kellermann
25fa3ccade MusicChunk, player/Thread: use std::unique_ptr<Tag> 2017-12-20 15:02:14 +01:00
Max Kellermann
a17a481e30 event/BufferedSocket: add "noexcept" 2017-12-20 10:42:17 +01:00
Max Kellermann
8ac73a9eba output/alsa: add attributes "dop" and "allowed_formats" 2017-12-19 11:57:52 +01:00
Max Kellermann
86a06a7acc output/Interface: add "attributes" map
These attributes are printed in the "outputs" response, and the new
command "outputset" allows setting new values.

No attributes are currently implemented.
2017-12-19 11:57:52 +01:00
Max Kellermann
39dc83bd82 output/Print: print the plugin name 2017-12-19 11:52:10 +01:00
Max Kellermann
503063cddc output/Print: use %u for the index 2017-12-19 11:52:09 +01:00
Max Kellermann
914df18bf9 Main, ...: catch any exception, not just std::runtime_error 2017-12-19 10:56:23 +01:00
Max Kellermann
37c27fa606 output/Interface: convert need_fully_defined_audio_format to flag 2017-12-19 08:41:34 +01:00
Max Kellermann
edee8a3446 Compiler.h: add gcc_returns_nonnull, gcc_returns_twice 2017-12-18 23:00:13 +01:00
Max Kellermann
6246d36fe6 Merge branch 'v0.20.x' 2017-12-16 20:56:06 +01:00
Yue Wang
f1ef9f9d31 OSXOutputPlugin: set the buffer time to be 100ms
[mk: the following text was copied from
https://github.com/MusicPlayerDaemon/MPD/pull/167]

For certain format (hi-res files) and normal buffer size hardware, The
hardware may at once consume most of the buffers. However, in Delay()
function, MPD is supposed to wait for 25 ms after the next try. it
will create a hiccup. The negative impact is much major than
increasing the latency.

I understand larger buffers come at a price. That's why in my earlier
commit last year I significantly reduced it. However, the buffer size
in CoreAudio is set according to the hardware, which is super small
latency. For instance, the system audio of 2015 generation of macbook
pro has maximum buffer size of 4096 samples, which is just 0.09s for
44.1k framerate, or 0.04s for 96k frames --- . compare to the 0.5 sec
latency alsa plugin has, even if we quadruple it, it's still super
tiny.
2017-12-12 10:56:42 +01:00
Max Kellermann
fbc4bb29dc Merge branch 'v0.20.x' 2017-12-03 16:22:08 +01:00
Max Kellermann
de90d401d2 MusicChunk: add magic value IGNORE_REPLAY_GAIN
This fixes spurious replay gain logs when the player inserts silence
chunks, because those silence chunks had no replay gain attached,
resetting the ReplayGainFilter state, flipping it forth and back.
2017-12-03 11:39:12 +01:00
Yue Wang
7ba7ce3af7 Correctly set the mixer plugin for osx output 2017-12-02 23:29:23 -08:00
Max Kellermann
7d579e7400 lib/alsa/NonBlock: throw exception on error
Avoid another potential deadlock: if no file descriptors are
registered, our non-blocking ALSA code cannot ever work.
2017-11-14 21:08:07 +01:00
Max Kellermann
e0f777d4eb output/alsa: move code to LockCaughtError() 2017-11-14 21:07:59 +01:00
Max Kellermann
febd1ad09c output/alsa: fix deadlock bug
After UnlockActivate() returns, we not only need to check for errors,
but also for more room in the ring buffer.  If we don't check the ring
buffer, it may be drained already, and the cond.wait() call will never
finish.

Closes #151
2017-11-14 21:02:53 +01:00
Max Kellermann
e2c81aa9ea Merge branch 'v0.20.x' 2017-11-14 12:31:13 +01:00
Max Kellermann
014f8cd693 output/httpd: flush encoder after tag
Without the flush, ReadPage() may not return any data, or not all
data.  This may result in incomplete ddata the new "header" page,
corrupting streams with some encoders such as Vorbis.

Fixes #145
2017-11-14 12:00:14 +01:00
Max Kellermann
c582a9faae event/MultiSocketMonitor: add "noexcept" 2017-11-12 17:42:50 +01:00
Max Kellermann
390e830994 {mixer,output}/alsa: migrate from DeferredMonitor to DeferEvent 2017-11-12 17:27:58 +01:00
Max Kellermann
44c60567dd output/alsa: add "allowed_formats" setting
Allows defining a list of supported audio formats, and allows
switching on and off DoP with certain formats.

This is a first rough draft.  The setting syntax and its semantics may
still be redesigned.
2017-11-10 23:05:50 +01:00
Max Kellermann
20199e770c output/shout: use the shout_metadata_t only once
There is no documentation on whether calling shout_metadata_add()
multiple times on one instance is allowed.  To be sure, let's allocate
the object on demand each time in SendTag().
2017-11-10 22:30:53 +01:00
Max Kellermann
4c824e5309 output/shout: simplify shout_tag_to_metadata() 2017-11-10 22:26:25 +01:00
Max Kellermann
981bc85879 output/shout: relax quality and bitrate checks, forward as-is 2017-11-10 22:19:00 +01:00
Max Kellermann
015527d870 output/shout: make "quality" and "bitrate" local variables 2017-11-10 22:17:51 +01:00
Max Kellermann
6464b4b372 encoder/Configured: glue code to initialize PreparedEncoder 2017-11-10 21:54:57 +01:00
Max Kellermann
fef9747fbf output/shout: use MIME type instead of the encoder plugin name
This is more robust, for example it allows using the Shine encoder
plugin instead of LAME.
2017-11-10 21:52:54 +01:00
Max Kellermann
13816c1c7d output/{recorder,httpd,shout}: use std::unique_ptr to manage PreparedEncoder pointer 2017-11-10 21:35:22 +01:00
Max Kellermann
c54a920d13 output/httpd: make enum strictly-typed 2017-11-10 21:25:03 +01:00
Max Kellermann
83f8eeec44 output/httpd: migrate from DeferredMonitor to DeferEvent 2017-11-10 21:18:00 +01:00
Max Kellermann
b83fbad6a1 output/httpd: use C++11 initializers 2017-11-10 21:15:57 +01:00
Max Kellermann
0ff4350352 event/ServerSocket: pass UniqueSocketDescriptor by value
Passing it by value is actually smaller (32 bit) than the rvalue
reference (64 bit pointer), and it ensures that the object is consumed
after the call returns, no matter how the methods are implemented.
2017-11-10 20:43:14 +01:00
Max Kellermann
5fd2b7cc79 event/SocketMonitor: eliminate Read(), Write()
Migrate callers to GetSocket().Read(), GetSocket.Write(), which is the
same.
2017-11-10 20:37:52 +01:00
Max Kellermann
59a8836924 event/SocketMonitor: add "noexcept" 2017-11-10 20:20:07 +01:00
Max Kellermann
49784513b1 util/{Const,Writable}Buffer, ...: rename IsEmpty() to empty(), imitating STL 2017-11-10 19:24:33 +01:00
Max Kellermann
523051132d Merge branch 'v0.20.x' 2017-11-05 17:48:41 +01:00
cathugger
b111a8fe8d output/Thread: ensure pending tags are flushed in all cases
Fixes hanging playback with soxr resampler.

Closes #139, #141
2017-11-05 17:42:32 +01:00
Max Kellermann
55e6629fb4 output/Control: catch and log StartThread() exceptions 2017-10-30 08:39:44 +01:00
Max Kellermann
e2a74051dc lib/alsa/HwSetup: return effective parameters 2017-10-26 12:13:00 +02:00
Max Kellermann
b7e035b6f3 output/alsa: move AlsaSetupHw() to lib/alsa/HwSetup.cxx 2017-10-26 11:15:01 +02:00
Max Kellermann
890f1f5928 lib/alsa/Format: move HAVE_ALSA_DSD* definitions from the Alsa output plugin 2017-10-26 09:39:18 +02:00
Max Kellermann
b30c37eb79 output/alsa: move functions to lib/alsa/Format.hxx 2017-10-26 09:30:45 +02:00
Max Kellermann
b08cb148ae output/alsa: move class PeriodBuffer to lib/alsa/PeriodBuffer.hxx 2017-10-26 09:27:36 +02:00
Max Kellermann
6657801fb1 output/alsa: pass SampleFormat& to AlsaSetupFormat() 2017-10-26 08:46:28 +02:00
Max Kellermann
a199366157 output/alsa: remove period_time adjust loop
This loop was introduced in commit
24c1f46353, but -EPIPE is not a possible
error condition for snd_pcm_hw_params().  This code does not appear to
make sense.  Problems with a wrong period_time should be caught before
that by snd_pcm_hw_params_set_period_time_near().

This commit removes the last "goto" in MPD!  Yay!
2017-10-26 08:40:59 +02:00
Max Kellermann
ddabe1a6df output/alsa: add "noexcept" 2017-10-26 08:18:05 +02:00
Max Kellermann
e7b47ce335 output/alsa: in_frame_size is a debug-only variable 2017-10-26 08:17:21 +02:00
Max Kellermann
5ce93d6fa8 output/sndio: refuse to build with libroarsndio
RoarAudio's sndio emulation has been a source for annoyances.  First,
their headers turned out to be broken with C++, due to their use of
the "new" keyword.  Then they used a preprocessor macro to rename
"sio_hdl" to something else, effectively disallowing the use of
forward declarations.  Enough is enough, and I'm removing support for
it.

RoarAudio users should better use the RoarAudio output plugin.
2017-09-19 19:38:43 +02:00
Max Kellermann
735eabb066 output/sndio: move #include below guard 2017-09-19 18:59:04 +02:00
Max Kellermann
412ff762bb output/sndio: use forward declarations 2017-09-19 18:58:13 +02:00
Max Kellermann
44bbf42a9f Merge branch 'v0.20.x' 2017-09-19 18:58:02 +02:00
Max Kellermann
75c740fe2b output/sndio: fix indent 2017-09-19 18:50:35 +02:00
Max Kellermann
6c8d86bb90 output/sndio: rename the "sio_hdl" variable to avoid clash with struct name 2017-09-19 18:49:33 +02:00
Christopher Zimmermann
030f87c90c Add sndio mixer plugin 2017-09-16 11:58:33 +02:00
Christopher Zimmermann
ae941a7665 SndioOutput: Move class definition to header
no change in behaviour.
2017-09-16 09:14:56 +02:00
Max Kellermann
d0f6131ba4 output/Interface: allow Pause() to throw exception
Coverity discovered that the Pulse plugin could throw exceptions from
Pause(), but that method was marked "noexcept" because its caller was
not designed to catch exceptions.  So instead of avoiding exceptions
(by catching and logging them in each and every implementation), let's
allow them, and do the catch/log game in the MPD core.
2017-09-08 14:45:53 +02:00
Max Kellermann
91438b6540 output/Interface: the default Pause() implementation fails
Fixes regression from commit 31bad5f7af:
if Pause() returns true, the output thread is running a busy loop,
causing 100% CPU usage, instead of just closing the output.

Closes #105
2017-08-31 15:02:15 +02:00
Matthew Leon
aa9c6062b0 Merge branch 'v0.20.x' into master
contains OSX mixer
2017-08-22 10:36:37 +01:00
Matthew Leon
5fb39658f1 OSX mixer 2017-08-21 20:05:50 +01:00
Max Kellermann
9d0a71f245 output/Jack: add "noexcept" 2017-08-11 12:41:11 +02:00
Max Kellermann
ff1b435232 output/Jack: reorder methods 2017-08-11 12:39:42 +02:00
Max Kellermann
33b4114534 system/fd_util: remove unused library 2017-08-11 09:20:15 +02:00
Max Kellermann
3c7c0515d8 output/oss: use class FileDescriptor 2017-08-10 19:42:23 +02:00
Max Kellermann
df5cc3f0f6 fs/FileSystem: OpenFile() returns UniqueFileDescriptor 2017-08-10 19:34:52 +02:00
Max Kellermann
9a5bcc6db0 net/ServerSocket: pass UniqueSocketDescriptor&& to OnAccept() 2017-08-10 19:20:14 +02:00
Max Kellermann
492b20a89d event/SocketMonitor: use class SocketDescriptor 2017-08-10 19:19:58 +02:00
Max Kellermann
fcfc8bacc0 output/httpd: remove obsolete accept() error check 2017-08-10 19:19:53 +02:00
Max Kellermann
54de8b8e77 net/*, ...: use AF_LOCAL instead of AF_UNIX 2017-08-10 13:12:13 +02:00
Max Kellermann
a257504ba4 mixer/Plugin: pass AudioOutput to init()
Fix breakage from commit bea5681fd8
2017-08-10 13:07:36 +02:00
Max Kellermann
31bad5f7af output/Interface: convert to abstract class
Yet another C-style vtable replaced with C++.
2017-08-10 09:01:41 +02:00
Max Kellermann
1cf7f3d87c output/Solaris: use class FileDescriptor 2017-08-10 08:56:56 +02:00
Max Kellermann
9c9a9ccd5c output/Interface: convert to class, make attributes private 2017-08-09 17:03:07 +02:00
Max Kellermann
7381236de6 output/Interface: remove unused attribute "parent" 2017-08-09 17:03:00 +02:00
Max Kellermann
bea5681fd8 output/Interface: define a new struct AudioOutput
Hide struct FilteredAudioOutput from the plugins, preparing for hiding
MPD's core internals.
2017-08-08 18:58:40 +02:00
Max Kellermann
e11229494e output/Filtered: add method NeedFullyDefinedAudioFormat()
Avoid accessing FilteredAudioFormat attributes directly.
2017-08-08 18:57:59 +02:00
Max Kellermann
ccc0fcb5b7 output/Shout: move ConfigureShoutAudioInfo() call to Open()
Configure the AudioFormat after opening the encoder, because only now
we know the final format.
2017-08-08 18:56:14 +02:00
Max Kellermann
6e24381962 output/Shout: move code to ShoutSetAudioInfo() 2017-08-08 18:56:12 +02:00
Max Kellermann
3ab905644d output/Shout: open the encoder first, then open connection
This order will be necessary for proper AudioFormat initialization,
because the encoder may change the format.
2017-08-08 18:53:04 +02:00
Max Kellermann
f46d545307 output/Shout: pass shout_t* to shout_connect() 2017-08-08 18:52:03 +02:00
Max Kellermann
8134b0073b output/Shout: move write_page() into the struct 2017-08-08 18:47:37 +02:00
Max Kellermann
6ab19c7ef2 output/Shout: pass shout_t* to handle_shout_error() 2017-08-08 18:47:30 +02:00
Max Kellermann
d22361f7c7 output/Shout: remove unnecessary nullptr check 2017-08-08 18:47:02 +02:00
Max Kellermann
06c7e55188 output/Filtered: add methods SupportsEnableDisable(), SupportsPause() 2017-08-08 15:54:49 +02:00
Max Kellermann
b3eb8489f3 output/Filtered: add a few OutputPlugin method wrappers 2017-08-08 14:27:19 +02:00
Max Kellermann
5431fca99b output/Filtered: add attribute "log_name" 2017-08-08 14:02:58 +02:00
Max Kellermann
47c9d6ac64 output/Internal: rename source to Filtered.cxx 2017-08-07 21:50:13 +02:00
Max Kellermann
d0157af13e filter/Internal: rename struct AudioOutput to FilteredAudioOutput
Prepare to add an abstract class AudioOutput, to be implemented by
plugins, to get rid of the C-style vtable.
2017-08-07 18:47:39 +02:00
Max Kellermann
fc04620519 output/Internal: move code to ConfigureConvertFilter() 2017-08-07 18:42:10 +02:00
Max Kellermann
d4ee165253 output/Thread: move OpenSoftwareMixer() to the end
This call cannot fail, but needs cleanup if others fail.  By moving it
to the end, we eliminate some cleanup.
2017-08-07 18:42:09 +02:00
Max Kellermann
4f7f577a57 output/Internal: add OpenSoftwareMixer()
Moved code from AudioOutputControl::InternalOpen2().
2017-08-07 18:33:07 +02:00
Max Kellermann
612def5c11 output/Internal: rename CloseFilter() to CloseSoftwareMixer() 2017-08-07 18:32:43 +02:00
Max Kellermann
b8be7ec90e filter/Normalize: add normalize_filter_prepare() 2017-08-07 18:28:52 +02:00
Max Kellermann
a3d71f4b91 filter/Convert: add convert_filter_prepare() 2017-08-07 18:27:00 +02:00
Max Kellermann
9250819b75 filter/Volume: add volume_filter_prepare()
Circumvent filter_new() with a fake ConfigBlock.
2017-08-07 18:23:13 +02:00
Max Kellermann
04738636ca output/Finish: fold internal function into FinishDestroy() 2017-08-07 18:15:15 +02:00
Max Kellermann
07d1b3780d output/Control: move two AudioOutput methods to Finish.cxx 2017-08-07 18:13:57 +02:00
Max Kellermann
27d68d8fdd output/Internal: move the Mutex to struct AudioOutputControl
struct AudioOutput should not know or care about multi-threading.
2017-08-07 17:44:46 +02:00
Max Kellermann
546b773b21 output/Internal: remove mutex code from Close() 2017-08-07 17:43:58 +02:00
Max Kellermann
15dcaeda0f output/Internal: remove mutex code from BeginPause(), IteratePause() 2017-08-07 17:40:40 +02:00
Max Kellermann
8f42ba13ef output/Internal: simplify "return" statements in IteratePause() 2017-08-07 17:40:13 +02:00
Max Kellermann
5990017d51 output/Internal: remove mutex code from Enable() and Disable() 2017-08-07 17:39:20 +02:00
Max Kellermann
3197c0fd7d output/Thread: move code to InternalCloseOutput() 2017-08-07 17:35:43 +02:00
Max Kellermann
4580c685f1 output/Thread: unlock the mutex for several AudioOutput calls 2017-08-07 17:08:49 +02:00
Max Kellermann
67232453d4 output/Control: more locking information in API docs 2017-08-07 16:56:41 +02:00
Max Kellermann
b4cce80727 output/Thread: move code to InternalClose() 2017-08-07 16:34:29 +02:00
Max Kellermann
89a2e5ded3 output/Thread: rename InternalClose() to InternalCheckClose() 2017-08-07 16:33:20 +02:00
Max Kellermann
9d6b4f46d4 output/Thread: move AudioOutput methods to Internal.cxx 2017-08-07 16:26:50 +02:00
Max Kellermann
dad7d7e798 util/TruncateString: rename CopyString() to CopyTruncateString() 2017-07-05 17:15:58 +02:00
Max Kellermann
4b94ae8040 util/StringUtil: move CopyString() to TruncateString.cxx 2017-07-05 17:11:34 +02:00
Max Kellermann
6e2b348758 output/Internal: move the "open" flag to struct AudioOutputControl 2017-06-15 22:52:46 +02:00
Max Kellermann
613dd67784 output/Internal: move the AudioOutputSource to struct AudioOutputControl 2017-06-08 22:13:47 +02:00
Max Kellermann
58683f02ec output/Thread: move the AudioOutputSource::Open() call to InternalOpen()
Prepare for moving the AudioOutputSource to class AudioOutputControl.
2017-06-08 22:08:01 +02:00
Max Kellermann
7cb82fe8f3 output/Thread: move code to InternalClose() 2017-06-08 21:59:48 +02:00
Max Kellermann
0494779ecb output/Thread: move software_mixer_set_filter() out of the "try" block
That function is "noexcept".
2017-06-08 21:49:41 +02:00
Max Kellermann
7467b85019 output/Thread: rename audio_format to in_audio_format 2017-06-08 13:20:55 +02:00
Max Kellermann
7dea615f74 output/{Source,Thread}: make the AudioFormat parameter const 2017-06-08 13:19:34 +02:00
Max Kellermann
3010d182fc output/Internal: move "really_enabled" flag to class AudioOutputControl 2017-06-08 09:55:49 +02:00
Max Kellermann
a72a02f0f2 output/Thread: move Enable() call to InternalEnable() 2017-06-08 09:51:13 +02:00
Max Kellermann
614df96382 output/Thread: move Enable() call out of Open() 2017-06-08 09:50:34 +02:00
Max Kellermann
669d7a6feb output/Thread: move Close() call out of Disable() 2017-06-08 09:34:24 +02:00
Max Kellermann
d600b937f1 output/Thread: move code to InternalDisable() 2017-06-08 09:32:07 +02:00
Max Kellermann
979f1b6c39 release v0.20.9
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkz5jkQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEubuD/kBXMcV4XawqGNNtSHdrY8CxSL8wJMCMJQl
 aMgRkKLPRml8Hj9FNNG9pjXBuT+qUgPX7t9gBEiT7c+sV3fHH40gUf1js5GIsEPm
 BAVfvww5EhmQWWVhPTLk1iZ4jp6E96mDmIG1znwo7etSZHXU8RJfR7woBi3SPJ9f
 OPcrimskNuWpAWeaEIKi/1Iwzy8d9VK9Ttb73gA3M5zSm7ioXzt3YClpwLRM8JU6
 QeUJchy6VwXnygswjUNmbhPc3GsD2FyUZ4OtJ0hodnqqajfldBxhcHUnQk4zZULr
 1nLSyOuA9bwLuFohH1T6HiY9z8PFzgqdIHvsjOJgZ4gQa69PVNjal2tUEUav9zFv
 aK4LvTVPnIk+hqRbtLpV7/rPKuClrC9BO4oYdBGBDNY4hqVpvRA9obP1s00aOi+K
 UhYqLqg7yeIEeTlUxFOhXJCKAEL69BuXT5ihJtDlB/dCUzv37sEch/4WDgs7uc+O
 9kJYlElvozw57mbczsee/PCSnSWrLCq/qG/bNEUUQOTueWNuifh3PL62UXGgfbEH
 01hJDyLr6ETSmWn7rjTfLJiHThX/EQQvOhs+35fbCyry65z4tFwrilGDmFVUWGPq
 /6QEpY1D6q4fkoma/iWOZoTkfKewatAPGMGWoJaGhCnfQFz4VTFtS2bDtuUctQ16
 jnXnPFxqBw==
 =0SSp
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.9'

release v0.20.9
2017-06-04 12:57:05 +02:00
Max Kellermann
a057b4f6d8 *: add lost of "noexcept" specifications 2017-06-04 12:46:48 +02:00
Max Kellermann
1fa1790da5 output/Internal: move the "pause" flag to struct AudioOutputControl 2017-05-23 11:23:10 +02:00
Max Kellermann
dd29e6e475 output/pulse: add "pause" flag
Don't access AudioOutput::pause.
2017-05-23 11:17:04 +02:00
Max Kellermann
ae4b30a697 output/httpd: add "pause" flag
Don't access AudioOutput::pause.
2017-05-23 11:13:41 +02:00
Max Kellermann
353299168a output/Thread: skip WaitForDelay() after resuming playback
This allows removing the "base.pause" check from the JACK output
plugin, and will allow removing similar accesses from other plugins.
2017-05-23 11:00:28 +02:00
Max Kellermann
a50b2c3b85 output/Thread: rename {Play,Pause}() to Internal{Play,Pause}() 2017-05-23 10:59:17 +02:00
Max Kellermann
ebecee3d85 output/Internal: move "client" to struct AudioOutputControl 2017-05-23 00:32:03 +02:00
Max Kellermann
194f733ca7 output/MultipleOutputs: use LoadOutputControl() in AddNullOutput() 2017-05-23 00:31:31 +02:00
Max Kellermann
3907ddbcc4 output/{Internal,Control}: add "noexcept" 2017-05-23 00:17:23 +02:00
Max Kellermann
e616be0a42 output/Thread: move code to InternalOpen() 2017-05-23 00:08:36 +02:00
Max Kellermann
5eef146871 output/Internal: move several flags to struct AudioOutputControl 2017-05-22 23:40:20 +02:00
Max Kellermann
2e65686fc0 output/Control: add method Configure()
Prepare to move some configuration settings from AudioOutput to
AudioOutputControl.
2017-05-22 23:36:45 +02:00
Max Kellermann
e5847f1ddf output/MultipleOutputs: move code to LoadOutputControl() 2017-05-22 23:35:32 +02:00
Max Kellermann
59e4f1ee0f *: remove lots of GCC 4.8 fallback code
We can remove those C++11 and C++14 kludges because we require GCC 4.9
now.
2017-05-16 11:29:15 +02:00
Max Kellermann
0a3a5a7c65 Merge branch 'v0.20.x' 2017-05-16 10:09:20 +02:00
Max Kellermann
b3c82f8886 output/{osx,haiku,pulse,sles}: add missing "noexcept"
Fixes build failure on OS X, closes #44.  With the other plugins,
that's not critical, because those use the AudioOutputWrapper, which
hides this problem.
2017-05-16 07:12:30 +02:00
Max Kellermann
c5996c0593 *: add "noexcept" to many, many function prototypes
See commit 71f0ed8b74
2017-05-15 23:05:45 +02:00
Max Kellermann
4faef28cc5 release v0.20.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkaFL0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEr4ID/9iAQC+7fFv06uLOm48Ufu+PgoD8uJkAwF5
 QuLQkc85g9urn+bu9N7Qs7Vypp7aLyGcJKY0jyA8wxkOj24pUC3GYk80daUt561V
 5s20FnoS/Uoman3CSJL94IfCUBxejizE6vgIIHTc5bb6U0qIsPub/8JTTE2Ih7uP
 nvFZ5uBQ+YTc7at+iIH9123eUMKkitkh8osNblovqQT9v42++Tm4ztAytRHBjwUA
 Itew5HhlvahbLKqFs/7vmICh/YX1FcOV7cV+erEWYfkH0KCI2bhSle4u2d0CBOvD
 VJlDnBCo9bM7WKcPYqJiFFFXA0CRk06wbkkkAtwF4zjp8xos7aQcq4FyQnYL8KXo
 5lijIhRwBURBd+nt8oA9kuEhBt/T75otcemJkzVaYappHTJCLjhxSGcPt8mw+nE9
 9WQzsp/MIVzg9l5g3D9S/43xM7uhvn98Tn1Qf2s8YRd2o8CZeOhW+X3RvbCvVPv2
 mOlx4sFAv8DOJ3KxMdqiJT+PmylPyJluQdqH+tMc8BdPg/kpSpYIPTuSjjRqK1yh
 ld5do0HtAAwiHtvXfk5YVFjJSpO0c8yVn6xci2Cl4k/5ZHj2UE1ln+N5vCea2BRF
 2J3HAjROwtcwY3lU1jFnEAogf24KWiFJqhhC0EqBGUdlrM8Dn37P5cEWWjROIMNK
 lPEdovokNw==
 =CdDy
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.7'

release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann
788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann
71f0ed8b74 *: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann
89b900432e output/Internal: move thread-specific stuff to AudioOutputControl
The AudioOutput struct (which is exposed to all plugins) should not be
aware that it's being controlled by another thread.
2017-04-28 22:04:30 +02:00
Max Kellermann
8bb9d0960b output/Control: add struct AudioOutputControl
Will move attributes from struct AudioOutput that are specific to the
OutputThread.  The new struct AudioOutputControl is a holder for the
AudioOutput pointer.

This prepares for making the output list more dynamic, to allow moving
outputs to between partitions.
2017-04-28 22:04:24 +02:00
Max Kellermann
59181ac5fb output/Thread: move code to BeginPause(), IteratePause() 2017-04-28 22:01:20 +02:00
Max Kellermann
2a831fa547 output/Output*: drop "Output" prefix from source file name 2017-04-28 21:42:24 +02:00
Max Kellermann
f6e428ac22 Merge branch 'v0.20.x' 2017-04-24 11:44:27 +02:00
Max Kellermann
95b62a843a Merge branch 'add-original-year-tag' of git://github.com/tremby/MPD 2017-04-21 18:55:34 +02:00
Bart Nagel
ccb4f44caf Add support for the OriginalDate tag
See https://picard.musicbrainz.org/docs/mappings/

This tag is useful when the user would like all releases of the same
album to be sorted next to each other.
2017-04-21 09:43:26 -07:00
Max Kellermann
c788c76dc9 output/Internal: add method IsBusy() 2017-04-18 23:15:46 +02:00
Max Kellermann
2e4e1c7f48 output/Control: drop "Output" prefix from file name 2017-04-18 22:36:48 +02:00
Bart Nagel
0a7d612f41 Remove some redundant code 2017-04-18 16:10:38 +02:00
Max Kellermann
f85d4d28d1 output/alsa: work around dmix non-blocking snd_pcm_drain() bug
See code comment.  Bug was reported against MPD, but it's really an
alsa-lib bug.

 https://bugs.musicpd.org/view.php?id=4662
2017-03-29 20:36:04 +02:00
Max Kellermann
dae8b78569 output/httpd: copy the Page reference; fixes use-after-free 2017-03-29 20:17:09 +02:00
François Revol
46aa4d2f91 haiku: fix build
Some missing bits when converted to C++ exceptions...
2017-02-20 11:25:00 +01:00
Max Kellermann
512e81c629 output/httpd: use emplace() instead of push() 2017-02-19 20:48:17 +01:00
Max Kellermann
452666f742 output/httpd: wake up the I/O thread only if pages have been read from encoder 2017-02-19 20:46:20 +01:00
Max Kellermann
72008d951b output/httpd: no mutex lock while reading data from encoder 2017-02-19 20:45:16 +01:00
Max Kellermann
72146e7800 output/httpd: use std::lock_guard 2017-02-19 20:43:45 +01:00
Max Kellermann
f7af1bb8e2 output/httpd: cancel the DeferredMonitor in Close() 2017-02-19 20:41:34 +01:00
Max Kellermann
f88f1fca3f output/httpd: move Close() lock into the I/O thread
Fixes a potential deadlock introduced by commit 945287358b
2017-02-19 20:41:06 +01:00
Max Kellermann
26e4a40cc7 output/httpd/Page: use std::shared_ptr instead of class RefCount 2017-02-19 20:17:57 +01:00
Max Kellermann
8b1931072a output/httpd/Page: no variable size, use AllocatedArray
Using variable-size objects is not worth the trouble here.  Let's drop
this and use existing and simpler code.
2017-02-19 20:13:41 +01:00
Max Kellermann
45e15b6cc6 output/httpd/Page: make all attributes private 2017-02-19 20:13:35 +01:00
Max Kellermann
be7e52c882 output/httpd/Page: remove unused method Concat() 2017-02-19 20:13:19 +01:00
Max Kellermann
4162ce0bc5 output/httpd/Page: use uint8_t instead of unsigned char 2017-02-19 19:49:53 +01:00
Max Kellermann
7e46277016 Merge branch 'v0.20.x' 2017-02-19 19:46:18 +01:00
Max Kellermann
4bb83781e8 output/httpd/IcyMetaDataServer: cast length to unsigned
Fixes another buffer overflow: if the stream has a very long title or
URL, resulting in a metadata string of more than 2 kB, icy_string[0]
is a negative value, which gets casted to size_t - ouch!

 https://bugs.musicpd.org/view.php?id=4652
2017-02-19 19:28:52 +01:00
Max Kellermann
a73195b7cc output/httpd/IcyMetaDataServer: pad the string with 15 spaces
Fixes a buffer overflow due to the bad formula rounding the buffer
size up.  At the same time, remove the "+1" from the meta_length
calculation, which takes the padding into account and at the same time
implements proper rounding.
2017-02-19 19:27:37 +01:00
Max Kellermann
1bd00b8a9a output/httpd/IcyMetaDataServer: remove the int cast
Why did this cast exist??
2017-02-19 19:27:37 +01:00
Max Kellermann
1e972174a6 output/MultipleOutputs: add method AddNullOutput() 2017-02-17 23:53:49 +01:00
Max Kellermann
47dffe66aa output/alsa: fix race condition on early snd_pcm_writei() error
During UnlockActivate() while the mutex is unlocked, the IOThread can
set a new error condition, and will never again wake up the
OutputThread.  This race condition can cause a deadlock in the
OutputThread.
2017-02-15 11:23:44 +01:00
Max Kellermann
781487c4dd thread/Thread: use BoundMethod 2017-02-10 22:46:09 +01:00
Max Kellermann
835136dcd3 output/Thread: add assertion on the ao_plugin_play() result 2017-02-10 22:24:36 +01:00
Max Kellermann
4a80e9cb25 output/alsa: copy the PcmExport result to the ring_buffer
.. and not the input data.

Regression from commit b1c7649edb (integer underflow).

 https://bugs.musicpd.org/view.php?id=4639
2017-02-10 22:23:00 +01:00
Max Kellermann
cfd056231b output/alsa: use the EventLoop& parameter instead of io_thread_get() 2017-02-10 21:21:15 +01:00
Max Kellermann
b1c7649edb output/alsa: non-blocking mode
Use SND_PCM_NONBLOCK, and perform all snd_pcm_writei() calls in the
IOThread.  Use a lockless queue to copy data from the OutputThread to
the IOThread.

This rather major change aims to improve MPD's internal latency.  All
waits are now under MPD's control, instead of blocking inside
libasound2.

As a side effect, an output's filter is now decoupled from the actual
device I/O, which solves a major latency problem with the conversion
filter on slow CPUs and small period buffers.  See:

 https://bugs.musicpd.org/view.php?id=3900
2017-02-09 21:36:18 +01:00
Max Kellermann
03a97d87ea tag/Tag*: rename several source files 2017-02-08 08:49:42 +01:00
Max Kellermann
df4af2b550 release v0.20.4
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAliSTDkQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEsIQD/4iNkylzLp8mID2aFT690MFzv4TRXi2XS7v
 r3Rlx3hpGyDdzeXZeFc5zxsc9Ei8OfLcdFC/Umj9LjQanXakOxwsdhagrW9cadNX
 YLxkyVcREXalmzUvoWeRnya1LjoTdYA8llvG2tAJosXVr0o/GHZi56aHcrYnW2a6
 XD8kEk5k9beuEcBLk1rdZCTGPbVLwCFvMcpZ7j5Hd4kDGQjjw2aoEaPWchJdhLQh
 p+GRSU+A8hyTo9zy+aNO3cKvq6zqVxDLlHnIqh8XPWQoLPyWuD7ETvwERKmdmiPZ
 bSo0MR7azTlhkWbNZxjPHgZuacJDlwKvXPg1ofjn8VVcaVe5ONeX+1WP0ozUYqyU
 fmhLxMHKuwZcKo6do/jNhAVp//VBWhSwJHPA8kjBTuZHHc0HvgyTxlAgvzlrSswe
 dxc8vnvzgJfUKz5k7mf3amVg6Cu1CmNi59CkyL0NL+8N0inyMfdeQuQEYgbPoI6X
 jIRwACfXpMX75VtiDaNpnFLBjL5emE6u2bDoU2c5ezgpthaWjb0PqSmoLBBF8TNm
 k0ecXlIwCjT3pDcqmFdqgG3AJiYLTgX0rETC8PInl6toLzr2oVMVlijU3YK5PjMl
 nTvgs8TwprTWImgcBnidqRMb39p3AKs12pHfZ4Y5Iu82Bm60acZQMkv6sQh43Wyc
 +W2+T3D2IA==
 =b2Fz
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.4'

release v0.20.4
2017-02-01 22:05:33 +01:00
Max Kellermann
38d263ac19 output/sndio: work around a libroar C++ incompatibility
Same as in commit e02d8ad8d2, but this time for the sndio plugin
which can be emulated by libroar.
2017-02-01 19:53:23 +01:00
Max Kellermann
8fd9d91974 output/Plugin: pass EventLoop& to init()
Eliminate dependency on io_thread_get().
2017-01-25 22:54:41 +01:00
Max Kellermann
d3f35dab1e output/ao: convert to class, make attributes private 2017-01-25 10:46:09 +01:00
Max Kellermann
487e2618cd output/ao: use AudioOutputWrapper 2017-01-25 10:45:20 +01:00
Max Kellermann
30d5186db4 output/ao: use const_cast instead of the union hack 2017-01-25 10:44:19 +01:00
Max Kellermann
cbe59714d4 output/solaris: convert to class, make attributes private 2017-01-25 10:33:38 +01:00
Max Kellermann
704a28ca17 output/solaris: use AudioOutputWrapper 2017-01-25 10:29:42 +01:00
Max Kellermann
8d70d10aba output/httpd: use AudioOutputWrapper 2017-01-25 10:05:08 +01:00
Max Kellermann
ddd8b16f2b output/roar: use AudioOutputWrapper::Init() 2017-01-25 10:05:08 +01:00
Max Kellermann
b79ce77ec5 output/Wrapper: add missing include 2017-01-25 10:05:08 +01:00
Max Kellermann
fead4bbfd9 output/Plugin: convert pointers to references 2017-01-25 09:48:59 +01:00
Max Kellermann
6b968beede output/alsa: convert to class, make attributes private 2017-01-24 23:08:16 +01:00
Max Kellermann
f68dd1bffb output/alsa: make AlsaSetup() an AlsaOutput method 2017-01-24 23:06:33 +01:00
Max Kellermann
f92b71ca99 output/alsa: move code from AlsaSetup() to AlsaSetupSw() 2017-01-24 23:05:29 +01:00
Max Kellermann
2b79fe2d6a output/alsa: move code from AlsaSetup() to AlsaSetupHw() 2017-01-24 22:48:48 +01:00
Max Kellermann
5e93cfdd9e output/Source: reset the ReplayGain serials ion OpenFilter()
Each close/open cycle resets the Filter's state, because a new Filter
instance is being created.  That results in the serials
(replay_gain_serial and other_replay_gain_serial) being out of sync
with the internal ReplayGainFilter state.

So instead of initializing those serials once, we need to initialize
them each time we create new ReplayGainFilter instances, i.e. in
OpenFilter().

 https://bugs.musicpd.org/view.php?id=4632
2017-01-23 17:55:04 +01:00
Max Kellermann
39114f91a7 AudioFormat: replace struct audio_format_string with class StringBuffer, return it 2017-01-17 22:18:21 +01:00
Max Kellermann
6eea56861b AUTHORS, ...: update my email address 2017-01-17 11:54:55 +01:00
Max Kellermann
d14ec6aea5 output/Thread: reconfigure ConvertFilter for its new input AudioFormat
If the input AudioFormat changes but the out_audio_format doesn't
change (e.g. because there is a fixed "format" setting in this
"audio_output" section), the ConvertFilter needs to be reconfigured.
This didn't happen, resulting in awful static noise after changing
songs.
2017-01-15 01:24:17 +01:00
Max Kellermann
917cedf893 output/Thread: move AudioFormat logging code around 2017-01-15 01:23:49 +01:00
Max Kellermann
193dd71600 output/Thread: remember the original filter audio format in local variable 2017-01-15 01:21:14 +01:00
Max Kellermann
4ad0747c78 output/alsa: explicitly mention all snd_pcm_state() enums
I want a compiler warning when a new state needs to be considered
here.
2017-01-14 20:49:15 +01:00
Max Kellermann
c7b0c46d9f output/recorder: fix typo in variable name
Fixes the dreaded error "Failed to create : No such file or
directory".

 https://bugs.musicpd.org/view.php?id=4625
2017-01-12 21:36:32 +01:00
Max Kellermann
df578c91ad output/alsa: log DoP mode 2017-01-11 22:50:40 +01:00
Max Kellermann
70008c47c9 output/alsa: support DSD_U16 2017-01-11 22:47:21 +01:00
Max Kellermann
8364029db8 output/alsa: move code to PlayRaw() 2017-01-11 21:38:05 +01:00
Max Kellermann
78a73eac53 pcm/Export: add (dummy) method Cancel()
We'll have some code for it soon.
2017-01-11 15:41:28 +01:00
Max Kellermann
533cb99c33 output/Source: reset all filters in Cancel() 2017-01-11 15:39:18 +01:00
Max Kellermann
79726940dc output/Source: un-inline Cancel() 2017-01-11 15:39:00 +01:00
Max Kellermann
9c4df66925 pcm/Export: halve the sample rate for DoP
Move this sample rate fixup from the ALSA output plugin to PcmExport,
where it belongs.
2017-01-11 10:33:23 +01:00
Max Kellermann
c143adba91 pcm/Export: add CalcOutputSampleRate(), CalcInputSampleRate()
Prepare for DSD sample rate fixups.
2017-01-10 23:48:26 +01:00
Max Kellermann
5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann
3c565baf9d output/Source: clear current_chunk in Close()
Fixes assert failure after unpausing.
2017-01-03 10:50:02 +01:00
Max Kellermann
2e182e84c3 thread/Mutex: remove ScopeLock, use std::lock_guard directly 2017-01-03 07:11:57 +01:00
Max Kellermann
4484411a77 output/Internal: add various trivial getter methods 2016-12-29 23:28:54 +01:00
Max Kellermann
61a151c803 output/State: add missing mutex lock 2016-12-29 23:28:46 +01:00
Max Kellermann
5149c950aa output/Multiple: add missing mutex lock 2016-12-29 23:28:46 +01:00
Max Kellermann
18f4d846c9 output/Internal: make the Mutex mutable 2016-12-29 23:28:37 +01:00
Max Kellermann
db95aa250d output/Control: pass "force" flag to LockUpdate()
Reduce overhead by eliminating MultipleOutputs::ResetReopen().
2016-12-29 23:20:26 +01:00
Max Kellermann
982d1bf662 output/Init: convert audio_output_setup() to method 2016-12-29 22:59:03 +01:00
Max Kellermann
256f40d4f5 output/Multiple: obtain detailed error information in Open() 2016-12-29 14:46:13 +01:00
Max Kellermann
ef9acc54ec output/Internal: remember the most recent error 2016-12-29 14:21:12 +01:00
Max Kellermann
a9f2d25957 output/Thread: unify exception handling 2016-12-29 14:10:37 +01:00
Max Kellermann
4011899846 system/PeriodClock: use std::chrono::steady_clock 2016-12-28 22:23:45 +01:00
Max Kellermann
28e743ba70 output/Timer: include cleanup 2016-12-28 22:23:45 +01:00
Max Kellermann
71e7d32b08 output/Timer: use std::chrono 2016-12-28 22:00:33 +01:00
Max Kellermann
d5e422970c output/Plugin: delay() returns std::chrono::steady_clock::duration 2016-12-28 22:00:29 +01:00
Max Kellermann
a3ca9963a5 output/Timer: pass size_t to Add() 2016-12-28 10:17:29 +01:00
Max Kellermann
2d3c23876c output/Timer: use C++11 initializers 2016-12-28 10:16:41 +01:00
Max Kellermann
bd8d8eef3e output/Timer: no "time" initialization if !started 2016-12-28 10:16:11 +01:00
Max Kellermann
9e33074735 output/Thread: move software_mixer_set_filter() call to Open()
.. and remove the obsolete method OpenFilter().
2016-12-27 14:44:39 +01:00
Max Kellermann
d6d465cdf4 output/Thread: fix assertion failure in CLOSE handler
Convert assertion to runtime check; this assertion could fail when the
output was closed due to an error before CLOSE arrived.
2016-12-27 07:57:22 +01:00
Max Kellermann
e76573cc1a output/Thread: use "true" instead of "1" 2016-12-27 07:53:02 +01:00
Max Kellermann
3fa6dc71e2 output/Source: add assertion 2016-12-26 20:10:00 +01:00
Max Kellermann
6fec269844 output/SharedPipeConsumer: add thread-safety documentation 2016-12-26 20:09:10 +01:00
Max Kellermann
b6004b6837 output/Source: release the mutex while the filter runs
The filter can take some time to finish, even more so on a weak
machine with a saturated CPU.  By not holding the mutex during that
time, we can reduce PlayerThread latency a lot, because that thread
needs to synchronize a lot with all outputs.
2016-12-26 20:02:15 +01:00
Max Kellermann
86d3b25aec output/Source: add Fill(), ReadTag(), PeekData(), ConsumeData()
Don't expose MusicChunk instances, provide higher-level access to
chunk contents.
2016-12-26 13:53:22 +01:00
Max Kellermann
8a407bfbb0 output/Thread: move code to new class AudioOutputSource 2016-12-26 13:35:19 +01:00
Max Kellermann
d30a590d9e configure.ac: use MPD_AUTO for libsndio and Haiku 2016-12-26 13:35:19 +01:00
Max Kellermann
f95e404be1 outputThread: optimize Command::OPEN
Try harder to skip steps (reopen filter, reopen output) if the
AudioOutput is already open.
2016-12-24 14:05:11 +01:00
Max Kellermann
ffb8b4fc68 output/Internal: add method ClearTailChunk() 2016-12-22 14:46:59 +01:00
Max Kellermann
f86d6b0162 output/Control: move pipe initialization to the OutputThread
Un-protect the SharedPipeConsumer instance, and make it available in
the OutputThread only.  This gives more well-defined mutex protection.
2016-12-22 14:04:38 +01:00
Max Kellermann
71c72ed072 output/Control: use Command::OPEN to unpause, remove special case 2016-12-22 14:04:38 +01:00
Max Kellermann
a8d343e07b output/Thread: update in_audio_format before ReopenFilter() 2016-12-22 14:04:34 +01:00
Max Kellermann
d020172181 output/Thread: keep the device open if the audio format hasn't changed
Add another condition to Reopen() which allows keeping it open.
2016-12-21 17:45:01 +01:00
Max Kellermann
e5c9f6c1fe output/Internal: add attribute request.audio_format
Make in_audio_format accessible only from within the OutputThread, and
add a new one for inter-thread communication.
2016-12-21 17:00:29 +01:00
Max Kellermann
176dc11748 output/Thread: ao_filter_chunk() throws exception on error
Move the error logging to AudioOutput::PlayChunk().
2016-12-20 17:40:11 +01:00
Max Kellermann
c2abd02b9b output/Thread: use ConstBuffer::skip_front() 2016-12-20 17:38:08 +01:00
Max Kellermann
12ecfdd423 output/Thread: convert pointer to reference 2016-12-20 17:35:38 +01:00
Max Kellermann
67cfbfc2f3 output/SharedPipeConsumer: update API documentation 2016-12-20 16:35:14 +01:00
Max Kellermann
ccb45b6f6e output/Client: new interface to replace direct access to class PlayerControl 2016-12-14 20:29:15 +01:00
Max Kellermann
ece5971027 output/Multiple: move Wait() to struct PlayerControl
Eliminate a dependency from MultipleOutputs on PlayerControl.
2016-12-14 19:37:01 +01:00
Max Kellermann
7e1b53480e output/MultipleOutputs: parallelize EnableDisable() 2016-12-14 08:41:42 +01:00
Max Kellermann
6425b4f9f5 output/MultipleOutputs: parallelize AudioOutput destruction
Reduce latency by stopping all AudioOutputs asynchronously.
2016-12-14 08:35:07 +01:00
Max Kellermann
fb907f5f76 output/Thread: KILL implicitly closes and disables the AudioOutput
Reduce shutdown latency by two commands per output.
2016-12-14 08:29:09 +01:00
Max Kellermann
b107a1583f output/MultipleOutputs: move code to AudioOutput::EnableDisableWait() 2016-12-14 08:00:43 +01:00
Max Kellermann
ced3f320eb output/MultipleOutputs: reduce lock/unlock calls in EnableDisable()
Use ScopeLock to manage the lock; don't unlock after obtaining the
"really_enabled" flag; keep the same lock during EnableWait() /
DisableWait().
2016-12-14 07:54:05 +01:00
Max Kellermann
a9d7293818 output/Thread: wake up the player thread periodically while playing
Without this, the pipe would run empty very often, which may result in
an xrun if the roundtrip to the PlayerThread and back takes too long.
By waking up the PlayerThread before the pipe runs empty, we make MPD
much more latency tolerant, which is a major optimization.
2016-12-13 22:39:49 +01:00
Max Kellermann
265ad4b96a output/Thread: eliminate redundant nullptr check 2016-12-13 22:20:41 +01:00
Max Kellermann
92eeb4969f output/Thread: don't wake up the player after receiving command in Play()
If we have a pending command, then the player thread is already awake.
Even if not, we'll wake it up as soon as we have finished the command.
2016-12-13 22:17:06 +01:00
Max Kellermann
6fcddaf8fa output/Thread: use AtScopeExit() to revert the in_playback_loop flag 2016-12-13 22:15:52 +01:00
Max Kellermann
41fd583fbc output/Thread: eliminate one ScopeLock 2016-12-13 21:57:03 +01:00
Max Kellermann
ceba6816de output/Thread: split Open()
Simplify the code, eliminate duplicate rollback code and eliminate the
"goto" kludge.
2016-12-13 21:46:27 +01:00
Max Kellermann
093cb475bb output/Thread: simplify the retry_audio_format declaration 2016-12-13 21:34:43 +01:00
Max Kellermann
d44790b35f output/Thread: reduce locking further in Open() 2016-12-13 21:26:28 +01:00
Max Kellermann
f8164a3dd1 output/Thread: unlock mutex during OpenFilter() 2016-12-13 21:24:14 +01:00
Max Kellermann
c20126598f output/Thread: remove unused variable 2016-12-13 21:24:05 +01:00
Max Kellermann
6c818bb37a AudioFormat: add method WithMask(), shortcut for ApplyMask() 2016-12-13 20:57:46 +01:00
Max Kellermann
df91f3738a output/Thread: remove a useless out_audio_format setting
Now that I can see the Reopen() method clearly, it is obvious that the
out_audio_format setting will get overwritten by the following Open()
call.
2016-12-13 20:43:29 +01:00
Max Kellermann
b5b268f606 output/Thread: remove another redundant "open" check 2016-12-13 20:41:54 +01:00
Max Kellermann
ce6b8c94a2 output/Thread: convert redundant runtime check to assertion 2016-12-13 20:29:16 +01:00
Max Kellermann
6e643fe58b output/Thread: don't deinitialize the pipe in Close() 2016-12-13 20:28:19 +01:00
Max Kellermann
2bf91a0487 output/Internal: merge REOPEN and OPEN 2016-12-13 20:07:00 +01:00
Max Kellermann
2775d747ac output/Thread: move MusicPipe code to class SharedPipeConsumer 2016-12-13 16:33:23 +01:00
Max Kellermann
dc05dd7ca1 output/Multiple: make chunk_is_consumed_in() an AudioOutput method 2016-12-11 21:59:28 +01:00
Max Kellermann
3000b9dcde filter/ReplayGain: add ReplayGainConfig copy
Remove dependency on ReplayGain global variables.
2016-12-03 12:51:02 +01:00
Max Kellermann
3b867462a3 filter/ReplayGain: remove FilterPlugin instance, add explicit constructor 2016-12-03 12:34:23 +01:00
Max Kellermann
bfb0897b54 filter/ReplayGain: convert pointers to references 2016-12-03 12:13:45 +01:00
Max Kellermann
5f396e824f ReplayGainMode: convert to strictly-typed enum 2016-11-24 17:34:57 +01:00
Max Kellermann
4f229c254c ReplayGainInfo: move enum ReplayGainMode to separate header 2016-11-24 17:34:57 +01:00
Max Kellermann
509f62f68d output/MultipleOutputs: throw exception instead of calling FatalError() 2016-11-24 14:04:40 +01:00
Max Kellermann
35a2a48c47 Merge branch 'v0.19.x' 2016-11-17 22:20:24 +01:00
Max Kellermann
5c3e55b5b1 {input,output}/alsa: fix gcc 7.0 -Wimplicit-fallthrough 2016-11-16 19:50:38 +01:00
Dave Hocker
f6a85f0b0b output/osx: fix build failure 2016-11-10 12:55:08 +01:00
Max Kellermann
d9cb85df83 output/Plugin: remove 'Error&' parameters, use C++ exceptions only 2016-11-09 12:36:21 +01:00
Max Kellermann
445e82be75 output/Multiple: migrate from class Error to C++ exceptions 2016-11-09 12:31:23 +01:00
Max Kellermann
b78cc7e48a output/Thread: remove obsolete pcm_domain check, this is defunct 2016-11-09 12:15:35 +01:00
Max Kellermann
ac9ce0b3ad output/Init: migrate _setup() from class Error to C++ exceptions 2016-11-09 12:09:00 +01:00
Max Kellermann
cf2b814629 output/Init: migrate Configure() from class Error to C++ exceptions 2016-11-09 12:06:54 +01:00
Max Kellermann
bbe7a37359 output/Internal: hide Configure() and remove the non-configuring constructor 2016-11-09 12:06:06 +01:00
Max Kellermann
d0aa154ea6 output/null: migrate from class Error to C++ exceptions 2016-11-09 12:03:20 +01:00
Max Kellermann
df4616ae4a output/osx: migrate from class Error to C++ exceptions
Beware, this commit was not tested.  I don't have OS X, but I want to
prepare an API change.
2016-11-09 11:51:28 +01:00
Max Kellermann
10f62db9fd output/osx: use std::unique_ptr
Eliminate all those "goto"s and make the function exception-safe.
2016-11-09 11:50:14 +01:00
Max Kellermann
5c075210d6 output/osx: use AtScopeExit() to call CFRelease() 2016-11-09 11:49:21 +01:00
Max Kellermann
0cf85b0771 output/haiku: eliminate DoClose() 2016-11-09 11:42:00 +01:00
Max Kellermann
fa90047e52 output/haiku: migrate from class Error to C++ exceptions
Beware, this commit was not tested.  I don't have Haiku, but I want to
prepare an API change.
2016-11-09 11:39:11 +01:00
Max Kellermann
b9f64fe19b output/haiku: embed "format" into the HaikuOutput class
Avoid one level of dynamic allocation.
2016-11-09 11:36:38 +01:00
Max Kellermann
dd072912e8 output/solaris: migrate from class Error to C++ exceptions 2016-11-09 11:18:19 +01:00
Max Kellermann
9dbdc75689 output/httpd: migrate from class Error to C++ exceptions 2016-11-09 08:40:10 +01:00
Max Kellermann
dce211dbba output/sles: migrate from class Error to C++ exceptions 2016-11-09 08:35:35 +01:00
Max Kellermann
b4e5fa5c1b output/roar: migrate from class Error to C++ exceptions 2016-11-09 08:29:44 +01:00
Max Kellermann
f12fa7e20a output/shout: migrate from class Error to C++ exceptions 2016-11-08 15:40:19 +01:00
Max Kellermann
96f8f1da0c output/OpenAL: migrate from class Error to C++ exceptions 2016-11-08 15:19:30 +01:00
Max Kellermann
db7eec042e output/sndio: migrate from class Error to C++ exceptions 2016-11-08 15:15:16 +01:00
Max Kellermann
52aed3f8a1 output/jack: migrate from class Error to C++ exceptions 2016-11-08 15:11:21 +01:00
Max Kellermann
cadd186f1b output/jack: use AtScopeExit() 2016-11-08 15:10:38 +01:00
Max Kellermann
dd9ab16d67 output/recorder: migrate from class Error to C++ exceptions 2016-11-07 09:48:10 +01:00
Max Kellermann
d8b6aff23a encoder: migrate from class Error to C++ exceptions 2016-11-07 09:25:51 +01:00
Max Kellermann
b8aac3f8fc output/Thread: catch and log send_tag() exceptions 2016-11-07 09:25:47 +01:00
Max Kellermann
4aab97ccb1 config/Path: throw std::runtime_error on error 2016-11-07 09:07:50 +01:00
Max Kellermann
1859ba5ec8 output/winmm: 8 bit playback is not supported
Everything must be S16.
2016-11-07 08:53:57 +01:00
Max Kellermann
54d5184255 output/winmm: use std::array 2016-11-07 08:50:58 +01:00
Max Kellermann
0c5b986fc4 output/winmm: use range-based "for" 2016-11-07 08:28:41 +01:00
Max Kellermann
7b2cdd618e output/winmm: use AudioOutputWrapper 2016-11-07 08:08:42 +01:00
Max Kellermann
30bb3f1fcb output/winmm: migrate from class Error to C++ exceptions 2016-11-07 07:42:18 +01:00
Max Kellermann
b45ea66175 output/pipe: migrate from class Error to C++ exceptions 2016-11-05 15:24:10 +01:00
Max Kellermann
543c5034af output/fifo: migrate from class Error to C++ exceptions 2016-11-05 15:13:14 +01:00
Max Kellermann
c8aa7afdc6 output/oss: migrate from class Error to C++ exceptions 2016-11-05 13:18:45 +01:00
Max Kellermann
b35bb1b50c output/alsa: use C++ initializers 2016-11-04 11:31:23 +01:00
Max Kellermann
6341be9cdf output/alsa: migrate from class Error to C++ exceptions 2016-11-04 11:31:23 +01:00
Max Kellermann
93a14a93f9 output/alsa: use Error::FormatPrefix() 2016-11-04 11:31:23 +01:00
Max Kellermann
d6559e2ac9 output/Thread: fix wrong error reference in catch clause 2016-11-04 11:31:23 +01:00
Max Kellermann
65e6755b8b output/ao: migrate from class Error to C++ exceptions 2016-11-02 12:36:13 +01:00
Max Kellermann
6ead9750f4 output/pulse: migrate from class Error to C++ exceptions 2016-11-02 11:01:22 +01:00
Max Kellermann
6532c7e089 output/pulse: use C++11 initializers 2016-11-02 11:01:07 +01:00
Max Kellermann
8b3d934230 output/Thread: catch Pause() exceptions 2016-11-02 10:53:43 +01:00
Max Kellermann
e2b7c30811 event/BufferedSocket: pass std::exception_ptr to OnSocketError() 2016-11-02 10:38:05 +01:00
Max Kellermann
e17805f208 config/Block: GetPath() throws exception on error 2016-10-28 23:08:42 +02:00
Max Kellermann
d8bcdca55a config/Block: rename GetBlockPath() to GetPath() 2016-10-28 23:07:26 +02:00
Max Kellermann
f6f2a3b366 output/alsa: throw C++ exception on init error 2016-10-28 22:56:27 +02:00
Max Kellermann
d52c7e7a1b output/httpd: throw C++ exception on init error 2016-10-28 22:42:10 +02:00
Max Kellermann
c4acccac14 output/Init: add constructor overload which calls Configure() 2016-10-28 22:41:07 +02:00
Max Kellermann
13001c018c AudioParser: throw exception on error 2016-10-28 22:36:04 +02:00
Max Kellermann
0c343cb1c3 encoder/Plugin: migrate from class Error to C++ exceptions 2016-10-28 21:29:01 +02:00
Max Kellermann
aead221184 event/ServerSocket: migrate from class Error to C++ exceptions 2016-10-28 21:22:25 +02:00
Max Kellermann
0c464b24ad OutputInit: allow "init" to throw exception 2016-10-28 21:11:52 +02:00
Max Kellermann
a249a630c0 OutputThread: support plugins throwing exceptions 2016-10-28 21:10:18 +02:00
Max Kellermann
f39823eac0 OutputThread: use class ScopeUnlock for exception-safety 2016-10-28 21:10:18 +02:00
Max Kellermann
69de99636f OutputPlugin: update API documentation 2016-10-28 21:10:18 +02:00
Max Kellermann
5b2b4bf13c config/Param: use CamelCase 2016-10-28 11:38:37 +02:00
Yue Wang
d0302d1bbe _delay in output plugin will now ask the thread to repeatedly wait until it returns 0.
change the _delay API doc so that it matches its implementation behavior.
2016-09-19 10:24:56 -07:00
Yue Wang
d73267df5e use osx_output_delay to wait until ring buffer is able to write
This further optimize the performance. 

This is now working properly with a conditional variable bug being fixed (8bbfb5cda1).
2016-09-19 08:51:03 -07:00
Yue Wang
f881917d2f Fix a bug that buffer_frame_size is not properly initialized 2016-09-18 21:09:57 -07:00
Yue Wang
99244f51b0 Remove unused imports 2016-09-18 19:40:55 -07:00
Yue Wang
606d029ed9 Kill mutex and locks in osx_render. Improve performance. Also fix an initialization problem 2016-09-18 19:40:04 -07:00
Yue Wang
e4b9d679fb options for sample rate syncing and device hogging 2016-09-18 19:12:45 -07:00
Yue Wang
4a8a33ea85 Hogging is for user selected device only.
do not hog system device.
2016-09-18 13:15:46 -07:00
Yue Wang
ac4b83046a Add sample rate synchronization and device hogging to core audio plugin
which ensures mpd do bit perfect playback on OS X
2016-09-18 12:52:08 -07:00
Max Kellermann
e7d327226a mixer: migrate to C++ exceptions 2016-09-09 14:44:15 +02:00
Max Kellermann
860064c812 output/pulse: use a RTTI lock guard
Make all the locks exception-safe.
2016-09-09 14:36:24 +02:00
Max Kellermann
1c07f197de Filter/Plugin: migrate from class Error to C++ exceptions 2016-09-04 20:07:05 +02:00
Max Kellermann
13c32111a0 Filter/Internal: migrate from class Error to C++ exceptions 2016-09-04 19:38:41 +02:00
Max Kellermann
12091fcfb1 thread/Util: throw exception on error 2016-09-04 15:15:11 +02:00
Max Kellermann
3fea624cca output/Thread: use Close() after error in ReopenFilter()
Now that CloseFilter() may be called again, we can reduce code
duplication.
2016-09-04 15:09:51 +02:00
Max Kellermann
9007dd9ab7 output/Thread: clear Filter pointers in CloseFilter()
This allows calling CloseFilter() multiple times.
2016-09-04 15:09:05 +02:00
Max Kellermann
08166cf330 output/Internal: initialize the Filter pointers
With the configuration "replay_gain_handler none", the Filter pointers
are never initialized, which can crash MPD.

 https://bugs.musicpd.org/view.php?id=4571
2016-09-04 15:05:42 +02:00
Earnestly
e2f6cc9c9f Don't overwrite ss.format
Currently the switch statement is invalidated by ss.format being overwritten
with the default value of PA_SIMPLE_S16NE which results in white noise during
playback as my server is expected S16LE (S16NE).

Signed-off-by: Earnestly <zibeon@gmail.com>
2016-08-23 10:01:56 +02:00
Max Kellermann
ba69ade024 Compiler.h: add macro CLANG_OR_GCC_VERSION() 2016-08-23 09:48:58 +02:00
Max Kellermann
ea0e6d9824 fs/FileSystem: RemoveFile() throws exception on error 2016-08-15 22:25:15 +02:00
Max Kellermann
743fa73a01 Merge branch 'v0.19.x' 2016-08-15 12:33:07 +02:00
Nils Schneider
62000670e3 Support S24_P32/S32/FLOAT sample formats on Pulse
This is based on a patch from Ian Scott in 2014. It was never committed,
so I figured I'd fix the outstanding issue and resubmit it.

https://www.mail-archive.com/mpd-devel%40musicpd.org/msg00139.html
2016-08-15 10:02:29 +02:00
Max Kellermann
ac49043fbb output/pulse: move variable declaration down 2016-08-15 10:02:22 +02:00
Jacob Vosmaer
4d6192adcd Use a ScopeLock around condition.wait() 2016-08-07 15:47:21 +02:00
Jacob Vosmaer
9f1ada898e Improve readability of frame completion loop 2016-08-07 14:15:55 +02:00
Jacob Vosmaer
5617521380 Must lock/unlock around wait 2016-08-06 15:25:58 +02:00
Jacob Vosmaer
9835a2545d Do not assume two pops are enough 2016-08-06 15:19:10 +02:00
Jacob Vosmaer
c28cefeeb0 output/osx: wait-free render callback
Closes https://bugs.musicpd.org/view.php?id=4537 .

Removed the 'cancel' function because it violates 'single producer,
single consumer'.
2016-08-06 00:08:10 +02:00
Max Kellermann
2777a23672 Merge branch 'v0.19.x' 2016-07-29 20:25:59 +02:00
Max Kellermann
83aed7051c output/shout: rename "encoding" to "encoder"
The user manual specifies "encoder", which is consistent with other
output plugins.  "encoding" should be deprecated.
2016-07-29 10:52:03 +02:00
Jacob Vosmaer
ad80acb22a output/osx: remove incorrect memset behavior
In e068d62 I added code that zeros the remainder of the output buffer
if there are not enough input frames available. I have now learned
that we can signal to the caller of the render callback how much data
is in the output buffers. In practice, the input buffer is so large
that it does not matter so much how we handle input buffer underruns,
but I suppose that saying 'there is no data' is better than 'here is
some silence for you'.
2016-07-22 20:58:37 +02:00
Jacob Vosmaer
4cd9abe632 output/osx channel_map feature 2016-07-09 18:29:35 +02:00
Max Kellermann
b67e7df38e release v0.19.17
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXgCv6AAoJECNuiljG20USR3cP/RALB4qlhecMo6H8VwZvfjiA
 FHfhBKfdpHM3U3EEIZc1zxwHIdWk1yELtmx298vmJbWUifpYAYarXF5497tZf2XE
 AVfhTltEJEd7xB5ZULnEScM1aHzMZm5HRcHwM1UqNCsXP7PT8fmpk7gw19pKOChT
 h8V3+tpC403lCIcHcJGlkuzgZvKIZDs73g7a0+4GxD9XRAPwnMYRl3Cfd8QjKT/U
 r67AcOwQlS6hWJFs0K1JjOQwfwbRq2YmuOmFJua6n8O6CI/7t4h3faSQ0V/5qjFd
 k/pAMRtX6mz3mjVhZv4cuMy+QILWlxUNwLBIwtxSfbwcFKrN0vtIRG8O9622hTs2
 +mvYiVboWABk6hnukiDAfki96jWYHlsCJR5oIK9DZ4nBe5RVp0r9Nq/ook2AW2it
 6VgYIDBI5zS/blyJzXtzDVWEtSmLFxm21JSl+jHfWDtL6/rQGimdVOFkRw40oCBz
 seYb5kIbilrg6xq1KiBMT+EWmXMf+q+3YWQsu01blXGYGPhpUqhIr0h/qUfWAqMs
 fwIsoxsTrkQQjEWb6YWupPrdOLZ+kTAyaK+7v8B8JmzS/H3SohusMPUZKsQXl82s
 5LJVLtVxB9WRRmpfSoYqfk7CkTHOktCzVmiHb/FYUYElS9VKmJYYU8XQ25snCoZ6
 bYtERsH28q8rrpkWWEXP
 =IXD5
 -----END PGP SIGNATURE-----

Merge tag 'v0.19.17'

release v0.19.17
2016-07-09 00:46:09 +02:00
Jacob Vosmaer
e068d62ac6 output/osx rewrite render callback 2016-07-08 15:36:42 +02:00
Max Kellermann
1c7de0b4ac output/shout: remove pointless memset() call 2016-07-05 18:02:35 +02:00
Jacob Vosmaer
2fdbae3e1f Remove braces 2016-07-03 16:45:23 +02:00
Jacob Vosmaer
87e06793c2 Get rid of GetMacOSStatusCommentString 2016-07-03 14:06:53 +02:00
Jacob Vosmaer
8cc451a2e2 Use error.Set instead of error.Format 2016-07-03 13:36:35 +02:00
Jacob Vosmaer
723c2c7fa9 Remove some debugging code 2016-07-03 13:18:44 +02:00
Jacob Vosmaer
4dd2c5cdd5 Convert device name from CFStringRef to char* 2016-07-03 12:59:19 +02:00
Jacob Vosmaer
bdc257b40e Add debug statements 2016-07-02 23:44:21 +02:00
Jacob Vosmaer
4728f7c697 Use AudioComponent instead of Carbon Component 2016-07-02 23:35:44 +02:00
Max Kellermann
3a21241248 filter/FilterInternal: split class Filter, add class PreparedFilter
For easier state management inside filter plugins.
2016-07-01 21:04:24 +02:00
Max Kellermann
a43b0f5253 mixer/software: move Filter management to the AudioOutput 2016-07-01 18:23:53 +02:00
Dimitris Papastamos
4a6df9f961 output/sndio: Remove unused attribute
The variable is actually used in this function.
2016-06-24 09:11:36 +02:00
Dimitris Papastamos
a43ae2369b output/sndio: Add 24-bit 4-byte packed audio format support 2016-06-24 09:11:30 +02:00
Dimitris Papastamos
9a049de859 output/sndio: No need to use a loop in Play()
This is a left-over from the previous version of the code
that was retrying on EINTR.
2016-06-24 09:10:57 +02:00
Dimitris Papastamos
58b8398aa0 output/sndio: Use size_t instead of ssize_t
Some minor style fixes as well.
2016-06-23 11:11:42 +02:00
Max Kellermann
645751f680 output/Init: use C++11 initializers 2016-06-22 18:44:00 +02:00
Dimitris Papastamos
26c0924461 sndio: Eliminate remaining goto usage to conform to MPD style 2016-06-22 16:10:46 +02:00
Dimitris Papastamos
d4f801a8e9 sndio: Fix segmentation fault when audio card is removed
This can happen if you remove an external audio card or if you stop
sndiod(8) while playing a song.

sio_write() will retry internally if it fails with errno == EINTR
so no need to handle that.
2016-06-22 16:10:38 +02:00
Dimitris Papastamos
8406864963 sndio: Allow tweaking application buffer size
It defaults to 250 ms.
2016-06-22 16:09:57 +02:00
Dimitris Papastamos
d68cadba7b sndio: No need to use a timer so get rid of it 2016-06-22 11:28:58 +02:00
Max Kellermann
1207fd1f16 output/sndio: remove unnecessary initialization 2016-06-22 11:01:37 +02:00
Dimitris Papastamos
8aa61e230c sndio: Add option to select output device 2016-06-22 11:00:06 +02:00
Max Kellermann
2c7bda8a3b output/sndio: define SIO_DEVANY if it is undefined
Fixes build failure on Debian Wheezy.
2016-06-22 10:58:44 +02:00
Dimitris Papastamos
d58c5dd398 sndio: Implement sndio_test_default_device() 2016-06-22 10:54:59 +02:00
Dimitris Papastamos
171da7a347 Add sndio output plugin 2016-06-22 08:44:47 +02:00
Max Kellermann
d3c7fac606 thread/Thread: throw std::system_error on error 2016-06-17 19:11:20 +02:00
Max Kellermann
b376536a3b encoder/Interface: convert PreparedEncoder to abstract class 2016-05-04 18:32:52 +02:00
Max Kellermann
e7edc02647 encoder/Interface: move instance methods to abstract class
Rename struct Encoder to PreparedEncoder, and add a new (abstract)
class Encoder which represents one encoder instance.
2016-05-04 16:32:31 +02:00
Max Kellermann
6407b7c591 output/recorder: use C++11 initializers 2016-05-04 15:18:57 +02:00
Max Kellermann
e14cd92d59 output/shout: use AudioOutputWrapper 2016-05-04 15:06:29 +02:00
Max Kellermann
73cadd1798 output/shout: dispose encoder in destructor 2016-05-04 15:05:48 +02:00
Max Kellermann
fb9840f1f8 output/shout: call shout_shutdown() in destructor 2016-05-04 15:03:55 +02:00
Max Kellermann
492aaa3375 output/shout: use C++11 initializers 2016-05-04 14:46:45 +02:00
Max Kellermann
4c6619e6c5 output/MultipleOutputs: use C++11 initializers 2016-04-21 13:28:31 +02:00
Max Kellermann
6a1f5667f9 util/FormatString: return AllocatedString 2016-04-12 22:59:23 +02:00
Max Kellermann
667edcd9d0 util/IterableSplitString: cheaper variant of SplitString() 2016-03-18 14:11:50 +01:00
Max Kellermann
1aee89f5ea *: include cleanup (using iwyu) 2016-03-01 22:08:13 +01:00
Max Kellermann
92f54f0b59 output/alsa: disable DoP if it fails
See http://bugs.musicpd.org/view.php?id=4496
2016-02-28 10:19:19 +01:00
Max Kellermann
ddce544b53 output/alsa: move the PcmExport::Open() call to Open() 2016-02-28 10:15:54 +01:00
Max Kellermann
21fb7eea82 output/alsa: probe DSD_U32 if DSD_U8 fails
See http://bugs.musicpd.org/view.php?id=4485
2016-02-28 09:59:09 +01:00
Max Kellermann
fd7eb43366 output/alsa: use CamelCase 2016-02-28 09:44:15 +01:00
Max Kellermann
a1add27c4c output/alsa: fix indent 2016-02-28 09:35:57 +01:00
Max Kellermann
fc8194ee1e output/alsa: fix typo 2016-02-28 09:35:55 +01:00
Max Kellermann
8ffcdb73e8 output/alsa: remove option "use_mmap"
MPD does not really take advantage of memory-mapped I/O by generating
data right into the ALSA buffer; using plain snd_pcm_mmap_writei() has
no advantage compared to snd_pcm_writei().  Let's kill this
non-feature.
2016-02-28 09:30:59 +01:00
Max Kellermann
111528e51c output/alsa: add #ifdef ENABLE_DSD
Fixes the --disable-dsd build.

See http://bugs.musicpd.org/view.php?id=4498
2016-02-28 07:29:37 +01:00
Max Kellermann
c9761bf6af output/alsa: pass PcmExport::Params to alsa_setup() 2016-02-27 07:35:35 +01:00
Max Kellermann
4a47265224 output/alsa: pass PcmExport::Params to SetupDop() 2016-02-27 07:34:58 +01:00
Max Kellermann
f0f3017a76 pcm/export: move Open() parameters to struct Params 2016-02-26 18:55:27 +01:00
Max Kellermann
6a53fb33da output/alsa: basic infrastructure for DSD_U16 and DSD_U32 2016-02-26 18:44:58 +01:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Christian Halaszovich
3392cbbd91 Emit a warning if the OutputThread fails to get realtime scheduling
This only applies to linux systems.  Here, sched_setscheduler() is
called to get realtime scheduling.  With this patch, the return value
of this function is now checked and a warning / error message is
generated if it fails.
2016-02-19 17:09:44 +01:00
Max Kellermann
e4a06da14e fs/io/OutputStream: use C++ exceptions in Write() 2015-12-16 10:24:43 +01:00
Max Kellermann
7eae3bc8c5 fs/io/FileOutputStream: use C++ exceptions in Commit() 2015-12-16 00:33:33 +01:00
Max Kellermann
24b2198668 fs/io/FileOutputStream: use C++ exceptions in constructor 2015-12-16 00:33:30 +01:00
Max Kellermann
36239895bd player/Control: add Lock prefix to locking method names 2015-11-11 16:50:57 +01:00
Max Kellermann
738583e3d4 StateFile: use StringAfterPrefix() instead of StringStartsWith() 2015-11-11 15:34:36 +01:00
Max Kellermann
733989a284 util/StringUtil: move comparison functions to StringCompare.cxx 2015-11-06 09:20:18 +01:00
Max Kellermann
15e432204e pcm/Order: new library to convert from FLAC to ALSA channel order
This new library is integrated in the PcmExport class and (if enabled)
converts MPD's channel order (= FLAC channel order) to ALSA channel
order.

This fixes:
 http://bugs.musicpd.org/view.php?id=3147
and
 http://bugs.musicpd.org/view.php?id=3255
2015-10-27 11:44:23 +01:00
Max Kellermann
94f850a588 release v0.19.11
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWL0cEAAoJECNuiljG20USkHkP/0m3kFEEgqauAIbI1t0TkKOp
 2ii5iHZeMAlsxGEc5SX5fFoXM6STbXq/3+OXBf+OnABh9b03o744QAAwh1ei9tiQ
 kMysbN2fbpHkuchx1JfrOU1ad3qfWXQri8csTtx5eRYpgyqF7Mfl1SoY1nkpherd
 j4MVq7MVqBhwCqpAfJvTFTSOlNrJ4bBcvIgGslhFYhRxMRM83KgFS//lHvbXWnOg
 fjYEO34nz0rjCfz6x2r7ZQBLeQVr9n6h24iYhSTnU7Xq9o2ezWlVRIm9YVhxoZKf
 /MRJuAzaHhGID8IvX7dPxdQJ+feUhQXSv8HSjOJBO6R2dqIScE3D6EIBHy8Cj9Bk
 O2D1SgmR+2NnjNz2GUjCIKHm9c9jTgv+rnZ2l8hweS2oUQOPHbCtOoCNAfwyP+/Y
 ms1CavNl7bUuvWrM1ipM2ZK6QfW9P4F1dtmwqtJCsqdGFyQyfACcxqmlkfxhB2vI
 NyvKAOn/TlWWQscF9id3r90sEir/J9e7IJ6oZh+uvyIfOtt8wR/Jm5/H1MA7j3iX
 XmNbe1GY3WHjCH2lRr3tIRKAE8I3HAtBzwhvq/miSESrkEnJ06VMatkoMRQT63gy
 62yaCg+ZWiBRp07ygiedYuGL19pDOhqRjY3U/b/0EHMb9ux083nuUTssqgzzO2OP
 9OPao5CPs4M4QvmiG/wF
 =RdQt
 -----END PGP SIGNATURE-----

Merge tag 'v0.19.11'
2015-10-27 11:05:47 +01:00
Max Kellermann
ac61d43720 output/Command: flush the mixer cache when enabling/disabling output
Fixes mixer lag (http://bugs.musicpd.org/view.php?id=4425).
2015-10-26 16:29:07 +01:00
Max Kellermann
6bea346c41 output/httpd: use boost::intrusive::list instead of std::forward_list 2015-10-19 16:00:26 +02:00
Max Kellermann
f066bb7716 unix/Daemon, playlist/...: remove unused Domain variables 2015-10-16 18:08:59 +02:00
Max Kellermann
ce0d896492 unix/Daemon, playlist/pls, ...: remove unused Domain variables 2015-09-17 23:15:54 +02:00
François Revol
7743647460 output: add native Haiku audio output and mixer support
Also uses the notification system to display tags.
2015-09-17 22:46:46 +02:00
Max Kellermann
5fba8d773c PlayerThread, ...: move to src/player/ 2015-08-15 15:55:46 +02:00
Max Kellermann
7652a2986b client/Response: new Client wrapper class for writing responses 2015-08-12 08:41:05 +02:00
Max Kellermann
024d978ae5 output/fifo: smaller Cancel() buffer 2015-08-06 10:15:19 +02:00
Max Kellermann
e0f55b9295 output/fifo: move the buffer into the loop 2015-08-06 10:14:53 +02:00
Max Kellermann
ccd83748f7 output/fifo: use ssize_t for the read() result 2015-08-06 10:14:35 +02:00
Max Kellermann
291ee9f86a output/fifo: simplify the Cancel() loop 2015-08-06 10:13:21 +02:00
Max Kellermann
59e4d7f0f5 output/fifo: convert struct to class 2015-08-06 09:51:03 +02:00
Max Kellermann
4647448399 output/fifo: use AudioOutputWrapper::Open(),Close() 2015-08-06 09:50:02 +02:00
Max Kellermann
7dfe841876 output/fifo: rename Open(), Close() to OpenFifo(), CloseFifo() 2015-08-06 09:49:00 +02:00