summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata/mp4.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2022-03-13 10:55:47 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2022-03-13 10:55:47 -0400
commit77e4dd81f5abedda802b8b6e895849995907b484 (patch)
tree750656ede0dac091aa1512ccd81660ec40ddbb58 /lib/rbcodec/metadata/mp4.c
parenteb86ee296a40249c33d1969087f98108735beaa9 (diff)
downloadrockbox-77e4dd81f5abedda802b8b6e895849995907b484.tar.gz
rockbox-77e4dd81f5abedda802b8b6e895849995907b484.zip
option_string clean-up and consolidate with metadata_common
Change-Id: I2649f6af37bd871fb8f181ae2f716ff0bcf1f65c
Diffstat (limited to 'lib/rbcodec/metadata/mp4.c')
-rw-r--r--lib/rbcodec/metadata/mp4.c13
1 files changed, 9 insertions, 4 deletions
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,
533 rd_ret = 0; 533 rd_ret = 0;
534 tag_name[rd_ret] = 0; 534 tag_name[rd_ret] = 0;
535 535
536 static const char *tn_options[] = {"composer", "iTunSMPB",
537 "musicbrainz track id", "album artist", NULL};
536 538
537 if ((strcasecmp(tag_name, "composer") == 0) && !cwrt) 539 int tn_op = string_option(tag_name, tn_options, true);
540
541
542 if (tn_op == 0 && !cwrt) /*composer*/
538 { 543 {
539 read_mp4_tag_string(fd, size, &buffer, &buffer_left, 544 read_mp4_tag_string(fd, size, &buffer, &buffer_left,
540 &id3->composer); 545 &id3->composer);
541 } 546 }
542 else if (strcasecmp(tag_name, "iTunSMPB") == 0) 547 else if (tn_op == 1) /*iTunSMPB*/
543 { 548 {
544 char value[TAG_VALUE_LENGTH]; 549 char value[TAG_VALUE_LENGTH];
545 char* value_p = value; 550 char* value_p = value;
@@ -552,12 +557,12 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
552 DEBUGF("AAC: lead_trim %d, tail_trim %d\n", 557 DEBUGF("AAC: lead_trim %d, tail_trim %d\n",
553 id3->lead_trim, id3->tail_trim); 558 id3->lead_trim, id3->tail_trim);
554 } 559 }
555 else if (strcasecmp(tag_name, "musicbrainz track id") == 0) 560 else if (tn_op == 2) /*musicbrainz track id*/
556 { 561 {
557 read_mp4_tag_string(fd, size, &buffer, &buffer_left, 562 read_mp4_tag_string(fd, size, &buffer, &buffer_left,
558 &id3->mb_track_id); 563 &id3->mb_track_id);
559 } 564 }
560 else if ((strcasecmp(tag_name, "album artist") == 0)) 565 else if (tn_op == 3) /*album artist*/
561 { 566 {
562 read_mp4_tag_string(fd, size, &buffer, &buffer_left, 567 read_mp4_tag_string(fd, size, &buffer, &buffer_left,
563 &id3->albumartist); 568 &id3->albumartist);