arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
MultiVideoDemuxerFull Class Reference

MultiVideoDemuxer pre-registered with every container format this library ships a demuxer for: DemuxerAVI (RIFF/AVI, AudioCodecs/ContainerAVI.h), DemuxerMP4 (ISO base media/MP4, AudioCodecs/ContainerMP4.h), DemuxerMPG (MPEG Program Stream, AudioCodecs/ContainerMPG.h) - drop it in wherever a plain Demuxer& is expected (VideoPlayer in fact uses one internally as its own built-in demuxer) and it self-selects the right one from the stream's own container signature instead of the caller having to know the file format up front. Use the plain MultiVideoDemuxer (MultiVideoDemuxer.h) instead if you don't want all three container parsers pulled in unconditionally - register only what your content actually needs via its own addDemuxer(). More...

#include <MultiVideoDemuxerFull.h>

Inheritance diagram for MultiVideoDemuxerFull:
MultiVideoDemuxer Demuxer ContainerDecoder MimeSource VideoInfoSource AudioDecoder AudioWriter AudioInfoSource AudioInfoSupport

Public Member Functions

 MultiVideoDemuxerFull ()
 
void addDemuxer (Demuxer &demuxer)
 
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
 
virtual bool begin (AudioInfo info) override
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end () override
 
AudioInfoFormat getAudioInfo () override
 
PrintgetOutput ()
 
VideoInfo getVideoInfo () override
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
virtual bool isValid (const uint8_t *data, size_t len)
 
const char * mime () override
 
const char * mimeVideo () override
 
 operator bool () override
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
DemuxerselectedDemuxer () const
 
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 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.
 
void setOutput (Print &out) override
 
void setOutputAudio (Print &out) override
 
void setOutputVideo (Print &out) override
 
void setOutputVideo (VideoOutput &out) override
 
void setSendWavHeader (bool flag) override
 Forwarded to every registered demuxer eagerly (see class comment).
 
VideoInfo videoInfo () override
 
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 notifyAudioChange (AudioInfo info)
 
void select (Demuxer *demuxer)
 
void writeBlocking (Print *out, uint8_t *data, size_t len)
 

Protected Attributes

DemuxerAVI avi
 
Vector< Demuxer * > demuxers {0}
 
AudioInfo info
 
bool is_first = true
 
bool is_notify_active = true
 
DemuxerMP4 mp4
 
DemuxerMPG mpg
 
Vector< AudioInfoSupport * > notify_vector
 
Printp_print = nullptr
 
Demuxerp_selected = nullptr
 

Detailed Description

MultiVideoDemuxer pre-registered with every container format this library ships a demuxer for: DemuxerAVI (RIFF/AVI, AudioCodecs/ContainerAVI.h), DemuxerMP4 (ISO base media/MP4, AudioCodecs/ContainerMP4.h), DemuxerMPG (MPEG Program Stream, AudioCodecs/ContainerMPG.h) - drop it in wherever a plain Demuxer& is expected (VideoPlayer in fact uses one internally as its own built-in demuxer) and it self-selects the right one from the stream's own container signature instead of the caller having to know the file format up front. Use the plain MultiVideoDemuxer (MultiVideoDemuxer.h) instead if you don't want all three container parsers pulled in unconditionally - register only what your content actually needs via its own addDemuxer().

Unlike MultiVideoDecoderFull's codecs, none of DemuxerAVI/DemuxerMP4/ DemuxerMPG wrap an external codec library - all three are pure parsing code within this library itself, so this header adds no additional third-party dependency beyond what MultiVideoDemuxer.h already needs.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ MultiVideoDemuxerFull()

Member Function Documentation

◆ addDemuxer()

void addDemuxer ( Demuxer demuxer)
inlineinherited

Registers a demuxer under its own Demuxer::mimeVideo() - see the class comment for when/how it's later selected (content-sniffing via its own Demuxer::isValid()). Call before the first write() reaches this object.

Replaces, rather than adds to, any demuxer already registered under the same mimeVideo() - at most one entry per container format, for the same reason MultiVideoDecoder::addDecoder() does: a stale second entry for the same format would otherwise be permanently unreachable dead weight, never actually selected.

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ begin() [1/2]

bool begin ( )
inlineoverridevirtualinherited

Defers actual demuxer init to the first write() (see class comment)

  • always succeeds itself.

Reimplemented from AudioDecoder.

◆ begin() [2/2]

virtual bool begin ( AudioInfo  info)
inlineoverridevirtualinherited

Reimplemented from AudioWriter.

Reimplemented in DecoderBasic, and OggContainerDecoder.

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ end()

void end ( )
inlineoverridevirtualinherited

Reimplemented from AudioDecoder.

◆ getAudioInfo()

AudioInfoFormat getAudioInfo ( )
inlineoverridevirtualinherited

Common audio info of the currently selected demuxer - an empty AudioInfoFormat before the first write()/if none matched.

Implements Demuxer.

◆ getOutput()

Print * getOutput ( )
inlineinherited

◆ getVideoInfo()

