esp32cam
OV2640 camera on ESP32-CAM
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
esp32cam::detail::MjpegController Class Reference

Control MJPEG stream timing. More...

#include <mjpeg.hpp>

Public Types

enum  Action { CAPTURE = -1 , RETURN = -2 , SEND = -3 , STOP = -4 }
 

Public Member Functions

 MjpegController (MjpegConfig cfg)
 
int countSentFrames () const
 Retrieve number of sent frames. More...
 
int decideAction ()
 Decide what to do now. More...
 
void notifyCapture ()
 Notify that frame capture has started. More...
 
void notifyReturn (std::unique_ptr< Frame > frame)
 Notify that frame capture has completed. More...
 
FramegetFrame () const
 Retrieve current frame. More...
 
void notifySent (bool ok)
 Notify that a frame is sent to the client. More...
 
void notifyFail ()
 Notify that an error has occurred. More...
 

Public Attributes

const MjpegConfig cfg
 

Detailed Description

Control MJPEG stream timing.

Member Enumeration Documentation

◆ Action

Enumerator
CAPTURE 
RETURN 
SEND 
STOP 

Constructor & Destructor Documentation

◆ MjpegController()

esp32cam::detail::MjpegController::MjpegController ( MjpegConfig  cfg)
explicit

Member Function Documentation

◆ countSentFrames()

int esp32cam::detail::MjpegController::countSentFrames ( ) const
inline

Retrieve number of sent frames.

◆ decideAction()

int esp32cam::detail::MjpegController::decideAction ( )

Decide what to do now.

Return values
CAPTUREcapture a frame.
RETURNreturn a captured frame.
SENDsend current frame to the client.
STOPdisconnect the client.
Returns
if non-negative, how long to delay (millis) before the next action.

◆ getFrame()

Frame* esp32cam::detail::MjpegController::getFrame ( ) const
inline

Retrieve current frame.

◆ notifyCapture()

void esp32cam::detail::MjpegController::notifyCapture ( )

Notify that frame capture has started.

Postcondition
decideAction()==RETURN

◆ notifyFail()

void esp32cam::detail::MjpegController::notifyFail ( )

Notify that an error has occurred.

Postcondition
getFrame()==nullptr
decideAction()==STOP

◆ notifyReturn()

void esp32cam::detail::MjpegController::notifyReturn ( std::unique_ptr< Frame frame)

Notify that frame capture has completed.

Parameters
framecaptured frame, possibly nullptr.
Postcondition
if frame==nullptr, decideAction()==STOP; otherwise, decideAction()==SEND

◆ notifySent()

void esp32cam::detail::MjpegController::notifySent ( bool  ok)

Notify that a frame is sent to the client.

Parameters
okwhether sent successfully.
Postcondition
getFrame()==nullptr

The caller is expected to enforce MjpegConfig::frameTimeout and call `notifySent(false)` in case of send timeout.

Member Data Documentation

◆ cfg

const MjpegConfig esp32cam::detail::MjpegController::cfg

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