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

AVI Container Decoder which can be fed with small chunks of data. The minimum length must be bigger then the header size! The file structure is documented at https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference. More...

#include <ContainerAVI.h>

Inheritance diagram for AVIDecoder:
AudioDecoder AudioWriter AudioInfoSource

Public Member Functions

 AVIDecoder (AudioDecoder *audioDecoder, VideoOutput *videoOut=nullptr, int bufferSize=1024)
 
 AVIDecoder (int bufferSize=1024)
 
AudioFormat audioFormat ()
 Provides the audio_info.wFormatTag.
 
virtual AudioInfo audioInfo ()
 
WAVFormatX aviAudioInfo ()
 Provides the audio information.
 
BitmapInfoHeader aviVideoInfo ()
 Provides the video information.
 
void begin () override
 
virtual void begin (AudioInfo info)
 
void end () override
 
bool isMetadataReady ()
 Returns true if all metadata has been parsed and is available.
 
virtual bool isResultPCM ()
 If true, the decoding result is PCM data.
 
AVIMainHeader mainHeader ()
 Provides the information from the main header chunk.
 
 operator bool () override
 
virtual void setAudioInfo (AudioInfo from) override
 for most decoders this is not needed
 
void setMute (bool mute)
 
void setNotifyAudioChange (AudioInfoSupport &notify) override
 Registers an object that is notified if the audio format is changing.
 
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 the audio output stream - usually called by EncodedAudioStream.
 
virtual void setOutputVideoStream (VideoOutput &out_stream)
 
void setValidationCallback (bool(*cb)(AVIDecoder &avi))
 
void setVideoAudioSync (VideoAudioSync *yourSync)
 Replace the synchronization logic with your implementation.
 
AVIStreamHeader streamHeader (int idx)
 Provides the information from the stream header chunks.
 
const char * videoFormat ()
 
int videoSeconds ()
 Provide the length of the video in seconds.
 
virtual size_t write (const void *data, size_t length) override
 

Protected Member Functions

void cleanupStack ()
 
void consume (int len)
 We remove the processed bytes from the beginning of the buffer.
 
uint32_t getInt (int offset)
 Provides the int32 at the indicated byte offset.
 
StrgetStr (int offset, int len)
 Provides the string at the indicated byte offset with the indicated length.
 
bool isCurrentStreamAudio ()
 
bool isCurrentStreamVideo ()
 
bool parse ()
 
ParseObject parseAVIStreamData ()
 
ParseObject parseChunk (const char *id)
 We load the indicated chunk from the current data.
 
bool parseHeader ()
 
ParseObject parseList (const char *id)
 We load the indicated list from the current data.
 
void processStack (ParseObject &result)
 
void setupAudioInfo ()
 
void setupVideoInfo ()
 
ParseObject tryParseChunk ()
 
ParseObject tryParseChunk (const char *id)
 
ParseObject tryParseList ()
 We try to parse the actual state for any list.
 
ParseObject tryParseList (const char *id)
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 
void writeData ()
 

Protected Attributes

WAVFormatX audio_info
 
Vector< StreamContentType > content_types
 
CopyDecoder copy_decoder
 
long current_pos = 0
 
ParseObject current_stream_data
 
VideoAudioSync defaultSynch
 
bool header_is_avi = false
 
AudioInfo info
 
bool is_metadata_ready = false
 
bool is_mute = false
 
bool is_parsing_active = true
 
AVIMainHeader main_header
 
long movi_end_pos = 0
 
Stack< ParseObjectobject_stack
 
long open_subchunk_len = 0
 
AudioDecoderp_decoder = nullptr
 
AudioInfoSupportp_notify = nullptr
 
EncodedAudioOutputp_output_audio = nullptr
 
VideoOutputp_output_video = nullptr
 
Printp_print = nullptr
 
VideoAudioSyncp_synch = &defaultSynch
 
ParseBuffer parse_buffer
 
ParseState parse_state = ParseHeader
 
StrExt spaces
 
StrExt str
 
Vector< AVIStreamHeaderstream_header
 
int stream_header_idx = -1
 
bool(* validation_cb )(AVIDecoder &avi) = nullptr
 
char video_format [5] = {0}
 
BitmapInfoHeader video_info
 
int video_seconds = 0
 

Detailed Description

AVI Container Decoder which can be fed with small chunks of data. The minimum length must be bigger then the header size! The file structure is documented at https://learn.microsoft.com/en-us/windows/win32/directshow/avi-riff-file-reference.

Author
Phil Schatzmann

Member Function Documentation

◆ setValidationCallback()

void setValidationCallback ( bool(*)(AVIDecoder &avi)  cb)
inline

Register a validation callback which is called after parsing just before playing the audio

◆ tryParseChunk() [1/2]

ParseObject tryParseChunk ( )
inlineprotected

We parse a chunk and provide the FOURCC id and size: No content data is stored

◆ tryParseChunk() [2/2]

ParseObject tryParseChunk ( const char *  id)
inlineprotected

We try to parse the indicated chunk and determine the size: No content data is stored


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