Permalink
Browse files

Made some changes to parser. Forcing thread options in job initialisa…

…tion
  • Loading branch information...
1 parent 62704e2 commit fadcb5637a469f39d9082d7bfbab320d712ebdf9 @cgiffard committed Nov 21, 2012
Showing with 15 additions and 3 deletions.
  1. +2 −2 ffparse.js
  2. +13 −1 ncoder.js
View
@@ -74,8 +74,8 @@ FFParser.prototype.parse = function(data) {
data = data.toString();
var self = this,
- endsWithNewline = data.match(/[\r\n]$/),
- lines = data.split(/[\r\n]/ig);
+ endsWithNewline = data.match(/\n$/),
+ lines = data.split(/\n/ig);
// If there's something in the output buffer, prepend it to the first line.
if (self._outputBuffer.length) {
View
@@ -12,7 +12,7 @@ var workers = [];
// Use
var NCoder = function NCoder(simultaneity) {
- simultaneity = simultaneity ? simultaneity : threadCount;
+ this.simultaneity = simultaneity ? simultaneity : threadCount;
this.queue = new NQueue(this);
};
@@ -68,6 +68,10 @@ NCoder.prototype.h264 = function(infile,outfile,options) {
"-r", videoFrameRate
];
+ if (this.simultaneity > 1) {
+ parameters.push("-threads",this.simultaneity);
+ }
+
return this.addJob(infile,outfile,parameters);
};
@@ -101,6 +105,10 @@ NCoder.prototype.ogv = function(infile,outfile,options) {
"-r", videoFrameRate
];
+ if (this.simultaneity > 1) {
+ parameters.push("-threads",this.simultaneity);
+ }
+
return this.addJob(infile,outfile,parameters);
};
@@ -131,6 +139,10 @@ NCoder.prototype.webm = function(infile,outfile,options) {
"-r", videoFrameRate
];
+ if (this.simultaneity > 1) {
+ parameters.push("-threads",this.simultaneity);
+ }
+
return this.addJob(infile,outfile,parameters);
};

0 comments on commit fadcb56

Please sign in to comment.