Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / AudioData.webidl
blobe413e93971d4f4603a05e9c39604c8039ff4b608
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/#audiodata
8  */
10 // [Serializable, Transferable] are implemented without adding attributes here,
11 // but directly with {Read,Write}StructuredClone and Transfer/FromTransfered.
12 [Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"]
13 interface AudioData {
14   [Throws]
15   constructor(AudioDataInit init);
17   readonly attribute AudioSampleFormat? format;
18   readonly attribute float sampleRate;
19   readonly attribute unsigned long numberOfFrames;
20   readonly attribute unsigned long numberOfChannels;
21   readonly attribute unsigned long long duration;  // microseconds
22   readonly attribute long long timestamp;          // microseconds
24   [Throws]
25   unsigned long allocationSize(AudioDataCopyToOptions options);
26   [Throws]
27   undefined copyTo(
28       // bug 1696216: Should be `copyTo(AllowSharedBufferSource destination, ...)`
29       ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) destination,
30        AudioDataCopyToOptions options);
31   [Throws]
32   AudioData clone();
33   undefined close();
36 dictionary AudioDataInit {
37   required AudioSampleFormat format;
38   required float sampleRate;
39   required [EnforceRange] unsigned long numberOfFrames;
40   required [EnforceRange] unsigned long numberOfChannels;
41   required [EnforceRange] long long timestamp;  // microseconds
42   // bug 1696216: Should be AllowSharedBufferSource
43   required ([AllowShared] ArrayBufferView or [AllowShared] ArrayBuffer) data;
44   sequence<ArrayBuffer> transfer = [];
47 enum AudioSampleFormat {
48   "u8",
49   "s16",
50   "s32",
51   "f32",
52   "u8-planar",
53   "s16-planar",
54   "s32-planar",
55   "f32-planar",
58 dictionary AudioDataCopyToOptions {
59   required [EnforceRange] unsigned long planeIndex;
60   [EnforceRange] unsigned long frameOffset = 0;
61   [EnforceRange] unsigned long frameCount;
62   AudioSampleFormat format;