aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderInternal.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/DecoderInternal.cxx (renamed from src/decoder_internal.c)32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/decoder_internal.c b/src/DecoderInternal.cxx
index bc349f2ff..6970a220f 100644
--- a/src/decoder_internal.c
+++ b/src/DecoderInternal.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,15 +18,33 @@
*/
#include "config.h"
-#include "decoder_internal.h"
-#include "decoder_control.h"
-#include "pipe.h"
+#include "DecoderInternal.hxx"
+#include "DecoderControl.hxx"
+#include "MusicPipe.hxx"
+#include "MusicBuffer.hxx"
+#include "MusicChunk.hxx"
+#include "tag.h"
#include "input_stream.h"
-#include "buffer.h"
-#include "chunk.h"
#include <assert.h>
+decoder::~decoder()
+{
+ /* caller must flush the chunk */
+ assert(chunk == nullptr);
+
+ if (song_tag != nullptr)
+ tag_free(song_tag);
+
+ if (stream_tag != nullptr)
+ tag_free(stream_tag);
+
+ if (decoder_tag != nullptr)
+ tag_free(decoder_tag);
+
+ pcm_convert_deinit(&conv_state);
+}
+
/**
* All chunks are full of decoded data; wait for the player to free
* one.
@@ -87,7 +105,7 @@ decoder_flush_chunk(struct decoder *decoder)
assert(decoder != NULL);
assert(decoder->chunk != NULL);
- if (music_chunk_is_empty(decoder->chunk))
+ if (decoder->chunk->IsEmpty())
music_buffer_return(dc->buffer, decoder->chunk);
else
music_pipe_push(dc->pipe, decoder->chunk);