64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <limits>
|
|
|
|
namespace pp::app {
|
|
|
|
enum class RecordingStartAction {
|
|
start_thread,
|
|
no_op_already_running,
|
|
};
|
|
|
|
enum class RecordingStopAction {
|
|
stop_thread,
|
|
no_op_not_running,
|
|
};
|
|
|
|
struct RecordingClearPlan {
|
|
bool stop_running_recording = false;
|
|
bool delete_recorded_files = false;
|
|
int frame_count_after_clear = 0;
|
|
};
|
|
|
|
struct RecordingExportPlan {
|
|
std::size_t frame_count = 0;
|
|
int progress_total = 0;
|
|
};
|
|
|
|
[[nodiscard]] constexpr RecordingStartAction plan_recording_start(bool is_running) noexcept
|
|
{
|
|
return is_running
|
|
? RecordingStartAction::no_op_already_running
|
|
: RecordingStartAction::start_thread;
|
|
}
|
|
|
|
[[nodiscard]] constexpr RecordingStopAction plan_recording_stop(bool is_running) noexcept
|
|
{
|
|
return is_running
|
|
? RecordingStopAction::stop_thread
|
|
: RecordingStopAction::no_op_not_running;
|
|
}
|
|
|
|
[[nodiscard]] constexpr RecordingClearPlan plan_recording_clear(
|
|
bool is_running,
|
|
bool platform_deletes_recorded_files) noexcept
|
|
{
|
|
return {
|
|
is_running,
|
|
platform_deletes_recorded_files,
|
|
0,
|
|
};
|
|
}
|
|
|
|
[[nodiscard]] constexpr RecordingExportPlan plan_recording_export(std::size_t frame_count) noexcept
|
|
{
|
|
const auto max_progress_total = static_cast<std::size_t>(std::numeric_limits<int>::max());
|
|
return {
|
|
frame_count,
|
|
frame_count > max_progress_total ? std::numeric_limits<int>::max() : static_cast<int>(frame_count),
|
|
};
|
|
}
|
|
|
|
}
|