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

Bridges VideoDecoder's write() calls to the TFT - VideoDecoder always hands over one complete frame per write() call (see its class comment), so this can push the whole frame in one go. Usually the data is in RGB565 format, but other formats are supported as well. More...

#include <OutputTFT_eSPI.h>

Inheritance diagram for OutputTFT_eSPI:
VideoOutput

Public Member Functions

 OutputTFT_eSPI (TFT_eSPI &tft)
 
bool begin ()
 
virtual void flush ()
 
uint32_t getWriteTimeMs () const
 Optional: returns the time (ms) spent in the last write() call.
 
virtual bool hadOutput () const
 
virtual bool isKeyFrame (const uint8_t *data, size_t len)
 
virtual void setSkipRender (bool skip)
 
void setVideoInfo (VideoInfo info)
 Defines the video format and dimensions - call before begin() if you.
 
void setVideoInfoSource (VideoInfoSource &source) override
 Defines the source of the video information (width, height, fps, format)
 
virtual uint64_t totalDecodeMs () const
 
size_t write (const uint8_t *data, size_t len) override
 

Protected Attributes

VideoInfo info_
 
VideoInfoSourcep_info = nullptr
 
TFT_eSPI & tft_
 
uint32_t write_time_ms = 0
 

Detailed Description

Bridges VideoDecoder's write() calls to the TFT - VideoDecoder always hands over one complete frame per write() call (see its class comment), so this can push the whole frame in one go. Usually the data is in RGB565 format, but other formats are supported as well.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ OutputTFT_eSPI()

OutputTFT_eSPI ( TFT_eSPI &  tft)
inline

Member Function Documentation

◆ begin()

bool begin ( )
inline

◆ flush()

virtual void flush ( )
inlinevirtualinherited

Finalizes the frame most recently written via one or more write() calls - see class comment. Default no-op for implementations that display/decode synchronously in write() instead.

Reimplemented in Muxer, H264DecoderESP32S3< Alloc >, MJPEGDecoder, MPGDecoder, MultiVideoDecoder, OutputFPSMeter, OutputOpenCV, PacedVideoOutput, and VideoFrameMeter.

◆ getWriteTimeMs()

uint32_t getWriteTimeMs ( ) const
inlinevirtual

Optional: returns the time (ms) spent in the last write() call.

Reimplemented from VideoOutput.

◆ hadOutput()

virtual bool hadOutput ( ) const
inlinevirtualinherited

True if the most recent write()+flush() call actually produced a displayable picture - default true, matching every synchronous decoder (H264Decoder, MJPEGDecoder, ...), which always decodes and pushes pixels fully within that one call. Override this only if your decoder can legitimately accept/decode a frame's bytes without emitting a picture during that same call - e.g. MPGDecoder, whose B-picture display-order reordering can hold a just-decoded picture back and instead emit an earlier one (or nothing at all) from a given write(), see its own override. Used by PacedVideoOutput to avoid counting/timing a call that did no real rendering work as a rendered frame - without this, its outputFPS()/frameCountI()/ frameCountP()/avgFrameMs() would overcount for such a decoder.

Reimplemented in MPGDecoder.

◆ isKeyFrame()

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

True if data (one complete encoded frame, as handed to write()) is a keyframe/sync-sample - self-contained, decodable without any earlier frame. Used e.g. by PacedVideoOutput to decide which frames are safe to drop, and whether it's safe to resume decoding after abandoning a backlog (see its own class comment). Default false: a plain VideoOutput doesn't know or care about codec structure - override this in a decoder for the bitstream format it actually parses (see H264Decoder/H264DecoderESP32S3's isH264KeyFrame()-based override, MPGDecoder's isMpeg1KeyFrame()- based one). Getting this right matters beyond bookkeeping: a target whose frames are never recognized as keyframes can leave a caller like PacedVideoOutput unable to ever resume after a resync.

Reimplemented in PacedVideoOutput, H264Decoder, H264DecoderESP32S3< Alloc >, MJPEGDecoder, MPGDecoder, MultiVideoDecoder, and OutputFPSMeter.

◆ setSkipRender()

virtual void setSkipRender ( bool  skip)
inlinevirtualinherited

Hint to skip the expensive part of displaying the next frame(s) (e.g. the panel refresh) while still accepting and fully processing write() calls - used to recover from falling behind the playback schedule without breaking a codec's decode state (e.g. H.264 inter-prediction reference chain, which requires every frame to still be decoded even if it's never shown). Default no-op: implementations that can't skip rendering cheaply just ignore it and always render.

Reimplemented in MultiVideoDecoder, OutputFPSMeter, OutputTinyGPU, PacedVideoOutput, and VideoFrameMeter.

◆ setVideoInfo()

void setVideoInfo ( VideoInfo  info)
inline

Defines the video format and dimensions - call before begin() if you.

◆ setVideoInfoSource()

void setVideoInfoSource ( VideoInfoSource source)
inlineoverridevirtual

Defines the source of the video information (width, height, fps, format)

Reimplemented from VideoOutput.

◆ totalDecodeMs()

virtual uint64_t totalDecodeMs ( ) const
inlinevirtualinherited

Optional: sum of time (ms) spent purely decoding (excluding any surrounding convert/render/SPI work a subclass's write() also does) since begin() - see H264Decoder's own override for the only current implementation. Default 0: only meaningful for a decoder that separates decode time from render time internally: PacedVideoOutput:: logTo() prints a decode-vs-render split under "avg decode ms:" only when this returns nonzero.

Reimplemented in H264Decoder, and MultiVideoDecoder.

◆ write()

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

Implements VideoOutput.

Member Data Documentation

◆ info_

VideoInfo info_
protected

◆ p_info

VideoInfoSource* p_info = nullptr
protected

◆ tft_

TFT_eSPI& tft_
protected

◆ write_time_ms

uint32_t write_time_ms = 0
protected

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