packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs-avc-codec-registration (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.VideoEncoderEncodeOptionsForAvc
       (js_newVideoEncoderEncodeOptionsForAvc, js_setQuantizer, js_getQuantizer, newVideoEncoderEncodeOptionsForAvc, setQuantizer, getQuantizer, getQuantizerUnsafe, getQuantizerUnchecked, VideoEncoderEncodeOptionsForAvc(..), gTypeVideoEncoderEncodeOptionsForAvc)
       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 "(() => { return ({}); })"
        js_newVideoEncoderEncodeOptionsForAvc :: IO VideoEncoderEncodeOptionsForAvc
-- | <https://w3c.github.io/webcodecs/avc_codec_registration.html#dictdef-videoencoderencodeoptionsforavc VideoEncoderEncodeOptionsForAvc specification>
newVideoEncoderEncodeOptionsForAvc :: (MonadDOM m) => m VideoEncoderEncodeOptionsForAvc
newVideoEncoderEncodeOptionsForAvc = liftDOM ((js_newVideoEncoderEncodeOptionsForAvc))

foreign import javascript safe "(($1, $2) => { $1[\"quantizer\"] = $2; })"
        js_setQuantizer :: VideoEncoderEncodeOptionsForAvc -> JSVal -> IO ()
-- | <https://w3c.github.io/webcodecs/avc_codec_registration.html#dom-videoencoderencodeoptionsforavc-quantizer VideoEncoderEncodeOptionsForAvc.quantizer specification>
setQuantizer :: (MonadDOM m) => VideoEncoderEncodeOptionsForAvc -> Maybe Word -> m ()
setQuantizer self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setQuantizer (self) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"quantizer\"]; })"
        js_getQuantizer :: VideoEncoderEncodeOptionsForAvc -> IO JSVal
-- | <https://w3c.github.io/webcodecs/avc_codec_registration.html#dom-videoencoderencodeoptionsforavc-quantizer VideoEncoderEncodeOptionsForAvc.quantizer specification>
getQuantizer :: (MonadDOM m) => VideoEncoderEncodeOptionsForAvc -> m (Maybe Word)
getQuantizer self = liftDOM (((js_getQuantizer (self)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/avc_codec_registration.html#dom-videoencoderencodeoptionsforavc-quantizer VideoEncoderEncodeOptionsForAvc.quantizer specification>
getQuantizerUnsafe :: (MonadDOM m, HasCallStack) => VideoEncoderEncodeOptionsForAvc -> m Word
getQuantizerUnsafe self = liftDOM ((((js_getQuantizer (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/avc_codec_registration.html#dom-videoencoderencodeoptionsforavc-quantizer VideoEncoderEncodeOptionsForAvc.quantizer specification>
getQuantizerUnchecked :: (MonadDOM m) => VideoEncoderEncodeOptionsForAvc -> m Word
getQuantizerUnchecked self = liftDOM ((pFromJSVal <$> (js_getQuantizer (self))))