Add @mediabunny/aac-encoder extension package

This commit is contained in:
Vanilagy
2026-03-04 17:05:34 +01:00
parent 76e0703b13
commit c4398fb88c
51 changed files with 1976 additions and 274 deletions
+66
View File
@@ -0,0 +1,66 @@
/*!
* 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 type WorkerCommand = {
type: 'init';
data: {
numberOfChannels: number;
sampleRate: number;
bitrate: number;
};
} | {
type: 'encode';
data: {
ctx: number;
audioData: ArrayBuffer;
timestamp: number;
};
} | {
type: 'flush';
data: {
ctx: number;
};
} | {
type: 'close';
data: {
ctx: number;
};
};
export type WorkerResponseData = {
type: 'init';
ctx: number;
frameSize: number;
extradata: ArrayBuffer;
} | {
type: 'encode';
packets: Array<{
encodedData: ArrayBuffer;
pts: number;
duration: number;
}>;
} | {
type: 'flush';
packets: Array<{
encodedData: ArrayBuffer;
pts: number;
duration: number;
}>;
} | {
type: 'close';
};
export type WorkerResponse = {
id: number;
} & ({
success: true;
data: WorkerResponseData;
} | {
success: false;
error: unknown;
});