Rewrite reader logic, add separate reader for caching MP4 chunks, add more advanced drain iterators

This commit is contained in:
Vanilagy
2024-12-08 20:04:47 +01:00
parent ecfd193ae0
commit 5978110de9
12 changed files with 691 additions and 355 deletions
+3 -3
View File
@@ -15,14 +15,14 @@ export abstract class InputFormat {
class IsobmffInputFormat extends InputFormat {
/** @internal */
override async _canReadInput(input: Input) {
const sourceSize = await input._reader.getSourceSize();
const sourceSize = await input._mainReader.source._getSize();
if (sourceSize < 8) {
return false;
}
await input._reader.loadRange(4, 8);
await input._mainReader.loadRange(4, 8);
const isobmffReader = new IsobmffReader(input._reader);
const isobmffReader = new IsobmffReader(input._mainReader);
isobmffReader.pos = 4;
const fourCc = isobmffReader.readAscii(4);