decoder/flac: merged some code into flac_tag_apply_metadata()
This commit is contained in:
parent
305de100a7
commit
884be8e2b3
@ -197,7 +197,7 @@ flac_parse_comment(struct tag *tag, const char *char_tnum,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum,
|
flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum,
|
||||||
const FLAC__StreamMetadata_VorbisComment *comment)
|
const FLAC__StreamMetadata_VorbisComment *comment)
|
||||||
{
|
{
|
||||||
@ -205,6 +205,25 @@ flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum,
|
|||||||
flac_parse_comment(tag, char_tnum, &comment->comments[i]);
|
flac_parse_comment(tag, char_tnum, &comment->comments[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
flac_tag_apply_metadata(struct tag *tag, const char *track,
|
||||||
|
const FLAC__StreamMetadata *block)
|
||||||
|
{
|
||||||
|
switch (block->type) {
|
||||||
|
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||||
|
flac_vorbis_comments_to_tag(tag, track,
|
||||||
|
&block->data.vorbis_comment);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FLAC__METADATA_TYPE_STREAMINFO:
|
||||||
|
tag->time = flac_duration(&block->data.stream_info);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
|
void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
|
||||||
struct flac_data *data)
|
struct flac_data *data)
|
||||||
{
|
{
|
||||||
|
@ -182,8 +182,8 @@ void flac_error_common_cb(const char *plugin,
|
|||||||
struct flac_data *data);
|
struct flac_data *data);
|
||||||
|
|
||||||
void
|
void
|
||||||
flac_vorbis_comments_to_tag(struct tag *tag, const char *char_tnum,
|
flac_tag_apply_metadata(struct tag *tag, const char *track,
|
||||||
const FLAC__StreamMetadata_VorbisComment *comment);
|
const FLAC__StreamMetadata *block);
|
||||||
|
|
||||||
FLAC__StreamDecoderWriteStatus
|
FLAC__StreamDecoderWriteStatus
|
||||||
flac_common_write(struct flac_data *data, const FLAC__Frame * frame,
|
flac_common_write(struct flac_data *data, const FLAC__Frame * frame,
|
||||||
|
@ -268,12 +268,8 @@ flac_tag_load(const char *file, const char *char_tnum)
|
|||||||
block = FLAC__metadata_simple_iterator_get_block(it);
|
block = FLAC__metadata_simple_iterator_get_block(it);
|
||||||
if (!block)
|
if (!block)
|
||||||
break;
|
break;
|
||||||
if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
|
|
||||||
flac_vorbis_comments_to_tag(tag, char_tnum,
|
flac_tag_apply_metadata(tag, char_tnum, block);
|
||||||
&block->data.vorbis_comment);
|
|
||||||
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
|
||||||
tag->time = flac_duration(&block->data.stream_info);
|
|
||||||
}
|
|
||||||
FLAC__metadata_object_delete(block);
|
FLAC__metadata_object_delete(block);
|
||||||
} while (FLAC__metadata_simple_iterator_next(it));
|
} while (FLAC__metadata_simple_iterator_next(it));
|
||||||
|
|
||||||
@ -848,12 +844,8 @@ oggflac_tag_dup(const char *file)
|
|||||||
do {
|
do {
|
||||||
if (!(block = FLAC__metadata_iterator_get_block(it)))
|
if (!(block = FLAC__metadata_iterator_get_block(it)))
|
||||||
break;
|
break;
|
||||||
if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
|
|
||||||
flac_vorbis_comments_to_tag(ret, NULL,
|
flac_tag_apply_metadata(ret, NULL, block);
|
||||||
&block->data.vorbis_comment);
|
|
||||||
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
|
|
||||||
ret->time = flac_duration(&block->data.stream_info);
|
|
||||||
}
|
|
||||||
} while (FLAC__metadata_iterator_next(it));
|
} while (FLAC__metadata_iterator_next(it));
|
||||||
FLAC__metadata_iterator_delete(it);
|
FLAC__metadata_iterator_delete(it);
|
||||||
|
|
||||||
|
@ -170,16 +170,7 @@ static void of_metadata_dup_cb(G_GNUC_UNUSED const OggFLAC__SeekableStreamDecode
|
|||||||
|
|
||||||
assert(data->tag != NULL);
|
assert(data->tag != NULL);
|
||||||
|
|
||||||
switch (block->type) {
|
flac_tag_apply_metadata(data->tag, NULL, block);
|
||||||
case FLAC__METADATA_TYPE_STREAMINFO:
|
|
||||||
data->tag->time = flac_duration(&block->data.stream_info);
|
|
||||||
return;
|
|
||||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
|
||||||
flac_vorbis_comments_to_tag(data->tag, NULL,
|
|
||||||
&block->data.vorbis_comment);
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used by decode */
|
/* used by decode */
|
||||||
|
Loading…
Reference in New Issue
Block a user