diff --git a/Userland/Libraries/LibVideo/PlaybackManager.cpp b/Userland/Libraries/LibVideo/PlaybackManager.cpp index 0024fd4a0f..522a6d2bd2 100644 --- a/Userland/Libraries/LibVideo/PlaybackManager.cpp +++ b/Userland/Libraries/LibVideo/PlaybackManager.cpp @@ -75,7 +75,7 @@ Time PlaybackManager::duration() { auto duration_result = m_demuxer->duration(); if (duration_result.is_error()) - on_decoder_error(duration_result.release_error()); + dispatch_decoder_error(duration_result.release_error()); return duration_result.release_value(); } @@ -89,7 +89,7 @@ void PlaybackManager::dispatch_fatal_error(Error error) m_event_handler.dispatch_event(event); } -void PlaybackManager::on_decoder_error(DecoderError error) +void PlaybackManager::dispatch_decoder_error(DecoderError error) { switch (error.category()) { case DecoderErrorCategory::EndOfStream: @@ -104,6 +104,23 @@ void PlaybackManager::on_decoder_error(DecoderError error) } } +void PlaybackManager::dispatch_new_frame(RefPtr frame) +{ + m_main_loop.post_event(m_event_handler, make(frame)); +} + +bool PlaybackManager::dispatch_frame_queue_item(FrameQueueItem&& item) +{ + if (item.is_error()) { + dispatch_decoder_error(item.release_error()); + return true; + } + + dbgln_if(PLAYBACK_MANAGER_DEBUG, "Sent frame for presentation"); + dispatch_new_frame(item.bitmap()); + return false; +} + void PlaybackManager::timer_callback() { TRY_OR_FATAL_ERROR(m_playback_handler->on_timer_callback()); @@ -120,7 +137,7 @@ Optional