CommentFrameContent.decode constructor
CommentFrameContent.decode()
Implementation
factory CommentFrameContent.decode(
Id3Header header,
Id3v2FrameHeader frameHeader,
List<int> bytes,
int startIndex,
int size,
) {
var subBytes = bytes.sublist(startIndex, startIndex + size);
// Get the encoding
var encoding = getEncoding(subBytes[0]);
var language = _decodeLanguage(subBytes, 1, 3);
// The index where the description will end
final splitIndex = encoding is UTF16 ? _indexOfSplitPattern(subBytes, [0x00, 0x00], 4) : subBytes.indexOf(0x00, 4);
var description = _decodeDescription(subBytes, 4, splitIndex, encoding);
final offset = splitIndex + (encoding is UTF16 ? 2 : 1);
var body = _decodeBody(subBytes, offset, encoding);
var model = CommentModel(encoding, language, description, body);
return CommentFrameContent(model);
}