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/#audiodecoder
10 [Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.enabled"]
11 interface AudioDecoder : EventTarget {
13 constructor(AudioDecoderInit init);
15 readonly attribute CodecState state;
16 readonly attribute unsigned long decodeQueueSize;
17 attribute EventHandler ondequeue;
20 undefined configure(AudioDecoderConfig config);
22 undefined decode(EncodedAudioChunk chunk);
24 Promise<undefined> flush();
31 static Promise<AudioDecoderSupport> isConfigSupported(AudioDecoderConfig config);
34 dictionary AudioDecoderInit {
35 required AudioDataOutputCallback output;
36 required WebCodecsErrorCallback error;
39 callback AudioDataOutputCallback = undefined(AudioData output);
41 dictionary AudioDecoderSupport {
43 AudioDecoderConfig config;
46 dictionary AudioDecoderConfig {
47 required DOMString codec;
48 required [EnforceRange] unsigned long sampleRate;
49 required [EnforceRange] unsigned long numberOfChannels;
51 // Bug 1696216: Should be AllowSharedBufferSource
52 ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) description;