decoder/flac: pass VorbisComment to comments_to_tag()

This commit is contained in:
Max Kellermann 2009-11-10 21:58:19 +01:00
parent 2f69831fb8
commit e51d9fc6a9
4 changed files with 12 additions and 11 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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) /

View File

@ -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;
}