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

MPEG-1 (part 2) video decoder wrapper around TinyMPGDecoder. More...

#include <CodecMPG.h>

Inheritance diagram for MPGDecoder:
VideoDecoder VideoInfoSource VideoOutput

Public Member Functions

 MPGDecoder ()
 
 MPGDecoder (Print &out)
 
 MPGDecoder (VideoOutput &out)
 
bool begin () override
 Initializes the decoder (allocates its picture buffers, etc).
 
tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > & driver ()
 
void end () override
 Releases the decoder's resources.
 
void flush () override
 
bool hasError ()
 
void setOutput (Print &out) override
 Defines the target each decoded picture is written to.
 
void setOutput (VideoOutput &out)
 
void setVideoFormat (VideoFormat format) override
 
VideoInfo videoInfo () override
 
size_t write (const uint8_t *data, size_t len) override
 

Protected Member Functions

void writeFrame (tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > &decoder)
 
size_t writeToOutput (uint8_t *data, size_t len)
 

Static Protected Member Functions

static void onFrame (tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > &decoder, void *userData)
 

Protected Attributes

tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > decoder_
 
Vector< uint8_t > frame_buffer
 
Printp_out = nullptr
 
VideoOutputp_out_video = nullptr
 
VideoFormat pixel_format = VideoFormat::RGB565
 

Detailed Description

MPEG-1 (part 2) video decoder wrapper around TinyMPGDecoder.

The class mirrors the usage style of CodecH264.h: feed MPEG-1 bitstream data via write(), and receive decoded frames on the configured output.

Note: Requires TinyMPG (TinyMPGDecoder.h) to be installed and reachable by the compiler include path: https://github.com/pschatzmann/TinyMPG

Constructor & Destructor Documentation

◆ MPGDecoder() [1/3]

MPGDecoder ( )
inline

◆ MPGDecoder() [2/3]

MPGDecoder ( Print out)
inline

◆ MPGDecoder() [3/3]

MPGDecoder ( VideoOutput out)
inline

Member Function Documentation

◆ begin()

bool begin ( )
inlineoverridevirtual

Initializes the decoder (allocates its picture buffers, etc).

Implements VideoDecoder.

◆ driver()

tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > & driver ( )
inline

◆ end()

void end ( )
inlineoverridevirtual

Releases the decoder's resources.

Implements VideoDecoder.

◆ flush()

void flush ( )
inlineoverridevirtual

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 from VideoOutput.

◆ hasError()

bool hasError ( )
inline

◆ onFrame()

static void onFrame ( tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > &  decoder,
void *  userData 
)
inlinestaticprotected

◆ setOutput() [1/2]

void setOutput ( Print out)
inlineoverridevirtual

Defines the target each decoded picture is written to.

Implements VideoDecoder.

◆ setOutput() [2/2]

void setOutput ( VideoOutput out)
inline

◆ setVideoFormat()

void setVideoFormat ( VideoFormat  format)
inlineoverridevirtual

Selects the pixel format written to setOutput()'s target - e.g. VideoFormat::RGB565 (the common TFT wire format), RGB666/RGB888 for higher color depth displays, or I420 to pass the decoded planes through unconverted. Not every decoder backend supports every value (e.g. RGB666/RGB888 are TinyH264-only, not available on the esp_h264 backend) - unsupported values are logged and ignored (the previously selected format stays in effect); see the concrete class for exactly which ones it supports. Call before begin().

Implements VideoDecoder.

◆ videoInfo()

VideoInfo videoInfo ( )
inlineoverridevirtual

Reports the format/dimensions of the picture written to setOutput()'s target - VideoInfo::format is always the format most recently selected via setVideoFormat() (RGB565 if never called), the reliable way to determine it (rather than assuming); width/ height reflect the most recently decoded picture, 0 before any picture has been decoded.

Implements VideoDecoder.

◆ write()

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

Implements VideoOutput.

◆ writeFrame()

void writeFrame ( tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32< uint8_t > > &  decoder)
inlineprotected

◆ writeToOutput()

size_t writeToOutput ( uint8_t *  data,
size_t  len 
)
inlineprotected

Member Data Documentation

◆ decoder_

tinympg::TinyMPGDecoder< tinympg::PSRAMAllocatorESP32<uint8_t> > decoder_
protected

◆ frame_buffer

Vector<uint8_t> frame_buffer
protected

◆ p_out

Print* p_out = nullptr
protected

◆ p_out_video

VideoOutput* p_out_video = nullptr
protected

◆ pixel_format

VideoFormat pixel_format = VideoFormat::RGB565
protected

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