Skip to content

Commit 532f30a

Browse files
authored
Add bindings for the WebRTC Encoded Transform API (#4125)
1 parent 1ebbfc0 commit 532f30a

24 files changed

+1956
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* Added experimental support for `Symbol.dispose` via `WASM_BINDGEN_EXPERIMENTAL_SYMBOL_DISPOSE`.
1818
[#4118](https://github.com/rustwasm/wasm-bindgen/pull/4118)
1919

20+
* Added bindings for the draft [WebRTC Encoded Transform](https://www.w3.org/TR/webrtc-encoded-transform) spec.
21+
[#4125](https://github.com/rustwasm/wasm-bindgen/pull/4125)
22+
2023
### Fixed
2124

2225
* Fixed linked modules emitting snippet files when not using `--split-linked-modules`.

crates/web-sys/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ IterationCompositeOperation = []
768768
JsonWebKey = []
769769
KeyAlgorithm = []
770770
KeyEvent = []
771+
KeyFrameRequestEvent = ["Event"]
771772
KeyIdsInitData = []
772773
KeyboardEvent = ["Event", "UiEvent"]
773774
KeyboardEventInit = []
@@ -1114,6 +1115,13 @@ RtcDataChannelInit = []
11141115
RtcDataChannelState = []
11151116
RtcDataChannelType = []
11161117
RtcDegradationPreference = []
1118+
RtcEncodedAudioFrame = []
1119+
RtcEncodedAudioFrameMetadata = []
1120+
RtcEncodedAudioFrameOptions = []
1121+
RtcEncodedVideoFrame = []
1122+
RtcEncodedVideoFrameMetadata = []
1123+
RtcEncodedVideoFrameOptions = []
1124+
RtcEncodedVideoFrameType = []
11171125
RtcFecParameters = []
11181126
RtcIceCandidate = []
11191127
RtcIceCandidateInit = []
@@ -1154,6 +1162,8 @@ RtcRtpHeaderExtensionCapability = []
11541162
RtcRtpHeaderExtensionParameters = []
11551163
RtcRtpParameters = []
11561164
RtcRtpReceiver = []
1165+
RtcRtpScriptTransform = []
1166+
RtcRtpScriptTransformer = ["EventTarget"]
11571167
RtcRtpSender = []
11581168
RtcRtpSourceEntry = []
11591169
RtcRtpSourceEntryType = []
@@ -1174,12 +1184,19 @@ RtcStatsReportInternal = []
11741184
RtcStatsType = []
11751185
RtcTrackEvent = ["Event"]
11761186
RtcTrackEventInit = []
1187+
RtcTransformEvent = ["Event"]
11771188
RtcTransportStats = []
11781189
RtcdtmfSender = ["EventTarget"]
11791190
RtcdtmfToneChangeEvent = ["Event"]
11801191
RtcdtmfToneChangeEventInit = []
11811192
RtcrtpContributingSourceStats = []
11821193
RtcrtpStreamStats = []
1194+
SFrameTransform = ["EventTarget"]
1195+
SFrameTransformErrorEvent = ["Event"]
1196+
SFrameTransformErrorEventInit = []
1197+
SFrameTransformErrorEventType = []
1198+
SFrameTransformOptions = []
1199+
SFrameTransformRole = []
11831200
SaveFilePickerOptions = []
11841201
Scheduler = []
11851202
SchedulerPostTaskOptions = []

crates/web-sys/src/features/gen_DedicatedWorkerGlobalScope.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,31 @@ extern "C" {
5050
this: &DedicatedWorkerGlobalScope,
5151
value: Option<&::js_sys::Function>,
5252
);
53+
#[cfg(web_sys_unstable_apis)]
54+
# [wasm_bindgen (structural , method , getter , js_class = "DedicatedWorkerGlobalScope" , js_name = onrtctransform)]
55+
#[doc = "Getter for the `onrtctransform` field of this object."]
56+
#[doc = ""]
57+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/onrtctransform)"]
58+
#[doc = ""]
59+
#[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"]
60+
#[doc = ""]
61+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
62+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
63+
pub fn onrtctransform(this: &DedicatedWorkerGlobalScope) -> Option<::js_sys::Function>;
64+
#[cfg(web_sys_unstable_apis)]
65+
# [wasm_bindgen (structural , method , setter , js_class = "DedicatedWorkerGlobalScope" , js_name = onrtctransform)]
66+
#[doc = "Setter for the `onrtctransform` field of this object."]
67+
#[doc = ""]
68+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/DedicatedWorkerGlobalScope/onrtctransform)"]
69+
#[doc = ""]
70+
#[doc = "*This API requires the following crate features to be activated: `DedicatedWorkerGlobalScope`*"]
71+
#[doc = ""]
72+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
73+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
74+
pub fn set_onrtctransform(
75+
this: &DedicatedWorkerGlobalScope,
76+
value: Option<&::js_sys::Function>,
77+
);
5378
# [wasm_bindgen (method , structural , js_class = "DedicatedWorkerGlobalScope" , js_name = close)]
5479
#[doc = "The `close()` method."]
5580
#[doc = ""]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#![allow(unused_imports)]
2+
#![allow(clippy::all)]
3+
use super::*;
4+
use wasm_bindgen::prelude::*;
5+
#[cfg(web_sys_unstable_apis)]
6+
#[wasm_bindgen]
7+
extern "C" {
8+
# [wasm_bindgen (extends = Event , extends = :: js_sys :: Object , js_name = KeyFrameRequestEvent , typescript_type = "KeyFrameRequestEvent")]
9+
#[derive(Debug, Clone, PartialEq, Eq)]
10+
#[doc = "The `KeyFrameRequestEvent` class."]
11+
#[doc = ""]
12+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent)"]
13+
#[doc = ""]
14+
#[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"]
15+
#[doc = ""]
16+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
17+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
18+
pub type KeyFrameRequestEvent;
19+
#[cfg(web_sys_unstable_apis)]
20+
# [wasm_bindgen (structural , method , getter , js_class = "KeyFrameRequestEvent" , js_name = rid)]
21+
#[doc = "Getter for the `rid` field of this object."]
22+
#[doc = ""]
23+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/rid)"]
24+
#[doc = ""]
25+
#[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"]
26+
#[doc = ""]
27+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
29+
pub fn rid(this: &KeyFrameRequestEvent) -> Option<String>;
30+
#[cfg(web_sys_unstable_apis)]
31+
#[wasm_bindgen(catch, constructor, js_class = "KeyFrameRequestEvent")]
32+
#[doc = "The `new KeyFrameRequestEvent(..)` constructor, creating a new instance of `KeyFrameRequestEvent`."]
33+
#[doc = ""]
34+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/KeyFrameRequestEvent)"]
35+
#[doc = ""]
36+
#[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"]
37+
#[doc = ""]
38+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40+
pub fn new(type_: &str) -> Result<KeyFrameRequestEvent, JsValue>;
41+
#[cfg(web_sys_unstable_apis)]
42+
#[wasm_bindgen(catch, constructor, js_class = "KeyFrameRequestEvent")]
43+
#[doc = "The `new KeyFrameRequestEvent(..)` constructor, creating a new instance of `KeyFrameRequestEvent`."]
44+
#[doc = ""]
45+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/KeyFrameRequestEvent/KeyFrameRequestEvent)"]
46+
#[doc = ""]
47+
#[doc = "*This API requires the following crate features to be activated: `KeyFrameRequestEvent`*"]
48+
#[doc = ""]
49+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
51+
pub fn new_with_rid(type_: &str, rid: &str) -> Result<KeyFrameRequestEvent, JsValue>;
52+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#![allow(unused_imports)]
2+
#![allow(clippy::all)]
3+
use super::*;
4+
use wasm_bindgen::prelude::*;
5+
#[cfg(web_sys_unstable_apis)]
6+
#[wasm_bindgen]
7+
extern "C" {
8+
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = RTCEncodedAudioFrame , typescript_type = "RTCEncodedAudioFrame")]
9+
#[derive(Debug, Clone, PartialEq, Eq)]
10+
#[doc = "The `RtcEncodedAudioFrame` class."]
11+
#[doc = ""]
12+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame)"]
13+
#[doc = ""]
14+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"]
15+
#[doc = ""]
16+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
17+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
18+
pub type RtcEncodedAudioFrame;
19+
#[cfg(web_sys_unstable_apis)]
20+
# [wasm_bindgen (structural , method , getter , js_class = "RTCEncodedAudioFrame" , js_name = data)]
21+
#[doc = "Getter for the `data` field of this object."]
22+
#[doc = ""]
23+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/data)"]
24+
#[doc = ""]
25+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"]
26+
#[doc = ""]
27+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
29+
pub fn data(this: &RtcEncodedAudioFrame) -> ::js_sys::ArrayBuffer;
30+
#[cfg(web_sys_unstable_apis)]
31+
# [wasm_bindgen (structural , method , setter , js_class = "RTCEncodedAudioFrame" , js_name = data)]
32+
#[doc = "Setter for the `data` field of this object."]
33+
#[doc = ""]
34+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/data)"]
35+
#[doc = ""]
36+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"]
37+
#[doc = ""]
38+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40+
pub fn set_data(this: &RtcEncodedAudioFrame, value: &::js_sys::ArrayBuffer);
41+
#[cfg(web_sys_unstable_apis)]
42+
#[wasm_bindgen(catch, constructor, js_class = "RTCEncodedAudioFrame")]
43+
#[doc = "The `new RtcEncodedAudioFrame(..)` constructor, creating a new instance of `RtcEncodedAudioFrame`."]
44+
#[doc = ""]
45+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/RTCEncodedAudioFrame)"]
46+
#[doc = ""]
47+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`*"]
48+
#[doc = ""]
49+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
50+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
51+
pub fn new(original_frame: &RtcEncodedAudioFrame) -> Result<RtcEncodedAudioFrame, JsValue>;
52+
#[cfg(web_sys_unstable_apis)]
53+
#[cfg(feature = "RtcEncodedAudioFrameOptions")]
54+
#[wasm_bindgen(catch, constructor, js_class = "RTCEncodedAudioFrame")]
55+
#[doc = "The `new RtcEncodedAudioFrame(..)` constructor, creating a new instance of `RtcEncodedAudioFrame`."]
56+
#[doc = ""]
57+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/RTCEncodedAudioFrame)"]
58+
#[doc = ""]
59+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`, `RtcEncodedAudioFrameOptions`*"]
60+
#[doc = ""]
61+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
62+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
63+
pub fn new_with_options(
64+
original_frame: &RtcEncodedAudioFrame,
65+
options: &RtcEncodedAudioFrameOptions,
66+
) -> Result<RtcEncodedAudioFrame, JsValue>;
67+
#[cfg(web_sys_unstable_apis)]
68+
#[cfg(feature = "RtcEncodedAudioFrameMetadata")]
69+
# [wasm_bindgen (method , structural , js_class = "RTCEncodedAudioFrame" , js_name = getMetadata)]
70+
#[doc = "The `getMetadata()` method."]
71+
#[doc = ""]
72+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/RTCEncodedAudioFrame/getMetadata)"]
73+
#[doc = ""]
74+
#[doc = "*This API requires the following crate features to be activated: `RtcEncodedAudioFrame`, `RtcEncodedAudioFrameMetadata`*"]
75+
#[doc = ""]
76+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
77+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
78+
pub fn get_metadata(this: &RtcEncodedAudioFrame) -> RtcEncodedAudioFrameMetadata;
79+
}

0 commit comments

Comments
 (0)