aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/flac_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/flac_plugin.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c
index 9692ba49f..ee80d667a 100644
--- a/src/decoder/flac_plugin.c
+++ b/src/decoder/flac_plugin.c
@@ -268,12 +268,8 @@ flac_tag_load(const char *file, const char *char_tnum)
block = FLAC__metadata_simple_iterator_get_block(it);
if (!block)
break;
- if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
- flac_vorbis_comments_to_tag(tag, char_tnum, block);
- } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
- tag->time = ((float)block->data.stream_info.total_samples) /
- block->data.stream_info.sample_rate + 0.5;
- }
+
+ flac_tag_apply_metadata(tag, char_tnum, block);
FLAC__metadata_object_delete(block);
} while (FLAC__metadata_simple_iterator_next(it));
@@ -485,10 +481,7 @@ flac_decode_internal(struct decoder * decoder,
}
fail:
- if (data.replay_gain_info)
- replay_gain_info_free(data.replay_gain_info);
-
- tag_free(data.tag);
+ flac_data_deinit(&data);
if (flac_dec)
flac_delete(flac_dec);
@@ -670,8 +663,7 @@ fail:
if (pathname)
g_free(pathname);
- if (data.replay_gain_info)
- replay_gain_info_free(data.replay_gain_info);
+ flac_data_deinit(&data);
if (flac_dec)
flac_delete(flac_dec);
@@ -793,8 +785,7 @@ flac_filedecode_internal(struct decoder* decoder,
}
fail:
- if (data.replay_gain_info)
- replay_gain_info_free(data.replay_gain_info);
+ flac_data_deinit(&data);
if (flac_dec)
flac_delete(flac_dec);
@@ -853,13 +844,8 @@ oggflac_tag_dup(const char *file)
do {
if (!(block = FLAC__metadata_iterator_get_block(it)))
break;
- if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
- flac_vorbis_comments_to_tag(ret, NULL, block);
- } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
- ret->time = ((float)block->data.stream_info.
- total_samples) /
- block->data.stream_info.sample_rate + 0.5;
- }
+
+ flac_tag_apply_metadata(ret, NULL, block);
} while (FLAC__metadata_iterator_next(it));
FLAC__metadata_iterator_delete(it);