packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/VideoFrameBufferInit.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.VideoFrameBufferInit
       (newVideoFrameBufferInit, setFormat, getFormat, setCodedWidth, getCodedWidth, setCodedHeight, getCodedHeight, setTimestamp, getTimestamp, setDuration, getDuration, getDurationUnsafe, getDurationUnchecked, setLayout, getLayout, getLayoutUnsafe, getLayoutUnchecked, setVisibleRect, getVisibleRect, getVisibleRectUnsafe, getVisibleRectUnchecked, setRotation, getRotation, getRotationUnsafe, getRotationUnchecked, setFlip, getFlip, getFlipUnsafe, getFlipUnchecked, setDisplayWidth, getDisplayWidth, getDisplayWidthUnsafe, getDisplayWidthUnchecked, setDisplayHeight, getDisplayHeight, getDisplayHeightUnsafe, getDisplayHeightUnchecked, setColorSpace, getColorSpace, getColorSpaceUnsafe, getColorSpaceUnchecked, setTransfer, getTransfer, getTransferUnsafe, getTransferUnchecked, setMetadata, getMetadata, getMetadataUnsafe, getMetadataUnchecked, VideoFrameBufferInit(..), gTypeVideoFrameBufferInit)
       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-videoframebufferinit VideoFrameBufferInit specification>
