arduino-audio-tools
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
OSCContainerDecoder Class Reference

Decodes the provided data from the OSC segments. I recommend to assign a MultiDecoder so that we can support muiltiple audio types. More...

#include <ContainerOSC.h>

Inheritance diagram for OSCContainerDecoder:
ContainerDecoder AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 OSCContainerDecoder (AudioDecoder &decoder)
 
 OSCContainerDecoder (MultiDecoder &decoder)
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
bool addParserCallback (const char *address, bool(*callback)(OSCData &data, void *ref), OSCCompare compare=OSCCompare::Matches)
 Adds an new parser callback for a specific address matching string.
 
AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 
bool begin ()
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end ()
 
PrintgetOutput ()
 
uint64_t getSequenceNumber ()
 Provides the sequence number of the last packet.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
const char * mime ()
 Provides the mime type from the encoder.
 
 operator bool ()
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
void setAudioInfo (AudioInfo from) override
 for most decoders this is not needed
 
virtual bool setCodecConfig (const uint8_t *data, size_t len)
 Some decoders need e.g. a magic cookie to provide the relevant info for decoding.
 
void setDecoder (AudioDecoder &decoder)
 Defines the decoder to be used.
 
void setDecoder (MultiDecoder &decoder)
 Defines the decoder to be used: special logic for multidecoder.
 
void setMissingDataCallback (void(*missing_data_callback)(uint64_t from_seq, uint64_t to_seq, void *ref))
 Callback to be called when data is missing.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
void setOSCData (OSCData &osc)
 Optionally define you own OSCData object.
 
virtual void setOutput (AudioOutput &out_stream)
 Defines where the decoded result is written to.
 
virtual void setOutput (AudioStream &out_stream)
 Defines where the decoded result is written to.
 
void setOutput (Print &outStream)
 Defines where the decoded result is written to.
 
void setReference (void *ref)
 Provide a reference object to the callback.
 
void setWriteCallback (bool(*write_callback)(uint64_t time, uint64_t seq, uint8_t *data, size_t len, void *ref))
 Replace the write to the decoder with a callback:
 
size_t write (const uint8_t *data, size_t len)
 

Public Attributes

int id
 custom id to be used by application
 

Protected Member Functions

void notifyAudioChange (AudioInfo info)
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Static Protected Member Functions

static void missingDataCallback (uint64_t from_seq, uint64_t to_seq, void *ref)
 Default callback for missing data: just log the missing range.
 
static bool parseData (OSCData &osc, void *ref)
 
static bool parseInfo (OSCData &osc, void *ref)
 

Protected Attributes

SingleBuffer< uint8_t > buffer {0}
 
AudioInfo info
 
bool is_active = false
 
bool is_multi_decoder = false
 
bool is_notify_active = true
 
Str mime_str
 
void(* missing_data_callback )(uint64_t from_seq, uint64_t to_seq, void *ref) = missingDataCallback
 
Vector< AudioInfoSupport * > notify_vector
 
OSCData osc_default
 
AudioDecoderp_codec = nullptr
 
OSCDatap_osc = &osc_default
 
Printp_out = nullptr
 
Printp_print = nullptr
 
void * ref = nullptr
 
uint64_t seq_no = 0
 
bool(* write_callback )(uint64_t time, uint64_t seq, uint8_t *data, size_t len, void *ref) = nullptr
 Return false to complete the processing w/o writing to the decoder.
 

Detailed Description

Decodes the provided data from the OSC segments. I recommend to assign a MultiDecoder so that we can support muiltiple audio types.

Author
Phil Schatzmann

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ begin() [1/2]

bool begin ( )
inlinevirtual

Reimplemented from AudioDecoder.

◆ begin() [2/2]

virtual bool begin ( AudioInfo  info)
inlineoverridevirtualinherited

Reimplemented from AudioWriter.

◆ end()

void end ( )
inlinevirtual

Reimplemented from AudioDecoder.

◆ operator bool()

operator bool ( )
inlinevirtual

Implements AudioWriter.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtualinherited

for most decoders this is not needed

Implements AudioWriter.

Reimplemented in GGWaveDecoder, DecoderALAC, DecoderL8, OpusAudioDecoder, CodecNOP, and G7xxDecoder.

◆ setCodecConfig()

virtual bool setCodecConfig ( const uint8_t *  data,
size_t  len 
)
inlinevirtualinherited

Some decoders need e.g. a magic cookie to provide the relevant info for decoding.

Reimplemented in DecoderALAC, and MultiDecoder.

◆ setOutput() [1/3]

virtual void setOutput ( AudioOutput out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [2/3]

virtual void setOutput ( AudioStream out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [3/3]

void setOutput ( Print out_stream)
inlinevirtual

Defines where the decoded result is written to.

Reimplemented from AudioDecoder.

◆ write()

size_t write ( const uint8_t *  data,
size_t  len 
)
inlinevirtual

Implements AudioWriter.


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