@mediapipe/tasks-audio 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/audio.d.ts +15 -1134
- package/audio_bundle.js +1 -1
- package/package.json +1 -1
package/audio.d.ts
CHANGED
|
@@ -1,53 +1,5 @@
|
|
|
1
|
-
/// <reference types="@types/offscreencanvas" />
|
|
2
|
-
|
|
3
|
-
import * as jspb from 'google-protobuf';
|
|
4
|
-
|
|
5
|
-
declare class Acceleration extends jspb.Message {
|
|
6
|
-
hasXnnpack(): boolean;
|
|
7
|
-
clearXnnpack(): void;
|
|
8
|
-
getXnnpack(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack | undefined;
|
|
9
|
-
setXnnpack(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack): void;
|
|
10
|
-
|
|
11
|
-
hasGpu(): boolean;
|
|
12
|
-
clearGpu(): void;
|
|
13
|
-
getGpu(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu | undefined;
|
|
14
|
-
setGpu(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu): void;
|
|
15
|
-
|
|
16
|
-
hasTflite(): boolean;
|
|
17
|
-
clearTflite(): void;
|
|
18
|
-
getTflite(): mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite | undefined;
|
|
19
|
-
setTflite(value?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite): void;
|
|
20
|
-
|
|
21
|
-
getDelegateCase(): Acceleration.DelegateCase;
|
|
22
|
-
serializeBinary(): Uint8Array;
|
|
23
|
-
toObject(includeInstance?: boolean): Acceleration.AsObject;
|
|
24
|
-
static toObject(includeInstance: boolean, msg: Acceleration): Acceleration.AsObject;
|
|
25
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
26
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
27
|
-
static serializeBinaryToWriter(message: Acceleration, writer: jspb.BinaryWriter): void;
|
|
28
|
-
static deserializeBinary(bytes: Uint8Array): Acceleration;
|
|
29
|
-
static deserializeBinaryFromReader(message: Acceleration, reader: jspb.BinaryReader): Acceleration;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare namespace Acceleration {
|
|
33
|
-
type AsObject = {
|
|
34
|
-
xnnpack?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Xnnpack.AsObject,
|
|
35
|
-
gpu?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.Gpu.AsObject,
|
|
36
|
-
tflite?: mediapipe_calculators_tensor_inference_calculator_pb.InferenceCalculatorOptions.Delegate.TfLite.AsObject,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
enum DelegateCase {
|
|
40
|
-
DELEGATE_NOT_SET = 0,
|
|
41
|
-
XNNPACK = 1,
|
|
42
|
-
GPU = 2,
|
|
43
|
-
TFLITE = 4,
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
1
|
/** Performs audio classification. */
|
|
48
2
|
export declare class AudioClassifier extends AudioTaskRunner<AudioClassifierResult[]> {
|
|
49
|
-
private classificationResults;
|
|
50
|
-
private readonly options;
|
|
51
3
|
/**
|
|
52
4
|
* Initializes the Wasm runtime and creates a new audio classifier from the
|
|
53
5
|
* provided options.
|
|
@@ -74,8 +26,7 @@ export declare class AudioClassifier extends AudioTaskRunner<AudioClassifierResu
|
|
|
74
26
|
* @param modelAssetPath The path to the model asset.
|
|
75
27
|
*/
|
|
76
28
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<AudioClassifier>;
|
|
77
|
-
|
|
78
|
-
protected set baseOptions(proto: BaseOptions | undefined);
|
|
29
|
+
private constructor();
|
|
79
30
|
/**
|
|
80
31
|
* Sets new options for the audio classifier.
|
|
81
32
|
*
|
|
@@ -98,19 +49,10 @@ export declare class AudioClassifier extends AudioTaskRunner<AudioClassifierResu
|
|
|
98
49
|
* @return The classification result of the audio datas
|
|
99
50
|
*/
|
|
100
51
|
classify(audioData: Float32Array, sampleRate?: number): AudioClassifierResult[];
|
|
101
|
-
/** Sends an audio package to the graph and returns the classifications. */
|
|
102
|
-
protected process(audioData: Float32Array, sampleRate: number, timestampMs: number): AudioClassifierResult[];
|
|
103
|
-
/**
|
|
104
|
-
* Internal function for converting raw data into classification results, and
|
|
105
|
-
* adding them to our classfication results list.
|
|
106
|
-
**/
|
|
107
|
-
private addJsAudioClassificationResults;
|
|
108
|
-
/** Updates the MediaPipe graph configuration. */
|
|
109
|
-
private refreshGraph;
|
|
110
52
|
}
|
|
111
53
|
|
|
112
54
|
/** Options to configure the MediaPipe Audio Classifier Task */
|
|
113
|
-
export declare interface AudioClassifierOptions extends ClassifierOptions,
|
|
55
|
+
export declare interface AudioClassifierOptions extends ClassifierOptions, TaskRunnerOptions {
|
|
114
56
|
}
|
|
115
57
|
|
|
116
58
|
/** Classification results of a model. */
|
|
@@ -131,8 +73,6 @@ export declare interface AudioClassifierResult {
|
|
|
131
73
|
|
|
132
74
|
/** Performs embedding extraction on audio. */
|
|
133
75
|
export declare class AudioEmbedder extends AudioTaskRunner<AudioEmbedderResult[]> {
|
|
134
|
-
private embeddingResults;
|
|
135
|
-
private readonly options;
|
|
136
76
|
/**
|
|
137
77
|
* Initializes the Wasm runtime and creates a new audio embedder from the
|
|
138
78
|
* provided options.
|
|
@@ -159,8 +99,7 @@ export declare class AudioEmbedder extends AudioTaskRunner<AudioEmbedderResult[]
|
|
|
159
99
|
* @param modelAssetPath The path to the TFLite model.
|
|
160
100
|
*/
|
|
161
101
|
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string): Promise<AudioEmbedder>;
|
|
162
|
-
|
|
163
|
-
protected set baseOptions(proto: BaseOptions | undefined);
|
|
102
|
+
private constructor();
|
|
164
103
|
/**
|
|
165
104
|
* Sets new options for the audio embedder.
|
|
166
105
|
*
|
|
@@ -193,13 +132,10 @@ export declare class AudioEmbedder extends AudioTaskRunner<AudioEmbedderResult[]
|
|
|
193
132
|
* different sizes, or have an L2-norm of 0.
|
|
194
133
|
*/
|
|
195
134
|
static cosineSimilarity(u: Embedding, v: Embedding): number;
|
|
196
|
-
protected process(audioData: Float32Array, sampleRate: number, timestampMs: number): AudioEmbedderResult[];
|
|
197
|
-
/** Updates the MediaPipe graph configuration. */
|
|
198
|
-
private refreshGraph;
|
|
199
135
|
}
|
|
200
136
|
|
|
201
137
|
/** Options to configure the MediaPipe Audio Embedder Task */
|
|
202
|
-
export declare interface AudioEmbedderOptions extends EmbedderOptions,
|
|
138
|
+
export declare interface AudioEmbedderOptions extends EmbedderOptions, TaskRunnerOptions {
|
|
203
139
|
}
|
|
204
140
|
|
|
205
141
|
/** Embedding results for a given embedder model. */
|
|
@@ -220,18 +156,8 @@ export declare interface AudioEmbedderResult {
|
|
|
220
156
|
timestampMs?: number;
|
|
221
157
|
}
|
|
222
158
|
|
|
223
|
-
/** The options for configuring a MediaPipe Audio Task. */
|
|
224
|
-
declare interface AudioTaskOptions {
|
|
225
|
-
/** Options to configure the loading of the model assets. */
|
|
226
|
-
baseOptions?: BaseOptions_2;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
159
|
/** Base class for all MediaPipe Audio Tasks. */
|
|
230
160
|
declare abstract class AudioTaskRunner<T> extends TaskRunner {
|
|
231
|
-
protected abstract baseOptions?: BaseOptions | undefined;
|
|
232
|
-
private defaultSampleRate;
|
|
233
|
-
/** Configures the shared options of an audio task. */
|
|
234
|
-
setOptions(options: AudioTaskOptions): Promise<void>;
|
|
235
161
|
/**
|
|
236
162
|
* Sets the sample rate for API calls that omit an explicit sample rate.
|
|
237
163
|
* `48000` is used as a default if this method is not called.
|
|
@@ -239,44 +165,6 @@ declare abstract class AudioTaskRunner<T> extends TaskRunner {
|
|
|
239
165
|
* @param sampleRate A sample rate (e.g. `44100`).
|
|
240
166
|
*/
|
|
241
167
|
setDefaultSampleRate(sampleRate: number): void;
|
|
242
|
-
/** Sends an audio packet to the graph and awaits results. */
|
|
243
|
-
protected abstract process(audioData: Float32Array, sampleRate: number, timestampMs: number): T;
|
|
244
|
-
/** Sends a single audio clip to the graph and awaits results. */
|
|
245
|
-
protected processAudioClip(audioData: Float32Array, sampleRate?: number): T;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
declare class BaseOptions extends jspb.Message {
|
|
249
|
-
hasModelAsset(): boolean;
|
|
250
|
-
clearModelAsset(): void;
|
|
251
|
-
getModelAsset(): mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile | undefined;
|
|
252
|
-
setModelAsset(value?: mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile): void;
|
|
253
|
-
|
|
254
|
-
hasUseStreamMode(): boolean;
|
|
255
|
-
clearUseStreamMode(): void;
|
|
256
|
-
getUseStreamMode(): boolean | undefined;
|
|
257
|
-
setUseStreamMode(value: boolean): void;
|
|
258
|
-
|
|
259
|
-
hasAcceleration(): boolean;
|
|
260
|
-
clearAcceleration(): void;
|
|
261
|
-
getAcceleration(): mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration | undefined;
|
|
262
|
-
setAcceleration(value?: mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration): void;
|
|
263
|
-
|
|
264
|
-
serializeBinary(): Uint8Array;
|
|
265
|
-
toObject(includeInstance?: boolean): BaseOptions.AsObject;
|
|
266
|
-
static toObject(includeInstance: boolean, msg: BaseOptions): BaseOptions.AsObject;
|
|
267
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
268
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
269
|
-
static serializeBinaryToWriter(message: BaseOptions, writer: jspb.BinaryWriter): void;
|
|
270
|
-
static deserializeBinary(bytes: Uint8Array): BaseOptions;
|
|
271
|
-
static deserializeBinaryFromReader(message: BaseOptions, reader: jspb.BinaryReader): BaseOptions;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
declare namespace BaseOptions {
|
|
275
|
-
type AsObject = {
|
|
276
|
-
modelAsset?: mediapipe_tasks_cc_core_proto_external_file_pb.ExternalFile.AsObject,
|
|
277
|
-
useStreamMode?: boolean,
|
|
278
|
-
acceleration?: mediapipe_tasks_cc_core_proto_acceleration_pb.Acceleration.AsObject,
|
|
279
|
-
}
|
|
280
168
|
}
|
|
281
169
|
|
|
282
170
|
/**
|
|
@@ -294,7 +182,7 @@ declare namespace BaseOptions {
|
|
|
294
182
|
* See the License for the specific language governing permissions and
|
|
295
183
|
* limitations under the License.
|
|
296
184
|
*/
|
|
297
|
-
/** Options to configure MediaPipe
|
|
185
|
+
/** Options to configure MediaPipe model loading and processing. */
|
|
298
186
|
declare interface BaseOptions_2 {
|
|
299
187
|
/**
|
|
300
188
|
* The model path to the model asset file. Only one of `modelAssetPath` or
|
|
@@ -307,7 +195,7 @@ declare interface BaseOptions_2 {
|
|
|
307
195
|
*/
|
|
308
196
|
modelAssetBuffer?: Uint8Array | undefined;
|
|
309
197
|
/** Overrides the default backend to use for the provided model. */
|
|
310
|
-
delegate?:
|
|
198
|
+
delegate?: "CPU" | "GPU" | undefined;
|
|
311
199
|
}
|
|
312
200
|
|
|
313
201
|
/**
|
|
@@ -485,113 +373,6 @@ export declare interface Embedding {
|
|
|
485
373
|
headName: string;
|
|
486
374
|
}
|
|
487
375
|
|
|
488
|
-
/** A listener that will be invoked with an absl::StatusCode and message. */
|
|
489
|
-
declare type ErrorListener = (code: number, message: string) => void;
|
|
490
|
-
|
|
491
|
-
declare class ExternalFile extends jspb.Message {
|
|
492
|
-
hasFileContent(): boolean;
|
|
493
|
-
clearFileContent(): void;
|
|
494
|
-
getFileContent(): Uint8Array | string;
|
|
495
|
-
getFileContent_asU8(): Uint8Array;
|
|
496
|
-
getFileContent_asB64(): string;
|
|
497
|
-
setFileContent(value: Uint8Array | string): void;
|
|
498
|
-
|
|
499
|
-
hasFileName(): boolean;
|
|
500
|
-
clearFileName(): void;
|
|
501
|
-
getFileName(): string | undefined;
|
|
502
|
-
setFileName(value: string): void;
|
|
503
|
-
|
|
504
|
-
hasFileDescriptorMeta(): boolean;
|
|
505
|
-
clearFileDescriptorMeta(): void;
|
|
506
|
-
getFileDescriptorMeta(): FileDescriptorMeta | undefined;
|
|
507
|
-
setFileDescriptorMeta(value?: FileDescriptorMeta): void;
|
|
508
|
-
|
|
509
|
-
hasFilePointerMeta(): boolean;
|
|
510
|
-
clearFilePointerMeta(): void;
|
|
511
|
-
getFilePointerMeta(): FilePointerMeta | undefined;
|
|
512
|
-
setFilePointerMeta(value?: FilePointerMeta): void;
|
|
513
|
-
|
|
514
|
-
serializeBinary(): Uint8Array;
|
|
515
|
-
toObject(includeInstance?: boolean): ExternalFile.AsObject;
|
|
516
|
-
static toObject(includeInstance: boolean, msg: ExternalFile): ExternalFile.AsObject;
|
|
517
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
518
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
519
|
-
static serializeBinaryToWriter(message: ExternalFile, writer: jspb.BinaryWriter): void;
|
|
520
|
-
static deserializeBinary(bytes: Uint8Array): ExternalFile;
|
|
521
|
-
static deserializeBinaryFromReader(message: ExternalFile, reader: jspb.BinaryReader): ExternalFile;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
declare namespace ExternalFile {
|
|
525
|
-
type AsObject = {
|
|
526
|
-
fileContent: Uint8Array | string,
|
|
527
|
-
fileName?: string,
|
|
528
|
-
fileDescriptorMeta?: FileDescriptorMeta.AsObject,
|
|
529
|
-
filePointerMeta?: FilePointerMeta.AsObject,
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
declare class FileDescriptorMeta extends jspb.Message {
|
|
534
|
-
hasFd(): boolean;
|
|
535
|
-
clearFd(): void;
|
|
536
|
-
getFd(): number | undefined;
|
|
537
|
-
setFd(value: number): void;
|
|
538
|
-
|
|
539
|
-
hasLength(): boolean;
|
|
540
|
-
clearLength(): void;
|
|
541
|
-
getLength(): number | undefined;
|
|
542
|
-
setLength(value: number): void;
|
|
543
|
-
|
|
544
|
-
hasOffset(): boolean;
|
|
545
|
-
clearOffset(): void;
|
|
546
|
-
getOffset(): number | undefined;
|
|
547
|
-
setOffset(value: number): void;
|
|
548
|
-
|
|
549
|
-
serializeBinary(): Uint8Array;
|
|
550
|
-
toObject(includeInstance?: boolean): FileDescriptorMeta.AsObject;
|
|
551
|
-
static toObject(includeInstance: boolean, msg: FileDescriptorMeta): FileDescriptorMeta.AsObject;
|
|
552
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
553
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
554
|
-
static serializeBinaryToWriter(message: FileDescriptorMeta, writer: jspb.BinaryWriter): void;
|
|
555
|
-
static deserializeBinary(bytes: Uint8Array): FileDescriptorMeta;
|
|
556
|
-
static deserializeBinaryFromReader(message: FileDescriptorMeta, reader: jspb.BinaryReader): FileDescriptorMeta;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
declare namespace FileDescriptorMeta {
|
|
560
|
-
type AsObject = {
|
|
561
|
-
fd?: number,
|
|
562
|
-
length?: number,
|
|
563
|
-
offset?: number,
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
declare class FilePointerMeta extends jspb.Message {
|
|
568
|
-
hasPointer(): boolean;
|
|
569
|
-
clearPointer(): void;
|
|
570
|
-
getPointer(): number | undefined;
|
|
571
|
-
setPointer(value: number): void;
|
|
572
|
-
|
|
573
|
-
hasLength(): boolean;
|
|
574
|
-
clearLength(): void;
|
|
575
|
-
getLength(): number | undefined;
|
|
576
|
-
setLength(value: number): void;
|
|
577
|
-
|
|
578
|
-
serializeBinary(): Uint8Array;
|
|
579
|
-
toObject(includeInstance?: boolean): FilePointerMeta.AsObject;
|
|
580
|
-
static toObject(includeInstance: boolean, msg: FilePointerMeta): FilePointerMeta.AsObject;
|
|
581
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
582
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
583
|
-
static serializeBinaryToWriter(message: FilePointerMeta, writer: jspb.BinaryWriter): void;
|
|
584
|
-
static deserializeBinary(bytes: Uint8Array): FilePointerMeta;
|
|
585
|
-
static deserializeBinaryFromReader(message: FilePointerMeta, reader: jspb.BinaryReader): FilePointerMeta;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
declare namespace FilePointerMeta {
|
|
589
|
-
type AsObject = {
|
|
590
|
-
pointer?: number,
|
|
591
|
-
length?: number,
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
376
|
/**
|
|
596
377
|
* Resolves the files required for the MediaPipe Task APIs.
|
|
597
378
|
*
|
|
@@ -644,744 +425,17 @@ export declare class FilesetResolver {
|
|
|
644
425
|
static forVisionTasks(basePath?: string): Promise<WasmFileset>;
|
|
645
426
|
}
|
|
646
427
|
|
|
647
|
-
/**
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
*/
|
|
653
|
-
declare class GraphRunner {
|
|
654
|
-
readonly wasmModule: WasmModule;
|
|
655
|
-
readonly hasMultiStreamSupport: boolean;
|
|
656
|
-
autoResizeCanvas: boolean;
|
|
657
|
-
audioPtr: number | null;
|
|
658
|
-
audioSize: number;
|
|
659
|
-
/**
|
|
660
|
-
* Creates a new MediaPipe WASM module. Must be called *after* wasm Module has
|
|
661
|
-
* initialized. Note that we take control of the GL canvas from here on out,
|
|
662
|
-
* and will resize it to fit input.
|
|
663
|
-
*
|
|
664
|
-
* @param module The underlying Wasm Module to use.
|
|
665
|
-
* @param glCanvas The type of the GL canvas to use, or `null` if no GL
|
|
666
|
-
* canvas should be initialzed. Initializes an offscreen canvas if not
|
|
667
|
-
* provided.
|
|
668
|
-
*/
|
|
669
|
-
constructor(module: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
670
|
-
/**
|
|
671
|
-
* Convenience helper to load a MediaPipe graph from a file and pass it to
|
|
672
|
-
* setGraph.
|
|
673
|
-
* @param graphFile The url of the MediaPipe graph file to load.
|
|
674
|
-
*/
|
|
675
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
676
|
-
/**
|
|
677
|
-
* Convenience helper for calling setGraph with a string representing a text
|
|
678
|
-
* proto config.
|
|
679
|
-
* @param graphConfig The text proto graph config, expected to be a string in
|
|
680
|
-
* default JavaScript UTF-16 format.
|
|
681
|
-
*/
|
|
682
|
-
setGraphFromString(graphConfig: string): void;
|
|
683
|
-
/**
|
|
684
|
-
* Takes the raw data from a MediaPipe graph, and passes it to C++ to be run
|
|
685
|
-
* over the video stream. Will replace the previously running MediaPipe graph,
|
|
686
|
-
* if there is one.
|
|
687
|
-
* @param graphData The raw MediaPipe graph data, either in binary
|
|
688
|
-
* protobuffer format (.binarypb), or else in raw text format (.pbtxt or
|
|
689
|
-
* .textproto).
|
|
690
|
-
* @param isBinary This should be set to true if the graph is in
|
|
691
|
-
* binary format, and false if it is in human-readable text format.
|
|
692
|
-
*/
|
|
693
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
694
|
-
/**
|
|
695
|
-
* Configures the current graph to handle audio processing in a certain way
|
|
696
|
-
* for all its audio input streams. Additionally can configure audio headers
|
|
697
|
-
* (both input side packets as well as input stream headers), but these
|
|
698
|
-
* configurations only take effect if called before the graph is set/started.
|
|
699
|
-
* @param numChannels The number of channels of audio input. Only 1
|
|
700
|
-
* is supported for now.
|
|
701
|
-
* @param numSamples The number of samples that are taken in each
|
|
702
|
-
* audio capture.
|
|
703
|
-
* @param sampleRate The rate, in Hz, of the sampling.
|
|
704
|
-
* @param streamName The optional name of the input stream to additionally
|
|
705
|
-
* configure with audio information. This configuration only occurs before
|
|
706
|
-
* the graph is set/started. If unset, a default stream name will be used.
|
|
707
|
-
* @param headerName The optional name of the header input side packet to
|
|
708
|
-
* additionally configure with audio information. This configuration only
|
|
709
|
-
* occurs before the graph is set/started. If unset, a default header name
|
|
710
|
-
* will be used.
|
|
711
|
-
*/
|
|
712
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string, headerName?: string): void;
|
|
713
|
-
/**
|
|
714
|
-
* Allows disabling automatic canvas resizing, in case clients want to control
|
|
715
|
-
* control this.
|
|
716
|
-
* @param resize True will re-enable automatic canvas resizing, while false
|
|
717
|
-
* will disable the feature.
|
|
718
|
-
*/
|
|
719
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
720
|
-
/**
|
|
721
|
-
* Allows disabling the automatic render-to-screen code, in case clients don't
|
|
722
|
-
* need/want this. In particular, this removes the requirement for pipelines
|
|
723
|
-
* to have access to GPU resources, as well as the requirement for graphs to
|
|
724
|
-
* have "input_frames_gpu" and "output_frames_gpu" streams defined, so pure
|
|
725
|
-
* CPU pipelines and non-video pipelines can be created.
|
|
726
|
-
* NOTE: This only affects future graph initializations (via setGraph or
|
|
727
|
-
* initializeGraph), and does NOT affect the currently running graph, so
|
|
728
|
-
* calls to this should be made *before* setGraph/initializeGraph for the
|
|
729
|
-
* graph file being targeted.
|
|
730
|
-
* @param enabled True will re-enable automatic render-to-screen code and
|
|
731
|
-
* cause GPU resources to once again be requested, while false will
|
|
732
|
-
* disable the feature.
|
|
733
|
-
*/
|
|
734
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
735
|
-
/**
|
|
736
|
-
* Bind texture to our internal canvas, and upload image source to GPU.
|
|
737
|
-
* Returns tuple [width, height] of texture. Intended for internal usage.
|
|
738
|
-
*/
|
|
739
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number): [
|
|
740
|
-
number,
|
|
741
|
-
number
|
|
742
|
-
];
|
|
743
|
-
/**
|
|
744
|
-
* Takes the raw data from a JS image source, and sends it to C++ to be
|
|
745
|
-
* processed, waiting synchronously for the response. Note that we will resize
|
|
746
|
-
* our GL canvas to fit the input, so input size should only change
|
|
747
|
-
* infrequently.
|
|
748
|
-
* @param imageSource An image source to process.
|
|
749
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
750
|
-
* @return texture? The WebGL texture reference, if one was produced.
|
|
751
|
-
*/
|
|
752
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
753
|
-
/**
|
|
754
|
-
* Converts JavaScript string input parameters into C++ c-string pointers.
|
|
755
|
-
* See b/204830158 for more details. Intended for internal usage.
|
|
756
|
-
*/
|
|
757
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
758
|
-
/**
|
|
759
|
-
* Converts JavaScript string input parameters into C++ c-string pointers.
|
|
760
|
-
* See b/204830158 for more details.
|
|
761
|
-
*/
|
|
762
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
763
|
-
/**
|
|
764
|
-
* Ensures existence of the simple listeners table and registers the callback.
|
|
765
|
-
* Intended for internal usage.
|
|
766
|
-
*/
|
|
767
|
-
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
768
|
-
/**
|
|
769
|
-
* Ensures existence of the vector listeners table and registers the callback.
|
|
770
|
-
* Intended for internal usage.
|
|
771
|
-
*/
|
|
772
|
-
setVectorListener<T>(outputStreamName: string, callbackFcn: (data: T[]) => void): void;
|
|
773
|
-
/**
|
|
774
|
-
* Attaches a listener that will be invoked when the MediaPipe framework
|
|
775
|
-
* returns an error.
|
|
776
|
-
*/
|
|
777
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
778
|
-
/**
|
|
779
|
-
* Takes the raw data from a JS audio capture array, and sends it to C++ to be
|
|
780
|
-
* processed.
|
|
781
|
-
* @param audioData An array of raw audio capture data, like
|
|
782
|
-
* from a call to getChannelData on an AudioBuffer.
|
|
783
|
-
* @param streamName The name of the MediaPipe graph stream to add the audio
|
|
784
|
-
* data to.
|
|
785
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
786
|
-
*/
|
|
787
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
788
|
-
/**
|
|
789
|
-
* Takes the raw data from a JS audio capture array, and sends it to C++ to be
|
|
790
|
-
* processed, shaping the audioData array into an audio matrix according to
|
|
791
|
-
* the numChannels and numSamples parameters.
|
|
792
|
-
* @param audioData An array of raw audio capture data, like
|
|
793
|
-
* from a call to getChannelData on an AudioBuffer.
|
|
794
|
-
* @param numChannels The number of audio channels this data represents. If 0
|
|
795
|
-
* is passed, then the value will be taken from the last call to
|
|
796
|
-
* configureAudio.
|
|
797
|
-
* @param numSamples The number of audio samples captured in this data packet.
|
|
798
|
-
* If 0 is passed, then the value will be taken from the last call to
|
|
799
|
-
* configureAudio.
|
|
800
|
-
* @param streamName The name of the MediaPipe graph stream to add the audio
|
|
801
|
-
* data to.
|
|
802
|
-
* @param timestamp The timestamp of the current frame, in ms.
|
|
803
|
-
*/
|
|
804
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
805
|
-
/**
|
|
806
|
-
* Takes the relevant information from the HTML video or image element, and
|
|
807
|
-
* passes it into the WebGL-based graph for processing on the given stream at
|
|
808
|
-
* the given timestamp. Can be used for additional auxiliary GpuBuffer input
|
|
809
|
-
* streams. Processing will not occur until a blocking call (like
|
|
810
|
-
* processVideoGl or finishProcessing) is made. For use with
|
|
811
|
-
* 'gl_graph_runner_internal_multi_input'.
|
|
812
|
-
* @param imageSource Reference to the video frame we wish to add into our
|
|
813
|
-
* graph.
|
|
814
|
-
* @param streamName The name of the MediaPipe graph stream to add the frame
|
|
815
|
-
* to.
|
|
816
|
-
* @param timestamp The timestamp of the input frame, in ms.
|
|
817
|
-
*/
|
|
818
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
819
|
-
/**
|
|
820
|
-
* Sends a boolean packet into the specified stream at the given timestamp.
|
|
821
|
-
* @param data The boolean data to send.
|
|
822
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
823
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
824
|
-
*/
|
|
825
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
826
|
-
/**
|
|
827
|
-
* Sends a double packet into the specified stream at the given timestamp.
|
|
828
|
-
* @param data The double data to send.
|
|
829
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
830
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
831
|
-
*/
|
|
832
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
833
|
-
/**
|
|
834
|
-
* Sends a float packet into the specified stream at the given timestamp.
|
|
835
|
-
* @param data The float data to send.
|
|
836
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
837
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
838
|
-
*/
|
|
839
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
840
|
-
/**
|
|
841
|
-
* Sends an integer packet into the specified stream at the given timestamp.
|
|
842
|
-
* @param data The integer data to send.
|
|
843
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
844
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
845
|
-
*/
|
|
846
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
847
|
-
/**
|
|
848
|
-
* Sends a string packet into the specified stream at the given timestamp.
|
|
849
|
-
* @param data The string data to send.
|
|
850
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
851
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
852
|
-
*/
|
|
853
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
854
|
-
/**
|
|
855
|
-
* Sends a Record<string, string> packet into the specified stream at the
|
|
856
|
-
* given timestamp.
|
|
857
|
-
* @param data The records to send (will become a
|
|
858
|
-
* std::flat_hash_map<std::string, std::string).
|
|
859
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
860
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
861
|
-
*/
|
|
862
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
863
|
-
/**
|
|
864
|
-
* Sends a serialized protobuffer packet into the specified stream at the
|
|
865
|
-
* given timestamp, to be parsed into the specified protobuffer type.
|
|
866
|
-
* @param data The binary (serialized) raw protobuffer data.
|
|
867
|
-
* @param protoType The C++ namespaced type this protobuffer data corresponds
|
|
868
|
-
* to. It will be converted to this type when output as a packet into the
|
|
869
|
-
* graph.
|
|
870
|
-
* @param streamName The name of the graph input stream to send data into.
|
|
871
|
-
* @param timestamp The timestamp of the input data, in ms.
|
|
872
|
-
*/
|
|
873
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
874
|
-
/**
|
|
875
|
-
* Attaches a boolean packet to the specified input_side_packet.
|
|
876
|
-
* @param data The boolean data to send.
|
|
877
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
878
|
-
* into.
|
|
879
|
-
*/
|
|
880
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
881
|
-
/**
|
|
882
|
-
* Attaches a double packet to the specified input_side_packet.
|
|
883
|
-
* @param data The double data to send.
|
|
884
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
885
|
-
* into.
|
|
886
|
-
*/
|
|
887
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
888
|
-
/**
|
|
889
|
-
* Attaches a float packet to the specified input_side_packet.
|
|
890
|
-
* @param data The float data to send.
|
|
891
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
892
|
-
* into.
|
|
893
|
-
*/
|
|
894
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
895
|
-
/**
|
|
896
|
-
* Attaches a integer packet to the specified input_side_packet.
|
|
897
|
-
* @param data The integer data to send.
|
|
898
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
899
|
-
* into.
|
|
900
|
-
*/
|
|
901
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
902
|
-
/**
|
|
903
|
-
* Attaches a string packet to the specified input_side_packet.
|
|
904
|
-
* @param data The string data to send.
|
|
905
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
906
|
-
* into.
|
|
907
|
-
*/
|
|
908
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
909
|
-
/**
|
|
910
|
-
* Attaches a serialized proto packet to the specified input_side_packet.
|
|
911
|
-
* @param data The binary (serialized) raw protobuffer data.
|
|
912
|
-
* @param protoType The C++ namespaced type this protobuffer data corresponds
|
|
913
|
-
* to. It will be converted to this type for use in the graph.
|
|
914
|
-
* @param sidePacketName The name of the graph input side packet to send data
|
|
915
|
-
* into.
|
|
916
|
-
*/
|
|
917
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
918
|
-
/**
|
|
919
|
-
* Attaches a boolean packet listener to the specified output_stream.
|
|
920
|
-
* @param outputStreamName The name of the graph output stream to grab boolean
|
|
921
|
-
* data from.
|
|
922
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
923
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
924
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
925
|
-
* should not perform overly complicated (or any async) behavior.
|
|
926
|
-
*/
|
|
927
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
928
|
-
/**
|
|
929
|
-
* Attaches a bool[] packet listener to the specified output_stream.
|
|
930
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
931
|
-
* std::vector<bool> data from.
|
|
932
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
933
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
934
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
935
|
-
* should not perform overly complicated (or any async) behavior.
|
|
936
|
-
*/
|
|
937
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
938
|
-
/**
|
|
939
|
-
* Attaches an int packet listener to the specified output_stream.
|
|
940
|
-
* @param outputStreamName The name of the graph output stream to grab int
|
|
941
|
-
* data from.
|
|
942
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
943
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
944
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
945
|
-
* should not perform overly complicated (or any async) behavior.
|
|
946
|
-
*/
|
|
947
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
948
|
-
/**
|
|
949
|
-
* Attaches an int[] packet listener to the specified output_stream.
|
|
950
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
951
|
-
* std::vector<int> data from.
|
|
952
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
953
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
954
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
955
|
-
* should not perform overly complicated (or any async) behavior.
|
|
956
|
-
*/
|
|
957
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
958
|
-
/**
|
|
959
|
-
* Attaches a double packet listener to the specified output_stream.
|
|
960
|
-
* @param outputStreamName The name of the graph output stream to grab double
|
|
961
|
-
* data from.
|
|
962
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
963
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
964
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
965
|
-
* should not perform overly complicated (or any async) behavior.
|
|
966
|
-
*/
|
|
967
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
968
|
-
/**
|
|
969
|
-
* Attaches a double[] packet listener to the specified output_stream.
|
|
970
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
971
|
-
* std::vector<double> data from.
|
|
972
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
973
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
974
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
975
|
-
* should not perform overly complicated (or any async) behavior.
|
|
976
|
-
*/
|
|
977
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
978
|
-
/**
|
|
979
|
-
* Attaches a float packet listener to the specified output_stream.
|
|
980
|
-
* @param outputStreamName The name of the graph output stream to grab float
|
|
981
|
-
* data from.
|
|
982
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
983
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
984
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
985
|
-
* should not perform overly complicated (or any async) behavior.
|
|
986
|
-
*/
|
|
987
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
988
|
-
/**
|
|
989
|
-
* Attaches a float[] packet listener to the specified output_stream.
|
|
990
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
991
|
-
* std::vector<float> data from.
|
|
992
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
993
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
994
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
995
|
-
* should not perform overly complicated (or any async) behavior.
|
|
996
|
-
*/
|
|
997
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
998
|
-
/**
|
|
999
|
-
* Attaches a string packet listener to the specified output_stream.
|
|
1000
|
-
* @param outputStreamName The name of the graph output stream to grab string
|
|
1001
|
-
* data from.
|
|
1002
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
1003
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
1004
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
1005
|
-
* should not perform overly complicated (or any async) behavior.
|
|
1006
|
-
*/
|
|
1007
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
1008
|
-
/**
|
|
1009
|
-
* Attaches a string[] packet listener to the specified output_stream.
|
|
1010
|
-
* @param outputStreamName The name of the graph output stream to grab
|
|
1011
|
-
* std::vector<std::string> data from.
|
|
1012
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
1013
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
1014
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
1015
|
-
* should not perform overly complicated (or any async) behavior.
|
|
1016
|
-
*/
|
|
1017
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
1018
|
-
/**
|
|
1019
|
-
* Attaches a serialized proto packet listener to the specified output_stream.
|
|
1020
|
-
* @param outputStreamName The name of the graph output stream to grab binary
|
|
1021
|
-
* serialized proto data from (in Uint8Array format).
|
|
1022
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
1023
|
-
* it is received. Note that by default the data is only guaranteed to
|
|
1024
|
-
* exist for the duration of the callback, and the callback will be called
|
|
1025
|
-
* inline, so it should not perform overly complicated (or any async)
|
|
1026
|
-
* behavior. If the proto data needs to be able to outlive the call, you
|
|
1027
|
-
* may set the optional makeDeepCopy parameter to true, or can manually
|
|
1028
|
-
* deep-copy the data yourself.
|
|
1029
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
1030
|
-
* will override the default memory management behavior and make a deep
|
|
1031
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
1032
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
1033
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
1034
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
1035
|
-
* with it).
|
|
1036
|
-
*/
|
|
1037
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean): void;
|
|
1038
|
-
/**
|
|
1039
|
-
* Attaches a listener for an array of serialized proto packets to the
|
|
1040
|
-
* specified output_stream.
|
|
1041
|
-
* @param outputStreamName The name of the graph output stream to grab a
|
|
1042
|
-
* vector of binary serialized proto data from (in Uint8Array[] format).
|
|
1043
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
1044
|
-
* it is received. Note that by default the data is only guaranteed to
|
|
1045
|
-
* exist for the duration of the callback, and the callback will be called
|
|
1046
|
-
* inline, so it should not perform overly complicated (or any async)
|
|
1047
|
-
* behavior. If the proto data needs to be able to outlive the call, you
|
|
1048
|
-
* may set the optional makeDeepCopy parameter to true, or can manually
|
|
1049
|
-
* deep-copy the data yourself.
|
|
1050
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
1051
|
-
* will override the default memory management behavior and make a deep
|
|
1052
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
1053
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
1054
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
1055
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
1056
|
-
* with it).
|
|
1057
|
-
*/
|
|
1058
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean): void;
|
|
1059
|
-
/**
|
|
1060
|
-
* Attaches an audio packet listener to the specified output_stream, to be
|
|
1061
|
-
* given a Float32Array as output.
|
|
1062
|
-
* @param outputStreamName The name of the graph output stream to grab audio
|
|
1063
|
-
* data from.
|
|
1064
|
-
* @param callbackFcn The function that will be called back with the data, as
|
|
1065
|
-
* it is received. Note that the data is only guaranteed to exist for the
|
|
1066
|
-
* duration of the callback, and the callback will be called inline, so it
|
|
1067
|
-
* should not perform overly complicated (or any async) behavior. If the
|
|
1068
|
-
* audio data needs to be able to outlive the call, you may set the
|
|
1069
|
-
* optional makeDeepCopy parameter to true, or can manually deep-copy the
|
|
1070
|
-
* data yourself.
|
|
1071
|
-
* @param makeDeepCopy Optional convenience parameter which, if set to true,
|
|
1072
|
-
* will override the default memory management behavior and make a deep
|
|
1073
|
-
* copy of the underlying data, rather than just returning a view into the
|
|
1074
|
-
* C++-managed memory. At the cost of a data copy, this allows the
|
|
1075
|
-
* returned data to outlive the callback lifetime (and it will be cleaned
|
|
1076
|
-
* up automatically by JS garbage collection whenever the user is finished
|
|
1077
|
-
* with it).
|
|
1078
|
-
*/
|
|
1079
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean): void;
|
|
1080
|
-
/**
|
|
1081
|
-
* Forces all queued-up packets to be pushed through the MediaPipe graph as
|
|
1082
|
-
* far as possible, performing all processing until no more processing can be
|
|
1083
|
-
* done.
|
|
1084
|
-
*/
|
|
1085
|
-
finishProcessing(): void;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Valid types of image sources which we can run our GraphRunner over.
|
|
1090
|
-
*/
|
|
1091
|
-
declare type ImageSource = HTMLCanvasElement | HTMLVideoElement | HTMLImageElement | ImageData | ImageBitmap;
|
|
1092
|
-
|
|
1093
|
-
declare class InferenceCalculatorOptions extends jspb.Message {
|
|
1094
|
-
hasModelPath(): boolean;
|
|
1095
|
-
clearModelPath(): void;
|
|
1096
|
-
getModelPath(): string | undefined;
|
|
1097
|
-
setModelPath(value: string): void;
|
|
1098
|
-
|
|
1099
|
-
hasUseGpu(): boolean;
|
|
1100
|
-
clearUseGpu(): void;
|
|
1101
|
-
getUseGpu(): boolean | undefined;
|
|
1102
|
-
setUseGpu(value: boolean): void;
|
|
1103
|
-
|
|
1104
|
-
hasUseNnapi(): boolean;
|
|
1105
|
-
clearUseNnapi(): void;
|
|
1106
|
-
getUseNnapi(): boolean | undefined;
|
|
1107
|
-
setUseNnapi(value: boolean): void;
|
|
1108
|
-
|
|
1109
|
-
hasCpuNumThread(): boolean;
|
|
1110
|
-
clearCpuNumThread(): void;
|
|
1111
|
-
getCpuNumThread(): number | undefined;
|
|
1112
|
-
setCpuNumThread(value: number): void;
|
|
1113
|
-
|
|
1114
|
-
hasDelegate(): boolean;
|
|
1115
|
-
clearDelegate(): void;
|
|
1116
|
-
getDelegate(): InferenceCalculatorOptions.Delegate | undefined;
|
|
1117
|
-
setDelegate(value?: InferenceCalculatorOptions.Delegate): void;
|
|
1118
|
-
|
|
1119
|
-
serializeBinary(): Uint8Array;
|
|
1120
|
-
toObject(includeInstance?: boolean): InferenceCalculatorOptions.AsObject;
|
|
1121
|
-
static toObject(includeInstance: boolean, msg: InferenceCalculatorOptions): InferenceCalculatorOptions.AsObject;
|
|
1122
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1123
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1124
|
-
static serializeBinaryToWriter(message: InferenceCalculatorOptions, writer: jspb.BinaryWriter): void;
|
|
1125
|
-
static deserializeBinary(bytes: Uint8Array): InferenceCalculatorOptions;
|
|
1126
|
-
static deserializeBinaryFromReader(message: InferenceCalculatorOptions, reader: jspb.BinaryReader): InferenceCalculatorOptions;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
declare namespace InferenceCalculatorOptions {
|
|
1130
|
-
type AsObject = {
|
|
1131
|
-
modelPath?: string,
|
|
1132
|
-
useGpu?: boolean,
|
|
1133
|
-
useNnapi?: boolean,
|
|
1134
|
-
cpuNumThread?: number,
|
|
1135
|
-
delegate?: InferenceCalculatorOptions.Delegate.AsObject,
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
class Delegate extends jspb.Message {
|
|
1139
|
-
hasTflite(): boolean;
|
|
1140
|
-
clearTflite(): void;
|
|
1141
|
-
getTflite(): InferenceCalculatorOptions.Delegate.TfLite | undefined;
|
|
1142
|
-
setTflite(value?: InferenceCalculatorOptions.Delegate.TfLite): void;
|
|
1143
|
-
|
|
1144
|
-
hasGpu(): boolean;
|
|
1145
|
-
clearGpu(): void;
|
|
1146
|
-
getGpu(): InferenceCalculatorOptions.Delegate.Gpu | undefined;
|
|
1147
|
-
setGpu(value?: InferenceCalculatorOptions.Delegate.Gpu): void;
|
|
1148
|
-
|
|
1149
|
-
hasNnapi(): boolean;
|
|
1150
|
-
clearNnapi(): void;
|
|
1151
|
-
getNnapi(): InferenceCalculatorOptions.Delegate.Nnapi | undefined;
|
|
1152
|
-
setNnapi(value?: InferenceCalculatorOptions.Delegate.Nnapi): void;
|
|
1153
|
-
|
|
1154
|
-
hasXnnpack(): boolean;
|
|
1155
|
-
clearXnnpack(): void;
|
|
1156
|
-
getXnnpack(): InferenceCalculatorOptions.Delegate.Xnnpack | undefined;
|
|
1157
|
-
setXnnpack(value?: InferenceCalculatorOptions.Delegate.Xnnpack): void;
|
|
1158
|
-
|
|
1159
|
-
getDelegateCase(): Delegate.DelegateCase;
|
|
1160
|
-
serializeBinary(): Uint8Array;
|
|
1161
|
-
toObject(includeInstance?: boolean): Delegate.AsObject;
|
|
1162
|
-
static toObject(includeInstance: boolean, msg: Delegate): Delegate.AsObject;
|
|
1163
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1164
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1165
|
-
static serializeBinaryToWriter(message: Delegate, writer: jspb.BinaryWriter): void;
|
|
1166
|
-
static deserializeBinary(bytes: Uint8Array): Delegate;
|
|
1167
|
-
static deserializeBinaryFromReader(message: Delegate, reader: jspb.BinaryReader): Delegate;
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
namespace Delegate {
|
|
1171
|
-
type AsObject = {
|
|
1172
|
-
tflite?: InferenceCalculatorOptions.Delegate.TfLite.AsObject,
|
|
1173
|
-
gpu?: InferenceCalculatorOptions.Delegate.Gpu.AsObject,
|
|
1174
|
-
nnapi?: InferenceCalculatorOptions.Delegate.Nnapi.AsObject,
|
|
1175
|
-
xnnpack?: InferenceCalculatorOptions.Delegate.Xnnpack.AsObject,
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
class TfLite extends jspb.Message {
|
|
1179
|
-
serializeBinary(): Uint8Array;
|
|
1180
|
-
toObject(includeInstance?: boolean): TfLite.AsObject;
|
|
1181
|
-
static toObject(includeInstance: boolean, msg: TfLite): TfLite.AsObject;
|
|
1182
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1183
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1184
|
-
static serializeBinaryToWriter(message: TfLite, writer: jspb.BinaryWriter): void;
|
|
1185
|
-
static deserializeBinary(bytes: Uint8Array): TfLite;
|
|
1186
|
-
static deserializeBinaryFromReader(message: TfLite, reader: jspb.BinaryReader): TfLite;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
namespace TfLite {
|
|
1190
|
-
type AsObject = {
|
|
1191
|
-
}
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
class Gpu extends jspb.Message {
|
|
1195
|
-
hasUseAdvancedGpuApi(): boolean;
|
|
1196
|
-
clearUseAdvancedGpuApi(): void;
|
|
1197
|
-
getUseAdvancedGpuApi(): boolean | undefined;
|
|
1198
|
-
setUseAdvancedGpuApi(value: boolean): void;
|
|
1199
|
-
|
|
1200
|
-
hasApi(): boolean;
|
|
1201
|
-
clearApi(): void;
|
|
1202
|
-
getApi(): InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap] | undefined;
|
|
1203
|
-
setApi(value: InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap]): void;
|
|
1204
|
-
|
|
1205
|
-
hasAllowPrecisionLoss(): boolean;
|
|
1206
|
-
clearAllowPrecisionLoss(): void;
|
|
1207
|
-
getAllowPrecisionLoss(): boolean | undefined;
|
|
1208
|
-
setAllowPrecisionLoss(value: boolean): void;
|
|
1209
|
-
|
|
1210
|
-
hasCachedKernelPath(): boolean;
|
|
1211
|
-
clearCachedKernelPath(): void;
|
|
1212
|
-
getCachedKernelPath(): string | undefined;
|
|
1213
|
-
setCachedKernelPath(value: string): void;
|
|
1214
|
-
|
|
1215
|
-
hasSerializedModelDir(): boolean;
|
|
1216
|
-
clearSerializedModelDir(): void;
|
|
1217
|
-
getSerializedModelDir(): string | undefined;
|
|
1218
|
-
setSerializedModelDir(value: string): void;
|
|
1219
|
-
|
|
1220
|
-
hasModelToken(): boolean;
|
|
1221
|
-
clearModelToken(): void;
|
|
1222
|
-
getModelToken(): string | undefined;
|
|
1223
|
-
setModelToken(value: string): void;
|
|
1224
|
-
|
|
1225
|
-
hasUsage(): boolean;
|
|
1226
|
-
clearUsage(): void;
|
|
1227
|
-
getUsage(): InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap] | undefined;
|
|
1228
|
-
setUsage(value: InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap]): void;
|
|
1229
|
-
|
|
1230
|
-
serializeBinary(): Uint8Array;
|
|
1231
|
-
toObject(includeInstance?: boolean): Gpu.AsObject;
|
|
1232
|
-
static toObject(includeInstance: boolean, msg: Gpu): Gpu.AsObject;
|
|
1233
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1234
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1235
|
-
static serializeBinaryToWriter(message: Gpu, writer: jspb.BinaryWriter): void;
|
|
1236
|
-
static deserializeBinary(bytes: Uint8Array): Gpu;
|
|
1237
|
-
static deserializeBinaryFromReader(message: Gpu, reader: jspb.BinaryReader): Gpu;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
namespace Gpu {
|
|
1241
|
-
type AsObject = {
|
|
1242
|
-
useAdvancedGpuApi?: boolean,
|
|
1243
|
-
api?: InferenceCalculatorOptions.Delegate.Gpu.ApiMap[keyof InferenceCalculatorOptions.Delegate.Gpu.ApiMap],
|
|
1244
|
-
allowPrecisionLoss?: boolean,
|
|
1245
|
-
cachedKernelPath?: string,
|
|
1246
|
-
serializedModelDir?: string,
|
|
1247
|
-
modelToken?: string,
|
|
1248
|
-
usage?: InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap[keyof InferenceCalculatorOptions.Delegate.Gpu.InferenceUsageMap],
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
interface ApiMap {
|
|
1252
|
-
ANY: 0;
|
|
1253
|
-
OPENGL: 1;
|
|
1254
|
-
OPENCL: 2;
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
const Api: ApiMap;
|
|
1258
|
-
|
|
1259
|
-
interface InferenceUsageMap {
|
|
1260
|
-
UNSPECIFIED: 0;
|
|
1261
|
-
FAST_SINGLE_ANSWER: 1;
|
|
1262
|
-
SUSTAINED_SPEED: 2;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
const InferenceUsage: InferenceUsageMap;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
class Nnapi extends jspb.Message {
|
|
1269
|
-
hasCacheDir(): boolean;
|
|
1270
|
-
clearCacheDir(): void;
|
|
1271
|
-
getCacheDir(): string | undefined;
|
|
1272
|
-
setCacheDir(value: string): void;
|
|
1273
|
-
|
|
1274
|
-
hasModelToken(): boolean;
|
|
1275
|
-
clearModelToken(): void;
|
|
1276
|
-
getModelToken(): string | undefined;
|
|
1277
|
-
setModelToken(value: string): void;
|
|
1278
|
-
|
|
1279
|
-
hasAcceleratorName(): boolean;
|
|
1280
|
-
clearAcceleratorName(): void;
|
|
1281
|
-
getAcceleratorName(): string | undefined;
|
|
1282
|
-
setAcceleratorName(value: string): void;
|
|
1283
|
-
|
|
1284
|
-
serializeBinary(): Uint8Array;
|
|
1285
|
-
toObject(includeInstance?: boolean): Nnapi.AsObject;
|
|
1286
|
-
static toObject(includeInstance: boolean, msg: Nnapi): Nnapi.AsObject;
|
|
1287
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1288
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1289
|
-
static serializeBinaryToWriter(message: Nnapi, writer: jspb.BinaryWriter): void;
|
|
1290
|
-
static deserializeBinary(bytes: Uint8Array): Nnapi;
|
|
1291
|
-
static deserializeBinaryFromReader(message: Nnapi, reader: jspb.BinaryReader): Nnapi;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
namespace Nnapi {
|
|
1295
|
-
type AsObject = {
|
|
1296
|
-
cacheDir?: string,
|
|
1297
|
-
modelToken?: string,
|
|
1298
|
-
acceleratorName?: string,
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
class Xnnpack extends jspb.Message {
|
|
1303
|
-
hasNumThreads(): boolean;
|
|
1304
|
-
clearNumThreads(): void;
|
|
1305
|
-
getNumThreads(): number | undefined;
|
|
1306
|
-
setNumThreads(value: number): void;
|
|
1307
|
-
|
|
1308
|
-
serializeBinary(): Uint8Array;
|
|
1309
|
-
toObject(includeInstance?: boolean): Xnnpack.AsObject;
|
|
1310
|
-
static toObject(includeInstance: boolean, msg: Xnnpack): Xnnpack.AsObject;
|
|
1311
|
-
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
|
1312
|
-
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
|
1313
|
-
static serializeBinaryToWriter(message: Xnnpack, writer: jspb.BinaryWriter): void;
|
|
1314
|
-
static deserializeBinary(bytes: Uint8Array): Xnnpack;
|
|
1315
|
-
static deserializeBinaryFromReader(message: Xnnpack, reader: jspb.BinaryReader): Xnnpack;
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
namespace Xnnpack {
|
|
1319
|
-
type AsObject = {
|
|
1320
|
-
numThreads?: number,
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
enum DelegateCase {
|
|
1325
|
-
DELEGATE_NOT_SET = 0,
|
|
1326
|
-
TFLITE = 1,
|
|
1327
|
-
GPU = 2,
|
|
1328
|
-
NNAPI = 3,
|
|
1329
|
-
XNNPACK = 4,
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
const ext: jspb.ExtensionFieldInfo<InferenceCalculatorOptions>;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
declare namespace mediapipe_calculators_tensor_inference_calculator_pb {
|
|
1337
|
-
export {
|
|
1338
|
-
InferenceCalculatorOptions
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
declare namespace mediapipe_tasks_cc_core_proto_acceleration_pb {
|
|
1343
|
-
export {
|
|
1344
|
-
Acceleration
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
declare namespace mediapipe_tasks_cc_core_proto_external_file_pb {
|
|
1349
|
-
export {
|
|
1350
|
-
ExternalFile,
|
|
1351
|
-
FileDescriptorMeta,
|
|
1352
|
-
FilePointerMeta
|
|
1353
|
-
}
|
|
428
|
+
/** Base class for all MediaPipe Tasks. */
|
|
429
|
+
declare abstract class TaskRunner {
|
|
430
|
+
protected constructor();
|
|
431
|
+
/** Configures the task with custom options. */
|
|
432
|
+
abstract setOptions(options: TaskRunnerOptions): Promise<void>;
|
|
1354
433
|
}
|
|
1355
434
|
|
|
1356
|
-
/**
|
|
1357
|
-
declare
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
* Creates a new instance of a Mediapipe Task. Determines if SIMD is
|
|
1361
|
-
* supported and loads the relevant WASM binary.
|
|
1362
|
-
* @return A fully instantiated instance of `T`.
|
|
1363
|
-
*/
|
|
1364
|
-
protected static createInstance<T extends TaskRunner>(type: WasmMediaPipeConstructor<T>, initializeCanvas: boolean, fileset: WasmFileset): Promise<T>;
|
|
1365
|
-
constructor(wasmModule: WasmModule, glCanvas?: HTMLCanvasElement | OffscreenCanvas | null);
|
|
1366
|
-
/**
|
|
1367
|
-
* Takes the raw data from a MediaPipe graph, and passes it to C++ to be run
|
|
1368
|
-
* over the video stream. Will replace the previously running MediaPipe graph,
|
|
1369
|
-
* if there is one.
|
|
1370
|
-
* @param graphData The raw MediaPipe graph data, either in binary
|
|
1371
|
-
* protobuffer format (.binarypb), or else in raw text format (.pbtxt or
|
|
1372
|
-
* .textproto).
|
|
1373
|
-
* @param isBinary This should be set to true if the graph is in
|
|
1374
|
-
* binary format, and false if it is in human-readable text format.
|
|
1375
|
-
*/
|
|
1376
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
1377
|
-
/**
|
|
1378
|
-
* Forces all queued-up packets to be pushed through the MediaPipe graph as
|
|
1379
|
-
* far as possible, performing all processing until no more processing can be
|
|
1380
|
-
* done.
|
|
1381
|
-
*/
|
|
1382
|
-
finishProcessing(): void;
|
|
1383
|
-
/** Throws the error from the error listener if an error was raised. */
|
|
1384
|
-
private handleErrors;
|
|
435
|
+
/** Options to configure MediaPipe Tasks in general. */
|
|
436
|
+
declare interface TaskRunnerOptions {
|
|
437
|
+
/** Options to configure the loading of the model assets. */
|
|
438
|
+
baseOptions?: BaseOptions_2;
|
|
1385
439
|
}
|
|
1386
440
|
|
|
1387
441
|
/**
|
|
@@ -1407,177 +461,4 @@ declare interface WasmFileset {
|
|
|
1407
461
|
wasmBinaryPath: string;
|
|
1408
462
|
}
|
|
1409
463
|
|
|
1410
|
-
/**
|
|
1411
|
-
* Internal type of constructors used for initializing GraphRunner and
|
|
1412
|
-
* subclasses.
|
|
1413
|
-
*/
|
|
1414
|
-
declare type WasmMediaPipeConstructor<LibType> = (new (module: WasmModule, canvas?: HTMLCanvasElement | OffscreenCanvas | null) => LibType);
|
|
1415
|
-
|
|
1416
|
-
declare const WasmMediaPipeImageLib: (new (...args: any[]) => {
|
|
1417
|
-
registerModelResourcesGraphService(): void;
|
|
1418
|
-
readonly wasmModule: WasmModule;
|
|
1419
|
-
readonly hasMultiStreamSupport: boolean;
|
|
1420
|
-
autoResizeCanvas: boolean;
|
|
1421
|
-
audioPtr: number | null;
|
|
1422
|
-
audioSize: number;
|
|
1423
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
1424
|
-
setGraphFromString(graphConfig: string): void;
|
|
1425
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
1426
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
1427
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
1428
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
1429
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
1430
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
1431
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
1432
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
1433
|
-
setListener<T>(outputStreamName: string, callbackFcn: (data: T) => void): void;
|
|
1434
|
-
setVectorListener<T_1>(outputStreamName: string, callbackFcn: (data: T_1[]) => void): void;
|
|
1435
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
1436
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
1437
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
1438
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
1439
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
1440
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
1441
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
1442
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
1443
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
1444
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
1445
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
1446
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
1447
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1448
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1449
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1450
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
1451
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
1452
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
1453
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
1454
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1455
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1456
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1457
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1458
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1459
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1460
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
1461
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
1462
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1463
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1464
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1465
|
-
finishProcessing(): void;
|
|
1466
|
-
}) & (new (...args: any[]) => {
|
|
1467
|
-
addGpuBufferAsImageToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
1468
|
-
readonly wasmModule: WasmModule;
|
|
1469
|
-
readonly hasMultiStreamSupport: boolean;
|
|
1470
|
-
autoResizeCanvas: boolean;
|
|
1471
|
-
audioPtr: number | null;
|
|
1472
|
-
audioSize: number;
|
|
1473
|
-
initializeGraph(graphFile: string): Promise<void>;
|
|
1474
|
-
setGraphFromString(graphConfig: string): void;
|
|
1475
|
-
setGraph(graphData: Uint8Array, isBinary: boolean): void;
|
|
1476
|
-
configureAudio(numChannels: number, numSamples: number, sampleRate: number, streamName?: string | undefined, headerName?: string | undefined): void;
|
|
1477
|
-
setAutoResizeCanvas(resize: boolean): void;
|
|
1478
|
-
setAutoRenderToScreen(enabled: boolean): void;
|
|
1479
|
-
bindTextureToStream(imageSource: ImageSource, streamNamePtr?: number | undefined): [number, number];
|
|
1480
|
-
processGl(imageSource: ImageSource, timestamp: number): WebGLTexture | undefined;
|
|
1481
|
-
wrapStringPtr(stringData: string, stringPtrFunc: (ptr: number) => void): void;
|
|
1482
|
-
wrapStringPtrPtr(stringData: string[], ptrFunc: (ptr: number) => void): void;
|
|
1483
|
-
setListener<T_2>(outputStreamName: string, callbackFcn: (data: T_2) => void): void;
|
|
1484
|
-
setVectorListener<T_1_1>(outputStreamName: string, callbackFcn: (data: T_1_1[]) => void): void;
|
|
1485
|
-
attachErrorListener(callbackFcn: (code: number, message: string) => void): void;
|
|
1486
|
-
addAudioToStream(audioData: Float32Array, streamName: string, timestamp: number): void;
|
|
1487
|
-
addAudioToStreamWithShape(audioData: Float32Array, numChannels: number, numSamples: number, streamName: string, timestamp: number): void;
|
|
1488
|
-
addGpuBufferToStream(imageSource: ImageSource, streamName: string, timestamp: number): void;
|
|
1489
|
-
addBoolToStream(data: boolean, streamName: string, timestamp: number): void;
|
|
1490
|
-
addDoubleToStream(data: number, streamName: string, timestamp: number): void;
|
|
1491
|
-
addFloatToStream(data: number, streamName: string, timestamp: number): void;
|
|
1492
|
-
addIntToStream(data: number, streamName: string, timestamp: number): void;
|
|
1493
|
-
addStringToStream(data: string, streamName: string, timestamp: number): void;
|
|
1494
|
-
addStringRecordToStream(data: Record<string, string>, streamName: string, timestamp: number): void;
|
|
1495
|
-
addProtoToStream(data: Uint8Array, protoType: string, streamName: string, timestamp: number): void;
|
|
1496
|
-
addBoolToInputSidePacket(data: boolean, sidePacketName: string): void;
|
|
1497
|
-
addDoubleToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1498
|
-
addFloatToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1499
|
-
addIntToInputSidePacket(data: number, sidePacketName: string): void;
|
|
1500
|
-
addStringToInputSidePacket(data: string, sidePacketName: string): void;
|
|
1501
|
-
addProtoToInputSidePacket(data: Uint8Array, protoType: string, sidePacketName: string): void;
|
|
1502
|
-
attachBoolListener(outputStreamName: string, callbackFcn: (data: boolean) => void): void;
|
|
1503
|
-
attachBoolVectorListener(outputStreamName: string, callbackFcn: (data: boolean[]) => void): void;
|
|
1504
|
-
attachIntListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1505
|
-
attachIntVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1506
|
-
attachDoubleListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1507
|
-
attachDoubleVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1508
|
-
attachFloatListener(outputStreamName: string, callbackFcn: (data: number) => void): void;
|
|
1509
|
-
attachFloatVectorListener(outputStreamName: string, callbackFcn: (data: number[]) => void): void;
|
|
1510
|
-
attachStringListener(outputStreamName: string, callbackFcn: (data: string) => void): void;
|
|
1511
|
-
attachStringVectorListener(outputStreamName: string, callbackFcn: (data: string[]) => void): void;
|
|
1512
|
-
attachProtoListener(outputStreamName: string, callbackFcn: (data: Uint8Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1513
|
-
attachProtoVectorListener(outputStreamName: string, callbackFcn: (data: Uint8Array[]) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1514
|
-
attachAudioListener(outputStreamName: string, callbackFcn: (data: Float32Array) => void, makeDeepCopy?: boolean | undefined): void;
|
|
1515
|
-
finishProcessing(): void;
|
|
1516
|
-
}) & typeof GraphRunner;
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* Declarations for Emscripten's WebAssembly Module behavior, so TS compiler
|
|
1520
|
-
* doesn't break our JS/C++ bridge.
|
|
1521
|
-
*/
|
|
1522
|
-
declare interface WasmModule {
|
|
1523
|
-
canvas: HTMLCanvasElement | OffscreenCanvas | null;
|
|
1524
|
-
HEAPU8: Uint8Array;
|
|
1525
|
-
HEAPU32: Uint32Array;
|
|
1526
|
-
HEAPF32: Float32Array;
|
|
1527
|
-
HEAPF64: Float64Array;
|
|
1528
|
-
errorListener?: ErrorListener;
|
|
1529
|
-
_bindTextureToCanvas: () => boolean;
|
|
1530
|
-
_changeBinaryGraph: (size: number, dataPtr: number) => void;
|
|
1531
|
-
_changeTextGraph: (size: number, dataPtr: number) => void;
|
|
1532
|
-
_free: (ptr: number) => void;
|
|
1533
|
-
_malloc: (size: number) => number;
|
|
1534
|
-
_processFrame: (width: number, height: number, timestamp: number) => void;
|
|
1535
|
-
_setAutoRenderToScreen: (enabled: boolean) => void;
|
|
1536
|
-
_waitUntilIdle: () => void;
|
|
1537
|
-
dataFileDownloads?: {
|
|
1538
|
-
[url: string]: {
|
|
1539
|
-
loaded: number;
|
|
1540
|
-
total: number;
|
|
1541
|
-
};
|
|
1542
|
-
};
|
|
1543
|
-
stringToNewUTF8: (data: string) => number;
|
|
1544
|
-
_bindTextureToStream: (streamNamePtr: number) => void;
|
|
1545
|
-
_addBoundTextureToStream: (streamNamePtr: number, width: number, height: number, timestamp: number) => void;
|
|
1546
|
-
_addBoolToInputStream: (data: boolean, streamNamePtr: number, timestamp: number) => void;
|
|
1547
|
-
_addDoubleToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1548
|
-
_addFloatToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1549
|
-
_addIntToInputStream: (data: number, streamNamePtr: number, timestamp: number) => void;
|
|
1550
|
-
_addStringToInputStream: (dataPtr: number, streamNamePtr: number, timestamp: number) => void;
|
|
1551
|
-
_addFlatHashMapToInputStream: (keysPtr: number, valuesPtr: number, count: number, streamNamePtr: number, timestamp: number) => void;
|
|
1552
|
-
_addProtoToInputStream: (dataPtr: number, dataSize: number, protoNamePtr: number, streamNamePtr: number, timestamp: number) => void;
|
|
1553
|
-
_addBoolToInputSidePacket: (data: boolean, streamNamePtr: number) => void;
|
|
1554
|
-
_addDoubleToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1555
|
-
_addFloatToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1556
|
-
_addIntToInputSidePacket: (data: number, streamNamePtr: number) => void;
|
|
1557
|
-
_addStringToInputSidePacket: (dataPtr: number, streamNamePtr: number) => void;
|
|
1558
|
-
_addProtoToInputSidePacket: (dataPtr: number, dataSize: number, protoNamePtr: number, streamNamePtr: number) => void;
|
|
1559
|
-
simpleListeners?: {
|
|
1560
|
-
[outputStreamName: string]: (data: unknown) => void;
|
|
1561
|
-
};
|
|
1562
|
-
vectorListeners?: {
|
|
1563
|
-
[outputStreamName: string]: (data: unknown, index: number, length: number) => void;
|
|
1564
|
-
};
|
|
1565
|
-
_attachBoolListener: (streamNamePtr: number) => void;
|
|
1566
|
-
_attachBoolVectorListener: (streamNamePtr: number) => void;
|
|
1567
|
-
_attachDoubleListener: (streamNamePtr: number) => void;
|
|
1568
|
-
_attachDoubleVectorListener: (streamNamePtr: number) => void;
|
|
1569
|
-
_attachFloatListener: (streamNamePtr: number) => void;
|
|
1570
|
-
_attachFloatVectorListener: (streamNamePtr: number) => void;
|
|
1571
|
-
_attachIntListener: (streamNamePtr: number) => void;
|
|
1572
|
-
_attachIntVectorListener: (streamNamePtr: number) => void;
|
|
1573
|
-
_attachStringListener: (streamNamePtr: number) => void;
|
|
1574
|
-
_attachStringVectorListener: (streamNamePtr: number) => void;
|
|
1575
|
-
_attachProtoListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1576
|
-
_attachProtoVectorListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1577
|
-
_attachAudioListener: (streamNamePtr: number, makeDeepCopy?: boolean) => void;
|
|
1578
|
-
_addAudioToInputStream: (dataPtr: number, numChannels: number, numSamples: number, streamNamePtr: number, timestamp: number) => void;
|
|
1579
|
-
_configureAudio: (channels: number, samples: number, sampleRate: number, streamNamePtr: number, headerNamePtr: number) => void;
|
|
1580
|
-
_processGl: (frameDataPtr: number) => number;
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
464
|
export { }
|