newVideoFrameBufferInit :: (MonadDOM m) => VideoPixelFormat -> Word -> Word -> Int53 -> m VideoFrameBufferInit
newVideoFrameBufferInit format codedWidth codedHeight timestamp = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "format" (toJSVal format)) P.>> (o ^. jss "codedWidth" (toJSVal codedWidth)) P.>> (o ^. jss "codedHeight" (toJSVal codedHeight)) P.>> (o ^. jss "timestamp" (toJSVal timestamp)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-format VideoFrameBufferInit.format specification>
setFormat :: (MonadDOM m) => VideoFrameBufferInit -> VideoPixelFormat -> m ()
setFormat self val = liftDOM (void (self ^. jss "format" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-format VideoFrameBufferInit.format specification>
getFormat :: (MonadDOM m) => VideoFrameBufferInit -> m VideoPixelFormat
getFormat self = liftDOM (((self ^. js "format") >>= fromJSValUnchecked))

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

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

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

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

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-timestamp VideoFrameBufferInit.timestamp specification>
setTimestamp :: (MonadDOM m) => VideoFrameBufferInit -> Int53 -> m ()
setTimestamp self val = liftDOM (void (self ^. jss "timestamp" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-timestamp VideoFrameBufferInit.timestamp specification>
getTimestamp :: (MonadDOM m) => VideoFrameBufferInit -> m Int53
getTimestamp self = liftDOM (((self ^. js "timestamp") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-duration VideoFrameBufferInit.duration specification>
setDuration :: (MonadDOM m) => VideoFrameBufferInit -> Word53 -> m ()
setDuration self val = liftDOM (void (self ^. jss "duration" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-duration VideoFrameBufferInit.duration specification>
getDuration :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe Word53)
getDuration self = liftDOM (((self ^. js "duration") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-duration VideoFrameBufferInit.duration specification>
getDurationUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m Word53
getDurationUnsafe self = liftDOM ((((self ^. js "duration") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-duration VideoFrameBufferInit.duration specification>
getDurationUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m Word53
getDurationUnchecked self = liftDOM (((self ^. js "duration") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-layout VideoFrameBufferInit.layout specification>
setLayout :: (MonadDOM m) => VideoFrameBufferInit -> [PlaneLayout] -> m ()
setLayout self val = liftDOM (void (self ^. jss "layout" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-layout VideoFrameBufferInit.layout specification>
getLayout :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe [PlaneLayout])
getLayout self = liftDOM (((self ^. js "layout") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-layout VideoFrameBufferInit.layout specification>
getLayoutUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m [PlaneLayout]
getLayoutUnsafe self = liftDOM ((((self ^. js "layout") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-layout VideoFrameBufferInit.layout specification>
getLayoutUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m [PlaneLayout]
getLayoutUnchecked self = liftDOM (((self ^. js "layout") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-visiblerect VideoFrameBufferInit.visibleRect specification>
setVisibleRect :: (MonadDOM m) => VideoFrameBufferInit -> DOMRectInit -> m ()
setVisibleRect self val = liftDOM (void (self ^. jss "visibleRect" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-visiblerect VideoFrameBufferInit.visibleRect specification>
getVisibleRect :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe DOMRectInit)
getVisibleRect self = liftDOM (((self ^. js "visibleRect") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-visiblerect VideoFrameBufferInit.visibleRect specification>
getVisibleRectUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m DOMRectInit
getVisibleRectUnsafe self = liftDOM ((((self ^. js "visibleRect") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-visiblerect VideoFrameBufferInit.visibleRect specification>
getVisibleRectUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m DOMRectInit
getVisibleRectUnchecked self = liftDOM (((self ^. js "visibleRect") >>= fromJSValUnchecked))

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

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

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

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

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

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

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

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

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displaywidth VideoFrameBufferInit.displayWidth specification>
setDisplayWidth :: (MonadDOM m) => VideoFrameBufferInit -> Word -> m ()
setDisplayWidth self val = liftDOM (void (self ^. jss "displayWidth" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displaywidth VideoFrameBufferInit.displayWidth specification>
getDisplayWidth :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe Word)
getDisplayWidth self = liftDOM (((self ^. js "displayWidth") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displaywidth VideoFrameBufferInit.displayWidth specification>
getDisplayWidthUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m Word
getDisplayWidthUnsafe self = liftDOM ((((self ^. js "displayWidth") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displaywidth VideoFrameBufferInit.displayWidth specification>
getDisplayWidthUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m Word
getDisplayWidthUnchecked self = liftDOM ((P.round <$> ((self ^. js "displayWidth") >>= valToNumber)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displayheight VideoFrameBufferInit.displayHeight specification>
setDisplayHeight :: (MonadDOM m) => VideoFrameBufferInit -> Word -> m ()
setDisplayHeight self val = liftDOM (void (self ^. jss "displayHeight" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displayheight VideoFrameBufferInit.displayHeight specification>
getDisplayHeight :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe Word)
getDisplayHeight self = liftDOM (((self ^. js "displayHeight") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displayheight VideoFrameBufferInit.displayHeight specification>
getDisplayHeightUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m Word
getDisplayHeightUnsafe self = liftDOM ((((self ^. js "displayHeight") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-displayheight VideoFrameBufferInit.displayHeight specification>
getDisplayHeightUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m Word
getDisplayHeightUnchecked self = liftDOM ((P.round <$> ((self ^. js "displayHeight") >>= valToNumber)))

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

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

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

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

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-transfer VideoFrameBufferInit.transfer specification>
setTransfer :: (MonadDOM m, IsArrayBuffer val) => VideoFrameBufferInit -> [val] -> m ()
setTransfer self val = liftDOM (void (self ^. jss "transfer" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-transfer VideoFrameBufferInit.transfer specification>
getTransfer :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe [ArrayBuffer])
getTransfer self = liftDOM (((self ^. js "transfer") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-transfer VideoFrameBufferInit.transfer specification>
getTransferUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m [ArrayBuffer]
getTransferUnsafe self = liftDOM ((((self ^. js "transfer") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-transfer VideoFrameBufferInit.transfer specification>
getTransferUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m [ArrayBuffer]
getTransferUnchecked self = liftDOM (((self ^. js "transfer") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-metadata VideoFrameBufferInit.metadata specification>
setMetadata :: (MonadDOM m) => VideoFrameBufferInit -> VideoFrameMetadata -> m ()
setMetadata self val = liftDOM (void (self ^. jss "metadata" (toJSVal val)))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-metadata VideoFrameBufferInit.metadata specification>
getMetadata :: (MonadDOM m) => VideoFrameBufferInit -> m (Maybe VideoFrameMetadata)
getMetadata self = liftDOM (((self ^. js "metadata") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-metadata VideoFrameBufferInit.metadata specification>
getMetadataUnsafe :: (MonadDOM m, HasCallStack) => VideoFrameBufferInit -> m VideoFrameMetadata
getMetadataUnsafe self = liftDOM ((((self ^. js "metadata") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webcodecs/#dom-videoframebufferinit-metadata VideoFrameBufferInit.metadata specification>
getMetadataUnchecked :: (MonadDOM m) => VideoFrameBufferInit -> m VideoFrameMetadata
getMetadataUnchecked self = liftDOM (((self ^. js "metadata") >>= fromJSValUnchecked))