|
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 {
|
|
3421 | 3423 | 3. Let |overrideRect| be `undefined`.
|
3422 | 3424 | 4. 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 | +5. 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 | +6. If |parsedRect| is an exception, return |parsedRect|. |
| 3432 | +7. Let |optLayout| be `undefined`. |
| 3433 | +8. 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 | +9. 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 | +10. If |combinedLayout| is an exception, throw |combinedLayout|. |
| 3439 | +11. 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 | +12. If |init|.{{VideoFrameBufferInit/transfer}} contains more than one reference |
| 3442 | + to the same {{ArrayBuffer}}, then throw a {{DataCloneError}} {{DOMException}}. |
| 3443 | +13. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}: |
| 3444 | + 1. If {{platform object/[[Detached]]}} internal slot is `true`, |
| 3445 | + then throw a {{DataCloneError}} {{DOMException}}. |
| 3446 | +14. If |init|.{{VideoFrameBufferInit/transfer}} contains an {{ArrayBuffer}} |
| 3447 | + referenced by |data| the User Agent <em class="rfc2119">MAY</em> choose to: |
| 3448 | + 1. Let |resource| be a new [=media resource=] referencing pixel data in |
| 3449 | + |data|. |
| 3450 | +15. 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 | +16. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}: |
| 3465 | + 1. Perform [DetachArrayBuffer](https://tc39.es/ecma262/#sec-detacharraybuffer) |
| 3466 | + on |transferable| |
| 3467 | +17. Let |resourceCodedWidth| be the coded width of |resource|. |
| 3468 | +18. Let |resourceCodedHeight| be the coded height of |resource|. |
| 3469 | +19. 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 | +20. 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 | +21. 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]]}},
|
|
3470 | 3485 | 1. Let |truncatedVisibleWidth| be the value of
|
3471 | 3486 | {{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/width}} after
|
3472 | 3487 | truncating.
|
3473 |
| - 1. Assign |truncatedVisibleWidth| to {{VideoFrame/[[visible width]]}}. |
| 3488 | + 2. Assign |truncatedVisibleWidth| to {{VideoFrame/[[visible width]]}}. |
3474 | 3489 | 3. Let |truncatedVisibleHeight| be the value of
|
3475 | 3490 | {{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/height}} after
|
3476 | 3491 | truncating.
|
3477 |
| - 2. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}. |
| 3492 | + 4. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}. |
3478 | 3493 | 3. Otherwise:
|
3479 | 3494 | 1. Assign {{VideoFrame/[[coded width]]}} to
|
3480 | 3495 | {{VideoFrame/[[visible width]]}}.
|
|
3497 | 3512 | {{VideoFrame/[[color space]]}}.
|
3498 | 3513 | 10. Assign the result of calling [=Copy VideoFrame metadata=]
|
3499 | 3514 | with |init|'s {{VideoFrameInit/metadata}} to |frame|.{{VideoFrame/[[metadata]]}}.
|
3500 |
| -17. Return |frame|. |
| 3515 | +22. Return |frame|. |
3501 | 3516 |
|
3502 | 3517 | ### Attributes ###{#videoframe-attributes}
|
3503 | 3518 | : <dfn attribute for=VideoFrame>format</dfn>
|
|
0 commit comments