VideoDecoder.webidl (1943B)
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/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/webcodecs/#videodecoder 8 */ 9 10 [Exposed=(Window,DedicatedWorker), SecureContext, Func="nsRFPService::ExposeWebCodecsAPI"] 11 interface VideoDecoder : EventTarget { 12 [Throws] 13 constructor(VideoDecoderInit init); 14 15 readonly attribute CodecState state; 16 readonly attribute unsigned long decodeQueueSize; 17 attribute EventHandler ondequeue; 18 19 [Throws] 20 undefined configure(VideoDecoderConfig config); 21 [Throws] 22 undefined decode(EncodedVideoChunk chunk); 23 [NewObject, Throws] 24 Promise<undefined> flush(); 25 [Throws] 26 undefined reset(); 27 [Throws] 28 undefined close(); 29 30 [NewObject, Throws] 31 static Promise<VideoDecoderSupport> isConfigSupported(VideoDecoderConfig config); 32 }; 33 34 dictionary VideoDecoderInit { 35 required VideoFrameOutputCallback output; 36 required WebCodecsErrorCallback error; 37 }; 38 39 callback VideoFrameOutputCallback = undefined(VideoFrame output); 40 41 dictionary VideoDecoderSupport { 42 boolean supported; 43 VideoDecoderConfig config; 44 }; 45 46 dictionary VideoDecoderConfig { 47 required DOMString codec; 48 AllowSharedBufferSource description; 49 [EnforceRange] unsigned long codedWidth; 50 [EnforceRange] unsigned long codedHeight; 51 [EnforceRange] unsigned long displayAspectWidth; 52 [EnforceRange] unsigned long displayAspectHeight; 53 VideoColorSpaceInit colorSpace; 54 HardwareAcceleration hardwareAcceleration = "no-preference"; 55 boolean optimizeForLatency; 56 }; 57 58 enum HardwareAcceleration { 59 "no-preference", 60 "prefer-hardware", 61 "prefer-software", 62 }; 63 64 enum CodecState { 65 "unconfigured", 66 "configured", 67 "closed" 68 }; 69 70 callback WebCodecsErrorCallback = undefined(DOMException error);