toInfo static method

List<List<int>> toInfo(
  1. List<EBMLParserElement> data,
  2. int indexEndOffset,
  3. int totalSize
)

Implementation

static List<List<int>> toInfo(
    List<EBMLParserElement> data, int indexEndOffset, int totalSize) {
  final List<List<int>> info = [];
  data[0].children.forEach((element) {
    if (element.id == "bb") {
      final cueTime = element.children[0];
      final cueTrackPositions = element.children[1];
      // final CueTrack = CueTrackPositions.children[0];
      final cueClusterPosition = cueTrackPositions.children[1];
      info.add([cueTime.value, cueClusterPosition.value]);
    }
  });
  var segmentStart = indexEndOffset - info[0][1] + 1;
  var segmentEnd = totalSize;
  final l = info.length - 1;
  List<List<int>> res = [];
  for (var i = 0; i < info.length; i++) {
    var item = info[i];
    var start = item[1] + segmentStart;
    var end = 0;
    if (i < l) {
      end = info[i + 1][1] + segmentStart;
    } else {
      // last item,range end is its length
      end = segmentEnd;
    }
    res.add([start, end]);
  }
  return res;
}