43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.opus = exports.celt = undefined;
|
||
|
exports.getDuration = getDuration;
|
||
|
exports.createDecoderStream = createDecoderStream;
|
||
|
exports.createEncoderStream = createEncoderStream;
|
||
|
|
||
|
var _nodeOpus = require('node-opus');
|
||
|
|
||
|
var _decoderStream = require('./decoder-stream');
|
||
|
|
||
|
var _decoderStream2 = _interopRequireDefault(_decoderStream);
|
||
|
|
||
|
var _opusEncoderStream = require('./opus-encoder-stream');
|
||
|
|
||
|
var _opusEncoderStream2 = _interopRequireDefault(_opusEncoderStream);
|
||
|
|
||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||
|
|
||
|
var celt = exports.celt = [];
|
||
|
var opus = exports.opus = true;
|
||
|
|
||
|
function getDuration(codec, buffer) {
|
||
|
if (codec === 'Opus') {
|
||
|
// node-opus doesn't expose the relevant libopus function
|
||
|
return 10;
|
||
|
} else {
|
||
|
return 1;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function createDecoderStream(user) {
|
||
|
return new _decoderStream2.default();
|
||
|
}
|
||
|
|
||
|
function createEncoderStream(codec) {
|
||
|
if (codec === 'Opus') {
|
||
|
return new _opusEncoderStream2.default(codec);
|
||
|
}
|
||
|
}
|