music_mad.c: remove the non-standard 'Extended ID3v1' tag support:
authorOzkan Sezer
Sat, 07 Dec 2019 14:50:28 +0300
changeset 1060c8f653ad25de
parent 1058 b799e2ec2b5d
child 1062 bee60e95153e
music_mad.c: remove the non-standard 'Extended ID3v1' tag support:

none of the significant libraries like getID3, taglib, or libid3tag
support it. not supported in most, if not all mp3 players, either.
src/codecs/music_mad.c
     1.1 --- a/src/codecs/music_mad.c	Sat Dec 07 14:10:24 2019 +0300
     1.2 +++ b/src/codecs/music_mad.c	Sat Dec 07 14:50:28 2019 +0300
     1.3 @@ -238,17 +238,6 @@
     1.4      }
     1.5      return SDL_TRUE;
     1.6  }
     1.7 -static SDL_INLINE SDL_bool is_id3v1ext(const unsigned char *data, size_t length)
     1.8 -{
     1.9 -    /* ID3v1 extended tag: just before ID3v1, always 227 bytes.
    1.10 -     * https://www.getid3.org/phpBB3/viewtopic.php?t=1202
    1.11 -     * https://en.wikipedia.org/wiki/ID3v1#Enhanced_tag
    1.12 -     * Not an official standard, is only supported by few programs. */
    1.13 -    if (length < 4 || SDL_memcmp(data,"TAG+",4) != 0) {
    1.14 -        return SDL_FALSE;
    1.15 -    }
    1.16 -    return SDL_TRUE;
    1.17 -}
    1.18  static SDL_INLINE SDL_bool is_id3v2(const unsigned char *data, size_t length)
    1.19  {
    1.20      /* ID3v2 header is 10 bytes:  http://id3.org/id3v2.4.0-structure */
    1.21 @@ -349,20 +338,7 @@
    1.22      if (is_id3v1(music->input_buffer, 128)) {
    1.23          music->length -= 128;
    1.24  
    1.25 -        /* extended ID3v1 just before the ID3v1 tag? (unlikely)
    1.26 -         * if found, assume no additional tags: this stupidity
    1.27 -         * is non-standard..  */
    1.28 -        if (music->length < 227) goto ape;
    1.29 -        MAD_RWseek(music, -227, RW_SEEK_END);
    1.30 -        readsize = MAD_RWread(music, music->input_buffer, 1, 227);
    1.31 -        MAD_RWseek(music, 0, RW_SEEK_SET);
    1.32 -        if (readsize != 227) return -1;
    1.33 -        if (is_id3v1ext(music->input_buffer, 227)) {
    1.34 -            music->length -= 227;
    1.35 -            goto end;
    1.36 -        }
    1.37 -
    1.38 -        /* FIXME: handle possible double-ID3v1 tags? */
    1.39 +        /* FIXME: handle possible double-ID3v1 tags?? */
    1.40      }
    1.41  
    1.42      ape: /* APE tag may be at the end: read the footer */
    1.43 @@ -378,7 +354,6 @@
    1.44          }
    1.45      }
    1.46  
    1.47 -    end:
    1.48      return (music->length > 0)? 0: -1;
    1.49  }
    1.50