Skip to content

Commit

Permalink
Enhance progress extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Joyard committed Apr 30, 2016
1 parent 41851b6 commit 2ccd1b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ module.exports = function(proto) {
}

stderrRing.callback(function(line) {
utils.extractProgress(self, stderrRing.get(), duration);
utils.extractProgress(self, line, duration);
});
}
}
Expand Down
12 changes: 3 additions & 9 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,12 @@ var utils = module.exports = {
* Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate
*
* @param {FfmpegCommand} command event emitter
* @param {String} stderr ffmpeg stderr data
* @param {String} stderrLine ffmpeg stderr data
* @param {Number} [duration=0] expected output duration in seconds
* @private
*/
extractProgress: function(command, stderr, duration) {
var lines = stderr.split(nlRegexp);
var lastline = lines[lines.length - 2];
var progress;

if (lastline) {
progress = parseProgressLine(lastline);
}
extractProgress: function(command, stderrLine, duration) {
var progress = parseProgressLine(stderrLine);

if (progress) {
// build progress report object
Expand Down

0 comments on commit 2ccd1b0

Please sign in to comment.