Skip to content

Commit a66e797

Browse files
committed
Add option to client-facing API to drop all animations, pass it down to C++ level
1 parent 90d4848 commit a66e797

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/post-worker.js

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ self.lastCurrentTimeReceivedAt = Date.now();
99
self.targetFps = 30;
1010
self.libassMemoryLimit = 0; // in MiB
1111
self.renderOnDemand = false; // determines if only rendering on demand
12+
self.dropAllAnimations = false; // set to true to enable "lite mode" with all animations disabled for speed
1213

1314
self.width = 0;
1415
self.height = 0;
@@ -597,6 +598,7 @@ function onMessageFromMainEmscriptenThread(message) {
597598
self.libassMemoryLimit = message.data.libassMemoryLimit || self.libassMemoryLimit;
598599
self.libassGlyphLimit = message.data.libassGlyphLimit || 0;
599600
self.renderOnDemand = message.data.renderOnDemand || false;
601+
self.dropAllAnimations = message.data.dropAllAnimations || false;
600602
removeRunDependency('worker-init');
601603
break;
602604
}

src/pre-worker.js

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Module['onRuntimeInitialized'] = function () {
9595
self.changed = Module._malloc(4);
9696

9797
self.octObj.initLibrary(screen.width, screen.height);
98+
self.octObj.setDropAnimations(!!self.dropAllAnimations);
9899
self.octObj.createTrack("/sub.ass");
99100
self.ass_track = self.octObj.track;
100101
self.ass_library = self.octObj.ass_library;

src/subtitles-octopus.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var SubtitlesOctopus = function (options) {
1414
var self = this;
1515
self.canvas = options.canvas; // HTML canvas element (optional if video specified)
1616
self.renderMode = options.renderMode || (options.lossyRender ? 'fast' : (options.blendRender ? 'blend' : 'normal'));
17+
self.dropAllAnimations = options.dropAllAnimations || false;
1718
self.libassMemoryLimit = options.libassMemoryLimit || 0; // set libass bitmap cache memory limit in MiB (approximate)
1819
self.libassGlyphLimit = options.libassGlyphLimit || 0; // set libass glyph cache memory limit in MiB (approximate)
1920
self.targetFps = options.targetFps || 30;
@@ -122,7 +123,8 @@ var SubtitlesOctopus = function (options) {
122123
targetFps: self.targetFps,
123124
libassMemoryLimit: self.libassMemoryLimit,
124125
libassGlyphLimit: self.libassGlyphLimit,
125-
renderOnDemand: self.renderAhead > 0
126+
renderOnDemand: self.renderAhead > 0,
127+
dropAllAnimations: self.dropAllAnimations
126128
});
127129
};
128130

0 commit comments

Comments
 (0)