Class: OggOpusCodec
October 29, 2023 · View on GitHub
node-taglib-sharp / Exports / OggOpusCodec
Class: OggOpusCodec
Represents an Ogg Opus bitstream for use within an Ogg file.
Implements
Table of contents
Constructors
Accessors
- audioBitrate
- audioChannels
- audioSampleRate
- commentData
- description
- durationMilliseconds
- mediaTypes
- streamCount
Methods
Constructors
constructor
• new OggOpusCodec(headerPacket)
Constructs and initializes a new instance using the provided header packet to read the codec's header information.
Parameters
| Name | Type | Description |
|---|---|---|
headerPacket | ByteVector | Packet containing the header of the stream |
Accessors
audioBitrate
• get audioBitrate(): number
Bitrate of the audio in kilobits per second represented by the current instance.
Remarks
Always returns zero since bitrate is variable and no information is stored in the Ogg header (unlike Vorbis).
Returns
number
Implementation of
audioChannels
• get audioChannels(): number
Number of channels in the audio represented by the current instance.
Returns
number
Implementation of
audioSampleRate
• get audioSampleRate(): number
Sample rate of the audio represented by the current instance.
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.
Returns
number
Implementation of
commentData
• get commentData(): ByteVector
Gets the raw Xiph comment data contained in the codec.
Returns
Implementation of
IOggCodec.commentData
description
• get description(): string
Gets a text description of the media represented by the current instance.
Returns
string
Implementation of
durationMilliseconds
• get durationMilliseconds(): number
Duration of the media in milliseconds represented by the current instance.
Returns
number
Implementation of
IAudioCodec.durationMilliseconds
mediaTypes
• get mediaTypes(): MediaTypes
Types of media represented by the current instance, bitwise combined.
Returns
Implementation of
streamCount
• get streamCount(): number
Gets the number of streams contained in the bitstream.
Returns
number
Methods
readPacket
▸ readPacket(packet): boolean
Reads an Ogg packet that has been encountered in the stream, looking for the comment data.
Parameters
| Name | Type | Description |
|---|---|---|
packet | ByteVector | Packet to read |
Returns
boolean
Implementation of
setDuration
▸ setDuration(firstGranularPosition, lastGranularPosition): void
Sets the file offset information necessary for calculating the duration of the stream. Once called, the duration can be accessed by calling durationMilliseconds.
Parameters
| Name | Type | Description |
|---|---|---|
firstGranularPosition | ByteVector | First granular position of the stream |
lastGranularPosition | ByteVector | Last granular position of the stream |
Returns
void
Implementation of
writeCommentPacket
▸ writeCommentPacket(packets, comment): void
Renders and write the provided comment into the provided list of packets.
Parameters
| Name | Type | Description |
|---|---|---|
packets | ByteVector[] | List of packets the comment packet should be written into. |
comment | XiphComment | Xiph comment to write into the list of packets. |
Returns
void
Implementation of
isHeaderPacket
▸ Static isHeaderPacket(headerPacket): boolean
Determines whether an Opus header packet based on the presence of the Opus header packet magic signature.
Parameters
| Name | Type | Description |
|---|---|---|
headerPacket | ByteVector | Packet to check |
Returns
boolean