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

LibVideo/VP9: Choose whether/how to show new frames using an enum

There are three mutually exclusive frame-showing states:
- Show no new frame, only store the frame as a reference.
- Show a newly decoded frame.
- Show frame from the reference frame store.
Since they are mutually exclusive, using an enum rather than two bools
makes more sense.
This commit is contained in:
Zaggy1024 2022-11-22 21:36:36 -06:00 committed by Andreas Kling
parent befcd479ae
commit 3259c99cab
4 changed files with 24 additions and 9 deletions

View file

@ -237,17 +237,26 @@ struct PersistentBlockContext {
u8 segment_id { 0 };
};
enum class FrameShowMode {
CreateAndShowNewFrame,
ShowExistingFrame,
DoNotShowFrame,
};
struct FrameContext {
public:
u8 profile { 0 };
bool shows_existing_frame() const { return m_show_existing_frame; }
u8 existing_frame_index() const { return m_existing_frame_index; }
bool shows_a_frame() const { return m_frame_show_mode != FrameShowMode::DoNotShowFrame; }
bool shows_a_new_frame() const { return m_frame_show_mode == FrameShowMode::CreateAndShowNewFrame; }
bool shows_existing_frame() const { return m_frame_show_mode == FrameShowMode::ShowExistingFrame; }
void set_frame_hidden() { m_frame_show_mode = FrameShowMode::DoNotShowFrame; }
void set_existing_frame_to_show(u8 index)
{
m_show_existing_frame = true;
m_frame_show_mode = FrameShowMode::ShowExistingFrame;
m_existing_frame_index = index;
}
u8 existing_frame_index() const { return m_existing_frame_index; }
Gfx::Size<u32> size() const { return m_size; }
ErrorOr<void> set_size(Gfx::Size<u32> size)
@ -273,7 +282,7 @@ public:
private:
friend struct TileContext;
bool m_show_existing_frame { false };
FrameShowMode m_frame_show_mode { FrameShowMode::CreateAndShowNewFrame };
u8 m_existing_frame_index { 0 };
Gfx::Size<u32> m_size { 0, 0 };