{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) 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.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.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 for the callback on the (unwrapped) C side. 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 -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell. 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 () -- | Generate a function pointer callable from C code, from a `C_AudioRingBufferCallback`. foreign import ccall "wrapper" mk_AudioRingBufferCallback :: C_AudioRingBufferCallback -> IO (FunPtr C_AudioRingBufferCallback) {- | This function is set with @/gst_audio_ring_buffer_set_callback()/@ and is called to fill the memory at /@data@/ with /@len@/ bytes of samples. -} type AudioRingBufferCallback = GstAudio.AudioRingBuffer.AudioRingBuffer {- ^ /@rbuf@/: a 'GI.GstAudio.Objects.AudioRingBuffer.AudioRingBuffer' -} -> ByteString {- ^ /@data@/: target to fill -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioRingBufferCallback`@. noAudioRingBufferCallback :: Maybe AudioRingBufferCallback noAudioRingBufferCallback = Nothing {- | This function is set with @/gst_audio_ring_buffer_set_callback()/@ and is called to fill the memory at /@data@/ with /@len@/ bytes of samples. -} type AudioRingBufferCallback_WithClosures = GstAudio.AudioRingBuffer.AudioRingBuffer {- ^ /@rbuf@/: a 'GI.GstAudio.Objects.AudioRingBuffer.AudioRingBuffer' -} -> ByteString {- ^ /@data@/: target to fill -} -> Ptr () {- ^ /@userData@/: user data -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioRingBufferCallback_WithClosures`@. noAudioRingBufferCallback_WithClosures :: Maybe AudioRingBufferCallback_WithClosures noAudioRingBufferCallback_WithClosures = Nothing -- | A simple wrapper that ignores the closure arguments. drop_closures_AudioRingBufferCallback :: AudioRingBufferCallback -> AudioRingBufferCallback_WithClosures drop_closures_AudioRingBufferCallback _f rbuf data_ _ = _f rbuf data_ -- | Wrap the callback into a `GClosure`. genClosure_AudioRingBufferCallback :: MonadIO m => AudioRingBufferCallback -> m (GClosure C_AudioRingBufferCallback) genClosure_AudioRingBufferCallback cb = liftIO $ do let cb' = drop_closures_AudioRingBufferCallback cb let cb'' = wrap_AudioRingBufferCallback Nothing cb' mk_AudioRingBufferCallback cb'' >>= B.GClosure.newGClosure -- | Wrap a `AudioRingBufferCallback` into a `C_AudioRingBufferCallback`. wrap_AudioRingBufferCallback :: Maybe (Ptr (FunPtr C_AudioRingBufferCallback)) -> AudioRingBufferCallback_WithClosures -> C_AudioRingBufferCallback 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 = Just "#GstAudioPackFlags", 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 for the callback on the (unwrapped) C side. 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 = Just "#GstAudioPackFlags", 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 -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell. dynamic_AudioFormatUnpack :: (B.CallStack.HasCallStack, MonadIO m) => FunPtr C_AudioFormatUnpack -> GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] {- ^ /@flags@/: 'GI.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 () -- | Generate a function pointer callable from C code, from a `C_AudioFormatUnpack`. foreign import ccall "wrapper" mk_AudioFormatUnpack :: C_AudioFormatUnpack -> IO (FunPtr C_AudioFormatUnpack) {- | Unpacks /@length@/ samples from the given data of format /@info@/. The samples will be unpacked into /@dest@/ which each channel interleaved. /@dest@/ should at least be big enough to hold /@length@/ * channels * size(unpack_format) bytes. -} type AudioFormatUnpack = GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] {- ^ /@flags@/: 'GI.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. -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioFormatUnpack`@. noAudioFormatUnpack :: Maybe AudioFormatUnpack noAudioFormatUnpack = Nothing -- | Wrap the callback into a `GClosure`. genClosure_AudioFormatUnpack :: MonadIO m => AudioFormatUnpack -> m (GClosure C_AudioFormatUnpack) genClosure_AudioFormatUnpack cb = liftIO $ do let cb' = wrap_AudioFormatUnpack Nothing cb mk_AudioFormatUnpack cb' >>= B.GClosure.newGClosure -- | Wrap a `AudioFormatUnpack` into a `C_AudioFormatUnpack`. wrap_AudioFormatUnpack :: Maybe (Ptr (FunPtr C_AudioFormatUnpack)) -> AudioFormatUnpack -> C_AudioFormatUnpack 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 = Just "#GstAudioPackFlags", 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 for the callback on the (unwrapped) C side. 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 = Just "#GstAudioPackFlags", 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 -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell. dynamic_AudioFormatPack :: (B.CallStack.HasCallStack, MonadIO m) => FunPtr C_AudioFormatPack -> GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] {- ^ /@flags@/: 'GI.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 () -- | Generate a function pointer callable from C code, from a `C_AudioFormatPack`. foreign import ccall "wrapper" mk_AudioFormatPack :: C_AudioFormatPack -> IO (FunPtr C_AudioFormatPack) {- | Packs /@length@/ samples from /@src@/ to the data array in format /@info@/. The samples from source have each channel interleaved and will be packed into /@data@/. -} type AudioFormatPack = GstAudio.AudioFormatInfo.AudioFormatInfo {- ^ /@info@/: a 'GI.GstAudio.Structs.AudioFormatInfo.AudioFormatInfo' -} -> [GstAudio.Flags.AudioPackFlags] {- ^ /@flags@/: 'GI.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. -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioFormatPack`@. noAudioFormatPack :: Maybe AudioFormatPack noAudioFormatPack = Nothing -- | Wrap the callback into a `GClosure`. genClosure_AudioFormatPack :: MonadIO m => AudioFormatPack -> m (GClosure C_AudioFormatPack) genClosure_AudioFormatPack cb = liftIO $ do let cb' = wrap_AudioFormatPack Nothing cb mk_AudioFormatPack cb' >>= B.GClosure.newGClosure -- | Wrap a `AudioFormatPack` into a `C_AudioFormatPack`. wrap_AudioFormatPack :: Maybe (Ptr (FunPtr C_AudioFormatPack)) -> AudioFormatPack -> C_AudioFormatPack 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 for the callback on the (unwrapped) C side. 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 -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell. 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 -- | Generate a function pointer callable from C code, from a `C_AudioClockGetTimeFunc`. foreign import ccall "wrapper" mk_AudioClockGetTimeFunc :: C_AudioClockGetTimeFunc -> IO (FunPtr C_AudioClockGetTimeFunc) {- | This function will be called whenever the current clock time needs to be calculated. If this function returns 'GI.Gst.Constants.CLOCK_TIME_NONE', the last reported time will be returned by the clock. -} type AudioClockGetTimeFunc = Gst.Clock.Clock {- ^ /@clock@/: the 'GI.GstAudio.Objects.AudioClock.AudioClock' -} -> IO Word64 {- ^ __Returns:__ the current time or 'GI.Gst.Constants.CLOCK_TIME_NONE' if the previous time should be used. -} -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioClockGetTimeFunc`@. noAudioClockGetTimeFunc :: Maybe AudioClockGetTimeFunc noAudioClockGetTimeFunc = Nothing {- | This function will be called whenever the current clock time needs to be calculated. If this function returns 'GI.Gst.Constants.CLOCK_TIME_NONE', the last reported time will be returned by the clock. -} type AudioClockGetTimeFunc_WithClosures = Gst.Clock.Clock {- ^ /@clock@/: the 'GI.GstAudio.Objects.AudioClock.AudioClock' -} -> Ptr () {- ^ /@userData@/: user data -} -> IO Word64 {- ^ __Returns:__ the current time or 'GI.Gst.Constants.CLOCK_TIME_NONE' if the previous time should be used. -} -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioClockGetTimeFunc_WithClosures`@. noAudioClockGetTimeFunc_WithClosures :: Maybe AudioClockGetTimeFunc_WithClosures noAudioClockGetTimeFunc_WithClosures = Nothing -- | A simple wrapper that ignores the closure arguments. drop_closures_AudioClockGetTimeFunc :: AudioClockGetTimeFunc -> AudioClockGetTimeFunc_WithClosures drop_closures_AudioClockGetTimeFunc _f clock _ = _f clock -- | Wrap the callback into a `GClosure`. genClosure_AudioClockGetTimeFunc :: MonadIO m => AudioClockGetTimeFunc -> m (GClosure C_AudioClockGetTimeFunc) genClosure_AudioClockGetTimeFunc cb = liftIO $ do let cb' = drop_closures_AudioClockGetTimeFunc cb let cb'' = wrap_AudioClockGetTimeFunc Nothing cb' mk_AudioClockGetTimeFunc cb'' >>= B.GClosure.newGClosure -- | Wrap a `AudioClockGetTimeFunc` into a `C_AudioClockGetTimeFunc`. wrap_AudioClockGetTimeFunc :: Maybe (Ptr (FunPtr C_AudioClockGetTimeFunc)) -> AudioClockGetTimeFunc_WithClosures -> C_AudioClockGetTimeFunc 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 for the callback on the (unwrapped) C side. 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 -- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell. 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 () -- | Generate a function pointer callable from C code, from a `C_AudioBaseSinkCustomSlavingCallback`. foreign import ccall "wrapper" mk_AudioBaseSinkCustomSlavingCallback :: C_AudioBaseSinkCustomSlavingCallback -> IO (FunPtr C_AudioBaseSinkCustomSlavingCallback) {- | This function is set with 'GI.GstAudio.Objects.AudioBaseSink.audioBaseSinkSetCustomSlavingCallback' and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving\/synchronization schemes. The external clock is the sink\'s element clock, the internal one is the internal audio clock. The internal audio clock\'s calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime \< etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens. requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0. The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens. /Since: 1.6/ -} type AudioBaseSinkCustomSlavingCallback = GstAudio.AudioBaseSink.AudioBaseSink {- ^ /@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) -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioBaseSinkCustomSlavingCallback`@. noAudioBaseSinkCustomSlavingCallback :: Maybe AudioBaseSinkCustomSlavingCallback noAudioBaseSinkCustomSlavingCallback = Nothing {- | This function is set with 'GI.GstAudio.Objects.AudioBaseSink.audioBaseSinkSetCustomSlavingCallback' and is called during playback. It receives the current time of external and internal clocks, which the callback can then use to apply any custom slaving\/synchronization schemes. The external clock is the sink\'s element clock, the internal one is the internal audio clock. The internal audio clock\'s calibration is applied to the timestamps before they are passed to the callback. The difference between etime and itime is the skew; how much internal and external clock lie apart from each other. A skew of 0 means both clocks are perfectly in sync. itime > etime means the external clock is going slower, while itime \< etime means it is going faster than the internal clock. etime and itime are always valid timestamps, except for when a discontinuity happens. requested_skew is an output value the callback can write to. It informs the sink of whether or not it should move the playout pointer, and if so, by how much. This pointer is only NULL if a discontinuity occurs; otherwise, it is safe to write to *requested_skew. The default skew is 0. The sink may experience discontinuities. If one happens, discont is TRUE, itime, etime are set to GST_CLOCK_TIME_NONE, and requested_skew is NULL. This makes it possible to reset custom clock slaving algorithms when a discontinuity happens. /Since: 1.6/ -} type AudioBaseSinkCustomSlavingCallback_WithClosures = GstAudio.AudioBaseSink.AudioBaseSink {- ^ /@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 -} -> IO () -- | A convenience synonym for @`Nothing` :: `Maybe` `AudioBaseSinkCustomSlavingCallback_WithClosures`@. noAudioBaseSinkCustomSlavingCallback_WithClosures :: Maybe AudioBaseSinkCustomSlavingCallback_WithClosures noAudioBaseSinkCustomSlavingCallback_WithClosures = Nothing -- | A simple wrapper that ignores the closure arguments. drop_closures_AudioBaseSinkCustomSlavingCallback :: AudioBaseSinkCustomSlavingCallback -> AudioBaseSinkCustomSlavingCallback_WithClosures drop_closures_AudioBaseSinkCustomSlavingCallback _f sink etime itime requestedSkew discontReason _ = _f sink etime itime requestedSkew discontReason -- | Wrap the callback into a `GClosure`. genClosure_AudioBaseSinkCustomSlavingCallback :: MonadIO m => AudioBaseSinkCustomSlavingCallback -> m (GClosure C_AudioBaseSinkCustomSlavingCallback) genClosure_AudioBaseSinkCustomSlavingCallback cb = liftIO $ do let cb' = drop_closures_AudioBaseSinkCustomSlavingCallback cb let cb'' = wrap_AudioBaseSinkCustomSlavingCallback Nothing cb' mk_AudioBaseSinkCustomSlavingCallback cb'' >>= B.GClosure.newGClosure -- | Wrap a `AudioBaseSinkCustomSlavingCallback` into a `C_AudioBaseSinkCustomSlavingCallback`. wrap_AudioBaseSinkCustomSlavingCallback :: Maybe (Ptr (FunPtr C_AudioBaseSinkCustomSlavingCallback)) -> AudioBaseSinkCustomSlavingCallback_WithClosures -> C_AudioBaseSinkCustomSlavingCallback 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