libbitsub 1.9.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 +192 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/ts/diagnostics.d.ts +35 -0
- package/dist/ts/diagnostics.d.ts.map +1 -0
- package/dist/ts/diagnostics.js +102 -0
- package/dist/ts/diagnostics.js.map +1 -0
- package/dist/ts/frame-export.d.ts +6 -0
- package/dist/ts/frame-export.d.ts.map +1 -0
- package/dist/ts/frame-export.js +235 -0
- package/dist/ts/frame-export.js.map +1 -0
- package/dist/ts/parsers.d.ts +44 -4
- package/dist/ts/parsers.d.ts.map +1 -1
- package/dist/ts/parsers.js +269 -56
- package/dist/ts/parsers.js.map +1 -1
- package/dist/ts/renderers.d.ts +21 -2
- package/dist/ts/renderers.d.ts.map +1 -1
- package/dist/ts/renderers.js +150 -27
- package/dist/ts/renderers.js.map +1 -1
- package/dist/ts/types.d.ts +110 -1
- package/dist/ts/types.d.ts.map +1 -1
- package/dist/ts/utils.d.ts +1 -1
- package/dist/ts/utils.d.ts.map +1 -1
- package/dist/ts/utils.js +8 -1
- package/dist/ts/utils.js.map +1 -1
- package/dist/ts/worker.d.ts.map +1 -1
- package/dist/ts/worker.js +6 -4
- package/dist/ts/worker.js.map +1 -1
- package/dist/wrapper.d.ts +4 -2
- package/dist/wrapper.d.ts.map +1 -1
- package/dist/wrapper.js +4 -1
- package/dist/wrapper.js.map +1 -1
- package/package.json +9 -5
- package/pkg/README.md +192 -8
- package/pkg/libbitsub.d.ts +12 -220
- package/pkg/libbitsub.js +65 -118
- package/pkg/libbitsub_bg.wasm +0 -0
- package/pkg/libbitsub_bg.wasm.d.ts +7 -4
- package/pkg/package.json +2 -2
- package/src/wrapper.ts +20 -1
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,17 +80,27 @@ export class PgsParser {
|
|
|
91
80
|
return ret;
|
|
92
81
|
}
|
|
93
82
|
/**
|
|
94
|
-
*
|
|
83
|
+
* @returns {string}
|
|
95
84
|
*/
|
|
85
|
+
get lastRenderIssue() {
|
|
86
|
+
let deferred1_0;
|
|
87
|
+
let deferred1_1;
|
|
88
|
+
try {
|
|
89
|
+
const ret = wasm.pgsparser_lastRenderIssue(this.__wbg_ptr);
|
|
90
|
+
deferred1_0 = ret[0];
|
|
91
|
+
deferred1_1 = ret[1];
|
|
92
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
93
|
+
} finally {
|
|
94
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
96
97
|
constructor() {
|
|
97
98
|
const ret = wasm.pgsparser_new();
|
|
98
|
-
this.__wbg_ptr = ret
|
|
99
|
+
this.__wbg_ptr = ret;
|
|
99
100
|
PgsParserFinalization.register(this, this.__wbg_ptr, this);
|
|
100
101
|
return this;
|
|
101
102
|
}
|
|
102
103
|
/**
|
|
103
|
-
* Parse a PGS file from binary data.
|
|
104
|
-
* Returns the number of display sets parsed.
|
|
105
104
|
* @param {Uint8Array} data
|
|
106
105
|
* @returns {number}
|
|
107
106
|
*/
|
|
@@ -112,8 +111,6 @@ export class PgsParser {
|
|
|
112
111
|
return ret >>> 0;
|
|
113
112
|
}
|
|
114
113
|
/**
|
|
115
|
-
* Render subtitle at the given index and return RGBA data.
|
|
116
|
-
* Returns null if index is invalid or no subtitle data.
|
|
117
114
|
* @param {number} index
|
|
118
115
|
* @returns {SubtitleFrame | undefined}
|
|
119
116
|
*/
|
|
@@ -122,7 +119,6 @@ export class PgsParser {
|
|
|
122
119
|
return ret === 0 ? undefined : SubtitleFrame.__wrap(ret);
|
|
123
120
|
}
|
|
124
121
|
/**
|
|
125
|
-
* Get the presentation height for this subtitle track.
|
|
126
122
|
* @returns {number}
|
|
127
123
|
*/
|
|
128
124
|
get screenHeight() {
|
|
@@ -130,7 +126,6 @@ export class PgsParser {
|
|
|
130
126
|
return ret;
|
|
131
127
|
}
|
|
132
128
|
/**
|
|
133
|
-
* Get the presentation width for this subtitle track.
|
|
134
129
|
* @returns {number}
|
|
135
130
|
*/
|
|
136
131
|
get screenWidth() {
|
|
@@ -145,7 +140,6 @@ if (Symbol.dispose) PgsParser.prototype[Symbol.dispose] = PgsParser.prototype.fr
|
|
|
145
140
|
*/
|
|
146
141
|
export class RenderResult {
|
|
147
142
|
static __wrap(ptr) {
|
|
148
|
-
ptr = ptr >>> 0;
|
|
149
143
|
const obj = Object.create(RenderResult.prototype);
|
|
150
144
|
obj.__wbg_ptr = ptr;
|
|
151
145
|
RenderResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -162,7 +156,6 @@ export class RenderResult {
|
|
|
162
156
|
wasm.__wbg_renderresult_free(ptr, 0);
|
|
163
157
|
}
|
|
164
158
|
/**
|
|
165
|
-
* Get the number of composition elements.
|
|
166
159
|
* @returns {number}
|
|
167
160
|
*/
|
|
168
161
|
get compositionCount() {
|
|
@@ -170,7 +163,6 @@ export class RenderResult {
|
|
|
170
163
|
return ret >>> 0;
|
|
171
164
|
}
|
|
172
165
|
/**
|
|
173
|
-
* Get composition height at index.
|
|
174
166
|
* @param {number} index
|
|
175
167
|
* @returns {number}
|
|
176
168
|
*/
|
|
@@ -179,7 +171,6 @@ export class RenderResult {
|
|
|
179
171
|
return ret;
|
|
180
172
|
}
|
|
181
173
|
/**
|
|
182
|
-
* Get composition RGBA data at index.
|
|
183
174
|
* @param {number} index
|
|
184
175
|
* @returns {Uint8Array}
|
|
185
176
|
*/
|
|
@@ -188,7 +179,6 @@ export class RenderResult {
|
|
|
188
179
|
return ret;
|
|
189
180
|
}
|
|
190
181
|
/**
|
|
191
|
-
* Get composition width at index.
|
|
192
182
|
* @param {number} index
|
|
193
183
|
* @returns {number}
|
|
194
184
|
*/
|
|
@@ -197,7 +187,6 @@ export class RenderResult {
|
|
|
197
187
|
return ret;
|
|
198
188
|
}
|
|
199
189
|
/**
|
|
200
|
-
* Get composition X position at index.
|
|
201
190
|
* @param {number} index
|
|
202
191
|
* @returns {number}
|
|
203
192
|
*/
|
|
@@ -206,7 +195,6 @@ export class RenderResult {
|
|
|
206
195
|
return ret;
|
|
207
196
|
}
|
|
208
197
|
/**
|
|
209
|
-
* Get composition Y position at index.
|
|
210
198
|
* @param {number} index
|
|
211
199
|
* @returns {number}
|
|
212
200
|
*/
|
|
@@ -232,11 +220,10 @@ export class RenderResult {
|
|
|
232
220
|
if (Symbol.dispose) RenderResult.prototype[Symbol.dispose] = RenderResult.prototype.free;
|
|
233
221
|
|
|
234
222
|
/**
|
|
235
|
-
* A single subtitle composition element.
|
|
223
|
+
* A single PGS subtitle composition element.
|
|
236
224
|
*/
|
|
237
225
|
export class SubtitleComposition {
|
|
238
226
|
static __wrap(ptr) {
|
|
239
|
-
ptr = ptr >>> 0;
|
|
240
227
|
const obj = Object.create(SubtitleComposition.prototype);
|
|
241
228
|
obj.__wbg_ptr = ptr;
|
|
242
229
|
SubtitleCompositionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -253,7 +240,6 @@ export class SubtitleComposition {
|
|
|
253
240
|
wasm.__wbg_subtitlecomposition_free(ptr, 0);
|
|
254
241
|
}
|
|
255
242
|
/**
|
|
256
|
-
* Get RGBA pixel data as Uint8Array.
|
|
257
243
|
* @returns {Uint8Array}
|
|
258
244
|
*/
|
|
259
245
|
getRgba() {
|
|
@@ -296,22 +282,15 @@ if (Symbol.dispose) SubtitleComposition.prototype[Symbol.dispose] = SubtitleComp
|
|
|
296
282
|
* @enum {0 | 1}
|
|
297
283
|
*/
|
|
298
284
|
export const SubtitleFormat = Object.freeze({
|
|
299
|
-
/**
|
|
300
|
-
* PGS (Blu-ray) subtitle format
|
|
301
|
-
*/
|
|
302
285
|
Pgs: 0, "0": "Pgs",
|
|
303
|
-
/**
|
|
304
|
-
* VobSub (DVD) subtitle format
|
|
305
|
-
*/
|
|
306
286
|
VobSub: 1, "1": "VobSub",
|
|
307
287
|
});
|
|
308
288
|
|
|
309
289
|
/**
|
|
310
|
-
* A complete subtitle frame with all compositions.
|
|
290
|
+
* A complete PGS subtitle frame with all compositions.
|
|
311
291
|
*/
|
|
312
292
|
export class SubtitleFrame {
|
|
313
293
|
static __wrap(ptr) {
|
|
314
|
-
ptr = ptr >>> 0;
|
|
315
294
|
const obj = Object.create(SubtitleFrame.prototype);
|
|
316
295
|
obj.__wbg_ptr = ptr;
|
|
317
296
|
SubtitleFrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -328,7 +307,6 @@ export class SubtitleFrame {
|
|
|
328
307
|
wasm.__wbg_subtitleframe_free(ptr, 0);
|
|
329
308
|
}
|
|
330
309
|
/**
|
|
331
|
-
* Get the number of compositions.
|
|
332
310
|
* @returns {number}
|
|
333
311
|
*/
|
|
334
312
|
get compositionCount() {
|
|
@@ -336,7 +314,6 @@ export class SubtitleFrame {
|
|
|
336
314
|
return ret >>> 0;
|
|
337
315
|
}
|
|
338
316
|
/**
|
|
339
|
-
* Get a composition by index.
|
|
340
317
|
* @param {number} index
|
|
341
318
|
* @returns {SubtitleComposition | undefined}
|
|
342
319
|
*/
|
|
@@ -375,28 +352,20 @@ export class SubtitleRenderer {
|
|
|
375
352
|
const ptr = this.__destroy_into_raw();
|
|
376
353
|
wasm.__wbg_subtitlerenderer_free(ptr, 0);
|
|
377
354
|
}
|
|
378
|
-
/**
|
|
379
|
-
* Clear internal caches.
|
|
380
|
-
*/
|
|
381
355
|
clearCache() {
|
|
382
356
|
wasm.subtitlerenderer_clearCache(this.__wbg_ptr);
|
|
383
357
|
}
|
|
384
358
|
/**
|
|
385
|
-
* Get the number of subtitle entries.
|
|
386
359
|
* @returns {number}
|
|
387
360
|
*/
|
|
388
361
|
get count() {
|
|
389
362
|
const ret = wasm.subtitlerenderer_count(this.__wbg_ptr);
|
|
390
363
|
return ret >>> 0;
|
|
391
364
|
}
|
|
392
|
-
/**
|
|
393
|
-
* Dispose of all resources.
|
|
394
|
-
*/
|
|
395
365
|
dispose() {
|
|
396
366
|
wasm.subtitlerenderer_dispose(this.__wbg_ptr);
|
|
397
367
|
}
|
|
398
368
|
/**
|
|
399
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
400
369
|
* @param {number} time_ms
|
|
401
370
|
* @returns {number}
|
|
402
371
|
*/
|
|
@@ -405,7 +374,6 @@ export class SubtitleRenderer {
|
|
|
405
374
|
return ret;
|
|
406
375
|
}
|
|
407
376
|
/**
|
|
408
|
-
* Get the current subtitle format.
|
|
409
377
|
* @returns {SubtitleFormat | undefined}
|
|
410
378
|
*/
|
|
411
379
|
get format() {
|
|
@@ -413,7 +381,6 @@ export class SubtitleRenderer {
|
|
|
413
381
|
return ret === 2 ? undefined : ret;
|
|
414
382
|
}
|
|
415
383
|
/**
|
|
416
|
-
* Get the cue duration in milliseconds.
|
|
417
384
|
* @param {number} index
|
|
418
385
|
* @returns {number}
|
|
419
386
|
*/
|
|
@@ -422,7 +389,6 @@ export class SubtitleRenderer {
|
|
|
422
389
|
return ret;
|
|
423
390
|
}
|
|
424
391
|
/**
|
|
425
|
-
* Get the cue end time in milliseconds.
|
|
426
392
|
* @param {number} index
|
|
427
393
|
* @returns {number}
|
|
428
394
|
*/
|
|
@@ -431,7 +397,6 @@ export class SubtitleRenderer {
|
|
|
431
397
|
return ret;
|
|
432
398
|
}
|
|
433
399
|
/**
|
|
434
|
-
* Get the cue start time in milliseconds.
|
|
435
400
|
* @param {number} index
|
|
436
401
|
* @returns {number}
|
|
437
402
|
*/
|
|
@@ -440,7 +405,6 @@ export class SubtitleRenderer {
|
|
|
440
405
|
return ret;
|
|
441
406
|
}
|
|
442
407
|
/**
|
|
443
|
-
* Get all timestamps in milliseconds.
|
|
444
408
|
* @returns {Float64Array}
|
|
445
409
|
*/
|
|
446
410
|
getTimestamps() {
|
|
@@ -448,7 +412,6 @@ export class SubtitleRenderer {
|
|
|
448
412
|
return ret;
|
|
449
413
|
}
|
|
450
414
|
/**
|
|
451
|
-
* Check whether IDX metadata was used for VobSub.
|
|
452
415
|
* @returns {boolean}
|
|
453
416
|
*/
|
|
454
417
|
get hasIdxMetadata() {
|
|
@@ -456,7 +419,6 @@ export class SubtitleRenderer {
|
|
|
456
419
|
return ret !== 0;
|
|
457
420
|
}
|
|
458
421
|
/**
|
|
459
|
-
* Get the VobSub language code if available.
|
|
460
422
|
* @returns {string}
|
|
461
423
|
*/
|
|
462
424
|
get language() {
|
|
@@ -472,7 +434,21 @@ export class SubtitleRenderer {
|
|
|
472
434
|
}
|
|
473
435
|
}
|
|
474
436
|
/**
|
|
475
|
-
*
|
|
437
|
+
* @returns {string}
|
|
438
|
+
*/
|
|
439
|
+
get lastRenderIssue() {
|
|
440
|
+
let deferred1_0;
|
|
441
|
+
let deferred1_1;
|
|
442
|
+
try {
|
|
443
|
+
const ret = wasm.subtitlerenderer_lastRenderIssue(this.__wbg_ptr);
|
|
444
|
+
deferred1_0 = ret[0];
|
|
445
|
+
deferred1_1 = ret[1];
|
|
446
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
447
|
+
} finally {
|
|
448
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
476
452
|
* @param {Uint8Array} data
|
|
477
453
|
* @returns {number}
|
|
478
454
|
*/
|
|
@@ -483,7 +459,6 @@ export class SubtitleRenderer {
|
|
|
483
459
|
return ret >>> 0;
|
|
484
460
|
}
|
|
485
461
|
/**
|
|
486
|
-
* Load VobSub subtitle data from IDX and SUB.
|
|
487
462
|
* @param {string} idx_content
|
|
488
463
|
* @param {Uint8Array} sub_data
|
|
489
464
|
*/
|
|
@@ -495,7 +470,6 @@ export class SubtitleRenderer {
|
|
|
495
470
|
wasm.subtitlerenderer_loadVobSub(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
496
471
|
}
|
|
497
472
|
/**
|
|
498
|
-
* Load VobSub subtitle data from a Matroska subtitle container.
|
|
499
473
|
* @param {Uint8Array} mks_data
|
|
500
474
|
*/
|
|
501
475
|
loadVobSubMks(mks_data) {
|
|
@@ -507,7 +481,6 @@ export class SubtitleRenderer {
|
|
|
507
481
|
}
|
|
508
482
|
}
|
|
509
483
|
/**
|
|
510
|
-
* Load VobSub from SUB file only.
|
|
511
484
|
* @param {Uint8Array} sub_data
|
|
512
485
|
*/
|
|
513
486
|
loadVobSubOnly(sub_data) {
|
|
@@ -515,18 +488,13 @@ export class SubtitleRenderer {
|
|
|
515
488
|
const len0 = WASM_VECTOR_LEN;
|
|
516
489
|
wasm.subtitlerenderer_loadVobSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
517
490
|
}
|
|
518
|
-
/**
|
|
519
|
-
* Create a new subtitle renderer.
|
|
520
|
-
*/
|
|
521
491
|
constructor() {
|
|
522
492
|
const ret = wasm.subtitlerenderer_new();
|
|
523
|
-
this.__wbg_ptr = ret
|
|
493
|
+
this.__wbg_ptr = ret;
|
|
524
494
|
SubtitleRendererFinalization.register(this, this.__wbg_ptr, this);
|
|
525
495
|
return this;
|
|
526
496
|
}
|
|
527
497
|
/**
|
|
528
|
-
* Render subtitle at the given index.
|
|
529
|
-
* Returns a unified RenderResult or null.
|
|
530
498
|
* @param {number} index
|
|
531
499
|
* @returns {RenderResult | undefined}
|
|
532
500
|
*/
|
|
@@ -535,7 +503,6 @@ export class SubtitleRenderer {
|
|
|
535
503
|
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
536
504
|
}
|
|
537
505
|
/**
|
|
538
|
-
* Render subtitle at the given timestamp in seconds.
|
|
539
506
|
* @param {number} time_seconds
|
|
540
507
|
* @returns {RenderResult | undefined}
|
|
541
508
|
*/
|
|
@@ -544,7 +511,6 @@ export class SubtitleRenderer {
|
|
|
544
511
|
return ret === 0 ? undefined : RenderResult.__wrap(ret);
|
|
545
512
|
}
|
|
546
513
|
/**
|
|
547
|
-
* Get the presentation height for the loaded subtitle track.
|
|
548
514
|
* @returns {number}
|
|
549
515
|
*/
|
|
550
516
|
get screenHeight() {
|
|
@@ -552,7 +518,6 @@ export class SubtitleRenderer {
|
|
|
552
518
|
return ret;
|
|
553
519
|
}
|
|
554
520
|
/**
|
|
555
|
-
* Get the presentation width for the loaded subtitle track.
|
|
556
521
|
* @returns {number}
|
|
557
522
|
*/
|
|
558
523
|
get screenWidth() {
|
|
@@ -560,7 +525,6 @@ export class SubtitleRenderer {
|
|
|
560
525
|
return ret;
|
|
561
526
|
}
|
|
562
527
|
/**
|
|
563
|
-
* Get the VobSub track ID if available.
|
|
564
528
|
* @returns {string}
|
|
565
529
|
*/
|
|
566
530
|
get trackId() {
|
|
@@ -583,7 +547,6 @@ if (Symbol.dispose) SubtitleRenderer.prototype[Symbol.dispose] = SubtitleRendere
|
|
|
583
547
|
*/
|
|
584
548
|
export class VobSubFrame {
|
|
585
549
|
static __wrap(ptr) {
|
|
586
|
-
ptr = ptr >>> 0;
|
|
587
550
|
const obj = Object.create(VobSubFrame.prototype);
|
|
588
551
|
obj.__wbg_ptr = ptr;
|
|
589
552
|
VobSubFrameFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
@@ -600,7 +563,6 @@ export class VobSubFrame {
|
|
|
600
563
|
wasm.__wbg_vobsubframe_free(ptr, 0);
|
|
601
564
|
}
|
|
602
565
|
/**
|
|
603
|
-
* Get RGBA pixel data as Uint8Array.
|
|
604
566
|
* @returns {Uint8Array}
|
|
605
567
|
*/
|
|
606
568
|
getRgba() {
|
|
@@ -666,14 +628,10 @@ export class VobSubParser {
|
|
|
666
628
|
const ptr = this.__destroy_into_raw();
|
|
667
629
|
wasm.__wbg_vobsubparser_free(ptr, 0);
|
|
668
630
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Clear the internal cache.
|
|
671
|
-
*/
|
|
672
631
|
clearCache() {
|
|
673
632
|
wasm.vobsubparser_clearCache(this.__wbg_ptr);
|
|
674
633
|
}
|
|
675
634
|
/**
|
|
676
|
-
* Get the number of subtitle entries.
|
|
677
635
|
* @returns {number}
|
|
678
636
|
*/
|
|
679
637
|
get count() {
|
|
@@ -681,22 +639,16 @@ export class VobSubParser {
|
|
|
681
639
|
return ret >>> 0;
|
|
682
640
|
}
|
|
683
641
|
/**
|
|
684
|
-
* Check if debanding is enabled.
|
|
685
642
|
* @returns {boolean}
|
|
686
643
|
*/
|
|
687
644
|
get debandEnabled() {
|
|
688
645
|
const ret = wasm.vobsubparser_debandEnabled(this.__wbg_ptr);
|
|
689
646
|
return ret !== 0;
|
|
690
647
|
}
|
|
691
|
-
/**
|
|
692
|
-
* Dispose of all resources.
|
|
693
|
-
*/
|
|
694
648
|
dispose() {
|
|
695
649
|
wasm.vobsubparser_dispose(this.__wbg_ptr);
|
|
696
650
|
}
|
|
697
651
|
/**
|
|
698
|
-
* Find the subtitle index for a given timestamp in milliseconds.
|
|
699
|
-
* Returns -1 if no subtitle should be displayed at this time.
|
|
700
652
|
* @param {number} time_ms
|
|
701
653
|
* @returns {number}
|
|
702
654
|
*/
|
|
@@ -705,7 +657,6 @@ export class VobSubParser {
|
|
|
705
657
|
return ret;
|
|
706
658
|
}
|
|
707
659
|
/**
|
|
708
|
-
* Get the cue duration in milliseconds.
|
|
709
660
|
* @param {number} index
|
|
710
661
|
* @returns {number}
|
|
711
662
|
*/
|
|
@@ -714,7 +665,6 @@ export class VobSubParser {
|
|
|
714
665
|
return ret;
|
|
715
666
|
}
|
|
716
667
|
/**
|
|
717
|
-
* Get the cue end time in milliseconds.
|
|
718
668
|
* @param {number} index
|
|
719
669
|
* @returns {number}
|
|
720
670
|
*/
|
|
@@ -723,7 +673,6 @@ export class VobSubParser {
|
|
|
723
673
|
return ret;
|
|
724
674
|
}
|
|
725
675
|
/**
|
|
726
|
-
* Get the cue file position in the SUB file.
|
|
727
676
|
* @param {number} index
|
|
728
677
|
* @returns {number}
|
|
729
678
|
*/
|
|
@@ -732,7 +681,6 @@ export class VobSubParser {
|
|
|
732
681
|
return ret;
|
|
733
682
|
}
|
|
734
683
|
/**
|
|
735
|
-
* Get the cue start time in milliseconds.
|
|
736
684
|
* @param {number} index
|
|
737
685
|
* @returns {number}
|
|
738
686
|
*/
|
|
@@ -741,7 +689,6 @@ export class VobSubParser {
|
|
|
741
689
|
return ret;
|
|
742
690
|
}
|
|
743
691
|
/**
|
|
744
|
-
* Get all timestamps in milliseconds as a Float64Array.
|
|
745
692
|
* @returns {Float64Array}
|
|
746
693
|
*/
|
|
747
694
|
getTimestamps() {
|
|
@@ -749,7 +696,6 @@ export class VobSubParser {
|
|
|
749
696
|
return ret;
|
|
750
697
|
}
|
|
751
698
|
/**
|
|
752
|
-
* Check whether IDX metadata was used to load the parser.
|
|
753
699
|
* @returns {boolean}
|
|
754
700
|
*/
|
|
755
701
|
get hasIdxMetadata() {
|
|
@@ -757,7 +703,6 @@ export class VobSubParser {
|
|
|
757
703
|
return ret !== 0;
|
|
758
704
|
}
|
|
759
705
|
/**
|
|
760
|
-
* Get the declared language code from IDX metadata.
|
|
761
706
|
* @returns {string}
|
|
762
707
|
*/
|
|
763
708
|
get language() {
|
|
@@ -773,7 +718,21 @@ export class VobSubParser {
|
|
|
773
718
|
}
|
|
774
719
|
}
|
|
775
720
|
/**
|
|
776
|
-
*
|
|
721
|
+
* @returns {string}
|
|
722
|
+
*/
|
|
723
|
+
get lastRenderIssue() {
|
|
724
|
+
let deferred1_0;
|
|
725
|
+
let deferred1_1;
|
|
726
|
+
try {
|
|
727
|
+
const ret = wasm.vobsubparser_lastRenderIssue(this.__wbg_ptr);
|
|
728
|
+
deferred1_0 = ret[0];
|
|
729
|
+
deferred1_1 = ret[1];
|
|
730
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
731
|
+
} finally {
|
|
732
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
777
736
|
* @param {string} idx_content
|
|
778
737
|
* @param {Uint8Array} sub_data
|
|
779
738
|
*/
|
|
@@ -785,7 +744,6 @@ export class VobSubParser {
|
|
|
785
744
|
wasm.vobsubparser_loadFromData(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
786
745
|
}
|
|
787
746
|
/**
|
|
788
|
-
* Load VobSub from a Matroska subtitle container with embedded S_VOBSUB tracks.
|
|
789
747
|
* @param {Uint8Array} mks_data
|
|
790
748
|
*/
|
|
791
749
|
loadFromMks(mks_data) {
|
|
@@ -797,7 +755,6 @@ export class VobSubParser {
|
|
|
797
755
|
}
|
|
798
756
|
}
|
|
799
757
|
/**
|
|
800
|
-
* Load VobSub from SUB file only (scans for timestamps).
|
|
801
758
|
* @param {Uint8Array} sub_data
|
|
802
759
|
*/
|
|
803
760
|
loadFromSubOnly(sub_data) {
|
|
@@ -805,17 +762,13 @@ export class VobSubParser {
|
|
|
805
762
|
const len0 = WASM_VECTOR_LEN;
|
|
806
763
|
wasm.vobsubparser_loadFromSubOnly(this.__wbg_ptr, ptr0, len0);
|
|
807
764
|
}
|
|
808
|
-
/**
|
|
809
|
-
* Create a new VobSub parser.
|
|
810
|
-
*/
|
|
811
765
|
constructor() {
|
|
812
766
|
const ret = wasm.vobsubparser_new();
|
|
813
|
-
this.__wbg_ptr = ret
|
|
767
|
+
this.__wbg_ptr = ret;
|
|
814
768
|
VobSubParserFinalization.register(this, this.__wbg_ptr, this);
|
|
815
769
|
return this;
|
|
816
770
|
}
|
|
817
771
|
/**
|
|
818
|
-
* Render subtitle at the given index and return RGBA data.
|
|
819
772
|
* @param {number} index
|
|
820
773
|
* @returns {VobSubFrame | undefined}
|
|
821
774
|
*/
|
|
@@ -824,7 +777,6 @@ export class VobSubParser {
|
|
|
824
777
|
return ret === 0 ? undefined : VobSubFrame.__wrap(ret);
|
|
825
778
|
}
|
|
826
779
|
/**
|
|
827
|
-
* Get the presentation height for this subtitle track.
|
|
828
780
|
* @returns {number}
|
|
829
781
|
*/
|
|
830
782
|
get screenHeight() {
|
|
@@ -832,7 +784,6 @@ export class VobSubParser {
|
|
|
832
784
|
return ret;
|
|
833
785
|
}
|
|
834
786
|
/**
|
|
835
|
-
* Get the presentation width for this subtitle track.
|
|
836
787
|
* @returns {number}
|
|
837
788
|
*/
|
|
838
789
|
get screenWidth() {
|
|
@@ -840,28 +791,24 @@ export class VobSubParser {
|
|
|
840
791
|
return ret;
|
|
841
792
|
}
|
|
842
793
|
/**
|
|
843
|
-
* Enable or disable debanding.
|
|
844
794
|
* @param {boolean} enabled
|
|
845
795
|
*/
|
|
846
796
|
setDebandEnabled(enabled) {
|
|
847
797
|
wasm.vobsubparser_setDebandEnabled(this.__wbg_ptr, enabled);
|
|
848
798
|
}
|
|
849
799
|
/**
|
|
850
|
-
* Set the deband sample range in pixels (default: 15).
|
|
851
800
|
* @param {number} range
|
|
852
801
|
*/
|
|
853
802
|
setDebandRange(range) {
|
|
854
803
|
wasm.vobsubparser_setDebandRange(this.__wbg_ptr, range);
|
|
855
804
|
}
|
|
856
805
|
/**
|
|
857
|
-
* Set the deband threshold (0.0-255.0, default: 64.0).
|
|
858
806
|
* @param {number} threshold
|
|
859
807
|
*/
|
|
860
808
|
setDebandThreshold(threshold) {
|
|
861
809
|
wasm.vobsubparser_setDebandThreshold(this.__wbg_ptr, threshold);
|
|
862
810
|
}
|
|
863
811
|
/**
|
|
864
|
-
* Get the declared subtitle track ID from IDX metadata.
|
|
865
812
|
* @returns {string}
|
|
866
813
|
*/
|
|
867
814
|
get trackId() {
|
|
@@ -888,7 +835,7 @@ export function init() {
|
|
|
888
835
|
function __wbg_get_imports() {
|
|
889
836
|
const import0 = {
|
|
890
837
|
__proto__: null,
|
|
891
|
-
|
|
838
|
+
__wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
|
|
892
839
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
893
840
|
},
|
|
894
841
|
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
@@ -906,19 +853,19 @@ function __wbg_get_imports() {
|
|
|
906
853
|
const ret = new Error();
|
|
907
854
|
return ret;
|
|
908
855
|
},
|
|
909
|
-
|
|
856
|
+
__wbg_new_from_slice_18fa1f71286d66b8: function(arg0, arg1) {
|
|
910
857
|
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
911
858
|
return ret;
|
|
912
859
|
},
|
|
913
|
-
|
|
914
|
-
const ret = new
|
|
860
|
+
__wbg_new_with_length_36a4998e27b014c5: function(arg0) {
|
|
861
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
915
862
|
return ret;
|
|
916
863
|
},
|
|
917
|
-
|
|
918
|
-
const ret = new
|
|
864
|
+
__wbg_new_with_length_b4a87ccced374381: function(arg0) {
|
|
865
|
+
const ret = new Float64Array(arg0 >>> 0);
|
|
919
866
|
return ret;
|
|
920
867
|
},
|
|
921
|
-
|
|
868
|
+
__wbg_set_index_c69336ea758c0507: function(arg0, arg1, arg2) {
|
|
922
869
|
arg0[arg1 >>> 0] = arg2;
|
|
923
870
|
},
|
|
924
871
|
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
@@ -951,25 +898,25 @@ function __wbg_get_imports() {
|
|
|
951
898
|
|
|
952
899
|
const PgsParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
953
900
|
? { register: () => {}, unregister: () => {} }
|
|
954
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr
|
|
901
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pgsparser_free(ptr, 1));
|
|
955
902
|
const RenderResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
956
903
|
? { register: () => {}, unregister: () => {} }
|
|
957
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr
|
|
904
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_renderresult_free(ptr, 1));
|
|
958
905
|
const SubtitleCompositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
959
906
|
? { register: () => {}, unregister: () => {} }
|
|
960
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr
|
|
907
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlecomposition_free(ptr, 1));
|
|
961
908
|
const SubtitleFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
962
909
|
? { register: () => {}, unregister: () => {} }
|
|
963
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr
|
|
910
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitleframe_free(ptr, 1));
|
|
964
911
|
const SubtitleRendererFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
965
912
|
? { register: () => {}, unregister: () => {} }
|
|
966
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr
|
|
913
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_subtitlerenderer_free(ptr, 1));
|
|
967
914
|
const VobSubFrameFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
968
915
|
? { register: () => {}, unregister: () => {} }
|
|
969
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr
|
|
916
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubframe_free(ptr, 1));
|
|
970
917
|
const VobSubParserFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
971
918
|
? { register: () => {}, unregister: () => {} }
|
|
972
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr
|
|
919
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_vobsubparser_free(ptr, 1));
|
|
973
920
|
|
|
974
921
|
function getArrayU8FromWasm0(ptr, len) {
|
|
975
922
|
ptr = ptr >>> 0;
|
|
@@ -985,8 +932,7 @@ function getDataViewMemory0() {
|
|
|
985
932
|
}
|
|
986
933
|
|
|
987
934
|
function getStringFromWasm0(ptr, len) {
|
|
988
|
-
|
|
989
|
-
return decodeText(ptr, len);
|
|
935
|
+
return decodeText(ptr >>> 0, len);
|
|
990
936
|
}
|
|
991
937
|
|
|
992
938
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -1076,8 +1022,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
1076
1022
|
|
|
1077
1023
|
let WASM_VECTOR_LEN = 0;
|
|
1078
1024
|
|
|
1079
|
-
let wasmModule, wasm;
|
|
1025
|
+
let wasmModule, wasmInstance, wasm;
|
|
1080
1026
|
function __wbg_finalize_init(instance, module) {
|
|
1027
|
+
wasmInstance = instance;
|
|
1081
1028
|
wasm = instance.exports;
|
|
1082
1029
|
wasmModule = module;
|
|
1083
1030
|
cachedDataViewMemory0 = null;
|
package/pkg/libbitsub_bg.wasm
CHANGED
|
Binary file
|