mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-02 13:23:51 +02:00
Add Output.cancel
This commit is contained in:
@@ -17,6 +17,8 @@ export abstract class Writer {
|
||||
abstract flush(): Promise<void>;
|
||||
/** Called after muxing has finished. */
|
||||
abstract finalize(): Promise<void>;
|
||||
/** Closes the writer. */
|
||||
abstract close(): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,6 +76,8 @@ export class ArrayBufferTargetWriter extends Writer {
|
||||
this.target.buffer = this.buffer.slice(0, Math.max(this.maxPos, this.pos));
|
||||
}
|
||||
|
||||
async close() {}
|
||||
|
||||
getSlice(start: number, end: number) {
|
||||
return this.bytes.slice(start, end);
|
||||
}
|
||||
@@ -185,6 +189,10 @@ export class StreamTargetWriter extends Writer {
|
||||
assert(this.writer);
|
||||
return this.writer.close();
|
||||
}
|
||||
|
||||
async close() {
|
||||
return this.writer?.close();
|
||||
}
|
||||
}
|
||||
|
||||
const DEFAULT_CHUNK_SIZE = 2 ** 24;
|
||||
@@ -375,4 +383,8 @@ export class ChunkedStreamTargetWriter extends Writer {
|
||||
|
||||
return this.writer.close();
|
||||
}
|
||||
|
||||
async close() {
|
||||
return this.writer?.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user