aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderAPI.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-28 17:10:12 +0100
committerMax Kellermann <max@duempel.org>2013-10-28 17:10:12 +0100
commitde1261ba28fbf88a31fda1483578130030a464d5 (patch)
treec69c2f2f2b15193fd6a249e7a8d97637026d0eda /src/DecoderAPI.cxx
parent5ee5a89a7f4e765be0a059bc8e66c16c443484b6 (diff)
downloadmpd-de1261ba28fbf88a31fda1483578130030a464d5.tar.gz
mpd-de1261ba28fbf88a31fda1483578130030a464d5.tar.xz
mpd-de1261ba28fbf88a31fda1483578130030a464d5.zip
MusicChunk: return WritableBuffer
Diffstat (limited to 'src/DecoderAPI.cxx')
-rw-r--r--src/DecoderAPI.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/DecoderAPI.cxx b/src/DecoderAPI.cxx
index eede7c903..aaa8bb17f 100644
--- a/src/DecoderAPI.cxx
+++ b/src/DecoderAPI.cxx
@@ -406,7 +406,6 @@ decoder_data(Decoder &decoder,
while (length > 0) {
struct music_chunk *chunk;
- size_t nbytes;
bool full;
chunk = decoder_get_chunk(decoder);
@@ -415,17 +414,19 @@ decoder_data(Decoder &decoder,
return dc.command;
}
- void *dest = chunk->Write(dc.out_audio_format,
- decoder.timestamp -
- dc.song->start_ms / 1000.0,
- kbit_rate, &nbytes);
- if (dest == nullptr) {
+ const auto dest =
+ chunk->Write(dc.out_audio_format,
+ decoder.timestamp -
+ dc.song->start_ms / 1000.0,
+ kbit_rate);
+ if (dest.IsNull()) {
/* the chunk is full, flush it */
decoder_flush_chunk(decoder);
dc.client_cond.signal();
continue;
}
+ size_t nbytes = dest.size;
assert(nbytes > 0);
if (nbytes > length)
@@ -433,7 +434,7 @@ decoder_data(Decoder &decoder,
/* copy the buffer */
- memcpy(dest, data, nbytes);
+ memcpy(dest.data, data, nbytes);
/* expand the music pipe chunk */