diff --git a/src/MusicChunk.cxx b/src/MusicChunk.cxx index 784a27785..cc2de38a1 100644 --- a/src/MusicChunk.cxx +++ b/src/MusicChunk.cxx @@ -36,7 +36,7 @@ MusicChunkInfo::CheckFormat(const AudioFormat other_format) const noexcept } #endif -WritableBuffer +std::span MusicChunk::Write(const AudioFormat af, SongTime data_time, uint16_t _bit_rate) noexcept { diff --git a/src/MusicChunk.hxx b/src/MusicChunk.hxx index c1a4cf1fd..e9516cfde 100644 --- a/src/MusicChunk.hxx +++ b/src/MusicChunk.hxx @@ -23,7 +23,6 @@ #include "MusicChunkPtr.hxx" #include "Chrono.hxx" #include "tag/ReplayGainInfo.hxx" -#include "util/WritableBuffer.hxx" #ifndef NDEBUG #include "pcm/AudioFormat.hxx" @@ -32,6 +31,7 @@ #include #include #include +#include static constexpr size_t CHUNK_SIZE = 4096; @@ -116,7 +116,7 @@ struct MusicChunkInfo { */ struct MusicChunk : MusicChunkInfo { /** the data (probably PCM) */ - uint8_t data[CHUNK_SIZE - sizeof(MusicChunkInfo)]; + std::byte data[CHUNK_SIZE - sizeof(MusicChunkInfo)]; /** * Prepares appending to the music chunk. Returns a buffer @@ -129,7 +129,7 @@ struct MusicChunk : MusicChunkInfo { * @param bit_rate the current bit rate of the source file * @return a writable buffer, or nullptr if the chunk is full */ - WritableBuffer Write(AudioFormat af, + std::span Write(AudioFormat af, SongTime data_time, uint16_t bit_rate) noexcept; diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx index a57f8d8cc..d273cde8a 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx @@ -545,11 +545,11 @@ DecoderBridge::SubmitData(InputStream *is, continue; } - const size_t nbytes = std::min(dest.size, length); + const size_t nbytes = std::min(dest.size(), length); /* copy the buffer */ - memcpy(dest.data, data, nbytes); + memcpy(dest.data(), data, nbytes); /* expand the music pipe chunk */ diff --git a/src/pcm/MixRampGlue.cxx b/src/pcm/MixRampGlue.cxx index fd8e7dfdd..ab1670b0a 100644 --- a/src/pcm/MixRampGlue.cxx +++ b/src/pcm/MixRampGlue.cxx @@ -23,6 +23,7 @@ #include "MusicPipe.hxx" #include "MusicChunk.hxx" #include "util/Compiler.h" +#include "util/ConstBuffer.hxx" #include