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

Decodes ATRAC1 audio of a Sony MiniDisc .aea file: a 2048 byte header (magic, title, number of channels) is followed by the frames of 212 bytes per channel. The sample rate is 44100. More...

#include <ContainerATRAC.h>

Inheritance diagram for ContainerATRACAEA:
Inheritance graph
[legend]
Collaboration diagram for ContainerATRACAEA:
Collaboration graph
[legend]

Public Member Functions

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 () override
 Prepares the decoder for a new stream.
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
DecoderATRAC & decoder ()
 Provides access to the ATRAC decoder.
 
void end () override
 
Print * getOutput ()
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
const char * mime () override
 Provides the mime type of the data that is expected by this decoder.
 
 operator bool () override
 
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 setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
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.
 
void setOutput (Print &out_stream) override
 Defines where the decoded PCM data is written to.
 
size_t write (const uint8_t *data, size_t len) override
 Processes the container data: returns 0 if the stream is not supported.
 

Public Attributes

int id
 custom id to be used by application
 

Protected Member Functions

bool collect (const uint8_t *&p, size_t &n, size_t need)
 Copies the data into hdr until it contains need bytes.
 
void fail (const char *msg)
 
void notifyAudioChange (AudioInfo info)
 
void parse (const uint8_t *&p, size_t &n) override
 Processes the header data: must consume data, change the state or fail.
 
bool startDecoder (ATRACType type, int sample_rate, int channels, int block_align, const uint8_t *extra=nullptr, size_t extra_size=0, bool known=false, uint32_t length=0)
 Configures the decoder: the audio data starts after the header.
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 
void writePayload (const uint8_t *&p, size_t &n)
 

Static Protected Member Functions

static uint16_t be16 (const uint8_t *p)
 
static uint32_t be24 (const uint8_t *p)
 

Protected Attributes

DecoderATRAC dec
 
Vector< uint8_t > hdr
 
AudioInfo info
 
bool is_active = false
 
bool is_done = false
 
bool is_failed = false
 
bool is_notify_active = true
 
bool is_streaming = false
 
Vector< AudioInfoSupport * > notify_vector
 
Print * p_print = nullptr
 
bool payload_known = false
 
uint32_t payload_left = 0
 remaining audio bytes (only relevant if payload_known)
 
size_t skip_count = 0
 
int state = 0
 

Static Protected Attributes

static const size_t CHANNELS_POS = 264
 
static const size_t HEADER_SIZE = 2048
 
static const int SOUND_UNIT_SIZE = 212
 

Detailed Description

Decodes ATRAC1 audio of a Sony MiniDisc .aea file: a 2048 byte header (magic, title, number of channels) is followed by the frames of 212 bytes per channel. The sample rate is 44100.

Author
Phil Schatzmann

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport &  bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ be16()

static uint16_t be16 ( const uint8_t *  p)
inlinestaticprotectedinherited

◆ be24()

static uint32_t be24 ( const uint8_t *  p)
inlinestaticprotectedinherited

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtualinherited

Prepares the decoder for a new stream.

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

◆ collect()

bool collect ( const uint8_t *&  p,
size_t &  n,
size_t  need 
)
inlineprotectedinherited

Copies the data into hdr until it contains need bytes.

◆ decoder()

DecoderATRAC & decoder ( )
inlineinherited

Provides access to the ATRAC decoder.

◆ end()

void end ( )
inlineoverridevirtualinherited

Reimplemented from AudioDecoder.

◆ fail()

void fail ( const char *  msg)
inlineprotectedinherited

◆ getOutput()

Print * getOutput ( )
inlineinherited

◆ isNotifyActive()

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ mime()

const char * mime ( )
inlineoverridevirtual

Provides the mime type of the data that is expected by this decoder.

Implements AudioDecoder.

◆ notifyAudioChange()

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineoverridevirtualinherited

Implements AudioWriter.

◆ parse()

void parse ( const uint8_t *&  p,
size_t &  n 
)
inlineoverrideprotectedvirtual

Processes the header data: must consume data, change the state or fail.

Implements ContainerATRAC.

◆ 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, OpusMultiStreamAudioDecoder, 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, DecoderATRAC, and MultiDecoder.

◆ setNotifyActive()

void setNotifyActive ( bool  flag)
inlineinherited

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

◆ setOutput() [1/4]

virtual void setOutput ( AudioOutput &  out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented from AudioDecoder.

◆ setOutput() [2/4]

virtual void setOutput ( AudioStream &  out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented from AudioDecoder.

◆ setOutput() [3/4]

virtual void setOutput ( Print &  out_stream)
inlineoverridevirtualinherited

Defines where the decoded result is written to.

Reimplemented from AudioDecoder.

◆ setOutput() [4/4]

void setOutput ( Print &  out_stream)
inlineoverridevirtualinherited

Defines where the decoded PCM data is written to.

Reimplemented from AudioDecoder.

◆ startDecoder()

bool startDecoder ( ATRACType  type,
int  sample_rate,
int  channels,
int  block_align,
const uint8_t *  extra = nullptr,
size_t  extra_size = 0,
bool  known = false,
uint32_t  length = 0 
)
inlineprotectedinherited

Configures the decoder: the audio data starts after the header.

◆ write()

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

Processes the container data: returns 0 if the stream is not supported.

Implements AudioWriter.

◆ writeBlocking()

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

◆ writePayload()

void writePayload ( const uint8_t *&  p,
size_t &  n 
)
inlineprotectedinherited

Member Data Documentation

◆ CHANNELS_POS

const size_t CHANNELS_POS = 264
staticprotected

◆ dec

DecoderATRAC dec
protectedinherited

◆ hdr

Vector<uint8_t> hdr
protectedinherited

◆ HEADER_SIZE

const size_t HEADER_SIZE = 2048
staticprotected

◆ id

int id
inherited

custom id to be used by application

◆ info

AudioInfo info
protectedinherited

◆ is_active

bool is_active = false
protectedinherited

◆ is_done

bool is_done = false
protectedinherited

◆ is_failed

bool is_failed = false
protectedinherited

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ is_streaming

bool is_streaming = false
protectedinherited

◆ notify_vector

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ p_print

Print* p_print = nullptr
protectedinherited

◆ payload_known

bool payload_known = false
protectedinherited

◆ payload_left

uint32_t payload_left = 0
protectedinherited

remaining audio bytes (only relevant if payload_known)

◆ skip_count

size_t skip_count = 0
protectedinherited

◆ SOUND_UNIT_SIZE

const int SOUND_UNIT_SIZE = 212
staticprotected

◆ state

int state = 0
protectedinherited

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