Commit Graph

962 Commits

Author SHA1 Message Date
Max Kellermann e06d775af5 util/CircularBuffer: add method MoveTo()
This implements wraparound, so AsyncInputStream and ThreadInputStream
can now return all of the buffer contents in one Read() call.
2025-01-29 21:28:28 +01:00
Max Kellermann 950f5f4d32 input/{async,thread}: move code to ReadFromBuffer() 2025-01-29 21:26:05 +01:00
Max Kellermann a404e5754e Merge tag 'v0.23.17'
release v0.23.17
2025-01-29 17:20:02 +01:00
Max Kellermann d7212624b0 input/{async,thread}: clear the CircularBuffer when it becomes empty
First step towards fixing https://github.com/MusicPlayerDaemon/MPD/issues/2186
2025-01-29 13:05:24 +01:00
Max Kellermann 70a0a781c8 input/async: move the IsEOF() check to a separate block 2025-01-29 12:59:04 +01:00
Max Kellermann bd78307940 input/{async,thread}: add an additional Cond field
This eliminates the ScopeExchangeInputStreamHandler kludge.
2025-01-29 12:14:42 +01:00
Max Kellermann 959826d1d1 input/ffmpeg: offload FFmpeg calls to thread
Prepare for interruptible I/O.
2024-07-30 12:43:05 +02:00
Max Kellermann ec30716e01 input/thread: implement size and seek 2024-07-30 12:33:44 +02:00
Max Kellermann dc51015c75 input/mms: move MMS_BUFFER_SIZE into the class 2024-07-30 12:33:30 +02:00
Max Kellermann 72b0eeb7b1 input/mms: invoke Start() in constructor 2024-07-30 12:31:58 +02:00
Max Kellermann b050e0132e input/{async,thread}: add an additional Cond field
This eliminates the ScopeExchangeInputStreamHandler kludge.
2024-07-29 23:17:33 +02:00
Max Kellermann cf962d94c7 input/thread: remove bogus inline 2024-07-29 23:14:16 +02:00
Max Kellermann c29d23b4c3 input/thread: use notify_one() instead of notify_all()
There's only ever one waiter, and notify_one() may be faster than
notify_all().
2024-07-29 23:09:07 +02:00
Max Kellermann 61e8df913d input/thread: check IsEOF() in IsAvailable() 2024-07-29 23:05:00 +02:00
Max Kellermann 4a55e3e8bd input/thread: check buffer.empty() in IsEOF() 2024-07-29 23:03:00 +02:00
Max Kellermann 2e78bd430c input/thread: use pass std::span<std::byte> to ThreadRead() 2024-07-29 22:32:52 +02:00
Max Kellermann dbaa72cb40 util/CircularBuffer: use std::span internally 2024-07-29 22:24:54 +02:00
Max Kellermann 902cb8efac input/thread: use std::byte instead of uint8_t 2024-07-29 22:13:50 +02:00
Max Kellermann f54210bf68 input/async: move enum definition down 2024-07-29 22:13:42 +02:00
Max Kellermann 18cb34825d input/alsa: use libfmt instead of std::string concatenation 2024-07-23 15:04:49 +02:00
Max Kellermann 3db8a4f41b lib/alsa/NonBlock: embed in "namespace Alsa" 2024-07-11 21:33:03 +02:00
Max Kellermann fb87e19bae input/Registry: replace the input_plugins_for_each macros with a container class 2024-07-11 20:52:44 +02:00
Max Kellermann 13576b8a2e lib/curl/Easy: use pass std::chrono::duration to SetTimeout() 2024-07-10 16:58:16 +02:00
Max Kellermann 381215fd73 *: use std::scoped_lock with implicit template parameter 2024-05-23 20:54:49 +02:00
Max Kellermann b64d01677b storage/nfs: optimize OpenFile() 2024-05-17 13:39:42 +02:00
Max Kellermann 2576e66a55 input/nfs: cancel the pending read operation on seek 2024-05-17 12:54:08 +02:00
Max Kellermann 1f47fe47c7 input/Open: move code to WaitReady() 2024-05-15 14:39:40 +02:00
Max Kellermann 556300d59a input/InputStream: add [[nodiscard]] 2024-05-13 12:29:16 +02:00
Max Kellermann 34f7b38f39 input/InputStream: pass std::span<std::byte> to Read() 2024-05-13 12:28:40 +02:00
Max Kellermann 6d5dab38dd input/async: pass std::string_view to constructor 2024-05-13 10:18:18 +02:00
Max Kellermann 0c1ecc96a8 *: let libfmt quote strings 2024-04-16 11:50:18 +02:00
Max Kellermann 6a99f20828 util/IntrusiveHashSet: add concept checks to *Operators
This requires adding another template argument and reordering the others.
2024-04-03 21:27:37 +02:00
Max Kellermann e4ba736d03 input/{async,rewind}, decoder/dsdiff: use std::cmp_*() for safer integer comparisons 2024-03-15 18:45:46 +01:00
Max Kellermann cc291e8c98 Merge branch 'extend-robustness-of-cdda-playback' of https://github.com/lazypingu/MPD 2024-03-15 18:39:45 +01:00
lazypingu c00d217a53 Skip track if returned LSNs are negative which indicates track errors or if track is not an audio track 2024-03-12 20:39:51 +01:00
lazypingu 9d853897cd Use track and disc functions from libcdio-paranoia to enable playback of hidden tracks and audio tracks on multisession CDs 2024-03-12 20:37:50 +01:00
lazypingu 88c77f9c8a Add debug logging if setting speed failed 2024-03-12 20:37:50 +01:00
lazypingu 1a7278f1d3 Move cddap_speed_set below cddap_open to make sure that the drive was initialized and opened before attemting to set the speed 2024-03-12 20:36:28 +01:00
Max Kellermann d685d693e8 input/rewind, archive/iso9660: use use std::cmp_*() for safe integer comparison 2024-03-11 15:09:57 +01:00
Max Kellermann 393d57b387 util/NumberParser: rename to CNumberParser
A new NumberParser library based on std::from_chars() will be added.
2024-01-04 21:02:45 +01:00
Max Kellermann 8b03ce562c input/curl: increase CURLOPT_BUFFERSIZE from 16 kB to 512 kB 2024-01-04 17:57:42 +01:00
Max Kellermann 3c5b864396 tag/IcyMetadataParser: use std::span 2023-12-21 08:42:23 +01:00
borine 2fb34697c7 input/plugins/Alsa: catch all exceptions
snd_pcm_poll_descriptors_revents() may return any error code; the
ALSA docs do not constrain the permitted values. A 'hw' device
will only ever return an error if the pfd array passed in is
invalid (-EINVAL), but other I/O plugins may return arbitary
errors. For example a network-based device may return -EPIPE etc.
The resulting exception thrown by
AlsaNonBlockPcm::DispatchSockets() must be caught to prevent the
mpd process from being aborted.
2023-12-20 13:27:25 +01:00
borine 17d944f6ce input/plugins/Alsa: limit ALSA buffer time to 2 seconds maximum
Some ALSA capture devices can have very large buffers, holding 10
seconds or more audio. Using the maximum buffer size with such
devices leads to unacceptably large, and unnecessary, latency.
Also, some ALSA drivers (e.g. HDA Intel PCH) report an invalid
maximum period size, and the period size that mpd calculates from
the maximum buffer size results in "Invalid argument" error when
applying the hw_params. Note that the "default" capture device on
many cards includes the "dsnoop" plugin which imposes a buffer
size of 16384 frames, so that "alsa://" works OK but
"alsa://plughw" or "alsa://hw" both fail.

