arduino-audio-tools
Loading...
Searching...
No Matches
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 ()=default
 
 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 charmime ()
 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_tbuffer {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
 
voidref = 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

Constructor & Destructor Documentation

◆ OSCContainerDecoder() [1/3]

OSCContainerDecoder ( )
default

◆ OSCContainerDecoder() [2/3]

OSCContainerDecoder ( AudioDecoder decoder)
inline

◆ OSCContainerDecoder() [3/3]

OSCContainerDecoder ( MultiDecoder decoder)
inline

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ addParserCallback()

bool addParserCallback ( const char address,
bool(*)(OSCData &data, void *ref callback,
OSCCompare  compare = OSCCompare::Matches 
)
inline

Adds an new parser callback for a specific address matching string.

◆ 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.

Reimplemented in DecoderBasic, and OggContainerDecoder.

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ end()

void end ( )
inlinevirtual

Reimplemented from AudioDecoder.

◆ getOutput()

Print * getOutput ( )
inlineinherited

◆ getSequenceNumber()

uint64_t getSequenceNumber ( )
inline

Provides the sequence number of the last packet.

◆ isNotifyActive()

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ mime()

const char * mime ( )
inline

Provides the mime type from the encoder.

◆ missingDataCallback()

static void missingDataCallback ( uint64_t  from_seq,
uint64_t  to_seq,
void ref 
)
inlinestaticprotected

Default callback for missing data: just log the missing range.

◆ notifyAudioChange()

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlinevirtual

Implements AudioWriter.

◆ parseData()

static bool parseData ( OSCData osc,
void ref 
)
inlinestaticprotected

◆ parseInfo()

static bool parseInfo ( OSCData osc,
void ref 
)
inlinestaticprotected

◆ removeNotifyAudioChange()

virtual bool removeNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtualinherited

for most decoders this is not needed

Implements AudioWriter.

Reimplemented in DecoderALAC, CodecChain, DSFDecoder, DecoderL8, OpusAudioDecoder, CodecNOP, G729Decoder, 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.

◆ setDecoder() [1/2]

void setDecoder ( AudioDecoder decoder)
inline

Defines the decoder to be used.

◆ setDecoder() [2/2]

void setDecoder ( MultiDecoder decoder)
inline

Defines the decoder to be used: special logic for multidecoder.

◆ setMissingDataCallback()

void setMissingDataCallback ( void(*)(uint64_t from_seq, uint64_t to_seq, void *ref missing_data_callback)
inline

Callback to be called when data is missing.

◆ setNotifyActive()

void setNotifyActive ( bool  flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active)

◆ setOSCData()

void setOSCData ( OSCData osc)
inline

Optionally define you own OSCData object.

◆ setOutput() [1/3]

virtual void setOutput ( AudioOutput out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, CodecChain, 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, CodecChain, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [3/3]

void setOutput ( Print out_stream)
inlinevirtual

Defines where the decoded result is written to.

Reimplemented from AudioDecoder.

◆ setReference()

void setReference ( void ref)
inline

Provide a reference object to the callback.

◆ setWriteCallback()

void setWriteCallback ( bool(*)(uint64_t time, uint64_t seq, uint8_t *data, size_t len, void *ref write_callback)
inline

Replace the write to the decoder with a callback:

◆ write()

size_t write ( const uint8_t data,
size_t  len 
)
inlinevirtual

Implements AudioWriter.

◆ writeBlocking()

void writeBlocking ( Print out,
uint8_t data,
size_t  len 
)
inlineprotectedinherited

Member Data Documentation

◆ buffer

SingleBuffer<uint8_t> buffer {0}
protected

◆ id

int id
inherited

custom id to be used by application

◆ info

AudioInfo info
protectedinherited

◆ is_active

bool is_active = false
protected

◆ is_multi_decoder

bool is_multi_decoder = false
protected

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ mime_str

Str mime_str
protected

◆ missing_data_callback

void(* missing_data_callback) (uint64_t from_seq, uint64_t to_seq, void *ref) = missingDataCallback
protected

◆ notify_vector

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ osc_default

OSCData osc_default
protected

◆ p_codec

AudioDecoder* p_codec = nullptr
protected

◆ p_osc

OSCData* p_osc = &osc_default
protected

◆ p_out

Print* p_out = nullptr
protected

◆ p_print

Print* p_print = nullptr
protectedinherited

◆ ref

void* ref = nullptr
protected

◆ seq_no

uint64_t seq_no = 0
protected

◆ write_callback

bool(* write_callback) (uint64_t time, uint64_t seq, uint8_t *data, size_t len, void *ref) = nullptr
protected

Return false to complete the processing w/o writing to the decoder.


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