@mediabunny/mp3-encoder 1.28.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/mediabunny-mp3-encoder.js +3 -3
- package/dist/bundles/mediabunny-mp3-encoder.min.js +1 -1
- package/dist/bundles/mediabunny-mp3-encoder.min.mjs +1 -1
- package/dist/bundles/mediabunny-mp3-encoder.mjs +3 -3
- package/dist/modules/src/encode.worker.d.ts +1 -1
- package/dist/modules/src/encode.worker.js +1 -1
- package/dist/modules/src/index.d.ts +1 -1
- package/dist/modules/src/index.js +2 -2
- package/dist/modules/src/shared.d.ts +1 -1
- package/dist/modules/src/shared.js +1 -1
- package/package.json +1 -1
- package/src/encode.worker.ts +1 -1
- package/src/index.ts +3 -3
- package/src/lame-bridge.c +1 -1
- package/src/shared.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
3
3
|
*
|
|
4
4
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
5
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -212,7 +212,7 @@ var MediabunnyMp3Encoder = (() => {
|
|
|
212
212
|
return (Math.floor(12 * bitrate / sampleRate) + padding) * 4;
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
|
-
var
|
|
215
|
+
var readMp3FrameHeader = (word, remainingBytes) => {
|
|
216
216
|
const firstByte = word >>> 24;
|
|
217
217
|
const secondByte = word >>> 16 & 255;
|
|
218
218
|
const thirdByte = word >>> 8 & 255;
|
|
@@ -420,7 +420,7 @@ var MediabunnyMp3Encoder = (() => {
|
|
|
420
420
|
let pos = 0;
|
|
421
421
|
while (pos <= this.currentBufferOffset - FRAME_HEADER_SIZE) {
|
|
422
422
|
const word = new DataView(this.buffer.buffer).getUint32(pos, false);
|
|
423
|
-
const header =
|
|
423
|
+
const header = readMp3FrameHeader(word, null).header;
|
|
424
424
|
if (!header) {
|
|
425
425
|
break;
|
|
426
426
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
3
3
|
*
|
|
4
4
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
5
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -169,7 +169,7 @@ var computeMp3FrameSize = (lowSamplingFrequency, layer, bitrate, sampleRate, pad
|
|
|
169
169
|
return (Math.floor(12 * bitrate / sampleRate) + padding) * 4;
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
-
var
|
|
172
|
+
var readMp3FrameHeader = (word, remainingBytes) => {
|
|
173
173
|
const firstByte = word >>> 24;
|
|
174
174
|
const secondByte = word >>> 16 & 255;
|
|
175
175
|
const thirdByte = word >>> 8 & 255;
|
|
@@ -377,7 +377,7 @@ var Mp3Encoder = class extends CustomAudioEncoder {
|
|
|
377
377
|
let pos = 0;
|
|
378
378
|
while (pos <= this.currentBufferOffset - FRAME_HEADER_SIZE) {
|
|
379
379
|
const word = new DataView(this.buffer.buffer).getUint32(pos, false);
|
|
380
|
-
const header =
|
|
380
|
+
const header = readMp3FrameHeader(word, null).header;
|
|
381
381
|
if (!header) {
|
|
382
382
|
break;
|
|
383
383
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
4
4
|
*
|
|
5
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
6
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
4
4
|
*
|
|
5
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
6
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -124,7 +124,7 @@ class Mp3Encoder extends mediabunny_1.CustomAudioEncoder {
|
|
|
124
124
|
let pos = 0;
|
|
125
125
|
while (pos <= this.currentBufferOffset - mp3_misc_1.FRAME_HEADER_SIZE) {
|
|
126
126
|
const word = new DataView(this.buffer.buffer).getUint32(pos, false);
|
|
127
|
-
const header = (0, mp3_misc_1.
|
|
127
|
+
const header = (0, mp3_misc_1.readMp3FrameHeader)(word, null).header;
|
|
128
128
|
if (!header) {
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
4
4
|
*
|
|
5
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
6
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediabunny/mp3-encoder",
|
|
3
3
|
"author": "Vanilagy",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.29.0",
|
|
5
5
|
"description": "MP3 encoder extension for Mediabunny, based on LAME.",
|
|
6
6
|
"main": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
|
7
7
|
"module": "./dist/bundles/mediabunny-mp3-encoder.mjs",
|
package/src/encode.worker.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2026-present, Vanilagy and contributors
|
|
3
3
|
*
|
|
4
4
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
5
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { CustomAudioEncoder, AudioCodec, AudioSample, EncodedPacket, registerEncoder } from 'mediabunny';
|
|
10
|
-
import { FRAME_HEADER_SIZE,
|
|
10
|
+
import { FRAME_HEADER_SIZE, readMp3FrameHeader, SAMPLING_RATES } from '../../../shared/mp3-misc';
|
|
11
11
|
import type { WorkerCommand, WorkerResponse, WorkerResponseData } from './shared';
|
|
12
12
|
// @ts-expect-error An esbuild plugin handles this, TypeScript doesn't need to understand
|
|
13
13
|
import createWorker from './encode.worker';
|
|
@@ -145,7 +145,7 @@ class Mp3Encoder extends CustomAudioEncoder {
|
|
|
145
145
|
let pos = 0;
|
|
146
146
|
while (pos <= this.currentBufferOffset - FRAME_HEADER_SIZE) {
|
|
147
147
|
const word = new DataView(this.buffer.buffer).getUint32(pos, false);
|
|
148
|
-
const header =
|
|
148
|
+
const header = readMp3FrameHeader(word, null).header;
|
|
149
149
|
if (!header) {
|
|
150
150
|
break;
|
|
151
151
|
}
|
package/src/lame-bridge.c
CHANGED
package/src/shared.ts
CHANGED