summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-10 19:51:03 -0400
committerLinus Groh <mail@linusgroh.de>2023-04-11 19:27:55 +0200
commit33047b38ec0d9ce55bea2f74c00972711e106a30 (patch)
treeaa19d9487f3a0bc75bc62854dd298f0586c6eba3 /Userland/Libraries/LibVideo
parentfe664903993809b8ecc2318b31186da6e6ece82e (diff)
downloadserenity-33047b38ec0d9ce55bea2f74c00972711e106a30.zip
LibVideo: Add a hook to notify clients upon reaching end of the stream
Diffstat (limited to 'Userland/Libraries/LibVideo')
-rw-r--r--Userland/Libraries/LibVideo/PlaybackManager.cpp4
-rw-r--r--Userland/Libraries/LibVideo/PlaybackManager.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibVideo/PlaybackManager.cpp b/Userland/Libraries/LibVideo/PlaybackManager.cpp
index 4db877e1f2..bda97295b7 100644
--- a/Userland/Libraries/LibVideo/PlaybackManager.cpp
+++ b/Userland/Libraries/LibVideo/PlaybackManager.cpp
@@ -129,6 +129,10 @@ void PlaybackManager::dispatch_decoder_error(DecoderError error)
case DecoderErrorCategory::EndOfStream:
dbgln_if(PLAYBACK_MANAGER_DEBUG, "{}", error.string_literal());
TRY_OR_FATAL_ERROR(m_playback_handler->stop());
+
+ if (on_end_of_stream)
+ on_end_of_stream();
+
break;
default:
dbgln("Playback error encountered: {}", error.string_literal());
diff --git a/Userland/Libraries/LibVideo/PlaybackManager.h b/Userland/Libraries/LibVideo/PlaybackManager.h
index 813101ba6f..7c5779ded3 100644
--- a/Userland/Libraries/LibVideo/PlaybackManager.h
+++ b/Userland/Libraries/LibVideo/PlaybackManager.h
@@ -123,6 +123,7 @@ public:
Function<void(RefPtr<Gfx::Bitmap>)> on_video_frame;
Function<void()> on_playback_state_change;
+ Function<void()> on_end_of_stream;
Function<void(DecoderError)> on_decoder_error;
Function<void(Error)> on_fatal_playback_error;