Xeno-rat
Loading...
Searching...
No Matches
NAudio.Wave.XingHeader Class Reference

Represents a Xing VBR header. More...

Collaboration diagram for NAudio.Wave.XingHeader:

Static Public Member Functions

static XingHeader LoadXingHeader (Mp3Frame frame)
 Loads the Xing header from the provided Mp3Frame.
 

Properties

int Frames [get, set]
 Number of frames.
 
int Bytes [get, set]
 Number of bytes.
 
int VbrScale [get]
 VBR Scale property.
 
Mp3Frame Mp3Frame [get]
 The MP3 frame.
 

Private Types

enum  XingHeaderOptions { Frames = 1 , Bytes = 2 , Toc = 4 , VbrScale = 8 }
 

Private Member Functions

void WriteBigEndian (byte[] buffer, int offset, int value)
 Writes the integer value in big-endian format to the specified buffer at the given offset.
 
 XingHeader ()
 Sees if a frame contains a Xing header.
 

Static Private Member Functions

static int ReadBigEndian (byte[] buffer, int offset)
 Reads a 32-bit integer from the specified buffer in big-endian format.
 

Private Attributes

int vbrScale = -1
 
int startOffset
 
int endOffset
 
int tocOffset = -1
 
int framesOffset = -1
 
int bytesOffset = -1
 
Mp3Frame frame
 

Static Private Attributes

static int[] sr_table = { 44100, 48000, 32000, 99999 }
 

Detailed Description

Represents a Xing VBR header.

Member Enumeration Documentation

◆ XingHeaderOptions

Enumerator
Frames 
Bytes 
Toc 
VbrScale 

Constructor & Destructor Documentation

◆ XingHeader()

NAudio.Wave.XingHeader.XingHeader ( )
inlineprivate

Sees if a frame contains a Xing header.

Here is the caller graph for this function:

Member Function Documentation

◆ LoadXingHeader()

static XingHeader NAudio.Wave.XingHeader.LoadXingHeader ( Mp3Frame frame)
inlinestatic

Loads the Xing header from the provided Mp3Frame.

Parameters
frameThe Mp3Frame from which to load the Xing header.
Returns
The XingHeader loaded from the Mp3Frame, or null if the MPEG version is unsupported or the Xing header is not found.

This method loads the Xing header from the provided Mp3Frame. It calculates the offset based on the MPEG version and channel mode of the frame, and then checks for the presence of the Xing or Info header. If the Xing or Info header is found, it reads the XingHeaderOptions flags and sets the corresponding properties in the XingHeader object. The method returns the loaded XingHeader or null if the MPEG version is unsupported or the Xing header is not found.

Exceptions
FormatExceptionThrown when the MPEG version is unsupported.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadBigEndian()

static int NAudio.Wave.XingHeader.ReadBigEndian ( byte[] buffer,
int offset )
inlinestaticprivate

Reads a 32-bit integer from the specified buffer in big-endian format.

Parameters
bufferThe input buffer containing the integer data.
offsetThe offset at which the integer data starts in the buffer.
Returns
The 32-bit integer read from the buffer in big-endian format.
Here is the caller graph for this function:

◆ WriteBigEndian()

void NAudio.Wave.XingHeader.WriteBigEndian ( byte[] buffer,
int offset,
int value )
inlineprivate

Writes the integer value in big-endian format to the specified buffer at the given offset.

Parameters
bufferThe buffer to write the big-endian value to.
offsetThe offset within the buffer at which to start writing the value.
valueThe integer value to be written in big-endian format.

This method converts the integer value into its little-endian byte representation using the BitConverter.GetBytes method. It then writes the bytes in reverse order to the buffer starting from the specified offset to ensure big-endian format.

Member Data Documentation

◆ bytesOffset

int NAudio.Wave.XingHeader.bytesOffset = -1
private

◆ endOffset

int NAudio.Wave.XingHeader.endOffset
private

◆ frame

Mp3Frame NAudio.Wave.XingHeader.frame
private

◆ framesOffset

int NAudio.Wave.XingHeader.framesOffset = -1
private

◆ sr_table

int [] NAudio.Wave.XingHeader.sr_table = { 44100, 48000, 32000, 99999 }
staticprivate

◆ startOffset

int NAudio.Wave.XingHeader.startOffset
private

◆ tocOffset

int NAudio.Wave.XingHeader.tocOffset = -1
private

◆ vbrScale

int NAudio.Wave.XingHeader.vbrScale = -1
private

Property Documentation

◆ Bytes

int NAudio.Wave.XingHeader.Bytes
getset

Number of bytes.

◆ Frames

int NAudio.Wave.XingHeader.Frames
getset

Number of frames.

◆ Mp3Frame

Mp3Frame NAudio.Wave.XingHeader.Mp3Frame
get

The MP3 frame.

◆ VbrScale

int NAudio.Wave.XingHeader.VbrScale
get

VBR Scale property.


The documentation for this class was generated from the following file: