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

VideoFrameSource that pulls frames from a camera via TinyCamera (https://github.com/pschatzmann/TinyCamera) - so it works on every platform TinyCamera supports (ESP32 via esp32-camera, ESP32-P4 MIPI-CSI via ESP_Video, RP2040, STM32, desktop). nextFrame() returns the buffer of a freshly captured frame, returning the previous one to the driver first; as with any VideoFrameSource, the returned pointer is only valid until the next nextFrame() call. More...

#include <CameraFrameSourceTinyCamera.h>

Inheritance diagram for CameraFrameSourceTinyCamera:
VideoFrameSource

Public Member Functions

 CameraFrameSourceTinyCamera ()=default
 
bool begin (const camera_config_t &config, float fps)
 
tiny_camera::TinyCamera & camera ()
 Access to the camera, e.g. for sensor tuning (camera().sensor()).
 
void end ()
 Returns the last captured frame (if any) and releases the camera.
 
const uint8_t * nextFrame (size_t &len) override
 
VideoInfo videoInfo () override
 Width/height/format determined by begin(), and the fps given to it.
 
bool writeTo (Print &out)
 Write the frame to the indicated destination.
 

Static Protected Member Functions

static VideoFormat toVideoFormat (pixformat_t format)
 

Protected Attributes

tiny_camera::TinyCamera camera_
 
tiny_camera::TinyCameraFrame frame_
 
VideoInfo info
 

Detailed Description

VideoFrameSource that pulls frames from a camera via TinyCamera (https://github.com/pschatzmann/TinyCamera) - so it works on every platform TinyCamera supports (ESP32 via esp32-camera, ESP32-P4 MIPI-CSI via ESP_Video, RP2040, STM32, desktop). nextFrame() returns the buffer of a freshly captured frame, returning the previous one to the driver first; as with any VideoFrameSource, the returned pointer is only valid until the next nextFrame() call.

begin() captures one probe frame to determine width/height/format, so videoInfo() is complete right after it (as VideoMuxer::begin() requires) without any frame_size lookup table. Only the frame rate has to be given, since a camera has no fixed one: use the rate you actually want to capture (and encode) at.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ CameraFrameSourceTinyCamera()

Member Function Documentation

◆ begin()

bool begin ( const camera_config_t &  config,
float  fps 
)
inline

Initializes the camera and captures a probe frame to determine width/height/format - see the class comment.

Parameters
fpsframe rate reported by videoInfo().

◆ camera()

tiny_camera::TinyCamera & camera ( )
inline

Access to the camera, e.g. for sensor tuning (camera().sensor()).

◆ end()

void end ( )
inline

Returns the last captured frame (if any) and releases the camera.

◆ nextFrame()

const uint8_t * nextFrame ( size_t &  len)
inlineoverridevirtual

Returns the previous frame (if still held), captures a new one and returns its buffer - nullptr (len 0) if the capture failed.

Implements VideoFrameSource.

◆ toVideoFormat()

static VideoFormat toVideoFormat ( pixformat_t  format)
inlinestaticprotected

◆ videoInfo()

VideoInfo videoInfo ( )
inlineoverridevirtual

Width/height/format determined by begin(), and the fps given to it.

Implements VideoFrameSource.

◆ writeTo()

bool writeTo ( Print &  out)
inlineinherited

Write the frame to the indicated destination.

Member Data Documentation

◆ camera_

tiny_camera::TinyCamera camera_
protected

◆ frame_

tiny_camera::TinyCameraFrame frame_
protected

◆ info

VideoInfo info
protected

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