/*! * Copyright (c) 2026-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 { AudioSample, MaybePromise, VideoSample } from 'mediabunny'; import * as NodeAv from 'node-av'; /** * Options for configuring Mediabunny's server-side polyfills. * @group \@mediabunny/server * @public */ type MediabunnyServerOptions = { /** * The hardware context to use for hardware-accelerated decoding and encoding. When set to a * `NodeAv.HardwareContext`, that context is used directly. When set to a function, the function is invoked (with * no caching) every time a hardware decoder or encoder codec is resolved, receiving the codec ID and returning the * context to use for it (or `null` for no hardware acceleration). * * When not set, a context is automatically detected on first use and then cached. */ hardwareContext?: NodeAv.HardwareContext | null | ((codecId: NodeAv.AVCodecID) => MaybePromise); }; /** * Registers video and audio decoders and encoders for all codecs, using FFmpeg's libavcodec under the hood. * Additionally, a custom `VideoSample` transformer based on libavfilter is registered to enable resizing, rotation, * flipping and cropping of video frames. * * Make sure to call this function before interacting with Mediabunny. * * The decoders and encoders will automatically detect hardware acceleration support for each codec and platform and * make use of it if applicable. * * You can pass optional {@link MediabunnyServerOptions} for additional configuration. * * @group \@mediabunny/server * @public */ export declare const registerMediabunnyServer: (options?: MediabunnyServerOptions) => void; export type { MediabunnyServerOptions }; export { AvFrameVideoSampleResource } from './video-sample'; export { AvFrameAudioSampleResource } from './audio-sample'; export { NetworkSource } from './network-source'; export type { NetworkSourceOptions } from './network-source'; /** * Copies a `VideoSample` or `AudioSample` into the given NodeAV * [`Frame`](https://seydx.github.io/node-av/api/lib/classes/Frame.html), setting up the frame's format, media type, * timing and data. When the sample is already backed by an `AVFrame` (via `AvFrameVideoSampleResource` or * `AvFrameAudioSampleResource`), the frame is ref'd instead of copied for zero-copy reuse. * * For video samples, the frame's time base is always set to 1/1000000 (microsecond accuracy). For audio samples, the * frame's time base is always set to 1/sampleRate. * * @group \@mediabunny/server * @public */ export declare const toAvFrame: (sample: VideoSample | AudioSample, frame: NodeAv.Frame) => Promise; //# sourceMappingURL=index.d.ts.map