libbitsub 1.10.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/ts/renderers.d.ts +2 -0
- package/dist/ts/renderers.d.ts.map +1 -1
- package/package.json +9 -5
- package/pkg/README.md +16 -0
- package/pkg/libbitsub.d.ts +6 -229
- package/pkg/libbitsub.js +22 -123
- package/pkg/libbitsub_bg.wasm +0 -0
- package/pkg/libbitsub_bg.wasm.d.ts +4 -4
- package/pkg/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,6 +35,22 @@ https://a.rafasu.com/v
|
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
|
+
For pure Rust parser/rendering logic:
|
|
39
|
+
|
|
40
|
+
```toml
|
|
41
|
+
[dependencies]
|
|
42
|
+
libbitsub-core = "1.10.0"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For WASM bindings from Rust:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[dependencies]
|
|
49
|
+
libbitsub = "1.10.0"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For JavaScript package managers:
|
|
53
|
+
|
|
38
54
|
```bash
|
|
39
55
|
npm install libbitsub
|
|
40
56
|
# or
|
package/dist/ts/renderers.d.ts
CHANGED
|
@@ -132,7 +132,9 @@ declare abstract class BaseVideoSubtitleRenderer {
|
|
|
132
132
|
protected emitCueChange(cue: SubtitleCueMetadata | null): void;
|
|
133
133
|
protected emitRendererBackend(renderer: SubtitleRendererBackend): void;
|
|
134
134
|
protected recordLastRenderInfo(info: SubtitleLastRenderInfo): void;
|
|
135
|
+
/** Initialize WebGPU renderer. */
|
|
135
136
|
private initWebGPU;
|
|
137
|
+
/** Initialize WebGL2 renderer. */
|
|
136
138
|
private initWebGL2;
|
|
137
139
|
/** Initialize Canvas2D renderer. */
|
|
138
140
|
private initCanvas2D;
|
|
@@ -1 +1 @@
|
|
|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|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"author": "altqx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/altqx/libbitsub"
|
|
10
|
+
},
|
|
7
11
|
"keywords": [
|
|
8
12
|
"libbitsub",
|
|
9
13
|
"pgs",
|
|
@@ -46,15 +50,15 @@
|
|
|
46
50
|
"format": "cargo fmt && prettier . --write"
|
|
47
51
|
},
|
|
48
52
|
"devDependencies": {
|
|
49
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
50
|
-
"prettier": "^3.8.
|
|
51
|
-
"typescript": "^6.0.
|
|
53
|
+
"@typescript/native-preview": "^7.0.0-dev.20260524.1",
|
|
54
|
+
"prettier": "^3.8.3",
|
|
55
|
+
"typescript": "^6.0.3"
|
|
52
56
|
},
|
|
53
57
|
"peerDependencies": {},
|
|
54
58
|
"engines": {
|
|
55
59
|
"node": ">=18"
|
|
56
60
|
},
|
|
57
61
|
"dependencies": {
|
|
58
|
-
"@webgpu/types": "^0.1.
|
|
62
|
+
"@webgpu/types": "^0.1.70"
|
|
59
63
|
}
|
|
60
64
|
}
|
package/pkg/README.md
CHANGED
|
@@ -35,6 +35,22 @@ https://a.rafasu.com/v
|
|
|
35
35
|
|
|
36
36
|
## Installation
|
|
37
37
|
|
|
38
|
+
For pure Rust parser/rendering logic:
|
|
39
|
+
|
|
40
|
+
```toml
|
|
41
|
+
[dependencies]
|
|
42
|
+
libbitsub-core = "1.10.0"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
For WASM bindings from Rust:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[dependencies]
|
|
49
|
+
libbitsub = "1.10.0"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For JavaScript package managers:
|
|
53
|
+
|
|
38
54
|
```bash
|
|
39
55
|
npm install libbitsub
|
|
40
56
|
# or
|
package/pkg/libbitsub.d.ts
CHANGED
|
@@ -7,67 +7,20 @@
|
|
|
7
7
|
export class PgsParser {
|
|
8
8
|
free(): void;
|
|
9
9
|
[Symbol.dispose](): void;
|
|
10
|
-
/**
|
|
11
|
-
* Clear the internal cache.
|
|
12
|
-
*/
|
|
13
10
|
clearCache(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Find the display set index for a given timestamp in milliseconds.
|
|
16
|
-
*/
|
|
17
11
|
findIndexAtTimestamp(time_ms: number): number;
|
|
18
|
-
/**
|
|
19
|
-
* Get the number of composition objects in a cue.
|
|
20
|
-
*/
|
|
21
12
|
getCueCompositionCount(index: number): number;
|
|
22
|
-
/**
|
|
23
|
-
* Get the cue composition state.
|
|
24
|
-
*/
|
|
25
13
|
getCueCompositionState(index: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Get the cue end time in milliseconds.
|
|
28
|
-
*/
|
|
29
14
|
getCueEndTime(index: number): number;
|
|
30
|
-
/**
|
|
31
|
-
* Get the cue palette ID.
|
|
32
|
-
*/
|
|
33
15
|
getCuePaletteId(index: number): number;
|
|
34
|
-
/**
|
|
35
|
-
* Get the cue start time in milliseconds.
|
|
36
|
-
*/
|
|
37
16
|
getCueStartTime(index: number): number;
|
|
38
|
-
/**
|
|
39
|
-
* Get all timestamps in milliseconds as a Float64Array.
|
|
40
|
-
*/
|
|
41
17
|
getTimestamps(): Float64Array;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new PGS parser.
|
|
44
|
-
*/
|
|
45
18
|
constructor();
|
|
46
|
-
/**
|
|
47
|
-
* Parse a PGS file from binary data.
|
|
48
|
-
* Returns the number of display sets parsed.
|
|
49
|
-
*/
|
|
50
19
|
parse(data: Uint8Array): number;
|
|
51
|
-
/**
|
|
52
|
-
* Render subtitle at the given index and return RGBA data.
|
|
53
|
-
* Returns null if index is invalid or no subtitle data.
|
|
54
|
-
*/
|
|
55
20
|
renderAtIndex(index: number): SubtitleFrame | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Get the number of display sets.
|
|
58
|
-
*/
|
|
59
21
|
readonly count: number;
|
|
60
|
-
/**
|
|
61
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
62
|
-
*/
|
|
63
22
|
readonly lastRenderIssue: string;
|
|
64
|
-
/**
|
|
65
|
-
* Get the presentation height for this subtitle track.
|
|
66
|
-
*/
|
|
67
23
|
readonly screenHeight: number;
|
|
68
|
-
/**
|
|
69
|
-
* Get the presentation width for this subtitle track.
|
|
70
|
-
*/
|
|
71
24
|
readonly screenWidth: number;
|
|
72
25
|
}
|
|
73
26
|
|
|
@@ -78,44 +31,23 @@ export class RenderResult {
|
|
|
78
31
|
private constructor();
|
|
79
32
|
free(): void;
|
|
80
33
|
[Symbol.dispose](): void;
|
|
81
|
-
/**
|
|
82
|
-
* Get composition height at index.
|
|
83
|
-
*/
|
|
84
34
|
getCompositionHeight(index: number): number;
|
|
85
|
-
/**
|
|
86
|
-
* Get composition RGBA data at index.
|
|
87
|
-
*/
|
|
88
35
|
getCompositionRgba(index: number): Uint8Array;
|
|
89
|
-
/**
|
|
90
|
-
* Get composition width at index.
|
|
91
|
-
*/
|
|
92
36
|
getCompositionWidth(index: number): number;
|
|
93
|
-
/**
|
|
94
|
-
* Get composition X position at index.
|
|
95
|
-
*/
|
|
96
37
|
getCompositionX(index: number): number;
|
|
97
|
-
/**
|
|
98
|
-
* Get composition Y position at index.
|
|
99
|
-
*/
|
|
100
38
|
getCompositionY(index: number): number;
|
|
101
|
-
/**
|
|
102
|
-
* Get the number of composition elements.
|
|
103
|
-
*/
|
|
104
39
|
readonly compositionCount: number;
|
|
105
40
|
readonly screenHeight: number;
|
|
106
41
|
readonly screenWidth: number;
|
|
107
42
|
}
|
|
108
43
|
|
|
109
44
|
/**
|
|
110
|
-
* A single subtitle composition element.
|
|
45
|
+
* A single PGS subtitle composition element.
|
|
111
46
|
*/
|
|
112
47
|
export class SubtitleComposition {
|
|
113
48
|
private constructor();
|
|
114
49
|
free(): void;
|
|
115
50
|
[Symbol.dispose](): void;
|
|
116
|
-
/**
|
|
117
|
-
* Get RGBA pixel data as Uint8Array.
|
|
118
|
-
*/
|
|
119
51
|
getRgba(): Uint8Array;
|
|
120
52
|
readonly height: number;
|
|
121
53
|
readonly width: number;
|
|
@@ -127,30 +59,18 @@ export class SubtitleComposition {
|
|
|
127
59
|
* Subtitle format type.
|
|
128
60
|
*/
|
|
129
61
|
export enum SubtitleFormat {
|
|
130
|
-
/**
|
|
131
|
-
* PGS (Blu-ray) subtitle format
|
|
132
|
-
*/
|
|
133
62
|
Pgs = 0,
|
|
134
|
-
/**
|
|
135
|
-
* VobSub (DVD) subtitle format
|
|
136
|
-
*/
|
|
137
63
|
VobSub = 1,
|
|
138
64
|
}
|
|
139
65
|
|
|
140
66
|
/**
|
|
141
|
-
* A complete subtitle frame with all compositions.
|
|
67
|
+
* A complete PGS subtitle frame with all compositions.
|
|
142
68
|
*/
|
|
143
69
|
export class SubtitleFrame {
|
|
144
70
|
private constructor();
|
|
145
71
|
free(): void;
|
|
146
72
|
[Symbol.dispose](): void;
|
|
147
|
-
/**
|
|
148
|
-
* Get a composition by index.
|
|
149
|
-
*/
|
|
150
73
|
getComposition(index: number): SubtitleComposition | undefined;
|
|
151
|
-
/**
|
|
152
|
-
* Get the number of compositions.
|
|
153
|
-
*/
|
|
154
74
|
readonly compositionCount: number;
|
|
155
75
|
readonly height: number;
|
|
156
76
|
readonly width: number;
|
|
@@ -162,94 +82,27 @@ export class SubtitleFrame {
|
|
|
162
82
|
export class SubtitleRenderer {
|
|
163
83
|
free(): void;
|
|
164
84
|
[Symbol.dispose](): void;
|
|
165
|
-
/**
|
|
166
|
-
* Clear internal caches.
|
|
167
|
-
*/
|
|
168
85
|
clearCache(): void;
|
|
169
|
-
/**
|
|
170
|
-
* Dispose of all resources.
|
|
171
|
-
*/
|
|
172
86
|
dispose(): void;
|
|
173
|
-
/**
|
|
174
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
175
|
-
*/
|
|
176
87
|
findIndexAtTimestamp(time_ms: number): number;
|
|
177
|
-
/**
|
|
178
|
-
* Get the cue duration in milliseconds.
|
|
179
|
-
*/
|
|
180
88
|
getCueDuration(index: number): number;
|
|
181
|
-
/**
|
|
182
|
-
* Get the cue end time in milliseconds.
|
|
183
|
-
*/
|
|
184
89
|
getCueEndTime(index: number): number;
|
|
185
|
-
/**
|
|
186
|
-
* Get the cue start time in milliseconds.
|
|
187
|
-
*/
|
|
188
90
|
getCueStartTime(index: number): number;
|
|
189
|
-
/**
|
|
190
|
-
* Get all timestamps in milliseconds.
|
|
191
|
-
*/
|
|
192
91
|
getTimestamps(): Float64Array;
|
|
193
|
-
/**
|
|
194
|
-
* Load PGS subtitle data.
|
|
195
|
-
*/
|
|
196
92
|
loadPgs(data: Uint8Array): number;
|
|
197
|
-
/**
|
|
198
|
-
* Load VobSub subtitle data from IDX and SUB.
|
|
199
|
-
*/
|
|
200
93
|
loadVobSub(idx_content: string, sub_data: Uint8Array): void;
|
|
201
|
-
/**
|
|
202
|
-
* Load VobSub subtitle data from a Matroska subtitle container.
|
|
203
|
-
*/
|
|
204
94
|
loadVobSubMks(mks_data: Uint8Array): void;
|
|
205
|
-
/**
|
|
206
|
-
* Load VobSub from SUB file only.
|
|
207
|
-
*/
|
|
208
95
|
loadVobSubOnly(sub_data: Uint8Array): void;
|
|
209
|
-
/**
|
|
210
|
-
* Create a new subtitle renderer.
|
|
211
|
-
*/
|
|
212
96
|
constructor();
|
|
213
|
-
/**
|
|
214
|
-
* Render subtitle at the given index.
|
|
215
|
-
* Returns a unified RenderResult or null.
|
|
216
|
-
*/
|
|
217
97
|
renderAtIndex(index: number): RenderResult | undefined;
|
|
218
|
-
/**
|
|
219
|
-
* Render subtitle at the given timestamp in seconds.
|
|
220
|
-
*/
|
|
221
98
|
renderAtTimestamp(time_seconds: number): RenderResult | undefined;
|
|
222
|
-
/**
|
|
223
|
-
* Get the number of subtitle entries.
|
|
224
|
-
*/
|
|
225
99
|
readonly count: number;
|
|
226
|
-
/**
|
|
227
|
-
* Get the current subtitle format.
|
|
228
|
-
*/
|
|
229
100
|
readonly format: SubtitleFormat | undefined;
|
|
230
|
-
/**
|
|
231
|
-
* Check whether IDX metadata was used for VobSub.
|
|
232
|
-
*/
|
|
233
101
|
readonly hasIdxMetadata: boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Get the VobSub language code if available.
|
|
236
|
-
*/
|
|
237
102
|
readonly language: string;
|
|
238
|
-
/**
|
|
239
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
240
|
-
*/
|
|
241
103
|
readonly lastRenderIssue: string;
|
|
242
|
-
/**
|
|
243
|
-
* Get the presentation height for the loaded subtitle track.
|
|
244
|
-
*/
|
|
245
104
|
readonly screenHeight: number;
|
|
246
|
-
/**
|
|
247
|
-
* Get the presentation width for the loaded subtitle track.
|
|
248
|
-
*/
|
|
249
105
|
readonly screenWidth: number;
|
|
250
|
-
/**
|
|
251
|
-
* Get the VobSub track ID if available.
|
|
252
|
-
*/
|
|
253
106
|
readonly trackId: string;
|
|
254
107
|
}
|
|
255
108
|
|
|
@@ -260,9 +113,6 @@ export class VobSubFrame {
|
|
|
260
113
|
private constructor();
|
|
261
114
|
free(): void;
|
|
262
115
|
[Symbol.dispose](): void;
|
|
263
|
-
/**
|
|
264
|
-
* Get RGBA pixel data as Uint8Array.
|
|
265
|
-
*/
|
|
266
116
|
getRgba(): Uint8Array;
|
|
267
117
|
readonly height: number;
|
|
268
118
|
readonly screenHeight: number;
|
|
@@ -278,102 +128,29 @@ export class VobSubFrame {
|
|
|
278
128
|
export class VobSubParser {
|
|
279
129
|
free(): void;
|
|
280
130
|
[Symbol.dispose](): void;
|
|
281
|
-
/**
|
|
282
|
-
* Clear the internal cache.
|
|
283
|
-
*/
|
|
284
131
|
clearCache(): void;
|
|
285
|
-
/**
|
|
286
|
-
* Dispose of all resources.
|
|
287
|
-
*/
|
|
288
132
|
dispose(): void;
|
|
289
|
-
/**
|
|
290
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
291
|
-
* Returns -1 if no subtitle should be displayed at this time.
|
|
292
|
-
*/
|
|
293
133
|
findIndexAtTimestamp(time_ms: number): number;
|
|
294
|
-
/**
|
|
295
|
-
* Get the cue duration in milliseconds.
|
|
296
|
-
*/
|
|
297
134
|
getCueDuration(index: number): number;
|
|
298
|
-
/**
|
|
299
|
-
* Get the cue end time in milliseconds.
|
|
300
|
-
*/
|
|
301
135
|
getCueEndTime(index: number): number;
|
|
302
|
-
/**
|
|
303
|
-
* Get the cue file position in the SUB file.
|
|
304
|
-
*/
|
|
305
136
|
getCueFilePosition(index: number): number;
|
|
306
|
-
/**
|
|
307
|
-
* Get the cue start time in milliseconds.
|
|
308
|
-
*/
|
|
309
137
|
getCueStartTime(index: number): number;
|
|
310
|
-
/**
|
|
311
|
-
* Get all timestamps in milliseconds as a Float64Array.
|
|
312
|
-
*/
|
|
313
138
|
getTimestamps(): Float64Array;
|
|
314
|
-
/**
|
|
315
|
-
* Load VobSub from IDX content and SUB data.
|
|
316
|
-
*/
|
|
317
139
|
loadFromData(idx_content: string, sub_data: Uint8Array): void;
|
|
318
|
-
/**
|
|
319
|
-
* Load VobSub from a Matroska subtitle container with embedded S_VOBSUB tracks.
|
|
320
|
-
*/
|
|
321
140
|
loadFromMks(mks_data: Uint8Array): void;
|
|
322
|
-
/**
|
|
323
|
-
* Load VobSub from SUB file only (scans for timestamps).
|
|
324
|
-
*/
|
|
325
141
|
loadFromSubOnly(sub_data: Uint8Array): void;
|
|
326
|
-
/**
|
|
327
|
-
* Create a new VobSub parser.
|
|
328
|
-
*/
|
|
329
142
|
constructor();
|
|
330
|
-
/**
|
|
331
|
-
* Render subtitle at the given index and return RGBA data.
|
|
332
|
-
*/
|
|
333
143
|
renderAtIndex(index: number): VobSubFrame | undefined;
|
|
334
|
-
/**
|
|
335
|
-
* Enable or disable debanding.
|
|
336
|
-
*/
|
|
337
144
|
setDebandEnabled(enabled: boolean): void;
|
|
338
|
-
/**
|
|
339
|
-
* Set the deband sample range in pixels (default: 15).
|
|
340
|
-
*/
|
|
341
145
|
setDebandRange(range: number): void;
|
|
342
|
-
/**
|
|
343
|
-
* Set the deband threshold (0.0-255.0, default: 64.0).
|
|
344
|
-
*/
|
|
345
146
|
setDebandThreshold(threshold: number): void;
|
|
346
|
-
/**
|
|
347
|
-
* Get the number of subtitle entries.
|
|
348
|
-
*/
|
|
349
147
|
readonly count: number;
|
|
350
|
-
/**
|
|
351
|
-
* Check if debanding is enabled.
|
|
352
|
-
*/
|
|
353
148
|
readonly debandEnabled: boolean;
|
|
354
|
-
/**
|
|
355
|
-
* Check whether IDX metadata was used to load the parser.
|
|
356
|
-
*/
|
|
357
149
|
readonly hasIdxMetadata: boolean;
|
|
358
|
-
/**
|
|
359
|
-
* Get the declared language code from IDX metadata.
|
|
360
|
-
*/
|
|
361
150
|
readonly language: string;
|
|
362
|
-
/**
|
|
363
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
364
|
-
*/
|
|
365
151
|
readonly lastRenderIssue: string;
|
|
366
|
-
/**
|
|
367
|
-
* Get the presentation height for this subtitle track.
|
|
368
|
-
*/
|
|
369
152
|
readonly screenHeight: number;
|
|
370
|
-
/**
|
|
371
|
-
* Get the presentation width for this subtitle track.
|
|
372
|
-
*/
|
|
373
153
|
readonly screenWidth: number;
|
|
374
|
-
/**
|
|
375
|
-
* Get the declared subtitle track ID from IDX metadata.
|
|
376
|
-
*/
|
|
377
154
|
readonly trackId: string;
|
|
378
155
|
}
|
|
379
156
|
|
|
@@ -389,6 +166,7 @@ export interface InitOutput {
|
|
|
389
166
|
readonly __wbg_pgsparser_free: (a: number, b: number) => void;
|
|
390
167
|
readonly __wbg_renderresult_free: (a: number, b: number) => void;
|
|
391
168
|
readonly __wbg_subtitlecomposition_free: (a: number, b: number) => void;
|
|
169
|
+
readonly __wbg_subtitleframe_free: (a: number, b: number) => void;
|
|
392
170
|
readonly __wbg_subtitlerenderer_free: (a: number, b: number) => void;
|
|
393
171
|
readonly __wbg_vobsubframe_free: (a: number, b: number) => void;
|
|
394
172
|
readonly __wbg_vobsubparser_free: (a: number, b: number) => void;
|
|
@@ -421,7 +199,10 @@ export interface InitOutput {
|
|
|
421
199
|
readonly subtitlecomposition_width: (a: number) => number;
|
|
422
200
|
readonly subtitlecomposition_x: (a: number) => number;
|
|
423
201
|
readonly subtitlecomposition_y: (a: number) => number;
|
|
202
|
+
readonly subtitleframe_compositionCount: (a: number) => number;
|
|
424
203
|
readonly subtitleframe_getComposition: (a: number, b: number) => number;
|
|
204
|
+
readonly subtitleframe_height: (a: number) => number;
|
|
205
|
+
readonly subtitleframe_width: (a: number) => number;
|
|
425
206
|
readonly subtitlerenderer_clearCache: (a: number) => void;
|
|
426
207
|
readonly subtitlerenderer_count: (a: number) => number;
|
|
427
208
|
readonly subtitlerenderer_dispose: (a: number) => void;
|
|
@@ -475,10 +256,6 @@ export interface InitOutput {
|
|
|
475
256
|
readonly vobsubparser_setDebandRange: (a: number, b: number) => void;
|
|
476
257
|
readonly vobsubparser_setDebandThreshold: (a: number, b: number) => void;
|
|
477
258
|
readonly vobsubparser_trackId: (a: number) => [number, number];
|
|
478
|
-
readonly __wbg_subtitleframe_free: (a: number, b: number) => void;
|
|
479
|
-
readonly subtitleframe_compositionCount: (a: number) => number;
|
|
480
|
-
readonly subtitleframe_width: (a: number) => number;
|
|
481
|
-
readonly subtitleframe_height: (a: number) => number;
|
|
482
259
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
483
260
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
484
261
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/pkg/libbitsub.js
CHANGED
|
@@ -14,14 +14,10 @@ export class PgsParser {
|
|
|
14
14
|
const ptr = this.__destroy_into_raw();
|
|
15
15
|
wasm.__wbg_pgsparser_free(ptr, 0);
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Clear the internal cache.
|
|
19
|
-
*/
|
|
20
17
|
clearCache() {
|
|
21
18
|
wasm.pgsparser_clearCache(this.__wbg_ptr);
|
|
22
19
|
}
|
|
23
20
|
/**
|
|
24
|
-
* Get the number of display sets.
|
|
25
21
|
* @returns {number}
|
|
26
22
|
*/
|
|
27
23
|
get count() {
|
|
@@ -29,7 +25,6 @@ export class PgsParser {
|
|
|
29
25
|
return ret >>> 0;
|
|
30
26
|
}
|
|
31
27
|
/**
|
|
32
|
-
* Find the display set index for a given timestamp in milliseconds.
|
|
33
28
|
* @param {number} time_ms
|
|
34
29
|
* @returns {number}
|
|
35
30
|
*/
|
|
@@ -38,7 +33,6 @@ export class PgsParser {
|
|
|
38
33
|
return ret;
|
|
39
34
|
}
|
|
40
35
|
/**
|
|
41
|
-
* Get the number of composition objects in a cue.
|
|
42
36
|
* @param {number} index
|
|
43
37
|
* @returns {number}
|
|
44
38
|
*/
|
|
@@ -47,7 +41,6 @@ export class PgsParser {
|
|
|
47
41
|
return ret >>> 0;
|
|
48
42
|
}
|
|
49
43
|
/**
|
|
50
|
-
* Get the cue composition state.
|
|
51
44
|
* @param {number} index
|
|
52
45
|
* @returns {number}
|
|
53
46
|
*/
|
|
@@ -56,7 +49,6 @@ export class PgsParser {
|
|
|
56
49
|
return ret;
|
|
57
50
|
}
|
|
58
51
|
/**
|
|
59
|
-
* Get the cue end time in milliseconds.
|
|
60
52
|
* @param {number} index
|
|
61
53
|
* @returns {number}
|
|
62
54
|
*/
|
|
@@ -65,7 +57,6 @@ export class PgsParser {
|
|
|
65
57
|
return ret;
|
|
66
58
|
}
|
|
67
59
|
/**
|
|
68
|
-
* Get the cue palette ID.
|
|
69
60
|
* @param {number} index
|
|
70
61
|
* @returns {number}
|
|
71
62
|
*/
|
|
@@ -74,7 +65,6 @@ export class PgsParser {
|
|
|
74
65
|
return ret;
|
|
75
66
|
}
|
|
76
67
|
/**
|
|
77
|
-
* Get the cue start time in milliseconds.
|
|
78
68
|
* @param {number} index
|
|
79
69
|
* @returns {number}
|
|
80
70
|
*/
|
|
@@ -83,7 +73,6 @@ export class PgsParser {
|
|
|
83
73
|
return ret;
|
|
84
74
|
}
|
|
85
75
|
/**
|
|
86
|
-
* Get all timestamps in milliseconds as a Float64Array.
|
|
87
76
|
* @returns {Float64Array}
|
|
88
77
|
*/
|
|
89
78
|
getTimestamps() {
|
|
@@ -91,7 +80,6 @@ export class PgsParser {
|
|
|
91
80
|
return ret;
|
|
92
81
|
}
|
|
93
82
|
/**
|
|
94
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
95
83
|
* @returns {string}
|
|
96
84
|
*/
|
|
97
85
|
get lastRenderIssue() {
|
|
@@ -106,18 +94,13 @@ export class PgsParser {
|
|
|
106
94
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
107
95
|
}
|
|
108
96
|
}
|
|
109
|
-
/**
|
|
110
|
-
* Create a new PGS parser.
|
|
111
|
-
*/
|
|
112
97
|
constructor() {
|
|
113
98
|
const ret = wasm.pgsparser_new();
|
|
114
|
-
this.__wbg_ptr = ret
|
|
99
|
+
this.__wbg_ptr = ret;
|
|
115
100
|
PgsParserFinalization.register(this, this.__wbg_ptr, this);
|
|
116
101
|
return this;
|
|
117
102
|
}
|
|
118
103
|
/**
|
|
119
|
-
* Parse a PGS file from binary data.
|
|
120
|
-
* Returns the number of display sets parsed.
|
|
121
104
|
* @param {Uint8Array} data
|
|
122
105
|
* @returns {number}
|
|
123
106
|
*/
|
|
@@ -128,8 +111,6 @@ export class PgsParser {
|
|
|
128
111
|
return ret >>> 0;
|
|
129
112
|
}
|
|
130
113
|
/**
|
|
131
|
-
* Render subtitle at the given index and return RGBA data.
|
|
132
|
-
* Returns null if index is invalid or no subtitle data.
|
|
133
114
|
* @param {number} index
|
|
134
115
|
* @returns {SubtitleFrame | undefined}
|
|
135
116
|
*/
|
|
@@ -138,7 +119,6 @@ export class PgsParser {
|
|
|
138
119
|
return ret === 0 ? undefined : SubtitleFrame.__wrap(ret);
|
|
139
120
|
}
|
|
140
121
|
/**
|
|
141
|
-
* Get the presentation height for this subtitle track.
|
|
142
122
|
* @returns {number}
|
|
143
123
|
*/
|
|
144
124
|
get screenHeight() {
|
|
@@ -146,7 +126,6 @@ export class PgsParser {
|
|
|
146
126
|
return ret;
|
|
147
127
|
}
|
|
148
128
|
/**
|
|
149
|
-
* Get the presentation width for this subtitle track.
|
|
150
129
|
* @returns {number}
|
|
151
130
|
*/
|
|
152
131
|
get screenWidth() {
|
|
@@ -161,7 +140,6 @@ if (Symbol.dispose) PgsParser.prototype[Symbol.dispose] = PgsParser.prototype.fr
|
|
|
161
140
|
*/
|
|
162
141
|
export class RenderResult {
|
|
163
142
|
static __wrap(ptr) {
|
|
164
|
-
ptr = ptr >>> 0;
|
|
165
143
|
const obj = Object.create(RenderResult.prototype);
|
|
166
144
|
obj.__wbg_ptr = ptr;
|
|
167
145
|
RenderResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -178,7 +156,6 @@ export class RenderResult {
|
|
|
178
156
|
wasm.__wbg_renderresult_free(ptr, 0);
|
|
179
157
|
}
|
|
180
158
|
/**
|
|
181
|
-
* Get the number of composition elements.
|
|
182
159
|
* @returns {number}
|
|
183
160
|
*/
|
|
184
161
|
get compositionCount() {
|
|
@@ -186,7 +163,6 @@ export class RenderResult {
|
|
|
186
163
|
return ret >>> 0;
|
|
187
164
|
}
|
|
188
165
|
/**
|
|
189
|
-
* Get composition height at index.
|
|
190
166
|
* @param {number} index
|
|
191
167
|
* @returns {number}
|
|
192
168
|
*/
|
|
@@ -195,7 +171,6 @@ export class RenderResult {
|
|
|
195
171
|
return ret;
|
|
196
172
|
}
|
|
197
173
|
/**
|
|
198
|
-
* Get composition RGBA data at index.
|
|
199
174
|
* @param {number} index
|
|
200
175
|
* @returns {Uint8Array}
|
|
201
176
|
*/
|
|
@@ -204,7 +179,6 @@ export class RenderResult {
|
|
|
204
179
|
return ret;
|
|
205
180
|
}
|
|
206
181
|
/**
|
|
207
|
-
* Get composition width at index.
|
|
208
182
|
* @param {number} index
|
|
209
183
|
* @returns {number}
|
|
210
184
|
*/
|
|
@@ -213,7 +187,6 @@ export class RenderResult {
|
|
|
213
187
|
return ret;
|
|
214
188
|
}
|
|
215
189
|
/**
|
|
216
|
-
* Get composition X position at index.
|
|
217
190
|
* @param {number} index
|
|
218
191
|
* @returns {number}
|
|
219
192
|
*/
|
|
@@ -222,7 +195,6 @@ export class RenderResult {
|
|
|
222
195
|
return ret;
|
|
223
196
|
}
|
|
224
197
|
/**
|
|
225
|
-
* Get composition Y position at index.
|
|
226
198
|
* @param {number} index
|
|
227
199
|
* @returns {number}
|
|
228
200
|
*/
|
|
@@ -248,11 +220,10 @@ export class RenderResult {
|
|
|
248
220
|
if (Symbol.dispose) RenderResult.prototype[Symbol.dispose] = RenderResult.prototype.free;
|
|
249
221
|
|
|
250
222
|
/**
|
|
251
|
-
* A single subtitle composition element.
|
|
223
|
+
* A single PGS subtitle composition element.
|
|
252
224
|
*/
|
|
253
225
|
export class SubtitleComposition {
|
|
254
226
|
static __wrap(ptr) {
|
|
255
|
-
ptr = ptr >>> 0;
|
|
256
227
|
const obj = Object.create(SubtitleComposition.prototype);
|
|
257
228
|
obj.__wbg_ptr = ptr;
|
|
258
229
|
SubtitleCompositionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -269,7 +240,6 @@ export class SubtitleComposition {
|
|
|
269
240
|
wasm.__wbg_subtitlecomposition_free(ptr, 0);
|
|
270
241
|
}
|
|
271
242
|
/**
|
|
272
|
-
* Get RGBA pixel data as Uint8Array.
|
|
273
243
|
* @returns {Uint8Array}
|
|
274
244
|
*/
|
|
275
245
|
getRgba() {
|
|
@@ -312,22 +282,15 @@ if (Symbol.dispose) SubtitleComposition.prototype[Symbol.dispose] = SubtitleComp
|
|
|
312
282
|
* @enum {0 | 1}
|
|
313
283
|
*/
|
|
314
284
|
export const SubtitleFormat = Object.freeze({
|
|
315
|
-
/**
|
|
316
|
-
* PGS (Blu-ray) subtitle format
|
|
317
|
-
*/
|
|
318
285
|
Pgs: 0, "0": "Pgs",
|
|
319
|
-
/**
|
|
320
|
-
* VobSub (DVD) subtitle format
|
|
321
|
-
*/
|
|
322
286
|
VobSub: 1, "1": "VobSub",
|
|
323
287
|
});
|
|
324
288
|
|
|
325
289
|
/**
|
|
326
|
-
* A complete subtitle frame with all compositions.
|
|
290
|
+
* A complete PGS subtitle frame with all compositions.
|
|
327
291
|
*/
|
|
328
292
|
export class SubtitleFrame {
|
|
329
293
|
static __wrap(ptr) {
|
|
330
|
-
ptr = ptr >>> 0;
|
|
331
294
|
const obj = Object.create(SubtitleFrame.prototype);
|
|
332
295
|
obj.__wbg_ptr = ptr;
|
|
333
296
|
SubtitleFrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -344,7 +307,6 @@ export class SubtitleFrame {
|
|
|
344
307
|
wasm.__wbg_subtitleframe_free(ptr, 0);
|
|
345
308
|
}
|
|
346
309
|
/**
|
|
347
|
-
* Get the number of compositions.
|
|
348
310
|
* @returns {number}
|
|
349
311
|
*/
|
|
350
312
|
get compositionCount() {
|
|
@@ -352,7 +314,6 @@ export class SubtitleFrame {
|
|
|
352
314
|
return ret >>> 0;
|
|
353
315
|
}
|
|
354
316
|
/**
|
|
355
|
-
* Get a composition by index.
|
|
356
317
|
* @param {number} index
|
|
357
318
|
* @returns {SubtitleComposition | undefined}
|
|
358
319
|
*/
|
|
@@ -391,28 +352,20 @@ export class SubtitleRenderer {
|
|
|
391
352
|
const ptr = this.__destroy_into_raw();
|
|
392
353
|
wasm.__wbg_subtitlerenderer_free(ptr, 0);
|
|
393
354
|
}
|
|
394
|
-
/**
|
|
395
|
-
* Clear internal caches.
|
|
396
|
-
*/
|
|
397
355
|
clearCache() {
|
|
398
356
|
wasm.subtitlerenderer_clearCache(this.__wbg_ptr);
|
|
399
357
|
}
|
|
400
358
|
/**
|
|
401
|
-
* Get the number of subtitle entries.
|
|
402
359
|
* @returns {number}
|
|
403
360
|
*/
|
|
404
361
|
get count() {
|
|
405
362
|
const ret = wasm.subtitlerenderer_count(this.__wbg_ptr);
|
|
406
363
|
return ret >>> 0;
|
|
407
364
|
}
|
|
408
|
-
/**
|
|
409
|
-
* Dispose of all resources.
|
|
410
|
-
*/
|
|
411
365
|
dispose() {
|
|
412
366
|
wasm.subtitlerenderer_dispose(this.__wbg_ptr);
|
|
413
367
|
}
|
|
414
368
|
/**
|
|
415
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
416
369
|
* @param {number} time_ms
|
|
417
370
|
* @returns {number}
|
|
418
371
|
*/
|
|
@@ -421,7 +374,6 @@ export class SubtitleRenderer {
|
|
|
421
374
|
return ret;
|
|
422
375
|
}
|
|
423
376
|
/**
|
|
424
|
-
* Get the current subtitle format.
|
|
425
377
|
* @returns {SubtitleFormat | undefined}
|
|
426
378
|
*/
|
|
427
379
|
get format() {
|
|
@@ -429,7 +381,6 @@ export class SubtitleRenderer {
|
|
|
429
381
|
return ret === 2 ? undefined : ret;
|
|
430
382
|
}
|
|
431
383
|
/**
|
|
432
|
-
* Get the cue duration in milliseconds.
|
|
433
384
|
* @param {number} index
|
|
434
385
|
* @returns {number}
|
|
435
386
|
*/
|
|
@@ -438,7 +389,6 @@ export class SubtitleRenderer {
|
|
|
438
389
|
return ret;
|
|
439
390
|
}
|
|
440
391
|
/**
|
|
441
|
-
* Get the cue end time in milliseconds.
|
|
442
392
|
* @param {number} index
|
|
443
393
|
* @returns {number}
|
|
444
394
|
*/
|
|
@@ -447,7 +397,6 @@ export class SubtitleRenderer {
|
|
|
447
397
|
return ret;
|
|
448
398
|
}
|
|
449
399
|
/**
|
|
450
|
-
* Get the cue start time in milliseconds.
|
|
451
400
|
* @param {number} index
|
|
452
401
|
* @returns {number}
|
|
453
402
|
*/
|
|
@@ -456,7 +405,6 @@ export class SubtitleRenderer {
|
|
|
456
405
|
return ret;
|
|
457
406
|
}
|
|
458
407
|
/**
|
|
459
|
-
* Get all timestamps in milliseconds.
|
|
460
408
|
* @returns {Float64Array}
|
|
461
409
|
*/
|
|
462
410
|
getTimestamps() {
|
|
@@ -464,7 +412,6 @@ export class SubtitleRenderer {
|
|
|
464
412
|
return ret;
|
|
465
413
|
}
|
|
466
414
|
/**
|
|
467
|
-
* Check whether IDX metadata was used for VobSub.
|
|
468
415
|
* @returns {boolean}
|
|
469
416
|
*/
|
|
470
417
|
get hasIdxMetadata() {
|
|
@@ -472,7 +419,6 @@ export class SubtitleRenderer {
|
|
|
472
419
|
return ret !== 0;
|
|
473
420
|
}
|
|
474
421
|
/**
|
|
475
|
-
* Get the VobSub language code if available.
|
|
476
422
|
* @returns {string}
|
|
477
423
|
*/
|
|
478
424
|
get language() {
|
|
@@ -488,7 +434,6 @@ export class SubtitleRenderer {
|
|
|
488
434
|
}
|
|
489
435
|
}
|
|
490
436
|
/**
|
|
491
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
492
437
|
* @returns {string}
|
|
493
438
|
*/
|
|
494
439
|
get lastRenderIssue() {
|
|
@@ -504,7 +449,6 @@ export class SubtitleRenderer {
|
|
|
504
449
|
}
|
|
505
450
|
}
|
|
506
451
|
/**
|
|
507
|
-
* Load PGS subtitle data.
|
|
508
452
|
* @param {Uint8Array} data
|
|
509
453
|
* @returns {number}
|
|
510
454
|
*/
|
|
@@ -515,7 +459,6 @@ export class SubtitleRenderer {
|
|
|
515
459
|
return ret >>> 0;
|
|
516
460
|
}
|
|
517
461
|
/**
|
|
518
|
-
* Load VobSub subtitle data from IDX and SUB.
|
|
519
462
|
* @param {string} idx_content
|
|
520
463
|
* @param {Uint8Array} sub_data
|
|
521
464
|
*/
|
|
@@ -527,7 +470,6 @@ export class SubtitleRenderer {
|
|
|
527
470
|
wasm.subtitlerenderer_loadVobSub(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
528
471
|
}
|
|
529
472
|
/**
|
|
530
|
-
* Load VobSub subtitle data from a Matroska subtitle container.
|
|
531
473
|
* @param {Uint8Array} mks_data
|
|
532
474
|
*/
|
|
533
475
|
loadVobSubMks(mks_data) {
|
|
@@ -539,7 +481,6 @@ export class SubtitleRenderer {
|
|
|
539
481
|
}
|
|
540
482
|
}
|
|
541
483
|
/**
|
|
542
|
-
* Load VobSub from SUB file only.
|
|
543
484
|
* @param {Uint8Array} sub_data
|
|
544
485
|
*/
|
|
545
486
|
loadVobSubOnly(sub_data) {
|
|
@@ -547,18 +488,13 @@ export class SubtitleRenderer {
|
|
|
547
488
|
const len0 = WASM_VECTOR_LEN;
|
|
548
489
|
wasm.subtitlerenderer_loadVobSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
549
490
|
}
|
|
550
|
-
/**
|
|
551
|
-
* Create a new subtitle renderer.
|
|
552
|
-
*/
|
|
553
491
|
constructor() {
|
|
554
492
|
const ret = wasm.subtitlerenderer_new();
|
|
555
|
-
this.__wbg_ptr = ret
|
|
493
|
+
this.__wbg_ptr = ret;
|
|
556
494
|
SubtitleRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
557
495
|
return this;
|
|
558
496
|
}
|
|
559
497
|
/**
|
|
560
|
-
* Render subtitle at the given index.
|
|
561
|
-
* Returns a unified RenderResult or null.
|
|
562
498
|
* @param {number} index
|
|
563
499
|
* @returns {RenderResult | undefined}
|
|
564
500
|
*/
|
|
@@ -567,7 +503,6 @@ export class SubtitleRenderer {
|
|
|
567
503
|
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
568
504
|
}
|
|
569
505
|
/**
|
|
570
|
-
* Render subtitle at the given timestamp in seconds.
|
|
571
506
|
* @param {number} time_seconds
|
|
572
507
|
* @returns {RenderResult | undefined}
|
|
573
508
|
*/
|
|
@@ -576,7 +511,6 @@ export class SubtitleRenderer {
|
|
|
576
511
|
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
577
512
|
}
|
|
578
513
|
/**
|
|
579
|
-
* Get the presentation height for the loaded subtitle track.
|
|
580
514
|
* @returns {number}
|
|
581
515
|
*/
|
|
582
516
|
get screenHeight() {
|
|
@@ -584,7 +518,6 @@ export class SubtitleRenderer {
|
|
|
584
518
|
return ret;
|
|
585
519
|
}
|
|
586
520
|
/**
|
|
587
|
-
* Get the presentation width for the loaded subtitle track.
|
|
588
521
|
* @returns {number}
|
|
589
522
|
*/
|
|
590
523
|
get screenWidth() {
|
|
@@ -592,7 +525,6 @@ export class SubtitleRenderer {
|
|
|
592
525
|
return ret;
|
|
593
526
|
}
|
|
594
527
|
/**
|
|
595
|
-
* Get the VobSub track ID if available.
|
|
596
528
|
* @returns {string}
|
|
597
529
|
*/
|
|
598
530
|
get trackId() {
|
|
@@ -615,7 +547,6 @@ if (Symbol.dispose) SubtitleRenderer.prototype[Symbol.dispose] = SubtitleRendere
|
|
|
615
547
|
*/
|
|
616
548
|
export class VobSubFrame {
|
|
617
549
|
static __wrap(ptr) {
|
|
618
|
-
ptr = ptr >>> 0;
|
|
619
550
|
const obj = Object.create(VobSubFrame.prototype);
|
|
620
551
|
obj.__wbg_ptr = ptr;
|
|
621
552
|
VobSubFrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -632,7 +563,6 @@ export class VobSubFrame {
|
|
|
632
563
|
wasm.__wbg_vobsubframe_free(ptr, 0);
|
|
633
564
|
}
|
|
634
565
|
/**
|
|
635
|
-
* Get RGBA pixel data as Uint8Array.
|
|
636
566
|
* @returns {Uint8Array}
|
|
637
567
|
*/
|
|
638
568
|
getRgba() {
|
|
@@ -698,14 +628,10 @@ export class VobSubParser {
|
|
|
698
628
|
const ptr = this.__destroy_into_raw();
|
|
699
629
|
wasm.__wbg_vobsubparser_free(ptr, 0);
|
|
700
630
|
}
|
|
701
|
-
/**
|
|
702
|
-
* Clear the internal cache.
|
|
703
|
-
*/
|
|
704
631
|
clearCache() {
|
|
705
632
|
wasm.vobsubparser_clearCache(this.__wbg_ptr);
|
|
706
633
|
}
|
|
707
634
|
/**
|
|
708
|
-
* Get the number of subtitle entries.
|
|
709
635
|
* @returns {number}
|
|
710
636
|
*/
|
|
711
637
|
get count() {
|
|
@@ -713,22 +639,16 @@ export class VobSubParser {
|
|
|
713
639
|
return ret >>> 0;
|
|
714
640
|
}
|
|
715
641
|
/**
|
|
716
|
-
* Check if debanding is enabled.
|
|
717
642
|
* @returns {boolean}
|
|
718
643
|
*/
|
|
719
644
|
get debandEnabled() {
|
|
720
645
|
const ret = wasm.vobsubparser_debandEnabled(this.__wbg_ptr);
|
|
721
646
|
return ret !== 0;
|
|
722
647
|
}
|
|
723
|
-
/**
|
|
724
|
-
* Dispose of all resources.
|
|
725
|
-
*/
|
|
726
648
|
dispose() {
|
|
727
649
|
wasm.vobsubparser_dispose(this.__wbg_ptr);
|
|
728
650
|
}
|
|
729
651
|
/**
|
|
730
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
731
|
-
* Returns -1 if no subtitle should be displayed at this time.
|
|
732
652
|
* @param {number} time_ms
|
|
733
653
|
* @returns {number}
|
|
734
654
|
*/
|
|
@@ -737,7 +657,6 @@ export class VobSubParser {
|
|
|
737
657
|
return ret;
|
|
738
658
|
}
|
|
739
659
|
/**
|
|
740
|
-
* Get the cue duration in milliseconds.
|
|
741
660
|
* @param {number} index
|
|
742
661
|
* @returns {number}
|
|
743
662
|
*/
|
|
@@ -746,7 +665,6 @@ export class VobSubParser {
|
|
|
746
665
|
return ret;
|
|
747
666
|
}
|
|
748
667
|
/**
|
|
749
|
-
* Get the cue end time in milliseconds.
|
|
750
668
|
* @param {number} index
|
|
751
669
|
* @returns {number}
|
|
752
670
|
*/
|
|
@@ -755,7 +673,6 @@ export class VobSubParser {
|
|
|
755
673
|
return ret;
|
|
756
674
|
}
|
|
757
675
|
/**
|
|
758
|
-
* Get the cue file position in the SUB file.
|
|
759
676
|
* @param {number} index
|
|
760
677
|
* @returns {number}
|
|
761
678
|
*/
|
|
@@ -764,7 +681,6 @@ export class VobSubParser {
|
|
|
764
681
|
return ret;
|
|
765
682
|
}
|
|
766
683
|
/**
|
|
767
|
-
* Get the cue start time in milliseconds.
|
|
768
684
|
* @param {number} index
|
|
769
685
|
* @returns {number}
|
|
770
686
|
*/
|
|
@@ -773,7 +689,6 @@ export class VobSubParser {
|
|
|
773
689
|
return ret;
|
|
774
690
|
}
|
|
775
691
|
/**
|
|
776
|
-
* Get all timestamps in milliseconds as a Float64Array.
|
|
777
692
|
* @returns {Float64Array}
|
|
778
693
|
*/
|
|
779
694
|
getTimestamps() {
|
|
@@ -781,7 +696,6 @@ export class VobSubParser {
|
|
|
781
696
|
return ret;
|
|
782
697
|
}
|
|
783
698
|
/**
|
|
784
|
-
* Check whether IDX metadata was used to load the parser.
|
|
785
699
|
* @returns {boolean}
|
|
786
700
|
*/
|
|
787
701
|
get hasIdxMetadata() {
|
|
@@ -789,7 +703,6 @@ export class VobSubParser {
|
|
|
789
703
|
return ret !== 0;
|
|
790
704
|
}
|
|
791
705
|
/**
|
|
792
|
-
* Get the declared language code from IDX metadata.
|
|
793
706
|
* @returns {string}
|
|
794
707
|
*/
|
|
795
708
|
get language() {
|
|
@@ -805,7 +718,6 @@ export class VobSubParser {
|
|
|
805
718
|
}
|
|
806
719
|
}
|
|
807
720
|
/**
|
|
808
|
-
* Get the last non-fatal render issue for diagnostics.
|
|
809
721
|
* @returns {string}
|
|
810
722
|
*/
|
|
811
723
|
get lastRenderIssue() {
|
|
@@ -821,7 +733,6 @@ export class VobSubParser {
|
|
|
821
733
|
}
|
|
822
734
|
}
|
|
823
735
|
/**
|
|
824
|
-
* Load VobSub from IDX content and SUB data.
|
|
825
736
|
* @param {string} idx_content
|
|
826
737
|
* @param {Uint8Array} sub_data
|
|
827
738
|
*/
|
|
@@ -833,7 +744,6 @@ export class VobSubParser {
|
|
|
833
744
|
wasm.vobsubparser_loadFromData(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
834
745
|
}
|
|
835
746
|
/**
|
|
836
|
-
* Load VobSub from a Matroska subtitle container with embedded S_VOBSUB tracks.
|
|
837
747
|
* @param {Uint8Array} mks_data
|
|
838
748
|
*/
|
|
839
749
|
loadFromMks(mks_data) {
|
|
@@ -845,7 +755,6 @@ export class VobSubParser {
|
|
|
845
755
|
}
|
|
846
756
|
}
|
|
847
757
|
/**
|
|
848
|
-
* Load VobSub from SUB file only (scans for timestamps).
|
|
849
758
|
* @param {Uint8Array} sub_data
|
|
850
759
|
*/
|
|
851
760
|
loadFromSubOnly(sub_data) {
|
|
@@ -853,17 +762,13 @@ export class VobSubParser {
|
|
|
853
762
|
const len0 = WASM_VECTOR_LEN;
|
|
854
763
|
wasm.vobsubparser_loadFromSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
855
764
|
}
|
|
856
|
-
/**
|
|
857
|
-
* Create a new VobSub parser.
|
|
858
|
-
*/
|
|
859
765
|
constructor() {
|
|
860
766
|
const ret = wasm.vobsubparser_new();
|
|
861
|
-
this.__wbg_ptr = ret
|
|
767
|
+
this.__wbg_ptr = ret;
|
|
862
768
|
VobSubParserFinalization.register(this, this.__wbg_ptr, this);
|
|
863
769
|
return this;
|
|
864
770
|
}
|
|
865
771
|
/**
|
|
866
|
-
* Render subtitle at the given index and return RGBA data.
|
|
867
772
|
* @param {number} index
|
|
868
773
|
* @returns {VobSubFrame | undefined}
|
|
869
774
|
*/
|
|
@@ -872,7 +777,6 @@ export class VobSubParser {
|
|
|
872
777
|
return ret === 0 ? undefined : VobSubFrame.__wrap(ret);
|
|
873
778
|
}
|
|
874
779
|
/**
|
|
875
|
-
* Get the presentation height for this subtitle track.
|
|
876
780
|
* @returns {number}
|
|
877
781
|
*/
|
|
878
782
|
get screenHeight() {
|
|
@@ -880,7 +784,6 @@ export class VobSubParser {
|
|
|
880
784
|
return ret;
|
|
881
785
|
}
|
|
882
786
|
/**
|
|
883
|
-
* Get the presentation width for this subtitle track.
|
|
884
787
|
* @returns {number}
|
|
885
788
|
*/
|
|
886
789
|
get screenWidth() {
|
|
@@ -888,28 +791,24 @@ export class VobSubParser {
|
|
|
888
791
|
return ret;
|
|
889
792
|
}
|
|
890
793
|
/**
|
|
891
|
-
* Enable or disable debanding.
|
|
892
794
|
* @param {boolean} enabled
|
|
893
795
|
*/
|
|
894
796
|
setDebandEnabled(enabled) {
|
|
895
797
|
wasm.vobsubparser_setDebandEnabled(this.__wbg_ptr, enabled);
|
|
896
798
|
}
|
|
897
799
|
/**
|
|
898
|
-
* Set the deband sample range in pixels (default: 15).
|
|
899
800
|
* @param {number} range
|
|
900
801
|
*/
|
|
901
802
|
setDebandRange(range) {
|
|
902
803
|
wasm.vobsubparser_setDebandRange(this.__wbg_ptr, range);
|
|
903
804
|
}
|
|
904
805
|
/**
|
|
905
|
-
* Set the deband threshold (0.0-255.0, default: 64.0).
|
|
906
806
|
* @param {number} threshold
|
|
907
807
|
*/
|
|
908
808
|
setDebandThreshold(threshold) {
|
|
909
809
|
wasm.vobsubparser_setDebandThreshold(this.__wbg_ptr, threshold);
|
|
910
810
|
}
|
|
911
811
|
/**
|
|
912
|
-
* Get the declared subtitle track ID from IDX metadata.
|
|
913
812
|
* @returns {string}
|
|
914
813
|
*/
|
|
915
814
|
get trackId() {
|
|
@@ -936,7 +835,7 @@ export function init() {
|
|
|
936
835
|
function __wbg_get_imports() {
|
|
937
836
|
const import0 = {
|
|
938
837
|
__proto__: null,
|
|
939
|
-
|
|
838
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
940
839
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
941
840
|
},
|
|
942
841
|
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
@@ -954,19 +853,19 @@ function __wbg_get_imports() {
|
|
|
954
853
|
const ret = new Error();
|
|
955
854
|
return ret;
|
|
956
855
|
},
|
|
957
|
-
|
|
856
|
+
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
958
857
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
959
858
|
return ret;
|
|
960
859
|
},
|
|
961
|
-
|
|
962
|
-
const ret = new
|
|
860
|
+
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
861
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
963
862
|
return ret;
|
|
964
863
|
},
|
|
965
|
-
|
|
966
|
-
const ret = new
|
|
864
|
+
__wbg_new_with_length_b4a87ccced374381: function(arg0) {
|
|
865
|
+
const ret = new Float64Array(arg0 >>> 0);
|
|
967
866
|
return ret;
|
|
968
867
|
},
|
|
969
|
-
|
|
868
|
+
__wbg_set_index_c69336ea758c0507: function(arg0, arg1, arg2) {
|
|
970
869
|
arg0[arg1 >>> 0] = arg2;
|
|
971
870
|
},
|
|
972
871
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
@@ -999,25 +898,25 @@ function __wbg_get_imports() {
|
|
|
999
898
|
|
|
1000
899
|
const PgsParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1001
900
|
? { register: () => {}, unregister: () => {} }
|
|
1002
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr
|
|
901
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr, 1));
|
|
1003
902
|
const RenderResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1004
903
|
? { register: () => {}, unregister: () => {} }
|
|
1005
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr
|
|
904
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr, 1));
|
|
1006
905
|
const SubtitleCompositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1007
906
|
? { register: () => {}, unregister: () => {} }
|
|
1008
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr
|
|
907
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr, 1));
|
|
1009
908
|
const SubtitleFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1010
909
|
? { register: () => {}, unregister: () => {} }
|
|
1011
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr
|
|
910
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr, 1));
|
|
1012
911
|
const SubtitleRendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1013
912
|
? { register: () => {}, unregister: () => {} }
|
|
1014
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr
|
|
913
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr, 1));
|
|
1015
914
|
const VobSubFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1016
915
|
? { register: () => {}, unregister: () => {} }
|
|
1017
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr
|
|
916
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr, 1));
|
|
1018
917
|
const VobSubParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1019
918
|
? { register: () => {}, unregister: () => {} }
|
|
1020
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr
|
|
919
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr, 1));
|
|
1021
920
|
|
|
1022
921
|
function getArrayU8FromWasm0(ptr, len) {
|
|
1023
922
|
ptr = ptr >>> 0;
|
|
@@ -1033,8 +932,7 @@ function getDataViewMemory0() {
|
|
|
1033
932
|
}
|
|
1034
933
|
|
|
1035
934
|
function getStringFromWasm0(ptr, len) {
|
|
1036
|
-
|
|
1037
|
-
return decodeText(ptr, len);
|
|
935
|
+
return decodeText(ptr >>> 0, len);
|
|
1038
936
|
}
|
|
1039
937
|
|
|
1040
938
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -1124,8 +1022,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
1124
1022
|
|
|
1125
1023
|
let WASM_VECTOR_LEN = 0;
|
|
1126
1024
|
|
|
1127
|
-
let wasmModule, wasm;
|
|
1025
|
+
let wasmModule, wasmInstance, wasm;
|
|
1128
1026
|
function __wbg_finalize_init(instance, module) {
|
|
1027
|
+
wasmInstance = instance;
|
|
1129
1028
|
wasm = instance.exports;
|
|
1130
1029
|
wasmModule = module;
|
|
1131
1030
|
cachedDataViewMemory0 = null;
|
package/pkg/libbitsub_bg.wasm
CHANGED
|
Binary file
|
|
@@ -4,6 +4,7 @@ export const memory: WebAssembly.Memory;
|
|
|
4
4
|
export const __wbg_pgsparser_free: (a: number, b: number) => void;
|
|
5
5
|
export const __wbg_renderresult_free: (a: number, b: number) => void;
|
|
6
6
|
export const __wbg_subtitlecomposition_free: (a: number, b: number) => void;
|
|
7
|
+
export const __wbg_subtitleframe_free: (a: number, b: number) => void;
|
|
7
8
|
export const __wbg_subtitlerenderer_free: (a: number, b: number) => void;
|
|
8
9
|
export const __wbg_vobsubframe_free: (a: number, b: number) => void;
|
|
9
10
|
export const __wbg_vobsubparser_free: (a: number, b: number) => void;
|
|
@@ -36,7 +37,10 @@ export const subtitlecomposition_height: (a: number) => number;
|
|
|
36
37
|
export const subtitlecomposition_width: (a: number) => number;
|
|
37
38
|
export const subtitlecomposition_x: (a: number) => number;
|
|
38
39
|
export const subtitlecomposition_y: (a: number) => number;
|
|
40
|
+
export const subtitleframe_compositionCount: (a: number) => number;
|
|
39
41
|
export const subtitleframe_getComposition: (a: number, b: number) => number;
|
|
42
|
+
export const subtitleframe_height: (a: number) => number;
|
|
43
|
+
export const subtitleframe_width: (a: number) => number;
|
|
40
44
|
export const subtitlerenderer_clearCache: (a: number) => void;
|
|
41
45
|
export const subtitlerenderer_count: (a: number) => number;
|
|
42
46
|
export const subtitlerenderer_dispose: (a: number) => void;
|
|
@@ -90,10 +94,6 @@ export const vobsubparser_setDebandEnabled: (a: number, b: number) => void;
|
|
|
90
94
|
export const vobsubparser_setDebandRange: (a: number, b: number) => void;
|
|
91
95
|
export const vobsubparser_setDebandThreshold: (a: number, b: number) => void;
|
|
92
96
|
export const vobsubparser_trackId: (a: number) => [number, number];
|
|
93
|
-
export const __wbg_subtitleframe_free: (a: number, b: number) => void;
|
|
94
|
-
export const subtitleframe_compositionCount: (a: number) => number;
|
|
95
|
-
export const subtitleframe_width: (a: number) => number;
|
|
96
|
-
export const subtitleframe_height: (a: number) => number;
|
|
97
97
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
98
98
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
99
99
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
package/pkg/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"altqx"
|
|
6
6
|
],
|
|
7
7
|
"description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
|
|
8
|
-
"version": "1.10.
|
|
8
|
+
"version": "1.10.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
"wasm",
|
|
29
29
|
"rendering"
|
|
30
30
|
]
|
|
31
|
-
}
|
|
31
|
+
}
|