arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::MetaDataICY Class Reference

Icecast/Shoutcast Metadata Handling. Metadata class which splits the data into audio and metadata. The result is provided via callback methods. see https://www.codeproject.com/Articles/11308/SHOUTcast-Stream-Ripper. More...

#include <MetaDataICY.h>

Inheritance diagram for audio_tools::MetaDataICY:
audio_tools::AbstractMetaData

Public Member Functions

 MetaDataICY (int metaint)
 We just process the Metadata and ignore the audio info.
 
virtual void begin () override
 Resets all counters and restarts the prcessing. More...
 
virtual void end () override
 Resets all counters and restarts the prcessing. More...
 
virtual bool hasMetaData ()
 Returns true if the ICY stream contains metadata.
 
virtual bool isData ()
 returns true if the actual bytes is an audio data byte (e.g.mp3)
 
virtual int metaInt ()
 provides the metaint
 
virtual void processChar (char ch)
 character based state engine
 
virtual void setAudioDataCallback (void(*fn)(const uint8_t *str, int len), int bufferLen=1024)
 Defines the audio callback function.
 
virtual void setCallback (void(*fn)(MetaDataType info, const char *str, int len)) override
 Defines the metadata callback function. More...
 
virtual void setIcyMetaInt (int value) override
 Defines the ICE metaint value which is provided by the web call! More...
 
virtual Status status ()
 Returns the actual status of the state engine for the current byte.
 
virtual size_t write (const uint8_t *buffer, size_t len) override
 Writes the data in order to retrieve the metadata and perform the corresponding callbacks. More...
 
virtual void begin ()=0
 
virtual void end ()=0
 
virtual void setCallback (void(*fn)(MetaDataType info, const char *str, int len))=0
 
virtual void setIcyMetaInt (int value)
 
virtual size_t write (const uint8_t *data, size_t length)=0
 

Protected Member Functions

virtual void clear ()
 
virtual bool isAscii (char *result, int l)
 Make sure that the result is a valid ASCII string.
 
virtual int metaSize (uint8_t metaSize)
 determines the meta data size from the size byte
 
virtual void processData (char ch)
 Collects the data in a buffer and executes the callback when the buffer is full.
 
virtual void processMetaData (char *metaData, int len)
 e.g. StreamTitle=' House Bulldogs - But your love (Radio Edit)';StreamUrl='';
 
virtual void setupMetaData (int meta_size)
 allocates the memory to store the metadata / we support changing sizes
 

Protected Attributes

void(* callback )(MetaDataType info, const char *str, int len) = nullptr
 
Status currentStatus = ProcessData
 
uint8_t * dataBuffer =nullptr
 
void(* dataCallback )(const uint8_t *str, int len) = nullptr
 
int dataLen = 0
 
int dataPos = 0
 
bool is_data
 
char * metaData =nullptr
 
int metaDataLen = 0
 
int metaDataMaxLen = 0
 
int metaDataPos = 0
 
int mp3_blocksize = 0
 
Status nextStatus = ProcessData
 
int totalData = 0
 

Detailed Description

Icecast/Shoutcast Metadata Handling. Metadata class which splits the data into audio and metadata. The result is provided via callback methods. see https://www.codeproject.com/Articles/11308/SHOUTcast-Stream-Ripper.

Author
Phil Schatzmann

Member Function Documentation

◆ begin()

virtual void audio_tools::MetaDataICY::begin ( )
inlineoverridevirtual

Resets all counters and restarts the prcessing.

Implements audio_tools::AbstractMetaData.

◆ end()

virtual void audio_tools::MetaDataICY::end ( )
inlineoverridevirtual

Resets all counters and restarts the prcessing.

Implements audio_tools::AbstractMetaData.

◆ setCallback()

virtual void audio_tools::MetaDataICY::setCallback ( void(*)(MetaDataType info, const char *str, int len)  fn)
inlineoverridevirtual

Defines the metadata callback function.

Implements audio_tools::AbstractMetaData.

◆ setIcyMetaInt()

virtual void audio_tools::MetaDataICY::setIcyMetaInt ( int  value)
inlineoverridevirtual

Defines the ICE metaint value which is provided by the web call!

Reimplemented from audio_tools::AbstractMetaData.

◆ write()

virtual size_t audio_tools::MetaDataICY::write ( const uint8_t *  buffer,
size_t  len 
)
inlineoverridevirtual

Writes the data in order to retrieve the metadata and perform the corresponding callbacks.

Implements audio_tools::AbstractMetaData.


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