From e51d9fc6a9902c2ef448abf8f1151964a441d788 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 10 Nov 2009 21:58:19 +0100 Subject: decoder/flac: pass VorbisComment to comments_to_tag() --- src/decoder/_flac_common.c | 12 +++++------- src/decoder/_flac_common.h | 2 +- src/decoder/flac_plugin.c | 6 ++++-- src/decoder/oggflac_plugin.c | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c index fca76d11e..33cfd9c3c 100644 --- a/src/decoder/_flac_common.c +++ b/src/decoder/_flac_common.c @@ -199,13 +199,10 @@ flac_parse_comment(struct tag *tag, const char *char_tnum, void flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum, - const FLAC__StreamMetadata *block) + const FLAC__StreamMetadata_VorbisComment *comment) { - FLAC__StreamMetadata_VorbisComment_Entry *comments = - block->data.vorbis_comment.comments; - - for (unsigned i = block->data.vorbis_comment.num_comments; i > 0; --i) - flac_parse_comment(tag, char_tnum, comments++); + for (unsigned i = 0; i < comment->num_comments; ++i) + flac_parse_comment(tag, char_tnum, &comment->comments[i]); } void flac_metadata_common_cb(const FLAC__StreamMetadata * block, @@ -223,7 +220,8 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block, flac_parse_replay_gain(block, data); if (data->tag != NULL) - flac_vorbis_comments_to_tag(data->tag, NULL, block); + flac_vorbis_comments_to_tag(data->tag, NULL, + &block->data.vorbis_comment); default: break; diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h index 0172ed2b1..fc240aa11 100644 --- a/src/decoder/_flac_common.h +++ b/src/decoder/_flac_common.h @@ -176,7 +176,7 @@ void flac_error_common_cb(const char *plugin, void flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum, - const FLAC__StreamMetadata *block); + const FLAC__StreamMetadata_VorbisComment *comment); FLAC__StreamDecoderWriteStatus flac_common_write(struct flac_data *data, const FLAC__Frame * frame, diff --git a/src/decoder/flac_plugin.c b/src/decoder/flac_plugin.c index 73d82a65c..e2620c676 100644 --- a/src/decoder/flac_plugin.c +++ b/src/decoder/flac_plugin.c @@ -269,7 +269,8 @@ flac_tag_load(const char *file, const char *char_tnum) if (!block) break; if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - flac_vorbis_comments_to_tag(tag, char_tnum, block); + flac_vorbis_comments_to_tag(tag, char_tnum, + &block->data.vorbis_comment); } 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; @@ -849,7 +850,8 @@ oggflac_tag_dup(const char *file) 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); + flac_vorbis_comments_to_tag(ret, NULL, + &block->data.vorbis_comment); } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { ret->time = ((float)block->data.stream_info. total_samples) / diff --git a/src/decoder/oggflac_plugin.c b/src/decoder/oggflac_plugin.c index 0c9b881b6..0f5e774c3 100644 --- a/src/decoder/oggflac_plugin.c +++ b/src/decoder/oggflac_plugin.c @@ -177,7 +177,8 @@ static void of_metadata_dup_cb(G_GNUC_UNUSED const OggFLAC__SeekableStreamDecode block->data.stream_info.sample_rate + 0.5; return; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - flac_vorbis_comments_to_tag(data->tag, NULL, block); + flac_vorbis_comments_to_tag(data->tag, NULL, + &block->data.vorbis_comment); default: break; } -- cgit v1.2.3