/** @packageDocumentation EBML element parsing and writing utilities for Matroska files. */ import { ByteVector } from "../../byteVector.js"; import { IOStream } from "../../toolkit/ioStream.js"; /** * EBML Element IDs used in Matroska files. */ export declare enum EbmlId { EBMLHeader = 440786851, DocType = 17026, DocTypeVersion = 17031, VoidElement = 236, Segment = 408125543, SeekHead = 290298740, Seek = 19899, SeekID = 21419, SeekPosition = 21420, Info = 357149030, TimestampScale = 2807729, Duration = 17545, Title = 31657, Tracks = 374648427, TrackEntry = 174, TrackType = 131, CodecID = 134, Audio = 225, SamplingFrequency = 181, Channels = 159, BitDepth = 25188, Tags = 307544935, Tag = 29555, Targets = 25536, TargetTypeValue = 26826, TagTrackUID = 25541, TagEditionUID = 25545, TagChapterUID = 25540, TagAttachmentUID = 25542, SimpleTag = 26568, TagName = 17827, TagString = 17543, TagLanguage = 17530, TagBinary = 17541, TagLanguageDefault = 17540, Attachments = 423732329, AttachedFile = 24999, AttachedFileDescription = 18046, AttachedFileName = 18030, AttachedFileMediaType = 18016, AttachedFileData = 18012, AttachedFileUID = 18094, Cluster = 524531317, Cues = 475249515 } /** * Returns the byte length of an EBML element ID. */ export declare function idSize(id: number): number; /** * Determine the VINT size length from the first byte. * The number of leading zeros in the first byte indicates extra bytes. * maxSizeLength limits how many bytes are allowed (4 for IDs, 8 for sizes). */ export declare function vintSizeLength(firstByte: number, maxSizeLength: number): number; /** * Read an element ID from a stream. Returns [id, bytesRead] or [0, 0] on failure. */ export declare function readElementId(stream: IOStream): Promise<[number, number]>; /** * Read a VINT (variable-length integer) from a stream. * Returns [sizeLength, value] or [0, 0] on failure. * The VINT marker bit is masked off to get the actual data value. */ export declare function readVint(stream: IOStream): Promise<[number, number]>; /** An EBML element header parsed from a stream. */ export interface EbmlElement { id: number; dataSize: number; /** Total header size (id bytes + size bytes). */ headSize: number; /** Offset where the element header starts in the stream. */ offset: number; } /** * Read the next EBML element header from the stream. * Returns null on failure. */ export declare function readElement(stream: IOStream): Promise; /** * Skip an element's data in the stream. */ export declare function skipElement(stream: IOStream, element: EbmlElement): Promise; /** * Find a specific element by ID within a range. Skips unmatched elements. */ export declare function findElement(stream: IOStream, targetId: number, maxOffset: number): Promise; /** * Read all child elements within a master element's data range. */ export declare function readChildElements(stream: IOStream, parentDataOffset: number, parentDataSize: number): Promise; /** * Read the raw data of an element from the stream. */ export declare function readElementData(stream: IOStream, element: EbmlElement): Promise; /** * Read an unsigned integer element value (1-8 bytes, big-endian). */ export declare function readUintValue(stream: IOStream, element: EbmlElement): Promise; /** * Read a float element value (4 or 8 bytes, big-endian IEEE 754). */ export declare function readFloatValue(stream: IOStream, element: EbmlElement): Promise; /** * Read a UTF-8 string element value. */ export declare function readStringValue(stream: IOStream, element: EbmlElement): Promise; /** * Concatenate multiple ByteVectors into one. */ export declare function combineByteVectors(parts: ByteVector[]): ByteVector; /** * Encode an EBML element ID as bytes (big-endian, already contains marker bits). */ export declare function encodeId(id: number): ByteVector; /** * Encode a VINT (variable-length integer) for EBML element sizes. * The minimum size is used unless minBytes is specified. */ export declare function encodeVint(value: number, minBytes?: number): ByteVector; /** * Render an EBML element: id bytes + vint(size) + data bytes. */ export declare function renderEbmlElement(id: number, data: ByteVector): ByteVector; /** * Render a UTF-8 string EBML element. */ export declare function renderStringElement(id: number, value: string): ByteVector; /** * Render an unsigned integer EBML element (big-endian, minimal byte count). */ export declare function renderUintElement(id: number, value: number): ByteVector; /** * Render a Void EBML element of the given total byte size (including id+size header). * Minimum size is 2 bytes (1 byte id + 1 byte vint(0)). */ export declare function renderVoidElement(totalSize: number): ByteVector; //# sourceMappingURL=ebmlElement.d.ts.map