VideoInfo getVideoInfo ( )
inlineoverridevirtualinherited

Common video info of the currently selected demuxer - an empty VideoInfo before the first write()/if none matched.

Implements Demuxer.

◆ isNotifyActive()

bool isNotifyActive ( )
inlineinherited

Checks if the automatic AudioInfo update is active.

◆ isValid()

virtual bool isValid ( const uint8_t *  data,
size_t  len 
)
inlinevirtualinherited

True if data (the start of the stream, as handed to the first write()) looks like this demuxer's own container format - content-sniffing, not a guarantee (see the concrete class for exactly what's checked). Used by MultiVideoDemuxer to auto-select a registered demuxer (MultiVideoDemuxer.h); not otherwise part of the write()/parse path. Default false, matching VideoDecoder::isValid()'s own default - a demuxer not meant to be auto-detected this way simply never overrides it.

Reimplemented in DemuxerAVI, DemuxerMP4, and DemuxerMPG.

◆ mime()

const char * mime ( )
inlineoverridevirtualinherited

The audio MIME type of the currently selected demuxer's audio track

  • see Demuxer::mime(). nullptr before the first write()/if none matched, or (depending on the concrete demuxer) until enough of the audio track's own metadata has been parsed.

Implements Demuxer.

◆ mimeVideo()

const char * mimeVideo ( )
inlineoverridevirtualinherited

The container MIME type of the currently selected demuxer (e.g. "video/avi") - nullptr before the first write()/if none matched.

Implements Demuxer.

◆ notifyAudioChange()

void notifyAudioChange ( AudioInfo  info)
inlineprotectedinherited

◆ operator bool()

operator bool ( )
inlineoverridevirtualinherited

Implements AudioWriter.

◆ removeNotifyAudioChange()

virtual bool removeNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ select()

void select ( Demuxer demuxer)
inlineprotectedinherited

◆ selectedDemuxer()

Demuxer * selectedDemuxer ( ) const
inlineinherited

The demuxer detection picked for the current stream - nullptr before the first write(), or if none matched.

◆ setAudioInfo()

void setAudioInfo ( AudioInfo  from)
inlineoverridevirtualinherited

for most decoders this is not needed

Implements AudioWriter.

Reimplemented in DecoderALAC, CodecChain, DSFDecoder, DecoderL8, OpusAudioDecoder, OpusMultiStreamAudioDecoder, CodecNOP, G729Decoder, 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.

◆ 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]

void setOutput ( Print out)
inlineoverridevirtualinherited

Satisfies the AudioWriter/AudioDecoder interface - delegates to setOutputAudio(), matching every concrete Demuxer's own convention.

Reimplemented from AudioDecoder.

◆ setOutputAudio()

void setOutputAudio ( Print out)
inlineoverridevirtualinherited

Defines the audio output stream - forwarded to every registered demuxer eagerly (see class comment).

Implements Demuxer.

◆ setOutputVideo() [1/2]

void setOutputVideo ( Print out)
inlineoverridevirtualinherited

Defines the video output - forwarded to every registered demuxer eagerly (see class comment).

Implements Demuxer.

◆ setOutputVideo() [2/2]

void setOutputVideo ( VideoOutput out)
inlineoverridevirtualinherited

See Demuxer::setOutputVideo(VideoOutput&) - forwarded to every registered demuxer eagerly (same rationale as the Print& overload above).

Implements Demuxer.

◆ setSendWavHeader()

void setSendWavHeader ( bool  flag)
inlineoverridevirtualinherited

Forwarded to every registered demuxer eagerly (see class comment).

Implements Demuxer.

◆ videoInfo()

VideoInfo videoInfo ( )
inlineoverridevirtualinherited

Fulfills VideoInfoSource::videoInfo(), so any Demuxer can be passed directly to e.g. OutputOpenCV::setVideoInfoSource() - note the reported 'format' is the container's codec (e.g. H264), not necessarily what ends up written to a raw-picture VideoOutput/Print (that depends on whatever decoder sits between the demuxer and the output); consumers that care about the decoded format should still set it explicitly and rely on this only for width/height.

Implements VideoInfoSource.

◆ write()

size_t write ( const uint8_t *  data,
size_t  len 
)
inlineoverridevirtualinherited

Implements AudioWriter.

◆ writeBlocking()

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

Member Data Documentation

◆ avi

DemuxerAVI avi
protected

◆ demuxers

Vector<Demuxer *> demuxers {0}
protectedinherited

◆ id

int id
inherited

custom id to be used by application

◆ info

AudioInfo info
protectedinherited

◆ is_first

bool is_first = true
protectedinherited

◆ is_notify_active

bool is_notify_active = true
protectedinherited

◆ mp4

DemuxerMP4 mp4
protected

◆ mpg

DemuxerMPG mpg
protected

◆ notify_vector

Vector<AudioInfoSupport*> notify_vector
protectedinherited

◆ p_print

Print* p_print = nullptr
protectedinherited

◆ p_selected

Demuxer* p_selected = nullptr
protectedinherited

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