Centralize legacy recording bridge
This commit is contained in:
51
src/app.cpp
51
src/app.cpp
@@ -11,6 +11,7 @@
|
||||
#include "app_core/document_route.h"
|
||||
#include "app_core/document_session.h"
|
||||
#include "legacy_history_services.h"
|
||||
#include "legacy_recording_services.h"
|
||||
#include "platform_api/platform_services.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
@@ -767,56 +768,30 @@ void App::rec_clear()
|
||||
rec_running,
|
||||
platform_deletes_recorded_files_on_clear()
|
||||
);
|
||||
if (plan.stop_running_recording)
|
||||
rec_stop();
|
||||
if (plan.delete_recorded_files)
|
||||
clear_platform_recorded_files(rec_path);
|
||||
rec_count = plan.frame_count_after_clear;
|
||||
update_rec_frames();
|
||||
const auto status = pp::panopainter::execute_legacy_recording_clear_plan(*this, plan);
|
||||
if (!status.ok())
|
||||
LOG("Recording clear action failed: %s", status.message);
|
||||
}
|
||||
|
||||
void App::rec_start()
|
||||
{
|
||||
const auto plan = pp::app::plan_recording_start(rec_running);
|
||||
switch (plan)
|
||||
{
|
||||
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);
|
||||
const auto status = pp::panopainter::execute_legacy_recording_start_action(*this, plan);
|
||||
if (!status.ok())
|
||||
LOG("Recording start action failed: %s", status.message);
|
||||
}
|
||||
|
||||
void App::rec_stop()
|
||||
{
|
||||
const auto plan = pp::app::plan_recording_stop(rec_running);
|
||||
switch (plan)
|
||||
{
|
||||
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();
|
||||
const auto status = pp::panopainter::execute_legacy_recording_stop_action(*this, plan);
|
||||
if (!status.ok())
|
||||
LOG("Recording stop action failed: %s", status.message);
|
||||
}
|
||||
|
||||
void App::rec_export(std::string path)
|
||||
{
|
||||
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) {
|
||||
@@ -824,9 +799,9 @@ void App::rec_export(std::string path)
|
||||
});
|
||||
#endif
|
||||
*/
|
||||
Canvas::I->m_encoder->write_mp4(path);
|
||||
|
||||
pb->destroy();
|
||||
const auto status = pp::panopainter::execute_legacy_recording_export_plan(*this, plan, path);
|
||||
if (!status.ok())
|
||||
LOG("Recording export action failed: %s", status.message);
|
||||
}
|
||||
|
||||
void App::rec_loop()
|
||||
|
||||
Reference in New Issue
Block a user