ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/VideoFrame.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.VideoFrame
(js_newVideoFrame, js_newVideoFrameData', js_allocationSize, js_clone, js_close, js_copyTo, js_getFormat, js_getCodedWidth, js_getCodedHeight, js_getCodedRect, js_getVisibleRect, js_getDisplayWidth, js_getDisplayHeight, js_getDuration, js_getTimestamp, js_getColorSpace, newVideoFrame, newVideoFrameData', allocationSize, allocationSize_, clone, clone_, close, copyTo, copyTo_, getFormat, getFormatUnsafe, getFormatUnchecked, getCodedWidth, getCodedHeight, getCodedRect, getCodedRectUnsafe, getCodedRectUnchecked, getVisibleRect, getVisibleRectUnsafe, getVisibleRectUnchecked, getDisplayWidth, getDisplayHeight, getDuration, getDurationUnsafe, getDurationUnchecked, getTimestamp, getColorSpace, VideoFrame(..), gTypeVideoFrame)
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, $2) => { return new globalThis[\"VideoFrame\"]($1, $2); })"
js_newVideoFrame :: CanvasImageSource -> JSVal -> IO VideoFrame
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/VideoFrame MDN VideoFrame. documentation>
newVideoFrame :: (MonadDOM m, IsCanvasImageSource image) => image -> Maybe VideoFrameInit -> m VideoFrame
newVideoFrame image init = liftDOM (((P.maybe (P.return jsUndefined) toJSVal init) >>= \a2' -> js_newVideoFrame (Types.toCanvasImageSource image) a2'))
foreign import javascript safe "(($1, $2) => { return new globalThis[\"VideoFrame\"]($1, $2); })"
js_newVideoFrameData' :: AllowSharedBufferSource -> VideoFrameBufferInit -> IO VideoFrame
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/VideoFrame MDN VideoFrame. documentation>
newVideoFrameData' :: (MonadDOM m, IsAllowSharedBufferSource data') => data' -> VideoFrameBufferInit -> m VideoFrame
newVideoFrameData' data' init = liftDOM ((js_newVideoFrameData' (Types.toAllowSharedBufferSource data') (init)))
foreign import javascript safe "(($1, $2) => { return $1[\"allocationSize\"]($2); })"
js_allocationSize :: VideoFrame -> JSVal -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/allocationSize MDN VideoFrame.allocationSize documentation>
allocationSize :: (MonadDOM m) => VideoFrame -> Maybe VideoFrameCopyToOptions -> m Word
allocationSize self options = liftDOM (((P.maybe (P.return jsUndefined) toJSVal options) >>= \a2' -> js_allocationSize (self) a2'))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/allocationSize MDN VideoFrame.allocationSize documentation>
allocationSize_ :: (MonadDOM m) => VideoFrame -> Maybe VideoFrameCopyToOptions -> m ()
allocationSize_ self options = liftDOM (void (((P.maybe (P.return jsUndefined) toJSVal options) >>= \a2' -> js_allocationSize (self) a2')))
foreign import javascript safe "(($1) => { return $1[\"clone\"](); })"
js_clone :: VideoFrame -> IO VideoFrame
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/clone MDN VideoFrame.clone documentation>
clone :: (MonadDOM m) => VideoFrame -> m VideoFrame
clone self = liftDOM ((js_clone (self)))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/clone MDN VideoFrame.clone documentation>
clone_ :: (MonadDOM m) => VideoFrame -> m ()
clone_ self = liftDOM (void ((js_clone (self))))
foreign import javascript safe "(($1) => { return $1[\"close\"](); })"
js_close :: VideoFrame -> IO ()
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/close MDN VideoFrame.close documentation>
close :: (MonadDOM m) => VideoFrame -> m ()
close self = liftDOM (void ((js_close (self))))
foreign import javascript interruptible "(($1, $2, $3, $c) => { return $1[\"copyTo\"]($2, $3).then(function(s) { $c(null, s);}, function(e) { $c(e, null);}); })"
js_copyTo :: VideoFrame -> AllowSharedBufferSource -> JSVal -> IO (JSVal, JSVal)
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/copyTo MDN VideoFrame.copyTo documentation>
copyTo :: (MonadDOM m, IsAllowSharedBufferSource destination) => VideoFrame -> destination -> Maybe VideoFrameCopyToOptions -> m [PlaneLayout]
copyTo self destination options = liftDOM (((((P.maybe (P.return jsUndefined) toJSVal options) >>= \a3' -> js_copyTo (self) (Types.toAllowSharedBufferSource destination) a3') >>= checkPromiseResult) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/copyTo MDN VideoFrame.copyTo documentation>
copyTo_ :: (MonadDOM m, IsAllowSharedBufferSource destination) => VideoFrame -> destination -> Maybe VideoFrameCopyToOptions -> m ()
copyTo_ self destination options = liftDOM (void ((((P.maybe (P.return jsUndefined) toJSVal options) >>= \a3' -> js_copyTo (self) (Types.toAllowSharedBufferSource destination) a3') >>= checkPromiseResult)))
foreign import javascript unsafe "(($1) => { return $1[\"format\"]; })"
js_getFormat :: VideoFrame -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/format MDN VideoFrame.format documentation>
getFormat :: (MonadDOM m) => VideoFrame -> m (Maybe VideoPixelFormat)
getFormat self = liftDOM (((js_getFormat (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/format MDN VideoFrame.format documentation>
getFormatUnsafe :: (MonadDOM m, HasCallStack) => VideoFrame -> m VideoPixelFormat
getFormatUnsafe self = liftDOM ((((js_getFormat (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/format MDN VideoFrame.format documentation>
getFormatUnchecked :: (MonadDOM m) => VideoFrame -> m VideoPixelFormat
getFormatUnchecked self = liftDOM ((pFromJSVal <$> (js_getFormat (self))))
foreign import javascript unsafe "(($1) => { return $1[\"codedWidth\"]; })"
js_getCodedWidth :: VideoFrame -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/codedWidth MDN VideoFrame.codedWidth documentation>
getCodedWidth :: (MonadDOM m) => VideoFrame -> m Word
getCodedWidth self = liftDOM ((js_getCodedWidth (self)))
foreign import javascript unsafe "(($1) => { return $1[\"codedHeight\"]; })"
js_getCodedHeight :: VideoFrame -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/codedHeight MDN VideoFrame.codedHeight documentation>
getCodedHeight :: (MonadDOM m) => VideoFrame -> m Word
getCodedHeight self = liftDOM ((js_getCodedHeight (self)))
foreign import javascript unsafe "(($1) => { return $1[\"codedRect\"]; })"
js_getCodedRect :: VideoFrame -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/codedRect MDN VideoFrame.codedRect documentation>
getCodedRect :: (MonadDOM m) => VideoFrame -> m (Maybe DOMRectReadOnly)
getCodedRect self = liftDOM (((js_getCodedRect (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/codedRect MDN VideoFrame.codedRect documentation>
getCodedRectUnsafe :: (MonadDOM m, HasCallStack) => VideoFrame -> m DOMRectReadOnly
getCodedRectUnsafe self = liftDOM ((((js_getCodedRect (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/codedRect MDN VideoFrame.codedRect documentation>
getCodedRectUnchecked :: (MonadDOM m) => VideoFrame -> m DOMRectReadOnly
getCodedRectUnchecked self = liftDOM ((pFromJSVal <$> (js_getCodedRect (self))))
foreign import javascript unsafe "(($1) => { return $1[\"visibleRect\"]; })"
js_getVisibleRect :: VideoFrame -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/visibleRect MDN VideoFrame.visibleRect documentation>
getVisibleRect :: (MonadDOM m) => VideoFrame -> m (Maybe DOMRectReadOnly)
getVisibleRect self = liftDOM (((js_getVisibleRect (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/visibleRect MDN VideoFrame.visibleRect documentation>
getVisibleRectUnsafe :: (MonadDOM m, HasCallStack) => VideoFrame -> m DOMRectReadOnly
getVisibleRectUnsafe self = liftDOM ((((js_getVisibleRect (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/visibleRect MDN VideoFrame.visibleRect documentation>
getVisibleRectUnchecked :: (MonadDOM m) => VideoFrame -> m DOMRectReadOnly
getVisibleRectUnchecked self = liftDOM ((pFromJSVal <$> (js_getVisibleRect (self))))
foreign import javascript unsafe "(($1) => { return $1[\"displayWidth\"]; })"
js_getDisplayWidth :: VideoFrame -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/displayWidth MDN VideoFrame.displayWidth documentation>
getDisplayWidth :: (MonadDOM m) => VideoFrame -> m Word
getDisplayWidth self = liftDOM ((js_getDisplayWidth (self)))
foreign import javascript unsafe "(($1) => { return $1[\"displayHeight\"]; })"
js_getDisplayHeight :: VideoFrame -> IO Word
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/displayHeight MDN VideoFrame.displayHeight documentation>
getDisplayHeight :: (MonadDOM m) => VideoFrame -> m Word
getDisplayHeight self = liftDOM ((js_getDisplayHeight (self)))
foreign import javascript unsafe "(($1) => { return $1[\"duration\"]; })"
js_getDuration :: VideoFrame -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/duration MDN VideoFrame.duration documentation>
getDuration :: (MonadDOM m) => VideoFrame -> m (Maybe Word53)
getDuration self = liftDOM (((js_getDuration (self)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/duration MDN VideoFrame.duration documentation>
getDurationUnsafe :: (MonadDOM m, HasCallStack) => VideoFrame -> m Word53
getDurationUnsafe self = liftDOM ((((js_getDuration (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/duration MDN VideoFrame.duration documentation>
getDurationUnchecked :: (MonadDOM m) => VideoFrame -> m Word53
getDurationUnchecked self = liftDOM ((pFromJSVal <$> (js_getDuration (self))))
foreign import javascript unsafe "(($1) => { return $1[\"timestamp\"]; })"
js_getTimestamp :: VideoFrame -> IO JSVal
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/timestamp MDN VideoFrame.timestamp documentation>
getTimestamp :: (MonadDOM m) => VideoFrame -> m Int53
getTimestamp self = liftDOM (((js_getTimestamp (self)) >>= fromJSValUnchecked))
foreign import javascript unsafe "(($1) => { return $1[\"colorSpace\"]; })"
js_getColorSpace :: VideoFrame -> IO VideoColorSpace
-- | <https://developer.mozilla.org/docs/Web/API/VideoFrame/colorSpace MDN VideoFrame.colorSpace documentation>
getColorSpace :: (MonadDOM m) => VideoFrame -> m VideoColorSpace
getColorSpace self = liftDOM ((js_getColorSpace (self)))