-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.js
54 lines (45 loc) · 1.14 KB
/
configure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const { ffmpeg } = require('./ffmpeg')
const settings = require('./settings')
/**
* Configures module level settings like binary paths
* for various commands (ffmpeg, ffprobe, mkvmerge, x264)
* and shared settings between functions.
* @public
* @param {?(Object)} opts
* @param {?(Object)} opts.bin
* @param {?(String)} opts.bin.x264
* @param {?(String)} opts.bin.ffmpeg
* @param {?(String)} opts.bin.ffprobe
*/
function configure(opts) {
if (!opts || 'object' !== typeof opts) {
opts = {}
}
if (opts.bin) {
if ('string' === typeof opts.bin.x264) {
settings.bin.x264 = opts.bin.x264
}
if ('string' === typeof opts.bin.mkvmerge) {
settings.bin.mkvmerge = opts.bin.mkvmerge
}
if ('string' === typeof opts.bin.ffmpeg) {
settings.bin.ffmpeg = opts.bin.ffmpeg
}
if ('string' === typeof opts.bin.ffprobe) {
settings.bin.ffprobe = opts.bin.ffprobe
}
}
if (settings.bin.ffmpeg) {
ffmpeg.setFfmpegPath(settings.bin.ffmpeg)
}
if (settings.bin.ffprobe) {
ffmpeg.setFfprobePath(opts.bin.ffprobe)
}
return settings
}
/**
* Module exports.
*/
module.exports = {
configure
}