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

Vorbis Streaming Decoder using https://github.com/pschatzmann/arduino-libvorbis-tremor. More...

#include <CodecVorbis.h>

Inheritance diagram for VorbisDecoder:
StreamingDecoder AudioInfoSource AudioInfoSupport

Public Member Functions

 ~VorbisDecoder ()
 Destroy the VorbisDecoder object.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioInfo audioInfo () override
 Provides the last available MP3FrameInfo.
 
virtual AudioInfo audioInfoOut ()
 
bool begin () override
 Starts the processing.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
virtual bool copy () override
 Process a single read operation - to be called in the loop.
 
bool copyAll ()
 Process all available data.
 
void end () override
 Releases the reserved memory.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
const char * mime () override
 Provides "audio/ogg".
 
virtual operator bool () override
 checks if the class is active
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
void setDelayOnNoData (size_t delay)
 Defines the delay when there is no data.
 
void setInput (Stream &inStream)
 Stream Interface: Decode directly by taking data from the stream.
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
virtual void setOutput (AudioOutput &out_stream)
 Defines the output streams and register to be notified.
 
virtual void setOutput (AudioStream &out_stream)
 Defines the output streams and register to be notified.
 
virtual void setOutput (Print &out_stream)
 Defines the output Stream.
 
void setReadSize (size_t size)
 Defines the default read size.
 
void setWaitForData (size_t wait)
 Defines the delay to wait if there is not enough data to open the decoder.
 

Protected Member Functions

AudioInfo currentInfo ()
 
const char * getOpenError (int error)
 
void notifyAudioChange (AudioInfo info)
 
bool ovOpen ()
 
virtual size_t readBytes (uint8_t *data, size_t len) override
 Reads bytes from the input stream.
 
const char * readError (long error)
 
void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
 

Static Protected Member Functions

static size_t read_func (void *ptr, size_t size, size_t nmemb, void *datasource)
 
static int seek_func (void *datasource, ogg_int64_t offset, int whence)
 
static long tell_func (void *datasource)
 

Protected Attributes

bool active = false
 
int bitstream = 0
 
ov_callbacks callbacks
 
AudioInfo cfg
 
size_t delay_on_no_data_ms = 100
 
size_t delay_wait_for_data_ms = 500
 
OggVorbis_File file
 
AudioInfo info
 
bool is_first = true
 
bool is_notify_active = true
 
bool is_ov_open = false
 
size_t max_read_size = 1024
 
Vector< AudioInfoSupport * > notify_vector
 
Streamp_input = nullptr
 Input stream for encoded audio data.
 
Printp_print = nullptr
 Output stream for decoded PCM data.
 
Vector< uint8_t > pcm {0}
 

Detailed Description

Vorbis Streaming Decoder using https://github.com/pschatzmann/arduino-libvorbis-tremor.

Author
Phil Schatzmann

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtual

Provides the last available MP3FrameInfo.

Implements StreamingDecoder.

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ begin()

bool begin ( )
inlineoverridevirtual

Starts the processing.

Implements StreamingDecoder.

◆ copy()

virtual bool copy ( )
inlineoverridevirtual

Process a single read operation - to be called in the loop.

Reads a chunk of data from the input stream, decodes it, and writes the decoded PCM data to the output stream.

Returns
true if data was processed successfully, false if no more data is available or an error occurred

Implements StreamingDecoder.

◆ copyAll()

bool copyAll ( )
inlineinherited

Process all available data.

Convenience method that calls copy() repeatedly until all available data has been processed.

Returns
true if any data was processed, false if no data was available

◆ end()

void end ( )
inlineoverridevirtual

Releases the reserved memory.

Implements StreamingDecoder.

◆ mime()

const char * mime ( )
inlineoverridevirtual

Provides "audio/ogg".

Implements StreamingDecoder.

◆ operator bool()

virtual operator bool ( )
inlineoverridevirtual

checks if the class is active

Implements StreamingDecoder.

◆ readBytes()

virtual size_t readBytes ( uint8_t *  data,
size_t  len 
)
inlineoverrideprotectedvirtual

Reads bytes from the input stream.

Derived classes must implement this to read data from their input source.

Parameters
dataBuffer to store the read data
lenMaximum number of bytes to read
Returns
Number of bytes actually read

Implements StreamingDecoder.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  info)
inlineoverrideprotectedvirtualinherited

Defines the input AudioInfo.

Implements AudioInfoSupport.

◆ setInput()

void setInput ( Stream inStream)
inlineinherited

Stream Interface: Decode directly by taking data from the stream.

This is more efficient than feeding the decoder with write: just call copy() in the loop to process data from the input stream.

Parameters
inStreamThe input stream containing encoded audio data

◆ setOutput() [1/3]

virtual void setOutput ( AudioOutput out_stream)
inlinevirtualinherited

Defines the output streams and register to be notified.

Sets the output stream and registers for audio info change notifications.

Parameters
out_streamThe AudioOutput to write decoded audio data to

Reimplemented in MultiStreamingDecoder.

◆ setOutput() [2/3]

virtual void setOutput ( AudioStream out_stream)
inlinevirtualinherited

Defines the output streams and register to be notified.

Sets the output stream and registers for audio info change notifications.

Parameters
out_streamThe AudioStream to write decoded audio data to

Reimplemented in MultiStreamingDecoder.

◆ setOutput() [3/3]

virtual void setOutput ( Print out_stream)
inlinevirtualinherited

Defines the output Stream.

Sets where the decoded PCM audio data will be written to.

Parameters
out_streamThe Print stream to write decoded audio data to

Reimplemented in StreamingDecoderAdapter, and MultiStreamingDecoder.


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