diff options
author | Max Kellermann <max@duempel.org> | 2008-11-04 17:04:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-04 17:04:54 +0100 |
commit | 01706dd46c977acd0bce1fa7e8cc665c621b158c (patch) | |
tree | 53ff9cc9cb6d5ba637421574860e30ee5109acf1 /src | |
parent | 02a172f2c2262585dacf71dc4a54e7f870e55d14 (diff) | |
download | mpd-01706dd46c977acd0bce1fa7e8cc665c621b158c.tar.gz mpd-01706dd46c977acd0bce1fa7e8cc665c621b158c.tar.xz mpd-01706dd46c977acd0bce1fa7e8cc665c621b158c.zip |
mp4: use tag_is_empty() instead of passing the tag_is_found flag
The API of mp4_load_tag() was strange: it always returned a tag
object, no matter if a tag was found in the file; the existence of a
tag was indicated with the tag_found integer reference. This flag is
superfluous, since we can simply check whether the tag is empty or
not.
Diffstat (limited to '')
-rw-r--r-- | src/decoder/mp4_plugin.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/decoder/mp4_plugin.c b/src/decoder/mp4_plugin.c index 934ffc59b..7f17055a1 100644 --- a/src/decoder/mp4_plugin.c +++ b/src/decoder/mp4_plugin.c @@ -302,7 +302,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream) } static struct tag * -mp4_load_tag(const char *file, int *tag_found) +mp4_load_tag(const char *file) { struct tag *ret = NULL; struct input_stream input_stream; @@ -317,8 +317,6 @@ mp4_load_tag(const char *file, int *tag_found) int32_t scale; int i; - *tag_found = 0; - if (!input_stream_open(&input_stream, file)) { DEBUG("mp4_load_tag: Failed to open file: %s\n", file); return NULL; @@ -356,25 +354,18 @@ mp4_load_tag(const char *file, int *tag_found) if (0 == strcasecmp("artist", item)) { tag_add_item(ret, TAG_ITEM_ARTIST, value); - *tag_found = 1; } else if (0 == strcasecmp("title", item)) { tag_add_item(ret, TAG_ITEM_TITLE, value); - *tag_found = 1; } else if (0 == strcasecmp("album", item)) { tag_add_item(ret, TAG_ITEM_ALBUM, value); - *tag_found = 1; } else if (0 == strcasecmp("track", item)) { tag_add_item(ret, TAG_ITEM_TRACK, value); - *tag_found = 1; } else if (0 == strcasecmp("disc", item)) { /* Is that the correct id? */ tag_add_item(ret, TAG_ITEM_DISC, value); - *tag_found = 1; } else if (0 == strcasecmp("genre", item)) { tag_add_item(ret, TAG_ITEM_GENRE, value); - *tag_found = 1; } else if (0 == strcasecmp("date", item)) { tag_add_item(ret, TAG_ITEM_DATE, value); - *tag_found = 1; } free(item); @@ -391,12 +382,11 @@ static struct tag * mp4_tag_dup(const char *file) { struct tag *ret = NULL; - int tag_found = 0; - ret = mp4_load_tag(file, &tag_found); + ret = mp4_load_tag(file); if (!ret) return NULL; - if (!tag_found) { + if (tag_is_empty(ret)) { struct tag *temp = tag_id3_load(file); if (temp) { temp->time = ret->time; |