import type { LiveAudio, LiveVideo } from './types.js'; import { type AacConfig, type AvcConfig } from './flv.js'; /** A segment closed: its bytes, its media start and duration (seconds), and, when it opens a new init, that init. */ export type Cut = { /** the segment's number in its recording */ sequence: number; bytes: Uint8Array; start: number; duration: number; init?: { bytes: Uint8Array; video?: LiveVideo; audio?: LiveAudio; }; }; /** A stream the segmenter will not hold: its publish is ended with the reason (ingest.ts). */ export declare class LiveOverrun extends Error { } export declare class Segmenter { private readonly options; private avc?; private aac?; private meta; private freshInit; private video; private audio; private start?; private keyed; private audioNext?; private lastVideoDuration; private sequence; /** what the segment under way holds, and since when video has come with no keyframe to start on */ private bytes; private frames; private unkeyedSince?; constructor(options: { targetMs: number; offsetMs: number; firstSequence: number; }); /** The publisher's metadata (`onMetaData`): the size and rate a stream's SPS does not say, and whether video comes. */ metadata(meta: Record): void; videoConfig(config: AvcConfig): Cut[]; audioConfig(config: AacConfig): Cut[]; /** A video frame at its decode time: the segment it closes, if it closes one. */ videoFrame(timestamp: number, key: boolean, cts: number, data: Uint8Array): Cut[]; audioFrame(timestamp: number, data: Uint8Array): Cut[]; /** The segment under way, closed (the publish's end, or a configuration change). */ flush(): Cut[]; private keyframeCeiling; private noKeyframe; /** A frame the segment under way may still take, or the refusal past its ceilings. */ private within; private expectsVideo; private audioOnlyStarted; private cut; }