From b8ca4808849d9996f40aeaafe6a8162df9c1f26b Mon Sep 17 00:00:00 2001 From: Eugene Zemtsov Date: Wed, 28 Feb 2024 21:18:31 -0800 Subject: [PATCH] Allow for color space conversion to p3 and sRGB for RGB frames as well --- index.src.html | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/index.src.html b/index.src.html index 6e12e717..7d2735b1 100644 --- a/index.src.html +++ b/index.src.html @@ -3763,9 +3763,8 @@ 5. If `destination.byteLength` is less than |combinedLayout|'s [=combined buffer layout/allocationSize=], return a promise rejected with a {{TypeError}}. - 6. If |options|.{{VideoFrameCopyToOptions/format}} does not equal - {{VideoFrame/[[format]]}} and |options|.{{VideoFrameCopyToOptions/format}} - is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} then: + 6. If |options|.{{VideoFrameCopyToOptions/format}} is equal to one of + {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} then: 1. Let |newOptions| be the result of running the Clone Configuration algorithm with |options|. 2. Assign `undefined` to |newOptions|.{{VideoFrameCopyToOptions/format}} @@ -3778,10 +3777,12 @@ algorithm with |options|.{{VideoFrameCopyToOptions/format}}, |rect|, and `options.colorSpace`. 7. Return the result of calling {{VideoFrame/copyTo()}} on |rgbFrame| with |destination| and |newOptions|. - 7. Let |p| be a new {{Promise}}. - 8. Let |copyStepsQueue| be the result of starting a new [=parallel queue=]. - 9. Let |planeLayouts| be a new [=list=]. - 10. Enqueue the following steps to |copyStepsQueue|: + 7. Otherwise, if |options|.{{VideoFrameCopyToOptions/format}} is not `undefined` or `null` + throw a {{NotSupportedError}} {{DOMException}}. + 8. Let |p| be a new {{Promise}}. + 9. Let |copyStepsQueue| be the result of starting a new [=parallel queue=]. + 10. Let |planeLayouts| be a new [=list=]. + 11. Enqueue the following steps to |copyStepsQueue|: 1. Let resource be the [=media resource=] referenced by [[resource reference]]. 2. Let |numPlanes| be the number of planes as defined by @@ -3818,7 +3819,7 @@ 10. Increment |planeIndex| by `1`. 11. Append |layout| to |planeLayouts|. 5. [=Queue a task=] to resolve |p| with |planeLayouts|. - 11. Return |p|. + 12. Return |p|. : clone() :: Creates a new {{VideoFrame}} with a reference to the same @@ -4324,9 +4325,9 @@ invalid to specify planes that overlap. : format :: A {{VideoPixelFormat}} for the pixel data in the destination - {{BufferSource}}. Potential values are: - {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} and values of {{VideoFrame/format}}. - If unspecified or `null`, the {{VideoFrame/format}} is used. + {{BufferSource}}. Potential values are: {{RGBA}}, {{RGBX}}, {{BGRA}}, + {{BGRX}}. If unspecified or `null`, the the destination + {{BufferSource}} will match {{VideoFrame/format}} . : colorSpace :: A {{PredefinedColorSpace}} that SHALL be used as a target color space for the pixel data in the destination