Limit the maximum buffer time for ALSA input devices to a more useable
2 seconds, thereby avoiding both the above problems.
2023-12-20 13:26:24 +01:00
Max Kellermann 7727630f24 Merge branch 'alsa_input_exception' of https://github.com/borine/MPD 2023-12-20 13:21:37 +01:00
Max Kellermann 642de1510b lib/curl/Request: remove redundant CurlEasy wrapper methods 2023-12-09 20:54:21 +01:00
borine f61eed1a82 input/plugins/Alsa: catch all exceptions
snd_pcm_poll_descriptors_revents() may return any error code; the
ALSA docs do not constrain the permitted values. A 'hw' device
will only ever return an error if the pfd array passed in is
invalid (-EINVAL), but other I/O plugins may return arbitary
errors. For example a network-based device may return -EPIPE etc.
The resulting exception thrown by
AlsaNonBlockPcm::DispatchSockets() must be caught to prevent the
mpd process from being aborted.
2023-11-26 15:36:42 +00:00
Max Kellermann 634b38169a Merge branch 'alsa_input_buffer' of https://github.com/borine/MPD 2023-11-26 08:24:51 +01:00
Max Kellermann 0c409aa290 input/LastInputStream: use CoarseTimerEvent 2023-11-21 20:41:47 +01:00
Max Kellermann 7ccc4ddf0d io/Reader: use std::span 2023-10-07 08:44:42 +02:00