/
debug.js
45 lines (44 loc) · 1.21 KB
/
debug.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
exports = module.exports = function Debug(command) {
command.prototype.getCommand = function(outputmethod, callback) {
var self = this;
this._prepare(function(err, meta) {
if (err) {
callback(null, err);
} else {
var args = self.buildFfmpegArgs(true, meta);
// kinda hacky, have to make sure the returned object is no array
if (args.length === undefined) {
callback(null, args);
} else {
var cmd = '';
cmd += 'ffmpeg';
args.forEach(function(el) {
cmd += ' ' + el;
});
callback(cmd, null);
}
}
});
return this;
};
command.prototype.getArgs = function(callback) {
if (callback) {
var self = this;
this._prepare(function(err, meta) {
if (err) {
callback(null, err);
} else {
var args = self.buildFfmpegArgs(true, meta);
// kinda hacky, have to make sure the returned object is no array
if (args.length === undefined) {
callback(null, args);
} else {
callback(args, null);
}
}
});
} else {
return this.buildFfmpegArgs(true, null);
}
};
};