Plan recording session decisions in app core
This commit is contained in:
54
src/app.cpp
54
src/app.cpp
@@ -5,6 +5,7 @@
|
||||
#include "node_dialog_open.h"
|
||||
#include "node_progress_bar.h"
|
||||
#include "mp4enc.h"
|
||||
#include "app_core/document_recording.h"
|
||||
#include "app_core/document_route.h"
|
||||
#include "app_core/document_session.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
@@ -880,47 +881,70 @@ void App::renderdoc_frame_end()
|
||||
|
||||
void App::rec_clear()
|
||||
{
|
||||
rec_stop();
|
||||
const auto plan = pp::app::plan_recording_clear(
|
||||
rec_running,
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
delete_all_files_in_path(rec_path);
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
rec_count = 0;
|
||||
);
|
||||
if (plan.stop_running_recording)
|
||||
rec_stop();
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
if (plan.delete_recorded_files)
|
||||
delete_all_files_in_path(rec_path);
|
||||
#endif
|
||||
rec_count = plan.frame_count_after_clear;
|
||||
update_rec_frames();
|
||||
}
|
||||
|
||||
void App::rec_start()
|
||||
{
|
||||
if (!rec_running)
|
||||
const auto plan = pp::app::plan_recording_start(rec_running);
|
||||
switch (plan)
|
||||
{
|
||||
update_rec_frames();
|
||||
rec_thread = std::thread(&App::rec_loop, this);
|
||||
case pp::app::RecordingStartAction::start_thread:
|
||||
break;
|
||||
case pp::app::RecordingStartAction::no_op_already_running:
|
||||
return;
|
||||
}
|
||||
|
||||
update_rec_frames();
|
||||
rec_thread = std::thread(&App::rec_loop, this);
|
||||
}
|
||||
|
||||
void App::rec_stop()
|
||||
{
|
||||
if (rec_running)
|
||||
const auto plan = pp::app::plan_recording_stop(rec_running);
|
||||
switch (plan)
|
||||
{
|
||||
rec_running = false;
|
||||
rec_cv.notify_all();
|
||||
if (rec_thread.joinable())
|
||||
rec_thread.join();
|
||||
update_rec_frames();
|
||||
case pp::app::RecordingStopAction::stop_thread:
|
||||
break;
|
||||
case pp::app::RecordingStopAction::no_op_not_running:
|
||||
return;
|
||||
}
|
||||
|
||||
rec_running = false;
|
||||
rec_cv.notify_all();
|
||||
if (rec_thread.joinable())
|
||||
rec_thread.join();
|
||||
update_rec_frames();
|
||||
}
|
||||
|
||||
void App::rec_export(std::string path)
|
||||
{
|
||||
int progress = 0;
|
||||
int tot = rec_count;
|
||||
const auto plan = pp::app::plan_recording_export(static_cast<std::size_t>(rec_count));
|
||||
auto pb = layout[main_id]->add_child<NodeProgressBar>();
|
||||
pb->m_progress->SetWidthP(0);
|
||||
pb->m_title->set_text("Exporting MP4 movie");
|
||||
pb->m_total = plan.progress_total;
|
||||
pb->m_count = 0;
|
||||
|
||||
/*
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
export_mp4(rec_path, width, height, rec_count, ^(float) {
|
||||
pb->m_progress->SetWidthP((float)progress / tot * 100.f);
|
||||
pb->increment();
|
||||
});
|
||||
#endif
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user