Skip to content

Commit 4d6064c

Browse files
committed
Add WebCodecs VideoFrame as CanvasImageSource.
Adding VideoFrame as a CanvasImageSource allows drawImage(), createImageBitmap(), and texImage() to interoperate with VideoFrames. VideoFrames are effectively the same as the existing point-in-time capture done for HTMLVideoElement on each of these interfaces. This adds a non-normative reference on the WebCodecs spec for the VideoFrame interface and associated properties to accomplish this. Bug: w3c/webcodecs#158
1 parent 24a6d00 commit 4d6064c

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

source

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4040,6 +4040,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
40404040
<li><dfn data-x-href="https://w3c.github.io/manifest/#dfn-processing-a-manifest">process the manifest</dfn></li>
40414041
</ul>
40424042
</dd>
4043+
4044+
<dt>WebCodecs</dt>
4045+
4046+
<dd>
4047+
<p>The following features are defined in <cite>WebCodecs</cite>: <ref spec=WEBCODECS></p>
4048+
4049+
<ul class="brief">
4050+
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#videoframe-interface"><code>VideoFrame</code></dfn> interface.</li>
4051+
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#dom-videoframe-displaywidth">displayWidth</dfn></li>
4052+
<li><dfn data-x-href="https://w3c.github.io/webcodecs/#dom-videoframe-displayheight">displayHeight</dfn></li>
4053+
</ul>
4054+
</dd>
40434055
</dl>
40444056

40454057
<hr>
@@ -60202,7 +60214,8 @@ typedef (<span>HTMLOrSVGImageElement</span> or
6020260214
<span>HTMLVideoElement</span> or
6020360215
<span>HTMLCanvasElement</span> or
6020460216
<span>ImageBitmap</span> or
60205-
<span>OffscreenCanvas</span>) <dfn>CanvasImageSource</dfn>;
60217+
<span>OffscreenCanvas</span> or
60218+
<span>VideoFrame</span>) <dfn>CanvasImageSource</dfn>;
6020660219

6020760220
enum <dfn>CanvasFillRule</dfn> { "<span data-x="dom-context-2d-fillRule-nonzero">nonzero</span>", "<span data-x="dom-context-2d-fillRule-evenodd">evenodd</span>" };
6020860221

@@ -62684,6 +62697,8 @@ try {
6268462697

6268562698
<li><code>ImageBitmap</code></li>
6268662699

62700+
<li><code>VideoFrame</code></li>
62701+
6268762702
</ul>
6268862703

6268962704
<p class="note">Although not formally specified as such, <span>SVG <code>image</code></span>
@@ -62728,6 +62743,7 @@ try {
6272862743
<code>DOMException</code>.</p></dd>
6272962744

6273062745
<dt><code>ImageBitmap</code></dt>
62746+
<dt><code>VideoFrame</code></dt>
6273162747
<dd><p>If <var>image</var>'s <span>[[Detached]]</span> internal slot value
6273262748
is set to true, then throw an <span>"<code>InvalidStateError</code>"</span>
6273362749
<code>DOMException</code>.</p></dd>
@@ -62769,6 +62785,10 @@ try {
6276962785
<p>When a <code>CanvasImageSource</code> object represents an <code>ImageBitmap</code>, the
6277062786
object's bitmap image data must be used as the source image.</p>
6277162787

62788+
<p>When a <code>CanvasImageSource</code> object represents a <code>VideoFrame</code>, the
62789+
object's pixel data must be used as the source image, and the source image's dimensions must be the
62790+
<span>displayWidth</span> and <span>displayHeight</span> of the frame.</p>
62791+
6277262792
<p>An object <var>image</var> <dfn id=the-image-argument-is-not-origin-clean>is not
6277362793
origin-clean</dfn> if, switching on <var>image</var>:</p>
6277462794

@@ -95423,6 +95443,23 @@ dictionary <dfn>ImageBitmapOptions</dfn> {
9542395443
</li>
9542495444
</ol>
9542595445
</dd>
95446+
95447+
<dt><code>VideoFrame</code>
95448+
<dd>
95449+
<ol>
95450+
<li><p>Set <var>imageBitmap</var>'s <span data-x="concept-ImageBitmap-bitmap-data">bitmap
95451+
data</span> to a copy of <var>image</var>'s visible pixel data, <span>cropped to the source
95452+
rectangle with formatting</span>.</p></li>
95453+
95454+
<li>
95455+
<p>Run this step <span>in parallel</span>:</p>
95456+
95457+
<ol>
95458+
<li><p>Resolve <var>p</var> with <var>imageBitmap</var>.</p></li>
95459+
</ol>
95460+
</li>
95461+
</ol>
95462+
</dd>
9542695463
</dl>
9542795464
</li>
9542895465

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

123522+
<dt id="refsWEBCODECS">[WEBCODECS]</dt>
123523+
<dd>(Non-normative) <cite><a href="https://w3c.github.io/webcodecs/">WebCodecs API</a></cite>, C. Cunningham, P. Adenot, B. Aboba. W3C.</dd>
123524+
123485123525
<dt id="refsWEBCRYPTO">[WEBCRYPTO]</dt>
123486123526
<dd>(Non-normative) <cite><a href="https://w3c.github.io/webcrypto/Overview.html">Web Cryptography API</a></cite>, M. Watson. W3C.</dd>
123487123527

0 commit comments

Comments
 (0)