aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderInternal.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-13 19:13:47 +0100
committerMax Kellermann <max@duempel.org>2013-11-13 19:13:47 +0100
commita80b5cf19b8d2dda6db15444cd11aa9494546380 (patch)
tree1a30f2ef79bf568683895439db87aef247ef47a1 /src/DecoderInternal.cxx
parent44ac84767ee16b5445f80267589fe4a5fba0a33a (diff)
downloadmpd-a80b5cf19b8d2dda6db15444cd11aa9494546380.tar.gz
mpd-a80b5cf19b8d2dda6db15444cd11aa9494546380.tar.xz
mpd-a80b5cf19b8d2dda6db15444cd11aa9494546380.zip
DecoderInternal: move functions into the class
Diffstat (limited to '')
-rw-r--r--src/DecoderInternal.cxx37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/DecoderInternal.cxx b/src/DecoderInternal.cxx
index d5f40ad48..d4b125b29 100644
--- a/src/DecoderInternal.cxx
+++ b/src/DecoderInternal.cxx
@@ -51,24 +51,21 @@ need_chunks(DecoderControl &dc)
}
struct music_chunk *
-decoder_get_chunk(Decoder &decoder)
+Decoder::GetChunk()
{
- DecoderControl &dc = decoder.dc;
DecoderCommand cmd;
- if (decoder.chunk != nullptr)
- return decoder.chunk;
+ if (chunk != nullptr)
+ return chunk;
do {
- decoder.chunk = dc.buffer->Allocate();
- if (decoder.chunk != nullptr) {
- decoder.chunk->replay_gain_serial =
- decoder.replay_gain_serial;
- if (decoder.replay_gain_serial != 0)
- decoder.chunk->replay_gain_info =
- decoder.replay_gain_info;
-
- return decoder.chunk;
+ chunk = dc.buffer->Allocate();
+ if (chunk != nullptr) {
+ chunk->replay_gain_serial = replay_gain_serial;
+ if (replay_gain_serial != 0)
+ chunk->replay_gain_info = replay_gain_info;
+
+ return chunk;
}
dc.Lock();
@@ -80,18 +77,16 @@ decoder_get_chunk(Decoder &decoder)
}
void
-decoder_flush_chunk(Decoder &decoder)
+Decoder::FlushChunk()
{
- DecoderControl &dc = decoder.dc;
-
- assert(decoder.chunk != nullptr);
+ assert(chunk != nullptr);
- if (decoder.chunk->IsEmpty())
- dc.buffer->Return(decoder.chunk);
+ if (chunk->IsEmpty())
+ dc.buffer->Return(chunk);
else
- dc.pipe->Push(decoder.chunk);
+ dc.pipe->Push(chunk);
- decoder.chunk = nullptr;
+ chunk = nullptr;
dc.Lock();
if (dc.client_is_waiting)