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

Foxen FLAC Decoder using https://github.com/astoeckel/libfoxenflac Unlike FLACDecoder which is a streaming decoder, this is a simple AudioDecoder implementation. More...

#include <CodecFLACFoxen.h>

Inheritance diagram for FLACDecoderFoxen:
AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 FLACDecoderFoxen ()=default
 
 FLACDecoderFoxen (int maxBlockSize, int maxChannels, bool convertTo16Bits=true, bool releaseOnEnd=false)
 Default Constructor.
 
 ~FLACDecoderFoxen ()
 Destructor - calls end();.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
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 ()
 
void flush ()
 
PrintgetOutput ()
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual bool isResultPCM ()
 Returns true to indicate that the decoding result is PCM data.
 
 operator bool () override
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
void set32Bit (bool flag)
 Select between 16 and 32 bit output: the default is 16 bits.
 
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 setInBufferSize (int size)
 Defines the input buffer size (default is 2k)
 
void setMaxBlockSize (int size)
 Defines the maximum FLAC blocksize: drives the buffer allocation.
 
void setMaxChannels (int ch)
 Defines the maximum number of channels: drives the buffer allocation.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
void setOutBufferSize (int size)
 
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.
 
virtual void setOutput (Print &out_stream) override
 Defines where the decoded result is written to.
 
size_t write (const uint8_t *data, size_t len) override
 

Public Attributes

int id
 custom id to be used by application
 

Protected Member Functions

bool decode ()
 
void notifyAudioChange (AudioInfo info)
 
void processMetadata ()
 
void write16BitData (int out_len)
 
void write32BitData (int out_len)
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

int bits_eff = 0
 
fx_flac_tflac = nullptr
 
Vector< uint8_tfoxen_data {0}
 
int in_buffer_size = 1024 * 2
 
AudioInfo info
 
bool is_active = false
 
bool is_convert_to_16 = true
 
bool is_notify_active = true
 
bool is_release_memory_on_end = false
 
bool is_stop_on_error = true
 
int max_block_size = 5 * 1024
 
int max_channels = 2
 
Vector< AudioInfoSupport * > notify_vector
 
Vector< int32_tout
 
int out_buffer_size = 1024 * 4
 
Printp_print = nullptr
 
SingleBuffer< uint8_twrite_buffer {0}
 

Detailed Description

Foxen FLAC Decoder using https://github.com/astoeckel/libfoxenflac Unlike FLACDecoder which is a streaming decoder, this is a simple AudioDecoder implementation.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ FLACDecoderFoxen() [1/2]

FLACDecoderFoxen ( )
default

◆ FLACDecoderFoxen() [2/2]

FLACDecoderFoxen ( int  maxBlockSize,
int  maxChannels,
bool  convertTo16Bits = true,
bool  releaseOnEnd = false 
)
inline

Default Constructor.

◆ ~FLACDecoderFoxen()

~FLACDecoderFoxen ( )
inline

Destructor - calls end();.

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.

Reimplemented in DecoderBasic, and OggContainerDecoder.

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ decode()

bool decode ( )
inlineprotected

◆ end()

void end ( )
inlinevirtual

Reimplemented from AudioDecoder.

◆ flush()

void flush ( )
inline

◆ getOutput()

Print * getOutput ( )
inlineinherited

◆ isNotifyActive()

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isResultPCM()

virtual bool isResultPCM ( )
inlinevirtualinherited

Returns true to indicate that the decoding result is PCM data.

Reimplemented in CopyDecoder, DecoderNetworkFormat, and ContainerM4A.

◆ notifyAudioChange()

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineoverridevirtual

Implements AudioWriter.

◆ processMetadata()

void processMetadata ( )
inlineprotected

◆ removeNotifyAudioChange()

virtual bool removeNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

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

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ set32Bit()

void set32Bit ( bool  flag)
inline

Select between 16 and 32 bit output: the default is 16 bits.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtualinherited

for most decoders this is not needed

Implements AudioWriter.

Reimplemented in DecoderALAC, CodecChain, DSFDecoder, 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.

◆ setInBufferSize()

void setInBufferSize ( int  size)
inline

Defines the input buffer size (default is 2k)

◆ setMaxBlockSize()

void setMaxBlockSize ( int  size)
inline

Defines the maximum FLAC blocksize: drives the buffer allocation.

◆ setMaxChannels()

void setMaxChannels ( int  ch)
inline

Defines the maximum number of channels: drives the buffer allocation.

◆ setNotifyActive()

void setNotifyActive ( bool  flag)
inlineinherited

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

◆ setOutBufferSize()

void setOutBufferSize ( int  size)
inline

Defines the number of 32 bit samples for providing the result (default is 4k)

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

virtual void setOutput ( Print out_stream)
inlineoverridevirtualinherited

◆ write()

size_t write ( const uint8_t data,
size_t  len 
)
inlineoverridevirtual

Implements AudioWriter.

◆ write16BitData()

void write16BitData ( int  out_len)
inlineprotected

◆ write32BitData()

void write32BitData ( int  out_len)
inlineprotected

◆ writeBlocking()

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

Member Data Documentation

◆ bits_eff

int bits_eff = 0
protected

◆ flac

fx_flac_t* flac = nullptr
protected

◆ foxen_data

Vector<uint8_t> foxen_data {0}
protected

◆ id

int id
inherited

custom id to be used by application

◆ in_buffer_size

int in_buffer_size = 1024 * 2
protected

◆ info

AudioInfo info
protectedinherited

◆ is_active

bool is_active = false
protected

◆ is_convert_to_16

bool is_convert_to_16 = true
protected

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ is_release_memory_on_end

bool is_release_memory_on_end = false
protected

◆ is_stop_on_error

bool is_stop_on_error = true
protected

◆ max_block_size

int max_block_size = 5 * 1024
protected

◆ max_channels

int max_channels = 2
protected

◆ notify_vector

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ out

Vector<int32_t> out
protected

◆ out_buffer_size

int out_buffer_size = 1024 * 4
protected

◆ p_print

Print* p_print = nullptr
protectedinherited

◆ write_buffer

SingleBuffer<uint8_t> write_buffer {0}
protected

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