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

Decodes ATRAC3 and ATRAC3+ audio in a Sony OpenMG audio container (.oma, .aa3, .at3): the file starts with an ID3v2 like tag ('ea3' or 'ID3') which is followed by a 96 byte 'EA3' header with the codec parameters. Encrypted files are not supported. More...

#include <ContainerATRAC.h>

Inheritance diagram for ContainerATRACOMA:
Inheritance graph
[legend]
Collaboration diagram for ContainerATRACOMA:
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 Types

enum  CodecId { CodecATRAC3 = 0 , CodecATRAC3Plus = 1 }
 
enum  State { Start = 0 , Ea3 }
 

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.
 
void parseEa3 ()
 
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)
 
static size_t syncSafe (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 EA3_HEADER_SIZE = 96
 
static const size_t ID3_HEADER_SIZE = 10
 

Detailed Description

Decodes ATRAC3 and ATRAC3+ audio in a Sony OpenMG audio container (.oma, .aa3, .at3): the file starts with an ID3v2 like tag ('ea3' or 'ID3') which is followed by a 96 byte 'EA3' header with the codec parameters. Encrypted files are not supported.

Author
Phil Schatzmann

Member Enumeration Documentation

◆ CodecId

enum CodecId
protected
Enumerator
CodecATRAC3 
CodecATRAC3Plus 

◆ State

enum State
protected
Enumerator
Start 
Ea3 

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.

◆ parseEa3()

void parseEa3 ( )
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 >.

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

◆ syncSafe()

static size_t syncSafe ( const uint8_t *  p)
inlinestaticprotected

◆ 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

◆ dec

DecoderATRAC dec
protectedinherited

◆ EA3_HEADER_SIZE

const size_t EA3_HEADER_SIZE = 96
staticprotected

◆ hdr

Vector<uint8_t> hdr
protectedinherited

◆ id

int id
inherited

custom id to be used by application

◆ ID3_HEADER_SIZE

const size_t ID3_HEADER_SIZE = 10
staticprotected

◆ 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

◆ state

int state = 0
protectedinherited

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