summaryrefslogtreecommitdiff
path: root/apps/metadata.c
diff options
context:
space:
mode:
authorMagnus Holmgren <magnushol@gmail.com>2005-07-27 11:54:33 +0000
committerMagnus Holmgren <magnushol@gmail.com>2005-07-27 11:54:33 +0000
commit988ea2cffc36d891d5b4752484c741a98eddede3 (patch)
tree7118198c6da300be6f5d90692988d243bcbcda04 /apps/metadata.c
parente44372ef18cbf30f0e174ed76be4ee4e6206f2cc (diff)
downloadrockbox-988ea2cffc36d891d5b4752484c741a98eddede3.tar.gz
rockbox-988ea2cffc36d891d5b4752484c741a98eddede3.zip
Added support for ID3V2 ReplayGain tags (as written by Foobar). Generalized the replaygain tag parsing a bit, to cut down the code size (APE tags should use this as well, but as it requires larger changes, it will have to wait for another commit). Also fixed a bug in the ID3V2 parser; ISO-8859-1 strings could confuse the main parsing loop (causing bufferpos to come out of sync).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7243 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata.c')
-rw-r--r--apps/metadata.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/apps/metadata.c b/apps/metadata.c
index 409bdf88c5..bbbfe07d66 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -528,7 +528,7 @@ static bool get_apetag_info (struct mp3entry *entry, int fd)
528 528
529 if (rem_space > 1 && 529 if (rem_space > 1 &&
530 get_apetag_item (&temp_apetag, "replaygain_track_gain", temp_buffer, rem_space)) { 530 get_apetag_item (&temp_apetag, "replaygain_track_gain", temp_buffer, rem_space)) {
531 entry->track_gain = get_replaygain (entry->track_gain_str = temp_buffer); 531 entry->track_gain = get_replaygain (entry->track_gain_string = temp_buffer);
532 str_space = strlen (temp_buffer) + 1; 532 str_space = strlen (temp_buffer) + 1;
533 temp_buffer += str_space; 533 temp_buffer += str_space;
534 rem_space -= str_space; 534 rem_space -= str_space;
@@ -536,7 +536,7 @@ static bool get_apetag_info (struct mp3entry *entry, int fd)
536 536
537 if (rem_space > 1 && 537 if (rem_space > 1 &&
538 get_apetag_item (&temp_apetag, "replaygain_album_gain", temp_buffer, rem_space)) { 538 get_apetag_item (&temp_apetag, "replaygain_album_gain", temp_buffer, rem_space)) {
539 entry->album_gain = get_replaygain (entry->album_gain_str = temp_buffer); 539 entry->album_gain = get_replaygain (entry->album_gain_string = temp_buffer);
540 str_space = strlen (temp_buffer) + 1; 540 str_space = strlen (temp_buffer) + 1;
541 temp_buffer += str_space; 541 temp_buffer += str_space;
542 rem_space -= str_space; 542 rem_space -= str_space;
@@ -910,37 +910,13 @@ static bool get_vorbis_comments (struct mp3entry *entry, int fd)
910 } else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) { 910 } else if (strncasecmp(temp, "TRACKNUMBER=", 12) == 0) {
911 name_length = 11; 911 name_length = 11;
912 p = &(entry->track_string); 912 p = &(entry->track_string);
913 } else if ((strncasecmp(temp, "RG_RADIO=", 9) == 0)
914 && !entry->track_gain) {
915 entry->track_gain = get_replaygain(&temp[9]);
916 name_length = 8;
917 p = &(entry->track_gain_str);
918 } else if (strncasecmp(temp, "REPLAYGAIN_TRACK_GAIN=", 22) == 0) {
919 entry->track_gain = get_replaygain(&temp[22]);
920 name_length = 21;
921 p = &(entry->track_gain_str);
922 } else if ((strncasecmp(temp, "RG_AUDIOPHILE=", 14) == 0)
923 && !entry->album_gain) {
924 entry->album_gain = get_replaygain(&temp[14]);
925 name_length = 13;
926 p = &(entry->album_gain_str);
927 } else if (strncasecmp(temp, "REPLAYGAIN_ALBUM_GAIN=", 22) == 0) {
928 entry->album_gain = get_replaygain(&temp[22]);
929 name_length = 21;
930 p = &(entry->album_gain_str);
931 } else if ((strncasecmp(temp, "RG_PEAK=", 8) == 0)
932 && !entry->track_peak) {
933 entry->track_peak = get_replaypeak(&temp[8]);
934 p = NULL;
935 } else if (strncasecmp(temp, "REPLAYGAIN_TRACK_PEAK=", 22) == 0) {
936 entry->track_peak = get_replaypeak(&temp[22]);
937 p = NULL;
938 } else if (strncasecmp(temp, "REPLAYGAIN_ALBUM_PEAK=", 22) == 0) {
939 entry->album_peak = get_replaypeak(&temp[22]);
940 p = NULL;
941 } else { 913 } else {
914 int value_length = parse_replaygain(temp, NULL, entry, buffer,
915 buffer_remaining);
916 buffer_remaining -= value_length;
917 buffer += value_length;
942 p = NULL; 918 p = NULL;
943 } 919 }
944 920
945 if (p) { 921 if (p) {
946 comment_length -= (name_length + 1); 922 comment_length -= (name_length + 1);