summaryrefslogtreecommitdiff
path: root/apps/metadata
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata')
-rw-r--r--apps/metadata/asf.c12
-rw-r--r--apps/metadata/id3tags.c18
-rw-r--r--apps/metadata/metadata_common.c2
-rw-r--r--apps/metadata/mp4.c8
-rw-r--r--apps/metadata/mpc.c6
5 files changed, 10 insertions, 36 deletions
diff --git a/apps/metadata/asf.c b/apps/metadata/asf.c
index c445e485a2..56d5c87f9d 100644
--- a/apps/metadata/asf.c
+++ b/apps/metadata/asf.c
@@ -456,18 +456,8 @@ static int asf_parse_header(int fd, struct mp3entry* id3,
456 lseek(fd, length, SEEK_CUR); 456 lseek(fd, length, SEEK_CUR);
457 } 457 }
458 } else if (!strncmp("replaygain_", utf8buf, 11)) { 458 } else if (!strncmp("replaygain_", utf8buf, 11)) {
459 char* value = id3buf;
460 int buf_len = id3buf_remaining;
461 int len;
462 asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining); 459 asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
463 len = parse_replaygain(utf8buf, value, id3, 460 parse_replaygain(utf8buf, id3buf, id3);
464 value, buf_len);
465
466 if (len == 0) {
467 /* Don't need to keep the value */
468 id3buf = value;
469 id3buf_remaining = buf_len;
470 }
471 } else if (!strcmp("MusicBrainz/Track Id", utf8buf)) { 461 } else if (!strcmp("MusicBrainz/Track Id", utf8buf)) {
472 id3->mb_track_id = id3buf; 462 id3->mb_track_id = id3buf;
473 asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining); 463 asf_utf16LEdecode(fd, length, &id3buf, &id3buf_remaining);
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index 3cbebc12e3..c1d9cb2020 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -370,14 +370,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
370 entry->albumartist = tag; 370 entry->albumartist = tag;
371#if CONFIG_CODEC == SWCODEC 371#if CONFIG_CODEC == SWCODEC
372 } else { 372 } else {
373 /* Calculate residual buffer size in bytes which can be used by 373 /* Call parse_replaygain(). */
374 * parse_replaygain() to save the string representation of 374 parse_replaygain(tag, value, entry);
375 * replaygain data.*/
376 length = sizeof(entry->id3v2buf) - (tag - entry->id3v2buf);
377
378 /* Call parse_replaygain(), returns length in bytes used by the
379 * string representation of replaygain data. */
380 length = parse_replaygain(tag, value, entry, tag, length);
381#endif 375#endif
382 } 376 }
383 } 377 }
@@ -387,12 +381,11 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
387 381
388#if CONFIG_CODEC == SWCODEC 382#if CONFIG_CODEC == SWCODEC
389/* parse RVA2 binary data and convert to replaygain information. */ 383/* parse RVA2 binary data and convert to replaygain information. */
390static int parserva2( struct mp3entry* entry, char* tag, int bufferpos ) 384static int parserva2( struct mp3entry* entry, char* tag, int bufferpos)
391{ 385{
392 int desc_len = strlen(tag); 386 int desc_len = strlen(tag);
393 int start_pos = tag - entry->id3v2buf; 387 int start_pos = tag - entry->id3v2buf;
394 int end_pos = start_pos + desc_len + 5; 388 int end_pos = start_pos + desc_len + 5;
395 int value_len = 0;
396 unsigned char* value = tag + desc_len + 1; 389 unsigned char* value = tag + desc_len + 1;
397 390
398 /* Only parse RVA2 replaygain tags if tag version == 2.4 and channel 391 /* Only parse RVA2 replaygain tags if tag version == 2.4 and channel
@@ -447,11 +440,10 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
447 } 440 }
448 } 441 }
449 442
450 value_len = parse_replaygain_int(album, gain, peak * 2, entry, 443 parse_replaygain_int(album, gain, peak * 2, entry);
451 tag, sizeof(entry->id3v2buf) - start_pos);
452 } 444 }
453 445
454 return start_pos + value_len; 446 return start_pos;
455} 447}
456#endif 448#endif
457 449
diff --git a/apps/metadata/metadata_common.c b/apps/metadata/metadata_common.c
index 341d279b5d..ae6b245616 100644
--- a/apps/metadata/metadata_common.c
+++ b/apps/metadata/metadata_common.c
@@ -333,7 +333,7 @@ long parse_tag(const char* name, char* value, struct mp3entry* id3,
333 } 333 }
334 else 334 else
335 { 335 {
336 len = parse_replaygain(name, value, id3, buf, buf_remaining); 336 parse_replaygain(name, value, id3);
337 p = NULL; 337 p = NULL;
338 } 338 }
339 339
diff --git a/apps/metadata/mp4.c b/apps/metadata/mp4.c
index 6130135bae..a431231e12 100644
--- a/apps/metadata/mp4.c
+++ b/apps/metadata/mp4.c
@@ -528,13 +528,7 @@ static bool read_mp4_tags(int fd, struct mp3entry* id3,
528 buffer -= length; 528 buffer -= length;
529 buffer_left += length; 529 buffer_left += length;
530 530
531 if (parse_replaygain(tag_name, buffer, id3, 531 parse_replaygain(tag_name, buffer, id3);
532 buffer, buffer_left) > 0)
533 {
534 /* Data used, keep it. */
535 buffer += length;
536 buffer_left -= length;
537 }
538 } 532 }
539 } 533 }
540 } 534 }
diff --git a/apps/metadata/mpc.c b/apps/metadata/mpc.c
index 0387dc9f77..0b75ed04dd 100644
--- a/apps/metadata/mpc.c
+++ b/apps/metadata/mpc.c
@@ -46,8 +46,7 @@ static int set_replaygain_sv7(struct mp3entry* id3,
46 /* We use a peak value of 0 to indicate a given gain type isn't used. */ 46 /* We use a peak value of 0 to indicate a given gain type isn't used. */
47 if (peak != 0) { 47 if (peak != 0) {
48 /* Save the ReplayGain data to id3-structure for further processing. */ 48 /* Save the ReplayGain data to id3-structure for further processing. */
49 used += parse_replaygain_int(album, gain * 512 / 100, peak << 9, 49 parse_replaygain_int(album, gain * 512 / 100, peak << 9, id3);
50 id3, id3->toc + used, sizeof(id3->toc) - used);
51 } 50 }
52 51
53 return used; 52 return used;
@@ -73,8 +72,7 @@ static int set_replaygain_sv8(struct mp3entry* id3,
73 /* We use a peak value of 0 to indicate a given gain type isn't used. */ 72 /* We use a peak value of 0 to indicate a given gain type isn't used. */
74 if (peak != 0) { 73 if (peak != 0) {
75 /* Save the ReplayGain data to id3-structure for further processing. */ 74 /* Save the ReplayGain data to id3-structure for further processing. */
76 used += parse_replaygain_int(album, gain * 512 / 100, peak, 75 parse_replaygain_int(album, gain * 512 / 100, peak, id3);
77 id3, id3->toc + used, sizeof(id3->toc) - used);
78 } 76 }
79 77
80 return used; 78 return used;