mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Transparent video read/write support (#145)
* Add support for reading transparent Matroska and implement alpha side data & decode * Few fixes * Implement alpha encoding * Gracefully handle inability to acquire WebGL context, properly clean up WebGL contexts * Improve touch device detection * Test test * Test test #2 * Test test 3 * Test test 4 * Test test 5 * Test test 6 * Test test 7 * Test test 8 * Test test 9 * Test test 10 * Test test 11 * Test test 12 * Test test 13 * Test test 14 * Test test 15 * Test test 16 * Test test 17 * Test test 18 * Test test 19 * Test test 20 * Fix type errors, improve MetadataTags docs * Do a bunch of docs work * Test test? * "Unexpected only modifier 🤓" * Add InputVideoTrack.canBeTransparent() * Some clean-up * Adjust CI to be less spammy in PRs * Fix broken license headers
This commit is contained in:
+10
-1
@@ -192,6 +192,7 @@ export interface InputVideoTrackBacking extends InputTrackBacking {
|
||||
getCodedHeight(): number;
|
||||
getRotation(): Rotation;
|
||||
getColorSpace(): Promise<VideoColorSpaceInit>;
|
||||
canBeTransparent(): Promise<boolean>;
|
||||
getDecoderConfig(): Promise<VideoDecoderConfig | null>;
|
||||
}
|
||||
|
||||
@@ -260,6 +261,11 @@ export class InputVideoTrack extends InputTrack {
|
||||
|| (colorSpace.matrix as string) === 'bt2020-ncl';
|
||||
}
|
||||
|
||||
/** Checks if this track may contain transparent samples with alpha data. */
|
||||
canBeTransparent() {
|
||||
return this._backing.canBeTransparent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the [decoder configuration](https://www.w3.org/TR/webcodecs/#video-decoder-config) for decoding the
|
||||
* track's packets using a [`VideoDecoder`](https://developer.mozilla.org/en-US/docs/Web/API/VideoDecoder). Returns
|
||||
@@ -312,7 +318,10 @@ export class InputVideoTrack extends InputTrack {
|
||||
return null;
|
||||
}
|
||||
|
||||
return determineVideoPacketType(this, packet);
|
||||
const decoderConfig = await this.getDecoderConfig();
|
||||
assert(decoderConfig);
|
||||
|
||||
return determineVideoPacketType(this.codec, decoderConfig, packet.data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user