arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | 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:
ContainerDecoder AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 AVIDecoder (AudioDecoder *audioDecoder, VideoOutput *videoOut=nullptr, int bufferSize=1024)
 
 AVIDecoder (int bufferSize=1024)
 
 ~AVIDecoder ()
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
AudioFormat audioFormat ()
 Provides the audio_info.wFormatTag.
 
AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 
WAVFormatX aviAudioInfo ()
 Provides the audio information.
 
BitmapInfoHeader aviVideoInfo ()
 Provides the video information.
 
bool begin () override
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end () override
 
PrintgetOutput ()
 
bool isMetadataReady ()
 Returns true if all metadata has been parsed and is available.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
AVIMainHeader mainHeader ()
 Provides the information from the main header chunk.
 
 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 setMute (bool mute)
 
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 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 charvideoFormat ()
 
int videoSeconds ()
 Provide the length of the video in seconds.
 
virtual size_t write (const uint8_t *data, size_t len) override
 

Public Attributes

int id
 custom id to be used by application
 

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.
 
StrViewgetStr (int offset, int len)
 Provides the string at the indicated byte offset with the indicated length.
 
bool isCurrentStreamAudio ()
 
bool isCurrentStreamVideo ()
 
void notifyAudioChange (AudioInfo info)
 
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< StreamContentTypecontent_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_notify_active = true
 
bool is_parsing_active = true
 
AVIMainHeader main_header
 
long movi_end_pos = 0
 
Vector< AudioInfoSupport * > notify_vector
 
Stack< ParseObjectobject_stack
 
long open_subchunk_len = 0
 
AudioDecoderp_decoder = nullptr
 
EncodedAudioOutputp_output_audio = nullptr
 
VideoOutputp_output_video = nullptr
 
Printp_print = nullptr
 
VideoAudioSyncp_synch = &defaultSynch
 
ParseBuffer parse_buffer
 
ParseState parse_state = ParseHeader
 
Str spaces
 
Str 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

Constructor & Destructor Documentation

◆ AVIDecoder() [1/2]

AVIDecoder ( int  bufferSize = 1024)
inline

◆ AVIDecoder() [2/2]

AVIDecoder ( AudioDecoder audioDecoder,
VideoOutput videoOut = nullptr,
int  bufferSize = 1024 
)
inline

◆ ~AVIDecoder()

~AVIDecoder ( )
inline

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioFormat()

AudioFormat audioFormat ( )
inline

Provides the audio_info.wFormatTag.

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ aviAudioInfo()

WAVFormatX aviAudioInfo ( )
inline

Provides the audio information.

◆ aviVideoInfo()

BitmapInfoHeader aviVideoInfo ( )
inline

Provides the video information.

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtual

Reimplemented from AudioDecoder.

◆ begin() [2/2]

virtual bool begin ( AudioInfo  info)
inlineoverridevirtualinherited

Reimplemented from AudioWriter.

Reimplemented in DecoderBasic, and OggContainerDecoder.

◆ cleanupStack()

void cleanupStack ( )
inlineprotected

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ consume()

void consume ( int  len)
inlineprotected

We remove the processed bytes from the beginning of the buffer.

◆ end()

void end ( )
inlineoverridevirtual

Reimplemented from AudioDecoder.

◆ getInt()

uint32_t getInt ( int  offset)
inlineprotected

Provides the int32 at the indicated byte offset.

◆ getOutput()

Print * getOutput ( )
inlineinherited

◆ getStr()

StrView & getStr ( int  offset,
int  len 
)
inlineprotected

Provides the string at the indicated byte offset with the indicated length.

◆ isCurrentStreamAudio()

bool isCurrentStreamAudio ( )
inlineprotected

◆ isCurrentStreamVideo()

bool isCurrentStreamVideo ( )
inlineprotected

◆ isMetadataReady()

bool isMetadataReady ( )
inline

Returns true if all metadata has been parsed and is available.

◆ isNotifyActive()

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ mainHeader()

AVIMainHeader mainHeader ( )
inline

Provides the information from the main header chunk.

◆ notifyAudioChange()

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineoverridevirtual

Implements AudioWriter.

◆ parse()

bool parse ( )
inlineprotected

◆ parseAVIStreamData()

ParseObject parseAVIStreamData ( )
inlineprotected

◆ parseChunk()

ParseObject parseChunk ( const char id)
inlineprotected

We load the indicated chunk from the current data.

◆ parseHeader()

bool parseHeader ( )
inlineprotected

◆ parseList()

ParseObject parseList ( const char id)
inlineprotected

We load the indicated list from the current data.

◆ processStack()

void processStack ( ParseObject result)
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, CodecNOP, 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, and MultiDecoder.

◆ setMute()

void setMute ( bool  mute)
inline

◆ setNotifyActive()

void setNotifyActive ( bool  flag)
inlineinherited

Deactivate/Reactivate automatic AudioInfo updates: (default is active)

◆ setOutput() [1/3]

virtual void setOutput ( AudioOutput out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, CodecChain, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [2/3]

virtual void setOutput ( AudioStream out_stream)
inlinevirtualinherited

Defines where the decoded result is written to.

Reimplemented in ADTSDecoder, CodecChain, MTSDecoder, MTSDecoderTSDemux, and MetaDataFilterDecoder.

◆ setOutput() [3/3]

virtual void setOutput ( Print out_stream)
inlineoverridevirtual

Defines the audio output stream - usually called by EncodedAudioStream.

Reimplemented from AudioDecoder.

◆ setOutputVideoStream()

virtual void setOutputVideoStream ( VideoOutput out_stream)
inlinevirtual

◆ setupAudioInfo()

void setupAudioInfo ( )
inlineprotected

◆ setupVideoInfo()

void setupVideoInfo ( )
inlineprotected

◆ setValidationCallback()

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

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

◆ setVideoAudioSync()

void setVideoAudioSync ( VideoAudioSync yourSync)
inline

Replace the synchronization logic with your implementation.

◆ streamHeader()

AVIStreamHeader streamHeader ( int  idx)
inline

Provides the information from the stream header chunks.

◆ 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

◆ tryParseList() [1/2]

ParseObject tryParseList ( )
inlineprotected

We try to parse the actual state for any list.

◆ tryParseList() [2/2]

ParseObject tryParseList ( const char id)
inlineprotected

◆ videoFormat()

const char * videoFormat ( )
inline

◆ videoSeconds()

int videoSeconds ( )
inline

Provide the length of the video in seconds.

◆ write()

virtual size_t write ( const uint8_t data,
size_t  len 
)
inlineoverridevirtual

Implements AudioWriter.

◆ writeBlocking()

void writeBlocking ( Print out,
uint8_t data,
size_t  len 
)
inlineprotectedinherited

◆ writeData()

void writeData ( )
inlineprotected

Member Data Documentation

◆ audio_info

WAVFormatX audio_info
protected

◆ content_types

Vector<StreamContentType> content_types
protected

◆ copy_decoder

CopyDecoder copy_decoder
protected

◆ current_pos

long current_pos = 0
protected

◆ current_stream_data

ParseObject current_stream_data
protected

◆ defaultSynch

VideoAudioSync defaultSynch
protected

◆ header_is_avi

bool header_is_avi = false
protected

◆ id

int id
inherited

custom id to be used by application

◆ info

AudioInfo info
protectedinherited

◆ is_metadata_ready

bool is_metadata_ready = false
protected

◆ is_mute

bool is_mute = false
protected

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ is_parsing_active

bool is_parsing_active = true
protected

◆ main_header

AVIMainHeader main_header
protected

◆ movi_end_pos

long movi_end_pos = 0
protected

◆ notify_vector

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ object_stack

Stack<ParseObject> object_stack
protected

◆ open_subchunk_len

long open_subchunk_len = 0
protected

◆ p_decoder

AudioDecoder* p_decoder = nullptr
protected

◆ p_output_audio

EncodedAudioOutput* p_output_audio = nullptr
protected

◆ p_output_video

VideoOutput* p_output_video = nullptr
protected

◆ p_print

Print* p_print = nullptr
protectedinherited

◆ p_synch

VideoAudioSync* p_synch = &defaultSynch
protected

◆ parse_buffer

ParseBuffer parse_buffer
protected

◆ parse_state

ParseState parse_state = ParseHeader
protected

◆ spaces

Str spaces
protected

◆ str

Str str
protected

◆ stream_header

Vector<AVIStreamHeader> stream_header
protected

◆ stream_header_idx

int stream_header_idx = -1
protected

◆ validation_cb

bool(* validation_cb) (AVIDecoder &avi) = nullptr
protected

◆ video_format

char video_format[5] = {0}
protected

◆ video_info

BitmapInfoHeader video_info
protected

◆ video_seconds

int video_seconds = 0
protected

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