/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is * https://w3c.github.io/webcodecs/#image-decoding */ typedef (AllowSharedBufferSource or ReadableStream) ImageBufferSource; dictionary ImageDecoderInit { required DOMString type; required ImageBufferSource data; ColorSpaceConversion colorSpaceConversion = "default"; [EnforceRange] unsigned long desiredWidth; [EnforceRange] unsigned long desiredHeight; boolean preferAnimation; sequence transfer = []; }; dictionary ImageDecodeOptions { [EnforceRange] unsigned long frameIndex = 0; boolean completeFramesOnly = true; }; dictionary ImageDecodeResult { required VideoFrame image; required boolean complete; }; [Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.image-decoder.enabled"] interface ImageTrack { readonly attribute boolean animated; readonly attribute unsigned long frameCount; readonly attribute unrestricted float repetitionCount; attribute boolean selected; }; [Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.image-decoder.enabled"] interface ImageTrackList { getter ImageTrack (unsigned long index); readonly attribute Promise ready; readonly attribute unsigned long length; readonly attribute long selectedIndex; readonly attribute ImageTrack? selectedTrack; }; [Exposed=(Window,DedicatedWorker), SecureContext, Pref="dom.media.webcodecs.image-decoder.enabled"] interface ImageDecoder { [Throws] constructor(ImageDecoderInit init); readonly attribute DOMString type; readonly attribute boolean complete; readonly attribute Promise completed; readonly attribute ImageTrackList tracks; [Throws] Promise decode(optional ImageDecodeOptions options = {}); undefined reset(); undefined close(); [Throws] static Promise isTypeSupported(DOMString type); };