import IOggCodec from "./iOggCodec"; import XiphComment from "../../xiph/xiphComment"; import { ByteVector } from "../../byteVector"; import { IAudioCodec, MediaTypes } from "../../properties"; /** * Represents an Ogg Opus bitstream for use within an Ogg file. */ export default class Opus implements IOggCodec, IAudioCodec { private static readonly HEADER_IDENTIFIER; private static readonly COMMENT_IDENTIFIER; private readonly _channelCount; private readonly _inputSampleRate; private readonly _opusVersion; private readonly _preSkip; private readonly _streamCount; private _commentData; private _durationMilliseconds; /** * Constructs and initializes a new instance using the provided header packet to read the * codec's header information. * @param headerPacket Packet containing the header of the stream */ constructor(headerPacket: ByteVector); /** * @inheritDoc * @remarks * Always returns zero since bitrate is variable and no information is stored in the * Ogg header (unlike Vorbis). */ get audioBitrate(): number; /** * @inheritDoc * @remarks * This is the *input* sample rate used when the file was created. Opus uses a variety * of sample rates internally, and as such the output sample rate is dependent on the * decoder used. In most modern hardware cases, this will be 48kHz. */ get audioSampleRate(): number; /** @inheritDoc */ get audioChannels(): number; /** * Gets the raw Xiph comment data contained in the codec. */ get commentData(): ByteVector; /** @inheritDoc */ get description(): string; /** @inheritDoc */ get durationMilliseconds(): number; /** @inheritDoc */ get mediaTypes(): MediaTypes; /** * Gets the number of streams contained in the bitstream. */ get streamCount(): number; /** * Determines whether an Opus header packet based on the presence of the Opus header * packet magic signature. * @param headerPacket Packet to check */ static isHeaderPacket(headerPacket: ByteVector): boolean; /** @inheritDoc */ readPacket(packet: ByteVector): boolean; /** @inheritDoc */ writeCommentPacket(packets: ByteVector[], comment: XiphComment): void; setDuration(firstGranularPosition: ByteVector, lastGranularPosition: ByteVector): void; }