{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gst.Objects.SystemClock
(
SystemClock(..) ,
IsSystemClock ,
toSystemClock ,
#if defined(ENABLE_OVERLOADING)
ResolveSystemClockMethod ,
#endif
systemClockObtain ,
systemClockSetDefault ,
#if defined(ENABLE_OVERLOADING)
SystemClockClockTypePropertyInfo ,
#endif
constructSystemClockClockType ,
getSystemClockClockType ,
setSystemClockClockType ,
#if defined(ENABLE_OVERLOADING)
systemClockClockType ,
#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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Objects.Clock as Gst.Clock
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
newtype SystemClock = SystemClock (SP.ManagedPtr SystemClock)
deriving (SystemClock -> SystemClock -> Bool
(SystemClock -> SystemClock -> Bool)
-> (SystemClock -> SystemClock -> Bool) -> Eq SystemClock
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SystemClock -> SystemClock -> Bool
$c/= :: SystemClock -> SystemClock -> Bool
== :: SystemClock -> SystemClock -> Bool
$c== :: SystemClock -> SystemClock -> Bool
Eq)
instance SP.ManagedPtrNewtype SystemClock where
toManagedPtr :: SystemClock -> ManagedPtr SystemClock
toManagedPtr (SystemClock ManagedPtr SystemClock
p) = ManagedPtr SystemClock
p
foreign import ccall "gst_system_clock_get_type"
c_gst_system_clock_get_type :: IO B.Types.GType
instance B.Types.TypedObject SystemClock where
glibType :: IO GType
glibType = IO GType
c_gst_system_clock_get_type
instance B.Types.GObject SystemClock
class (SP.GObject o, O.IsDescendantOf SystemClock o) => IsSystemClock o
instance (SP.GObject o, O.IsDescendantOf SystemClock o) => IsSystemClock o
instance O.HasParentTypes SystemClock
type instance O.ParentTypes SystemClock = '[Gst.Clock.Clock, Gst.Object.Object, GObject.Object.Object]
toSystemClock :: (MIO.MonadIO m, IsSystemClock o) => o -> m SystemClock
toSystemClock :: forall (m :: * -> *) o.
(MonadIO m, IsSystemClock o) =>
o -> m SystemClock
toSystemClock = IO SystemClock -> m SystemClock
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO SystemClock -> m SystemClock)
-> (o -> IO SystemClock) -> o -> m SystemClock
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr SystemClock -> SystemClock) -> o -> IO SystemClock
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr SystemClock -> SystemClock
SystemClock
instance B.GValue.IsGValue (Maybe SystemClock) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gst_system_clock_get_type
gvalueSet_ :: Ptr GValue -> Maybe SystemClock -> IO ()
gvalueSet_ Ptr GValue
gv Maybe SystemClock
P.Nothing = Ptr GValue -> Ptr SystemClock -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr SystemClock
forall a. Ptr a
FP.nullPtr :: FP.Ptr SystemClock)
gvalueSet_ Ptr GValue
gv (P.Just SystemClock
obj) = SystemClock -> (Ptr SystemClock -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr SystemClock
obj (Ptr GValue -> Ptr SystemClock -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe SystemClock)
gvalueGet_ Ptr GValue
gv = do
Ptr SystemClock
ptr <- Ptr GValue -> IO (Ptr SystemClock)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr SystemClock)
if Ptr SystemClock
ptr Ptr SystemClock -> Ptr SystemClock -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr SystemClock
forall a. Ptr a
FP.nullPtr
then SystemClock -> Maybe SystemClock
forall a. a -> Maybe a
P.Just (SystemClock -> Maybe SystemClock)
-> IO SystemClock -> IO (Maybe SystemClock)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr SystemClock -> SystemClock)
-> Ptr SystemClock -> IO SystemClock
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr SystemClock -> SystemClock
SystemClock Ptr SystemClock
ptr
else Maybe SystemClock -> IO (Maybe SystemClock)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe SystemClock
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveSystemClockMethod (t :: Symbol) (o :: *) :: * where
ResolveSystemClockMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolveSystemClockMethod "addObservation" o = Gst.Clock.ClockAddObservationMethodInfo
ResolveSystemClockMethod "addObservationUnapplied" o = Gst.Clock.ClockAddObservationUnappliedMethodInfo
ResolveSystemClockMethod "adjustUnlocked" o = Gst.Clock.ClockAdjustUnlockedMethodInfo
ResolveSystemClockMethod "adjustWithCalibration" o = Gst.Clock.ClockAdjustWithCalibrationMethodInfo
ResolveSystemClockMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSystemClockMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSystemClockMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolveSystemClockMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSystemClockMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSystemClockMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveSystemClockMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolveSystemClockMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolveSystemClockMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolveSystemClockMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolveSystemClockMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSystemClockMethod "isSynced" o = Gst.Clock.ClockIsSyncedMethodInfo
ResolveSystemClockMethod "newPeriodicId" o = Gst.Clock.ClockNewPeriodicIdMethodInfo
ResolveSystemClockMethod "newSingleShotId" o = Gst.Clock.ClockNewSingleShotIdMethodInfo
ResolveSystemClockMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSystemClockMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSystemClockMethod "periodicIdReinit" o = Gst.Clock.ClockPeriodicIdReinitMethodInfo
ResolveSystemClockMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolveSystemClockMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSystemClockMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolveSystemClockMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSystemClockMethod "singleShotIdReinit" o = Gst.Clock.ClockSingleShotIdReinitMethodInfo
ResolveSystemClockMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSystemClockMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSystemClockMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolveSystemClockMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolveSystemClockMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSystemClockMethod "unadjustUnlocked" o = Gst.Clock.ClockUnadjustUnlockedMethodInfo
ResolveSystemClockMethod "unadjustWithCalibration" o = Gst.Clock.ClockUnadjustWithCalibrationMethodInfo
ResolveSystemClockMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolveSystemClockMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolveSystemClockMethod "waitForSync" o = Gst.Clock.ClockWaitForSyncMethodInfo
ResolveSystemClockMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSystemClockMethod "getCalibration" o = Gst.Clock.ClockGetCalibrationMethodInfo
ResolveSystemClockMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolveSystemClockMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolveSystemClockMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSystemClockMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolveSystemClockMethod "getInternalTime" o = Gst.Clock.ClockGetInternalTimeMethodInfo
ResolveSystemClockMethod "getMaster" o = Gst.Clock.ClockGetMasterMethodInfo
ResolveSystemClockMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolveSystemClockMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolveSystemClockMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolveSystemClockMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSystemClockMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSystemClockMethod "getResolution" o = Gst.Clock.ClockGetResolutionMethodInfo
ResolveSystemClockMethod "getTime" o = Gst.Clock.ClockGetTimeMethodInfo
ResolveSystemClockMethod "getTimeout" o = Gst.Clock.ClockGetTimeoutMethodInfo
ResolveSystemClockMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolveSystemClockMethod "setCalibration" o = Gst.Clock.ClockSetCalibrationMethodInfo
ResolveSystemClockMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolveSystemClockMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolveSystemClockMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolveSystemClockMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSystemClockMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveSystemClockMethod "setMaster" o = Gst.Clock.ClockSetMasterMethodInfo
ResolveSystemClockMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolveSystemClockMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolveSystemClockMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSystemClockMethod "setResolution" o = Gst.Clock.ClockSetResolutionMethodInfo
ResolveSystemClockMethod "setSynced" o = Gst.Clock.ClockSetSyncedMethodInfo
ResolveSystemClockMethod "setTimeout" o = Gst.Clock.ClockSetTimeoutMethodInfo
ResolveSystemClockMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSystemClockMethod t SystemClock, O.OverloadedMethod info SystemClock p) => OL.IsLabel t (SystemClock -> 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 ~ ResolveSystemClockMethod t SystemClock, O.OverloadedMethod info SystemClock p, R.HasField t SystemClock p) => R.HasField t SystemClock p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveSystemClockMethod t SystemClock, O.OverloadedMethodInfo info SystemClock) => OL.IsLabel t (O.MethodProxy info SystemClock) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getSystemClockClockType :: (MonadIO m, IsSystemClock o) => o -> m Gst.Enums.ClockType
getSystemClockClockType :: forall (m :: * -> *) o.
(MonadIO m, IsSystemClock o) =>
o -> m ClockType
getSystemClockClockType o
obj = IO ClockType -> m ClockType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ClockType -> m ClockType) -> IO ClockType -> m ClockType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO ClockType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"clock-type"
setSystemClockClockType :: (MonadIO m, IsSystemClock o) => o -> Gst.Enums.ClockType -> m ()
setSystemClockClockType :: forall (m :: * -> *) o.
(MonadIO m, IsSystemClock o) =>
o -> ClockType -> m ()
setSystemClockClockType o
obj ClockType
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
o -> String -> ClockType -> IO ()
forall a b.
(GObject a, Enum b, BoxedEnum b) =>
a -> String -> b -> IO ()
B.Properties.setObjectPropertyEnum o
obj String
"clock-type" ClockType
val
constructSystemClockClockType :: (IsSystemClock o, MIO.MonadIO m) => Gst.Enums.ClockType -> m (GValueConstruct o)
constructSystemClockClockType :: forall o (m :: * -> *).
(IsSystemClock o, MonadIO m) =>
ClockType -> m (GValueConstruct o)
constructSystemClockClockType ClockType
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> ClockType -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"clock-type" ClockType
val
#if defined(ENABLE_OVERLOADING)
data SystemClockClockTypePropertyInfo
instance AttrInfo SystemClockClockTypePropertyInfo where
type AttrAllowedOps SystemClockClockTypePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrBaseTypeConstraint SystemClockClockTypePropertyInfo = IsSystemClock
type AttrSetTypeConstraint SystemClockClockTypePropertyInfo = (~) Gst.Enums.ClockType
type AttrTransferTypeConstraint SystemClockClockTypePropertyInfo = (~) Gst.Enums.ClockType
type AttrTransferType SystemClockClockTypePropertyInfo = Gst.Enums.ClockType
type AttrGetType SystemClockClockTypePropertyInfo = Gst.Enums.ClockType
type AttrLabel SystemClockClockTypePropertyInfo = "clock-type"
type AttrOrigin SystemClockClockTypePropertyInfo = SystemClock
attrGet = getSystemClockClockType
attrSet = setSystemClockClockType
attrTransfer _ v = do
return v
attrConstruct = constructSystemClockClockType
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gst.Objects.SystemClock.clockType"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gst-1.0.25/docs/GI-Gst-Objects-SystemClock.html#g:attr:clockType"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList SystemClock
type instance O.AttributeList SystemClock = SystemClockAttributeList
type SystemClockAttributeList = ('[ '("clockType", SystemClockClockTypePropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("timeout", Gst.Clock.ClockTimeoutPropertyInfo), '("windowSize", Gst.Clock.ClockWindowSizePropertyInfo), '("windowThreshold", Gst.Clock.ClockWindowThresholdPropertyInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
systemClockClockType :: AttrLabelProxy "clockType"
systemClockClockType = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList SystemClock = SystemClockSignalList
type SystemClockSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("synced", Gst.Clock.ClockSyncedSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gst_system_clock_obtain" gst_system_clock_obtain ::
IO (Ptr Gst.Clock.Clock)
systemClockObtain ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Gst.Clock.Clock
systemClockObtain :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Clock
systemClockObtain = IO Clock -> m Clock
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Clock -> m Clock) -> IO Clock -> m Clock
forall a b. (a -> b) -> a -> b
$ do
Ptr Clock
result <- IO (Ptr Clock)
gst_system_clock_obtain
Text -> Ptr Clock -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"systemClockObtain" Ptr Clock
result
Clock
result' <- ((ManagedPtr Clock -> Clock) -> Ptr Clock -> IO Clock
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Clock -> Clock
Gst.Clock.Clock) Ptr Clock
result
Clock -> IO Clock
forall (m :: * -> *) a. Monad m => a -> m a
return Clock
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gst_system_clock_set_default" gst_system_clock_set_default ::
Ptr Gst.Clock.Clock ->
IO ()
systemClockSetDefault ::
(B.CallStack.HasCallStack, MonadIO m, Gst.Clock.IsClock a) =>
Maybe (a)
-> m ()
systemClockSetDefault :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsClock a) =>
Maybe a -> m ()
systemClockSetDefault Maybe a
newClock = 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 Clock
maybeNewClock <- case Maybe a
newClock of
Maybe a
Nothing -> Ptr Clock -> IO (Ptr Clock)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Clock
forall a. Ptr a
nullPtr
Just a
jNewClock -> do
Ptr Clock
jNewClock' <- a -> IO (Ptr Clock)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jNewClock
Ptr Clock -> IO (Ptr Clock)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Clock
jNewClock'
Ptr Clock -> IO ()
gst_system_clock_set_default Ptr Clock
maybeNewClock
Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
newClock a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
#endif