|
3277 | 3277 | [EnforceRange] unsigned long displayHeight;
|
3278 | 3278 |
|
3279 | 3279 | VideoColorSpaceInit colorSpace;
|
| 3280 | + |
| 3281 | + sequence<ArrayBuffer> transfer = []; |
3280 | 3282 | };
|
3281 | 3283 |
|
3282 | 3284 | dictionary VideoFrameMetadata {
|
|
3415 | 3417 | VideoFrame(data, init)
|
3416 | 3418 | </dfn>
|
3417 | 3419 | 1. If |init| is not a [=valid VideoFrameBufferInit=], throw a {{TypeError}}.
|
3418 |
| -2. Let |defaultRect| be «[ "x:" → `0`, "y" → `0`, |
| 3420 | +1. Let |defaultRect| be «[ "x:" → `0`, "y" → `0`, |
3419 | 3421 | "width" → |init|.{{VideoFrameBufferInit/codedWidth}}, "height" →
|
3420 | 3422 | |init|.{{VideoFrameBufferInit/codedWidth}} ]».
|
3421 |
| -3. Let |overrideRect| be `undefined`. |
3422 |
| -4. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=], assign its |
| 3423 | +1. Let |overrideRect| be `undefined`. |
| 3424 | +1. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=], assign its |
3423 | 3425 | value to |overrideRect|.
|
3424 |
| -4. Let |parsedRect| be the result of running the [=VideoFrame/Parse Visible |
| 3426 | +1. Let |parsedRect| be the result of running the [=VideoFrame/Parse Visible |
3425 | 3427 | Rect=] algorithm with |defaultRect|, |overrideRect|,
|
3426 | 3428 | |init|.{{VideoFrameBufferInit/codedWidth}},
|
3427 | 3429 | |init|.{{VideoFrameBufferInit/codedHeight}}, and
|
3428 | 3430 | |init|.{{VideoFrameBufferInit/format}}.
|
3429 |
| -5. If |parsedRect| is an exception, return |parsedRect|. |
3430 |
| -6. Let |optLayout| be `undefined`. |
3431 |
| -7. If |options|.{{VideoFrameBufferInit/layout}} [=map/exists=], assign its value |
| 3431 | +1. If |parsedRect| is an exception, return |parsedRect|. |
| 3432 | +1. Let |optLayout| be `undefined`. |
| 3433 | +1. If |options|.{{VideoFrameBufferInit/layout}} [=map/exists=], assign its value |
3432 | 3434 | to |optLayout|.
|
3433 |
| -8. Let |combinedLayout| be the result of running the [=VideoFrame/Compute |
| 3435 | +1. Let |combinedLayout| be the result of running the [=VideoFrame/Compute |
3434 | 3436 | Layout and Allocation Size=] algorithm with |parsedRect|,
|
3435 | 3437 | |init|.{{VideoFrameBufferInit/format}}, and |optLayout|.
|
3436 |
| -9. If |combinedLayout| is an exception, throw |combinedLayout|. |
3437 |
| -10. If `data.byteLength` is less than |combinedLayout|’s |
| 3438 | +1. If |combinedLayout| is an exception, throw |combinedLayout|. |
| 3439 | +1. If `data.byteLength` is less than |combinedLayout|’s |
3438 | 3440 | [=combined buffer layout/allocationSize=], throw a {{TypeError}}.
|
3439 |
| -11. Let |resource| be a new [=media resource=] containing a copy of |data|. Use |
3440 |
| - {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}} |
| 3441 | +1. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}: |
| 3442 | + 1. If {{platform object/[[Detached]]}} internal slot is `true`, |
| 3443 | + then throw a {{DataCloneError}} {{DOMException}}. |
| 3444 | +1. If |init|.{{VideoFrameBufferInit/transfer}} contains an ArrayBuffer referenced |
| 3445 | + by |data|: |
| 3446 | + 1. Let |resource| be a new [=media resource=] referencing pixels in |data| |
| 3447 | + without a copy. |
| 3448 | + Use {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}} |
| 3449 | + to determine where in |data| the pixels for each plane reside. |
| 3450 | +1. Otherwise: |
| 3451 | + 1. Let |resource| be a new [=media resource=] containing a copy of |data|. |
| 3452 | + Use {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}} |
3441 | 3453 | to determine where in |data| the pixels for each plane reside.
|
3442 | 3454 |
|
3443 | 3455 | The User Agent <em class="rfc2119">MAY</em> choose to allocate
|
|
3449 | 3461 | reposition the visible rectangle within |resource|. The final position
|
3450 | 3462 | will be reflected by {{VideoFrame/visibleRect}}.
|
3451 | 3463 |
|
3452 |
| -12. Let |resourceCodedWidth| be the coded width of |resource|. |
3453 |
| -13. Let |resourceCodedHeight| be the coded height of |resource|. |
3454 |
| -14. Let |resourceVisibleLeft| be the left offset for the visible rectangle of |
| 3464 | +1. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}: |
| 3465 | + 1. Perform [DetachArrayBuffer](https://tc39.es/ecma262/#sec-detacharraybuffer) |
| 3466 | + on |transferable| |
| 3467 | +1. Let |resourceCodedWidth| be the coded width of |resource|. |
| 3468 | +1. Let |resourceCodedHeight| be the coded height of |resource|. |
| 3469 | +1. Let |resourceVisibleLeft| be the left offset for the visible rectangle of |
3455 | 3470 | |resource|.
|
3456 |
| -15. Let |resourceVisibleTop| be the top offset for the visible rectangle of |
| 3471 | +1. Let |resourceVisibleTop| be the top offset for the visible rectangle of |
3457 | 3472 | |resource|.
|
3458 | 3473 |
|
3459 | 3474 | ISSUE: The spec <em class="rfc2119">SHOULD</em> provide definitions (and
|
3460 | 3475 | possibly diagrams) for coded size, visible rectangle, and display size.
|
3461 | 3476 | See [#166](https://github.com/w3c/webcodecs/issues/166).
|
3462 | 3477 |
|
3463 |
| -16. Let |frame| be a new {{VideoFrame}} object initialized as follows: |
| 3478 | +1. Let |frame| be a new {{VideoFrame}} object initialized as follows: |
3464 | 3479 | 1. Assign |resourceCodedWidth|, |resourceCodedHeight|,
|
3465 | 3480 | |resourceVisibleLeft|, and |resourceVisibleTop| to
|
3466 | 3481 | {{VideoFrame/[[coded width]]}}, {{VideoFrame/[[coded height]]}},
|
3467 | 3482 | {{VideoFrame/[[visible left]]}}, and {{VideoFrame/[[visible top]]}}
|
3468 | 3483 | respectively.
|
3469 |
| - 2. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=]: |
| 3484 | + 1. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=]: |
3470 | 3485 | 1. Let |truncatedVisibleWidth| be the value of
|
3471 | 3486 | {{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/width}} after
|
3472 | 3487 | truncating.
|
3473 | 3488 | 1. Assign |truncatedVisibleWidth| to {{VideoFrame/[[visible width]]}}.
|
3474 |
| - 3. Let |truncatedVisibleHeight| be the value of |
| 3489 | + 1. Let |truncatedVisibleHeight| be the value of |
3475 | 3490 | {{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/height}} after
|
3476 | 3491 | truncating.
|
3477 |
| - 2. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}. |
3478 |
| - 3. Otherwise: |
| 3492 | + 1. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}. |
| 3493 | + 1. Otherwise: |
3479 | 3494 | 1. Assign {{VideoFrame/[[coded width]]}} to
|
3480 | 3495 | {{VideoFrame/[[visible width]]}}.
|
3481 | 3496 | 2. Assign {{VideoFrame/[[coded height]]}} to
|
3482 | 3497 | {{VideoFrame/[[visible height]]}}.
|
3483 |
| - 4. If |init|.{{VideoFrameBufferInit/displayWidth}} [=map/exists=], assign |
| 3498 | + 1. If |init|.{{VideoFrameBufferInit/displayWidth}} [=map/exists=], assign |
3484 | 3499 | it to {{VideoFrame/[[display width]]}}. Otherwise, assign
|
3485 | 3500 | {{VideoFrame/[[visible width]]}} to {{VideoFrame/[[display width]]}}.
|
3486 |
| - 5. If |init|.{{VideoFrameBufferInit/displayHeight}} [=map/exists=], assign |
| 3501 | + 1. If |init|.{{VideoFrameBufferInit/displayHeight}} [=map/exists=], assign |
3487 | 3502 | it to {{VideoFrame/[[display height]]}}. Otherwise, assign
|
3488 | 3503 | {{VideoFrame/[[visible height]]}} to {{VideoFrame/[[display height]]}}.
|
3489 |
| - 6. Assign |init|'s {{VideoFrameBufferInit/timestamp}} and |
| 3504 | + 1. Assign |init|'s {{VideoFrameBufferInit/timestamp}} and |
3490 | 3505 | {{VideoFrameBufferInit/duration}} to {{VideoFrame/[[timestamp]]}} and
|
3491 | 3506 | {{VideoFrame/[[duration]]}} respectively.
|
3492 |
| - 7. Let |colorSpace| be `undefined`. |
3493 |
| - 8. If |init|.{{VideoFrameBufferInit/colorSpace}} [=map/exists=], assign its |
| 3507 | + 1. Let |colorSpace| be `undefined`. |
| 3508 | + 1. If |init|.{{VideoFrameBufferInit/colorSpace}} [=map/exists=], assign its |
3494 | 3509 | value to |colorSpace|.
|
3495 |
| - 9. Assign the result of running the [=VideoFrame/Pick Color Space=] |
| 3510 | + 1. Assign the result of running the [=VideoFrame/Pick Color Space=] |
3496 | 3511 | algorithm, with |colorSpace| and {{VideoFrame/[[format]]}}, to
|
3497 | 3512 | {{VideoFrame/[[color space]]}}.
|
3498 |
| - 10. Assign the result of calling [=Copy VideoFrame metadata=] |
| 3513 | + 1. Assign the result of calling [=Copy VideoFrame metadata=] |
3499 | 3514 | with |init|'s {{VideoFrameInit/metadata}} to |frame|.{{VideoFrame/[[metadata]]}}.
|
3500 |
| -17. Return |frame|. |
| 3515 | +1. Return |frame|. |
3501 | 3516 |
|
3502 | 3517 | ### Attributes ###{#videoframe-attributes}
|
3503 | 3518 | : <dfn attribute for=VideoFrame>format</dfn>
|
|
0 commit comments