From 82059645f18e4a8aa734e0a376d10bb52fc1cc7d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Oct 2013 21:12:37 +0200 Subject: decoder: rename the struct to "Decoder" --- src/DecoderInternal.cxx | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'src/DecoderInternal.cxx') diff --git a/src/DecoderInternal.cxx b/src/DecoderInternal.cxx index 8d89155cc..c3ce6d433 100644 --- a/src/DecoderInternal.cxx +++ b/src/DecoderInternal.cxx @@ -27,7 +27,7 @@ #include -decoder::~decoder() +Decoder::~Decoder() { /* caller must flush the chunk */ assert(chunk == nullptr); @@ -59,26 +59,24 @@ need_chunks(decoder_control &dc, bool do_wait) } struct music_chunk * -decoder_get_chunk(struct decoder *decoder) +decoder_get_chunk(Decoder &decoder) { - decoder_control &dc = decoder->dc; + decoder_control &dc = decoder.dc; DecoderCommand cmd; - assert(decoder != nullptr); - - if (decoder->chunk != nullptr) - return decoder->chunk; + if (decoder.chunk != nullptr) + return decoder.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; + 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; } dc.Lock(); @@ -90,17 +88,16 @@ decoder_get_chunk(struct decoder *decoder) } void -decoder_flush_chunk(struct decoder *decoder) +decoder_flush_chunk(Decoder &decoder) { - decoder_control &dc = decoder->dc; + decoder_control &dc = decoder.dc; - assert(decoder != nullptr); - assert(decoder->chunk != nullptr); + assert(decoder.chunk != nullptr); - if (decoder->chunk->IsEmpty()) - dc.buffer->Return(decoder->chunk); + if (decoder.chunk->IsEmpty()) + dc.buffer->Return(decoder.chunk); else - dc.pipe->Push(decoder->chunk); + dc.pipe->Push(decoder.chunk); - decoder->chunk = nullptr; + decoder.chunk = nullptr; } -- cgit v1.2.3