Add Mediabunny Codec Registry

This commit is contained in:
Vanilagy
2026-02-12 11:56:37 +01:00
parent de9a4bbc23
commit 7cc26edacb
25 changed files with 649 additions and 21 deletions
+1 -4
View File
@@ -62,10 +62,7 @@ export class AdtsMuxer extends Muxer {
const description = meta?.decoderConfig?.description;
// From the WebCodecs Codec Registry:
// "If description is present, it is assumed to a AudioSpecificConfig as defined in [iso14496-3] section
// 1.6.2.1, Table 1.15, and the bitstream is assumed to be in aac.
// If the description is not present, the bitstream is assumed to be in adts format."
// Follows from the Mediabunny Codec Registry:
this.inputIsAdts = !description;
if (!this.inputIsAdts) {
+2 -2
View File
@@ -833,7 +833,7 @@ export const validateVideoChunkMetadata = (metadata: EncodedVideoChunkMetadata |
if (!VALID_VIDEO_CODEC_STRING_PREFIXES.some(prefix => metadata.decoderConfig!.codec.startsWith(prefix))) {
throw new TypeError(
'Video chunk metadata decoder configuration codec string must be a valid video codec string as specified in'
+ ' the WebCodecs Codec Registry.',
+ ' the Mediabunny Codec Registry.',
);
}
if (!Number.isInteger(metadata.decoderConfig.codedWidth) || metadata.decoderConfig.codedWidth! <= 0) {
@@ -970,7 +970,7 @@ export const validateAudioChunkMetadata = (metadata: EncodedAudioChunkMetadata |
if (!VALID_AUDIO_CODEC_STRING_PREFIXES.some(prefix => metadata.decoderConfig!.codec.startsWith(prefix))) {
throw new TypeError(
'Audio chunk metadata decoder configuration codec string must be a valid audio codec string as specified in'
+ ' the WebCodecs Codec Registry.',
+ ' the Mediabunny Codec Registry.',
);
}
if (!Number.isInteger(metadata.decoderConfig.sampleRate) || metadata.decoderConfig.sampleRate <= 0) {
+2 -2
View File
@@ -127,7 +127,7 @@ export type VideoEncodingAdditionalOptions = {
*/
latencyMode?: 'quality' | 'realtime';
/**
* The full codec string as specified in the WebCodecs Codec Registry. This string must match the codec
* The full codec string as specified in the Mediabunny Codec Registry. This string must match the codec
* specified in `codec`. When not set, a fitting codec string will be constructed automatically by the library.
*/
fullCodecString?: string;
@@ -280,7 +280,7 @@ export type AudioEncodingAdditionalOptions = {
/** Configures the bitrate mode. */
bitrateMode?: 'constant' | 'variable';
/**
* The full codec string as specified in the WebCodecs Codec Registry. This string must match the codec
* The full codec string as specified in the Mediabunny Codec Registry. This string must match the codec
* specified in `codec`. When not set, a fitting codec string will be constructed automatically by the library.
*/
fullCodecString?: string;
+4 -1
View File
@@ -56,7 +56,10 @@ export class EncodedPacket {
/** Creates a new {@link EncodedPacket} from raw bytes and timing information. */
constructor(
/** The encoded data of this packet. */
/**
* The encoded data of this packet. For any given codec, this data must adhere to the format specified in the
* Mediabunny Codec Registry.
*/
public readonly data: Uint8Array,
/** The type of this packet. */
public readonly type: PacketType,