SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Record Class Referenceabstract

An API for recording video. More...

#include <record.h>

Inheritance diagram for Record:
Inheritance graph
[legend]

Public Member Functions

 Record (std::filesystem::path file, glm::ivec2 resolution, uint8_t fps)
 Construct a new Record from a file path, resolution and fps.
 
virtual ~Record ()
 
virtual void open ()=0
 Open the video file.
 
void queueFrame (std::vector< uint8_t > pixels)
 Enqueue a frame to be written.
 
uint8_t queueSize ()
 Number of frames yet to be sent for writing.
 
uint64_t framesLeft ()
 Number of frame left to be written in total.
 
void writeFrames ()
 Send the frames in the buffer for writing.
 
virtual void close ()=0
 Close the video file.
 
bool isWriting () const
 If the video is being written to in the background.
 
bool isOpen () const
 If the file is open.
 
bool finalise ()
 Check if finalised.
 

Protected Member Functions

virtual void write (const uint8_t *frame)=0
 
void writeBuffer ()
 

Protected Attributes

std::filesystem::path file
 
glm::ivec2 resolution
 
uint8_t fps
 
bool fileOpen = false
 
bool writing = false
 
std::vector< std::vector< uint8_t > > inBuffer
 
std::vector< std::vector< uint8_t > > outBuffer
 

Detailed Description

An API for recording video.

Constructor & Destructor Documentation

◆ Record()

Record::Record ( std::filesystem::path  file,
glm::ivec2  resolution,
uint8_t  fps 
)
inline

Construct a new Record from a file path, resolution and fps.

Parameters
filethe video file path.
resolutionthe resolution.
fpsthe frames per second.

◆ ~Record()

virtual Record::~Record ( )
inlinevirtual

Member Function Documentation

◆ close()

virtual void Record::close ( )
pure virtual

Close the video file.

Remarks
including trailer writing etc.
Warning
See isWriting to check if the threaded io is still active.

Implemented in FFmpegRecord, and JompegRecord.

◆ finalise()

bool Record::finalise ( )
inline

Check if finalised.

Returns
true all writing is finished, the file is closed.
false either writing is happening or queued.

◆ framesLeft()

uint64_t Record::framesLeft ( )
inline

Number of frame left to be written in total.

Returns
uint64_t total count.

◆ isOpen()

bool Record::isOpen ( ) const
inline

If the file is open.

Returns
true the video file is open.
false the video file is not open.

◆ isWriting()

bool Record::isWriting ( ) const
inline

If the video is being written to in the background.

Returns
true writing is happening.
false no writing is happening.

◆ open()

virtual void Record::open ( )
pure virtual

Open the video file.

Remarks
including header writing etc.

Implemented in FFmpegRecord, and JompegRecord.

◆ queueFrame()

void Record::queueFrame ( std::vector< uint8_t pixels)
inline

Enqueue a frame to be written.

Parameters
pixelsthe frame's pixels.

◆ queueSize()

uint8_t Record::queueSize ( )
inline

Number of frames yet to be sent for writing.

Returns
uint8_t the count.

◆ write()

virtual void Record::write ( const uint8_t frame)
protectedpure virtual

◆ writeBuffer()

void Record::writeBuffer ( )
inlineprotected

◆ writeFrames()

void Record::writeFrames ( )
inline

Send the frames in the buffer for writing.

Remarks
Runs in a background thread, sets a flag to stop additional threads spawning.

Member Data Documentation

◆ file

std::filesystem::path Record::file
protected

◆ fileOpen

bool Record::fileOpen = false
protected

◆ fps

uint8_t Record::fps
protected

◆ inBuffer

std::vector<std::vector<uint8_t> > Record::inBuffer
protected

◆ outBuffer

std::vector<std::vector<uint8_t> > Record::outBuffer
protected

◆ resolution

glm::ivec2 Record::resolution
protected

◆ writing

bool Record::writing = false
protected

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