1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibVideo: Rewrite the video frame present function to be more readable

The PlaybackManager::update_presented_frame function was getting out of
hand and adding seeking was making it illegible. This rewrites it to be
(hopefully) quite a bit more readable, and adds a few comments to help
future readers of the code.

In addition, some helpful debugging prints were added that should help
debug any future issues with the player.
This commit is contained in:
Zaggy1024 2022-11-14 00:48:31 -06:00 committed by Andreas Kling
parent f31621b3f2
commit 9a9fe08449
3 changed files with 81 additions and 67 deletions

View file

@ -114,7 +114,7 @@ void VideoPlayerWidget::update_play_pause_icon()
m_play_pause_action->set_enabled(true);
if (m_playback_manager->is_playing() || m_playback_manager->is_buffering())
if (m_playback_manager->is_playing())
m_play_pause_action->set_icon(m_pause_icon);
else
m_play_pause_action->set_icon(m_play_icon);
@ -140,7 +140,7 @@ void VideoPlayerWidget::toggle_pause()
{
if (!m_playback_manager)
return;
if (m_playback_manager->is_playing() || m_playback_manager->is_buffering())
if (m_playback_manager->is_playing())
pause_playback();
else
resume_playback();