arduino-audio-tools
|
Minimum flexible parser for MPEG4 data (which is based on the Quicktime format). Small atoms will be make available via a callback method. The big (audio) content is written to the Print object which was specified in the constructor. Depends on https://github.com/pschatzmann/arduino-libhelix! More...
#include <ContainerMP4.h>
Public Member Functions | |
ContainerMP4 (AudioDecoder &decoder, const char *streamAtom="mdat") | |
ContainerMP4 (AudioDecoder *decoder, const char *streamAtom="mdat") | |
ContainerMP4 (const char *streamAtom="mdat") | |
virtual void | addNotifyAudioChange (AudioInfoSupport &bi) |
Adds target to be notified about audio changes. | |
virtual AudioInfo | audioInfo () |
provides the actual input AudioInfo | |
virtual AudioInfo | audioInfoOut () |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream | |
bool | begin () override |
starts the processing | |
virtual bool | begin (AudioInfo info) override |
virtual void | clearNotifyAudioChange () |
Deletes all change notify subscriptions. | |
void | end () override |
ends the processing | |
Print * | getOutput () |
bool | isHeader (MP4Atom *atom, const uint8_t *data) |
Checks if the indicated atom is a header atom: you can define your custom method with setIsHeaderCallback() | |
bool | isNotifyActive () |
Checks if the automatic AudioInfo update is active. | |
int | maxSize () |
Provides the maximum size. | |
operator bool () override | |
virtual bool | removeNotifyAudioChange (AudioInfoSupport &bi) |
Removes a target in order not to be notified about audio changes. | |
virtual void | setAudioInfo (AudioInfo from) override |
for most decoders this is not needed | |
void | setDataCallback (void(*cb)(MP4Atom &atom, ContainerMP4 &container)) |
Defines the callback that is executed on each atom. | |
void | setIsHeaderCallback (bool(*cb)(MP4Atom *atom, const uint8_t *data)) |
Defines the callback which is used to determine if an atom is a header atom. | |
void | setMaxSize (int size) |
Defines the maximum size that we can submit to the decoder. | |
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. | |
const char * | streamAtom () |
Provides the content atom name which will be written incrementally. | |
size_t | write (const uint8_t *data, size_t len) override |
writes the data to be parsed into atoms | |
Public Attributes | |
int | id |
custom id to be used by application | |
Protected Member Functions | |
size_t | decode (const uint8_t *data, size_t len) |
output of audio mdat to helix decoder; | |
void | notifyAudioChange (AudioInfo info) |
void | setStreamOutputSize (int size) |
Defines the size of open data that will be written directly w/o parsing. | |
void | writeBlocking (Print *out, uint8_t *data, size_t len) |
Static Protected Member Functions | |
static void | default_data_callback (MP4Atom &atom, ContainerMP4 &container) |
Default logic to process an atom. | |
static bool | default_is_header_callback (MP4Atom *atom, const uint8_t *data) |
Default logic to determine if a atom is a header. | |
Protected Attributes | |
AACDecoderHelix | aac_decoder |
MP4ParseBuffer | buffer {this} |
const char * | current_atom = nullptr |
int | current_pos = 0 |
void(* | data_callback )(MP4Atom &atom, ContainerMP4 &container)=default_data_callback |
AudioInfo | info |
bool | is_active = false |
bool(* | is_header_callback )(MP4Atom *atom, const uint8_t *data)=default_is_header_callback |
bool | is_notify_active = true |
bool | is_sound = false |
int | max_size |
Vector< AudioInfoSupport * > | notify_vector |
AudioDecoder * | p_decoder = &aac_decoder |
Print * | p_print = nullptr |
const char * | stream_atom |
int | stream_out_open = 0 |
Friends | |
class | MP4ParseBuffer |
Minimum flexible parser for MPEG4 data (which is based on the Quicktime format). Small atoms will be make available via a callback method. The big (audio) content is written to the Print object which was specified in the constructor. Depends on https://github.com/pschatzmann/arduino-libhelix!
|
inlinevirtualinherited |
Adds target to be notified about audio changes.
Reimplemented in CodecNOP, MP3DecoderMAD, EncodedAudioOutput, EncodedAudioStream, AACDecoderFDK, DecoderBasic, MP3DecoderHelix, OggContainerDecoder, Pipeline, and Pipeline::ModifyingStreamAdapter.
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in CodecNOP, GGWaveDecoder, AACDecoderFDK, AACDecoderHelix, DecoderBasic, MP3DecoderHelix, MP3DecoderMAD, OpusAudioDecoder, WAVDecoder, WavIMADecoder, and OggContainerDecoder.
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, and ResampleStream.
|
inlineoverridevirtual |
starts the processing
Reimplemented from AudioDecoder.
Reimplemented from AudioWriter.
|
inlinestaticprotected |
Default logic to process an atom.
output of mdat to decoder;
|
inlineoverridevirtual |
ends the processing
Reimplemented from AudioDecoder.
Implements AudioWriter.
for most decoders this is not needed
Implements AudioWriter.
Reimplemented in GGWaveDecoder, DecoderL8, OpusAudioDecoder, CodecNOP, AACDecoderHelix, and G7xxDecoder.
|
inlinevirtualinherited |
Defines where the decoded result is written to.
Reimplemented in MetaDataFilterDecoder.
|
inlinevirtualinherited |
Defines where the decoded result is written to.
Reimplemented in MetaDataFilterDecoder.
Defines where the decoded result is written to.
Implements AudioWriter.
Reimplemented in MP3DecoderMAD, DecoderBase64, DecoderAdapter, CodecNOP, AACDecoderFDK, AACDecoderHelix, ADPCMDecoderXQ, APTXDecoder, Codec2Decoder, CopyDecoder, G722Decoder, GSMDecoder, ILBCDecoder, LC3Decoder, SBCDecoder, WavIMADecoder, GGWaveDecoder, ADPCMDecoder, DecoderBasic, DecoderFloat, G7xxDecoder, DecoderL16, OpusAudioDecoder, WAVDecoder, AVIDecoder, MultiDecoder, MetaDataFilterDecoder, MP3DecoderMini, BinaryContainerDecoder, MP3DecoderHelix, and OggContainerDecoder.
writes the data to be parsed into atoms
Implements AudioWriter.