Xeno-rat
|
Represents an MP3 Frame. More...
Static Public Member Functions | |
static Mp3Frame | LoadFromStream (Stream input) |
Loads an MP3 frame from the given input stream and returns the frame. | |
static Mp3Frame | LoadFromStream (Stream input, bool readData) |
Reads an MP3Frame from a stream. | |
Properties | |
int | SampleRate [get, private set] |
Sample rate of this frame. | |
int | FrameLength [get, private set] |
Frame length in bytes. | |
int | BitRate [get, private set] |
Bit Rate. | |
byte[] | RawData [get, private set] |
Raw frame data (includes header bytes) | |
MpegVersion | MpegVersion [get, private set] |
MPEG Version. | |
MpegLayer | MpegLayer [get, private set] |
MPEG Layer. | |
ChannelMode | ChannelMode [get, private set] |
Channel Mode. | |
int | SampleCount [get, private set] |
The number of samples in this frame. | |
int | ChannelExtension [get, private set] |
The channel extension bits. | |
int | BitRateIndex [get, private set] |
The bitrate index (directly from the header) | |
bool | Copyright [get, private set] |
Whether the Copyright bit is set. | |
bool | CrcPresent [get, private set] |
Whether a CRC is present. | |
long | FileOffset [get, private set] |
Not part of the MP3 frame itself - indicates where in the stream we found this header. | |
Private Member Functions | |
Mp3Frame () | |
Constructs an MP3 frame. | |
Static Private Member Functions | |
static bool | IsValidHeader (byte[] headerBytes, Mp3Frame frame) |
Checks if the provided header bytes and Mp3Frame are valid and returns a boolean value indicating the result. | |
Static Private Attributes | |
static readonly int[,,] | bitRates |
static readonly int[,] | samplesPerFrame |
static readonly int[] | sampleRatesVersion1 = new int[] {44100, 48000, 32000} |
static readonly int[] | sampleRatesVersion2 = new int[] {22050, 24000, 16000} |
static readonly int[] | sampleRatesVersion25 = new int[] {11025, 12000, 8000} |
const int | MaxFrameLength = 16*1024 |
Represents an MP3 Frame.
|
inlineprivate |
Constructs an MP3 frame.
|
inlinestaticprivate |
Checks if the provided header bytes and Mp3Frame are valid and returns a boolean value indicating the result.
headerBytes | The header bytes of the Mp3Frame. |
frame | The Mp3Frame to be validated. |
This method checks if the provided header bytes and Mp3Frame are valid according to the MPEG audio format specifications. It validates various properties of the Mp3Frame such as MPEG version, layer, bit rate, sample rate, channel mode, frame length, etc. If any of the properties are invalid, the method returns false; otherwise, it returns true.
|
inlinestatic |
Loads an MP3 frame from the given input stream and returns the frame.
input | The input stream from which to load the MP3 frame. |
readData | A boolean value indicating whether to read the frame data from the input stream. |
This method reads the header bytes from the input stream and validates them to identify an MP3 frame. If the header is not valid, it shifts down by one and tries again until a valid header is found. Once a valid header is found, it reads the frame data from the input stream based on the frame length. If readData is false, it skips reading the frame data and moves the input stream position accordingly.
EndOfStreamException | Thrown when an unexpected end of stream is encountered before the frame is complete. |
|
inlinestatic |
Reads an MP3Frame from a stream.
http://mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm has some good info also see http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
getprivate set |
Bit Rate.
|
getprivate set |
The bitrate index (directly from the header)
|
getprivate set |
The channel extension bits.
|
getprivate set |
Channel Mode.
|
getprivate set |
Whether the Copyright bit is set.
|
getprivate set |
Whether a CRC is present.
|
getprivate set |
Not part of the MP3 frame itself - indicates where in the stream we found this header.
|
getprivate set |
Frame length in bytes.
|
getprivate set |
MPEG Layer.
|
getprivate set |
MPEG Version.
|
getprivate set |
Raw frame data (includes header bytes)
|
getprivate set |
The number of samples in this frame.
|
getprivate set |
Sample rate of this frame.