SB-6.1-PRE

This commit is contained in:
ItzEmerald committed 2021-02-02 13:50:53 +00:00
1 parent 690169a409
commit 358a25f522
3760 files changed
+300059 -36

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
const WebmBaseDemuxer = require('../core/WebmBase');
const VORBIS_HEAD = Buffer.from([...'vorbis'].map(x => x.charCodeAt(0)));
/**
* Demuxes a Webm stream (containing Vorbis audio) to output a Vorbis stream.
* @memberof vorbis
* @extends core.WebmBaseDemuxer
*/
class WebmDemuxer extends WebmBaseDemuxer {
_checkHead(data) {
if (data.readUInt8(0) !== 2 || !data.slice(4, 10).equals(VORBIS_HEAD)) {
throw Error('Audio codec is not Vorbis!');
}
this.push(data.slice(3, 3 + data.readUInt8(1)));
this.push(data.slice(3 + data.readUInt8(1), 3 + data.readUInt8(1) + data.readUInt8(2)));
this.push(data.slice(3 + data.readUInt8(1) + data.readUInt8(2)));
}
}
module.exports = WebmDemuxer;