MP3 header parser that processes MP3 data incrementally and extracts complete MP3 frames. Can validate MP3 data and extract audio information. When used with a Print output, it splits incoming data into complete MP3 frames and writes them to the output stream.
More...
#include <HeaderParserMP3.h>
MP3 header parser that processes MP3 data incrementally and extracts complete MP3 frames. Can validate MP3 data and extract audio information. When used with a Print output, it splits incoming data into complete MP3 frames and writes them to the output stream.
Features:
- Incremental processing of MP3 data in small chunks
- Frame synchronization and validation
- Extraction of audio information (sample rate, bit rate, etc.)
- Output of complete MP3 frames only
- Support for all MPEG versions (1, 2, 2.5) and layers
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ FrameReason
| Enumerator |
|---|
| VALID | |
| INVALID_BITRATE_FOR_VERSION | |
| INVALID_SAMPLERATE_FOR_VERSION | |
| INVALID_MPEG_VERSION | |
| INVALID_LAYER | |
| INVALID_LAYER_II_BITRATE_AND_MODE | |
| INVALID_EMPHASIS | |
| INVALID_CRC | |
◆ HeaderParserMP3() [1/2]
◆ HeaderParserMP3() [2/2]
Constructor for write support.
◆ contains()
◆ findSyncWord()
Finds the mp3/aac sync word.
◆ flush()
◆ getBitRate()
Bit rate from mp3 header.
◆ getChannels()
| int getChannels |
( |
| ) |
const |
|
inline |
Number of channels from mp3 header.
◆ getFrameHeader()
| FrameHeader getFrameHeader |
( |
| ) |
|
|
inline |
◆ getFrameLength()
Frame length from mp3 header.
◆ getFrameRateHz()
frame rate in Hz (frames per second)
◆ getLayerStr()
| const char * getLayerStr |
( |
| ) |
const |
|
inline |
Provides a string representation of the MPEG layer.
◆ getPlayingTime()
Provides the estimated playing time in seconds based on the bitrate of the first segment
◆ getSampleRate()
| uint16_t getSampleRate |
( |
| ) |
const |
|
inline |
Sample rate from mp3 header.
◆ getSamplesPerFrame()
| int getSamplesPerFrame |
( |
| ) |
|
|
inline |
number of samples per mp3 frame
◆ getTimePerFrameMs()
playing time per frame in ms
◆ getVersionStr()
| const char * getVersionStr |
( |
| ) |
const |
|
inline |
Provides a string representation of the MPEG version.
◆ hasValidFrame()
| bool hasValidFrame |
( |
| ) |
const |
|
inline |
Returns true if we have parsed at least one valid frame.
◆ isValid() [1/2]
Returns true if a valid frame has been detected.
◆ isValid() [2/2]
parses the header string and returns true if this is a valid mp3 file
◆ processBuffer()
Processes the internal buffer to extract complete mp3 frames.
◆ readFrameHeader()
| void readFrameHeader |
( |
const uint8_t * |
data | ) |
|
|
inlineprotected |
◆ reset()
Clears internal buffer and resets state.
◆ resize()
◆ seekFrameSync()
◆ setOutput()
| void setOutput |
( |
Print & |
output | ) |
|
|
inline |
◆ validate()
◆ validateFrameHeader()
| FrameReason validateFrameHeader |
( |
const FrameHeader & |
header | ) |
|
|
inlineprotected |
◆ write()
split up the data into mp3 segements and write to output
◆ buffer
◆ buffer_size
◆ frame_header_valid
| bool frame_header_valid = false |
|
protected |
◆ header
◆ last_frame_size
◆ p_output
| Print* p_output = nullptr |
|
protected |
The documentation for this class was generated from the following file: