import { PipelineConfig } from './config-types'; import { LadonOutput, MaskGenerator } from './generator-types'; export declare class WorkerGenerator implements MaskGenerator { readonly config: PipelineConfig; private pending; private lastResult; private newMask; constructor(config: PipelineConfig); isLoaded(): boolean; getLadonOutput(): Promise; /** * Returns a promise that resolves when the worker returns the mask for the given timestamp. * This is useful for synchronizing the processing of frames with their corresponding masks. * The promise will be resolved with the mask data when it is available. * * @param timestamp - The timestamp of the frame for which the mask is requested. * @returns A promise that resolves with the mask data when available. */ getLadonOutputForTimestamp(timestamp: number): Promise; /** * Loads the worker and initializes it with the provided configuration. * The worker is responsible for processing the input image and generating the mask. * Prepares the worker configuration by resolving the final URLs and paths to send to the worker. * * @returns A promise that resolves when the worker is loaded and initialized. */ load(): Promise; /** * Sends the input image to the worker for processing. * The input image is expected to be a Uint8ClampedArray. * Claims ownership of the input tensor's buffer and forwards it to the worker. * * @param input - The input image as a Uint8ClampedArray. * @param timestamp - The timestamp of the input image. */ process(input: Uint8ClampedArray, timestamp: number): Promise; /** * Destroys the worker and cleans up resources. * First it sends a message to the worker to destroy itself, * then it waits for the worker to respond with a 'destroyed' message. * After that, it terminates the worker and revokes the URL if it exists. * * @returns A promise that resolves when the worker is destroyed. */ destroy(): Promise; }