mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
VideoPlayer: Start fleshing out the user interface
This adds player widget with working play/pause controls, a seek bar which currently only displays the current playback position, and a button to cycle between the scaling modes. The player uses the new PlaybackManager class to handle demuxing, decoding, and frame presentation timing. Currently, the volume control is non-functional.
This commit is contained in:
parent
353e1c2b4d
commit
f99d356a17
6 changed files with 429 additions and 82 deletions
59
Userland/Applications/VideoPlayer/VideoPlayerWidget.h
Normal file
59
Userland/Applications/VideoPlayer/VideoPlayerWidget.h
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FixedArray.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibGUI/Forward.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibVideo/DecoderError.h>
|
||||
#include <LibVideo/PlaybackManager.h>
|
||||
|
||||
#include "VideoFrameWidget.h"
|
||||
|
||||
namespace VideoPlayer {
|
||||
|
||||
class VideoPlayerWidget final : public GUI::Widget {
|
||||
C_OBJECT(VideoPlayerWidget)
|
||||
|
||||
public:
|
||||
void open_file(StringView filename);
|
||||
void resume_playback();
|
||||
void pause_playback();
|
||||
void toggle_pause();
|
||||
|
||||
private:
|
||||
VideoPlayerWidget(GUI::Window&);
|
||||
|
||||
void update_play_pause_icon();
|
||||
void on_decoding_error(Video::DecoderError);
|
||||
void display_next_frame();
|
||||
|
||||
void cycle_sizing_modes();
|
||||
|
||||
void event(Core::Event&) override;
|
||||
|
||||
GUI::Window& m_window;
|
||||
|
||||
RefPtr<VideoFrameWidget> m_video_display;
|
||||
RefPtr<GUI::HorizontalSlider> m_seek_slider;
|
||||
|
||||
RefPtr<GUI::Toolbar> m_toolbar;
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_play_icon;
|
||||
RefPtr<Gfx::Bitmap> m_pause_icon;
|
||||
|
||||
RefPtr<GUI::Action> m_play_pause_action;
|
||||
RefPtr<GUI::Label> m_timestamp_label;
|
||||
RefPtr<GUI::Action> m_cycle_sizing_modes_action;
|
||||
RefPtr<GUI::HorizontalSlider> m_volume_slider;
|
||||
|
||||
RefPtr<Video::PlaybackManager> m_playback_manager;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue