packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoDecoderConfig.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webcodecs (webref). Do not edit.
module JSDOM.Generated.VideoDecoderConfig
       (newVideoDecoderConfig, setCodec, getCodec, setDescription, getDescription, getDescriptionUnsafe, getDescriptionUnchecked, setCodedWidth, getCodedWidth, getCodedWidthUnsafe, getCodedWidthUnchecked, setCodedHeight, getCodedHeight, getCodedHeightUnsafe, getCodedHeightUnchecked, setDisplayAspectWidth, getDisplayAspectWidth, getDisplayAspectWidthUnsafe, getDisplayAspectWidthUnchecked, setDisplayAspectHeight, getDisplayAspectHeight, getDisplayAspectHeightUnsafe, getDisplayAspectHeightUnchecked, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, setHardwareAcceleration, getHardwareAcceleration, getHardwareAccelerationUnsafe, getHardwareAccelerationUnchecked, setOptimizeForLatency, getOptimizeForLatency, getOptimizeForLatencyUnsafe, getOptimizeForLatencyUnchecked, setRotation, getRotation, getRotationUnsafe, getRotationUnchecked, setFlip, getFlip, getFlipUnsafe, getFlipUnchecked, VideoDecoderConfig(..), gTypeVideoDecoderConfig)
       where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums

