AudioDecoder.webidl (1554B)
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/#audiodecoder 8 */ 9 10 [Exposed=(Window,DedicatedWorker), SecureContext, Func="nsRFPService::ExposeWebCodecsAPI"] 11 interface AudioDecoder : EventTarget { 12 [Throws] 13 constructor(AudioDecoderInit init); 14 15 readonly attribute CodecState state; 16 readonly attribute unsigned long decodeQueueSize; 17 attribute EventHandler ondequeue; 18 19 [Throws] 20 undefined configure(AudioDecoderConfig config); 21 [Throws] 22 undefined decode(EncodedAudioChunk 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<AudioDecoderSupport> isConfigSupported(AudioDecoderConfig config); 32 }; 33 34 dictionary AudioDecoderInit { 35 required AudioDataOutputCallback output; 36 required WebCodecsErrorCallback error; 37 }; 38 39 callback AudioDataOutputCallback = undefined(AudioData output); 40 41 dictionary AudioDecoderSupport { 42 boolean supported; 43 AudioDecoderConfig config; 44 }; 45 46 dictionary AudioDecoderConfig { 47 required DOMString codec; 48 required [EnforceRange] unsigned long sampleRate; 49 required [EnforceRange] unsigned long numberOfChannels; 50 51 // Bug 1958020: This should be BufferSource 52 AllowSharedBufferSource description; 53 };