A simple Arduino API for the libhelix MP3 decoder. The data is provided with the help of write() calls. The decoded result is available either via a callback method or via an output stream.
More...
#include <MP3DecoderHelix.h>
|
|
| MP3DecoderHelix (Print &output, MP3Type mp3Type=MP3Normal) |
| |
|
| MP3DecoderHelix (MP3DataCallback dataCallback, MP3Type mp3Type=MP3Normal) |
| |
|
| MP3DecoderHelix (MP3Type mp3Type) |
| |
|
void | setInfoCallback (MP3InfoCallback cb, void *caller=nullptr) |
| |
|
void | setDataCallback (MP3DataCallback cb) |
| |
|
MP3FrameInfo | audioInfo () |
| | Provides the last available MP3FrameInfo.
|
| |
| void | end () override |
| | Releases the reserved memory.
|
| |
| size_t | maxFrameSize () override |
| | determines the frame buffer size that will be allocated
|
| |
| size_t | maxPCMSize () override |
| | Determines the pcm buffer size that will be allocated.
|
| |
|
void | setOutput (Print &output) |
| |
|
virtual bool | begin () |
| | Starts the processing.
|
| |
|
virtual size_t | write (const void *in_ptr, size_t in_size) |
| | decodes the next segments from the input. The data can be provided in one big or in small incremental pieces. It is suggested to be called in the Arduino Loop. If the provided data does not fit into the buffer it is split up into small pieces that fit
|
| |
|
| operator bool () |
| | returns true if active
|
| |
|
uint64_t | timeOfLastWrite () |
| | Provides the timestamp in ms of last write.
|
| |
|
uint64_t | timeOfLastResult () |
| | Provides the timestamp in ms of last decoded result.
|
| |
|
void | flush () |
| | Decodes all open packets, including the last frame. Call it at the end of the stream. A frame is only decoded when a sync word follows it, so flush() appends an end marker (a valid frame header) for the decoding and removes it again. A partially received frame is not decoded.
|
| |
|
void | setMaxFrameSize (size_t len) |
| | Define your optimized maximum frame size in bytes.
|
| |
|
void | setMaxPCMSize (size_t len) |
| | Define your optimized maximum pcm buffer size in bytes.
|
| |
| void | setReference (void *ref) |
| |
|
void | setMaxPCMWriteSize (int size) |
| | Defines the max chunk size that is wrtten to out (Arduino only)
|
| |
|
| const uint8_t * | endSyncWord () override |
| | the end marker appended by flush(): a valid MPEG-1 Layer III header
|
| |
| virtual bool | allocateDecoder () override |
| | Allocate the decoder.
|
| |
| int | findSynchWord (int offset=0) override |
| |
| int | decode () override |
| |
|
void | provideResult (MP3FrameInfo &info) |
| |
|
int | decodableBytes () |
| | the bytes that the decoders may use for a frame
|
| |
|
bool | presync () |
| | make sure that we start with a valid sync: remove ID3 data
|
| |
| bool | resynch (int rc) |
| |
| bool | removeInvalidData (int pos) |
| |
|
virtual size_t | writeChunk (const void *in_ptr, size_t in_size) |
| | Decoding Loop: We decode the procided data until we run out of data.
|
| |
|
void | decodeAvailable () |
| | Decodes all frames that are complete enough to be decoded.
|
| |
| void | discardUnusableData () |
| |
|
size_t | writeToOut (uint8_t *data, size_t len) |
| |
|
virtual int | minFrameBufferSize () |
| | Provides the actual minimum frame buffer size.
|
| |
| virtual void | setMinFrameBufferSize (int size) |
| |
|
|
HMP3Decoder | decoder = nullptr |
| |
|
MP3DataCallback | pcmCallback = nullptr |
| |
|
MP3InfoCallback | infoCallback = nullptr |
| |
|
MP3Type | mp3_type |
| |
|
MP3FrameInfo | mp3FrameInfo |
| |
|
void * | p_caller_data = nullptr |
| |
|
int | reserved_tail = 0 |
| |
|
bool | active = false |
| |
|
bool | is_raw = false |
| |
|
Vector< uint8_t > | pcm_buffer {0} |
| |
|
SingleBuffer< uint8_t > | frame_buffer {0} |
| |
|
size_t | max_frame_size = 0 |
| |
|
size_t | max_pcm_size = 0 |
| |
|
size_t | frame_counter = 0 |
| |
|
size_t | max_write_size = 1024 |
| |
|
int | delay_ms = -1 |
| |
|
int | parse_0_count = 0 |
| |
|
int | min_frame_buffer_size = 0 |
| |
|
uint64_t | time_last_write = 0 |
| |
|
uint64_t | time_last_result = 0 |
| |
|
void * | p_caller_ref = nullptr |
| |
|
Print * | out = nullptr |
| |
|
|
static const int | END_MARKER_LEN = 4 |
| |
A simple Arduino API for the libhelix MP3 decoder. The data is provided with the help of write() calls. The decoded result is available either via a callback method or via an output stream.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ allocateDecoder()
| virtual bool libhelix::MP3DecoderHelix::allocateDecoder |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
◆ decode()
| int libhelix::MP3DecoderHelix::decode |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
decods the data and removes the decoded frame from the buffer returns the number of bytes that have been processed or a negative error code
Implements libhelix::CommonHelix.
◆ discardUnusableData()
| void libhelix::CommonHelix::discardUnusableData |
( |
| ) |
|
|
inlineprotectedinherited |
Removes the data up to the next sync word after the first byte. If there is no further sync word the whole buffer is dropped.
◆ end()
| void libhelix::MP3DecoderHelix::end |
( |
| ) |
|
|
inlineoverridevirtual |
◆ endSyncWord()
| const uint8_t * libhelix::MP3DecoderHelix::endSyncWord |
( |
| ) |
|
|
inlineoverrideprotectedvirtual |
◆ findSynchWord()
| int libhelix::MP3DecoderHelix::findSynchWord |
( |
int |
offset = 0 | ) |
|
|
inlineoverrideprotectedvirtual |
Finds the synch word in the available buffer data starting from the indicated offset
Implements libhelix::CommonHelix.
◆ maxFrameSize()
| size_t libhelix::MP3DecoderHelix::maxFrameSize |
( |
| ) |
|
|
inlineoverridevirtual |
◆ maxPCMSize()
| size_t libhelix::MP3DecoderHelix::maxPCMSize |
( |
| ) |
|
|
inlineoverridevirtual |
◆ removeInvalidData()
| bool libhelix::CommonHelix::removeInvalidData |
( |
int |
pos | ) |
|
|
inlineprotectedinherited |
removes invalid data not starting with a synch word.
- Returns
- Returns true if we still have data to be played
◆ resynch()
| bool libhelix::CommonHelix::resynch |
( |
int |
rc | ) |
|
|
inlineprotectedinherited |
advance data, returns true if we need to continue the processing
◆ setMinFrameBufferSize()
| virtual void libhelix::CommonHelix::setMinFrameBufferSize |
( |
int |
size | ) |
|
|
inlineprotectedvirtualinherited |
Defines the minimum frame buffer size which is required before starting the decoding
◆ setReference()
| void libhelix::CommonHelix::setReference |
( |
void * |
ref | ) |
|
|
inlineinherited |
Define some additional information which will be provided back in the callbacks
The documentation for this class was generated from the following file: