-
Notifications
You must be signed in to change notification settings - Fork 3
/
compensationdelay.js
150 lines (138 loc) · 3.22 KB
/
compensationdelay.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
const addFilter = require('./utils').addFilter;
const registerFilter = require('./utils').registerFilter;
/**
* Augment FfmpegCommand with the compensationdelay function.
*
*
* @example
* ffmpeg().compensationdelay()
* ... // call filter configuration functions
* .build() // end filter configuration
* ...
* .applyFilters() // called once all filters have been configured
*
* @param {FfmpegCommand} ffmpegCommand The fluent-ffmpeg constructor.
* @return {FfmpegCommand} The ffmpegCommand augmented with the compensationdelay function.
*/
function compensationdelay(ffmpegCommand) {
registerFilter(ffmpegCommand, 'compensationdelay', function() {
return new CompensationdelayFilter(this);
});
return ffmpegCommand;
}
/**
* Class exposing methods to configure the vstack filter in a builder pattern way.
*
* See {@link http://ffmpeg.org/ffmpeg-filters.html#vstack} for a description
* of each configuration option.
*/
class CompensationdelayFilter {
/**
* @param {FfmpegCommand} ffmpegCommand The fluent-ffmpeg constructor.
*/
constructor (ffmpeg) {
this.ffmpeg = ffmpeg;
CompensationdelayFilter.prototype.withMm = this.mm;
CompensationdelayFilter.prototype.withCm = this.cm;
CompensationdelayFilter.prototype.withM = this.m;
CompensationdelayFilter.prototype.withDry = this.dry;
CompensationdelayFilter.prototype.withWet = this.wet;
CompensationdelayFilter.prototype.withTemp = this.temp;
}
/**
* Set millimeters distance. This is compensation distance for fine tuning.
* Default is 0.
*
*
* @param val
*/
mm(val) {
this._mm = val;
return this;
}
/**
* Set cm distance. This is compensation distance for tightening distance setup.
* Default is 0.
*
*
* @param val
*/
cm(val) {
this._cm = val;
return this;
}
/**
* Set meters distance. This is compensation distance for hard distance setup.
* Default is 0.
*
*
* @param val
*/
m(val) {
this._m = val;
return this;
}
/**
* Set dry amount. Amount of unprocessed (dry) signal.
* Default is 0.
*
*
* @param val
*/
dry(val) {
this._dry = val;
return this;
}
/**
* Set wet amount. Amount of processed (wet) signal.
* Default is 1.
*
*
* @param val
*/
wet(val) {
this._wet = val;
return this;
}
/**
* Set temperature degree in Celsius. This is the temperature of the environment.
* Default is 20.
*
* @param val
*/
temp(val) {
this._temp = val;
return this;
}
/**
* Creates this filter configuration and registers it in the ffmpeg instance.
* @return {ffmpegCommand} The ffmpeg instance.
*/
build() {
let opt = {};
if (this._mm) {
opt['mm'] = this._mm;
}
if (this._cm) {
opt['cm'] = this._cm;
}
if (this._m) {
opt['m'] = this._m;
}
if (this._dry) {
opt['dry'] = this._dry;
}
if (this._wet) {
opt['wet'] = this._wet;
}
if (this._temp) {
opt['temp'] = this._temp;
}
addFilter(this.ffmpeg, {
filter: 'compensationdelay',
options: opt
});
return this.ffmpeg;
}
}
module.exports.compensationdelay = compensationdelay;