Fix failing tests, add missing license headers

This commit is contained in:
Vanilagy
2026-04-01 16:39:42 +02:00
parent 5bba924ce5
commit 3c0a6fc299
14 changed files with 59 additions and 31 deletions
+6
View File
@@ -7,6 +7,8 @@
*/
import { AudioCodec, VideoCodec } from './codec';
import { canDecodeAudioMemo, canDecodeVideoMemo } from './decode';
import { canEncodeAudioMemo, canEncodeVideoMemo } from './encode';
import { MaybePromise } from './misc';
import { EncodedPacket } from './packet';
import { AudioSample, VideoSample } from './sample';
@@ -152,6 +154,7 @@ export const registerDecoder = (decoder: typeof CustomVideoDecoder | typeof Cust
}
customVideoDecoders.push(casted);
canDecodeVideoMemo.clear();
} else if (decoder.prototype instanceof CustomAudioDecoder) {
const casted = decoder as typeof CustomAudioDecoder;
@@ -161,6 +164,7 @@ export const registerDecoder = (decoder: typeof CustomVideoDecoder | typeof Cust
}
customAudioDecoders.push(casted);
canDecodeAudioMemo.clear();
} else {
throw new TypeError('Decoder must be a CustomVideoDecoder or CustomAudioDecoder.');
}
@@ -182,6 +186,7 @@ export const registerEncoder = (encoder: typeof CustomVideoEncoder | typeof Cust
}
customVideoEncoders.push(casted);
canEncodeVideoMemo.clear();
} else if (encoder.prototype instanceof CustomAudioEncoder) {
const casted = encoder as typeof CustomAudioEncoder;
@@ -191,6 +196,7 @@ export const registerEncoder = (encoder: typeof CustomVideoEncoder | typeof Cust
}
customAudioEncoders.push(casted);
canEncodeAudioMemo.clear();
} else {
throw new TypeError('Encoder must be a CustomVideoEncoder or CustomAudioEncoder.');
}
+2 -2
View File
@@ -22,8 +22,8 @@ import {
import { customAudioDecoders, customVideoDecoders } from './custom-coder';
import { isAllowSharedBufferSource, SetOptional } from './misc';
const canDecodeVideoMemo = new Map<string, Promise<boolean>>();
const canDecodeAudioMemo = new Map<string, Promise<boolean>>();
export const canDecodeVideoMemo = new Map<string, Promise<boolean>>();
export const canDecodeAudioMemo = new Map<string, Promise<boolean>>();
const validateVideoDecodingConfig = (codec: VideoCodec, options: SetOptional<VideoDecoderConfig, 'codec'>) => {
if (!options || typeof options !== 'object') {
+2 -2
View File
@@ -26,8 +26,8 @@ import { isFirefox, MaybePromise, Rotation } from './misc';
import { EncodedPacket } from './packet';
import { AudioSample, CropRectangle, validateCropRectangle, VideoSample } from './sample';
const canEncodeVideoMemo = new Map<string, Promise<boolean>>();
const canEncodeAudioMemo = new Map<string, Promise<boolean>>();
export const canEncodeVideoMemo = new Map<string, Promise<boolean>>();
export const canEncodeAudioMemo = new Map<string, Promise<boolean>>();
/**
* Configuration object that controls video encoding. Can be used to set codec, quality, and more.
+4 -4
View File
@@ -49,16 +49,16 @@ export class FlacMuxer extends Muxer {
super(output);
this.format = format;
if (this.format._options.appendOnly) {
this.writer.ensureMonotonicity();
}
}
async start() {
const release = await this.mutex.acquire();
this.writer = await this.output._getRootWriter();
if (this.format._options.appendOnly) {
this.writer.ensureMonotonicity();
}
this.writer.write(FLAC_HEADER);
release();
+8
View File
@@ -1,3 +1,11 @@
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { AUDIO_CODECS, AudioCodec, inferCodecFromCodecString, MediaCodec, VIDEO_CODECS, VideoCodec } from '../codec';
import { Demuxer, DurationMetadataRequestOptions } from '../demuxer';
import { Input } from '../input';
+8
View File
@@ -1,3 +1,11 @@
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
export const canIgnoreLine = (line: string) => line.length === 0 || (line.startsWith('#') && !line.startsWith('#EXT'));
export class AttributeList {
+8
View File
@@ -1,3 +1,11 @@
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { MediaCodec, validateAudioChunkMetadata, validateVideoChunkMetadata } from '../codec';
import { EncodedAudioPacketSource, EncodedVideoPacketSource } from '../media-source';
import { arrayArgmax, assert, findLastIndex, joinPaths, textEncoder, toArray, UNDETERMINED_LANGUAGE } from '../misc';
+8
View File
@@ -1,3 +1,11 @@
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { AES_128_BLOCK_SIZE, createAes128CbcDecryptStream } from '../aes';
import { ENCRYPTION_KEY_CACHE_GROUP, Input } from '../input';
import { Segment, SegmentedInput, SegmentRetrievalOptions } from '../segmented-input';
+8
View File
@@ -1,3 +1,11 @@
/*!
* Copyright (c) 2026-present, Vanilagy and contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { assert } from './misc';
import { AudioSample } from './sample';