mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-29 11:53:52 +02:00
Implement MP3 muxer
This commit is contained in:
+33
-33
@@ -179,39 +179,6 @@ export class WebMInputFormat extends MatroskaInputFormat {
|
||||
}
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export class WaveInputFormat extends InputFormat {
|
||||
async _canReadInput(input: Input) {
|
||||
const sourceSize = await input._mainReader.source._getSize();
|
||||
if (sourceSize < 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const riffReader = new RiffReader(input._mainReader);
|
||||
const riffType = riffReader.readAscii(4);
|
||||
if (riffType !== 'RIFF' && riffType !== 'RIFX') {
|
||||
return false;
|
||||
}
|
||||
|
||||
riffReader.pos = 8;
|
||||
const format = riffReader.readAscii(4);
|
||||
return format === 'WAVE';
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_createDemuxer(input: Input) {
|
||||
return new WaveDemuxer(input);
|
||||
}
|
||||
|
||||
getName() {
|
||||
return 'WAVE';
|
||||
}
|
||||
|
||||
getMimeType() {
|
||||
return 'audio/wav';
|
||||
}
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export class Mp3InputFormat extends InputFormat {
|
||||
async _canReadInput(input: Input) {
|
||||
@@ -248,6 +215,39 @@ export class Mp3InputFormat extends InputFormat {
|
||||
}
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export class WaveInputFormat extends InputFormat {
|
||||
async _canReadInput(input: Input) {
|
||||
const sourceSize = await input._mainReader.source._getSize();
|
||||
if (sourceSize < 12) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const riffReader = new RiffReader(input._mainReader);
|
||||
const riffType = riffReader.readAscii(4);
|
||||
if (riffType !== 'RIFF' && riffType !== 'RIFX') {
|
||||
return false;
|
||||
}
|
||||
|
||||
riffReader.pos = 8;
|
||||
const format = riffReader.readAscii(4);
|
||||
return format === 'WAVE';
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_createDemuxer(input: Input) {
|
||||
return new WaveDemuxer(input);
|
||||
}
|
||||
|
||||
getName() {
|
||||
return 'WAVE';
|
||||
}
|
||||
|
||||
getMimeType() {
|
||||
return 'audio/wav';
|
||||
}
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export const MP4 = new Mp4InputFormat();
|
||||
/** @public */
|
||||
|
||||
Reference in New Issue
Block a user