import { ByteVector } from "../byteVector"; import { File } from "../file"; /** * Provides support for reading and writing headers for ISO/IEC 14496-12 boxes. */ export default class Mpeg4BoxHeader { /** * Contains the box size. */ private _boxSize; /** * The type of box represented by the current instance. */ private _boxType; /** * The extended type of the box represented by the current instance. */ private _extendedType; /** * Contains the header size. */ private _headerSize; /** * Contains the position of the header. */ private _position; /** * Indicates that the header was read from a file. */ private _fromDisk; private constructor(); /** * Constructs and initializes a new instance of {@link Mpeg4BoxHeader} by reading it from a * specified seek position in a specified file. * @param file A {@link File} object to read the new instance from. * @param position A value specifying the seek position in File at which to start reading. */ static fromFileAndPosition(file: File, position: number): Mpeg4BoxHeader; /** * Constructs and initializes a new instance of {@link Mpeg4BoxHeader} with a specified box type * and optionally extended type. * @param type A {@link ByteVector} object containing the four byte box type. * @param extendedType A {@link ByteVector} object containing the four byte box type. */ static fromType(type: ByteVector, extendedType?: ByteVector): Mpeg4BoxHeader; /** * Gets the type of box represented by the current instance. */ get boxType(): ByteVector; /** * Gets the extended type of the box represented by the current instance. */ get extendedType(): ByteVector; /** * Gets the size of the header represented by the current instance. */ get headerSize(): number; /** * Gets the size of the data in the box described by the current instance. */ get dataSize(): number; /** * Gets the size of the data in the box described by the current instance. * @internal */ set dataSize(v: number); /** * Gets the total size of the box described by the current instance. */ get totalBoxSize(): number; /** * Gets the position box represented by the current instance in the file it comes from. */ get position(): number; /** * Overwrites the header on disk, updating it to include a change in the size of the box. * @param file A {@link File} object containing the file from which the box originates. * @param sizeChange A value indicating the change in the size of the box described by the * current instance. * @returns number Size change encountered by the box that parents the box described the current * instance, equal to the size change of the box plus any size change that should happen in * the header. * @internal */ overwrite(file: File, sizeChange: number): number; /** * Renders the header represented by the current instance. * @returns ByteVector Rendered version of the current instance. */ render(): ByteVector; }