From 7132047c924c1850c406e52cf58e2d80267e8370 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 9 Apr 2023 11:59:35 -0400 Subject: [PATCH] LibVideo: Add a forwarding header And change some non-plain structs to classes for consistency. --- Userland/Libraries/LibVideo/DecoderError.h | 5 ++--- Userland/Libraries/LibVideo/Forward.h | 19 +++++++++++++++++++ Userland/Libraries/LibVideo/PlaybackManager.h | 3 ++- Userland/Libraries/LibVideo/Track.h | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 Userland/Libraries/LibVideo/Forward.h diff --git a/Userland/Libraries/LibVideo/DecoderError.h b/Userland/Libraries/LibVideo/DecoderError.h index c66b7717ea..bca03e1c18 100644 --- a/Userland/Libraries/LibVideo/DecoderError.h +++ b/Userland/Libraries/LibVideo/DecoderError.h @@ -10,12 +10,11 @@ #include #include #include +#include #include namespace Video { -struct DecoderError; - template using DecoderErrorOr = ErrorOr; @@ -33,7 +32,7 @@ enum class DecoderErrorCategory : u32 { NotImplemented, }; -struct DecoderError { +class DecoderError { public: static DecoderError with_description(DecoderErrorCategory category, StringView description) { diff --git a/Userland/Libraries/LibVideo/Forward.h b/Userland/Libraries/LibVideo/Forward.h new file mode 100644 index 0000000000..6eb99471f3 --- /dev/null +++ b/Userland/Libraries/LibVideo/Forward.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2023, Tim Flynn + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +namespace Video { + +class DecoderError; +class FrameQueueItem; +class PlaybackManager; +class Sample; +class Track; +class VideoDecoder; +class VideoFrame; + +} diff --git a/Userland/Libraries/LibVideo/PlaybackManager.h b/Userland/Libraries/LibVideo/PlaybackManager.h index 92c03d5131..813101ba6f 100644 --- a/Userland/Libraries/LibVideo/PlaybackManager.h +++ b/Userland/Libraries/LibVideo/PlaybackManager.h @@ -23,7 +23,8 @@ namespace Video { -struct FrameQueueItem { +class FrameQueueItem { +public: static constexpr Time no_timestamp = Time::min(); enum class Type { diff --git a/Userland/Libraries/LibVideo/Track.h b/Userland/Libraries/LibVideo/Track.h index 476ff51314..4653cc22fc 100644 --- a/Userland/Libraries/LibVideo/Track.h +++ b/Userland/Libraries/LibVideo/Track.h @@ -20,7 +20,7 @@ enum class TrackType : u32 { Subtitles, }; -struct Track { +class Track { struct VideoData { Time duration {}; u64 pixel_width { 0 };