/** * An H.264 sync sample that is not an IDR frame cannot open a WebCodecs decode * session: Chrome rejects the chunk with "An EncodedVideoChunk was marked as * type key but wasn't a key frame" and emits no frames. Adding a recovery-point * SEI to the access unit declares it a valid entry point, which is enough for the * decoder to accept it and decode forward from there. * * The decoder demands an entry point for exactly one chunk, the first after * configure() or flush(), and putting the SEI on any other chunk misdescribes * the stream. KeyPacketRequirement is what tracks which chunk that is. */ /** * Width of the AVCC length prefix this track frames every NAL with, read from * its avcC record, or null when the description names no usable width. Files * carry 1, 2, and 4, so nothing downstream may assume one of them. */ export declare function nalPrefixWidth(description: VideoDecoderConfig["description"]): number | null; /** * Whether this access unit carries an IDR slice. * * A container's sync table names sync samples, and an H.264 sync sample is * usually an ordinary I picture rather than an IDR. The two differ in what a * decoder may assume about the pictures that follow: an IDR empties the * reference list, so nothing after it can name a picture from before it, while * an I picture leaves the list standing and the next reference frame is free to * name pictures the entry point never decoded. Only the IDR is an entry point * the bitstream cannot invalidate. * * Unreadable framing reads as not-IDR: the caller's fallback is to enter * further back, which costs a walk and is never wrong. */ export declare function isIdrAccessUnit(packetBytes: Uint8Array, prefixWidth: number): boolean; /** * The access unit as the chunk that opens a decode, carrying the recovery-point * SEI that makes it a legal entry point. * * Where the SEI goes is the whole of it: an access unit delimiter, when the * packet has one, is required to be the access unit's first NAL, so the SEI goes * behind it. Ahead of it the access unit is malformed, and a decoder reading the * opening chunk to decide whether it is really a key frame is entitled to say it * is not. */ export declare function openingKeyPacket(packetBytes: Uint8Array, prefixWidth: number): Uint8Array; /** * WebCodecs' standing demand for a key frame, which configure() and flush() * both arm and the next submitted chunk clears. */ export declare class KeyPacketRequirement { private readonly prefixWidth; private pending; constructor(prefixWidth: number); /** Whether the demand still stands, so the chunk about to satisfy it can * also be typed as the key chunk the decoder is waiting for. */ get armed(): boolean; /** Call after every configure() and flush(). */ rearm(): void; /** * Bytes to submit for the next packet in decode order, carrying the * recovery-point SEI while the demand stands. The container reports sync * samples, never IDR frames, so the SEI goes on without inspecting the * packet; ahead of a true IDR it is a NAL the decoder ignores. */ satisfy(packetBytes: Uint8Array): Uint8Array; }