arduino-audio-tools
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members

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>

Inheritance diagram for ContainerMP4:
ContainerDecoder AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

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
 
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. More...
 
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
 
AudioDecoderp_decoder = &aac_decoder
 
Printp_print = nullptr
 
const char * stream_atom
 
int stream_out_open = 0
 

Friends

class MP4ParseBuffer
 

Detailed Description

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!

Author
Phil Schatzmann

Member Function Documentation

◆ default_data_callback()

static void default_data_callback ( MP4Atom atom,
ContainerMP4 container 
)
inlinestaticprotected

Default logic to process an atom.

output of mdat to decoder;


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