ACMX 2.136.0
Dual-Backend Real-Time GPU Video Synthesis
Loading...
Searching...
No Matches
acmxvk::SnapshotWriter Class Reference

#include <snapshot_writer.hpp>

Public Member Functions

void enqueue (SnapshotJob job)
SnapshotWriteroperator= (const SnapshotWriter &)=delete
SnapshotWriteroperator= (SnapshotWriter &&)=delete
bool queueFull ()
 SnapshotWriter ()=default
 SnapshotWriter (const SnapshotWriter &)=delete
 SnapshotWriter (SnapshotWriter &&)=delete
bool start ()
void stop () noexcept
 ~SnapshotWriter ()

Static Public Member Functions

static std::string_view formatName (SnapshotFormat format) noexcept
static void savePng (const fs::path &path, std::uint8_t *rgba, int width, int height)

Private Member Functions

void workerLoop () noexcept

Static Private Member Functions

static void saveRaw (const fs::path &path, const std::vector< std::uint8_t > &rgba, std::uint32_t width, std::uint32_t height)
static void saveRaw16 (const fs::path &path, const std::vector< std::uint16_t > &rgba, std::uint32_t width, std::uint32_t height)

Private Attributes

std::condition_variable condition
std::deque< SnapshotJobjobs
std::size_t jobs_in_flight = 0
std::mutex mutex
bool stopping = false
std::thread worker

Static Private Attributes

static constexpr std::size_t QUEUE_CAPACITY = 4

Detailed Description

Definition at line 29 of file snapshot_writer.hpp.

Constructor & Destructor Documentation

◆ SnapshotWriter() [1/3]

acmxvk::SnapshotWriter::SnapshotWriter ( )
default

◆ ~SnapshotWriter()

acmxvk::SnapshotWriter::~SnapshotWriter ( )

Definition at line 21 of file snapshot_writer.cpp.

References stop().

◆ SnapshotWriter() [2/3]

acmxvk::SnapshotWriter::SnapshotWriter ( const SnapshotWriter & )
delete

References SnapshotWriter().

◆ SnapshotWriter() [3/3]

acmxvk::SnapshotWriter::SnapshotWriter ( SnapshotWriter && )
delete

References SnapshotWriter().

Member Function Documentation

◆ enqueue()

void acmxvk::SnapshotWriter::enqueue ( SnapshotJob job)

Definition at line 58 of file snapshot_writer.cpp.

References condition, jobs, jobs_in_flight, and mutex.

Referenced by operator=().

◆ formatName()

std::string_view acmxvk::SnapshotWriter::formatName ( SnapshotFormat format)
staticnodiscardnoexcept

◆ operator=() [1/2]

SnapshotWriter & acmxvk::SnapshotWriter::operator= ( const SnapshotWriter & )
delete

References SnapshotWriter().

◆ operator=() [2/2]

SnapshotWriter & acmxvk::SnapshotWriter::operator= ( SnapshotWriter && )
delete

◆ queueFull()

bool acmxvk::SnapshotWriter::queueFull ( )
nodiscard

Definition at line 53 of file snapshot_writer.cpp.

References jobs_in_flight, mutex, and QUEUE_CAPACITY.

Referenced by operator=().

◆ savePng()

void acmxvk::SnapshotWriter::savePng ( const fs::path & path,
std::uint8_t * rgba,
int width,
int height )
static

◆ saveRaw()

void acmxvk::SnapshotWriter::saveRaw ( const fs::path & path,
const std::vector< std::uint8_t > & rgba,
std::uint32_t width,
std::uint32_t height )
staticprivate

Definition at line 75 of file snapshot_writer.cpp.

Referenced by workerLoop().

◆ saveRaw16()

void acmxvk::SnapshotWriter::saveRaw16 ( const fs::path & path,
const std::vector< std::uint16_t > & rgba,
std::uint32_t width,
std::uint32_t height )
staticprivate

Definition at line 107 of file snapshot_writer.cpp.

Referenced by workerLoop().

◆ start()

bool acmxvk::SnapshotWriter::start ( )
nodiscard

Definition at line 25 of file snapshot_writer.cpp.

References mutex, stopping, worker, and workerLoop().

Referenced by operator=().

◆ stop()

void acmxvk::SnapshotWriter::stop ( )
noexcept

Definition at line 41 of file snapshot_writer.cpp.

References condition, mutex, stopping, and worker.

Referenced by operator=(), acmxvk::MainWindow::~MainWindow(), and ~SnapshotWriter().

◆ workerLoop()

Member Data Documentation

◆ condition

std::condition_variable acmxvk::SnapshotWriter::condition
private

Definition at line 72 of file snapshot_writer.hpp.

Referenced by enqueue(), stop(), and workerLoop().

◆ jobs

std::deque<SnapshotJob> acmxvk::SnapshotWriter::jobs
private

Definition at line 70 of file snapshot_writer.hpp.

Referenced by enqueue(), and workerLoop().

◆ jobs_in_flight

std::size_t acmxvk::SnapshotWriter::jobs_in_flight = 0
private

Definition at line 74 of file snapshot_writer.hpp.

Referenced by enqueue(), queueFull(), and workerLoop().

◆ mutex

std::mutex acmxvk::SnapshotWriter::mutex
private

Definition at line 71 of file snapshot_writer.hpp.

Referenced by enqueue(), queueFull(), start(), stop(), and workerLoop().

◆ QUEUE_CAPACITY

std::size_t acmxvk::SnapshotWriter::QUEUE_CAPACITY = 4
staticconstexprprivate

Definition at line 49 of file snapshot_writer.hpp.

Referenced by queueFull().

◆ stopping

bool acmxvk::SnapshotWriter::stopping = false
private

Definition at line 75 of file snapshot_writer.hpp.

Referenced by start(), stop(), and workerLoop().

◆ worker

std::thread acmxvk::SnapshotWriter::worker
private

Definition at line 73 of file snapshot_writer.hpp.

Referenced by start(), and stop().


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