-- | <https://w3c.github.io/webcodecs/#dictdef-videodecoderconfig VideoDecoderConfig specification>
newVideoDecoderConfig :: (MonadDOM m, ToJSString codec) => codec -> m VideoDecoderConfig
newVideoDecoderConfig codec = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "codec" (toJSVal codec)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codec VideoDecoderConfig.codec specification>
setCodec :: (MonadDOM m, ToJSString val) => VideoDecoderConfig -> val -> m ()
setCodec self val = liftDOM (void (self ^. jss "codec" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codec VideoDecoderConfig.codec specification>
getCodec :: (MonadDOM m, FromJSString result) => VideoDecoderConfig -> m result
getCodec self = liftDOM (((self ^. js "codec") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-description VideoDecoderConfig.description specification>
setDescription :: (MonadDOM m, IsAllowSharedBufferSource val) => VideoDecoderConfig -> val -> m ()
setDescription self val = liftDOM (void (self ^. jss "description" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-description VideoDecoderConfig.description specification>
getDescription :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe AllowSharedBufferSource)
getDescription self = liftDOM (((self ^. js "description") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-description VideoDecoderConfig.description specification>
getDescriptionUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m AllowSharedBufferSource
getDescriptionUnsafe self = liftDOM ((((self ^. js "description") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-description VideoDecoderConfig.description specification>
getDescriptionUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m AllowSharedBufferSource
getDescriptionUnchecked self = liftDOM (((self ^. js "description") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedwidth VideoDecoderConfig.codedWidth specification>
setCodedWidth :: (MonadDOM m) => VideoDecoderConfig -> Word -> m ()
setCodedWidth self val = liftDOM (void (self ^. jss "codedWidth" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedwidth VideoDecoderConfig.codedWidth specification>
getCodedWidth :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Word)
getCodedWidth self = liftDOM (((self ^. js "codedWidth") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedwidth VideoDecoderConfig.codedWidth specification>
getCodedWidthUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Word
getCodedWidthUnsafe self = liftDOM ((((self ^. js "codedWidth") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedwidth VideoDecoderConfig.codedWidth specification>
getCodedWidthUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Word
getCodedWidthUnchecked self = liftDOM ((P.round <$> ((self ^. js "codedWidth") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedheight VideoDecoderConfig.codedHeight specification>
setCodedHeight :: (MonadDOM m) => VideoDecoderConfig -> Word -> m ()
setCodedHeight self val = liftDOM (void (self ^. jss "codedHeight" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedheight VideoDecoderConfig.codedHeight specification>
getCodedHeight :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Word)
getCodedHeight self = liftDOM (((self ^. js "codedHeight") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedheight VideoDecoderConfig.codedHeight specification>
getCodedHeightUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Word
getCodedHeightUnsafe self = liftDOM ((((self ^. js "codedHeight") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-codedheight VideoDecoderConfig.codedHeight specification>
getCodedHeightUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Word
getCodedHeightUnchecked self = liftDOM ((P.round <$> ((self ^. js "codedHeight") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectwidth VideoDecoderConfig.displayAspectWidth specification>
setDisplayAspectWidth :: (MonadDOM m) => VideoDecoderConfig -> Word -> m ()
setDisplayAspectWidth self val = liftDOM (void (self ^. jss "displayAspectWidth" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectwidth VideoDecoderConfig.displayAspectWidth specification>
getDisplayAspectWidth :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Word)
getDisplayAspectWidth self = liftDOM (((self ^. js "displayAspectWidth") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectwidth VideoDecoderConfig.displayAspectWidth specification>
getDisplayAspectWidthUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Word
getDisplayAspectWidthUnsafe self = liftDOM ((((self ^. js "displayAspectWidth") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectwidth VideoDecoderConfig.displayAspectWidth specification>
getDisplayAspectWidthUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Word
getDisplayAspectWidthUnchecked self = liftDOM ((P.round <$> ((self ^. js "displayAspectWidth") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectheight VideoDecoderConfig.displayAspectHeight specification>
setDisplayAspectHeight :: (MonadDOM m) => VideoDecoderConfig -> Word -> m ()
setDisplayAspectHeight self val = liftDOM (void (self ^. jss "displayAspectHeight" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectheight VideoDecoderConfig.displayAspectHeight specification>
getDisplayAspectHeight :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Word)
getDisplayAspectHeight self = liftDOM (((self ^. js "displayAspectHeight") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectheight VideoDecoderConfig.displayAspectHeight specification>
getDisplayAspectHeightUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Word
getDisplayAspectHeightUnsafe self = liftDOM ((((self ^. js "displayAspectHeight") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-displayaspectheight VideoDecoderConfig.displayAspectHeight specification>
getDisplayAspectHeightUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Word
getDisplayAspectHeightUnchecked self = liftDOM ((P.round <$> ((self ^. js "displayAspectHeight") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-colorspace VideoDecoderConfig.colorSpace specification>
setColorSpace :: (MonadDOM m) => VideoDecoderConfig -> VideoColorSpaceInit -> m ()
setColorSpace self val = liftDOM (void (self ^. jss "colorSpace" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-colorspace VideoDecoderConfig.colorSpace specification>
getColorSpace :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe VideoColorSpaceInit)
getColorSpace self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-colorspace VideoDecoderConfig.colorSpace specification>
getColorSpaceUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m VideoColorSpaceInit
getColorSpaceUnsafe self = liftDOM ((((self ^. js "colorSpace") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-colorspace VideoDecoderConfig.colorSpace specification>
getColorSpaceUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m VideoColorSpaceInit
getColorSpaceUnchecked self = liftDOM (((self ^. js "colorSpace") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-hardwareacceleration VideoDecoderConfig.hardwareAcceleration specification>
setHardwareAcceleration :: (MonadDOM m) => VideoDecoderConfig -> HardwareAcceleration -> m ()
setHardwareAcceleration self val = liftDOM (void (self ^. jss "hardwareAcceleration" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-hardwareacceleration VideoDecoderConfig.hardwareAcceleration specification>
getHardwareAcceleration :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe HardwareAcceleration)
getHardwareAcceleration self = liftDOM (((self ^. js "hardwareAcceleration") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-hardwareacceleration VideoDecoderConfig.hardwareAcceleration specification>
getHardwareAccelerationUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m HardwareAcceleration
getHardwareAccelerationUnsafe self = liftDOM ((((self ^. js "hardwareAcceleration") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-hardwareacceleration VideoDecoderConfig.hardwareAcceleration specification>
getHardwareAccelerationUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m HardwareAcceleration
getHardwareAccelerationUnchecked self = liftDOM (((self ^. js "hardwareAcceleration") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-optimizeforlatency VideoDecoderConfig.optimizeForLatency specification>
setOptimizeForLatency :: (MonadDOM m) => VideoDecoderConfig -> Bool -> m ()
setOptimizeForLatency self val = liftDOM (void (self ^. jss "optimizeForLatency" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-optimizeforlatency VideoDecoderConfig.optimizeForLatency specification>
getOptimizeForLatency :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Bool)
getOptimizeForLatency self = liftDOM (((self ^. js "optimizeForLatency") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-optimizeforlatency VideoDecoderConfig.optimizeForLatency specification>
getOptimizeForLatencyUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Bool
getOptimizeForLatencyUnsafe self = liftDOM ((((self ^. js "optimizeForLatency") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-optimizeforlatency VideoDecoderConfig.optimizeForLatency specification>
getOptimizeForLatencyUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Bool
getOptimizeForLatencyUnchecked self = liftDOM (((self ^. js "optimizeForLatency") >>= valToBool))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-rotation VideoDecoderConfig.rotation specification>
setRotation :: (MonadDOM m) => VideoDecoderConfig -> Double -> m ()
setRotation self val = liftDOM (void (self ^. jss "rotation" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-rotation VideoDecoderConfig.rotation specification>
getRotation :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Double)
getRotation self = liftDOM (((self ^. js "rotation") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-rotation VideoDecoderConfig.rotation specification>
getRotationUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Double
getRotationUnsafe self = liftDOM ((((self ^. js "rotation") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-rotation VideoDecoderConfig.rotation specification>
getRotationUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Double
getRotationUnchecked self = liftDOM (((self ^. js "rotation") >>= valToNumber))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-flip VideoDecoderConfig.flip specification>
setFlip :: (MonadDOM m) => VideoDecoderConfig -> Bool -> m ()
setFlip self val = liftDOM (void (self ^. jss "flip" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-flip VideoDecoderConfig.flip specification>
getFlip :: (MonadDOM m) => VideoDecoderConfig -> m (Maybe Bool)
getFlip self = liftDOM (((self ^. js "flip") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-flip VideoDecoderConfig.flip specification>
getFlipUnsafe :: (MonadDOM m, HasCallStack) => VideoDecoderConfig -> m Bool
getFlipUnsafe self = liftDOM ((((self ^. js "flip") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videodecoderconfig-flip VideoDecoderConfig.flip specification>
getFlipUnchecked :: (MonadDOM m) => VideoDecoderConfig -> m Bool
getFlipUnchecked self = liftDOM (((self ^. js "flip") >>= valToBool))