|
arduino-audio-tools
|
ATRAC decoder (ATRAC1, ATRAC3, ATRAC3+ and ATRAC9) which converts the raw ATRAC frames into 16 bit PCM data. This class depends on https://github.com/pschatzmann/codec-atrac which is based on the ATRAC decoders of FFmpeg. More...
#include <CodecATRAC.h>


Public Member Functions | |
| DecoderATRAC (ATRACType type=ATRAC3) | |
| ~DecoderATRAC () | |
| 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 |
| bool | begin (ATRACType type, int sampleRate, int channels, int blockAlign, const uint8_t *extra=nullptr, size_t extraSize=0) |
| Starts the decoder with the parameters found in the header of the stream. | |
| virtual bool | begin (AudioInfo info) override |
| virtual void | clearNotifyAudioChange () |
| Deletes all change notify subscriptions. | |
| void | end () override |
| void | flush () |
| Drops partial data and resets the decoder state, e.g. after a seek. | |
| int | frameSize () |
| Size of one ATRAC frame in bytes. | |
| Print * | getOutput () |
| ATRACType | getType () |
| bool | isNotifyActive () |
| Checks if the automatic AudioInfo update is active. | |
| virtual bool | isResultPCM () |
| Returns true to indicate that the decoding result is PCM data. | |
| 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 | |
| void | setBlockSize (int blockSize) override |
| Defines the size of one ATRAC frame (block align) in bytes. | |
| bool | setCodecConfig (const uint8_t *data, size_t len) override |
| Defines the codec specific header (e.g. the WAV fmt extension) | |
| void | setExtraData (const uint8_t *data, size_t len) override |
| Defines the codec specific header (e.g. the WAV fmt extension) | |
| 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 | setType (ATRACType type) |
| Defines the ATRAC variant (must be called before begin()) | |
| AudioFormat | wavFormat () override |
| size_t | write (const uint8_t *data, size_t len) override |
| Decodes the data: any amount of data can be provided. | |
Public Attributes | |
| int | id |
| custom id to be used by application | |
Protected Member Functions | |
| void | decodeFrame () |
| void | notifyAudioChange (AudioInfo info) |
| void | writeBlocking (Print *out, uint8_t *data, size_t len) |
Static Protected Member Functions | |
| static int | atrac9FrameSize (const uint8_t *extra, size_t size) |
Protected Attributes | |
| int | block_align = 0 |
| Vector< uint8_t > | extradata |
| Vector< uint8_t > | frame |
| size_t | frame_pos = 0 |
| int | frame_size = 0 |
| AudioInfo | info |
| bool | is_notify_active = true |
| bool | is_open = false |
| Vector< AudioInfoSupport * > | notify_vector |
| ATRACDecoder * | p_decoder = nullptr |
| Print * | p_print = nullptr |
| Vector< int16_t > | pcm |
| ATRACType | type = ATRAC3 |
Static Protected Attributes | |
| static const int | MAX_SAMPLES_PER_FRAME = 2048 |
| ATRAC3+ has the largest frames: 2048 samples per channel. | |
ATRAC decoder (ATRAC1, ATRAC3, ATRAC3+ and ATRAC9) which converts the raw ATRAC frames into 16 bit PCM data. This class depends on https://github.com/pschatzmann/codec-atrac which is based on the ATRAC decoders of FFmpeg.
The decoder needs to know the stream parameters which are usually found in the header of a container: register one decoder per type with WAVDecoder::addDecoder() to process WAV files (.at3, .at9), use ContainerATRACOMA or ContainerATRACAEA (see ContainerATRAC.h) for OMA and AEA files, or call begin(type, sampleRate, channels, blockAlign, extradata, extradataSize) yourself if you get the raw frames from somewhere else. The write() method can be called with any amount of data: the frames of blockAlign bytes are assembled internally.
| Type | blockAlign | extradata |
|---|---|---|
| ATRAC1 | 212 * channels | - |
| ATRAC3 | frame size | 10, 12 or 14 bytes |
| ATRAC3PLUS | frame size | - |
| ATRAC9 | frame size (or 0: derived) | 12 bytes (rate and channels) |
|
inline |
|
inline |
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, CodecChain, MP3DecoderHelix, MP3DecoderMAD, OggContainerDecoder, RTSPClient< TcpClient, UdpSocket >, Pipeline, and Pipeline::ModifyingStreamAdapter.
ATRAC9 config header: the packet size is the frame size << superframe index (see ATRACDecoder)
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in CodecNOP, DecoderBasic, DSFDecoder, MP3DecoderHelix, MP3DecoderMAD, OpusAudioDecoder, OpusMultiStreamAudioDecoder, VorbisDecoder, WAVDecoder, WavIMADecoder, OggContainerDecoder, and VorbisDecoder.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, ResampleStreamT< TInterpolator >, and SupportedRatesStream.
|
inlineoverridevirtual |
Starts the decoder with the values defined with setAudioInfo(), setBlockSize() and setCodecConfig()
Reimplemented from AudioDecoder.
|
inline |
Starts the decoder with the parameters found in the header of the stream.
Reimplemented from AudioWriter.
Reimplemented in DecoderBasic, and OggContainerDecoder.
|
inlinevirtualinherited |
Deletes all change notify subscriptions.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineprotected |
|
inlineoverridevirtual |
Reimplemented from AudioDecoder.
|
inline |
Drops partial data and resets the decoder state, e.g. after a seek.
|
inline |
Size of one ATRAC frame in bytes.
|
inlineinherited |
|
inline |
|
inlinevirtualinherited |
Returns true to indicate that the decoding result is PCM data.
Reimplemented in CopyDecoder, DecoderNetworkFormat, and ContainerM4A.
|
inlineoverridevirtual |
Provides the mime type of the data that is expected by this decoder.
Implements AudioDecoder.
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Implements AudioWriter.
|
inlinevirtualinherited |
Removes a target in order not to be notified about audio changes.
Reimplemented in RTSPClient< TcpClient, UdpSocket >.
|
inlineoverridevirtualinherited |
for most decoders this is not needed
Implements AudioWriter.
Reimplemented in DecoderALAC, CodecChain, DSFDecoder, DecoderL8, OpusAudioDecoder, OpusMultiStreamAudioDecoder, CodecNOP, G729Decoder, and G7xxDecoder.
|
inlineoverridevirtual |
Defines the size of one ATRAC frame (block align) in bytes.
Implements AudioDecoderExt.
Defines the codec specific header (e.g. the WAV fmt extension)
Reimplemented from AudioDecoder.
Defines the codec specific header (e.g. the WAV fmt extension)
Reimplemented from AudioDecoderExt.
|
inlineinherited |
Deactivate/Reactivate automatic AudioInfo updates: (default is active)
|
inlinevirtualinherited |
Defines where the decoded result is written to.
Reimplemented in ContainerATRAC, ADTSDecoder, CodecChain, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.
|
inlinevirtualinherited |
Defines where the decoded result is written to.
Reimplemented in ContainerATRAC, ADTSDecoder, CodecChain, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.
|
inlineoverridevirtualinherited |
Defines where the decoded result is written to.
Implements AudioWriter.
Reimplemented in DecoderBase64, MP3DecoderMAD, DemuxerMP4, DemuxerMPG, DemuxerMTS, DecoderAdapter, MultiVideoDemuxer, CodecNOP, ADPCMDecoderXQ, APTXDecoder, Codec2Decoder, CopyDecoder, G722Decoder, GSMDecoder, ILBCDecoder, LC3Decoder, DecoderNetworkFormat, SBCDecoder, WavIMADecoder, AACDecoderFDK, AACDecoderHelix, ADPCMDecoder, ADTSDecoder, DecoderBasic, CodecChain, DecoderFloat, G729Decoder, G7xxDecoder, DecoderL16, MP2Decoder, MTSDecoder, OpusAudioDecoder, OpusMultiStreamAudioDecoder, MTSDecoderTSDemux, WAVDecoder, ContainerATRAC, ContainerATRAC, DemuxerAVI, ContainerM4A, MultiDecoder, MetaDataFilterDecoder, MP3DecoderMini, BinaryContainerDecoder, OSCContainerDecoder, MP3DecoderHelix, and OggContainerDecoder.
|
inline |
Defines the ATRAC variant (must be called before begin())
|
inlineoverridevirtual |
Provides the WAV format tag of the selected type, so that the decoder can be registered with WAVDecoder::addDecoder(): ATRAC3, ATRAC3+ and ATRAC9 are supported in WAV files
Reimplemented from AudioDecoderExt.
Decodes the data: any amount of data can be provided.
Implements AudioWriter.
|
protected |
|
protected |
|
protected |
|
inherited |
custom id to be used by application
|
protectedinherited |
|
protectedinherited |
|
protected |
|
staticprotected |
ATRAC3+ has the largest frames: 2048 samples per channel.
|
protectedinherited |
|
protected |
|
protectedinherited |
|
protected |