import IsoAudioSampleEntry from "./boxes/isoAudioSampleEntry"; import IsoMovieHeaderBox from "./boxes/isoMovieHeaderBox"; import IsoUserDataBox from "./boxes/isoUserDataBox"; import IsoVisualSampleEntry from "./boxes/isoVisualSampleEntry"; import Mpeg4Box from "./boxes/mpeg4Box"; import Mpeg4BoxHeader from "./mpeg4BoxHeader"; import { File } from "../file"; /** * This class provides methods for reading important information from an MPEG-4 file. * @internal */ export default class Mpeg4FileParser { /** * Contains the file to read from. */ private readonly _file; /** * Contains the first header found in the file. */ private readonly _firstHeader; /** * Contains the ISO movie header box. */ private _mvhdBox; /** * Contains the ISO user data boxes. */ private _udtaBoxes; /** * Contains the box headers from the top of the file to the "moov" box. */ private _moovTree; /** * Contains the "stco" boxes found in the file. */ private _stcoBoxes; /** * Contains the "stsd" boxes found in the file. */ private _stsdBoxes; /** * Constructs and initializes a new instance of {{@link Mpeg4FileParser}} for a specified file. * @param file A {{@link File}} object to perform operations on. */ constructor(file: File); /** * Gets the movie header box read by the current instance. */ get movieHeaderBox(): IsoMovieHeaderBox; /** * Gets all user data boxes read by the current instance. */ get userDataBoxes(): IsoUserDataBox[]; /** * Gets the audio sample entry read by the current instance. */ get audioSampleEntry(): IsoAudioSampleEntry; /** * Gets the visual sample entry read by the current instance. */ get visualSampleEntry(): IsoVisualSampleEntry; /** * Gets the box headers for the first "moov" box and * all parent boxes up to the top of the file as read by the * current instance. */ get moovTree(): Mpeg4BoxHeader[]; /** * Gets all chunk offset boxes read by the current instance. */ get chunkOffsetBoxes(): Mpeg4Box[]; /** * Parses the file referenced by the current instance, * searching for box headers that will be useful in saving * the file. */ parseBoxHeaders(): void; /** * Parses the file referenced by the current instance, searching for tags. */ parseTag(): void; /** * Parses the file referenced by the current instance, searching for tags and properties. */ parseTagAndProperties(): void; /** * Parses the file referenced by the current instance, searching for chunk offset boxes. */ parseChunkOffsets(): void; /** * Parses boxes for a specified range, looking for headers. * @param start A value specifying the seek position at which to start reading. * @param end A value specifying the seek position at which to stop reading. * @param parents An array of {{@link Mpeg4BoxHeader}} containing all the parent handlers that * apply to the range. */ private parseBoxHeadersFromStartEndAndParents; /** * Parses boxes for a specified range, looking for tags. * @param start A value specifying the seek position at which to start reading. * @param end A value specifying the seek position at which to stop reading. * @param parents An array of {{@link Mpeg4BoxHeader}} parents. */ private parseTagFromStartEndAndParents; /** * Parses boxes for a specified range, looking for tags and properties. * @param start A value specifying the seek position at which to start reading. * @param end A value specifying the seek position at which to stop reading. * @param handler A {{@link IsoHandlerBox}} object that applied to the range being searched. * @param parents An array of {{@link Mpeg4BoxHeader}} parents. */ private parseTagAndPropertiesFromStartEndHandlerAndParents; /** * Parses boxes for a specified range, looking for chunk offset boxes. * @param start A value specifying the seek position at which to start reading. * @param end A value specifying the seek position at which to stop reading. */ private parseChunkOffsetsFromStartAndEnd; /** * Resets all internal fields. */ private resetFields; }