import type { MediaPackager, PackagerSourceInfo } from '../media_packager.js';
import type { KvPair } from '../../moq/moqt.js';
import { type CMAFMediaType } from './cmaf_init_segment.js';
export declare const CMAF_PACKAGER_VERSION = "cmafpackaging-01(self-init)";
export interface CMAFPackagerOptions {
    initRepeatEveryMs?: number;
}
export declare class CMAFPackager implements MediaPackager {
    readonly mediaType: CMAFMediaType;
    private timestamp;
    private sourceTimescale;
    private codec;
    private config;
    private data;
    private isDelta;
    private codedWidth;
    private codedHeight;
    private chunkDurationUs;
    private startsGroup;
    private initSegment;
    private initConfig;
    private initSentAtUs;
    private sequenceNumber;
    private lastTimestamp;
    private mediaTimescale;
    private missingConfigWarned;
    private readonly initRepeatEveryUs;
    constructor(mediaType: CMAFMediaType, options?: CMAFPackagerOptions);
    SetData(timestamp: number | undefined, timescale: number | undefined, codec: string | undefined, config: Uint8Array | ArrayBuffer | undefined, data: any, isDelta: boolean | undefined): void;
    /**
     * Per-chunk extras that the LOC `SetData` shape has no room for: the coded
     * dimensions (needed by `tkhd` / the visual sample entry), the WebCodecs chunk
     * duration (needed by `trun`), and whether this chunk starts a MoQ group
     * (which is where the CMAF Header goes). All optional; see
     * `sampleDurationInSourceUnits` and `startsNewGroup` for the fallbacks.
     */
    SetSourceInfo(info: PackagerSourceInfo): void;
    IsDelta(): boolean | undefined;
    /** CMAF is self-describing: nothing rides the MoQ Object Properties. */
    Properties(): KvPair[];
    /** `[ftyp moov] styp moof mdat` for this chunk. */
    PayloadToBytes(): Uint8Array;
    GetDataStr(): string;
    private createChunk;
    /**
     * The CMAF Header to prepend to this object, or undefined when the subscriber
     * does not need a fresh copy yet (see `initRepeatEveryMs`).
     */
    private initSegmentToSend;
    private refreshInitSegment;
    private buildInitSegment;
    /**
     * Media (`mdhd`) timescale. Video keeps the WebCodecs microsecond timebase;
     * audio uses its sample rate, as CMAF recommends (23000-19 §7.5.13). It is
     * resolved once and cached: changing it mid-track would invalidate every
     * timestamp already sent.
     */
    private resolveMediaTimescale;
    /**
     * Timescale of the timestamps the caller passes in. There is no safe default:
     * guessing it would silently scale every timestamp in the stream.
     */
    private requireSourceTimescale;
    private toMediaTime;
    /**
     * Sample duration in source (WebCodecs, microsecond) units. WebCodecs always
     * reports a duration for audio, but frames captured from a camera often carry
     * none, so fall back to the interval since the previous chunk: a live stream
     * has no lookahead, which makes this the freshest estimate available. `tfdt`
     * stays exact either way, so an off-by-a-little duration only affects the
     * last sample of the stream.
     */
    private sampleDurationInSourceUnits;
}
//# sourceMappingURL=cmaf_packager.d.ts.map