arduino-audio-tools
|
Icecast/Shoutcast Audio Stream which splits the data into metadata and audio data. The Audio data is provided via the regular stream functions. The metadata is handled with the help of the MetaDataICY state machine and provided via a callback method. More...
#include <ICYStreamT.h>
Public Member Functions | |
ICYStreamT (Client &clientPar, int readBufferSize=DEFAULT_BUFFER_SIZE) | |
ICYStreamT (const char *ssid, const char *password, int readBufferSize=DEFAULT_BUFFER_SIZE) | |
Default constructor. | |
ICYStreamT (int readBufferSize=DEFAULT_BUFFER_SIZE) | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
void | addRequestHeader (const char *key, const char *value) override |
Adds/Updates a request header. | |
virtual AudioInfo | audioInfo () override |
provides the actual input AudioInfo | |
virtual AudioInfo | audioInfoOut () |
virtual int | available () override |
provides the available method from the URLStream | |
int | availableForWrite () override |
Writes are not supported. | |
virtual bool | begin () |
virtual bool | begin (const char *urlStr, const char *acceptMime=nullptr, MethodID action=GET, const char *reqMime="", const char *reqData="") override |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
int | contentLength () override |
Provides the reported data size from the http reply. | |
virtual void | end () override |
Ends the processing. | |
virtual void | flush () override |
const char * | getReplyHeader (const char *key) override |
Provides reply header info. | |
virtual HttpRequest & | httpRequest () override |
provides access to the HttpRequest | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
operator bool () | |
virtual int | read () override |
virtual size_t | readBytes (uint8_t *data, size_t len) override |
reads the audio bytes | |
virtual size_t | readSilence (uint8_t *buffer, size_t length) |
Source to generate silence: just sets the buffer to 0. | |
virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
virtual void | setAudioInfo (AudioInfo newInfo) override |
Defines the input AudioInfo. | |
void | setCACert (const char *cert) |
Define the Root PEM Certificate for SSL: | |
void | setClient (Client &client) override |
(Re-)defines the client | |
void | setConnectionClose (bool flag) override |
Add Connection: close to request header. | |
virtual bool | setMetadataCallback (void(*fn)(MetaDataType info, const char *str, int len)) override |
Defines the meta data callback function. | |
void | setNotifyActive (bool flag) |
Deactivate/Reactivate automatic AudioInfo updates: (default is active) | |
void | setPassword (const char *password) override |
Sets the password that will be used for logging in (when calling begin) | |
void | setPowerSave (bool active) |
void | setReadBufferSize (int readBufferSize) |
void | setSSID (const char *ssid) override |
Sets the ssid that will be used for logging in (when calling begin) | |
size_t | totalRead () override |
Total amout of data that was consumed so far. | |
const char * | urlStr () override |
Provides the url as string. | |
bool | waitForData (int timeout) override |
virtual size_t | write (const uint8_t *data, size_t len) override |
virtual size_t | write (uint8_t ch) override |
virtual void | writeSilence (size_t len) |
Writes len bytes of silence (=0). | |
Protected Member Functions | |
virtual int | not_supported (int out, const char *msg="") |
void | notifyAudioChange (AudioInfo info) |
void | refillReadBuffer () |
Protected Attributes | |
int | _timeout = 10 |
void(* | callback )(MetaDataType info, const char *str, int len) = nullptr |
MetaDataICY | icy |
AudioInfo | info |
bool | is_notify_active = true |
Vector< AudioInfoSupport * > | notify_vector |
RingBuffer< uint8_t > | tmp_in {0} |
RingBuffer< uint8_t > | tmp_out {0} |
T | url |
Icecast/Shoutcast Audio Stream which splits the data into metadata and audio data. The Audio data is provided via the regular stream functions. The metadata is handled with the help of the MetaDataICY state machine and provided via a callback method.
This is basically just a URLStream with the metadata turned on.
If you run into performance issues, check if the data is provided chunked. In this chase you can check if setting the protocol to "HTTP/1.0" improves the situation.
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, MP3DecoderMAD, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
|
inlineoverridevirtual |
Adds/Updates a request header.
Implements AbstractURLStream.
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in JupyterAudioT< T >, MozziStream, TimerCallbackAudioStream, PureDataStream, AdapterAudioOutputToAudioStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and InputMerge< T >.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtual |
provides the available method from the URLStream
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
|
inlinevirtualinherited |
Reimplemented in AudioOutputWithCallback, HLSStreamT< URLStream >, SPDIFOutput, VS1053Stream, WM8960Stream, ESPNowStream, TimerCallbackAudioStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, AudioFFTBase, AnalogAudioArduino, AnalogAudioStream, MemoryStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, FormatConverterStream, and Pipeline.
|
inlineoverridevirtual |
Implements AbstractURLStream.
|
inlineoverridevirtual |
Provides the reported data size from the http reply.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Ends the processing.
Implements AbstractURLStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.
|
inlineoverridevirtual |
Provides reply header info.
Implements AbstractURLStream.
|
inlineoverridevirtual |
provides access to the HttpRequest
Implements AbstractURLStream.
|
inlinevirtual |
Reimplemented from AudioStream.
|
inlineoverridevirtual |
reads the audio bytes
Reimplemented from AudioStream.
|
inlineoverridevirtualinherited |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Reimplemented in VS1053Stream, WM8960Stream, I2SBitBang, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, VolumeStream, MiniAudioStream, PortAudioStream, I2SCodecStream, MozziStream, SPDIFOutput, AudioLoRa, AnalogAudioStream, I2SStream, MeasuringStream, VolumeMeter, TimerCallbackAudioStream, AudioBLEStream, LoRaStream, AudioFFTBase, AudioKitStream, VBANStream, AnalogAudioArduino, Equalizer3Bands, AdapterAudioOutputToAudioStream, TimedStream, ProgressStream, FormatConverterStream, FadeStream, Pipeline::ModifyingStreamAdapter, PureDataStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, Pipeline, and ResampleStream.
|
inlinevirtual |
Define the Root PEM Certificate for SSL:
Implements AbstractURLStream.
|
inlineoverridevirtual |
(Re-)defines the client
Implements AbstractURLStream.
|
inlineoverridevirtual |
Add Connection: close to request header.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Defines the meta data callback function.
Reimplemented from AbstractURLStream.
|
inlineoverridevirtual |
Sets the password that will be used for logging in (when calling begin)
Implements AbstractURLStream.
|
inlinevirtual |
if set to true, it activates the power save mode which comes at the cost of performance! - By default this is deactivated. ESP32 Only!
Implements AbstractURLStream.
|
inlineoverridevirtual |
Sets the ssid that will be used for logging in (when calling begin)
Implements AbstractURLStream.
|
inlineoverridevirtual |
Total amout of data that was consumed so far.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Provides the url as string.
Implements AbstractURLStream.
|
inlineoverridevirtual |
Waits the indicated time for the data to be available waits for some data - returns false if the request has failed
Implements AbstractURLStream.
|
inlineoverridevirtualinherited |
Implements BaseStream.
Reimplemented in I2SCodecStream, MozziStream, SPDIFOutput, I2SStream, A2DPStream, FaustStream< DSP >, AudioFFTBase, TfLiteAudioStream, VS1053Stream, AnalogAudioStream, AudioEffectStreamT< T >, BufferedTaskStream, TimedStream, BufferedStream, MeasuringStream, ProgressStream, VolumeStream, TfLiteAudioStreamBase, and AnalogDriverESP32V2::IO16Bit.
|
inlineoverridevirtualinherited |
Reimplemented in BufferedTaskStream, and BufferedStream.