From 77e4dd81f5abedda802b8b6e895849995907b484 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 13 Mar 2022 10:55:47 -0400 Subject: option_string clean-up and consolidate with metadata_common Change-Id: I2649f6af37bd871fb8f181ae2f716ff0bcf1f65c --- lib/rbcodec/metadata/mp4.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/rbcodec/metadata/mp4.c') diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c index 41f38480b1..accc5cd662 100644 --- a/lib/rbcodec/metadata/mp4.c +++ b/lib/rbcodec/metadata/mp4.c @@ -533,13 +533,18 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3, rd_ret = 0; tag_name[rd_ret] = 0; + static const char *tn_options[] = {"composer", "iTunSMPB", + "musicbrainz track id", "album artist", NULL}; - if ((strcasecmp(tag_name, "composer") == 0) && !cwrt) + int tn_op = string_option(tag_name, tn_options, true); + + + if (tn_op == 0 && !cwrt) /*composer*/ { read_mp4_tag_string(fd, size, &buffer, &buffer_left, &id3->composer); } - else if (strcasecmp(tag_name, "iTunSMPB") == 0) + else if (tn_op == 1) /*iTunSMPB*/ { char value[TAG_VALUE_LENGTH]; char* value_p = value; @@ -552,12 +557,12 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3, DEBUGF("AAC: lead_trim %d, tail_trim %d\n", id3->lead_trim, id3->tail_trim); } - else if (strcasecmp(tag_name, "musicbrainz track id") == 0) + else if (tn_op == 2) /*musicbrainz track id*/ { read_mp4_tag_string(fd, size, &buffer, &buffer_left, &id3->mb_track_id); } - else if ((strcasecmp(tag_name, "album artist") == 0)) + else if (tn_op == 3) /*album artist*/ { read_mp4_tag_string(fd, size, &buffer, &buffer_left, &id3->albumartist); -- cgit v1.2.3