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

LibVideo: Add a method to get the playback state from PlaybackManager

This commit is contained in:
Zaggy1024 2023-04-12 01:01:29 -05:00 committed by Sam Atkins
parent b081967762
commit dc049e36cf
2 changed files with 28 additions and 5 deletions

View file

@ -91,6 +91,15 @@ public:
virtual void start(int interval_ms) = 0;
};
enum class PlaybackState {
Starting,
Playing,
Paused,
Buffering,
Seeking,
Stopped,
};
class PlaybackManager {
public:
enum class SeekMode {
@ -115,6 +124,10 @@ public:
{
return m_playback_handler->is_playing();
}
PlaybackState get_state() const
{
return m_playback_handler->get_state();
}
u64 number_of_skipped_frames() const { return m_skipped_frames; }
@ -187,7 +200,8 @@ private:
virtual ErrorOr<void> on_enter() { return {}; }
virtual ErrorOr<void> play() { return {}; };
virtual bool is_playing() = 0;
virtual bool is_playing() const = 0;
virtual PlaybackState get_state() const = 0;
virtual ErrorOr<void> pause() { return {}; };
virtual ErrorOr<void> buffer() { return {}; };
virtual ErrorOr<void> seek(Time target_timestamp, SeekMode);