save timelapse stream to file

This commit is contained in:
2019-11-02 18:05:24 +01:00
parent 7db1739df6
commit 83ba717d5b
9 changed files with 150 additions and 23 deletions

View File

@@ -471,6 +471,8 @@ void App::init()
uirtt.create(width, height, -1, GL_RGBA8, true);
rec_start();
if (!check_license())
{
message_box("License", "Could not validate this license, running in demo mode.");
@@ -695,10 +697,10 @@ void App::update_rec_frames()
{
if (auto txt = layout[main_id]->find<NodeText>("txt-rec"))
{
if (rec_running)
if (rec_running && Canvas::I->m_encoder)
{
static char buffer[128];
sprintf(buffer, "Recorded %d frames", rec_count);
sprintf(buffer, "Recorded %d frames", Canvas::I->m_encoder->frames_count());
txt->set_text(buffer);
}
else
@@ -779,7 +781,7 @@ void App::rec_export(std::string path)
});
#endif
*/
m_encoder->write_mp4(data_path + "/export.mp4");
Canvas::I->m_encoder->write_mp4(data_path + "/export.mp4");
pb->destroy();
}
@@ -788,11 +790,6 @@ void App::rec_loop()
{
BT_SetTerminate();
rec_running = true;
if (!m_encoder)
{
m_encoder = std::make_unique<MP4Encoder>();
m_encoder->init(1024, 512, 30, 500 << 10);
}
while(rec_running)
{
std::unique_ptr<Image> frame;
@@ -810,8 +807,8 @@ void App::rec_loop()
rec_frames.pop_front();
}
lock.unlock();
if (frame)
m_encoder->encode(*frame);
if (frame && Canvas::I->m_encoder)
Canvas::I->m_encoder->encode(*frame);
update_rec_frames();
}
}