@mediapipe/tasks-text 0.1.0-alpha-1670012900 → 0.1.0-alpha-2
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/package.json +1 -1
- package/text.d.ts +16 -670
- package/text_bundle.js +1 -1
package/text.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="@types/offscreencanvas" />
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
5
3
|
*
|
|
@@ -15,8 +13,8 @@
|
|
|
15
13
|
* See the License for the specific language governing permissions and
|
|
16
14
|
* limitations under the License.
|
|
17
15
|
*/
|
|
18
|
-
/** Options to configure MediaPipe
|
|
19
|
-
declare interface
|
|
16
|
+
/** Options to configure MediaPipe model loading and processing. */
|
|
17
|
+
declare interface BaseOptions_2 {
|
|
20
18
|
/**
|
|
21
19
|
* The model path to the model asset file. Only one of `modelAssetPath` or
|
|
22
20
|
* `modelAssetBuffer` can be set.
|
|
@@ -28,7 +26,7 @@ declare interface BaseOptions {
|
|
|
28
26
|
*/
|
|
29
27
|
modelAssetBuffer?: Uint8Array | undefined;
|
|
30
28
|
/** Overrides the default backend to use for the provided model. */
|
|
31
|
-
delegate?:
|
|
29
|
+
delegate?: "CPU" | "GPU" | undefined;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -206,9 +204,6 @@ export declare interface Embedding {
|
|
|
206
204
|
headName: string;
|
|
207
205
|
}
|
|
208
206
|
|
|
209
|
-
/** A listener that will be invoked with an absl::StatusCode and message. */
|
|
210
|
-
declare type ErrorListener = (code: number, message: string) => void;
|
|
211
|
-
|
|
212
207
|
/**
|
|
213
208
|
* Resolves the files required for the MediaPipe Task APIs.
|
|
214
209
|
*
|
|
@@ -261,487 +256,21 @@ export declare class FilesetResolver {
|
|
|
261
256
|
static forVisionTasks(basePath?: string): Promise<WasmFileset>;
|
|
262
257
|
}
|
|
263
258
|
|
|
264
|
-
/**
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
*/
|
|
270
|
-
declare class GraphRunner {
|
|
271
|
-
readonly wasmModule: WasmModule;
|
|
272
|
-
readonly hasMultiStreamSupport: boolean;
|
|
273
|
-
autoResizeCanvas: boolean;
|
|
274
|
-
audioPtr: number | null;
|
|
275
|
-
audioSize: number;
|
|
276
|
-
/**
|
|
277
|
-
* Creates a new MediaPipe WASM module. Must be called *after* wasm Module has
|
|
278
|
-
* initialized. Note that we take control of the GL canvas from here on out,
|
|
279
|
-
* and will resize it to fit input.
|
|
280
|
-
*
|
|
281
|
-
* @param module The underlying Wasm Module to use.
|
|
282
|
-
* @param glCanvas The type of the GL canvas to use, or `null` if no GL
|
|
283
|
-
* canvas should be initialzed. Initializes an offscreen canvas if not
|
|
284
|
-
* provided.
|
|
285
|
-
*/
|
|
286
|
-
constructor(module: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
287
|
-
/**
|
|
288
|
-
* Convenience helper to load a MediaPipe graph from a file and pass it to
|
|
289
|
-
* setGraph.
|
|
290
|
-
* @param graphFile The url of the MediaPipe graph file to load.
|
|
291
|
-
*/
|
|
292
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
293
|
-
/**
|
|
294
|
-
* Convenience helper for calling setGraph with a string representing a text
|
|
295
|
-
* proto config.
|
|
296
|
-
* @param graphConfig The text proto graph config, expected to be a string in
|
|
297
|
-
* default JavaScript UTF-16 format.
|
|
298
|
-
*/
|
|
299
|
-
setGraphFromString(graphConfig: string): void;
|
|
300
|
-
/**
|
|
301
|
-
* Takes the raw data from a MediaPipe graph, and passes it to C++ to be run
|
|
302
|
-
* over the video stream. Will replace the previously running MediaPipe graph,
|
|
303
|
-
* if there is one.
|
|
304
|
-
* @param graphData The raw MediaPipe graph data, either in binary
|
|
305
|
-
* protobuffer format (.binarypb), or else in raw text format (.pbtxt or
|
|
306
|
-
* .textproto).
|
|
307
|
-
* @param isBinary This should be set to true if the graph is in
|
|
308
|
-
* binary format, and false if it is in human-readable text format.
|
|
309
|
-
*/
|
|
310
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
311
|
-
/**
|
|
312
|
-
* Configures the current graph to handle audio processing in a certain way
|
|
313
|
-
* for all its audio input streams. Additionally can configure audio headers
|
|
314
|
-
* (both input side packets as well as input stream headers), but these
|
|
315
|
-
* configurations only take effect if called before the graph is set/started.
|
|
316
|
-
* @param numChannels The number of channels of audio input. Only 1
|
|
317
|
-
* is supported for now.
|
|
318
|
-
* @param numSamples The number of samples that are taken in each
|
|
319
|
-
* audio capture.
|
|
320
|
-
* @param sampleRate The rate, in Hz, of the sampling.
|
|
321
|
-
* @param streamName The optional name of the input stream to additionally
|
|
322
|
-
* configure with audio information. This configuration only occurs before
|
|
323
|
-
* the graph is set/started. If unset, a default stream name will be used.
|
|
324
|
-
* @param headerName The optional name of the header input side packet to
|
|
325
|
-
* additionally configure with audio information. This configuration only
|
|
326
|
-
* occurs before the graph is set/started. If unset, a default header name
|
|
327
|
-
* will be used.
|
|
328
|
-
*/
|
|
329
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string, headerName?: string): void;
|
|
330
|
-
/**
|
|
331
|
-
* Allows disabling automatic canvas resizing, in case clients want to control
|
|
332
|
-
* control this.
|
|
333
|
-
* @param resize True will re-enable automatic canvas resizing, while false
|
|
334
|
-
* will disable the feature.
|
|
335
|
-
*/
|
|
336
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
337
|
-
/**
|
|
338
|
-
* Allows disabling the automatic render-to-screen code, in case clients don't
|
|
339
|
-
* need/want this. In particular, this removes the requirement for pipelines
|
|
340
|
-
* to have access to GPU resources, as well as the requirement for graphs to
|
|
341
|
-
* have "input_frames_gpu" and "output_frames_gpu" streams defined, so pure
|
|
342
|
-
* CPU pipelines and non-video pipelines can be created.
|
|
343
|
-
* NOTE: This only affects future graph initializations (via setGraph or
|
|
344
|
-
* initializeGraph), and does NOT affect the currently running graph, so
|
|
345
|
-
* calls to this should be made *before* setGraph/initializeGraph for the
|
|
346
|
-
* graph file being targeted.
|
|
347
|
-
* @param enabled True will re-enable automatic render-to-screen code and
|
|
348
|
-
* cause GPU resources to once again be requested, while false will
|
|
349
|
-
* disable the feature.
|
|
350
|
-
*/
|
|
351
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
352
|
-
/**
|
|
353
|
-
* Bind texture to our internal canvas, and upload image source to GPU.
|
|
354
|
-
* Returns tuple [width, height] of texture. Intended for internal usage.
|
|
355
|
-
*/
|
|
356
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number): [
|
|
357
|
-
number,
|
|
358
|
-
number
|
|
359
|
-
];
|
|
360
|
-
/**
|
|
361
|
-
* Takes the raw data from a JS image source, and sends it to C++ to be
|
|
362
|
-
* processed, waiting synchronously for the response. Note that we will resize
|
|
363
|
-
* our GL canvas to fit the input, so input size should only change
|
|
364
|
-
* infrequently.
|
|
365
|
-
* @param imageSource An image source to process.
|
|
366
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
367
|
-
* @return texture? The WebGL texture reference, if one was produced.
|
|
368
|
-
*/
|
|
369
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
370
|
-
/**
|
|
371
|
-
* Converts JavaScript string input parameters into C++ c-string pointers.
|
|
372
|
-
* See b/204830158 for more details. Intended for internal usage.
|
|
373
|
-
*/
|
|
374
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
375
|
-
/**
|
|
376
|
-
* Converts JavaScript string input parameters into C++ c-string pointers.
|
|
377
|
-
* See b/204830158 for more details.
|
|
378
|
-
*/
|
|
379
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
380
|
-
/**
|
|
381
|
-
* Ensures existence of the simple listeners table and registers the callback.
|
|
382
|
-
* Intended for internal usage.
|
|
383
|
-
*/
|
|
384
|
-
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
385
|
-
/**
|
|
386
|
-
* Ensures existence of the vector listeners table and registers the callback.
|
|
387
|
-
* Intended for internal usage.
|
|
388
|
-
*/
|
|
389
|
-
setVectorListener<T>(outputStreamName: string, callbackFcn: (data: T[]) => void): void;
|
|
390
|
-
/**
|
|
391
|
-
* Attaches a listener that will be invoked when the MediaPipe framework
|
|
392
|
-
* returns an error.
|
|
393
|
-
*/
|
|
394
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
395
|
-
/**
|
|
396
|
-
* Takes the raw data from a JS audio capture array, and sends it to C++ to be
|
|
397
|
-
* processed.
|
|
398
|
-
* @param audioData An array of raw audio capture data, like
|
|
399
|
-
* from a call to getChannelData on an AudioBuffer.
|
|
400
|
-
* @param streamName The name of the MediaPipe graph stream to add the audio
|
|
401
|
-
* data to.
|
|
402
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
403
|
-
*/
|
|
404
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
405
|
-
/**
|
|
406
|
-
* Takes the raw data from a JS audio capture array, and sends it to C++ to be
|
|
407
|
-
* processed, shaping the audioData array into an audio matrix according to
|
|
408
|
-
* the numChannels and numSamples parameters.
|
|
409
|
-
* @param audioData An array of raw audio capture data, like
|
|
410
|
-
* from a call to getChannelData on an AudioBuffer.
|
|
411
|
-
* @param numChannels The number of audio channels this data represents. If 0
|
|
412
|
-
* is passed, then the value will be taken from the last call to
|
|
413
|
-
* configureAudio.
|
|
414
|
-
* @param numSamples The number of audio samples captured in this data packet.
|
|
415
|
-
* If 0 is passed, then the value will be taken from the last call to
|
|
416
|
-
* configureAudio.
|
|
417
|
-
* @param streamName The name of the MediaPipe graph stream to add the audio
|
|
418
|
-
* data to.
|
|
419
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
420
|
-
*/
|
|
421
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
422
|
-
/**
|
|
423
|
-
* Takes the relevant information from the HTML video or image element, and
|
|
424
|
-
* passes it into the WebGL-based graph for processing on the given stream at
|
|
425
|
-
* the given timestamp. Can be used for additional auxiliary GpuBuffer input
|
|
426
|
-
* streams. Processing will not occur until a blocking call (like
|
|
427
|
-
* processVideoGl or finishProcessing) is made. For use with
|
|
428
|
-
* 'gl_graph_runner_internal_multi_input'.
|
|
429
|
-
* @param imageSource Reference to the video frame we wish to add into our
|
|
430
|
-
* graph.
|
|
431
|
-
* @param streamName The name of the MediaPipe graph stream to add the frame
|
|
432
|
-
* to.
|
|
433
|
-
* @param timestamp The timestamp of the input frame, in ms.
|
|
434
|
-
*/
|
|
435
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
436
|
-
/**
|
|
437
|
-
* Sends a boolean packet into the specified stream at the given timestamp.
|
|
438
|
-
* @param data The boolean data to send.
|
|
439
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
440
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
441
|
-
*/
|
|
442
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
443
|
-
/**
|
|
444
|
-
* Sends a double packet into the specified stream at the given timestamp.
|
|
445
|
-
* @param data The double data to send.
|
|
446
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
447
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
448
|
-
*/
|
|
449
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
450
|
-
/**
|
|
451
|
-
* Sends a float packet into the specified stream at the given timestamp.
|
|
452
|
-
* @param data The float data to send.
|
|
453
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
454
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
455
|
-
*/
|
|
456
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
457
|
-
/**
|
|
458
|
-
* Sends an integer packet into the specified stream at the given timestamp.
|
|
459
|
-
* @param data The integer data to send.
|
|
460
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
461
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
462
|
-
*/
|
|
463
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
464
|
-
/**
|
|
465
|
-
* Sends a string packet into the specified stream at the given timestamp.
|
|
466
|
-
* @param data The string data to send.
|
|
467
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
468
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
469
|
-
*/
|
|
470
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
471
|
-
/**
|
|
472
|
-
* Sends a Record<string, string> packet into the specified stream at the
|
|
473
|
-
* given timestamp.
|
|
474
|
-
* @param data The records to send (will become a
|
|
475
|
-
* std::flat_hash_map<std::string, std::string).
|
|
476
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
477
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
478
|
-
*/
|
|
479
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
480
|
-
/**
|
|
481
|
-
* Sends a serialized protobuffer packet into the specified stream at the
|
|
482
|
-
* given timestamp, to be parsed into the specified protobuffer type.
|
|
483
|
-
* @param data The binary (serialized) raw protobuffer data.
|
|
484
|
-
* @param protoType The C++ namespaced type this protobuffer data corresponds
|
|
485
|
-
* to. It will be converted to this type when output as a packet into the
|
|
486
|
-
* graph.
|
|
487
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
488
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
489
|
-
*/
|
|
490
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
491
|
-
/**
|
|
492
|
-
* Attaches a boolean packet to the specified input_side_packet.
|
|
493
|
-
* @param data The boolean data to send.
|
|
494
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
495
|
-
* into.
|
|
496
|
-
*/
|
|
497
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
498
|
-
/**
|
|
499
|
-
* Attaches a double packet to the specified input_side_packet.
|
|
500
|
-
* @param data The double data to send.
|
|
501
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
502
|
-
* into.
|
|
503
|
-
*/
|
|
504
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
505
|
-
/**
|
|
506
|
-
* Attaches a float packet to the specified input_side_packet.
|
|
507
|
-
* @param data The float data to send.
|
|
508
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
509
|
-
* into.
|
|
510
|
-
*/
|
|
511
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
512
|
-
/**
|
|
513
|
-
* Attaches a integer packet to the specified input_side_packet.
|
|
514
|
-
* @param data The integer data to send.
|
|
515
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
516
|
-
* into.
|
|
517
|
-
*/
|
|
518
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
519
|
-
/**
|
|
520
|
-
* Attaches a string packet to the specified input_side_packet.
|
|
521
|
-
* @param data The string data to send.
|
|
522
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
523
|
-
* into.
|
|
524
|
-
*/
|
|
525
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
526
|
-
/**
|
|
527
|
-
* Attaches a serialized proto packet to the specified input_side_packet.
|
|
528
|
-
* @param data The binary (serialized) raw protobuffer data.
|
|
529
|
-
* @param protoType The C++ namespaced type this protobuffer data corresponds
|
|
530
|
-
* to. It will be converted to this type for use in the graph.
|
|
531
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
532
|
-
* into.
|
|
533
|
-
*/
|
|
534
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
535
|
-
/**
|
|
536
|
-
* Attaches a boolean packet listener to the specified output_stream.
|
|
537
|
-
* @param outputStreamName The name of the graph output stream to grab boolean
|
|
538
|
-
* data from.
|
|
539
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
540
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
541
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
542
|
-
* should not perform overly complicated (or any async) behavior.
|
|
543
|
-
*/
|
|
544
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
545
|
-
/**
|
|
546
|
-
* Attaches a bool[] packet listener to the specified output_stream.
|
|
547
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
548
|
-
* std::vector<bool> data from.
|
|
549
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
550
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
551
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
552
|
-
* should not perform overly complicated (or any async) behavior.
|
|
553
|
-
*/
|
|
554
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
555
|
-
/**
|
|
556
|
-
* Attaches an int packet listener to the specified output_stream.
|
|
557
|
-
* @param outputStreamName The name of the graph output stream to grab int
|
|
558
|
-
* data from.
|
|
559
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
560
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
561
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
562
|
-
* should not perform overly complicated (or any async) behavior.
|
|
563
|
-
*/
|
|
564
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
565
|
-
/**
|
|
566
|
-
* Attaches an int[] packet listener to the specified output_stream.
|
|
567
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
568
|
-
* std::vector<int> data from.
|
|
569
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
570
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
571
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
572
|
-
* should not perform overly complicated (or any async) behavior.
|
|
573
|
-
*/
|
|
574
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
575
|
-
/**
|
|
576
|
-
* Attaches a double packet listener to the specified output_stream.
|
|
577
|
-
* @param outputStreamName The name of the graph output stream to grab double
|
|
578
|
-
* data from.
|
|
579
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
580
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
581
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
582
|
-
* should not perform overly complicated (or any async) behavior.
|
|
583
|
-
*/
|
|
584
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
585
|
-
/**
|
|
586
|
-
* Attaches a double[] packet listener to the specified output_stream.
|
|
587
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
588
|
-
* std::vector<double> data from.
|
|
589
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
590
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
591
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
592
|
-
* should not perform overly complicated (or any async) behavior.
|
|
593
|
-
*/
|
|
594
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
595
|
-
/**
|
|
596
|
-
* Attaches a float packet listener to the specified output_stream.
|
|
597
|
-
* @param outputStreamName The name of the graph output stream to grab float
|
|
598
|
-
* data from.
|
|
599
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
600
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
601
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
602
|
-
* should not perform overly complicated (or any async) behavior.
|
|
603
|
-
*/
|
|
604
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
605
|
-
/**
|
|
606
|
-
* Attaches a float[] packet listener to the specified output_stream.
|
|
607
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
608
|
-
* std::vector<float> data from.
|
|
609
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
610
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
611
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
612
|
-
* should not perform overly complicated (or any async) behavior.
|
|
613
|
-
*/
|
|
614
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
615
|
-
/**
|
|
616
|
-
* Attaches a string packet listener to the specified output_stream.
|
|
617
|
-
* @param outputStreamName The name of the graph output stream to grab string
|
|
618
|
-
* data from.
|
|
619
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
620
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
621
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
622
|
-
* should not perform overly complicated (or any async) behavior.
|
|
623
|
-
*/
|
|
624
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
625
|
-
/**
|
|
626
|
-
* Attaches a string[] packet listener to the specified output_stream.
|
|
627
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
628
|
-
* std::vector<std::string> data from.
|
|
629
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
630
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
631
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
632
|
-
* should not perform overly complicated (or any async) behavior.
|
|
633
|
-
*/
|
|
634
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
635
|
-
/**
|
|
636
|
-
* Attaches a serialized proto packet listener to the specified output_stream.
|
|
637
|
-
* @param outputStreamName The name of the graph output stream to grab binary
|
|
638
|
-
* serialized proto data from (in Uint8Array format).
|
|
639
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
640
|
-
* it is received. Note that by default the data is only guaranteed to
|
|
641
|
-
* exist for the duration of the callback, and the callback will be called
|
|
642
|
-
* inline, so it should not perform overly complicated (or any async)
|
|
643
|
-
* behavior. If the proto data needs to be able to outlive the call, you
|
|
644
|
-
* may set the optional makeDeepCopy parameter to true, or can manually
|
|
645
|
-
* deep-copy the data yourself.
|
|
646
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
647
|
-
* will override the default memory management behavior and make a deep
|
|
648
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
649
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
650
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
651
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
652
|
-
* with it).
|
|
653
|
-
*/
|
|
654
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean): void;
|
|
655
|
-
/**
|
|
656
|
-
* Attaches a listener for an array of serialized proto packets to the
|
|
657
|
-
* specified output_stream.
|
|
658
|
-
* @param outputStreamName The name of the graph output stream to grab a
|
|
659
|
-
* vector of binary serialized proto data from (in Uint8Array[] format).
|
|
660
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
661
|
-
* it is received. Note that by default the data is only guaranteed to
|
|
662
|
-
* exist for the duration of the callback, and the callback will be called
|
|
663
|
-
* inline, so it should not perform overly complicated (or any async)
|
|
664
|
-
* behavior. If the proto data needs to be able to outlive the call, you
|
|
665
|
-
* may set the optional makeDeepCopy parameter to true, or can manually
|
|
666
|
-
* deep-copy the data yourself.
|
|
667
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
668
|
-
* will override the default memory management behavior and make a deep
|
|
669
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
670
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
671
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
672
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
673
|
-
* with it).
|
|
674
|
-
*/
|
|
675
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean): void;
|
|
676
|
-
/**
|
|
677
|
-
* Attaches an audio packet listener to the specified output_stream, to be
|
|
678
|
-
* given a Float32Array as output.
|
|
679
|
-
* @param outputStreamName The name of the graph output stream to grab audio
|
|
680
|
-
* data from.
|
|
681
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
682
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
683
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
684
|
-
* should not perform overly complicated (or any async) behavior. If the
|
|
685
|
-
* audio data needs to be able to outlive the call, you may set the
|
|
686
|
-
* optional makeDeepCopy parameter to true, or can manually deep-copy the
|
|
687
|
-
* data yourself.
|
|
688
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
689
|
-
* will override the default memory management behavior and make a deep
|
|
690
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
691
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
692
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
693
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
694
|
-
* with it).
|
|
695
|
-
*/
|
|
696
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean): void;
|
|
697
|
-
/**
|
|
698
|
-
* Forces all queued-up packets to be pushed through the MediaPipe graph as
|
|
699
|
-
* far as possible, performing all processing until no more processing can be
|
|
700
|
-
* done.
|
|
701
|
-
*/
|
|
702
|
-
finishProcessing(): void;
|
|
259
|
+
/** Base class for all MediaPipe Tasks. */
|
|
260
|
+
declare abstract class TaskRunner {
|
|
261
|
+
protected constructor();
|
|
262
|
+
/** Configures the task with custom options. */
|
|
263
|
+
abstract setOptions(options: TaskRunnerOptions): Promise<void>;
|
|
703
264
|
}
|
|
704
265
|
|
|
705
|
-
/**
|
|
706
|
-
|
|
707
|
-
*/
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
/** Base class for all MediaPipe Tasks. */
|
|
711
|
-
declare abstract class TaskRunner extends WasmMediaPipeImageLib {
|
|
712
|
-
private processingErrors;
|
|
713
|
-
/**
|
|
714
|
-
* Creates a new instance of a Mediapipe Task. Determines if SIMD is
|
|
715
|
-
* supported and loads the relevant WASM binary.
|
|
716
|
-
* @return A fully instantiated instance of `T`.
|
|
717
|
-
*/
|
|
718
|
-
protected static createInstance<T extends TaskRunner>(type: WasmMediaPipeConstructor<T>, initializeCanvas: boolean, fileset: WasmFileset): Promise<T>;
|
|
719
|
-
constructor(wasmModule: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
720
|
-
/**
|
|
721
|
-
* Takes the raw data from a MediaPipe graph, and passes it to C++ to be run
|
|
722
|
-
* over the video stream. Will replace the previously running MediaPipe graph,
|
|
723
|
-
* if there is one.
|
|
724
|
-
* @param graphData The raw MediaPipe graph data, either in binary
|
|
725
|
-
* protobuffer format (.binarypb), or else in raw text format (.pbtxt or
|
|
726
|
-
* .textproto).
|
|
727
|
-
* @param isBinary This should be set to true if the graph is in
|
|
728
|
-
* binary format, and false if it is in human-readable text format.
|
|
729
|
-
*/
|
|
730
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
731
|
-
/**
|
|
732
|
-
* Forces all queued-up packets to be pushed through the MediaPipe graph as
|
|
733
|
-
* far as possible, performing all processing until no more processing can be
|
|
734
|
-
* done.
|
|
735
|
-
*/
|
|
736
|
-
finishProcessing(): void;
|
|
737
|
-
/** Throws the error from the error listener if an error was raised. */
|
|
738
|
-
private handleErrors;
|
|
266
|
+
/** Options to configure MediaPipe Tasks in general. */
|
|
267
|
+
declare interface TaskRunnerOptions {
|
|
268
|
+
/** Options to configure the loading of the model assets. */
|
|
269
|
+
baseOptions?: BaseOptions_2;
|
|
739
270
|
}
|
|
740
271
|
|
|
741
272
|
/** Performs Natural Language classification. */
|
|
742
273
|
export declare class TextClassifier extends TaskRunner {
|
|
743
|
-
private classificationResult;
|
|
744
|
-
private readonly options;
|
|
745
274
|
/**
|
|
746
275
|
* Initializes the Wasm runtime and creates a new text classifier from the
|
|
747
276
|
* provided options.
|
|
@@ -768,6 +297,7 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
768
297
|
* @param modelAssetPath The path to the model asset.
|
|
769
298
|
*/
|
|
770
299
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextClassifier>;
|
|
300
|
+
private constructor();
|
|
771
301
|
/**
|
|
772
302
|
* Sets new options for the text classifier.
|
|
773
303
|
*
|
|
@@ -786,12 +316,10 @@ export declare class TextClassifier extends TaskRunner {
|
|
|
786
316
|
* @return The classification result of the text
|
|
787
317
|
*/
|
|
788
318
|
classify(text: string): TextClassifierResult;
|
|
789
|
-
/** Updates the MediaPipe graph configuration. */
|
|
790
|
-
private refreshGraph;
|
|
791
319
|
}
|
|
792
320
|
|
|
793
321
|
/** Options to configure the MediaPipe Text Classifier Task */
|
|
794
|
-
export declare interface TextClassifierOptions extends ClassifierOptions,
|
|
322
|
+
export declare interface TextClassifierOptions extends ClassifierOptions, TaskRunnerOptions {
|
|
795
323
|
}
|
|
796
324
|
|
|
797
325
|
/** Classification results of a model. */
|
|
@@ -814,8 +342,6 @@ export declare interface TextClassifierResult {
|
|
|
814
342
|
* Performs embedding extraction on text.
|
|
815
343
|
*/
|
|
816
344
|
export declare class TextEmbedder extends TaskRunner {
|
|
817
|
-
private embeddingResult;
|
|
818
|
-
private readonly options;
|
|
819
345
|
/**
|
|
820
346
|
* Initializes the Wasm runtime and creates a new text embedder from the
|
|
821
347
|
* provided options.
|
|
@@ -842,6 +368,7 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
842
368
|
* @param modelAssetPath The path to the TFLite model.
|
|
843
369
|
*/
|
|
844
370
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<TextEmbedder>;
|
|
371
|
+
private constructor();
|
|
845
372
|
/**
|
|
846
373
|
* Sets new options for the text embedder.
|
|
847
374
|
*
|
|
@@ -870,12 +397,10 @@ export declare class TextEmbedder extends TaskRunner {
|
|
|
870
397
|
* different sizes, or have an L2-norm of 0.
|
|
871
398
|
*/
|
|
872
399
|
static cosineSimilarity(u: Embedding, v: Embedding): number;
|
|
873
|
-
/** Updates the MediaPipe graph configuration. */
|
|
874
|
-
private refreshGraph;
|
|
875
400
|
}
|
|
876
401
|
|
|
877
402
|
/** Options to configure the MediaPipe Text Embedder Task */
|
|
878
|
-
export declare interface TextEmbedderOptions extends EmbedderOptions,
|
|
403
|
+
export declare interface TextEmbedderOptions extends EmbedderOptions, TaskRunnerOptions {
|
|
879
404
|
}
|
|
880
405
|
|
|
881
406
|
/** Embedding results for a given embedder model. */
|
|
@@ -896,12 +421,6 @@ export declare interface TextEmbedderResult {
|
|
|
896
421
|
timestampMs?: number;
|
|
897
422
|
}
|
|
898
423
|
|
|
899
|
-
/** The options for configuring a MediaPipe Text task. */
|
|
900
|
-
declare interface TextTaskOptions {
|
|
901
|
-
/** Options to configure the loading of the model assets. */
|
|
902
|
-
baseOptions?: BaseOptions;
|
|
903
|
-
}
|
|
904
|
-
|
|
905
424
|
/**
|
|
906
425
|
* Copyright 2022 The MediaPipe Authors. All Rights Reserved.
|
|
907
426
|
*
|
|
@@ -925,177 +444,4 @@ declare interface WasmFileset {
|
|
|
925
444
|
wasmBinaryPath: string;
|
|
926
445
|
}
|
|
927
446
|
|
|
928
|
-
/**
|
|
929
|
-
* Internal type of constructors used for initializing GraphRunner and
|
|
930
|
-
* subclasses.
|
|
931
|
-
*/
|
|
932
|
-
declare type WasmMediaPipeConstructor<LibType> = (new (module: WasmModule, canvas?: HTMLCanvasElement | OffscreenCanvas | null) => LibType);
|
|
933
|
-
|
|
934
|
-
declare const WasmMediaPipeImageLib: (new (...args: any[]) => {
|
|
935
|
-
registerModelResourcesGraphService(): void;
|
|
936
|
-
readonly wasmModule: WasmModule;
|
|
937
|
-
readonly hasMultiStreamSupport: boolean;
|
|
938
|
-
autoResizeCanvas: boolean;
|
|
939
|
-
audioPtr: number | null;
|
|
940
|
-
audioSize: number;
|
|
941
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
942
|
-
setGraphFromString(graphConfig: string): void;
|
|
943
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
944
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
945
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
946
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
947
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
948
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
949
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
950
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
951
|
-
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
952
|
-
setVectorListener<T_1>(outputStreamName: string, callbackFcn: (data: T_1[]) => void): void;
|
|
953
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
954
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
955
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
956
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
957
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
958
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
959
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
960
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
961
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
962
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
963
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
964
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
965
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
966
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
967
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
968
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
969
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
970
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
971
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
972
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
973
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
974
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
975
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
976
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
977
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
978
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
979
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
980
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
981
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
982
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
983
|
-
finishProcessing(): void;
|
|
984
|
-
}) & (new (...args: any[]) => {
|
|
985
|
-
addGpuBufferAsImageToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
986
|
-
readonly wasmModule: WasmModule;
|
|
987
|
-
readonly hasMultiStreamSupport: boolean;
|
|
988
|
-
autoResizeCanvas: boolean;
|
|
989
|
-
audioPtr: number | null;
|
|
990
|
-
audioSize: number;
|
|
991
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
992
|
-
setGraphFromString(graphConfig: string): void;
|
|
993
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
994
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
995
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
996
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
997
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
998
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
999
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
1000
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
1001
|
-
setListener<T_2>(outputStreamName: string, callbackFcn: (data: T_2) => void): void;
|
|
1002
|
-
setVectorListener<T_1_1>(outputStreamName: string, callbackFcn: (data: T_1_1[]) => void): void;
|
|
1003
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
1004
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
1005
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
1006
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
1007
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
1008
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
1009
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
1010
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
1011
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
1012
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
1013
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
1014
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
1015
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1016
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1017
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1018
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
1019
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
1020
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
1021
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
1022
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1023
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1024
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1025
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1026
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1027
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1028
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
1029
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
1030
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1031
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1032
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1033
|
-
finishProcessing(): void;
|
|
1034
|
-
}) & typeof GraphRunner;
|
|
1035
|
-
|
|
1036
|
-
/**
|
|
1037
|
-
* Declarations for Emscripten's WebAssembly Module behavior, so TS compiler
|
|
1038
|
-
* doesn't break our JS/C++ bridge.
|
|
1039
|
-
*/
|
|
1040
|
-
declare interface WasmModule {
|
|
1041
|
-
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
|
1042
|
-
HEAPU8: Uint8Array;
|
|
1043
|
-
HEAPU32: Uint32Array;
|
|
1044
|
-
HEAPF32: Float32Array;
|
|
1045
|
-
HEAPF64: Float64Array;
|
|
1046
|
-
errorListener?: ErrorListener;
|
|
1047
|
-
_bindTextureToCanvas: () => boolean;
|
|
1048
|
-
_changeBinaryGraph: (size: number, dataPtr: number) => void;
|
|
1049
|
-
_changeTextGraph: (size: number, dataPtr: number) => void;
|
|
1050
|
-
_free: (ptr: number) => void;
|
|
1051
|
-
_malloc: (size: number) => number;
|
|
1052
|
-
_processFrame: (width: number, height: number, timestamp: number) => void;
|
|
1053
|
-
_setAutoRenderToScreen: (enabled: boolean) => void;
|
|
1054
|
-
_waitUntilIdle: () => void;
|
|
1055
|
-
dataFileDownloads?: {
|
|
1056
|
-
[url: string]: {
|
|
1057
|
-
loaded: number;
|
|
1058
|
-
total: number;
|
|
1059
|
-
};
|
|
1060
|
-
};
|
|
1061
|
-
stringToNewUTF8: (data: string) => number;
|
|
1062
|
-
_bindTextureToStream: (streamNamePtr: number) => void;
|
|
1063
|
-
_addBoundTextureToStream: (streamNamePtr: number, width: number, height: number, timestamp: number) => void;
|
|
1064
|
-
_addBoolToInputStream: (data: boolean, streamNamePtr: number, timestamp: number) => void;
|
|
1065
|
-
_addDoubleToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1066
|
-
_addFloatToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1067
|
-
_addIntToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1068
|
-
_addStringToInputStream: (dataPtr: number, streamNamePtr: number, timestamp: number) => void;
|
|
1069
|
-
_addFlatHashMapToInputStream: (keysPtr: number, valuesPtr: number, count: number, streamNamePtr: number, timestamp: number) => void;
|
|
1070
|
-
_addProtoToInputStream: (dataPtr: number, dataSize: number, protoNamePtr: number, streamNamePtr: number, timestamp: number) => void;
|
|
1071
|
-
_addBoolToInputSidePacket: (data: boolean, streamNamePtr: number) => void;
|
|
1072
|
-
_addDoubleToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1073
|
-
_addFloatToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1074
|
-
_addIntToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1075
|
-
_addStringToInputSidePacket: (dataPtr: number, streamNamePtr: number) => void;
|
|
1076
|
-
_addProtoToInputSidePacket: (dataPtr: number, dataSize: number, protoNamePtr: number, streamNamePtr: number) => void;
|
|
1077
|
-
simpleListeners?: {
|
|
1078
|
-
[outputStreamName: string]: (data: unknown) => void;
|
|
1079
|
-
};
|
|
1080
|
-
vectorListeners?: {
|
|
1081
|
-
[outputStreamName: string]: (data: unknown, index: number, length: number) => void;
|
|
1082
|
-
};
|
|
1083
|
-
_attachBoolListener: (streamNamePtr: number) => void;
|
|
1084
|
-
_attachBoolVectorListener: (streamNamePtr: number) => void;
|
|
1085
|
-
_attachDoubleListener: (streamNamePtr: number) => void;
|
|
1086
|
-
_attachDoubleVectorListener: (streamNamePtr: number) => void;
|
|
1087
|
-
_attachFloatListener: (streamNamePtr: number) => void;
|
|
1088
|
-
_attachFloatVectorListener: (streamNamePtr: number) => void;
|
|
1089
|
-
_attachIntListener: (streamNamePtr: number) => void;
|
|
1090
|
-
_attachIntVectorListener: (streamNamePtr: number) => void;
|
|
1091
|
-
_attachStringListener: (streamNamePtr: number) => void;
|
|
1092
|
-
_attachStringVectorListener: (streamNamePtr: number) => void;
|
|
1093
|
-
_attachProtoListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1094
|
-
_attachProtoVectorListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1095
|
-
_attachAudioListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1096
|
-
_addAudioToInputStream: (dataPtr: number, numChannels: number, numSamples: number, streamNamePtr: number, timestamp: number) => void;
|
|
1097
|
-
_configureAudio: (channels: number, samples: number, sampleRate: number, streamNamePtr: number, headerNamePtr: number) => void;
|
|
1098
|
-
_processGl: (frameDataPtr: number) => number;
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
447
|
export { }
|