libbitsub 1.5.0 → 1.6.0

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.
@@ -241,7 +241,9 @@ export class WebGPURenderer {
241
241
  texture,
242
242
  view: texture.createView(),
243
243
  width,
244
- height
244
+ height,
245
+ sourceData: null,
246
+ bindGroup: null
245
247
  };
246
248
  }
247
249
  /**
@@ -282,36 +284,38 @@ export class WebGPURenderer {
282
284
  if (width <= 0 || height <= 0)
283
285
  continue;
284
286
  let texInfo = this.textures[i];
285
- // Recreate texture if size changed
287
+ // Recreate texture if size changed; clear cached bind group and source reference
286
288
  if (texInfo.width !== width || texInfo.height !== height) {
287
289
  this.pendingDestroyTextures.push(texInfo.texture);
288
290
  texInfo = this.createTextureInfo(width, height);
289
291
  this.textures[i] = texInfo;
290
292
  }
291
- // Premultiply alpha on CPU so linear texture filtering produces correct results
292
- const uploadData = new Uint8Array(data.length);
293
- if (this.format === 'bgra8unorm') {
294
- for (let j = 0; j < data.length; j += 4) {
295
- const a = data[j + 3];
296
- const af = a / 255;
297
- uploadData[j] = (data[j + 2] * af + 0.5) | 0; // B <- R * a
298
- uploadData[j + 1] = (data[j + 1] * af + 0.5) | 0; // G <- G * a
299
- uploadData[j + 2] = (data[j] * af + 0.5) | 0; // R <- B * a
300
- uploadData[j + 3] = a;
293
+ // Only premultiply and re-upload when the source ImageData buffer has changed
294
+ if (texInfo.sourceData !== data) {
295
+ const uploadData = new Uint8Array(data.length);
296
+ if (this.format === 'bgra8unorm') {
297
+ for (let j = 0; j < data.length; j += 4) {
298
+ const a = data[j + 3];
299
+ const af = a / 255;
300
+ uploadData[j] = (data[j + 2] * af + 0.5) | 0; // B <- R * a
301
+ uploadData[j + 1] = (data[j + 1] * af + 0.5) | 0; // G
302
+ uploadData[j + 2] = (data[j] * af + 0.5) | 0; // R <- B * a
303
+ uploadData[j + 3] = a;
304
+ }
301
305
  }
302
- }
303
- else {
304
- for (let j = 0; j < data.length; j += 4) {
305
- const a = data[j + 3];
306
- const af = a / 255;
307
- uploadData[j] = (data[j] * af + 0.5) | 0;
308
- uploadData[j + 1] = (data[j + 1] * af + 0.5) | 0;
309
- uploadData[j + 2] = (data[j + 2] * af + 0.5) | 0;
310
- uploadData[j + 3] = a;
306
+ else {
307
+ for (let j = 0; j < data.length; j += 4) {
308
+ const a = data[j + 3];
309
+ const af = a / 255;
310
+ uploadData[j] = (data[j] * af + 0.5) | 0;
311
+ uploadData[j + 1] = (data[j + 1] * af + 0.5) | 0;
312
+ uploadData[j + 2] = (data[j + 2] * af + 0.5) | 0;
313
+ uploadData[j + 3] = a;
314
+ }
311
315
  }
316
+ this.device.queue.writeTexture({ texture: texInfo.texture }, uploadData, { bytesPerRow: width * 4 }, { width, height });
317
+ texInfo.sourceData = data;
312
318
  }
313
- // Upload premultiplied pixel data to texture
314
- this.device.queue.writeTexture({ texture: texInfo.texture }, uploadData, { bytesPerRow: width * 4 }, { width, height });
315
319
  // Calculate scaled position and size
316
320
  const scaledWidth = width * scaleX;
317
321
  const scaledHeight = height * scaleY;
@@ -334,17 +338,19 @@ export class WebGPURenderer {
334
338
  ]);
335
339
  const quadBuffer = this.quadDataBuffers[i];
336
340
  this.device.queue.writeBuffer(quadBuffer, 0, quadData);
337
- // Create bind group for this composition
338
- const bindGroup = this.device.createBindGroup({
339
- layout: this.bindGroupLayout,
340
- entries: [
341
- { binding: 0, resource: { buffer: this.uniformBuffer } },
342
- { binding: 1, resource: { buffer: quadBuffer } },
343
- { binding: 2, resource: this.sampler },
344
- { binding: 3, resource: texInfo.view }
345
- ]
346
- });
347
- renderPass.setBindGroup(0, bindGroup);
341
+ // Reuse cached bind group; it is only invalidated when the texture is recreated (size change)
342
+ if (!texInfo.bindGroup) {
343
+ texInfo.bindGroup = this.device.createBindGroup({
344
+ layout: this.bindGroupLayout,
345
+ entries: [
346
+ { binding: 0, resource: { buffer: this.uniformBuffer } },
347
+ { binding: 1, resource: { buffer: quadBuffer } },
348
+ { binding: 2, resource: this.sampler },
349
+ { binding: 3, resource: texInfo.view }
350
+ ]
351
+ });
352
+ }
353
+ renderPass.setBindGroup(0, texInfo.bindGroup);
348
354
  renderPass.draw(6); // 6 vertices for quad
349
355
  }
350
356
  renderPass.end();
@@ -354,6 +360,19 @@ export class WebGPURenderer {
354
360
  tex.destroy();
355
361
  }
356
362
  this.pendingDestroyTextures = [];
363
+ // Free GPU resources in slots beyond the current composition count
364
+ if (this.textures.length > compositions.length) {
365
+ for (let i = compositions.length; i < this.textures.length; i++) {
366
+ this.textures[i].texture.destroy();
367
+ }
368
+ this.textures.length = compositions.length;
369
+ }
370
+ if (this.quadDataBuffers.length > compositions.length) {
371
+ for (let i = compositions.length; i < this.quadDataBuffers.length; i++) {
372
+ this.quadDataBuffers[i].destroy();
373
+ }
374
+ this.quadDataBuffers.length = compositions.length;
375
+ }
357
376
  }
358
377
  /**
359
378
  * Clear the canvas.
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-renderer.js","sourceRoot":"","sources":["../../src/ts/webgpu-renderer.ts"],"names":[],"mappings":"AAAA,uCAAuC;AAIvC,qBAAqB;AACrB,MAAM,aAAa,GAAG,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ChC,CAAA;AAED,sDAAsD;AACtD,MAAM,eAAe,GAAG,UAAU,CAAC;;;;;;;;;;;;;CAalC,CAAA;AASD;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,KAAK,IAAI,SAAS,CAAA;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,cAAc;IACzB,MAAM,GAAqB,IAAI,CAAA;IAC/B,OAAO,GAA4B,IAAI,CAAA;IACvC,QAAQ,GAA6B,IAAI,CAAA;IACzC,OAAO,GAAsB,IAAI,CAAA;IACjC,eAAe,GAA8B,IAAI,CAAA;IAEjD,gCAAgC;IAChC,aAAa,GAAqB,IAAI,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AAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAA;QACzB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAA;IAC1B,CAAC;CACF"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "libbitsub",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "author": "altqx",
5
- "license": "MIT OR Apache-2.0",
5
+ "license": "MIT",
6
6
  "description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
7
7
  "keywords": [
8
8
  "libbitsub",
package/pkg/LICENSE CHANGED
@@ -1,9 +1,3 @@
1
- Libbitsub is dual-licensed under The MIT License [1] and
2
- Apache 2.0 License [2]. Copyright (c) 2026, Jaruwit Jaiya.
3
-
4
- [1]: <http://opensource.org/licenses/MIT>, which is reproduced below:
5
-
6
- ~~~~
7
1
  MIT License
8
2
 
9
3
  Copyright (c) 2026 Jaruwit Jaiya
@@ -25,211 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
21
  SOFTWARE.
28
- ~~~~
29
-
30
-
31
- [2]: <http://www.apache.org/licenses/LICENSE-2.0>, which is reproduced below:
32
-
33
- ~~~~
34
- Apache License
35
- Version 2.0, January 2004
36
- http://www.apache.org/licenses/
37
-
38
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
39
-
40
- 1. Definitions.
41
-
42
- "License" shall mean the terms and conditions for use, reproduction,
43
- and distribution as defined by Sections 1 through 9 of this document.
44
-
45
- "Licensor" shall mean the copyright owner or entity authorized by
46
- the copyright owner that is granting the License.
47
-
48
- "Legal Entity" shall mean the union of the acting entity and all
49
- other entities that control, are controlled by, or are under common
50
- control with that entity. For the purposes of this definition,
51
- "control" means (i) the power, direct or indirect, to cause the
52
- direction or management of such entity, whether by contract or
53
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
54
- outstanding shares, or (iii) beneficial ownership of such entity.
55
-
56
- "You" (or "Your") shall mean an individual or Legal Entity
57
- exercising permissions granted by this License.
58
-
59
- "Source" form shall mean the preferred form for making modifications,
60
- including but not limited to software source code, documentation
61
- source, and configuration files.
62
-
63
- "Object" form shall mean any form resulting from mechanical
64
- transformation or translation of a Source form, including but
65
- not limited to compiled object code, generated documentation,
66
- and conversions to other media types.
67
-
68
- "Work" shall mean the work of authorship, whether in Source or
69
- Object form, made available under the License, as indicated by a
70
- copyright notice that is included in or attached to the work
71
- (an example is provided in the Appendix below).
72
-
73
- "Derivative Works" shall mean any work, whether in Source or Object
74
- form, that is based on (or derived from) the Work and for which the
75
- editorial revisions, annotations, elaborations, or other modifications
76
- represent, as a whole, an original work of authorship. For the purposes
77
- of this License, Derivative Works shall not include works that remain
78
- separable from, or merely link (or bind by name) to the interfaces of,
79
- the Work and Derivative Works thereof.
80
-
81
- "Contribution" shall mean any work of authorship, including
82
- the original version of the Work and any modifications or additions
83
- to that Work or Derivative Works thereof, that is intentionally
84
- submitted to Licensor for inclusion in the Work by the copyright owner
85
- or by an individual or Legal Entity authorized to submit on behalf of
86
- the copyright owner. For the purposes of this definition, "submitted"
87
- means any form of electronic, verbal, or written communication sent
88
- to the Licensor or its representatives, including but not limited to
89
- communication on electronic mailing lists, source code control systems,
90
- and issue tracking systems that are managed by, or on behalf of, the
91
- Licensor for the purpose of discussing and improving the Work, but
92
- excluding communication that is conspicuously marked or otherwise
93
- designated in writing by the copyright owner as "Not a Contribution."
94
-
95
- "Contributor" shall mean Licensor and any individual or Legal Entity
96
- on behalf of whom a Contribution has been received by Licensor and
97
- subsequently incorporated within the Work.
98
-
99
- 2. Grant of Copyright License. Subject to the terms and conditions of
100
- this License, each Contributor hereby grants to You a perpetual,
101
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
102
- copyright license to reproduce, prepare Derivative Works of,
103
- publicly display, publicly perform, sublicense, and distribute the
104
- Work and such Derivative Works in Source or Object form.
105
-
106
- 3. Grant of Patent License. Subject to the terms and conditions of
107
- this License, each Contributor hereby grants to You a perpetual,
108
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
109
- (except as stated in this section) patent license to make, have made,
110
- use, offer to sell, sell, import, and otherwise transfer the Work,
111
- where such license applies only to those patent claims licensable
112
- by such Contributor that are necessarily infringed by their
113
- Contribution(s) alone or by combination of their Contribution(s)
114
- with the Work to which such Contribution(s) was submitted. If You
115
- institute patent litigation against any entity (including a
116
- cross-claim or counterclaim in a lawsuit) alleging that the Work
117
- or a Contribution incorporated within the Work constitutes direct
118
- or contributory patent infringement, then any patent licenses
119
- granted to You under this License for that Work shall terminate
120
- as of the date such litigation is filed.
121
-
122
- 4. Redistribution. You may reproduce and distribute copies of the
123
- Work or Derivative Works thereof in any medium, with or without
124
- modifications, and in Source or Object form, provided that You
125
- meet the following conditions:
126
-
127
- (a) You must give any other recipients of the Work or
128
- Derivative Works a copy of this License; and
129
-
130
- (b) You must cause any modified files to carry prominent notices
131
- stating that You changed the files; and
132
-
133
- (c) You must retain, in the Source form of any Derivative Works
134
- that You distribute, all copyright, patent, trademark, and
135
- attribution notices from the Source form of the Work,
136
- excluding those notices that do not pertain to any part of
137
- the Derivative Works; and
138
-
139
- (d) If the Work includes a "NOTICE" text file as part of its
140
- distribution, then any Derivative Works that You distribute must
141
- include a readable copy of the attribution notices contained
142
- within such NOTICE file, excluding those notices that do not
143
- pertain to any part of the Derivative Works, in at least one
144
- of the following places: within a NOTICE text file distributed
145
- as part of the Derivative Works; within the Source form or
146
- documentation, if provided along with the Derivative Works; or,
147
- within a display generated by the Derivative Works, if and
148
- wherever such third-party notices normally appear. The contents
149
- of the NOTICE file are for informational purposes only and
150
- do not modify the License. You may add Your own attribution
151
- notices within Derivative Works that You distribute, alongside
152
- or as an addendum to the NOTICE text from the Work, provided
153
- that such additional attribution notices cannot be construed
154
- as modifying the License.
155
-
156
- You may add Your own copyright statement to Your modifications and
157
- may provide additional or different license terms and conditions
158
- for use, reproduction, or distribution of Your modifications, or
159
- for any such Derivative Works as a whole, provided Your use,
160
- reproduction, and distribution of the Work otherwise complies with
161
- the conditions stated in this License.
162
-
163
- 5. Submission of Contributions. Unless You explicitly state otherwise,
164
- any Contribution intentionally submitted for inclusion in the Work
165
- by You to the Licensor shall be under the terms and conditions of
166
- this License, without any additional terms or conditions.
167
- Notwithstanding the above, nothing herein shall supersede or modify
168
- the terms of any separate license agreement you may have executed
169
- with Licensor regarding such Contributions.
170
-
171
- 6. Trademarks. This License does not grant permission to use the trade
172
- names, trademarks, service marks, or product names of the Licensor,
173
- except as required for reasonable and customary use in describing the
174
- origin of the Work and reproducing the content of the NOTICE file.
175
-
176
- 7. Disclaimer of Warranty. Unless required by applicable law or
177
- agreed to in writing, Licensor provides the Work (and each
178
- Contributor provides its Contributions) on an "AS IS" BASIS,
179
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
180
- implied, including, without limitation, any warranties or conditions
181
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
182
- PARTICULAR PURPOSE. You are solely responsible for determining the
183
- appropriateness of using or redistributing the Work and assume any
184
- risks associated with Your exercise of permissions under this License.
185
-
186
- 8. Limitation of Liability. In no event and under no legal theory,
187
- whether in tort (including negligence), contract, or otherwise,
188
- unless required by applicable law (such as deliberate and grossly
189
- negligent acts) or agreed to in writing, shall any Contributor be
190
- liable to You for damages, including any direct, indirect, special,
191
- incidental, or consequential damages of any character arising as a
192
- result of this License or out of the use or inability to use the
193
- Work (including but not limited to damages for loss of goodwill,
194
- work stoppage, computer failure or malfunction, or any and all
195
- other commercial damages or losses), even if such Contributor
196
- has been advised of the possibility of such damages.
197
-
198
- 9. Accepting Warranty or Additional Liability. While redistributing
199
- the Work or Derivative Works thereof, You may choose to offer,
200
- and charge a fee for, acceptance of support, warranty, indemnity,
201
- or other liability obligations and/or rights consistent with this
202
- License. However, in accepting such obligations, You may act only
203
- on Your own behalf and on Your sole responsibility, not on behalf
204
- of any other Contributor, and only if You agree to indemnify,
205
- defend, and hold each Contributor harmless for any liability
206
- incurred by, or claims asserted against, such Contributor by reason
207
- of your accepting any such warranty or additional liability.
208
-
209
- END OF TERMS AND CONDITIONS
210
-
211
- APPENDIX: How to apply the Apache License to your work.
212
-
213
- To apply the Apache License to your work, attach the following
214
- boilerplate notice, with the fields enclosed by brackets "[]"
215
- replaced with your own identifying information. (Don't include
216
- the brackets!) The text should be enclosed in the appropriate
217
- comment syntax for the file format. We also recommend that a
218
- file or class name and description of purpose be included on the
219
- same "printed page" as the copyright notice for easier
220
- identification within third-party archives.
221
-
222
- Copyright [yyyy] [name of copyright owner]
223
-
224
- Licensed under the Apache License, Version 2.0 (the "License");
225
- you may not use this file except in compliance with the License.
226
- You may obtain a copy of the License at
227
-
228
- http://www.apache.org/licenses/LICENSE-2.0
229
-
230
- Unless required by applicable law or agreed to in writing, software
231
- distributed under the License is distributed on an "AS IS" BASIS,
232
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
233
- See the License for the specific language governing permissions and
234
- limitations under the License.
235
- ~~~~
package/pkg/README.md CHANGED
@@ -8,7 +8,7 @@ Started as a fork of Arcus92's [libpgs-js](https://github.com/Arcus92/libpgs-js)
8
8
 
9
9
  - **PGS (Blu-ray)** subtitle parsing and rendering
10
10
  - **VobSub (DVD)** subtitle parsing and rendering
11
- - **WebGPU rendering** GPU-accelerated rendering with automatic Canvas2D fallback
11
+ - **WebGPU / WebGL2 rendering** GPU-accelerated rendering with automatic fallback: WebGPU → WebGL2 → Canvas2D
12
12
  - **High-performance** Rust-based rendering engine compiled to WebAssembly
13
13
  - **Zero-copy** data transfer between JS and WASM where possible
14
14
  - **Caching** for decoded bitmaps to optimize repeated rendering
@@ -319,31 +319,44 @@ setInterval(() => {
319
319
  | `totalEntries` | number | Total subtitle entries/display sets in the loaded file |
320
320
  | `currentIndex` | number | Index of the currently displayed subtitle |
321
321
 
322
- ### WebGPU Rendering
322
+ ### GPU-Accelerated Rendering
323
323
 
324
- libbitsub automatically uses WebGPU for GPU-accelerated rendering when available, with automatic fallback to Canvas2D:
324
+ libbitsub automatically selects the best available GPU renderer at startup, following this fallback chain:
325
+
326
+ **WebGPU → WebGL2 → Canvas2D**
325
327
 
326
328
  ```typescript
327
- import { PgsRenderer, isWebGPUSupported } from 'libbitsub'
329
+ import { PgsRenderer, isWebGPUSupported, isWebGL2Supported } from 'libbitsub'
328
330
 
329
- // Check WebGPU support
331
+ // Check renderer support
330
332
  if (isWebGPUSupported()) {
331
- console.log('WebGPU available - GPU-accelerated rendering enabled')
333
+ console.log('WebGPU available')
334
+ } else if (isWebGL2Supported()) {
335
+ console.log('WebGL2 available')
336
+ } else {
337
+ console.log('Falling back to Canvas2D')
332
338
  }
333
339
 
334
- // Configure WebGPU preference
335
340
  const renderer = new PgsRenderer({
336
341
  video: videoElement,
337
342
  subUrl: '/subtitles/movie.sup',
338
- preferWebGPU: true, // default: true
339
- onWebGPUFallback: () => console.log('Fell back to Canvas2D')
343
+ onWebGPUFallback: () => console.log('WebGPU unavailable, trying WebGL2'),
344
+ onWebGL2Fallback: () => console.log('WebGL2 unavailable, using Canvas2D')
340
345
  })
341
346
  ```
342
347
 
343
348
  **Options:**
344
349
 
345
- - `preferWebGPU` (boolean): Enable WebGPU rendering if available. Default: `true`
346
- - `onWebGPUFallback` (function): Callback when WebGPU is unavailable and falls back to Canvas2D
350
+ - `onWebGPUFallback` (function): Callback when WebGPU initialisation fails
351
+ - `onWebGL2Fallback` (function): Callback when WebGL2 initialisation fails
352
+
353
+ **Renderer capabilities:**
354
+
355
+ | Renderer | Premultiplied alpha | Linear sampling | Browser support |
356
+ | -------- | ------------------- | --------------- | --------------- |
357
+ | WebGPU | ✅ | ✅ | Chrome 113+, Firefox 141+, Edge 113+ |
358
+ | WebGL2 | ✅ | ✅ | All modern browsers |
359
+ | Canvas2D | — | ✅ | Universal |
347
360
 
348
361
  ## Low-Level API (Programmatic Use)
349
362
 
@@ -501,11 +514,11 @@ interface VideoSubtitleOptions {
501
514
  subUrl?: string // URL to subtitle file (provide this OR subContent)
502
515
  subContent?: ArrayBuffer // Direct subtitle content (provide this OR subUrl)
503
516
  workerUrl?: string // Worker URL (for API compatibility)
504
- preferWebGPU?: boolean // Prefer WebGPU renderer if available (default: true)
505
517
  onLoading?: () => void // Called when subtitle loading starts
506
518
  onLoaded?: () => void // Called when subtitle loading completes
507
519
  onError?: (error: Error) => void // Called when subtitle loading fails
508
- onWebGPUFallback?: () => void // Called when WebGPU is unavailable
520
+ onWebGPUFallback?: () => void // Called when WebGPU init fails
521
+ onWebGL2Fallback?: () => void // Called when WebGL2 init fails
509
522
  }
510
523
  ```
511
524
 
@@ -566,7 +579,4 @@ interface SubtitleCompositionData {
566
579
 
567
580
  ## License
568
581
 
569
- Licensed under either of
570
-
571
- - Apache License, Version 2.0
572
- - MIT license
582
+ MIT
@@ -331,8 +331,8 @@ export interface InitOutput {
331
331
  readonly vobsubparser_setDebandRange: (a: number, b: number) => void;
332
332
  readonly vobsubparser_setDebandThreshold: (a: number, b: number) => void;
333
333
  readonly __wbg_subtitleframe_free: (a: number, b: number) => void;
334
- readonly subtitleframe_width: (a: number) => number;
335
334
  readonly subtitleframe_height: (a: number) => number;
335
+ readonly subtitleframe_width: (a: number) => number;
336
336
  readonly subtitleframe_compositionCount: (a: number) => number;
337
337
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
338
338
  readonly __wbindgen_malloc: (a: number, b: number) => number;
Binary file
@@ -62,8 +62,8 @@ export const vobsubparser_setDebandEnabled: (a: number, b: number) => void;
62
62
  export const vobsubparser_setDebandRange: (a: number, b: number) => void;
63
63
  export const vobsubparser_setDebandThreshold: (a: number, b: number) => void;
64
64
  export const __wbg_subtitleframe_free: (a: number, b: number) => void;
65
- export const subtitleframe_width: (a: number) => number;
66
65
  export const subtitleframe_height: (a: number) => number;
66
+ export const subtitleframe_width: (a: number) => number;
67
67
  export const subtitleframe_compositionCount: (a: number) => number;
68
68
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
69
69
  export const __wbindgen_malloc: (a: number, b: number) => number;
package/pkg/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "altqx"
6
6
  ],
7
7
  "description": "High-performance WASM renderer for graphical subtitles (PGS and VobSub)",
8
- "version": "1.5.0",
9
- "license": "MIT OR Apache-2.0",
8
+ "version": "1.6.0",
9
+ "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "https://github.com/altqx/libbitsub"