lib/parsers/mp3_parser/id3_v2.rb
# ID3v2 uses "unsynchronized integers", which are unsigned integers smeared
# over multiple bytes in such a manner that the first bit is always 0 (unset).
# This is done so that ID3v2 incompatible decoders will not by accident see
# the 0xFF0xFF0xFF0xFF sequence anywhere that can be mistaken for the MPEG frame
# synchronisation header. Effectively it is a 7 bit big-endian unsigned integer
# encoding.
#
# 8 bit 255 (0xFF) encoded in this mannner takes 16 bits instead,
# and looks like this: `0b00000001 01111111`. Note how it avoids having
# the first bit of the second byte be 1.
# This method decodes an unsigned integer packed in this fashion
ID3v2 uses "unsynchronized integers", which are unsigned integers smeared
over multiple bytes in such a manner that the first bit is always 0 (unset).
This is done so that ID3v2 incompatible decoders will not by accident see
the 0xFF0xFF0xFF0xFF sequence anywhere that can be mistaken for the MPEG frame
synchronisation header. Effectively it is a 7 bit big-endian unsigned integer
encoding.

8 bit 255 (0xFF) encoded in this mannner takes 16 bits instead,
and looks like this: `0b00000001 01111111`. Note how it avoids having
the first bit of the second byte be 1.
This method decodes an unsigned integer packed in this fashion
ID3v2 uses " unsynchronized integers " which are unsigned integers smeared over multiple bytes in such a manner that the first bit is always 0 ( unset ) . This is done so that ID3v2 incompatible decoders will not by accident see the 0xFF0xFF0xFF0xFF sequence anywhere that can be mistaken for the MPEG frame synchronisation header . Effectively it is a 7 bit big - endian unsigned integer encoding . 8 bit 255 ( 0xFF ) encoded in this mannner takes 16 bits instead and looks like this : ` 0b00000001 01111111 ` . Note how it avoids having the first bit of the second byte be 1 . This method decodes an unsigned integer packed in this fashion
def decode_syncsafe_int(bytes)
    size = 0
    j = 0
    i = bytes.bytesize - 1
    while i >= 0
      size += 128**i * (bytes.getbyte(j) & 0x7f)
      j += 1
      i -= 1
    end
    size
  end
def decode_syncsafe_int ( bytes ) size = 0 j = 0 i = bytes . bytesize - 1 while i >= 0 size += 128 ** i * ( bytes . getbyte ( j ) & 0x7f ) j += 1 i -= 1 end size end
ID3v2 uses "unsynchronized integers", which are unsigned integers smeared
over multiple bytes in such a manner that the first bit is always 0 (unset).
ID3v2 uses " unsynchronized integers " which are unsigned integers smeared over multiple bytes in such a manner that the first bit is always 0 ( unset ) .
bytes