{"size": 490, "ext": "js", "max_stars_repo_path": "src/widgets/node_modules/mux.js/es/tools/parse-tfdt.js", "max_stars_repo_name": "cutting-mat/cutting-mat-admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/widgets/node_modules/mux.js/es/tools/parse-tfdt.js", "max_issues_repo_name": "cutting-mat/cutting-mat-admin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/widgets/node_modules/mux.js/es/tools/parse-tfdt.js", "max_forks_repo_name": "cutting-mat/cutting-mat-admin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5, "max_line_length": 100, "alphanum_fraction": 0.6367346939}
var toUnsigned = require('../utils/bin').toUnsigned;

var getUint64 = require('../utils/numbers.js').getUint64;

var tfdt = function tfdt(data) {
  var result = {
    version: data[0],
    flags: new Uint8Array(data.subarray(1, 4))
  };

  if (result.version === 1) {
    result.baseMediaDecodeTime = getUint64(data.subarray(4));
  } else {
    result.baseMediaDecodeTime = toUnsigned(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  }

  return result;
};

module.exports = tfdt;