1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-04 10:09:16 +02:00

v1.08: Add handling of AC-3 audio codec too...

This commit is contained in:
Jeff Schiller 2023-02-01 21:59:26 -08:00
parent a24524e772
commit 44beb992bf
3 changed files with 29 additions and 6 deletions

View file

@ -122,6 +122,8 @@ export function getFullMIMEString(info) {
case 'aac': codecFrags.add(getMP4ACodecString(stream)); break;
case 'vorbis': codecFrags.add('vorbis'); break;
case 'opus': codecFrags.add('opus'); break;
// I'm going off of what Chromium calls this one, with the dash.
case 'ac3': codecFrags.add('ac-3'); break;
default:
throw `Could not handle codec_name ${stream.codec_name}, ` +
`codec_tag_string ${stream.codec_tag_string} for file ${info.format.filename} yet. ` +

View file

@ -1,6 +1,6 @@
{
"name": "@codedread/bitjs",
"version": "1.0.7",
"version": "1.0.8",
"description": "Binary Tools for JavaScript",
"homepage": "https://github.com/codedread/bitjs",
"author": "Jeff Schiller",

View file

@ -276,6 +276,27 @@ describe('codecs test suite', () => {
});
});
describe('MPEG2', () => {
/** @type {ProbeInfo} */
let info;
beforeEach(() => {
info = {
format: { format_name: 'matroska,webm' },
streams: [{
codec_type: 'video',
codec_name: 'mpeg2video',
}],
};
});
it('detects mpeg2video', () => {
expect(getFullMIMEString(info))
.to.be.a('string')
.and.equals('video/webm; codecs="mpeg2video"');
});
});
describe('MP4A / AAC', () => {
/** @type {ProbeInfo} */
let info;
@ -355,7 +376,7 @@ describe('codecs test suite', () => {
});
});
describe('MPEG2', () => {
describe('AC-3', () => {
/** @type {ProbeInfo} */
let info;
@ -363,16 +384,16 @@ describe('codecs test suite', () => {
info = {
format: { format_name: 'matroska,webm' },
streams: [{
codec_type: 'video',
codec_name: 'mpeg2video',
codec_type: 'audio',
codec_name: 'ac3',
}],
};
});
it('detects mpeg2video', () => {
it('detects AC-3', () => {
expect(getFullMIMEString(info))
.to.be.a('string')
.and.equals('video/webm; codecs="mpeg2video"');
.and.equals('audio/webm; codecs="ac-3"');
});
});
});