Commit 8307dd3e authored by Max Kellermann's avatar Max Kellermann

flac: removed "vorbis_comment_found" flag

Use tag_is_empty() instead.
parent 86dc7929
...@@ -228,14 +228,12 @@ flac_write_cb(const flac_decoder *dec, const FLAC__Frame *frame, ...@@ -228,14 +228,12 @@ flac_write_cb(const flac_decoder *dec, const FLAC__Frame *frame,
} }
static struct tag * static struct tag *
flac_tag_load(const char *file, bool *vorbis_comment_found) flac_tag_load(const char *file)
{ {
struct tag *ret = NULL; struct tag *ret = NULL;
FLAC__Metadata_SimpleIterator *it; FLAC__Metadata_SimpleIterator *it;
FLAC__StreamMetadata *block = NULL; FLAC__StreamMetadata *block = NULL;
*vorbis_comment_found = false;
it = FLAC__metadata_simple_iterator_new(); it = FLAC__metadata_simple_iterator_new();
if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) { if (!FLAC__metadata_simple_iterator_init(it, file, 1, 0)) {
const char *err; const char *err;
...@@ -267,10 +265,7 @@ flac_tag_load(const char *file, bool *vorbis_comment_found) ...@@ -267,10 +265,7 @@ flac_tag_load(const char *file, bool *vorbis_comment_found)
if (!block) if (!block)
break; break;
if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { if (block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
ret = flac_vorbis_comments_to_tag(block, ret); flac_vorbis_comments_to_tag(block, ret);
if (ret)
*vorbis_comment_found = true;
} else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) { } else if (block->type == FLAC__METADATA_TYPE_STREAMINFO) {
if (!ret) if (!ret)
ret = tag_new(); ret = tag_new();
...@@ -289,14 +284,13 @@ static struct tag * ...@@ -289,14 +284,13 @@ static struct tag *
flac_tag_dup(const char *file) flac_tag_dup(const char *file)
{ {
struct tag *ret = NULL; struct tag *ret = NULL;
bool vorbis_comment_found = false;
ret = flac_tag_load(file, &vorbis_comment_found); ret = flac_tag_load(file);
if (!ret) { if (!ret) {
g_debug("Failed to grab information from: %s\n", file); g_debug("Failed to grab information from: %s\n", file);
return NULL; return NULL;
} }
if (!vorbis_comment_found) { if (tag_is_empty(ret)) {
struct tag *temp = tag_id3_load(file); struct tag *temp = tag_id3_load(file);
if (temp) { if (temp) {
temp->time = ret->time; temp->time = ret->time;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment