mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 13:53:53 +02:00
Implement @mediabunny/prores extension, add onError callbacks to custom coders, fix visibleRect bug in VideoSample
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
MediaCodec,
|
||||
OPUS_SAMPLE_RATE,
|
||||
PRORES_FOURCCS,
|
||||
ProresFourCc,
|
||||
VideoCodec,
|
||||
} from '../codec';
|
||||
import { Demuxer } from '../demuxer';
|
||||
@@ -216,6 +217,7 @@ type InternalTrack = {
|
||||
codecDescription: Uint8Array | null;
|
||||
colorSpace: VideoColorSpaceInit | null;
|
||||
alphaMode: boolean;
|
||||
proresFormat: ProresFourCc | null;
|
||||
}
|
||||
| {
|
||||
type: 'audio';
|
||||
@@ -1084,10 +1086,12 @@ export class MatroskaDemuxer extends Demuxer {
|
||||
? textDecoder.decode(this.currentTrack.codecPrivate)
|
||||
: '';
|
||||
|
||||
if (PRORES_FOURCCS.includes(format)) {
|
||||
if ((PRORES_FOURCCS as readonly string[]).includes(format)) {
|
||||
this.currentTrack.info.codec = 'prores';
|
||||
this.currentTrack.info.proresFormat = format as ProresFourCc;
|
||||
} else {
|
||||
// We don't support ProRes RAW yet
|
||||
// Either an invalid string or ProRes RAW, which we don't support yet (it's a
|
||||
// different codec).
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1182,6 +1186,7 @@ export class MatroskaDemuxer extends Demuxer {
|
||||
codecDescription: null,
|
||||
colorSpace: null,
|
||||
alphaMode: false,
|
||||
proresFormat: null,
|
||||
};
|
||||
} else if (type === 2) {
|
||||
this.currentTrack.info = {
|
||||
@@ -2447,7 +2452,12 @@ class MatroskaVideoTrackBacking extends MatroskaTrackBacking implements InputVid
|
||||
}
|
||||
|
||||
async canBeTransparent() {
|
||||
return this.internalTrack.info.alphaMode;
|
||||
return this.internalTrack.info.alphaMode || (
|
||||
this.internalTrack.info.codec === 'prores' && (
|
||||
this.internalTrack.info.proresFormat === 'ap4h'
|
||||
|| this.internalTrack.info.proresFormat === 'ap4x'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
async getDecoderConfig(): Promise<VideoDecoderConfig | null> {
|
||||
@@ -2489,9 +2499,7 @@ class MatroskaVideoTrackBacking extends MatroskaTrackBacking implements InputVid
|
||||
av1CodecInfo: this.internalTrack.info.codec === 'av1' && firstPacket
|
||||
? extractAv1CodecInfoFromPacket(firstPacket.data)
|
||||
: null,
|
||||
proresFormat: this.internalTrack.info.codec === 'prores' && this.internalTrack.codecPrivate
|
||||
? textDecoder.decode(this.internalTrack.codecPrivate)
|
||||
: null,
|
||||
proresFormat: this.internalTrack.info.proresFormat,
|
||||
}),
|
||||
codedWidth: this.internalTrack.info.width,
|
||||
codedHeight: this.internalTrack.info.height,
|
||||
|
||||
Reference in New Issue
Block a user