Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WebCodecs VideoFrame as CanvasImageSource. #6589

Merged
merged 8 commits into from
Jul 29, 2021
42 changes: 40 additions & 2 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -4115,6 +4115,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ul>
</dd>

<dt>WebCodecs</dt>

<dd>
<p>The following features are defined in <cite>WebCodecs</cite>: <ref spec=WEBCODECS></p>

<ul class="brief">
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#videoframe-interface"><code>VideoFrame</code></dfn> interface.</li>
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#dom-videoframe-display-width-slot">[[display width]]</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#dom-videoframe-display-height-slot">[[display height]]</dfn></li>
</ul>
</dd>

<dt>WebDriver BiDi</dt>

<dd>
Expand Down Expand Up @@ -60822,7 +60834,8 @@ typedef (<span>HTMLOrSVGImageElement</span> or
<span>HTMLVideoElement</span> or
<span>HTMLCanvasElement</span> or
<span>ImageBitmap</span> or
<span>OffscreenCanvas</span>) <dfn typedef>CanvasImageSource</dfn>;
<span>OffscreenCanvas</span> or
<span>VideoFrame</span>) <dfn>CanvasImageSource</dfn>;

enum <dfn enum>PredefinedColorSpace</dfn> { "<span data-x="dom-PredefinedColorSpace-srgb">srgb</span>", "<span data-x="dom-PredefinedColorSpace-display-p3">display-p3</span>" };

Expand Down Expand Up @@ -63796,7 +63809,6 @@ try {
sources:</p>

<ul>

<li><code>HTMLOrSVGImageElement</code> (<code>img</code> or <span>SVG <code>image</code></span>
elements)</li>

Expand All @@ -63806,6 +63818,7 @@ try {

<li><code>ImageBitmap</code></li>

<li><code>VideoFrame</code></li>
</ul>

<p class="note">Although not formally specified as such, <span>SVG <code>image</code></span>
Expand Down Expand Up @@ -63850,6 +63863,7 @@ try {
<code>DOMException</code>.</p></dd>

<dt><code>ImageBitmap</code></dt>
<dt><code>VideoFrame</code></dt>
<dd><p>If <var>image</var>'s <span>[[Detached]]</span> internal slot value
is set to true, then throw an <span>"<code>InvalidStateError</code>"</span>
<code>DOMException</code>.</p></dd>
Expand Down Expand Up @@ -63891,6 +63905,10 @@ try {
<p>When a <code>CanvasImageSource</code> object represents an <code>ImageBitmap</code>, the
object's bitmap image data must be used as the source image.</p>

<p>When a <code>CanvasImageSource</code> object represents a <code>VideoFrame</code>, the object's
pixel data must be used as the source image, and the source image's dimensions must be the
object's <span>[[display width]]</span> and <span>[[display height]]</span>.</p>

<p>An object <var>image</var> <dfn id=the-image-argument-is-not-origin-clean>is not
origin-clean</dfn> if, switching on <var>image</var>'s type:</p>

Expand Down Expand Up @@ -97597,6 +97615,23 @@ dictionary <dfn dictionary>ImageBitmapOptions</dfn> {
</li>
</ol>
</dd>

<dt><code>VideoFrame</code>
<dd>
<ol>
<li><p>Set <var>imageBitmap</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap
data</span> to a copy of <var>image</var>'s visible pixel data, <span>cropped to the source
rectangle with formatting</span>.</p></li>

<li>
<p>Run this step <span>in parallel</span>:</p>

<ol>
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
</ol>
</li>
</ol>
</dd>
</dl>
</li>

Expand Down Expand Up @@ -125678,6 +125713,9 @@ INSERT INTERFACES HERE
<dt id="refsWEBAUDIO">[WEBAUDIO]</dt>
<dd>(Non-normative) <cite><a href="https://webaudio.github.io/web-audio-api/">Web Audio API</a></cite>, P. Adenot, H. Choi. W3C.</dd>

<dt id="refsWEBCODECS">[WEBCODECS]</dt>
<dd><cite><a href="https://w3c.github.io/webcodecs/">WebCodecs API</a></cite>, C. Cunningham, P. Adenot, B. Aboba. W3C.</dd>

<dt id="refsWEBCRYPTO">[WEBCRYPTO]</dt>
<dd>(Non-normative) <cite><a href="https://w3c.github.io/webcrypto/Overview.html">Web Cryptography API</a></cite>, M. Watson. W3C.</dd>

Expand Down