/*! * Copyright (c) 2025-present, Vanilagy and contributors * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { AVCodecID } from 'node-av'; /** * Encodes video frames into encoded chunks. * * Corresponds to the WebCodecs VideoEncoder API. */ export declare class VideoEncoderPolyfill extends EventTarget { private init; private config; private codecContext; private mutex; private frame; private packet; private _encodeQueueSize; private currentConfigId; private chunkOutputted; private colorSpaceSet; private pendingFlushResolvers; private scaler; private lastScalerKey; private dstFrame; private _state; /** * The current state of the encoder: "unconfigured", "configured", or "closed". */ get state(): CodecState; /** * The number of pending encode operations. */ get encodeQueueSize(): number; /** * Event handler called when an encode operation completes and leaves the queue. */ ondequeue: ((this: VideoEncoder, ev: Event) => unknown) | null; /** * Creates a new VideoEncoder. */ constructor(init: VideoEncoderInit); private static createCodecContext; /** * Checks if the encoder can support the given configuration. */ static isConfigSupported(config: VideoEncoderConfig): Promise; /** * Configures the encoder with the given configuration. */ configure(config: VideoEncoderConfig): void; private configureInternal; /** * Queues a video frame to be encoded. */ encode(frame: VideoFrame, options?: VideoEncoderEncodeOptions): void; private outputChunk; private decrementQueue; lastBuffer: Buffer | null; private encodeInternal; /** * Flushes all pending encode operations and waits for completion. */ flush(): Promise; private flushInternal; /** * Closes the encoder and releases all resources. */ close(): void; /** * Resets the encoder to an unconfigured state. */ reset(): void; private handleAsyncError; } export declare const getDecentVideoBitrate: (codec: AVCodecID, width: number, height: number) => number;