aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/oggflac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-10 21:42:15 +0100
committerMax Kellermann <max@duempel.org>2009-11-10 21:42:15 +0100
commitb6a2ffd3d761c05fd7cd7fecfe470307b6a5ed15 (patch)
treeadad8c48fe7476b3cb9a47eb5888225830b302c6 /src/decoder/oggflac_plugin.c
parent6a5f4651a12cfb624e723835b0c37f38ffb4ec64 (diff)
downloadmpd-b6a2ffd3d761c05fd7cd7fecfe470307b6a5ed15.tar.gz
mpd-b6a2ffd3d761c05fd7cd7fecfe470307b6a5ed15.tar.xz
mpd-b6a2ffd3d761c05fd7cd7fecfe470307b6a5ed15.zip
decoder/flac: added function flac_data_deinit()
Clean up tag and replay_gain_info there.
Diffstat (limited to 'src/decoder/oggflac_plugin.c')
-rw-r--r--src/decoder/oggflac_plugin.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c
index fedfdcb48..0c9b881b6 100644
--- a/src/decoder/oggflac_plugin.c
+++ b/src/decoder/oggflac_plugin.c
@@ -29,11 +29,8 @@
#include <assert.h>
#include <unistd.h>
-static void oggflac_cleanup(struct flac_data *data,
- OggFLAC__SeekableStreamDecoder * decoder)
+static void oggflac_cleanup(OggFLAC__SeekableStreamDecoder * decoder)
{
- if (data->replay_gain_info)
- replay_gain_info_free(data->replay_gain_info);
if (decoder)
OggFLAC__seekable_stream_decoder_delete(decoder);
}
@@ -264,6 +261,7 @@ oggflac_tag_dup(const char *file)
struct input_stream input_stream;
OggFLAC__SeekableStreamDecoder *decoder;
struct flac_data data;
+ struct tag *tag;
if (!input_stream_open(&input_stream, file))
return NULL;
@@ -280,15 +278,17 @@ oggflac_tag_dup(const char *file)
* data.tag will be set or unset, that's all we care about */
decoder = full_decoder_init_and_read_metadata(&data, 1);
- oggflac_cleanup(&data, decoder);
+ oggflac_cleanup(decoder);
input_stream_close(&input_stream);
- if (!tag_is_defined(data.tag)) {
- tag_free(data.tag);
+ if (tag_is_defined(data.tag)) {
+ tag = data.tag;
data.tag = NULL;
}
- return data.tag;
+ flac_data_deinit(&data);
+
+ return tag;
}
static void
@@ -344,7 +344,8 @@ oggflac_decode(struct decoder * mpd_decoder, struct input_stream *input_stream)
}
fail:
- oggflac_cleanup(&data, decoder);
+ oggflac_cleanup(decoder);
+ flac_data_deinit(&data);
}
static const char *const oggflac_suffixes[] = { "ogg", "oga", NULL };