diff options
Diffstat (limited to 'servers/movie_writer')
-rw-r--r-- | servers/movie_writer/movie_writer.cpp | 15 | ||||
-rw-r--r-- | servers/movie_writer/movie_writer.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp index 9f96b8cfda..93f9f8ea08 100644 --- a/servers/movie_writer/movie_writer.cpp +++ b/servers/movie_writer/movie_writer.cpp @@ -30,6 +30,8 @@ #include "movie_writer.h" #include "core/config/project_settings.h" +#include "core/io/dir_access.h" +#include "servers/display_server.h" MovieWriter *MovieWriter::writers[MovieWriter::MAX_WRITERS]; uint32_t MovieWriter::writer_count = 0; @@ -101,6 +103,7 @@ void MovieWriter::get_supported_extensions(List<String> *r_extensions) const { } void MovieWriter::begin(const Size2i &p_movie_size, uint32_t p_fps, const String &p_base_path) { + project_name = GLOBAL_GET("application/config/name"); mix_rate = get_audio_mix_rate(); AudioDriverDummy::get_dummy_singleton()->set_mix_rate(mix_rate); AudioDriverDummy::get_dummy_singleton()->set_speaker_mode(AudioDriver::SpeakerMode(get_audio_speaker_mode())); @@ -162,6 +165,18 @@ void MovieWriter::set_extensions_hint() { } void MovieWriter::add_frame(const Ref<Image> &p_image) { + const int movie_time_seconds = Engine::get_singleton()->get_frames_drawn() / fps; + const String movie_time = vformat("%s:%s:%s", + String::num(movie_time_seconds / 3600).pad_zeros(2), + String::num((movie_time_seconds % 3600) / 60).pad_zeros(2), + String::num(movie_time_seconds % 60).pad_zeros(2)); + +#ifdef DEBUG_ENABLED + DisplayServer::get_singleton()->window_set_title(vformat("MovieWriter: Frame %d (time: %s) - %s (DEBUG)", Engine::get_singleton()->get_frames_drawn(), movie_time, project_name)); +#else + DisplayServer::get_singleton()->window_set_title(vformat("MovieWriter: Frame %d (time: %s) - %s", Engine::get_singleton()->get_frames_drawn(), movie_time, project_name)); +#endif + AudioDriverDummy::get_dummy_singleton()->mix_audio(mix_rate / fps, audio_mix_buffer.ptr()); write_frame(p_image, audio_mix_buffer.ptr()); } diff --git a/servers/movie_writer/movie_writer.h b/servers/movie_writer/movie_writer.h index 1ec6e93052..7877a60715 100644 --- a/servers/movie_writer/movie_writer.h +++ b/servers/movie_writer/movie_writer.h @@ -42,6 +42,8 @@ class MovieWriter : public Object { uint64_t mix_rate = 0; uint32_t audio_channels = 0; + String project_name; + LocalVector<int32_t> audio_mix_buffer; enum { |