libav-wasm 0.8.2 → 0.8.4

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.
Binary file
package/build/libav.wasm CHANGED
Binary file
package/build/utils.d.ts CHANGED
@@ -1,4 +1,2 @@
1
1
  export declare function debounceImmediateAndLatest<T extends (...args: any[]) => any>(wait: number, func: T): T;
2
2
  export declare const queuedThrottleWithLastCall: <T2 extends any[], T extends (...args: T2) => any>(time: number, func: T) => (...args: Parameters<T>) => Promise<any> | undefined;
3
- export declare const toStreamChunkSize: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array<ArrayBufferLike>>;
4
- export declare const toBufferedStream: (SIZE: number) => (stream: ReadableStream) => ReadableStream<Uint8Array<ArrayBufferLike>>;
package/build/worker.d.ts CHANGED
@@ -32,6 +32,22 @@ export interface ThumbnailReadResult {
32
32
  offset: number;
33
33
  cancelled: boolean;
34
34
  }
35
+ /** what the thumbnail path needs from a file: no muxer, no encoder, no stream map */
36
+ export interface ThumbnailInitResult {
37
+ duration: number;
38
+ videoMimeType: string;
39
+ videoExtradata: WASMVector<number>;
40
+ indexes: WASMVector<Index>;
41
+ }
42
+ /** `data` is tightly packed RGBA at width * height * 4, the exact shape an ImageData takes */
43
+ export interface ThumbnailDecodeResult {
44
+ data: Uint8Array;
45
+ width: number;
46
+ height: number;
47
+ pts: number;
48
+ duration: number;
49
+ cancelled: boolean;
50
+ }
35
51
  export type Index = {
36
52
  index: number;
37
53
  timestamp: number;
@@ -120,10 +136,19 @@ export interface RemuxerInstance {
120
136
  cancelled: boolean;
121
137
  finished: boolean;
122
138
  }>;
139
+ initThumbnail: (read: WASMReadFunction) => Promise<ThumbnailInitResult>;
123
140
  readKeyframe: (read: WASMReadFunction, timestamp: number) => Promise<ThumbnailReadResult>;
141
+ decodeKeyframe: (read: WASMReadFunction, timestamp: number, width: number, height: number) => Promise<ThumbnailDecodeResult>;
142
+ setAudioStreamIndex: (index: number) => void;
124
143
  }
125
144
  export type Remuxer = {
126
145
  new (options: RemuxerInstanceOptions): RemuxerInstance;
146
+ initThumbnail: (read: WASMReadFunction) => Promise<{
147
+ duration: number;
148
+ videoMimeType: string;
149
+ videoExtradata: ArrayBuffer;
150
+ indexes: Index[];
151
+ }>;
127
152
  init: (read: WASMReadFunction) => Promise<{
128
153
  data: ArrayBuffer;
129
154
  attachments: Attachment[];
@@ -175,18 +200,27 @@ export type Remuxer = {
175
200
  offset: number;
176
201
  cancelled: boolean;
177
202
  }>;
203
+ decodeKeyframe: (read: WASMReadFunction, timestamp: number, width: number, height: number) => Promise<{
204
+ data: ArrayBuffer;
205
+ width: number;
206
+ height: number;
207
+ pts: number;
208
+ duration: number;
209
+ cancelled: boolean;
210
+ }>;
211
+ setAudioStreamIndex: (index: number) => void;
178
212
  };
179
213
  type WASMVector<T> = {
180
214
  size: () => number;
181
215
  get: (index: number) => T;
216
+ delete: () => void;
182
217
  };
183
218
  declare const resolvers: {
184
- makeRemuxer: ({ publicPath, length, bufferSize, audioStreamIndex, log }: {
219
+ makeRemuxer: ({ publicPath, length, bufferSize, audioStreamIndex }: {
185
220
  publicPath: string;
186
221
  length: number;
187
222
  bufferSize: number;
188
223
  audioStreamIndex?: number;
189
- log: (isError: boolean, text: string) => Promise<void>;
190
224
  }) => Promise<{
191
225
  destroy: () => Promise<void>;
192
226
  init: (read: ReadFunction) => Promise<{
@@ -214,6 +248,12 @@ declare const resolvers: {
214
248
  indexes: Index[];
215
249
  videoExtradata: ArrayBuffer;
216
250
  }>;
251
+ initThumbnail: (read: ReadFunction) => Promise<{
252
+ duration: number;
253
+ videoMimeType: string;
254
+ videoExtradata: ArrayBuffer;
255
+ indexes: Index[];
256
+ }>;
217
257
  seek: (read: ReadFunction, timestamp: number) => Promise<{
218
258
  data: ArrayBuffer;
219
259
  subtitles: SubtitleFragment[];
@@ -232,6 +272,7 @@ declare const resolvers: {
232
272
  cancelled: boolean;
233
273
  finished: boolean;
234
274
  }>;
275
+ setAudioStreamIndex: (index: number) => Promise<void>;
235
276
  readKeyframe: (read: ReadFunction, timestamp: number) => Promise<ArrayBuffer>;
236
277
  }>;
237
278
  };