convert method

  1. @override
bool convert()

Implementation

@override
bool convert() {
  /*
    The ID3v2 tag header, which should be the first information in the
 file, is 10 bytes as follows:

   ID3v2/file identifier      "ID3"
   ID3v2 version              $03 00
   ID3v2 flags                %abc00000(or %ab000000 in v2.2)
   ID3v2 size             4 * %0xxxxxxx
  */
  int start = 0;
  if (readValue(header[0], start) != 'ID3') {
    // Search from end of file.
    start = _searchFooterReturnFixStart(bytes.length - 10);
    if (start == 0) {
      return false;
    } else {
      // ID3v2.4
      _hasFooter = true;
    }
  }
  // Range
  metadata.setRangeStart(start);

  start += header[0].length;

  // [ Header ]
  start = _parseHeader(start);

  // [ Extended Header ]
  start = _parseExtendedHeader(start);

  // [ Frames ]
  start = _parseFrames(start);

  // [ Padding(OPTIONAL) ]
  start = _parsePadding(start);

  // [ Footer(Exists only in ID3v2.4) ]
  if (_hasFooter) {
    metadata.set(value: '<Has Footer>', key: 'Footer');
  }

  metadata.setRangeLength(totalLength);

  return true;
}