{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.GstAudio.Callbacks ( -- * Signals -- ** AudioBaseSinkCustomSlavingCallback #signal:AudioBaseSinkCustomSlavingCallback# AudioBaseSinkCustomSlavingCallback , AudioBaseSinkCustomSlavingCallback_WithClosures, C_AudioBaseSinkCustomSlavingCallback , drop_closures_AudioBaseSinkCustomSlavingCallback, dynamic_AudioBaseSinkCustomSlavingCallback, genClosure_AudioBaseSinkCustomSlavingCallback, mk_AudioBaseSinkCustomSlavingCallback , noAudioBaseSinkCustomSlavingCallback , noAudioBaseSinkCustomSlavingCallback_WithClosures, wrap_AudioBaseSinkCustomSlavingCallback , -- ** AudioClockGetTimeFunc #signal:AudioClockGetTimeFunc# AudioClockGetTimeFunc , AudioClockGetTimeFunc_WithClosures , C_AudioClockGetTimeFunc , drop_closures_AudioClockGetTimeFunc , dynamic_AudioClockGetTimeFunc , genClosure_AudioClockGetTimeFunc , mk_AudioClockGetTimeFunc , noAudioClockGetTimeFunc , noAudioClockGetTimeFunc_WithClosures , wrap_AudioClockGetTimeFunc , -- ** AudioFormatPack #signal:AudioFormatPack# AudioFormatPack , C_AudioFormatPack , dynamic_AudioFormatPack , genClosure_AudioFormatPack , mk_AudioFormatPack , noAudioFormatPack , wrap_AudioFormatPack , -- ** AudioFormatUnpack #signal:AudioFormatUnpack# AudioFormatUnpack , C_AudioFormatUnpack , dynamic_AudioFormatUnpack , genClosure_AudioFormatUnpack , mk_AudioFormatUnpack , noAudioFormatUnpack , wrap_AudioFormatUnpack , -- ** AudioRingBufferCallback #signal:AudioRingBufferCallback# AudioRingBufferCallback , AudioRingBufferCallback_WithClosures , C_AudioRingBufferCallback , drop_closures_AudioRingBufferCallback , dynamic_AudioRingBufferCallback , genClosure_AudioRingBufferCallback , mk_AudioRingBufferCallback , noAudioRingBufferCallback , noAudioRingBufferCallback_WithClosures , wrap_AudioRingBufferCallback , ) 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.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack 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 GI.Gst.Objects.Clock as Gst.Clock import {-# SOURCE #-} qualified GI.GstAudio.Enums as GstAudio.Enums import {-# SOURCE #-} qualified GI.GstAudio.Flags as GstAudio.Flags import {-# SOURCE #-} qualified GI.GstAudio.Objects.AudioBaseSink as GstAudio.AudioBaseSink import {-# SOURCE #-} qualified GI.GstAudio.Objects.AudioRingBuffer as GstAudio.AudioRingBuffer import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioFormatInfo as GstAudio.AudioFormatInfo -- callback AudioRingBufferCallback -- -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "rbuf", argType = TInterface (Name {namespace = "GstAudio", name = "AudioRingBuffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioRingBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "target to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "amount to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function is set with gst_audio_ring_buffer_set_callback() and is\ncalled to fill the memory at @data with @len bytes of samples.", sinceVersion = Nothing}} type C_AudioRingBufferCallback = Ptr GstAudio.AudioRingBuffer.AudioRingBuffer -> Ptr Word8 -> Word32 -> Ptr () -> IO () -- Args : [Arg {argCName = "rbuf", argType = TInterface (Name {namespace = "GstAudio", name = "AudioRingBuffer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioRingBuffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "target to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "len", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "amount to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 3, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [Arg {argCName = "len", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "amount to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "dynamic" __dynamic_C_AudioRingBufferCallback :: FunPtr C_AudioRingBufferCallback -> C_AudioRingBufferCallback dynamic_AudioRingBufferCallback :: (B.CallStack.HasCallStack, MonadIO m, GstAudio.AudioRingBuffer.IsAudioRingBuffer a) => FunPtr C_AudioRingBufferCallback -> a {- ^ /@rbuf@/: a 'GI.GstAudio.Objects.AudioRingBuffer.AudioRingBuffer' -} -> ByteString {- ^ /@data@/: target to fill -} -> Ptr () {- ^ /@userData@/: user data -} -> m () dynamic_AudioRingBufferCallback __funPtr rbuf data_ userData = liftIO $ do let len = fromIntegral $ B.length data_ rbuf' <- unsafeManagedPtrCastPtr rbuf data_' <- packByteString data_ (__dynamic_C_AudioRingBufferCallback __funPtr) rbuf' data_' len userData touchManagedPtr rbuf freeMem data_' return () foreign import ccall "wrapper" mk_AudioRingBufferCallback :: C_AudioRingBufferCallback -> IO (FunPtr C_AudioRingBufferCallback) type AudioRingBufferCallback = GstAudio.AudioRingBuffer.AudioRingBuffer -> ByteString -> IO () noAudioRingBufferCallback :: Maybe AudioRingBufferCallback noAudioRingBufferCallback = Nothing type AudioRingBufferCallback_WithClosures = GstAudio.AudioRingBuffer.AudioRingBuffer -> ByteString -> Ptr () -> IO () noAudioRingBufferCallback_WithClosures :: Maybe AudioRingBufferCallback_WithClosures noAudioRingBufferCallback_WithClosures = Nothing drop_closures_AudioRingBufferCallback :: AudioRingBufferCallback -> AudioRingBufferCallback_WithClosures drop_closures_AudioRingBufferCallback _f rbuf data_ _ = _f rbuf data_ genClosure_AudioRingBufferCallback :: AudioRingBufferCallback -> IO Closure genClosure_AudioRingBufferCallback cb = do let cb' = drop_closures_AudioRingBufferCallback cb let cb'' = wrap_AudioRingBufferCallback Nothing cb' mk_AudioRingBufferCallback cb'' >>= newCClosure wrap_AudioRingBufferCallback :: Maybe (Ptr (FunPtr C_AudioRingBufferCallback)) -> AudioRingBufferCallback_WithClosures -> Ptr GstAudio.AudioRingBuffer.AudioRingBuffer -> Ptr Word8 -> Word32 -> Ptr () -> IO () wrap_AudioRingBufferCallback funptrptr _cb rbuf data_ len userData = do rbuf' <- (newObject GstAudio.AudioRingBuffer.AudioRingBuffer) rbuf data_' <- (unpackByteStringWithLength len) data_ _cb rbuf' data_' userData maybeReleaseFunPtr funptrptr -- callback AudioFormatUnpack -- -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioFormatInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioFormatInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioPackFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a destination array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the audio data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of samples to unpack.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Unpacks @length samples from the given data of format @info.\nThe samples will be unpacked into @dest which each channel\ninterleaved. @dest should at least be big enough to hold @length *\nchannels * size(unpack_format) bytes.", sinceVersion = Nothing}} type C_AudioFormatUnpack = Ptr GstAudio.AudioFormatInfo.AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () -- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioFormatInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioFormatInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioPackFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a destination array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the audio data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of samples to unpack.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "dynamic" __dynamic_C_AudioFormatUnpack :: FunPtr C_AudioFormatUnpack -> C_AudioFormatUnpack dynamic_AudioFormatUnpack :: (B.CallStack.HasCallStack, MonadIO m) => FunPtr C_AudioFormatUnpack -> GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] -> Ptr Word8 {- ^ /@dest@/: a destination array -} -> Ptr Word8 {- ^ /@data@/: pointer to the audio data -} -> Int32 {- ^ /@length@/: the amount of samples to unpack. -} -> m () dynamic_AudioFormatUnpack __funPtr info flags dest data_ length_ = liftIO $ do info' <- unsafeManagedPtrGetPtr info let flags' = gflagsToWord flags (__dynamic_C_AudioFormatUnpack __funPtr) info' flags' dest data_ length_ touchManagedPtr info return () foreign import ccall "wrapper" mk_AudioFormatUnpack :: C_AudioFormatUnpack -> IO (FunPtr C_AudioFormatUnpack) type AudioFormatUnpack = GstAudio.AudioFormatInfo.AudioFormatInfo -> [GstAudio.Flags.AudioPackFlags] -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () noAudioFormatUnpack :: Maybe AudioFormatUnpack noAudioFormatUnpack = Nothing genClosure_AudioFormatUnpack :: AudioFormatUnpack -> IO Closure genClosure_AudioFormatUnpack cb = do let cb' = wrap_AudioFormatUnpack Nothing cb mk_AudioFormatUnpack cb' >>= newCClosure wrap_AudioFormatUnpack :: Maybe (Ptr (FunPtr C_AudioFormatUnpack)) -> AudioFormatUnpack -> Ptr GstAudio.AudioFormatInfo.AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () wrap_AudioFormatUnpack funptrptr _cb info flags dest data_ length_ = do info' <- (newPtr GstAudio.AudioFormatInfo.AudioFormatInfo) info let flags' = wordToGFlags flags _cb info' flags' dest data_ length_ maybeReleaseFunPtr funptrptr -- callback AudioFormatPack -- -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioFormatInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioFormatInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioPackFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the destination\n data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of samples to pack.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Packs @length samples from @src to the data array in format @info.\nThe samples from source have each channel interleaved\nand will be packed into @data.", sinceVersion = Nothing}} type C_AudioFormatPack = Ptr GstAudio.AudioFormatInfo.AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () -- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioFormatInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioFormatInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "GstAudio", name = "AudioPackFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a source array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) (-1) (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to the destination\n data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the amount of samples to pack.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "dynamic" __dynamic_C_AudioFormatPack :: FunPtr C_AudioFormatPack -> C_AudioFormatPack dynamic_AudioFormatPack :: (B.CallStack.HasCallStack, MonadIO m) => FunPtr C_AudioFormatPack -> GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] -> Ptr Word8 {- ^ /@src@/: a source array -} -> Ptr Word8 {- ^ /@data@/: pointer to the destination data -} -> Int32 {- ^ /@length@/: the amount of samples to pack. -} -> m () dynamic_AudioFormatPack __funPtr info flags src data_ length_ = liftIO $ do info' <- unsafeManagedPtrGetPtr info let flags' = gflagsToWord flags (__dynamic_C_AudioFormatPack __funPtr) info' flags' src data_ length_ touchManagedPtr info return () foreign import ccall "wrapper" mk_AudioFormatPack :: C_AudioFormatPack -> IO (FunPtr C_AudioFormatPack) type AudioFormatPack = GstAudio.AudioFormatInfo.AudioFormatInfo -> [GstAudio.Flags.AudioPackFlags] -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () noAudioFormatPack :: Maybe AudioFormatPack noAudioFormatPack = Nothing genClosure_AudioFormatPack :: AudioFormatPack -> IO Closure genClosure_AudioFormatPack cb = do let cb' = wrap_AudioFormatPack Nothing cb mk_AudioFormatPack cb' >>= newCClosure wrap_AudioFormatPack :: Maybe (Ptr (FunPtr C_AudioFormatPack)) -> AudioFormatPack -> Ptr GstAudio.AudioFormatInfo.AudioFormatInfo -> CUInt -> Ptr Word8 -> Ptr Word8 -> Int32 -> IO () wrap_AudioFormatPack funptrptr _cb info flags src data_ length_ = do info' <- (newPtr GstAudio.AudioFormatInfo.AudioFormatInfo) info let flags' = wordToGFlags flags _cb info' flags' src data_ length_ maybeReleaseFunPtr funptrptr -- callback AudioClockGetTimeFunc -- -> Callable {returnType = Just (TBasicType TUInt64), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "the current time or #GST_CLOCK_TIME_NONE if the previous time should\nbe used.", sinceVersion = Nothing}, args = [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstAudioClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function will be called whenever the current clock time needs to be\ncalculated. If this function returns #GST_CLOCK_TIME_NONE, the last reported\ntime will be returned by the clock.", sinceVersion = Nothing}} type C_AudioClockGetTimeFunc = Ptr Gst.Clock.Clock -> Ptr () -> IO Word64 -- Args : [Arg {argCName = "clock", argType = TInterface (Name {namespace = "Gst", name = "Clock"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstAudioClock", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", 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 "dynamic" __dynamic_C_AudioClockGetTimeFunc :: FunPtr C_AudioClockGetTimeFunc -> C_AudioClockGetTimeFunc dynamic_AudioClockGetTimeFunc :: (B.CallStack.HasCallStack, MonadIO m, Gst.Clock.IsClock a) => FunPtr C_AudioClockGetTimeFunc -> a {- ^ /@clock@/: the 'GI.GstAudio.Objects.AudioClock.AudioClock' -} -> Ptr () {- ^ /@userData@/: user data -} -> m Word64 {- ^ __Returns:__ the current time or 'GI.Gst.Constants.CLOCK_TIME_NONE' if the previous time should be used. -} dynamic_AudioClockGetTimeFunc __funPtr clock userData = liftIO $ do clock' <- unsafeManagedPtrCastPtr clock result <- (__dynamic_C_AudioClockGetTimeFunc __funPtr) clock' userData touchManagedPtr clock return result foreign import ccall "wrapper" mk_AudioClockGetTimeFunc :: C_AudioClockGetTimeFunc -> IO (FunPtr C_AudioClockGetTimeFunc) type AudioClockGetTimeFunc = Gst.Clock.Clock -> IO Word64 noAudioClockGetTimeFunc :: Maybe AudioClockGetTimeFunc noAudioClockGetTimeFunc = Nothing type AudioClockGetTimeFunc_WithClosures = Gst.Clock.Clock -> Ptr () -> IO Word64 noAudioClockGetTimeFunc_WithClosures :: Maybe AudioClockGetTimeFunc_WithClosures noAudioClockGetTimeFunc_WithClosures = Nothing drop_closures_AudioClockGetTimeFunc :: AudioClockGetTimeFunc -> AudioClockGetTimeFunc_WithClosures drop_closures_AudioClockGetTimeFunc _f clock _ = _f clock genClosure_AudioClockGetTimeFunc :: AudioClockGetTimeFunc -> IO Closure genClosure_AudioClockGetTimeFunc cb = do let cb' = drop_closures_AudioClockGetTimeFunc cb let cb'' = wrap_AudioClockGetTimeFunc Nothing cb' mk_AudioClockGetTimeFunc cb'' >>= newCClosure wrap_AudioClockGetTimeFunc :: Maybe (Ptr (FunPtr C_AudioClockGetTimeFunc)) -> AudioClockGetTimeFunc_WithClosures -> Ptr Gst.Clock.Clock -> Ptr () -> IO Word64 wrap_AudioClockGetTimeFunc funptrptr _cb clock userData = do clock' <- (newObject Gst.Clock.Clock) clock result <- _cb clock' userData maybeReleaseFunPtr funptrptr return result -- callback AudioBaseSinkCustomSlavingCallback -- -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "sink", argType = TInterface (Name {namespace = "GstAudio", name = "AudioBaseSink"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioBaseSink", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "etime", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "external clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "itime", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "internal clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "requested_skew", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "skew amount requested by the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "discont_reason", argType = TInterface (Name {namespace = "GstAudio", name = "AudioBaseSinkDiscontReason"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "reason for discontinuity (if any)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "This function is set with gst_audio_base_sink_set_custom_slaving_callback()\nand is called during playback. It receives the current time of external and\ninternal clocks, which the callback can then use to apply any custom\nslaving/synchronization schemes.\n\nThe external clock is the sink's element clock, the internal one is the\ninternal audio clock. The internal audio clock's calibration is applied to\nthe timestamps before they are passed to the callback. The difference between\netime and itime is the skew; how much internal and external clock lie apart\nfrom each other. A skew of 0 means both clocks are perfectly in sync.\nitime > etime means the external clock is going slower, while itime < etime\nmeans it is going faster than the internal clock. etime and itime are always\nvalid timestamps, except for when a discontinuity happens.\n\nrequested_skew is an output value the callback can write to. It informs the\nsink of whether or not it should move the playout pointer, and if so, by how\nmuch. This pointer is only NULL if a discontinuity occurs; otherwise, it is\nsafe to write to *requested_skew. The default skew is 0.\n\nThe sink may experience discontinuities. If one happens, discont is TRUE,\nitime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL.\nThis makes it possible to reset custom clock slaving algorithms when a\ndiscontinuity happens.", sinceVersion = Just "1.6"}} type C_AudioBaseSinkCustomSlavingCallback = Ptr GstAudio.AudioBaseSink.AudioBaseSink -> Word64 -> Word64 -> Int64 -> CUInt -> Ptr () -> IO () -- Args : [Arg {argCName = "sink", argType = TInterface (Name {namespace = "GstAudio", name = "AudioBaseSink"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioBaseSink", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "etime", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "external clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "itime", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "internal clock time", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "requested_skew", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "skew amount requested by the callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "discont_reason", argType = TInterface (Name {namespace = "GstAudio", name = "AudioBaseSinkDiscontReason"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "reason for discontinuity (if any)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 5, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "dynamic" __dynamic_C_AudioBaseSinkCustomSlavingCallback :: FunPtr C_AudioBaseSinkCustomSlavingCallback -> C_AudioBaseSinkCustomSlavingCallback dynamic_AudioBaseSinkCustomSlavingCallback :: (B.CallStack.HasCallStack, MonadIO m, GstAudio.AudioBaseSink.IsAudioBaseSink a) => FunPtr C_AudioBaseSinkCustomSlavingCallback -> a {- ^ /@sink@/: a 'GI.GstAudio.Objects.AudioBaseSink.AudioBaseSink' -} -> Word64 {- ^ /@etime@/: external clock time -} -> Word64 {- ^ /@itime@/: internal clock time -} -> Int64 {- ^ /@requestedSkew@/: skew amount requested by the callback -} -> GstAudio.Enums.AudioBaseSinkDiscontReason {- ^ /@discontReason@/: reason for discontinuity (if any) -} -> Ptr () {- ^ /@userData@/: user data -} -> m () dynamic_AudioBaseSinkCustomSlavingCallback __funPtr sink etime itime requestedSkew discontReason userData = liftIO $ do sink' <- unsafeManagedPtrCastPtr sink let discontReason' = (fromIntegral . fromEnum) discontReason (__dynamic_C_AudioBaseSinkCustomSlavingCallback __funPtr) sink' etime itime requestedSkew discontReason' userData touchManagedPtr sink return () foreign import ccall "wrapper" mk_AudioBaseSinkCustomSlavingCallback :: C_AudioBaseSinkCustomSlavingCallback -> IO (FunPtr C_AudioBaseSinkCustomSlavingCallback) type AudioBaseSinkCustomSlavingCallback = GstAudio.AudioBaseSink.AudioBaseSink -> Word64 -> Word64 -> Int64 -> GstAudio.Enums.AudioBaseSinkDiscontReason -> IO () noAudioBaseSinkCustomSlavingCallback :: Maybe AudioBaseSinkCustomSlavingCallback noAudioBaseSinkCustomSlavingCallback = Nothing type AudioBaseSinkCustomSlavingCallback_WithClosures = GstAudio.AudioBaseSink.AudioBaseSink -> Word64 -> Word64 -> Int64 -> GstAudio.Enums.AudioBaseSinkDiscontReason -> Ptr () -> IO () noAudioBaseSinkCustomSlavingCallback_WithClosures :: Maybe AudioBaseSinkCustomSlavingCallback_WithClosures noAudioBaseSinkCustomSlavingCallback_WithClosures = Nothing drop_closures_AudioBaseSinkCustomSlavingCallback :: AudioBaseSinkCustomSlavingCallback -> AudioBaseSinkCustomSlavingCallback_WithClosures drop_closures_AudioBaseSinkCustomSlavingCallback _f sink etime itime requestedSkew discontReason _ = _f sink etime itime requestedSkew discontReason genClosure_AudioBaseSinkCustomSlavingCallback :: AudioBaseSinkCustomSlavingCallback -> IO Closure genClosure_AudioBaseSinkCustomSlavingCallback cb = do let cb' = drop_closures_AudioBaseSinkCustomSlavingCallback cb let cb'' = wrap_AudioBaseSinkCustomSlavingCallback Nothing cb' mk_AudioBaseSinkCustomSlavingCallback cb'' >>= newCClosure wrap_AudioBaseSinkCustomSlavingCallback :: Maybe (Ptr (FunPtr C_AudioBaseSinkCustomSlavingCallback)) -> AudioBaseSinkCustomSlavingCallback_WithClosures -> Ptr GstAudio.AudioBaseSink.AudioBaseSink -> Word64 -> Word64 -> Int64 -> CUInt -> Ptr () -> IO () wrap_AudioBaseSinkCustomSlavingCallback funptrptr _cb sink etime itime requestedSkew discontReason userData = do sink' <- (newObject GstAudio.AudioBaseSink.AudioBaseSink) sink let discontReason' = (toEnum . fromIntegral) discontReason _cb sink' etime itime requestedSkew discontReason' userData maybeReleaseFunPtr funptrptr