-- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria #if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__)) #define ENABLE_OVERLOADING #endif module GI.GstAudio.Functions ( -- * Methods -- ** audioChannelGetFallbackMask #method:audioChannelGetFallbackMask# audioChannelGetFallbackMask , -- ** audioChannelPositionsFromMask #method:audioChannelPositionsFromMask# audioChannelPositionsFromMask , -- ** audioChannelPositionsToMask #method:audioChannelPositionsToMask# audioChannelPositionsToMask , -- ** audioChannelPositionsToString #method:audioChannelPositionsToString# audioChannelPositionsToString , -- ** audioChannelPositionsToValidOrder #method:audioChannelPositionsToValidOrder# audioChannelPositionsToValidOrder , -- ** audioCheckValidChannelPositions #method:audioCheckValidChannelPositions# audioCheckValidChannelPositions , -- ** audioClippingMetaApiGetType #method:audioClippingMetaApiGetType# audioClippingMetaApiGetType , -- ** audioDownmixMetaApiGetType #method:audioDownmixMetaApiGetType# audioDownmixMetaApiGetType , -- ** audioFormatInfoGetType #method:audioFormatInfoGetType# audioFormatInfoGetType , -- ** audioGetChannelReorderMap #method:audioGetChannelReorderMap# audioGetChannelReorderMap , -- ** audioIec61937FrameSize #method:audioIec61937FrameSize# audioIec61937FrameSize , -- ** audioIec61937Payload #method:audioIec61937Payload# audioIec61937Payload , -- ** audioMetaApiGetType #method:audioMetaApiGetType# audioMetaApiGetType , -- ** audioReorderChannels #method:audioReorderChannels# audioReorderChannels , -- ** bufferAddAudioClippingMeta #method:bufferAddAudioClippingMeta# bufferAddAudioClippingMeta , -- ** bufferAddAudioDownmixMeta #method:bufferAddAudioDownmixMeta# bufferAddAudioDownmixMeta , -- ** bufferAddAudioMeta #method:bufferAddAudioMeta# bufferAddAudioMeta , -- ** bufferGetAudioDownmixMetaForChannels #method:bufferGetAudioDownmixMetaForChannels# bufferGetAudioDownmixMetaForChannels , ) 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.GI.Base.Signals as B.Signals 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.Enums as Gst.Enums import qualified GI.Gst.Structs.Buffer as Gst.Buffer import {-# SOURCE #-} qualified GI.GstAudio.Enums as GstAudio.Enums import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioClippingMeta as GstAudio.AudioClippingMeta import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioDownmixMeta as GstAudio.AudioDownmixMeta import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioInfo as GstAudio.AudioInfo import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioMeta as GstAudio.AudioMeta import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioRingBufferSpec as GstAudio.AudioRingBufferSpec -- function gst_buffer_get_audio_downmix_meta_for_channels -- Args: [ Arg -- { argCName = "buffer" -- , argType = TInterface Name { namespace = "Gst" , name = "Buffer" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GstBuffer" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to_position" -- , argType = -- TCArray -- False -- (-1) -- 2 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the channel positions of\n the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "to_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioDownmixMeta" }) -- throws : False -- Skip return : False foreign import ccall "gst_buffer_get_audio_downmix_meta_for_channels" gst_buffer_get_audio_downmix_meta_for_channels :: Ptr Gst.Buffer.Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"}) Ptr CInt -> -- to_position : TCArray False (-1) 2 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- to_channels : TBasicType TInt IO (Ptr GstAudio.AudioDownmixMeta.AudioDownmixMeta) -- | Find the t'GI.GstAudio.Structs.AudioDownmixMeta.AudioDownmixMeta' on /@buffer@/ for the given destination -- channel positions. bufferGetAudioDownmixMetaForChannels :: (B.CallStack.HasCallStack, MonadIO m) => Gst.Buffer.Buffer -- ^ /@buffer@/: a t'GI.Gst.Structs.Buffer.Buffer' -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@toPosition@/: the channel positions of -- the destination -> m GstAudio.AudioDownmixMeta.AudioDownmixMeta -- ^ __Returns:__ the t'GI.GstAudio.Structs.AudioDownmixMeta.AudioDownmixMeta' on /@buffer@/. bufferGetAudioDownmixMetaForChannels :: Buffer -> [AudioChannelPosition] -> m AudioDownmixMeta bufferGetAudioDownmixMetaForChannels buffer :: Buffer buffer toPosition :: [AudioChannelPosition] toPosition = IO AudioDownmixMeta -> m AudioDownmixMeta forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO AudioDownmixMeta -> m AudioDownmixMeta) -> IO AudioDownmixMeta -> m AudioDownmixMeta forall a b. (a -> b) -> a -> b $ do let toChannels :: Int32 toChannels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] toPosition Ptr Buffer buffer' <- Buffer -> IO (Ptr Buffer) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Buffer buffer let toPosition' :: [CInt] toPosition' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] toPosition Ptr CInt toPosition'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] toPosition' Ptr AudioDownmixMeta result <- Ptr Buffer -> Ptr CInt -> Int32 -> IO (Ptr AudioDownmixMeta) gst_buffer_get_audio_downmix_meta_for_channels Ptr Buffer buffer' Ptr CInt toPosition'' Int32 toChannels Text -> Ptr AudioDownmixMeta -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "bufferGetAudioDownmixMetaForChannels" Ptr AudioDownmixMeta result AudioDownmixMeta result' <- ((ManagedPtr AudioDownmixMeta -> AudioDownmixMeta) -> Ptr AudioDownmixMeta -> IO AudioDownmixMeta forall a. (HasCallStack, WrappedPtr a) => (ManagedPtr a -> a) -> Ptr a -> IO a newPtr ManagedPtr AudioDownmixMeta -> AudioDownmixMeta GstAudio.AudioDownmixMeta.AudioDownmixMeta) Ptr AudioDownmixMeta result Buffer -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Buffer buffer Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt toPosition'' AudioDownmixMeta -> IO AudioDownmixMeta forall (m :: * -> *) a. Monad m => a -> m a return AudioDownmixMeta result' -- function gst_buffer_add_audio_meta -- Args: [ Arg -- { argCName = "buffer" -- , argType = TInterface Name { namespace = "Gst" , name = "Buffer" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GstBuffer" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "info" -- , argType = -- TInterface Name { namespace = "GstAudio" , name = "AudioInfo" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the audio properties of the buffer" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "samples" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of valid samples in the buffer" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "offsets" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the offsets (in bytes) where each channel plane starts\n in the buffer or %NULL to calculate it (see below); must be %NULL also\n when @info->layout is %GST_AUDIO_LAYOUT_INTERLEAVED" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface Name { namespace = "GstAudio" , name = "AudioMeta" }) -- throws : False -- Skip return : False foreign import ccall "gst_buffer_add_audio_meta" gst_buffer_add_audio_meta :: Ptr Gst.Buffer.Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"}) Ptr GstAudio.AudioInfo.AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}) Word64 -> -- samples : TBasicType TUInt64 Word64 -> -- offsets : TBasicType TUInt64 IO (Ptr GstAudio.AudioMeta.AudioMeta) -- | Allocates and attaches a t'GI.GstAudio.Structs.AudioMeta.AudioMeta' on /@buffer@/, which must be writable -- for that purpose. The fields of the t'GI.GstAudio.Structs.AudioMeta.AudioMeta' are directly populated -- from the arguments of this function. -- -- When /@info@/->layout is 'GI.GstAudio.Enums.AudioLayoutNonInterleaved' and /@offsets@/ is -- 'P.Nothing', the offsets are calculated with a formula that assumes the planes are -- tightly packed and in sequence: -- offsets[channel] = channel * /@samples@/ * sample_stride -- -- It is not allowed for channels to overlap in memory, -- i.e. for each i in [0, channels), the range -- [/@offsets@/[i], /@offsets@/[i] + /@samples@/ * sample_stride) must not overlap -- with any other such range. This function will assert if the parameters -- specified cause this restriction to be violated. -- -- It is, obviously, also not allowed to specify parameters that would cause -- out-of-bounds memory access on /@buffer@/. This is also checked, which means -- that you must add enough memory on the /@buffer@/ before adding this meta. -- -- /Since: 1.16/ bufferAddAudioMeta :: (B.CallStack.HasCallStack, MonadIO m) => Gst.Buffer.Buffer -- ^ /@buffer@/: a t'GI.Gst.Structs.Buffer.Buffer' -> GstAudio.AudioInfo.AudioInfo -- ^ /@info@/: the audio properties of the buffer -> Word64 -- ^ /@samples@/: the number of valid samples in the buffer -> Word64 -- ^ /@offsets@/: the offsets (in bytes) where each channel plane starts -- in the buffer or 'P.Nothing' to calculate it (see below); must be 'P.Nothing' also -- when /@info@/->layout is 'GI.GstAudio.Enums.AudioLayoutInterleaved' -> m GstAudio.AudioMeta.AudioMeta -- ^ __Returns:__ the t'GI.GstAudio.Structs.AudioMeta.AudioMeta' that was attached on the /@buffer@/ bufferAddAudioMeta :: Buffer -> AudioInfo -> Word64 -> Word64 -> m AudioMeta bufferAddAudioMeta buffer :: Buffer buffer info :: AudioInfo info samples :: Word64 samples offsets :: Word64 offsets = IO AudioMeta -> m AudioMeta forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO AudioMeta -> m AudioMeta) -> IO AudioMeta -> m AudioMeta forall a b. (a -> b) -> a -> b $ do Ptr Buffer buffer' <- Buffer -> IO (Ptr Buffer) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Buffer buffer Ptr AudioInfo info' <- AudioInfo -> IO (Ptr AudioInfo) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr AudioInfo info Ptr AudioMeta result <- Ptr Buffer -> Ptr AudioInfo -> Word64 -> Word64 -> IO (Ptr AudioMeta) gst_buffer_add_audio_meta Ptr Buffer buffer' Ptr AudioInfo info' Word64 samples Word64 offsets Text -> Ptr AudioMeta -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "bufferAddAudioMeta" Ptr AudioMeta result AudioMeta result' <- ((ManagedPtr AudioMeta -> AudioMeta) -> Ptr AudioMeta -> IO AudioMeta forall a. (HasCallStack, WrappedPtr a) => (ManagedPtr a -> a) -> Ptr a -> IO a newPtr ManagedPtr AudioMeta -> AudioMeta GstAudio.AudioMeta.AudioMeta) Ptr AudioMeta result Buffer -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Buffer buffer AudioInfo -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr AudioInfo info AudioMeta -> IO AudioMeta forall (m :: * -> *) a. Monad m => a -> m a return AudioMeta result' -- function gst_buffer_add_audio_downmix_meta -- Args: [ Arg -- { argCName = "buffer" -- , argType = TInterface Name { namespace = "Gst" , name = "Buffer" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GstBuffer" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "from_position" -- , argType = -- TCArray -- False -- (-1) -- 2 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the channel positions\n of the source" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "from_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the source" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to_position" -- , argType = -- TCArray -- False -- (-1) -- 4 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the channel positions of\n the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "matrix" -- , argType = TBasicType TFloat -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The matrix coefficients." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "to_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the destination" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "from_channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels of the source" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioDownmixMeta" }) -- throws : False -- Skip return : False foreign import ccall "gst_buffer_add_audio_downmix_meta" gst_buffer_add_audio_downmix_meta :: Ptr Gst.Buffer.Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"}) Ptr CInt -> -- from_position : TCArray False (-1) 2 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- from_channels : TBasicType TInt Ptr CInt -> -- to_position : TCArray False (-1) 4 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- to_channels : TBasicType TInt CFloat -> -- matrix : TBasicType TFloat IO (Ptr GstAudio.AudioDownmixMeta.AudioDownmixMeta) -- | Attaches t'GI.GstAudio.Structs.AudioDownmixMeta.AudioDownmixMeta' metadata to /@buffer@/ with the given parameters. -- -- /@matrix@/ is an two-dimensional array of /@toChannels@/ times /@fromChannels@/ -- coefficients, i.e. the i-th output channels is constructed by multiplicating -- the input channels with the coefficients in /@matrix@/[i] and taking the sum -- of the results. bufferAddAudioDownmixMeta :: (B.CallStack.HasCallStack, MonadIO m) => Gst.Buffer.Buffer -- ^ /@buffer@/: a t'GI.Gst.Structs.Buffer.Buffer' -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@fromPosition@/: the channel positions -- of the source -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@toPosition@/: the channel positions of -- the destination -> Float -- ^ /@matrix@/: The matrix coefficients. -> m GstAudio.AudioDownmixMeta.AudioDownmixMeta -- ^ __Returns:__ the t'GI.GstAudio.Structs.AudioDownmixMeta.AudioDownmixMeta' on /@buffer@/. bufferAddAudioDownmixMeta :: Buffer -> [AudioChannelPosition] -> [AudioChannelPosition] -> Float -> m AudioDownmixMeta bufferAddAudioDownmixMeta buffer :: Buffer buffer fromPosition :: [AudioChannelPosition] fromPosition toPosition :: [AudioChannelPosition] toPosition matrix :: Float matrix = IO AudioDownmixMeta -> m AudioDownmixMeta forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO AudioDownmixMeta -> m AudioDownmixMeta) -> IO AudioDownmixMeta -> m AudioDownmixMeta forall a b. (a -> b) -> a -> b $ do let toChannels :: Int32 toChannels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] toPosition let fromChannels :: Int32 fromChannels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] fromPosition Ptr Buffer buffer' <- Buffer -> IO (Ptr Buffer) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Buffer buffer let fromPosition' :: [CInt] fromPosition' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] fromPosition Ptr CInt fromPosition'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] fromPosition' let toPosition' :: [CInt] toPosition' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] toPosition Ptr CInt toPosition'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] toPosition' let matrix' :: CFloat matrix' = Float -> CFloat forall a b. (Real a, Fractional b) => a -> b realToFrac Float matrix Ptr AudioDownmixMeta result <- Ptr Buffer -> Ptr CInt -> Int32 -> Ptr CInt -> Int32 -> CFloat -> IO (Ptr AudioDownmixMeta) gst_buffer_add_audio_downmix_meta Ptr Buffer buffer' Ptr CInt fromPosition'' Int32 fromChannels Ptr CInt toPosition'' Int32 toChannels CFloat matrix' Text -> Ptr AudioDownmixMeta -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "bufferAddAudioDownmixMeta" Ptr AudioDownmixMeta result AudioDownmixMeta result' <- ((ManagedPtr AudioDownmixMeta -> AudioDownmixMeta) -> Ptr AudioDownmixMeta -> IO AudioDownmixMeta forall a. (HasCallStack, WrappedPtr a) => (ManagedPtr a -> a) -> Ptr a -> IO a newPtr ManagedPtr AudioDownmixMeta -> AudioDownmixMeta GstAudio.AudioDownmixMeta.AudioDownmixMeta) Ptr AudioDownmixMeta result Buffer -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Buffer buffer Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt fromPosition'' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt toPosition'' AudioDownmixMeta -> IO AudioDownmixMeta forall (m :: * -> *) a. Monad m => a -> m a return AudioDownmixMeta result' -- function gst_buffer_add_audio_clipping_meta -- Args: [ Arg -- { argCName = "buffer" -- , argType = TInterface Name { namespace = "Gst" , name = "Buffer" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GstBuffer" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "format" -- , argType = TInterface Name { namespace = "Gst" , name = "Format" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "GstFormat of @start and @stop, GST_FORMAT_DEFAULT is samples" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "start" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Amount of audio to clip from start of buffer" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "end" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Amount of to clip from end of buffer" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioClippingMeta" }) -- throws : False -- Skip return : False foreign import ccall "gst_buffer_add_audio_clipping_meta" gst_buffer_add_audio_clipping_meta :: Ptr Gst.Buffer.Buffer -> -- buffer : TInterface (Name {namespace = "Gst", name = "Buffer"}) CUInt -> -- format : TInterface (Name {namespace = "Gst", name = "Format"}) Word64 -> -- start : TBasicType TUInt64 Word64 -> -- end : TBasicType TUInt64 IO (Ptr GstAudio.AudioClippingMeta.AudioClippingMeta) -- | Attaches t'GI.GstAudio.Structs.AudioClippingMeta.AudioClippingMeta' metadata to /@buffer@/ with the given parameters. -- -- /Since: 1.8/ bufferAddAudioClippingMeta :: (B.CallStack.HasCallStack, MonadIO m) => Gst.Buffer.Buffer -- ^ /@buffer@/: a t'GI.Gst.Structs.Buffer.Buffer' -> Gst.Enums.Format -- ^ /@format@/: GstFormat of /@start@/ and /@stop@/, GST_FORMAT_DEFAULT is samples -> Word64 -- ^ /@start@/: Amount of audio to clip from start of buffer -> Word64 -- ^ /@end@/: Amount of to clip from end of buffer -> m GstAudio.AudioClippingMeta.AudioClippingMeta -- ^ __Returns:__ the t'GI.GstAudio.Structs.AudioClippingMeta.AudioClippingMeta' on /@buffer@/. bufferAddAudioClippingMeta :: Buffer -> Format -> Word64 -> Word64 -> m AudioClippingMeta bufferAddAudioClippingMeta buffer :: Buffer buffer format :: Format format start :: Word64 start end :: Word64 end = IO AudioClippingMeta -> m AudioClippingMeta forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO AudioClippingMeta -> m AudioClippingMeta) -> IO AudioClippingMeta -> m AudioClippingMeta forall a b. (a -> b) -> a -> b $ do Ptr Buffer buffer' <- Buffer -> IO (Ptr Buffer) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr Buffer buffer let format' :: CUInt format' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (Format -> Int) -> Format -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Format -> Int forall a. Enum a => a -> Int fromEnum) Format format Ptr AudioClippingMeta result <- Ptr Buffer -> CUInt -> Word64 -> Word64 -> IO (Ptr AudioClippingMeta) gst_buffer_add_audio_clipping_meta Ptr Buffer buffer' CUInt format' Word64 start Word64 end Text -> Ptr AudioClippingMeta -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "bufferAddAudioClippingMeta" Ptr AudioClippingMeta result AudioClippingMeta result' <- ((ManagedPtr AudioClippingMeta -> AudioClippingMeta) -> Ptr AudioClippingMeta -> IO AudioClippingMeta forall a. (HasCallStack, WrappedPtr a) => (ManagedPtr a -> a) -> Ptr a -> IO a newPtr ManagedPtr AudioClippingMeta -> AudioClippingMeta GstAudio.AudioClippingMeta.AudioClippingMeta) Ptr AudioClippingMeta result Buffer -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr Buffer buffer AudioClippingMeta -> IO AudioClippingMeta forall (m :: * -> *) a. Monad m => a -> m a return AudioClippingMeta result' -- function gst_audio_reorder_channels -- Args: [ Arg -- { argCName = "data" -- , argType = TCArray False (-1) 1 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The pointer to\n the memory." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "size" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The size of the memory." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "format" -- , argType = -- TInterface Name { namespace = "GstAudio" , name = "AudioFormat" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The %GstAudioFormat of the buffer." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "from" -- , argType = -- TCArray -- False -- (-1) -- 3 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The channel positions in the buffer." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to" -- , argType = -- TCArray -- False -- (-1) -- 3 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The channel positions to convert to." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "size" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The size of the memory." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_reorder_channels" gst_audio_reorder_channels :: Ptr Word8 -> -- data : TCArray False (-1) 1 (TBasicType TUInt8) Word64 -> -- size : TBasicType TUInt64 CUInt -> -- format : TInterface (Name {namespace = "GstAudio", name = "AudioFormat"}) Int32 -> -- channels : TBasicType TInt Ptr CInt -> -- from : TCArray False (-1) 3 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Ptr CInt -> -- to : TCArray False (-1) 3 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) IO CInt -- | Reorders /@data@/ from the channel positions /@from@/ to the channel -- positions /@to@/. /@from@/ and /@to@/ must contain the same number of -- positions and the same positions, only in a different order. -- -- Note: this function assumes the audio data is in interleaved layout audioReorderChannels :: (B.CallStack.HasCallStack, MonadIO m) => ByteString -- ^ /@data@/: The pointer to -- the memory. -> GstAudio.Enums.AudioFormat -- ^ /@format@/: The @/GstAudioFormat/@ of the buffer. -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@from@/: The channel positions in the buffer. -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@to@/: The channel positions to convert to. -> m Bool -- ^ __Returns:__ 'P.True' if the reordering was possible. audioReorderChannels :: ByteString -> AudioFormat -> [AudioChannelPosition] -> [AudioChannelPosition] -> m Bool audioReorderChannels data_ :: ByteString data_ format :: AudioFormat format from :: [AudioChannelPosition] from to :: [AudioChannelPosition] to = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] to let from_expected_length_ :: Int32 from_expected_length_ = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] from Bool -> IO () -> IO () forall (f :: * -> *). Applicative f => Bool -> f () -> f () when (Int32 from_expected_length_ Int32 -> Int32 -> Bool forall a. Eq a => a -> a -> Bool /= Int32 channels) (IO () -> IO ()) -> IO () -> IO () forall a b. (a -> b) -> a -> b $ [Char] -> IO () forall a. HasCallStack => [Char] -> a error "GstAudio.audioReorderChannels : length of 'from' does not agree with that of 'to'." let size :: Word64 size = Int -> Word64 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Word64) -> Int -> Word64 forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString data_ Ptr Word8 data_' <- ByteString -> IO (Ptr Word8) packByteString ByteString data_ let format' :: CUInt format' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (AudioFormat -> Int) -> AudioFormat -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioFormat -> Int forall a. Enum a => a -> Int fromEnum) AudioFormat format let from' :: [CInt] from' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] from Ptr CInt from'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] from' let to' :: [CInt] to' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] to Ptr CInt to'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] to' CInt result <- Ptr Word8 -> Word64 -> CUInt -> Int32 -> Ptr CInt -> Ptr CInt -> IO CInt gst_audio_reorder_channels Ptr Word8 data_' Word64 size CUInt format' Int32 channels Ptr CInt from'' Ptr CInt to'' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Ptr Word8 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word8 data_' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt from'' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt to'' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_meta_api_get_type -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TGType) -- throws : False -- Skip return : False foreign import ccall "gst_audio_meta_api_get_type" gst_audio_meta_api_get_type :: IO CGType -- | /No description available in the introspection data./ audioMetaApiGetType :: (B.CallStack.HasCallStack, MonadIO m) => m GType audioMetaApiGetType :: m GType audioMetaApiGetType = IO GType -> m GType forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO GType -> m GType) -> IO GType -> m GType forall a b. (a -> b) -> a -> b $ do Word64 result <- IO Word64 gst_audio_meta_api_get_type let result' :: GType result' = Word64 -> GType GType Word64 result GType -> IO GType forall (m :: * -> *) a. Monad m => a -> m a return GType result' -- function gst_audio_iec61937_payload -- Args: [ Arg -- { argCName = "src" -- , argType = TCArray False (-1) 1 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a buffer containing the data to payload" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "src_n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "size of @src in bytes" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "dst" -- , argType = TCArray False (-1) 3 (TBasicType TUInt8) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just -- "the destination buffer to store the\n payloaded contents in. Should not overlap with @src" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "dst_n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "size of @dst in bytes" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "spec" -- , argType = -- TInterface -- Name { namespace = "GstAudio" , name = "AudioRingBufferSpec" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the ringbufer spec for @src" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "endianness" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the expected byte order of the payloaded data" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "dst_n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "size of @dst in bytes" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "src_n" -- , argType = TBasicType TUInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "size of @src in bytes" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_iec61937_payload" gst_audio_iec61937_payload :: Ptr Word8 -> -- src : TCArray False (-1) 1 (TBasicType TUInt8) Word32 -> -- src_n : TBasicType TUInt Ptr Word8 -> -- dst : TCArray False (-1) 3 (TBasicType TUInt8) Word32 -> -- dst_n : TBasicType TUInt Ptr GstAudio.AudioRingBufferSpec.AudioRingBufferSpec -> -- spec : TInterface (Name {namespace = "GstAudio", name = "AudioRingBufferSpec"}) Int32 -> -- endianness : TBasicType TInt IO CInt -- | Payloads /@src@/ in the form specified by IEC 61937 for the type from /@spec@/ and -- stores the result in /@dst@/. /@src@/ must contain exactly one frame of data and -- the frame is not checked for errors. audioIec61937Payload :: (B.CallStack.HasCallStack, MonadIO m) => ByteString -- ^ /@src@/: a buffer containing the data to payload -> ByteString -- ^ /@dst@/: the destination buffer to store the -- payloaded contents in. Should not overlap with /@src@/ -> GstAudio.AudioRingBufferSpec.AudioRingBufferSpec -- ^ /@spec@/: the ringbufer spec for /@src@/ -> Int32 -- ^ /@endianness@/: the expected byte order of the payloaded data -> m Bool -- ^ __Returns:__ transfer-full: 'P.True' if the payloading was successful, 'P.False' -- otherwise. audioIec61937Payload :: ByteString -> ByteString -> AudioRingBufferSpec -> Int32 -> m Bool audioIec61937Payload src :: ByteString src dst :: ByteString dst spec :: AudioRingBufferSpec spec endianness :: Int32 endianness = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let dstN :: Word32 dstN = Int -> Word32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Word32) -> Int -> Word32 forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString dst let srcN :: Word32 srcN = Int -> Word32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Word32) -> Int -> Word32 forall a b. (a -> b) -> a -> b $ ByteString -> Int B.length ByteString src Ptr Word8 src' <- ByteString -> IO (Ptr Word8) packByteString ByteString src Ptr Word8 dst' <- ByteString -> IO (Ptr Word8) packByteString ByteString dst Ptr AudioRingBufferSpec spec' <- AudioRingBufferSpec -> IO (Ptr AudioRingBufferSpec) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr AudioRingBufferSpec spec CInt result <- Ptr Word8 -> Word32 -> Ptr Word8 -> Word32 -> Ptr AudioRingBufferSpec -> Int32 -> IO CInt gst_audio_iec61937_payload Ptr Word8 src' Word32 srcN Ptr Word8 dst' Word32 dstN Ptr AudioRingBufferSpec spec' Int32 endianness let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result AudioRingBufferSpec -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr AudioRingBufferSpec spec Ptr Word8 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word8 src' Ptr Word8 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word8 dst' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_iec61937_frame_size -- Args: [ Arg -- { argCName = "spec" -- , argType = -- TInterface -- Name { namespace = "GstAudio" , name = "AudioRingBufferSpec" } -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the ringbufer spec" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUInt) -- throws : False -- Skip return : False foreign import ccall "gst_audio_iec61937_frame_size" gst_audio_iec61937_frame_size :: Ptr GstAudio.AudioRingBufferSpec.AudioRingBufferSpec -> -- spec : TInterface (Name {namespace = "GstAudio", name = "AudioRingBufferSpec"}) IO Word32 -- | Calculated the size of the buffer expected by 'GI.GstAudio.Functions.audioIec61937Payload' for -- payloading type from /@spec@/. audioIec61937FrameSize :: (B.CallStack.HasCallStack, MonadIO m) => GstAudio.AudioRingBufferSpec.AudioRingBufferSpec -- ^ /@spec@/: the ringbufer spec -> m Word32 -- ^ __Returns:__ the size or 0 if the given /@type@/ is not supported or cannot be -- payloaded. audioIec61937FrameSize :: AudioRingBufferSpec -> m Word32 audioIec61937FrameSize spec :: AudioRingBufferSpec spec = IO Word32 -> m Word32 forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32 forall a b. (a -> b) -> a -> b $ do Ptr AudioRingBufferSpec spec' <- AudioRingBufferSpec -> IO (Ptr AudioRingBufferSpec) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr AudioRingBufferSpec spec Word32 result <- Ptr AudioRingBufferSpec -> IO Word32 gst_audio_iec61937_frame_size Ptr AudioRingBufferSpec spec' AudioRingBufferSpec -> IO () forall a. ManagedPtrNewtype a => a -> IO () touchManagedPtr AudioRingBufferSpec spec Word32 -> IO Word32 forall (m :: * -> *) a. Monad m => a -> m a return Word32 result -- function gst_audio_get_channel_reorder_map -- Args: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "from" -- , argType = -- TCArray -- False -- (-1) -- 0 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The channel positions to reorder from." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "to" -- , argType = -- TCArray -- False -- (-1) -- 0 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The channel positions to reorder to." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "reorder_map" -- , argType = TCArray False (-1) 0 (TBasicType TInt) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Pointer to the reorder map." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_get_channel_reorder_map" gst_audio_get_channel_reorder_map :: Int32 -> -- channels : TBasicType TInt Ptr CInt -> -- from : TCArray False (-1) 0 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Ptr CInt -> -- to : TCArray False (-1) 0 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Ptr Int32 -> -- reorder_map : TCArray False (-1) 0 (TBasicType TInt) IO CInt -- | Returns a reorder map for /@from@/ to /@to@/ that can be used in -- custom channel reordering code, e.g. to convert from or to the -- GStreamer channel order. /@from@/ and /@to@/ must contain the same -- number of positions and the same positions, only in a -- different order. -- -- The resulting /@reorderMap@/ can be used for reordering by assigning -- channel i of the input to channel reorder_map[i] of the output. audioGetChannelReorderMap :: (B.CallStack.HasCallStack, MonadIO m) => [GstAudio.Enums.AudioChannelPosition] -- ^ /@from@/: The channel positions to reorder from. -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@to@/: The channel positions to reorder to. -> [Int32] -- ^ /@reorderMap@/: Pointer to the reorder map. -> m Bool -- ^ __Returns:__ 'P.True' if the channel positions are valid and reordering -- is possible. audioGetChannelReorderMap :: [AudioChannelPosition] -> [AudioChannelPosition] -> [Int32] -> m Bool audioGetChannelReorderMap from :: [AudioChannelPosition] from to :: [AudioChannelPosition] to reorderMap :: [Int32] reorderMap = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [Int32] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [Int32] reorderMap let to_expected_length_ :: Int32 to_expected_length_ = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] to Bool -> IO () -> IO () forall (f :: * -> *). Applicative f => Bool -> f () -> f () when (Int32 to_expected_length_ Int32 -> Int32 -> Bool forall a. Eq a => a -> a -> Bool /= Int32 channels) (IO () -> IO ()) -> IO () -> IO () forall a b. (a -> b) -> a -> b $ [Char] -> IO () forall a. HasCallStack => [Char] -> a error "GstAudio.audioGetChannelReorderMap : length of 'to' does not agree with that of 'reorderMap'." let from_expected_length_ :: Int32 from_expected_length_ = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] from Bool -> IO () -> IO () forall (f :: * -> *). Applicative f => Bool -> f () -> f () when (Int32 from_expected_length_ Int32 -> Int32 -> Bool forall a. Eq a => a -> a -> Bool /= Int32 channels) (IO () -> IO ()) -> IO () -> IO () forall a b. (a -> b) -> a -> b $ [Char] -> IO () forall a. HasCallStack => [Char] -> a error "GstAudio.audioGetChannelReorderMap : length of 'from' does not agree with that of 'to'." let from' :: [CInt] from' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] from Ptr CInt from'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] from' let to' :: [CInt] to' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] to Ptr CInt to'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] to' Ptr Int32 reorderMap' <- [Int32] -> IO (Ptr Int32) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [Int32] reorderMap CInt result <- Int32 -> Ptr CInt -> Ptr CInt -> Ptr Int32 -> IO CInt gst_audio_get_channel_reorder_map Int32 channels Ptr CInt from'' Ptr CInt to'' Ptr Int32 reorderMap' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt from'' Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt to'' Ptr Int32 -> IO () forall a. Ptr a -> IO () freeMem Ptr Int32 reorderMap' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_format_info_get_type -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TGType) -- throws : False -- Skip return : False foreign import ccall "gst_audio_format_info_get_type" gst_audio_format_info_get_type :: IO CGType -- | /No description available in the introspection data./ audioFormatInfoGetType :: (B.CallStack.HasCallStack, MonadIO m) => m GType audioFormatInfoGetType :: m GType audioFormatInfoGetType = IO GType -> m GType forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO GType -> m GType) -> IO GType -> m GType forall a b. (a -> b) -> a -> b $ do Word64 result <- IO Word64 gst_audio_format_info_get_type let result' :: GType result' = Word64 -> GType GType Word64 result GType -> IO GType forall (m :: * -> *) a. Monad m => a -> m a return GType result' -- function gst_audio_downmix_meta_api_get_type -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TGType) -- throws : False -- Skip return : False foreign import ccall "gst_audio_downmix_meta_api_get_type" gst_audio_downmix_meta_api_get_type :: IO CGType -- | /No description available in the introspection data./ audioDownmixMetaApiGetType :: (B.CallStack.HasCallStack, MonadIO m) => m GType audioDownmixMetaApiGetType :: m GType audioDownmixMetaApiGetType = IO GType -> m GType forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO GType -> m GType) -> IO GType -> m GType forall a b. (a -> b) -> a -> b $ do Word64 result <- IO Word64 gst_audio_downmix_meta_api_get_type let result' :: GType result' = Word64 -> GType GType Word64 result GType -> IO GType forall (m :: * -> *) a. Monad m => a -> m a return GType result' -- function gst_audio_clipping_meta_api_get_type -- Args: [] -- Lengths: [] -- returnType: Just (TBasicType TGType) -- throws : False -- Skip return : False foreign import ccall "gst_audio_clipping_meta_api_get_type" gst_audio_clipping_meta_api_get_type :: IO CGType -- | /No description available in the introspection data./ audioClippingMetaApiGetType :: (B.CallStack.HasCallStack, MonadIO m) => m GType audioClippingMetaApiGetType :: m GType audioClippingMetaApiGetType = IO GType -> m GType forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO GType -> m GType) -> IO GType -> m GType forall a b. (a -> b) -> a -> b $ do Word64 result <- IO Word64 gst_audio_clipping_meta_api_get_type let result' :: GType result' = Word64 -> GType GType Word64 result GType -> IO GType forall (m :: * -> *) a. Monad m => a -> m a return GType result' -- function gst_audio_check_valid_channel_positions -- Args: [ Arg -- { argCName = "position" -- , argType = -- TCArray -- False -- (-1) -- 1 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The %GstAudioChannelPositions\n to check." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "force_order" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Only consider the GStreamer channel order." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_check_valid_channel_positions" gst_audio_check_valid_channel_positions :: Ptr CInt -> -- position : TCArray False (-1) 1 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- channels : TBasicType TInt CInt -> -- force_order : TBasicType TBoolean IO CInt -- | Checks if /@position@/ contains valid channel positions for -- /@channels@/ channels. If /@forceOrder@/ is 'P.True' it additionally -- checks if the channels are in the order required by GStreamer. audioCheckValidChannelPositions :: (B.CallStack.HasCallStack, MonadIO m) => [GstAudio.Enums.AudioChannelPosition] -- ^ /@position@/: The @/GstAudioChannelPositions/@ -- to check. -> Bool -- ^ /@forceOrder@/: Only consider the GStreamer channel order. -> m Bool -- ^ __Returns:__ 'P.True' if the channel positions are valid. audioCheckValidChannelPositions :: [AudioChannelPosition] -> Bool -> m Bool audioCheckValidChannelPositions position :: [AudioChannelPosition] position forceOrder :: Bool forceOrder = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] position let position' :: [CInt] position' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] position Ptr CInt position'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] position' let forceOrder' :: CInt forceOrder' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Bool -> Int forall a. Enum a => a -> Int fromEnum) Bool forceOrder CInt result <- Ptr CInt -> Int32 -> CInt -> IO CInt gst_audio_check_valid_channel_positions Ptr CInt position'' Int32 channels CInt forceOrder' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt position'' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_channel_positions_to_valid_order -- Args: [ Arg -- { argCName = "position" -- , argType = -- TCArray -- False -- (-1) -- 1 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The channel positions to\n reorder to." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_channel_positions_to_valid_order" gst_audio_channel_positions_to_valid_order :: Ptr CInt -> -- position : TCArray False (-1) 1 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- channels : TBasicType TInt IO CInt -- | Reorders the channel positions in /@position@/ from any order to -- the GStreamer channel order. audioChannelPositionsToValidOrder :: (B.CallStack.HasCallStack, MonadIO m) => [GstAudio.Enums.AudioChannelPosition] -- ^ /@position@/: The channel positions to -- reorder to. -> m Bool -- ^ __Returns:__ 'P.True' if the channel positions are valid and reordering -- was successful. audioChannelPositionsToValidOrder :: [AudioChannelPosition] -> m Bool audioChannelPositionsToValidOrder position :: [AudioChannelPosition] position = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] position let position' :: [CInt] position' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] position Ptr CInt position'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] position' CInt result <- Ptr CInt -> Int32 -> IO CInt gst_audio_channel_positions_to_valid_order Ptr CInt position'' Int32 channels let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt position'' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_channel_positions_to_string -- Args: [ Arg -- { argCName = "position" -- , argType = -- TCArray -- False -- (-1) -- 1 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The %GstAudioChannelPositions\n to convert." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "gst_audio_channel_positions_to_string" gst_audio_channel_positions_to_string :: Ptr CInt -> -- position : TCArray False (-1) 1 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- channels : TBasicType TInt IO CString -- | Converts /@position@/ to a human-readable string representation for -- debugging purposes. audioChannelPositionsToString :: (B.CallStack.HasCallStack, MonadIO m) => [GstAudio.Enums.AudioChannelPosition] -- ^ /@position@/: The @/GstAudioChannelPositions/@ -- to convert. -> m T.Text -- ^ __Returns:__ a newly allocated string representing -- /@position@/ -- -- Since 1.10 audioChannelPositionsToString :: [AudioChannelPosition] -> m Text audioChannelPositionsToString position :: [AudioChannelPosition] position = IO Text -> m Text forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] position let position' :: [CInt] position' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] position Ptr CInt position'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] position' CString result <- Ptr CInt -> Int32 -> IO CString gst_audio_channel_positions_to_string Ptr CInt position'' Int32 channels Text -> CString -> IO () forall a. HasCallStack => Text -> Ptr a -> IO () checkUnexpectedReturnNULL "audioChannelPositionsToString" CString result Text result' <- HasCallStack => CString -> IO Text CString -> IO Text cstringToText CString result CString -> IO () forall a. Ptr a -> IO () freeMem CString result Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt position'' Text -> IO Text forall (m :: * -> *) a. Monad m => a -> m a return Text result' -- function gst_audio_channel_positions_to_mask -- Args: [ Arg -- { argCName = "position" -- , argType = -- TCArray -- False -- (-1) -- 1 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The %GstAudioChannelPositions" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "force_order" -- , argType = TBasicType TBoolean -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "Only consider the GStreamer channel order." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channel_mask" -- , argType = TBasicType TUInt64 -- , direction = DirectionOut -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the output channel mask" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels." -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_channel_positions_to_mask" gst_audio_channel_positions_to_mask :: Ptr CInt -> -- position : TCArray False (-1) 1 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) Int32 -> -- channels : TBasicType TInt CInt -> -- force_order : TBasicType TBoolean Ptr Word64 -> -- channel_mask : TBasicType TUInt64 IO CInt -- | Convert the /@position@/ array of /@channels@/ channels to a bitmask. -- -- If /@forceOrder@/ is 'P.True' it additionally checks if the channels are -- in the order required by GStreamer. audioChannelPositionsToMask :: (B.CallStack.HasCallStack, MonadIO m) => [GstAudio.Enums.AudioChannelPosition] -- ^ /@position@/: The @/GstAudioChannelPositions/@ -> Bool -- ^ /@forceOrder@/: Only consider the GStreamer channel order. -> m ((Bool, Word64)) -- ^ __Returns:__ 'P.True' if the channel positions are valid and could be converted. audioChannelPositionsToMask :: [AudioChannelPosition] -> Bool -> m (Bool, Word64) audioChannelPositionsToMask position :: [AudioChannelPosition] position forceOrder :: Bool forceOrder = IO (Bool, Word64) -> m (Bool, Word64) forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Bool, Word64) -> m (Bool, Word64)) -> IO (Bool, Word64) -> m (Bool, Word64) forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] position let position' :: [CInt] position' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] position Ptr CInt position'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] position' let forceOrder' :: CInt forceOrder' = (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . Bool -> Int forall a. Enum a => a -> Int fromEnum) Bool forceOrder Ptr Word64 channelMask <- IO (Ptr Word64) forall a. Storable a => IO (Ptr a) allocMem :: IO (Ptr Word64) CInt result <- Ptr CInt -> Int32 -> CInt -> Ptr Word64 -> IO CInt gst_audio_channel_positions_to_mask Ptr CInt position'' Int32 channels CInt forceOrder' Ptr Word64 channelMask let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Word64 channelMask' <- Ptr Word64 -> IO Word64 forall a. Storable a => Ptr a -> IO a peek Ptr Word64 channelMask Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt position'' Ptr Word64 -> IO () forall a. Ptr a -> IO () freeMem Ptr Word64 channelMask (Bool, Word64) -> IO (Bool, Word64) forall (m :: * -> *) a. Monad m => a -> m a return (Bool result', Word64 channelMask') -- function gst_audio_channel_positions_from_mask -- Args: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "channel_mask" -- , argType = TBasicType TUInt64 -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The input channel_mask" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "position" -- , argType = -- TCArray -- False -- (-1) -- 0 -- (TInterface -- Name { namespace = "GstAudio" , name = "AudioChannelPosition" }) -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The\n %GstAudioChannelPosition<!-- -->s" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "The number of channels" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , transfer = TransferNothing -- } -- ] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gst_audio_channel_positions_from_mask" gst_audio_channel_positions_from_mask :: Int32 -> -- channels : TBasicType TInt Word64 -> -- channel_mask : TBasicType TUInt64 Ptr CInt -> -- position : TCArray False (-1) 0 (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})) IO CInt -- | Convert the /@channels@/ present in /@channelMask@/ to a /@position@/ array -- (which should have at least /@channels@/ entries ensured by caller). -- If /@channelMask@/ is set to 0, it is considered as \'not present\' for purpose -- of conversion. -- A partially valid /@channelMask@/ with less bits set than the number -- of channels is considered valid. audioChannelPositionsFromMask :: (B.CallStack.HasCallStack, MonadIO m) => Word64 -- ^ /@channelMask@/: The input channel_mask -> [GstAudio.Enums.AudioChannelPosition] -- ^ /@position@/: The -- @/GstAudioChannelPosition/@s -> m Bool -- ^ __Returns:__ 'P.True' if channel and channel mask are valid and could be converted audioChannelPositionsFromMask :: Word64 -> [AudioChannelPosition] -> m Bool audioChannelPositionsFromMask channelMask :: Word64 channelMask position :: [AudioChannelPosition] position = IO Bool -> m Bool forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do let channels :: Int32 channels = Int -> Int32 forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> Int32) -> Int -> Int32 forall a b. (a -> b) -> a -> b $ [AudioChannelPosition] -> Int forall (t :: * -> *) a. Foldable t => t a -> Int length [AudioChannelPosition] position let position' :: [CInt] position' = (AudioChannelPosition -> CInt) -> [AudioChannelPosition] -> [CInt] forall a b. (a -> b) -> [a] -> [b] map (Int -> CInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CInt) -> (AudioChannelPosition -> Int) -> AudioChannelPosition -> CInt forall b c a. (b -> c) -> (a -> b) -> a -> c . AudioChannelPosition -> Int forall a. Enum a => a -> Int fromEnum) [AudioChannelPosition] position Ptr CInt position'' <- [CInt] -> IO (Ptr CInt) forall a. Storable a => [a] -> IO (Ptr a) packStorableArray [CInt] position' CInt result <- Int32 -> Word64 -> Ptr CInt -> IO CInt gst_audio_channel_positions_from_mask Int32 channels Word64 channelMask Ptr CInt position'' let result' :: Bool result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= 0) CInt result Ptr CInt -> IO () forall a. Ptr a -> IO () freeMem Ptr CInt position'' Bool -> IO Bool forall (m :: * -> *) a. Monad m => a -> m a return Bool result' -- function gst_audio_channel_get_fallback_mask -- Args: [ Arg -- { argCName = "channels" -- , argType = TBasicType TInt -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the number of channels" -- , 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_channel_get_fallback_mask" gst_audio_channel_get_fallback_mask :: Int32 -> -- channels : TBasicType TInt IO Word64 -- | Get the fallback channel-mask for the given number of channels. -- -- This function returns a reasonable fallback channel-mask and should be -- called as a last resort when the specific channel map is unknown. -- -- /Since: 1.8/ audioChannelGetFallbackMask :: (B.CallStack.HasCallStack, MonadIO m) => Int32 -- ^ /@channels@/: the number of channels -> m Word64 -- ^ __Returns:__ a fallback channel-mask for /@channels@/ or 0 when there is no -- mask and mono. audioChannelGetFallbackMask :: Int32 -> m Word64 audioChannelGetFallbackMask channels :: Int32 channels = IO Word64 -> m Word64 forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Word64 -> m Word64) -> IO Word64 -> m Word64 forall a b. (a -> b) -> a -> b $ do Word64 result <- Int32 -> IO Word64 gst_audio_channel_get_fallback_mask Int32 channels Word64 -> IO Word64 forall (m :: * -> *) a. Monad m => a -> m a return Word64 result