From 41e66bef37f52d83709e30723a19f4521787b5af Mon Sep 17 00:00:00 2001 From: Benau Date: Wed, 22 Mar 2017 12:44:32 +0800 Subject: [PATCH] Allow keeping target name after changing resolution --- src/graphics/irr_driver.cpp | 4 ++-- src/utils/avi_writer.cpp | 1 + src/utils/avi_writer.hpp | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 01fd4db23..3f2ef394a 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -1912,8 +1912,8 @@ void IrrDriver::setRecording(bool val) { std::string track_name = World::getWorld() != NULL ? race_manager->getTrackName() : "menu"; - AVIWriter::getInstance()->setRecordingTarget(file_manager - ->getScreenshotDir() + track_name); + AVIWriter::setRecordingTarget(file_manager->getScreenshotDir() + + track_name); AVIWriter::getInstance()->resetFrameBufferImage(); MessageQueue::add(MessageQueue::MT_GENERIC, _("Video recording started.")); diff --git a/src/utils/avi_writer.cpp b/src/utils/avi_writer.cpp index eb7f9012c..b6348e413 100644 --- a/src/utils/avi_writer.cpp +++ b/src/utils/avi_writer.cpp @@ -28,6 +28,7 @@ #include #include +Synchronised AVIWriter::m_recording_target(""); // ---------------------------------------------------------------------------- AVIWriter::AVIWriter() : m_idle(true) { diff --git a/src/utils/avi_writer.hpp b/src/utils/avi_writer.hpp index 53becd9bc..66e455f89 100644 --- a/src/utils/avi_writer.hpp +++ b/src/utils/avi_writer.hpp @@ -167,7 +167,7 @@ class AVIWriter : public CanBeDeleted, public NoCopy, private: FILE* m_file; - Synchronised m_recording_target; + static Synchronised m_recording_target; std::string m_filename; @@ -241,6 +241,11 @@ public: // ------------------------------------------------------------------------ static void* startRoutine(void *obj); // ------------------------------------------------------------------------ + static void setRecordingTarget(const std::string& name) + { + m_recording_target.setAtomic(name); + } + // ------------------------------------------------------------------------ void captureFrameBufferImage(float dt); // ------------------------------------------------------------------------ void resetFrameBufferImage(); @@ -248,9 +253,6 @@ public: void resetCaptureFormat(); // ------------------------------------------------------------------------ void stopRecording() { addFrameBufferImage(NULL, -1); } - // ------------------------------------------------------------------------ - void setRecordingTarget(const std::string& name) - { m_recording_target.setAtomic(name); } };