Skip to content

Commit e51d241

Browse files
committed
Introduce VideoFrame metadata
1 parent 938df12 commit e51d241

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

index.src.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@
9999

100100
spec: webrtc-svc; urlPrefix: https://w3c.github.io/webrtc-svc/
101101
type: dfn; text: scalability mode identifier; url:#scalabilitymodes*
102+
103+
spec: ECMASCRIPT; urlPrefix: https://tc39.es/ecma262/
104+
type: dfn; text: the current Realm; url: #current-realm
102105
</pre>
103106

104107
<pre class='biblio'>
@@ -3182,6 +3185,8 @@
31823185
readonly attribute long long? timestamp; // microseconds
31833186
readonly attribute VideoColorSpace colorSpace;
31843187

3188+
VideoFrameMetadata getMetadata();
3189+
31853190
unsigned long allocationSize(
31863191
optional VideoFrameCopyToOptions options = {});
31873192
Promise<sequence<PlaneLayout>> copyTo(
@@ -3204,6 +3209,8 @@
32043209
// Default matches image unless visibleRect is provided.
32053210
[EnforceRange] unsigned long displayWidth;
32063211
[EnforceRange] unsigned long displayHeight;
3212+
3213+
VideoFrameMetadata metadata;
32073214
};
32083215

32093216
dictionary VideoFrameBufferInit {
@@ -3225,6 +3232,9 @@
32253232

32263233
VideoColorSpaceInit colorSpace;
32273234
};
3235+
3236+
dictionary VideoFrameMetadata {
3237+
};
32283238
</xmp>
32293239

32303240
### Internal Slots ###{#videoframe-internal-slots}
@@ -3279,6 +3289,14 @@
32793289
: <dfn attribute for=VideoFrame>[[color space]]</dfn>
32803290
:: The {{VideoColorSpace}} associated with this frame.
32813291

3292+
: <dfn attribute for=VideoFrame>\[[metadata]]</dfn>
3293+
:: The {{VideoFrameMetadata}} associated with this frame.
3294+
<div class='note'>
3295+
{{VideoFrameMetadata}} is designed to be extended by other specifications.
3296+
Specifications that do extend {{VideoFrameMetadata}} need to make sure that
3297+
added properties are serializable.
3298+
</div>
3299+
32823300
### Constructors ###{#videoframe-constructors}
32833301

32843302
<dfn constructor for=VideoFrame title="VideoFrame(image, init)">
@@ -3426,6 +3444,8 @@
34263444
9. Assign the result of running the [=VideoFrame/Pick Color Space=]
34273445
algorithm, with |colorSpace| and {{VideoFrame/[[format]]}}, to
34283446
{{VideoFrame/[[color space]]}}.
3447+
10. Assign the result of calling [=Copy VideoFrame metadata=]
3448+
with |init|'s {{VideoFrameInit/metadata}} to {{VideoFrame/[[metadata]]}}.
34293449
17. Return |frame|.
34303450

34313451
### Attributes ###{#videoframe-attributes}
@@ -3624,6 +3644,12 @@
36243644

36253645
When invoked, run the [=Close VideoFrame=] algorithm with [=this=].
36263646

3647+
: <dfn method for=VideoFrame>getMetadata()</dfn>
3648+
:: Gets the {{VideoFrameMetadata}} associated with this frame.
3649+
3650+
When invoked, return the result of calling [=Copy VideoFrame metadata=]
3651+
with [=this=] {{VideoFrame/[[metadata]]}}.
3652+
36273653
### Algorithms ###{#videoframe-algorithms}
36283654
: <dfn>Create a VideoFrame</dfn> (with |output|, |timestamp|, |duration|, |displayAspectWidth|, |displayAspectHeight|, and |colorSpace|)
36293655
:: 1. Let |frame| be a new {{VideoFrame}}, constructed as follows:
@@ -3747,6 +3773,8 @@
37473773
|otherFrame|.{{VideoFrame/timestamp}} to
37483774
|frame|.{{VideoFrame/timestamp}}.
37493775
11. Assign |format| to |frame|.{{VideoFrame/[[format]]}}.
3776+
12. Assign the result of calling [=Copy VideoFrame metadata=]
3777+
with |init|'s {{VideoFrameInit/metadata}} to {{VideoFrame/metadata}}.
37503778

37513779
: <dfn for=VideoFrame>Initialize Frame With Resource and Size</dfn> (with
37523780
|init|, |frame|, |resource|, |width| and |height|)
@@ -3825,6 +3853,7 @@
38253853
and {{VideoFrame/[[display height]]}}.
38263854
5. Assign `null` to |frame|'s {{VideoFrame/[[duration]]}} and
38273855
{{VideoFrame/[[timestamp]]}}.
3856+
6. Assign a new {{VideoFrameMetadata}} to |frame|'s {{VideoFrame/[[metadata]]}}.
38283857

38293858
: <dfn for=VideoFrame>Parse VideoFrameCopyToOptions</dfn> (with |options|)
38303859
:: 1. Let |defaultRect| be the result of performing the getter steps for
@@ -3998,6 +4027,13 @@
39984027
[=combined buffer layout/allocationSize=].
39994028
9. Return |combinedLayout|.
40004029

4030+
: <dfn for=VideoFrame>Copy VideoFrame metadata</dfn> (with |metadata|)
4031+
:: 1. Let |metadataCopySerialized| be [$StructuredSerialize$](|metadata|).
4032+
2. Let |metadataCopy| be [$StructuredDeserialize$](|metadataCopySerialized|, [=the current Realm=]).
4033+
3. return |metadataCopy|.
4034+
4035+
The goal of this algorithm is to ensure that metadata owned by a {{VideoFrame}} is immutable.
4036+
40014037
### Transfer and Serialization ###{#videoframe-transfer-serialization}
40024038

40034039
: The {{VideoFrame}} [=transfer steps=] (with |value| and |dataHolder|) are:

0 commit comments

Comments
 (0)