Truly independent web browser
LibMedia+Compositor+Tests: Wrap CICP in a ColorMetadata struct
Zaggy10242489998cbc79
diff --git a/Libraries/LibMedia/Containers/ISOBMFF/Boxes.h b/Libraries/LibMedia/Containers/ISOBMFF/Boxes.hindex 3293953299f..909ef96a2a0 100644--- a/Libraries/LibMedia/Containers/ISOBMFF/Boxes.h+++ b/Libraries/LibMedia/Containers/ISOBMFF/Boxes.h@@ -319,7 +319,7 @@ inline Track track_from_track_entry(TrackEntry const& track_entry, bool is_firsttrack.set_video_data({.pixel_width = video.width,.pixel_height = video.height,- .cicp = video.cicp.value_or({}),+ .color_metadata = { .cicp = video.cicp.value_or({}) },});} else if (track.type() == TrackType::Audio && sample_entry->audio.has_value()) {auto const& audio = sample_entry->audio.value();diff --git a/Libraries/LibMedia/Containers/Matroska/Document.h b/Libraries/LibMedia/Containers/Matroska/Document.hindex 5a0a1ea3b7a..4427c479aca 100644--- a/Libraries/LibMedia/Containers/Matroska/Document.h+++ b/Libraries/LibMedia/Containers/Matroska/Document.h@@ -347,7 +347,7 @@ inline Track track_from_track_entry(TrackEntry const& track_entry, bool is_firsttrack.set_video_data({.pixel_width = video_track->pixel_width,.pixel_height = video_track->pixel_height,- .cicp = cicp,+ .color_metadata = { .cicp = cicp },});}}diff --git a/Libraries/LibMedia/Containers/Ogg/Reader.cpp b/Libraries/LibMedia/Containers/Ogg/Reader.cppindex 986773cf970..64d3393af16 100644--- a/Libraries/LibMedia/Containers/Ogg/Reader.cpp+++ b/Libraries/LibMedia/Containers/Ogg/Reader.cpp@@ -307,7 +307,7 @@ Track StreamIdentification::create_track(size_t identifier) constTrack track { type, identifier, Track::Kind::Main, {}, {} };track.set_parsed_codec(ParsedCodec { codec_id });if (type == TrackType::Video) {- track.set_video_data({ .pixel_width = pixel_width, .pixel_height = pixel_height, .cicp = {} });+ track.set_video_data({ .pixel_width = pixel_width, .pixel_height = pixel_height, .color_metadata = {} });return track;}auto channel_map = vorbis_channel_map(channel_count);diff --git a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp b/Libraries/LibMedia/Producers/DecodedVideoProducer.cppindex a25959fb825..71c958c48a5 100644--- a/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp+++ b/Libraries/LibMedia/Producers/DecodedVideoProducer.cpp@@ -688,7 +688,7 @@ void DecodedVideoProducer::ThreadData::handle_seek()break;while (m_decoder != nullptr && new_seek_id == seek_id) {- auto frame_result = m_decoder->take_next_output(m_track.video_data().cicp, timestamp);+ auto frame_result = m_decoder->take_next_output(m_track.video_data().color_metadata, timestamp);if (frame_result.is_error()) {if (frame_result.error().category() == DecoderErrorCategory::EndOfStream) {if (m_decoder_is_draining_before_unavailable_data) {@@ -877,7 +877,7 @@ void DecodedVideoProducer::ThreadData::push_data_and_decode_some_frames()if (seek_is_pending())return;- auto frame_result = m_decoder->take_next_output(m_track.video_data().cicp);+ auto frame_result = m_decoder->take_next_output(m_track.video_data().color_metadata);if (frame_result.is_error()) {if (frame_result.error().category() == DecoderErrorCategory::NeedsMoreInput)break;diff --git a/Libraries/LibMedia/RemoteVideoDecoder.cpp b/Libraries/LibMedia/RemoteVideoDecoder.cppindex fe80e7f2d57..d7e2ea62f5b 100644--- a/Libraries/LibMedia/RemoteVideoDecoder.cpp+++ b/Libraries/LibMedia/RemoteVideoDecoder.cpp@@ -718,7 +718,7 @@ void RemoteVideoDecoder::signal_end_of_stream()});}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> RemoteVideoDecoder::take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> RemoteVideoDecoder::take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target){// The server hears of the target with the next submission, which follows the flush that any new target comes after.m_output_target = target;@@ -762,11 +762,11 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> RemoteVideoDecoder::take_next_output(C}auto const& frame = output->frame;- auto cicp = container_cicp;- cicp.adopt_specified_values(frame->cicp());+ auto color_metadata = container_color_metadata;+ color_metadata.adopt_specified_values(frame->color_metadata());return DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(frame->timestamp(), frame->duration(), frame->size(),- frame->bit_depth(), frame->subsampling(), cicp, frame->storage()));+ frame->bit_depth(), frame->subsampling(), move(color_metadata), frame->storage()));}void RemoteVideoDecoder::flush()diff --git a/Libraries/LibMedia/RemoteVideoDecoder.h b/Libraries/LibMedia/RemoteVideoDecoder.hindex 6fb6e30ffac..290ea44855b 100644--- a/Libraries/LibMedia/RemoteVideoDecoder.h+++ b/Libraries/LibMedia/RemoteVideoDecoder.h@@ -55,7 +55,7 @@ public:virtual DecoderErrorOr<void> receive_coded_data(CodedFrame const&, DecodeIntent) override;virtual void signal_end_of_stream() override;- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) override;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) override;virtual void flush() override;struct State;diff --git a/Libraries/LibMedia/Track.cpp b/Libraries/LibMedia/Track.cppindex 5a101222a89..075bae99b52 100644--- a/Libraries/LibMedia/Track.cpp+++ b/Libraries/LibMedia/Track.cpp@@ -24,7 +24,7 @@ ErrorOr<void> encode(Encoder& encoder, Media::Track const& track)auto const& video_data = track.video_data();TRY(encoder.encode(video_data.pixel_width));TRY(encoder.encode(video_data.pixel_height));- TRY(encoder.encode(video_data.cicp));+ TRY(encoder.encode(video_data.color_metadata));break;}case Media::TrackType::Audio: {@@ -62,7 +62,7 @@ ErrorOr<Media::Track> decode(Decoder& decoder)Media::Track::VideoData video_data;video_data.pixel_width = TRY(decoder.decode<u64>());video_data.pixel_height = TRY(decoder.decode<u64>());- video_data.cicp = TRY(decoder.decode<Media::CodingIndependentCodePoints>());+ video_data.color_metadata = TRY(decoder.decode<Media::ColorMetadata>());track.set_video_data(video_data);break;}diff --git a/Libraries/LibMedia/Track.h b/Libraries/LibMedia/Track.hindex ad6f60e499f..abdc4b40466 100644--- a/Libraries/LibMedia/Track.h+++ b/Libraries/LibMedia/Track.h@@ -18,7 +18,7 @@#include <LibIPC/Forward.h>#include <LibMedia/Export.h>#include <LibMediaCodecs/CodecParameters.h>-#include <LibMediaCodecs/Color/CodingIndependentCodePoints.h>+#include <LibMediaCodecs/Color/ColorMetadata.h>#include <LibMediaCodecs/TrackType.h>namespace Media {@@ -28,7 +28,7 @@ public:struct VideoData {u64 pixel_width { 0 };u64 pixel_height { 0 };- CodingIndependentCodePoints cicp;+ ColorMetadata color_metadata;};struct AudioData {diff --git a/Libraries/LibMediaCodecs/CMakeLists.txt b/Libraries/LibMediaCodecs/CMakeLists.txtindex 746e239ee7c..6cf6a1a5542 100644--- a/Libraries/LibMediaCodecs/CMakeLists.txt+++ b/Libraries/LibMediaCodecs/CMakeLists.txt@@ -8,6 +8,7 @@ set(SOURCESCodecs/MPEG4Audio.cppCodecs/VP9.cppColor/CodingIndependentCodePoints.cpp+ Color/ColorMetadata.cppDecoderCapabilities.cppDecoderError.cppFFmpeg/FFmpegFunctions.cppdiff --git a/Libraries/LibMediaCodecs/Color/ColorMetadata.cpp b/Libraries/LibMediaCodecs/Color/ColorMetadata.cppnew file mode 100644index 00000000000..116d0f330de--- /dev/null+++ b/Libraries/LibMediaCodecs/Color/ColorMetadata.cpp@@ -0,0 +1,28 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <LibIPC/Decoder.h>+#include <LibIPC/Encoder.h>+#include <LibMediaCodecs/Color/ColorMetadata.h>++namespace IPC {++template<>+ErrorOr<void> encode(Encoder& encoder, Media::ColorMetadata const& metadata)+{+ TRY(encoder.encode(metadata.cicp));+ return {};+}++template<>+ErrorOr<Media::ColorMetadata> decode(Decoder& decoder)+{+ return Media::ColorMetadata {+ .cicp = TRY(decoder.decode<Media::CodingIndependentCodePoints>()),+ };+}++}diff --git a/Libraries/LibMediaCodecs/Color/ColorMetadata.h b/Libraries/LibMediaCodecs/Color/ColorMetadata.hnew file mode 100644index 00000000000..fa575874fa7--- /dev/null+++ b/Libraries/LibMediaCodecs/Color/ColorMetadata.h@@ -0,0 +1,36 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <LibIPC/Forward.h>+#include <LibMediaCodecs/Color/CodingIndependentCodePoints.h>+#include <LibMediaCodecs/Export.h>++namespace Media {++struct ColorMetadata {+ CodingIndependentCodePoints cicp;++ bool operator==(ColorMetadata const&) const = default;++ void adopt_specified_values(ColorMetadata const& other)+ {+ cicp.adopt_specified_values(other.cicp);+ }+};++}++namespace IPC {++template<>+MEDIACODECS_API ErrorOr<void> encode(Encoder&, Media::ColorMetadata const&);++template<>+MEDIACODECS_API ErrorOr<Media::ColorMetadata> decode(Decoder&);++}diff --git a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.cpp b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.cppindex c902a6a9e52..51c39dec644 100644--- a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.cpp+++ b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.cpp@@ -113,7 +113,7 @@ void FFmpegVideoDecoder::signal_end_of_stream()VERIFY(result == 0 || result == AVERROR_EOF);}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVideoDecoder::take_next_output(CodingIndependentCodePoints const& container_cicp, [[maybe_unused]] Optional<AK::Duration> target)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVideoDecoder::take_next_output(ColorMetadata const& container_color_metadata, [[maybe_unused]] Optional<AK::Duration> target){while (!m_pending_frame.has_value()) {auto result = m_functions.avcodec_receive_frame(m_codec_context, m_frame);@@ -141,7 +141,8 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVideoDecoder::take_next_output(C}}- auto cicp = coding_independent_code_points_of(m_functions, *m_codec_context, container_cicp);+ auto color_metadata = container_color_metadata;+ color_metadata.cicp = coding_independent_code_points_of(m_functions, *m_codec_context, container_color_metadata.cicp);auto pixel_format = static_cast<AVPixelFormat>(m_frame->format);auto bit_depth = [&]() -> Optional<u8> {@@ -195,13 +196,13 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVideoDecoder::take_next_output(Cif (!acquired_slot.has_value())return DecoderError::with_description(DecoderErrorCategory::TryAgain, "Every video frame slot is held elsewhere"sv);- auto yuv_data = DECODER_TRY_ALLOC(Gfx::YUVData::create(size, *bit_depth, subsampling, cicp,+ auto yuv_data = DECODER_TRY_ALLOC(Gfx::YUVData::create(size, *bit_depth, subsampling, color_metadata.cicp,acquired_slot->bytes.slice(0, layout.y_size),acquired_slot->bytes.slice(layout.u_offset, layout.u_size),acquired_slot->bytes.slice(layout.v_offset, layout.v_size)));TRY(copy_pending_frame_into(yuv_data));- auto frame = DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(m_pending_frame->timestamp, m_pending_frame->duration, size.to_type<u32>(), *bit_depth, subsampling, cicp, acquired_slot->storage));+ auto frame = DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(m_pending_frame->timestamp, m_pending_frame->duration, size.to_type<u32>(), *bit_depth, subsampling, move(color_metadata), acquired_slot->storage));m_pending_frame.clear();return frame;}diff --git a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.h b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.hindex 6942ffdb1de..0c2c0d28ca4 100644--- a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.h+++ b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVideoDecoder.h@@ -35,7 +35,7 @@ public:virtual DecoderErrorOr<void> receive_coded_data(CodedFrame const&, DecodeIntent) override;virtual void signal_end_of_stream() override;- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) override;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) override;virtual void flush() override;diff --git a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.cpp b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.cppindex 6e1b87d9215..4639b47f772 100644--- a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.cpp+++ b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.cpp@@ -1083,7 +1083,7 @@ DecoderErrorOr<NonnullRefPtr<VideoSurface>> FFmpegVulkanVideoDecoder::surface_foreturn surface.release_value();}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVulkanVideoDecoder::take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration>)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVulkanVideoDecoder::take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration>){TRY(receive_decoded_frames());@@ -1108,9 +1108,9 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> FFmpegVulkanVideoDecoder::take_next_ouif (!storage)return DecoderError::with_description(DecoderErrorCategory::TryAgain, "Every video surface the decoder may hand out is held elsewhere"sv);- auto cicp = container_cicp;- cicp.adopt_specified_values(output.cicp);- auto frame = DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(output.timing.timestamp, output.timing.duration, output.size, output.bit_depth, Subsampling::yuv420(), cicp, storage.release_nonnull()));+ auto color_metadata = container_color_metadata;+ color_metadata.cicp.adopt_specified_values(output.cicp);+ auto frame = DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(output.timing.timestamp, output.timing.duration, output.size, output.bit_depth, Subsampling::yuv420(), move(color_metadata), storage.release_nonnull()));m_outputs.take_first();return frame;}diff --git a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.h b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.hindex a351d9b8c2a..2e606283a6f 100644--- a/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.h+++ b/Libraries/LibMediaCodecs/FFmpeg/FFmpegVulkanVideoDecoder.h@@ -54,7 +54,7 @@ public:virtual DecoderErrorOr<void> receive_coded_data(CodedFrame const&, DecodeIntent) override;virtual void signal_end_of_stream() override;- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) override;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) override;virtual void flush() override;private:diff --git a/Libraries/LibMediaCodecs/VideoDecoder.h b/Libraries/LibMediaCodecs/VideoDecoder.hindex 45f9e4d79ab..ce7113fc180 100644--- a/Libraries/LibMediaCodecs/VideoDecoder.h+++ b/Libraries/LibMediaCodecs/VideoDecoder.h@@ -9,7 +9,7 @@#include <AK/Function.h>#include <AK/NonnullRefPtr.h>#include <AK/Time.h>-#include <LibMediaCodecs/Color/CodingIndependentCodePoints.h>+#include <LibMediaCodecs/Color/ColorMetadata.h>#include "DecoderError.h"@@ -47,7 +47,7 @@ public:// Callers may pass the optional target parameter to indicate the timestamp past which they need output. This// allows reordered codecs to produce a seek-resolving frame without filling the reorder queue first.- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) = 0;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) = 0;virtual void flush() = 0;};diff --git a/Libraries/LibMediaCodecs/VideoFrame.cpp b/Libraries/LibMediaCodecs/VideoFrame.cppindex a63c0d5212e..2b53e55fbf9 100644--- a/Libraries/LibMediaCodecs/VideoFrame.cpp+++ b/Libraries/LibMediaCodecs/VideoFrame.cpp@@ -25,7 +25,7 @@ VideoFrame::VideoFrame(Gfx::Size<u32> size,u8 bit_depth,Subsampling subsampling,- CodingIndependentCodePoints cicp,+ ColorMetadata color_metadata,NonnullRefPtr<VideoFrameStorage> storage): m_id(next_frame_id()), m_timestamp(timestamp)@@ -33,7 +33,7 @@ VideoFrame::VideoFrame(, m_size(size), m_bit_depth(bit_depth), m_subsampling(subsampling)- , m_cicp(cicp)+ , m_color_metadata(move(color_metadata)), m_storage(move(storage)){}@@ -52,7 +52,7 @@ Core::AnonymousBuffer VideoFrame::pixel_buffer() constOptional<Gfx::YUVData> VideoFrame::yuv_data() const{- auto yuv_data = yuv_data_in_buffer(pixel_buffer(), m_size.to_type<int>(), m_bit_depth, m_subsampling, m_cicp);+ auto yuv_data = yuv_data_in_buffer(pixel_buffer(), m_size.to_type<int>(), m_bit_depth, m_subsampling, cicp());if (yuv_data.is_error())return {};return yuv_data.release_value();@@ -61,7 +61,7 @@ Optional<Gfx::YUVData> VideoFrame::yuv_data() constErrorOr<NonnullRefPtr<Gfx::Bitmap>> VideoFrame::to_bitmap() const{if (auto surface = this->surface())- return surface->read_back_bitmap(m_cicp);+ return surface->read_back_bitmap(cicp());auto yuv_data = this->yuv_data();if (!yuv_data.has_value())return Error::from_string_literal("Video frame has no pixels to read");diff --git a/Libraries/LibMediaCodecs/VideoFrame.h b/Libraries/LibMediaCodecs/VideoFrame.hindex fa4e11354cb..ff5d7f231b8 100644--- a/Libraries/LibMediaCodecs/VideoFrame.h+++ b/Libraries/LibMediaCodecs/VideoFrame.h@@ -14,7 +14,7 @@#include <LibCore/AnonymousBuffer.h>#include <LibGfx/Size.h>#include <LibGfx/YUVData.h>-#include <LibMediaCodecs/Color/CodingIndependentCodePoints.h>+#include <LibMediaCodecs/Color/ColorMetadata.h>#include <LibMediaCodecs/Export.h>#include <LibMediaCodecs/Subsampling.h>@@ -34,7 +34,7 @@ public:Gfx::Size<u32> size,u8 bit_depth,Subsampling subsampling,- CodingIndependentCodePoints cicp,+ ColorMetadata color_metadata,NonnullRefPtr<VideoFrameStorage>);~VideoFrame();@@ -54,7 +54,8 @@ public:u8 bit_depth() const { return m_bit_depth; }Subsampling subsampling() const { return m_subsampling; }- CodingIndependentCodePoints const& cicp() const { return m_cicp; }+ ColorMetadata const& color_metadata() const { return m_color_metadata; }+ CodingIndependentCodePoints const& cicp() const { return m_color_metadata.cicp; }// A view of the planes in the frame's buffer, absent when a surface holds them instead.Optional<Gfx::YUVData> yuv_data() const;@@ -77,7 +78,7 @@ private:Gfx::Size<u32> m_size;u8 m_bit_depth;Subsampling m_subsampling;- CodingIndependentCodePoints m_cicp;+ ColorMetadata m_color_metadata;NonnullRefPtr<VideoFrameStorage> m_storage;};diff --git a/Libraries/LibMediaCodecs/VideoFrameMetadata.cpp b/Libraries/LibMediaCodecs/VideoFrameMetadata.cppindex 839f3656667..3beb850f514 100644--- a/Libraries/LibMediaCodecs/VideoFrameMetadata.cpp+++ b/Libraries/LibMediaCodecs/VideoFrameMetadata.cpp@@ -51,7 +51,7 @@ bool VideoFrameMetadata::is_valid() constreturn false;if (video_frame_exceeds_limits(size.width(), size.height()))return false;- return cicp.is_valid_or_unspecified();+ return color_metadata.cicp.is_valid_or_unspecified();}VideoFrameMetadata VideoFrameMetadata::for_frame(VideoFrame const& frame)@@ -62,7 +62,7 @@ VideoFrameMetadata VideoFrameMetadata::for_frame(VideoFrame const& frame).size = frame.size().to_type<int>(),.bit_depth = frame.bit_depth(),.subsampling = frame.subsampling(),- .cicp = frame.cicp(),+ .color_metadata = frame.color_metadata(),};}@@ -79,7 +79,7 @@ ErrorOr<void> encode(Encoder& encoder, Media::VideoFrameMetadata const& metadataTRY(encoder.encode(metadata.bit_depth));TRY(encoder.encode(metadata.subsampling.x()));TRY(encoder.encode(metadata.subsampling.y()));- TRY(encoder.encode(metadata.cicp));+ TRY(encoder.encode(metadata.color_metadata));return {};}@@ -95,7 +95,7 @@ ErrorOr<Media::VideoFrameMetadata> decode(Decoder& decoder)TRY(decoder.decode<bool>()),TRY(decoder.decode<bool>()),};- metadata.cicp = TRY(decoder.decode<Media::CodingIndependentCodePoints>());+ metadata.color_metadata = TRY(decoder.decode<Media::ColorMetadata>());if (!metadata.is_valid())return Error::from_string_literal("Video frame metadata describes a frame that could not have been decoded");return metadata;diff --git a/Libraries/LibMediaCodecs/VideoFrameMetadata.h b/Libraries/LibMediaCodecs/VideoFrameMetadata.hindex dca44b52de3..146ad9ff144 100644--- a/Libraries/LibMediaCodecs/VideoFrameMetadata.h+++ b/Libraries/LibMediaCodecs/VideoFrameMetadata.h@@ -9,7 +9,7 @@#include <AK/Time.h>#include <LibGfx/Size.h>#include <LibIPC/Forward.h>-#include <LibMediaCodecs/Color/CodingIndependentCodePoints.h>+#include <LibMediaCodecs/Color/ColorMetadata.h>#include <LibMediaCodecs/Export.h>#include <LibMediaCodecs/Forward.h>#include <LibMediaCodecs/Subsampling.h>@@ -27,7 +27,7 @@ struct MEDIACODECS_API VideoFrameMetadata {Gfx::IntSize size;u8 bit_depth { 0 };Subsampling subsampling;- CodingIndependentCodePoints cicp;+ ColorMetadata color_metadata;};// How a frame's planes lay out within a pool slot's bytes, aligned for cache- anddiff --git a/Libraries/LibMediaCodecs/VideoFramePool.cpp b/Libraries/LibMediaCodecs/VideoFramePool.cppindex 26eff27c062..dfe8c55c279 100644--- a/Libraries/LibMediaCodecs/VideoFramePool.cpp+++ b/Libraries/LibMediaCodecs/VideoFramePool.cpp@@ -257,10 +257,10 @@ ErrorOr<NonnullRefPtr<VideoFrame>> create_received_video_frame(VideoFrameMetadatif (metadata.subsampling != Subsampling::yuv420() || metadata.size.width() > surface_size.width() || metadata.size.height() > surface_size.height())return Error::from_string_literal("Video frame metadata does not match its surface");} else {- TRY(yuv_data_in_buffer(storage->pixel_buffer(), metadata.size, metadata.bit_depth, metadata.subsampling, metadata.cicp));+ TRY(yuv_data_in_buffer(storage->pixel_buffer(), metadata.size, metadata.bit_depth, metadata.subsampling, metadata.color_metadata.cicp));}- return make_ref_counted<VideoFrame>(metadata.timestamp, metadata.duration, metadata.size.to_type<u32>(), metadata.bit_depth, metadata.subsampling, metadata.cicp, move(storage));+ return make_ref_counted<VideoFrame>(metadata.timestamp, metadata.duration, metadata.size.to_type<u32>(), metadata.bit_depth, metadata.subsampling, metadata.color_metadata, move(storage));}}diff --git a/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.h b/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.hindex 2a22fed9cc8..e5ad24f4c6e 100644--- a/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.h+++ b/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.h@@ -44,7 +44,7 @@ public:virtual DecoderErrorOr<void> receive_coded_data(CodedFrame const&, DecodeIntent) override;virtual void signal_end_of_stream() override;- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) override;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) override;virtual void flush() override;private:@@ -74,7 +74,7 @@ private:void insert_output_in_presentation_order_while_locked(DecodedOutput&&);bool may_pull_frame_from_reorder_queue_while_locked() const;- DecoderErrorOr<NonnullRefPtr<VideoFrame>> adopt_output_while_locked(CodingIndependentCodePoints const& container_cicp, size_t index);+ DecoderErrorOr<NonnullRefPtr<VideoFrame>> adopt_output_while_locked(ColorMetadata const& container_color_metadata, size_t index);CodecID const m_codec_id;NonnullRefPtr<VideoSurfaceBudget> m_surface_budget { make_ref_counted<VideoSurfaceBudget>() };diff --git a/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.mm b/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.mmindex 2f81d334d0e..db5540dcead 100644--- a/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.mm+++ b/Libraries/LibMediaCodecs/VideoToolbox/VideoToolboxVideoDecoder.mm@@ -934,7 +934,7 @@ bool VideoToolboxVideoDecoder::may_pull_frame_from_reorder_queue_while_locked()return m_outputs.size() > frames_that_may_still_be_preceded;}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target){MutexLocker locker { m_output_mutex };while (true) {@@ -945,7 +945,7 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::take_next_ouauto const& output = m_outputs[index];if (*target < output.timestamp || *target >= output.timestamp + output.duration)continue;- auto frame = TRY(adopt_output_while_locked(container_cicp, index));+ auto frame = TRY(adopt_output_while_locked(container_color_metadata, index));// Everything the covering frame was queued behind precedes the target.m_outputs.remove(0, index + 1);return frame;@@ -967,12 +967,12 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::take_next_oum_caller_is_waiting_for_output = false;}- auto frame = TRY(adopt_output_while_locked(container_cicp, 0));+ auto frame = TRY(adopt_output_while_locked(container_color_metadata, 0));m_outputs.remove(0);return frame;}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::adopt_output_while_locked(CodingIndependentCodePoints const& container_cicp, size_t index)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::adopt_output_while_locked(ColorMetadata const& container_color_metadata, size_t index){auto const& output = m_outputs[index];@@ -980,12 +980,12 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> VideoToolboxVideoDecoder::adopt_outputif (!storage)return DecoderError::with_description(DecoderErrorCategory::TryAgain, "Every video surface the decoder may hand out is held elsewhere"sv);- auto cicp = container_cicp;- cicp.adopt_specified_values(output.cicp);+ auto color_metadata = container_color_metadata;+ color_metadata.cicp.adopt_specified_values(output.cicp);return DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(output.timestamp, output.duration, output.size.to_type<u32>(),- output.bit_depth, output.subsampling, cicp, storage.release_nonnull()));+ output.bit_depth, output.subsampling, move(color_metadata), storage.release_nonnull()));}void VideoToolboxVideoDecoder::flush()diff --git a/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.cpp b/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.cppindex 9afa3dabfb9..80ae211e973 100644--- a/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.cpp+++ b/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.cpp@@ -598,20 +598,20 @@ void WindowsMediaFoundationVideoDecoder::retire_submitted_frames_through(Optionam_submitted_frames.remove(0, *index + 1);}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> WindowsMediaFoundationVideoDecoder::take_next_output(CodingIndependentCodePoints const& container_cicp, [[maybe_unused]] Optional<AK::Duration> target)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> WindowsMediaFoundationVideoDecoder::take_next_output(ColorMetadata const& container_color_metadata, [[maybe_unused]] Optional<AK::Duration> target){TRY(collect_available_outputs());auto output = TRY(m_thread_data->take_completed_output(m_draining));// Only this thread takes outputs or flushes, so a frame that cannot go out yet can go back to the front.- auto frame = copy_output_into_frame_pool(output, container_cicp);+ auto frame = copy_output_into_frame_pool(output, container_color_metadata);if (frame.is_error())m_thread_data->return_to_front(move(output));return frame;}-DecoderErrorOr<NonnullRefPtr<VideoFrame>> WindowsMediaFoundationVideoDecoder::copy_output_into_frame_pool(DecodedOutput const& output, CodingIndependentCodePoints const& container_cicp)+DecoderErrorOr<NonnullRefPtr<VideoFrame>> WindowsMediaFoundationVideoDecoder::copy_output_into_frame_pool(DecodedOutput const& output, ColorMetadata const& container_color_metadata){auto const& format = output.format;auto subsampling = Subsampling::yuv420();@@ -702,7 +702,7 @@ DecoderErrorOr<NonnullRefPtr<VideoFrame>> WindowsMediaFoundationVideoDecoder::co}}- return DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(output.timestamp, output.duration, format.aperture_size, format.bit_depth, subsampling, container_cicp, acquired_slot->storage));+ return DECODER_TRY_ALLOC(try_make_ref_counted<VideoFrame>(output.timestamp, output.duration, format.aperture_size, format.bit_depth, subsampling, container_color_metadata, acquired_slot->storage));}void WindowsMediaFoundationVideoDecoder::flush()diff --git a/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.h b/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.hindex 2d7920d272a..3a3a7228ce3 100644--- a/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.h+++ b/Libraries/LibMediaCodecs/WindowsMediaFoundation/WindowsMediaFoundationVideoDecoder.h@@ -38,7 +38,7 @@ public:virtual DecoderErrorOr<void> receive_coded_data(CodedFrame const&, DecodeIntent) override;virtual void signal_end_of_stream() override;- virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration> target = {}) override;+ virtual DecoderErrorOr<NonnullRefPtr<VideoFrame>> take_next_output(ColorMetadata const& container_color_metadata, Optional<AK::Duration> target = {}) override;virtual void flush() override;private:@@ -65,7 +65,7 @@ private:Optional<size_t> index_of_submitted_frame(i64 sample_time) const;void retire_submitted_frames_through(Optional<size_t> index);- DecoderErrorOr<NonnullRefPtr<VideoFrame>> copy_output_into_frame_pool(DecodedOutput const&, CodingIndependentCodePoints const& container_cicp);+ DecoderErrorOr<NonnullRefPtr<VideoFrame>> copy_output_into_frame_pool(DecodedOutput const&, ColorMetadata const& container_color_metadata);CodecID const m_codec_id;NonnullOwnPtr<Transform> m_transform;diff --git a/Tests/Compositor/TestVideoFrameHolds.cpp b/Tests/Compositor/TestVideoFrameHolds.cppindex a02fa985694..214e7b0aa13 100644--- a/Tests/Compositor/TestVideoFrameHolds.cpp+++ b/Tests/Compositor/TestVideoFrameHolds.cpp@@ -18,7 +18,7 @@ static NonnullRefPtr<Media::VideoFrame> create_pooled_frame(Media::VideoFramePooauto subsampling = Media::Subsampling::yuv420();auto layout = MUST(Media::frame_plane_layout(frame_size, 8, subsampling));auto acquired = pool.try_acquire(layout.total_byte_count).release_value();- return make_ref_counted<Media::VideoFrame>(AK::Duration::zero(), AK::Duration::from_milliseconds(33), Gfx::Size<u32>(frame_size), 8, subsampling, Media::CodingIndependentCodePoints {}, move(acquired.storage));+ return make_ref_counted<Media::VideoFrame>(AK::Duration::zero(), AK::Duration::from_milliseconds(33), Gfx::Size<u32>(frame_size), 8, subsampling, Media::ColorMetadata {}, move(acquired.storage));}// Every frame kept for a hold keeps its buffer open in the Compositor, so a WebContent holding one frame after anotherdiff --git a/Tests/LibMedia/TestDisplayingVideoSink.cpp b/Tests/LibMedia/TestDisplayingVideoSink.cppindex 68d4308b03f..a4543014c6b 100644--- a/Tests/LibMedia/TestDisplayingVideoSink.cpp+++ b/Tests/LibMedia/TestDisplayingVideoSink.cpp@@ -26,7 +26,7 @@ NonnullRefPtr<Media::VideoFrame> create_test_frame(Media::VideoFramePool& pool,auto plane_sizes = MUST(Gfx::YUVData::plane_sizes(frame_size, bit_depth, subsampling));auto acquired = pool.try_acquire(plane_sizes.total).release_value();- return make_ref_counted<Media::VideoFrame>(timestamp, duration, Gfx::Size<u32>(frame_size), bit_depth, subsampling, Media::CodingIndependentCodePoints {}, move(acquired.storage));+ return make_ref_counted<Media::VideoFrame>(timestamp, duration, Gfx::Size<u32>(frame_size), bit_depth, subsampling, Media::ColorMetadata {}, move(acquired.storage));}}diff --git a/Tests/LibMedia/TestFFmpegVulkanDecode.cpp b/Tests/LibMedia/TestFFmpegVulkanDecode.cppindex 3d2e67230db..2ec440f730c 100644--- a/Tests/LibMedia/TestFFmpegVulkanDecode.cpp+++ b/Tests/LibMedia/TestFFmpegVulkanDecode.cpp@@ -70,7 +70,7 @@ struct Decoding {Media::DecoderErrorOr<NonnullRefPtr<Media::VideoFrame>> next_frame() const{while (true) {- auto frame_result = decoder->take_next_output(track.video_data().cicp);+ auto frame_result = decoder->take_next_output(track.video_data().color_metadata);if (!frame_result.is_error() || frame_result.error().category() != Media::DecoderErrorCategory::NeedsMoreInput)return frame_result;diff --git a/Tests/LibMedia/TestH264Decode.cpp b/Tests/LibMedia/TestH264Decode.cppindex a2582014d96..387be1ec486 100644--- a/Tests/LibMedia/TestH264Decode.cpp+++ b/Tests/LibMedia/TestH264Decode.cpp@@ -69,7 +69,7 @@ TEST_CASE(h264_configuration_change)MUST(decoder->receive_coded_data(sample, Media::DecodeIntent::Output));while (true) {- auto decoded_frame_result = decoder->take_next_output(new_track.video_data().cicp);+ auto decoded_frame_result = decoder->take_next_output(new_track.video_data().color_metadata);if (decoded_frame_result.is_error()) {EXPECT_EQ(decoded_frame_result.error().category(), Media::DecoderErrorCategory::NeedsMoreInput);break;@@ -102,7 +102,7 @@ TEST_CASE(avc_in_mp4_with_reordered_frames)auto last_timestamp = AK::Duration::min();auto take_decoded_frame = [&]() -> Media::DecoderErrorOr<void> {- auto decoded_frame = TRY(decoder->take_next_output(track.video_data().cicp));+ auto decoded_frame = TRY(decoder->take_next_output(track.video_data().color_metadata));EXPECT(last_timestamp <= decoded_frame->timestamp());EXPECT(!decoded_frame->duration().is_zero());@@ -157,7 +157,7 @@ TEST_CASE(h264_reference_only_frames_are_decoded_but_not_produced)Vector<AK::Duration> presented_timestamps;auto drain = [&] {while (true) {- auto decoded_frame_result = decoder->take_next_output(track.video_data().cicp);+ auto decoded_frame_result = decoder->take_next_output(track.video_data().color_metadata);if (decoded_frame_result.is_error())return;presented_timestamps.append(decoded_frame_result.value()->timestamp());diff --git a/Tests/LibMedia/TestParseMatroska.cpp b/Tests/LibMedia/TestParseMatroska.cppindex b5190d27436..0404f9f0d69 100644--- a/Tests/LibMedia/TestParseMatroska.cpp+++ b/Tests/LibMedia/TestParseMatroska.cpp@@ -1236,8 +1236,8 @@ TEST_CASE(track_entry_parses_its_codec_private_configuration_record)EXPECT_EQ(track_entry->parsed_codec()->av1_parameters()->level, 8);auto track = Media::Matroska::track_from_track_entry(*track_entry, true);- EXPECT_EQ(track.video_data().cicp.color_primaries(), Media::ColorPrimaries::BT2020);- EXPECT_EQ(track.video_data().cicp.transfer_characteristics(), Media::TransferCharacteristics::SMPTE2084);+ EXPECT_EQ(track.video_data().color_metadata.cicp.color_primaries(), Media::ColorPrimaries::BT2020);+ EXPECT_EQ(track.video_data().color_metadata.cicp.transfer_characteristics(), Media::TransferCharacteristics::SMPTE2084);}TEST_CASE(color_element_overrides_the_codec_private_configuration_record)@@ -1248,8 +1248,8 @@ TEST_CASE(color_element_overrides_the_codec_private_configuration_record)auto track_entry = MUST(reader.track_for_track_number(1));auto track = Media::Matroska::track_from_track_entry(*track_entry, true);- EXPECT_EQ(track.video_data().cicp.color_primaries(), Media::ColorPrimaries::BT709);- EXPECT_EQ(track.video_data().cicp.transfer_characteristics(), Media::TransferCharacteristics::BT709);+ EXPECT_EQ(track.video_data().color_metadata.cicp.color_primaries(), Media::ColorPrimaries::BT709);+ EXPECT_EQ(track.video_data().color_metadata.cicp.transfer_characteristics(), Media::TransferCharacteristics::BT709);}TEST_CASE(simple_block_extending_past_the_representable_size_is_corrupted)diff --git a/Tests/LibMedia/TestRemoteVideoNode.cpp b/Tests/LibMedia/TestRemoteVideoNode.cppindex 7c27efd2a75..8752dcf220b 100644--- a/Tests/LibMedia/TestRemoteVideoNode.cpp+++ b/Tests/LibMedia/TestRemoteVideoNode.cpp@@ -205,7 +205,7 @@ NonnullRefPtr<VideoFrame> create_pooled_frame(VideoFramePool& pool, AK::Durationauto layout = MUST(frame_plane_layout(frame_size, bit_depth, subsampling));auto acquired = pool.try_acquire(layout.total_byte_count).release_value();- return make_ref_counted<VideoFrame>(timestamp, duration, Gfx::Size<u32>(frame_size), bit_depth, subsampling, CodingIndependentCodePoints {}, move(acquired.storage));+ return make_ref_counted<VideoFrame>(timestamp, duration, Gfx::Size<u32>(frame_size), bit_depth, subsampling, ColorMetadata {}, move(acquired.storage));}// A frame as the consumer receives it, which counts its release.diff --git a/Tests/LibMedia/TestSystemFFmpeg.cpp b/Tests/LibMedia/TestSystemFFmpeg.cppindex f25e791e46f..40785c17305 100644--- a/Tests/LibMedia/TestSystemFFmpeg.cpp+++ b/Tests/LibMedia/TestSystemFFmpeg.cpp@@ -51,7 +51,7 @@ static size_t decode_every_frame(Media::FFmpeg::SystemFFmpeg const& library, Strsize_t frame_count = 0;auto drain = [&] {while (true) {- auto frame = decoder->take_next_output(track.video_data().cicp);+ auto frame = decoder->take_next_output(track.video_data().color_metadata);if (frame.is_error())return frame.release_error();frame_count++;diff --git a/Tests/LibMedia/TestVideoFramePool.cpp b/Tests/LibMedia/TestVideoFramePool.cppindex f5fa8b9256d..64a4d5a5812 100644--- a/Tests/LibMedia/TestVideoFramePool.cpp+++ b/Tests/LibMedia/TestVideoFramePool.cpp@@ -55,11 +55,13 @@ static Media::VideoFrameMetadata make_metadata().size = RESOLVED_FRAME_SIZE,.bit_depth = RESOLVED_FRAME_BIT_DEPTH,.subsampling = RESOLVED_FRAME_SUBSAMPLING,- .cicp = {- Media::ColorPrimaries::BT709,- Media::TransferCharacteristics::BT709,- Media::MatrixCoefficients::BT709,- Media::VideoFullRangeFlag::Full,+ .color_metadata = {+ .cicp = {+ Media::ColorPrimaries::BT709,+ Media::TransferCharacteristics::BT709,+ Media::MatrixCoefficients::BT709,+ Media::VideoFullRangeFlag::Full,+ },},};}@@ -375,7 +377,7 @@ TEST_CASE(received_frames_must_be_ones_a_decoder_could_produce)EXPECT(receive(negative_duration).is_error());auto unknown_primaries = make_metadata();- unknown_primaries.cicp.set_color_primaries(static_cast<Media::ColorPrimaries>(200));+ unknown_primaries.color_metadata.cicp.set_color_primaries(static_cast<Media::ColorPrimaries>(200));EXPECT(receive(unknown_primaries).is_error());auto too_wide = make_metadata();diff --git a/Tests/LibMedia/TestVideoToolboxDecode.cpp b/Tests/LibMedia/TestVideoToolboxDecode.cppindex 8ace16aec49..ba86b82d7a2 100644--- a/Tests/LibMedia/TestVideoToolboxDecode.cpp+++ b/Tests/LibMedia/TestVideoToolboxDecode.cpp@@ -26,7 +26,7 @@ struct Decoding {Media::DecoderErrorOr<NonnullRefPtr<Media::VideoFrame>> next_frame() const{while (true) {- auto frame_result = decoder->take_next_output(track.video_data().cicp);+ auto frame_result = decoder->take_next_output(track.video_data().color_metadata);if (!frame_result.is_error() || frame_result.error().category() != Media::DecoderErrorCategory::NeedsMoreInput)return frame_result;diff --git a/Tests/LibMedia/TestWindowsMediaFoundationDecode.cpp b/Tests/LibMedia/TestWindowsMediaFoundationDecode.cppindex 7e893961a9a..14faddc83a4 100644--- a/Tests/LibMedia/TestWindowsMediaFoundationDecode.cpp+++ b/Tests/LibMedia/TestWindowsMediaFoundationDecode.cpp@@ -57,7 +57,7 @@ DecodeResult decode_all_frames(StringView path, Function<void(Media::VideoFrameauto last_timestamp = AK::Duration::min();auto take_decoded_frames = [&](Media::DecoderErrorCategory expected_end) {while (true) {- auto frame_result = decoder->take_next_output(track.video_data().cicp);+ auto frame_result = decoder->take_next_output(track.video_data().color_metadata);if (frame_result.is_error()) {EXPECT_EQ(frame_result.error().category(), expected_end);return;@@ -156,7 +156,7 @@ TEST_CASE(h264_reference_only_frames_are_decoded_but_not_produced)Vector<AK::Duration> presented_timestamps;auto drain = [&] {while (true) {- auto decoded_frame_result = decoder->take_next_output(track.video_data().cicp);+ auto decoded_frame_result = decoder->take_next_output(track.video_data().color_metadata);if (decoded_frame_result.is_error())return;presented_timestamps.append(decoded_frame_result.value()->timestamp());@@ -198,7 +198,7 @@ TEST_CASE(flush_restarts_decoding_from_a_keyframe)MUST(decoder->receive_coded_data(first_sample, Media::DecodeIntent::Output));decoder->signal_end_of_stream();- auto frame = MUST(decoder->take_next_output(track.video_data().cicp));+ auto frame = MUST(decoder->take_next_output(track.video_data().color_metadata));EXPECT_EQ(frame->timestamp(), first_sample.presentation_timestamp());- EXPECT_EQ(decoder->take_next_output(track.video_data().cicp).error().category(), Media::DecoderErrorCategory::EndOfStream);+ EXPECT_EQ(decoder->take_next_output(track.video_data().color_metadata).error().category(), Media::DecoderErrorCategory::EndOfStream);}diff --git a/Tests/LibMedia/WithholdingVideoDecoder.h b/Tests/LibMedia/WithholdingVideoDecoder.hindex e759d4511de..60dd6711e67 100644--- a/Tests/LibMedia/WithholdingVideoDecoder.h+++ b/Tests/LibMedia/WithholdingVideoDecoder.h@@ -169,7 +169,7 @@ public:virtual void signal_end_of_stream() override { m_reached_end_of_stream = true; }- virtual Media::DecoderErrorOr<NonnullRefPtr<Media::VideoFrame>> take_next_output(Media::CodingIndependentCodePoints const& container_cicp, Optional<AK::Duration>) override+ virtual Media::DecoderErrorOr<NonnullRefPtr<Media::VideoFrame>> take_next_output(Media::ColorMetadata const& container_color_metadata, Optional<AK::Duration>) override{MutexLocker locker { m_withheld_outputs->m_mutex };// Draining waits for the withheld outputs, as a decoder waits for its device to finish them, and so does@@ -209,7 +209,7 @@ public:auto output = m_withheld_outputs->m_released.take_first();m_withheld_outputs->m_handed_out_count++;- return make_ref_counted<Media::VideoFrame>(output.timestamp, output.duration, FRAME_SIZE, 8, Media::Subsampling::yuv420(), container_cicp, move(acquired_slot->storage));+ return make_ref_counted<Media::VideoFrame>(output.timestamp, output.duration, FRAME_SIZE, 8, Media::Subsampling::yuv420(), container_color_metadata, move(acquired_slot->storage));}virtual void flush() override