gi-gstaudio-1.0.17: GI/GstAudio/Structs/AudioInfo.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
Information describing audio properties. This information can be filled
in from GstCaps with 'GI.GstAudio.Structs.AudioInfo.audioInfoFromCaps'.
Use the provided macros to access the info in this structure.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GstAudio.Structs.AudioInfo
(
-- * Exported types
AudioInfo(..) ,
newZeroAudioInfo ,
noAudioInfo ,
-- * Methods
-- ** convert #method:convert#
#if ENABLE_OVERLOADING
AudioInfoConvertMethodInfo ,
#endif
audioInfoConvert ,
-- ** copy #method:copy#
#if ENABLE_OVERLOADING
AudioInfoCopyMethodInfo ,
#endif
audioInfoCopy ,
-- ** free #method:free#
#if ENABLE_OVERLOADING
AudioInfoFreeMethodInfo ,
#endif
audioInfoFree ,
-- ** fromCaps #method:fromCaps#
#if ENABLE_OVERLOADING
AudioInfoFromCapsMethodInfo ,
#endif
audioInfoFromCaps ,
-- ** init #method:init#
#if ENABLE_OVERLOADING
AudioInfoInitMethodInfo ,
#endif
audioInfoInit ,
-- ** isEqual #method:isEqual#
#if ENABLE_OVERLOADING
AudioInfoIsEqualMethodInfo ,
#endif
audioInfoIsEqual ,
-- ** new #method:new#
audioInfoNew ,
-- ** setFormat #method:setFormat#
#if ENABLE_OVERLOADING
AudioInfoSetFormatMethodInfo ,
#endif
audioInfoSetFormat ,
-- ** toCaps #method:toCaps#
#if ENABLE_OVERLOADING
AudioInfoToCapsMethodInfo ,
#endif
audioInfoToCaps ,
-- * Properties
-- ** bpf #attr:bpf#
{- | the number of bytes for one frame, this is the size of one
sample * /@channels@/
-}
#if ENABLE_OVERLOADING
audioInfo_bpf ,
#endif
getAudioInfoBpf ,
setAudioInfoBpf ,
-- ** channels #attr:channels#
{- | the number of channels
-}
#if ENABLE_OVERLOADING
audioInfo_channels ,
#endif
getAudioInfoChannels ,
setAudioInfoChannels ,
-- ** finfo #attr:finfo#
{- | the format info of the audio
-}
#if ENABLE_OVERLOADING
audioInfo_finfo ,
#endif
clearAudioInfoFinfo ,
getAudioInfoFinfo ,
setAudioInfoFinfo ,
-- ** flags #attr:flags#
{- | additional audio flags
-}
#if ENABLE_OVERLOADING
audioInfo_flags ,
#endif
getAudioInfoFlags ,
setAudioInfoFlags ,
-- ** layout #attr:layout#
{- | audio layout
-}
#if ENABLE_OVERLOADING
audioInfo_layout ,
#endif
getAudioInfoLayout ,
setAudioInfoLayout ,
-- ** rate #attr:rate#
{- | the audio sample rate
-}
#if ENABLE_OVERLOADING
audioInfo_rate ,
#endif
getAudioInfoRate ,
setAudioInfoRate ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.Gst.Enums as Gst.Enums
import qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.GstAudio.Enums as GstAudio.Enums
import {-# SOURCE #-} qualified GI.GstAudio.Flags as GstAudio.Flags
import {-# SOURCE #-} qualified GI.GstAudio.Structs.AudioFormatInfo as GstAudio.AudioFormatInfo
-- | Memory-managed wrapper type.
newtype AudioInfo = AudioInfo (ManagedPtr AudioInfo)
foreign import ccall "gst_audio_info_get_type" c_gst_audio_info_get_type ::
IO GType
instance BoxedObject AudioInfo where
boxedType _ = c_gst_audio_info_get_type
-- | Construct a `AudioInfo` struct initialized to zero.
newZeroAudioInfo :: MonadIO m => m AudioInfo
newZeroAudioInfo = liftIO $ callocBoxedBytes 320 >>= wrapBoxed AudioInfo
instance tag ~ 'AttrSet => Constructible AudioInfo tag where
new _ attrs = do
o <- newZeroAudioInfo
GI.Attributes.set o attrs
return o
-- | A convenience alias for `Nothing` :: `Maybe` `AudioInfo`.
noAudioInfo :: Maybe AudioInfo
noAudioInfo = Nothing
{- |
Get the value of the “@finfo@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #finfo
@
-}
getAudioInfoFinfo :: MonadIO m => AudioInfo -> m (Maybe GstAudio.AudioFormatInfo.AudioFormatInfo)
getAudioInfoFinfo s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr GstAudio.AudioFormatInfo.AudioFormatInfo)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newPtr GstAudio.AudioFormatInfo.AudioFormatInfo) val'
return val''
return result
{- |
Set the value of the “@finfo@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #finfo 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoFinfo :: MonadIO m => AudioInfo -> Ptr GstAudio.AudioFormatInfo.AudioFormatInfo -> m ()
setAudioInfoFinfo s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Ptr GstAudio.AudioFormatInfo.AudioFormatInfo)
{- |
Set the value of the “@finfo@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #finfo
@
-}
clearAudioInfoFinfo :: MonadIO m => AudioInfo -> m ()
clearAudioInfoFinfo s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: Ptr GstAudio.AudioFormatInfo.AudioFormatInfo)
#if ENABLE_OVERLOADING
data AudioInfoFinfoFieldInfo
instance AttrInfo AudioInfoFinfoFieldInfo where
type AttrAllowedOps AudioInfoFinfoFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AudioInfoFinfoFieldInfo = (~) (Ptr GstAudio.AudioFormatInfo.AudioFormatInfo)
type AttrBaseTypeConstraint AudioInfoFinfoFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoFinfoFieldInfo = Maybe GstAudio.AudioFormatInfo.AudioFormatInfo
type AttrLabel AudioInfoFinfoFieldInfo = "finfo"
type AttrOrigin AudioInfoFinfoFieldInfo = AudioInfo
attrGet _ = getAudioInfoFinfo
attrSet _ = setAudioInfoFinfo
attrConstruct = undefined
attrClear _ = clearAudioInfoFinfo
audioInfo_finfo :: AttrLabelProxy "finfo"
audioInfo_finfo = AttrLabelProxy
#endif
{- |
Get the value of the “@flags@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #flags
@
-}
getAudioInfoFlags :: MonadIO m => AudioInfo -> m [GstAudio.Flags.AudioFlags]
getAudioInfoFlags s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CUInt
let val' = wordToGFlags val
return val'
{- |
Set the value of the “@flags@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #flags 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoFlags :: MonadIO m => AudioInfo -> [GstAudio.Flags.AudioFlags] -> m ()
setAudioInfoFlags s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gflagsToWord val
poke (ptr `plusPtr` 8) (val' :: CUInt)
#if ENABLE_OVERLOADING
data AudioInfoFlagsFieldInfo
instance AttrInfo AudioInfoFlagsFieldInfo where
type AttrAllowedOps AudioInfoFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AudioInfoFlagsFieldInfo = (~) [GstAudio.Flags.AudioFlags]
type AttrBaseTypeConstraint AudioInfoFlagsFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoFlagsFieldInfo = [GstAudio.Flags.AudioFlags]
type AttrLabel AudioInfoFlagsFieldInfo = "flags"
type AttrOrigin AudioInfoFlagsFieldInfo = AudioInfo
attrGet _ = getAudioInfoFlags
attrSet _ = setAudioInfoFlags
attrConstruct = undefined
attrClear _ = undefined
audioInfo_flags :: AttrLabelProxy "flags"
audioInfo_flags = AttrLabelProxy
#endif
{- |
Get the value of the “@layout@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #layout
@
-}
getAudioInfoLayout :: MonadIO m => AudioInfo -> m GstAudio.Enums.AudioLayout
getAudioInfoLayout s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
{- |
Set the value of the “@layout@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #layout 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoLayout :: MonadIO m => AudioInfo -> GstAudio.Enums.AudioLayout -> m ()
setAudioInfoLayout s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 12) (val' :: CUInt)
#if ENABLE_OVERLOADING
data AudioInfoLayoutFieldInfo
instance AttrInfo AudioInfoLayoutFieldInfo where
type AttrAllowedOps AudioInfoLayoutFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AudioInfoLayoutFieldInfo = (~) GstAudio.Enums.AudioLayout
type AttrBaseTypeConstraint AudioInfoLayoutFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoLayoutFieldInfo = GstAudio.Enums.AudioLayout
type AttrLabel AudioInfoLayoutFieldInfo = "layout"
type AttrOrigin AudioInfoLayoutFieldInfo = AudioInfo
attrGet _ = getAudioInfoLayout
attrSet _ = setAudioInfoLayout
attrConstruct = undefined
attrClear _ = undefined
audioInfo_layout :: AttrLabelProxy "layout"
audioInfo_layout = AttrLabelProxy
#endif
{- |
Get the value of the “@rate@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #rate
@
-}
getAudioInfoRate :: MonadIO m => AudioInfo -> m Int32
getAudioInfoRate s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Int32
return val
{- |
Set the value of the “@rate@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #rate 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoRate :: MonadIO m => AudioInfo -> Int32 -> m ()
setAudioInfoRate s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Int32)
#if ENABLE_OVERLOADING
data AudioInfoRateFieldInfo
instance AttrInfo AudioInfoRateFieldInfo where
type AttrAllowedOps AudioInfoRateFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AudioInfoRateFieldInfo = (~) Int32
type AttrBaseTypeConstraint AudioInfoRateFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoRateFieldInfo = Int32
type AttrLabel AudioInfoRateFieldInfo = "rate"
type AttrOrigin AudioInfoRateFieldInfo = AudioInfo
attrGet _ = getAudioInfoRate
attrSet _ = setAudioInfoRate
attrConstruct = undefined
attrClear _ = undefined
audioInfo_rate :: AttrLabelProxy "rate"
audioInfo_rate = AttrLabelProxy
#endif
{- |
Get the value of the “@channels@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #channels
@
-}
getAudioInfoChannels :: MonadIO m => AudioInfo -> m Int32
getAudioInfoChannels s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Int32
return val
{- |
Set the value of the “@channels@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #channels 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoChannels :: MonadIO m => AudioInfo -> Int32 -> m ()
setAudioInfoChannels s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 20) (val :: Int32)
#if ENABLE_OVERLOADING
data AudioInfoChannelsFieldInfo
instance AttrInfo AudioInfoChannelsFieldInfo where
type AttrAllowedOps AudioInfoChannelsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AudioInfoChannelsFieldInfo = (~) Int32
type AttrBaseTypeConstraint AudioInfoChannelsFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoChannelsFieldInfo = Int32
type AttrLabel AudioInfoChannelsFieldInfo = "channels"
type AttrOrigin AudioInfoChannelsFieldInfo = AudioInfo
attrGet _ = getAudioInfoChannels
attrSet _ = setAudioInfoChannels
attrConstruct = undefined
attrClear _ = undefined
audioInfo_channels :: AttrLabelProxy "channels"
audioInfo_channels = AttrLabelProxy
#endif
{- |
Get the value of the “@bpf@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' audioInfo #bpf
@
-}
getAudioInfoBpf :: MonadIO m => AudioInfo -> m Int32
getAudioInfoBpf s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO Int32
return val
{- |
Set the value of the “@bpf@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' audioInfo [ #bpf 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAudioInfoBpf :: MonadIO m => AudioInfo -> Int32 -> m ()
setAudioInfoBpf s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: Int32)
#if ENABLE_OVERLOADING
data AudioInfoBpfFieldInfo
instance AttrInfo AudioInfoBpfFieldInfo where
type AttrAllowedOps AudioInfoBpfFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AudioInfoBpfFieldInfo = (~) Int32
type AttrBaseTypeConstraint AudioInfoBpfFieldInfo = (~) AudioInfo
type AttrGetType AudioInfoBpfFieldInfo = Int32
type AttrLabel AudioInfoBpfFieldInfo = "bpf"
type AttrOrigin AudioInfoBpfFieldInfo = AudioInfo
attrGet _ = getAudioInfoBpf
attrSet _ = setAudioInfoBpf
attrConstruct = undefined
attrClear _ = undefined
audioInfo_bpf :: AttrLabelProxy "bpf"
audioInfo_bpf = AttrLabelProxy
#endif
-- XXX Skipped attribute for "AudioInfo:position" :: Not implemented: "Don't know how to unpack C array of type TCArray False 64 (-1) (TInterface (Name {namespace = \"GstAudio\", name = \"AudioChannelPosition\"}))"
#if ENABLE_OVERLOADING
instance O.HasAttributeList AudioInfo
type instance O.AttributeList AudioInfo = AudioInfoAttributeList
type AudioInfoAttributeList = ('[ '("finfo", AudioInfoFinfoFieldInfo), '("flags", AudioInfoFlagsFieldInfo), '("layout", AudioInfoLayoutFieldInfo), '("rate", AudioInfoRateFieldInfo), '("channels", AudioInfoChannelsFieldInfo), '("bpf", AudioInfoBpfFieldInfo)] :: [(Symbol, *)])
#endif
-- method AudioInfo::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_audio_info_new" gst_audio_info_new ::
IO (Ptr AudioInfo)
{- |
Allocate a new 'GI.GstAudio.Structs.AudioInfo.AudioInfo' that is also initialized with
'GI.GstAudio.Structs.AudioInfo.audioInfoInit'.
-}
audioInfoNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m AudioInfo
{- ^ __Returns:__ a new 'GI.GstAudio.Structs.AudioInfo.AudioInfo'. free with 'GI.GstAudio.Structs.AudioInfo.audioInfoFree'. -}
audioInfoNew = liftIO $ do
result <- gst_audio_info_new
checkUnexpectedReturnNULL "audioInfoNew" result
result' <- (wrapBoxed AudioInfo) result
return result'
#if ENABLE_OVERLOADING
#endif
-- method AudioInfo::convert
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_fmt", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstFormat of the @src_val", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "src_val", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "value to convert", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_fmt", argType = TInterface (Name {namespace = "Gst", name = "Format"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GstFormat of the @dest_val", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest_val", argType = TBasicType TInt64, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to destination value", 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_info_convert" gst_audio_info_convert ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
CUInt -> -- src_fmt : TInterface (Name {namespace = "Gst", name = "Format"})
Int64 -> -- src_val : TBasicType TInt64
CUInt -> -- dest_fmt : TInterface (Name {namespace = "Gst", name = "Format"})
Ptr Int64 -> -- dest_val : TBasicType TInt64
IO CInt
{- |
Converts among various 'GI.Gst.Enums.Format' types. This function handles
GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For
raw audio, GST_FORMAT_DEFAULT corresponds to audio frames. This
function can be used to handle pad queries of the type GST_QUERY_CONVERT.
-}
audioInfoConvert ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> Gst.Enums.Format
{- ^ /@srcFmt@/: 'GI.Gst.Enums.Format' of the /@srcVal@/ -}
-> Int64
{- ^ /@srcVal@/: value to convert -}
-> Gst.Enums.Format
{- ^ /@destFmt@/: 'GI.Gst.Enums.Format' of the /@destVal@/ -}
-> m ((Bool, Int64))
{- ^ __Returns:__ TRUE if the conversion was successful. -}
audioInfoConvert info srcFmt srcVal destFmt = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
let srcFmt' = (fromIntegral . fromEnum) srcFmt
let destFmt' = (fromIntegral . fromEnum) destFmt
destVal <- allocMem :: IO (Ptr Int64)
result <- gst_audio_info_convert info' srcFmt' srcVal destFmt' destVal
let result' = (/= 0) result
destVal' <- peek destVal
touchManagedPtr info
freeMem destVal
return (result', destVal')
#if ENABLE_OVERLOADING
data AudioInfoConvertMethodInfo
instance (signature ~ (Gst.Enums.Format -> Int64 -> Gst.Enums.Format -> m ((Bool, Int64))), MonadIO m) => O.MethodInfo AudioInfoConvertMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoConvert
#endif
-- method AudioInfo::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_audio_info_copy" gst_audio_info_copy ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
IO (Ptr AudioInfo)
{- |
Copy a GstAudioInfo structure.
-}
audioInfoCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> m AudioInfo
{- ^ __Returns:__ a new 'GI.GstAudio.Structs.AudioInfo.AudioInfo'. free with gst_audio_info_free. -}
audioInfoCopy info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- gst_audio_info_copy info'
checkUnexpectedReturnNULL "audioInfoCopy" result
result' <- (wrapBoxed AudioInfo) result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data AudioInfoCopyMethodInfo
instance (signature ~ (m AudioInfo), MonadIO m) => O.MethodInfo AudioInfoCopyMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoCopy
#endif
-- method AudioInfo::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", 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_info_free" gst_audio_info_free ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
IO ()
{- |
Free a GstAudioInfo structure previously allocated with 'GI.GstAudio.Structs.AudioInfo.audioInfoNew'
or 'GI.GstAudio.Structs.AudioInfo.audioInfoCopy'.
-}
audioInfoFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> m ()
audioInfoFree info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
gst_audio_info_free info'
touchManagedPtr info
return ()
#if ENABLE_OVERLOADING
data AudioInfoFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioInfoFreeMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoFree
#endif
-- method AudioInfo::from_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_audio_info_from_caps" gst_audio_info_from_caps ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
IO CInt
{- |
Parse /@caps@/ and update /@info@/.
-}
audioInfoFromCaps ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> Gst.Caps.Caps
{- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' -}
-> m Bool
{- ^ __Returns:__ TRUE if /@caps@/ could be parsed -}
audioInfoFromCaps info caps = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
caps' <- unsafeManagedPtrGetPtr caps
result <- gst_audio_info_from_caps info' caps'
let result' = (/= 0) result
touchManagedPtr info
touchManagedPtr caps
return result'
#if ENABLE_OVERLOADING
data AudioInfoFromCapsMethodInfo
instance (signature ~ (Gst.Caps.Caps -> m Bool), MonadIO m) => O.MethodInfo AudioInfoFromCapsMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoFromCaps
#endif
-- method AudioInfo::init
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", 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_info_init" gst_audio_info_init ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
IO ()
{- |
Initialize /@info@/ with default values.
-}
audioInfoInit ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> m ()
audioInfoInit info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
gst_audio_info_init info'
touchManagedPtr info
return ()
#if ENABLE_OVERLOADING
data AudioInfoInitMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo AudioInfoInitMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoInit
#endif
-- method AudioInfo::is_equal
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "other", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False
foreign import ccall "gst_audio_info_is_equal" gst_audio_info_is_equal ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
Ptr AudioInfo -> -- other : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
IO CInt
{- |
Compares two 'GI.GstAudio.Structs.AudioInfo.AudioInfo' and returns whether they are equal or not
/Since: 1.2/
-}
audioInfoIsEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> AudioInfo
{- ^ /@other@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> m Bool
{- ^ __Returns:__ 'True' if /@info@/ and /@other@/ are equal, else 'False'. -}
audioInfoIsEqual info other = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
other' <- unsafeManagedPtrGetPtr other
result <- gst_audio_info_is_equal info' other'
let result' = (/= 0) result
touchManagedPtr info
touchManagedPtr other
return result'
#if ENABLE_OVERLOADING
data AudioInfoIsEqualMethodInfo
instance (signature ~ (AudioInfo -> m Bool), MonadIO m) => O.MethodInfo AudioInfoIsEqualMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoIsEqual
#endif
-- method AudioInfo::set_format
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", 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 format", 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 "the samplerate", 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 = "position", argType = TCArray False 64 (-1) (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"})), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the channel positions", 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_info_set_format" gst_audio_info_set_format ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
CUInt -> -- format : TInterface (Name {namespace = "GstAudio", name = "AudioFormat"})
Int32 -> -- rate : TBasicType TInt
Int32 -> -- channels : TBasicType TInt
Ptr CInt -> -- position : TCArray False 64 (-1) (TInterface (Name {namespace = "GstAudio", name = "AudioChannelPosition"}))
IO ()
{- |
Set the default info for the audio info of /@format@/ and /@rate@/ and /@channels@/.
Note: This initializes /@info@/ first, no values are preserved.
-}
audioInfoSetFormat ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> GstAudio.Enums.AudioFormat
{- ^ /@format@/: the format -}
-> Int32
{- ^ /@rate@/: the samplerate -}
-> Int32
{- ^ /@channels@/: the number of channels -}
-> Maybe ([GstAudio.Enums.AudioChannelPosition])
{- ^ /@position@/: the channel positions -}
-> m ()
audioInfoSetFormat info format rate channels position = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
let format' = (fromIntegral . fromEnum) format
maybePosition <- case position of
Nothing -> return nullPtr
Just jPosition -> do
let jPosition' = map (fromIntegral . fromEnum) jPosition
jPosition'' <- packStorableArray jPosition'
return jPosition''
gst_audio_info_set_format info' format' rate channels maybePosition
touchManagedPtr info
freeMem maybePosition
return ()
#if ENABLE_OVERLOADING
data AudioInfoSetFormatMethodInfo
instance (signature ~ (GstAudio.Enums.AudioFormat -> Int32 -> Int32 -> Maybe ([GstAudio.Enums.AudioChannelPosition]) -> m ()), MonadIO m) => O.MethodInfo AudioInfoSetFormatMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoSetFormat
#endif
-- method AudioInfo::to_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "info", argType = TInterface (Name {namespace = "GstAudio", name = "AudioInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstAudioInfo", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_audio_info_to_caps" gst_audio_info_to_caps ::
Ptr AudioInfo -> -- info : TInterface (Name {namespace = "GstAudio", name = "AudioInfo"})
IO (Ptr Gst.Caps.Caps)
{- |
Convert the values of /@info@/ into a 'GI.Gst.Structs.Caps.Caps'.
-}
audioInfoToCaps ::
(B.CallStack.HasCallStack, MonadIO m) =>
AudioInfo
{- ^ /@info@/: a 'GI.GstAudio.Structs.AudioInfo.AudioInfo' -}
-> m Gst.Caps.Caps
{- ^ __Returns:__ the new 'GI.Gst.Structs.Caps.Caps' containing the
info of /@info@/. -}
audioInfoToCaps info = liftIO $ do
info' <- unsafeManagedPtrGetPtr info
result <- gst_audio_info_to_caps info'
checkUnexpectedReturnNULL "audioInfoToCaps" result
result' <- (wrapBoxed Gst.Caps.Caps) result
touchManagedPtr info
return result'
#if ENABLE_OVERLOADING
data AudioInfoToCapsMethodInfo
instance (signature ~ (m Gst.Caps.Caps), MonadIO m) => O.MethodInfo AudioInfoToCapsMethodInfo AudioInfo signature where
overloadedMethod _ = audioInfoToCaps
#endif
#if ENABLE_OVERLOADING
type family ResolveAudioInfoMethod (t :: Symbol) (o :: *) :: * where
ResolveAudioInfoMethod "convert" o = AudioInfoConvertMethodInfo
ResolveAudioInfoMethod "copy" o = AudioInfoCopyMethodInfo
ResolveAudioInfoMethod "free" o = AudioInfoFreeMethodInfo
ResolveAudioInfoMethod "fromCaps" o = AudioInfoFromCapsMethodInfo
ResolveAudioInfoMethod "init" o = AudioInfoInitMethodInfo
ResolveAudioInfoMethod "isEqual" o = AudioInfoIsEqualMethodInfo
ResolveAudioInfoMethod "toCaps" o = AudioInfoToCapsMethodInfo
ResolveAudioInfoMethod "setFormat" o = AudioInfoSetFormatMethodInfo
ResolveAudioInfoMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAudioInfoMethod t AudioInfo, O.MethodInfo info AudioInfo p) => OL.IsLabel t (AudioInfo -> 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