1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/webcodecs/#videodecoder
10 [Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.enabled"]
11 interface VideoDecoder : EventTarget {
13 constructor(VideoDecoderInit init);
15 readonly attribute CodecState state;
16 readonly attribute unsigned long decodeQueueSize;
17 attribute EventHandler ondequeue;
20 undefined configure(VideoDecoderConfig config);
22 undefined decode(EncodedVideoChunk chunk);
24 Promise<undefined> flush();
31 static Promise<VideoDecoderSupport> isConfigSupported(VideoDecoderConfig config);
34 dictionary VideoDecoderInit {
35 required VideoFrameOutputCallback output;
36 required WebCodecsErrorCallback error;
39 callback VideoFrameOutputCallback = undefined(VideoFrame output);
41 dictionary VideoDecoderSupport {
43 VideoDecoderConfig config;
46 dictionary VideoDecoderConfig {
47 required DOMString codec;
48 // Bug 1696216: Should be [AllowShared] BufferSource description;
49 ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) description;
50 [EnforceRange] unsigned long codedWidth;
51 [EnforceRange] unsigned long codedHeight;
52 [EnforceRange] unsigned long displayAspectWidth;
53 [EnforceRange] unsigned long displayAspectHeight;
54 VideoColorSpaceInit colorSpace;
55 HardwareAcceleration hardwareAcceleration = "no-preference";
56 boolean optimizeForLatency;
59 enum HardwareAcceleration {
71 callback WebCodecsErrorCallback = undefined(DOMException error);