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

VideoFrameSource that pulls frames from the ESP32 camera (esp_camera.h, the Arduino-ESP32 "esp32-camera" component) - nextFrame() returns esp_camera_fb_get()'s buffer, releasing the previous frame (esp_camera_fb_return()) first; as with any VideoFrameSource, the returned pointer is only valid until the next nextFrame() call. More...

#include <CameraFrameSourceESP32.h>

Inheritance diagram for CameraFrameSource:
VideoFrameSource

Public Member Functions

 CameraFrameSource ()=default
 
 CameraFrameSource (VideoInfo info)
 
bool begin ()
 Initializes the camera (esp_camera_init()).
 
void end ()
 
const uint8_t * nextFrame (size_t &len) override
 
void setCameraConfig (camera_config_t config)
 
void setVideoInfo (VideoInfo info)
 
VideoInfo videoInfo () override
 
bool writeTo (Print &out)
 Write the frame to the indicated destination.
 

Protected Member Functions

void releaseFrame ()
 

Protected Attributes

camera_config_t cfg {}
 
camera_fb_t * fb = nullptr
 
VideoInfo info
 

Detailed Description

VideoFrameSource that pulls frames from the ESP32 camera (esp_camera.h, the Arduino-ESP32 "esp32-camera" component) - nextFrame() returns esp_camera_fb_get()'s buffer, releasing the previous frame (esp_camera_fb_return()) first; as with any VideoFrameSource, the returned pointer is only valid until the next nextFrame() call.

width/height/fps/format (see videoInfo()) must be configured explicitly

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ CameraFrameSource() [1/2]

CameraFrameSource ( )
default

◆ CameraFrameSource() [2/2]

CameraFrameSource ( VideoInfo  info)
inline
Parameters
infowidth/height/fps/format reported by videoInfo() - must match camera_config_t's own frame_size/pixel_format (this class has no lookup table from one to the other).

Member Function Documentation

◆ begin()

bool begin ( )
inline

Initializes the camera (esp_camera_init()).

◆ end()

void end ( )
inline

Releases the last captured frame buffer (if any) and deinitializes the camera.

◆ nextFrame()

const uint8_t * nextFrame ( size_t &  len)
inlineoverridevirtual

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

Implements VideoFrameSource.

◆ releaseFrame()

void releaseFrame ( )
inlineprotected

◆ setCameraConfig()

void setCameraConfig ( camera_config_t  config)
inline

Defines the camera_config_t esp_camera_init() is called with - see the esp32-camera component's own docs for the individual fields. Call before begin().

◆ setVideoInfo()

void setVideoInfo ( VideoInfo  info)
inline

Defines the width/height/fps/format reported by videoInfo() - see the constructor. Call before begin().

◆ videoInfo()

VideoInfo videoInfo ( )
inlineoverridevirtual

Provides the width/height/fps/format configured via the constructor or setVideoInfo().

Implements VideoFrameSource.

◆ writeTo()

bool writeTo ( Print out)
inlineinherited

Write the frame to the indicated destination.

Member Data Documentation

◆ cfg

camera_config_t cfg {}
protected

◆ fb

camera_fb_t* fb = nullptr
protected

◆ info

VideoInfo info
protected

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