1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 10:49:36 +02:00
Oinktube/node_modules/@videojs/vhs-utils/es/ogg-helpers.js
Daniel d4d042e041 Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
2021-10-26 14:52:45 -03:00

28 lines
No EOL
658 B
JavaScript

import { bytesMatch, toUint8 } from './byte-helpers';
var SYNC_WORD = toUint8([0x4f, 0x67, 0x67, 0x53]);
export var getPages = function getPages(bytes, start, end) {
if (end === void 0) {
end = Infinity;
}
bytes = toUint8(bytes);
var pages = [];
var i = 0;
while (i < bytes.length && pages.length < end) {
// we are unsynced,
// find the next syncword
if (!bytesMatch(bytes, SYNC_WORD, {
offset: i
})) {
i++;
continue;
}
var segmentLength = bytes[i + 27];
pages.push(bytes.subarray(i, i + 28 + segmentLength));
i += pages[pages.length - 1].length;
}
return pages.slice(start, end);
};