summaryrefslogtreecommitdiffstats
path: root/scene
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-12-04 23:05:15 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-12-04 23:05:15 +0100
commitf444818c7e8d6d0cab90c73cb259bee58e6db2ad (patch)
treec65fb648f0650735111d99cc3d5d0d6bfaf9625b /scene
parentbe585ac64454a4097af8731d65c8abd0454ab345 (diff)
parent7d0c561e02d37a27884162128387064f4fb1b90b (diff)
downloadredot-engine-f444818c7e8d6d0cab90c73cb259bee58e6db2ad.tar.gz
Merge pull request #84794 from akien-mga/videoplayer-fix-reloading-translation-remapped-stream
VideoPlayer: Fix reloading translation remapped stream
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/video_stream_player.cpp10
-rw-r--r--scene/resources/video_stream.cpp1
2 files changed, 11 insertions, 0 deletions
diff --git a/scene/gui/video_stream_player.cpp b/scene/gui/video_stream_player.cpp
index ac09844128..41a210e180 100644
--- a/scene/gui/video_stream_player.cpp
+++ b/scene/gui/video_stream_player.cpp
@@ -237,6 +237,12 @@ bool VideoStreamPlayer::has_loop() const {
void VideoStreamPlayer::set_stream(const Ref<VideoStream> &p_stream) {
stop();
+ // Make sure to handle stream changes seamlessly, e.g. when done via
+ // translation remapping.
+ if (stream.is_valid()) {
+ stream->disconnect_changed(callable_mp(this, &VideoStreamPlayer::set_stream));
+ }
+
AudioServer::get_singleton()->lock();
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());
stream = p_stream;
@@ -248,6 +254,10 @@ void VideoStreamPlayer::set_stream(const Ref<VideoStream> &p_stream) {
}
AudioServer::get_singleton()->unlock();
+ if (stream.is_valid()) {
+ stream->connect_changed(callable_mp(this, &VideoStreamPlayer::set_stream).bind(stream));
+ }
+
if (!playback.is_null()) {
playback->set_paused(paused);
texture = playback->get_texture();
diff --git a/scene/resources/video_stream.cpp b/scene/resources/video_stream.cpp
index dc8545426f..3b152d11ce 100644
--- a/scene/resources/video_stream.cpp
+++ b/scene/resources/video_stream.cpp
@@ -172,6 +172,7 @@ Ref<VideoStreamPlayback> VideoStream::instantiate_playback() {
void VideoStream::set_file(const String &p_file) {
file = p_file;
+ emit_changed();
}
String VideoStream::get_file() {