parseMetadataBlock function

MetadataBlock parseMetadataBlock(
  1. int type,
  2. bool isLast,
  3. int length,
  4. Uint8List data,
)

Dispatches a raw metadata block to its typed parser.

Used by both the one-shot reader and the streaming decoder so they agree on how unknown block types are handled.

Implementation

MetadataBlock parseMetadataBlock(
    int type, bool isLast, int length, Uint8List data) {
  switch (type) {
    case BlockType.streamInfo:
      return StreamInfoBlock.parse(isLast, length, data);
    case BlockType.padding:
      return PaddingBlock.parse(isLast, length, data);
    case BlockType.application:
      return ApplicationBlock.parse(isLast, length, data);
    case BlockType.seekTable:
      return SeekTableBlock.parse(isLast, length, data);
    case BlockType.vorbisComment:
      return VorbisCommentBlock.parse(isLast, length, data);
    case BlockType.cueSheet:
      return CueSheetBlock.parse(isLast, length, data);
    case BlockType.picture:
      return PictureBlock.parse(isLast, length, data);
    default:
      return UnknownMetadataBlock(
          blockType: type, isLast: isLast, length: length, rawData: data);
  }
}