import { File } from "../file"; import { IAudioCodec, MediaTypes } from "../properties"; /** * This structure implements {@link IAudioCodec} and provides information about an ADTS AAC audio * stream. NOTE: This header type should not be used for MPEG-4 encapsulated audio files. */ export default class AacAudioHeader implements IAudioCodec { private static readonly SAMPLE_RATES; /** * An empty an unset header */ static readonly UNKNOWN: AacAudioHeader; private readonly _audioBitrate; private readonly _audioChannels; private readonly _audioSampleRate; private readonly _mpeg4AudioTypeIndex; private _durationMilliseconds; private _streamLength; /** * Constructs and initializes a new instance of {@link AacAudioHeader} by populating it with the * specified values. * @param channels Number of channels in the audio stream * @param bitrate Bitrate of the audio stream * @param sampleRate Sample rate of the audio stream * @param mpegAudioType ID of the MPEG-4 audio type */ constructor(channels: number, bitrate: number, sampleRate: number, mpegAudioType: number); /** @inheritDoc */ get audioBitrate(): number; /** @inheritDoc */ get audioChannels(): number; /** @inheritDoc */ get audioSampleRate(): number; /** @inheritDoc */ get description(): string; /** * @inheritDoc * @remarks * Until the stream length has been set ({@link streamLength}), this will return * `undefined`. */ get durationMilliseconds(): number; /** @inheritDoc */ get mediaTypes(): MediaTypes; /** * Sets the length of the audio stream represented by the current instance. * @desc Until this value has been set, {@link durationMilliseconds} will return an incorrect * value. * @param value Length in bytes of the audio stream represented by the current instance */ set streamLength(value: number); /** * Searches for an audio header in a {@link File} starting at a specified position and * searching through a specified number of bytes. * @param file File to search * @param position Seek position in `file` in which to start searching * @param length maximum number of bytes to search before aborting. Omit to search entire file. * Searching the entire file may take a very long time, it is recommended to always use a * reasonable length here * @returns Header found or `undefined` if a header could not be found */ static find(file: File, position: number, length?: number): AacAudioHeader; }