|
922 | 922 | 5. If {{VideoDecoderConfig/colorSpace}} [=map/exists=] in the
|
923 | 923 | {{VideoDecoder/[[active decoder config]]}}, assign its value to
|
924 | 924 | |colorSpace|.
|
925 |
| - 6. Let |frame| be the result of running the [=Create a VideoFrame=] |
| 925 | + 6. Assign the values of {{VideoDecoderConfig/rotation}} and |
| 926 | + {{VideoDecoderConfig/flip}} to |rotation| and |flip| respectively. |
| 927 | + 7. Let |frame| be the result of running the [=Create a VideoFrame=] |
926 | 928 | algorithm with |output|, |timestamp|, |duration|,
|
927 |
| - |displayAspectWidth|, |displayAspectHeight|, and |colorSpace|. |
928 |
| - 7. Invoke {{VideoDecoder/[[output callback]]}} with |frame|. |
| 929 | + |displayAspectWidth|, |displayAspectHeight|, |colorSpace|, |
| 930 | + |rotation|, and |flip|. |
| 931 | + 8. Invoke {{VideoDecoder/[[output callback]]}} with |frame|. |
929 | 932 | </dd>
|
930 | 933 | <dt><dfn>Reset VideoDecoder</dfn> (with |exception|)</dt>
|
931 | 934 | <dd>
|
|
1970 | 1973 | VideoColorSpaceInit colorSpace;
|
1971 | 1974 | HardwareAcceleration hardwareAcceleration = "no-preference";
|
1972 | 1975 | boolean optimizeForLatency;
|
| 1976 | + double rotation = 0; |
| 1977 | + boolean flip = false; |
1973 | 1978 | };
|
1974 | 1979 | </xmp>
|
1975 | 1980 |
|
|
2059 | 2064 | bitstreams require a minimum number of inputs before any output can be
|
2060 | 2065 | produced.
|
2061 | 2066 | </dd>
|
| 2067 | + <dt><dfn dict-member for=VideoDecoderConfig>rotation</dfn></dt> |
| 2068 | + <dd> |
| 2069 | + Sets the {{VideoFrame/rotation}} attribute on decoded frames. |
| 2070 | + </dd> |
| 2071 | + <dt><dfn dict-member for=VideoDecoderConfig>flip</dfn></dt> |
| 2072 | + <dd> |
| 2073 | + Sets the {{VideoFrame/flip}} attribute on decoded frames. |
| 2074 | + </dd> |
2062 | 2075 | </dl>
|
2063 | 2076 |
|
2064 | 2077 |
|
|
3910 | 3923 | with {{VideoFrame/[[metadata]]}}.
|
3911 | 3924 |
|
3912 | 3925 | ### Algorithms ###{#videoframe-algorithms}
|
3913 |
| -: <dfn>Create a VideoFrame</dfn> (with |output|, |timestamp|, |duration|, |displayAspectWidth|, |displayAspectHeight|, and |colorSpace|) |
| 3926 | +: <dfn>Create a VideoFrame</dfn> (with |output|, |timestamp|, |duration|, |displayAspectWidth|, |displayAspectHeight|, |colorSpace|, |rotation|, and |flip|) |
3914 | 3927 | :: 1. Let |frame| be a new {{VideoFrame}}, constructed as follows:
|
3915 | 3928 | 1. Assign `false` to {{platform object/[[Detached]]}}.
|
3916 | 3929 | 2. Let |resource| be the [=media resource=] described by |output|.
|
|
3940 | 3953 | 11. Assign {{VideoFrame/[[color space]]}} with the result of running the
|
3941 | 3954 | [=VideoFrame/Pick Color Space=] algorithm, with |colorSpace| and
|
3942 | 3955 | {{VideoFrame/[[format]]}}.
|
| 3956 | + 12. Assign {{VideoFrame/rotation}} and {{VideoFrame/flip}} to |rotation| |
| 3957 | + and |flip| respectively. |
3943 | 3958 | 2. Return |frame|.
|
3944 | 3959 |
|
3945 | 3960 |
|
|
5742 | 5757 | 3. If a |timestamp| can otherwise be trivially generated from
|
5743 | 5758 | metadata without further decoding, assign that to |timestamp|.
|
5744 | 5759 | 4. Otherwise, assign `0` to |timestamp|.
|
5745 |
| - 4. Assign {{ImageDecodeResult/image}} with the result of running the |
5746 |
| - [=Create a VideoFrame=] algorithm with |output|, |timestamp|, and |
5747 |
| - |duration|. |
| 5760 | + 4. If {{ImageDecoder/[[encoded data]]}} contains orientation metadata |
| 5761 | + describe it as |rotation| and |flip|. |
| 5762 | + 5. Assign {{ImageDecodeResult/image}} with the result of running the |
| 5763 | + [=Create a VideoFrame=] algorithm with |output|, |timestamp|, |
| 5764 | + |duration|, |rotation|, and |flip|. |
5748 | 5765 | 12. Run the [=ImageDecoder/Resolve Decode=] algorithm with |promise| and
|
5749 | 5766 | |decodeResult|.
|
5750 | 5767 |
|
|
5808 | 5825 | 3. If a |timestamp| can otherwise be trivially generated from
|
5809 | 5826 | metadata without further decoding, assign that to |timestamp|.
|
5810 | 5827 | 4. Otherwise, assign `0` to |timestamp|.
|
5811 |
| - 17. Assign {{ImageDecodeResult/image}} with the result of running the |
5812 |
| - [=Create a VideoFrame=] algorithm with |output|, |timestamp|, and |
5813 |
| - |duration|. |
5814 |
| - 18. Remove |promise| from {{ImageDecoder/[[pending decode promises]]}}. |
5815 |
| - 19. Resolve |promise| with |decodeResult|. |
| 5828 | + 17. If {{ImageDecoder/[[encoded data]]}} contains orientation metadata |
| 5829 | + describe it as |rotation| and |flip|. |
| 5830 | + 18. Assign {{ImageDecodeResult/image}} with the result of running the |
| 5831 | + [=Create a VideoFrame=] algorithm with |output|, |timestamp|, |
| 5832 | + |duration|, |rotation|, and |flip|. |
| 5833 | + 19. Remove |promise| from {{ImageDecoder/[[pending decode promises]]}}. |
| 5834 | + 20. Resolve |promise| with |decodeResult|. |
5816 | 5835 |
|
5817 | 5836 | : <dfn for=ImageDecoder>Resolve Decode</dfn> (with |promise| and |result|)
|
5818 | 5837 | :: 1. [=Queue a task=] to perform these steps:
|
|
0 commit comments