summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/VideoTrack.h
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-09 12:08:49 -0400
committerLinus Groh <mail@linusgroh.de>2023-04-09 23:55:05 +0200
commitedf85d39c6497f33bf8501e202fa4b7eddc98646 (patch)
tree40f6d5380ecaa2208c711d0afd88def942ec6b6b /Userland/Libraries/LibWeb/HTML/VideoTrack.h
parent7132047c924c1850c406e52cf58e2d80267e8370 (diff)
downloadserenity-edf85d39c6497f33bf8501e202fa4b7eddc98646.zip
LibWeb: Port HTMLVideoElement to play videos with Video::PlaybackManager
This has several advantages over the current manual demuxing currently being performed. PlaybackManager hides the specific demuxer being used, which will allow more codecs to be added transparently to LibWeb. It also provides buffering and controls playback rate for us. Further, it will allow us to much more easily implement the "media timeline" to render a timestamp and implement seeking.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/VideoTrack.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/VideoTrack.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/VideoTrack.h b/Userland/Libraries/LibWeb/HTML/VideoTrack.h
index 5009271705..77e37cecf6 100644
--- a/Userland/Libraries/LibWeb/HTML/VideoTrack.h
+++ b/Userland/Libraries/LibWeb/HTML/VideoTrack.h
@@ -9,9 +9,7 @@
#include <AK/String.h>
#include <AK/Time.h>
#include <LibGfx/Forward.h>
-#include <LibVideo/Containers/Matroska/MatroskaDemuxer.h>
-#include <LibVideo/Track.h>
-#include <LibVideo/VP9/Decoder.h>
+#include <LibVideo/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::HTML {
@@ -24,11 +22,12 @@ public:
void set_video_track_list(Badge<VideoTrackList>, JS::GCPtr<VideoTrackList> video_track_list) { m_video_track_list = video_track_list; }
- RefPtr<Gfx::Bitmap> next_frame();
+ void play_video(Badge<HTMLVideoElement>);
+ void pause_video(Badge<HTMLVideoElement>);
- Time duration() const { return m_track.video_data().duration; }
- u64 pixel_width() const { return m_track.video_data().pixel_width; }
- u64 pixel_height() const { return m_track.video_data().pixel_height; }
+ Time duration() const;
+ u64 pixel_width() const;
+ u64 pixel_height() const;
String const& id() const { return m_id; }
String const& kind() const { return m_kind; }
@@ -39,7 +38,7 @@ public:
void set_selected(bool selected);
private:
- explicit VideoTrack(JS::Realm&, JS::NonnullGCPtr<HTMLMediaElement>, NonnullOwnPtr<Video::Matroska::MatroskaDemuxer>, Video::Track);
+ VideoTrack(JS::Realm&, JS::NonnullGCPtr<HTMLMediaElement>, NonnullOwnPtr<Video::PlaybackManager>);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@@ -62,9 +61,7 @@ private:
JS::NonnullGCPtr<HTMLMediaElement> m_media_element;
JS::GCPtr<VideoTrackList> m_video_track_list;
- NonnullOwnPtr<Video::Matroska::MatroskaDemuxer> m_demuxer;
- Video::VP9::Decoder m_decoder;
- Video::Track m_track;
+ NonnullOwnPtr<Video::PlaybackManager> m_playback_manager;
};
}