{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Structs.Promise
(
Promise(..) ,
newZeroPromise ,
#if defined(ENABLE_OVERLOADING)
ResolvePromiseMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
PromiseExpireMethodInfo ,
#endif
promiseExpire ,
#if defined(ENABLE_OVERLOADING)
PromiseGetReplyMethodInfo ,
#endif
promiseGetReply ,
#if defined(ENABLE_OVERLOADING)
PromiseInterruptMethodInfo ,
#endif
promiseInterrupt ,
promiseNew ,
promiseNewWithChangeFunc ,
#if defined(ENABLE_OVERLOADING)
PromiseReplyMethodInfo ,
#endif
promiseReply ,
#if defined(ENABLE_OVERLOADING)
PromiseWaitMethodInfo ,
#endif
promiseWait ,
getPromiseParent ,
#if defined(ENABLE_OVERLOADING)
promise_parent ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.Gst.Callbacks as Gst.Callbacks
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Structs.MiniObject as Gst.MiniObject
import {-# SOURCE #-} qualified GI.Gst.Structs.Structure as Gst.Structure
newtype Promise = Promise (SP.ManagedPtr Promise)
deriving (Promise -> Promise -> Bool
(Promise -> Promise -> Bool)
-> (Promise -> Promise -> Bool) -> Eq Promise
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Promise -> Promise -> Bool
$c/= :: Promise -> Promise -> Bool
== :: Promise -> Promise -> Bool
$c== :: Promise -> Promise -> Bool
Eq)
instance SP.ManagedPtrNewtype Promise where
toManagedPtr :: Promise -> ManagedPtr Promise
toManagedPtr (Promise ManagedPtr Promise
p) = ManagedPtr Promise
p
foreign import ccall "gst_promise_get_type" c_gst_promise_get_type ::
IO GType
type instance O.ParentTypes Promise = '[]
instance O.HasParentTypes Promise
instance B.Types.TypedObject Promise where
glibType :: IO GType
glibType = IO GType
c_gst_promise_get_type
instance B.Types.GBoxed Promise
instance B.GValue.IsGValue (Maybe Promise) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_promise_get_type
gvalueSet_ :: Ptr GValue -> Maybe Promise -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Promise
P.Nothing = Ptr GValue -> Ptr Promise -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Promise
forall a. Ptr a
FP.nullPtr :: FP.Ptr Promise)
gvalueSet_ Ptr GValue
gv (P.Just Promise
obj) = Promise -> (Ptr Promise -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Promise
obj (Ptr GValue -> Ptr Promise -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Promise)
gvalueGet_ Ptr GValue
gv = do
Ptr Promise
ptr <- Ptr GValue -> IO (Ptr Promise)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Promise)
if Ptr Promise
ptr Ptr Promise -> Ptr Promise -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Promise
forall a. Ptr a
FP.nullPtr
then Promise -> Maybe Promise
forall a. a -> Maybe a
P.Just (Promise -> Maybe Promise) -> IO Promise -> IO (Maybe Promise)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Promise -> Promise) -> Ptr Promise -> IO Promise
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Promise -> Promise
Promise Ptr Promise
ptr
else Maybe Promise -> IO (Maybe Promise)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Promise
forall a. Maybe a
P.Nothing
newZeroPromise :: MonadIO m => m Promise
newZeroPromise :: forall (m :: * -> *). MonadIO m => m Promise
newZeroPromise = IO Promise -> m Promise
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Promise -> m Promise) -> IO Promise -> m Promise
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Promise)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
64 IO (Ptr Promise) -> (Ptr Promise -> IO Promise) -> IO Promise
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Promise -> Promise) -> Ptr Promise -> IO Promise
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Promise -> Promise
Promise
instance tag ~ 'AttrSet => Constructible Promise tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Promise -> Promise)
-> [AttrOp Promise tag] -> m Promise
new ManagedPtr Promise -> Promise
_ [AttrOp Promise tag]
attrs = do
Promise
o <- m Promise
forall (m :: * -> *). MonadIO m => m Promise
newZeroPromise
Promise -> [AttrOp Promise 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Promise
o [AttrOp Promise tag]
[AttrOp Promise 'AttrSet]
attrs
Promise -> m Promise
forall (m :: * -> *) a. Monad m => a -> m a
return Promise
o
getPromiseParent :: MonadIO m => Promise -> m Gst.MiniObject.MiniObject
getPromiseParent :: forall (m :: * -> *). MonadIO m => Promise -> m MiniObject
getPromiseParent Promise
s = IO MiniObject -> m MiniObject
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MiniObject -> m MiniObject) -> IO MiniObject -> m MiniObject
forall a b. (a -> b) -> a -> b
$ Promise -> (Ptr Promise -> IO MiniObject) -> IO MiniObject
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Promise
s ((Ptr Promise -> IO MiniObject) -> IO MiniObject)
-> (Ptr Promise -> IO MiniObject) -> IO MiniObject
forall a b. (a -> b) -> a -> b
$ \Ptr Promise
ptr -> do
let val :: Ptr MiniObject
val = Ptr Promise
ptr Ptr Promise -> Int -> Ptr MiniObject
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: (Ptr Gst.MiniObject.MiniObject)
MiniObject
val' <- ((ManagedPtr MiniObject -> MiniObject)
-> Ptr MiniObject -> IO MiniObject
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MiniObject -> MiniObject
Gst.MiniObject.MiniObject) Ptr MiniObject
val
MiniObject -> IO MiniObject
forall (m :: * -> *) a. Monad m => a -> m a
return MiniObject
val'
#if defined(ENABLE_OVERLOADING)
data PromiseParentFieldInfo
instance AttrInfo PromiseParentFieldInfo where
type AttrBaseTypeConstraint PromiseParentFieldInfo = (~) Promise
type AttrAllowedOps PromiseParentFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint PromiseParentFieldInfo = (~) (Ptr Gst.MiniObject.MiniObject)
type AttrTransferTypeConstraint PromiseParentFieldInfo = (~)(Ptr Gst.MiniObject.MiniObject)
type AttrTransferType PromiseParentFieldInfo = (Ptr Gst.MiniObject.MiniObject)
type AttrGetType PromiseParentFieldInfo = Gst.MiniObject.MiniObject
type AttrLabel PromiseParentFieldInfo = "parent"
type AttrOrigin PromiseParentFieldInfo = Promise
attrGet = getPromiseParent
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.parent"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#g:attr:parent"
})
promise_parent :: AttrLabelProxy "parent"
promise_parent = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Promise
type instance O.AttributeList Promise = PromiseAttributeList
type PromiseAttributeList = ('[ '("parent", PromiseParentFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gst_promise_new" gst_promise_new ::
IO (Ptr Promise)
promiseNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Promise
promiseNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Promise
promiseNew = IO Promise -> m Promise
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Promise -> m Promise) -> IO Promise -> m Promise
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
result <- IO (Ptr Promise)
gst_promise_new
Text -> Ptr Promise -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"promiseNew" Ptr Promise
result
Promise
result' <- ((ManagedPtr Promise -> Promise) -> Ptr Promise -> IO Promise
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Promise -> Promise
Promise) Ptr Promise
result
Promise -> IO Promise
forall (m :: * -> *) a. Monad m => a -> m a
return Promise
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gst_promise_new_with_change_func" gst_promise_new_with_change_func ::
FunPtr Gst.Callbacks.C_PromiseChangeFunc ->
Ptr () ->
FunPtr GLib.Callbacks.C_DestroyNotify ->
IO (Ptr Promise)
promiseNewWithChangeFunc ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.Callbacks.PromiseChangeFunc
-> m Promise
promiseNewWithChangeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
PromiseChangeFunc -> m Promise
promiseNewWithChangeFunc PromiseChangeFunc
func = IO Promise -> m Promise
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Promise -> m Promise) -> IO Promise -> m Promise
forall a b. (a -> b) -> a -> b
$ do
FunPtr C_PromiseChangeFunc
func' <- C_PromiseChangeFunc -> IO (FunPtr C_PromiseChangeFunc)
Gst.Callbacks.mk_PromiseChangeFunc (Maybe (Ptr (FunPtr C_PromiseChangeFunc))
-> PromiseChangeFunc_WithClosures -> C_PromiseChangeFunc
Gst.Callbacks.wrap_PromiseChangeFunc Maybe (Ptr (FunPtr C_PromiseChangeFunc))
forall a. Maybe a
Nothing (PromiseChangeFunc -> PromiseChangeFunc_WithClosures
Gst.Callbacks.drop_closures_PromiseChangeFunc PromiseChangeFunc
func))
let userData :: Ptr ()
userData = FunPtr C_PromiseChangeFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_PromiseChangeFunc
func'
let notify :: FunPtr (Ptr a -> IO ())
notify = FunPtr (Ptr a -> IO ())
forall a. FunPtr (Ptr a -> IO ())
SP.safeFreeFunPtrPtr
Ptr Promise
result <- FunPtr C_PromiseChangeFunc
-> Ptr () -> FunPtr C_DestroyNotify -> IO (Ptr Promise)
gst_promise_new_with_change_func FunPtr C_PromiseChangeFunc
func' Ptr ()
userData FunPtr C_DestroyNotify
forall a. FunPtr (Ptr a -> IO ())
notify
Text -> Ptr Promise -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"promiseNewWithChangeFunc" Ptr Promise
result
Promise
result' <- ((ManagedPtr Promise -> Promise) -> Ptr Promise -> IO Promise
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Promise -> Promise
Promise) Ptr Promise
result
Promise -> IO Promise
forall (m :: * -> *) a. Monad m => a -> m a
return Promise
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gst_promise_expire" gst_promise_expire ::
Ptr Promise ->
IO ()
promiseExpire ::
(B.CallStack.HasCallStack, MonadIO m) =>
Promise
-> m ()
promiseExpire :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Promise -> m ()
promiseExpire Promise
promise = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
promise' <- Promise -> IO (Ptr Promise)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Promise
promise
Ptr Promise -> IO ()
gst_promise_expire Ptr Promise
promise'
PromiseChangeFunc
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Promise
promise
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PromiseExpireMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod PromiseExpireMethodInfo Promise signature where
overloadedMethod = promiseExpire
instance O.OverloadedMethodInfo PromiseExpireMethodInfo Promise where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.promiseExpire",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#v:promiseExpire"
})
#endif
foreign import ccall "gst_promise_get_reply" gst_promise_get_reply ::
Ptr Promise ->
IO (Ptr Gst.Structure.Structure)
promiseGetReply ::
(B.CallStack.HasCallStack, MonadIO m) =>
Promise
-> m (Maybe Gst.Structure.Structure)
promiseGetReply :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Promise -> m (Maybe Structure)
promiseGetReply Promise
promise = IO (Maybe Structure) -> m (Maybe Structure)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Structure) -> m (Maybe Structure))
-> IO (Maybe Structure) -> m (Maybe Structure)
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
promise' <- Promise -> IO (Ptr Promise)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Promise
promise
Ptr Structure
result <- Ptr Promise -> IO (Ptr Structure)
gst_promise_get_reply Ptr Promise
promise'
Maybe Structure
maybeResult <- Ptr Structure
-> (Ptr Structure -> IO Structure) -> IO (Maybe Structure)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Structure
result ((Ptr Structure -> IO Structure) -> IO (Maybe Structure))
-> (Ptr Structure -> IO Structure) -> IO (Maybe Structure)
forall a b. (a -> b) -> a -> b
$ \Ptr Structure
result' -> do
Structure
result'' <- ((ManagedPtr Structure -> Structure)
-> Ptr Structure -> IO Structure
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Structure -> Structure
Gst.Structure.Structure) Ptr Structure
result'
Structure -> IO Structure
forall (m :: * -> *) a. Monad m => a -> m a
return Structure
result''
PromiseChangeFunc
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Promise
promise
Maybe Structure -> IO (Maybe Structure)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Structure
maybeResult
#if defined(ENABLE_OVERLOADING)
data PromiseGetReplyMethodInfo
instance (signature ~ (m (Maybe Gst.Structure.Structure)), MonadIO m) => O.OverloadedMethod PromiseGetReplyMethodInfo Promise signature where
overloadedMethod = promiseGetReply
instance O.OverloadedMethodInfo PromiseGetReplyMethodInfo Promise where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.promiseGetReply",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#v:promiseGetReply"
})
#endif
foreign import ccall "gst_promise_interrupt" gst_promise_interrupt ::
Ptr Promise ->
IO ()
promiseInterrupt ::
(B.CallStack.HasCallStack, MonadIO m) =>
Promise
-> m ()
promiseInterrupt :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Promise -> m ()
promiseInterrupt Promise
promise = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
promise' <- Promise -> IO (Ptr Promise)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Promise
promise
Ptr Promise -> IO ()
gst_promise_interrupt Ptr Promise
promise'
PromiseChangeFunc
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Promise
promise
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PromiseInterruptMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod PromiseInterruptMethodInfo Promise signature where
overloadedMethod = promiseInterrupt
instance O.OverloadedMethodInfo PromiseInterruptMethodInfo Promise where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.promiseInterrupt",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#v:promiseInterrupt"
})
#endif
foreign import ccall "gst_promise_reply" gst_promise_reply ::
Ptr Promise ->
Ptr Gst.Structure.Structure ->
IO ()
promiseReply ::
(B.CallStack.HasCallStack, MonadIO m) =>
Promise
-> Maybe (Gst.Structure.Structure)
-> m ()
promiseReply :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Promise -> Maybe Structure -> m ()
promiseReply Promise
promise Maybe Structure
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
promise' <- Promise -> IO (Ptr Promise)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Promise
promise
Ptr Structure
maybeS <- case Maybe Structure
s of
Maybe Structure
Nothing -> Ptr Structure -> IO (Ptr Structure)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Structure
forall a. Ptr a
nullPtr
Just Structure
jS -> do
Ptr Structure
jS' <- Structure -> IO (Ptr Structure)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed Structure
jS
Ptr Structure -> IO (Ptr Structure)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Structure
jS'
Ptr Promise -> Ptr Structure -> IO ()
gst_promise_reply Ptr Promise
promise' Ptr Structure
maybeS
PromiseChangeFunc
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Promise
promise
Maybe Structure -> (Structure -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Structure
s Structure -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PromiseReplyMethodInfo
instance (signature ~ (Maybe (Gst.Structure.Structure) -> m ()), MonadIO m) => O.OverloadedMethod PromiseReplyMethodInfo Promise signature where
overloadedMethod = promiseReply
instance O.OverloadedMethodInfo PromiseReplyMethodInfo Promise where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.promiseReply",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#v:promiseReply"
})
#endif
foreign import ccall "gst_promise_wait" gst_promise_wait ::
Ptr Promise ->
IO CUInt
promiseWait ::
(B.CallStack.HasCallStack, MonadIO m) =>
Promise
-> m Gst.Enums.PromiseResult
promiseWait :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Promise -> m PromiseResult
promiseWait Promise
promise = IO PromiseResult -> m PromiseResult
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PromiseResult -> m PromiseResult)
-> IO PromiseResult -> m PromiseResult
forall a b. (a -> b) -> a -> b
$ do
Ptr Promise
promise' <- Promise -> IO (Ptr Promise)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Promise
promise
CUInt
result <- Ptr Promise -> IO CUInt
gst_promise_wait Ptr Promise
promise'
let result' :: PromiseResult
result' = (Int -> PromiseResult
forall a. Enum a => Int -> a
toEnum (Int -> PromiseResult) -> (CUInt -> Int) -> CUInt -> PromiseResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
PromiseChangeFunc
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Promise
promise
PromiseResult -> IO PromiseResult
forall (m :: * -> *) a. Monad m => a -> m a
return PromiseResult
result'
#if defined(ENABLE_OVERLOADING)
data PromiseWaitMethodInfo
instance (signature ~ (m Gst.Enums.PromiseResult), MonadIO m) => O.OverloadedMethod PromiseWaitMethodInfo Promise signature where
overloadedMethod = promiseWait
instance O.OverloadedMethodInfo PromiseWaitMethodInfo Promise where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Structs.Promise.promiseWait",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Structs-Promise.html#v:promiseWait"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolvePromiseMethod (t :: Symbol) (o :: *) :: * where
ResolvePromiseMethod "expire" o = PromiseExpireMethodInfo
ResolvePromiseMethod "interrupt" o = PromiseInterruptMethodInfo
ResolvePromiseMethod "reply" o = PromiseReplyMethodInfo
ResolvePromiseMethod "wait" o = PromiseWaitMethodInfo
ResolvePromiseMethod "getReply" o = PromiseGetReplyMethodInfo
ResolvePromiseMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePromiseMethod t Promise, O.OverloadedMethod info Promise p) => OL.IsLabel t (Promise -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolvePromiseMethod t Promise, O.OverloadedMethod info Promise p, R.HasField t Promise p) => R.HasField t Promise p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolvePromiseMethod t Promise, O.OverloadedMethodInfo info Promise) => OL.IsLabel t (O.MethodProxy info Promise) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif