{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' provides a helper object that helps tracking audio stream alignment and discontinuities, and detects discontinuities if possible. See 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignNew' for a description of its parameters and 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignProcess' for the details of the processing. /Since: 1.14/ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GstAudio.Structs.AudioStreamAlign ( -- * Exported types AudioStreamAlign(..) , noAudioStreamAlign , -- * Methods -- ** copy #method:copy# #if ENABLE_OVERLOADING AudioStreamAlignCopyMethodInfo , #endif audioStreamAlignCopy , -- ** free #method:free# #if ENABLE_OVERLOADING AudioStreamAlignFreeMethodInfo , #endif audioStreamAlignFree , -- ** getAlignmentThreshold #method:getAlignmentThreshold# #if ENABLE_OVERLOADING AudioStreamAlignGetAlignmentThresholdMethodInfo, #endif audioStreamAlignGetAlignmentThreshold , -- ** getDiscontWait #method:getDiscontWait# #if ENABLE_OVERLOADING AudioStreamAlignGetDiscontWaitMethodInfo, #endif audioStreamAlignGetDiscontWait , -- ** getRate #method:getRate# #if ENABLE_OVERLOADING AudioStreamAlignGetRateMethodInfo , #endif audioStreamAlignGetRate , -- ** getSamplesSinceDiscont #method:getSamplesSinceDiscont# #if ENABLE_OVERLOADING AudioStreamAlignGetSamplesSinceDiscontMethodInfo, #endif audioStreamAlignGetSamplesSinceDiscont , -- ** getTimestampAtDiscont #method:getTimestampAtDiscont# #if ENABLE_OVERLOADING AudioStreamAlignGetTimestampAtDiscontMethodInfo, #endif audioStreamAlignGetTimestampAtDiscont , -- ** markDiscont #method:markDiscont# #if ENABLE_OVERLOADING AudioStreamAlignMarkDiscontMethodInfo , #endif audioStreamAlignMarkDiscont , -- ** new #method:new# audioStreamAlignNew , -- ** process #method:process# #if ENABLE_OVERLOADING AudioStreamAlignProcessMethodInfo , #endif audioStreamAlignProcess , -- ** setAlignmentThreshold #method:setAlignmentThreshold# #if ENABLE_OVERLOADING AudioStreamAlignSetAlignmentThresholdMethodInfo, #endif audioStreamAlignSetAlignmentThreshold , -- ** setDiscontWait #method:setDiscontWait# #if ENABLE_OVERLOADING AudioStreamAlignSetDiscontWaitMethodInfo, #endif audioStreamAlignSetDiscontWait , -- ** setRate #method:setRate# #if ENABLE_OVERLOADING AudioStreamAlignSetRateMethodInfo , #endif audioStreamAlignSetRate , ) 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 -- | Memory-managed wrapper type. newtype AudioStreamAlign = AudioStreamAlign (ManagedPtr AudioStreamAlign) foreign import ccall "gst_audio_stream_align_get_type" c_gst_audio_stream_align_get_type :: IO GType instance BoxedObject AudioStreamAlign where boxedType _ = c_gst_audio_stream_align_get_type -- | A convenience alias for `Nothing` :: `Maybe` `AudioStreamAlign`. noAudioStreamAlign :: Maybe AudioStreamAlign noAudioStreamAlign = Nothing #if ENABLE_OVERLOADING instance O.HasAttributeList AudioStreamAlign type instance O.AttributeList AudioStreamAlign = AudioStreamAlignAttributeList type AudioStreamAlignAttributeList = ('[ ] :: [(Symbol, *)]) #endif -- method AudioStreamAlign::new -- method type : Constructor -- Args : [Arg {argCName = "rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a sample rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alignment_threshold", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a alignment threshold in nanoseconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "discont_wait", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "discont wait in nanoseconds", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"})) -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_new" gst_audio_stream_align_new :: Int32 -> -- rate : TBasicType TInt Word64 -> -- alignment_threshold : TBasicType TUInt64 Word64 -> -- discont_wait : TBasicType TUInt64 IO (Ptr AudioStreamAlign) {- | Allocate a new 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' with the given configuration. All processing happens according to sample rate /@rate@/, until 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignSetRate' is called with a new /@rate@/. A negative rate can be used for reverse playback. /@alignmentThreshold@/ gives the tolerance in nanoseconds after which a timestamp difference is considered a discontinuity. Once detected, /@discontWait@/ nanoseconds have to pass without going below the threshold again until the output buffer is marked as a discontinuity. These can later be re-configured with 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignSetAlignmentThreshold' and 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignSetDiscontWait'. /Since: 1.14/ -} audioStreamAlignNew :: (B.CallStack.HasCallStack, MonadIO m) => Int32 {- ^ /@rate@/: a sample rate -} -> Word64 {- ^ /@alignmentThreshold@/: a alignment threshold in nanoseconds -} -> Word64 {- ^ /@discontWait@/: discont wait in nanoseconds -} -> m AudioStreamAlign {- ^ __Returns:__ a new 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign'. free with 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignFree'. -} audioStreamAlignNew rate alignmentThreshold discontWait = liftIO $ do result <- gst_audio_stream_align_new rate alignmentThreshold discontWait checkUnexpectedReturnNULL "audioStreamAlignNew" result result' <- (wrapBoxed AudioStreamAlign) result return result' #if ENABLE_OVERLOADING #endif -- method AudioStreamAlign::copy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"})) -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_copy" gst_audio_stream_align_copy :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO (Ptr AudioStreamAlign) {- | Copy a GstAudioStreamAlign structure. /Since: 1.14/ -} audioStreamAlignCopy :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m AudioStreamAlign {- ^ __Returns:__ a new 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign'. free with gst_audio_stream_align_free. -} audioStreamAlignCopy align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_copy align' checkUnexpectedReturnNULL "audioStreamAlignCopy" result result' <- (wrapBoxed AudioStreamAlign) result touchManagedPtr align return result' #if ENABLE_OVERLOADING data AudioStreamAlignCopyMethodInfo instance (signature ~ (m AudioStreamAlign), MonadIO m) => O.MethodInfo AudioStreamAlignCopyMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignCopy #endif -- method AudioStreamAlign::free -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_free" gst_audio_stream_align_free :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO () {- | Free a GstAudioStreamAlign structure previously allocated with 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignNew' or 'GI.GstAudio.Structs.AudioStreamAlign.audioStreamAlignCopy'. /Since: 1.14/ -} audioStreamAlignFree :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m () audioStreamAlignFree align = liftIO $ do align' <- unsafeManagedPtrGetPtr align gst_audio_stream_align_free align' touchManagedPtr align return () #if ENABLE_OVERLOADING data AudioStreamAlignFreeMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioStreamAlignFreeMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignFree #endif -- method AudioStreamAlign::get_alignment_threshold -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", 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_audio_stream_align_get_alignment_threshold" gst_audio_stream_align_get_alignment_threshold :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO Word64 {- | Gets the currently configured alignment threshold. /Since: 1.14/ -} audioStreamAlignGetAlignmentThreshold :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m Word64 {- ^ __Returns:__ The currently configured alignment threshold -} audioStreamAlignGetAlignmentThreshold align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_get_alignment_threshold align' touchManagedPtr align return result #if ENABLE_OVERLOADING data AudioStreamAlignGetAlignmentThresholdMethodInfo instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioStreamAlignGetAlignmentThresholdMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignGetAlignmentThreshold #endif -- method AudioStreamAlign::get_discont_wait -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", 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_audio_stream_align_get_discont_wait" gst_audio_stream_align_get_discont_wait :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO Word64 {- | Gets the currently configured discont wait. /Since: 1.14/ -} audioStreamAlignGetDiscontWait :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m Word64 {- ^ __Returns:__ The currently configured discont wait -} audioStreamAlignGetDiscontWait align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_get_discont_wait align' touchManagedPtr align return result #if ENABLE_OVERLOADING data AudioStreamAlignGetDiscontWaitMethodInfo instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioStreamAlignGetDiscontWaitMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignGetDiscontWait #endif -- method AudioStreamAlign::get_rate -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", 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_audio_stream_align_get_rate" gst_audio_stream_align_get_rate :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO Int32 {- | Gets the currently configured sample rate. /Since: 1.14/ -} audioStreamAlignGetRate :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m Int32 {- ^ __Returns:__ The currently configured sample rate -} audioStreamAlignGetRate align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_get_rate align' touchManagedPtr align return result #if ENABLE_OVERLOADING data AudioStreamAlignGetRateMethodInfo instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo AudioStreamAlignGetRateMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignGetRate #endif -- method AudioStreamAlign::get_samples_since_discont -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", 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_audio_stream_align_get_samples_since_discont" gst_audio_stream_align_get_samples_since_discont :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO Word64 {- | Returns the number of samples that were processed since the last discontinuity was detected. /Since: 1.14/ -} audioStreamAlignGetSamplesSinceDiscont :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m Word64 {- ^ __Returns:__ The number of samples processed since the last discontinuity. -} audioStreamAlignGetSamplesSinceDiscont align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_get_samples_since_discont align' touchManagedPtr align return result #if ENABLE_OVERLOADING data AudioStreamAlignGetSamplesSinceDiscontMethodInfo instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioStreamAlignGetSamplesSinceDiscontMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignGetSamplesSinceDiscont #endif -- method AudioStreamAlign::get_timestamp_at_discont -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", 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_audio_stream_align_get_timestamp_at_discont" gst_audio_stream_align_get_timestamp_at_discont :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO Word64 {- | Timestamp that was passed when a discontinuity was detected, i.e. the first timestamp after the discontinuity. /Since: 1.14/ -} audioStreamAlignGetTimestampAtDiscont :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m Word64 {- ^ __Returns:__ The last timestamp at when a discontinuity was detected -} audioStreamAlignGetTimestampAtDiscont align = liftIO $ do align' <- unsafeManagedPtrGetPtr align result <- gst_audio_stream_align_get_timestamp_at_discont align' touchManagedPtr align return result #if ENABLE_OVERLOADING data AudioStreamAlignGetTimestampAtDiscontMethodInfo instance (signature ~ (m Word64), MonadIO m) => O.MethodInfo AudioStreamAlignGetTimestampAtDiscontMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignGetTimestampAtDiscont #endif -- method AudioStreamAlign::mark_discont -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_mark_discont" gst_audio_stream_align_mark_discont :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) IO () {- | Marks the next buffer as discontinuous and resets timestamp tracking. /Since: 1.14/ -} audioStreamAlignMarkDiscont :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> m () audioStreamAlignMarkDiscont align = liftIO $ do align' <- unsafeManagedPtrGetPtr align gst_audio_stream_align_mark_discont align' touchManagedPtr align return () #if ENABLE_OVERLOADING data AudioStreamAlignMarkDiscontMethodInfo instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioStreamAlignMarkDiscontMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignMarkDiscont #endif -- method AudioStreamAlign::process -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "discont", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if this data is considered to be discontinuous", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timestamp", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstClockTime of the start of the data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_samples", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of samples to process", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_timestamp", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output timestamp of the data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "out_duration", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output duration of the data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "out_sample_position", argType = TBasicType TUInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "output sample position of the start of the data", 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_audio_stream_align_process" gst_audio_stream_align_process :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) CInt -> -- discont : TBasicType TBoolean Word64 -> -- timestamp : TBasicType TUInt64 Word32 -> -- n_samples : TBasicType TUInt Ptr Word64 -> -- out_timestamp : TBasicType TUInt64 Ptr Word64 -> -- out_duration : TBasicType TUInt64 Ptr Word64 -> -- out_sample_position : TBasicType TUInt64 IO CInt {- | Processes data with /@timestamp@/ and /@nSamples@/, and returns the output timestamp, duration and sample position together with a boolean to signal whether a discontinuity was detected or not. All non-discontinuous data will have perfect timestamps and durations. A discontinuity is detected once the difference between the actual timestamp and the timestamp calculated from the sample count since the last discontinuity differs by more than the alignment threshold for a duration longer than discont wait. Note: In reverse playback, every buffer is considered discontinuous in the context of buffer flags because the last sample of the previous buffer is discontinuous with the first sample of the current one. However for this function they are only considered discontinuous in reverse playback if the first sample of the previous buffer is discontinuous with the last sample of the current one. /Since: 1.14/ -} audioStreamAlignProcess :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> Bool {- ^ /@discont@/: if this data is considered to be discontinuous -} -> Word64 {- ^ /@timestamp@/: a @/GstClockTime/@ of the start of the data -} -> Word32 {- ^ /@nSamples@/: number of samples to process -} -> m ((Bool, Word64, Word64, Word64)) {- ^ __Returns:__ 'True' if a discontinuity was detected, 'False' otherwise. -} audioStreamAlignProcess align discont timestamp nSamples = liftIO $ do align' <- unsafeManagedPtrGetPtr align let discont' = (fromIntegral . fromEnum) discont outTimestamp <- allocMem :: IO (Ptr Word64) outDuration <- allocMem :: IO (Ptr Word64) outSamplePosition <- allocMem :: IO (Ptr Word64) result <- gst_audio_stream_align_process align' discont' timestamp nSamples outTimestamp outDuration outSamplePosition let result' = (/= 0) result outTimestamp' <- peek outTimestamp outDuration' <- peek outDuration outSamplePosition' <- peek outSamplePosition touchManagedPtr align freeMem outTimestamp freeMem outDuration freeMem outSamplePosition return (result', outTimestamp', outDuration', outSamplePosition') #if ENABLE_OVERLOADING data AudioStreamAlignProcessMethodInfo instance (signature ~ (Bool -> Word64 -> Word32 -> m ((Bool, Word64, Word64, Word64))), MonadIO m) => O.MethodInfo AudioStreamAlignProcessMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignProcess #endif -- method AudioStreamAlign::set_alignment_threshold -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "alignment_threshold", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a new alignment threshold", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_set_alignment_threshold" gst_audio_stream_align_set_alignment_threshold :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) Word64 -> -- alignment_threshold : TBasicType TUInt64 IO () {- | Sets /@alignmentTreshold@/ as new alignment threshold for the following processing. /Since: 1.14/ -} audioStreamAlignSetAlignmentThreshold :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> Word64 {- ^ /@alignmentThreshold@/: a new alignment threshold -} -> m () audioStreamAlignSetAlignmentThreshold align alignmentThreshold = liftIO $ do align' <- unsafeManagedPtrGetPtr align gst_audio_stream_align_set_alignment_threshold align' alignmentThreshold touchManagedPtr align return () #if ENABLE_OVERLOADING data AudioStreamAlignSetAlignmentThresholdMethodInfo instance (signature ~ (Word64 -> m ()), MonadIO m) => O.MethodInfo AudioStreamAlignSetAlignmentThresholdMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignSetAlignmentThreshold #endif -- method AudioStreamAlign::set_discont_wait -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "discont_wait", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a new discont wait", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_set_discont_wait" gst_audio_stream_align_set_discont_wait :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) Word64 -> -- discont_wait : TBasicType TUInt64 IO () {- | Sets /@alignmentTreshold@/ as new discont wait for the following processing. /Since: 1.14/ -} audioStreamAlignSetDiscontWait :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> Word64 {- ^ /@discontWait@/: a new discont wait -} -> m () audioStreamAlignSetDiscontWait align discontWait = liftIO $ do align' <- unsafeManagedPtrGetPtr align gst_audio_stream_align_set_discont_wait align' discontWait touchManagedPtr align return () #if ENABLE_OVERLOADING data AudioStreamAlignSetDiscontWaitMethodInfo instance (signature ~ (Word64 -> m ()), MonadIO m) => O.MethodInfo AudioStreamAlignSetDiscontWaitMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignSetDiscontWait #endif -- method AudioStreamAlign::set_rate -- method type : OrdinaryMethod -- Args : [Arg {argCName = "align", argType = TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioStreamAlign", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rate", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a new sample rate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gst_audio_stream_align_set_rate" gst_audio_stream_align_set_rate :: Ptr AudioStreamAlign -> -- align : TInterface (Name {namespace = "GstAudio", name = "AudioStreamAlign"}) Int32 -> -- rate : TBasicType TInt IO () {- | Sets /@rate@/ as new sample rate for the following processing. If the sample rate differs this implicitely marks the next data as discontinuous. /Since: 1.14/ -} audioStreamAlignSetRate :: (B.CallStack.HasCallStack, MonadIO m) => AudioStreamAlign {- ^ /@align@/: a 'GI.GstAudio.Structs.AudioStreamAlign.AudioStreamAlign' -} -> Int32 {- ^ /@rate@/: a new sample rate -} -> m () audioStreamAlignSetRate align rate = liftIO $ do align' <- unsafeManagedPtrGetPtr align gst_audio_stream_align_set_rate align' rate touchManagedPtr align return () #if ENABLE_OVERLOADING data AudioStreamAlignSetRateMethodInfo instance (signature ~ (Int32 -> m ()), MonadIO m) => O.MethodInfo AudioStreamAlignSetRateMethodInfo AudioStreamAlign signature where overloadedMethod _ = audioStreamAlignSetRate #endif #if ENABLE_OVERLOADING type family ResolveAudioStreamAlignMethod (t :: Symbol) (o :: *) :: * where ResolveAudioStreamAlignMethod "copy" o = AudioStreamAlignCopyMethodInfo ResolveAudioStreamAlignMethod "free" o = AudioStreamAlignFreeMethodInfo ResolveAudioStreamAlignMethod "markDiscont" o = AudioStreamAlignMarkDiscontMethodInfo ResolveAudioStreamAlignMethod "process" o = AudioStreamAlignProcessMethodInfo ResolveAudioStreamAlignMethod "getAlignmentThreshold" o = AudioStreamAlignGetAlignmentThresholdMethodInfo ResolveAudioStreamAlignMethod "getDiscontWait" o = AudioStreamAlignGetDiscontWaitMethodInfo ResolveAudioStreamAlignMethod "getRate" o = AudioStreamAlignGetRateMethodInfo ResolveAudioStreamAlignMethod "getSamplesSinceDiscont" o = AudioStreamAlignGetSamplesSinceDiscontMethodInfo ResolveAudioStreamAlignMethod "getTimestampAtDiscont" o = AudioStreamAlignGetTimestampAtDiscontMethodInfo ResolveAudioStreamAlignMethod "setAlignmentThreshold" o = AudioStreamAlignSetAlignmentThresholdMethodInfo ResolveAudioStreamAlignMethod "setDiscontWait" o = AudioStreamAlignSetDiscontWaitMethodInfo ResolveAudioStreamAlignMethod "setRate" o = AudioStreamAlignSetRateMethodInfo ResolveAudioStreamAlignMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveAudioStreamAlignMethod t AudioStreamAlign, O.MethodInfo info AudioStreamAlign p) => OL.IsLabel t (AudioStreamAlign -> 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