feat(media): expose video encoder and decoder interface shells

This commit is contained in:
ldm0
2026-10-11 18:06:46 +08:00
parent 251564f98c
commit 99bb1f7fdc
3 changed files with 18 additions and 0 deletions
@@ -35,6 +35,8 @@ pub(in crate::context_bootstrap) const WORKER_SHARED_INTERFACE_NAMES: &[&str] =
"MIDIOutput",
"MIDIOutputMap",
"MIDIPort",
"VideoDecoder",
"VideoEncoder",
"EventTarget",
"Event",
"CustomEvent",
@@ -211,6 +213,8 @@ const SECURE_CONTEXT_ONLY_INTERFACE_NAMES: &[&str] = &[
"PaymentRequest",
"PaymentRequestUpdateEvent",
"PaymentResponse",
"VideoDecoder",
"VideoEncoder",
"Worklet",
"AudioWorklet",
"ServiceWorker",
@@ -249,6 +253,7 @@ const WINDOW_DEDICATED_AND_SHARED_WORKER_INTERFACE_NAMES: &[&str] = &[
"XMLHttpRequest",
];
const DEDICATED_AND_SHARED_WORKER_INTERFACE_NAMES: &[&str] = &["FileReaderSync"];
const WINDOW_AND_DEDICATED_WORKER_INTERFACE_NAMES: &[&str] = &["VideoDecoder", "VideoEncoder"];
pub(in crate::context_bootstrap) const INDEXED_DB_INTERFACE_NAMES: &[&str] = &[
"DOMStringList",
@@ -525,6 +530,9 @@ fn exposure_for_name(name: &str) -> ExposureSet {
match name {
"FileSystemSyncAccessHandle" => ExposureSet::DEDICATED_WORKER_ONLY,
"EncodedVideoChunk" => ExposureSet::WINDOW_AND_DEDICATED_WORKER,
_ if WINDOW_AND_DEDICATED_WORKER_INTERFACE_NAMES.contains(&name) => {
ExposureSet::WINDOW_AND_DEDICATED_WORKER
}
_ if WINDOW_DEDICATED_AND_SHARED_WORKER_INTERFACE_NAMES.contains(&name) => {
ExposureSet::WINDOW_DEDICATED_AND_SHARED_WORKER
}
@@ -120,6 +120,14 @@ const CONSTRUCTOR_SPECS_BEFORE_STREAMS: &[ConstructorSpec] = &[
interface: web_api_interfaces::PaymentResponse::DESCRIPTOR,
kind: ConstructorKind::Illegal,
},
ConstructorSpec {
interface: web_api_interfaces::VideoDecoder::DESCRIPTOR,
kind: ConstructorKind::Shell { length: 1 },
},
ConstructorSpec {
interface: web_api_interfaces::VideoEncoder::DESCRIPTOR,
kind: ConstructorKind::Shell { length: 1 },
},
ConstructorSpec {
interface: web_api_interfaces::External::DESCRIPTOR,
kind: ConstructorKind::Illegal,
@@ -45,6 +45,8 @@ interfaces! {
PaymentRequest: EventTarget;
PaymentRequestUpdateEvent: Event;
PaymentResponse: EventTarget;
VideoDecoder: EventTarget;
VideoEncoder: EventTarget;
AbortController;
AbortSignal: EventTarget;
AbstractRange;