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:
parent
a24524e772
commit
44beb992bf
3 changed files with 29 additions and 6 deletions
|
@ -122,6 +122,8 @@ export function getFullMIMEString(info) {
|
||||||
case 'aac': codecFrags.add(getMP4ACodecString(stream)); break;
|
case 'aac': codecFrags.add(getMP4ACodecString(stream)); break;
|
||||||
case 'vorbis': codecFrags.add('vorbis'); break;
|
case 'vorbis': codecFrags.add('vorbis'); break;
|
||||||
case 'opus': codecFrags.add('opus'); 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:
|
default:
|
||||||
throw `Could not handle codec_name ${stream.codec_name}, ` +
|
throw `Could not handle codec_name ${stream.codec_name}, ` +
|
||||||
`codec_tag_string ${stream.codec_tag_string} for file ${info.format.filename} yet. ` +
|
`codec_tag_string ${stream.codec_tag_string} for file ${info.format.filename} yet. ` +
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@codedread/bitjs",
|
"name": "@codedread/bitjs",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"description": "Binary Tools for JavaScript",
|
"description": "Binary Tools for JavaScript",
|
||||||
"homepage": "https://github.com/codedread/bitjs",
|
"homepage": "https://github.com/codedread/bitjs",
|
||||||
"author": "Jeff Schiller",
|
"author": "Jeff Schiller",
|
||||||
|
|
|
@ -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', () => {
|
describe('MP4A / AAC', () => {
|
||||||
/** @type {ProbeInfo} */
|
/** @type {ProbeInfo} */
|
||||||
let info;
|
let info;
|
||||||
|
@ -355,7 +376,7 @@ describe('codecs test suite', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('MPEG2', () => {
|
describe('AC-3', () => {
|
||||||
/** @type {ProbeInfo} */
|
/** @type {ProbeInfo} */
|
||||||
let info;
|
let info;
|
||||||
|
|
||||||
|
@ -363,16 +384,16 @@ describe('codecs test suite', () => {
|
||||||
info = {
|
info = {
|
||||||
format: { format_name: 'matroska,webm' },
|
format: { format_name: 'matroska,webm' },
|
||||||
streams: [{
|
streams: [{
|
||||||
codec_type: 'video',
|
codec_type: 'audio',
|
||||||
codec_name: 'mpeg2video',
|
codec_name: 'ac3',
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
it('detects mpeg2video', () => {
|
it('detects AC-3', () => {
|
||||||
expect(getFullMIMEString(info))
|
expect(getFullMIMEString(info))
|
||||||
.to.be.a('string')
|
.to.be.a('string')
|
||||||
.and.equals('video/webm; codecs="mpeg2video"');
|
.and.equals('audio/webm; codecs="ac-3"');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue