PNGParallelRecordingStrategy Class Reference

Concrete strategy for a PNG image recording. More...

#include <VisionX/libraries/imrec/record/strats/PNGParallelRecordingStrategy.h>

+ Inheritance diagram for PNGParallelRecordingStrategy:

Public Member Functions

 PNGParallelRecordingStrategy ()
 
 PNGParallelRecordingStrategy (const std::filesystem::path &filePath, const std::string &file_name, unsigned int png_compression=9, unsigned int thread_pool_size=1)
 
void recordFrame (const cv::Mat &frame, std::chrono::microseconds timestamp) override
 Adds the given frame to the recording. More...
 
void recordFrameAsync (std::filesystem::path path, const cv::Mat &frame)
 
void startRecording () override
 Starts the recording manually if constructed empty. More...
 
void stopRecording () override
 Stops the recording. More...
 
 ~PNGParallelRecordingStrategy () override
 
- Public Member Functions inherited from AbstractSequencedRecordingStrategy
 AbstractSequencedRecordingStrategy ()
 Default constructor to manually start the recording. More...
 
 AbstractSequencedRecordingStrategy (const std::filesystem::path &filePath, const std::filesystem::path &ext)
 
std::filesystem::path getDotExtension () const override
 Gets the extension plus preceeded dot of the configured file (e.g. More...
 
std::filesystem::path getMetadataPath () const override
 
 ~AbstractSequencedRecordingStrategy () override
 Destruct the recording strategy. More...
 
- Public Member Functions inherited from AbstractRecordingStrategy
 AbstractRecordingStrategy ()
 Default constructor to start the recording manually. More...
 
 AbstractRecordingStrategy (const std::filesystem::path &filePath)
 Constructor for any recording strategy, immediately starting the recording. More...
 
virtual std::filesystem::path getFilePath () const
 Gets the raw file path for the recording as configured. More...
 
virtual std::filesystem::path getPath () const
 Gets the path to the recording without filename. More...
 
virtual std::filesystem::path getStem () const
 Gets the stem of the configured file (filename without extension) More...
 
virtual bool isRecording () const
 Indicates whether this instance is already initialised for recording. More...
 
virtual void recordFrame (const CByteImage &frame, std::chrono::microseconds timestamp)
 Adds the given frame to the recording. More...
 
virtual void writeMetadataDatetime (const std::string &var_name, std::chrono::microseconds timestamp)
 
virtual std::tuple< unsigned int, std::string > writeMetadataFrame (const CByteImage &frame, std::chrono::microseconds timestamp)
 
virtual std::tuple< unsigned int, std::string > writeMetadataFrame (const cv::Mat &frame, std::chrono::microseconds timestamp)
 
virtual void writeMetadataLine (const std::string &var_name, std::string_view var_type, std::string_view var_value)
 
virtual ~AbstractRecordingStrategy ()
 Destructor. More...
 

Static Public Member Functions

static void recordSnapshot (const CByteImage &image, const std::filesystem::path &path)
 
static void recordSnapshot (const cv::Mat &image, const std::filesystem::path &path)
 

Protected Attributes

unsigned int m_png_compression
 
std::atomic< unsigned int > m_pool_current_size
 
std::condition_variable m_pool_cv
 
unsigned int m_pool_max_size
 
std::mutex m_pool_mutex
 
std::mutex m_record_frame_mutex
 
- Protected Attributes inherited from AbstractRecordingStrategy
std::filesystem::path m_file_path
 Path to where the recording file should be written to. More...
 

Additional Inherited Members

- Protected Member Functions inherited from AbstractSequencedRecordingStrategy
std::filesystem::path deriveFramePath (const unsigned int sequence_number, const std::string &frame_name)
 Returns the next sequenced full path and increments the sequence number. More...
 

Detailed Description

Concrete strategy for a PNG image recording.

Definition at line 44 of file PNGParallelRecordingStrategy.h.

Constructor & Destructor Documentation

◆ PNGParallelRecordingStrategy() [1/2]

◆ PNGParallelRecordingStrategy() [2/2]

PNGParallelRecordingStrategy ( const std::filesystem::path &  filePath,
const std::string &  file_name,
unsigned int  png_compression = 9,
unsigned int  thread_pool_size = 1 
)

Definition at line 47 of file PNGParallelRecordingStrategy.cpp.

◆ ~PNGParallelRecordingStrategy()

Definition at line 57 of file PNGParallelRecordingStrategy.cpp.

Member Function Documentation

◆ recordFrame()

void recordFrame ( const cv::Mat &  frame,
std::chrono::microseconds  timestamp 
)
overridevirtual

Adds the given frame to the recording.

Parameters
frameFrame to be added

Reimplemented from AbstractRecordingStrategy.

Definition at line 113 of file PNGParallelRecordingStrategy.cpp.

◆ recordFrameAsync()

void recordFrameAsync ( std::filesystem::path  path,
const cv::Mat &  frame 
)

Definition at line 133 of file PNGParallelRecordingStrategy.cpp.

◆ recordSnapshot() [1/2]

void recordSnapshot ( const CByteImage &  image,
const std::filesystem::path &  path 
)
static

Definition at line 84 of file PNGParallelRecordingStrategy.cpp.

+ Here is the call graph for this function:

◆ recordSnapshot() [2/2]

void recordSnapshot ( const cv::Mat &  image,
const std::filesystem::path &  path 
)
static

Definition at line 64 of file PNGParallelRecordingStrategy.cpp.

◆ startRecording()

void startRecording ( )
overridevirtual

Starts the recording manually if constructed empty.

Parameters
filePathPath to where the recording file should be written to
fpsAmount of frames being recorded per second

Reimplemented from AbstractSequencedRecordingStrategy.

Definition at line 94 of file PNGParallelRecordingStrategy.cpp.

+ Here is the call graph for this function:

◆ stopRecording()

void stopRecording ( )
overridevirtual

Stops the recording.

Reimplemented from AbstractRecordingStrategy.

Definition at line 103 of file PNGParallelRecordingStrategy.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_png_compression

unsigned int m_png_compression
protected

Definition at line 50 of file PNGParallelRecordingStrategy.h.

◆ m_pool_current_size

std::atomic<unsigned int> m_pool_current_size
protected

Definition at line 56 of file PNGParallelRecordingStrategy.h.

◆ m_pool_cv

std::condition_variable m_pool_cv
protected

Definition at line 54 of file PNGParallelRecordingStrategy.h.

◆ m_pool_max_size

unsigned int m_pool_max_size
protected

Definition at line 55 of file PNGParallelRecordingStrategy.h.

◆ m_pool_mutex

std::mutex m_pool_mutex
protected

Definition at line 53 of file PNGParallelRecordingStrategy.h.

◆ m_record_frame_mutex

std::mutex m_record_frame_mutex
protected

Definition at line 52 of file PNGParallelRecordingStrategy.h.


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