TinyGPU
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AVIWriter< RGB_T > Class Template Reference

Writes a simple AVI movie containing RGB565 frames. More...

#include <AVIWriter.h>

Public Member Functions

 AVIWriter (Print &out)
 Creates an AVI writer that streams data to the provided Print output.
 
 ~AVIWriter ()
 Finalizes the AVI stream if it is still open.
 
bool begin (const ISurface< RGB_T > &surface, uint16_t fps=30, uint32_t frameCount=0)
 
void end ()
 Finalizes the AVI stream and writes the optional frame index.
 
bool add (const ISurface< RGB_T > &surface)
 Appends one RGB565 frame to the AVI stream.
 

Protected Member Functions

void resetState ()
 Resets the writer state after finishing or aborting a stream.
 
void writeHeader ()
 Writes the RIFF, AVI, stream, and movi headers.
 
void writeFrame (const ISurface< RGB_T > &surface)
 Writes one surface as a bottom-up padded RGB565 AVI frame.
 
void writeIndex ()
 Writes the idx1 frame index when a frame count was provided.
 
void writeFourCC (const char *value)
 Writes a four-character AVI chunk identifier.
 
void writeU8 (uint8_t value)
 Writes a single byte to the output stream.
 
void writeU16 (uint16_t value)
 Writes a 16-bit little-endian value to the output stream.
 
void writeU32 (uint32_t value)
 Writes a 32-bit little-endian value to the output stream.
 
void writeBytes (const uint8_t *data, size_t length)
 Writes a raw byte sequence to the output stream.
 

Static Protected Member Functions

static uint32_t frameRowStride (uint32_t width)
 Returns the padded byte stride of one RGB565 frame row.
 
static uint32_t paddedChunkSize (uint32_t dataSize)
 Returns the data size rounded up to an even AVI chunk length.
 

Protected Attributes

Print & out_
 
uint32_t width_ = 0
 
uint32_t height_ = 0
 
uint16_t fps_ = 30
 
uint32_t rowStride_ = 0
 
uint32_t frameSize_ = 0
 
uint32_t expectedFrameCount_ = 0
 
uint32_t frameCount_ = 0
 
bool isOpen_ = false
 

Detailed Description

template<typename RGB_T = RGB565>
class tinygpu::AVIWriter< RGB_T >

Writes a simple AVI movie containing RGB565 frames.

The implementation writes frames directly to the output stream as they are added. When the expected frame count is provided in begin(), the AVI headers and optional idx1 index can be precomputed without buffering the frame data. Frames are encoded as uncompressed 16-bit BI_BITFIELDS video using RGB565 channel masks.

Constructor & Destructor Documentation

◆ AVIWriter()

AVIWriter ( Print &  out)
inline

Creates an AVI writer that streams data to the provided Print output.

◆ ~AVIWriter()

~AVIWriter ( )
inline

Finalizes the AVI stream if it is still open.

Member Function Documentation

◆ add()

bool add ( const ISurface< RGB_T > &  surface)
inline

Appends one RGB565 frame to the AVI stream.

◆ begin()

bool begin ( const ISurface< RGB_T > &  surface,
uint16_t  fps = 30,
uint32_t  frameCount = 0 
)
inline

Starts a new AVI stream using the surface dimensions and optional frame count.

◆ end()

void end ( )
inline

Finalizes the AVI stream and writes the optional frame index.

◆ frameRowStride()

static uint32_t frameRowStride ( uint32_t  width)
inlinestaticprotected

Returns the padded byte stride of one RGB565 frame row.

◆ paddedChunkSize()

static uint32_t paddedChunkSize ( uint32_t  dataSize)
inlinestaticprotected

Returns the data size rounded up to an even AVI chunk length.

◆ resetState()

void resetState ( )
inlineprotected

Resets the writer state after finishing or aborting a stream.

◆ writeBytes()

void writeBytes ( const uint8_t *  data,
size_t  length 
)
inlineprotected

Writes a raw byte sequence to the output stream.

◆ writeFourCC()

void writeFourCC ( const char *  value)
inlineprotected

Writes a four-character AVI chunk identifier.

◆ writeFrame()

void writeFrame ( const ISurface< RGB_T > &  surface)
inlineprotected

Writes one surface as a bottom-up padded RGB565 AVI frame.

◆ writeHeader()

void writeHeader ( )
inlineprotected

Writes the RIFF, AVI, stream, and movi headers.

◆ writeIndex()

void writeIndex ( )
inlineprotected

Writes the idx1 frame index when a frame count was provided.

◆ writeU16()

void writeU16 ( uint16_t  value)
inlineprotected

Writes a 16-bit little-endian value to the output stream.

◆ writeU32()

void writeU32 ( uint32_t  value)
inlineprotected

Writes a 32-bit little-endian value to the output stream.

◆ writeU8()

void writeU8 ( uint8_t  value)
inlineprotected

Writes a single byte to the output stream.

Member Data Documentation

◆ expectedFrameCount_

uint32_t expectedFrameCount_ = 0
protected

◆ fps_

uint16_t fps_ = 30
protected

◆ frameCount_

uint32_t frameCount_ = 0
protected

◆ frameSize_

uint32_t frameSize_ = 0
protected

◆ height_

uint32_t height_ = 0
protected

◆ isOpen_

bool isOpen_ = false
protected

◆ out_

Print& out_
protected

◆ rowStride_

uint32_t rowStride_ = 0
protected

◆ width_

uint32_t width_ = 0
protected

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