mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
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.
This commit is contained in:
parent
7132047c92
commit
edf85d39c6
5 changed files with 87 additions and 93 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue