mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Update the VideoPlayer correctly when writing out frames in SessionRecording
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <openspace/engine/syncengine.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
#include <openspace/interaction/sessionrecording.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
@@ -36,6 +37,7 @@
|
||||
#include <ghoul/opengl/framebufferobject.h>
|
||||
#include <ghoul/opengl/openglstatecache.h>
|
||||
|
||||
|
||||
namespace {
|
||||
constexpr std::string_view _loggerCat = "VideoPlayer";
|
||||
|
||||
@@ -497,6 +499,28 @@ void VideoPlayer::update() {
|
||||
if (_isDestroying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (global::sessionRecording->isSavingFramesDuringPlayback()) {
|
||||
double dt = global::sessionRecording->fixedDeltaTimeDuringFrameOutput();
|
||||
if (_playbackMode == PlaybackMode::MapToSimulationTime) {
|
||||
_currentVideoTime = correctVideoPlaybackTime();
|
||||
}
|
||||
else {
|
||||
_currentVideoTime = _currentVideoTime + dt;
|
||||
}
|
||||
|
||||
MpvKey key = MpvKey::Time;
|
||||
mpv_set_property(_mpvHandle, keys[key], formats[key], &_currentVideoTime);
|
||||
|
||||
uint64_t result = mpv_render_context_update(_mpvRenderContext);
|
||||
while ((result & MPV_RENDER_UPDATE_FRAME) == 0) {
|
||||
renderFrame();
|
||||
|
||||
result = mpv_render_context_update(_mpvRenderContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (_playbackMode == PlaybackMode::MapToSimulationTime) {
|
||||
seekToTime(correctVideoPlaybackTime());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user