/*! * 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 { type MaybePromise, VideoSamplePixelFormat, VideoSampleResource, VideoSampleColorSpace, SetRequired, VideoSampleInit, VideoSample, VideoDataPlane, VideoSampleTransformationDescription } from 'mediabunny'; import * as NodeAv from 'node-av'; /** * A custom `VideoSampleResource` backed by NodeAV's * [`Frame`](https://seydx.github.io/node-av/api/lib/classes/Frame.html), which in turn is backed by FFmpeg's * [`AVFrame`](https://ffmpeg.org/doxygen/2.7/structAVFrame.html). You can use this resource to create `VideoSample` * instances that are directly backed by FFmpeg's `AVFrame` without data having to be copied. Since `AVFrame`s can * themselves be backed by data on the GPU, this enables zero-copy hardware-accelerated decode and encode paths. * * When using Electron, you can directly create `Frame` instances without the data having to leave the GPU. For more, * see [NodeAV's docs](https://seydx.github.io/node-av/api/lib/classes/Frame.html). * * When passed, the `Frame` is now owned by resource, meaning it takes care of closing the frame later. If you want to * keep a copy for your own use, clone the frame first. * * @group \@mediabunny/server * @public */ export declare class AvFrameVideoSampleResource extends VideoSampleResource { /** * The NodeAV [`Frame`](https://seydx.github.io/node-av/api/lib/classes/Frame.html) instance backing this resource. * Access throws if the resource has already been closed. */ get frame(): NodeAv.Frame; constructor(frame: NodeAv.Frame); /** WebCodecs pixel format mapped from the underlying AvFrame, or `null` if unsupported. */ getFormat(): VideoSamplePixelFormat | null; /** Coded frame width in pixels (may differ from display width when SAR ≠ 1). */ getCodedWidth(): number; /** Coded frame height in pixels (may differ from display height when SAR ≠ 1). */ getCodedHeight(): number; /** Display width after applying the sample aspect ratio. */ getSquarePixelWidth(): number; /** Display height after applying the sample aspect ratio. */ getSquarePixelHeight(): number; /** Color space (primaries / transfer / matrix / full-range) of the underlying frame. */ getColorSpace(): VideoSampleColorSpace; /** Release the underlying AvFrame; after this call the resource is unusable. */ close(): void; /** Return one entry per plane (`data` + per-line `stride` in bytes). */ getDataPlanes(): MaybePromise; /** Convert the frame to a packed RGBA `VideoSample`. The `colorSpace` argument is currently unused. */ toRgbSample(init: SetRequired, colorSpace: PredefinedColorSpace): Promise; } export declare const applySampleColorToFrame: (sample: VideoSample, frame: NodeAv.Frame) => void; export declare const copyVideoSampleToAvFrame: (sample: VideoSample, frame: NodeAv.Frame, lastBuffer: Buffer | null) => Promise>; export declare const transformVideoSample: (sample: VideoSample, description: VideoSampleTransformationDescription) => Promise; //# sourceMappingURL=video-sample.d.ts.map