convertRAW function

void convertRAW(
  1. List<Plane> planes,
  2. NativeDataStruct data
)

Concatenates planes into one array, which can be passed to VideoWorker.

Implementation

void convertRAW(List<Plane> planes, NativeDataStruct data) {
  int totalBytes = 0;
  for (int i = 0; i < planes.length; ++i) {
    totalBytes += planes[i].bytes.length;
  }

  if (data.size != totalBytes) data.resize(totalBytes);

  int byteOffset = 0;
  for (int i = 0; i < planes.length; ++i) {
    final length = planes[i].bytes.length;
    data.bytes!.setRange(byteOffset, byteOffset += length, planes[i].bytes);
  }
}