{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) GStreamer uses a global clock to synchronize the plugins in a pipeline. Different clock implementations are possible by implementing this abstract base class or, more conveniently, by subclassing 'GI.Gst.Objects.SystemClock.SystemClock'. The 'GI.Gst.Objects.Clock.Clock' returns a monotonically increasing time with the method 'GI.Gst.Objects.Clock.clockGetTime'. Its accuracy and base time depend on the specific clock implementation but time is always expressed in nanoseconds. Since the baseline of the clock is undefined, the clock time returned is not meaningful in itself, what matters are the deltas between two clock times. The time returned by a clock is called the absolute time. The pipeline uses the clock to calculate the running time. Usually all renderers synchronize to the global clock using the buffer timestamps, the newsegment events and the element\'s base time, see 'GI.Gst.Objects.Pipeline.Pipeline'. A clock implementation can support periodic and single shot clock notifications both synchronous and asynchronous. One first needs to create a @/GstClockID/@ for the periodic or single shot notification using 'GI.Gst.Objects.Clock.clockNewSingleShotId' or 'GI.Gst.Objects.Clock.clockNewPeriodicId'. To perform a blocking wait for the specific time of the @/GstClockID/@ use the 'GI.Gst.Objects.Clock.clockIdWait'. To receive a callback when the specific time is reached in the clock use 'GI.Gst.Objects.Clock.clockIdWaitAsync'. Both these calls can be interrupted with the 'GI.Gst.Objects.Clock.clockIdUnschedule' call. If the blocking wait is unscheduled a return value of @/GST_CLOCK_UNSCHEDULED/@ is returned. Periodic callbacks scheduled async will be repeatedly called automatically until it is unscheduled. To schedule a sync periodic callback, 'GI.Gst.Objects.Clock.clockIdWait' should be called repeatedly. The async callbacks can happen from any thread, either provided by the core or from a streaming thread. The application should be prepared for this. A @/GstClockID/@ that has been unscheduled cannot be used again for any wait operation, a new @/GstClockID/@ should be created and the old unscheduled one should be destroyed with 'GI.Gst.Objects.Clock.clockIdUnref'. It is possible to perform a blocking wait on the same @/GstClockID/@ from multiple threads. However, registering the same @/GstClockID/@ for multiple async notifications is not possible, the callback will only be called for the thread registering the entry last. None of the wait operations unref the @/GstClockID/@, the owner is responsible for unreffing the ids itself. This holds for both periodic and single shot notifications. The reason being that the owner of the @/GstClockID/@ has to keep a handle to the @/GstClockID/@ to unblock the wait on FLUSHING events or state changes and if the entry would be unreffed automatically, the handle might become invalid without any notification. These clock operations do not operate on the running time, so the callbacks will also occur when not in PLAYING state as if the clock just keeps on running. Some clocks however do not progress when the element that provided the clock is not PLAYING. When a clock has the @/GST_CLOCK_FLAG_CAN_SET_MASTER/@ flag set, it can be slaved to another 'GI.Gst.Objects.Clock.Clock' with the 'GI.Gst.Objects.Clock.clockSetMaster'. The clock will then automatically be synchronized to this master clock by repeatedly sampling the master clock and the slave clock and recalibrating the slave clock with 'GI.Gst.Objects.Clock.clockSetCalibration'. This feature is mostly useful for plugins that have an internal clock but must operate with another clock selected by the 'GI.Gst.Objects.Pipeline.Pipeline'. They can track the offset and rate difference of their internal clock relative to the master clock by using the 'GI.Gst.Objects.Clock.clockGetCalibration' function. The master\/slave synchronisation can be tuned with the 'GI.Gst.Objects.Clock.Clock':@/timeout/@, 'GI.Gst.Objects.Clock.Clock':@/window-size/@ and 'GI.Gst.Objects.Clock.Clock':@/window-threshold/@ properties. The 'GI.Gst.Objects.Clock.Clock':@/timeout/@ property defines the interval to sample the master clock and run the calibration functions. 'GI.Gst.Objects.Clock.Clock':@/window-size/@ defines the number of samples to use when calibrating and 'GI.Gst.Objects.Clock.Clock':@/window-threshold/@ defines the minimum number of samples before the calibration is performed. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Gst.Objects.Clock ( -- * Exported types Clock(..) , IsClock , toClock , noClock , -- * Methods -- ** addObservation #method:addObservation# #if ENABLE_OVERLOADING ClockAddObservationMethodInfo , #endif clockAddObservation , -- ** addObservationUnapplied #method:addObservationUnapplied# #if ENABLE_OVERLOADING ClockAddObservationUnappliedMethodInfo , #endif clockAddObservationUnapplied , -- ** adjustUnlocked #method:adjustUnlocked# #if ENABLE_OVERLOADING ClockAdjustUnlockedMethodInfo , #endif clockAdjustUnlocked , -- ** adjustWithCalibration #method:adjustWithCalibration# #if ENABLE_OVERLOADING ClockAdjustWithCalibrationMethodInfo , #endif clockAdjustWithCalibration , -- ** getCalibration #method:getCalibration# #if ENABLE_OVERLOADING ClockGetCalibrationMethodInfo , #endif clockGetCalibration , -- ** getInternalTime #method:getInternalTime# #if ENABLE_OVERLOADING ClockGetInternalTimeMethodInfo , #endif clockGetInternalTime , -- ** getMaster #method:getMaster# #if ENABLE_OVERLOADING ClockGetMasterMethodInfo , #endif clockGetMaster , -- ** getResolution #method:getResolution# #if ENABLE_OVERLOADING ClockGetResolutionMethodInfo , #endif clockGetResolution , -- ** getTime #method:getTime# #if ENABLE_OVERLOADING ClockGetTimeMethodInfo , #endif clockGetTime , -- ** getTimeout #method:getTimeout# #if ENABLE_OVERLOADING ClockGetTimeoutMethodInfo , #endif clockGetTimeout , -- ** idCompareFunc #method:idCompareFunc# clockIdCompareFunc , -- ** idGetClock #method:idGetClock# clockIdGetClock , -- ** idGetTime #method:idGetTime# clockIdGetTime , -- ** idRef #method:idRef# clockIdRef , -- ** idUnref #method:idUnref# clockIdUnref , -- ** idUnschedule #method:idUnschedule# clockIdUnschedule , -- ** idUsesClock #method:idUsesClock# clockIdUsesClock , -- ** idWait #method:idWait# clockIdWait , -- ** idWaitAsync #method:idWaitAsync# clockIdWaitAsync , -- ** isSynced #method:isSynced# #if ENABLE_OVERLOADING ClockIsSyncedMethodInfo , #endif clockIsSynced , -- ** newPeriodicId #method:newPeriodicId# #if ENABLE_OVERLOADING ClockNewPeriodicIdMethodInfo , #endif clockNewPeriodicId , -- ** newSingleShotId #method:newSingleShotId# #if ENABLE_OVERLOADING ClockNewSingleShotIdMethodInfo , #endif clockNewSingleShotId , -- ** periodicIdReinit #method:periodicIdReinit# #if ENABLE_OVERLOADING ClockPeriodicIdReinitMethodInfo , #endif clockPeriodicIdReinit , -- ** setCalibration #method:setCalibration# #if ENABLE_OVERLOADING ClockSetCalibrationMethodInfo , #endif clockSetCalibration , -- ** setMaster #method:setMaster# #if ENABLE_OVERLOADING ClockSetMasterMethodInfo , #endif clockSetMaster , -- ** setResolution #method:setResolution# #if ENABLE_OVERLOADING ClockSetResolutionMethodInfo , #endif clockSetResolution , -- ** setSynced #method:setSynced# #if ENABLE_OVERLOADING ClockSetSyncedMethodInfo , #endif clockSetSynced , -- ** setTimeout #method:setTimeout# #if ENABLE_OVERLOADING ClockSetTimeoutMethodInfo , #endif clockSetTimeout , -- ** singleShotIdReinit #method:singleShotIdReinit# #if ENABLE_OVERLOADING ClockSingleShotIdReinitMethodInfo , #endif clockSingleShotIdReinit , -- ** unadjustUnlocked #method:unadjustUnlocked# #if ENABLE_OVERLOADING ClockUnadjustUnlockedMethodInfo , #endif clockUnadjustUnlocked , -- ** unadjustWithCalibration #method:unadjustWithCalibration# #if ENABLE_OVERLOADING ClockUnadjustWithCalibrationMethodInfo , #endif clockUnadjustWithCalibration , -- ** waitForSync #method:waitForSync# #if ENABLE_OVERLOADING ClockWaitForSyncMethodInfo , #endif clockWaitForSync , -- * Properties -- ** timeout #attr:timeout# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING ClockTimeoutPropertyInfo , #endif #if ENABLE_OVERLOADING clockTimeout , #endif constructClockTimeout , getClockTimeout , setClockTimeout , -- ** windowSize #attr:windowSize# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING ClockWindowSizePropertyInfo , #endif #if ENABLE_OVERLOADING clockWindowSize , #endif constructClockWindowSize , getClockWindowSize , setClockWindowSize , -- ** windowThreshold #attr:windowThreshold# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING ClockWindowThresholdPropertyInfo , #endif #if ENABLE_OVERLOADING clockWindowThreshold , #endif constructClockWindowThreshold , getClockWindowThreshold , setClockWindowThreshold , -- * Signals -- ** synced #signal:synced# C_ClockSyncedCallback , ClockSyncedCallback , #if ENABLE_OVERLOADING ClockSyncedSignalInfo , #endif afterClockSynced , genClosure_ClockSynced , mk_ClockSyncedCallback , noClockSyncedCallback , onClockSynced , wrap_ClockSyncedCallback , ) 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.ManagedPtr as B.ManagedPtr 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.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 GI.GLib.Callbacks as GLib.Callbacks import qualified GI.GObject.Objects.Object as GObject.Object import qualified GI.Gst.Callbacks as Gst.Callbacks import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object -- | Memory-managed wrapper type. newtype Clock = Clock (ManagedPtr Clock) foreign import ccall "gst_clock_get_type" c_gst_clock_get_type :: IO GType instance GObject Clock where gobjectType = c_gst_clock_get_type -- | Type class for types which can be safely cast to `Clock`, for instance with `toClock`. class (GObject o, O.IsDescendantOf Clock o) => IsClock o instance (GObject o, O.IsDescendantOf Clock o) => IsClock o instance O.HasParentTypes Clock type instance O.ParentTypes Clock = '[Gst.Object.Object, GObject.Object.Object] -- | Cast to `Clock`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toClock :: (MonadIO m, IsClock o) => o -> m Clock toClock = liftIO . unsafeCastTo Clock -- | A convenience alias for `Nothing` :: `Maybe` `Clock`. noClock :: Maybe Clock noClock = Nothing #if ENABLE_OVERLOADING type family ResolveClockMethod (t :: Symbol) (o :: *) :: * where ResolveClockMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo ResolveClockMethod "addObservation" o = ClockAddObservationMethodInfo ResolveClockMethod "addObservationUnapplied" o = ClockAddObservationUnappliedMethodInfo ResolveClockMethod "adjustUnlocked" o = ClockAdjustUnlockedMethodInfo ResolveClockMethod "adjustWithCalibration" o = ClockAdjustWithCalibrationMethodInfo ResolveClockMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveClockMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveClockMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo ResolveClockMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveClockMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveClockMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveClockMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo ResolveClockMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo ResolveClockMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo ResolveClockMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo ResolveClockMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveClockMethod "isSynced" o = ClockIsSyncedMethodInfo ResolveClockMethod "newPeriodicId" o = ClockNewPeriodicIdMethodInfo ResolveClockMethod "newSingleShotId" o = ClockNewSingleShotIdMethodInfo ResolveClockMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveClockMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveClockMethod "periodicIdReinit" o = ClockPeriodicIdReinitMethodInfo ResolveClockMethod "ref" o = Gst.Object.ObjectRefMethodInfo ResolveClockMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveClockMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo ResolveClockMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveClockMethod "singleShotIdReinit" o = ClockSingleShotIdReinitMethodInfo ResolveClockMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveClockMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveClockMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo ResolveClockMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo ResolveClockMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveClockMethod "unadjustUnlocked" o = ClockUnadjustUnlockedMethodInfo ResolveClockMethod "unadjustWithCalibration" o = ClockUnadjustWithCalibrationMethodInfo ResolveClockMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo ResolveClockMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo ResolveClockMethod "waitForSync" o = ClockWaitForSyncMethodInfo ResolveClockMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveClockMethod "getCalibration" o = ClockGetCalibrationMethodInfo ResolveClockMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo ResolveClockMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo ResolveClockMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveClockMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo ResolveClockMethod "getInternalTime" o = ClockGetInternalTimeMethodInfo ResolveClockMethod "getMaster" o = ClockGetMasterMethodInfo ResolveClockMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo ResolveClockMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo ResolveClockMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo ResolveClockMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveClockMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveClockMethod "getResolution" o = ClockGetResolutionMethodInfo ResolveClockMethod "getTime" o = ClockGetTimeMethodInfo ResolveClockMethod "getTimeout" o = ClockGetTimeoutMethodInfo ResolveClockMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo ResolveClockMethod "setCalibration" o = ClockSetCalibrationMethodInfo ResolveClockMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo ResolveClockMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo ResolveClockMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo ResolveClockMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveClockMethod "setMaster" o = ClockSetMasterMethodInfo ResolveClockMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo ResolveClockMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo ResolveClockMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveClockMethod "setResolution" o = ClockSetResolutionMethodInfo ResolveClockMethod "setSynced" o = ClockSetSyncedMethodInfo ResolveClockMethod "setTimeout" o = ClockSetTimeoutMethodInfo ResolveClockMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveClockMethod t Clock, O.MethodInfo info Clock p) => OL.IsLabel t (Clock -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif -- signal Clock::synced {- | Signaled on clocks with GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC set once the clock is synchronized, or when it completely lost synchronization. This signal will not be emitted on clocks without the flag. This signal will be emitted from an arbitrary thread, most likely not the application\'s main thread. /Since: 1.6/ -} type ClockSyncedCallback = Bool {- ^ /@synced@/: if the clock is synced now -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `ClockSyncedCallback`@. noClockSyncedCallback :: Maybe ClockSyncedCallback noClockSyncedCallback = Nothing -- | Type for the callback on the (unwrapped) C side. type C_ClockSyncedCallback = Ptr () -> -- object CInt -> Ptr () -> -- user_data IO () -- | Generate a function pointer callable from C code, from a `C_ClockSyncedCallback`. foreign import ccall "wrapper" mk_ClockSyncedCallback :: C_ClockSyncedCallback -> IO (FunPtr C_ClockSyncedCallback) -- | Wrap the callback into a `GClosure`. genClosure_ClockSynced :: MonadIO m => ClockSyncedCallback -> m (GClosure C_ClockSyncedCallback) genClosure_ClockSynced cb = liftIO $ do let cb' = wrap_ClockSyncedCallback cb mk_ClockSyncedCallback cb' >>= B.GClosure.newGClosure -- | Wrap a `ClockSyncedCallback` into a `C_ClockSyncedCallback`. wrap_ClockSyncedCallback :: ClockSyncedCallback -> C_ClockSyncedCallback wrap_ClockSyncedCallback _cb _ synced _ = do let synced' = (/= 0) synced _cb synced' {- | Connect a signal handler for the “@synced@” signal, to be run before the default handler. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Signals.on' clock #synced callback @ -} onClockSynced :: (IsClock a, MonadIO m) => a -> ClockSyncedCallback -> m SignalHandlerId onClockSynced obj cb = liftIO $ do let cb' = wrap_ClockSyncedCallback cb cb'' <- mk_ClockSyncedCallback cb' connectSignalFunPtr obj "synced" cb'' SignalConnectBefore {- | Connect a signal handler for the “@synced@” signal, to be run after the default handler. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Signals.after' clock #synced callback @ -} afterClockSynced :: (IsClock a, MonadIO m) => a -> ClockSyncedCallback -> m SignalHandlerId afterClockSynced obj cb = liftIO $ do let cb' = wrap_ClockSyncedCallback cb cb'' <- mk_ClockSyncedCallback cb' connectSignalFunPtr obj "synced" cb'' SignalConnectAfter -- VVV Prop "timeout" -- Type: TBasicType TUInt64 -- Flags: [PropertyReadable,PropertyWritable] -- Nullable: (Just False,Just False) {- | Get the value of the “@timeout@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' clock #timeout @ -} getClockTimeout :: (MonadIO m, IsClock o) => o -> m Word64 getClockTimeout obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "timeout" {- | Set the value of the “@timeout@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' clock [ #timeout 'Data.GI.Base.Attributes.:=' value ] @ -} setClockTimeout :: (MonadIO m, IsClock o) => o -> Word64 -> m () setClockTimeout obj val = liftIO $ B.Properties.setObjectPropertyUInt64 obj "timeout" val {- | Construct a `GValueConstruct` with valid value for the “@timeout@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructClockTimeout :: (IsClock o) => Word64 -> IO (GValueConstruct o) constructClockTimeout val = B.Properties.constructObjectPropertyUInt64 "timeout" val #if ENABLE_OVERLOADING data ClockTimeoutPropertyInfo instance AttrInfo ClockTimeoutPropertyInfo where type AttrAllowedOps ClockTimeoutPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ClockTimeoutPropertyInfo = (~) Word64 type AttrBaseTypeConstraint ClockTimeoutPropertyInfo = IsClock type AttrGetType ClockTimeoutPropertyInfo = Word64 type AttrLabel ClockTimeoutPropertyInfo = "timeout" type AttrOrigin ClockTimeoutPropertyInfo = Clock attrGet _ = getClockTimeout attrSet _ = setClockTimeout attrConstruct _ = constructClockTimeout attrClear _ = undefined #endif -- VVV Prop "window-size" -- Type: TBasicType TInt -- Flags: [PropertyReadable,PropertyWritable] -- Nullable: (Nothing,Nothing) {- | Get the value of the “@window-size@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' clock #windowSize @ -} getClockWindowSize :: (MonadIO m, IsClock o) => o -> m Int32 getClockWindowSize obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "window-size" {- | Set the value of the “@window-size@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' clock [ #windowSize 'Data.GI.Base.Attributes.:=' value ] @ -} setClockWindowSize :: (MonadIO m, IsClock o) => o -> Int32 -> m () setClockWindowSize obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "window-size" val {- | Construct a `GValueConstruct` with valid value for the “@window-size@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructClockWindowSize :: (IsClock o) => Int32 -> IO (GValueConstruct o) constructClockWindowSize val = B.Properties.constructObjectPropertyInt32 "window-size" val #if ENABLE_OVERLOADING data ClockWindowSizePropertyInfo instance AttrInfo ClockWindowSizePropertyInfo where type AttrAllowedOps ClockWindowSizePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ClockWindowSizePropertyInfo = (~) Int32 type AttrBaseTypeConstraint ClockWindowSizePropertyInfo = IsClock type AttrGetType ClockWindowSizePropertyInfo = Int32 type AttrLabel ClockWindowSizePropertyInfo = "window-size" type AttrOrigin ClockWindowSizePropertyInfo = Clock attrGet _ = getClockWindowSize attrSet _ = setClockWindowSize attrConstruct _ = constructClockWindowSize attrClear _ = undefined #endif -- VVV Prop "window-threshold" -- Type: TBasicType TInt -- Flags: [PropertyReadable,PropertyWritable] -- Nullable: (Nothing,Nothing) {- | Get the value of the “@window-threshold@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' clock #windowThreshold @ -} getClockWindowThreshold :: (MonadIO m, IsClock o) => o -> m Int32 getClockWindowThreshold obj = liftIO $ B.Properties.getObjectPropertyInt32 obj "window-threshold" {- | Set the value of the “@window-threshold@” property. When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' clock [ #windowThreshold 'Data.GI.Base.Attributes.:=' value ] @ -} setClockWindowThreshold :: (MonadIO m, IsClock o) => o -> Int32 -> m () setClockWindowThreshold obj val = liftIO $ B.Properties.setObjectPropertyInt32 obj "window-threshold" val {- | Construct a `GValueConstruct` with valid value for the “@window-threshold@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructClockWindowThreshold :: (IsClock o) => Int32 -> IO (GValueConstruct o) constructClockWindowThreshold val = B.Properties.constructObjectPropertyInt32 "window-threshold" val #if ENABLE_OVERLOADING data ClockWindowThresholdPropertyInfo instance AttrInfo ClockWindowThresholdPropertyInfo where type AttrAllowedOps ClockWindowThresholdPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint ClockWindowThresholdPropertyInfo = (~) Int32 type AttrBaseTypeConstraint ClockWindowThresholdPropertyInfo = IsClock type AttrGetType ClockWindowThresholdPropertyInfo = Int32 type AttrLabel ClockWindowThresholdPropertyInfo = "window-threshold" type AttrOrigin ClockWindowThresholdPropertyInfo = Clock attrGet _ = getClockWindowThreshold attrSet _ = setClockWindowThreshold attrConstruct _ = constructClockWindowThreshold attrClear _ = undefined #endif #if ENABLE_OVERLOADING instance O.HasAttributeList Clock type instance O.AttributeList Clock = ClockAttributeList type ClockAttributeList = ('[ '("name", Gst.Object.ObjectNamePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("timeout", ClockTimeoutPropertyInfo), '("windowSize", ClockWindowSizePropertyInfo), '("windowThreshold", ClockWindowThresholdPropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING clockTimeout :: AttrLabelProxy "timeout" clockTimeout = AttrLabelProxy clockWindowSize :: AttrLabelProxy "windowSize" clockWindowSize = AttrLabelProxy clockWindowThreshold :: AttrLabelProxy "windowThreshold" clockWindowThreshold = AttrLabelProxy #endif #if ENABLE_OVERLOADING data ClockSyncedSignalInfo instance SignalInfo ClockSyncedSignalInfo where type HaskellCallbackType ClockSyncedSignalInfo = ClockSyncedCallback connectSignal _ obj cb connectMode = do let cb' = wrap_ClockSyncedCallback cb cb'' <- mk_ClockSyncedCallback cb' connectSignalFunPtr obj "synced" cb'' connectMode type instance O.SignalList Clock = ClockSignalList type ClockSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("synced", ClockSyncedSignalInfo)] :: [(Symbol, *)]) #endif -- method Clock::add_observation -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "slave", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a time on the slave", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "master", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a time on the master", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "r_squared", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_add_observation" gst_clock_add_observation :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- slave : TBasicType TUInt64 Word64 -> -- master : TBasicType TUInt64 Ptr CDouble -> -- r_squared : TBasicType TDouble IO CInt {- | The time /@master@/ of the master clock and the time /@slave@/ of the slave clock are added to the list of observations. If enough observations are available, a linear regression algorithm is run on the observations and /@clock@/ is recalibrated. If this functions returns 'True', /@rSquared@/ will contain the correlation coefficient of the interpolation. A value of 1.0 means a perfect regression was performed. This value can be used to control the sampling frequency of the master and slave clocks. -} clockAddObservation :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Word64 {- ^ /@slave@/: a time on the slave -} -> Word64 {- ^ /@master@/: a time on the master -} -> m ((Bool, Double)) {- ^ __Returns:__ 'True' if enough observations were added to run the regression algorithm. MT safe. -} clockAddObservation clock slave master = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock rSquared <- allocMem :: IO (Ptr CDouble) result <- gst_clock_add_observation clock' slave master rSquared let result' = (/= 0) result rSquared' <- peek rSquared let rSquared'' = realToFrac rSquared' touchManagedPtr clock freeMem rSquared return (result', rSquared'') #if ENABLE_OVERLOADING data ClockAddObservationMethodInfo instance (signature ~ (Word64 -> Word64 -> m ((Bool, Double))), MonadIO m, IsClock a) => O.MethodInfo ClockAddObservationMethodInfo a signature where overloadedMethod _ = clockAddObservation #endif -- method Clock::add_observation_unapplied -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "slave", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a time on the slave", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "master", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a time on the master", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "r_squared", argType = TBasicType TDouble, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer to hold the result", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "internal", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "external", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the external time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate_num", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the rate numerator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate_denom", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the rate denominator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_add_observation_unapplied" gst_clock_add_observation_unapplied :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- slave : TBasicType TUInt64 Word64 -> -- master : TBasicType TUInt64 Ptr CDouble -> -- r_squared : TBasicType TDouble Ptr Word64 -> -- internal : TBasicType TUInt64 Ptr Word64 -> -- external : TBasicType TUInt64 Ptr Word64 -> -- rate_num : TBasicType TUInt64 Ptr Word64 -> -- rate_denom : TBasicType TUInt64 IO CInt {- | Add a clock observation to the internal slaving algorithm the same as 'GI.Gst.Objects.Clock.clockAddObservation', and return the result of the master clock estimation, without updating the internal calibration. The caller can then take the results and call 'GI.Gst.Objects.Clock.clockSetCalibration' with the values, or some modified version of them. /Since: 1.6/ -} clockAddObservationUnapplied :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Word64 {- ^ /@slave@/: a time on the slave -} -> Word64 {- ^ /@master@/: a time on the master -} -> m ((Bool, Double, Word64, Word64, Word64, Word64)) clockAddObservationUnapplied clock slave master = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock rSquared <- allocMem :: IO (Ptr CDouble) internal <- allocMem :: IO (Ptr Word64) external <- allocMem :: IO (Ptr Word64) rateNum <- allocMem :: IO (Ptr Word64) rateDenom <- allocMem :: IO (Ptr Word64) result <- gst_clock_add_observation_unapplied clock' slave master rSquared internal external rateNum rateDenom let result' = (/= 0) result rSquared' <- peek rSquared let rSquared'' = realToFrac rSquared' internal' <- peek internal external' <- peek external rateNum' <- peek rateNum rateDenom' <- peek rateDenom touchManagedPtr clock freeMem rSquared freeMem internal freeMem external freeMem rateNum freeMem rateDenom return (result', rSquared'', internal', external', rateNum', rateDenom') #if ENABLE_OVERLOADING data ClockAddObservationUnappliedMethodInfo instance (signature ~ (Word64 -> Word64 -> m ((Bool, Double, Word64, Word64, Word64, Word64))), MonadIO m, IsClock a) => O.MethodInfo ClockAddObservationUnappliedMethodInfo a signature where overloadedMethod _ = clockAddObservationUnapplied #endif -- method Clock::adjust_unlocked -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "internal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_adjust_unlocked" gst_clock_adjust_unlocked :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- internal : TBasicType TUInt64 IO Word64 {- | Converts the given /@internal@/ clock time to the external time, adjusting for the rate and reference time set with 'GI.Gst.Objects.Clock.clockSetCalibration' and making sure that the returned time is increasing. This function should be called with the clock\'s OBJECT_LOCK held and is mainly used by clock subclasses. This function is the reverse of 'GI.Gst.Objects.Clock.clockUnadjustUnlocked'. -} clockAdjustUnlocked :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to use -} -> Word64 {- ^ /@internal@/: a clock time -} -> m Word64 {- ^ __Returns:__ the converted time of the clock. -} clockAdjustUnlocked clock internal = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_adjust_unlocked clock' internal touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockAdjustUnlockedMethodInfo instance (signature ~ (Word64 -> m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockAdjustUnlockedMethodInfo a signature where overloadedMethod _ = clockAdjustUnlocked #endif -- method Clock::adjust_with_calibration -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "internal_target", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cinternal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cexternal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference external time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cnum", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the rate of the clock relative to its\n internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cdenom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the rate of the clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_adjust_with_calibration" gst_clock_adjust_with_calibration :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- internal_target : TBasicType TUInt64 Word64 -> -- cinternal : TBasicType TUInt64 Word64 -> -- cexternal : TBasicType TUInt64 Word64 -> -- cnum : TBasicType TUInt64 Word64 -> -- cdenom : TBasicType TUInt64 IO Word64 {- | Converts the given /@internalTarget@/ clock time to the external time, using the passed calibration parameters. This function performs the same calculation as 'GI.Gst.Objects.Clock.clockAdjustUnlocked' when called using the current calibration parameters, but doesn\'t ensure a monotonically increasing result as 'GI.Gst.Objects.Clock.clockAdjustUnlocked' does. Note: The /@clock@/ parameter is unused and can be NULL /Since: 1.6/ -} clockAdjustWithCalibration :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to use -} -> Word64 {- ^ /@internalTarget@/: a clock time -} -> Word64 {- ^ /@cinternal@/: a reference internal time -} -> Word64 {- ^ /@cexternal@/: a reference external time -} -> Word64 {- ^ /@cnum@/: the numerator of the rate of the clock relative to its internal time -} -> Word64 {- ^ /@cdenom@/: the denominator of the rate of the clock -} -> m Word64 {- ^ __Returns:__ the converted time of the clock. -} clockAdjustWithCalibration clock internalTarget cinternal cexternal cnum cdenom = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_adjust_with_calibration clock' internalTarget cinternal cexternal cnum cdenom touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockAdjustWithCalibrationMethodInfo instance (signature ~ (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockAdjustWithCalibrationMethodInfo a signature where overloadedMethod _ = clockAdjustWithCalibration #endif -- method Clock::get_calibration -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "internal", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "external", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the external time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate_num", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the rate numerator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "rate_denom", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a location to store the rate denominator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_calibration" gst_clock_get_calibration :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Ptr Word64 -> -- internal : TBasicType TUInt64 Ptr Word64 -> -- external : TBasicType TUInt64 Ptr Word64 -> -- rate_num : TBasicType TUInt64 Ptr Word64 -> -- rate_denom : TBasicType TUInt64 IO () {- | Gets the internal rate and reference time of /@clock@/. See 'GI.Gst.Objects.Clock.clockSetCalibration' for more information. /@internal@/, /@external@/, /@rateNum@/, and /@rateDenom@/ can be left 'Nothing' if the caller is not interested in the values. MT safe. -} clockGetCalibration :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> m ((Word64, Word64, Word64, Word64)) clockGetCalibration clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock internal <- allocMem :: IO (Ptr Word64) external <- allocMem :: IO (Ptr Word64) rateNum <- allocMem :: IO (Ptr Word64) rateDenom <- allocMem :: IO (Ptr Word64) gst_clock_get_calibration clock' internal external rateNum rateDenom internal' <- peek internal external' <- peek external rateNum' <- peek rateNum rateDenom' <- peek rateDenom touchManagedPtr clock freeMem internal freeMem external freeMem rateNum freeMem rateDenom return (internal', external', rateNum', rateDenom') #if ENABLE_OVERLOADING data ClockGetCalibrationMethodInfo instance (signature ~ (m ((Word64, Word64, Word64, Word64))), MonadIO m, IsClock a) => O.MethodInfo ClockGetCalibrationMethodInfo a signature where overloadedMethod _ = clockGetCalibration #endif -- method Clock::get_internal_time -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_internal_time" gst_clock_get_internal_time :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO Word64 {- | Gets the current internal time of the given clock. The time is returned unadjusted for the offset and the rate. -} clockGetInternalTime :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to query -} -> m Word64 {- ^ __Returns:__ the internal time of the clock. Or GST_CLOCK_TIME_NONE when given invalid input. MT safe. -} clockGetInternalTime clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_get_internal_time clock' touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockGetInternalTimeMethodInfo instance (signature ~ (m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockGetInternalTimeMethodInfo a signature where overloadedMethod _ = clockGetInternalTime #endif -- method Clock::get_master -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gst", name = "Clock"})) -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_master" gst_clock_get_master :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO (Ptr Clock) {- | Get the master clock that /@clock@/ is slaved to or 'Nothing' when the clock is not slaved to any master clock. -} clockGetMaster :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> m (Maybe Clock) {- ^ __Returns:__ a master 'GI.Gst.Objects.Clock.Clock' or 'Nothing' when this clock is not slaved to a master clock. Unref after usage. MT safe. -} clockGetMaster clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_get_master clock' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (wrapObject Clock) result' return result'' touchManagedPtr clock return maybeResult #if ENABLE_OVERLOADING data ClockGetMasterMethodInfo instance (signature ~ (m (Maybe Clock)), MonadIO m, IsClock a) => O.MethodInfo ClockGetMasterMethodInfo a signature where overloadedMethod _ = clockGetMaster #endif -- method Clock::get_resolution -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_resolution" gst_clock_get_resolution :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO Word64 {- | Get the accuracy of the clock. The accuracy of the clock is the granularity of the values returned by 'GI.Gst.Objects.Clock.clockGetTime'. -} clockGetResolution :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> m Word64 {- ^ __Returns:__ the resolution of the clock in units of @/GstClockTime/@. MT safe. -} clockGetResolution clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_get_resolution clock' touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockGetResolutionMethodInfo instance (signature ~ (m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockGetResolutionMethodInfo a signature where overloadedMethod _ = clockGetResolution #endif -- method Clock::get_time -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_time" gst_clock_get_time :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO Word64 {- | Gets the current time of the given clock. The time is always monotonically increasing and adjusted according to the current offset and rate. -} clockGetTime :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to query -} -> m Word64 {- ^ __Returns:__ the time of the clock. Or GST_CLOCK_TIME_NONE when given invalid input. MT safe. -} clockGetTime clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_get_time clock' touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockGetTimeMethodInfo instance (signature ~ (m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockGetTimeMethodInfo a signature where overloadedMethod _ = clockGetTime #endif -- method Clock::get_timeout -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_get_timeout" gst_clock_get_timeout :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO Word64 {- | Get the amount of time that master and slave clocks are sampled. -} clockGetTimeout :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> m Word64 {- ^ __Returns:__ the interval between samples. -} clockGetTimeout clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_get_timeout clock' touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockGetTimeoutMethodInfo instance (signature ~ (m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockGetTimeoutMethodInfo a signature where overloadedMethod _ = clockGetTimeout #endif -- method Clock::is_synced -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_is_synced" gst_clock_is_synced :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO CInt {- | Checks if the clock is currently synced. This returns if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is not set on the clock. /Since: 1.6/ -} clockIsSynced :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a GstClock -} -> m Bool {- ^ __Returns:__ 'True' if the clock is currently synced -} clockIsSynced clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_is_synced clock' let result' = (/= 0) result touchManagedPtr clock return result' #if ENABLE_OVERLOADING data ClockIsSyncedMethodInfo instance (signature ~ (m Bool), MonadIO m, IsClock a) => O.MethodInfo ClockIsSyncedMethodInfo a signature where overloadedMethod _ = clockIsSynced #endif -- method Clock::new_periodic_id -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to get a periodic notification id from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested start time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested interval", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "gst_clock_new_periodic_id" gst_clock_new_periodic_id :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- start_time : TBasicType TUInt64 Word64 -> -- interval : TBasicType TUInt64 IO (Ptr ()) {- | Get an ID from /@clock@/ to trigger a periodic notification. The periodic notifications will start at time /@startTime@/ and will then be fired with the given /@interval@/. /@id@/ should be unreffed after usage. Free-function: gst_clock_id_unref -} clockNewPeriodicId :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: The @/GstClockID/@ to get a periodic notification id from -} -> Word64 {- ^ /@startTime@/: the requested start time -} -> Word64 {- ^ /@interval@/: the requested interval -} -> m (Ptr ()) {- ^ __Returns:__ a @/GstClockID/@ that can be used to request the time notification. MT safe. -} clockNewPeriodicId clock startTime interval = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_new_periodic_id clock' startTime interval touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockNewPeriodicIdMethodInfo instance (signature ~ (Word64 -> Word64 -> m (Ptr ())), MonadIO m, IsClock a) => O.MethodInfo ClockNewPeriodicIdMethodInfo a signature where overloadedMethod _ = clockNewPeriodicId #endif -- method Clock::new_single_shot_id -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to get a single shot notification from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "gst_clock_new_single_shot_id" gst_clock_new_single_shot_id :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- time : TBasicType TUInt64 IO (Ptr ()) {- | Get a @/GstClockID/@ from /@clock@/ to trigger a single shot notification at the requested time. The single shot id should be unreffed after usage. Free-function: gst_clock_id_unref -} clockNewSingleShotId :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: The @/GstClockID/@ to get a single shot notification from -} -> Word64 {- ^ /@time@/: the requested time -} -> m (Ptr ()) {- ^ __Returns:__ a @/GstClockID/@ that can be used to request the time notification. MT safe. -} clockNewSingleShotId clock time = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_new_single_shot_id clock' time touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockNewSingleShotIdMethodInfo instance (signature ~ (Word64 -> m (Ptr ())), MonadIO m, IsClock a) => O.MethodInfo ClockNewSingleShotIdMethodInfo a signature where overloadedMethod _ = clockNewSingleShotId #endif -- method Clock::periodic_id_reinit -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockID", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start_time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested start time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the requested interval", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_periodic_id_reinit" gst_clock_periodic_id_reinit :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Ptr () -> -- id : TBasicType TPtr Word64 -> -- start_time : TBasicType TUInt64 Word64 -> -- interval : TBasicType TUInt64 IO CInt {- | Reinitializes the provided periodic /@id@/ to the provided start time and interval. Does not modify the reference count. -} clockPeriodicIdReinit :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Ptr () {- ^ /@id@/: a @/GstClockID/@ -} -> Word64 {- ^ /@startTime@/: the requested start time -} -> Word64 {- ^ /@interval@/: the requested interval -} -> m Bool {- ^ __Returns:__ 'True' if the GstClockID could be reinitialized to the provided /@time@/, else 'False'. -} clockPeriodicIdReinit clock id startTime interval = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_periodic_id_reinit clock' id startTime interval let result' = (/= 0) result touchManagedPtr clock return result' #if ENABLE_OVERLOADING data ClockPeriodicIdReinitMethodInfo instance (signature ~ (Ptr () -> Word64 -> Word64 -> m Bool), MonadIO m, IsClock a) => O.MethodInfo ClockPeriodicIdReinitMethodInfo a signature where overloadedMethod _ = clockPeriodicIdReinit #endif -- method Clock::set_calibration -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to calibrate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "internal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "external", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference external time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rate_num", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the rate of the clock relative to its\n internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rate_denom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the rate of the clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_set_calibration" gst_clock_set_calibration :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- internal : TBasicType TUInt64 Word64 -> -- external : TBasicType TUInt64 Word64 -> -- rate_num : TBasicType TUInt64 Word64 -> -- rate_denom : TBasicType TUInt64 IO () {- | Adjusts the rate and time of /@clock@/. A rate of 1\/1 is the normal speed of the clock. Values bigger than 1\/1 make the clock go faster. /@internal@/ and /@external@/ are calibration parameters that arrange that 'GI.Gst.Objects.Clock.clockGetTime' should have been /@external@/ at internal time /@internal@/. This internal time should not be in the future; that is, it should be less than the value of 'GI.Gst.Objects.Clock.clockGetInternalTime' when this function is called. Subsequent calls to 'GI.Gst.Objects.Clock.clockGetTime' will return clock times computed as follows: > > time = (internal_time - internal) * rate_num / rate_denom + external This formula is implemented in 'GI.Gst.Objects.Clock.clockAdjustUnlocked'. Of course, it tries to do the integer arithmetic as precisely as possible. Note that 'GI.Gst.Objects.Clock.clockGetTime' always returns increasing values so when you move the clock backwards, 'GI.Gst.Objects.Clock.clockGetTime' will report the previous value until the clock catches up. MT safe. -} clockSetCalibration :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to calibrate -} -> Word64 {- ^ /@internal@/: a reference internal time -} -> Word64 {- ^ /@external@/: a reference external time -} -> Word64 {- ^ /@rateNum@/: the numerator of the rate of the clock relative to its internal time -} -> Word64 {- ^ /@rateDenom@/: the denominator of the rate of the clock -} -> m () clockSetCalibration clock internal external rateNum rateDenom = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock gst_clock_set_calibration clock' internal external rateNum rateDenom touchManagedPtr clock return () #if ENABLE_OVERLOADING data ClockSetCalibrationMethodInfo instance (signature ~ (Word64 -> Word64 -> Word64 -> Word64 -> m ()), MonadIO m, IsClock a) => O.MethodInfo ClockSetCalibrationMethodInfo a signature where overloadedMethod _ = clockSetCalibration #endif -- method Clock::set_master -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "master", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a master #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_set_master" gst_clock_set_master :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Ptr Clock -> -- master : TInterface (Name {namespace = "Gst", name = "Clock"}) IO CInt {- | Set /@master@/ as the master clock for /@clock@/. /@clock@/ will be automatically calibrated so that 'GI.Gst.Objects.Clock.clockGetTime' reports the same time as the master clock. A clock provider that slaves its clock to a master can get the current calibration values with 'GI.Gst.Objects.Clock.clockGetCalibration'. /@master@/ can be 'Nothing' in which case /@clock@/ will not be slaved anymore. It will however keep reporting its time adjusted with the last configured rate and time offsets. -} clockSetMaster :: (B.CallStack.HasCallStack, MonadIO m, IsClock a, IsClock b) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Maybe (b) {- ^ /@master@/: a master 'GI.Gst.Objects.Clock.Clock' -} -> m Bool {- ^ __Returns:__ 'True' if the clock is capable of being slaved to a master clock. Trying to set a master on a clock without the @/GST_CLOCK_FLAG_CAN_SET_MASTER/@ flag will make this function return 'False'. MT safe. -} clockSetMaster clock master = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock maybeMaster <- case master of Nothing -> return nullPtr Just jMaster -> do jMaster' <- unsafeManagedPtrCastPtr jMaster return jMaster' result <- gst_clock_set_master clock' maybeMaster let result' = (/= 0) result touchManagedPtr clock whenJust master touchManagedPtr return result' #if ENABLE_OVERLOADING data ClockSetMasterMethodInfo instance (signature ~ (Maybe (b) -> m Bool), MonadIO m, IsClock a, IsClock b) => O.MethodInfo ClockSetMasterMethodInfo a signature where overloadedMethod _ = clockSetMaster #endif -- method Clock::set_resolution -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resolution", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The resolution to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_set_resolution" gst_clock_set_resolution :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- resolution : TBasicType TUInt64 IO Word64 {- | Set the accuracy of the clock. Some clocks have the possibility to operate with different accuracy at the expense of more resource usage. There is normally no need to change the default resolution of a clock. The resolution of a clock can only be changed if the clock has the @/GST_CLOCK_FLAG_CAN_SET_RESOLUTION/@ flag set. -} clockSetResolution :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Word64 {- ^ /@resolution@/: The resolution to set -} -> m Word64 {- ^ __Returns:__ the new resolution of the clock. -} clockSetResolution clock resolution = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_set_resolution clock' resolution touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockSetResolutionMethodInfo instance (signature ~ (Word64 -> m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockSetResolutionMethodInfo a signature where overloadedMethod _ = clockSetResolution #endif -- method Clock::set_synced -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "synced", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if the clock is synced", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_set_synced" gst_clock_set_synced :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) CInt -> -- synced : TBasicType TBoolean IO () {- | Sets /@clock@/ to synced and emits the GstClock::synced signal, and wakes up any thread waiting in 'GI.Gst.Objects.Clock.clockWaitForSync'. This function must only be called if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is set on the clock, and is intended to be called by subclasses only. /Since: 1.6/ -} clockSetSynced :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a GstClock -} -> Bool {- ^ /@synced@/: if the clock is synced -} -> m () clockSetSynced clock synced = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock let synced' = (fromIntegral . fromEnum) synced gst_clock_set_synced clock' synced' touchManagedPtr clock return () #if ENABLE_OVERLOADING data ClockSetSyncedMethodInfo instance (signature ~ (Bool -> m ()), MonadIO m, IsClock a) => O.MethodInfo ClockSetSyncedMethodInfo a signature where overloadedMethod _ = clockSetSynced #endif -- method Clock::set_timeout -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a timeout", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_set_timeout" gst_clock_set_timeout :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- timeout : TBasicType TUInt64 IO () {- | Set the amount of time, in nanoseconds, to sample master and slave clocks -} clockSetTimeout :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Word64 {- ^ /@timeout@/: a timeout -} -> m () clockSetTimeout clock timeout = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock gst_clock_set_timeout clock' timeout touchManagedPtr clock return () #if ENABLE_OVERLOADING data ClockSetTimeoutMethodInfo instance (signature ~ (Word64 -> m ()), MonadIO m, IsClock a) => O.MethodInfo ClockSetTimeoutMethodInfo a signature where overloadedMethod _ = clockSetTimeout #endif -- method Clock::single_shot_id_reinit -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockID", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The requested time.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_single_shot_id_reinit" gst_clock_single_shot_id_reinit :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Ptr () -> -- id : TBasicType TPtr Word64 -> -- time : TBasicType TUInt64 IO CInt {- | Reinitializes the provided single shot /@id@/ to the provided time. Does not modify the reference count. -} clockSingleShotIdReinit :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' -} -> Ptr () {- ^ /@id@/: a @/GstClockID/@ -} -> Word64 {- ^ /@time@/: The requested time. -} -> m Bool {- ^ __Returns:__ 'True' if the GstClockID could be reinitialized to the provided /@time@/, else 'False'. -} clockSingleShotIdReinit clock id time = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_single_shot_id_reinit clock' id time let result' = (/= 0) result touchManagedPtr clock return result' #if ENABLE_OVERLOADING data ClockSingleShotIdReinitMethodInfo instance (signature ~ (Ptr () -> Word64 -> m Bool), MonadIO m, IsClock a) => O.MethodInfo ClockSingleShotIdReinitMethodInfo a signature where overloadedMethod _ = clockSingleShotIdReinit #endif -- method Clock::unadjust_unlocked -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "external", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an external clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_unadjust_unlocked" gst_clock_unadjust_unlocked :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- external : TBasicType TUInt64 IO Word64 {- | Converts the given /@external@/ clock time to the internal time of /@clock@/, using the rate and reference time set with 'GI.Gst.Objects.Clock.clockSetCalibration'. This function should be called with the clock\'s OBJECT_LOCK held and is mainly used by clock subclasses. This function is the reverse of 'GI.Gst.Objects.Clock.clockAdjustUnlocked'. -} clockUnadjustUnlocked :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to use -} -> Word64 {- ^ /@external@/: an external clock time -} -> m Word64 {- ^ __Returns:__ the internal time of the clock corresponding to /@external@/. -} clockUnadjustUnlocked clock external = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_unadjust_unlocked clock' external touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockUnadjustUnlockedMethodInfo instance (signature ~ (Word64 -> m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockUnadjustUnlockedMethodInfo a signature where overloadedMethod _ = clockUnadjustUnlocked #endif -- method Clock::unadjust_with_calibration -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "external_target", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cinternal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cexternal", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a reference external time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cnum", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the numerator of the rate of the clock relative to its\n internal time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "cdenom", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the denominator of the rate of the clock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_unadjust_with_calibration" gst_clock_unadjust_with_calibration :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- external_target : TBasicType TUInt64 Word64 -> -- cinternal : TBasicType TUInt64 Word64 -> -- cexternal : TBasicType TUInt64 Word64 -> -- cnum : TBasicType TUInt64 Word64 -> -- cdenom : TBasicType TUInt64 IO Word64 {- | Converts the given /@externalTarget@/ clock time to the internal time, using the passed calibration parameters. This function performs the same calculation as 'GI.Gst.Objects.Clock.clockUnadjustUnlocked' when called using the current calibration parameters. Note: The /@clock@/ parameter is unused and can be NULL /Since: 1.8/ -} clockUnadjustWithCalibration :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to use -} -> Word64 {- ^ /@externalTarget@/: a clock time -} -> Word64 {- ^ /@cinternal@/: a reference internal time -} -> Word64 {- ^ /@cexternal@/: a reference external time -} -> Word64 {- ^ /@cnum@/: the numerator of the rate of the clock relative to its internal time -} -> Word64 {- ^ /@cdenom@/: the denominator of the rate of the clock -} -> m Word64 {- ^ __Returns:__ the converted time of the clock. -} clockUnadjustWithCalibration clock externalTarget cinternal cexternal cnum cdenom = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_unadjust_with_calibration clock' externalTarget cinternal cexternal cnum cdenom touchManagedPtr clock return result #if ENABLE_OVERLOADING data ClockUnadjustWithCalibrationMethodInfo instance (signature ~ (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> m Word64), MonadIO m, IsClock a) => O.MethodInfo ClockUnadjustWithCalibrationMethodInfo a signature where overloadedMethod _ = clockUnadjustWithCalibration #endif -- method Clock::wait_for_sync -- method type : OrdinaryMethod -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GstClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeout", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "timeout for waiting or %GST_CLOCK_TIME_NONE", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_wait_for_sync" gst_clock_wait_for_sync :: Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) Word64 -> -- timeout : TBasicType TUInt64 IO CInt {- | Waits until /@clock@/ is synced for reporting the current time. If /@timeout@/ is 'GI.Gst.Constants.CLOCK_TIME_NONE' it will wait forever, otherwise it will time out after /@timeout@/ nanoseconds. For asynchronous waiting, the GstClock::synced signal can be used. This returns immediately with TRUE if GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC is not set on the clock, or if the clock is already synced. /Since: 1.6/ -} clockWaitForSync :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => a {- ^ /@clock@/: a GstClock -} -> Word64 {- ^ /@timeout@/: timeout for waiting or 'GI.Gst.Constants.CLOCK_TIME_NONE' -} -> m Bool {- ^ __Returns:__ 'True' if waiting was successful, or 'False' on timeout -} clockWaitForSync clock timeout = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_wait_for_sync clock' timeout let result' = (/= 0) result touchManagedPtr clock return result' #if ENABLE_OVERLOADING data ClockWaitForSyncMethodInfo instance (signature ~ (Word64 -> m Bool), MonadIO m, IsClock a) => O.MethodInfo ClockWaitForSyncMethodInfo a signature where overloadedMethod _ = clockWaitForSync #endif -- method Clock::id_compare_func -- method type : MemberFunction -- Args : [Arg {argCName = "id1", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GstClockID", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id2", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #GstClockID to compare with", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_compare_func" gst_clock_id_compare_func :: Ptr () -> -- id1 : TBasicType TPtr Ptr () -> -- id2 : TBasicType TPtr IO Int32 {- | Compares the two @/GstClockID/@ instances. This function can be used as a GCompareFunc when sorting ids. -} clockIdCompareFunc :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id1@/: A @/GstClockID/@ -} -> Ptr () {- ^ /@id2@/: A @/GstClockID/@ to compare with -} -> m Int32 {- ^ __Returns:__ negative value if a \< b; zero if a = b; positive value if a > b MT safe. -} clockIdCompareFunc id1 id2 = liftIO $ do result <- gst_clock_id_compare_func id1 id2 return result #if ENABLE_OVERLOADING #endif -- method Clock::id_get_clock -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockID", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gst", name = "Clock"})) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_get_clock" gst_clock_id_get_clock :: Ptr () -> -- id : TBasicType TPtr IO (Ptr Clock) {- | This function returns the underlying clock. /Since: 1.16/ -} clockIdGetClock :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: a @/GstClockID/@ -} -> m (Maybe Clock) {- ^ __Returns:__ a 'GI.Gst.Objects.Clock.Clock' or 'Nothing' when the underlying clock has been freed. Unref after usage. MT safe. -} clockIdGetClock id = liftIO $ do result <- gst_clock_id_get_clock id maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (wrapObject Clock) result' return result'' return maybeResult #if ENABLE_OVERLOADING #endif -- method Clock::id_get_time -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to query", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_get_time" gst_clock_id_get_time :: Ptr () -> -- id : TBasicType TPtr IO Word64 {- | Get the time of the clock ID -} clockIdGetTime :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: The @/GstClockID/@ to query -} -> m Word64 {- ^ __Returns:__ the time of the given clock id. MT safe. -} clockIdGetTime id = liftIO $ do result <- gst_clock_id_get_time id return result #if ENABLE_OVERLOADING #endif -- method Clock::id_ref -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to ref", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TPtr) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_ref" gst_clock_id_ref :: Ptr () -> -- id : TBasicType TPtr IO (Ptr ()) {- | Increase the refcount of given /@id@/. -} clockIdRef :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: The @/GstClockID/@ to ref -} -> m (Ptr ()) {- ^ __Returns:__ The same @/GstClockID/@ with increased refcount. MT safe. -} clockIdRef id = liftIO $ do result <- gst_clock_id_ref id return result #if ENABLE_OVERLOADING #endif -- method Clock::id_unref -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to unref", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_unref" gst_clock_id_unref :: Ptr () -> -- id : TBasicType TPtr IO () {- | Unref given /@id@/. When the refcount reaches 0 the @/GstClockID/@ will be freed. MT safe. -} clockIdUnref :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: The @/GstClockID/@ to unref -} -> m () clockIdUnref id = liftIO $ do gst_clock_id_unref id return () #if ENABLE_OVERLOADING #endif -- method Clock::id_unschedule -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The id to unschedule", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_unschedule" gst_clock_id_unschedule :: Ptr () -> -- id : TBasicType TPtr IO () {- | Cancel an outstanding request with /@id@/. This can either be an outstanding async notification or a pending sync notification. After this call, /@id@/ cannot be used anymore to receive sync or async notifications, you need to create a new @/GstClockID/@. MT safe. -} clockIdUnschedule :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: The id to unschedule -} -> m () clockIdUnschedule id = liftIO $ do gst_clock_id_unschedule id return () #if ENABLE_OVERLOADING #endif -- method Clock::id_uses_clock -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockID to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClock to compare against", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_uses_clock" gst_clock_id_uses_clock :: Ptr () -> -- id : TBasicType TPtr Ptr Clock -> -- clock : TInterface (Name {namespace = "Gst", name = "Clock"}) IO CInt {- | This function returns whether /@id@/ uses /@clock@/ as the underlying clock. /@clock@/ can be NULL, in which case the return value indicates whether the underlying clock has been freed. If this is the case, the /@id@/ is no longer usable and should be freed. /Since: 1.16/ -} clockIdUsesClock :: (B.CallStack.HasCallStack, MonadIO m, IsClock a) => Ptr () {- ^ /@id@/: a @/GstClockID/@ to check -} -> a {- ^ /@clock@/: a 'GI.Gst.Objects.Clock.Clock' to compare against -} -> m Bool {- ^ __Returns:__ whether the clock /@id@/ uses the same underlying 'GI.Gst.Objects.Clock.Clock' /@clock@/. MT safe. -} clockIdUsesClock id clock = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- gst_clock_id_uses_clock id clock' let result' = (/= 0) result touchManagedPtr clock return result' #if ENABLE_OVERLOADING #endif -- method Clock::id_wait -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GstClockID to wait on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "jitter", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pointer that will contain the jitter,\n can be %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gst", name = "ClockReturn"})) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_wait" gst_clock_id_wait :: Ptr () -> -- id : TBasicType TPtr Ptr Int64 -> -- jitter : TBasicType TInt64 IO CUInt {- | Perform a blocking wait on /@id@/. /@id@/ should have been created with 'GI.Gst.Objects.Clock.clockNewSingleShotId' or 'GI.Gst.Objects.Clock.clockNewPeriodicId' and should not have been unscheduled with a call to 'GI.Gst.Objects.Clock.clockIdUnschedule'. If the /@jitter@/ argument is not 'Nothing' and this function returns @/GST_CLOCK_OK/@ or @/GST_CLOCK_EARLY/@, it will contain the difference against the clock and the time of /@id@/ when this method was called. Positive values indicate how late /@id@/ was relative to the clock (in which case this function will return @/GST_CLOCK_EARLY/@). Negative values indicate how much time was spent waiting on the clock before this function returned. -} clockIdWait :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: The @/GstClockID/@ to wait on -} -> m ((Gst.Enums.ClockReturn, Int64)) {- ^ __Returns:__ the result of the blocking wait. @/GST_CLOCK_EARLY/@ will be returned if the current clock time is past the time of /@id@/, @/GST_CLOCK_OK/@ if /@id@/ was scheduled in time. @/GST_CLOCK_UNSCHEDULED/@ if /@id@/ was unscheduled with 'GI.Gst.Objects.Clock.clockIdUnschedule'. MT safe. -} clockIdWait id = liftIO $ do jitter <- allocMem :: IO (Ptr Int64) result <- gst_clock_id_wait id jitter let result' = (toEnum . fromIntegral) result jitter' <- peek jitter freeMem jitter return (result', jitter') #if ENABLE_OVERLOADING #endif -- method Clock::id_wait_async -- method type : MemberFunction -- Args : [Arg {argCName = "id", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockID to wait on", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "func", argType = TInterface (Name {namespace = "Gst", name = "ClockCallback"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The callback function", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "User data passed in the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "destroy_data", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GDestroyNotify for user_data", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gst", name = "ClockReturn"})) -- throws : False -- Skip return : False foreign import ccall "gst_clock_id_wait_async" gst_clock_id_wait_async :: Ptr () -> -- id : TBasicType TPtr FunPtr Gst.Callbacks.C_ClockCallback -> -- func : TInterface (Name {namespace = "Gst", name = "ClockCallback"}) Ptr () -> -- user_data : TBasicType TPtr FunPtr GLib.Callbacks.C_DestroyNotify -> -- destroy_data : TInterface (Name {namespace = "GLib", name = "DestroyNotify"}) IO CUInt {- | Register a callback on the given @/GstClockID/@ /@id@/ with the given function and user_data. When passing a @/GstClockID/@ with an invalid time to this function, the callback will be called immediately with a time set to GST_CLOCK_TIME_NONE. The callback will be called when the time of /@id@/ has been reached. The callback /@func@/ can be invoked from any thread, either provided by the core or from a streaming thread. The application should be prepared for this. -} clockIdWaitAsync :: (B.CallStack.HasCallStack, MonadIO m) => Ptr () {- ^ /@id@/: a @/GstClockID/@ to wait on -} -> Gst.Callbacks.ClockCallback {- ^ /@func@/: The callback function -} -> m Gst.Enums.ClockReturn {- ^ __Returns:__ the result of the non blocking wait. MT safe. -} clockIdWaitAsync id func = liftIO $ do func' <- Gst.Callbacks.mk_ClockCallback (Gst.Callbacks.wrap_ClockCallback Nothing (Gst.Callbacks.drop_closures_ClockCallback func)) let userData = castFunPtrToPtr func' let destroyData = safeFreeFunPtrPtr result <- gst_clock_id_wait_async id func' userData destroyData let result' = (toEnum . fromIntegral) result return result' #if ENABLE_OVERLOADING #endif