-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- 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.GstPbutils.Functions
    ( 

 -- * Methods


-- ** codecUtilsAacCapsSetLevelAndProfile #method:codecUtilsAacCapsSetLevelAndProfile#

    codecUtilsAacCapsSetLevelAndProfile     ,


-- ** codecUtilsAacGetChannels #method:codecUtilsAacGetChannels#

    codecUtilsAacGetChannels                ,


-- ** codecUtilsAacGetIndexFromSampleRate #method:codecUtilsAacGetIndexFromSampleRate#

    codecUtilsAacGetIndexFromSampleRate     ,


-- ** codecUtilsAacGetLevel #method:codecUtilsAacGetLevel#

    codecUtilsAacGetLevel                   ,


-- ** codecUtilsAacGetProfile #method:codecUtilsAacGetProfile#

    codecUtilsAacGetProfile                 ,


-- ** codecUtilsAacGetSampleRate #method:codecUtilsAacGetSampleRate#

    codecUtilsAacGetSampleRate              ,


-- ** codecUtilsAacGetSampleRateFromIndex #method:codecUtilsAacGetSampleRateFromIndex#

    codecUtilsAacGetSampleRateFromIndex     ,


-- ** codecUtilsCapsGetMimeCodec #method:codecUtilsCapsGetMimeCodec#

    codecUtilsCapsGetMimeCodec              ,


-- ** codecUtilsH264CapsSetLevelAndProfile #method:codecUtilsH264CapsSetLevelAndProfile#

    codecUtilsH264CapsSetLevelAndProfile    ,


-- ** codecUtilsH264GetLevel #method:codecUtilsH264GetLevel#

    codecUtilsH264GetLevel                  ,


-- ** codecUtilsH264GetLevelIdc #method:codecUtilsH264GetLevelIdc#

    codecUtilsH264GetLevelIdc               ,


-- ** codecUtilsH264GetProfile #method:codecUtilsH264GetProfile#

    codecUtilsH264GetProfile                ,


-- ** codecUtilsH264GetProfileFlagsLevel #method:codecUtilsH264GetProfileFlagsLevel#

    codecUtilsH264GetProfileFlagsLevel      ,


-- ** codecUtilsH265CapsSetLevelTierAndProfile #method:codecUtilsH265CapsSetLevelTierAndProfile#

    codecUtilsH265CapsSetLevelTierAndProfile,


-- ** codecUtilsH265GetLevel #method:codecUtilsH265GetLevel#

    codecUtilsH265GetLevel                  ,


-- ** codecUtilsH265GetLevelIdc #method:codecUtilsH265GetLevelIdc#

    codecUtilsH265GetLevelIdc               ,


-- ** codecUtilsH265GetProfile #method:codecUtilsH265GetProfile#

    codecUtilsH265GetProfile                ,


-- ** codecUtilsH265GetTier #method:codecUtilsH265GetTier#

    codecUtilsH265GetTier                   ,


-- ** codecUtilsMpeg4videoCapsSetLevelAndProfile #method:codecUtilsMpeg4videoCapsSetLevelAndProfile#

    codecUtilsMpeg4videoCapsSetLevelAndProfile,


-- ** codecUtilsMpeg4videoGetLevel #method:codecUtilsMpeg4videoGetLevel#

    codecUtilsMpeg4videoGetLevel            ,


-- ** codecUtilsMpeg4videoGetProfile #method:codecUtilsMpeg4videoGetProfile#

    codecUtilsMpeg4videoGetProfile          ,


-- ** codecUtilsOpusCreateCaps #method:codecUtilsOpusCreateCaps#

    codecUtilsOpusCreateCaps                ,


-- ** codecUtilsOpusCreateCapsFromHeader #method:codecUtilsOpusCreateCapsFromHeader#

    codecUtilsOpusCreateCapsFromHeader      ,


-- ** codecUtilsOpusCreateHeader #method:codecUtilsOpusCreateHeader#

    codecUtilsOpusCreateHeader              ,


-- ** codecUtilsOpusParseCaps #method:codecUtilsOpusParseCaps#

    codecUtilsOpusParseCaps                 ,


-- ** codecUtilsOpusParseHeader #method:codecUtilsOpusParseHeader#

    codecUtilsOpusParseHeader               ,


-- ** encodingListAllTargets #method:encodingListAllTargets#

    encodingListAllTargets                  ,


-- ** encodingListAvailableCategories #method:encodingListAvailableCategories#

    encodingListAvailableCategories         ,


-- ** installPluginsAsync #method:installPluginsAsync#

    installPluginsAsync                     ,


-- ** installPluginsInstallationInProgress #method:installPluginsInstallationInProgress#

    installPluginsInstallationInProgress    ,


-- ** installPluginsSupported #method:installPluginsSupported#

    installPluginsSupported                 ,


-- ** installPluginsSync #method:installPluginsSync#

    installPluginsSync                      ,


-- ** isMissingPluginMessage #method:isMissingPluginMessage#

    isMissingPluginMessage                  ,


-- ** missingDecoderInstallerDetailNew #method:missingDecoderInstallerDetailNew#

    missingDecoderInstallerDetailNew        ,


-- ** missingDecoderMessageNew #method:missingDecoderMessageNew#

    missingDecoderMessageNew                ,


-- ** missingElementInstallerDetailNew #method:missingElementInstallerDetailNew#

    missingElementInstallerDetailNew        ,


-- ** missingElementMessageNew #method:missingElementMessageNew#

    missingElementMessageNew                ,


-- ** missingEncoderInstallerDetailNew #method:missingEncoderInstallerDetailNew#

    missingEncoderInstallerDetailNew        ,


-- ** missingEncoderMessageNew #method:missingEncoderMessageNew#

    missingEncoderMessageNew                ,


-- ** missingPluginMessageGetDescription #method:missingPluginMessageGetDescription#

    missingPluginMessageGetDescription      ,


-- ** missingPluginMessageGetInstallerDetail #method:missingPluginMessageGetInstallerDetail#

    missingPluginMessageGetInstallerDetail  ,


-- ** missingUriSinkInstallerDetailNew #method:missingUriSinkInstallerDetailNew#

    missingUriSinkInstallerDetailNew        ,


-- ** missingUriSinkMessageNew #method:missingUriSinkMessageNew#

    missingUriSinkMessageNew                ,


-- ** missingUriSourceInstallerDetailNew #method:missingUriSourceInstallerDetailNew#

    missingUriSourceInstallerDetailNew      ,


-- ** missingUriSourceMessageNew #method:missingUriSourceMessageNew#

    missingUriSourceMessageNew              ,


-- ** pbUtilsAddCodecDescriptionToTagList #method:pbUtilsAddCodecDescriptionToTagList#

    pbUtilsAddCodecDescriptionToTagList     ,


-- ** pbUtilsGetCapsDescriptionFlags #method:pbUtilsGetCapsDescriptionFlags#

    pbUtilsGetCapsDescriptionFlags          ,


-- ** pbUtilsGetCodecDescription #method:pbUtilsGetCodecDescription#

    pbUtilsGetCodecDescription              ,


-- ** pbUtilsGetDecoderDescription #method:pbUtilsGetDecoderDescription#

    pbUtilsGetDecoderDescription            ,


-- ** pbUtilsGetElementDescription #method:pbUtilsGetElementDescription#

    pbUtilsGetElementDescription            ,


-- ** pbUtilsGetEncoderDescription #method:pbUtilsGetEncoderDescription#

    pbUtilsGetEncoderDescription            ,


-- ** pbUtilsGetFileExtensionFromCaps #method:pbUtilsGetFileExtensionFromCaps#

    pbUtilsGetFileExtensionFromCaps         ,


-- ** pbUtilsGetSinkDescription #method:pbUtilsGetSinkDescription#

    pbUtilsGetSinkDescription               ,


-- ** pbUtilsGetSourceDescription #method:pbUtilsGetSourceDescription#

    pbUtilsGetSourceDescription             ,


-- ** pbUtilsInit #method:pbUtilsInit#

    pbUtilsInit                             ,


-- ** pluginsBaseVersion #method:pluginsBaseVersion#

    pluginsBaseVersion                      ,


-- ** pluginsBaseVersionString #method:pluginsBaseVersionString#

    pluginsBaseVersionString                ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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 Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R

import qualified GI.Gst.Objects.Element as Gst.Element
import qualified GI.Gst.Structs.Buffer as Gst.Buffer
import qualified GI.Gst.Structs.Caps as Gst.Caps
import qualified GI.Gst.Structs.Message as Gst.Message
import qualified GI.Gst.Structs.TagList as Gst.TagList
import qualified GI.GstPbutils.Callbacks as GstPbutils.Callbacks
import {-# SOURCE #-} qualified GI.GstPbutils.Enums as GstPbutils.Enums
import {-# SOURCE #-} qualified GI.GstPbutils.Flags as GstPbutils.Flags
import {-# SOURCE #-} qualified GI.GstPbutils.Objects.EncodingTarget as GstPbutils.EncodingTarget
import {-# SOURCE #-} qualified GI.GstPbutils.Structs.InstallPluginsContext as GstPbutils.InstallPluginsContext

-- function plugins_base_version_string
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugins_base_version_string" gst_plugins_base_version_string :: 
    IO CString

-- | This function returns a string that is useful for describing this version
-- of GStreamer\'s gst-plugins-base libraries to the outside world: user agent
-- strings, logging, about dialogs ...
pluginsBaseVersionString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.Text
    -- ^ __Returns:__ a newly allocated string describing this version of gst-plugins-base
pluginsBaseVersionString :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Text
pluginsBaseVersionString  = IO Text -> m Text
forall a. IO a -> m a
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
    CString
result <- IO CString
gst_plugins_base_version_string
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pluginsBaseVersionString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function plugins_base_version
-- Args: [ Arg
--           { argCName = "major"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a guint to store the major version number, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "minor"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a guint to store the minor version number, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "micro"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a guint to store the micro version number, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "nano"
--           , argType = TBasicType TUInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "pointer to a guint to store the nano version number, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_plugins_base_version" gst_plugins_base_version :: 
    Ptr Word32 ->                           -- major : TBasicType TUInt
    Ptr Word32 ->                           -- minor : TBasicType TUInt
    Ptr Word32 ->                           -- micro : TBasicType TUInt
    Ptr Word32 ->                           -- nano : TBasicType TUInt
    IO ()

-- | Gets the version number of the GStreamer Plugins Base libraries.
pluginsBaseVersion ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ((Word32, Word32, Word32, Word32))
pluginsBaseVersion :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
m (Word32, Word32, Word32, Word32)
pluginsBaseVersion  = IO (Word32, Word32, Word32, Word32)
-> m (Word32, Word32, Word32, Word32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Word32, Word32, Word32, Word32)
 -> m (Word32, Word32, Word32, Word32))
-> IO (Word32, Word32, Word32, Word32)
-> m (Word32, Word32, Word32, Word32)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word32
major <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word32
minor <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word32
micro <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word32
nano <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> Ptr Word32 -> IO ()
gst_plugins_base_version Ptr Word32
major Ptr Word32
minor Ptr Word32
micro Ptr Word32
nano
    Word32
major' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
major
    Word32
minor' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
minor
    Word32
micro' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
micro
    Word32
nano' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
nano
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
major
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
minor
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
micro
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
nano
    (Word32, Word32, Word32, Word32)
-> IO (Word32, Word32, Word32, Word32)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Word32
major', Word32
minor', Word32
micro', Word32
nano')


-- function pb_utils_init
-- Args: []
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_init" gst_pb_utils_init :: 
    IO ()

-- | Initialises the base utils support library. This function is not
-- thread-safe. Applications should call it after calling 'GI.Gst.Functions.init',
-- plugins should call it from their plugin_init function.
-- 
-- This function may be called multiple times. It will do nothing if the
-- library has already been initialised.
pbUtilsInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ()
pbUtilsInit :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m ()
pbUtilsInit  = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    IO ()
gst_pb_utils_init
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function pb_utils_get_source_description
-- Args: [ Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the protocol the source element needs to handle, e.g. \"http\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_source_description" gst_pb_utils_get_source_description :: 
    CString ->                              -- protocol : TBasicType TUTF8
    IO CString

-- | Returns a localised string describing a source element handling the protocol
-- specified in /@protocol@/, for use in error dialogs or other messages to be
-- seen by the user. Should never return NULL unless /@protocol@/ is invalid.
-- 
-- This function is mainly for internal use, applications would typically
-- use 'GI.GstPbutils.Functions.missingPluginMessageGetDescription' to get a description of
-- a missing feature from a missing-plugin message.
pbUtilsGetSourceDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@protocol@/: the protocol the source element needs to handle, e.g. \"http\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetSourceDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
pbUtilsGetSourceDescription Text
protocol = IO Text -> m Text
forall a. IO a -> m a
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
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
result <- CString -> IO CString
gst_pb_utils_get_source_description CString
protocol'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetSourceDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_sink_description
-- Args: [ Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the protocol the sink element needs to handle, e.g. \"http\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_sink_description" gst_pb_utils_get_sink_description :: 
    CString ->                              -- protocol : TBasicType TUTF8
    IO CString

-- | Returns a localised string describing a sink element handling the protocol
-- specified in /@protocol@/, for use in error dialogs or other messages to be
-- seen by the user. Should never return NULL unless /@protocol@/ is invalid.
-- 
-- This function is mainly for internal use, applications would typically
-- use 'GI.GstPbutils.Functions.missingPluginMessageGetDescription' to get a description of
-- a missing feature from a missing-plugin message.
pbUtilsGetSinkDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@protocol@/: the protocol the sink element needs to handle, e.g. \"http\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetSinkDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
pbUtilsGetSinkDescription Text
protocol = IO Text -> m Text
forall a. IO a -> m a
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
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
result <- CString -> IO CString
gst_pb_utils_get_sink_description CString
protocol'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetSinkDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_file_extension_from_caps
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) #GstCaps for which a file extension is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_file_extension_from_caps" gst_pb_utils_get_file_extension_from_caps :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns a possible file extension for the given caps, if known.
-- 
-- /Since: 1.20/
pbUtilsGetFileExtensionFromCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which a file extension is needed
    -> m (Maybe T.Text)
    -- ^ __Returns:__ a newly-allocated file extension string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetFileExtensionFromCaps :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> m (Maybe Text)
pbUtilsGetFileExtensionFromCaps Caps
caps = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CString
result <- Ptr Caps -> IO CString
gst_pb_utils_get_file_extension_from_caps Ptr Caps
caps'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function pb_utils_get_encoder_description
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the (fixed) #GstCaps for which an encoder description is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_encoder_description" gst_pb_utils_get_encoder_description :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns a localised string describing an encoder for the format specified
-- in /@caps@/, for use in error dialogs or other messages to be seen by the user.
-- Should never return NULL unless /@factoryName@/ or /@caps@/ are invalid.
-- 
-- This function is mainly for internal use, applications would typically
-- use 'GI.GstPbutils.Functions.missingPluginMessageGetDescription' to get a description of
-- a missing feature from a missing-plugin message.
pbUtilsGetEncoderDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which an encoder description is needed
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetEncoderDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Caps -> m Text
pbUtilsGetEncoderDescription Caps
caps = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CString
result <- Ptr Caps -> IO CString
gst_pb_utils_get_encoder_description Ptr Caps
caps'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetEncoderDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_element_description
-- Args: [ Arg
--           { argCName = "factory_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the name of the element, e.g. \"giosrc\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_element_description" gst_pb_utils_get_element_description :: 
    CString ->                              -- factory_name : TBasicType TUTF8
    IO CString

-- | Returns a localised string describing the given element, for use in
-- error dialogs or other messages to be seen by the user. Should never
-- return NULL unless /@factoryName@/ is invalid.
-- 
-- This function is mainly for internal use, applications would typically
-- use 'GI.GstPbutils.Functions.missingPluginMessageGetDescription' to get a description of
-- a missing feature from a missing-plugin message.
pbUtilsGetElementDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@factoryName@/: the name of the element, e.g. \"giosrc\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetElementDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
pbUtilsGetElementDescription Text
factoryName = IO Text -> m Text
forall a. IO a -> m a
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
    CString
factoryName' <- Text -> IO CString
textToCString Text
factoryName
    CString
result <- CString -> IO CString
gst_pb_utils_get_element_description CString
factoryName'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetElementDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
factoryName'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_decoder_description
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the (fixed) #GstCaps for which an decoder description is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_decoder_description" gst_pb_utils_get_decoder_description :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns a localised string describing an decoder for the format specified
-- in /@caps@/, for use in error dialogs or other messages to be seen by the user.
-- Should never return NULL unless /@factoryName@/ or /@caps@/ are invalid.
-- 
-- This function is mainly for internal use, applications would typically
-- use 'GI.GstPbutils.Functions.missingPluginMessageGetDescription' to get a description of
-- a missing feature from a missing-plugin message.
pbUtilsGetDecoderDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which an decoder description is needed
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetDecoderDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Caps -> m Text
pbUtilsGetDecoderDescription Caps
caps = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CString
result <- Ptr Caps -> IO CString
gst_pb_utils_get_decoder_description Ptr Caps
caps'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetDecoderDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_codec_description
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the (fixed) #GstCaps for which an format description is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_codec_description" gst_pb_utils_get_codec_description :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns a localised (as far as this is possible) string describing the
-- media format specified in /@caps@/, for use in error dialogs or other messages
-- to be seen by the user. Should never return NULL unless /@caps@/ is invalid.
-- 
-- Also see the convenience function
-- 'GI.GstPbutils.Functions.pbUtilsAddCodecDescriptionToTagList'.
pbUtilsGetCodecDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which an format description is needed
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
pbUtilsGetCodecDescription :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Caps -> m Text
pbUtilsGetCodecDescription Caps
caps = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CString
result <- Ptr Caps -> IO CString
gst_pb_utils_get_codec_description Ptr Caps
caps'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"pbUtilsGetCodecDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function pb_utils_get_caps_description_flags
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) #GstCaps for which flags are requested"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name
--                    { namespace = "GstPbutils"
--                    , name = "PbUtilsCapsDescriptionFlags"
--                    })
-- throws : False
-- Skip return : False

foreign import ccall "gst_pb_utils_get_caps_description_flags" gst_pb_utils_get_caps_description_flags :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CUInt

-- | Returns flags that describe the format of the caps if known. No flags are
-- set for unknown caps.
-- 
-- /Since: 1.20/
pbUtilsGetCapsDescriptionFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which flags are requested
    -> m [GstPbutils.Flags.PbUtilsCapsDescriptionFlags]
    -- ^ __Returns:__ t'GI.GstPbutils.Flags.PbUtilsCapsDescriptionFlags' that describe /@caps@/, or no flags
    --          if the caps are unknown.
pbUtilsGetCapsDescriptionFlags :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> m [PbUtilsCapsDescriptionFlags]
pbUtilsGetCapsDescriptionFlags Caps
caps = IO [PbUtilsCapsDescriptionFlags] -> m [PbUtilsCapsDescriptionFlags]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [PbUtilsCapsDescriptionFlags]
 -> m [PbUtilsCapsDescriptionFlags])
-> IO [PbUtilsCapsDescriptionFlags]
-> m [PbUtilsCapsDescriptionFlags]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CUInt
result <- Ptr Caps -> IO CUInt
gst_pb_utils_get_caps_description_flags Ptr Caps
caps'
    let result' :: [PbUtilsCapsDescriptionFlags]
result' = CUInt -> [PbUtilsCapsDescriptionFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    [PbUtilsCapsDescriptionFlags] -> IO [PbUtilsCapsDescriptionFlags]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [PbUtilsCapsDescriptionFlags]
result'


-- function pb_utils_add_codec_description_to_tag_list
-- Args: [ Arg
--           { argCName = "taglist"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "TagList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstTagList" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "codec_tag"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a GStreamer codec tag such as #GST_TAG_AUDIO_CODEC,\n            #GST_TAG_VIDEO_CODEC or #GST_TAG_CODEC. If none is specified,\n            the function will attempt to detect the appropriate category."
--                 , 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 "the (fixed) #GstCaps for which a codec tag should be added."
--                 , 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_pb_utils_add_codec_description_to_tag_list" gst_pb_utils_add_codec_description_to_tag_list :: 
    Ptr Gst.TagList.TagList ->              -- taglist : TInterface (Name {namespace = "Gst", name = "TagList"})
    CString ->                              -- codec_tag : TBasicType TUTF8
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CInt

-- | Adds a codec tag describing the format specified by /@caps@/ to /@taglist@/.
pbUtilsAddCodecDescriptionToTagList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.TagList.TagList
    -- ^ /@taglist@/: a t'GI.Gst.Structs.TagList.TagList'
    -> Maybe (T.Text)
    -- ^ /@codecTag@/: a GStreamer codec tag such as 'GI.Gst.Constants.TAG_AUDIO_CODEC',
    --             'GI.Gst.Constants.TAG_VIDEO_CODEC' or 'GI.Gst.Constants.TAG_CODEC'. If none is specified,
    --             the function will attempt to detect the appropriate category.
    -> Gst.Caps.Caps
    -- ^ /@caps@/: the (fixed) t'GI.Gst.Structs.Caps.Caps' for which a codec tag should be added.
    -> m Bool
    -- ^ __Returns:__ TRUE if a codec tag was added, FALSE otherwise.
pbUtilsAddCodecDescriptionToTagList :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TagList -> Maybe Text -> Caps -> m Bool
pbUtilsAddCodecDescriptionToTagList TagList
taglist Maybe Text
codecTag Caps
caps = IO Bool -> m Bool
forall a. IO a -> m a
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
    Ptr TagList
taglist' <- TagList -> IO (Ptr TagList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TagList
taglist
    CString
maybeCodecTag <- case Maybe Text
codecTag of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jCodecTag -> do
            CString
jCodecTag' <- Text -> IO CString
textToCString Text
jCodecTag
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jCodecTag'
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CInt
result <- Ptr TagList -> CString -> Ptr Caps -> IO CInt
gst_pb_utils_add_codec_description_to_tag_list Ptr TagList
taglist' CString
maybeCodecTag Ptr Caps
caps'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    TagList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TagList
taglist
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeCodecTag
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function missing_uri_source_message_new
-- Args: [ Arg
--           { argCName = "element"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Element" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstElement posting the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the URI protocol the missing source needs to implement,\n           e.g. \"http\" or \"mms\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_uri_source_message_new" gst_missing_uri_source_message_new :: 
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    CString ->                              -- protocol : TBasicType TUTF8
    IO (Ptr Gst.Message.Message)

-- | Creates a missing-plugin message for /@element@/ to notify the application
-- that a source element for a particular URI protocol is missing. This
-- function is mainly for use in plugins.
missingUriSourceMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    a
    -- ^ /@element@/: the t'GI.Gst.Objects.Element.Element' posting the message
    -> T.Text
    -- ^ /@protocol@/: the URI protocol the missing source needs to implement,
    --            e.g. \"http\" or \"mms\"
    -> m Gst.Message.Message
    -- ^ __Returns:__ a new t'GI.Gst.Structs.Message.Message', or NULL on error
missingUriSourceMessageNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsElement a) =>
a -> Text -> m Message
missingUriSourceMessageNew a
element Text
protocol = IO Message -> m Message
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Message -> m Message) -> IO Message -> m Message
forall a b. (a -> b) -> a -> b
$ do
    Ptr Element
element' <- a -> IO (Ptr Element)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
element
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    Ptr Message
result <- Ptr Element -> CString -> IO (Ptr Message)
gst_missing_uri_source_message_new Ptr Element
element' CString
protocol'
    Text -> Ptr Message -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingUriSourceMessageNew" Ptr Message
result
    Message
result' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
element
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Message -> IO Message
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result'


-- function missing_uri_source_installer_detail_new
-- Args: [ Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the URI protocol the missing source needs to implement,\n           e.g. \"http\" or \"mms\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_uri_source_installer_detail_new" gst_missing_uri_source_installer_detail_new :: 
    CString ->                              -- protocol : TBasicType TUTF8
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions in
-- the case where the application knows exactly what kind of plugin it is
-- missing.
missingUriSourceInstallerDetailNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@protocol@/: the URI protocol the missing source needs to implement,
    --            e.g. \"http\" or \"mms\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingUriSourceInstallerDetailNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
missingUriSourceInstallerDetailNew Text
protocol = IO Text -> m Text
forall a. IO a -> m a
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
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
result <- CString -> IO CString
gst_missing_uri_source_installer_detail_new CString
protocol'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingUriSourceInstallerDetailNew" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_uri_sink_message_new
-- Args: [ Arg
--           { argCName = "element"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Element" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstElement posting the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the URI protocol the missing sink needs to implement,\n           e.g. \"http\" or \"smb\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_uri_sink_message_new" gst_missing_uri_sink_message_new :: 
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    CString ->                              -- protocol : TBasicType TUTF8
    IO (Ptr Gst.Message.Message)

-- | Creates a missing-plugin message for /@element@/ to notify the application
-- that a sink element for a particular URI protocol is missing. This
-- function is mainly for use in plugins.
missingUriSinkMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    a
    -- ^ /@element@/: the t'GI.Gst.Objects.Element.Element' posting the message
    -> T.Text
    -- ^ /@protocol@/: the URI protocol the missing sink needs to implement,
    --            e.g. \"http\" or \"smb\"
    -> m Gst.Message.Message
    -- ^ __Returns:__ a new t'GI.Gst.Structs.Message.Message', or NULL on error
missingUriSinkMessageNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsElement a) =>
a -> Text -> m Message
missingUriSinkMessageNew a
element Text
protocol = IO Message -> m Message
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Message -> m Message) -> IO Message -> m Message
forall a b. (a -> b) -> a -> b
$ do
    Ptr Element
element' <- a -> IO (Ptr Element)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
element
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    Ptr Message
result <- Ptr Element -> CString -> IO (Ptr Message)
gst_missing_uri_sink_message_new Ptr Element
element' CString
protocol'
    Text -> Ptr Message -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingUriSinkMessageNew" Ptr Message
result
    Message
result' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
element
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Message -> IO Message
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result'


-- function missing_uri_sink_installer_detail_new
-- Args: [ Arg
--           { argCName = "protocol"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the URI protocol the missing source needs to implement,\n           e.g. \"http\" or \"mms\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_uri_sink_installer_detail_new" gst_missing_uri_sink_installer_detail_new :: 
    CString ->                              -- protocol : TBasicType TUTF8
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions in
-- the case where the application knows exactly what kind of plugin it is
-- missing.
missingUriSinkInstallerDetailNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@protocol@/: the URI protocol the missing source needs to implement,
    --            e.g. \"http\" or \"mms\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingUriSinkInstallerDetailNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
missingUriSinkInstallerDetailNew Text
protocol = IO Text -> m Text
forall a. IO a -> m a
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
    CString
protocol' <- Text -> IO CString
textToCString Text
protocol
    CString
result <- CString -> IO CString
gst_missing_uri_sink_installer_detail_new CString
protocol'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingUriSinkInstallerDetailNew" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
protocol'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_plugin_message_get_installer_detail
-- Args: [ Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_plugin_message_get_installer_detail" gst_missing_plugin_message_get_installer_detail :: 
    Ptr Gst.Message.Message ->              -- msg : TInterface (Name {namespace = "Gst", name = "Message"})
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions.
missingPluginMessageGetInstallerDetail ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    -- ^ /@msg@/: a missing-plugin t'GI.Gst.Structs.Message.Message' of type @/GST_MESSAGE_ELEMENT/@
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingPluginMessageGetInstallerDetail :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Message -> m Text
missingPluginMessageGetInstallerDetail Message
msg = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Message
msg' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Message
msg
    CString
result <- Ptr Message -> IO CString
gst_missing_plugin_message_get_installer_detail Ptr Message
msg'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingPluginMessageGetInstallerDetail" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Message -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
msg
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_plugin_message_get_description
-- Args: [ Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a missing-plugin #GstMessage of type #GST_MESSAGE_ELEMENT"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_plugin_message_get_description" gst_missing_plugin_message_get_description :: 
    Ptr Gst.Message.Message ->              -- msg : TInterface (Name {namespace = "Gst", name = "Message"})
    IO CString

-- | Returns a localised string describing the missing feature, for use in
-- error dialogs and the like. Should never return NULL unless /@msg@/ is not
-- a valid missing-plugin message.
-- 
-- This function is mainly for applications that need a human-readable string
-- describing a missing plugin, given a previously collected missing-plugin
-- message
missingPluginMessageGetDescription ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    -- ^ /@msg@/: a missing-plugin t'GI.Gst.Structs.Message.Message' of type @/GST_MESSAGE_ELEMENT/@
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated description string, or NULL on error. Free
    --          string with 'GI.GLib.Functions.free' when not needed any longer.
missingPluginMessageGetDescription :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Message -> m Text
missingPluginMessageGetDescription Message
msg = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Message
msg' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Message
msg
    CString
result <- Ptr Message -> IO CString
gst_missing_plugin_message_get_description Ptr Message
msg'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingPluginMessageGetDescription" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Message -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
msg
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_encoder_message_new
-- Args: [ Arg
--           { argCName = "element"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Element" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstElement posting the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "encode_caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) caps for which an encoder element is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_encoder_message_new" gst_missing_encoder_message_new :: 
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    Ptr Gst.Caps.Caps ->                    -- encode_caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Gst.Message.Message)

-- | Creates a missing-plugin message for /@element@/ to notify the application
-- that an encoder element for a particular set of (fixed) caps is missing.
-- This function is mainly for use in plugins.
missingEncoderMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    a
    -- ^ /@element@/: the t'GI.Gst.Objects.Element.Element' posting the message
    -> Gst.Caps.Caps
    -- ^ /@encodeCaps@/: the (fixed) caps for which an encoder element is needed
    -> m Gst.Message.Message
    -- ^ __Returns:__ a new t'GI.Gst.Structs.Message.Message', or NULL on error
missingEncoderMessageNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsElement a) =>
a -> Caps -> m Message
missingEncoderMessageNew a
element Caps
encodeCaps = IO Message -> m Message
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Message -> m Message) -> IO Message -> m Message
forall a b. (a -> b) -> a -> b
$ do
    Ptr Element
element' <- a -> IO (Ptr Element)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
element
    Ptr Caps
encodeCaps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
encodeCaps
    Ptr Message
result <- Ptr Element -> Ptr Caps -> IO (Ptr Message)
gst_missing_encoder_message_new Ptr Element
element' Ptr Caps
encodeCaps'
    Text -> Ptr Message -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingEncoderMessageNew" Ptr Message
result
    Message
result' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
element
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
encodeCaps
    Message -> IO Message
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result'


-- function missing_encoder_installer_detail_new
-- Args: [ Arg
--           { argCName = "encode_caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) caps for which an encoder element is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_encoder_installer_detail_new" gst_missing_encoder_installer_detail_new :: 
    Ptr Gst.Caps.Caps ->                    -- encode_caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions in
-- the case where the application knows exactly what kind of plugin it is
-- missing.
missingEncoderInstallerDetailNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@encodeCaps@/: the (fixed) caps for which an encoder element is needed
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingEncoderInstallerDetailNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Caps -> m Text
missingEncoderInstallerDetailNew Caps
encodeCaps = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Caps
encodeCaps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
encodeCaps
    CString
result <- Ptr Caps -> IO CString
gst_missing_encoder_installer_detail_new Ptr Caps
encodeCaps'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingEncoderInstallerDetailNew" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
encodeCaps
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_element_message_new
-- Args: [ Arg
--           { argCName = "element"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Element" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstElement posting the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "factory_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the missing element (element factory),\n           e.g. \"videoscale\" or \"cdparanoiasrc\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_element_message_new" gst_missing_element_message_new :: 
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    CString ->                              -- factory_name : TBasicType TUTF8
    IO (Ptr Gst.Message.Message)

-- | Creates a missing-plugin message for /@element@/ to notify the application
-- that a certain required element is missing. This function is mainly for
-- use in plugins.
missingElementMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    a
    -- ^ /@element@/: the t'GI.Gst.Objects.Element.Element' posting the message
    -> T.Text
    -- ^ /@factoryName@/: the name of the missing element (element factory),
    --            e.g. \"videoscale\" or \"cdparanoiasrc\"
    -> m Gst.Message.Message
    -- ^ __Returns:__ a new t'GI.Gst.Structs.Message.Message', or NULL on error
missingElementMessageNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsElement a) =>
a -> Text -> m Message
missingElementMessageNew a
element Text
factoryName = IO Message -> m Message
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Message -> m Message) -> IO Message -> m Message
forall a b. (a -> b) -> a -> b
$ do
    Ptr Element
element' <- a -> IO (Ptr Element)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
element
    CString
factoryName' <- Text -> IO CString
textToCString Text
factoryName
    Ptr Message
result <- Ptr Element -> CString -> IO (Ptr Message)
gst_missing_element_message_new Ptr Element
element' CString
factoryName'
    Text -> Ptr Message -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingElementMessageNew" Ptr Message
result
    Message
result' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
element
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
factoryName'
    Message -> IO Message
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result'


-- function missing_element_installer_detail_new
-- Args: [ Arg
--           { argCName = "factory_name"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the name of the missing element (element factory),\n           e.g. \"videoscale\" or \"cdparanoiasrc\""
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_element_installer_detail_new" gst_missing_element_installer_detail_new :: 
    CString ->                              -- factory_name : TBasicType TUTF8
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions in
-- the case where the application knows exactly what kind of plugin it is
-- missing.
missingElementInstallerDetailNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@factoryName@/: the name of the missing element (element factory),
    --            e.g. \"videoscale\" or \"cdparanoiasrc\"
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingElementInstallerDetailNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Text
missingElementInstallerDetailNew Text
factoryName = IO Text -> m Text
forall a. IO a -> m a
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
    CString
factoryName' <- Text -> IO CString
textToCString Text
factoryName
    CString
result <- CString -> IO CString
gst_missing_element_installer_detail_new CString
factoryName'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingElementInstallerDetailNew" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
factoryName'
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function missing_decoder_message_new
-- Args: [ Arg
--           { argCName = "element"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Element" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstElement posting the message"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "decode_caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) caps for which a decoder element is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Message" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_decoder_message_new" gst_missing_decoder_message_new :: 
    Ptr Gst.Element.Element ->              -- element : TInterface (Name {namespace = "Gst", name = "Element"})
    Ptr Gst.Caps.Caps ->                    -- decode_caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO (Ptr Gst.Message.Message)

-- | Creates a missing-plugin message for /@element@/ to notify the application
-- that a decoder element for a particular set of (fixed) caps is missing.
-- This function is mainly for use in plugins.
missingDecoderMessageNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gst.Element.IsElement a) =>
    a
    -- ^ /@element@/: the t'GI.Gst.Objects.Element.Element' posting the message
    -> Gst.Caps.Caps
    -- ^ /@decodeCaps@/: the (fixed) caps for which a decoder element is needed
    -> m Gst.Message.Message
    -- ^ __Returns:__ a new t'GI.Gst.Structs.Message.Message', or NULL on error
missingDecoderMessageNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsElement a) =>
a -> Caps -> m Message
missingDecoderMessageNew a
element Caps
decodeCaps = IO Message -> m Message
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Message -> m Message) -> IO Message -> m Message
forall a b. (a -> b) -> a -> b
$ do
    Ptr Element
element' <- a -> IO (Ptr Element)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
element
    Ptr Caps
decodeCaps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
decodeCaps
    Ptr Message
result <- Ptr Element -> Ptr Caps -> IO (Ptr Message)
gst_missing_decoder_message_new Ptr Element
element' Ptr Caps
decodeCaps'
    Text -> Ptr Message -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingDecoderMessageNew" Ptr Message
result
    Message
result' <- ((ManagedPtr Message -> Message) -> Ptr Message -> IO Message
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Message -> Message
Gst.Message.Message) Ptr Message
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
element
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
decodeCaps
    Message -> IO Message
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Message
result'


-- function missing_decoder_installer_detail_new
-- Args: [ Arg
--           { argCName = "decode_caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the (fixed) caps for which a decoder element is needed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_missing_decoder_installer_detail_new" gst_missing_decoder_installer_detail_new :: 
    Ptr Gst.Caps.Caps ->                    -- decode_caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Returns an opaque string containing all the details about the missing
-- element to be passed to an external installer called via
-- 'GI.GstPbutils.Functions.installPluginsAsync' or 'GI.GstPbutils.Functions.installPluginsSync'.
-- 
-- This function is mainly for applications that call external plugin
-- installation mechanisms using one of the two above-mentioned functions in
-- the case where the application knows exactly what kind of plugin it is
-- missing.
missingDecoderInstallerDetailNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@decodeCaps@/: the (fixed) caps for which a decoder element is needed
    -> m T.Text
    -- ^ __Returns:__ a newly-allocated detail string, or NULL on error. Free string
    --          with 'GI.GLib.Functions.free' when not needed any longer.
missingDecoderInstallerDetailNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Caps -> m Text
missingDecoderInstallerDetailNew Caps
decodeCaps = IO Text -> m Text
forall a. IO a -> m a
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
    Ptr Caps
decodeCaps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
decodeCaps
    CString
result <- Ptr Caps -> IO CString
gst_missing_decoder_installer_detail_new Ptr Caps
decodeCaps'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"missingDecoderInstallerDetailNew" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
decodeCaps
    Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function is_missing_plugin_message
-- Args: [ Arg
--           { argCName = "msg"
--           , argType =
--               TInterface Name { namespace = "Gst" , name = "Message" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstMessage" , 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_is_missing_plugin_message" gst_is_missing_plugin_message :: 
    Ptr Gst.Message.Message ->              -- msg : TInterface (Name {namespace = "Gst", name = "Message"})
    IO CInt

-- | Checks whether /@msg@/ is a missing plugins message.
isMissingPluginMessage ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Message.Message
    -- ^ /@msg@/: a t'GI.Gst.Structs.Message.Message'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@msg@/ is a missing-plugins message, otherwise 'P.False'.
isMissingPluginMessage :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Message -> m Bool
isMissingPluginMessage Message
msg = IO Bool -> m Bool
forall a. IO a -> m a
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
    Ptr Message
msg' <- Message -> IO (Ptr Message)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Message
msg
    CInt
result <- Ptr Message -> IO CInt
gst_is_missing_plugin_message Ptr Message
msg'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Message -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Message
msg
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function install_plugins_sync
-- Args: [ Arg
--           { argCName = "details"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "NULL-terminated array\n    of installer string details"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ctx"
--           , argType =
--               TInterface
--                 Name { namespace = "GstPbutils" , name = "InstallPluginsContext" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstInstallPluginsContext, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GstPbutils" , name = "InstallPluginsReturn" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_install_plugins_sync" gst_install_plugins_sync :: 
    Ptr CString ->                          -- details : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr GstPbutils.InstallPluginsContext.InstallPluginsContext -> -- ctx : TInterface (Name {namespace = "GstPbutils", name = "InstallPluginsContext"})
    IO CUInt

-- | Requests plugin installation and block until the plugins have been
-- installed or installation has failed.
-- 
-- This function should almost never be used, it only exists for cases where
-- a non-GLib main loop is running and the user wants to run it in a separate
-- thread and marshal the result back asynchronously into the main thread
-- using the other non-GLib main loop. You should almost always use
-- 'GI.GstPbutils.Functions.installPluginsAsync' instead of this function.
installPluginsSync ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    -- ^ /@details@/: NULL-terminated array
    --     of installer string details
    -> Maybe (GstPbutils.InstallPluginsContext.InstallPluginsContext)
    -- ^ /@ctx@/: a t'GI.GstPbutils.Structs.InstallPluginsContext.InstallPluginsContext', or NULL
    -> m GstPbutils.Enums.InstallPluginsReturn
    -- ^ __Returns:__ the result of the installation.
installPluginsSync :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Text] -> Maybe InstallPluginsContext -> m InstallPluginsReturn
installPluginsSync [Text]
details Maybe InstallPluginsContext
ctx = IO InstallPluginsReturn -> m InstallPluginsReturn
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InstallPluginsReturn -> m InstallPluginsReturn)
-> IO InstallPluginsReturn -> m InstallPluginsReturn
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
details' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
details
    Ptr InstallPluginsContext
maybeCtx <- case Maybe InstallPluginsContext
ctx of
        Maybe InstallPluginsContext
Nothing -> Ptr InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InstallPluginsContext
forall a. Ptr a
nullPtr
        Just InstallPluginsContext
jCtx -> do
            Ptr InstallPluginsContext
jCtx' <- InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr InstallPluginsContext
jCtx
            Ptr InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InstallPluginsContext
jCtx'
    CUInt
result <- Ptr CString -> Ptr InstallPluginsContext -> IO CUInt
gst_install_plugins_sync Ptr CString
details' Ptr InstallPluginsContext
maybeCtx
    let result' :: InstallPluginsReturn
result' = (Int -> InstallPluginsReturn
forall a. Enum a => Int -> a
toEnum (Int -> InstallPluginsReturn)
-> (CUInt -> Int) -> CUInt -> InstallPluginsReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    Maybe InstallPluginsContext
-> (InstallPluginsContext -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe InstallPluginsContext
ctx InstallPluginsContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
details'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
details'
    InstallPluginsReturn -> IO InstallPluginsReturn
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return InstallPluginsReturn
result'


-- function install_plugins_supported
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_install_plugins_supported" gst_install_plugins_supported :: 
    IO CInt

-- | Checks whether plugin installation is likely to be supported by the
-- current environment. This currently only checks whether the helper script
-- that is to be provided by the distribution or operating system vendor
-- exists.
installPluginsSupported ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    -- ^ __Returns:__ TRUE if plugin installation is likely to be supported.
installPluginsSupported :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool
installPluginsSupported  = IO Bool -> m Bool
forall a. IO a -> m a
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
    CInt
result <- IO CInt
gst_install_plugins_supported
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function install_plugins_installation_in_progress
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gst_install_plugins_installation_in_progress" gst_install_plugins_installation_in_progress :: 
    IO CInt

-- | Checks whether plugin installation (initiated by this application only)
-- is currently in progress.
installPluginsInstallationInProgress ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
    -- ^ __Returns:__ TRUE if plugin installation is in progress, otherwise FALSE
installPluginsInstallationInProgress :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Bool
installPluginsInstallationInProgress  = IO Bool -> m Bool
forall a. IO a -> m a
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
    CInt
result <- IO CInt
gst_install_plugins_installation_in_progress
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function install_plugins_async
-- Args: [ Arg
--           { argCName = "details"
--           , argType = TCArray True (-1) (-1) (TBasicType TUTF8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "NULL-terminated array\n    of installer string details (see below)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ctx"
--           , argType =
--               TInterface
--                 Name { namespace = "GstPbutils" , name = "InstallPluginsContext" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GstInstallPluginsContext, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "func"
--           , argType =
--               TInterface
--                 Name
--                   { namespace = "GstPbutils" , name = "InstallPluginsResultFunc" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the function to call when the installer program returns"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeAsync
--           , argClosure = 3
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the user data to pass to @func when called, or NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GstPbutils" , name = "InstallPluginsReturn" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_install_plugins_async" gst_install_plugins_async :: 
    Ptr CString ->                          -- details : TCArray True (-1) (-1) (TBasicType TUTF8)
    Ptr GstPbutils.InstallPluginsContext.InstallPluginsContext -> -- ctx : TInterface (Name {namespace = "GstPbutils", name = "InstallPluginsContext"})
    FunPtr GstPbutils.Callbacks.C_InstallPluginsResultFunc -> -- func : TInterface (Name {namespace = "GstPbutils", name = "InstallPluginsResultFunc"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    IO CUInt

-- | Requests plugin installation without blocking. Once the plugins have been
-- installed or installation has failed, /@func@/ will be called with the result
-- of the installation and your provided /@userData@/ pointer.
-- 
-- This function requires a running GLib\/Gtk main loop. If you are not
-- running a GLib\/Gtk main loop, make sure to regularly call
-- g_main_context_iteration(NULL,FALSE).
-- 
-- The installer strings that make up /@detail@/ are typically obtained by
-- calling 'GI.GstPbutils.Functions.missingPluginMessageGetInstallerDetail' on missing-plugin
-- messages that have been caught on a pipeline\'s bus or created by the
-- application via the provided API, such as 'GI.GstPbutils.Functions.missingElementMessageNew'.
-- 
-- It is possible to request the installation of multiple missing plugins in
-- one go (as might be required if there is a demuxer for a certain format
-- installed but no suitable video decoder and no suitable audio decoder).
installPluginsAsync ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [T.Text]
    -- ^ /@details@/: NULL-terminated array
    --     of installer string details (see below)
    -> Maybe (GstPbutils.InstallPluginsContext.InstallPluginsContext)
    -- ^ /@ctx@/: a t'GI.GstPbutils.Structs.InstallPluginsContext.InstallPluginsContext', or NULL
    -> GstPbutils.Callbacks.InstallPluginsResultFunc
    -- ^ /@func@/: the function to call when the installer program returns
    -> m GstPbutils.Enums.InstallPluginsReturn
    -- ^ __Returns:__ result code whether an external installer could be started
installPluginsAsync :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Text]
-> Maybe InstallPluginsContext
-> InstallPluginsResultFunc
-> m InstallPluginsReturn
installPluginsAsync [Text]
details Maybe InstallPluginsContext
ctx InstallPluginsResultFunc
func = IO InstallPluginsReturn -> m InstallPluginsReturn
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO InstallPluginsReturn -> m InstallPluginsReturn)
-> IO InstallPluginsReturn -> m InstallPluginsReturn
forall a b. (a -> b) -> a -> b
$ do
    Ptr CString
details' <- [Text] -> IO (Ptr CString)
packZeroTerminatedUTF8CArray [Text]
details
    Ptr InstallPluginsContext
maybeCtx <- case Maybe InstallPluginsContext
ctx of
        Maybe InstallPluginsContext
Nothing -> Ptr InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InstallPluginsContext
forall a. Ptr a
nullPtr
        Just InstallPluginsContext
jCtx -> do
            Ptr InstallPluginsContext
jCtx' <- InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr InstallPluginsContext
jCtx
            Ptr InstallPluginsContext -> IO (Ptr InstallPluginsContext)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr InstallPluginsContext
jCtx'
    Ptr (FunPtr C_InstallPluginsResultFunc)
ptrfunc <- IO (Ptr (FunPtr C_InstallPluginsResultFunc))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (FunPtr GstPbutils.Callbacks.C_InstallPluginsResultFunc))
    FunPtr C_InstallPluginsResultFunc
func' <- C_InstallPluginsResultFunc
-> IO (FunPtr C_InstallPluginsResultFunc)
GstPbutils.Callbacks.mk_InstallPluginsResultFunc (Maybe (Ptr (FunPtr C_InstallPluginsResultFunc))
-> InstallPluginsResultFunc_WithClosures
-> C_InstallPluginsResultFunc
GstPbutils.Callbacks.wrap_InstallPluginsResultFunc (Ptr (FunPtr C_InstallPluginsResultFunc)
-> Maybe (Ptr (FunPtr C_InstallPluginsResultFunc))
forall a. a -> Maybe a
Just Ptr (FunPtr C_InstallPluginsResultFunc)
ptrfunc) (InstallPluginsResultFunc -> InstallPluginsResultFunc_WithClosures
GstPbutils.Callbacks.drop_closures_InstallPluginsResultFunc InstallPluginsResultFunc
func))
    Ptr (FunPtr C_InstallPluginsResultFunc)
-> FunPtr C_InstallPluginsResultFunc -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr (FunPtr C_InstallPluginsResultFunc)
ptrfunc FunPtr C_InstallPluginsResultFunc
func'
    let userData :: Ptr a
userData = Ptr a
forall a. Ptr a
nullPtr
    CUInt
result <- Ptr CString
-> Ptr InstallPluginsContext
-> FunPtr C_InstallPluginsResultFunc
-> Ptr ()
-> IO CUInt
gst_install_plugins_async Ptr CString
details' Ptr InstallPluginsContext
maybeCtx FunPtr C_InstallPluginsResultFunc
func' Ptr ()
forall a. Ptr a
userData
    let result' :: InstallPluginsReturn
result' = (Int -> InstallPluginsReturn
forall a. Enum a => Int -> a
toEnum (Int -> InstallPluginsReturn)
-> (CUInt -> Int) -> CUInt -> InstallPluginsReturn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    Maybe InstallPluginsContext
-> (InstallPluginsContext -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe InstallPluginsContext
ctx InstallPluginsContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
details'
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
details'
    InstallPluginsReturn -> IO InstallPluginsReturn
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return InstallPluginsReturn
result'


-- function encoding_list_available_categories
-- Args: []
-- Lengths: []
-- returnType: Just (TGList (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_list_available_categories" gst_encoding_list_available_categories :: 
    IO (Ptr (GList CString))

-- | Lists all t'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' categories present on disk.
encodingListAvailableCategories ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m [T.Text]
    -- ^ __Returns:__ A list
    -- of t'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' categories.
encodingListAvailableCategories :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m [Text]
encodingListAvailableCategories  = IO [Text] -> m [Text]
forall a. IO a -> m a
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
    Ptr (GList CString)
result <- IO (Ptr (GList CString))
gst_encoding_list_available_categories
    [CString]
result' <- Ptr (GList CString) -> IO [CString]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList CString)
result
    [Text]
result'' <- (CString -> IO Text) -> [CString] -> IO [Text]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText [CString]
result'
    (CString -> IO ()) -> Ptr (GList CString) -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (GList (Ptr a)) -> IO ()
mapGList CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (GList CString)
result
    Ptr (GList CString) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList CString)
result
    [Text] -> IO [Text]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result''


-- function encoding_list_all_targets
-- Args: [ Arg
--           { argCName = "categoryname"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The category, for ex: #GST_ENCODING_CATEGORY_DEVICE.\nCan be %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList
--                  (TInterface
--                     Name { namespace = "GstPbutils" , name = "EncodingTarget" }))
-- throws : False
-- Skip return : False

foreign import ccall "gst_encoding_list_all_targets" gst_encoding_list_all_targets :: 
    CString ->                              -- categoryname : TBasicType TUTF8
    IO (Ptr (GList (Ptr GstPbutils.EncodingTarget.EncodingTarget)))

-- | List all available t'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget' for the specified category, or all categories
-- if /@categoryname@/ is 'P.Nothing'.
encodingListAllTargets ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (T.Text)
    -- ^ /@categoryname@/: The category, for ex: 'GI.GstPbutils.Constants.ENCODING_CATEGORY_DEVICE'.
    -- Can be 'P.Nothing'.
    -> m [GstPbutils.EncodingTarget.EncodingTarget]
    -- ^ __Returns:__ The list of t'GI.GstPbutils.Objects.EncodingTarget.EncodingTarget'
encodingListAllTargets :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe Text -> m [EncodingTarget]
encodingListAllTargets Maybe Text
categoryname = IO [EncodingTarget] -> m [EncodingTarget]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [EncodingTarget] -> m [EncodingTarget])
-> IO [EncodingTarget] -> m [EncodingTarget]
forall a b. (a -> b) -> a -> b
$ do
    CString
maybeCategoryname <- case Maybe Text
categoryname of
        Maybe Text
Nothing -> CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jCategoryname -> do
            CString
jCategoryname' <- Text -> IO CString
textToCString Text
jCategoryname
            CString -> IO CString
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jCategoryname'
    Ptr (GList (Ptr EncodingTarget))
result <- CString -> IO (Ptr (GList (Ptr EncodingTarget)))
gst_encoding_list_all_targets CString
maybeCategoryname
    [Ptr EncodingTarget]
result' <- Ptr (GList (Ptr EncodingTarget)) -> IO [Ptr EncodingTarget]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr EncodingTarget))
result
    [EncodingTarget]
result'' <- (Ptr EncodingTarget -> IO EncodingTarget)
-> [Ptr EncodingTarget] -> IO [EncodingTarget]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM ((ManagedPtr EncodingTarget -> EncodingTarget)
-> Ptr EncodingTarget -> IO EncodingTarget
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr EncodingTarget -> EncodingTarget
GstPbutils.EncodingTarget.EncodingTarget) [Ptr EncodingTarget]
result'
    Ptr (GList (Ptr EncodingTarget)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr EncodingTarget))
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeCategoryname
    [EncodingTarget] -> IO [EncodingTarget]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [EncodingTarget]
result''


-- function codec_utils_opus_parse_header
-- Args: [ Arg
--           { argCName = "header"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the OpusHead #GstBuffer"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "rate"
--           , argType = TBasicType TUInt32
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the sample rate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channels"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of channels"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channel_mapping_family"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the channel mapping family"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stream_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of independent streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "coupled_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of stereo streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channel_mapping"
--           , argType = TCArray False 256 (-1) (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mapping between the streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "pre_skip"
--           , argType = TBasicType TUInt16
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Pre-skip in 48kHz samples or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "output_gain"
--           , argType = TBasicType TInt16
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Output gain or 0" , 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_codec_utils_opus_parse_header" gst_codec_utils_opus_parse_header :: 
    Ptr Gst.Buffer.Buffer ->                -- header : TInterface (Name {namespace = "Gst", name = "Buffer"})
    Ptr Word32 ->                           -- rate : TBasicType TUInt32
    Ptr Word8 ->                            -- channels : TBasicType TUInt8
    Ptr Word8 ->                            -- channel_mapping_family : TBasicType TUInt8
    Ptr Word8 ->                            -- stream_count : TBasicType TUInt8
    Ptr Word8 ->                            -- coupled_count : TBasicType TUInt8
    Ptr (Ptr Word8) ->                      -- channel_mapping : TCArray False 256 (-1) (TBasicType TUInt8)
    Ptr Word16 ->                           -- pre_skip : TBasicType TUInt16
    Ptr Int16 ->                            -- output_gain : TBasicType TInt16
    IO CInt

-- | Parses the OpusHead header.
-- 
-- /Since: 1.8/
codecUtilsOpusParseHeader ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@header@/: the OpusHead t'GI.Gst.Structs.Buffer.Buffer'
    -> m ((Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16, Int16))
    -- ^ __Returns:__ 'P.True' if parsing was successful, 'P.False' otherwise.
codecUtilsOpusParseHeader :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer
-> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
      Int16)
codecUtilsOpusParseHeader Buffer
header = IO
  (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
   Int16)
-> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
      Int16)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO
   (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
    Int16)
 -> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
       Int16))
-> IO
     (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
      Int16)
-> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
      Int16)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
header' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
header
    Ptr Word32
rate <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word8
channels <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
channelMappingFamily <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
streamCount <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
coupledCount <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr (Ptr Word8)
channelMapping <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
    Ptr Word16
preSkip <- IO (Ptr Word16)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word16)
    Ptr Int16
outputGain <- IO (Ptr Int16)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int16)
    CInt
result <- Ptr Buffer
-> Ptr Word32
-> Ptr Word8
-> Ptr Word8
-> Ptr Word8
-> Ptr Word8
-> Ptr (Ptr Word8)
-> Ptr Word16
-> Ptr Int16
-> IO CInt
gst_codec_utils_opus_parse_header Ptr Buffer
header' Ptr Word32
rate Ptr Word8
channels Ptr Word8
channelMappingFamily Ptr Word8
streamCount Ptr Word8
coupledCount Ptr (Ptr Word8)
channelMapping Ptr Word16
preSkip Ptr Int16
outputGain
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Word32
rate' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
rate
    Word8
channels' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
channels
    Word8
channelMappingFamily' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
channelMappingFamily
    Word8
streamCount' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
streamCount
    Word8
coupledCount' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
coupledCount
    Ptr Word8
channelMapping' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
channelMapping
    ByteString
channelMapping'' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
256) Ptr Word8
channelMapping'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channelMapping'
    Word16
preSkip' <- Ptr Word16 -> IO Word16
forall a. Storable a => Ptr a -> IO a
peek Ptr Word16
preSkip
    Int16
outputGain' <- Ptr Int16 -> IO Int16
forall a. Storable a => Ptr a -> IO a
peek Ptr Int16
outputGain
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
header
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
rate
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channels
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channelMappingFamily
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
streamCount
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
coupledCount
    Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
channelMapping
    Ptr Word16 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word16
preSkip
    Ptr Int16 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int16
outputGain
    (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
 Int16)
-> IO
     (Bool, Word32, Word8, Word8, Word8, Word8, ByteString, Word16,
      Int16)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Word32
rate', Word8
channels', Word8
channelMappingFamily', Word8
streamCount', Word8
coupledCount', ByteString
channelMapping'', Word16
preSkip', Int16
outputGain')


-- function codec_utils_opus_parse_caps
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #GstCaps to parse the data from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "rate"
--           , argType = TBasicType TUInt32
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the sample rate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channels"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of channels"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channel_mapping_family"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the channel mapping family"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "stream_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of independent streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "coupled_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of stereo streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "channel_mapping"
--           , argType = TCArray False 256 (-1) (TBasicType TUInt8)
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mapping between the streams"
--                 , 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_codec_utils_opus_parse_caps" gst_codec_utils_opus_parse_caps :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Word32 ->                           -- rate : TBasicType TUInt32
    Ptr Word8 ->                            -- channels : TBasicType TUInt8
    Ptr Word8 ->                            -- channel_mapping_family : TBasicType TUInt8
    Ptr Word8 ->                            -- stream_count : TBasicType TUInt8
    Ptr Word8 ->                            -- coupled_count : TBasicType TUInt8
    Ptr (Ptr Word8) ->                      -- channel_mapping : TCArray False 256 (-1) (TBasicType TUInt8)
    IO CInt

-- | Parses Opus caps and fills the different fields with defaults if possible.
-- 
-- /Since: 1.8/
codecUtilsOpusParseCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the t'GI.Gst.Structs.Caps.Caps' to parse the data from
    -> m ((Bool, Word32, Word8, Word8, Word8, Word8, ByteString))
    -- ^ __Returns:__ 'P.True' if parsing was successful, 'P.False' otherwise.
codecUtilsOpusParseCaps :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
codecUtilsOpusParseCaps Caps
caps = IO (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
-> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
 -> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString))
-> IO (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
-> m (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    Ptr Word32
rate <- IO (Ptr Word32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word32)
    Ptr Word8
channels <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
channelMappingFamily <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
streamCount <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
coupledCount <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr (Ptr Word8)
channelMapping <- IO (Ptr (Ptr Word8))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Word8))
    CInt
result <- Ptr Caps
-> Ptr Word32
-> Ptr Word8
-> Ptr Word8
-> Ptr Word8
-> Ptr Word8
-> Ptr (Ptr Word8)
-> IO CInt
gst_codec_utils_opus_parse_caps Ptr Caps
caps' Ptr Word32
rate Ptr Word8
channels Ptr Word8
channelMappingFamily Ptr Word8
streamCount Ptr Word8
coupledCount Ptr (Ptr Word8)
channelMapping
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Word32
rate' <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek Ptr Word32
rate
    Word8
channels' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
channels
    Word8
channelMappingFamily' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
channelMappingFamily
    Word8
streamCount' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
streamCount
    Word8
coupledCount' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
coupledCount
    Ptr Word8
channelMapping' <- Ptr (Ptr Word8) -> IO (Ptr Word8)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Word8)
channelMapping
    ByteString
channelMapping'' <- (Integer -> Ptr Word8 -> IO ByteString
forall a. Integral a => a -> Ptr Word8 -> IO ByteString
unpackByteStringWithLength Integer
256) Ptr Word8
channelMapping'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channelMapping'
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Ptr Word32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word32
rate
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channels
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
channelMappingFamily
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
streamCount
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
coupledCount
    Ptr (Ptr Word8) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr Word8)
channelMapping
    (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
-> IO (Bool, Word32, Word8, Word8, Word8, Word8, ByteString)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Word32
rate', Word8
channels', Word8
channelMappingFamily', Word8
streamCount', Word8
coupledCount', ByteString
channelMapping'')


-- function codec_utils_opus_create_header
-- Args: [ Arg
--           { argCName = "rate"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the sample rate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "channels"
--           , argType = TBasicType TUInt8
--           , 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_mapping_family"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the channel mapping family"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stream_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of independent streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coupled_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of stereo streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "channel_mapping"
--           , argType = TCArray False (-1) (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mapping between the streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pre_skip"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Pre-skip in 48kHz samples or 0"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "output_gain"
--           , argType = TBasicType TInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Output gain or 0" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gst" , name = "Buffer" })
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_opus_create_header" gst_codec_utils_opus_create_header :: 
    Word32 ->                               -- rate : TBasicType TUInt32
    Word8 ->                                -- channels : TBasicType TUInt8
    Word8 ->                                -- channel_mapping_family : TBasicType TUInt8
    Word8 ->                                -- stream_count : TBasicType TUInt8
    Word8 ->                                -- coupled_count : TBasicType TUInt8
    Ptr Word8 ->                            -- channel_mapping : TCArray False (-1) (-1) (TBasicType TUInt8)
    Word16 ->                               -- pre_skip : TBasicType TUInt16
    Int16 ->                                -- output_gain : TBasicType TInt16
    IO (Ptr Gst.Buffer.Buffer)

-- | Creates OpusHead header from the given parameters.
-- 
-- /Since: 1.8/
codecUtilsOpusCreateHeader ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@rate@/: the sample rate
    -> Word8
    -- ^ /@channels@/: the number of channels
    -> Word8
    -- ^ /@channelMappingFamily@/: the channel mapping family
    -> Word8
    -- ^ /@streamCount@/: the number of independent streams
    -> Word8
    -- ^ /@coupledCount@/: the number of stereo streams
    -> Maybe (Ptr Word8)
    -- ^ /@channelMapping@/: the mapping between the streams
    -> Word16
    -- ^ /@preSkip@/: Pre-skip in 48kHz samples or 0
    -> Int16
    -- ^ /@outputGain@/: Output gain or 0
    -> m Gst.Buffer.Buffer
    -- ^ __Returns:__ The t'GI.Gst.Structs.Buffer.Buffer' containing the OpusHead.
codecUtilsOpusCreateHeader :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32
-> Word8
-> Word8
-> Word8
-> Word8
-> Maybe (Ptr Word8)
-> Word16
-> Int16
-> m Buffer
codecUtilsOpusCreateHeader Word32
rate Word8
channels Word8
channelMappingFamily Word8
streamCount Word8
coupledCount Maybe (Ptr Word8)
channelMapping Word16
preSkip Int16
outputGain = IO Buffer -> m Buffer
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Buffer -> m Buffer) -> IO Buffer -> m Buffer
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
maybeChannelMapping <- case Maybe (Ptr Word8)
channelMapping of
        Maybe (Ptr Word8)
Nothing -> Ptr Word8 -> IO (Ptr Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
forall a. Ptr a
nullPtr
        Just Ptr Word8
jChannelMapping -> do
            Ptr Word8 -> IO (Ptr Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
jChannelMapping
    Ptr Buffer
result <- Word32
-> Word8
-> Word8
-> Word8
-> Word8
-> Ptr Word8
-> Word16
-> Int16
-> IO (Ptr Buffer)
gst_codec_utils_opus_create_header Word32
rate Word8
channels Word8
channelMappingFamily Word8
streamCount Word8
coupledCount Ptr Word8
maybeChannelMapping Word16
preSkip Int16
outputGain
    Text -> Ptr Buffer -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"codecUtilsOpusCreateHeader" Ptr Buffer
result
    Buffer
result' <- ((ManagedPtr Buffer -> Buffer) -> Ptr Buffer -> IO Buffer
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Buffer -> Buffer
Gst.Buffer.Buffer) Ptr Buffer
result
    Buffer -> IO Buffer
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Buffer
result'


-- function codec_utils_opus_create_caps_from_header
-- Args: [ Arg
--           { argCName = "header"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "OpusHead header" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "comments"
--           , argType = TInterface Name { namespace = "Gst" , name = "Buffer" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Comment header or NULL"
--                 , 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_codec_utils_opus_create_caps_from_header" gst_codec_utils_opus_create_caps_from_header :: 
    Ptr Gst.Buffer.Buffer ->                -- header : TInterface (Name {namespace = "Gst", name = "Buffer"})
    Ptr Gst.Buffer.Buffer ->                -- comments : TInterface (Name {namespace = "Gst", name = "Buffer"})
    IO (Ptr Gst.Caps.Caps)

-- | Creates Opus caps from the given OpusHead /@header@/ and comment header
-- /@comments@/.
-- 
-- /Since: 1.8/
codecUtilsOpusCreateCapsFromHeader ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Buffer.Buffer
    -- ^ /@header@/: OpusHead header
    -> Maybe (Gst.Buffer.Buffer)
    -- ^ /@comments@/: Comment header or NULL
    -> m Gst.Caps.Caps
    -- ^ __Returns:__ The t'GI.Gst.Structs.Caps.Caps'.
codecUtilsOpusCreateCapsFromHeader :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Buffer -> Maybe Buffer -> m Caps
codecUtilsOpusCreateCapsFromHeader Buffer
header Maybe Buffer
comments = IO Caps -> m Caps
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Caps -> m Caps) -> IO Caps -> m Caps
forall a b. (a -> b) -> a -> b
$ do
    Ptr Buffer
header' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
header
    Ptr Buffer
maybeComments <- case Maybe Buffer
comments of
        Maybe Buffer
Nothing -> Ptr Buffer -> IO (Ptr Buffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Buffer
forall a. Ptr a
nullPtr
        Just Buffer
jComments -> do
            Ptr Buffer
jComments' <- Buffer -> IO (Ptr Buffer)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Buffer
jComments
            Ptr Buffer -> IO (Ptr Buffer)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Buffer
jComments'
    Ptr Caps
result <- Ptr Buffer -> Ptr Buffer -> IO (Ptr Caps)
gst_codec_utils_opus_create_caps_from_header Ptr Buffer
header' Ptr Buffer
maybeComments
    Text -> Ptr Caps -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"codecUtilsOpusCreateCapsFromHeader" Ptr Caps
result
    Caps
result' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result
    Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Buffer
header
    Maybe Buffer -> (Buffer -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Buffer
comments Buffer -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Caps -> IO Caps
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result'


-- function codec_utils_opus_create_caps
-- Args: [ Arg
--           { argCName = "rate"
--           , argType = TBasicType TUInt32
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the sample rate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "channels"
--           , argType = TBasicType TUInt8
--           , 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_mapping_family"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the channel mapping family"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stream_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of independent streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "coupled_count"
--           , argType = TBasicType TUInt8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of stereo streams"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "channel_mapping"
--           , argType = TCArray False (-1) (-1) (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the mapping between the streams"
--                 , 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_codec_utils_opus_create_caps" gst_codec_utils_opus_create_caps :: 
    Word32 ->                               -- rate : TBasicType TUInt32
    Word8 ->                                -- channels : TBasicType TUInt8
    Word8 ->                                -- channel_mapping_family : TBasicType TUInt8
    Word8 ->                                -- stream_count : TBasicType TUInt8
    Word8 ->                                -- coupled_count : TBasicType TUInt8
    Ptr Word8 ->                            -- channel_mapping : TCArray False (-1) (-1) (TBasicType TUInt8)
    IO (Ptr Gst.Caps.Caps)

-- | Creates Opus caps from the given parameters.
-- 
-- /Since: 1.8/
codecUtilsOpusCreateCaps ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@rate@/: the sample rate
    -> Word8
    -- ^ /@channels@/: the number of channels
    -> Word8
    -- ^ /@channelMappingFamily@/: the channel mapping family
    -> Word8
    -- ^ /@streamCount@/: the number of independent streams
    -> Word8
    -- ^ /@coupledCount@/: the number of stereo streams
    -> Maybe (Ptr Word8)
    -- ^ /@channelMapping@/: the mapping between the streams
    -> m Gst.Caps.Caps
    -- ^ __Returns:__ The t'GI.Gst.Structs.Caps.Caps', or 'P.Nothing' if the parameters would lead to
    -- invalid Opus caps.
codecUtilsOpusCreateCaps :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32
-> Word8 -> Word8 -> Word8 -> Word8 -> Maybe (Ptr Word8) -> m Caps
codecUtilsOpusCreateCaps Word32
rate Word8
channels Word8
channelMappingFamily Word8
streamCount Word8
coupledCount Maybe (Ptr Word8)
channelMapping = IO Caps -> m Caps
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Caps -> m Caps) -> IO Caps -> m Caps
forall a b. (a -> b) -> a -> b
$ do
    Ptr Word8
maybeChannelMapping <- case Maybe (Ptr Word8)
channelMapping of
        Maybe (Ptr Word8)
Nothing -> Ptr Word8 -> IO (Ptr Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
forall a. Ptr a
nullPtr
        Just Ptr Word8
jChannelMapping -> do
            Ptr Word8 -> IO (Ptr Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Word8
jChannelMapping
    Ptr Caps
result <- Word32
-> Word8 -> Word8 -> Word8 -> Word8 -> Ptr Word8 -> IO (Ptr Caps)
gst_codec_utils_opus_create_caps Word32
rate Word8
channels Word8
channelMappingFamily Word8
streamCount Word8
coupledCount Ptr Word8
maybeChannelMapping
    Text -> Ptr Caps -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"codecUtilsOpusCreateCaps" Ptr Caps
result
    Caps
result' <- ((ManagedPtr Caps -> Caps) -> Ptr Caps -> IO Caps
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Caps -> Caps
Gst.Caps.Caps) Ptr Caps
result
    Caps -> IO Caps
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Caps
result'


-- function codec_utils_mpeg4video_get_profile
-- Args: [ Arg
--           { argCName = "vis_obj_seq"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the visual object\n  sequence for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_mpeg4video_get_profile" gst_codec_utils_mpeg4video_get_profile :: 
    Ptr Word8 ->                            -- vis_obj_seq : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the profile indication in the stream\'s visual object sequence into
-- a string. /@visObjSeq@/ is expected to be the data following the visual
-- object sequence start code. Only the first byte
-- (profile_and_level_indication) is used.
codecUtilsMpeg4videoGetProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@visObjSeq@/: Pointer to the visual object
    --   sequence for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The profile as a const string, or NULL if there is an error.
codecUtilsMpeg4videoGetProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsMpeg4videoGetProfile ByteString
visObjSeq = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
visObjSeq
    Ptr Word8
visObjSeq' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
visObjSeq
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_mpeg4video_get_profile Ptr Word8
visObjSeq' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
visObjSeq'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_mpeg4video_get_level
-- Args: [ Arg
--           { argCName = "vis_obj_seq"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the visual object\n  sequence for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_mpeg4video_get_level" gst_codec_utils_mpeg4video_get_level :: 
    Ptr Word8 ->                            -- vis_obj_seq : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the level indication in the stream\'s visual object sequence into
-- a string. /@visObjSeq@/ is expected to be the data following the visual
-- object sequence start code. Only the first byte
-- (profile_and_level_indication) is used.
codecUtilsMpeg4videoGetLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@visObjSeq@/: Pointer to the visual object
    --   sequence for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The level as a const string, or NULL if there is an error.
codecUtilsMpeg4videoGetLevel :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsMpeg4videoGetLevel ByteString
visObjSeq = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
visObjSeq
    Ptr Word8
visObjSeq' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
visObjSeq
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_mpeg4video_get_level Ptr Word8
visObjSeq' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
visObjSeq'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_mpeg4video_caps_set_level_and_profile
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GstCaps to which the level and profile are to be added"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "vis_obj_seq"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the visual object\n  sequence for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_mpeg4video_caps_set_level_and_profile" gst_codec_utils_mpeg4video_caps_set_level_and_profile :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Word8 ->                            -- vis_obj_seq : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CInt

-- | Sets the level and profile in /@caps@/ if it can be determined from
-- /@visObjSeq@/. See 'GI.GstPbutils.Functions.codecUtilsMpeg4videoGetLevel' and
-- 'GI.GstPbutils.Functions.codecUtilsMpeg4videoGetProfile' for more details on the
-- parameters.
codecUtilsMpeg4videoCapsSetLevelAndProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the t'GI.Gst.Structs.Caps.Caps' to which the level and profile are to be added
    -> ByteString
    -- ^ /@visObjSeq@/: Pointer to the visual object
    --   sequence for the stream.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the level and profile could be set, 'P.False' otherwise.
codecUtilsMpeg4videoCapsSetLevelAndProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> ByteString -> m Bool
codecUtilsMpeg4videoCapsSetLevelAndProfile Caps
caps ByteString
visObjSeq = IO Bool -> m Bool
forall a. IO a -> m a
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 len :: Word32
len = 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
visObjSeq
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    Ptr Word8
visObjSeq' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
visObjSeq
    CInt
result <- Ptr Caps -> Ptr Word8 -> Word32 -> IO CInt
gst_codec_utils_mpeg4video_caps_set_level_and_profile Ptr Caps
caps' Ptr Word8
visObjSeq' Word32
len
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
visObjSeq'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function codec_utils_h265_get_tier
-- Args: [ Arg
--           { argCName = "profile_tier_level"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the profile_tier_level\n  for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of the data available in @profile_tier_level."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of the data available in @profile_tier_level."
--                    , 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_codec_utils_h265_get_tier" gst_codec_utils_h265_get_tier :: 
    Ptr Word8 ->                            -- profile_tier_level : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the tier indication (general_tier_flag) in the stream\'s
-- profile_tier_level structure into a string. The profile_tier_level
-- is expected to have the same format as for 'GI.GstPbutils.Functions.codecUtilsH264GetProfile'.
-- 
-- /Since: 1.4/
codecUtilsH265GetTier ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@profileTierLevel@/: Pointer to the profile_tier_level
    --   for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The tier as a const string, or 'P.Nothing' if there is an error.
codecUtilsH265GetTier :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsH265GetTier ByteString
profileTierLevel = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
profileTierLevel
    Ptr Word8
profileTierLevel' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
profileTierLevel
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_h265_get_tier Ptr Word8
profileTierLevel' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
profileTierLevel'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_h265_get_profile
-- Args: [ Arg
--           { argCName = "profile_tier_level"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Pointer to the profile_tier_level\n  structure for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of the data available in @profile_tier_level"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of the data available in @profile_tier_level"
--                    , 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_codec_utils_h265_get_profile" gst_codec_utils_h265_get_profile :: 
    Ptr Word8 ->                            -- profile_tier_level : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the profile indication (general_profile_idc) in the stream\'s
-- profile_level_tier structure into a string. The profile_tier_level is
-- expected to have the following format, as defined in the H.265
-- specification. The profile_tier_level is viewed as a bitstream here,
-- with bit 0 being the most significant bit of the first byte.
-- 
-- * Bit 0:1   - general_profile_space
-- * Bit 2     - general_tier_flag
-- * Bit 3:7   - general_profile_idc
-- * Bit 8:39  - gernal_profile_compatibility_flags
-- * Bit 40    - general_progressive_source_flag
-- * Bit 41    - general_interlaced_source_flag
-- * Bit 42    - general_non_packed_constraint_flag
-- * Bit 43    - general_frame_only_constraint_flag
-- * Bit 44:87 - See below
-- * Bit 88:95 - general_level_idc
-- 
-- /Since: 1.4/
codecUtilsH265GetProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@profileTierLevel@/: Pointer to the profile_tier_level
    --   structure for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The profile as a const string, or 'P.Nothing' if there is an error.
codecUtilsH265GetProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsH265GetProfile ByteString
profileTierLevel = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
profileTierLevel
    Ptr Word8
profileTierLevel' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
profileTierLevel
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_h265_get_profile Ptr Word8
profileTierLevel' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
profileTierLevel'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_h265_get_level_idc
-- Args: [ Arg
--           { argCName = "level"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A level string from caps"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_h265_get_level_idc" gst_codec_utils_h265_get_level_idc :: 
    CString ->                              -- level : TBasicType TUTF8
    IO Word8

-- | Transform a level string from the caps into the level_idc
-- 
-- /Since: 1.4/
codecUtilsH265GetLevelIdc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@level@/: A level string from caps
    -> m Word8
    -- ^ __Returns:__ the level_idc or 0 if the level is unknown
codecUtilsH265GetLevelIdc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Word8
codecUtilsH265GetLevelIdc Text
level = IO Word8 -> m Word8
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    CString
level' <- Text -> IO CString
textToCString Text
level
    Word8
result <- CString -> IO Word8
gst_codec_utils_h265_get_level_idc CString
level'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
level'
    Word8 -> IO Word8
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result


-- function codec_utils_h265_get_level
-- Args: [ Arg
--           { argCName = "profile_tier_level"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the profile_tier_level\n  for the stream"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of the data available in @profile_tier_level."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of the data available in @profile_tier_level."
--                    , 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_codec_utils_h265_get_level" gst_codec_utils_h265_get_level :: 
    Ptr Word8 ->                            -- profile_tier_level : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the level indication (general_level_idc) in the stream\'s
-- profile_tier_level structure into a string. The profiel_tier_level is
-- expected to have the same format as for 'GI.GstPbutils.Functions.codecUtilsH264GetProfile'.
-- 
-- /Since: 1.4/
codecUtilsH265GetLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@profileTierLevel@/: Pointer to the profile_tier_level
    --   for the stream
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The level as a const string, or 'P.Nothing' if there is an error.
codecUtilsH265GetLevel :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsH265GetLevel ByteString
profileTierLevel = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
profileTierLevel
    Ptr Word8
profileTierLevel' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
profileTierLevel
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_h265_get_level Ptr Word8
profileTierLevel' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
profileTierLevel'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_h265_caps_set_level_tier_and_profile
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #GstCaps to which the level, tier and profile are to be added"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "profile_tier_level"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Pointer to the profile_tier_level\n  struct"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Length of the data available in @profile_tier_level."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "Length of the data available in @profile_tier_level."
--                    , 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_codec_utils_h265_caps_set_level_tier_and_profile" gst_codec_utils_h265_caps_set_level_tier_and_profile :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Word8 ->                            -- profile_tier_level : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CInt

-- | Sets the level, tier and profile in /@caps@/ if it can be determined from
-- /@profileTierLevel@/. See 'GI.GstPbutils.Functions.codecUtilsH265GetLevel',
-- 'GI.GstPbutils.Functions.codecUtilsH265GetTier' and 'GI.GstPbutils.Functions.codecUtilsH265GetProfile'
-- for more details on the parameters.
-- 
-- /Since: 1.4/
codecUtilsH265CapsSetLevelTierAndProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the t'GI.Gst.Structs.Caps.Caps' to which the level, tier and profile are to be added
    -> ByteString
    -- ^ /@profileTierLevel@/: Pointer to the profile_tier_level
    --   struct
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the level, tier, profile could be set, 'P.False' otherwise.
codecUtilsH265CapsSetLevelTierAndProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> ByteString -> m Bool
codecUtilsH265CapsSetLevelTierAndProfile Caps
caps ByteString
profileTierLevel = IO Bool -> m Bool
forall a. IO a -> m a
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 len :: Word32
len = 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
profileTierLevel
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    Ptr Word8
profileTierLevel' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
profileTierLevel
    CInt
result <- Ptr Caps -> Ptr Word8 -> Word32 -> IO CInt
gst_codec_utils_h265_caps_set_level_tier_and_profile Ptr Caps
caps' Ptr Word8
profileTierLevel' Word32
len
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
profileTierLevel'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function codec_utils_h264_get_profile_flags_level
-- Args: [ Arg
--           { argCName = "codec_data"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "H264 AVCC extradata"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of @codec_data"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "profile"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for h264 profile_idc or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "flags"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for h264 constraint set flags or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "level"
--           , argType = TBasicType TUInt8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location h264 level_idc or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "length of @codec_data"
--                    , 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_codec_utils_h264_get_profile_flags_level" gst_codec_utils_h264_get_profile_flags_level :: 
    Ptr Word8 ->                            -- codec_data : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    Ptr Word8 ->                            -- profile : TBasicType TUInt8
    Ptr Word8 ->                            -- flags : TBasicType TUInt8
    Ptr Word8 ->                            -- level : TBasicType TUInt8
    IO CInt

-- | Parses profile, flags, and level from a H264 AVCC extradata\/sequence_header.
-- These are most commonly retrieved from a video\/x-h264 caps with a codec_data
-- buffer.
-- 
-- The format of H264 AVCC extradata\/sequence_header is documented in the
-- ITU-T H.264 specification section 7.3.2.1.1 as well as in ISO\/IEC 14496-15
-- section 5.3.3.1.2.
-- 
-- /Since: 1.20/
codecUtilsH264GetProfileFlagsLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@codecData@/: H264 AVCC extradata
    -> m ((Bool, Word8, Word8, Word8))
    -- ^ __Returns:__ 'P.True' on success, 'P.False' on failure
codecUtilsH264GetProfileFlagsLevel :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Bool, Word8, Word8, Word8)
codecUtilsH264GetProfileFlagsLevel ByteString
codecData = IO (Bool, Word8, Word8, Word8) -> m (Bool, Word8, Word8, Word8)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Word8, Word8, Word8) -> m (Bool, Word8, Word8, Word8))
-> IO (Bool, Word8, Word8, Word8) -> m (Bool, Word8, Word8, Word8)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
codecData
    Ptr Word8
codecData' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
codecData
    Ptr Word8
profile <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
flags <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    Ptr Word8
level <- IO (Ptr Word8)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Word8)
    CInt
result <- Ptr Word8
-> Word32 -> Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> IO CInt
gst_codec_utils_h264_get_profile_flags_level Ptr Word8
codecData' Word32
len Ptr Word8
profile Ptr Word8
flags Ptr Word8
level
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Word8
profile' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
profile
    Word8
flags' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
flags
    Word8
level' <- Ptr Word8 -> IO Word8
forall a. Storable a => Ptr a -> IO a
peek Ptr Word8
level
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
codecData'
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
profile
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
flags
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
level
    (Bool, Word8, Word8, Word8) -> IO (Bool, Word8, Word8, Word8)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Word8
profile', Word8
flags', Word8
level')


-- function codec_utils_h264_get_profile
-- Args: [ Arg
--           { argCName = "sps"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the sequence parameter set for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_h264_get_profile" gst_codec_utils_h264_get_profile :: 
    Ptr Word8 ->                            -- sps : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the profile indication (profile_idc) in the stream\'s
-- sequence parameter set into a string. The SPS is expected to have the
-- following format, as defined in the H.264 specification. The SPS is viewed
-- as a bitstream here, with bit 0 being the most significant bit of the first
-- byte.
-- 
-- * Bit 0:7   - Profile indication
-- * Bit 8     - constraint_set0_flag
-- * Bit 9     - constraint_set1_flag
-- * Bit 10    - constraint_set2_flag
-- * Bit 11    - constraint_set3_flag
-- * Bit 12    - constraint_set3_flag
-- * Bit 13:15 - Reserved
-- * Bit 16:24 - Level indication
codecUtilsH264GetProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@sps@/: Pointer to the sequence parameter set for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The profile as a const string, or 'P.Nothing' if there is an error.
codecUtilsH264GetProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsH264GetProfile ByteString
sps = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
sps
    Ptr Word8
sps' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
sps
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_h264_get_profile Ptr Word8
sps' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
sps'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_h264_get_level_idc
-- Args: [ Arg
--           { argCName = "level"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A level string from caps"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_h264_get_level_idc" gst_codec_utils_h264_get_level_idc :: 
    CString ->                              -- level : TBasicType TUTF8
    IO Word8

-- | Transform a level string from the caps into the level_idc
codecUtilsH264GetLevelIdc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@level@/: A level string from caps
    -> m Word8
    -- ^ __Returns:__ the level_idc or 0 if the level is unknown
codecUtilsH264GetLevelIdc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Text -> m Word8
codecUtilsH264GetLevelIdc Text
level = IO Word8 -> m Word8
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    CString
level' <- Text -> IO CString
textToCString Text
level
    Word8
result <- CString -> IO Word8
gst_codec_utils_h264_get_level_idc CString
level'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
level'
    Word8 -> IO Word8
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result


-- function codec_utils_h264_get_level
-- Args: [ Arg
--           { argCName = "sps"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the sequence parameter set for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_h264_get_level" gst_codec_utils_h264_get_level :: 
    Ptr Word8 ->                            -- sps : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Converts the level indication (level_idc) in the stream\'s
-- sequence parameter set into a string. The SPS is expected to have the
-- same format as for 'GI.GstPbutils.Functions.codecUtilsH264GetProfile'.
codecUtilsH264GetLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@sps@/: Pointer to the sequence parameter set for the stream.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The level as a const string, or 'P.Nothing' if there is an error.
codecUtilsH264GetLevel :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsH264GetLevel ByteString
sps = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
sps
    Ptr Word8
sps' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
sps
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_h264_get_level Ptr Word8
sps' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
sps'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_h264_caps_set_level_and_profile
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the #GstCaps to which the level and profile are to be added"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sps"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "Pointer to the sequence parameter set for the stream."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of the data available in @sps."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of the data available in @sps."
--                    , 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_codec_utils_h264_caps_set_level_and_profile" gst_codec_utils_h264_caps_set_level_and_profile :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Word8 ->                            -- sps : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CInt

-- | Sets the level and profile in /@caps@/ if it can be determined from /@sps@/. See
-- 'GI.GstPbutils.Functions.codecUtilsH264GetLevel' and 'GI.GstPbutils.Functions.codecUtilsH264GetProfile'
-- for more details on the parameters.
codecUtilsH264CapsSetLevelAndProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the t'GI.Gst.Structs.Caps.Caps' to which the level and profile are to be added
    -> ByteString
    -- ^ /@sps@/: Pointer to the sequence parameter set for the stream.
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the level and profile could be set, 'P.False' otherwise.
codecUtilsH264CapsSetLevelAndProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> ByteString -> m Bool
codecUtilsH264CapsSetLevelAndProfile Caps
caps ByteString
sps = IO Bool -> m Bool
forall a. IO a -> m a
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 len :: Word32
len = 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
sps
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    Ptr Word8
sps' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
sps
    CInt
result <- Ptr Caps -> Ptr Word8 -> Word32 -> IO CInt
gst_codec_utils_h264_caps_set_level_and_profile Ptr Caps
caps' Ptr Word8
sps' Word32
len
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
sps'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function codec_utils_caps_get_mime_codec
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "A #GstCaps to convert to mime codec"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_caps_get_mime_codec" gst_codec_utils_caps_get_mime_codec :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    IO CString

-- | Converts /@caps@/ to a RFC 6381 compatible codec string if possible.
-- 
-- Useful for providing the \'codecs\' field inside the \'Content-Type\' HTTP
-- header for containerized formats, such as mp4 or matroska.
-- 
-- Registered codecs can be found at http:\/\/mp4ra.org\/#\/codecs
-- 
-- /Since: 1.20/
codecUtilsCapsGetMimeCodec ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: A t'GI.Gst.Structs.Caps.Caps' to convert to mime codec
    -> m (Maybe T.Text)
    -- ^ __Returns:__ a RFC 6381 compatible codec string or 'P.Nothing'
codecUtilsCapsGetMimeCodec :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> m (Maybe Text)
codecUtilsCapsGetMimeCodec Caps
caps = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    CString
result <- Ptr Caps -> IO CString
gst_codec_utils_caps_get_mime_codec Ptr Caps
caps'
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_aac_get_sample_rate_from_index
-- Args: [ Arg
--           { argCName = "sr_idx"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Sample rate index as from the AudioSpecificConfig (MPEG-4\n         container) or ADTS frame header"
--                 , 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_codec_utils_aac_get_sample_rate_from_index" gst_codec_utils_aac_get_sample_rate_from_index :: 
    Word32 ->                               -- sr_idx : TBasicType TUInt
    IO Word32

-- | Translates the sample rate index found in AAC headers to the actual sample
-- rate.
codecUtilsAacGetSampleRateFromIndex ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@srIdx@/: Sample rate index as from the AudioSpecificConfig (MPEG-4
    --          container) or ADTS frame header
    -> m Word32
    -- ^ __Returns:__ The sample rate if /@srIdx@/ is valid, 0 otherwise.
codecUtilsAacGetSampleRateFromIndex :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> m Word32
codecUtilsAacGetSampleRateFromIndex Word32
srIdx = IO Word32 -> m Word32
forall a. IO a -> m a
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
    Word32
result <- Word32 -> IO Word32
gst_codec_utils_aac_get_sample_rate_from_index Word32
srIdx
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function codec_utils_aac_get_sample_rate
-- Args: [ Arg
--           { argCName = "audio_config"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a pointer to the AudioSpecificConfig\n               as specified in the Elementary Stream Descriptor (esds)\n               in ISO/IEC 14496-1."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @audio_config"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @audio_config"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_aac_get_sample_rate" gst_codec_utils_aac_get_sample_rate :: 
    Ptr Word8 ->                            -- audio_config : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO Word32

-- | Translates the sample rate index found in AAC headers to the actual sample
-- rate.
-- 
-- /Since: 1.10/
codecUtilsAacGetSampleRate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@audioConfig@/: a pointer to the AudioSpecificConfig
    --                as specified in the Elementary Stream Descriptor (esds)
    --                in ISO\/IEC 14496-1.
    -> m Word32
    -- ^ __Returns:__ The sample rate if sr_idx is valid, 0 otherwise.
codecUtilsAacGetSampleRate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m Word32
codecUtilsAacGetSampleRate ByteString
audioConfig = IO Word32 -> m Word32
forall a. IO a -> m a
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
    let len :: Word32
len = 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
audioConfig
    Ptr Word8
audioConfig' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
audioConfig
    Word32
result <- Ptr Word8 -> Word32 -> IO Word32
gst_codec_utils_aac_get_sample_rate Ptr Word8
audioConfig' Word32
len
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
audioConfig'
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function codec_utils_aac_get_profile
-- Args: [ Arg
--           { argCName = "audio_config"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a pointer to the AudioSpecificConfig\n               as specified in the Elementary Stream Descriptor (esds)\n               in ISO/IEC 14496-1."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @audio_config in bytes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @audio_config in bytes"
--                    , 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_codec_utils_aac_get_profile" gst_codec_utils_aac_get_profile :: 
    Ptr Word8 ->                            -- audio_config : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Returns the profile of the given AAC stream as a string. The profile is
-- normally determined using the AudioObjectType field which is in the first
-- 5 bits of /@audioConfig@/
codecUtilsAacGetProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@audioConfig@/: a pointer to the AudioSpecificConfig
    --                as specified in the Elementary Stream Descriptor (esds)
    --                in ISO\/IEC 14496-1.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The profile as a const string and 'P.Nothing' if the profile could not be
    -- determined.
codecUtilsAacGetProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsAacGetProfile ByteString
audioConfig = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
audioConfig
    Ptr Word8
audioConfig' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
audioConfig
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_aac_get_profile Ptr Word8
audioConfig' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
audioConfig'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_aac_get_level
-- Args: [ Arg
--           { argCName = "audio_config"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a pointer to the AudioSpecificConfig\n               as specified in the Elementary Stream Descriptor (esds)\n               in ISO/IEC 14496-1."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @audio_config in bytes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @audio_config in bytes"
--                    , 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_codec_utils_aac_get_level" gst_codec_utils_aac_get_level :: 
    Ptr Word8 ->                            -- audio_config : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CString

-- | Determines the level of a stream as defined in ISO\/IEC 14496-3. For AAC LC
-- streams, the constraints from the AAC audio profile are applied. For AAC
-- Main, LTP, SSR and others, the Main profile is used.
-- 
-- The /@audioConfig@/ parameter follows the following format, starting from the
-- most significant bit of the first byte:
-- 
--   * Bit 0:4 contains the AudioObjectType (if this is 0x5, then the
--     real AudioObjectType is carried after the rate and channel data)
--   * Bit 5:8 contains the sample frequency index (if this is 0xf, then the
--     next 24 bits define the actual sample frequency, and subsequent
--     fields are appropriately shifted).
--   * Bit 9:12 contains the channel configuration
codecUtilsAacGetLevel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@audioConfig@/: a pointer to the AudioSpecificConfig
    --                as specified in the Elementary Stream Descriptor (esds)
    --                in ISO\/IEC 14496-1.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ The level as a const string and 'P.Nothing' if the level could not be
    -- determined.
codecUtilsAacGetLevel :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m (Maybe Text)
codecUtilsAacGetLevel ByteString
audioConfig = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    let len :: Word32
len = 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
audioConfig
    Ptr Word8
audioConfig' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
audioConfig
    CString
result <- Ptr Word8 -> Word32 -> IO CString
gst_codec_utils_aac_get_level Ptr Word8
audioConfig' Word32
len
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
audioConfig'
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function codec_utils_aac_get_index_from_sample_rate
-- Args: [ Arg
--           { argCName = "rate"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Sample rate" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_aac_get_index_from_sample_rate" gst_codec_utils_aac_get_index_from_sample_rate :: 
    Word32 ->                               -- rate : TBasicType TUInt
    IO Int32

-- | Translates the sample rate to the index corresponding to it in AAC spec.
codecUtilsAacGetIndexFromSampleRate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    -- ^ /@rate@/: Sample rate
    -> m Int32
    -- ^ __Returns:__ The AAC index for this sample rate, -1 if the rate is not a
    -- valid AAC sample rate.
codecUtilsAacGetIndexFromSampleRate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Word32 -> m Int32
codecUtilsAacGetIndexFromSampleRate Word32
rate = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- Word32 -> IO Int32
gst_codec_utils_aac_get_index_from_sample_rate Word32
rate
    Int32 -> IO Int32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function codec_utils_aac_get_channels
-- Args: [ Arg
--           { argCName = "audio_config"
--           , argType = TCArray False (-1) 1 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a pointer to the AudioSpecificConfig\n               as specified in the Elementary Stream Descriptor (esds)\n               in ISO/IEC 14496-1."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @audio_config in bytes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @audio_config in bytes"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gst_codec_utils_aac_get_channels" gst_codec_utils_aac_get_channels :: 
    Ptr Word8 ->                            -- audio_config : TCArray False (-1) 1 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO Word32

-- | Returns the channels of the given AAC stream.
-- 
-- /Since: 1.10/
codecUtilsAacGetChannels ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    ByteString
    -- ^ /@audioConfig@/: a pointer to the AudioSpecificConfig
    --                as specified in the Elementary Stream Descriptor (esds)
    --                in ISO\/IEC 14496-1.
    -> m Word32
    -- ^ __Returns:__ The channels or 0 if the channel could not be determined.
codecUtilsAacGetChannels :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
ByteString -> m Word32
codecUtilsAacGetChannels ByteString
audioConfig = IO Word32 -> m Word32
forall a. IO a -> m a
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
    let len :: Word32
len = 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
audioConfig
    Ptr Word8
audioConfig' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
audioConfig
    Word32
result <- Ptr Word8 -> Word32 -> IO Word32
gst_codec_utils_aac_get_channels Ptr Word8
audioConfig' Word32
len
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
audioConfig'
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
result


-- function codec_utils_aac_caps_set_level_and_profile
-- Args: [ Arg
--           { argCName = "caps"
--           , argType = TInterface Name { namespace = "Gst" , name = "Caps" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the #GstCaps to which level and profile fields are to be added"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "audio_config"
--           , argType = TCArray False (-1) 2 (TBasicType TUInt8)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a pointer to the AudioSpecificConfig\n               as specified in the Elementary Stream Descriptor (esds)\n               in ISO/IEC 14496-1. (See below for more details)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "len"
--           , argType = TBasicType TUInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Length of @audio_config in bytes"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "len"
--              , argType = TBasicType TUInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "Length of @audio_config 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_codec_utils_aac_caps_set_level_and_profile" gst_codec_utils_aac_caps_set_level_and_profile :: 
    Ptr Gst.Caps.Caps ->                    -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
    Ptr Word8 ->                            -- audio_config : TCArray False (-1) 2 (TBasicType TUInt8)
    Word32 ->                               -- len : TBasicType TUInt
    IO CInt

-- | Sets the level and profile on /@caps@/ if it can be determined from
-- /@audioConfig@/. See 'GI.GstPbutils.Functions.codecUtilsAacGetLevel' and
-- 'GI.GstPbutils.Functions.codecUtilsAacGetProfile' for more details on the parameters.
-- /@caps@/ must be audio\/mpeg caps with an \"mpegversion\" field of either 2 or 4.
-- If mpegversion is 4, the \"base-profile\" field is also set in /@caps@/.
codecUtilsAacCapsSetLevelAndProfile ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Gst.Caps.Caps
    -- ^ /@caps@/: the t'GI.Gst.Structs.Caps.Caps' to which level and profile fields are to be added
    -> ByteString
    -- ^ /@audioConfig@/: a pointer to the AudioSpecificConfig
    --                as specified in the Elementary Stream Descriptor (esds)
    --                in ISO\/IEC 14496-1. (See below for more details)
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the level and profile could be set, 'P.False' otherwise.
codecUtilsAacCapsSetLevelAndProfile :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Caps -> ByteString -> m Bool
codecUtilsAacCapsSetLevelAndProfile Caps
caps ByteString
audioConfig = IO Bool -> m Bool
forall a. IO a -> m a
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 len :: Word32
len = 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
audioConfig
    Ptr Caps
caps' <- Caps -> IO (Ptr Caps)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Caps
caps
    Ptr Word8
audioConfig' <- ByteString -> IO (Ptr Word8)
packByteString ByteString
audioConfig
    CInt
result <- Ptr Caps -> Ptr Word8 -> Word32 -> IO CInt
gst_codec_utils_aac_caps_set_level_and_profile Ptr Caps
caps' Ptr Word8
audioConfig' Word32
len
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Caps -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Caps
caps
    Ptr Word8 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Word8
audioConfig'
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'