Skip to content

Commit

Permalink
Add option to client-facing API to drop all animations, pass it down …
Browse files Browse the repository at this point in the history
…to C++ level
  • Loading branch information
JustAMan committed Mar 24, 2020
1 parent 90d4848 commit a66e797
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/post-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ self.lastCurrentTimeReceivedAt = Date.now();
self.targetFps = 30;
self.libassMemoryLimit = 0; // in MiB
self.renderOnDemand = false; // determines if only rendering on demand
self.dropAllAnimations = false; // set to true to enable "lite mode" with all animations disabled for speed

self.width = 0;
self.height = 0;
Expand Down Expand Up @@ -597,6 +598,7 @@ function onMessageFromMainEmscriptenThread(message) {
self.libassMemoryLimit = message.data.libassMemoryLimit || self.libassMemoryLimit;
self.libassGlyphLimit = message.data.libassGlyphLimit || 0;
self.renderOnDemand = message.data.renderOnDemand || false;
self.dropAllAnimations = message.data.dropAllAnimations || false;
removeRunDependency('worker-init');
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/pre-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Module['onRuntimeInitialized'] = function () {
self.changed = Module._malloc(4);

self.octObj.initLibrary(screen.width, screen.height);
self.octObj.setDropAnimations(!!self.dropAllAnimations);
self.octObj.createTrack("/sub.ass");
self.ass_track = self.octObj.track;
self.ass_library = self.octObj.ass_library;
Expand Down
4 changes: 3 additions & 1 deletion src/subtitles-octopus.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var SubtitlesOctopus = function (options) {
var self = this;
self.canvas = options.canvas; // HTML canvas element (optional if video specified)
self.renderMode = options.renderMode || (options.lossyRender ? 'fast' : (options.blendRender ? 'blend' : 'normal'));
self.dropAllAnimations = options.dropAllAnimations || false;
self.libassMemoryLimit = options.libassMemoryLimit || 0; // set libass bitmap cache memory limit in MiB (approximate)
self.libassGlyphLimit = options.libassGlyphLimit || 0; // set libass glyph cache memory limit in MiB (approximate)
self.targetFps = options.targetFps || 30;
Expand Down Expand Up @@ -122,7 +123,8 @@ var SubtitlesOctopus = function (options) {
targetFps: self.targetFps,
libassMemoryLimit: self.libassMemoryLimit,
libassGlyphLimit: self.libassGlyphLimit,
renderOnDemand: self.renderAhead > 0
renderOnDemand: self.renderAhead > 0,
dropAllAnimations: self.dropAllAnimations
});
};

Expand Down

0 comments on commit a66e797

Please sign in to comment.