tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

AudioData.webidl (1923B)


      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 */
      9 
     10 // [Serializable, Transferable] are implemented without adding attributes here,
     11 // but directly with {Read,Write}StructuredClone and Transfer/FromTransfered.
     12 [Exposed=(Window,DedicatedWorker), Func="nsRFPService::ExposeWebCodecsAPI"]
     13 interface AudioData {
     14  [Throws]
     15  constructor(AudioDataInit init);
     16 
     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
     23 
     24  [Throws]
     25  unsigned long allocationSize(AudioDataCopyToOptions options);
     26  [Throws]
     27  undefined copyTo(AllowSharedBufferSource destination, AudioDataCopyToOptions options);
     28  [Throws]
     29  AudioData clone();
     30  undefined close();
     31 };
     32 
     33 dictionary AudioDataInit {
     34  required AudioSampleFormat format;
     35  required float sampleRate;
     36  required [EnforceRange] unsigned long numberOfFrames;
     37  required [EnforceRange] unsigned long numberOfChannels;
     38  required [EnforceRange] long long timestamp;  // microseconds
     39  required AllowSharedBufferSource data;
     40  sequence<ArrayBuffer> transfer = [];
     41 };
     42 
     43 enum AudioSampleFormat {
     44  "u8",
     45  "s16",
     46  "s32",
     47  "f32",
     48  "u8-planar",
     49  "s16-planar",
     50  "s32-planar",
     51  "f32-planar",
     52 };
     53 
     54 dictionary AudioDataCopyToOptions {
     55  required [EnforceRange] unsigned long planeIndex;
     56  [EnforceRange] unsigned long frameOffset = 0;
     57  [EnforceRange] unsigned long frameCount;
     58  AudioSampleFormat format;
     59 };