Implement Ogg muxer

This commit is contained in:
Vanilagy
2025-02-09 10:56:54 +01:00
parent cd30c9faec
commit 0db871dd21
13 changed files with 715 additions and 204 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
import { Reader } from '../reader';
import { OGGS } from './ogg-misc';
const OGGS = 0x5367674f; // 'OggS'
export const MIN_PAGE_HEADER_SIZE = 27;
export const MAX_PAGE_HEADER_SIZE = 27 + 255;
export const MAX_PAGE_SIZE = MAX_PAGE_HEADER_SIZE + 255 * 255;
@@ -15,7 +15,7 @@ export type Page = {
serialNumber: number;
sequenceNumber: number;
checksum: number;
lacingValues: number[];
lacingValues: Uint8Array;
};
export class OggReader {
@@ -83,10 +83,10 @@ export class OggReader {
const checksum = this.readU32();
const numberPageSegments = this.readU8();
const lacingValues: number[] = [];
const lacingValues = new Uint8Array(numberPageSegments);
for (let i = 0; i < numberPageSegments; i++) {
lacingValues.push(this.readU8());
lacingValues[i] = this.readU8();
}
const headerSize = 27 + numberPageSegments;