packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/VideoDecoder.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.VideoDecoder
       (js_newVideoDecoder, js_close, js_configure, js_decode, js_flush, js_reset, js_isConfigSupported, js_getState, js_getDecodeQueueSize, newVideoDecoder, close, configure, decode, flush, reset, isConfigSupported, isConfigSupported_, getState, getDecodeQueueSize, dequeue, VideoDecoder(..), gTypeVideoDecoder)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(($1) => { return new globalThis[\"VideoDecoder\"]($1); })"
        js_newVideoDecoder :: VideoDecoderInit -> IO VideoDecoder
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/VideoDecoder MDN VideoDecoder. documentation>
newVideoDecoder :: (MonadDOM m) => VideoDecoderInit -> m VideoDecoder
newVideoDecoder init = liftDOM ((js_newVideoDecoder (init)))

foreign import javascript safe "(($1) => { return $1[\"close\"](); })"
        js_close :: VideoDecoder -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/close MDN VideoDecoder.close documentation>
close :: (MonadDOM m) => VideoDecoder -> m ()
close self = liftDOM (void ((js_close (self))))

foreign import javascript safe "(($1, $2) => { return $1[\"configure\"]($2); })"
        js_configure :: VideoDecoder -> VideoDecoderConfig -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/configure MDN VideoDecoder.configure documentation>
configure :: (MonadDOM m) => VideoDecoder -> VideoDecoderConfig -> m ()
configure self config = liftDOM (void ((js_configure (self) (config))))

foreign import javascript safe "(($1, $2) => { return $1[\"decode\"]($2); })"
        js_decode :: VideoDecoder -> EncodedVideoChunk -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/decode MDN VideoDecoder.decode documentation>
decode :: (MonadDOM m) => VideoDecoder -> EncodedVideoChunk -> m ()
decode self chunk = liftDOM (void ((js_decode (self) (chunk))))

foreign import javascript interruptible "(($1, $c) => { return $1[\"flush\"]().then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_flush :: VideoDecoder -> IO (JSVal, ())
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/flush MDN VideoDecoder.flush documentation>
flush :: (MonadDOM m) => VideoDecoder -> m ()
flush self = liftDOM (void (((js_flush (self)) >>= checkPromiseResult)))

foreign import javascript safe "(($1) => { return $1[\"reset\"](); })"
        js_reset :: VideoDecoder -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/reset MDN VideoDecoder.reset documentation>
reset :: (MonadDOM m) => VideoDecoder -> m ()
reset self = liftDOM (void ((js_reset (self))))

foreign import javascript interruptible "(($1, $c) => { return globalThis[\"VideoDecoder\"][\"isConfigSupported\"]($1).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
        js_isConfigSupported :: VideoDecoderConfig -> IO (JSVal, VideoDecoderSupport)
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/isConfigSupported_static MDN VideoDecoder.isConfigSupported documentation>
isConfigSupported :: (MonadDOM m) => VideoDecoderConfig -> m VideoDecoderSupport
isConfigSupported config = liftDOM (((js_isConfigSupported (config)) >>= checkPromiseResult))

-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/isConfigSupported_static MDN VideoDecoder.isConfigSupported documentation>
isConfigSupported_ :: (MonadDOM m) => VideoDecoderConfig -> m ()
isConfigSupported_ config = liftDOM (void (((js_isConfigSupported (config)) >>= checkPromiseResult)))

foreign import javascript unsafe "(($1) => { return $1[\"state\"]; })"
        js_getState :: VideoDecoder -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/state MDN VideoDecoder.state documentation>
getState :: (MonadDOM m) => VideoDecoder -> m CodecState
getState self = liftDOM (((js_getState (self)) >>= fromJSValUnchecked))

foreign import javascript unsafe "(($1) => { return $1[\"decodeQueueSize\"]; })"
        js_getDecodeQueueSize :: VideoDecoder -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoDecoder/decodeQueueSize MDN VideoDecoder.decodeQueueSize documentation>
getDecodeQueueSize :: (MonadDOM m) => VideoDecoder -> m Word
getDecodeQueueSize self = liftDOM ((js_getDecodeQueueSize (self)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoder-ondequeue dequeue event>
dequeue :: EventName VideoDecoder Event
dequeue = unsafeEventName (toJSString "dequeue")