/** * Routines to parse the outer Network Access Layer, starting at the * byte stream format (Annex B) and ending at the containing SODB. * * @module */ import type BitReader from "./BitReader.js"; export declare enum NALUType { /** Coded slice of a non-IDR picture */ SLICE_NON_IDR = 1, /** Coded slice data partition A */ SLICE_PARTITION_A = 2, /** Coded slice data partition B */ SLICE_PARTITION_B = 3, /** Coded slice data partition C */ SLICE_PARTITION_C = 4, /** Coded slice of an IDR picture */ SLICE_IDR = 5, /** Supplemental enhancement information */ SEI = 6, /** Sequence parameter set */ SPS = 7, /** Picture parameter set */ PPS = 8, /** Access unit delimiter */ AUD = 9, /** End of sequence */ END_SEQ = 10, /** End of stream */ END_STREAM = 11, /** Filler data */ FILLER_DATA = 12, /** Sequence parameter set extension */ SPS_EXT = 13, /** Prefix NAL unit */ PREFIX_NALU = 14, /** Subset sequence parameter set */ SUBSET_SPS = 15, /** Depth parameter set */ DPS = 16, /** Coded slice of an auxiliary coded picture without partitioning */ SLICE_AUX = 19, /** Coded slice extension */ SLICE_EXT = 20, /** Coded slice extension for a depth view component or a 3D-AVC texture view component */ SLICE_LAYER_EXT = 21 } export declare const NALU_TYPE_UNSPEC_START = 24; /** * Parse the first byte of a NALU */ export declare const parseNALUPrefix: (octet: number) => { forbidden_zero_bit: number; nal_ref_idc: number; nal_unit_type: number; }; export interface RawNALU { forbidden_zero_bit: number; nal_ref_idc: number; nal_unit_type: number; extensions?: Uint8Array; rbsp: Uint8Array; } /** * Parse outer layer of a NALU * * Note: Subarrays are returned. Before further parsing, {@link decodeRBSP} should be used. */ export declare function parseNALU(nalu: Uint8Array): { rbsp: Uint8Array; forbidden_zero_bit: number; nal_ref_idc: number; nal_unit_type: number; }; /** * Decode (unescape) the RBSP part of a NALU, by removing `emulation_prevention_three_byte` * * Note: if passed, `out` is assumed to be large enough to hold result * @returns same array passed at `out` */ export declare function decodeRBSP(rbsp: Uint8Array, out?: Uint8Array): Uint8Array; /** * Slice the NALUs present in the supplied buffer, assuming it is already byte-aligned */ export declare function sliceNALUs(stream: Uint8Array, options?: { /** * if true, the returned array contains the leading chunk of data before the * first start code (possibly empty). if false, an error is thrown if this * chunk is empty (default: false) */ includeLeading?: boolean; }): Uint8Array[]; /** * validate the trailing bits (and EOF) of an RBSP */ export declare function validateRBSPTrailing(reader: BitReader): void; /** * check if we have reached the end of the SODB (trailing bits follow * immediately) or if there's more data */ export declare function moreRBSPData(reader: BitReader): boolean;